author | Tero Marttila <terom@fixme.fi> |
Tue, 31 Mar 2009 23:36:05 +0300 | |
changeset 100 | cfb7776bd6f0 |
parent 87 | f0db6ebf18b9 |
child 120 | 576bab0a1c5a |
permissions | -rw-r--r-- |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef CONFIG_H |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define CONFIG_H |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
/** |
87 | 5 |
* @file |
6 |
* |
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
* Support for module configuration parameters |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
*/ |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
#include "error.h" |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
/** |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
* Different types of configuration parameters |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
*/ |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
enum config_type { |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
CONFIG_INVALID, |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
/** A plain NUL-terminated string */ |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
CONFIG_STRING, |
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
19 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
20 |
/** An IRC channel */ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
21 |
CONFIG_IRC_CHAN, |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
22 |
}; |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
23 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
24 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
25 |
* Structure to hold a value as defined by config_type |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
26 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
27 |
struct config_value { |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
28 |
/** The type of the value */ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
29 |
enum config_type type; |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
30 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
31 |
/** The typed value */ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
32 |
union { |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
33 |
/** Value for CONFIG_STRING */ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
34 |
char *string; |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
35 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
36 |
/** Value for CONFIG_IRC_CHAN */ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
37 |
struct irc_chan *irc_chan; |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
38 |
}; |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
39 |
}; |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
|
87 | 41 |
/** |
42 |
* A single configuration option, with a name, type, handler function, etc. |
|
43 |
*/ |
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
struct config_option { |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
45 |
/** The name of the config option */ |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
46 |
const char *name; |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
47 |
|
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
48 |
/** The type of the value expected */ |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
49 |
enum config_type type; |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
50 |
|
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
51 |
/** The value handler func, by type */ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
52 |
union { |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
53 |
err_t (*string) (void *ctx, char *value, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
54 |
err_t (*irc_chan) (void *ctx, struct irc_chan *chan, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
55 |
} func; |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
56 |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
57 |
/** The value description */ |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
58 |
const char *description; |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
60 |
/** Help text */ |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
61 |
const char *help; |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
62 |
}; |
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
63 |
|
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
64 |
#define CONFIG_OPT_STRING(name, func, desc, help) \ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
65 |
{ name, CONFIG_STRING, { .string = func }, desc, help } |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
66 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
67 |
#define CONFIG_OPT_IRC_CHAN(name, func, desc, help) \ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
68 |
{ name, CONFIG_IRC_CHAN, { .irc_chan = func }, desc, help } |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
69 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
70 |
#define CONFIG_OPT_END \ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
71 |
{ NULL, CONFIG_INVALID, { NULL }, NULL, NULL } |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
72 |
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
73 |
/** |
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
74 |
* Lookup a config option by name. |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
75 |
* |
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
76 |
* @param options a CONFIG_OPT_END-terminated array of config_option's |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
77 |
* @param name the config_option::name to look up |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
78 |
* @param err returned error info if not found |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
79 |
* @return a direct pointer to the config_option if found |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
80 |
*/ |
100
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
81 |
const struct config_option* config_lookup (const struct config_option *options, const char *name, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
82 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
83 |
// XXX: move this into nexus |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
84 |
#include "nexus.h" |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
85 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
86 |
* Parse a raw value into a suitable configuration value, based on the config option type. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
87 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
88 |
* Since this needs to access the application state, you need to pass in the nexus as an argument. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
89 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
90 |
* Formats supported: |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
91 |
* CONFIG_IRC_CHAN - uses a '<network>/<channel>' format and irc_client_get_chan |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
92 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
93 |
* @param option the option to parse the value for, use config_lookup to find it |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
94 |
* @param nexus the application state |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
95 |
* @param value the returned value, if succesfull |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
96 |
* @param raw_value the raw value to parse based on the type |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
97 |
* @param err returned error info |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
98 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
99 |
err_t config_parse (const struct config_option *option, struct nexus *nexus, struct config_value *value, char *raw_value, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
100 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
101 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
102 |
* Apply a parsed configuration value to the given option. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
103 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
104 |
* The config option handlers take a context argument; the value of this depends on the implementor of the config_option. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
105 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
106 |
* @param option the option to apply |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
107 |
* @param ctx the context pointer for the option handler |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
108 |
* @param value the parsed value |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
109 |
* @param err returned error info |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
110 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
111 |
err_t config_apply_opt (const struct config_option *option, void *ctx, const struct config_value *value, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
112 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
113 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
114 |
* Apply a parsed configuration value for the named config opt. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
115 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
116 |
* @param options a CONFIG_OPT_END-terminated array of config_option's |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
117 |
* @param ctx the context pointer for the option handler |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
118 |
* @param name the config_option::name to look up |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
119 |
* @param value the parsed value |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
120 |
* @param err returned error info |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
121 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
122 |
err_t config_apply (const struct config_option *options, void *ctx, const char *name, const struct config_value *value, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
123 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
124 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
125 |
* Apply a string value for the named config opt. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
126 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
127 |
* @param options a CONFIG_OPT_END-terminated array of config_option's |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
128 |
* @param ctx the context pointer for the option handler |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
129 |
* @param name the config_option::name to look up |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
130 |
* @param value the string value |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
131 |
* @param err returned error info |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
132 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
133 |
err_t config_apply_string (const struct config_option *options, void *ctx, const char *name, char *value, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
134 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
135 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
136 |
* Apply an irc_chan value for the named config opt. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
137 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
138 |
* @param options a CONFIG_OPT_END-terminated array of config_option's |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
139 |
* @param ctx the context pointer for the option handler |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
140 |
* @param name the config_option::name to look up |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
141 |
* @param value the irc_chan value |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
142 |
* @param err returned error info |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
143 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
144 |
err_t config_apply_irc_chan (const struct config_option *options, void *ctx, const char *name, struct irc_chan *value, struct error_info *err); |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
145 |
|
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
146 |
/** |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
147 |
* Parse and apply a configuration value for the named config opt. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
148 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
149 |
* See config_parse() for more info. |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
150 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
151 |
* @param options a CONFIG_OPT_END-terminated array of config_option's |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
152 |
* @param nexus the application state |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
153 |
* @param ctx the context pointer for the option handler |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
154 |
* @param name the config_option::name to look up |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
155 |
* @param raw_value the raw value to parse |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
156 |
* @param err returned error info |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
157 |
* |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
158 |
* @see config_parse |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
159 |
*/ |
cfb7776bd6f0
improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents:
87
diff
changeset
|
160 |
err_t config_apply_raw (const struct config_option *options, struct nexus *nexus, void *ctx, const char *name, char *raw_value, struct error_info *err); |
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
161 |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
162 |
#endif |