]>
Commit | Line | Data |
---|---|---|
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 | ||
9 | #include <sys/types.h> | |
10 | ||
11 | #include <stdio.h> | |
12 | ||
13 | #include "client.h" | |
14 | ||
15 | struct ConfEntry | |
16 | { | |
17 | const char *cf_name; | |
18 | int cf_type; | |
19 | void (*cf_func) (void *); | |
20 | int cf_len; | |
21 | void *cf_arg; | |
22 | }; | |
23 | ||
24 | struct TopConf | |
25 | { | |
26 | const char *tc_name; | |
27 | int (*tc_sfunc) (struct TopConf *); | |
28 | int (*tc_efunc) (struct TopConf *); | |
29 | rb_dlink_list tc_items; | |
30 | struct ConfEntry *tc_entries; | |
31 | }; | |
32 | ||
33 | ||
34 | #define CF_QSTRING 0x01 | |
35 | #define CF_INT 0x02 | |
36 | #define CF_STRING 0x03 | |
37 | #define CF_TIME 0x04 | |
38 | #define CF_YESNO 0x05 | |
39 | #define CF_LIST 0x06 | |
40 | #define CF_ONE 0x07 | |
41 | ||
42 | #define CF_MTYPE 0xFF | |
43 | ||
44 | #define CF_FLIST 0x1000 | |
45 | #define CF_MFLAG 0xFF00 | |
46 | ||
47 | typedef struct conf_parm_t_stru | |
48 | { | |
49 | struct conf_parm_t_stru *next; | |
50 | int type; | |
51 | union | |
52 | { | |
53 | char *string; | |
54 | int number; | |
55 | struct conf_parm_t_stru *list; | |
56 | } | |
57 | v; | |
58 | } | |
59 | conf_parm_t; | |
60 | ||
61 | extern struct TopConf *conf_cur_block; | |
62 | ||
63 | extern char *current_file; | |
64 | ||
65 | int read_config(char *); | |
66 | int conf_start_block(char *, char *); | |
67 | int conf_end_block(struct TopConf *); | |
68 | int conf_call_set(struct TopConf *, char *, conf_parm_t *, int); | |
69 | void conf_report_error(const char *, ...); | |
70 | void newconf_init(void); | |
71 | int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)); | |
72 | int remove_conf_item(const char *topconf, const char *name); | |
73 | int add_top_conf(const char *name, int (*sfunc) (struct TopConf *), int (*efunc) (struct TopConf *), struct ConfEntry *items); | |
74 | int remove_top_conf(char *name); | |
75 | struct TopConf *find_top_conf(const char *name); | |
76 | struct ConfEntry *find_conf_item(const struct TopConf *top, const char *name); | |
77 | ||
78 | #endif |