aboutsummaryrefslogtreecommitdiff
path: root/cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text
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 /cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text')
-rw-r--r--cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text/x-cvsweb-markup/index.html947
1 files changed, 947 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text/x-cvsweb-markup/index.html b/cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text/x-cvsweb-markup/index.html
new file mode 100644
index 00000000..ee08cca2
--- /dev/null
+++ b/cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp?rev=1.11&content-type=text/x-cvsweb-markup/index.html
@@ -0,0 +1,947 @@
+<!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_service/admin_service.cpp - view - 1.11</TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee">
+<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="admin_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_service.cpp">admin_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_service/">admin_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_service/">admin_service</a> / <a href="/cvs/cvsweb.cgi/code/nelns/admin_service/admin_service.cpp">admin_service.cpp</a>&nbsp;(<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nelns/admin_service/admin_service.cpp?rev=1.11" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nelns/admin_service/admin_service.cpp?rev=1.11','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR>
+Revision <B>1.11</B>, <i>Tue Jul 10 16:49:53 2001 UTC</i> (12 months, 2 weeks ago) by <i>lecroart</i>
+<BR>Branch: <b>MAIN</b>
+<BR>Changes since <b>1.10: +18 -14
+ lines</b><PRE>
+BUGFIX: when a service isn't ready and already disconnected, it doesn't crash anymore
+</PRE>
+</td></tr></table><HR noshade><PRE>/** \file admin_service.cpp
+ * Admin Service (AS)
+ *
+ * $Id: admin_service.cpp,v 1.11 2001/07/10 16:49:53 lecroart Exp $
+ *
+ */
+
+/* Copyright, 2000 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NeL Network Services.
+ * NEVRAX NeL Network Services 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 NeL Network Services 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 NeL Network Services; 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;string&gt;
+#include &lt;list&gt;
+
+#include &quot;nel/net/service.h&quot;
+#include &quot;nel/misc/debug.h&quot;
+#include &quot;nel/misc/config_file.h&quot;
+#include &quot;nel/misc/command.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 () : Id(0xFFFFFFFF), Ready(false), Connected(false), InConfig(false) { }
+
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Id; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// uint32 to identify the service
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AliasName; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// alias of the service used in the AES and AS to find him (unique per AES)
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ShortName; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// name of the service in short format (&quot;NS&quot; for example)
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LongName; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// name of the service in long format (&quot;naming_service&quot;)
+ &nbsp; &nbsp; &nbsp; &nbsp;bool &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ready; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// true if the service is ready
+ &nbsp; &nbsp; &nbsp; &nbsp;bool &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Connected; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// true if the service is connected to the AES
+ &nbsp; &nbsp; &nbsp; &nbsp;bool &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InConfig; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// true if the service is in the configuration
+ &nbsp; &nbsp; &nbsp; &nbsp;std::vector&lt;NLMISC::CSerialCommand&gt; &nbsp; &nbsp; &nbsp; &nbsp;Commands;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;void setValues (const CService &amp;t)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// copy all except gtk stuffs
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Id = t.Id;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AliasName = t.AliasName;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ShortName = t.ShortName;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LongName = t.LongName;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ready = t.Ready;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Connected = t.Connected;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//InConfig = t.InConfig; never change the inconfig value
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+};
+
+typedef list&lt;CService&gt; TServices;
+typedef list&lt;CService&gt;::iterator SIT;
+
+struct CAdminExecutorService
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService () : Id(NextId++), SockId(NULL), Connected(false) { }
+
+ &nbsp; &nbsp; &nbsp; &nbsp;TSockId &nbsp; &nbsp; &nbsp; &nbsp;SockId; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// connection to the AES
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 &nbsp; &nbsp; &nbsp; &nbsp;Id; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// uint32 to identify the AES where the service is running
+
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp;ServerAlias; &nbsp; &nbsp; &nbsp; &nbsp;/// name of the layer4 connection, used to send message to this AES
+ &nbsp; &nbsp; &nbsp; &nbsp;string &nbsp; &nbsp; &nbsp; &nbsp;ServerAddr; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// address in a string format (only the ip)
+ &nbsp; &nbsp; &nbsp; &nbsp;bool &nbsp; &nbsp; &nbsp; &nbsp;Connected; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/// true if the AES is connected
+
+ &nbsp; &nbsp; &nbsp; &nbsp;TServices Services;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;vector&lt;string&gt; &nbsp; &nbsp; &nbsp; &nbsp;ServiceAliasList;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT findService (uint32 sid, bool asrt = true)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SIT sit;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (sit = Services.begin(); sit != Services.end(); sit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*sit).Id == sid)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (asrt)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlassert (sit != Services.end());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return sit;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT findService (const string &amp;alias, bool asrt = true)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SIT sit;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (sit = Services.begin(); sit != Services.end(); sit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*sit).AliasName == alias)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (asrt)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlassert (sit != Services.end());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return sit;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+private:
+ &nbsp; &nbsp; &nbsp; &nbsp;static uint32 NextId;
+};
+
+uint32 CAdminExecutorService::NextId = 1;
+
+typedef list&lt;CAdminExecutorService&gt; TAdminExecutorServices;
+typedef list&lt;CAdminExecutorService&gt;::iterator AESIT;
+
+TAdminExecutorServices AdminExecutorServices;
+
+/////////////////
+
+AESIT findAdminExecutorService (uint32 aesid, bool asrt = true)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit;
+ &nbsp; &nbsp; &nbsp; &nbsp;for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*aesit).Id == aesid)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;if (asrt)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlassert (aesit != AdminExecutorServices.end());
+ &nbsp; &nbsp; &nbsp; &nbsp;return aesit;
+}
+
+AESIT findAdminExecutorService (string ServerAlias, bool asrt = true)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit;
+ &nbsp; &nbsp; &nbsp; &nbsp;for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*aesit).ServerAlias == ServerAlias)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;if (asrt)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlassert (aesit != AdminExecutorServices.end());
+ &nbsp; &nbsp; &nbsp; &nbsp;return aesit;
+}
+
+void displayServices ()
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;for (AESIT aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;&gt; Admin&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (SIT sit = (*aesit).Services.begin(); sit != (*aesit).Services.end(); sit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot; &nbsp;&gt; '%s' '%s' '%s' '%s' %d %d&quot;, (*aesit).SockId-&gt;asString().c_str(), (*sit).AliasName.c_str(), (*sit).ShortName.c_str(), (*sit).LongName.c_str(), (*aesit).Id, (*sit).Id);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+}
+
+
+// send a message to a client. if ok is 0 it s an error or it s a normal
+void messageToClient (uint8 ok, string msg, TSockId from = NULL)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;MESSAGE&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (ok, msg);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, from);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////// SCRIPT MANAGER /////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool StartAllServices = false;
+uint32 StartAllServicesPos;
+
+void doNextStartAllServicesStep ()
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;nlassert (StartAllServices);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// get the script
+ &nbsp; &nbsp; &nbsp; &nbsp;try
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CConfigFile::CVar &amp;script = IService::ConfigFile.getVar(&quot;Services&quot;);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// check the position
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (StartAllServicesPos*2 &gt;= (uint32)script.size())
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StartAllServices = false;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlinfo(&quot;end of the script&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (1, &quot;Start All Service finnished correctly&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// get the script line
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serverAlias;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serviceAlias;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;serverAlias = script.asString (StartAllServicesPos*2);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;serviceAlias = script.asString (StartAllServicesPos*2+1);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;catch(EBadSize &amp;)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (1, &quot;'Services' variable does not contains a good number of entries (must be a multiple of 2)&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning (&quot;'Services' variable does not contains a good number of entries (must be a multiple of 2)&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StartAllServices = false;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (serverAlias, false);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (aesit == AdminExecutorServices.end())
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (1, &quot;don't find the server&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning(&quot;don't find the server&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StartAllServices = false;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// check if the service is not currently running
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StartAllServicesPos++;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = (*aesit).findService (serviceAlias);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*sit).Connected)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// the service is already running, go to the next process
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;doNextStartAllServicesStep ();
+ &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// send the resquest to the AES
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA((*aesit).ServerAlias), &quot;STARTS&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (serviceAlias);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send ((*aesit).ServerAlias, msgout);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;catch(EUnknownVar&amp;)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (1, &quot;'Services' variable is not found&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning (&quot;'Services' variable is not found&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StartAllServices = false;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+}
+
+void initStartAllServices ()
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;if (StartAllServices)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (1, &quot;already running a script, reset it&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning(&quot;already running a script, reset it&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StartAllServices = false;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;try
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CConfigFile::CVar &amp;script = IService::ConfigFile.getVar(&quot;Services&quot;);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (sint i = 0 ; i &lt; script.size (); i+=2)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serverAlias = script.asString(i);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (serverAlias, false);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (aesit == AdminExecutorServices.end())
+ &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;messageToClient (1, &quot;an aes is not running, can't run the script&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning(&quot;aes '%s' isn't running, can't run the script&quot;, serverAlias.c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &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;catch(EConfigFile &amp;)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (1, &quot;bad config file&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning (&quot;bad config file&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;StartAllServicesPos = 0;
+ &nbsp; &nbsp; &nbsp; &nbsp;StartAllServices = true;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;doNextStartAllServicesStep();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////// CONNECTION TO THE AES ///////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+static void cbExecuteSystemCommandResult (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;vector&lt;string&gt; result;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serialCont (result);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo(&quot;command result&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;for (uint i = 0; i &lt; result.size(); i++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf (&quot;%s&quot;, result[i].c_str());
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo(&quot;end of command result&quot;);
+}
+
+// get the service list from the admin exec and send the list to all admin client
+static void cbServiceList (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp;// Get the list of service from aes
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbs;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (nbs);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;for (uint32 i = 0; i &lt; nbs; i++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// find the service
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CService s;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (s.Id, s.AliasName, s.ShortName, s.LongName, s.Ready);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgin.serialCont (s.Commands);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.Connected = true;
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!s.AliasName.empty())
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = aes-&gt;findService (s.AliasName, false);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sit == aes-&gt;Services.end ())
+ &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;aes-&gt;Services.push_back (s);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlassert (&quot;the service already exists with alias, update it&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).setValues (s);
+ &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;else
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = aes-&gt;findService (s.Id, false);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sit == aes-&gt;Services.end ())
+ &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;aes-&gt;Services.push_back (s);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlassert (&quot;the service already exists with id, update it&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).setValues (s);
+ &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;displayServices ();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp;// Send the new list to all admin
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SERVICE_LIST&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbaes = 1;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (nbaes);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id);
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 ss = aes-&gt;Services.size();
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (ss);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;for (SIT sit = aes-&gt;Services.begin(); sit != aes-&gt;Services.end(); sit++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial ((*sit).Id, (*sit).AliasName, (*sit).ShortName, (*sit).LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial ((*sit).Ready, (*sit).Connected, (*sit).InConfig);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serialCont ((*sit).Commands);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+}
+
+static void cbServiceAliasList (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;// get the service list from the admin exec and send the list to all admin client
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;ServiceAliasList.clear ();
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serialCont (aes-&gt;ServiceAliasList);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo(&quot;send SAL to admin callback from aes&quot;);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SAL&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serialCont (aes-&gt;ServiceAliasList);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+ &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo(&quot;new service alias list&quot;);
+}
+
+
+static void cbServiceIdentification (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;string alias;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid, alias);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT sit;
+ &nbsp; &nbsp; &nbsp; &nbsp;if (!alias.empty())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit = aes-&gt;findService (alias, false);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sit == aes-&gt;Services.end ())
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// the alias is not found
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning (&quot;new service with alias (%s) but not in my list&quot;, alias.c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;Services.push_back (CService ());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit = aes-&gt;Services.end();
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit--;
+ &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// normal case
+ &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;sit = aes-&gt;findService (sid, false);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sit == aes-&gt;Services.end ())
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// normal case for unknown services
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning (&quot;new service without alias and not in my list, add it&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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlwarning (&quot;new service without alias is already in my list with id %d, add it&quot;, sid);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;Services.push_back (CService ());
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit = aes-&gt;Services.end();
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit--;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Id = sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;(*sit).AliasName = alias;
+ &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Connected = true;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial ((*sit).ShortName, (*sit).LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serialCont ((*sit).Commands);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;*:%d:%d is identified to be '%s' '%s' '%s'&quot;, aes-&gt;Id, sid, (*sit).AliasName.c_str(), (*sit).ShortName.c_str(), (*sit).LongName.c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message to all admin client
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SID&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id, sid, (*sit).AliasName, (*sit).ShortName, (*sit).LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serialCont ((*sit).Commands);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+}
+
+static void cbServiceReady (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = aes-&gt;findService(sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Ready = true;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;*:%d:%d is ready&quot;, aes-&gt;Id, sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message to all admin client
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SR&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id, sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// if we are in a script execution, continue
+ &nbsp; &nbsp; &nbsp; &nbsp;if (StartAllServices)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;doNextStartAllServicesStep();
+}
+
+static void cbServiceConnection (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;*:%d:%d connected&quot;, aes-&gt;Id, sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// don't do anything. we have to wait identification to add it in out lists
+
+/*
+ &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;Services.push_back (CService(sid));
+*/
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message to all admin client
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SC&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id, sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+}
+
+static void cbServiceDisconnection (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;*:%d:%d disconnected&quot;, aes-&gt;Id, sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = aes-&gt;findService(sid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message to all admin client
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SD&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id, sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// the service could disconnect before it's identification, in this case, we don't have it in the service list
+ &nbsp; &nbsp; &nbsp; &nbsp;if (sit != aes-&gt;Services.end ())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*sit).InConfig)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Ready = (*sit).Connected = false;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Id = 0xFFFFFFFF;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).ShortName = (*sit).LongName = &quot;&quot;;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Commands.clear ();
+ &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// erase only if it's not a service in the config
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;Services.erase (sit);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;displayServices ();
+}
+
+// i'm connected to a new admin executor service
+void cbAESConnection (const string &amp;serviceName, TSockId from, void *arg)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (serviceName); &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = &amp;(*aesit);
+ &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;// set the appid to find the aes in O(1)
+ &nbsp; &nbsp; &nbsp; &nbsp;from-&gt;setAppId ((uint64)(uint)aes);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;Connected = true;
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;*:%d:* connected&quot;, aes-&gt;Id);
+/*
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message that an admin exec is connected to all admin client
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;AESC&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+*/
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the new state of this AES
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;AES_LIST&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbaes = 1;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (nbaes);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id, aes-&gt;ServerAlias, aes-&gt;ServerAddr, aes-&gt;Connected);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+}
+
+// i'm disconnected to an admin executor service
+void cbAESDisconnection (const string &amp;serviceName, TSockId from, void *arg)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;// get the aes with the appid
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;aes-&gt;Connected = false;
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT sit;
+ &nbsp; &nbsp; &nbsp; &nbsp;for (sit = aes-&gt;Services.begin(); sit != aes-&gt;Services.end();)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// keep only inconfig services
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*sit).InConfig)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Id = 0xFFFFFFFF;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).ShortName = (*sit).LongName = &quot;&quot;;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*sit).Ready = (*sit).Connected = false;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit++;
+ &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// erase only if it's not a service in the config
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sit = aes-&gt;Services.erase (sit);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;*:%d:* disconnected&quot;, aes-&gt;Id);
+/* &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message to all admin client that an admin exec is disconnected
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;AESD&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+*/
+
+ &nbsp; &nbsp; &nbsp; &nbsp;displayServices ();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the new state of this AES
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;AES_LIST&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbaes = 1;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (nbaes);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id, aes-&gt;ServerAlias, aes-&gt;ServerAddr, aes-&gt;Connected);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+}
+
+static void cbLog (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;// received an answer for a command, give it to all admin client
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// get the aes with the appid
+ &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService *aes = (CAdminExecutorService*) (uint) from-&gt;appId();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// broadcast the message to the admin service
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;XLOG&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;string log;
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (log);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (aes-&gt;Id);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (log);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, 0);
+}
+
+
+TCallbackItem AESCallbackArray[] =
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;ESCR&quot;, cbExecuteSystemCommandResult },
+
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SL&quot;, cbServiceList },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SID&quot;, cbServiceIdentification },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SR&quot;, cbServiceReady },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SC&quot;, cbServiceConnection },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SD&quot;, cbServiceDisconnection },
+
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SAL&quot;, cbServiceAliasList },
+
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;XLOG&quot;, cbLog },
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////// CONNECTION TO THE CLIENT ////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//
+// A new admin client is connected.
+//
+void clientConnection (const string &amp;serviceName, TSockId from, void *arg)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;// new client, send him all out info about services
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo (&quot;client %s is connected&quot;, from-&gt;asString().c_str());
+
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp;// send the list of all the aes
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout2 (CNetManager::getSIDA (&quot;AS&quot;), &quot;AES_LIST&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit;
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbaes = (uint32)AdminExecutorServices.size();
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout2.serial (nbaes);
+ &nbsp; &nbsp; &nbsp; &nbsp;for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// send info about the AES
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout2.serial ((*aesit).Id, (*aesit).ServerAlias, (*aesit).ServerAddr, (*aesit).Connected);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout2, from);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp;// send the list of all services
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA (&quot;AS&quot;), &quot;SERVICE_LIST&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;nbaes = (uint32)AdminExecutorServices.size();
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (nbaes);
+ &nbsp; &nbsp; &nbsp; &nbsp;for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial ((*aesit).Id);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;uint32 nbs = (uint32)(*aesit).Services.size();
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (nbs);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (SIT sit = (*aesit).Services.begin(); sit != (*aesit).Services.end(); sit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// send info about services of the AES
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial ((*sit).Id, (*sit).AliasName, (*sit).ShortName, (*sit).LongName);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial ((*sit).Ready, (*sit).Connected, (*sit).InConfig);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serialCont ((*sit).Commands);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout, from);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;displayServices ();
+
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp;// send service alias list
+ &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp;nlinfo(&quot;send SAL to admin startup&quot;);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout2 (CNetManager::getSIDA (&quot;AS&quot;), &quot;SAL&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout2.serial ((*aesit).Id);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout2.serialCont ((*aesit).ServiceAliasList);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send (&quot;AS&quot;, msgout2, from);
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+}
+
+
+static void cbExecuteSystemCommand (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;string command;
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 aesid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (aesid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (command);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (aesid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;if (aesit == AdminExecutorServices.end())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// don't find the aes, send an error message
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (0, &quot;couldn't execute command, as didn't find the aes&quot;, from);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// send the resquest to the AES
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA((*aesit).ServerAlias), &quot;SYS&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (command);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send ((*aesit).ServerAlias, msgout);
+}
+
+
+static void cbStartService (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;string serviceAlias;
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 aesid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (aesid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (serviceAlias);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (aesid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;if (aesit == AdminExecutorServices.end())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// don't find the aes, send an error message
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (0, &quot;couldn't start service, as didn't find the aes&quot;, from);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// send the resquest to the AES
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA((*aesit).ServerAlias), &quot;STARTS&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (serviceAlias);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send ((*aesit).ServerAlias, msgout);
+}
+
+static void cbStopService (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 aesid, sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (aesid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (aesid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;if (aesit == AdminExecutorServices.end())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (0, &quot;couldn't stop service, as didn't find the aes&quot;, from);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// don't find the aes, send an error message
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = (*aesit).findService (sid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;if (sit == (*aesit).Services.end())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// don't find the s, send an error message
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (0, &quot;couldn't stop service, as didn't find the service&quot;, from);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// send the resquest to the AES
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA((*aesit).ServerAlias), &quot;STOPS&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send ((*aesit).ServerAlias, msgout);
+}
+
+static void cbExecCommand (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;uint32 aesid, sid;
+ &nbsp; &nbsp; &nbsp; &nbsp;string command;
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (aesid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgin.serial (command);
+
+ &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (aesid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;if (aesit == AdminExecutorServices.end())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (0, &quot;couldn't stop service, as didn't find the aes&quot;, from);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// don't find the aes, send an error message
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;SIT sit = (*aesit).findService (sid, false);
+ &nbsp; &nbsp; &nbsp; &nbsp;if (sit == (*aesit).Services.end())
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// don't find the s, send an error message
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;messageToClient (0, &quot;couldn't stop service, as didn't find the service&quot;, from);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp;// send the resquest to the AES
+
+ &nbsp; &nbsp; &nbsp; &nbsp;CMessage msgout (CNetManager::getSIDA((*aesit).ServerAlias), &quot;EXEC_COMMAND&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (sid);
+ &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial (command);
+ &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send ((*aesit).ServerAlias, msgout);
+}
+
+static void cbStartAllServices (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;initStartAllServices ();
+}
+
+static void cbStopAllServices (CMessage&amp; msgin, TSockId from, CCallbackNetBase &amp;netbase)
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;for (AESIT aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++)
+ &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (SIT sit = (*aesit).Services.begin(); sit != (*aesit).Services.end(); sit++)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((*sit).Connected)
+ &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;CMessage msgout (CNetManager::getSIDA((*aesit).ServerAlias), &quot;STOPS&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgout.serial ((*sit).Id);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::send ((*aesit).ServerAlias, msgout);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+}
+
+TCallbackItem ClientCallbackArray[] =
+{
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;SYS&quot;, cbExecuteSystemCommand },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;STARTS&quot;, cbStartService },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;STOPS&quot;, cbStopService },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;EXEC_COMMAND&quot;, cbExecCommand },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;START_ALL_SERVICES&quot;, cbStartAllServices },
+ &nbsp; &nbsp; &nbsp; &nbsp;{ &quot;STOP_ALL_SERVICES&quot;, cbStopAllServices },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////// SERVICE IMPLEMENTATION //////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class CAdminService : 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;DebugLog-&gt;addNegativeFilter (&quot;L0:&quot;);
+// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DebugLog-&gt;addNegativeFilter (&quot;L1:&quot;);
+// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DebugLog-&gt;addNegativeFilter (&quot;L2:&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::setConnectionCallback (&quot;AS&quot;, clientConnection, NULL);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Get the list of AESHosts, add in the structures and create connection to all AES
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CConfigFile::CVar &amp;host = ConfigFile.getVar (&quot;AESHosts&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sint i;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (i = 0 ; i &lt; host.size (); i+=2)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serverAlias = host.asString(i);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serverAddr = host.asString(i+1);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// add to the list
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CAdminExecutorService aes;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aes.ServerAlias = serverAlias;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aes.ServerAddr = serverAddr;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AdminExecutorServices.push_back (aes);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// connect to the AES
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::setConnectionCallback (serverAlias, cbAESConnection, NULL);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::setDisconnectionCallback (serverAlias, cbAESDisconnection, NULL);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::addClient (serverAlias, serverAddr+&quot;:49996&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CNetManager::addCallbackArray (serverAlias, AESCallbackArray, sizeof (AESCallbackArray)/sizeof(AESCallbackArray[0]));
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Get the list of services in the shard
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CConfigFile::CVar &amp;serv = ConfigFile.getVar (&quot;Services&quot;);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (i = 0 ; i &lt; serv.size (); i+=2)
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serverAlias = serv.asString(i);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string serviceAlias = serv.asString(i+1);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AESIT aesit = findAdminExecutorService (serverAlias);
+
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// add new AES in the list
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CService s;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.AliasName = serviceAlias;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.InConfig = true;
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*aesit).Services.push_back (s);
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;displayServices ();
+ &nbsp; &nbsp; &nbsp; &nbsp;}
+};
+
+
+// AS is a server connection to the admin client
+// AESAS is a client connection to the admin executor
+
+/// Naming Service
+NLNET_SERVICE_MAIN (CAdminService, &quot;AS&quot;, &quot;admin_service&quot;, 49995, ClientCallbackArray);
+</PRE> \ No newline at end of file