From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../doxygen/nel/classNLNET_1_1CUnifiedNetwork.html | 2716 ++++++++++++++++++++ 1 file changed, 2716 insertions(+) create mode 100644 docs/doxygen/nel/classNLNET_1_1CUnifiedNetwork.html (limited to 'docs/doxygen/nel/classNLNET_1_1CUnifiedNetwork.html') diff --git a/docs/doxygen/nel/classNLNET_1_1CUnifiedNetwork.html b/docs/doxygen/nel/classNLNET_1_1CUnifiedNetwork.html new file mode 100644 index 00000000..7d204e09 --- /dev/null +++ b/docs/doxygen/nel/classNLNET_1_1CUnifiedNetwork.html @@ -0,0 +1,2716 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

NLNET::CUnifiedNetwork Class Reference

Layer 5. +More... +

+#include <unified_network.h> +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Methods

void init (const CInetAddress *addr, CCallbackNetBase::TRecordingState rec, const std::string &shortName, uint16 port, TServiceId &sid)
 Creates the connection to the Naming Service. More...

void connect ()
 Registers to the Naming Service, and connects to the present services. More...

void release ()
 Closes the connection to the naming service, every other connection and free. More...

void addService (const std::string &name, const CInetAddress &addr, bool sendId=true, bool external=true, uint16 sid=0, bool autoRetry=true, bool shouldBeAlreayInserted=false)
 Adds a specific service to the list of connected services. More...

void addService (const std::string &name, const std::vector< CInetAddress > &addr, bool sendId=true, bool external=true, uint16 sid=0, bool autoRetry=true, bool shouldBeAlreayInserted=false)
void addCallbackArray (const TUnifiedCallbackItem *callbackarray, NLMISC::CStringIdArray::TStringId arraysize)
 Adds a callback array in the system. More...

void update (NLMISC::TTime timeout=0)
 Call it evenly. More...

bool send (const std::string &serviceName, const CMessage &msg, uint8 nid=0xFF)
 Sends a message to a specific serviceName. More...

bool send (uint16 serviceId, const CMessage &msg, uint8 nid=0xFF)
 Sends a message to a specific serviceId. More...

void send (const CMessage &msg, uint8 nid=0xFF)
 Broadcasts a message to all connected services. More...

void setServiceUpCallback (const std::string &serviceName, TUnifiedNetCallback cb, void *arg=0, bool back=true)
 Sets callback for incoming connections. More...

void setServiceDownCallback (const std::string &serviceName, TUnifiedNetCallback cb, void *arg=0, bool back=true)
 Sets callback for disconnections. More...

void addNetworkAssociation (const std::string &networkName, uint8 nid)
 Associate a string with a network id If the send don't set a specific nid, it ll use the 0, so be sure that the nid 0 is set to a network. More...

void clearNetworkAssociation ()
 Clear all network association. More...

void addDefaultNetwork (const std::string &defnet)
 This array says to wich network we need to send the message for the default nid. More...

void clearDefaultNetwork ()
 Clear all default network. More...

bool isServiceLocal (uint16 sid)
 Returns true if the sid service is on the same computer than this service. More...

bool isServiceLocal (const std::string &serviceName)
 Returns true if the serviceName service is on the same computer than this service. More...

CCallbackNetBasegetNetBase (const std::string &name, TSockId &host, uint8 nid=0xFF)
 
+Warning:
+You should not use getNetBase functions because it could have more than one connection to a service and in this case it ll return the first connection Gets the CCallbackNetBase of the service.
More...


CCallbackNetBasegetNetBase (uint16 sid, TSockId &host, uint8 nid=0xFF)
 Gets the CCallbackNetBase of the service. More...

uint64 getBytesSent ()
 Gets the total number of bytes sent. More...

uint64 getBytesReceived ()
 Gets the total number of bytes received. More...

uint64 getSendQueueSize ()
 Gets the total number of bytes queued for sending. More...

uint64 getReceiveQueueSize ()
 Gets the total number of bytes queued after receiving. More...

TUnifiedMsgCallback findCallback (const std::string &callbackName)
 Find a callback in the array. More...

void displayInternalTables (NLMISC::CLog *log=NLMISC::InfoLog)

Static Public Methods

CUnifiedNetwork * getInstance ()
 Returns the singleton instance of the CUnifiedNetwork class. More...

bool isUsed ()
 Returns true if the application called getInstance(). More...


Private Types

typedef std::map< std::string,
+ TUnifiedMsgCallback
TMsgMappedCallback
 A map of callbacks, refered by message name. More...

typedef std::pair< TUnifiedNetCallback,
+ void * > 
TCallbackArgItem
 A callback and its user data. More...

typedef std::hash_multimap<
+ std::string, TCallbackArgItem
TNameMappedCallback
 A map of service up/down callbacks with their user data. More...


Private Methods

 CUnifiedNetwork ()
 ~CUnifiedNetwork ()
void autoCheck ()
CUnifiedConnectiongetUnifiedConnection (uint16 sid)
bool haveNamedCnx (const std::string &name, uint16 sid)
void addNamedCnx (const std::string &name, uint16 sid)
void removeNamedCnx (const std::string &name, uint16 sid)
uint8 findConnectionId (uint16 sid, uint8 nid)

Private Attributes

std::vector< CUnifiedConnection_IdCnx
 Vector of connections by service id (sid is the entry in this array, it means that there s some hole). More...

std::vector< uint16_UsedConnection
 This vector contains only an index to the unified connection. It is used to have quick access on the available connections. More...

TNameMappedConnection _NamedCnx
 Map of connections by service name. More...

CCallbackServer_CbServer
 The callback server. More...

uint16 _ServerPort
 The server port. More...

TNameMappedCallback _UpCallbacks
 Map of the up/down service callbacks. More...

std::vector< TCallbackArgItem_UpUniCallback
TNameMappedCallback _DownCallbacks
std::vector< TCallbackArgItem_DownUniCallback
CCallbackNetBase::TRecordingState _RecordingState
 Recording state. More...

TServiceId _SId
 Service id of the running service. More...

std::string _Name
 Service name. More...

TMsgMappedCallback _Callbacks
 Map of callbacks. More...

uint16 _ExtSId
 Used for external service. More...

NLMISC::TTime _LastRetry
 Last time of retry. More...

NLMISC::TTime _NextUpdateTime
 Time of the theorical next update. More...

NLNET::CInetAddress _NamingServiceAddr
 Naming service. More...

bool _Initialised
 true if initialisation function called. More...

std::vector< uint32_NetworkAssociations
 for each nid, which network address. More...

std::vector< std::string > _DefaultNetwork
 for each services, which network to take. More...


Static Private Attributes

CUnifiedNetwork * _Instance = NULL
 The main instance. More...


Friends

struct isServiceLocalClass
void uncbConnection (TSockId from, void *arg)
void uncbDisconnection (TSockId from, void *arg)
void uncbServiceIdentification (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void uncbMsgProcessing (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void uNetRegistrationBroadcast (const std::string &name, TServiceId sid, const std::vector< CInetAddress > &addr)
void uNetUnregistrationBroadcast (const std::string &name, TServiceId sid, const std::vector< CInetAddress > &addr)
+


Detailed Description

+Layer 5. +

+

+Author:
+Vianney Lecroart, Benjamin Legros , Nevrax France
+Date:
+2002
+

+ +

+Definition at line 71 of file unified_network.h.


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::pair<TUnifiedNetCallback, void *> NLNET::CUnifiedNetwork::TCallbackArgItem [private] +
+
+ + + + + +
+   + + +

+A callback and its user data. +

+ +

+Definition at line 232 of file unified_network.h.

+

+ + + + +
+ + +
typedef std::map<std::string, TUnifiedMsgCallback> NLNET::CUnifiedNetwork::TMsgMappedCallback [private] +
+
+ + + + + +
+   + + +

+A map of callbacks, refered by message name. +

+ +

+Definition at line 229 of file unified_network.h.

+

+ + + + +
+ + +
typedef std::hash_multimap<std::string, TCallbackArgItem> NLNET::CUnifiedNetwork::TNameMappedCallback [private] +
+
+ + + + + +
+   + + +

+A map of service up/down callbacks with their user data. +

+ +

+Definition at line 235 of file unified_network.h.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLNET::CUnifiedNetwork::CUnifiedNetwork   [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 461 of file unified_network.h. +

+References _CbServer, _ExtSId, _Initialised, _LastRetry, and _NextUpdateTime. +

+Referenced by getInstance.

+

+ + + + +
+ + + + + + + + + +
NLNET::CUnifiedNetwork::~CUnifiedNetwork   [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 465 of file unified_network.h.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::addCallbackArray const TUnifiedCallbackItem  callbackarray,
NLMISC::CStringIdArray::TStringId   arraysize
+
+ + + + + +
+   + + +

+Adds a callback array in the system. +

+You can add callback only *after* adding the server, the client or the group. +

+Definition at line 1117 of file unified_network.cpp. +

+References _Callbacks.

+

+ + + + +
+ + + + + + + + + + +
void NLNET::CUnifiedNetwork::addDefaultNetwork const std::string &   defnet [inline]
+
+ + + + + +
+   + + +

+This array says to wich network we need to send the message for the default nid. +

+For example you can says that message for AES will use the network 0 and message for LS will use the network 1. To do that, just call the function with string "AES0" and "LS1" the number is the nid (look at addNetworkAssociation()) addNetworkAssociation("192.168.0.0", 0); addNetworkAssociation("192.168.1.0", 1); In this case if you send a message to AES with default nid, it'll be send to 192.168.0.x In this case if you send a message to LS with default nid, it'll be send to 192.168.1.y +

+Definition at line 185 of file unified_network.h. +

+References _DefaultNetwork, and nlinfo.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::addNamedCnx const std::string &   name,
uint16   sid
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1612 of file unified_network.cpp. +

+References _NamedCnx, NLNET::allstuffs, AUTOCHECK_DISPLAY, range, and NLNET::test. +

+Referenced by update.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::addNetworkAssociation const std::string &   networkName,
uint8   nid
+
+ + + + + +
+   + + +

+Associate a string with a network id If the send don't set a specific nid, it ll use the 0, so be sure that the nid 0 is set to a network. +

+You must call this function before the connect() function.

+Parameters:
+ + + +
networkName  +must be in a xxx.xxx.xxx.xxx format. The low value will be ignore depending of the network class.
nid  +a number (used as an index in a vector for constant access so numbers should be contiguous) that will be use to send to this network.
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::addService const std::string &   name,
const std::vector< CInetAddress > &   addr,
bool   sendId = true,
bool   external = true,
uint16   sid = 0,
bool   autoRetry = true,
bool   shouldBeAlreayInserted = false
+
+ + + + + +
+   + + +

+

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::addService const std::string &   name,
const CInetAddress  addr,
bool   sendId = true,
bool   external = true,
uint16   sid = 0,
bool   autoRetry = true,
bool   shouldBeAlreayInserted = false
+
+ + + + + +
+   + + +

+Adds a specific service to the list of connected services. +

+ +

+Referenced by connect.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CUnifiedNetwork::autoCheck   [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1432 of file unified_network.cpp. +

+References _IdCnx, _NamedCnx, _NetworkAssociations, _UsedConnection, and AUTOCHECK_DISPLAY. +

+Referenced by update.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CUnifiedNetwork::clearDefaultNetwork   [inline]
+
+ + + + + +
+   + + +

+Clear all default network. +

+ +

+Definition at line 188 of file unified_network.h. +

+References _DefaultNetwork.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CUnifiedNetwork::clearNetworkAssociation   [inline]
+
+ + + + + +
+   + + +

+Clear all network association. +

+ +

+Definition at line 176 of file unified_network.h. +

+References _NetworkAssociations.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CUnifiedNetwork::connect  
+
+ + + + + +
+   + + +

+Registers to the Naming Service, and connects to the present services. +

+ +

+Definition at line 519 of file unified_network.cpp. +

+References _Initialised, _SId, addService, NLMISC::getThreadId, nlassertex, nlwarning, and NLNET::ThreadCreator.

+

+ + + + +
+ + + + + + + + + + +
void NLNET::CUnifiedNetwork::displayInternalTables NLMISC::CLog  log = NLMISC::InfoLog
+
+ + + + + +
+   + + +

+ +

+Definition at line 1513 of file unified_network.cpp. +

+References _IdCnx, _NamedCnx, _NetworkAssociations, _UsedConnection, NLMISC::CLog::displayNL, and NLNET::internalIPAddressToString.

+

+ + + + +
+ + + + + + + + + + +
TUnifiedMsgCallback NLNET::CUnifiedNetwork::findCallback const std::string &   callbackName
+
+ + + + + +
+   + + +

+Find a callback in the array. +

+ +

+Definition at line 1336 of file unified_network.cpp. +

+References _Callbacks, and NLNET::TUnifiedMsgCallback.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint8 NLNET::CUnifiedNetwork::findConnectionId uint16   sid,
uint8   nid
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 959 of file unified_network.cpp. +

+References _IdCnx, and nlwarning. +

+Referenced by getNetBase, and send.

+

+ + + + +
+ + + + + + + + + +
uint64 NLNET::CUnifiedNetwork::getBytesReceived  
+
+ + + + + +
+   + + +

+Gets the total number of bytes received. +

+ +

+Definition at line 1206 of file unified_network.cpp. +

+References _CbServer, _IdCnx, and _UsedConnection.

+

+ + + + +
+ + + + + + + + + +
uint64 NLNET::CUnifiedNetwork::getBytesSent  
+
+ + + + + +
+   + + +

+Gets the total number of bytes sent. +

+ +

+Definition at line 1182 of file unified_network.cpp. +

+References _CbServer, _IdCnx, and _UsedConnection.

+

+ + + + +
+ + + + + + + + + +
CUnifiedNetwork * NLNET::CUnifiedNetwork::getInstance   [static]
+
+ + + + + +
+   + + +

+Returns the singleton instance of the CUnifiedNetwork class. +

+ +

+Definition at line 1397 of file unified_network.cpp. +

+References _Instance, and CUnifiedNetwork. +

+Referenced by NLNET::IService::main.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
CCallbackNetBase * NLNET::CUnifiedNetwork::getNetBase uint16   sid,
TSockId  host,
uint8   nid = 0xFF
+
+ + + + + +
+   + + +

+Gets the CCallbackNetBase of the service. +

+ +

+Definition at line 1311 of file unified_network.cpp. +

+References _IdCnx, _Initialised, findConnectionId, NLMISC::getThreadId, nlassertex, nlwarning, NLNET::ThreadCreator, and NLNET::TSockId.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
CCallbackNetBase * NLNET::CUnifiedNetwork::getNetBase const std::string &   name,
TSockId  host,
uint8   nid = 0xFF
+
+ + + + + +
+   + + +

+

+Warning:
+You should not use getNetBase functions because it could have more than one connection to a service and in this case it ll return the first connection Gets the CCallbackNetBase of the service.
+

+ +

+Definition at line 1278 of file unified_network.cpp. +

+References _IdCnx, _Initialised, _NamedCnx, findConnectionId, NLMISC::getThreadId, nlassertex, nlwarning, NLNET::ThreadCreator, and NLNET::TSockId.

+

+ + + + +
+ + + + + + + + + +
uint64 NLNET::CUnifiedNetwork::getReceiveQueueSize  
+
+ + + + + +
+   + + +

+Gets the total number of bytes queued after receiving. +

+ +

+Definition at line 1254 of file unified_network.cpp. +

+References _CbServer, _IdCnx, and _UsedConnection.

+

+ + + + +
+ + + + + + + + + +
uint64 NLNET::CUnifiedNetwork::getSendQueueSize  
+
+ + + + + +
+   + + +

+Gets the total number of bytes queued for sending. +

+ +

+Definition at line 1230 of file unified_network.cpp. +

+References _CbServer, _IdCnx, and _UsedConnection.

+

+ + + + +
+ + + + + + + + + + +
CUnifiedNetwork::CUnifiedConnection * NLNET::CUnifiedNetwork::getUnifiedConnection uint16   sid [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1414 of file unified_network.cpp. +

+References _IdCnx, AUTOCHECK_DISPLAY, and nlwarning.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLNET::CUnifiedNetwork::haveNamedCnx const std::string &   name,
uint16   sid
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1596 of file unified_network.cpp. +

+References _NamedCnx, and range. +

+Referenced by update.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::init const CInetAddress  addr,
CCallbackNetBase::TRecordingState   rec,
const std::string &   shortName,
uint16   port,
TServiceId  sid
+
+ + + + + +
+   + + +

+Creates the connection to the Naming Service. +

+If the connection failed, ESocketConnectionFailed exception is generated. This function is called automatically called by the service class at the beginning.

+Parameters:
+ + + +
addr  +address of the naming service (0 is you don't want to use the naming service)
rec  +recorging state to know if we have to record or replay messages
+
+

+ + + + +
+ + + + + + + + + + +
bool NLNET::CUnifiedNetwork::isServiceLocal const std::string &   serviceName
+
+ + + + + +
+   + + +

+Returns true if the serviceName service is on the same computer than this service. +

+ +

+Definition at line 1345 of file unified_network.cpp. +

+References _Name, _NamedCnx, isServiceLocal, and range.

+

+ + + + +
+ + + + + + + + + + +
bool NLNET::CUnifiedNetwork::isServiceLocal uint16   sid
+
+ + + + + +
+   + + +

+Returns true if the sid service is on the same computer than this service. +

+ +

+Definition at line 1364 of file unified_network.cpp. +

+References _IdCnx, and _SId. +

+Referenced by isServiceLocal.

+

+ + + + +
+ + + + + + + + + +
bool NLNET::CUnifiedNetwork::isUsed   [static]
+
+ + + + + +
+   + + +

+Returns true if the application called getInstance(). +

+This function is used to know if the user is using layer 4 or layer 5 +

+Definition at line 1405 of file unified_network.cpp. +

+References _Instance.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CUnifiedNetwork::release  
+
+ + + + + +
+   + + +

+Closes the connection to the naming service, every other connection and free. +

+ +

+Definition at line 552 of file unified_network.cpp. +

+References _Callbacks, _CbServer, _DownCallbacks, _IdCnx, _Initialised, _NamedCnx, _UpCallbacks, _UsedConnection, NLMISC::getThreadId, nlwarning, and NLNET::ThreadCreator.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::removeNamedCnx const std::string &   name,
uint16   sid
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1639 of file unified_network.cpp. +

+References _NamedCnx, NLNET::allstuffs, AUTOCHECK_DISPLAY, range, and NLNET::test.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::send const CMessage  msg,
uint8   nid = 0xFF
+
+ + + + + +
+   + + +

+Broadcasts a message to all connected services. +

+

+Parameters:
+ + + +
msg  +the message you want to send.
nid  +Network Id specify to which network the message must pass throw (0xFF mean the default network)
+
+

+Definition at line 1089 of file unified_network.cpp. +

+References _IdCnx, _Initialised, findConnectionId, NLMISC::getThreadId, nlassertex, nlwarning, and NLNET::ThreadCreator.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLNET::CUnifiedNetwork::send uint16   serviceId,
const CMessage  msg,
uint8   nid = 0xFF
+
+ + + + + +
+   + + +

+Sends a message to a specific serviceId. +

+

+Parameters:
+ + + + +
serviceId  +Id of the service you want to send the message.
msg  +the message you want to send.
nid  +Network Id specify to which network the message must pass throw (0xFF mean the default network)
+
+Returns:
+true if the service was found (may return true even if the sending failed)
+

+Definition at line 1065 of file unified_network.cpp. +

+References _IdCnx, _Initialised, findConnectionId, NLMISC::getThreadId, nlassertex, nlwarning, and NLNET::ThreadCreator.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLNET::CUnifiedNetwork::send const std::string &   serviceName,
const CMessage  msg,
uint8   nid = 0xFF
+
+ + + + + +
+   + + +

+Sends a message to a specific serviceName. +

+If there's more than one service with this name, all services of this name will receive the message.

+Parameters:
+ + + + +
serviceName  +name of the service you want to send the message (may not be unique.)
msg  +the message you want to send.
nid  +Network Id specify to which network the message must pass throw (0xFF mean the default network)
+
+Returns:
+true if the service was found (one or more instances) (may return true even if the sending failed)
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::setServiceDownCallback const std::string &   serviceName,
TUnifiedNetCallback   cb,
void *   arg = 0,
bool   back = true
+
+ + + + + +
+   + + +

+Sets callback for disconnections. +

+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. +

+If the serviceName is "*", you can set more than one callback, each one will be called one after one. Otherwise only the last setCallback will be called (and you can set cb to 0 to remove the callback). If the serviceName is "*", the callback will be call for any services If you set the same callback for a specific service S and for "*", the callback might be call twice (in case the service S is down)

+Parameters:
+ + +
back  +if true, put the callback at the end of the callback array, otherwise but on the beginning. You should always use true
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CUnifiedNetwork::setServiceUpCallback const std::string &   serviceName,
TUnifiedNetCallback   cb,
void *   arg = 0,
bool   back = true
+
+ + + + + +
+   + + +

+Sets callback for incoming connections. +

+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 +

+If the serviceName is "*", you can set more than one callback, each one will be called one after one. Otherwise only the last setCallback will be called (and you can set cb to 0 to remove the callback). If the serviceName is "*", the callback will be call for any services If you set the same callback for a specific service S and for "*", the callback might be call twice (in case the service S is up)

+Parameters:
+ + +
back  +if true, put the callback at the end of the callback array, otherwise but on the beginning. You should always use true
+
+

+ + + + +
+ + + + + + + + + + +
void NLNET::CUnifiedNetwork::update NLMISC::TTime   timeout = 0
+
+ + + + + +
+   + + +

+Call it evenly. +

+the parameter select the timeout value in seconds 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 804 of file unified_network.cpp. +

+References _CbServer, _IdCnx, _Initialised, _LastRetry, _Name, _NamingServiceAddr, _NextUpdateTime, _RecordingState, _ServerPort, _SId, _UpCallbacks, _UpUniCallback, _UsedConnection, addNamedCnx, NLNET::CInetAddress::asString, autoCheck, NLMISC::getThreadId, haveNamedCnx, NLNET::CInetAddress::isValid, nlassert, nlassertex, nlinfo, NLMISC::nlSleep, nlwarning, NLNET::ThreadCreator, NLMISC::TTime, and NLNET::TUnifiedNetCallback.

+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend struct isServiceLocalClass [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 487 of file unified_network.h.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void uncbConnection TSockId   from,
void *   arg
[friend]
+
+ + + + + +
+   + + +

+ +

+Definition at line 164 of file unified_network.cpp.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void uncbDisconnection TSockId   from,
void *   arg
[friend]
+
+ + + + + +
+   + + +

+ +

+Definition at line 171 of file unified_network.cpp.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void uncbMsgProcessing CMessage  msgin,
TSockId   from,
CCallbackNetBase  netbase
[friend]
+
+ + + + + +
+   + + +

+ +

+Definition at line 390 of file unified_network.cpp.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void uncbServiceIdentification CMessage  msgin,
TSockId   from,
CCallbackNetBase  netbase
[friend]
+
+ + + + + +
+   + + +

+ +

+Definition at line 274 of file unified_network.cpp.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void uNetRegistrationBroadcast const std::string &   name,
TServiceId   sid,
const std::vector< CInetAddress > &   addr
[friend]
+
+ + + + + +
+   + + +

+

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void uNetUnregistrationBroadcast const std::string &   name,
TServiceId   sid,
const std::vector< CInetAddress > &   addr
[friend]
+
+ + + + + +
+   + + +

+

+


Member Data Documentation

+

+ + + + +
+ + +
TMsgMappedCallback NLNET::CUnifiedNetwork::_Callbacks [private] +
+
+ + + + + +
+   + + +

+Map of callbacks. +

+ +

+Definition at line 434 of file unified_network.h. +

+Referenced by addCallbackArray, findCallback, and release.

+

+ + + + +
+ + +
CCallbackServer* NLNET::CUnifiedNetwork::_CbServer [private] +
+
+ + + + + +
+   + + +

+The callback server. +

+ +

+Definition at line 413 of file unified_network.h. +

+Referenced by CUnifiedNetwork, getBytesReceived, getBytesSent, getReceiveQueueSize, getSendQueueSize, release, and update.

+

+ + + + +
+ + +
std::vector<std::string> NLNET::CUnifiedNetwork::_DefaultNetwork [private] +
+
+ + + + + +
+   + + +

+for each services, which network to take. +

+ +

+Definition at line 458 of file unified_network.h. +

+Referenced by addDefaultNetwork, and clearDefaultNetwork.

+

+ + + + +
+ + +
TNameMappedCallback NLNET::CUnifiedNetwork::_DownCallbacks [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 421 of file unified_network.h. +

+Referenced by release.

+

+ + + + +
+ + +
std::vector<TCallbackArgItem> NLNET::CUnifiedNetwork::_DownUniCallback [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 422 of file unified_network.h.

+

+ + + + +
+ + +
uint16 NLNET::CUnifiedNetwork::_ExtSId [private] +
+
+ + + + + +
+   + + +

+Used for external service. +

+ +

+Definition at line 437 of file unified_network.h. +

+Referenced by CUnifiedNetwork.

+

+ + + + +
+ + +
std::vector<CUnifiedConnection> NLNET::CUnifiedNetwork::_IdCnx [private] +
+
+ + + + + +
+   + + +

+Vector of connections by service id (sid is the entry in this array, it means that there s some hole). +

+ +

+Definition at line 404 of file unified_network.h. +

+Referenced by autoCheck, displayInternalTables, findConnectionId, getBytesReceived, getBytesSent, getNetBase, getReceiveQueueSize, getSendQueueSize, getUnifiedConnection, isServiceLocal, release, send, and update.

+

+ + + + +
+ + +
bool NLNET::CUnifiedNetwork::_Initialised [private] +
+
+ + + + + +
+   + + +

+true if initialisation function called. +

+ +

+Definition at line 452 of file unified_network.h. +

+Referenced by connect, CUnifiedNetwork, getNetBase, release, send, and update.

+

+ + + + +
+ + +
CUnifiedNetwork * NLNET::CUnifiedNetwork::_Instance = NULL [static, private] +
+
+ + + + + +
+   + + +

+The main instance. +

+ +

+Definition at line 1395 of file unified_network.cpp. +

+Referenced by getInstance, and isUsed.

+

+ + + + +
+ + +
NLMISC::TTime NLNET::CUnifiedNetwork::_LastRetry [private] +
+
+ + + + + +
+   + + +

+Last time of retry. +

+ +

+Definition at line 440 of file unified_network.h. +

+Referenced by CUnifiedNetwork, and update.

+

+ + + + +
+ + +
std::string NLNET::CUnifiedNetwork::_Name [private] +
+
+ + + + + +
+   + + +

+Service name. +

+ +

+Definition at line 431 of file unified_network.h. +

+Referenced by isServiceLocal, and update.

+

+ + + + +
+ + +
TNameMappedConnection NLNET::CUnifiedNetwork::_NamedCnx [private] +
+
+ + + + + +
+   + + +

+Map of connections by service name. +

+ +

+Definition at line 410 of file unified_network.h. +

+Referenced by addNamedCnx, autoCheck, displayInternalTables, getNetBase, haveNamedCnx, isServiceLocal, release, and removeNamedCnx.

+

+ + + + +
+ + +
NLNET::CInetAddress NLNET::CUnifiedNetwork::_NamingServiceAddr [private] +
+
+ + + + + +
+   + + +

+Naming service. +

+ +

+Definition at line 449 of file unified_network.h. +

+Referenced by update.

+

+ + + + +
+ + +
std::vector<uint32> NLNET::CUnifiedNetwork::_NetworkAssociations [private] +
+
+ + + + + +
+   + + +

+for each nid, which network address. +

+ +

+Definition at line 455 of file unified_network.h. +

+Referenced by autoCheck, clearNetworkAssociation, and displayInternalTables.

+

+ + + + +
+ + +
NLMISC::TTime NLNET::CUnifiedNetwork::_NextUpdateTime [private] +
+
+ + + + + +
+   + + +

+Time of the theorical next update. +

+ +

+Definition at line 443 of file unified_network.h. +

+Referenced by CUnifiedNetwork, and update.

+

+ + + + +
+ + +
CCallbackNetBase::TRecordingState NLNET::CUnifiedNetwork::_RecordingState [private] +
+
+ + + + + +
+   + + +

+Recording state. +

+ +

+Definition at line 425 of file unified_network.h. +

+Referenced by update.

+

+ + + + +
+ + +
uint16 NLNET::CUnifiedNetwork::_ServerPort [private] +
+
+ + + + + +
+   + + +

+The server port. +

+ +

+Definition at line 416 of file unified_network.h. +

+Referenced by update.

+

+ + + + +
+ + +
TServiceId NLNET::CUnifiedNetwork::_SId [private] +
+
+ + + + + +
+   + + +

+Service id of the running service. +

+ +

+Definition at line 428 of file unified_network.h. +

+Referenced by connect, isServiceLocal, and update.

+

+ + + + +
+ + +
TNameMappedCallback NLNET::CUnifiedNetwork::_UpCallbacks [private] +
+
+ + + + + +
+   + + +

+Map of the up/down service callbacks. +

+ +

+Definition at line 419 of file unified_network.h. +

+Referenced by release, and update.

+

+ + + + +
+ + +
std::vector<TCallbackArgItem> NLNET::CUnifiedNetwork::_UpUniCallback [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 420 of file unified_network.h. +

+Referenced by update.

+

+ + + + +
+ + +
std::vector<uint16> NLNET::CUnifiedNetwork::_UsedConnection [private] +
+
+ + + + + +
+   + + +

+This vector contains only an index to the unified connection. It is used to have quick access on the available connections. +

+ +

+Definition at line 407 of file unified_network.h. +

+Referenced by autoCheck, displayInternalTables, getBytesReceived, getBytesSent, getReceiveQueueSize, getSendQueueSize, release, and update.

+


The documentation for this class was generated from the following files: + + + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1