NLNET::CUnifiedNetwork::CUnifiedConnection Class Reference


Detailed Description

This may contains a CCallbackClient or a TSockId, depending on which type of connection it is.

Definition at line 253 of file unified_network.h.

Public Types

enum  TState { NotUsed, Ready }

Public Member Functions

 CUnifiedConnection (const std::string &name, uint16 id, CCallbackClient *cbc)
 CUnifiedConnection (const std::string &name, uint16 id, bool isExternal)
 CUnifiedConnection ()
void display (bool full, NLMISC::CLog *log=NLMISC::InfoLog)
void reset ()
void setupNetworkAssociation (const std::vector< uint32 > &networkAssociations, const std::vector< std::string > &defaultNetwork)

Data Fields

uint AutoCheck
 Used for debug purpose.

bool AutoRetry
 Auto-retry mode.

std::vector< TConnectionConnection
 Connection to the service (me be > 1).

uint8 DefaultNetwork
 This contains the connection id that will be used for default network, it's a connection id used for Connection index.

std::vector< CInetAddressExtAddress
 The external connection address.

bool IsExternal
 If the connection is extern to the naming service.

std::vector< uint8NetworkConnectionAssociations
 This is used to associate a nid (look addNetworkAssociation) with a TConnection.

bool SendId
 Auto identify at connection.

uint16 ServiceId
 The id of the service (is unique).

std::string ServiceName
 The name of the service (may not be unique).

TState State
 If the service entry is used.

uint32 TotalCallbackCalled


Member Enumeration Documentation

enum NLNET::CUnifiedNetwork::CUnifiedConnection::TState
 

NotUsed = the unified connection is empty, not used Ready = we can use the unified connection

Enumeration values:
NotUsed 
Ready 

Definition at line 258 of file unified_network.h.

00258 { NotUsed, Ready };


Constructor & Destructor Documentation

NLNET::CUnifiedNetwork::CUnifiedConnection::CUnifiedConnection  )  [inline]
 

Definition at line 332 of file unified_network.h.

References reset().

00332 { reset(); }

NLNET::CUnifiedNetwork::CUnifiedConnection::CUnifiedConnection const std::string &  name,
uint16  id,
bool  isExternal
[inline]
 

Definition at line 334 of file unified_network.h.

References IsExternal, Ready, reset(), ServiceId, ServiceName, and uint16.

00335                 {
00336                         reset ();
00337                         ServiceName = name;
00338                         ServiceId = id;
00339                         State = Ready;
00340                         IsExternal = isExternal;
00341                 }

NLNET::CUnifiedNetwork::CUnifiedConnection::CUnifiedConnection const std::string &  name,
uint16  id,
CCallbackClient cbc
[inline]
 

Definition at line 343 of file unified_network.h.

References Ready, reset(), ServiceId, ServiceName, and uint16.

00344                 {
00345                         reset ();
00346                         ServiceName = name;
00347                         ServiceId = id;
00348                         State = Ready;
00349                         Connection.push_back(TConnection (cbc));
00350                 }


Member Function Documentation

void NLNET::CUnifiedNetwork::CUnifiedConnection::display bool  full,
NLMISC::CLog log = NLMISC::InfoLog
 

Definition at line 1826 of file unified_network.cpp.

References NLMISC::CLog::displayNL(), ExtAddress, IsExternal, SendId, ServiceId, ServiceName, NLMISC::toString(), TotalCallbackCalled, and uint.

Referenced by NLNET::CUnifiedNetwork::displayUnifiedConnection().

01827 {
01828         log->displayNL ("> %s-%hu %s %s %s (%d ExtAddr %d Cnx) TotalCb %d", ServiceName.c_str (), ServiceId, IsExternal?"External":"NotExternal",
01829                 AutoRetry?"AutoRetry":"NoAutoRetry", SendId?"SendId":"NoSendId", ExtAddress.size (), Connection.size (), TotalCallbackCalled);
01830         
01831         uint maxc = std::max (ExtAddress.size (), Connection.size ());
01832         
01833         for (uint j = 0; j < maxc; j++)
01834         {
01835                 string base;
01836                 if(j < ExtAddress.size ())
01837                 {
01838                         base += ExtAddress[j].asString ();
01839                 }
01840                 else
01841                 {
01842                         base += "NotValid";
01843                 }
01844                 
01845                 string ext;
01846                 if(j < Connection.size () && Connection[j].valid())
01847                 {
01848                         if(Connection[j].IsServerConnection)
01849                         {
01850                                 ext += "Server ";
01851                         }
01852                         else
01853                         {
01854                                 ext += "Client ";
01855                         }
01856                         ext += Connection[j].CbNetBase->getSockId (Connection[j].HostId)->asString ();
01857                         ext += " AppId:" + toString(Connection[j].getAppId());
01858                         if (Connection[j].CbNetBase->connected ())
01859                                 ext += " Connected";
01860                         else
01861                                 ext += " NotConnected";
01862                 }
01863                 else
01864                 {
01865                         ext += "NotValid";
01866                 }
01867                 
01868                 log->displayNL ("  - %s %s", base.c_str (), ext.c_str ());
01869                 if(full)
01870                 {
01871                         log->displayNL ("     * ReceiveQueueStat");
01872                         Connection[j].CbNetBase->displayReceiveQueueStat(log);
01873                         log->displayNL ("     * SendQueueStat");
01874                         Connection[j].CbNetBase->displaySendQueueStat(log, Connection[j].HostId);
01875                         log->displayNL ("     * ThreadStat");
01876                         Connection[j].CbNetBase->displayThreadStat(log);
01877                 }
01878         }
01879 }

void NLNET::CUnifiedNetwork::CUnifiedConnection::reset void   )  [inline]
 

Definition at line 354 of file unified_network.h.

References AutoCheck, DefaultNetwork, ExtAddress, IsExternal, NetworkConnectionAssociations, NotUsed, SendId, ServiceId, ServiceName, TotalCallbackCalled, and uint.

Referenced by CUnifiedConnection(), NLNET::uncbDisconnection(), and NLNET::uNetUnregistrationBroadcast().

00355                 {
00356                         ServiceName = "DEAD";
00357                         ServiceId = 0xDEAD;
00358                         State = NotUsed;
00359                         IsExternal = false;
00360                         AutoRetry = false;
00361                         SendId = false;
00362                         AutoCheck = false;
00363                         ExtAddress.clear ();
00364                         for (uint i = 0; i < Connection.size (); i++)
00365                                 Connection[i].reset();
00366                         Connection.clear ();
00367                         DefaultNetwork = 0xDD;
00368                         NetworkConnectionAssociations.clear();
00369                         TotalCallbackCalled = 0;
00370                 }

void NLNET::CUnifiedNetwork::CUnifiedConnection::setupNetworkAssociation const std::vector< uint32 > &  networkAssociations,
const std::vector< std::string > &  defaultNetwork
[inline]
 

Definition at line 374 of file unified_network.h.

References DefaultNetwork, ExtAddress, NetworkConnectionAssociations, nlinfo, nlwarning, ServiceName, uint, uint16, uint32, and uint8.

Referenced by NLNET::CUnifiedNetwork::addService().

00375                 {
00376                         for (uint8 i = 0; i < networkAssociations.size (); i++)
00377                         {
00378                                 uint8 j;
00379                                 for (j = 0; j < ExtAddress.size (); j++)
00380                                 {
00381                                         if (ExtAddress[j].internalNetAddress() == networkAssociations[i])
00382                                         {
00383                                                 // we found an association, add it
00384                                                 if (i >= NetworkConnectionAssociations.size ())
00385                                                         NetworkConnectionAssociations.resize (i+1);
00386 
00387                                                 NetworkConnectionAssociations[i] = j;
00388                                                 nlinfo ("HNETL5: nid %hu will be use connection %hu", (uint16)i, (uint16)j);
00389                                                 break;
00390                                         }
00391                                 }
00392                                 if (j == ExtAddress.size ())
00393                                 {
00394                                         nlinfo ("HNETL5: nid %hu is not found", (uint16)i);
00395                                 }
00396                         }
00397                         // find the default network
00398                         uint j;
00399                         for (j = 0; j < defaultNetwork.size (); j++)
00400                         {
00401                                 uint32 pos = defaultNetwork[j].find(ServiceName);
00402                                 if (pos != std::string::npos && pos == 0 && ServiceName.size() == defaultNetwork[j].size ()-1)
00403                                 {
00404                                         uint8 nid = defaultNetwork[j][defaultNetwork[j].size ()-1] - '0';
00405                                         DefaultNetwork = NetworkConnectionAssociations[nid];
00406                                         nlinfo ("HNETL5: default network for '%s' will be nid %hu and connection id %hu", ServiceName.c_str(), (uint16)nid, (uint16)DefaultNetwork);
00407                                         break;
00408                                 }
00409                         }
00410                         if (j == defaultNetwork.size ())
00411                         {
00412                                 if (NetworkConnectionAssociations.size ()>0)
00413                                         DefaultNetwork = NetworkConnectionAssociations[0];
00414                                 else
00415                                         DefaultNetwork = 0;
00416 
00417                                 if (defaultNetwork.size () > 0)
00418                                         nlwarning ("HNETL5: default network not found in the array, will use connection id %hu", (uint16)DefaultNetwork);
00419                         }
00420                 }


Field Documentation

uint NLNET::CUnifiedNetwork::CUnifiedConnection::AutoCheck
 

Used for debug purpose.

Definition at line 320 of file unified_network.h.

Referenced by reset().

bool NLNET::CUnifiedNetwork::CUnifiedConnection::AutoRetry
 

Auto-retry mode.

Definition at line 316 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), NLNET::uncbDisconnection(), and NLNET::CUnifiedNetwork::update().

std::vector<TConnection> NLNET::CUnifiedNetwork::CUnifiedConnection::Connection
 

Connection to the service (me be > 1).

Definition at line 324 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), NLNET::uncbDisconnection(), NLNET::uncbServiceIdentification(), NLNET::uNetUnregistrationBroadcast(), and NLNET::CUnifiedNetwork::update().

uint8 NLNET::CUnifiedNetwork::CUnifiedConnection::DefaultNetwork
 

This contains the connection id that will be used for default network, it's a connection id used for Connection index.

Definition at line 328 of file unified_network.h.

Referenced by reset(), and setupNetworkAssociation().

std::vector<CInetAddress> NLNET::CUnifiedNetwork::CUnifiedConnection::ExtAddress
 

The external connection address.

Definition at line 322 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), display(), reset(), setupNetworkAssociation(), NLNET::uncbServiceIdentification(), and NLNET::CUnifiedNetwork::update().

bool NLNET::CUnifiedNetwork::CUnifiedConnection::IsExternal
 

If the connection is extern to the naming service.

Definition at line 314 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), CUnifiedConnection(), display(), reset(), NLNET::uncbDisconnection(), and NLNET::CUnifiedNetwork::update().

std::vector<uint8> NLNET::CUnifiedNetwork::CUnifiedConnection::NetworkConnectionAssociations
 

This is used to associate a nid (look addNetworkAssociation) with a TConnection.

Definition at line 326 of file unified_network.h.

Referenced by reset(), and setupNetworkAssociation().

bool NLNET::CUnifiedNetwork::CUnifiedConnection::SendId
 

Auto identify at connection.

Definition at line 318 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), display(), reset(), and NLNET::CUnifiedNetwork::update().

uint16 NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceId
 

The id of the service (is unique).

Definition at line 310 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), CUnifiedConnection(), display(), reset(), NLNET::uncbDisconnection(), NLNET::uNetUnregistrationBroadcast(), and NLNET::CUnifiedNetwork::update().

std::string NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName
 

The name of the service (may not be unique).

Definition at line 308 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), CUnifiedConnection(), display(), NLNET::CUnifiedNetwork::getServiceName(), NLNET::CUnifiedNetwork::getServiceUnifiedName(), reset(), setupNetworkAssociation(), NLNET::uncbDisconnection(), NLNET::uncbMsgProcessing(), NLNET::uNetUnregistrationBroadcast(), and NLNET::CUnifiedNetwork::update().

TState NLNET::CUnifiedNetwork::CUnifiedConnection::State
 

If the service entry is used.

Definition at line 312 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::addService(), and NLNET::CUnifiedNetwork::update().

uint32 NLNET::CUnifiedNetwork::CUnifiedConnection::TotalCallbackCalled
 

Definition at line 330 of file unified_network.h.

Referenced by display(), reset(), and NLNET::uncbMsgProcessing().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 14:07:18 2004 for NeL by doxygen 1.3.6