"Module" Tables
The module table
defines the main interface between the module and the core ProFTPD engine,
providing pointers to the other handler tables, giving a name to the module,
etc etc. The API version used by the module is denoted as well, so that
ProFTPD can recognize whether it is capable of using this module, or whether
the given API version is too old or too new. As ProFTPD maintains an internal
list of modules in a doubly-linked list arrangment, the table defines two
pointers to the others which are set when ProFTPD starts; do not define
these fields yourself.
Each module can supply up to two initialization routines via
this module table. The first initialization function is called immediately
after the module is loaded, while the second is called after ProFTPD is
connected to a client, and the main ProFTPD server (if not in inetd
mode) has forked off. The second initialization function's purpose is to let
the module perform any necessary preparatory work once a client is connected
and ProFTPD is ready to provide service to the new client. In
inetd
mode, the "child init" function will be called
immediately after ProFTPD is loaded, because ProFTPD is always in
"child mode" when run from inetd
. Note that both of
these initialization routines are optional. If you don't need them, or only
need one, simply set the function pointer to NULL
in the module
table.
Definition
Example
module sample_module = { /* pointer to the next module -- always NULL (set internally) */ NULL, /* pointer to the previous module -- always NULL (set internally) */ NULL, /* Module API version (current version: 2.0) */ 0x20, /* this module's name */ "sample", /* module configuration handler table */ sample_config, /* module command handler table */ sample_commands, /* module authentication handler table */ NULL, /* module initialization function */ sample_init, /* module "child mode" post-fork initialization function */ sample_child_init };