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)
52 return ELEMENT_CONFIGTYPE;
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, "check") == 0)
82 else if (strcmp (name, "servicehelper") == 0)
84 return ELEMENT_SERVICEHELPER;
86 else if (strcmp (name, "includedir") == 0)
88 return ELEMENT_INCLUDEDIR;
90 else if (strcmp (name, "standard_session_servicedirs") == 0)
92 return ELEMENT_STANDARD_SESSION_SERVICEDIRS;
94 else if (strcmp (name, "standard_system_servicedirs") == 0)
96 return ELEMENT_STANDARD_SYSTEM_SERVICEDIRS;
98 else if (strcmp (name, "servicedir") == 0)
100 return ELEMENT_SERVICEDIR;
102 else if (strcmp (name, "include") == 0)
104 return ELEMENT_INCLUDE;
106 else if (strcmp (name, "policy") == 0)
108 return ELEMENT_POLICY;
110 else if (strcmp (name, "limit") == 0)
112 return ELEMENT_LIMIT;
114 else if (strcmp (name, "selinux") == 0)
116 return ELEMENT_SELINUX;
118 else if (strcmp (name, "associate") == 0)
120 return ELEMENT_ASSOCIATE;
122 else if (strcmp (name, "syslog") == 0)
124 return ELEMENT_SYSLOG;
126 else if (strcmp (name, "keep_umask") == 0)
128 return ELEMENT_KEEP_UMASK;
130 else if (strcmp (name, "allow_anonymous") == 0)
132 return ELEMENT_ALLOW_ANONYMOUS;
134 else if (strcmp (name, "apparmor") == 0)
136 return ELEMENT_APPARMOR;
142 bus_config_parser_element_type_to_name (ElementType type)
148 case ELEMENT_BUSCONFIG:
150 case ELEMENT_INCLUDE:
170 case ELEMENT_PIDFILE:
172 case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
173 return "standard_session_servicedirs";
174 case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS:
175 return "standard_system_servicedirs";
176 case ELEMENT_SERVICEDIR:
178 case ELEMENT_SERVICEHELPER:
179 return "servicehelper";
180 case ELEMENT_INCLUDEDIR:
182 case ELEMENT_CONFIGTYPE:
184 case ELEMENT_SELINUX:
186 case ELEMENT_ASSOCIATE:
190 case ELEMENT_KEEP_UMASK:
192 case ELEMENT_ALLOW_ANONYMOUS:
193 return "allow_anonymous";
194 case ELEMENT_APPARMOR:
198 _dbus_assert_not_reached ("bad element type");