aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/naming__client_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/naming__client_8cpp-source.html625
1 files changed, 625 insertions, 0 deletions
diff --git a/docs/doxygen/nel/naming__client_8cpp-source.html b/docs/doxygen/nel/naming__client_8cpp-source.html
new file mode 100644
index 00000000..48527f42
--- /dev/null
+++ b/docs/doxygen/nel/naming__client_8cpp-source.html
@@ -0,0 +1,625 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>naming_client.cpp</h1><a href="naming__client_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00008 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
+00009 <font class="comment"> *</font>
+00010 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00011 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00012 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00013 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00014 <font class="comment"> * any later version.</font>
+00015 <font class="comment"></font>
+00016 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00017 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00018 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00019 <font class="comment"> * General Public License for more details.</font>
+00020 <font class="comment"></font>
+00021 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00022 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00023 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00024 <font class="comment"> * MA 02111-1307, USA.</font>
+00025 <font class="comment"> */</font>
+00026
+00027 <font class="comment">//</font>
+00028 <font class="comment">// Includes</font>
+00029 <font class="comment">//</font>
+00030
+00031 <font class="preprocessor">#include "<a class="code" href="stdnet_8h.html">stdnet.h</a>"</font>
+00032
+00033 <font class="preprocessor">#include "<a class="code" href="naming__client_8h.html">nel/net/naming_client.h</a>"</font>
+00034 <font class="preprocessor">#include "<a class="code" href="callback__client_8h.html">nel/net/callback_client.h</a>"</font>
+00035 <font class="preprocessor">#include "<a class="code" href="service_8h.html">nel/net/service.h</a>"</font>
+00036
+00037
+00038 <font class="comment">//</font>
+00039 <font class="comment">// Namespaces</font>
+00040 <font class="comment">//</font>
+00041
+00042 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00043 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00044
+00045
+00046 <font class="keyword">namespace </font>NLNET {
+00047
+00048 <font class="comment">//</font>
+00049 <font class="comment">// Variables</font>
+00050 <font class="comment">//</font>
+00051
+<a name="l00052"></a><a class="code" href="classNLNET_1_1CNamingClient.html#r0">00052</a> CCallbackClient *CNamingClient::_Connection = NULL;
+<a name="l00053"></a><a class="code" href="classNLNET_1_1CNamingClient.html#r2">00053</a> CNamingClient::TRegServices CNamingClient::_RegisteredServices;
+00054
+00055 <font class="keyword">static</font> <a class="code" href="namespaceNLNET.html#a20">TBroadcastCallback</a> <a class="code" href="namespaceNLNET.html#a45">_RegistrationBroadcastCallback</a> = NULL;
+00056 <font class="keyword">static</font> <a class="code" href="namespaceNLNET.html#a20">TBroadcastCallback</a> <a class="code" href="namespaceNLNET.html#a46">_UnregistrationBroadcastCallback</a> = NULL;
+00057
+<a name="l00058"></a><a class="code" href="classNLNET_1_1CNamingClient.html#q0">00058</a> uint CNamingClient::_ThreadId = 0xFFFFFFFF;
+00059
+<a name="l00060"></a><a class="code" href="classNLNET_1_1CNamingClient.html#r1">00060</a> <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> CNamingClient::_MySId = 0;
+00061
+00062
+<a name="l00063"></a><a class="code" href="classNLNET_1_1CNamingClient.html#r3">00063</a> <a class="code" href="classstd_1_1list.html">std::list&lt;CNamingClient::CServiceEntry&gt;</a> CNamingClient::RegisteredServices;
+00064 NLMISC::CMutex CNamingClient::RegisteredServicesMutex(<font class="stringliteral">"CNamingClient::RegisteredServicesMutex"</font>);
+00065
+<a name="l00066"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d17">00066</a> <font class="keywordtype">void</font> CNamingClient::setRegistrationBroadcastCallback (<a class="code" href="namespaceNLNET.html#a20">TBroadcastCallback</a> cb)
+00067 {
+00068 <a class="code" href="namespaceNLNET.html#a45">_RegistrationBroadcastCallback</a> = cb;
+00069 }
+00070
+<a name="l00071"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d18">00071</a> <font class="keywordtype">void</font> CNamingClient::setUnregistrationBroadcastCallback (<a class="code" href="namespaceNLNET.html#a20">TBroadcastCallback</a> cb)
+00072 {
+00073 <a class="code" href="namespaceNLNET.html#a46">_UnregistrationBroadcastCallback</a> = cb;
+00074 }
+00075
+00076 <font class="comment">//</font>
+00077
+00078 <font class="comment">//</font>
+00079
+00080 <font class="keyword">static</font> <font class="keywordtype">bool</font> <a class="code" href="namespaceNLNET.html#a47">Registered</a>;
+00081 <font class="keyword">static</font> <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> <a class="code" href="namespaceNLNET.html#a48">RegisteredSuccess</a>;
+00082 <font class="keyword">static</font> <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> *<a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a> = NULL;
+00083
+00084 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a107">cbRegister</a> (CMessage &amp;msgin, <a class="code" href="namespaceNLNET.html#a0">TSockId</a> from, CCallbackNetBase &amp;netbase)
+00085 {
+00086 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a> != NULL);
+00087
+00088 msgin.serial (<a class="code" href="namespaceNLNET.html#a48">RegisteredSuccess</a>);
+00089 <font class="keywordflow">if</font> (RegisteredSuccess)
+00090 {
+00091 msgin.serial (*<a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a>);
+00092
+00093 <font class="comment">// decode the registered services at the register process</font>
+00094 <a class="code" href="namespaceNLNET.html#a109">cbRegisterBroadcast</a> (msgin, from, netbase);
+00095 }
+00096 <a class="code" href="namespaceNLNET.html#a47">Registered</a> = <font class="keyword">true</font>;
+00097 }
+00098
+00099 <font class="comment">//</font>
+00100
+00101 <font class="keyword">static</font> <font class="keywordtype">bool</font> <a class="code" href="namespaceNLNET.html#a50">QueryPort</a>;
+00102 <font class="keyword">static</font> uint16 <a class="code" href="namespaceNLNET.html#a51">QueryPortPort</a>;
+00103
+00104 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a108">cbQueryPort</a> (CMessage &amp;msgin, <a class="code" href="namespaceNLNET.html#a0">TSockId</a> from, CCallbackNetBase &amp;netbase)
+00105 {
+00106 msgin.serial (<a class="code" href="namespaceNLNET.html#a51">QueryPortPort</a>);
+00107 <a class="code" href="namespaceNLNET.html#a50">QueryPort</a> = <font class="keyword">true</font>;
+00108 }
+00109
+00110 <font class="comment">//</font>
+00111
+00112 <font class="comment">//static bool FirstRegisteredBroadcast;</font>
+00113
+<a name="l00114"></a><a class="code" href="classNLNET_1_1CNamingClient.html#a109">00114</a> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a109">cbRegisterBroadcast</a> (CMessage &amp;msgin, <a class="code" href="namespaceNLNET.html#a0">TSockId</a> from, CCallbackNetBase &amp;netbase)
+00115 {
+00116 <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> size;
+00117 string name;
+00118 <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid;
+00119 vector&lt;CInetAddress&gt; <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>;
+00120
+00121 msgin.serial (size);
+00122
+00123 <font class="keywordflow">for</font> (<a class="code" href="namespaceNLNET.html#a19">TServiceId</a> i = 0; i &lt; size; i++)
+00124 {
+00125 msgin.serial (name);
+00126 msgin.serial (sid);
+00127 msgin.serialCont (<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>);
+00128
+00129 <font class="comment">// add it in the list</font>
+00130
+00131 std::vector&lt;CInetAddress&gt; addrs;
+00132 CNamingClient::find (sid, addrs);
+00133
+00134 <font class="keywordflow">if</font> (addrs.size() == 0)
+00135 {
+00136 CNamingClient::RegisteredServicesMutex.enter ();
+00137 CNamingClient::RegisteredServices.push_back (CNamingClient::CServiceEntry (name, sid, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>));
+00138 CNamingClient::RegisteredServicesMutex.leave ();
+00139
+00140 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"NC: Registration Broadcast of the service %s-%hu '%s'"</font>, name.c_str(), (uint16)sid, <a class="code" href="namespaceNLNET.html#a82">vectorCInetAddressToString</a>(addr).c_str());
+00141
+00142 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLNET.html#a45">_RegistrationBroadcastCallback</a> != NULL)
+00143 <a class="code" href="namespaceNLNET.html#a45">_RegistrationBroadcastCallback</a> (name, sid, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>);
+00144 }
+00145 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (addrs.size() == 1)
+00146 {
+00147 CNamingClient::RegisteredServicesMutex.enter ();
+00148 <font class="keywordflow">for</font> (<a class="code" href="classstd_1_1list.html">std::list&lt;CNamingClient::CServiceEntry&gt;</a>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
+00149 {
+00150 <font class="keywordflow">if</font> (sid == (*it).SId)
+00151 {
+00152 (*it).Name = name;
+00153 (*it).Addr = <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>;
+00154 <font class="keywordflow">break</font>;
+00155 }
+00156 }
+00157 CNamingClient::RegisteredServicesMutex.leave ();
+00158 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"NC: Registration Broadcast (update) of the service %s-%hu '%s'"</font>, name.c_str(), (uint16)sid, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>[0].asString().c_str());
+00159 }
+00160 <font class="keywordflow">else</font>
+00161 {
+00162 <a class="code" href="debug_8h.html#a12">nlstop</a>;
+00163 }
+00164 }
+00165
+00166 <font class="comment">// FirstRegisteredBroadcast = true;</font>
+00167
+00168 <font class="comment">//CNamingClient::displayRegisteredServices ();</font>
+00169 }
+00170
+00171 <font class="comment">//</font>
+00172
+<a name="l00173"></a><a class="code" href="classNLNET_1_1CNamingClient.html#a110">00173</a> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a110">cbUnregisterBroadcast</a> (CMessage &amp;msgin, <a class="code" href="namespaceNLNET.html#a0">TSockId</a> from, CCallbackNetBase &amp;netbase)
+00174 {
+00175 string name;
+00176 <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid;
+00177 vector&lt;CInetAddress&gt; addrs;
+00178
+00179 msgin.serial (name);
+00180 msgin.serial (sid);
+00181
+00182 <font class="comment">// remove it in the list, if the service is not found, ignore it</font>
+00183
+00184 CNamingClient::RegisteredServicesMutex.enter ();
+00185 <font class="keywordflow">for</font> (<a class="code" href="classstd_1_1list.html">std::list&lt;CNamingClient::CServiceEntry&gt;</a>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
+00186 {
+00187 <font class="keywordflow">if</font> ((*it).SId == sid)
+00188 {
+00189 <font class="comment">// check the structure</font>
+00190 <a class="code" href="debug_8h.html#a8">nlassertex</a> ((*it).Name == name, (<font class="stringliteral">"%s %s"</font>,(*it).Name.c_str(), name.c_str()));
+00191
+00192 addrs = (*it).Addr;
+00193
+00194 CNamingClient::RegisteredServices.erase (it);
+00195 <font class="keywordflow">break</font>;
+00196 }
+00197 }
+00198 CNamingClient::RegisteredServicesMutex.leave ();
+00199
+00200 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"NC: Unregistration Broadcast of the service %s-%hu"</font>, name.c_str(), (uint16)sid);
+00201
+00202 <font class="comment">// send the ACK to the NS</font>
+00203
+00204 CMessage msgout (CNamingClient::_Connection-&gt;getSIDA(), <font class="stringliteral">"ACK_UNI"</font>);
+00205 msgout.serial (sid);
+00206 CNamingClient::_Connection-&gt;send (msgout);
+00207
+00208 <font 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!</font>
+00209 <font class="keywordflow">if</font>(CNamingClient::_MySId == sid)
+00210 {
+00211 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Naming Service asked me to leave, I leave!"</font>);
+00212 IService::getInstance()-&gt;exit();
+00213 <font class="keywordflow">return</font>;
+00214 }
+00215
+00216 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLNET.html#a46">_UnregistrationBroadcastCallback</a> != NULL)
+00217 <a class="code" href="namespaceNLNET.html#a46">_UnregistrationBroadcastCallback</a> (name, sid, addrs);
+00218
+00219 <font class="comment">//CNamingClient::displayRegisteredServices ();</font>
+00220 }
+00221
+00222 <font class="comment">//</font>
+00223
+00224 <font class="keyword">static</font> TCallbackItem <a class="code" href="namespaceNLNET.html#a52">NamingClientCallbackArray</a>[] =
+00225 {
+00226 { <font class="stringliteral">"RG"</font>, <a class="code" href="namespaceNLNET.html#a107">cbRegister</a> },
+00227 { <font class="stringliteral">"QP"</font>, <a class="code" href="namespaceNLNET.html#a108">cbQueryPort</a> },
+00228
+00229 { <font class="stringliteral">"RGB"</font>, <a class="code" href="namespaceNLNET.html#a109">cbRegisterBroadcast</a> },
+00230 { <font class="stringliteral">"UNB"</font>, <a class="code" href="namespaceNLNET.html#a110">cbUnregisterBroadcast</a> },
+00231 };
+00232
+00233 <font class="keywordtype">void</font> CNamingClient::connect( <font class="keyword">const</font> CInetAddress &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, CCallbackNetBase::TRecordingState rec, <font class="keyword">const</font> vector&lt;CInetAddress&gt; &amp;addresses )
+00234 {
+00235 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> == NULL || <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; !<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00236 <a class="code" href="classNLNET_1_1CNamingClient.html#q0">_ThreadId</a> = <a class="code" href="namespaceNLMISC.html#a237">getThreadId</a> ();
+00237
+00238 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> == NULL)
+00239 {
+00240 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> = <font class="keyword">new</font> CCallbackClient( rec, <font class="stringliteral">"naming_client.nmr"</font> );
+00241 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;addCallbackArray (<a class="code" href="namespaceNLNET.html#a52">NamingClientCallbackArray</a>, <font class="keyword">sizeof</font> (<a class="code" href="namespaceNLNET.html#a52">NamingClientCallbackArray</a>) / <font class="keyword">sizeof</font> (<a class="code" href="namespaceNLNET.html#a52">NamingClientCallbackArray</a>[0]));
+00242 }
+00243
+00244 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connect (<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>);
+00245
+00246 <font class="comment">/* // send the available addresses</font>
+00247 <font class="comment"> CMessage msgout (_Connection-&gt;getSIDA(), "RS");</font>
+00248 <font class="comment"> msgout.serialCont (const_cast&lt;vector&lt;CInetAddress&gt;&amp;&gt;(addresses));</font>
+00249 <font class="comment"> _Connection-&gt;send (msgout);</font>
+00250 <font class="comment"> </font>
+00251 <font class="comment"> // wait the message that contains all already connected services</font>
+00252 <font class="comment"> FirstRegisteredBroadcast = false;</font>
+00253 <font class="comment"> while (!FirstRegisteredBroadcast &amp;&amp; _Connection-&gt;connected ())</font>
+00254 <font class="comment"> {</font>
+00255 <font class="comment"> _Connection-&gt;update (-1);</font>
+00256 <font class="comment"> nlSleep (1);</font>
+00257 <font class="comment"> }</font>
+00258 <font class="comment">*/</font>}
+00259
+00260
+<a name="l00261"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d2">00261</a> <font class="keywordtype">void</font> CNamingClient::disconnect ()
+00262 {
+00263 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00264
+00265 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL)
+00266 {
+00267 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ())
+00268 {
+00269 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;disconnect ();
+00270 }
+00271 <font class="keyword">delete</font> <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>;
+00272 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> = NULL;
+00273 }
+00274
+00275 <font class="comment">// we don't call unregisterAllServices because when the naming service will see the disconnection,</font>
+00276 <font class="comment">// it'll automatically unregister all services registered by this client.</font>
+00277 }
+00278
+<a name="l00279"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d3">00279</a> string CNamingClient::info ()
+00280 {
+00281 string <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00282
+00283 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1CNamingClient.html#d1">connected</a> ())
+00284 {
+00285 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = <font class="stringliteral">"connected to "</font>;
+00286 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> += <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;remoteAddress().asString();
+00287 }
+00288 <font class="keywordflow">else</font>
+00289 {
+00290 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = <font class="stringliteral">"Not connected"</font>;
+00291 }
+00292
+00293 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00294 }
+00295
+<a name="l00296"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d4">00296</a> <font class="keywordtype">bool</font> CNamingClient::registerService (<font class="keyword">const</font> std::string &amp;name, <font class="keyword">const</font> std::vector&lt;CInetAddress&gt; &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> &amp;sid)
+00297 {
+00298 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00299 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00300
+00301 CMessage msgout (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;getSIDA(), <font class="stringliteral">"RG"</font>);
+00302 msgout.serial (const_cast&lt;std::string&amp;&gt;(name));
+00303 msgout.serialCont (<font class="keyword">const_cast</font>&lt;vector&lt;CInetAddress&gt;&amp;&gt;(<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>));
+00304 sid = 0;
+00305 msgout.serial (sid);
+00306 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;send (msgout);
+00307
+00308 <font class="comment">// wait the answer of the naming service "RG"</font>
+00309 <a class="code" href="namespaceNLNET.html#a47">Registered</a> = <font class="keyword">false</font>;
+00310 <a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a> = &amp;sid;
+00311 <font class="keywordflow">while</font> (!<a class="code" href="namespaceNLNET.html#a47">Registered</a>)
+00312 {
+00313 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;update (-1);
+00314 <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a> (1);
+00315 }
+00316 <font class="keywordflow">if</font> (RegisteredSuccess)
+00317 {
+00318 <a class="code" href="classNLNET_1_1CNamingClient.html#r1">_MySId</a> = sid;
+00319 <a class="code" href="classNLNET_1_1CNamingClient.html#r2">_RegisteredServices</a>.insert (make_pair (*<a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a>, name));
+00320 <a class="code" href="debug_8h.html#a0">nldebug</a> (<font class="stringliteral">"NC: Registered service %s-%hu at %s"</font>, name.c_str(), (uint16)sid, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>[0].asString().c_str());
+00321 }
+00322 <font class="keywordflow">else</font>
+00323 {
+00324 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"NC: Naming service refused to register service %s at %s"</font>, name.c_str(), <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>[0].asString().c_str());
+00325 }
+00326
+00327 <a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a> = NULL;
+00328
+00329 <font class="keywordflow">return</font> <a class="code" href="namespaceNLNET.html#a48">RegisteredSuccess</a> == 1;
+00330 }
+00331
+<a name="l00332"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d5">00332</a> <font class="keywordtype">bool</font> CNamingClient::registerServiceWithSId (<font class="keyword">const</font> std::string &amp;name, <font class="keyword">const</font> std::vector&lt;CInetAddress&gt; &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid)
+00333 {
+00334 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00335 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00336
+00337 CMessage msgout (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;getSIDA(), <font class="stringliteral">"RG"</font>);
+00338 msgout.serial (const_cast&lt;std::string&amp;&gt;(name));
+00339 msgout.serialCont (<font class="keyword">const_cast</font>&lt;vector&lt;CInetAddress&gt;&amp;&gt;(<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>));
+00340 msgout.serial (sid);
+00341 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;send (msgout);
+00342
+00343 <font class="comment">// wait the answer of the naming service "RGI"</font>
+00344 <a class="code" href="namespaceNLNET.html#a47">Registered</a> = <font class="keyword">false</font>;
+00345 <a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a> = &amp;sid;
+00346 <font class="keywordflow">while</font> (!<a class="code" href="namespaceNLNET.html#a47">Registered</a>)
+00347 {
+00348 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;update (-1);
+00349 <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a> (1);
+00350 }
+00351 <font class="keywordflow">if</font> (RegisteredSuccess)
+00352 {
+00353 <a class="code" href="classNLNET_1_1CNamingClient.html#r1">_MySId</a> = sid;
+00354 <a class="code" href="classNLNET_1_1CNamingClient.html#r2">_RegisteredServices</a>.insert (make_pair (*<a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a>, name));
+00355 <a class="code" href="debug_8h.html#a0">nldebug</a> (<font class="stringliteral">"NC: Registered service with sid %s-%hu at %s"</font>, name.c_str(), (uint16)<a class="code" href="namespaceNLNET.html#a49">RegisteredSID</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>[0].asString().c_str());
+00356 }
+00357 <font class="keywordflow">else</font>
+00358 {
+00359 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"NC: Naming service refused to register service with sid %s at %s"</font>, name.c_str(), <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>[0].asString().c_str());
+00360 }
+00361
+00362 <font class="keywordflow">return</font> <a class="code" href="namespaceNLNET.html#a48">RegisteredSuccess</a> == 1;
+00363 }
+00364
+<a name="l00365"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d6">00365</a> <font class="keywordtype">void</font> CNamingClient::resendRegisteration (<font class="keyword">const</font> std::string &amp;name, <font class="keyword">const</font> std::vector&lt;CInetAddress&gt; &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid)
+00366 {
+00367 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00368 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00369
+00370 CMessage msgout (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;getSIDA(), <font class="stringliteral">"RRG"</font>);
+00371 msgout.serial (const_cast&lt;std::string&amp;&gt;(name));
+00372 msgout.serialCont (<font class="keyword">const_cast</font>&lt;vector&lt;CInetAddress&gt;&amp;&gt;(<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>));
+00373 msgout.serial (sid);
+00374 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;send (msgout);
+00375 }
+00376
+<a name="l00377"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d7">00377</a> <font class="keywordtype">void</font> CNamingClient::unregisterService (<a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid)
+00378 {
+00379 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00380 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00381
+00382 CMessage msgout (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;getSIDA(), <font class="stringliteral">"UNI"</font>);
+00383 msgout.serial (sid);
+00384 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;send (msgout);
+00385
+00386 <a class="code" href="debug_8h.html#a0">nldebug</a> (<font class="stringliteral">"NC: Unregistering service %s-%hu"</font>, <a class="code" href="classNLNET_1_1CNamingClient.html#r2">_RegisteredServices</a>[sid].c_str(), sid);
+00387 <a class="code" href="classNLNET_1_1CNamingClient.html#r2">_RegisteredServices</a>.erase (sid);
+00388 }
+00389
+<a name="l00390"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d8">00390</a> <font class="keywordtype">void</font> CNamingClient::unregisterAllServices ()
+00391 {
+00392 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00393 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00394
+00395 <font class="keywordflow">while</font> (!<a class="code" href="classNLNET_1_1CNamingClient.html#r2">_RegisteredServices</a>.empty())
+00396 {
+00397 TRegServices::iterator irs = <a class="code" href="classNLNET_1_1CNamingClient.html#r2">_RegisteredServices</a>.begin();
+00398 <a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid = (*irs).first;
+00399 <a class="code" href="classNLNET_1_1CNamingClient.html#d7">unregisterService</a> (sid);
+00400 }
+00401 }
+00402
+<a name="l00403"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d9">00403</a> uint16 CNamingClient::queryServicePort ()
+00404 {
+00405 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00406 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00407
+00408 CMessage msgout (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;getSIDA(), <font class="stringliteral">"QP"</font>);
+00409 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;send (msgout);
+00410
+00411 <font class="comment">// wait the answer of the naming service "QP"</font>
+00412 <a class="code" href="namespaceNLNET.html#a50">QueryPort</a> = <font class="keyword">false</font>;
+00413 <font class="keywordflow">while</font> (!<a class="code" href="namespaceNLNET.html#a50">QueryPort</a>)
+00414 {
+00415 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;update (-1);
+00416 <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a> (1);
+00417 }
+00418
+00419 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"NC: Received the answer of the query port (%hu)"</font>, <a class="code" href="namespaceNLNET.html#a51">QueryPortPort</a>);
+00420
+00421 <font class="keywordflow">return</font> <a class="code" href="namespaceNLNET.html#a51">QueryPortPort</a>;
+00422 }
+00423
+<a name="l00424"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d10">00424</a> <font class="keywordtype">bool</font> CNamingClient::lookup (<font class="keyword">const</font> std::string &amp;name, CInetAddress &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>)
+00425 {
+00426 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00427
+00428 vector&lt;CInetAddress&gt; addrs;
+00429 <a class="code" href="classNLNET_1_1CNamingClient.html#f1">find</a> (name, addrs);
+00430
+00431 <font class="keywordflow">if</font> (addrs.size()==0)
+00432 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00433
+00434 <a class="code" href="debug_8h.html#a6">nlassert</a> (addrs.size()==1);
+00435 <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> = addrs[0];
+00436
+00437 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00438 }
+00439
+<a name="l00440"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d11">00440</a> <font class="keywordtype">bool</font> CNamingClient::lookup (<a class="code" href="namespaceNLNET.html#a19">TServiceId</a> sid, CInetAddress &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>)
+00441 {
+00442 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00443
+00444 vector&lt;CInetAddress&gt; addrs;
+00445 <a class="code" href="classNLNET_1_1CNamingClient.html#f1">find</a> (sid, addrs);
+00446
+00447 <font class="keywordflow">if</font> (addrs.size()==0)
+00448 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00449
+00450 <a class="code" href="debug_8h.html#a6">nlassert</a> (addrs.size()==1);
+00451 <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> = addrs[0];
+00452
+00453 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00454 }
+00455
+<a name="l00457"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d12">00457</a> <font class="keywordtype">bool</font> CNamingClient::lookupAlternate (<font class="keyword">const</font> std::string &amp;name, CInetAddress &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>)
+00458 {
+00459 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00460
+00461 <font class="comment">// remove it from his local list</font>
+00462
+00463 <a class="code" href="classNLNET_1_1CNamingClient.html#r4">RegisteredServicesMutex</a>.enter ();
+00464 <font class="keywordflow">for</font> (<a class="code" href="classstd_1_1list.html">std::list&lt;CServiceEntry&gt;</a>::iterator it = <a class="code" href="classNLNET_1_1CNamingClient.html#r3">RegisteredServices</a>.begin(); it != <a class="code" href="classNLNET_1_1CNamingClient.html#r3">RegisteredServices</a>.end (); it++)
+00465 {
+00466 <font class="keywordflow">if</font> ((*it).Addr[0] == <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>)
+00467 {
+00468 <a class="code" href="classNLNET_1_1CNamingClient.html#r3">RegisteredServices</a>.erase (it);
+00469 <font class="keywordflow">break</font>;
+00470 }
+00471 }
+00472 <a class="code" href="classNLNET_1_1CNamingClient.html#r4">RegisteredServicesMutex</a>.leave ();
+00473
+00474 vector&lt;CInetAddress&gt; addrs;
+00475 <a class="code" href="classNLNET_1_1CNamingClient.html#f1">find</a> (name, addrs);
+00476
+00477 <font class="keywordflow">if</font> (addrs.size()==0)
+00478 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00479
+00480 <a class="code" href="debug_8h.html#a6">nlassert</a> (addrs.size()==1);
+00481 <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> = addrs[0];
+00482
+00483 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00484 }
+00485
+<a name="l00486"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d13">00486</a> <font class="keywordtype">void</font> CNamingClient::lookupAll (<font class="keyword">const</font> std::string &amp;name, std::vector&lt;CInetAddress&gt; &amp;addrs)
+00487 {
+00488 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00489
+00490 <a class="code" href="classNLNET_1_1CNamingClient.html#f1">find</a> (name, addrs);
+00491 }
+00492
+<a name="l00493"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d15">00493</a> <font class="keywordtype">bool</font> CNamingClient::lookupAndConnect (<font class="keyword">const</font> std::string &amp;name, CCallbackClient &amp;sock)
+00494 {
+00495 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ());
+00496
+00497 <font class="comment">// look up for service</font>
+00498 CInetAddress servaddr;
+00499
+00500 <font class="comment">// if service not found, return false</font>
+00501 <font class="keywordflow">if</font> (!CNamingClient::lookup (name, servaddr))
+00502 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00503
+00504 <font class="keywordflow">do</font>
+00505 {
+00506 <font class="keywordflow">try</font>
+00507 {
+00508 <font class="comment">// try to connect to the server</font>
+00509 sock.connect (servaddr);
+00510
+00511 <font class="comment">// connection succeeded</font>
+00512 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00513 }
+00514 <font class="keywordflow">catch</font> (ESocketConnectionFailed &amp;e)
+00515 {
+00516 <a class="code" href="debug_8h.html#a0">nldebug</a>( <font class="stringliteral">"Connection to %s failed: %s, tring another service if available"</font>, servaddr.asString().c_str(), e.what() );
+00517
+00518 <font class="comment">// try another server and if service is not found, return false</font>
+00519 <font class="keywordflow">if</font> (!CNamingClient::lookupAlternate (name, servaddr))
+00520 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00521 }
+00522 }
+00523 <font class="keywordflow">while</font> (true);
+00524 }
+00525
+00526
+00527
+<a name="l00528"></a><a class="code" href="classNLNET_1_1CNamingClient.html#d16">00528</a> <font class="keywordtype">void</font> CNamingClient::update ()
+00529 {
+00530 <a class="code" href="classNLNET_1_1CNamingClient.html#e0">checkThreadId</a> ();
+00531 <font class="comment">// get message for naming service (new registration for example)</font>
+00532 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a> != NULL &amp;&amp; <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;connected ())
+00533 <a class="code" href="classNLNET_1_1CNamingClient.html#r0">_Connection</a>-&gt;update ();
+00534 }
+00535
+<a name="l00536"></a><a class="code" href="classNLNET_1_1CNamingClient.html#e0">00536</a> <font class="keywordtype">void</font> CNamingClient::checkThreadId ()
+00537 {
+00538 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLMISC.html#a237">getThreadId</a> () != <a class="code" href="classNLNET_1_1CNamingClient.html#q0">_ThreadId</a>)
+00539 {
+00540 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"You try to access to the CNamingClient with 2 differents thread (%d and %d)"</font>, <a class="code" href="classNLNET_1_1CNamingClient.html#q0">_ThreadId</a>, <a class="code" href="namespaceNLMISC.html#a237">getThreadId</a>());
+00541 }
+00542 }
+00543
+00544
+00545 <font class="comment">//</font>
+00546 <font class="comment">// Commands</font>
+00547 <font class="comment">//</font>
+00548
+00549 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a>(services, <font class="stringliteral">"displays registered services"</font>, <font class="stringliteral">""</font>)
+00550 {
+00551 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00552
+00553 CNamingClient::displayRegisteredServices (&amp;log);
+00554
+00555 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00556 }
+00557
+00558 } <font class="comment">// NLNET</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>