|
Packit Service |
a2489d |
lftp 2.0 and later support loading modules (shared objects) at
|
|
Packit Service |
a2489d |
runtime. Use command `module' to load a module.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
It also supports loading certain modules (some of protocols and commands)
|
|
Packit Service |
a2489d |
automatically on demand. To compile modular lftp use:
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
configure --with-modules
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
You will need GCC and ELF platform (linux, freebsd-3.x, solaris, irix etc).
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
Below are the technical details.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
Module is a shared object, after loading it with dlopen(3) lftp does
|
|
Packit Service |
a2489d |
dlsym("module_init") and calls this function with parameters argc, argv:
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
extern "C"
|
|
Packit Service |
a2489d |
void module_init(int argc, const char * const *argv);
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
The argv vector contains the arguments passed to `module' command after
|
|
Packit Service |
a2489d |
module name. In case of loading module on demand it is empty.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
Note: function _init of a module is called automatically by dlopen. It can
|
|
Packit Service |
a2489d |
execute constructors if the module is properly compiled with `gcc -shared'.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
To load modules on demand lftp uses protocol or command name to find
|
|
Packit Service |
a2489d |
module file. For protocols it looks for proto-<PROTOCOL>.so and for
|
|
Packit Service |
a2489d |
commands -- cmd-<COMMAND>.so. The modules register the protocols and
|
|
Packit Service |
a2489d |
commands they provide with functions FileAccess::Register and
|
|
Packit Service |
a2489d |
CmdExec::RegisterCommand.
|
|
Packit Service |
a2489d |
|
|
Packit Service |
a2489d |
lftp searches module for any protocol specified in URL in open command,
|
|
Packit Service |
a2489d |
and only for certain compile time defined set of commands -- the commands
|
|
Packit Service |
a2489d |
that have NULL instead of function pointer in command table in commands.cc.
|