aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/service_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/service_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/service_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/service_8cpp-source.html1616
1 files changed, 1616 insertions, 0 deletions
diff --git a/docs/doxygen/nel/service_8cpp-source.html b/docs/doxygen/nel/service_8cpp-source.html
new file mode 100644
index 00000000..f1ca647d
--- /dev/null
+++ b/docs/doxygen/nel/service_8cpp-source.html
@@ -0,0 +1,1616 @@
+<!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>service.cpp</h1><a href="service_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00009 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00010 <font class="comment"> *</font>
+00011 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00012 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00013 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00014 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00015 <font class="comment"> * any later version.</font>
+00016 <font class="comment"> *</font>
+00017 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00018 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00019 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00020 <font class="comment"> * General Public License for more details.</font>
+00021 <font class="comment"> *</font>
+00022 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00023 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00024 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00025 <font class="comment"> * MA 02111-1307, USA.</font>
+00026 <font class="comment"> */</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="stdnet_8h.html">stdnet.h</a>"</font>
+00029
+00030 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00031 <font class="preprocessor"></font>
+00032 <font class="comment">//</font>
+00033 <font class="comment">// Includes</font>
+00034 <font class="comment">//</font>
+00035
+00036 <font class="comment">// these defines is for IsDebuggerPresent(). it'll not compile on windows 95</font>
+00037 <font class="comment">// just comment this and the IsDebuggerPresent to compile on windows 95</font>
+00038 <font class="preprocessor"># define _WIN32_WINDOWS 0x0410</font>
+00039 <font class="preprocessor"></font><font class="preprocessor"># define WINVER 0x0400</font>
+00040 <font class="preprocessor"></font><font class="preprocessor"># include &lt;windows.h&gt;</font>
+00041 <font class="preprocessor"># include &lt;direct.h&gt;</font>
+00042
+00043 <font class="preprocessor">#elif defined NL_OS_UNIX</font>
+00044 <font class="preprocessor"></font>
+00045 <font class="preprocessor"># include &lt;<a class="code" href="unistd_8h.html">unistd.h</a>&gt;</font>
+00046
+00047 <font class="preprocessor">#endif</font>
+00048 <font class="preprocessor"></font>
+00049 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
+00050 <font class="preprocessor">#include &lt;signal.h&gt;</font>
+00051
+00052 <font class="preprocessor">#include "<a class="code" href="config__file_8h.html">nel/misc/config_file.h</a>"</font>
+00053 <font class="preprocessor">#include "<a class="code" href="displayer_8h.html">nel/misc/displayer.h</a>"</font>
+00054 <font class="preprocessor">#include "<a class="code" href="mutex_8h.html">nel/misc/mutex.h</a>"</font>
+00055 <font class="preprocessor">#include "<a class="code" href="window__displayer_8h.html">nel/misc/window_displayer.h</a>"</font>
+00056 <font class="preprocessor">#include "<a class="code" href="gtk__displayer_8h.html">nel/misc/gtk_displayer.h</a>"</font>
+00057 <font class="preprocessor">#include "<a class="code" href="win__displayer_8h.html">nel/misc/win_displayer.h</a>"</font>
+00058 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
+00059 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font>
+00060 <font class="preprocessor">#include "<a class="code" href="report_8h.html">nel/misc/report.h</a>"</font>
+00061
+00062 <font class="preprocessor">#include "<a class="code" href="naming__client_8h.html">nel/net/naming_client.h</a>"</font>
+00063 <font class="preprocessor">#include "<a class="code" href="service_8h.html">nel/net/service.h</a>"</font>
+00064 <font class="preprocessor">#include "<a class="code" href="unified__network_8h.html">nel/net/unified_network.h</a>"</font>
+00065 <font class="preprocessor">#include "<a class="code" href="net__manager_8h.html">nel/net/net_manager.h</a>"</font>
+00066 <font class="preprocessor">#include "<a class="code" href="net__displayer_8h.html">nel/net/net_displayer.h</a>"</font>
+00067 <font class="preprocessor">#include "<a class="code" href="email_8h.html">nel/net/email.h</a>"</font>
+00068 <font class="preprocessor">#include "<a class="code" href="varpath_8h.html">nel/net/varpath.h</a>"</font>
+00069
+00070 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font>
+00071
+00072
+00073 <font class="comment">//</font>
+00074 <font class="comment">// Namespace</font>
+00075 <font class="comment">//</font>
+00076
+00077 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00078 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00079
+00080
+00081 <font class="keyword">namespace </font>NLNET
+00082 {
+00083
+00084
+00085 <font class="comment">//</font>
+00086 <font class="comment">// Constants</font>
+00087 <font class="comment">//</font>
+00088
+00089 <font class="keyword">static</font> <font class="keyword">const</font> sint <a class="code" href="namespaceNLNET.html#a54">Signal</a>[] = {
+00090 SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM
+00091 };
+00092
+00093 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNLNET.html#a55">SignalName</a>[]=
+00094 {
+00095 <font class="stringliteral">"SIGABRT"</font>, <font class="stringliteral">"SIGFPE"</font>, <font class="stringliteral">"SIGILL"</font>, <font class="stringliteral">"SIGINT"</font>, <font class="stringliteral">"SIGSEGV"</font>, <font class="stringliteral">"SIGTERM"</font>
+00096 };
+00097
+00098
+00099 <font class="comment">//</font>
+00100 <font class="comment">// Variables</font>
+00101 <font class="comment">//</font>
+00102
+00103
+00104 <font class="comment">// class static member</font>
+<a name="l00105"></a><a class="code" href="classNLNET_1_1IService.html#z354_20">00105</a> IService *IService::_Instance = NULL;
+00106
+00107 <font class="keyword">static</font> sint <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = 0;
+00108
+00109 <font class="comment">// services stat</font>
+00110 <font class="keyword">static</font> sint32 <a class="code" href="namespaceNLNET.html#a57">NetSpeedLoop</a>, <a class="code" href="namespaceNLNET.html#a58">UserSpeedLoop</a>;
+00111
+00112 <font class="comment">// this is the thread that initialized the signal redirection</font>
+00113 <font class="comment">// we ll ignore other thread signals</font>
+00114 <font class="keyword">static</font> uint <a class="code" href="namespaceNLNET.html#a59">SignalisedThread</a>;
+00115
+00116 <font class="keyword">static</font> CFileDisplayer fd;
+00117 <font class="keyword">static</font> CNetDisplayer <a class="code" href="namespaceNLNET.html#a116">commandDisplayer</a>(<font class="keyword">false</font>);
+00118 <font class="keyword">static</font> CLog <a class="code" href="namespaceNLNET.html#a61">commandLog</a>;
+00119
+00120
+00121 <font class="comment">//</font>
+00122 <font class="comment">// Callback managing</font>
+00123 <font class="comment">//</font>
+00124
+00125 <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a117">serviceGetView</a> (uint32 rid, <font class="keyword">const</font> string &amp;rawvarpath, vector&lt;string&gt; &amp;vara, vector&lt;string&gt; &amp;vala)
+00126 {
+00127 string str;
+00128 CLog logDisplayVars;
+00129 CMemDisplayer mdDisplayVars;
+00130 logDisplayVars.addDisplayer (&amp;mdDisplayVars);
+00131
+00132 <a class="code" href="classCVarPath.html">CVarPath</a> varpath(rawvarpath);
+00133
+00134 <font class="comment">// add default row</font>
+00135 vara.push_back (<font class="stringliteral">"service"</font>);
+00136
+00137 vala.push_back (IService::getInstance ()-&gt;getServiceUnifiedName());
+00138
+00139 <font class="keywordflow">for</font> (uint j = 0; j &lt; varpath.<a class="code" href="classCVarPath.html#m0">Destination</a>.size (); j++)
+00140 {
+00141 string cmd = varpath.<a class="code" href="classCVarPath.html#m0">Destination</a>[j].first;
+00142
+00143 <font class="comment">// replace = with space to execute the command</font>
+00144 uint pos = cmd.find(<font class="stringliteral">"="</font>);
+00145 <font class="keywordflow">if</font> (pos != string::npos)
+00146 cmd[pos] = <font class="charliteral">' '</font>;
+00147
+00148 mdDisplayVars.clear ();
+00149 ICommand::execute(cmd, logDisplayVars, <font class="keyword">true</font>);
+00150 <font class="keyword">const</font> std::deque&lt;std::string&gt; &amp;strs = mdDisplayVars.lockStrings();
+00151 <font class="keywordflow">if</font> (strs.size()&gt;0)
+00152 {
+00153 string s_ = strs[0];
+00154
+00155 uint32 pos = strs[0].find(<font class="stringliteral">"="</font>);
+00156 <font class="keywordflow">if</font>(pos != string::npos &amp;&amp; pos + 2 &lt; strs[0].size())
+00157 {
+00158 uint32 pos2 = string::npos;
+00159 <font class="keywordflow">if</font>(strs[0][strs[0].size()-1] == <font class="charliteral">'\n'</font>)
+00160 pos2 = strs[0].size() - pos - 2 - 1;
+00161
+00162 str = strs[0].substr (pos+2, pos2);
+00163 }
+00164 <font class="keywordflow">else</font>
+00165 {
+00166 str = <font class="stringliteral">"???"</font>;
+00167 }
+00168 }
+00169 <font class="keywordflow">else</font>
+00170 {
+00171 str = <font class="stringliteral">"???"</font>;
+00172 }
+00173 mdDisplayVars.unlockStrings();
+00174
+00175 <font class="keywordflow">if</font> (pos != string::npos)
+00176 vara.push_back(cmd.substr(0, pos));
+00177 <font class="keywordflow">else</font>
+00178 vara.push_back(cmd);
+00179
+00180 vala.push_back (str);
+00181 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Add to result view '%s' = '%s'"</font>, varpath.<a class="code" href="classCVarPath.html#m0">Destination</a>[j].first.c_str(), str.c_str());
+00182 }
+00183
+00184 }
+00185
+00186 <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a118">servcbGetView</a> (CMessage &amp;msgin, <font class="keyword">const</font> std::string &amp;serviceName, uint16 sid)
+00187 {
+00188 uint32 rid;
+00189 string rawvarpath;
+00190
+00191 msgin.serial (rid);
+00192 msgin.serial (rawvarpath);
+00193
+00194 vector&lt;string&gt; vara;
+00195 vector&lt;string&gt; vala;
+00196
+00197 <a class="code" href="namespaceNLNET.html#a117">serviceGetView</a> (rid, rawvarpath, vara, vala);
+00198
+00199 CMessage msgout(<font class="stringliteral">"VIEW"</font>);
+00200 msgout.serial(rid);
+00201
+00202 msgout.serialCont (vara);
+00203 msgout.serialCont (vala);
+00204
+00205 CUnifiedNetwork::getInstance ()-&gt;send (sid, msgout);
+00206 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Sent result view to service '%s-%hu'"</font>, serviceName.c_str(), sid);
+00207 }
+00208
+00209 <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a119">AESConnection</a> (<font class="keyword">const</font> string &amp;serviceName, uint16 sid, <font class="keywordtype">void</font> *arg)
+00210 {
+00211 <font class="comment">// established a connection to the AES, identify myself</font>
+00212
+00213 <font class="comment">//</font>
+00214 <font class="comment">// Sends the identification message with the name of the service and all commands available on this service</font>
+00215 <font class="comment">//</font>
+00216
+00217 CMessage msgout (<font class="stringliteral">"SID"</font>);
+00218 uint32 pid = getpid ();
+00219 msgout.serial (IService::getInstance()-&gt;_AliasName, IService::getInstance()-&gt;_LongName, pid);
+00220 ICommand::serialCommands (msgout);
+00221 CUnifiedNetwork::getInstance()-&gt;send(<font class="stringliteral">"AES"</font>, msgout);
+00222
+00223 <font class="keywordflow">if</font> (IService::getInstance()-&gt;_Initialized)
+00224 {
+00225 CMessage msgout2 (<font class="stringliteral">"SR"</font>);
+00226 CUnifiedNetwork::getInstance()-&gt;send(<font class="stringliteral">"AES"</font>, msgout2);
+00227 }
+00228
+00229 <font class="comment">// add the displayer to the standard logger</font>
+00230 <font class="comment">// TSockId hid;</font>
+00231 <font class="comment">// CCallbackClient *client = dynamic_cast&lt;CCallbackClient *&gt;(CUnifiedNetwork::getInstance()-&gt;getNetBase("AES", hid));</font>
+00232 <font class="comment">// commandDisplayer.setLogServer (client);</font>
+00233 <font class="comment">// commandLog.addDisplayer (&amp;commandDisplayer);</font>
+00234 }
+00235
+00236
+00237 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a120">AESDisconnection</a> (<font class="keyword">const</font> std::string &amp;serviceName, uint16 sid, <font class="keywordtype">void</font> *arg)
+00238 {
+00239 <font class="comment">// commandLog.removeDisplayer (&amp;commandDisplayer);</font>
+00240 }
+00241
+00242
+00243 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a121">cbExecCommand</a> (CMessage &amp;msgin, <font class="keyword">const</font> std::string &amp;serviceName, uint16 sid)
+00244 {
+00245 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"AES: Deprecated function call cbExecCommand"</font>);
+00246
+00247 <font class="comment">/* string command;</font>
+00248 <font class="comment"> msgin.serial (command);</font>
+00249 <font class="comment"></font>
+00250 <font class="comment"> ICommand::execute (command, commandLog);</font>
+00251 <font class="comment">*/</font>}
+00252
+00253
+00254 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a122">cbStopService</a> (CMessage &amp;msgin, <font class="keyword">const</font> std::string &amp;serviceName, uint16 sid)
+00255 {
+00256 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Receive a stop from service %s-%d, need to quit"</font>, serviceName.c_str(), sid);
+00257 <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = 0xFFFF;
+00258 }
+00259
+00260
+00261
+00262 <font class="comment">// layer 5</font>
+00263 <font class="keyword">static</font> TUnifiedCallbackItem <a class="code" href="namespaceNLNET.html#a62">AESCallbackArray</a>[] =
+00264 {
+00265 { <font class="stringliteral">"STOPS"</font>, <a class="code" href="namespaceNLNET.html#a122">cbStopService</a> },
+00266 { <font class="stringliteral">"EXEC_COMMAND"</font>, <a class="code" href="namespaceNLNET.html#a121">cbExecCommand</a> },
+00267 { <font class="stringliteral">"GET_VIEW"</font>, <a class="code" href="namespaceNLNET.html#a118">servcbGetView</a> },
+00268 };
+00269
+00270 <font class="comment">//</font>
+00271 <font class="comment">// Signals managing</font>
+00272 <font class="comment">//</font>
+00273
+00274 <font class="comment">// This function is called when a signal comes</font>
+00275 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a123">sigHandler</a>(<font class="keywordtype">int</font> Sig)
+00276 {
+00277 <font class="comment">// redirect the signal for the next time</font>
+00278 signal(Sig, <a class="code" href="namespaceNLNET.html#a123">sigHandler</a>);
+00279
+00280 <font class="comment">// find the signal</font>
+00281 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; i &lt; (int)(<font class="keyword">sizeof</font>(Signal)/<font class="keyword">sizeof</font>(<a class="code" href="namespaceNLNET.html#a54">Signal</a>[0])); i++)
+00282 {
+00283 <font class="keywordflow">if</font> (Sig == <a class="code" href="namespaceNLNET.html#a54">Signal</a>[i])
+00284 {
+00285 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLMISC.html#a237">getThreadId</a> () != <a class="code" href="namespaceNLNET.html#a59">SignalisedThread</a>)
+00286 {
+00287 <a class="code" href="debug_8h.html#a0">nldebug</a> (<font class="stringliteral">"Not the main thread received the signal (%s, %d), ignore it"</font>, <a class="code" href="namespaceNLNET.html#a55">SignalName</a>[i],Sig);
+00288 <font class="keywordflow">return</font>;
+00289 }
+00290 <font class="keywordflow">else</font>
+00291 {
+00292 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Signal %s (%d) received"</font>, <a class="code" href="namespaceNLNET.html#a55">SignalName</a>[i], Sig);
+00293 <font class="keywordflow">switch</font> (Sig)
+00294 {
+00295 <font class="keywordflow">case</font> SIGABRT :
+00296 <font class="keywordflow">case</font> SIGILL :
+00297 <font class="keywordflow">case</font> SIGINT :
+00298 <font class="keywordflow">case</font> SIGSEGV :
+00299 <font class="keywordflow">case</font> SIGTERM :
+00300 <font class="comment">// you should not call a function and system function like printf in a SigHandle because</font>
+00301 <font class="comment">// signal-handler routines are usually called asynchronously when an interrupt occurs.</font>
+00302 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> == 0)
+00303 {
+00304 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Receive a signal that said that i must exit"</font>);
+00305 <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = Sig;
+00306 <font class="keywordflow">return</font>;
+00307 }
+00308 <font class="keywordflow">else</font>
+00309 {
+00310 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Signal already received, launch the brutal exit"</font>);
+00311 exit (EXIT_FAILURE);
+00312 }
+00313 <font class="keywordflow">break</font>;
+00314 }
+00315 }
+00316 }
+00317 }
+00318 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Unknown signal received (%d)"</font>, Sig);
+00319 }
+00320
+00321 <font class="comment">// Initialise the signal redirection</font>
+00322 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a124">initSignal</a>()
+00323 {
+00324 <a class="code" href="namespaceNLNET.html#a59">SignalisedThread</a> = <a class="code" href="namespaceNLMISC.html#a237">getThreadId</a> ();
+00325 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00326 <font class="preprocessor"></font> <font class="comment">// in debug mode, we only trap the SIGINT signal</font>
+00327 signal(<a class="code" href="namespaceNLNET.html#a54">Signal</a>[3], <a class="code" href="namespaceNLNET.html#a123">sigHandler</a>);
+00328 <font class="comment">//nldebug("Signal : %s (%d) trapped", SignalName[3], Signal[3]);</font>
+00329 <font class="preprocessor">#else</font>
+00330 <font class="preprocessor"></font> <font class="comment">// in release, redirect all signals</font>
+00331 <font class="comment">/* don't redirect now because to hard to debug...</font>
+00332 <font class="comment"> for (int i = 0; i &lt; (int)(sizeof(Signal)/sizeof(Signal[0])); i++)</font>
+00333 <font class="comment"> {</font>
+00334 <font class="comment"> signal(Signal[i], sigHandler);</font>
+00335 <font class="comment"> nldebug("Signal %s (%d) trapped", SignalName[i], Signal[i]);</font>
+00336 <font class="comment"> }</font>
+00337 <font class="comment">*/</font>
+00338 <font class="preprocessor">#endif</font>
+00339 <font class="preprocessor"></font>}
+00340
+00341 <font class="comment">//</font>
+00342 <font class="comment">// Class implementation</font>
+00343 <font class="comment">//</font>
+00344
+00345 <font class="comment">// Ctor</font>
+<a name="l00346"></a><a class="code" href="classNLNET_1_1IService.html#z352_5">00346</a> IService::IService() :
+00347 WindowDisplayer(NULL),
+00348 _Port(0),
+00349 _RecordingState(CCallbackNetBase::Off),
+00350 _UpdateTimeout(100),
+00351 _SId(0),
+00352 _Status(0),
+00353 _Initialized(false),
+00354 _ResetMeasures(false)
+00355 {
+00356 <font class="comment">// Singleton</font>
+00357 <a class="code" href="debug_8h.html#a6">nlassert</a>( <a class="code" href="classNLNET_1_1IService.html#z354_20">_Instance</a> == NULL );
+00358
+00359 <a class="code" href="classNLNET_1_1IService.html#z354_20">_Instance</a> = <font class="keyword">this</font>;
+00360 }
+00361
+00362
+00363
+<a name="l00364"></a><a class="code" href="classNLNET_1_1IService.html#z350_7">00364</a> <font class="keywordtype">bool</font> IService::haveArg (<font class="keywordtype">char</font> argName)
+00365 {
+00366 <font class="keywordflow">for</font> (uint32 i = 0; i &lt; <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>.size(); i++)
+00367 {
+00368 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i].size() &gt;= 2 &amp;&amp; <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i][0] == <font class="charliteral">'-'</font>)
+00369 {
+00370 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i][1] == argName)
+00371 {
+00372 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00373 }
+00374 }
+00375 }
+00376 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00377 }
+00378
+<a name="l00379"></a><a class="code" href="classNLNET_1_1IService.html#z350_8">00379</a> string IService::getArg (<font class="keywordtype">char</font> argName)
+00380 {
+00381 <font class="keywordflow">for</font> (uint32 i = 0; i &lt; <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>.size(); i++)
+00382 {
+00383 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i].size() &gt;= 2 &amp;&amp; <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i][0] == <font class="charliteral">'-'</font>)
+00384 {
+00385 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i][1] == argName)
+00386 {
+00387 <font class="keywordflow">return</font> <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>[i].substr(2);
+00388 }
+00389 }
+00390 }
+00391 <font class="keywordflow">throw</font> Exception (<font class="stringliteral">"Parameter '-%c' is not found in command line"</font>, argName);
+00392 }
+00393
+00394
+<a name="l00395"></a><a class="code" href="classNLNET_1_1IService.html#z352_2">00395</a> <font class="keywordtype">void</font> IService::setArgs (<font class="keyword">const</font> <font class="keywordtype">char</font> *args)
+00396 {
+00397 <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>.push_back (<font class="stringliteral">"&lt;ProgramName&gt;"</font>);
+00398
+00399 string sargs (args);
+00400 uint32 pos1 = 0, pos2 = 0;
+00401
+00402 <font class="keywordflow">do</font>
+00403 {
+00404 pos1 = sargs.find_first_not_of (<font class="stringliteral">" "</font>, pos2);
+00405 <font class="keywordflow">if</font> (pos1 == string::npos) <font class="keywordflow">break</font>;
+00406 pos2 = sargs.find_first_of (<font class="stringliteral">" "</font>, pos1);
+00407 <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>.push_back (sargs.substr (pos1, pos2-pos1));
+00408 }
+00409 <font class="keywordflow">while</font> (pos2 != string::npos);
+00410 }
+00411
+<a name="l00412"></a><a class="code" href="classNLNET_1_1IService.html#z352_1">00412</a> <font class="keywordtype">void</font> IService::setArgs (<font class="keywordtype">int</font> argc, <font class="keyword">const</font> <font class="keywordtype">char</font> **argv)
+00413 {
+00414 <font class="keywordflow">for</font> (sint i = 0; i &lt; argc; i++)
+00415 {
+00416 <a class="code" href="classNLNET_1_1IService.html#z354_0">_Args</a>.push_back (argv[i]);
+00417 }
+00418 }
+00419
+00420 <font class="comment">/*</font>
+00421 <font class="comment"> * Returns a pointer to the CCallbackServer object</font>
+00422 <font class="comment"> */</font>
+<a name="l00423"></a><a class="code" href="classNLNET_1_1IService.html#z350_10">00423</a> CCallbackServer *IService::getServer()
+00424 {
+00425 <font class="keywordflow">return</font> NULL;
+00426 }
+00427
+00428
+00429
+00430 <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a125">cbLogFilter</a> (CConfigFile::CVar &amp;var)
+00431 {
+00432 CLog *log = NULL;
+00433 <font class="keywordflow">if</font> (var.Name == <font class="stringliteral">"NegFiltersDebug"</font>)
+00434 {
+00435 log = <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>;
+00436 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Updating negative filter on debug from config file"</font>);
+00437 }
+00438 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (var.Name == <font class="stringliteral">"NegFiltersInfo"</font>)
+00439 {
+00440 log = <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>;
+00441 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Updating negative filter on info from config file"</font>);
+00442 }
+00443 <font class="keywordflow">else</font>
+00444 {
+00445 <a class="code" href="debug_8h.html#a12">nlstop</a>;
+00446 }
+00447
+00448 <font class="comment">// remove all old filter from configfile</font>
+00449 CConfigFile::CVar &amp;oldvar = IService::getInstance()-&gt;ConfigFile.getVar (var.Name);
+00450 <font class="keywordflow">for</font> (sint j = 0; j &lt; oldvar.size(); j++)
+00451 {
+00452 log-&gt;removeFilter (oldvar.asString(j).c_str());
+00453 }
+00454
+00455 <font class="comment">// add all new filter from configfile</font>
+00456 <font class="keywordflow">for</font> (sint i = 0; i &lt; var.size(); i++)
+00457 {
+00458 log-&gt;addNegativeFilter (var.asString(i).c_str());
+00459 }
+00460 }
+00461
+00462
+00463
+00464
+00465
+00466
+00467
+00468
+00469 <font class="comment">//</font>
+00470 <font class="comment">// The main function of the service</font>
+00471 <font class="comment">//</font>
+00472
+<a name="l00473"></a><a class="code" href="classNLNET_1_1IService.html#z352_0">00473</a> sint IService::main (<font class="keyword">const</font> <font class="keywordtype">char</font> *serviceShortName, <font class="keyword">const</font> <font class="keywordtype">char</font> *serviceLongName, uint16 servicePort, <font class="keyword">const</font> <font class="keywordtype">char</font> *configDir, <font class="keyword">const</font> <font class="keywordtype">char</font> *logDir)
+00474 {
+00475 <font class="keywordtype">bool</font> userInitCalled = <font class="keyword">false</font>;
+00476 <font class="keywordtype">bool</font> resyncEvenly = <font class="keyword">false</font>;
+00477 CConfigFile::CVar *var = NULL;
+00478
+00479 <font class="comment">// a short name service can't be a number</font>
+00480 <a class="code" href="debug_8h.html#a6">nlassert</a> (atoi(serviceShortName) == 0);
+00481
+00482 <font class="keywordflow">try</font>
+00483 {
+00484 <font class="comment">//</font>
+00485 <font class="comment">// Init parameters</font>
+00486 <font class="comment">//</font>
+00487
+00488 <a class="code" href="classNLNET_1_1IService.html#z354_11">_ConfigDir</a> = CPath::standardizePath(configDir);
+00489 <a class="code" href="classNLNET_1_1IService.html#z354_12">_LogDir</a> = CPath::standardizePath(logDir);
+00490 <a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a> = serviceShortName;
+00491 <a class="code" href="classNLNET_1_1IService.html#z354_4">_LongName</a> = serviceLongName;
+00492
+00493 <font class="comment">// Set the process name</font>
+00494 CLog::setProcessName (<a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>);
+00495
+00496 <a class="code" href="namespaceNLMISC.html#a275">setReportEmailFunction</a> ((<font class="keywordtype">void</font>*)sendEmail);
+00497 <a class="code" href="namespaceNLNET.html#a79">setDefaultEmailParams</a> (<font class="stringliteral">"gw.nevrax.com"</font>, <font class="stringliteral">""</font>, <font class="stringliteral">"lecroart@nevrax.com"</font>);
+00498
+00499 <font class="comment">// get the path where to run the service if any in the command line</font>
+00500 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z350_7">haveArg</a>(<font class="charliteral">'A'</font>))
+00501 {
+00502 <a class="code" href="classNLNET_1_1IService.html#z354_13">_RunningPath</a> = CPath::standardizePath(<a class="code" href="classNLNET_1_1IService.html#z350_8">getArg</a>(<font class="charliteral">'A'</font>));
+00503 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00504 <font class="preprocessor"></font> _chdir (<a class="code" href="classNLNET_1_1IService.html#z354_13">_RunningPath</a>.c_str());
+00505 <font class="preprocessor">#else</font>
+00506 <font class="preprocessor"></font> chdir (<a class="code" href="classNLNET_1_1IService.html#z354_13">_RunningPath</a>.c_str());
+00507 <font class="preprocessor">#endif</font>
+00508 <font class="preprocessor"></font> }
+00509
+00510 <font class="comment">//</font>
+00511 <font class="comment">// Init debug/log stuffs (must be first things otherwise we can't log if errors)</font>
+00512 <font class="comment">//</font>
+00513
+00514 <font class="comment">// get the log dir if any in the command line</font>
+00515 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z350_7">haveArg</a>(<font class="charliteral">'L'</font>))
+00516 <a class="code" href="classNLNET_1_1IService.html#z354_12">_LogDir</a> = CPath::standardizePath(<a class="code" href="classNLNET_1_1IService.html#z350_8">getArg</a>(<font class="charliteral">'L'</font>));
+00517
+00518 <font class="comment">// get the config file dir if any in the command line</font>
+00519 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z350_7">haveArg</a>(<font class="charliteral">'C'</font>))
+00520 <a class="code" href="classNLNET_1_1IService.html#z354_11">_ConfigDir</a> = CPath::standardizePath(<a class="code" href="classNLNET_1_1IService.html#z350_8">getArg</a>(<font class="charliteral">'C'</font>));
+00521
+00522 <a class="code" href="namespaceNLMISC.html#a247">createDebug</a> (<a class="code" href="classNLNET_1_1IService.html#z354_12">_LogDir</a>.c_str(), <font class="keyword">false</font>);
+00523
+00524 <font class="comment">//DebugLog-&gt;addNegativeFilter ("NETL");</font>
+00525
+00526 <font class="comment">// we create the log with service name filename ("test_service.log" for example)</font>
+00527 fd.setParam (<a class="code" href="classNLNET_1_1IService.html#z354_12">_LogDir</a> + <a class="code" href="classNLNET_1_1IService.html#z354_4">_LongName</a> + <font class="stringliteral">".log"</font>, <font class="keyword">false</font>);
+00528
+00529 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;addDisplayer (&amp;fd);
+00530 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;addDisplayer (&amp;fd);
+00531 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;addDisplayer (&amp;fd);
+00532 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;addDisplayer (&amp;fd);
+00533 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;addDisplayer (&amp;fd);
+00534
+00535
+00536 <font class="comment">//</font>
+00537 <font class="comment">// Init the hierarchical timer</font>
+00538 <font class="comment">//</font>
+00539
+00540 CHTimer::startBench(<font class="keyword">false</font>, <font class="keyword">true</font>);
+00541
+00542
+00543 <font class="comment">//</font>
+00544 <font class="comment">// Load the config file</font>
+00545 <font class="comment">//</font>
+00546
+00547 <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a5">load</a> (<a class="code" href="classNLNET_1_1IService.html#z354_11">_ConfigDir</a> + <a class="code" href="classNLNET_1_1IService.html#z354_4">_LongName</a> + <font class="stringliteral">".cfg"</font>);
+00548
+00549
+00550 <font class="comment">//</font>
+00551 <font class="comment">// Set the negatif filter from the config file</font>
+00552 <font class="comment">//</font>
+00553
+00554 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"NegFiltersDebug"</font>)) != NULL)
+00555 {
+00556 <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a11">setCallback</a> (<font class="stringliteral">"NegFiltersDebug"</font>, <a class="code" href="namespaceNLNET.html#a125">cbLogFilter</a>);
+00557 <font class="keywordflow">for</font> (sint i = 0; i &lt; var-&gt;size(); i++)
+00558 {
+00559 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;addNegativeFilter (var-&gt;asString(i).c_str());
+00560 }
+00561 }
+00562
+00563 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"NegFiltersInfo"</font>)) != NULL)
+00564 {
+00565 <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a11">setCallback</a> (<font class="stringliteral">"NegFiltersInfo"</font>, <a class="code" href="namespaceNLNET.html#a125">cbLogFilter</a>);
+00566 <font class="keywordflow">for</font> (sint i = 0; i &lt; var-&gt;size(); i++)
+00567 {
+00568 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;addNegativeFilter (var-&gt;asString(i).c_str());
+00569 }
+00570 }
+00571
+00572
+00573 <font class="comment">//</font>
+00574 <font class="comment">// Create the window if neeeded</font>
+00575 <font class="comment">//</font>
+00576
+00577 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"WindowStyle"</font>)) != NULL)
+00578 {
+00579 string disp = var-&gt;asString ();
+00580 <font class="preprocessor">#ifdef NL_USE_GTK</font>
+00581 <font class="preprocessor"></font> <font class="keywordflow">if</font> (disp == <font class="stringliteral">"GTK"</font>)
+00582 {
+00583 <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> = <font class="keyword">new</font> CGtkDisplayer (<font class="stringliteral">"DEFAULT_WD"</font>);
+00584 }
+00585 <font class="preprocessor">#endif // NL_USE_GTK</font>
+00586 <font class="preprocessor"></font>
+00587 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00588 <font class="preprocessor"></font> <font class="keywordflow">if</font> (disp == <font class="stringliteral">"WIN"</font>)
+00589 {
+00590 <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> = <font class="keyword">new</font> CWinDisplayer (<font class="stringliteral">"DEFAULT_WD"</font>);
+00591 }
+00592 <font class="preprocessor">#endif // NL_OS_WINDOWS</font>
+00593 <font class="preprocessor"></font>
+00594 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> == NULL &amp;&amp; disp != <font class="stringliteral">"NONE"</font>)
+00595 {
+00596 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Unknown value for the WindowStyle (should be GTK, WIN or NONE), use no window displayer"</font>);
+00597 }
+00598 }
+00599
+00600 vector &lt;pair&lt;string,uint&gt; &gt; displayedVariables;
+00601 <font class="comment">//uint speedNetLabel, speedUsrLabel, rcvLabel, sndLabel, rcvQLabel, sndQLabel, scrollLabel;</font>
+00602 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> != NULL)
+00603 {
+00604 <font class="comment">//</font>
+00605 <font class="comment">// Init window param if necessary</font>
+00606 <font class="comment">//</font>
+00607
+00608 sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=-1, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=-1, <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>=-1, h=-1, fs=10;
+00609 <font class="keywordtype">bool</font> iconified = <font class="keyword">false</font>, ww = <font class="keyword">false</font>;
+00610 string fn;
+00611
+00612 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"XWinParam"</font>)) != NULL) <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = var-&gt;asInt();
+00613 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"YWinParam"</font>)) != NULL) <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> = var-&gt;asInt();
+00614 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"WWinParam"</font>)) != NULL) <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> = var-&gt;asInt();
+00615 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"HWinParam"</font>)) != NULL) h = var-&gt;asInt();
+00616 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"HWinParam"</font>)) != NULL) iconified = var-&gt;asInt() == 1;
+00617 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"FontSize"</font>)) != NULL) fs = var-&gt;asInt();
+00618 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"FontName"</font>)) != NULL) fn = var-&gt;asString();
+00619 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"WordWrap"</font>)) != NULL) ww = var-&gt;asInt() == 1;
+00620
+00621 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z350_7">haveArg</a>(<font class="charliteral">'I'</font>)) iconified = <font class="keyword">true</font>;
+00622
+00623 <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a2">create</a> (string(<font class="stringliteral">"*INIT* "</font>) + <a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a> + <font class="stringliteral">" "</font> + <a class="code" href="classNLNET_1_1IService.html#z354_4">_LongName</a>, iconified, <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>, h, -1, fs, fn, ww);
+00624
+00625 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;addDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+00626 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;addDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+00627 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;addDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+00628 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;addDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+00629 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;addDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+00630
+00631 <font class="comment">// adding default displayed variables</font>
+00632 displayedVariables.push_back(make_pair(string(<font class="stringliteral">"NetLop|NetSpeedLoop"</font>), <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a3">createLabel</a> (<font class="stringliteral">"NetLop"</font>)));
+00633 displayedVariables.push_back(make_pair(string(<font class="stringliteral">"UsrLop|UserSpeedLoop"</font>), <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a3">createLabel</a> (<font class="stringliteral">"UsrLop"</font>)));
+00634 <font class="comment">// displayedVariables.push_back(make_pair(string("Rcv|ReceivedBytes"), WindowDisplayer-&gt;createLabel ("Rcv")));</font>
+00635 <font class="comment">// displayedVariables.push_back(make_pair(string("Snd|SentBytes"), WindowDisplayer-&gt;createLabel ("Snd")));</font>
+00636 <font class="comment">// displayedVariables.push_back(make_pair(string("RcvQ|ReceivedQueueSize"), WindowDisplayer-&gt;createLabel ("RcvQ")));</font>
+00637 <font class="comment">// displayedVariables.push_back(make_pair(string("SndQ|SentQueueSize"), WindowDisplayer-&gt;createLabel ("SndQ")));</font>
+00638 displayedVariables.push_back(make_pair(string(<font class="stringliteral">"|Scroller"</font>), <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a3">createLabel</a> (<font class="stringliteral">"NeL Rulez"</font>)));
+00639
+00640 CConfigFile::CVar *<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"DisplayedVariables"</font>);
+00641 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> != NULL)
+00642 {
+00643 <font class="keywordflow">for</font> (sint i = 0; i &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>-&gt;size(); i++)
+00644 {
+00645 displayedVariables.push_back(make_pair(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>-&gt;asString(i), <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a3">createLabel</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>-&gt;asString(i).c_str())));
+00646 }
+00647 }
+00648 }
+00649
+00650 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Starting Service '%s' using NeL ("</font>__DATE__<font class="stringliteral">" "</font>__TIME__<font class="stringliteral">")"</font>, <a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>.c_str());
+00651
+00652 <a class="code" href="classNLNET_1_1IService.html#z351_0">setStatus</a> (EXIT_SUCCESS);
+00653
+00654 <font class="comment">//</font>
+00655 <font class="comment">// Redirect signal if needed (in release mode only)</font>
+00656 <font class="comment">//</font>
+00657
+00658 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00659 <font class="preprocessor"></font><font class="preprocessor">#ifdef NL_RELEASE</font>
+00660 <font class="preprocessor"></font> <a class="code" href="namespaceNLNET.html#a124">initSignal</a>();
+00661 <font class="preprocessor">#else</font>
+00662 <font class="preprocessor"></font> <font class="comment">// don't install signal is the application is started in debug mode</font>
+00663 <font class="keywordflow">if</font> (<a class="code" href="displayer_8cpp.html#a0">IsDebuggerPresent</a> ())
+00664 {
+00665 <font class="comment">//nlinfo("Running with the debugger, don't redirect signals");</font>
+00666 <a class="code" href="namespaceNLNET.html#a124">initSignal</a>();
+00667 }
+00668 <font class="keywordflow">else</font>
+00669 {
+00670 <font class="comment">//nlinfo("Running without the debugger, redirect SIGINT signal");</font>
+00671 <a class="code" href="namespaceNLNET.html#a124">initSignal</a>();
+00672 }
+00673 <font class="preprocessor">#endif</font>
+00674 <font class="preprocessor"></font><font class="preprocessor">#else // NL_OS_UNIX</font>
+00675 <font class="preprocessor"></font> <a class="code" href="namespaceNLNET.html#a124">initSignal</a>();
+00676 <font class="preprocessor">#endif</font>
+00677 <font class="preprocessor"></font>
+00678
+00679 <font class="comment">//</font>
+00680 <font class="comment">// Ignore SIGPIPE (broken pipe) on unix system</font>
+00681 <font class="comment">//</font>
+00682
+00683 <font class="preprocessor">#ifdef NL_OS_UNIX</font>
+00684 <font class="preprocessor"></font> <font class="comment">// Ignore the SIGPIPE signal</font>
+00685 sigset_t SigList;
+00686 <font class="keywordtype">bool</font> IgnoredPipe = <font class="keyword">true</font>;
+00687 <font class="keywordflow">if</font> (sigemptyset (&amp;SigList) == -1)
+00688 {
+00689 perror(<font class="stringliteral">"sigemptyset()"</font>);
+00690 IgnoredPipe = <font class="keyword">false</font>;
+00691 }
+00692
+00693 <font class="keywordflow">if</font> (sigaddset (&amp;SigList, SIGPIPE) == -1)
+00694 {
+00695 perror(<font class="stringliteral">"sigaddset()"</font>);
+00696 IgnoredPipe = <font class="keyword">false</font>;
+00697 }
+00698
+00699 <font class="keywordflow">if</font> (sigprocmask (SIG_BLOCK, &amp;SigList, NULL) == -1)
+00700 {
+00701 perror(<font class="stringliteral">"sigprocmask()"</font>);
+00702 IgnoredPipe = <font class="keyword">false</font>;
+00703 }
+00704 <a class="code" href="debug_8h.html#a0">nldebug</a> (<font class="stringliteral">"SIGPIPE %s"</font>, IgnoredPipe?<font class="stringliteral">"Ignored"</font>:<font class="stringliteral">"Not Ignored"</font>);
+00705 <font class="preprocessor">#endif // NL_OS_UNIX</font>
+00706 <font class="preprocessor"></font>
+00707
+00708 <font class="comment">//</font>
+00709 <font class="comment">// Initialize the network system</font>
+00710 <font class="comment">//</font>
+00711
+00712 string localhost;
+00713 <font class="keywordflow">try</font>
+00714 {
+00715 <font class="comment">// Initialize WSAStartup and network stuffs</font>
+00716 CSock::initNetwork();
+00717
+00718 <font class="comment">// Get the localhost name</font>
+00719 localhost = CInetAddress::localHost().hostName();
+00720 }
+00721 <font class="keywordflow">catch</font> (<a class="code" href="structNLNET_1_1ESocket.html">NLNET::ESocket</a> &amp;)
+00722 {
+00723 localhost = <font class="stringliteral">"&lt;UnknownHost&gt;"</font>;
+00724 }
+00725
+00726 <font class="comment">// Set the localhost name and service name to the logger</font>
+00727 CLog::setProcessName (localhost+<font class="stringliteral">"/"</font>+<a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>);
+00728
+00729 <font class="comment">//</font>
+00730 <font class="comment">// Initialize server parameters</font>
+00731 <font class="comment">//</font>
+00732
+00733 <font class="comment">// Get the port from config file or in the macro (overload the port set by the user init())</font>
+00734 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a>(<font class="stringliteral">"Port"</font>)) != NULL)
+00735 {
+00736 <font class="comment">// set the listen port with the value in the config file if any</font>
+00737 <a class="code" href="classNLNET_1_1IService.html#z354_1">_Port</a> = var-&gt;asInt();
+00738 }
+00739 <font class="keywordflow">else</font>
+00740 {
+00741 <font class="comment">// set the listen port with the value in the NLNET_SERVICE_MAIN macro</font>
+00742 <a class="code" href="classNLNET_1_1IService.html#z354_1">_Port</a> = servicePort;
+00743 }
+00744
+00745 <font class="comment">// set the listen port if there are a port arg in the command line</font>
+00746 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z350_7">haveArg</a>(<font class="charliteral">'P'</font>))
+00747 {
+00748 <a class="code" href="classNLNET_1_1IService.html#z354_1">_Port</a> = atoi(<a class="code" href="classNLNET_1_1IService.html#z350_8">getArg</a>(<font class="charliteral">'P'</font>).c_str());
+00749 }
+00750
+00751 <font class="comment">// set the aliasname if is present in the command line</font>
+00752 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z350_7">haveArg</a>(<font class="charliteral">'N'</font>))
+00753 {
+00754 <a class="code" href="classNLNET_1_1IService.html#z354_5">_AliasName</a> = <a class="code" href="classNLNET_1_1IService.html#z350_8">getArg</a>(<font class="charliteral">'N'</font>);
+00755 }
+00756
+00757 <font class="comment">// Load the recording state from the config file</font>
+00758 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"Rec"</font>)) != NULL)
+00759 {
+00760 string srecstate = var-&gt;asString();
+00761 strupr( srecstate );
+00762 <font class="keywordflow">if</font> ( srecstate == <font class="stringliteral">"RECORD"</font> )
+00763 {
+00764 <a class="code" href="classNLNET_1_1IService.html#z354_2">_RecordingState</a> = CCallbackNetBase::Record;
+00765 <a class="code" href="debug_8h.html#a1">nlinfo</a>( <font class="stringliteral">"Service recording messages"</font> );
+00766 }
+00767 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ( srecstate == <font class="stringliteral">"REPLAY"</font> )
+00768 {
+00769 <a class="code" href="classNLNET_1_1IService.html#z354_2">_RecordingState</a> = CCallbackNetBase::Replay;
+00770 <a class="code" href="debug_8h.html#a1">nlinfo</a>( <font class="stringliteral">"Service replaying messages"</font> );
+00771 }
+00772 <font class="keywordflow">else</font>
+00773 {
+00774 <a class="code" href="classNLNET_1_1IService.html#z354_2">_RecordingState</a> = CCallbackNetBase::Off;
+00775 }
+00776 }
+00777 <font class="keywordflow">else</font>
+00778 {
+00779 <font class="comment">// Not found</font>
+00780 <a class="code" href="classNLNET_1_1IService.html#z354_2">_RecordingState</a> = CCallbackNetBase::Off;
+00781 }
+00782
+00783 <font class="comment">// Load the default stream format</font>
+00784 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"StringMsgFormat"</font>)) != NULL)
+00785 {
+00786 CMessage::setDefaultStringMode( var-&gt;asInt() == 1 );
+00787 }
+00788 <font class="keywordflow">else</font>
+00789 {
+00790 <font class="comment">// Not found =&gt; binary</font>
+00791 CMessage::setDefaultStringMode( <font class="keyword">false</font> );
+00792 }
+00793
+00794 <font class="comment">/*</font>
+00795 <font class="comment"> //</font>
+00796 <font class="comment"> // Layer4 Startup (Connect to the Naming Service (except for the NS itself and Login Service))</font>
+00797 <font class="comment"> //</font>
+00798 <font class="comment"></font>
+00799 <font class="comment"> if (IService::_ShortName != "NS" &amp;&amp; IService::_ShortName != "LS" &amp;&amp; IService::_ShortName != "AES" &amp;&amp; IService::_ShortName != "AS")</font>
+00800 <font class="comment"> {</font>
+00801 <font class="comment"> bool ok = false;</font>
+00802 <font class="comment"> while (!ok)</font>
+00803 <font class="comment"> {</font>
+00804 <font class="comment"> // read the naming service address from the config file</font>
+00805 <font class="comment"> CInetAddress loc(ConfigFile.getVar("NSHost").asString(), ConfigFile.getVar("NSPort").asInt());</font>
+00806 <font class="comment"> try</font>
+00807 <font class="comment"> {</font>
+00808 <font class="comment"> CNetManager::init( &amp;loc, _RecordingState );</font>
+00809 <font class="comment"> ok = true;</font>
+00810 <font class="comment"> }</font>
+00811 <font class="comment"> catch (ESocketConnectionFailed &amp;)</font>
+00812 <font class="comment"> {</font>
+00813 <font class="comment"> nlwarning ("Could not connect to the Naming Service (%s). Retrying in a few seconds...", loc.asString().c_str());</font>
+00814 <font class="comment"> nlSleep (5000);</font>
+00815 <font class="comment"> }</font>
+00816 <font class="comment"> }</font>
+00817 <font class="comment"> }</font>
+00818 <font class="comment"> else</font>
+00819 <font class="comment"> {</font>
+00820 <font class="comment"> CNetManager::init( NULL, _RecordingState );</font>
+00821 <font class="comment"> }</font>
+00822 <font class="comment">*/</font>
+00823
+00827
+00828 <font class="comment">// get the sid</font>
+00829 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"SId"</font>)) != NULL)
+00830 {
+00831 sint32 sid = var-&gt;asInt();
+00832 <font class="keywordflow">if</font> (sid&lt;=0 || sid&gt;255)
+00833 {
+00834 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Bad SId value in the config file, %d is not in [0;255] range"</font>, sid);
+00835 <a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a> = 0;
+00836 }
+00837 <font class="keywordflow">else</font>
+00838 {
+00839 <a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a> = (uint8) sid;
+00840 }
+00841 }
+00842 <font class="keywordflow">else</font>
+00843 {
+00844 <font class="comment">// ok, SId not found, use dynamic sid</font>
+00845 <a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a> = 0;
+00846 }
+00847
+00848
+00849 <font class="comment">// look if we don't want to use NS</font>
+00850 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"DontUseNS"</font>)) != NULL)
+00851 {
+00852 <font class="comment">// if we set the value in the config file, get it</font>
+00853 <a class="code" href="classNLNET_1_1IService.html#z354_17">_DontUseNS</a> = (var-&gt;asInt() == 1);
+00854 }
+00855 <font class="keywordflow">else</font>
+00856 {
+00857 <font class="comment">// if not, we use ns only if service is not ns, ls, aes, as</font>
+00858 <a class="code" href="classNLNET_1_1IService.html#z354_17">_DontUseNS</a> = <font class="keyword">false</font>;
+00859 }
+00860
+00861 <font class="comment">//</font>
+00862 <font class="comment">// Register all network associations (must be before the CUnifiedNetwork::getInstance()-&gt;init)</font>
+00863 <font class="comment">//</font>
+00864
+00865 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"Networks"</font>)) != NULL)
+00866 {
+00867 <font class="keywordflow">for</font> (uint8 i = 0; i &lt; var-&gt;size (); i++)
+00868 CUnifiedNetwork::getInstance()-&gt;addNetworkAssociation (var-&gt;asString(i), i);
+00869 }
+00870
+00871 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"DefaultNetworks"</font>)) != NULL)
+00872 {
+00873 <font class="keywordflow">for</font> (uint8 i = 0; i &lt; var-&gt;size (); i++)
+00874 CUnifiedNetwork::getInstance()-&gt;addDefaultNetwork(var-&gt;asString(i));
+00875 }
+00876
+00877 <font class="comment">// normal setup for the common services</font>
+00878 <font class="keywordflow">if</font> (!<a class="code" href="classNLNET_1_1IService.html#z354_17">_DontUseNS</a>)
+00879 {
+00880 <font class="keywordtype">bool</font> ok = <font class="keyword">false</font>;
+00881 <font class="keywordflow">while</font> (!ok)
+00882 {
+00883 <font class="comment">// read the naming service address from the config file</font>
+00884 string LSAddr = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a2">getVar</a> (<font class="stringliteral">"NSHost"</font>).asString();
+00885
+00886 <font class="comment">// if there's no port to the NS, use the default one 50000</font>
+00887 <font class="keywordflow">if</font> (LSAddr.find(<font class="stringliteral">":"</font>) == string::npos)
+00888 LSAddr += <font class="stringliteral">":50000"</font>;
+00889
+00890 CInetAddress loc(LSAddr);
+00891 <font class="keywordflow">try</font>
+00892 {
+00893 CUnifiedNetwork::getInstance()-&gt;init (&amp;loc, <a class="code" href="classNLNET_1_1IService.html#z354_2">_RecordingState</a>, <a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>, <a class="code" href="classNLNET_1_1IService.html#z354_1">_Port</a>, <a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a>);
+00894
+00895 ok = <font class="keyword">true</font>;
+00896 }
+00897 <font class="keywordflow">catch</font> (ESocketConnectionFailed &amp;)
+00898 {
+00899 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Could not connect to the Naming Service (%s). Retrying in a few seconds..."</font>, loc.asString().c_str());
+00900 <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a> (5000);
+00901 }
+00902 }
+00903 }
+00904 <font class="keywordflow">else</font>
+00905 {
+00906 CUnifiedNetwork::getInstance()-&gt;init(NULL, <a class="code" href="classNLNET_1_1IService.html#z354_2">_RecordingState</a>, <a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>, <a class="code" href="classNLNET_1_1IService.html#z354_1">_Port</a>, <a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a>);
+00907 }
+00908
+00909 <font class="comment">// At this point, the _SId must be ok if we use the naming service.</font>
+00910 <font class="comment">// If it's 0, it means that we don't use NS and we left the other side server to find a sid for your connection</font>
+00911
+00912 <font class="keywordflow">if</font>(!<a class="code" href="classNLNET_1_1IService.html#z354_17">_DontUseNS</a>)
+00913 {
+00914 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a> != 0);
+00915 }
+00916
+00917 <font class="comment">//</font>
+00918 <font class="comment">// Connect to the local AES and send identification</font>
+00919 <font class="comment">//</font>
+00920
+00921 <font class="comment">// look if we don't want to use NS</font>
+00922 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"DontUseAES"</font>)) != NULL)
+00923 {
+00924 <font class="comment">// if we set the value in the config file, get it</font>
+00925 <a class="code" href="classNLNET_1_1IService.html#z354_18">_DontUseAES</a> = var-&gt;asInt() == 1;
+00926 }
+00927 <font class="keywordflow">else</font>
+00928 {
+00929 <font class="comment">// if not, we use aes only if service is not aes or as</font>
+00930 <a class="code" href="classNLNET_1_1IService.html#z354_18">_DontUseAES</a> = <font class="keyword">false</font>;
+00931 }
+00932
+00933 <font class="keywordflow">if</font> (!<a class="code" href="classNLNET_1_1IService.html#z354_18">_DontUseAES</a>)
+00934 {
+00935 CUnifiedNetwork::getInstance()-&gt;setServiceUpCallback (<font class="stringliteral">"AES"</font>, <a class="code" href="classNLNET_1_1IService.html#l3">AESConnection</a>, NULL);
+00936 CUnifiedNetwork::getInstance()-&gt;setServiceDownCallback (<font class="stringliteral">"AES"</font>, <a class="code" href="namespaceNLNET.html#a120">AESDisconnection</a>, NULL);
+00937 CUnifiedNetwork::getInstance()-&gt;addCallbackArray (<a class="code" href="namespaceNLNET.html#a62">AESCallbackArray</a>, <font class="keyword">sizeof</font>(<a class="code" href="namespaceNLNET.html#a62">AESCallbackArray</a>)/<font class="keyword">sizeof</font>(<a class="code" href="namespaceNLNET.html#a62">AESCallbackArray</a>[0]));
+00938 CUnifiedNetwork::getInstance()-&gt;addService (<font class="stringliteral">"AES"</font>, CInetAddress(<font class="stringliteral">"localhost:49997"</font>));
+00939 }
+00940
+00941
+00942 <font class="comment">//</font>
+00943 <font class="comment">// Add callback array</font>
+00944 <font class="comment">//</font>
+00945
+00946 <font class="comment">// add callback set in the NLNET_SERVICE_MAIN macro</font>
+00947 <a class="code" href="classNLNET_1_1CUnifiedNetwork.html#d0">NLNET::CUnifiedNetwork::getInstance</a>()-&gt;addCallbackArray(<a class="code" href="classNLNET_1_1IService.html#z354_15">_CallbackArray</a>, <a class="code" href="classNLNET_1_1IService.html#z354_16">_CallbackArraySize</a>);
+00948
+00949 <font class="comment">//</font>
+00950 <font class="comment">// Now we have the service id, we can set the entites id generator</font>
+00951 <font class="comment">//</font>
+00952
+00953 <a class="code" href="classNLNET_1_1IService.html#z354_10">_NextEntityId</a>.<a class="code" href="structNLMISC_1_1CEntityId.html#a15">setServiceId</a>(<a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a>);
+00954
+00955 <font class="comment">// Set the localhost name and service name and the sid</font>
+00956 CLog::setProcessName (localhost+<font class="stringliteral">"/"</font>+<a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>+<font class="stringliteral">"-"</font>+toString((uint16)<a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a>));
+00957
+00958
+00959 <font class="comment">//</font>
+00960 <font class="comment">// Add default pathes</font>
+00961 <font class="comment">//</font>
+00962
+00963 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"Paths"</font>)) != NULL)
+00964 {
+00965 <font class="keywordflow">for</font> (sint i = 0; i &lt; var-&gt;size(); i++)
+00966 {
+00967 CPath::addSearchPath (var-&gt;asString(i), <font class="keyword">true</font>, <font class="keyword">false</font>);
+00968 }
+00969 }
+00970
+00971 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"PathsNoRecurse"</font>)) != NULL)
+00972 {
+00973 <font class="keywordflow">for</font> (sint i = 0; i &lt; var-&gt;size(); i++)
+00974 {
+00975 CPath::addSearchPath (var-&gt;asString(i), <font class="keyword">false</font>, <font class="keyword">false</font>);
+00976 }
+00977 }
+00978
+00979
+00980 <font class="comment">// if we can, try to setup where to write files</font>
+00981 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"WriteFilesDirectory"</font>)) != NULL)
+00982 {
+00983 <a class="code" href="classNLNET_1_1IService.html#m1">WriteFilesDirectory</a> = CPath::standardizePath(var-&gt;asString());
+00984 }
+00985
+00986
+00987 <font class="comment">//</font>
+00988 <font class="comment">// Call the user service init</font>
+00989 <font class="comment">//</font>
+00990
+00991 userInitCalled = <font class="keyword">true</font>; <font class="comment">// the bool must be put *before* the call to init()</font>
+00992 <a class="code" href="classNLNET_1_1IService.html#z349_0">init</a> ();
+00993
+00994
+00995 <font class="comment">//</font>
+00996 <font class="comment">// Connects to the present services</font>
+00997 <font class="comment">// WARNING: only after the user init() was called because the</font>
+00998 <font class="comment">// addService may call up service callbacks.</font>
+00999 <font class="comment">//</font>
+01000
+01001 CUnifiedNetwork::getInstance()-&gt;connect();
+01002
+01003
+01004 <font class="comment">//</font>
+01005 <font class="comment">// Say to the AES that the service is ready</font>
+01006 <font class="comment">//</font>
+01007
+01008 <font class="keywordflow">if</font> (!<a class="code" href="classNLNET_1_1IService.html#z354_18">_DontUseAES</a>)
+01009 {
+01010 <font class="comment">// send the ready message (service init finished)</font>
+01011 CMessage msgout (<font class="stringliteral">"SR"</font>);
+01012 CUnifiedNetwork::getInstance()-&gt;send(<font class="stringliteral">"AES"</font>, msgout);
+01013 }
+01014
+01015
+01016 <a class="code" href="classNLNET_1_1IService.html#z354_9">_Initialized</a> = <font class="keyword">true</font>;
+01017
+01018 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Service initialised, executing StartCommands"</font>);
+01019
+01020 <font class="comment">//</font>
+01021 <font class="comment">// Call the user command from the config file if any</font>
+01022 <font class="comment">//</font>
+01023
+01024 <font class="keywordflow">if</font> ((var = <a class="code" href="classNLNET_1_1IService.html#z351_3">ConfigFile</a>.<a class="code" href="classNLMISC_1_1CConfigFile.html#a3">getVarPtr</a> (<font class="stringliteral">"StartCommands"</font>)) != NULL)
+01025 {
+01026 <font class="keywordflow">for</font> (sint i = 0; i &lt; var-&gt;size(); i++)
+01027 {
+01028 ICommand::execute (var-&gt;asString(i), *<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>);
+01029 }
+01030 }
+01031
+01032 string str;
+01033 CLog logDisplayVars;
+01034 CMemDisplayer mdDisplayVars;
+01035 logDisplayVars.addDisplayer (&amp;mdDisplayVars);
+01036
+01037 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Service ready"</font>);
+01038
+01039 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> != NULL)
+01040 <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a6">setTitleBar</a> (<a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a> + <font class="stringliteral">" "</font> + <a class="code" href="classNLNET_1_1IService.html#z354_4">_LongName</a> + <font class="stringliteral">" "</font> + <a class="code" href="classNLNET_1_1IService.html#z354_14">_Version</a>);
+01041
+01042 <font class="comment">//</font>
+01043 <font class="comment">// Call the user service update each loop and check files and network activity</font>
+01044 <font class="comment">//</font>
+01045
+01046 <font class="keywordflow">do</font>
+01047 {
+01048 <font class="comment">//H_BEFORE(NLNETServiceLoop); // Not tick-wise</font>
+01049 <font class="comment">// count the amount of time to manage internal system</font>
+01050 <a class="code" href="namespaceNLMISC.html#a183">TTime</a> bbefore = CTime::getLocalTime ();
+01051
+01052 <font class="comment">// call the user update and exit if the user update asks it</font>
+01053 <font class="comment">//H_BEFORE(NLNETServiceUpdate);</font>
+01054 <font class="keywordflow">if</font> (!<a class="code" href="classNLNET_1_1IService.html#z349_1">update</a> ())
+01055 {
+01056 <font class="comment">//H_AFTER(NLNETServiceLoop); // Not tick-wise</font>
+01057 <font class="comment">//H_AFTER(NLNETServiceUpdate);</font>
+01058 <font class="keywordflow">break</font>;
+01059 }
+01060 <font class="comment">//H_AFTER(NLNETServiceUpdate);</font>
+01061
+01062 <font class="comment">// count the amount of time to manage internal system</font>
+01063 <a class="code" href="namespaceNLMISC.html#a183">TTime</a> before = CTime::getLocalTime ();
+01064
+01065 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> != NULL)
+01066 {
+01067 <font class="comment">// update the window displayer and quit if asked</font>
+01068 <font class="keywordflow">if</font> (!<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a5">update</a> ())
+01069 {
+01070 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"The window displayer was closed by user, need to quit"</font>);
+01071 <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = 1;
+01072 }
+01073 }
+01074
+01075 <font class="comment">// stop the loop if the exit signal asked</font>
+01076 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> &gt; 0)
+01077 {
+01078 <font class="comment">//H_AFTER(NLNETServiceLoop) // Not tick-wise</font>
+01079 <font class="keywordflow">break</font>;
+01080 }
+01081
+01082 CConfigFile::checkConfigFiles ();
+01083
+01084 CFile::checkFileChange();
+01085
+01086 <font class="comment">//H_BEFORE(NLNETManageMessages); // Not tick-wise</font>
+01087 <font class="comment">// get and manage layer 5 messages</font>
+01088 CUnifiedNetwork::getInstance()-&gt;update (<a class="code" href="classNLNET_1_1IService.html#z354_6">_UpdateTimeout</a>);
+01089 <font class="comment">//H_AFTER(NLNETManageMessages); // Not tick-wise</font>
+01090
+01091 <font class="comment">// resync the clock every hours</font>
+01092 <font class="keywordflow">if</font> (resyncEvenly)
+01093 {
+01094 <font class="keyword">static</font> <a class="code" href="namespaceNLMISC.html#a183">TTime</a> LastSyncTime = CTime::getLocalTime ();
+01095
+01096 <font class="comment">//---------------------------------------</font>
+01097 <font class="comment">// To simulate Ctrl-C in the debugger... Exit after 1 min !</font>
+01098 <font class="comment">/*if (CTime::getLocalTime () - LastSyncTime &gt; 60 * 1000 )</font>
+01099 <font class="comment"> {</font>
+01100 <font class="comment"> ExitSignalAsked = 1;</font>
+01101 <font class="comment"> }*/</font>
+01102 <font class="comment">//---------------------------------------</font>
+01103 <font class="comment">/*</font>
+01104 <font class="comment"> if (CTime::getLocalTime () - LastSyncTime &gt; 60*60*1000)</font>
+01105 <font class="comment"> {</font>
+01106 <font class="comment"> CUniTime::syncUniTimeFromService ( _RecordingState );</font>
+01107 <font class="comment"> LastSyncTime = CTime::getLocalTime ();</font>
+01108 <font class="comment"> }</font>
+01109 <font class="comment">*/</font>
+01110 }
+01111
+01112 <a class="code" href="namespaceNLNET.html#a57">NetSpeedLoop</a> = (sint32) (CTime::getLocalTime () - before);
+01113 <a class="code" href="namespaceNLNET.html#a58">UserSpeedLoop</a> = (sint32) (before - bbefore);
+01114
+01115 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> != NULL)
+01116 {
+01117 uint64 rcv, snd, rcvq, sndq;
+01118 rcv = CUnifiedNetwork::getInstance()-&gt;getBytesReceived ();
+01119 snd = CUnifiedNetwork::getInstance()-&gt;getBytesSent ();
+01120 rcvq = CUnifiedNetwork::getInstance()-&gt;getReceiveQueueSize ();
+01121 sndq = CUnifiedNetwork::getInstance()-&gt;getSendQueueSize ();
+01122
+01123 <font class="keywordflow">for</font> (uint i = 0; i &lt; displayedVariables.size(); i++)
+01124 {
+01125 <font class="comment">// it s a separator, do nothing</font>
+01126 <font class="keywordflow">if</font> (displayedVariables[i].first.empty())
+01127 <font class="keywordflow">continue</font>;
+01128
+01129 <font class="comment">// it s a command, do nothing</font>
+01130 <font class="keywordflow">if</font> (displayedVariables[i].first[0] == <font class="charliteral">'@'</font>)
+01131 <font class="keywordflow">continue</font>;
+01132
+01133 string dispName = displayedVariables[i].first;
+01134 string varName = dispName;
+01135 uint32 pos = dispName.find(<font class="stringliteral">"|"</font>);
+01136 <font class="keywordflow">if</font> (pos != string::npos)
+01137 {
+01138 varName = displayedVariables[i].first.substr(pos+1);
+01139 dispName = displayedVariables[i].first.substr(0, pos);
+01140 }
+01141
+01142 <font class="keywordflow">if</font> (dispName.empty())
+01143 str = <font class="stringliteral">""</font>;
+01144 <font class="keywordflow">else</font>
+01145 str = dispName + <font class="stringliteral">": "</font>;
+01146
+01147 mdDisplayVars.clear ();
+01148 ICommand::execute(varName, logDisplayVars, <font class="keyword">true</font>);
+01149 <font class="keyword">const</font> std::deque&lt;std::string&gt; &amp;strs = mdDisplayVars.lockStrings();
+01150 <font class="keywordflow">if</font> (strs.size()&gt;0)
+01151 {
+01152
+01153 string s_ = strs[0];
+01154
+01155 uint32 pos = strs[0].find(<font class="stringliteral">"="</font>);
+01156 <font class="keywordflow">if</font>(pos != string::npos &amp;&amp; pos + 2 &lt; strs[0].size())
+01157 {
+01158 uint32 pos2 = string::npos;
+01159 <font class="keywordflow">if</font>(strs[0][strs[0].size()-1] == <font class="charliteral">'\n'</font>)
+01160 pos2 = strs[0].size() - pos - 2 - 1;
+01161
+01162 str += strs[0].substr (pos+2, pos2);
+01163 }
+01164 <font class="keywordflow">else</font>
+01165 {
+01166 str += <font class="stringliteral">"???"</font>;
+01167 }
+01168 }
+01169 <font class="keywordflow">else</font>
+01170 {
+01171 str += <font class="stringliteral">"???"</font>;
+01172 }
+01173 mdDisplayVars.unlockStrings();
+01174 <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CWindowDisplayer.html#a4">setLabel</a> (displayedVariables[i].second, str);
+01175 }
+01176
+01177 }
+01178
+01179 <font class="comment">// nldebug ("SYNC: updatetimeout must be %d and is %d, sleep the rest of the time", _UpdateTimeout, delta);</font>
+01180 <font class="comment">//H_AFTER(NLNETServiceLoop); // Not tick-wise</font>
+01181
+01182 <font class="comment">// Resetting the hierarchical timer must be done outside the top-level timer</font>
+01183 <font class="keywordflow">if</font> ( _ResetMeasures )
+01184 {
+01185 CHTimer::clear();
+01186 <a class="code" href="classNLNET_1_1IService.html#z354_19">_ResetMeasures</a> = <font class="keyword">false</font>;
+01187 }
+01188 <font class="comment">//H_AFTER(NLNETServiceLoop);</font>
+01189 }
+01190 <font class="keywordflow">while</font> (true);
+01191 }
+01192 <font class="comment">/* catch (ETrapDebug &amp;)</font>
+01193 <font class="comment"> {</font>
+01194 <font class="comment"> // we have to do that if we want to trap unhandled exception with the report message box</font>
+01195 <font class="comment"> setStatus (EXIT_FAILURE);</font>
+01196 <font class="comment"> }</font>
+01197 <font class="comment">*/</font> <font class="keywordflow">catch</font> (EFatalError &amp;)
+01198 {
+01199 <font class="comment">// Somebody call nlerror, so we have to quit now, the message already display</font>
+01200 <font class="comment">// so we don't have to to anything</font>
+01201 <a class="code" href="classNLNET_1_1IService.html#z351_0">setStatus</a> (EXIT_FAILURE);
+01202 }
+01203 <font class="keywordflow">catch</font> ( uint ) <font class="comment">// SEH exceptions</font>
+01204 {
+01205 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;displayNL( <font class="stringliteral">"System exception"</font> );
+01206 }
+01207
+01208 <font class="preprocessor">#ifdef NL_RELEASE</font>
+01209 <font class="preprocessor"></font><font class="comment">/* // in release mode, we catch everything to handle clean release.</font>
+01210 <font class="comment"> catch (Exception &amp;e)</font>
+01211 <font class="comment"> {</font>
+01212 <font class="comment"> // Catch NeL exception to release the system cleanly</font>
+01213 <font class="comment"> setStatus (EXIT_FAILURE);</font>
+01214 <font class="comment"> nlinfo ("ERROR: NeL Exception: Error running the service \"%s\": %s", _ShortName.c_str(), e.what());</font>
+01215 <font class="comment"> }</font>
+01216 <font class="comment"> catch (...)</font>
+01217 <font class="comment"> {</font>
+01218 <font class="comment"> // Catch anything we can to release the system cleanly</font>
+01219 <font class="comment"> setStatus (EXIT_FAILURE);</font>
+01220 <font class="comment"> nlinfo ("ERROR: Unknown external exception");</font>
+01221 <font class="comment"> }</font>
+01222 <font class="comment">*/</font>
+01223 <font class="preprocessor">#endif</font>
+01224 <font class="preprocessor"></font>
+01225 <font class="keywordflow">try</font>
+01226 {
+01227 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Service starts releasing"</font>);
+01228
+01229 <font class="comment">//</font>
+01230 <font class="comment">// Call the user service release() if the init() was called</font>
+01231 <font class="comment">//</font>
+01232
+01233 <font class="keywordflow">if</font> (userInitCalled)
+01234 <a class="code" href="classNLNET_1_1IService.html#z349_2">release</a> ();
+01235
+01236 <font class="comment">//</font>
+01237 <font class="comment">// Delete all network connection (naming client also)</font>
+01238 <font class="comment">//</font>
+01239
+01240 CUnifiedNetwork::getInstance()-&gt;release ();
+01241
+01242 CSock::releaseNetwork ();
+01243
+01244 <font class="comment">//</font>
+01245 <font class="comment">// Remove the window displayer</font>
+01246 <font class="comment">//</font>
+01247
+01248 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> != NULL)
+01249 {
+01250 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;removeDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+01251 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;removeDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+01252 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;removeDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+01253 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;removeDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+01254 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;removeDisplayer (<a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>);
+01255
+01256 <font class="keyword">delete</font> <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a>;
+01257 <a class="code" href="classNLNET_1_1IService.html#m0">WindowDisplayer</a> = NULL;
+01258 }
+01259
+01260 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Service released succesfuly"</font>);
+01261 }
+01262 <font class="comment">/* catch (ETrapDebug &amp;)</font>
+01263 <font class="comment"> {</font>
+01264 <font class="comment"> // we have to do that if we want to trap unhandled exception with the report message box</font>
+01265 <font class="comment"> setStatus (EXIT_FAILURE);</font>
+01266 <font class="comment"> }</font>
+01267 <font class="comment">*/</font> <font class="keywordflow">catch</font> (EFatalError &amp;)
+01268 {
+01269 <font class="comment">// Somebody call nlerror, so we have to quit now, the message already display</font>
+01270 <font class="comment">// so we don't have to to anything</font>
+01271 <a class="code" href="classNLNET_1_1IService.html#z351_0">setStatus</a> (EXIT_FAILURE);
+01272 }
+01273
+01274 <font class="preprocessor">#ifdef NL_RELEASE</font>
+01275 <font class="preprocessor"></font><font class="comment">/* // in release mode, we catch everything to handle clean release.</font>
+01276 <font class="comment"> catch (Exception &amp;e)</font>
+01277 <font class="comment"> {</font>
+01278 <font class="comment"> setStatus (EXIT_FAILURE);</font>
+01279 <font class="comment"> nlinfo ("ERROR: NeL Exception: Error releasing the service \"%s\": %s", _ShortName.c_str(), e.what());</font>
+01280 <font class="comment"> }</font>
+01281 <font class="comment"> catch (...)</font>
+01282 <font class="comment"> {</font>
+01283 <font class="comment"> // Catch anything we can to release the system cleanly</font>
+01284 <font class="comment"> setStatus (EXIT_FAILURE);</font>
+01285 <font class="comment"> nlinfo ("ERROR: Unknown external exception");</font>
+01286 <font class="comment"> }</font>
+01287 <font class="comment">*/</font>
+01288 <font class="preprocessor">#endif</font>
+01289 <font class="preprocessor"></font>
+01290 CHTimer::endBench();
+01291 CHTimer::display();
+01292 CHTimer::displayByExecutionPath ();
+01293 CHTimer::displayHierarchical(<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, <font class="keyword">true</font>, 64);
+01294 CHTimer::displayHierarchicalByExecutionPathSorted (<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, CHTimer::TotalTime, <font class="keyword">true</font>, 64);
+01295
+01296 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Service ends"</font>);
+01297
+01298 <font class="keywordflow">return</font> <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a>?100+<a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a>:<a class="code" href="classNLNET_1_1IService.html#z350_5">getStatus</a> ();
+01299 }
+01300
+<a name="l01301"></a><a class="code" href="classNLNET_1_1IService.html#z351_1">01301</a> <font class="keywordtype">void</font> IService::exit (sint code)
+01302 {
+01303 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"somebody called IService::exit(), I have to quit"</font>);
+01304 <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = code;
+01305 }
+01306
+01307 <font class="comment">/*</font>
+01308 <font class="comment"> * Require to reset the hierarchical timer</font>
+01309 <font class="comment"> */</font>
+<a name="l01310"></a><a class="code" href="classNLNET_1_1IService.html#z352_4">01310</a> <font class="keywordtype">void</font> IService::requireResetMeasures()
+01311 {
+01312 <a class="code" href="classNLNET_1_1IService.html#z354_19">_ResetMeasures</a> = <font class="keyword">true</font>;
+01313 }
+01314
+01315
+<a name="l01316"></a><a class="code" href="classNLNET_1_1IService.html#z350_3">01316</a> std::string IService::getServiceUnifiedName ()<font class="keyword"> const</font>
+01317 <font class="keyword"></font>{
+01318 <a class="code" href="debug_8h.html#a6">nlassert</a> (!<a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>.empty())
+01319 string <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+01320 <font class="keywordflow">if</font> (!<a class="code" href="classNLNET_1_1IService.html#z354_5">_AliasName</a>.empty())
+01321 {
+01322 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = <a class="code" href="classNLNET_1_1IService.html#z354_5">_AliasName</a>+<font class="stringliteral">"/"</font>;
+01323 }
+01324 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> += <a class="code" href="classNLNET_1_1IService.html#z354_3">_ShortName</a>;
+01325 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a> != 0)
+01326 {
+01327 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> += <font class="stringliteral">"-"</font>;
+01328 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> += toString (<a class="code" href="classNLNET_1_1IService.html#z354_7">_SId</a>);
+01329 }
+01330 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+01331 }
+01332
+01333
+01334
+01335 <font class="comment">//</font>
+01336 <font class="comment">// Commands and Variables for controling all services</font>
+01337 <font class="comment">//</font>
+01338
+01339 <a class="code" href="namespaceNLNET.html#a126">NLMISC_VARIABLE</a>(sint32, <a class="code" href="namespaceNLNET.html#a57">NetSpeedLoop</a>, <font class="stringliteral">"duration of the last network loop (in ms)"</font>);
+01340 <a class="code" href="namespaceNLNET.html#a126">NLMISC_VARIABLE</a>(sint32, <a class="code" href="namespaceNLNET.html#a58">UserSpeedLoop</a>, <font class="stringliteral">"duration of the last user loop (in ms)"</font>);
+01341
+01342 <a class="code" href="namespaceNLNET.html#a128">NLMISC_DYNVARIABLE</a>(uint64, ReceivedBytes, <font class="stringliteral">"total of bytes received by this service"</font>)
+01343 {
+01344 <font class="comment">// we can only read the value</font>
+01345 <font class="keywordflow">if</font> (get)
+01346 *<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> = CUnifiedNetwork::getInstance()-&gt;getBytesReceived ();
+01347 }
+01348
+01349 <a class="code" href="namespaceNLNET.html#a128">NLMISC_DYNVARIABLE</a>(uint64, SentBytes, <font class="stringliteral">"total of bytes sent by this service"</font>)
+01350 {
+01351 <font class="comment">// we can only read the value</font>
+01352 <font class="keywordflow">if</font> (get)
+01353 *<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> = CUnifiedNetwork::getInstance()-&gt;getBytesSent ();
+01354 }
+01355
+01356 <a class="code" href="namespaceNLNET.html#a128">NLMISC_DYNVARIABLE</a>(uint64, ReceivedQueueSize, <font class="stringliteral">"current size in bytes of the received queue size"</font>)
+01357 {
+01358 <font class="comment">// we can only read the value</font>
+01359 <font class="keywordflow">if</font> (get)
+01360 *<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> = CUnifiedNetwork::getInstance()-&gt;getReceiveQueueSize ();
+01361 }
+01362
+01363 <a class="code" href="namespaceNLNET.html#a128">NLMISC_DYNVARIABLE</a>(uint64, SentQueueSize, <font class="stringliteral">"current size in bytes of the sent queue size"</font>)
+01364 {
+01365 <font class="comment">// we can only read the value</font>
+01366 <font class="keywordflow">if</font> (get)
+01367 *<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> = CUnifiedNetwork::getInstance()-&gt;getSendQueueSize ();
+01368 }
+01369
+01370 <a class="code" href="namespaceNLNET.html#a128">NLMISC_DYNVARIABLE</a>(string, Scroller, <font class="stringliteral">"current size in bytes of the sent queue size"</font>)
+01371 {
+01372 <font class="keywordflow">if</font> (get)
+01373 {
+01374 <font class="comment">// display the scroll text</font>
+01375 <font class="keyword">static</font> string foo = <font class="stringliteral">"Welcome to NeL Service! This scroll is used to see the update frequency of the main function and to see if the service is frozen or not. Have a nice day and hope you'll like NeL!!! "</font>
+01376 <font class="stringliteral">"Welcome to NeL Service! This scroll is used to see the update frequency of the main function and to see if the service is frozen or not. Have a nice day and hope you'll like NeL!!! "</font>;
+01377 <font class="keyword">static</font> <font class="keywordtype">int</font> pos = 0;
+01378 *<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> = foo.substr ((pos++)%(foo.size()/2), 10);
+01379 }
+01380 }
+01381
+01382 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a> (quit, <font class="stringliteral">"exit the service"</font>, <font class="stringliteral">""</font>)
+01383 {
+01384 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01385
+01386 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"User ask me with a command to quit"</font>);
+01387 <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = 0xFFFF;
+01388
+01389 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01390 }
+01391
+01392 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a> (brutalQuit, <font class="stringliteral">"exit the service brutally"</font>, <font class="stringliteral">""</font>)
+01393 {
+01394 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01395
+01396 ::exit (0xFFFFFFFF);
+01397
+01398 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01399 }
+01400
+01401
+01402 <font class="preprocessor">#ifdef MUTEX_DEBUG</font>
+01403 <font class="preprocessor"></font><a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a> (mutex, <font class="stringliteral">"display mutex values"</font>, <font class="stringliteral">""</font>)
+01404 {
+01405 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01406
+01407 map&lt;CFairMutex*,TMutexLocks&gt; acquiretimes = getNewAcquireTimes();
+01408
+01409 map&lt;CFairMutex*,TMutexLocks&gt;::iterator im;
+01410 <font class="keywordflow">for</font> ( im=acquiretimes.begin(); im!=acquiretimes.end(); ++im )
+01411 {
+01412 <a class="code" href="debug_8h.html#a1">nlinfo</a>( <font class="stringliteral">"%d %p %s: %.0f %.0f, called %u times th(%d, %d wait)%s"</font>, (*im).second.MutexNum, (*im).first, (*im).second.MutexName.c_str(),
+01413 CTime::cpuCycleToSecond((*im).second.TimeToEnter)*1000.0, CTime::cpuCycleToSecond((*im).second.TimeInMutex)*1000.0,
+01414 (*im).second.Nb, (*im).second.ThreadHavingTheMutex, (*im).second.WaitingMutex,
+01415 (*im).second.Dead?<font class="stringliteral">" DEAD"</font>:<font class="stringliteral">""</font>);
+01416 }
+01417
+01418 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01419 }
+01420 <font class="preprocessor">#endif // MUTEX_DEBUG</font>
+01421 <font class="preprocessor"></font>
+01422 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a> (serviceInfo, <font class="stringliteral">"display information about this service"</font>, <font class="stringliteral">""</font>)
+01423 {
+01424 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01425
+01426 log.displayNL (<font class="stringliteral">"Service %s '%s' using NeL ("</font>__DATE__<font class="stringliteral">" "</font>__TIME__<font class="stringliteral">")"</font>, IService::getInstance()-&gt;getServiceLongName().c_str(), IService::getInstance()-&gt;getServiceUnifiedName().c_str());
+01427 log.displayNL (<font class="stringliteral">"Service listening port: %d"</font>, IService::getInstance()-&gt;_Port);
+01428 log.displayNL (<font class="stringliteral">"Service running directory: '%s'"</font>, IService::getInstance()-&gt;_RunningPath.c_str());
+01429 log.displayNL (<font class="stringliteral">"Service log directory: '%s'"</font>, IService::getInstance()-&gt;_LogDir.c_str());
+01430 log.displayNL (<font class="stringliteral">"Service config directory: '%s' config filename: '%s.cfg'"</font>, IService::getInstance()-&gt;_ConfigDir.c_str(), IService::getInstance()-&gt;_LongName.c_str());
+01431 log.displayNL (<font class="stringliteral">"Service id: %d"</font>, IService::getInstance()-&gt;_SId);
+01432 log.displayNL (<font class="stringliteral">"Service update timeout: %dms"</font>, IService::getInstance()-&gt;_UpdateTimeout);
+01433 log.displayNL (<font class="stringliteral">"Service %suse naming service"</font>, IService::getInstance()-&gt;_DontUseNS?<font class="stringliteral">"don't "</font>:<font class="stringliteral">""</font>);
+01434 log.displayNL (<font class="stringliteral">"Service %suse admin executor service"</font>, IService::getInstance()-&gt;_DontUseAES?<font class="stringliteral">"don't "</font>:<font class="stringliteral">""</font>);
+01435 <font class="preprocessor">#ifdef NL_RELEASE_DEBUG</font>
+01436 <font class="preprocessor"></font> string mode = <font class="stringliteral">"NL_RELEASE_DEBUG"</font>;
+01437 <font class="preprocessor">#elif defined(NL_DEBUG_FAST)</font>
+01438 <font class="preprocessor"></font> string mode = <font class="stringliteral">"NL_DEBUG_FAST"</font>;
+01439 <font class="preprocessor">#elif defined(NL_DEBUG)</font>
+01440 <font class="preprocessor"></font> string mode = <font class="stringliteral">"NL_DEBUG"</font>;
+01441 <font class="preprocessor">#elif defined(NL_RELEASE)</font>
+01442 <font class="preprocessor"></font> string mode = <font class="stringliteral">"NL_RELEASE"</font>;
+01443 <font class="preprocessor">#else</font>
+01444 <font class="preprocessor"></font> string mode = <font class="stringliteral">"???"</font>;
+01445 <font class="preprocessor">#endif</font>
+01446 <font class="preprocessor"></font> log.displayNL (<font class="stringliteral">"NeL is compiled in %s mode"</font>, mode.c_str());
+01447
+01448 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"Services arguments: %d args"</font>, IService::getInstance()-&gt;_Args.size ());
+01449 <font class="keywordflow">for</font> (uint i = 0; i &lt; IService::getInstance()-&gt;_Args.size (); i++)
+01450 {
+01451 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">" argv[%d] = '%s'"</font>, i, IService::getInstance()-&gt;_Args[i].c_str ());
+01452 }
+01453
+01454 log.displayNL (<font class="stringliteral">"Naming service info: %s"</font>, CNamingClient::info().c_str());
+01455
+01456 ICommand::execute (<font class="stringliteral">"services"</font>, log);
+01457
+01458 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01459 }
+01460
+01461 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a>(resetMeasures, <font class="stringliteral">"reset hierarchical timer"</font>, <font class="stringliteral">""</font>)
+01462 {
+01463 IService::getInstance()-&gt;requireResetMeasures();
+01464 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01465 }
+01466
+01467 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a>(displayMeasures, <font class="stringliteral">"display hierarchical timer"</font>, <font class="stringliteral">""</font>)
+01468 {
+01469 CHTimer::display();
+01470 CHTimer::displayHierarchicalByExecutionPathSorted (<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>, CHTimer::TotalTime, <font class="keyword">true</font>, 64);
+01471 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01472 }
+01473
+01474 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a>(getWinDisplayerInfo, <font class="stringliteral">"display the info about the pos and size of the window displayer"</font>, <font class="stringliteral">""</font>)
+01475 {
+01476 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>,h;
+01477 IService::getInstance()-&gt;WindowDisplayer-&gt;getWindowPos (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>,h);
+01478 log.displayNL (<font class="stringliteral">"Window Displayer : XWinParam = %d; YWinParam = %d; WWinParam = %d; HWinParam = %d;"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>, h);
+01479 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01480 }
+01481
+01482 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a>(printConfigFile, <font class="stringliteral">"display the variables of the default configfile"</font>, <font class="stringliteral">""</font>)
+01483 {
+01484 IService::getInstance()-&gt;ConfigFile.print(&amp;log);
+01485 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01486 }
+01487
+01488 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a>(getUnknownConfigFileVariables, <font class="stringliteral">"display the variables from config file that are called but not present"</font>, <font class="stringliteral">""</font>)
+01489 {
+01490 log.displayNL (<font class="stringliteral">"%d Variables not found in the configfile '%s'"</font>, IService::getInstance()-&gt;ConfigFile.UnknownVariables.size(), IService::getInstance()-&gt;ConfigFile.getFilename().c_str() );
+01491 <font class="keywordflow">for</font> (uint i = 0; i &lt; IService::getInstance()-&gt;ConfigFile.UnknownVariables.size(); i++)
+01492 {
+01493 log.displayNL (<font class="stringliteral">" %s"</font>, IService::getInstance()-&gt;ConfigFile.UnknownVariables[i].c_str());
+01494 }
+01495 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01496 }
+01497
+01498 <a class="code" href="namespaceNLNET.html#a111">NLMISC_COMMAND</a> (freeze, <font class="stringliteral">"Freeze the service for N seconds (for debug purpose)"</font>, <font class="stringliteral">"&lt;N&gt;"</font>)
+01499 {
+01500 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01501
+01502 sint32 n = atoi (args[0].c_str());
+01503
+01504 log.displayNL (<font class="stringliteral">"Freezing %d seconds"</font>, n);
+01505
+01506 <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a>(n * 1000);
+01507 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01508 }
+01509
+01510 uint32 foo = 7777, <a class="code" href="namespaceNLNET.html#a63">bar</a> = 6666;
+01511
+01512 <a class="code" href="namespaceNLNET.html#a126">NLMISC_VARIABLE</a>(uint32, foo, <font class="stringliteral">"test the get view system"</font>);
+01513 <a class="code" href="namespaceNLNET.html#a126">NLMISC_VARIABLE</a>(uint32, <a class="code" href="namespaceNLNET.html#a63">bar</a>, <font class="stringliteral">"test the get view system"</font>);
+01514
+01515
+01516 <font class="comment">// -1 = service is quitting</font>
+01517 <font class="comment">// 0 = service is not connected</font>
+01518 <font class="comment">// 1 = service is running</font>
+01519 <font class="comment">// 2 = service is launching</font>
+01520 <font class="comment">// 3 = service failed launching</font>
+01521
+01522 <a class="code" href="namespaceNLNET.html#a128">NLMISC_DYNVARIABLE</a>(string, State, <font class="stringliteral">"Set this value to 0 to shutdown the service and 1 to start the service"</font>)
+01523 {
+01524 <font class="keyword">static</font> string running = <font class="stringliteral">"Online"</font>;
+01525
+01526 <font class="comment">// read or write the variable</font>
+01527 <font class="keywordflow">if</font> (get)
+01528 {
+01529 *<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> = running;
+01530 }
+01531 <font class="keywordflow">else</font>
+01532 {
+01533 <font class="keywordflow">if</font> (IService::getInstance()-&gt;getServiceShortName() == <font class="stringliteral">"AES"</font> || IService::getInstance()-&gt;getServiceShortName() == <font class="stringliteral">"AS"</font>)
+01534 {
+01535 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"I can't set State=0 because I'm the admin and I should never quit"</font>);
+01536 }
+01537 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (*<a class="code" href="driver__opengl__extension__def_8h.html#a362">pointer</a> == <font class="stringliteral">"0"</font>)
+01538 {
+01539 <font class="comment">// ok, we want to set the value to false, just quit</font>
+01540 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"User ask me with a command to quit using the State variable"</font>);
+01541 <a class="code" href="namespaceNLNET.html#a56">ExitSignalAsked</a> = 0xFFFE;
+01542 running = <font class="stringliteral">"Quitting"</font>;
+01543 }
+01544 <font class="keywordflow">else</font>
+01545 {
+01546 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Unknown value for State '%s'"</font>, (*pointer).c_str());
+01547 }
+01548 }
+01549 }
+01550
+01551
+01552 } <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>