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;
20 typedef struct conf_data CONF_DATA;
23 * Instead of putting the information into a configuration structure,
24 * the configuration file routines MAY just parse it directly into
25 * user-supplied variables.
27 #define PW_TYPE_STRING_PTR 100
28 #define PW_TYPE_BOOLEAN 101
29 #define PW_TYPE_SUBSECTION 102
31 typedef struct CONF_PARSER {
33 int type; /* PW_TYPE_STRING, etc. */
34 size_t offset; /* relative pointer within "base" */
35 void *data; /* absolute pointer if base is NULL */
36 const char *dflt; /* default as it would appear in radiusd.conf */
39 /* This preprocessor trick will be useful in initializing CONF_PARSER struct */
40 #define XStringify(x) #x
41 #define Stringify(x) XStringify(x)
42 /* And this pointer trick too */
44 # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
47 void cf_pair_free(CONF_PAIR **cp);
48 void cf_section_free(CONF_SECTION **cp);
49 int cf_item_parse(const CONF_SECTION *cs, const char *name,
50 int type, void *data, const char *dflt);
51 int cf_section_parse(const CONF_SECTION *, void *base, const CONF_PARSER *variables);
53 CONF_SECTION *conf_read(const char *fromfile, int fromline,
54 const char *conffile, CONF_SECTION *parent);
57 CONF_PAIR *cf_pair_find(const CONF_SECTION *, const char *name);
58 CONF_PAIR *cf_pair_find_next(const CONF_SECTION *, const CONF_PAIR *, const char *name);
59 CONF_SECTION *cf_section_find(const char *name);
60 CONF_SECTION *cf_section_sub_find(const CONF_SECTION *, const char *name);
61 CONF_SECTION *cf_section_sub_find_name2(const CONF_SECTION *, const char *name1, const char *name2);
62 char *cf_section_value_find(const CONF_SECTION *, const char *attr);
64 void *cf_data_find(CONF_SECTION *, const char *);
65 int cf_data_add(CONF_SECTION *, const char *, void *, void (*)(void *));
67 char *cf_pair_attr(CONF_PAIR *pair);
68 char *cf_pair_value(CONF_PAIR *pair);
69 const char *cf_section_name1(const CONF_SECTION *);
70 const char *cf_section_name2(const CONF_SECTION *);
71 int dump_config(void);
72 CONF_SECTION *cf_subsection_find_next(CONF_SECTION *section,
73 CONF_SECTION *subsection,
75 int cf_section_lineno(CONF_SECTION *section);
76 int cf_pair_lineno(CONF_PAIR *pair);
77 CONF_ITEM *cf_item_find_next(CONF_SECTION *section, CONF_ITEM *item);
78 int cf_item_is_section(CONF_ITEM *item);
79 CONF_PAIR *cf_itemtopair(CONF_ITEM *item);
80 CONF_SECTION *cf_itemtosection(CONF_ITEM *item);
81 CONF_ITEM *cf_pairtoitem(CONF_PAIR *cp);
82 CONF_ITEM *cf_sectiontoitem(CONF_SECTION *cs);
83 #endif /* _CONFFILE_H */