libtrap
1.16.1
|
TRAP is represented by a shared object called libtrap. It is dynamically linked with every Nemea module. This library implements the communication interfaces used by all Nemea modules to exchange data. There are different types of interfaces using various underlying methods of communication (TCP/IP, Unix domain socket, shared memory) and each interface has several parameters. However, libtrap abstracts a module from the underlying interface and its specifics. The main features of libtrap are:
The interface type and behaviour is fully configurable by module and is usually set by user when module starts. Because some interface types support communication over a network, the system may be easily distributed on several hosts.
Libtrap supplies Simple API and Context API, both using Common libtrap API. For writing new Nemea modules, Nemea module macros can be useful.
The example of usage in pseudocode:
To initialize libtrap, module_info and ifc_spec must be provided. The trap_parse_params() function can be used to prepare ifc_spec from process arguments.
The trap_module_info_s parameter is usually defined in the beginning of Nemea modules. It contains module's name and description.