diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02980.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02980.html | 1896 |
1 files changed, 1896 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02980.html b/docs/doxygen/nel/a02980.html new file mode 100644 index 00000000..9014bb43 --- /dev/null +++ b/docs/doxygen/nel/a02980.html @@ -0,0 +1,1896 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLNET::CNamingClient class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLNET::CNamingClient Class Reference</h1><code>#include <<a class="el" href="a06090.html">naming_client.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Client side of Naming Service. Allows to register/unregister services, and to lookup for a registered service.<p> +<dl compact><dt><b>Warning:</b></dt><dd>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</dd></dl> +<dl compact><dt><b>Author:</b></dt><dd>Olivier Cado <p> +Vianney Lecroart <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00058">58</a> of file <a class="el" href="a06090.html">naming_client.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente0">connect</a> (const <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> rec, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addresses)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Connect to the naming service. <a href="#NLNET_1_1CNamingCliente0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente1">connected</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return true if the connection to the Naming Service was done. <a href="#NLNET_1_1CNamingCliente1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente2">disconnect</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Close the connection to the naming service. <a href="#NLNET_1_1CNamingCliente2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente3">displayRegisteredServices</a> (<a class="el" href="a02813.html">NLMISC::CLog</a> *log=<a class="el" href="a05378.html#a13">NLMISC::DebugLog</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const std::list< <a class="el" href="a02981.html">CServiceEntry</a> > & </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente4">getRegisteredServices</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente5">info</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns information about the naming connection (connected or not, which naming service and so on). <a href="#NLNET_1_1CNamingCliente5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente6">lookup</a> (<a class="el" href="a05379.html#a93">TServiceId</a> sid, <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Same as lookup(const string&, CInetAddress&, uint16&). <a href="#NLNET_1_1CNamingCliente6"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente7">lookup</a> (const std::string &name, <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente8">lookupAll</a> (const std::string &name, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addresses)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente9">lookupAlternate</a> (const std::string &name, <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente10">lookupAndConnect</a> (const std::string &name, <a class="el" href="a02305.html">CCallbackClient</a> &sock)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a9">uint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente11">queryServicePort</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente12">registerService</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a05379.html#a93">TServiceId</a> &sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente13">registerServiceWithSId</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a05379.html#a93">TServiceId</a> sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente14">resendRegisteration</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a05379.html#a93">TServiceId</a> sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente15">setRegistrationBroadcastCallback</a> (<a class="el" href="a05379.html#a94">TBroadcastCallback</a> cb)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">You can link a callback if you want to know when a new service is registered (NULL to disable callback). <a href="#NLNET_1_1CNamingCliente15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente16">setUnregistrationBroadcastCallback</a> (<a class="el" href="a05379.html#a94">TBroadcastCallback</a> cb)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">You can link a callback if you want to know when a new service is unregistered (NULL to disable callback). <a href="#NLNET_1_1CNamingCliente16"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente17">unregisterAllServices</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Unregister all services registered by this client. You don't have to. <a href="#NLNET_1_1CNamingCliente17"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente18">unregisterService</a> (<a class="el" href="a05379.html#a93">TServiceId</a> sid)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Unregister a service from the naming service, service identifier. <a href="#NLNET_1_1CNamingCliente18"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingCliente19">update</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Call it evenly. <a href="#NLNET_1_1CNamingCliente19"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Protected Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Protected Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientt0">_ThreadId</a> = 0xFFFFFFFF</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a05379.html#a93">TServiceId</a>,<br> + std::string > </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">TRegServices</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Type of map of registered services. <a href="#NLNET_1_1CNamingClienty0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientd0">CNamingClient</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NLNET_1_1CNamingClientd0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientd1">~CNamingClient</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#NLNET_1_1CNamingClientd1"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienth0">doReceiveLookupAnswer</a> (const std::string &name, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addrs)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienth1">find</a> (<a class="el" href="a05379.html#a93">TServiceId</a> sid, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addrs)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (const std::string &name, std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &addrs)</td></tr> + +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02305.html">CCallbackClient</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> = NULL</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05379.html#a93">TServiceId</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv1">_MySId</a> = 0</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">TRegServices</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::list< <a class="el" href="a02981.html">CServiceEntry</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>NLMISC::CMutex </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a></td></tr> + +<tr><td colspan=2><br><h2>Friends</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientn0">cbRegisterBroadcast</a> (<a class="el" href="a02918.html">CMessage</a> &msgin, <a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, <a class="el" href="a02306.html">CCallbackNetBase</a> &netbase)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02980.html#NLNET_1_1CNamingClientn1">cbUnregisterBroadcast</a> (<a class="el" href="a02918.html">CMessage</a> &msgin, <a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, <a class="el" href="a02306.html">CCallbackNetBase</a> &netbase)</td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLNET_1_1CNamingClienty0" doxytag="NLNET::CNamingClient::TRegServices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<<a class="el" href="a05379.html#a93">TServiceId</a>, std::string> <a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">NLNET::CNamingClient::TRegServices</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Type of map of registered services. +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00194">194</a> of file <a class="el" href="a06090.html">naming_client.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLNET_1_1CNamingClientd0" doxytag="NLNET::CNamingClient::CNamingClient" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CNamingClient::CNamingClient </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00200">200</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +<div class="fragment"><pre>00200 {} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientd1" doxytag="NLNET::CNamingClient::~CNamingClient" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CNamingClient::~<a class="el" href="a02980.html">CNamingClient</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Destructor. +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00203">203</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +<div class="fragment"><pre>00203 {} +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CNamingClientf0" doxytag="NLNET::CNamingClient::checkThreadId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::checkThreadId </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, protected]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00544">544</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00154">nlerror</a>. +<p> +Referenced by <a class="el" href="a06089.html#l00267">disconnect()</a>, <a class="el" href="a06089.html#l00411">queryServicePort()</a>, <a class="el" href="a06089.html#l00302">registerService()</a>, <a class="el" href="a06089.html#l00340">registerServiceWithSId()</a>, <a class="el" href="a06089.html#l00373">resendRegisteration()</a>, <a class="el" href="a06089.html#l00398">unregisterAllServices()</a>, <a class="el" href="a06089.html#l00385">unregisterService()</a>, and <a class="el" href="a06089.html#l00536">update()</a>. +<p> +<div class="fragment"><pre>00545 { +00546 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a257">getThreadId</a> () != <a class="code" href="a02980.html#NLNET_1_1CNamingClientt0">_ThreadId</a>) +00547 { +00548 <a class="code" href="a04199.html#a3">nlerror</a> (<span class="stringliteral">"You try to access to the CNamingClient with 2 differents thread (%d and %d)"</span>, _ThreadId, <a class="code" href="a05378.html#a257">getThreadId</a>()); +00549 } +00550 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente0" doxytag="NLNET::CNamingClient::connect" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::connect </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> </td> + <td class="mdname" nowrap> <em>rec</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addresses</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Connect to the naming service. +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00239">239</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05526.html#l00184">NLNET::CCallbackNetBase::addCallbackArray()</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06089.html#l00230">NLNET::NamingClientCallbackArray</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +<div class="fragment"><pre>00240 { +00241 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection == NULL || _Connection != NULL && !<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00242 <a class="code" href="a02980.html#NLNET_1_1CNamingClientt0">_ThreadId</a> = <a class="code" href="a05378.html#a257">getThreadId</a> (); +00243 +00244 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> == NULL) +00245 { +00246 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> = <span class="keyword">new</span> CCallbackClient( rec, <span class="stringliteral">"naming_client.nmr"</span> ); +00247 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->addCallbackArray (NamingClientCallbackArray, <span class="keyword">sizeof</span> (NamingClientCallbackArray) / <span class="keyword">sizeof</span> (NamingClientCallbackArray[0])); +00248 } +00249 +00250 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connect (addr); +00251 +00252 <span class="comment">/* // send the available addresses</span> +00253 <span class="comment"> CMessage msgout (_Connection->getSIDA(), "RS");</span> +00254 <span class="comment"> msgout.serialCont (const_cast<vector<CInetAddress>&>(addresses));</span> +00255 <span class="comment"> _Connection->send (msgout);</span> +00256 <span class="comment"> </span> +00257 <span class="comment"> // wait the message that contains all already connected services</span> +00258 <span class="comment"> FirstRegisteredBroadcast = false;</span> +00259 <span class="comment"> while (!FirstRegisteredBroadcast && _Connection->connected ())</span> +00260 <span class="comment"> {</span> +00261 <span class="comment"> _Connection->update (-1);</span> +00262 <span class="comment"> nlSleep (1);</span> +00263 <span class="comment"> }</span> +00264 <span class="comment">*/</span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente1" doxytag="NLNET::CNamingClient::connected" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::connected </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return true if the connection to the Naming Service was done. +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00079">79</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +References <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>. +<p> +Referenced by <a class="el" href="a06089.html#l00285">info()</a>. +<p> +<div class="fragment"><pre>00079 { <span class="keywordflow">return</span> <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected (); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente2" doxytag="NLNET::CNamingClient::disconnect" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::disconnect </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Close the connection to the naming service. +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00267">267</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, and <a class="el" href="a05524.html#l00354">NLNET::CCallbackClient::disconnect()</a>. +<p> +<div class="fragment"><pre>00268 { +00269 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00270 +00271 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> != NULL) +00272 { +00273 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()) +00274 { +00275 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->disconnect (); +00276 } +00277 <span class="keyword">delete</span> <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>; +00278 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> = NULL; +00279 } +00280 +00281 <span class="comment">// we don't call unregisterAllServices because when the naming service will see the disconnection,</span> +00282 <span class="comment">// it'll automatically unregister all services registered by this client.</span> +00283 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente3" doxytag="NLNET::CNamingClient::displayRegisteredServices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::displayRegisteredServices </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02813.html">NLMISC::CLog</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>log</em> = <a class="el" href="a05378.html#a13">NLMISC::DebugLog</a> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00172">172</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +References <a class="el" href="a06089.html#l00063">RegisteredServices</a>, <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>00173 { +00174 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter (); +00175 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"Display the %d registered services :"</span>, <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.size()); +00176 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++) +00177 { +00178 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">" > %s-%hu %d addr"</span>, (*it).Name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)(*it).SId, (*it).Addr.size()); +00179 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i = 0; i < (*it).Addr.size(); i++) +00180 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">" '%s'"</span>, (*it).Addr[i].asString().c_str()); +00181 } +00182 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"End of the list"</span>); +00183 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave (); +00184 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClienth0" doxytag="NLNET::CNamingClient::doReceiveLookupAnswer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::doReceiveLookupAnswer </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addrs</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClienth1" doxytag="NLNET::CNamingClient::find" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::find </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addrs</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00220">220</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +References <a class="el" href="a06089.html#l00063">RegisteredServices</a>, <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>. +<p> +<div class="fragment"><pre>00221 { +00222 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter (); +00223 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++) +00224 <span class="keywordflow">if</span> (sid == (*it).SId) +00225 addrs.push_back ((*it).Addr[0]); +00226 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave (); +00227 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClienth2" doxytag="NLNET::CNamingClient::find" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::find </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addrs</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06090.html#l00211">211</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +References <a class="el" href="a06089.html#l00063">RegisteredServices</a>, and <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>. +<p> +Referenced by <a class="el" href="a06089.html#l00432">lookup()</a>, <a class="el" href="a06089.html#l00494">lookupAll()</a>, and <a class="el" href="a06089.html#l00465">lookupAlternate()</a>. +<p> +<div class="fragment"><pre>00212 { +00213 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter (); +00214 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++) +00215 <span class="keywordflow">if</span> (name == (*it).Name) +00216 addrs.push_back ((*it).Addr[0]); +00217 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave (); +00218 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente4" doxytag="NLNET::CNamingClient::getRegisteredServices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const std::list<<a class="el" href="a02981.html">CServiceEntry</a>>& NLNET::CNamingClient::getRegisteredServices </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns all registered services. +<p> +Definition at line <a class="el" href="a06090.html#l00147">147</a> of file <a class="el" href="a06090.html">naming_client.h</a>. +<p> +References <a class="el" href="a06089.html#l00063">RegisteredServices</a>. +<p> +<div class="fragment"><pre>00147 { <span class="keywordflow">return</span> <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>; } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente5" doxytag="NLNET::CNamingClient::info" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> string NLNET::CNamingClient::info </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns information about the naming connection (connected or not, which naming service and so on). +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00285">285</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00385">NLNET::CInetAddress::asString()</a>, <a class="el" href="a06090.html#l00079">connected()</a>, <a class="el" href="a05507.html#l00169">NLNET::CBufClient::remoteAddress()</a>, and <a class="el" href="a05646.html#l01119">res</a>. +<p> +<div class="fragment"><pre>00286 { +00287 string <a class="code" href="a04223.html#a643">res</a>; +00288 +00289 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingCliente1">connected</a> ()) +00290 { +00291 <a class="code" href="a04223.html#a643">res</a> = <span class="stringliteral">"connected to "</span>; +00292 <a class="code" href="a04223.html#a643">res</a> += <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->remoteAddress().asString(); +00293 } +00294 <span class="keywordflow">else</span> +00295 { +00296 <a class="code" href="a04223.html#a643">res</a> = <span class="stringliteral">"Not connected"</span>; +00297 } +00298 +00299 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a643">res</a>; +00300 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente6" doxytag="NLNET::CNamingClient::lookup" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookup </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>addr</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Same as lookup(const string&, CInetAddress&, uint16&). +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00448">448</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>. +<p> +<div class="fragment"><pre>00449 { +00450 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00451 +00452 vector<CInetAddress> addrs; +00453 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (sid, addrs); +00454 +00455 <span class="keywordflow">if</span> (addrs.size()==0) +00456 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00457 +00458 <a class="code" href="a04199.html#a6">nlassert</a> (addrs.size()==1); +00459 <a class="code" href="a04223.html#a657">addr</a> = addrs[0]; +00460 +00461 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00462 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente7" doxytag="NLNET::CNamingClient::lookup" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookup </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>addr</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true and the address of the specified service if it is found, otherwise returns false <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>name</em> </td><td>[in] Short name of the service to find </td></tr> + <tr><td valign=top><em>addr</em> </td><td>[out] Address of the service </td></tr> + <tr><td valign=top><em>validitytime</em> </td><td>[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if all worked fine</dd></dl> + +<p> +Definition at line <a class="el" href="a06089.html#l00432">432</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +<div class="fragment"><pre>00433 { +00434 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00435 +00436 vector<CInetAddress> addrs; +00437 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (name, addrs); +00438 +00439 <span class="keywordflow">if</span> (addrs.size()==0) +00440 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00441 +00442 <a class="code" href="a04199.html#a6">nlassert</a> (addrs.size()==1); +00443 <a class="code" href="a04223.html#a657">addr</a> = addrs[0]; +00444 +00445 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00446 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente8" doxytag="NLNET::CNamingClient::lookupAll" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::lookupAll </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addresses</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns all services corresponding to the specified short name. Ex: lookupAll ("AS", addresses); +<p> +Definition at line <a class="el" href="a06089.html#l00494">494</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>. +<p> +<div class="fragment"><pre>00495 { +00496 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00497 +00498 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (name, addrs); +00499 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente9" doxytag="NLNET::CNamingClient::lookupAlternate" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookupAlternate </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>addr</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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 <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>name</em> </td><td>[in] Short name of the service to find </td></tr> + <tr><td valign=top><em>addr</em> </td><td>[in/out] In: Address of the service that does not respond. Out: Alternative address </td></tr> + <tr><td valign=top><em>validitytime</em> </td><td>[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if all worked fine.</dd></dl> + +<p> +Definition at line <a class="el" href="a06089.html#l00465">465</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a06090.html#l00211">find()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06089.html#l00063">RegisteredServices</a>, and <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>. +<p> +<div class="fragment"><pre>00466 { +00467 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00468 +00469 <span class="comment">// remove it from his local list</span> +00470 +00471 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.enter (); +00472 <span class="keywordflow">for</span> (std::list<CServiceEntry>::iterator it = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.begin(); it != <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.end (); it++) +00473 { +00474 <span class="keywordflow">if</span> ((*it).Addr[0] == <a class="code" href="a04223.html#a657">addr</a>) +00475 { +00476 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv3">RegisteredServices</a>.erase (it); +00477 <span class="keywordflow">break</span>; +00478 } +00479 } +00480 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv4">RegisteredServicesMutex</a>.leave (); +00481 +00482 vector<CInetAddress> addrs; +00483 <a class="code" href="a02980.html#NLNET_1_1CNamingClienth2">find</a> (name, addrs); +00484 +00485 <span class="keywordflow">if</span> (addrs.size()==0) +00486 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00487 +00488 <a class="code" href="a04199.html#a6">nlassert</a> (addrs.size()==1); +00489 <a class="code" href="a04223.html#a657">addr</a> = addrs[0]; +00490 +00491 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00492 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente10" doxytag="NLNET::CNamingClient::lookupAndConnect" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::lookupAndConnect </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02305.html">CCallbackClient</a> & </td> + <td class="mdname" nowrap> <em>sock</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Obtains a socket connected to a service providing the service <em>name</em>. In case of failure to connect, the method informs the Naming Service and tries to get another service. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>name</em> </td><td>[in] Short name of the service to find and connected </td></tr> + <tr><td valign=top><em>sock</em> </td><td>[out] The connected socket. </td></tr> + <tr><td valign=top><em>validitytime</em> </td><td>[out] After this number of seconds are elapsed, another lookup will be necessary before sending a message to the service. </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>false if the service was not found.</dd></dl> + +<p> +Definition at line <a class="el" href="a06089.html#l00501">501</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00385">NLNET::CInetAddress::asString()</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05622.html#l00101">nldebug</a>. +<p> +<div class="fragment"><pre>00502 { +00503 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00504 +00505 <span class="comment">// look up for service</span> +00506 <a class="code" href="a02665.html">CInetAddress</a> servaddr; +00507 +00508 <span class="comment">// if service not found, return false</span> +00509 <span class="keywordflow">if</span> (!CNamingClient::lookup (name, servaddr)) +00510 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00511 +00512 <span class="keywordflow">do</span> +00513 { +00514 <span class="keywordflow">try</span> +00515 { +00516 <span class="comment">// try to connect to the server</span> +00517 sock.connect (servaddr); +00518 +00519 <span class="comment">// connection succeeded</span> +00520 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00521 } +00522 <span class="keywordflow">catch</span> (ESocketConnectionFailed &e) +00523 { +00524 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"NC: Connection to %s failed: %s, tring another service if available"</span>, servaddr.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa1">asString</a>().c_str(), e.what() ); +00525 +00526 <span class="comment">// try another server and if service is not found, return false</span> +00527 <span class="keywordflow">if</span> (!CNamingClient::lookupAlternate (name, servaddr)) +00528 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00529 } +00530 } +00531 <span class="keywordflow">while</span> (<span class="keyword">true</span>); +00532 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente11" doxytag="NLNET::CNamingClient::queryServicePort" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> NLNET::CNamingClient::queryServicePort </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Requests the naming service to choose a port for the service <dl compact><dt><b>Returns:</b></dt><dd>An empty port number</dd></dl> + +<p> +Definition at line <a class="el" href="a06089.html#l00411">411</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06089.html#l00106">NLNET::QueryPort</a>, <a class="el" href="a06089.html#l00107">NLNET::QueryPortPort</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>. +<p> +<div class="fragment"><pre>00412 { +00413 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00414 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00415 +00416 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"QP"</span>); +00417 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout); +00418 +00419 <span class="comment">// wait the answer of the naming service "QP"</span> +00420 <a class="code" href="a05379.html#a39">QueryPort</a> = <span class="keyword">false</span>; +00421 <span class="keywordflow">while</span> (!<a class="code" href="a05379.html#a39">QueryPort</a>) +00422 { +00423 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (-1); +00424 <a class="code" href="a05378.html#a256">nlSleep</a> (1); +00425 } +00426 +00427 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Received the answer of the query port (%hu)"</span>, QueryPortPort); +00428 +00429 <span class="keywordflow">return</span> <a class="code" href="a05379.html#a40">QueryPortPort</a>; +00430 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente12" doxytag="NLNET::CNamingClient::registerService" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::registerService </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> & </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Register a service within the naming service. Returns false if the registration failed. +<p> +Definition at line <a class="el" href="a06089.html#l00302">302</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00060">_MySId</a>, <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06089.html#l00083">NLNET::Reason</a>, <a class="el" href="a06089.html#l00080">NLNET::Registered</a>, <a class="el" href="a06089.html#l00082">NLNET::RegisteredSID</a>, <a class="el" href="a06089.html#l00081">NLNET::RegisteredSuccess</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05979.html#l00423">NLMISC::CMemStream::serialCont()</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>. +<p> +<div class="fragment"><pre>00303 { +00304 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00305 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00306 +00307 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"RG"</span>); +00308 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (const_cast<std::string&>(name)); +00309 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (<span class="keyword">const_cast</span><vector<CInetAddress>&>(addr)); +00310 sid = 0; +00311 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00312 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout); +00313 +00314 <span class="comment">// wait the answer of the naming service "RG"</span> +00315 <a class="code" href="a05379.html#a35">Registered</a> = <span class="keyword">false</span>; +00316 <a class="code" href="a05379.html#a37">RegisteredSID</a> = &sid; +00317 <span class="keywordflow">while</span> (!<a class="code" href="a05379.html#a35">Registered</a>) +00318 { +00319 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (-1); +00320 <a class="code" href="a05378.html#a256">nlSleep</a> (1); +00321 } +00322 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a36">RegisteredSuccess</a>) +00323 { +00324 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv1">_MySId</a> = sid; +00325 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.insert (make_pair (*RegisteredSID, name)); +00326 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Registered service %s-%hu at %s"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid, <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str()); +00327 } +00328 <span class="keywordflow">else</span> +00329 { +00330 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Naming service refused to register service %s at %s"</span>, name.c_str(), <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str()); +00331 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"NC: Startup denied: %s"</span>, <a class="code" href="a05379.html#a38">Reason</a>.c_str()); +00332 <a class="code" href="a05379.html#a38">Reason</a>.clear(); +00333 } +00334 +00335 <a class="code" href="a05379.html#a37">RegisteredSID</a> = NULL; +00336 +00337 <span class="keywordflow">return</span> <a class="code" href="a05379.html#a36">RegisteredSuccess</a>; +00338 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente13" doxytag="NLNET::CNamingClient::registerServiceWithSId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CNamingClient::registerServiceWithSId </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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. +<p> +Definition at line <a class="el" href="a06089.html#l00340">340</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00060">_MySId</a>, <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00154">nlerror</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06089.html#l00080">NLNET::Registered</a>, <a class="el" href="a06089.html#l00082">NLNET::RegisteredSID</a>, <a class="el" href="a06089.html#l00081">NLNET::RegisteredSuccess</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05979.html#l00423">NLMISC::CMemStream::serialCont()</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>. +<p> +<div class="fragment"><pre>00341 { +00342 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00343 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00344 +00345 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"RG"</span>); +00346 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (const_cast<std::string&>(name)); +00347 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (<span class="keyword">const_cast</span><vector<CInetAddress>&>(addr)); +00348 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00349 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout); +00350 +00351 <span class="comment">// wait the answer of the naming service "RGI"</span> +00352 <a class="code" href="a05379.html#a35">Registered</a> = <span class="keyword">false</span>; +00353 <a class="code" href="a05379.html#a37">RegisteredSID</a> = &sid; +00354 <span class="keywordflow">while</span> (!<a class="code" href="a05379.html#a35">Registered</a>) +00355 { +00356 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (-1); +00357 <a class="code" href="a05378.html#a256">nlSleep</a> (1); +00358 } +00359 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a36">RegisteredSuccess</a>) +00360 { +00361 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv1">_MySId</a> = sid; +00362 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.insert (make_pair (*RegisteredSID, name)); +00363 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Registered service with sid %s-%hu at %s"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)*<a class="code" href="a05379.html#a37">RegisteredSID</a>, <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str()); +00364 } +00365 <span class="keywordflow">else</span> +00366 { +00367 <a class="code" href="a04199.html#a3">nlerror</a> (<span class="stringliteral">"NC: Naming service refused to register service with sid %s at %s"</span>, name.c_str(), <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str()); +00368 } +00369 +00370 <span class="keywordflow">return</span> <a class="code" href="a05379.html#a36">RegisteredSuccess</a> == 1; +00371 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente14" doxytag="NLNET::CNamingClient::resendRegisteration" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::resendRegisteration </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +If the NS is down and goes up, we have to send it again the registration. But in this case, the NS must not send a registration broadcast, so we have a special message +<p> +Definition at line <a class="el" href="a06089.html#l00373">373</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05979.html#l00423">NLMISC::CMemStream::serialCont()</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>. +<p> +<div class="fragment"><pre>00374 { +00375 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00376 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00377 +00378 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"RRG"</span>); +00379 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (const_cast<std::string&>(name)); +00380 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (<span class="keyword">const_cast</span><vector<CInetAddress>&>(addr)); +00381 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00382 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout); +00383 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente15" doxytag="NLNET::CNamingClient::setRegistrationBroadcastCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::setRegistrationBroadcastCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05379.html#a94">TBroadcastCallback</a> </td> + <td class="mdname1" valign="top" nowrap> <em>cb</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +You can link a callback if you want to know when a new service is registered (NULL to disable callback). +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00066">66</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00055">NLNET::_RegistrationBroadcastCallback</a>, and <a class="el" href="a06090.html#l00044">NLNET::TBroadcastCallback</a>. +<p> +<div class="fragment"><pre>00067 { +00068 <a class="code" href="a05379.html#a33">_RegistrationBroadcastCallback</a> = cb; +00069 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente16" doxytag="NLNET::CNamingClient::setUnregistrationBroadcastCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::setUnregistrationBroadcastCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05379.html#a94">TBroadcastCallback</a> </td> + <td class="mdname1" valign="top" nowrap> <em>cb</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +You can link a callback if you want to know when a new service is unregistered (NULL to disable callback). +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00071">71</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00056">NLNET::_UnregistrationBroadcastCallback</a>, and <a class="el" href="a06090.html#l00044">NLNET::TBroadcastCallback</a>. +<p> +<div class="fragment"><pre>00072 { +00073 <a class="code" href="a05379.html#a34">_UnregistrationBroadcastCallback</a> = cb; +00074 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente17" doxytag="NLNET::CNamingClient::unregisterAllServices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::unregisterAllServices </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Unregister all services registered by this client. You don't have to. +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00398">398</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, and <a class="el" href="a06089.html#l00385">unregisterService()</a>. +<p> +<div class="fragment"><pre>00399 { +00400 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00401 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00402 +00403 <span class="keywordflow">while</span> (!<a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.empty()) +00404 { +00405 TRegServices::iterator irs = <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.begin(); +00406 <a class="code" href="a05379.html#a93">TServiceId</a> sid = (*irs).first; +00407 <a class="code" href="a02980.html#NLNET_1_1CNamingCliente18">unregisterService</a> (sid); +00408 } +00409 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente18" doxytag="NLNET::CNamingClient::unregisterService" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::unregisterService </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname1" valign="top" nowrap> <em>sid</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Unregister a service from the naming service, service identifier. +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00385">385</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00053">_RegisteredServices</a>, <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, <a class="el" href="a05527.html#l00129">NLNET::CCallbackNetBase::getSIDA()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, and <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>. +<p> +Referenced by <a class="el" href="a06089.html#l00398">unregisterAllServices()</a>. +<p> +<div class="fragment"><pre>00386 { +00387 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00388 <a class="code" href="a04199.html#a6">nlassert</a> (_Connection != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()); +00389 +00390 <a class="code" href="a02918.html">CMessage</a> msgout (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->getSIDA(), <span class="stringliteral">"UNI"</span>); +00391 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00392 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->send (msgout); +00393 +00394 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"NC: Unregistering service %s-%hu"</span>, _RegisteredServices[sid].c_str(), sid); +00395 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv2">_RegisteredServices</a>.erase (sid); +00396 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingCliente19" doxytag="NLNET::CNamingClient::update" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNamingClient::update </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Call it evenly. +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00536">536</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +References <a class="el" href="a06089.html#l00544">checkThreadId()</a>, <a class="el" href="a05525.html#l00069">NLNET::CCallbackClient::connected()</a>, and <a class="el" href="a05524.html#l00162">NLNET::CCallbackClient::update()</a>. +<p> +<div class="fragment"><pre>00537 { +00538 <a class="code" href="a02980.html#NLNET_1_1CNamingClientf0">checkThreadId</a> (); +00539 <span class="comment">// get message for naming service (new registration for example)</span> +00540 <span class="keywordflow">if</span> (<a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a> != NULL && <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->connected ()) +00541 <a class="code" href="a02980.html#NLNET_1_1CNamingClientv0">_Connection</a>->update (); +00542 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Friends And Related Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CNamingClientn0" doxytag="NLNET::CNamingClient::cbRegisterBroadcast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void cbRegisterBroadcast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msgin</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>from</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html">CCallbackNetBase</a> & </td> + <td class="mdname" nowrap> <em>netbase</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00119">119</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +<div class="fragment"><pre>00120 { +00121 <a class="code" href="a05379.html#a93">TServiceId</a> <a class="code" href="a04223.html#a587">size</a>; +00122 string name; +00123 <a class="code" href="a05379.html#a93">TServiceId</a> sid; +00124 vector<CInetAddress> <a class="code" href="a04223.html#a657">addr</a>; +00125 +00126 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (size); +00127 +00128 <span class="keywordflow">for</span> (<a class="code" href="a05379.html#a93">TServiceId</a> i = 0; i < <a class="code" href="a04223.html#a587">size</a>; i++) +00129 { +00130 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (name); +00131 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00132 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (addr); +00133 +00134 <span class="comment">// add it in the list</span> +00135 +00136 std::vector<CInetAddress> addrs; +00137 CNamingClient::find (sid, addrs); +00138 +00139 <span class="keywordflow">if</span> (addrs.size() == 0) +00140 { +00141 CNamingClient::RegisteredServicesMutex.enter (); +00142 CNamingClient::RegisteredServices.push_back (CNamingClient::CServiceEntry (name, sid, addr)); +00143 CNamingClient::RegisteredServicesMutex.leave (); +00144 +00145 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Registration Broadcast of the service %s-%hu '%s'"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid, <a class="code" href="a05379.html#a138">vectorCInetAddressToString</a>(addr).c_str()); +00146 +00147 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a33">_RegistrationBroadcastCallback</a> != NULL) +00148 <a class="code" href="a05379.html#a33">_RegistrationBroadcastCallback</a> (name, sid, addr); +00149 } +00150 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (addrs.size() == 1) +00151 { +00152 CNamingClient::RegisteredServicesMutex.enter (); +00153 <span class="keywordflow">for</span> (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++) +00154 { +00155 <span class="keywordflow">if</span> (sid == (*it).SId) +00156 { +00157 (*it).Name = name; +00158 (*it).Addr = <a class="code" href="a04223.html#a657">addr</a>; +00159 <span class="keywordflow">break</span>; +00160 } +00161 } +00162 CNamingClient::RegisteredServicesMutex.leave (); +00163 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Registration Broadcast (update) of the service %s-%hu '%s'"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid, <a class="code" href="a04223.html#a657">addr</a>[0].asString().c_str()); +00164 } +00165 <span class="keywordflow">else</span> +00166 { +00167 <a class="code" href="a04199.html#a12">nlstop</a>; +00168 } +00169 } +00170 +00171 <span class="comment">// FirstRegisteredBroadcast = true;</span> +00172 +00173 <span class="comment">//CNamingClient::displayRegisteredServices ();</span> +00174 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientn1" doxytag="NLNET::CNamingClient::cbUnregisterBroadcast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void cbUnregisterBroadcast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msgin</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>from</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html">CCallbackNetBase</a> & </td> + <td class="mdname" nowrap> <em>netbase</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00178">178</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +<div class="fragment"><pre>00179 { +00180 string name; +00181 <a class="code" href="a05379.html#a93">TServiceId</a> sid; +00182 vector<CInetAddress> addrs; +00183 +00184 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (name); +00185 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00186 +00187 <span class="comment">// remove it in the list, if the service is not found, ignore it</span> +00188 +00189 CNamingClient::RegisteredServicesMutex.enter (); +00190 <span class="keywordflow">for</span> (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++) +00191 { +00192 <span class="keywordflow">if</span> ((*it).SId == sid) +00193 { +00194 <span class="comment">// check the structure</span> +00195 <a class="code" href="a04199.html#a8">nlassertex</a> ((*it).Name == name, (<span class="stringliteral">"%s %s"</span>,(*it).Name.c_str(), name.c_str())); +00196 +00197 addrs = (*it).Addr; +00198 +00199 CNamingClient::RegisteredServices.erase (it); +00200 <span class="keywordflow">break</span>; +00201 } +00202 } +00203 CNamingClient::RegisteredServicesMutex.leave (); +00204 +00205 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"NC: Unregistration Broadcast of the service %s-%hu"</span>, name.c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)sid); +00206 +00207 <span class="comment">// send the ACK to the NS</span> +00208 +00209 <a class="code" href="a02918.html">CMessage</a> msgout (CNamingClient::_Connection->getSIDA(), <span class="stringliteral">"ACK_UNI"</span>); +00210 msgout.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (sid); +00211 CNamingClient::_Connection->send (msgout); +00212 +00213 <span class="comment">// oh my god, it s my sid! but i m alive, why this f*cking naming service want to kill me? ok, i leave it alone!</span> +00214 <span class="keywordflow">if</span>(CNamingClient::_MySId == sid) +00215 { +00216 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"NC: Naming Service asked me to leave, I leave!"</span>); +00217 IService::getInstance()->exit(); +00218 <span class="keywordflow">return</span>; +00219 } +00220 +00221 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a34">_UnregistrationBroadcastCallback</a> != NULL) +00222 <a class="code" href="a05379.html#a34">_UnregistrationBroadcastCallback</a> (name, sid, addrs); +00223 +00224 <span class="comment">//CNamingClient::displayRegisteredServices ();</span> +00225 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLNET_1_1CNamingClientv0" doxytag="NLNET::CNamingClient::_Connection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02305.html">CCallbackClient</a> * <a class="el" href="a02980.html#NLNET_1_1CNamingClientv0">NLNET::CNamingClient::_Connection</a> = NULL<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00052">52</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientv1" doxytag="NLNET::CNamingClient::_MySId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05379.html#a93">TServiceId</a> <a class="el" href="a02980.html#NLNET_1_1CNamingClientv1">NLNET::CNamingClient::_MySId</a> = 0<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00060">60</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +Referenced by <a class="el" href="a06089.html#l00302">registerService()</a>, and <a class="el" href="a06089.html#l00340">registerServiceWithSId()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientv2" doxytag="NLNET::CNamingClient::_RegisteredServices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02980.html#NLNET_1_1CNamingClienty0">CNamingClient::TRegServices</a> <a class="el" href="a02980.html#NLNET_1_1CNamingClientv2">NLNET::CNamingClient::_RegisteredServices</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00053">53</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +Referenced by <a class="el" href="a06089.html#l00302">registerService()</a>, <a class="el" href="a06089.html#l00340">registerServiceWithSId()</a>, <a class="el" href="a06089.html#l00398">unregisterAllServices()</a>, and <a class="el" href="a06089.html#l00385">unregisterService()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientt0" doxytag="NLNET::CNamingClient::_ThreadId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02980.html#NLNET_1_1CNamingClientt0">NLNET::CNamingClient::_ThreadId</a> = 0xFFFFFFFF<code> [static, protected]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b><a class="el" href="todo.html#_todo000051">Todo:</a></b></dt><dd>ace: debug feature that we should remove one day before releasing the game</dd></dl> + +<p> +Definition at line <a class="el" href="a06089.html#l00058">58</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientv3" doxytag="NLNET::CNamingClient::RegisteredServices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::list< <a class="el" href="a02981.html">CNamingClient::CServiceEntry</a> > <a class="el" href="a02980.html#NLNET_1_1CNamingClientv3">NLNET::CNamingClient::RegisteredServices</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06089.html#l00063">63</a> of file <a class="el" href="a06089.html">naming_client.cpp</a>. +<p> +Referenced by <a class="el" href="a06090.html#l00172">displayRegisteredServices()</a>, <a class="el" href="a06090.html#l00211">find()</a>, <a class="el" href="a06090.html#l00147">getRegisteredServices()</a>, and <a class="el" href="a06089.html#l00465">lookupAlternate()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNamingClientv4" doxytag="NLNET::CNamingClient::RegisteredServicesMutex" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CMutex <a class="el" href="a02980.html#NLNET_1_1CNamingClientv4">NLNET::CNamingClient::RegisteredServicesMutex</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Referenced by <a class="el" href="a06090.html#l00172">displayRegisteredServices()</a>, <a class="el" href="a06090.html#l00211">find()</a>, and <a class="el" href="a06089.html#l00465">lookupAlternate()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06090.html">naming_client.h</a><li><a class="el" href="a06089.html">naming_client.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:00:38 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |