|
|
|
|
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 ReferenceClient 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< CServiceEntry > | RegisteredServices |
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]
|
|
Constructor & Destructor Documentation
NLNET::CNamingClient::CNamingClient |
( |
|
) |
[inline, private] |
|
NLNET::CNamingClient::~CNamingClient |
( |
|
) |
[inline, private] |
|
Member Function Documentation
void NLNET::CNamingClient::checkThreadId |
( |
|
) |
[static, protected] |
|
bool NLNET::CNamingClient::connected |
( |
|
) |
[inline, static] |
|
void NLNET::CNamingClient::disconnect |
( |
|
) |
[static] |
|
void NLNET::CNamingClient::displayRegisteredServices |
( |
|
) |
[inline, static, private] |
|
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] |
|
void NLNET::CNamingClient::find |
( |
const std::string & |
name, |
|
|
std::vector< CInetAddress > & |
addrs |
|
) |
[inline, static, private] |
|
string NLNET::CNamingClient::info |
( |
|
) |
[static] |
|
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] |
|
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] |
|
TServiceId NLNET::CNamingClient::registerService |
( |
const std::string & |
name, |
|
|
const CInetAddress & |
addr |
|
) |
[static] |
|
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] |
|
void NLNET::CNamingClient::setUnregistrationBroadcastCallback |
( |
TBroadcastCallback |
cb |
) |
[static] |
|
void NLNET::CNamingClient::unregisterAllServices |
( |
|
) |
[static] |
|
void NLNET::CNamingClient::unregisterService |
( |
TServiceId |
sid |
) |
[static] |
|
void NLNET::CNamingClient::update |
( |
|
) |
[static] |
|
Friends And Related Function Documentation
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. |
uint NLNET::CNamingClient::_ThreadId = 0xFFFFFFFF [static, protected]
|
|
NLMISC::CMutex NLNET::CNamingClient::RegisteredServicesMutex [static, private]
|
|
The documentation for this class was generated from the following files:
|
|