Gateway transport using layer 3 client. More...
Inherits NLNET::IGatewayTransport.
Public Types | |
| enum | { RETRY_INTERVAL = 5, MIN_RETRY_INTERVAL = 1 } |
| typedef map< CCallbackNetBase *, CGatewayL3ClientTransport * > | TDispatcherIndex |
| A static mapper to retrieve transport from the CCallbackServer pointer. | |
| typedef map< TSockId, CL3ClientRoute * > | TClientRoutes |
| Storage for active connection. | |
| typedef vector< TSockId > | TClientRouteIds |
| Indexed storage of active connection (used for stable connId) a NULL TSockeId mean a free connection slot. | |
| typedef vector < TClientRouteIds::difference_type > | TFreeRouteIds |
| A list of free slot ready for use. | |
Public Member Functions | |
| CGatewayL3ClientTransport (const IGatewayTransport::TCtorParam ¶m) | |
| Constructor. | |
| ~CGatewayL3ClientTransport () | |
| void | deletePendingRoute () |
| const std::string & | getClassName () const |
| Return the class name from the transport factory. | |
| virtual void | update () |
| The gateway update the transport regularly. | |
| virtual uint32 | getRouteCount () const |
| Return the number of route currently open by the transport. | |
| void | dump (NLMISC::CLog &log) const |
| Dump debug information in the specified log stream. | |
| void | onCommand (const CMessage &) throw (EInvalidCommand) |
| The gateway send a command message to the transport. | |
| bool | onCommand (const TParsedCommandLine &command) throw (EInvalidCommand) |
| The gateway send a textual command to the transport. | |
| void | connect (CInetAddress &addr) |
| connect to a server | |
| void | close (uint32 connId) |
| void | onDisconnection (TSockId from) |
| Event management. | |
| void | onDispatchMessage (const CMessage &msgin, TSockId from, CCallbackNetBase &) |
Static Public Member Functions | |
| static void | cbDisconnection (TSockId from, void *arg) |
| static callback forwarder | |
| static void | cbDispatchMessage (CMessage &msgin, TSockId from, CCallbackNetBase &netbase) |
Public Attributes | |
| TClientRoutes | _Routes |
| TClientRouteIds | _RouteIds |
| TFreeRouteIds | _FreeRoutesIds |
| list< CL3ClientRoute * > | _RouteToRemove |
| the route to delete outside of the update loop | |
| uint32 | _RetryInterval |
| Retry interval for reconnection. | |
Static Public Attributes | |
| static TDispatcherIndex | _DispatcherIndex |
Friends | |
| class | CL3ClientRoute |
Gateway transport using layer 3 client.
Definition at line 439 of file module_gateway_transport.cpp.
| typedef vector<TSockId> NLNET::CGatewayL3ClientTransport::TClientRouteIds |
Indexed storage of active connection (used for stable connId) a NULL TSockeId mean a free connection slot.
Definition at line 453 of file module_gateway_transport.cpp.
| typedef map<TSockId, CL3ClientRoute*> NLNET::CGatewayL3ClientTransport::TClientRoutes |
Storage for active connection.
Definition at line 448 of file module_gateway_transport.cpp.
| typedef map<CCallbackNetBase*, CGatewayL3ClientTransport*> NLNET::CGatewayL3ClientTransport::TDispatcherIndex |
A static mapper to retrieve transport from the CCallbackServer pointer.
Definition at line 444 of file module_gateway_transport.cpp.
| typedef vector<TClientRouteIds::difference_type> NLNET::CGatewayL3ClientTransport::TFreeRouteIds |
A list of free slot ready for use.
Definition at line 456 of file module_gateway_transport.cpp.
| anonymous enum |
| RETRY_INTERVAL |
Default time interval (in seconds) between to reconnection attempts. |
| MIN_RETRY_INTERVAL |
A minimum value in case or configuration error. |
Definition at line 465 of file module_gateway_transport.cpp.
| NLNET::CGatewayL3ClientTransport::CGatewayL3ClientTransport | ( | const IGatewayTransport::TCtorParam & | param | ) | [inline] |
Constructor.
Definition at line 474 of file module_gateway_transport.cpp.
| NLNET::CGatewayL3ClientTransport::~CGatewayL3ClientTransport | ( | ) | [inline] |
Definition at line 480 of file module_gateway_transport.cpp.
References _RouteIds, close(), and deletePendingRoute().
| static void NLNET::CGatewayL3ClientTransport::cbDisconnection | ( | TSockId | from, | |
| void * | arg | |||
| ) | [inline, static] |
static callback forwarder
Definition at line 813 of file module_gateway_transport.cpp.
References nlassert, and onDisconnection().
Referenced by connect().
| static void NLNET::CGatewayL3ClientTransport::cbDispatchMessage | ( | CMessage & | msgin, | |
| TSockId | from, | |||
| CCallbackNetBase & | netbase | |||
| ) | [inline, static] |
Definition at line 823 of file module_gateway_transport.cpp.
References _DispatcherIndex, and nlassert.
Referenced by connect().
| void NLNET::CGatewayL3ClientTransport::close | ( | uint32 | connId | ) | [inline] |
Definition at line 715 of file module_gateway_transport.cpp.
References _DispatcherIndex, _FreeRoutesIds, NLNET::IGatewayTransport::_Gateway, _RouteIds, _Routes, deletePendingRoute(), H_AUTO, nlassert, nldebug, nlwarning, and NLNET::IModuleGateway::onRouteRemoved().
Referenced by onCommand(), and ~CGatewayL3ClientTransport().
| void NLNET::CGatewayL3ClientTransport::connect | ( | CInetAddress & | addr | ) | [inline] |
connect to a server
Definition at line 663 of file module_gateway_transport.cpp.
References _DispatcherIndex, _FreeRoutesIds, NLNET::IGatewayTransport::_Gateway, _RetryInterval, _RouteIds, _Routes, NLNET::CInetAddress::asString(), NLNET::CL3ClientRoute::CallbackClient, cbDisconnection(), cbDispatchMessage(), CL3ClientRoute, NLNET::CCallbackClient::connected(), H_AUTO, NLNET::InvalidSockId, nldebug, nlinfo, and NLNET::IModuleGateway::onRouteAdded().
Referenced by onCommand().
| void NLNET::CGatewayL3ClientTransport::deletePendingRoute | ( | ) | [inline] |
Definition at line 495 of file module_gateway_transport.cpp.
References _DispatcherIndex, _FreeRoutesIds, _RouteIds, _Routes, _RouteToRemove, NLNET::CL3ClientRoute::CallbackClient, NLNET::CL3ClientRoute::ConnId, NLNET::CCallbackClient::getSockId(), and H_AUTO.
Referenced by close(), update(), and ~CGatewayL3ClientTransport().
| void NLNET::CGatewayL3ClientTransport::dump | ( | NLMISC::CLog & | log | ) | const [inline, virtual] |
Dump debug information in the specified log stream.
Implements NLNET::IGatewayTransport.
Definition at line 579 of file module_gateway_transport.cpp.
References _Routes, NLNET::CInetAddress::asString(), NLNET::CL3ClientRoute::CallbackClient, NLNET::CCallbackClient::connected(), NLMISC::CLog::displayNL(), NLNET::CCallbackClient::displayReceiveQueueStat(), NLNET::CCallbackClient::displaySendQueueStat(), NLNET::CGatewayRoute::ForeignToLocalIdx, NLNET::IModuleManager::getInstance(), NLNET::IModuleProxy::getModuleName(), NLNET::IModuleManager::getModuleProxy(), and NLNET::CL3ClientRoute::ServerAddr.
| const std::string& NLNET::CGatewayL3ClientTransport::getClassName | ( | ) | const [inline, virtual] |
Return the class name from the transport factory.
Implements NLNET::IGatewayTransport.
Definition at line 512 of file module_gateway_transport.cpp.
References LAYER3_CLIENT_CLASS_NAME.
| virtual uint32 NLNET::CGatewayL3ClientTransport::getRouteCount | ( | ) | const [inline, virtual] |
Return the number of route currently open by the transport.
Implements NLNET::IGatewayTransport.
Definition at line 574 of file module_gateway_transport.cpp.
References _Routes.
| bool NLNET::CGatewayL3ClientTransport::onCommand | ( | const TParsedCommandLine & | command | ) | throw (EInvalidCommand) [inline, virtual] |
The gateway send a textual command to the transport.
Implements NLNET::IGatewayTransport.
Definition at line 620 of file module_gateway_transport.cpp.
References _RetryInterval, close(), connect(), NLNET::fromString(), MIN_RETRY_INTERVAL, nldebug, and NLNET::TParsedCommandLine::ParamValue.
| void NLNET::CGatewayL3ClientTransport::onCommand | ( | const CMessage & | command | ) | throw (EInvalidCommand) [inline, virtual] |
The gateway send a command message to the transport.
Implements NLNET::IGatewayTransport.
Definition at line 614 of file module_gateway_transport.cpp.
| void NLNET::CGatewayL3ClientTransport::onDisconnection | ( | TSockId | from | ) | [inline] |
Event management.
Definition at line 765 of file module_gateway_transport.cpp.
References NLNET::IGatewayTransport::_Gateway, _Routes, H_AUTO, nlassert, nldebug, and NLNET::IModuleGateway::onRouteRemoved().
Referenced by cbDisconnection().
| void NLNET::CGatewayL3ClientTransport::onDispatchMessage | ( | const CMessage & | msgin, | |
| TSockId | from, | |||
| CCallbackNetBase & | ||||
| ) | [inline] |
Definition at line 789 of file module_gateway_transport.cpp.
References NLNET::IGatewayTransport::_Gateway, _Routes, NLNET::CMessage::getName(), H_AUTO, nlassert, and NLNET::IModuleGateway::onReceiveMessage().
| virtual void NLNET::CGatewayL3ClientTransport::update | ( | ) | [inline, virtual] |
The gateway update the transport regularly.
Implements NLNET::IGatewayTransport.
Definition at line 518 of file module_gateway_transport.cpp.
References NLNET::IGatewayTransport::_Gateway, _RetryInterval, _Routes, NLNET::CInetAddress::asString(), NLNET::CL3ClientRoute::CallbackClient, NLNET::CCallbackClient::connect(), NLNET::CCallbackClient::connected(), deletePendingRoute(), NLNET::CCallbackClient::flush(), H_AUTO, NLNET::KEEP_ALIVE_DELAY, NLNET::CL3ClientRoute::LastCommTime, NLNET::CL3ClientRoute::LastConnectionRetry, nldebug, nlinfo, NLNET::IModuleGateway::onRouteAdded(), NLNET::CL3ClientRoute::sendMessage(), NLNET::CL3ClientRoute::ServerAddr, and NLNET::CCallbackClient::update2().
friend class CL3ClientRoute [friend] |
Definition at line 441 of file module_gateway_transport.cpp.
Referenced by connect().
CGatewayL3ClientTransport::TDispatcherIndex NLNET::CGatewayL3ClientTransport::_DispatcherIndex [static] |
Definition at line 445 of file module_gateway_transport.cpp.
Referenced by cbDispatchMessage(), close(), connect(), and deletePendingRoute().
Definition at line 457 of file module_gateway_transport.cpp.
Referenced by close(), connect(), and deletePendingRoute().
Retry interval for reconnection.
Definition at line 463 of file module_gateway_transport.cpp.
Referenced by connect(), onCommand(), and update().
Definition at line 454 of file module_gateway_transport.cpp.
Referenced by close(), connect(), deletePendingRoute(), and ~CGatewayL3ClientTransport().
Definition at line 449 of file module_gateway_transport.cpp.
Referenced by close(), connect(), deletePendingRoute(), dump(), getRouteCount(), onDisconnection(), onDispatchMessage(), and update().
the route to delete outside of the update loop
Definition at line 460 of file module_gateway_transport.cpp.
Referenced by deletePendingRoute().
1.6.1