added BOOLEAN type (yes/no) to the configuration parser
[freeradius.git] / src / include / conffile.h
1 #ifndef _CONFFILE_H
2 #define _CONFFILE_H
3
4 /*
5  * conffile.h   Defines for the conffile parsing routines.
6  *
7  * Version:     $Id$
8  *
9  */
10
11 #include "token.h"
12
13 typedef struct conf_pair {
14         char                    *attr;
15         char                    *value;
16         int                     operator;
17         struct conf_pair        *next;
18 } CONF_PAIR;
19
20 typedef struct conf_part {
21         char                    *name1;
22         char                    *name2;
23         CONF_PAIR               *cps;
24         struct conf_part        *sub;
25         struct conf_part        *next;
26 } CONF_SECTION;
27
28 /*
29  *  Instead of putting the information into a configuration structure,
30  *  the configuration file routines MAY just parse it directly into
31  *  user-supplied variables.
32  */
33 #define PW_TYPE_STRING_PTR      100
34 #define PW_TYPE_BOOLEAN         101
35
36 typedef struct CONF_PARSER {
37   const char *name;
38   int type;                     /* PW_TYPE_STRING, etc. */
39   void *data;                   /* pointer to where to put it */
40 } CONF_PARSER;
41
42 CONF_SECTION    *conf_read(const char *conffile, const CONF_PARSER vars[]);
43 CONF_PAIR       *cf_pair_alloc(const char *attr, const char *value, int operator);
44 void            cf_pair_add(CONF_SECTION *cs, CONF_PAIR *cp_new);
45 void            cf_pair_free(CONF_PAIR *cp);
46 CONF_SECTION    *cf_section_alloc(const char *name1, const char *name2);
47 void            cf_section_free(CONF_SECTION *cp);
48 void            cf_section_free_all(CONF_SECTION *cp);
49 int             cf_section_parse(CONF_SECTION *cs, const CONF_PARSER *variables);
50
51 /* JLN -- Newly added */
52                 
53 CONF_PAIR       *cf_pair_find(CONF_SECTION *section, const char *name);
54 CONF_PAIR       *cf_pair_find_next(CONF_SECTION *section, CONF_PAIR *pair, const char *name);
55 CONF_SECTION    *cf_section_find(const char *name);
56 CONF_SECTION    *cf_section_sub_find(CONF_SECTION *section, const char *name);
57 CONF_SECTION    *cf_module_config_find(const char *modulename);
58 char            *cf_section_value_find(CONF_SECTION *section, const char *attr);
59
60 int             read_radius_conf_file(void);
61
62 #endif /* _CONFFILE_H */