|
|
|
|
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>
Collaboration diagram for NLNET::CNamingClient:
[legend]List of all members.
Static Public Methods |
void | connect (const CInetAddress& addr) |
| 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...
|
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) |
| Tells the Naming Service the specified address does not respond for the specified service, and returns true and another address for the service if available, otherwise returns false. More...
|
void | lookupAll (const std::string &name, std::vector<CInetAddress> &addresses) |
| Returns all services corresponding to the specified short name. 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...
|
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) |
Static Private Attributes |
CCallbackClient* | _Connection = NULL |
TRegServices | _RegisteredServices |
Detailed Description
Client side of Naming Service.
Allows to register/unregister services, and to lookup for a registered service.
-
Author(s):
-
Olivier Cado , Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 55 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::connect (
|
const CInetAddress & addr ) [static]
|
|
bool NLNET::CNamingClient::connected (
|
) [inline, static]
|
|
|
Return true if the connection to the Naming Service was done.
Definition at line 64 of file naming_client.h. |
void NLNET::CNamingClient::disconnect (
|
) [static]
|
|
void NLNET::CNamingClient::doReceiveLookupAnswer (
|
const std::string & name,
|
|
std::vector< CInetAddress >& addrs ) [static, private]
|
|
|
Same as lookup(const string&, CInetAddress&, uint16&).
Definition at line 342 of file naming_client.cpp. |
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 320 of file naming_client.cpp. |
void NLNET::CNamingClient::lookupAll (
|
const std::string & name,
|
|
std::vector< CInetAddress >& addrs ) [static]
|
|
|
Returns all services corresponding to the specified short name.
Ex: lookupAll ("AS", addresses);
Definition at line 384 of file naming_client.cpp. |
bool NLNET::CNamingClient::lookupAlternate (
|
const std::string & name,
|
|
CInetAddress & addr ) [static]
|
|
|
Tells the Naming Service the specified address does not respond for the specified service, and returns true and another address for the service if available, otherwise returns false.
-
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 363 of file naming_client.cpp. |
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 397 of file naming_client.cpp. |
uint16 NLNET::CNamingClient::queryServicePort (
|
) [static]
|
|
|
Requests the naming service to choose a port for the service.
-
Returns:
-
An empty port number
Definition at line 281 of file naming_client.cpp. |
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 177 of file naming_client.cpp. |
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 206 of file naming_client.cpp. |
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 48 of file naming_client.cpp. |
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 53 of file naming_client.cpp. |
void NLNET::CNamingClient::unregisterAllServices (
|
) [static]
|
|
|
Unregister all services registered by this client. You don't have to.
Definition at line 269 of file naming_client.cpp. |
void NLNET::CNamingClient::unregisterService (
|
TServiceId sid ) [static]
|
|
|
Unregister a service from the naming service, service identifier.
Definition at line 257 of file naming_client.cpp. |
void NLNET::CNamingClient::update (
|
) [static]
|
|
Member Data Documentation
CCallbackClient * NLNET::CNamingClient::_Connection = NULL [static, private]
|
|
The documentation for this class was generated from the following files:
|
|