| author | Tero Marttila <terom@fixme.fi> |
| Wed, 01 Apr 2009 00:26:50 +0300 | |
| changeset 101 | bb8ed1382103 |
| parent 100 | cfb7776bd6f0 |
| child 103 | 454aea1e4f11 |
| permissions | -rw-r--r-- |
| 54 | 1 |
#ifndef MODULE_H |
2 |
#define MODULE_H |
|
3 |
||
4 |
/** |
|
5 |
* @file |
|
6 |
* |
|
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
7 |
* Dynamically loadable modules for use with nexus. |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
8 |
* |
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
9 |
* The modules are loaded using dlopen(), and hence should be standard dynamic libraries. Modules are then "loaded" by |
| 87 | 10 |
* resolving a `struct module_funcs` symbol called "<modname>_funcs", and then using the init func to construct a |
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
11 |
* "context", which is then further manipulated by various other module functions. |
| 54 | 12 |
*/ |
13 |
#include "nexus.h" |
|
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
14 |
#include "config.h" |
| 54 | 15 |
#include "error.h" |
16 |
||
17 |
#include <sys/queue.h> |
|
18 |
||
19 |
/** |
|
20 |
* Information required to load/identify a module. |
|
21 |
*/ |
|
22 |
struct module_info {
|
|
23 |
/** Human-readable name */ |
|
24 |
const char *name; |
|
25 |
||
26 |
/** Filesystem path to the .so */ |
|
27 |
const char *path; |
|
28 |
}; |
|
29 |
||
30 |
/** |
|
|
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
|
31 |
* A table of (function/other) pointers defining a module's behaviour. This is dynamically resolved from the module DSO |
|
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 |
* using the "<mod_name>_module" symbol. |
|
57
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
33 |
*/ |
|
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
|
34 |
struct module_desc {
|
|
57
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
35 |
/** |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
36 |
* Initialize the module, returning an opaque context pointer that is stored in the module state, and supplied for |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
37 |
* subsequent calls. The supplied nexus arg can be used to access the global state. |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
38 |
* |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
39 |
* @param nexus a pointer to the nexus struct containing the global state |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
40 |
* @param ctx_ptr the context pointer should be returned via this |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
41 |
* @param err returned error info |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
42 |
*/ |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
43 |
err_t (*init) (struct nexus *nexus, void **ctx_ptr, struct error_info *err); |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
44 |
|
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
45 |
/** |
|
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
|
46 |
* A module may define a set of available configuration parameters for use by module_conf, by setting this to an |
|
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
|
47 |
* array of config_option's. |
|
57
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
48 |
* |
|
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
|
49 |
* The handler functions will recieve the module's context pointer as their ctx argument. |
|
83
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
50 |
*/ |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
51 |
const struct config_option *config_options; |
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
52 |
|
|
c8e2dac08207
add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
70
diff
changeset
|
53 |
/** |
|
70
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
54 |
* Unload the module, removing all handlers/callbacks added to the nexus' irc_client. This does not have to act |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
55 |
* immediately, and will still have access to all irc_* resources it had earlier, and may perform I/O to unload |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
56 |
* cleanly. But the unloading should complete reasonably quickly, after which all event handlers added by the |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
57 |
* module to the nexus' ev_base should have been removed, and resources released. |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
58 |
* |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
59 |
* @param ctx the module's context pointer as returned by init |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
60 |
*/ |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
61 |
err_t (*unload) (void *ctx); |
|
57
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
62 |
}; |
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
63 |
|
|
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
64 |
/** |
| 54 | 65 |
* A loaded module. |
66 |
*/ |
|
67 |
struct module {
|
|
68 |
/** The identifying info for the module */ |
|
69 |
struct module_info info; |
|
70 |
||
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
71 |
/** The dlopen handle */ |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
72 |
void *handle; |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
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 |
/** The module entry point */ |
|
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
|
75 |
struct module_desc *desc; |
|
57
ce1accba5fc7
slight cleanup to move module funcs to a 'struct module_funcs'
Tero Marttila <terom@fixme.fi>
parents:
56
diff
changeset
|
76 |
|
| 54 | 77 |
/** The module context object */ |
78 |
void *ctx; |
|
79 |
||
|
70
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
80 |
/** Reference back to modules struct used to load this module */ |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
81 |
struct modules *modules; |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
82 |
|
|
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
|
83 |
/** |
|
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 |
* Is the module currently being unloaded? |
|
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 |
bool unloading; |
|
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 |
|
| 54 | 88 |
/** Our entry in the list of modules */ |
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
89 |
TAILQ_ENTRY(module) modules_list; |
| 54 | 90 |
}; |
91 |
||
92 |
/** |
|
93 |
* A set of loaded modules, and functionality to load more |
|
94 |
*/ |
|
95 |
struct modules {
|
|
96 |
/** The nexus in use */ |
|
97 |
struct nexus *nexus; |
|
98 |
||
99 |
/** List of loaded modules */ |
|
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
100 |
TAILQ_HEAD(module_ctx_modules, module) list; |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
101 |
}; |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
102 |
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
103 |
/** |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
104 |
* Possible error codes |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
105 |
*/ |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
106 |
enum module_error_code {
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
107 |
_ERR_MODULE_BEGIN = _ERR_MODULE, |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
108 |
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
109 |
ERR_MODULE_OPEN, ///< dlopen() failed |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
110 |
ERR_MODULE_NAME, ///< invalid module_info.name |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
111 |
ERR_MODULE_SYM, ///< invalid symbol |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
112 |
ERR_MODULE_INIT_FUNC, ///< invalid module_init_func_t |
|
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
113 |
ERR_MODULE_CONF, ///< value error in configuration data |
| 54 | 114 |
}; |
115 |
||
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
116 |
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
117 |
/** |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
118 |
* Maximum length of a module name |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
119 |
*/ |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
120 |
#define MODULE_NAME_MAX 24 |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
121 |
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
122 |
/** |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
123 |
* Maximum length of module symbol suffix |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
124 |
*/ |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
125 |
#define MODULE_SUFFIX_MAX 16 |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
126 |
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
127 |
/** |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
128 |
* Maximum length of symbol name name, including terminating NUL |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
129 |
*/ |
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
130 |
#define MODULE_SYMBOL_MAX (MODULE_NAME_MAX + 1 + MODULE_SUFFIX_MAX + 1) |
| 54 | 131 |
|
132 |
/** |
|
133 |
* Create a new modules state |
|
134 |
*/ |
|
135 |
err_t modules_create (struct modules **modules_ptr, struct nexus *nexus); |
|
136 |
||
137 |
/** |
|
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
138 |
* Load a new module |
|
65
d7508879ad01
add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents:
57
diff
changeset
|
139 |
* |
|
d7508879ad01
add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents:
57
diff
changeset
|
140 |
* @param modules the module-loading context |
|
d7508879ad01
add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents:
57
diff
changeset
|
141 |
* @param module_ptr return the new module via this, if not NULL |
|
d7508879ad01
add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents:
57
diff
changeset
|
142 |
* @param info the info required to identify and load the module |
|
d7508879ad01
add --module support, and tweak irc_net docs
Tero Marttila <terom@fixme.fi>
parents:
57
diff
changeset
|
143 |
* @param err return error info |
| 54 | 144 |
*/ |
|
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
145 |
err_t module_load (struct modules *modules, struct module **module_ptr, const struct module_info *info, struct error_info *err); |
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
146 |
|
|
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
147 |
/** |
|
66
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
148 |
* Lookup a module by name |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
149 |
* |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
150 |
* @param modules the modules state |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
151 |
* @param name the module name to get |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
152 |
* @return the module struct, or NULL if not found |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
153 |
*/ |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
154 |
struct module* module_get (struct modules *modules, const char *name); |
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
155 |
|
|
ef8c9d7daf62
all options are now fully implemented
Tero Marttila <terom@fixme.fi>
parents:
65
diff
changeset
|
156 |
/** |
|
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
|
157 |
* Look up a module configuration option by name |
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
158 |
*/ |
|
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
|
159 |
const struct config_option* module_conf_lookup (struct module *module, 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
|
160 |
|
|
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
|
161 |
/** |
|
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
|
162 |
* Apply a module configuration option using a structured 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
|
163 |
*/ |
|
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
|
164 |
err_t module_conf (struct module *module, const struct config_option *opt, 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
|
165 |
|
|
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
|
166 |
/** |
|
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
|
167 |
* Set a module configuration option using a raw 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
|
168 |
*/ |
|
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
|
169 |
err_t module_conf_raw (struct module *module, const char *name, char *value, struct error_info *err); |
| 54 | 170 |
|
171 |
/** |
|
|
70
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
172 |
* Unload a module. This means calling its 'unload' func, which will then go about shutting down the module. This might |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
173 |
* not happen right away, though, so the module is not destroyed yet. |
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
54
diff
changeset
|
174 |
* |
|
70
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
175 |
* XXX: currently the module is never destroyed, there needs to be a "module unload done" callback... |
| 54 | 176 |
*/ |
177 |
err_t module_unload (struct module *module); |
|
178 |
||
|
70
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
179 |
/** |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
180 |
* Destroy a module, releasing as many resources as possible |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
181 |
*/ |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
182 |
void module_destroy (struct module *module); |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
183 |
|
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
184 |
/** |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
185 |
* Unload all modules, this just calls module_unload for each module, logging errors as warnings. |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
186 |
* |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
187 |
* XXX: currently, this does not destroy any modules, or the modules state itself. |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
188 |
*/ |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
189 |
err_t modules_unload (struct modules *modules); |
|
a9a4c5e6aa30
implement module unloading, although module_destroy is currently never called
Tero Marttila <terom@fixme.fi>
parents:
66
diff
changeset
|
190 |
|
| 54 | 191 |
#endif |