2 * ircd-ratbox: A slightly useful ircd.
3 * modules.h: A header for the modules functions.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2004 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * $Id: modules.h 26 2006-09-20 18:02:06Z spb $
27 #ifndef INCLUDED_modules_h
28 #define INCLUDED_modules_h
35 #if defined(HAVE_SHL_LOAD)
38 #if !defined(STATIC_MODULES) && defined(HAVE_DLFCN_H)
53 void * mapi_header
; /* actually struct mapi_mheader_av<mapi_version> */
58 char path
[MAXPATHLEN
];
61 #define MAPI_MAGIC_HDR 0x4D410000
63 #define MAPI_V1 (MAPI_MAGIC_HDR | 0x1)
65 #define MAPI_MAGIC(x) ((x) & 0xffff0000)
66 #define MAPI_VERSION(x) ((x) & 0x0000ffff)
68 typedef struct Message
* mapi_clist_av1
;
72 const char * hapi_name
;
78 const char * hapi_name
;
82 struct mapi_mheader_av1
84 int mapi_version
; /* Module API version */
85 int (*mapi_register
) (void); /* Register function;
86 ret -1 = failure (unload) */
87 void (*mapi_unregister
) (void); /* Unregister function. */
88 mapi_clist_av1
* mapi_command_list
; /* List of commands to add. */
89 mapi_hlist_av1
* mapi_hook_list
; /* List of hooks to add. */
90 mapi_hfn_list_av1
*mapi_hfn_list
; /* List of hook_add_hook's to do */
91 const char * mapi_module_version
; /* Module's version (freeform) */
94 #ifndef STATIC_MODULES
95 # define DECLARE_MODULE_AV1(name,reg,unreg,cl,hl,hfnlist, v) \
96 struct mapi_mheader_av1 _mheader = { MAPI_V1, reg, unreg, cl, hl, hfnlist, v}
98 # define DECLARE_MODULE_AV1(name,reg,unreg,cl,hl,hfnlist, v) \
99 struct mapi_mheader_av1 name ## _mheader = { MAPI_V1, reg, unreg, cl, hl, hfnlist, v}
100 void load_static_modules(void);
104 void mod_add_path(const char *path
);
105 void mod_clear_paths(void);
108 extern void load_module(char *path
);
110 /* load all modules */
111 extern void load_all_modules(int warn
);
113 /* load core modules */
114 extern void load_core_modules(int);
116 extern int unload_one_module(const char *, int);
117 extern int load_one_module(const char *, int);
118 extern int load_a_module(const char *, int, int);
119 extern int findmodule_byname(const char *);
120 extern char *irc_basename(const char *);
121 extern void modules_init(void);
123 #endif /* INCLUDED_modules_h */