Modules are C++ objects that provides facilities for object oriented messaging between each other.
Basically, module layer is composed of some interfaces:
If you want to learn module quickly, the best starting point is in the unit test directory. Head to C:\nevrax\code\nel\tools\nel_unit_test\net_ut and open the module_test.cpp file.
There, you will find an almost exhaustive test of the module layer.
The IModule interface is partly implemented in CModuleBase and it is the class that you MUST derive from to build you module (if you derive directly from IModule, you will be in big trouble). Your module must implement (even if empty) a number of virtuals to receive message and event about the application and module discovering. To ease the creation of simple module, there are template classes that provide empty implementation for all the virtual (this class are in include/nel/net/module_builder_parts.h).
As a start point, the most important virtuals are IModule::onModuleUp(IModuleProxy *moduleProxy), IModule::onModuleDown(IModuleProxy *moduleProxy)
that warn your module about other module begin accessible or not. On the moduleProxy, you can then invoke sendModuleMessage(IModule *sender, CMessage message) to send a message to the module.
To make two modules visible to each other, they need to be plugged into a gateway socket interface. Then, if the two modules are plugged in two different gateways, these gateways need to be connected.
IModuleSocket is an interface implemented by the NeL layer 6 that is used to plug modules in. Each socket in a process must have a unique name (for a gateway socket, it is the name of the gateway module). A module can be plugged into any number of sockets, but only once in the same socket. A socket can accept any number of modules. For now, the only gateways use sockets, but one can imagine to build another system that accept modules (e.g an interceptor between module and gateway).
IModuleGateway is implemented by 2 modules, namely StandardGateway and LocalGateway. LocalGateway is just a simple testing gateway that doesn't implement the entire gateway interface and that should not be used but for testing purposes.
StandardGateway contains all the logic for module interconnection, discovering and messaging but relies on an external plug-in for transport between gateways. Integrated with NeL, there are 2 gateway transports provided: a transport using NeL Layer 3 (with a server and client mode) and a transport using NeL Layer 5.
Note that almost all module operations can be done either programmatically or by using NeL commands. For example, you can create or delete modules, add or remove transport on gateway, plug or unplug modules in sockets by using commands.
There is also a security (or identification) system in the standard gateway. This system works with a security plug-in that can be added at run time on a gateway transport. This system allows the plug-in to add a security tag element on a proxy description before it is disclosed by the gateway to all modules and other gateway. These security modules are then accessible from the IModuleProxy interface by anyone who want to check some identity or security info.