os/ossrv/ofdbus/dbus/bus/config-parser.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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  * Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     6  * Licensed under the Academic Free License version 2.1
     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 #ifndef __SYMBIAN32__
    28 #include <config.h>
    29 #endif // __SYMBIAN32__
    30 
    31 #include <dbus/dbus.h>
    32 
    33 #ifndef __SYMBIAN32__
    34 #include <dbus/dbus-string.h>
    35 #include <dbus/dbus-list.h>
    36 #include <dbus/dbus-hash.h>
    37 #else
    38 #include "dbus-string.h"
    39 #include "dbus-list.h"
    40 #include "dbus-hash.h"
    41 #endif //__SYMBIAN32__
    42 #include "bus.h"
    43 
    44 /* Whatever XML library we're using just pushes data into this API */
    45 
    46 typedef struct BusConfigParser BusConfigParser;
    47 
    48 BusConfigParser* bus_config_parser_new (const DBusString      *basedir,
    49                                         dbus_bool_t            is_toplevel,
    50                                         const BusConfigParser *parent);
    51 
    52 BusConfigParser* bus_config_parser_ref           (BusConfigParser   *parser);
    53 void             bus_config_parser_unref         (BusConfigParser   *parser);
    54 dbus_bool_t      bus_config_parser_check_doctype (BusConfigParser   *parser,
    55                                                   const char        *doctype,
    56                                                   DBusError         *error);
    57 dbus_bool_t      bus_config_parser_start_element (BusConfigParser   *parser,
    58                                                   const char        *element_name,
    59                                                   const char       **attribute_names,
    60                                                   const char       **attribute_values,
    61                                                   DBusError         *error);
    62 dbus_bool_t      bus_config_parser_end_element   (BusConfigParser   *parser,
    63                                                   const char        *element_name,
    64                                                   DBusError         *error);
    65 dbus_bool_t      bus_config_parser_content       (BusConfigParser   *parser,
    66                                                   const DBusString  *content,
    67                                                   DBusError         *error);
    68 dbus_bool_t      bus_config_parser_finished      (BusConfigParser   *parser,
    69                                                   DBusError         *error);
    70 
    71 /* Functions for extracting the parse results */
    72 const char* bus_config_parser_get_user         (BusConfigParser *parser);
    73 const char* bus_config_parser_get_type         (BusConfigParser *parser);
    74 DBusList**  bus_config_parser_get_addresses    (BusConfigParser *parser);
    75 DBusList**  bus_config_parser_get_mechanisms   (BusConfigParser *parser);
    76 dbus_bool_t bus_config_parser_get_fork         (BusConfigParser *parser);
    77 const char* bus_config_parser_get_pidfile      (BusConfigParser *parser);
    78 DBusList**  bus_config_parser_get_service_dirs (BusConfigParser *parser);
    79 DBusList**  bus_config_parser_get_conf_dirs    (BusConfigParser *parser);
    80 BusPolicy*  bus_config_parser_steal_policy     (BusConfigParser *parser);
    81 void        bus_config_parser_get_limits       (BusConfigParser *parser,
    82                                                 BusLimits       *limits);
    83 
    84 DBusHashTable* bus_config_parser_steal_service_context_table (BusConfigParser *parser);
    85 
    86 /* Loader functions (backended off one of the XML parsers).  Returns a
    87  * finished ConfigParser.
    88  */
    89 BusConfigParser* bus_config_load (const DBusString      *file,
    90                                   dbus_bool_t            is_toplevel,
    91                                   const BusConfigParser *parent,
    92                                   DBusError             *error);
    93 
    94 #endif /* BUS_CONFIG_PARSER_H */