|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLNET::CNetManager Class ReferenceLayer 4.
More...
#include <net_manager.h>
List of all members.
Static Public Methods |
void | init (const CInetAddress *addr, CCallbackNetBase::TRecordingState rec) |
| Creates the connection to the Naming Service. More...
|
void | release () |
void | addServer (const std::string &serviceName, uint16 servicePort=0, bool external=false) |
| Sets up a server on a specific port with a specific service name (create a listen socket, register to naming service and so on) If servicePort is 0, it will be dynamically determinated by the Naming Service. More...
|
void | addServer (const std::string &serviceName, uint16 servicePort, NLNET::TServiceId &sid, bool external=false) |
void | addClient (const std::string &serviceName, const std::string &addr, bool autoRetry=true) |
| Creates a connection to a specific IP and associate it this a "fake" serviceName (to enable you to send data for example). More...
|
void | addClient (const std::string &serviceName) |
| Creates a connection to a service using the naming service and the serviceName. More...
|
void | addGroup (const std::string &groupName, const std::string &serviceName) |
| Creates connections to a group of service. More...
|
void | addCallbackArray (const std::string &serviceName, const TCallbackItem *callbackarray, NLMISC::CStringIdArray::TStringId arraysize) |
| Adds a callback array to a specific service connection. You can add callback only *after* adding the server, the client or the group. More...
|
void | update (NLMISC::TTime timeout=0) |
| Call it evenly. More...
|
void | send (const std::string &serviceName, const CMessage &buffer, TSockId hostid=InvalidSockId) |
| Sends a message to a specific serviceName. More...
|
void | setConnectionCallback (const std::string &serviceName, TNetManagerCallback cb, void *arg) |
| Sets callback for incoming connections (or NULL to disable callback) On a client, the callback will be call when the connection to the server is established (the first connection or after the server shutdown and started) On a server, the callback is called each time a new client is connected to him. More...
|
void | setDisconnectionCallback (const std::string &serviceName, TNetManagerCallback cb, void *arg) |
| Sets callback for disconnections (or NULL to disable callback) On a client, the callback will be call each time the connection to the server is lost On a server, the callback is called each time a client is disconnected. More...
|
NLMISC::CStringIdArray & | getSIDA (const std::string &serviceName) |
| Use this function to get the String ID Array needed when you want to create a message. More...
|
CCallbackNetBase * | getNetBase (const std::string &serviceName) |
| Returns the connection if you want to do specific calls. More...
|
void | setUpdateTimeout (uint32 timeout) |
void | createConnection (CBaseStruct &Base, const CInetAddress &Addr, const std::string &name) |
uint64 | getBytesSent () |
uint64 | getBytesReceived () |
uint64 | getReceiveQueueSize () |
uint64 | getSendQueueSize () |
Private Types |
typedef std::map< std::string,
CBaseStruct > | TBaseMap |
typedef TBaseMap::iterator | ItBaseMap |
Private Methods |
| CNetManager () |
Static Private Methods |
ItBaseMap | find (const std::string &serviceName) |
Static Private Attributes |
TBaseMap | _BaseMap |
CCallbackNetBase::TRecordingState | _RecordingState |
NLMISC::TTime | _NextUpdateTime = 0 |
Friends |
void | RegistrationBroadcast (const std::string &name, TServiceId sid, const std::vector< CInetAddress > &addr) |
Detailed Description
Layer 4.
In case of addGroup(), messages are *not* associate with id, so the message type is always sent with string.
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 99 of file net_manager.h.
Member Typedef Documentation
typedef TBaseMap::iterator NLNET::CNetManager::ItBaseMap [private]
|
|
|
Definition at line 171 of file net_manager.h.
Referenced by addCallbackArray, addClient, addGroup, addServer, getBytesReceived, getBytesSent, getNetBase, getReceiveQueueSize, getSendQueueSize, getSIDA, release, send, setConnectionCallback, setDisconnectionCallback, and update. |
typedef std::map<std::string, CBaseStruct> NLNET::CNetManager::TBaseMap [private]
|
|
Constructor & Destructor Documentation
NLNET::CNetManager::CNetManager |
( |
|
) |
[inline, private] |
|
Member Function Documentation
void NLNET::CNetManager::addClient |
( |
const std::string & |
serviceName |
) |
[static] |
|
void NLNET::CNetManager::addClient |
( |
const std::string & |
serviceName, |
|
|
const std::string & |
addr, |
|
|
bool |
autoRetry = true |
|
) |
[static] |
|
void NLNET::CNetManager::addGroup |
( |
const std::string & |
groupName, |
|
|
const std::string & |
serviceName |
|
) |
[static] |
|
void NLNET::CNetManager::addServer |
( |
const std::string & |
serviceName, |
|
|
uint16 |
servicePort, |
|
|
NLNET::TServiceId & |
sid, |
|
|
bool |
external = false |
|
) |
[static] |
|
void NLNET::CNetManager::addServer |
( |
const std::string & |
serviceName, |
|
|
uint16 |
servicePort = 0, |
|
|
bool |
external = false |
|
) |
[static] |
|
|
Sets up a server on a specific port with a specific service name (create a listen socket, register to naming service and so on) If servicePort is 0, it will be dynamically determinated by the Naming Service.
If sid id 0, the service id will be dynamically determinated by the Naming Service.
Definition at line 201 of file net_manager.cpp.
References NLNET::TServiceId. |
void NLNET::CNetManager::createConnection |
( |
CBaseStruct & |
Base, |
|
|
const CInetAddress & |
Addr, |
|
|
const std::string & |
name |
|
) |
[static] |
|
uint64 NLNET::CNetManager::getBytesReceived |
( |
|
) |
[static] |
|
uint64 NLNET::CNetManager::getBytesSent |
( |
|
) |
[static] |
|
CCallbackNetBase * NLNET::CNetManager::getNetBase |
( |
const std::string & |
serviceName |
) |
[static] |
|
uint64 NLNET::CNetManager::getReceiveQueueSize |
( |
|
) |
[static] |
|
uint64 NLNET::CNetManager::getSendQueueSize |
( |
|
) |
[static] |
|
void NLNET::CNetManager::release |
( |
|
) |
[static] |
|
void NLNET::CNetManager::setConnectionCallback |
( |
const std::string & |
serviceName, |
|
|
TNetManagerCallback |
cb, |
|
|
void * |
arg |
|
) |
[static] |
|
|
Sets callback for incoming connections (or NULL to disable callback) On a client, the callback will be call when the connection to the server is established (the first connection or after the server shutdown and started) On a server, the callback is called each time a new client is connected to him.
Definition at line 472 of file net_manager.cpp.
References find, ItBaseMap, nldebug, and NLNET::TNetManagerCallback. |
void NLNET::CNetManager::setDisconnectionCallback |
( |
const std::string & |
serviceName, |
|
|
TNetManagerCallback |
cb, |
|
|
void * |
arg |
|
) |
[static] |
|
|
Sets callback for disconnections (or NULL to disable callback) On a client, the callback will be call each time the connection to the server is lost On a server, the callback is called each time a client is disconnected.
Definition at line 480 of file net_manager.cpp.
References find, ItBaseMap, nldebug, and NLNET::TNetManagerCallback. |
void NLNET::CNetManager::setUpdateTimeout |
( |
uint32 |
timeout |
) |
[static] |
|
void NLNET::CNetManager::update |
( |
NLMISC::TTime |
timeout = 0 |
) |
[static] |
|
|
Call it evenly.
the parameter select the timeout value in milliseconds for each update. You are absolutely certain that this function will not be returns before this amount of time you set. If you set the update timeout value higher than 0, all messages in queues will be process until the time is greater than the timeout user update(). If you set the update timeout value to 0, all messages in queues will be process one time before calling the user update(). In this case, we don't nlSleep(1).
Definition at line 357 of file net_manager.cpp.
References _BaseMap, _NextUpdateTime, ItBaseMap, nlassert, nlinfo, NLMISC::nlSleep, and NLMISC::TTime. |
Friends And Related Function Documentation
void RegistrationBroadcast |
( |
const std::string & |
name, |
|
|
TServiceId |
sid, |
|
|
const std::vector< CInetAddress > & |
addr |
|
) |
[friend] |
|
Member Data Documentation
TTime NLNET::CNetManager::_NextUpdateTime = 0 [static, private]
|
|
The documentation for this class was generated from the following files:
|
|