5 * conffile.h Defines for the conffile parsing routines.
15 * Export the minimum amount of information about these structs
17 typedef struct conf_item CONF_ITEM;
18 typedef struct conf_pair CONF_PAIR;
19 typedef struct conf_part CONF_SECTION;
22 * Instead of putting the information into a configuration structure,
23 * the configuration file routines MAY just parse it directly into
24 * user-supplied variables.
26 #define PW_TYPE_STRING_PTR 100
27 #define PW_TYPE_BOOLEAN 101
28 #define PW_TYPE_SUBSECTION 102
30 typedef struct CONF_PARSER {
32 int type; /* PW_TYPE_STRING, etc. */
33 size_t offset; /* relative pointer within "base" */
34 void *data; /* absolute pointer if base is NULL */
35 const char *dflt; /* default as it would appear in radiusd.conf */
38 /* This preprocessor trick will be useful in initializing CONF_PARSER struct */
39 #define XStringify(x) #x
40 #define Stringify(x) XStringify(x)
41 /* And this pointer trick too */
43 # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
46 void cf_pair_free(CONF_PAIR **cp);
47 void cf_section_free(CONF_SECTION **cp);
48 int cf_section_parse(CONF_SECTION *cs, void *base, const CONF_PARSER *variables);
50 CONF_SECTION *conf_read(const char *fromfile, int fromline,
51 const char *conffile, CONF_SECTION *parent);
54 CONF_PAIR *cf_pair_find(CONF_SECTION *section, const char *name);
55 CONF_PAIR *cf_pair_find_next(CONF_SECTION *section, CONF_PAIR *pair, const char *name);
56 CONF_SECTION *cf_section_find(const char *name);
57 CONF_SECTION *cf_section_sub_find(CONF_SECTION *section, const char *name);
58 char *cf_section_value_find(CONF_SECTION *section, const char *attr);
60 char *cf_pair_attr(CONF_PAIR *pair);
61 char *cf_pair_value(CONF_PAIR *pair);
62 char *cf_section_name1(CONF_SECTION *section);
63 char *cf_section_name2(CONF_SECTION *section);
64 int dump_config(void);
65 CONF_SECTION *cf_subsection_find_next(CONF_SECTION *section,
66 CONF_SECTION *subsection,
68 int cf_section_lineno(CONF_SECTION *section);
69 int cf_pair_lineno(CONF_PAIR *pair);
70 CONF_ITEM *cf_item_find_next(CONF_SECTION *section, CONF_ITEM *item);
71 int cf_item_is_section(CONF_ITEM *item);
72 CONF_PAIR *cf_itemtopair(CONF_ITEM *item);
73 CONF_SECTION *cf_itemtosection(CONF_ITEM *item);
74 CONF_ITEM *cf_pairtoitem(CONF_PAIR *cp);
75 CONF_ITEM *cf_sectiontoitem(CONF_SECTION *cs);
76 #endif /* _CONFFILE_H */