2004-04-09 Jon Trowbridge <trow@ximian.com>
[platform/upstream/dbus.git] / bus / config-parser.h
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* config-parser.h  XML-library-agnostic configuration file parser
3  *
4  * Copyright (C) 2003 Red Hat, Inc.
5  *
6  * Licensed under the Academic Free License version 2.0
7  * 
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.
12  *
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.
17  * 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  */
23
24 #ifndef BUS_CONFIG_PARSER_H
25 #define BUS_CONFIG_PARSER_H
26
27 #include <config.h>
28
29 #include <dbus/dbus.h>
30 #include <dbus/dbus-string.h>
31 #include <dbus/dbus-list.h>
32 #include "bus.h"
33
34 /* Whatever XML library we're using just pushes data into this API */
35
36 typedef struct BusConfigParser BusConfigParser;
37
38 BusConfigParser* bus_config_parser_new (const DBusString      *basedir,
39                                         dbus_bool_t            is_toplevel,
40                                         const BusConfigParser *parent);
41
42 BusConfigParser* bus_config_parser_ref           (BusConfigParser   *parser);
43 void             bus_config_parser_unref         (BusConfigParser   *parser);
44 dbus_bool_t      bus_config_parser_check_doctype (BusConfigParser   *parser,
45                                                   const char        *doctype,
46                                                   DBusError         *error);
47 dbus_bool_t      bus_config_parser_start_element (BusConfigParser   *parser,
48                                                   const char        *element_name,
49                                                   const char       **attribute_names,
50                                                   const char       **attribute_values,
51                                                   DBusError         *error);
52 dbus_bool_t      bus_config_parser_end_element   (BusConfigParser   *parser,
53                                                   const char        *element_name,
54                                                   DBusError         *error);
55 dbus_bool_t      bus_config_parser_content       (BusConfigParser   *parser,
56                                                   const DBusString  *content,
57                                                   DBusError         *error);
58 dbus_bool_t      bus_config_parser_finished      (BusConfigParser   *parser,
59                                                   DBusError         *error);
60
61 /* Functions for extracting the parse results */
62 const char* bus_config_parser_get_user         (BusConfigParser *parser);
63 const char* bus_config_parser_get_type         (BusConfigParser *parser);
64 DBusList**  bus_config_parser_get_addresses    (BusConfigParser *parser);
65 DBusList**  bus_config_parser_get_mechanisms   (BusConfigParser *parser);
66 dbus_bool_t bus_config_parser_get_fork         (BusConfigParser *parser);
67 const char* bus_config_parser_get_pidfile      (BusConfigParser *parser);
68 DBusList**  bus_config_parser_get_service_dirs (BusConfigParser *parser);
69 BusPolicy*  bus_config_parser_steal_policy     (BusConfigParser *parser);
70 void        bus_config_parser_get_limits       (BusConfigParser *parser,
71                                                 BusLimits       *limits);
72
73 /* Loader functions (backended off one of the XML parsers).  Returns a
74  * finished ConfigParser.
75  */
76 BusConfigParser* bus_config_load (const DBusString      *file,
77                                   dbus_bool_t            is_toplevel,
78                                   const BusConfigParser *parent,
79                                   DBusError             *error);
80
81
82 #endif /* BUS_CONFIG_PARSER_H */