1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* config-parser-common.c Common defines and routines for config file parsing
4 * Copyright (C) 2007 Red Hat, Inc.
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <dbus/dbus-internals.h>
28 #include "config-parser-common.h"
32 bus_config_parser_element_name_to_type (const char *name)
34 if (strcmp (name, "none") == 0)
38 else if (strcmp (name, "busconfig") == 0)
40 return ELEMENT_BUSCONFIG;
42 else if (strcmp (name, "user") == 0)
46 else if (strcmp (name, "auth") == 0)
50 else if (strcmp (name, "type") == 0)
54 else if (strcmp (name, "fork") == 0)
58 else if (strcmp (name, "pidfile") == 0)
60 return ELEMENT_PIDFILE;
62 else if (strcmp (name, "listen") == 0)
64 return ELEMENT_LISTEN;
66 else if (strcmp (name, "auth") == 0)
70 else if (strcmp (name, "allow") == 0)
74 else if (strcmp (name, "deny") == 0)
78 else if (strcmp (name, "servicehelper") == 0)
80 return ELEMENT_SERVICEHELPER;
82 else if (strcmp (name, "includedir") == 0)
84 return ELEMENT_INCLUDEDIR;
86 else if (strcmp (name, "standard_session_servicedirs") == 0)
88 return ELEMENT_STANDARD_SESSION_SERVICEDIRS;
90 else if (strcmp (name, "standard_system_servicedirs") == 0)
92 return ELEMENT_STANDARD_SYSTEM_SERVICEDIRS;
94 else if (strcmp (name, "servicedir") == 0)
96 return ELEMENT_SERVICEDIR;
98 else if (strcmp (name, "include") == 0)
100 return ELEMENT_INCLUDE;
102 else if (strcmp (name, "policy") == 0)
104 return ELEMENT_POLICY;
106 else if (strcmp (name, "limit") == 0)
108 return ELEMENT_LIMIT;
110 else if (strcmp (name, "selinux") == 0)
112 return ELEMENT_SELINUX;
114 else if (strcmp (name, "associate") == 0)
116 return ELEMENT_ASSOCIATE;
118 else if (strcmp (name, "syslog") == 0)
120 return ELEMENT_SYSLOG;
122 else if (strcmp (name, "keep_umask") == 0)
124 return ELEMENT_KEEP_UMASK;
126 else if (strcmp (name, "allow_anonymous") == 0)
128 return ELEMENT_ALLOW_ANONYMOUS;
134 bus_config_parser_element_type_to_name (ElementType type)
140 case ELEMENT_BUSCONFIG:
142 case ELEMENT_INCLUDE:
160 case ELEMENT_PIDFILE:
162 case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
163 return "standard_session_servicedirs";
164 case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS:
165 return "standard_system_servicedirs";
166 case ELEMENT_SERVICEDIR:
168 case ELEMENT_SERVICEHELPER:
169 return "servicehelper";
170 case ELEMENT_INCLUDEDIR:
174 case ELEMENT_SELINUX:
176 case ELEMENT_ASSOCIATE:
180 case ELEMENT_KEEP_UMASK:
182 case ELEMENT_ALLOW_ANONYMOUS:
183 return "allow_anonymous";
186 _dbus_assert_not_reached ("bad element type");