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
24 #include <dbus/dbus-internals.h>
27 #include "config-parser-common.h"
31 bus_config_parser_element_name_to_type (const char *name)
33 if (strcmp (name, "none") == 0)
37 else if (strcmp (name, "busconfig") == 0)
39 return ELEMENT_BUSCONFIG;
41 else if (strcmp (name, "user") == 0)
45 else if (strcmp (name, "auth") == 0)
49 else if (strcmp (name, "type") == 0)
53 else if (strcmp (name, "fork") == 0)
57 else if (strcmp (name, "pidfile") == 0)
59 return ELEMENT_PIDFILE;
61 else if (strcmp (name, "listen") == 0)
63 return ELEMENT_LISTEN;
65 else if (strcmp (name, "auth") == 0)
69 else if (strcmp (name, "allow") == 0)
73 else if (strcmp (name, "deny") == 0)
77 else if (strcmp (name, "servicehelper") == 0)
79 return ELEMENT_SERVICEHELPER;
81 else if (strcmp (name, "includedir") == 0)
83 return ELEMENT_INCLUDEDIR;
85 else if (strcmp (name, "standard_session_servicedirs") == 0)
87 return ELEMENT_STANDARD_SESSION_SERVICEDIRS;
89 else if (strcmp (name, "standard_system_servicedirs") == 0)
91 return ELEMENT_STANDARD_SYSTEM_SERVICEDIRS;
93 else if (strcmp (name, "servicedir") == 0)
95 return ELEMENT_SERVICEDIR;
97 else if (strcmp (name, "include") == 0)
99 return ELEMENT_INCLUDE;
101 else if (strcmp (name, "policy") == 0)
103 return ELEMENT_POLICY;
105 else if (strcmp (name, "limit") == 0)
107 return ELEMENT_LIMIT;
109 else if (strcmp (name, "selinux") == 0)
111 return ELEMENT_SELINUX;
113 else if (strcmp (name, "associate") == 0)
115 return ELEMENT_ASSOCIATE;
117 else if (strcmp (name, "syslog") == 0)
119 return ELEMENT_SYSLOG;
121 else if (strcmp (name, "keep_umask") == 0)
123 return ELEMENT_KEEP_UMASK;
125 else if (strcmp (name, "allow_anonymous") == 0)
127 return ELEMENT_ALLOW_ANONYMOUS;
133 bus_config_parser_element_type_to_name (ElementType type)
139 case ELEMENT_BUSCONFIG:
141 case ELEMENT_INCLUDE:
159 case ELEMENT_PIDFILE:
161 case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
162 return "standard_session_servicedirs";
163 case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS:
164 return "standard_system_servicedirs";
165 case ELEMENT_SERVICEDIR:
167 case ELEMENT_SERVICEHELPER:
168 return "servicehelper";
169 case ELEMENT_INCLUDEDIR:
173 case ELEMENT_SELINUX:
175 case ELEMENT_ASSOCIATE:
179 case ELEMENT_KEEP_UMASK:
181 case ELEMENT_ALLOW_ANONYMOUS:
182 return "allow_anonymous";
185 _dbus_assert_not_reached ("bad element type");