From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/classNLNET_1_1CNamingClient.html | 1408 +++++++++++++++++++++ 1 file changed, 1408 insertions(+) create mode 100644 docs/doxygen/nel/classNLNET_1_1CNamingClient.html (limited to 'docs/doxygen/nel/classNLNET_1_1CNamingClient.html') diff --git a/docs/doxygen/nel/classNLNET_1_1CNamingClient.html b/docs/doxygen/nel/classNLNET_1_1CNamingClient.html new file mode 100644 index 00000000..92a4a2d6 --- /dev/null +++ b/docs/doxygen/nel/classNLNET_1_1CNamingClient.html @@ -0,0 +1,1408 @@ + + + + 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::CNamingClient Class Reference

Client side of Naming Service. +More... +

+#include <naming_client.h> +

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

Static Public Methods

void connect (const CInetAddress &addr, CCallbackNetBase::TRecordingState rec)
 Connect to the naming service. More...

bool connected ()
 Return true if the connection to the Naming Service was done. More...

void disconnect ()
 Close the connection to the naming service. More...

std::string info ()
 Returns information about the naming connection (connected or not, which naming service and so on). More...

TServiceId registerService (const std::string &name, const CInetAddress &addr)
 Register a service within the naming service. More...

bool registerServiceWithSId (const std::string &name, const CInetAddress &addr, TServiceId sid)
 Register a service within the naming service, using a specified service identifier. More...

void unregisterService (TServiceId sid)
 Unregister a service from the naming service, service identifier. More...

void unregisterAllServices ()
 Unregister all services registered by this client. You don't have to. More...

uint16 queryServicePort ()
 Requests the naming service to choose a port for the service. More...

bool lookup (const std::string &name, CInetAddress &addr)
 Returns true and the address of the specified service if it is found, otherwise returns false. More...

bool lookup (TServiceId sid, CInetAddress &addr)
 Same as lookup(const string&, CInetAddress&, uint16&). More...

bool lookupAlternate (const std::string &name, CInetAddress &addr)
void lookupAll (const std::string &name, std::vector< CInetAddress > &addresses)
 Returns all services corresponding to the specified short name. More...

const std::list< CServiceEntry > & getRegisteredServices ()
 Returns all registered services. More...

bool lookupAndConnect (const std::string &name, CCallbackClient &sock)
 Obtains a socket connected to a service providing the service name. More...

void update ()
 Call it evenly. More...

void setRegistrationBroadcastCallback (TBroadcastCallback cb)
 You can link a callback if you want to know when a new service is registered (NULL to disable callback). More...

void setUnregistrationBroadcastCallback (TBroadcastCallback cb)
 You can link a callback if you want to know when a new service is unregistered (NULL to disable callback). More...


Static Protected Methods

void checkThreadId ()

Static Protected Attributes

uint _ThreadId = 0xFFFFFFFF

Private Types

typedef std::map< TServiceId,
+ std::string > 
TRegServices
 Type of map of registered services. More...


Private Methods

 CNamingClient ()
 Constructor. More...

 ~CNamingClient ()
 Destructor. More...


Static Private Methods

void doReceiveLookupAnswer (const std::string &name, std::vector< CInetAddress > &addrs)
void displayRegisteredServices ()
void find (const std::string &name, std::vector< CInetAddress > &addrs)
void find (TServiceId sid, std::vector< CInetAddress > &addrs)

Static Private Attributes

CCallbackClient_Connection = NULL
TRegServices _RegisteredServices
std::list< CServiceEntryRegisteredServices
NLMISC::CMutex RegisteredServicesMutex

Friends

void cbRegisterBroadcast (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbUnregisterBroadcast (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
+


Detailed Description

+Client side of Naming Service. +

+Allows to register/unregister services, and to lookup for a registered service. +

+

+Warning:
+the Naming Service can be down, it will reconnect when up but if other services try to register during the NS is offline, it will cause bug
+Author:
+Olivier Cado , Vianney Lecroart , Nevrax France
+Date:
+2001
+

+ +

+Definition at line 58 of file naming_client.h.


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::map<TServiceId, std::string> NLNET::CNamingClient::TRegServices [private] +
+
+ + + + + +
+   + + +

+Type of map of registered services. +

+ +

+Definition at line 173 of file naming_client.h.

+


Constructor & Destructor Documentation

+

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

+Constructor. +

+ +

+Definition at line 178 of file naming_client.h.

+

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

+Destructor. +

+ +

+Definition at line 181 of file naming_client.h.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
void NLNET::CNamingClient::checkThreadId   [static, protected]
+
+ + + + + +
+   + + +

+ +

+Definition at line 471 of file naming_client.cpp. +

+References _ThreadId, NLMISC::getThreadId, and nlerror. +

+Referenced by disconnect, queryServicePort, registerService, registerServiceWithSId, unregisterAllServices, unregisterService, and update.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CNamingClient::connect const CInetAddress  addr,
CCallbackNetBase::TRecordingState   rec
[static]
+
+ + + + + +
+   + + +

+Connect to the naming service. +

+ +

+Definition at line 189 of file naming_client.cpp. +

+References _Connection, _ThreadId, NLNET::FirstRegisteredBroadcast, NLMISC::getThreadId, NLNET::NamingClientCallbackArray, and nlassert.

+

+ + + + +
+ + + + + + + + + +
bool NLNET::CNamingClient::connected   [inline, static]
+
+ + + + + +
+   + + +

+Return true if the connection to the Naming Service was done. +

+ +

+Definition at line 79 of file naming_client.h. +

+References _Connection. +

+Referenced by info.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CNamingClient::disconnect   [static]
+
+ + + + + +
+   + + +

+Close the connection to the naming service. +

+ +

+Definition at line 218 of file naming_client.cpp. +

+References _Connection, _RegisteredServices, and checkThreadId.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CNamingClient::displayRegisteredServices   [inline, static, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 190 of file naming_client.h. +

+References nldebug, and RegisteredServicesMutex.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CNamingClient::doReceiveLookupAnswer const std::string &   name,
std::vector< CInetAddress > &   addrs
[static, private]
+
+ + + + + +
+   + + +

+

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CNamingClient::find TServiceId   sid,
std::vector< CInetAddress > &   addrs
[inline, static, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 211 of file naming_client.h. +

+References RegisteredServicesMutex, and NLNET::TServiceId.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CNamingClient::find const std::string &   name,
std::vector< CInetAddress > &   addrs
[inline, static, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 202 of file naming_client.h. +

+References RegisteredServicesMutex. +

+Referenced by lookup, lookupAll, and lookupAlternate.

+

+ + + + +
+ + + + + + + + + +
const std::list<CServiceEntry>& NLNET::CNamingClient::getRegisteredServices   [inline, static]
+
+ + + + + +
+   + + +

+Returns all registered services. +

+ +

+Definition at line 143 of file naming_client.h. +

+References RegisteredServices.

+

+ + + + +
+ + + + + + + + + +
string NLNET::CNamingClient::info   [static]
+
+ + + + + +
+   + + +

+Returns information about the naming connection (connected or not, which naming service and so on). +

+ +

+Definition at line 238 of file naming_client.cpp. +

+References _Connection, and connected.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLNET::CNamingClient::lookup TServiceId   sid,
CInetAddress  addr
[static]
+
+ + + + + +
+   + + +

+Same as lookup(const string&, CInetAddress&, uint16&). +

+ +

+Definition at line 375 of file naming_client.cpp. +

+References _Connection, find, nlassert, and NLNET::TServiceId.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLNET::CNamingClient::lookup const std::string &   name,
CInetAddress  addr
[static]
+
+ + + + + +
+   + + +

+Returns true and the address of the specified service if it is found, otherwise returns false. +

+

+Parameters:
+ + + + +
name  +[in] Short name of the service to find
addr  +[out] Address of the service
validitytime  +[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service
+
+Returns:
+true if all worked fine
+

+Definition at line 359 of file naming_client.cpp. +

+References _Connection, find, and nlassert.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLNET::CNamingClient::lookupAll const std::string &   name,
std::vector< CInetAddress > &   addresses
[static]
+
+ + + + + +
+   + + +

+Returns all services corresponding to the specified short name. +

+Ex: lookupAll ("AS", addresses); +

+Definition at line 421 of file naming_client.cpp. +

+References _Connection, find, and nlassert.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLNET::CNamingClient::lookupAlternate const std::string &   name,
CInetAddress  addr
[static]
+
+ + + + + +
+   + + +

+

+Parameters:
+ + + + +
name  +[in] Short name of the service to find
addr  +[in/out] In: Address of the service that does not respond. Out: Alternative address
validitytime  +[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service
+
+Returns:
+true if all worked fine.
+

+Definition at line 392 of file naming_client.cpp. +

+References _Connection, find, nlassert, RegisteredServices, and RegisteredServicesMutex.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLNET::CNamingClient::lookupAndConnect const std::string &   name,
CCallbackClient  sock
[static]
+
+ + + + + +
+   + + +

+Obtains a socket connected to a service providing the service name. +

+In case of failure to connect, the method informs the Naming Service and tries to get another service.

+Parameters:
+ + + + +
name  +[in] Short name of the service to find and connected
sock  +[out] The connected socket.
validitytime  +[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service.
+
+Returns:
+false if the service was not found.
+

+Definition at line 428 of file naming_client.cpp. +

+References _Connection, nlassert, and nldebug.

+

+ + + + +
+ + + + + + + + + +
uint16 NLNET::CNamingClient::queryServicePort   [static]
+
+ + + + + +
+   + + +

+Requests the naming service to choose a port for the service. +

+

+Returns:
+An empty port number
+

+Definition at line 341 of file naming_client.cpp. +

+References _Connection, checkThreadId, nlassert, nldebug, NLNET::QueryPort, NLNET::QueryPortPort, and uint16.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
TServiceId NLNET::CNamingClient::registerService const std::string &   name,
const CInetAddress  addr
[static]
+
+ + + + + +
+   + + +

+Register a service within the naming service. +

+Returns the service identifier assigned by the NS (or 0 if it failed) +

+Definition at line 255 of file naming_client.cpp. +

+References _Connection, _RegisteredServices, checkThreadId, nlassert, nldebug, nlerror, NLNET::Registered, NLNET::RegisteredSID, and NLNET::TServiceId.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLNET::CNamingClient::registerServiceWithSId const std::string &   name,
const CInetAddress  addr,
TServiceId   sid
[static]
+
+ + + + + +
+   + + +

+Register a service within the naming service, using a specified service identifier. +

+Returns false if the service identifier is unavailable i.e. the registration failed. +

+Definition at line 285 of file naming_client.cpp. +

+References _Connection, _RegisteredServices, checkThreadId, nlassert, nldebug, nlerror, NLNET::Registered, NLNET::RegisteredSID, NLNET::RegisteredSuccess, and NLNET::TServiceId.

+

+ + + + +
+ + + + + + + + + + +
void NLNET::CNamingClient::setRegistrationBroadcastCallback TBroadcastCallback   cb [static]
+
+ + + + + +
+   + + +

+You can link a callback if you want to know when a new service is registered (NULL to disable callback). +

+ +

+Definition at line 62 of file naming_client.cpp. +

+References NLNET::_RegistrationBroadcastCallback, and NLNET::TBroadcastCallback.

+

+ + + + +
+ + + + + + + + + + +
void NLNET::CNamingClient::setUnregistrationBroadcastCallback TBroadcastCallback   cb [static]
+
+ + + + + +
+   + + +

+You can link a callback if you want to know when a new service is unregistered (NULL to disable callback). +

+ +

+Definition at line 67 of file naming_client.cpp. +

+References NLNET::_UnregistrationBroadcastCallback, and NLNET::TBroadcastCallback.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CNamingClient::unregisterAllServices   [static]
+
+ + + + + +
+   + + +

+Unregister all services registered by this client. You don't have to. +

+ +

+Definition at line 328 of file naming_client.cpp. +

+References _Connection, _RegisteredServices, checkThreadId, nlassert, NLNET::TServiceId, and unregisterService.

+

+ + + + +
+ + + + + + + + + + +
void NLNET::CNamingClient::unregisterService TServiceId   sid [static]
+
+ + + + + +
+   + + +

+Unregister a service from the naming service, service identifier. +

+ +

+Definition at line 315 of file naming_client.cpp. +

+References _Connection, _RegisteredServices, checkThreadId, nlassert, nldebug, and NLNET::TServiceId. +

+Referenced by unregisterAllServices.

+

+ + + + +
+ + + + + + + + + +
void NLNET::CNamingClient::update   [static]
+
+ + + + + +
+   + + +

+Call it evenly. +

+ +

+Definition at line 463 of file naming_client.cpp. +

+References _Connection, and checkThreadId.

+


Friends And Related Function Documentation

+

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

+ +

+Definition at line 109 of file naming_client.cpp.

+

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

+ +

+Definition at line 143 of file naming_client.cpp.

+


Member Data Documentation

+

+ + + + +
+ + +
CCallbackClient * NLNET::CNamingClient::_Connection = NULL [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 51 of file naming_client.cpp. +

+Referenced by connect, connected, disconnect, info, lookup, lookupAll, lookupAlternate, lookupAndConnect, queryServicePort, registerService, registerServiceWithSId, unregisterAllServices, unregisterService, and update.

+

+ + + + +
+ + +
CNamingClient::TRegServices NLNET::CNamingClient::_RegisteredServices [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 52 of file naming_client.cpp. +

+Referenced by disconnect, registerService, registerServiceWithSId, unregisterAllServices, and unregisterService.

+

+ + + + +
+ + +
uint NLNET::CNamingClient::_ThreadId = 0xFFFFFFFF [static, protected] +
+
+ + + + + +
+   + + +

+

+Todo:
+ ace: debug feature that we should remove one day before releasing the game
+

+Definition at line 57 of file naming_client.cpp. +

+Referenced by checkThreadId, and connect.

+

+ + + + +
+ + +
std::list< CNamingClient::CServiceEntry > NLNET::CNamingClient::RegisteredServices [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 59 of file naming_client.cpp. +

+Referenced by getRegisteredServices, and lookupAlternate.

+

+ + + + +
+ + +
NLMISC::CMutex NLNET::CNamingClient::RegisteredServicesMutex [static, private] +
+
+ + + + + +
+   + + +

+ +

+Referenced by displayRegisteredServices, find, and lookupAlternate.

+


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