Module API
#
Module headerEach module is described by a module header, which is created by the
MODULE_HEADER_V1
macro. This includes the module's version, vendor, a brief
description, and three optional entry points (constructor, post-init and
destructor).
MODULE_HEADER_V1( "ircd-yeti 1.1.0", "DareNET Development <https://c.darenet.org/dev>", "Provides the SETNAME command.", module_constructor, module_post_init, module_destructor);
#
Module initialzation and cleanupModules may export up to three entry points.
#
Constructorvoid (*constructor)(Module *mod)
This is the first function to be called. It should only assume that the ircd
core is loaded, unless the shared library directly links to some other library.
This function can use the MODULE_REQUEST_DEPENDENCY
macro to indicate other
ircd-yeti modules its depends on.
#
Post-initializationvoid (*post_init)(Module *mod)
This entry point can be used to perform second-pass initialization, such as for modules that require other ircd-yeti modules to be loaded.
#
Destructorvoid (*destructor)(ModuleIntent intent)
This function is called just before the module is unloaded, and should release any persistent resources owned by the module. The intent paremeter is used to inform the module if it's being reloaded or unloaded.
#
Module dependenciesMODULE_REQUEST_DEPENDENCY(self, module_name)
This macro is used to declare that the currently loading module depends on another module, as named, allowing for stub modules that derive from "super" modules.
MODULE_REQUEST_SYMBOL(self, destination, module_name, symbol)
This macro is used to request a module dependency, and then grab a symbol from it.
#
Resident modulesMODULE_MAKE_RESIDENT(module)
This macro ensures that a module will never be unloaded. Any future
module_unload()
calls on the module will be ignored.
#
Semi-resident modulesMODULE_MARK_RELOAD_ONLY(module)
This macro ensures that a module will never be permanently unloaded, but may be reloaded. If for any reason initialization of the module fails after a reloaded, the ircd will exit.
This intended for modules that are necessary for operation of the ircd (e.g., core modules), but should allow upgrading in place.