Import source code for dummynet innode emulation.
[ipfw.git] / dummynet / include / sys / module.h
1 /*
2  * trivial module support
3  */
4 #ifndef _SYS_MODULE_H_
5 #define _SYS_MODULE_H_
6 typedef struct module *module_t;
7 typedef int (*modeventhand_t)(module_t, int /* modeventtype_t */, void *);
8  
9 typedef enum modeventtype {
10         MOD_LOAD,
11         MOD_UNLOAD,
12         MOD_SHUTDOWN,
13         MOD_QUIESCE
14 } modeventtype_t;
15  
16 typedef struct moduledata {
17         const char      *name;          /* module name */
18         modeventhand_t  evhand;         /* event handler */
19         void            *priv;          /* extra data */
20 } moduledata_t;
21
22 int my_mod_register(struct moduledata *mod, const char *name, int order);
23 /*
24  * Hook the module descriptor, md, into our list of things to do.
25  * We should in principle respect the order of loading.
26  *
27  * XXX use the gcc .init functions
28  */
29 #define DECLARE_MODULE(a, md, c,d)                              \
30     moduledata_t *moddesc_##a = &md;
31
32 /*
33  * XXX MODULE_VERSION is define in linux too
34  */
35 #define MODULE_DEPEND(a,b,c,d,e)
36 #if defined( __linux__ ) || defined( _WIN32 )
37 #undef MODULE_VERSION
38 #define MODULE_VERSION(a,b)
39 #endif
40
41 #endif  /* _SYS_MODULE_H_ */
42