]> jfr.im git - solanum.git/blame - include/newconf.h
cap: substantial rewrite leveraging the ircd capabilities framework for client caps
[solanum.git] / include / newconf.h
CommitLineData
212380e3
AC
1/* This code is in the public domain.
2 * $Nightmare: nightmare/include/config.h,v 1.32.2.2.2.2 2002/07/02 03:41:28 ejb Exp $
3 * $Id: newconf.h 1735 2006-07-19 02:35:40Z nenolod $
4 */
5
6#ifndef _NEWCONF_H_INCLUDED
7#define _NEWCONF_H_INCLUDED
8
212380e3
AC
9struct ConfEntry
10{
11 const char *cf_name;
12 int cf_type;
13 void (*cf_func) (void *);
14 int cf_len;
15 void *cf_arg;
16};
17
18struct TopConf
19{
d7f753cd 20 const char *tc_name;
212380e3
AC
21 int (*tc_sfunc) (struct TopConf *);
22 int (*tc_efunc) (struct TopConf *);
5b96d9a6 23 rb_dlink_list tc_items;
212380e3
AC
24 struct ConfEntry *tc_entries;
25};
26
27
dceac3e4 28#define CF_QSTRING 0x01 /* quoted string */
212380e3 29#define CF_INT 0x02
dceac3e4 30#define CF_STRING 0x03 /* unquoted string */
212380e3
AC
31#define CF_TIME 0x04
32#define CF_YESNO 0x05
212380e3 33
dceac3e4 34#define CF_MTYPE 0xFF /* mask for type */
212380e3 35
dceac3e4
KB
36/* CF_FLIST is used to allow specifying that an option accepts a list of (type)
37 * values. conf_parm_t.type will never actually have another type & CF_FLIST;
38 * it's only used as a true flag in newconf.c (which only consumes conf_parm_t
39 * structures and doesn't create them itself).
40 */
41#define CF_FLIST 0x0100 /* flag for list */
42#define CF_MFLAG 0xFF00 /* mask for flags */
212380e3 43
dceac3e4
KB
44/* conf_parm_t.type must be either one type OR one flag. this is pretty easy to
45 * enforce because lists always contain nested conf_parm_t structures whose
46 * .type is the real type, so it doesn't need to be stored in the top-level one
47 * anyway.
48 */
212380e3
AC
49typedef struct conf_parm_t_stru
50{
51 struct conf_parm_t_stru *next;
52 int type;
53 union
54 {
55 char *string;
56 int number;
57 struct conf_parm_t_stru *list;
58 }
59 v;
60}
61conf_parm_t;
62
63extern struct TopConf *conf_cur_block;
64
65extern char *current_file;
66
67int read_config(char *);
68int conf_start_block(char *, char *);
69int conf_end_block(struct TopConf *);
dceac3e4 70int conf_call_set(struct TopConf *, char *, conf_parm_t *);
212380e3 71void conf_report_error(const char *, ...);
d84acbce 72void conf_report_warning(const char *, ...);
212380e3
AC
73void newconf_init(void);
74int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *));
75int remove_conf_item(const char *topconf, const char *name);
76int add_top_conf(const char *name, int (*sfunc) (struct TopConf *), int (*efunc) (struct TopConf *), struct ConfEntry *items);
77int remove_top_conf(char *name);
78struct TopConf *find_top_conf(const char *name);
79struct ConfEntry *find_conf_item(const struct TopConf *top, const char *name);
80
81#endif