aboutsummaryrefslogtreecommitdiff
path: root/cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3&content-type=text/x-cvsweb-markup/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3&content-type=text/x-cvsweb-markup/index.html')
-rw-r--r--cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3&content-type=text/x-cvsweb-markup/index.html334
1 files changed, 334 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3&content-type=text/x-cvsweb-markup/index.html b/cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3&content-type=text/x-cvsweb-markup/index.html
new file mode 100644
index 00000000..a3219806
--- /dev/null
+++ b/cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3&content-type=text/x-cvsweb-markup/index.html
@@ -0,0 +1,334 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
+<HEAD><style> A { color:black }</style>
+<!-- hennerik CVSweb $Revision: 1.93 $ -->
+<TITLE>code/nelns/admin_executor_service/admin_executor_service.cpp - view - 1.3</TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee">
+<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="admin_executor_service.cpp"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="admin_executor_service.cpp">admin_executor_service.cpp</A>
+ CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/">code</a> / <a href="/cvs/cvsweb.cgi/code/nelns/">nelns</a> / <a href="/cvs/cvsweb.cgi/code/nelns/admin_executor_service/">admin_executor_service</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/">code</a> / <a href="/cvs/cvsweb.cgi/code/nelns/">nelns</a> / <a href="/cvs/cvsweb.cgi/code/nelns/admin_executor_service/">admin_executor_service</a> / <a href="/cvs/cvsweb.cgi/code/nelns/admin_executor_service/admin_executor_service.cpp">admin_executor_service.cpp</a>&nbsp;(<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nelns/admin_executor_service/admin_executor_service.cpp?rev=1.3','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR>
+Revision <B>1.3</B>, <i>Thu May 3 13:19:13 2001 UTC</i> (14 months, 3 weeks ago) by <i>lecroart</i>
+<BR>Branch: <b>MAIN</b>
+<BR>Changes since <b>1.2: +1 -3
+ lines</b><PRE>
+BUGFIX: now compile on linux
+</PRE>
+</td></tr></table><HR noshade><PRE>/** \file admin_executor_service.cpp
+ * Admin Executor Service (AES)
+ *
+ * $Id: admin_executor_service.cpp,v 1.3 2001/05/03 13:19:13 lecroart Exp $
+ *
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX D.T.C. SYSTEM.
+ * NEVRAX D.T.C. SYSTEM is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * NEVRAX D.T.C. SYSTEM is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with NEVRAX D.T.C. SYSTEM; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include &lt;fcntl.h&gt;
+#include &lt;sys/stat.h&gt;
+
+#include &lt;string&gt;
+#include &lt;list&gt;
+
+#include &quot;nel/misc/debug.h&quot;
+#include &quot;nel/misc/config_file.h&quot;
+#include &quot;nel/misc/thread.h&quot;
+
+#include &quot;nel/net/service.h&quot;
+#include &quot;nel/net/net_manager.h&quot;
+
+
+using namespace std;
+using namespace NLMISC;
+using namespace NLNET;
+
+
+
+struct CService
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CService(TSockId s) : ServiceSockId(s), ServiceId(NextServiceId++) { }
+
+ &nbsp; &nbsp; &nbsp; &nbsp;TSockId &nbsp; &nbsp; &nbsp; &nbsp;ServiceSockId; &nbsp; &nbsp; &nbsp; &nbsp;// socket number to communicate with
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 &nbsp; &nbsp; &nbsp; &nbsp;ServiceId; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// id to identify it
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp;ShortName;
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp;LongName;
+
+private:
+
+ &nbsp; &nbsp; &nbsp; &nbsp;static &nbsp; &nbsp; &nbsp; &nbsp;uint32 NextServiceId;
+};
+
+uint32 CService::NextServiceId = 0;
+
+list&lt;CService&gt; Services;
+typedef list&lt;CService&gt;::iterator sit;
+
+sit find (TSockId sid)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;sit it;
+ &nbsp; &nbsp; &nbsp; &nbsp;for (it = Services.begin(); it != Services.end(); it++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*it).ServiceSockId == sid) break;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;return it;
+}
+
+sit find (uint32 sid)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;sit it;
+ &nbsp; &nbsp; &nbsp; &nbsp;for (it = Services.begin(); it != Services.end(); it++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*it).ServiceId == sid) break;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;return it;
+}
+
+
+class CExecuteCommandThread : public IRunnable
+{
+public:
+ &nbsp; &nbsp; &nbsp; &nbsp;string Command;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CExecuteCommandThread (string command) : Command(command) { }
+
+ &nbsp; &nbsp; &nbsp; &nbsp;void run ()
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;start executing: %s&quot;, Command.c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;system (Command.c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;end executing: %s&quot;, Command.c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+};
+
+
+void executeCommand (string command, bool background)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;if (command.empty()) return;
+
+/*
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;start executing: %s&quot;, command.c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp;if (command[command.size()-1] == '&amp;')
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;command.resize(command.size()-2);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (spawnlp (_P_NOWAIT, cmd.c_str(), command.c_str(), NULL) == -1)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;perror (&quot;ca chie grave!!!!: &quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (spawnlp (_P_WAIT, cmd.c_str(), command.c_str(), NULL) == -1)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;perror (&quot;ca chie grave!!!!: &quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;end executing: %s&quot;, command.c_str());
+*/
+
+ &nbsp; &nbsp; &nbsp; &nbsp;command += &quot; &gt;NUL:&quot;;
+ &nbsp; &nbsp; &nbsp; &nbsp;if (background)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IThread *thread = IThread::create (new CExecuteCommandThread (command));
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;thread-&gt;start ();
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;else
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CExecuteCommandThread cmdt (command);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cmdt.run ();
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+}
+
+
+/*
+// execute without
+void executeCommand (string command, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;if (command.empty()) return;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;#define STDOUT 1
+ &nbsp; &nbsp; &nbsp; &nbsp;#define STDERR 2
+ &nbsp; &nbsp; &nbsp; &nbsp;int nul, oldstdout, oldstderr;
+ &nbsp; &nbsp; &nbsp; &nbsp;char *tmpfilename = tmpnam (NULL);
+ &nbsp; &nbsp; &nbsp; &nbsp;nul = _open(tmpfilename, _O_RDWR | _O_CREAT | _O_TRUNC | _O_TEMPORARY | _O_SHORT_LIVED | _O_EXCL, _S_IREAD | _S_IWRITE);
+ &nbsp; &nbsp; &nbsp; &nbsp;oldstdout = _dup(STDOUT);
+ &nbsp; &nbsp; &nbsp; &nbsp;oldstderr = _dup(STDERR);
+ &nbsp; &nbsp; &nbsp; &nbsp;_dup2(nul, STDOUT);
+ &nbsp; &nbsp; &nbsp; &nbsp;_dup2(nul, STDERR);
+ &nbsp; &nbsp; &nbsp; &nbsp;system(command.c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp;_dup2(oldstdout, STDOUT);
+ &nbsp; &nbsp; &nbsp; &nbsp;_dup2(oldstderr, STDERR);
+ &nbsp; &nbsp; &nbsp; &nbsp;_close(oldstdout);
+ &nbsp; &nbsp; &nbsp; &nbsp;_close(oldstderr);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;_lseek (nul, 0L, SEEK_SET);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;while (!_eof(nul))
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;uint8 buffer[10000];
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbread = _read (nul, buffer, 10000);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (netbase.getSIDA(), &quot;ESCR&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (nbread);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serialBuffer (buffer, nbread);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;netbase.send (msgout, from);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;_close(nul);
+*/
+/*
+ &nbsp; &nbsp; &nbsp; &nbsp;FILE *fp = fopen (&quot;test.txt&quot;, &quot;r&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;do
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char str[1024];
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fgets (str, 1024, fp);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (feof(fp)) break;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result.push_back (str);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;while (true);
+ &nbsp; &nbsp; &nbsp; &nbsp;fclose (fp);
+// &nbsp; &nbsp; &nbsp;remove (&quot;test.txt&quot;);
+*///}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////// CONNECTION TO THE SERVICES //////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void cbServiceIdentification (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CService *c = (CService*) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (c-&gt;ShortName);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (c-&gt;LongName);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;%s %s %s is identified&quot;, from-&gt;asString().c_str(), c-&gt;ShortName.c_str(), c-&gt;LongName.c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AESAS&quot;), &quot;SID&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (c-&gt;ShortName);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (c-&gt;LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AESAS&quot;, msgout);
+}
+
+static void cbServiceReady (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CService *c = (CService*) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;%s %s %s is ready&quot;, from-&gt;asString().c_str(), c-&gt;ShortName.c_str(), c-&gt;LongName.c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AESAS&quot;), &quot;SR&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (c-&gt;ShortName);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (c-&gt;LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AESAS&quot;, msgout);
+}
+
+void serviceConnection (const string &amp;serviceName, TSockId from, void *arg)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;Services.push_back (CService(from));
+ &nbsp; &nbsp; &nbsp; &nbsp;CService *c = &amp;(Services.back());
+ &nbsp; &nbsp; &nbsp; &nbsp;from-&gt;setAppId ((uint64)c);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;%s is connected&quot;, from-&gt;asString().c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AESAS&quot;), &quot;SC&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AESAS&quot;, msgout);
+}
+
+void serviceDisconnection (const string &amp;serviceName, TSockId from, void *arg)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CService *c = (CService*) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;%s %s %s is disconnected&quot;, from-&gt;asString().c_str(), c-&gt;ShortName.c_str(), c-&gt;LongName.c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AESAS&quot;), &quot;SD&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (c-&gt;ShortName);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (c-&gt;LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AESAS&quot;, msgout);
+}
+
+
+/** Callback Array
+ */
+TCallbackItem ServicesCallbackArray[] =
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SID&quot;, cbServiceIdentification },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SR&quot;, cbServiceReady },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////// CONNECTION TO THE AS ////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void cbExecuteSystemCommand (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;string systemCommand;
+ &nbsp; &nbsp; &nbsp; &nbsp;uint8 background;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (systemCommand);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (background);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;I have to execute '%s'&quot;, systemCommand.c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp;executeCommand (systemCommand, background==1);
+}
+
+static void cbStopService (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;string service;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;I have to stop service&quot;);
+
+}
+
+
+TCallbackItem AESASCallbackArray[] =
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;ESC&quot;, cbExecuteSystemCommand },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SS&quot;, cbStopService },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////// SERVICE IMPLEMENTATION //////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class CAdminExecutorService : public IService
+{
+public:
+
+ &nbsp; &nbsp; &nbsp; &nbsp;/// Init the service, load the universal time.
+ &nbsp; &nbsp; &nbsp; &nbsp;void &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;init ()
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::setConnectionCallback (&quot;AES&quot;, serviceConnection, NULL);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::setDisconnectionCallback (&quot;AES&quot;, serviceDisconnection, NULL);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// install the server for AS
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::addServer (&quot;AESAS&quot;, 49996);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::addCallbackArray (&quot;AESAS&quot;, AESASCallbackArray, sizeof(AESASCallbackArray)/sizeof(AESASCallbackArray[0]));
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;bool &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;update ()
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return true;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+};
+
+
+/// Naming Service
+NLNET_SERVICE_MAIN (CAdminExecutorService, &quot;AES&quot;, &quot;admin_executor_service&quot;, 49997, ServicesCallbackArray);
+</PRE> \ No newline at end of file