diff options
Diffstat (limited to 'docs/doxygen/nel/a03632.html')
-rw-r--r-- | docs/doxygen/nel/a03632.html | 4627 |
1 files changed, 4627 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03632.html b/docs/doxygen/nel/a03632.html new file mode 100644 index 00000000..e1b0a298 --- /dev/null +++ b/docs/doxygen/nel/a03632.html @@ -0,0 +1,4627 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLNET::CUnifiedNetwork class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLNET::CUnifiedNetwork Class Reference</h1><code>#include <<a class="el" href="a06646.html">unified_network.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Layer 5<p> +<dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart, Benjamin Legros <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00071">71</a> of file <a class="el" href="a06646.html">unified_network.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka0">addCallbackArray</a> (const <a class="el" href="a03917.html">TUnifiedCallbackItem</a> *callbackarray, <a class="el" href="a03449.html#NLMISC_1_1CStringIdArrayw0">NLMISC::CStringIdArray::TStringId</a> arraysize)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka1">addDefaultNetwork</a> (const std::string &defnet)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka2">addNetworkAssociation</a> (const std::string &networkName, <a class="el" href="a04558.html#a7">uint8</a> nid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka3">addService</a> (const std::string &name, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>, bool sendId=true, bool external=true, <a class="el" href="a04558.html#a9">uint16</a> sid=0, bool autoRetry=true, bool shouldBeAlreayInserted=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka4">addService</a> (const std::string &name, const <a class="el" href="a02665.html">CInetAddress</a> &<a class="el" href="a04223.html#a657">addr</a>, bool sendId=true, bool external=true, <a class="el" href="a04558.html#a9">uint16</a> sid=0, bool autoRetry=true, bool shouldBeAlreayInserted=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka5">clearDefaultNetwork</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Clear all default network. <a href="#NLNET_1_1CUnifiedNetworka5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka6">clearNetworkAssociation</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka7">connect</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka8">displayInternalTables</a> (<a class="el" href="a02813.html">NLMISC::CLog</a> *log=<a class="el" href="a05378.html#a12">NLMISC::InfoLog</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka9">displayUnifiedConnection</a> (<a class="el" href="a04558.html#a9">uint16</a> sid, <a class="el" href="a02813.html">NLMISC::CLog</a> *log=<a class="el" href="a05378.html#a12">NLMISC::InfoLog</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05379.html#a98">TUnifiedMsgCallback</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka10">findCallback</a> (const std::string &callbackName)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Find a callback in the array. <a href="#NLNET_1_1CUnifiedNetworka10"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka11">getBytesReceived</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the total number of bytes received. <a href="#NLNET_1_1CUnifiedNetworka11"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka12">getBytesSent</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the total number of bytes sent. <a href="#NLNET_1_1CUnifiedNetworka12"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>const std::vector< <a class="el" href="a04558.html#a9">uint16</a> > & </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka13">getConnectionList</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the service ids of the active connections. <a href="#NLNET_1_1CUnifiedNetworka13"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02306.html">CCallbackNetBase</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka14">getNetBase</a> (<a class="el" href="a04558.html#a9">uint16</a> sid, <a class="el" href="a02303.html">TSockId</a> &host, <a class="el" href="a04558.html#a7">uint8</a> nid=0xFF)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the <a class="el" href="a02306.html">CCallbackNetBase</a> of the service. <a href="#NLNET_1_1CUnifiedNetworka14"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02306.html">CCallbackNetBase</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka15">getNetBase</a> (const std::string &name, <a class="el" href="a02303.html">TSockId</a> &host, <a class="el" href="a04558.html#a7">uint8</a> nid=0xFF)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the <a class="el" href="a02306.html">CCallbackNetBase</a> of the service. <a href="#NLNET_1_1CUnifiedNetworka15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka16">getReceiveQueueSize</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the total number of bytes queued after receiving. <a href="#NLNET_1_1CUnifiedNetworka16"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka17">getSendQueueSize</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the total number of bytes queued for sending. <a href="#NLNET_1_1CUnifiedNetworka17"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka18">getServiceName</a> (<a class="el" href="a04558.html#a9">uint16</a> sid)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the name of the specified service, or "" if not found. <a href="#NLNET_1_1CUnifiedNetworka18"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka19">getServiceUnifiedName</a> (<a class="el" href="a04558.html#a9">uint16</a> sid)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return a string identifying the service, using the format "NAME-sid" (or "sid" only if not found). <a href="#NLNET_1_1CUnifiedNetworka19"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka20">init</a> (const <a class="el" href="a02665.html">CInetAddress</a> *<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> rec, const std::string &shortName, <a class="el" href="a04558.html#a9">uint16</a> port, <a class="el" href="a05379.html#a93">TServiceId</a> &sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka21">isServiceLocal</a> (const std::string &serviceName)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the serviceName service is on the same computer than this service. <a href="#NLNET_1_1CUnifiedNetworka21"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka22">isServiceLocal</a> (<a class="el" href="a04558.html#a9">uint16</a> sid)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the sid service is on the same computer than this service. <a href="#NLNET_1_1CUnifiedNetworka22"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka23">release</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka24">send</a> (<a class="el" href="a04558.html#a9">uint16</a> serviceId, const <a class="el" href="a02918.html">CMessage</a> &msg, <a class="el" href="a04558.html#a7">uint8</a> nid=0xFF)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka25">send</a> (const std::string &serviceName, const <a class="el" href="a02918.html">CMessage</a> &msg, <a class="el" href="a04558.html#a7">uint8</a> nid=0xFF)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka26">sendAll</a> (const <a class="el" href="a02918.html">CMessage</a> &msg, <a class="el" href="a04558.html#a7">uint8</a> nid=0xFF)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka27">setServiceDownCallback</a> (const std::string &serviceName, <a class="el" href="a05379.html#a97">TUnifiedNetCallback</a> cb, void *arg=0, bool back=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka28">setServiceUpCallback</a> (const std::string &serviceName, <a class="el" href="a05379.html#a97">TUnifiedNetCallback</a> cb, void *arg=0, bool back=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka29">update</a> (<a class="el" href="a05378.html#a242">NLMISC::TTime</a> timeout=0)</td></tr> + +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03632.html">CUnifiedNetwork</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworke0">getInstance</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworke1">isUsed</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::pair< <a class="el" href="a05379.html#a97">TUnifiedNetCallback</a>,<br> + void * > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">A callback and its user data. <a href="#NLNET_1_1CUnifiedNetworky0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< std::string,<br> + <a class="el" href="a05379.html#a98">TUnifiedMsgCallback</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky1">TMsgMappedCallback</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">A map of callbacks, refered by message name. <a href="#NLNET_1_1CUnifiedNetworky1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::hash_map< std::string,<br> + std::list< <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky2">TNameMappedCallback</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">A map of service up/down callbacks with their user data. <a href="#NLNET_1_1CUnifiedNetworky2"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd0">addNamedCnx</a> (const std::string &name, <a class="el" href="a04558.html#a9">uint16</a> sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd1">autoCheck</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd2">callServiceDownCallback</a> (const std::string &serviceName, <a class="el" href="a04558.html#a9">uint16</a> sid, bool callGlobalCallback=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd3">callServiceUpCallback</a> (const std::string &serviceName, <a class="el" href="a04558.html#a9">uint16</a> sid, bool callGlobalCallback=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd4">CUnifiedNetwork</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd5">findConnectionId</a> (<a class="el" href="a04558.html#a9">uint16</a> sid, <a class="el" href="a04558.html#a7">uint8</a> nid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03633.html">CUnifiedConnection</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd6">getUnifiedConnection</a> (<a class="el" href="a04558.html#a9">uint16</a> sid, bool warn=true)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd7">haveNamedCnx</a> (const std::string &name, <a class="el" href="a04558.html#a9">uint16</a> sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd8">removeNamedCnx</a> (const std::string &name, <a class="el" href="a04558.html#a9">uint16</a> sid)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkd9">~CUnifiedNetwork</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky1">TMsgMappedCallback</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr0">_Callbacks</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Map of callbacks. <a href="#NLNET_1_1CUnifiedNetworkr0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02307.html">CCallbackServer</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">The callback server. <a href="#NLNET_1_1CUnifiedNetworkr1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::string > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr2">_DefaultNetwork</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">for each services, which network to take <a href="#NLNET_1_1CUnifiedNetworkr2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky2">TNameMappedCallback</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">_DownCallbacks</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a9">uint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr5">_ExtSId</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Used for external service. <a href="#NLNET_1_1CUnifiedNetworkr5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03633.html">CUnifiedConnection</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Vector of connections by service id (sid is the entry in this array, it means that there s some hole). <a href="#NLNET_1_1CUnifiedNetworkr6"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr7">_Initialised</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">true if initialisation function called <a href="#NLNET_1_1CUnifiedNetworkr7"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a242">NLMISC::TTime</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr8">_LastRetry</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Last time of retry. <a href="#NLNET_1_1CUnifiedNetworkr8"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr9">_Name</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Service name. <a href="#NLNET_1_1CUnifiedNetworkr9"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03635.html">TNameMappedConnection</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Map of connections by service name. <a href="#NLNET_1_1CUnifiedNetworkr10"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02665.html">NLNET::CInetAddress</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr11">_NamingServiceAddr</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Naming service. <a href="#NLNET_1_1CUnifiedNetworkr11"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a11">uint32</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">for each nid, which network address <a href="#NLNET_1_1CUnifiedNetworkr12"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a242">NLMISC::TTime</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Time of the theorical next update. <a href="#NLNET_1_1CUnifiedNetworkr13"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr14">_RecordingState</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Recording state. <a href="#NLNET_1_1CUnifiedNetworkr14"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a9">uint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr15">_ServerPort</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">The server port. <a href="#NLNET_1_1CUnifiedNetworkr15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05379.html#a93">TServiceId</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Service id of the running service. <a href="#NLNET_1_1CUnifiedNetworkr16"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky2">TNameMappedCallback</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">_UpCallbacks</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Map of the up/down service callbacks. <a href="#NLNET_1_1CUnifiedNetworkr17"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a9">uint16</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">This vector contains only an index to the unified connection. It is used to have quick access on the available connections. <a href="#NLNET_1_1CUnifiedNetworkr19"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03632.html">CUnifiedNetwork</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkv0">_Instance</a> = NULL</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">The main instance. <a href="#NLNET_1_1CUnifiedNetworkv0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Friends</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>struct </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn0">isServiceLocalClass</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>struct </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn1">l5CallbackClass</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>struct </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn2">l5QueuesStatsClass</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn3">uncbConnection</a> (<a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, void *arg)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn4">uncbDisconnection</a> (<a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, void *arg)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn5">uncbMsgProcessing</a> (<a class="el" href="a02918.html">CMessage</a> &msgin, <a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, <a class="el" href="a02306.html">CCallbackNetBase</a> &netbase)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn6">uncbServiceIdentification</a> (<a class="el" href="a02918.html">CMessage</a> &msgin, <a class="el" href="a02303.html">TSockId</a> <a class="el" href="a04113.html#a70">from</a>, <a class="el" href="a02306.html">CCallbackNetBase</a> &netbase)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn7">uNetRegistrationBroadcast</a> (const std::string &name, <a class="el" href="a05379.html#a93">TServiceId</a> sid, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkn8">uNetUnregistrationBroadcast</a> (const std::string &name, <a class="el" href="a05379.html#a93">TServiceId</a> sid, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>)</td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLNET_1_1CUnifiedNetworky0" doxytag="NLNET::CUnifiedNetwork::TCallbackArgItem" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::pair<<a class="el" href="a05379.html#a97">TUnifiedNetCallback</a>, void *> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">NLNET::CUnifiedNetwork::TCallbackArgItem</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +A callback and its user data. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00245">245</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworky1" doxytag="NLNET::CUnifiedNetwork::TMsgMappedCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<std::string, <a class="el" href="a05379.html#a98">TUnifiedMsgCallback</a>> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky1">NLNET::CUnifiedNetwork::TMsgMappedCallback</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +A map of callbacks, refered by message name. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00242">242</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworky2" doxytag="NLNET::CUnifiedNetwork::TNameMappedCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::hash_map<std::string, std::list<<a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a>> > <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky2">NLNET::CUnifiedNetwork::TNameMappedCallback</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +A map of service up/down callbacks with their user data. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00248">248</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd4" doxytag="NLNET::CUnifiedNetwork::CUnifiedNetwork" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CUnifiedNetwork::CUnifiedNetwork </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00481">481</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00457">_ExtSId</a>, and <a class="el" href="a06646.html#l00460">_LastRetry</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01481">getInstance()</a>. +<p> +<div class="fragment"><pre>00481 : <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>(0), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr5">_ExtSId</a>(256), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr8">_LastRetry</a>(0), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a>(0), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr7">_Initialised</a>(<span class="keyword">false</span>) +00482 { +00483 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd9" doxytag="NLNET::CUnifiedNetwork::~CUnifiedNetwork" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CUnifiedNetwork::~<a class="el" href="a03632.html">CUnifiedNetwork</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00485">485</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +<div class="fragment"><pre>00485 { } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka0" doxytag="NLNET::CUnifiedNetwork::addCallbackArray" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::addCallbackArray </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03917.html">TUnifiedCallbackItem</a> * </td> + <td class="mdname" nowrap> <em>callbackarray</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03449.html#NLMISC_1_1CStringIdArrayw0">NLMISC::CStringIdArray::TStringId</a> </td> + <td class="mdname" nowrap> <em>arraysize</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Adds a callback array in the system. You can add callback only *after* adding the server, the client or the group. +<p> +Definition at line <a class="el" href="a06645.html#l01188">1188</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00454">_Callbacks</a>, <a class="el" href="a06468.html#l00054">NLMISC::CStringIdArray::TStringId</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06364.html#l00419">NLNET::IService::main()</a>. +<p> +<div class="fragment"><pre>01189 { +01190 <a class="code" href="a04558.html#a15">uint</a> i; +01191 +01192 <span class="keywordflow">for</span> (i=0; i<(<a class="code" href="a04558.html#a15">uint</a>)arraysize; ++i) +01193 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr0">_Callbacks</a>.insert(make_pair(string(callbackarray[i].Key),callbackarray[i].Callback)); +01194 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka1" doxytag="NLNET::CUnifiedNetwork::addDefaultNetwork" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::addDefaultNetwork </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>defnet</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +This array says to wich network we need to send the message for the default nid. For example you can says that message for AES will use the network 0 and message for LS will use the network 1. To do that, just call the function with string "AES0" and "LS1" the number is the nid (look at <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka2">addNetworkAssociation()</a>) addNetworkAssociation("192.168.0.0", 0); addNetworkAssociation("192.168.1.0", 1); In this case if you send a message to AES with default nid, it'll be send to 192.168.0.x In this case if you send a message to LS with default nid, it'll be send to 192.168.1.y +<p> +Definition at line <a class="el" href="a06646.html#l00184">184</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +References <a class="el" href="a06646.html#l00478">_DefaultNetwork</a>, and <a class="el" href="a05622.html#l00111">nlinfo</a>. +<p> +<div class="fragment"><pre>00184 { <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: Add default network '%s'"</span>, defnet.c_str()); <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr2">_DefaultNetwork</a>.push_back (defnet); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd0" doxytag="NLNET::CUnifiedNetwork::addNamedCnx" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::addNamedCnx </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01700">1700</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06645.html#l00051">NLNET::allstuffs</a>, <a class="el" href="a06645.html#l00047">AUTOCHECK_DISPLAY</a>, <a class="el" href="a05646.html#l01126">range</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00653">addService()</a>, <a class="el" href="a06645.html#l00284">NLNET::uncbServiceIdentification()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. +<p> +<div class="fragment"><pre>01701 { +01702 <span class="comment">// check if not already inserted</span> +01703 CUnifiedNetwork::TNameMappedConnection::iterator it; +01704 pair<CUnifiedNetwork::TNameMappedConnection::iterator,CUnifiedNetwork::TNameMappedConnection::iterator> <a class="code" href="a04223.html#a655">range</a>; +01705 <a class="code" href="a04223.html#a655">range</a> = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.equal_range(name); +01706 +01707 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a655">range</a>.first != <a class="code" href="a04223.html#a655">range</a>.second) +01708 { +01709 <span class="keywordflow">for</span> (it=<a class="code" href="a04223.html#a655">range</a>.first; it!=<a class="code" href="a04223.html#a655">range</a>.second && (*it).second!=sid; ++it) +01710 ; +01711 +01712 <span class="keywordflow">if</span> (it != <a class="code" href="a04223.html#a655">range</a>.second) +01713 { +01714 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Try to add 2 times the same connection %s-%hu"</span>, name.c_str(), sid); +01715 <span class="keywordflow">return</span>; +01716 } +01717 } +01718 +01719 +01720 <span class="comment">// insert the name in the map to be able to send message with the name</span> +01721 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.insert(make_pair(name, sid)); +01722 +01723 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"+name "</span>+name+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>(sid)+<span class="stringliteral">"\n"</span>; +01724 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"+name %s-%hu"</span>, name.c_str (), sid); +01725 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka2" doxytag="NLNET::CUnifiedNetwork::addNetworkAssociation" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::addNetworkAssociation </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>networkName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Associate a string with a network id If the send don't set a specific nid, it ll use the 0, so be sure that the nid 0 is set to a network. You must call this function before the <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka7">connect()</a> function. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>networkName</em> </td><td>must be in a xxx.xxx.xxx.xxx format. The low value will be ignore depending of the network class. </td></tr> + <tr><td valign=top><em>nid</em> </td><td>a number (used as an index in a vector for constant access so numbers should be contiguous) that will be use to send to this network.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01759">1759</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00475">_NetworkAssociations</a>, <a class="el" href="a05810.html#l00527">NLNET::internalIPAddressToString()</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05810.html#l00522">NLNET::stringToInternalIPAddress()</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>01760 { +01761 <span class="keywordflow">if</span> (nid >= <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>.size ()) +01762 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>.resize (nid+1, 0xFF); +01763 +01764 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>[nid] = <a class="code" href="a05379.html#a139">stringToInternalIPAddress</a> (networkName); +01765 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: Associate network '%s' 0x%08x '%s' to nid %hu"</span>, networkName.c_str(), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>[nid], <a class="code" href="a05379.html#a140">internalIPAddressToString</a> (_NetworkAssociations[nid]).c_str(), (<a class="code" href="a04558.html#a9">uint16</a>)nid); +01766 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka3" doxytag="NLNET::CUnifiedNetwork::addService" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::addService </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>sendId</em> = true, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>external</em> = true, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em> = 0, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>autoRetry</em> = true, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>shouldBeAlreayInserted</em> = false</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l00653">653</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00478">_DefaultNetwork</a>, <a class="el" href="a06646.html#l00457">_ExtSId</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00475">_NetworkAssociations</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a06645.html#l01700">addNamedCnx()</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06645.html#l00051">NLNET::allstuffs</a>, <a class="el" href="a06645.html#l00047">AUTOCHECK_DISPLAY</a>, <a class="el" href="a06646.html#l00316">NLNET::CUnifiedNetwork::CUnifiedConnection::AutoRetry</a>, <a class="el" href="a06645.html#l01768">callServiceUpCallback()</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a06646.html#l00324">NLNET::CUnifiedNetwork::CUnifiedConnection::Connection</a>, <a class="el" href="a06646.html#l00322">NLNET::CUnifiedNetwork::CUnifiedConnection::ExtAddress</a>, <a class="el" href="a05524.html#l00272">NLNET::CCallbackClient::getSockId()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a06646.html#l00314">NLNET::CUnifiedNetwork::CUnifiedConnection::IsExternal</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05524.html#l00079">NLNET::CCallbackClient::send()</a>, <a class="el" href="a06646.html#l00318">NLNET::CUnifiedNetwork::CUnifiedConnection::SendId</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a06646.html#l00310">NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceId</a>, <a class="el" href="a06646.html#l00308">NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName</a>, <a class="el" href="a05515.html#l00060">NLNET::CBufSock::setAppId()</a>, <a class="el" href="a05527.html#l00110">NLNET::CCallbackNetBase::setDefaultCallback()</a>, <a class="el" href="a05525.html#l00080">NLNET::CCallbackClient::setDisconnectionCallback()</a>, <a class="el" href="a06646.html#l00374">NLNET::CUnifiedNetwork::CUnifiedConnection::setupNetworkAssociation()</a>, <a class="el" href="a06646.html#l00312">NLNET::CUnifiedNetwork::CUnifiedConnection::State</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06645.html#l00179">NLNET::uncbDisconnection()</a>, <a class="el" href="a06645.html#l00406">NLNET::uncbMsgProcessing()</a>, and <a class="el" href="a05810.html#l00509">NLNET::vectorCInetAddressToString()</a>. +<p> +<div class="fragment"><pre>00654 { +00655 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::addService() whereas it is not initialised yet"</span>)); +00656 +00657 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +00658 +00659 <span class="keywordflow">if</span> (external) +00660 sid = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr5">_ExtSId</a>++; +00661 +00662 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"HNETL5: addService %s-%hu '%s'"</span>, name.c_str(), sid, <a class="code" href="a05379.html#a138">vectorCInetAddressToString</a>(addr).c_str()); +00663 +00664 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"addService "</span>+name+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>(sid)+<span class="stringliteral">"\n"</span>; +00665 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"+service %s-%hu"</span>, name.c_str (), (<a class="code" href="a04558.html#a9">uint16</a>)sid); +00666 +00667 <span class="keywordflow">if</span> (external && <a class="code" href="a04223.html#a657">addr</a>.size () != 1) +00668 { +00669 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Can't add external service with more than one connection"</span>); +00670 } +00671 +00672 <span class="comment">// add the entry in the unified connection table</span> +00673 +00674 <span class="keywordflow">if</span> (sid >= <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size()) +00675 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.resize(sid+1); +00676 +00677 CUnifiedConnection *uc = &<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid]; +00678 +00679 <span class="comment">// at this point it s possible that the service already added in the _IdCnx by the uNetRegistrationBroadcast()</span> +00680 +00681 <span class="keywordflow">if</span> (shouldBeAlreayInserted && _IdCnx[sid].State == CUnifiedNetwork::CUnifiedConnection::NotUsed) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: the unified connection should already set by the naming reg broadcast and is not (%hu)"</span>, sid); +00682 <span class="keywordflow">if</span> (!shouldBeAlreayInserted && _IdCnx[sid].State == CUnifiedNetwork::CUnifiedConnection::Ready) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: the unified connection should not already set but is (%hu)"</span>, sid); +00683 +00684 <span class="keywordflow">if</span> (_IdCnx[sid].State == CUnifiedNetwork::CUnifiedConnection::NotUsed) +00685 { +00686 *uc = CUnifiedConnection(name, sid, external); +00687 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.push_back (sid); +00688 } +00689 <span class="keywordflow">else</span> +00690 { +00691 <span class="comment">// If the entry already set, check that all is correct</span> +00692 <span class="keywordflow">if</span> (name != uc->ServiceName) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: name are different in addService %s %s"</span>, name.c_str (), uc->ServiceName.c_str ()); +00693 <span class="keywordflow">if</span> (sid != uc->ServiceId) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: sid are different in addService %hu %hu"</span>, sid, uc->ServiceId); +00694 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a657">addr</a> != uc->ExtAddress) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: external addr are different in addService '%s' '%s'"</span>, <a class="code" href="a05379.html#a138">vectorCInetAddressToString</a>(addr).c_str(), <a class="code" href="a05379.html#a138">vectorCInetAddressToString</a>(uc->ExtAddress).c_str ()); +00695 } +00696 uc->AutoRetry = autoRetry; +00697 uc->SendId = sendId; +00698 uc->ExtAddress = <a class="code" href="a04223.html#a657">addr</a>; +00699 <a class="code" href="a04199.html#a6">nlassert</a> (!<a class="code" href="a04223.html#a657">addr</a>.empty()); +00700 +00701 <span class="comment">// associate nid with ext address</span> +00702 uc->setupNetworkAssociation (_NetworkAssociations, _DefaultNetwork); +00703 +00704 <span class="comment">// connect to all connection</span> +00705 <span class="keywordtype">bool</span> connectSuccess; +00706 +00707 <span class="keywordflow">if</span> (uc->Connection.size () < <a class="code" href="a04223.html#a657">addr</a>.size ()) +00708 { +00709 uc->Connection.resize (<a class="code" href="a04223.html#a657">addr</a>.size ()); +00710 } +00711 +00712 vector<CInetAddress> laddr = <a class="code" href="a02665.html#NLNET_1_1CInetAddresse0">CInetAddress::localAddresses</a>(); +00713 +00714 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i < <a class="code" href="a04223.html#a657">addr</a>.size(); i++) +00715 { +00716 <span class="comment">// first we have to look if we have a network that can established the connection</span> +00717 +00718 <a class="code" href="a04558.html#a15">uint</a> j = 0; +00719 <span class="comment">// it s 127.0.0.1, it s ok</span> +00720 <span class="keywordflow">if</span> (!<a class="code" href="a04223.html#a657">addr</a>[i].is127001 ()) +00721 { +00722 <span class="keywordflow">for</span> (j = 0; j < laddr.size (); j++) +00723 { +00724 <span class="keywordflow">if</span> (laddr[j].internalNetAddress () == <a class="code" href="a04223.html#a657">addr</a>[i].internalNetAddress ()) +00725 { +00726 <span class="comment">// it's ok, we can try</span> +00727 <span class="keywordflow">break</span>; +00728 } +00729 } +00730 +00731 <span class="comment">// If we don't found a valid network, we'll try with the first one.</span> +00732 <span class="comment">// It's happen, for example, when you try to connect to a service that is not in the network but use IP translation</span> +00733 <span class="keywordflow">if</span> (j == laddr.size ()) +00734 { +00735 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: I can't access '%s' because I haven't a net card on this network, we'll use the first network"</span>, addr[i].asString ().c_str ()); +00736 j = 0; +00737 } +00738 } +00739 +00740 <span class="comment">// create a new connection with the service, setup callback and connect</span> +00741 CCallbackClient *cbc = <span class="keyword">new</span> CCallbackClient(); +00742 cbc->setDisconnectionCallback(uncbDisconnection, NULL); +00743 cbc->setDefaultCallback(uncbMsgProcessing); +00744 cbc->getSockId()->setAppId(sid); +00745 +00746 <span class="keywordflow">try</span> +00747 { +00748 cbc->connect(addr[i]); +00749 connectSuccess = <span class="keyword">true</span>; +00750 +00751 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"+lconnect "</span>+name+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>(sid)+<span class="stringliteral">"\n"</span>; +00752 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"+lconnect %s-%hu"</span>, name.c_str (), (<a class="code" href="a04558.html#a9">uint16</a>)sid); +00753 } +00754 <span class="keywordflow">catch</span> (ESocketConnectionFailed &e) +00755 { +00756 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: can't connect to %s (sid %u) now (%s) '%s'"</span>, name.c_str(), sid, e.what (), <a class="code" href="a04223.html#a657">addr</a>[i].asString ().c_str()); +00757 connectSuccess = <span class="keyword">false</span>; +00758 +00759 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"+lconnect failed "</span>+name+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>((<a class="code" href="a04558.html#a9">uint16</a>)sid)+<span class="stringliteral">"\n"</span>; +00760 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"+lconnect failed %s-%hu"</span>, name.c_str (), (<a class="code" href="a04558.html#a9">uint16</a>)sid); +00761 } +00762 +00763 <span class="keywordflow">if</span> (!connectSuccess && !autoRetry) +00764 { +00765 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't add service because no retry and can't connect"</span>); +00766 <span class="keyword">delete</span> cbc; +00767 } +00768 <span class="keywordflow">else</span> +00769 { +00770 uc->Connection[i] = CUnifiedNetwork::CUnifiedConnection::TConnection(cbc); +00771 +00772 <span class="comment">// nlinfo ("HNETL5: %s", allstuffs.c_str ());</span> +00773 } +00774 +00775 <span class="keywordflow">if</span> (connectSuccess && sendId) +00776 { +00777 <span class="comment">// send identification to the service</span> +00778 <a class="code" href="a02918.html">CMessage</a> msg(<span class="stringliteral">"UN_SIDENT"</span>); +00779 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(_Name); +00780 <a class="code" href="a04558.html#a9">uint16</a> ssid = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a>; +00781 <span class="keywordflow">if</span> (uc->IsExternal) +00782 { +00783 <span class="comment">// in the case that the service is external, we can't send our sid because the external service can</span> +00784 <span class="comment">// have other connectin with the same sid (for example, LS can have 2 WS with same sid => sid = 0 and leave</span> +00785 <span class="comment">// the other side to find a good number</span> +00786 ssid = 0; +00787 } +00788 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(ssid); <span class="comment">// serializes a 16 bits service id</span> +00789 <a class="code" href="a04558.html#a7">uint8</a> pos = j; +00790 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(pos); <span class="comment">// send the position in the connection table</span> +00791 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (uc->IsExternal); +00792 cbc->send (msg); +00793 } +00794 } +00795 +00796 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a657">addr</a>.size () != uc->Connection.size()) +00797 { +00798 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't connect to all connections to the service %d/%d"</span>, <a class="code" href="a04223.html#a657">addr</a>.size (), uc->Connection.size()); +00799 } +00800 +00801 <span class="keywordtype">bool</span> cntok = <span class="keyword">false</span>; +00802 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j = 0; j < uc->Connection.size(); j++) +00803 { +00804 <span class="keywordflow">if</span> (uc->Connection[j].CbNetBase != NULL) +00805 { +00806 <span class="keywordflow">if</span> (uc->Connection[j].CbNetBase->connected ()) +00807 { +00808 cntok = <span class="keyword">true</span>; +00809 <span class="keywordflow">break</span>; +00810 } +00811 } +00812 } +00813 +00814 <span class="keywordflow">if</span> (cntok) +00815 { +00816 <span class="comment">// add the name only if at least one connection is ok</span> +00817 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd0">addNamedCnx</a> (name, sid); +00818 +00819 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd3">callServiceUpCallback</a> (name, sid, !external); +00820 +00821 <span class="comment">/* </span> +00822 <span class="comment"> // call the connection callback associated to this service</span> +00823 <span class="comment"> TNameMappedCallback::iterator itcb = _UpCallbacks.find(name);</span> +00824 <span class="comment"> if (itcb != _UpCallbacks.end())</span> +00825 <span class="comment"> {</span> +00826 <span class="comment"> for (list<TCallbackArgItem> it2 = (*itcb).second.begin(); it2 != (*itcb).second.end(); it2++)</span> +00827 <span class="comment"> { </span> +00828 <span class="comment"> TUnifiedNetCallback cb = (*it2).first;</span> +00829 <span class="comment"> if (cb) cb(name, sid, (*it2).second);</span> +00830 <span class="comment"> }</span> +00831 <span class="comment"> }</span> +00832 <span class="comment"></span> +00833 <span class="comment"> if (!external)</span> +00834 <span class="comment"> {</span> +00835 <span class="comment"> for (uint i = 0; i < _UpUniCallback.size (); i++)</span> +00836 <span class="comment"> {</span> +00837 <span class="comment"> if (_UpUniCallback[i].first != NULL)</span> +00838 <span class="comment"> _UpUniCallback[i].first (name, sid, _UpUniCallback[i].second);</span> +00839 <span class="comment"> }</span> +00840 <span class="comment"> }</span> +00841 <span class="comment">*/</span> } +00842 +00843 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL5: addService was successful"</span>); +00844 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka4" doxytag="NLNET::CUnifiedNetwork::addService" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::addService </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>sendId</em> = true, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>external</em> = true, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em> = 0, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>autoRetry</em> = true, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>shouldBeAlreayInserted</em> = false</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Adds a specific service to the list of connected services. +<p> +Definition at line <a class="el" href="a06645.html#l00646">646</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01127">addr</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00566">connect()</a>. +<p> +<div class="fragment"><pre>00647 { +00648 vector <CInetAddress> addrs; +00649 addrs.push_back (addr); +00650 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworka4">addService</a> (name, addrs, sendId, external, sid, autoRetry, shouldBeAlreayInserted); +00651 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd1" doxytag="NLNET::CUnifiedNetwork::autoCheck" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::autoCheck </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01517">1517</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06646.html#l00475">_NetworkAssociations</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a06645.html#l00047">AUTOCHECK_DISPLAY</a>, <a class="el" href="a05788.html#l00056">H_AUTO</a>, <a class="el" href="a05981.html#l00107">NL_I64</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00857">update()</a>. +<p> +<div class="fragment"><pre>01518 { +01519 <a class="code" href="a04365.html#a4">H_AUTO</a>(L5UpdateAutoCheck); +01520 <a class="code" href="a04558.html#a15">uint</a> i, j; +01521 +01522 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size (); i++) +01523 { +01524 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01525 { +01526 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].AutoCheck = 1; +01527 } +01528 <span class="keywordflow">else</span> +01529 { +01530 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].AutoCheck = 0; +01531 } +01532 } +01533 +01534 TNameMappedConnection::iterator itn; +01535 <span class="keywordflow">for</span> (itn = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.begin(); itn != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.end(); ++itn) +01536 { +01537 <span class="keywordflow">if</span> ((*itn).first != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].ServiceName) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: problem with name syncro between _NameCnx and _IdCnx '%s' '%s' '%d'"</span>, (*itn).first.c_str(), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].ServiceName.c_str (), (*itn).second); +01538 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].AutoCheck == 0) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: problem with name syncro between _NameCnx '%s' and _IdCnx '%s' '%d'"</span>, (*itn).first.c_str(), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].ServiceName.c_str (), (*itn).second); +01539 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].AutoCheck > 1) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: problem with name syncro between _NameCnx and _IdCnx '%s' '%d' more than one entry in named with the same name"</span>, (*itn).first.c_str(), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].ServiceName.c_str (),(*itn).second); +01540 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itn).second].AutoCheck++; +01541 } +01542 +01543 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.size (); i++) +01544 { +01545 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>[i]].State != CUnifiedNetwork::CUnifiedConnection::Ready) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: problem with the _UsedConnection syncro sid %d is not used in _IdCnx"</span>, _UsedConnection[i]); +01546 } +01547 +01548 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size (); i++) +01549 { +01550 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01551 { +01552 <span class="keywordflow">for</span> (j = 0; j < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.size (); j++) +01553 { +01554 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>[j] == i) <span class="keywordflow">break</span>; +01555 } +01556 <span class="keywordflow">if</span> (j == <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.size ()) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: problem with the _UsedConnection syncro sid %d is not in _UsedConnection"</span>, i); +01557 } +01558 } +01559 +01560 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size (); i++) +01561 { +01562 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State == CUnifiedNetwork::CUnifiedConnection::NotUsed) +01563 { +01564 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ServiceName != <span class="stringliteral">"DEAD"</span>) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d name should be DEAD and is '%s'"</span>, i, _IdCnx[i].ServiceName.c_str ()); +01565 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ServiceId != 0xDEAD) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d sid should be 0xDEAD and is 0x%X"</span>, i, _IdCnx[i].ServiceId); +01566 <span class="keywordflow">if</span> (!<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection.empty ()) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d connection size should be 0 and is %d"</span>, i, _IdCnx[i].Connection.size ()); +01567 <span class="keywordflow">if</span> (!<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ExtAddress.empty ()) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d ext addr size should be 0 and is %d"</span>, i, _IdCnx[i].ExtAddress.size ()); +01568 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].AutoCheck != 0) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d prob with syncro with _NamedCnx"</span>, i); +01569 } +01570 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01571 { +01572 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ServiceId != i) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Bad syncro sid index sid entry for %d %d"</span>, i, _IdCnx[i].ServiceId); +01573 +01574 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ServiceName == <span class="stringliteral">"DEAD"</span>) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d name should not be DEAD and is '%s'"</span>, i, _IdCnx[i].ServiceName.c_str ()); +01575 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ServiceId == 0xDEAD) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d sid should not be 0xDEAD and is 0x%X"</span>, i, _IdCnx[i].ServiceId); +01576 <span class="keywordflow">if</span> (!<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ExtAddress.empty () && <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection.size () > <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].ExtAddress.size()) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d ext addr size should not be 0 and is %d"</span>, i, _IdCnx[i].ExtAddress.size ()); +01577 +01578 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].AutoRetry == <span class="keyword">true</span> && <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection.size () > 1) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d auto retry with more than one connection %d"</span>, i, _IdCnx[i].Connection.size ()); +01579 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].AutoRetry == <span class="keyword">true</span> && <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].IsExternal == <span class="keyword">false</span>) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d auto retry with internal connection"</span>, i); +01580 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].AutoRetry == <span class="keyword">true</span> && <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection[0].valid() == <span class="keyword">false</span>) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d auto retry with invalid connection"</span>, i); +01581 +01582 <span class="keywordflow">for</span> (j = 0; j < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection.size (); j++) +01583 { +01584 <span class="keywordflow">if</span> (_IdCnx[i].Connection[j].valid() && !_IdCnx[i].Connection[j].IsServerConnection && _IdCnx[i].Connection[j].CbNetBase->connected () && _IdCnx[i].Connection[j].getAppId() != i) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d bad appid %"</span>NL_I64<span class="stringliteral">"X"</span>, i, _IdCnx[i].Connection[j].getAppId()); +01585 } +01586 +01587 <span class="keywordflow">for</span> (j = 0; j < _IdCnx[i].NetworkConnectionAssociations.size (); j++) +01588 { +01589 <span class="keywordflow">if</span> (_IdCnx[i].NetworkConnectionAssociations[j] != 0) +01590 { +01591 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>[j] != _IdCnx[i].ExtAddress[_IdCnx[i].NetworkConnectionAssociations[j]].internalNetAddress ()) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HLNET5: sid %d nid %d have address 0x%08x and is not the good connection net 0x%08x"</span>, i, j, _NetworkAssociations[j], _IdCnx[i].ExtAddress[_IdCnx[i].NetworkConnectionAssociations[j]].internalNetAddress ()); +01592 } +01593 } +01594 } +01595 } +01596 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd2" doxytag="NLNET::CUnifiedNetwork::callServiceDownCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::callServiceDownCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>callGlobalCallback</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01797">1797</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00441">_DownCallbacks</a>, <a class="el" href="a06646.html#l00442">_DownUniCallback</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06646.html#l00045">NLNET::TUnifiedNetCallback</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00179">NLNET::uncbDisconnection()</a>, and <a class="el" href="a06645.html#l00100">NLNET::uNetUnregistrationBroadcast()</a>. +<p> +<div class="fragment"><pre>01798 { +01799 <span class="comment">// now we warn the user</span> +01800 CUnifiedNetwork::TNameMappedCallback::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">_DownCallbacks</a>.find(serviceName); +01801 <span class="keywordflow">if</span> (it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">_DownCallbacks</a>.end()) +01802 { +01803 <span class="comment">// call it</span> +01804 <span class="keywordflow">for</span> (<a class="code" href="a03889.html">list<TCallbackArgItem></a>::iterator it2 = (*it).second.begin(); it2 != (*it).second.end(); it2++) +01805 { +01806 <a class="code" href="a05379.html#a97">TUnifiedNetCallback</a> cb = (*it2).first; +01807 <span class="keywordflow">if</span> (cb) +01808 cb(serviceName, sid, (*it2).second); +01809 <span class="keywordflow">else</span> +01810 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: User set an empty callback for '%s' service down"</span>, serviceName.c_str()); +01811 } +01812 } +01813 +01814 <span class="keywordflow">if</span>(callGlobalCallback) +01815 { +01816 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> c = 0; c < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a>.size (); c++) +01817 { +01818 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a>[c].first != NULL) +01819 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a>[c].first (serviceName, sid, _DownUniCallback[c].second); +01820 <span class="keywordflow">else</span> +01821 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: User set an empty callback for '*' service down"</span>); +01822 } +01823 } +01824 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd3" doxytag="NLNET::CUnifiedNetwork::callServiceUpCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::callServiceUpCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>callGlobalCallback</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01768">1768</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00439">_UpCallbacks</a>, <a class="el" href="a06646.html#l00440">_UpUniCallback</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06646.html#l00045">NLNET::TUnifiedNetCallback</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00653">addService()</a>, <a class="el" href="a06645.html#l00284">NLNET::uncbServiceIdentification()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. +<p> +<div class="fragment"><pre>01769 { +01770 <span class="comment">// now we warn the user</span> +01771 CUnifiedNetwork::TNameMappedCallback::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">_UpCallbacks</a>.find(serviceName); +01772 <span class="keywordflow">if</span> (it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">_UpCallbacks</a>.end()) +01773 { +01774 <span class="comment">// call it</span> +01775 <span class="keywordflow">for</span> (<a class="code" href="a03889.html">list<TCallbackArgItem></a>::iterator it2 = (*it).second.begin(); it2 != (*it).second.end(); it2++) +01776 { +01777 <a class="code" href="a05379.html#a97">TUnifiedNetCallback</a> cb = (*it2).first; +01778 <span class="keywordflow">if</span> (cb) +01779 cb(serviceName, sid, (*it2).second); +01780 <span class="keywordflow">else</span> +01781 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: User set an empty callback for '%s' service up"</span>, serviceName.c_str()); +01782 } +01783 } +01784 +01785 <span class="keywordflow">if</span>(callGlobalCallback) +01786 { +01787 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> c = 0; c < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a>.size (); c++) +01788 { +01789 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a>[c].first != NULL) +01790 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a>[c].first (serviceName, sid, _UpUniCallback[c].second); +01791 <span class="keywordflow">else</span> +01792 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: User set an empty callback for '*' service up"</span>); +01793 } +01794 } +01795 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka5" doxytag="NLNET::CUnifiedNetwork::clearDefaultNetwork" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::clearDefaultNetwork </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Clear all default network. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00187">187</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +References <a class="el" href="a06646.html#l00478">_DefaultNetwork</a>. +<p> +<div class="fragment"><pre>00187 { <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr2">_DefaultNetwork</a>.clear (); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka6" doxytag="NLNET::CUnifiedNetwork::clearNetworkAssociation" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::clearNetworkAssociation </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Clear all network association +<p> +Definition at line <a class="el" href="a06646.html#l00175">175</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +References <a class="el" href="a06646.html#l00475">_NetworkAssociations</a>. +<p> +<div class="fragment"><pre>00175 { <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>.clear (); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka7" doxytag="NLNET::CUnifiedNetwork::connect" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::connect </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Registers to the Naming Service, and connects to the present services +<p> +Definition at line <a class="el" href="a06645.html#l00566">566</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06645.html#l00646">addService()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>. +<p> +<div class="fragment"><pre>00567 { +00568 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::connect() whereas it is not initialised yet"</span>)); +00569 +00570 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +00571 +00572 +00573 <span class="keywordflow">if</span> (CNamingClient::connected()) +00574 { +00575 <span class="comment">// get the services list</span> +00576 <span class="keyword">const</span> <a class="code" href="a03889.html">list<CNamingClient::CServiceEntry></a> &services = CNamingClient::getRegisteredServices(); +00577 +00578 <span class="comment">// connects to the registered services</span> +00579 <a class="code" href="a03889.html">list<CNamingClient::CServiceEntry></a>::const_iterator its; +00580 +00581 <span class="comment">// don't connect to itself</span> +00582 <span class="keywordflow">for</span> (its = services.begin(); its != services.end(); ++its) +00583 { +00584 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a> != (*its).SId) +00585 { +00586 <span class="comment">// add service with name, address, ident, not external, service id, and not autoretry (obsolete)</span> +00587 <span class="comment">// we put the last true because the name callback should already inserted it by uNetRegistrationBroadcast()</span> +00588 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworka4">addService</a>((*its).Name, (*its).Addr, <span class="keyword">true</span>, <span class="keyword">false</span>, (*its).SId, <span class="keyword">false</span>, <span class="keyword">true</span>); +00589 } +00590 <span class="keywordflow">else</span> +00591 { +00592 <span class="comment">// don't process services received after mine because they'll connect to me</span> +00593 <span class="keywordflow">break</span>; +00594 } +00595 } +00596 } +00597 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka8" doxytag="NLNET::CUnifiedNetwork::displayInternalTables" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::displayInternalTables </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02813.html">NLMISC::CLog</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>log</em> = <a class="el" href="a05378.html#a12">NLMISC::InfoLog</a> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01599">1599</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06646.html#l00475">_NetworkAssociations</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a05943.html#l00323">NLMISC::CLog::displayNL()</a>, <a class="el" href="a05810.html#l00527">NLNET::internalIPAddressToString()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l02121">NLNET::NLMISC_COMMAND()</a>. +<p> +<div class="fragment"><pre>01600 { +01601 <a class="code" href="a04558.html#a15">uint</a> i, j; +01602 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"%d Named Connections:"</span>, <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.size ()); +01603 <span class="keywordflow">for</span> (TNameMappedConnection::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.begin(); it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.end (); it++) +01604 { +01605 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"> '%s' -> %hu"</span>, (*it).first.c_str(), (*it).second); +01606 } +01607 +01608 <a class="code" href="a04558.html#a15">uint</a> nbused = 0; +01609 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size (); i++) +01610 { +01611 <span class="keywordflow">if</span>(<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State != CUnifiedNetwork::CUnifiedConnection::NotUsed) +01612 nbused++; +01613 } +01614 +01615 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"%u/%u Unified Connections:"</span>, nbused, <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size ()); +01616 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size (); i++) +01617 { +01618 <span class="keywordflow">if</span>(<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State != CUnifiedNetwork::CUnifiedConnection::NotUsed) +01619 { +01620 <span class="comment">/* log->displayNL ("> %s-%hu %s %s %s (%d extaddr %d cnx) tcbc %d", _IdCnx[i].ServiceName.c_str (), _IdCnx[i].ServiceId, _IdCnx[i].IsExternal?"ext":"int", _IdCnx[i].AutoRetry?"autoretry":"noautoretry", _IdCnx[i].SendId?"sendid":"nosendid", _IdCnx[i].ExtAddress.size (), _IdCnx[i].Connection.size (), _IdCnx[i].TotalCallbackCalled);</span> +01621 <span class="comment"> uint maxc = _IdCnx[i].Connection.size ();</span> +01622 <span class="comment"> if(_IdCnx[i].Connection.size () <= _IdCnx[i].ExtAddress.size ())</span> +01623 <span class="comment"> maxc = _IdCnx[i].ExtAddress.size ();</span> +01624 <span class="comment"></span> +01625 <span class="comment"> for (j = 0; j < maxc; j++)</span> +01626 <span class="comment"> {</span> +01627 <span class="comment"> string base;</span> +01628 <span class="comment"> if(j < _IdCnx[i].ExtAddress.size ())</span> +01629 <span class="comment"> {</span> +01630 <span class="comment"> base += _IdCnx[i].ExtAddress[j].asString ();</span> +01631 <span class="comment"> }</span> +01632 <span class="comment"> else</span> +01633 <span class="comment"> {</span> +01634 <span class="comment"> base += "notvalid";</span> +01635 <span class="comment"> }</span> +01636 <span class="comment"></span> +01637 <span class="comment"> string ext;</span> +01638 <span class="comment"> if(j < _IdCnx[i].Connection.size () && _IdCnx[i].Connection[j].valid())</span> +01639 <span class="comment"> {</span> +01640 <span class="comment"> if(_IdCnx[i].Connection[j].IsServerConnection)</span> +01641 <span class="comment"> {</span> +01642 <span class="comment"> ext += "server ";</span> +01643 <span class="comment"> }</span> +01644 <span class="comment"> else</span> +01645 <span class="comment"> {</span> +01646 <span class="comment"> ext += "client ";</span> +01647 <span class="comment"> }</span> +01648 <span class="comment"> ext += _IdCnx[i].Connection[j].CbNetBase->getSockId (_IdCnx[i].Connection[j].HostId)->asString ();</span> +01649 <span class="comment"> ext += " appid:" + toString(_IdCnx[i].Connection[j].getAppId());</span> +01650 <span class="comment"> if (_IdCnx[i].Connection[j].CbNetBase->connected ())</span> +01651 <span class="comment"> ext += " connected";</span> +01652 <span class="comment"> else</span> +01653 <span class="comment"> ext += " notconnected";</span> +01654 <span class="comment"> }</span> +01655 <span class="comment"> else</span> +01656 <span class="comment"> {</span> +01657 <span class="comment"> ext += "notvalid";</span> +01658 <span class="comment"> }</span> +01659 <span class="comment"></span> +01660 <span class="comment"> log->displayNL (" - %s %s", base.c_str (), ext.c_str ());</span> +01661 <span class="comment"> }*/</span> +01662 +01663 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].display (<span class="keyword">false</span>, log); +01664 <span class="keywordflow">for</span> (j = 0; j < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].NetworkConnectionAssociations.size (); j++) +01665 { +01666 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">" * nid %d -> cnxn %hu"</span>, j, (<a class="code" href="a04558.html#a9">uint16</a>)_IdCnx[i].NetworkConnectionAssociations[j]); +01667 } +01668 } +01669 } +01670 +01671 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"%u Used Unified Connections:"</span>, <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.size()); +01672 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.size (); i++) +01673 { +01674 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"> %hu"</span>, _UsedConnection[i]); +01675 } +01676 +01677 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"%u Network Associations:"</span>, <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>.size()); +01678 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">_NetworkAssociations</a>.size (); i++) +01679 { +01680 log-><a class="code" href="a02813.html#NLNET_1_1CNetLoga7">displayNL</a> (<span class="stringliteral">"> 0x%08x -> '%s'"</span>, _NetworkAssociations[i], internalIPAddressToString (_NetworkAssociations[i]).c_str ()); +01681 } +01682 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka9" doxytag="NLNET::CUnifiedNetwork::displayUnifiedConnection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::displayUnifiedConnection </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02813.html">NLMISC::CLog</a> * </td> + <td class="mdname" nowrap> <em>log</em> = <a class="el" href="a05378.html#a12">NLMISC::InfoLog</a></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00231">231</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +References <a class="el" href="a06645.html#l01826">NLNET::CUnifiedNetwork::CUnifiedConnection::display()</a>, <a class="el" href="a06645.html#l01498">getUnifiedConnection()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>00232 { +00233 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd6">getUnifiedConnection</a>(sid)-><a class="code" href="a03633.html#NLNET_1_1CUnifiedNetwork_1_1CUnifiedConnectiona3">display</a>(<span class="keyword">false</span>, log); +00234 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka10" doxytag="NLNET::CUnifiedNetwork::findCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05379.html#a98">TUnifiedMsgCallback</a> NLNET::CUnifiedNetwork::findCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>callbackName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Find a callback in the array. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01393">1393</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00454">_Callbacks</a>, and <a class="el" href="a06646.html#l00052">NLNET::TUnifiedMsgCallback</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01983">NLNET::NLMISC_COMMAND()</a>. +<p> +<div class="fragment"><pre>01394 { +01395 TMsgMappedCallback::iterator itcb = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr0">_Callbacks</a>.find(callbackName); +01396 <span class="keywordflow">if</span> (itcb == <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr0">_Callbacks</a>.end()) +01397 <span class="keywordflow">return</span> NULL; +01398 <span class="keywordflow">else</span> +01399 <span class="keywordflow">return</span> (*itcb).second; +01400 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd5" doxytag="NLNET::CUnifiedNetwork::findConnectionId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> NLNET::CUnifiedNetwork::findConnectionId </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01030">1030</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01335">getNetBase()</a>, <a class="el" href="a06645.html#l01091">send()</a>, and <a class="el" href="a06645.html#l01160">sendAll()</a>. +<p> +<div class="fragment"><pre>01031 { +01032 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].Connection.size () == 0) +01033 { +01034 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send message to %s because no connection are available"</span>, _IdCnx[sid].ServiceName.c_str ()); +01035 <span class="keywordflow">return</span> 0xFF; +01036 } +01037 +01038 <span class="comment">// by default, connection id will be the default one</span> +01039 <a class="code" href="a04558.html#a7">uint8</a> connectionId = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].DefaultNetwork; +01040 +01041 <span class="keywordflow">if</span> (nid == 0xFF) +01042 { +01043 <span class="comment">// it s often appen because they didn't set a good network configuration, so it s in debug to disable it easily</span> +01044 <span class="comment">//nldebug ("HNETL5: nid %hu, will use the default connection %hu", (uint16)nid, (uint16)connectionId);</span> +01045 } +01046 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nid >= _IdCnx[sid].NetworkConnectionAssociations.size()) +01047 { +01048 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: No net association for nid %hu, use the default connection %hu"</span>, (<a class="code" href="a04558.html#a9">uint16</a>)nid, (<a class="code" href="a04558.html#a9">uint16</a>)connectionId); +01049 } +01050 <span class="keywordflow">else</span> +01051 { +01052 <span class="keywordflow">if</span> (_IdCnx[sid].NetworkConnectionAssociations[nid] >= _IdCnx[sid].Connection.size ()) +01053 { +01054 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send message to %s because nid %d point on a bad connection (%d and only have %d cnx), use default connection"</span>, _IdCnx[sid].ServiceName.c_str (), nid, connectionId, _IdCnx[sid].Connection.size ()); +01055 } +01056 <span class="keywordflow">else</span> +01057 { +01058 connectionId = _IdCnx[sid].NetworkConnectionAssociations[nid]; +01059 } +01060 } +01061 +01062 <span class="keywordflow">if</span> (connectionId >= _IdCnx[sid].Connection.size() || !_IdCnx[sid].Connection[connectionId].valid() || !_IdCnx[sid].Connection[connectionId].CbNetBase->connected()) +01063 { +01064 <span class="comment">// there's a problem with the selected connectionID, so try to find a valid one</span> +01065 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't find selected connection id %hu to send message to %s because connection is not valid or connected, find a valid connection id"</span>, (<a class="code" href="a04558.html#a9">uint16</a>)connectionId, _IdCnx[sid].ServiceName.c_str ()); +01066 +01067 <span class="keywordflow">for</span> (connectionId = 0; connectionId < _IdCnx[sid].Connection.size(); connectionId++) +01068 { +01069 <span class="keywordflow">if</span> (_IdCnx[sid].Connection[connectionId].valid() && _IdCnx[sid].Connection[connectionId].CbNetBase->connected()) +01070 { +01071 <span class="comment">// we found one at last, use this one</span> +01072 <span class="comment">//nldebug ("HNETL5: Ok, we found a valid connectionid, use %hu", (uint16)connectionId);</span> +01073 <span class="keywordflow">break</span>; +01074 } +01075 } +01076 +01077 <span class="keywordflow">if</span> (connectionId == _IdCnx[sid].Connection.size()) +01078 { +01079 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send message to %s because default connection is not exist, valid or connected"</span>, _IdCnx[sid].ServiceName.c_str ()); +01080 <span class="keywordflow">return</span> 0xFF; +01081 } +01082 } +01083 <span class="keywordflow">return</span> connectionId; +01084 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka11" doxytag="NLNET::CUnifiedNetwork::getBytesReceived" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CUnifiedNetwork::getBytesReceived </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gets the total number of bytes received. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01263">1263</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a05527.html#l00088">NLNET::CCallbackNetBase::getBytesReceived()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01947">NLNET::NLMISC_DYNVARIABLE()</a>. +<p> +<div class="fragment"><pre>01264 { +01265 <a class="code" href="a04558.html#a13">uint64</a> received = 0; +01266 <a class="code" href="a04558.html#a15">uint</a> j; +01267 +01268 <span class="keywordflow">for</span> (vector<uint16>::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.begin (); it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.end(); it++) +01269 { +01270 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01271 <span class="keywordflow">for</span> (j=0; j<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].Connection.size (); ++j) +01272 <span class="keywordflow">if</span>(_IdCnx[(*it)].Connection[j].valid () && !_IdCnx[(*it)].Connection[j].IsServerConnection) +01273 received += _IdCnx[(*it)].Connection[j].CbNetBase->getBytesReceived(); +01274 } +01275 +01276 <span class="comment">/* for (i=0; i<_IdCnx.size(); ++i)</span> +01277 <span class="comment"> if (_IdCnx[i].State == CUnifiedNetwork::CUnifiedConnection::Ready)</span> +01278 <span class="comment"> for (j=0; j<_IdCnx[i].Connection.size (); ++j)</span> +01279 <span class="comment"> if(_IdCnx[i].Connection[j].valid () && !_IdCnx[i].Connection[j].IsServerConnection)</span> +01280 <span class="comment"> received += _IdCnx[i].Connection[j].CbNetBase->getBytesReceived();</span> +01281 <span class="comment">*/</span> +01282 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>) +01283 received += <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->getBytesReceived(); +01284 <span class="keywordflow">return</span> received; +01285 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka12" doxytag="NLNET::CUnifiedNetwork::getBytesSent" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CUnifiedNetwork::getBytesSent </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gets the total number of bytes sent. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01239">1239</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a05527.html#l00087">NLNET::CCallbackNetBase::getBytesSent()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01958">NLNET::NLMISC_DYNVARIABLE()</a>. +<p> +<div class="fragment"><pre>01240 { +01241 <a class="code" href="a04558.html#a13">uint64</a> sent = 0; +01242 <a class="code" href="a04558.html#a15">uint</a> j; +01243 +01244 <span class="keywordflow">for</span> (vector<uint16>::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.begin (); it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.end(); it++) +01245 { +01246 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01247 <span class="keywordflow">for</span> (j=0; j<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].Connection.size (); ++j) +01248 <span class="keywordflow">if</span>(_IdCnx[(*it)].Connection[j].valid () && !_IdCnx[(*it)].Connection[j].IsServerConnection) +01249 sent += _IdCnx[(*it)].Connection[j].CbNetBase->getBytesSent(); +01250 } +01251 +01252 <span class="comment">/* for (i=0; i<_IdCnx.size(); ++i)</span> +01253 <span class="comment"> if (_IdCnx[i].State == CUnifiedNetwork::CUnifiedConnection::Ready)</span> +01254 <span class="comment"> for (j=0; j<_IdCnx[i].Connection.size (); ++j)</span> +01255 <span class="comment"> if(_IdCnx[i].Connection[j].valid () && !_IdCnx[i].Connection[j].IsServerConnection)</span> +01256 <span class="comment"> sent += _IdCnx[i].Connection[j].CbNetBase->getBytesSent();</span> +01257 <span class="comment">*/</span> +01258 <span class="keywordflow">if</span>(<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>) +01259 sent += <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->getBytesSent(); +01260 <span class="keywordflow">return</span> sent; +01261 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka13" doxytag="NLNET::CUnifiedNetwork::getConnectionList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const std::vector<<a class="el" href="a04558.html#a9">uint16</a>>& NLNET::CUnifiedNetwork::getConnectionList </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the service ids of the active connections. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00227">227</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +References <a class="el" href="a06646.html#l00427">_UsedConnection</a>. +<p> +<div class="fragment"><pre>00227 { <span class="keywordflow">return</span> <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>; } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworke0" doxytag="NLNET::CUnifiedNetwork::getInstance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03632.html">CUnifiedNetwork</a> * NLNET::CUnifiedNetwork::getInstance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns the singleton instance of the <a class="el" href="a03632.html">CUnifiedNetwork</a> class. +<p> +Definition at line <a class="el" href="a06645.html#l01481">1481</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00481">CUnifiedNetwork()</a>. +<p> +Referenced by <a class="el" href="a06364.html#l00419">NLNET::IService::main()</a>. +<p> +<div class="fragment"><pre>01482 { +01483 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkv0">_Instance</a> == NULL) +01484 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkv0">_Instance</a> = <span class="keyword">new</span> <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd4">CUnifiedNetwork</a>(); +01485 +01486 <span class="keywordflow">return</span> <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkv0">_Instance</a>; +01487 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka14" doxytag="NLNET::CUnifiedNetwork::getNetBase" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02306.html">CCallbackNetBase</a> * NLNET::CUnifiedNetwork::getNetBase </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> & </td> + <td class="mdname" nowrap> <em>host</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em> = 0xFF</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gets the <a class="el" href="a02306.html">CCallbackNetBase</a> of the service. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01368">1368</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06645.html#l01030">findConnectionId()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a05511.html#l00042">NLNET::TSockId</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>01369 { +01370 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::getNetBase() whereas it is not initialised yet"</span>)); +01371 +01372 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +01373 +01374 <span class="keywordflow">if</span> (sid >= <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size () || <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].State != CUnifiedNetwork::CUnifiedConnection::Ready) +01375 { +01376 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't get net base to the service '%hu' because not in _IdCnx"</span>, sid); +01377 host = InvalidSockId; +01378 <span class="keywordflow">return</span> NULL; +01379 } +01380 +01381 <a class="code" href="a04558.html#a7">uint8</a> connectionId = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd5">findConnectionId</a> (sid, nid); +01382 <span class="keywordflow">if</span> (connectionId == 0xff) <span class="comment">// failed</span> +01383 { +01384 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't getNetBase %hu because no connection available"</span>, sid); +01385 host = InvalidSockId; +01386 <span class="keywordflow">return</span> NULL; +01387 } +01388 +01389 host = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].Connection[connectionId].HostId; +01390 <span class="keywordflow">return</span> _IdCnx[sid].Connection[connectionId].CbNetBase; +01391 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka15" doxytag="NLNET::CUnifiedNetwork::getNetBase" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02306.html">CCallbackNetBase</a> * NLNET::CUnifiedNetwork::getNetBase </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> & </td> + <td class="mdname" nowrap> <em>host</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em> = 0xFF</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gets the <a class="el" href="a02306.html">CCallbackNetBase</a> of the service. +<p> +<dl compact><dt><b>Warning:</b></dt><dd>You should not use getNetBase functions because it could have more than one connection to a service and in this case it ll return the first connection </dd></dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01335">1335</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a05646.html#l00240">count</a>, <a class="el" href="a06645.html#l01030">findConnectionId()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a05511.html#l00042">NLNET::TSockId</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06645.html#l02048">NLNET::NLMISC_COMMAND()</a>. +<p> +<div class="fragment"><pre>01336 { +01337 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::getNetBase() whereas it is not initialised yet"</span>)); +01338 +01339 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +01340 +01341 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a577">count</a> = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.count(name); +01342 +01343 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a577">count</a> <= 0) +01344 { +01345 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: couldn't access the service %s"</span>, name.c_str()); +01346 host = InvalidSockId; +01347 <span class="keywordflow">return</span> NULL; +01348 } +01349 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a577">count</a> > 1) +01350 { +01351 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: %d services %s to getNetBase, returns the first valid"</span>, count, name.c_str()); +01352 } +01353 +01354 TNameMappedConnection::const_iterator itnmc = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.find(name); +01355 +01356 <a class="code" href="a04558.html#a7">uint8</a> connectionId = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd5">findConnectionId</a> ((*itnmc).second, nid); +01357 <span class="keywordflow">if</span> (connectionId == 0xff) <span class="comment">// failed</span> +01358 { +01359 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't getNetBase %s because no connection available"</span>, name.c_str()); +01360 host = InvalidSockId; +01361 <span class="keywordflow">return</span> NULL; +01362 } +01363 +01364 host = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*itnmc).second].Connection[connectionId].HostId; +01365 <span class="keywordflow">return</span> _IdCnx[(*itnmc).second].Connection[connectionId].CbNetBase; +01366 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka16" doxytag="NLNET::CUnifiedNetwork::getReceiveQueueSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CUnifiedNetwork::getReceiveQueueSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gets the total number of bytes queued after receiving. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01311">1311</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a05529.html#l00082">NLNET::CCallbackServer::getReceiveQueueSize()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01935">NLNET::NLMISC_DYNVARIABLE()</a>. +<p> +<div class="fragment"><pre>01312 { +01313 <a class="code" href="a04558.html#a13">uint64</a> received = 0; +01314 <a class="code" href="a04558.html#a15">uint</a> j; +01315 +01316 <span class="keywordflow">for</span> (vector<uint16>::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.begin (); it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.end(); it++) +01317 { +01318 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01319 <span class="keywordflow">for</span> (j=0; j<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].Connection.size (); ++j) +01320 <span class="keywordflow">if</span>(_IdCnx[(*it)].Connection[j].valid () && !_IdCnx[(*it)].Connection[j].IsServerConnection) +01321 received += _IdCnx[(*it)].Connection[j].CbNetBase->getReceiveQueueSize(); +01322 } +01323 +01324 <span class="comment">/* for (i=0; i<_IdCnx.size(); ++i)</span> +01325 <span class="comment"> if (_IdCnx[i].State == CUnifiedNetwork::CUnifiedConnection::Ready)</span> +01326 <span class="comment"> for (j=0; j<_IdCnx[i].Connection.size (); ++j)</span> +01327 <span class="comment"> if(_IdCnx[i].Connection[j].valid () && !_IdCnx[i].Connection[j].IsServerConnection)</span> +01328 <span class="comment"> received += _IdCnx[i].Connection[j].CbNetBase->getReceiveQueueSize();</span> +01329 <span class="comment">*/</span> +01330 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>) +01331 received += <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->getReceiveQueueSize(); +01332 <span class="keywordflow">return</span> received; +01333 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka17" doxytag="NLNET::CUnifiedNetwork::getSendQueueSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CUnifiedNetwork::getSendQueueSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gets the total number of bytes queued for sending. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01287">1287</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a05529.html#l00083">NLNET::CCallbackServer::getSendQueueSize()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01924">NLNET::NLMISC_DYNVARIABLE()</a>. +<p> +<div class="fragment"><pre>01288 { +01289 <a class="code" href="a04558.html#a13">uint64</a> sent = 0; +01290 <a class="code" href="a04558.html#a15">uint</a> j; +01291 +01292 <span class="keywordflow">for</span> (vector<uint16>::iterator it = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.begin (); it != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.end(); it++) +01293 { +01294 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01295 <span class="keywordflow">for</span> (j=0; j<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[(*it)].Connection.size (); ++j) +01296 <span class="keywordflow">if</span>(_IdCnx[(*it)].Connection[j].valid () && !_IdCnx[(*it)].Connection[j].IsServerConnection) +01297 sent += _IdCnx[(*it)].Connection[j].CbNetBase->getSendQueueSize(); +01298 } +01299 +01300 <span class="comment">/* for (i=0; i<_IdCnx.size(); ++i)</span> +01301 <span class="comment"> if (_IdCnx[i].State == CUnifiedNetwork::CUnifiedConnection::Ready)</span> +01302 <span class="comment"> for (j=0; j<_IdCnx[i].Connection.size (); ++j)</span> +01303 <span class="comment"> if(_IdCnx[i].Connection[j].valid () && !_IdCnx[i].Connection[j].IsServerConnection)</span> +01304 <span class="comment"> sent += _IdCnx[i].Connection[j].CbNetBase->getSendQueueSize();</span> +01305 <span class="comment">*/</span> +01306 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>) +01307 sent += <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->getSendQueueSize(); +01308 <span class="keywordflow">return</span> sent; +01309 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka18" doxytag="NLNET::CUnifiedNetwork::getServiceName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::string NLNET::CUnifiedNetwork::getServiceName </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname1" valign="top" nowrap> <em>sid</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the name of the specified service, or "" if not found. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01451">1451</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06645.html#l01498">getUnifiedConnection()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06646.html#l00308">NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>01452 { +01453 string <a class="code" href="a04223.html#a626">s</a>; +01454 CUnifiedConnection *c = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd6">getUnifiedConnection</a>(sid, <span class="keyword">false</span>); +01455 <span class="keywordflow">if</span> (c) +01456 <a class="code" href="a04223.html#a626">s</a> = c->ServiceName; +01457 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a626">s</a>; +01458 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka19" doxytag="NLNET::CUnifiedNetwork::getServiceUnifiedName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::string NLNET::CUnifiedNetwork::getServiceUnifiedName </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname1" valign="top" nowrap> <em>sid</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return a string identifying the service, using the format "NAME-sid" (or "sid" only if not found). +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01464">1464</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06645.html#l01498">getUnifiedConnection()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06646.html#l00308">NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>01465 { +01466 string <a class="code" href="a04223.html#a626">s</a>; +01467 CUnifiedConnection *c = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd6">getUnifiedConnection</a>(sid, <span class="keyword">false</span>); +01468 <span class="keywordflow">if</span> (c) +01469 <a class="code" href="a04223.html#a626">s</a> = c->ServiceName + <span class="stringliteral">"-"</span>; +01470 <a class="code" href="a04223.html#a626">s</a> += <a class="code" href="a05378.html#a244">toString</a>(sid); +01471 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a626">s</a>; +01472 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd6" doxytag="NLNET::CUnifiedNetwork::getUnifiedConnection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03633.html">CUnifiedNetwork::CUnifiedConnection</a> * NLNET::CUnifiedNetwork::getUnifiedConnection </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>warn</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01498">1498</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06645.html#l00047">AUTOCHECK_DISPLAY</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06646.html#l00231">displayUnifiedConnection()</a>, <a class="el" href="a06645.html#l01451">getServiceName()</a>, <a class="el" href="a06645.html#l01464">getServiceUnifiedName()</a>, <a class="el" href="a06645.html#l00179">NLNET::uncbDisconnection()</a>, <a class="el" href="a06645.html#l00406">NLNET::uncbMsgProcessing()</a>, and <a class="el" href="a06645.html#l00100">NLNET::uNetUnregistrationBroadcast()</a>. +<p> +<div class="fragment"><pre>01499 { +01500 <span class="keywordflow">if</span> (sid < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size () && <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].State == CUnifiedConnection::Ready) +01501 { +01502 <span class="keywordflow">if</span> (sid != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].ServiceId) +01503 { +01504 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Sid index %hu is not the same that in the entry %hu"</span>, sid, _IdCnx[sid].ServiceId); +01505 <span class="keywordflow">return</span> NULL; +01506 } +01507 <span class="keywordflow">return</span> &<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid]; +01508 } +01509 <span class="keywordflow">else</span> +01510 { +01511 <span class="keywordflow">if</span> ( warn ) +01512 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Try to get a bad unified connection (sid %hu is not in the table)"</span>, sid); +01513 <span class="keywordflow">return</span> NULL; +01514 } +01515 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd7" doxytag="NLNET::CUnifiedNetwork::haveNamedCnx" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::haveNamedCnx </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01684">1684</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a05646.html#l01126">range</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00857">update()</a>. +<p> +<div class="fragment"><pre>01685 { +01686 CUnifiedNetwork::TNameMappedConnection::iterator it; +01687 pair<CUnifiedNetwork::TNameMappedConnection::iterator,CUnifiedNetwork::TNameMappedConnection::iterator> <a class="code" href="a04223.html#a655">range</a>; +01688 <a class="code" href="a04223.html#a655">range</a> = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.equal_range(name); +01689 +01690 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a655">range</a>.first != <a class="code" href="a04223.html#a655">range</a>.second) +01691 { +01692 <span class="keywordflow">for</span> (it=<a class="code" href="a04223.html#a655">range</a>.first; it!=<a class="code" href="a04223.html#a655">range</a>.second && (*it).second!=sid; ++it) +01693 ; +01694 +01695 <span class="keywordflow">return</span> (it != <a class="code" href="a04223.html#a655">range</a>.second); +01696 } +01697 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01698 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka20" doxytag="NLNET::CUnifiedNetwork::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> * </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> </td> + <td class="mdname" nowrap> <em>rec</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::string & </td> + <td class="mdname" nowrap> <em>shortName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>port</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> & </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Creates the connection to the Naming Service. If the connection failed, <a class="el" href="a03812.html">ESocketConnectionFailed</a> exception is generated. This function is called automatically called by the service class at the beginning.<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>addr</em> </td><td>address of the naming service (0 is you don't want to use the naming service) </td></tr> + <tr><td valign=top><em>rec</em> </td><td>recording state to know if we have to record or replay messages </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>false if the instance startup was denied by the naming service</dd></dl> + +<p> +Definition at line <a class="el" href="a06645.html#l00479">479</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00469">_NamingServiceAddr</a>, <a class="el" href="a06646.html#l00436">_ServerPort</a>, <a class="el" href="a05526.html#l00184">NLNET::CCallbackNetBase::addCallbackArray()</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06645.html#l00047">AUTOCHECK_DISPLAY</a>, <a class="el" href="a06645.html#l00038">NLNET::fd</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05512.html#l00093">NLNET::CBufServer::init()</a>, <a class="el" href="a05810.html#l00297">NLNET::CInetAddress::isValid()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05529.html#l00061">NLNET::CCallbackServer::setConnectionCallback()</a>, <a class="el" href="a05527.html#l00110">NLNET::CCallbackNetBase::setDefaultCallback()</a>, <a class="el" href="a05529.html#l00064">NLNET::CCallbackServer::setDisconnectionCallback()</a>, <a class="el" href="a05637.html#l00350">NLMISC::CFileDisplayer::setParam()</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a06645.html#l00172">NLNET::uncbConnection()</a>, <a class="el" href="a06645.html#l00179">NLNET::uncbDisconnection()</a>, <a class="el" href="a06645.html#l00406">NLNET::uncbMsgProcessing()</a>, <a class="el" href="a06645.html#l00058">NLNET::uNetRegistrationBroadcast()</a>, <a class="el" href="a06645.html#l00100">NLNET::uNetUnregistrationBroadcast()</a>, and <a class="el" href="a06645.html#l00469">NLNET::unServerCbArray</a>. +<p> +<div class="fragment"><pre>00481 { +00482 <span class="comment">//DebugLog->addNegativeFilter ("HNETL5");</span> +00483 +00484 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr7">_Initialised</a>) +00485 { +00486 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Unified network layer already initialized"</span>); +00487 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00488 } +00489 +00490 <a class="code" href="a05379.html#a62">ThreadCreator</a> = <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>(); +00491 +00492 vector<CInetAddress> laddr = <a class="code" href="a02665.html#NLNET_1_1CInetAddresse0">CInetAddress::localAddresses</a>(); +00493 +00494 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr14">_RecordingState</a> = rec; +00495 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr9">_Name</a> = shortName; +00496 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a> = sid; +00497 +00498 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a657">addr</a> != 0) +00499 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr11">_NamingServiceAddr</a> = *<a class="code" href="a04223.html#a657">addr</a>; +00500 +00501 <span class="comment">// if the address isn't 0, uses the naming service</span> +00502 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr11">_NamingServiceAddr</a>.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa11">isValid</a> ()) +00503 { +00504 <span class="comment">// connect the callback to know when a new service comes in or goes down</span> +00505 CNamingClient::setRegistrationBroadcastCallback(uNetRegistrationBroadcast); +00506 CNamingClient::setUnregistrationBroadcastCallback(uNetUnregistrationBroadcast); +00507 +00508 <span class="comment">// connect to the naming service (may generate a ESocketConnectionFailed exception)</span> +00509 CNamingClient::connect(_NamingServiceAddr, _RecordingState, laddr); +00510 +00511 <span class="keywordflow">if</span> (port == 0) +00512 port = CNamingClient::queryServicePort (); +00513 } +00514 +00515 <span class="comment">// setup the server callback only if server port != 0, otherwise there's no server callback</span> +00516 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr15">_ServerPort</a> = port; +00517 +00518 <span class="keywordflow">if</span>(<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr15">_ServerPort</a> != 0) +00519 { +00520 <a class="code" href="a04199.html#a6">nlassert</a> (_CbServer == 0); +00521 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a> = <span class="keyword">new</span> CCallbackServer; +00522 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->init(port); +00523 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->addCallbackArray(unServerCbArray, 1); <span class="comment">// the service ident callback</span> +00524 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->setDefaultCallback(uncbMsgProcessing); <span class="comment">// the default callback wrapper</span> +00525 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->setConnectionCallback(uncbConnection, NULL); +00526 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->setDisconnectionCallback(uncbDisconnection, NULL); +00527 } +00528 <span class="keywordflow">else</span> +00529 { +00530 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: ServerPort is 0 so I don't create a CCallbackServer"</span>); +00531 } +00532 +00533 <span class="keywordflow">if</span> (CNamingClient::connected()) +00534 { +00535 <span class="comment">// register the service</span> +00536 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i < laddr.size(); i++) +00537 laddr[i].setPort(_ServerPort); +00538 +00539 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a> == 0) +00540 { +00541 <span class="keywordflow">if</span> ( ! CNamingClient::registerService(_Name, laddr, _SId) ) +00542 { +00543 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: Registration denied"</span>); +00544 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00545 } +00546 } +00547 <span class="keywordflow">else</span> +00548 { +00549 CNamingClient::registerServiceWithSId(_Name, laddr, _SId); +00550 } +00551 +00552 sid = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a>; +00553 +00554 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: Server '%s' added, registered and listen to port %hu"</span>, <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr9">_Name</a>.c_str (), <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr15">_ServerPort</a>); +00555 } +00556 +00557 string fn = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr9">_Name</a>+<span class="stringliteral">"_"</span>+<a class="code" href="a05378.html#a244">toString</a>(_SId)+<span class="stringliteral">".log"</span>; +00558 <a class="code" href="a05379.html#a50">fd</a>.<a class="code" href="a02525.html#NLMISC_1_1CFileDisplayera3">setParam</a> (fn); +00559 <a class="code" href="a05373.html#a4">test</a>.addDisplayer (&fd); +00560 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"**************INIT***************"</span>); +00561 +00562 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr7">_Initialised</a> = <span class="keyword">true</span>; +00563 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00564 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka21" doxytag="NLNET::CUnifiedNetwork::isServiceLocal" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::isServiceLocal </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>serviceName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true if the serviceName service is on the same computer than this service. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01402">1402</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06645.html#l01420">isServiceLocal()</a>, <a class="el" href="a05646.html#l01126">range</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>01403 { +01404 <span class="comment">// it s me, of course we are local</span> +01405 <span class="keywordflow">if</span> (serviceName == <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr9">_Name</a>) +01406 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01407 +01408 pair<TNameMappedConnection::const_iterator,TNameMappedConnection::const_iterator> <a class="code" href="a04223.html#a655">range</a>; +01409 <a class="code" href="a04223.html#a655">range</a> = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.equal_range(serviceName); +01410 +01411 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a655">range</a>.first != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.end()) +01412 { +01413 <a class="code" href="a04558.html#a9">uint16</a> sid = (*(<a class="code" href="a04223.html#a655">range</a>.first)).second; +01414 <span class="keywordflow">return</span> <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworka22">isServiceLocal</a> (sid); +01415 } +01416 +01417 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01418 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka22" doxytag="NLNET::CUnifiedNetwork::isServiceLocal" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::isServiceLocal </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname1" valign="top" nowrap> <em>sid</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true if the sid service is on the same computer than this service. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01420">1420</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01402">isServiceLocal()</a>, and <a class="el" href="a06645.html#l02156">NLNET::NLMISC_COMMAND()</a>. +<p> +<div class="fragment"><pre>01421 { +01422 <span class="comment">// it s me, of course we are local</span> +01423 <span class="keywordflow">if</span> (sid == <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a>) +01424 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01425 +01426 <span class="keywordflow">if</span> (sid >= <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size () || <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].State != CUnifiedNetwork::CUnifiedConnection::Ready) +01427 { +01428 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01429 } +01430 +01431 vector<CInetAddress> laddr = <a class="code" href="a02665.html#NLNET_1_1CInetAddresse0">CInetAddress::localAddresses</a>(); +01432 +01433 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i < laddr.size(); i++) +01434 { +01435 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j = 0; j < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].ExtAddress.size(); j++) +01436 { +01437 <span class="keywordflow">if</span> (_IdCnx[sid].ExtAddress[j].is127001 ()) +01438 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01439 +01440 <span class="keywordflow">if</span> (_IdCnx[sid].ExtAddress[j].internalIPAddress () == laddr[i].internalIPAddress ()) +01441 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01442 } +01443 } +01444 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01445 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworke1" doxytag="NLNET::CUnifiedNetwork::isUsed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::isUsed </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true if the application called <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworke0">getInstance()</a>. This function is used to know if the user is using layer 4 or layer 5 +<p> +Definition at line <a class="el" href="a06645.html#l01489">1489</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +<div class="fragment"><pre>01490 { +01491 <span class="keywordflow">return</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkv0">_Instance</a> != NULL); +01492 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka23" doxytag="NLNET::CUnifiedNetwork::release" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::release </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Closes the connection to the naming service, every other connection and free. +<p> +Definition at line <a class="el" href="a06645.html#l00599">599</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00454">_Callbacks</a>, <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00441">_DownCallbacks</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06646.html#l00439">_UpCallbacks</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a05528.html#l00246">NLNET::CCallbackServer::disconnect()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00600 { +00601 <span class="keywordflow">if</span> (!<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr7">_Initialised</a>) +00602 <span class="keywordflow">return</span>; +00603 +00604 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +00605 +00606 <span class="comment">// disconnect all clients</span> +00607 <span class="keywordflow">if</span>(<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>) +00608 { +00609 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->disconnect(InvalidSockId); +00610 <span class="keyword">delete</span> <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>; +00611 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a> = 0; +00612 } +00613 +00614 <span class="comment">// disconnect all connections to servers</span> +00615 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size(); ++i) +00616 { +00617 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State != CUnifiedNetwork::CUnifiedConnection::NotUsed) +00618 { +00619 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> j = 0 ; j < <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection.size (); j++) +00620 { +00621 <span class="keywordflow">if</span> (_IdCnx[i].Connection[j].valid() && !_IdCnx[i].Connection[j].IsServerConnection) +00622 { +00623 <span class="keywordflow">if</span> (_IdCnx[i].Connection[j].CbNetBase->connected ()) +00624 _IdCnx[i].Connection[j].CbNetBase->disconnect(); +00625 +00626 <span class="keyword">delete</span> _IdCnx[i].Connection[j].CbNetBase; +00627 } +00628 } +00629 _IdCnx[i].Connection.clear (); +00630 } +00631 } +00632 +00633 <span class="comment">// clear all other data</span> +00634 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.clear(); +00635 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.clear (); +00636 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.clear(); +00637 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">_UpCallbacks</a>.clear(); +00638 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">_DownCallbacks</a>.clear(); +00639 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr0">_Callbacks</a>.clear(); +00640 +00641 <span class="comment">// disconnect the connection with the naming service</span> +00642 <span class="keywordflow">if</span> (CNamingClient::connected ()) +00643 CNamingClient::disconnect (); +00644 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkd8" doxytag="NLNET::CUnifiedNetwork::removeNamedCnx" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::removeNamedCnx </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>sid</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01727">1727</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06645.html#l00051">NLNET::allstuffs</a>, <a class="el" href="a06645.html#l00047">AUTOCHECK_DISPLAY</a>, <a class="el" href="a05646.html#l01126">range</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00179">NLNET::uncbDisconnection()</a>, and <a class="el" href="a06645.html#l00100">NLNET::uNetUnregistrationBroadcast()</a>. +<p> +<div class="fragment"><pre>01728 { +01729 <span class="comment">// get all map nodes of that service name</span> +01730 CUnifiedNetwork::TNameMappedConnection::iterator it; +01731 pair<CUnifiedNetwork::TNameMappedConnection::iterator,CUnifiedNetwork::TNameMappedConnection::iterator> <a class="code" href="a04223.html#a655">range</a>; +01732 <a class="code" href="a04223.html#a655">range</a> = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.equal_range(name); +01733 +01734 <span class="comment">// assume not empty</span> +01735 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a655">range</a>.first == <a class="code" href="a04223.html#a655">range</a>.second) +01736 { +01737 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: The unified connection %s-%hu wasn't on the _NamedCnx"</span>, name.c_str(), sid); +01738 <span class="keywordflow">return</span>; +01739 } +01740 +01741 <span class="comment">// select good service id</span> +01742 <span class="keywordflow">for</span> (it=<a class="code" href="a04223.html#a655">range</a>.first; it!=<a class="code" href="a04223.html#a655">range</a>.second && (*it).second!=sid; ++it) +01743 ; +01744 +01745 <span class="comment">// assume id exists</span> +01746 <span class="keywordflow">if</span> (it == <a class="code" href="a04223.html#a655">range</a>.second) +01747 { +01748 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: The unified connection %s-%hu wasn't on the _NamedCnx"</span>, name.c_str(), sid); +01749 <span class="keywordflow">return</span>; +01750 } +01751 +01752 <span class="comment">// remove service for map</span> +01753 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.erase(it); +01754 +01755 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"-name "</span>+name+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>(sid)+<span class="stringliteral">"\n"</span>; +01756 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"-name %s-%hu"</span>, name.c_str (), sid); +01757 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka24" doxytag="NLNET::CUnifiedNetwork::send" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::send </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>serviceId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msg</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em> = 0xFF</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sends a message to a specific serviceId. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>serviceId</em> </td><td>Id of the service you want to send the message. </td></tr> + <tr><td valign=top><em>msg</em> </td><td>the message you want to send. </td></tr> + <tr><td valign=top><em>nid</em> </td><td>Network Id specify to which network the message must pass throw (0xFF mean the default network) </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if the service was found (may return true even if the sending failed)</dd></dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01136">1136</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06645.html#l01030">findConnectionId()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>01137 { +01138 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::send(uint16, const CMessage&) whereas it is not initialised yet"</span>)); +01139 +01140 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +01141 +01142 <span class="keywordflow">if</span> (sid >= <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size () || <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].State != CUnifiedNetwork::CUnifiedConnection::Ready) +01143 { +01144 <span class="comment">// happen when trying to send a message to an unknown service id</span> +01145 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send to the service '%hu' because not in _IdCnx"</span>, sid); +01146 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01147 } +01148 +01149 <a class="code" href="a04558.html#a7">uint8</a> connectionId = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd5">findConnectionId</a> (sid, nid); +01150 <span class="keywordflow">if</span> (connectionId == 0xff) <span class="comment">// failed</span> +01151 { +01152 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send to the service '%hu' because no connection available"</span>, sid); +01153 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01154 } +01155 +01156 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].Connection[connectionId].CbNetBase->send (msgout, _IdCnx[sid].Connection[connectionId].HostId); +01157 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01158 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka25" doxytag="NLNET::CUnifiedNetwork::send" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CUnifiedNetwork::send </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msg</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em> = 0xFF</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sends a message to a specific serviceName. If there's more than one service with this name, all services of this name will receive the message. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>serviceName</em> </td><td>name of the service you want to send the message (may not be unique.) </td></tr> + <tr><td valign=top><em>msg</em> </td><td>the message you want to send. </td></tr> + <tr><td valign=top><em>nid</em> </td><td>Network Id specify to which network the message must pass throw (0xFF mean the default network) </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if the service was found (one or more instances) (may return true even if the sending failed)</dd></dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01091">1091</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00430">_NamedCnx</a>, <a class="el" href="a06645.html#l01030">findConnectionId()</a>, <a class="el" href="a06026.html#l00411">NLNET::CMessage::getName()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05646.html#l01126">range</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>01092 { +01093 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::send(const string&, const CMessage&) whereas it is not initialised yet"</span>)); +01094 +01095 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +01096 +01097 TNameMappedConnection::const_iterator it; +01098 pair<TNameMappedConnection::const_iterator,TNameMappedConnection::const_iterator> <a class="code" href="a04223.html#a655">range</a>; +01099 <a class="code" href="a04223.html#a655">range</a> = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.equal_range(serviceName); +01100 +01101 <span class="keywordtype">bool</span> found = <span class="keyword">false</span>; +01102 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a655">range</a>.first != <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">_NamedCnx</a>.end()) +01103 { +01104 <span class="keywordflow">for</span> (it=<a class="code" href="a04223.html#a655">range</a>.first; it!=<a class="code" href="a04223.html#a655">range</a>.second; ++it) +01105 { +01106 <a class="code" href="a04558.html#a9">uint16</a> sid = (*it).second; +01107 <span class="keywordflow">if</span> (sid >= <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size () || <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].State != CUnifiedNetwork::CUnifiedConnection::Ready) +01108 { +01109 <span class="comment">// It often happen when the service is down (connection broke and the naming not already say that it s down)</span> +01110 <span class="comment">// In this case, just warn</span> +01111 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send to the service '%s' because it was in the _NamedCnx but not in _IdCnx (means that the service is down)"</span>, serviceName.c_str ()); +01112 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01113 } +01114 +01115 found = <span class="keyword">true</span>; +01116 +01117 <a class="code" href="a04558.html#a7">uint8</a> connectionId = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd5">findConnectionId</a> (sid, nid); +01118 <span class="keywordflow">if</span> (connectionId == 0xff) <span class="comment">// failed</span> +01119 { +01120 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send message to %hu because no connection available"</span>, sid); +01121 found = <span class="keyword">false</span>; +01122 <span class="keywordflow">continue</span>; +01123 } +01124 +01125 <span class="comment">//nldebug ("HNETL5: send message to %s using nid %d cnx %d / %s", serviceName.c_str (), nid, connectionId, connectionId<_IdCnx[sid].ExtAddress.size ()?_IdCnx[sid].ExtAddress[connectionId].asString().c_str():"???");</span> +01126 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[sid].Connection[connectionId].CbNetBase->send (msgout, _IdCnx[sid].Connection[connectionId].HostId); +01127 } +01128 } +01129 +01130 <span class="keywordflow">if</span> (!found) +01131 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: can't find service %s to send message %s"</span>, serviceName.c_str(), msgout.<a class="code" href="a02918.html#NLNET_1_1CMessagea16">getName</a>().c_str()); +01132 +01133 <span class="keywordflow">return</span> found; +01134 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka26" doxytag="NLNET::CUnifiedNetwork::sendAll" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::sendAll </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msg</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>nid</em> = 0xFF</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Broadcasts a message to all connected services. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>msg</em> </td><td>the message you want to send. </td></tr> + <tr><td valign=top><em>nid</em> </td><td>Network Id specify to which network the message must pass throw (0xFF mean the default network)</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01160">1160</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06645.html#l01030">findConnectionId()</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>01161 { +01162 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::send(const CMessage&) whereas it is not initialised yet"</span>)); +01163 +01164 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +01165 +01166 <a class="code" href="a04558.html#a15">uint</a> i; +01167 <span class="keywordflow">for</span> (i=0; i<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>.size(); ++i) +01168 { +01169 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].State == CUnifiedNetwork::CUnifiedConnection::Ready) +01170 { +01171 <a class="code" href="a04558.html#a7">uint8</a> connectionId = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd5">findConnectionId</a> (i, nid); +01172 <span class="keywordflow">if</span> (connectionId == 0xff) <span class="comment">// failed</span> +01173 { +01174 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't send message to %u because no connection available"</span>, i); +01175 <span class="keywordflow">continue</span>; +01176 } +01177 +01178 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[i].Connection[connectionId].CbNetBase->send (msgout, _IdCnx[i].Connection[connectionId].HostId); +01179 } +01180 } +01181 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka27" doxytag="NLNET::CUnifiedNetwork::setServiceDownCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::setServiceDownCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a97">TUnifiedNetCallback</a> </td> + <td class="mdname" nowrap> <em>cb</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>void * </td> + <td class="mdname" nowrap> <em>arg</em> = 0, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>back</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets callback for disconnections. On a client, the callback will be call each time the connection to the server is lost. On a server, the callback is called each time a client is disconnected.<p> +You can set more than one callback, each one will be called one after one. If the serviceName is "*", the callback will be call for any services If you set the same callback for a specific service S and for "*", the callback might be call twice (in case the service S is down)<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>back</em> </td><td>if true, put the callback at the end of the callback array, otherwise but on the beginning. You should always use true</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01216">1216</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00441">_DownCallbacks</a>, <a class="el" href="a06646.html#l00442">_DownUniCallback</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a06646.html#l00045">NLNET::TUnifiedNetCallback</a>. +<p> +<div class="fragment"><pre>01217 { +01218 <a class="code" href="a04199.html#a6">nlassert</a> (cb != NULL); +01219 <span class="keywordflow">if</span> (serviceName == <span class="stringliteral">"*"</span>) +01220 { +01221 <span class="keywordflow">if</span> (back) +01222 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a>.push_back (make_pair(cb, arg)); +01223 <span class="keywordflow">else</span> +01224 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a>.insert (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">_DownUniCallback</a>.begin(), make_pair(cb, arg)); +01225 } +01226 <span class="keywordflow">else</span> +01227 { +01228 <span class="keywordflow">if</span> (back) +01229 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">_DownCallbacks</a>[serviceName].push_back (make_pair(cb, arg)); +01230 <span class="keywordflow">else</span> +01231 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">_DownCallbacks</a>[serviceName].insert (_DownCallbacks[serviceName].begin(), make_pair(cb, arg)); +01232 } +01233 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka28" doxytag="NLNET::CUnifiedNetwork::setServiceUpCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::setServiceUpCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a97">TUnifiedNetCallback</a> </td> + <td class="mdname" nowrap> <em>cb</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>void * </td> + <td class="mdname" nowrap> <em>arg</em> = 0, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>back</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets callback for incoming connections. On a client, the callback will be call when the connection to the server is established (the first connection or after the server shutdown and started) On a server, the callback is called each time a new client is connected to him<p> +You can set more than one callback, each one will be called one after one. If the serviceName is "*", the callback will be call for any services If you set the same callback for a specific service S and for "*", the callback might be call twice (in case the service S is up)<p> +<dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>back</em> </td><td>if true, put the callback at the end of the callback array, otherwise but on the beginning. You should always use true</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06645.html#l01197">1197</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00439">_UpCallbacks</a>, <a class="el" href="a06646.html#l00440">_UpUniCallback</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a06646.html#l00045">NLNET::TUnifiedNetCallback</a>. +<p> +<div class="fragment"><pre>01198 { +01199 <a class="code" href="a04199.html#a6">nlassert</a> (cb != NULL); +01200 <span class="keywordflow">if</span> (serviceName == <span class="stringliteral">"*"</span>) +01201 { +01202 <span class="keywordflow">if</span> (back) +01203 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a>.push_back (make_pair(cb, arg)); +01204 <span class="keywordflow">else</span> +01205 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a>.insert (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">_UpUniCallback</a>.begin(), make_pair(cb, arg)); +01206 } +01207 <span class="keywordflow">else</span> +01208 { +01209 <span class="keywordflow">if</span> (back) +01210 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">_UpCallbacks</a>[serviceName].push_back (make_pair(cb, arg)); +01211 <span class="keywordflow">else</span> +01212 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">_UpCallbacks</a>[serviceName].insert (_UpCallbacks[serviceName].begin(), make_pair(cb, arg)); +01213 } +01214 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworka29" doxytag="NLNET::CUnifiedNetwork::update" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CUnifiedNetwork::update </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05378.html#a242">NLMISC::TTime</a> </td> + <td class="mdname1" valign="top" nowrap> <em>timeout</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Call it evenly. the parameter select the timeout value in seconds for each update. You are absolutely certain that this function will not be returns before this amount of time you set. If you set the update timeout value higher than 0, all messages in queues will be process until the time is greater than the timeout user <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka29">update()</a>. If you set the update timeout value to 0, all messages in queues will be process one time before calling the user <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworka29">update()</a>. In this case, we don't nlSleep(1). +<p> +Definition at line <a class="el" href="a06645.html#l00857">857</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +References <a class="el" href="a06646.html#l00433">_CbServer</a>, <a class="el" href="a06646.html#l00424">_IdCnx</a>, <a class="el" href="a06646.html#l00460">_LastRetry</a>, <a class="el" href="a06646.html#l00469">_NamingServiceAddr</a>, <a class="el" href="a06646.html#l00436">_ServerPort</a>, <a class="el" href="a06646.html#l00427">_UsedConnection</a>, <a class="el" href="a06645.html#l01700">addNamedCnx()</a>, <a class="el" href="a05810.html#l00385">NLNET::CInetAddress::asString()</a>, <a class="el" href="a06645.html#l01517">autoCheck()</a>, <a class="el" href="a06646.html#l00316">NLNET::CUnifiedNetwork::CUnifiedConnection::AutoRetry</a>, <a class="el" href="a06645.html#l01768">callServiceUpCallback()</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a06646.html#l00324">NLNET::CUnifiedNetwork::CUnifiedConnection::Connection</a>, <a class="el" href="a06646.html#l00322">NLNET::CUnifiedNetwork::CUnifiedConnection::ExtAddress</a>, <a class="el" href="a05586.html#l00093">NLMISC::getThreadId()</a>, <a class="el" href="a05788.html#l00056">H_AUTO</a>, <a class="el" href="a05788.html#l00045">H_TIME</a>, <a class="el" href="a06645.html#l01684">haveNamedCnx()</a>, <a class="el" href="a06646.html#l00314">NLNET::CUnifiedNetwork::CUnifiedConnection::IsExternal</a>, <a class="el" href="a05810.html#l00297">NLNET::CInetAddress::isValid()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00333">nlassertex</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06646.html#l00318">NLNET::CUnifiedNetwork::CUnifiedConnection::SendId</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a06646.html#l00310">NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceId</a>, <a class="el" href="a06646.html#l00308">NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName</a>, <a class="el" href="a06646.html#l00312">NLNET::CUnifiedNetwork::CUnifiedConnection::State</a>, <a class="el" href="a06645.html#l00040">NLNET::ThreadCreator</a>, <a class="el" href="a06553.html#l00047">NLMISC::TTime</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05528.html#l00175">NLNET::CCallbackServer::update()</a>. +<p> +<div class="fragment"><pre>00858 { +00859 <a class="code" href="a04365.html#a4">H_AUTO</a>(CUnifiedNetworkUpdate); +00860 +00861 <a class="code" href="a04199.html#a8">nlassertex</a>(_Initialised == <span class="keyword">true</span>, (<span class="stringliteral">"Try to CUnifiedNetwork::update() whereas it is not initialised yet"</span>)); +00862 +00863 <span class="keywordflow">if</span> (<a class="code" href="a05379.html#a62">ThreadCreator</a> != <a class="code" href="a05378.html#a257">NLMISC::getThreadId</a>()) <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Multithread access but this class is not thread safe thread creator = %u thread used = %u"</span>, ThreadCreator, NLMISC::getThreadId()); +00864 +00865 <span class="keywordtype">bool</span> enableRetry; <span class="comment">// true every 5 seconds to reconnect if necessary</span> +00866 +00867 <span class="comment">// Compute the real timeout based on the next update timeout</span> +00868 <a class="code" href="a05378.html#a242">TTime</a> t0 = CTime::getLocalTime (); +00869 +00870 <span class="keywordflow">if</span> (timeout > 0) +00871 { +00872 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a> == 0) +00873 { +00874 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a> = t0 + timeout; +00875 } +00876 <span class="keywordflow">else</span> +00877 { +00878 <a class="code" href="a05378.html#a242">TTime</a> err = t0 - <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a>; +00879 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a> += timeout; +00880 +00881 <span class="comment">// if we are too late, resync to the next value</span> +00882 <span class="keywordflow">while</span> (err > timeout) +00883 { +00884 err -= timeout; +00885 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">_NextUpdateTime</a> += timeout; +00886 } +00887 +00888 timeout -= err; +00889 <span class="keywordflow">if</span> (timeout < 0) timeout = 0; +00890 } +00891 } +00892 +00893 <span class="comment">// check if we need to retry to connect to the client</span> +00894 <span class="keywordflow">if</span> ((enableRetry = (t0-<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr8">_LastRetry</a> > 5000))) +00895 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr8">_LastRetry</a> = t0; +00896 +00897 <span class="comment">// Try to reconnect to the naming service if connection lost</span> +00898 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr11">_NamingServiceAddr</a>.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa11">isValid</a> ()) +00899 { +00900 <span class="keywordflow">if</span> (CNamingClient::connected ()) +00901 { +00902 CNamingClient::update (); +00903 } +00904 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (enableRetry) +00905 { +00906 <a class="code" href="a04365.html#a4">H_AUTO</a>(L5NSReconnect); +00907 <span class="keywordflow">try</span> +00908 { +00909 vector<CInetAddress> laddr = <a class="code" href="a02665.html#NLNET_1_1CInetAddresse0">CInetAddress::localAddresses</a>(); +00910 CNamingClient::connect (_NamingServiceAddr, _RecordingState, laddr); +00911 <span class="comment">// re-register the service</span> +00912 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i < laddr.size(); i++) +00913 laddr[i].setPort(_ServerPort); +00914 CNamingClient::resendRegisteration (_Name, laddr, _SId); +00915 } +00916 <span class="keywordflow">catch</span> (ESocketConnectionFailed &) +00917 { +00918 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Could not connect to the Naming Service (%s). Retrying in a few seconds..."</span>, <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr11">_NamingServiceAddr</a>.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa1">asString</a>().c_str()); +00919 } +00920 } +00921 } +00922 +00923 <span class="keywordflow">while</span> (<span class="keyword">true</span>) +00924 { +00925 <span class="comment">// update all server connections</span> +00926 <span class="keywordflow">if</span> (<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>) +00927 { +00928 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">_CbServer</a>->update(0); +00929 } +00930 +00931 <span class="comment">// update all client connections</span> +00932 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k<<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>.size(); ++k) +00933 { +00934 CUnifiedConnection &uc = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">_IdCnx</a>[<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">_UsedConnection</a>[k]]; +00935 <a class="code" href="a04199.html#a6">nlassert</a> (uc.State == CUnifiedNetwork::CUnifiedConnection::Ready); +00936 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j = 0; j < uc.Connection.size (); j++) +00937 { +00938 <span class="keywordflow">if</span> (!uc.Connection[j].valid()) +00939 <span class="keywordflow">continue</span>; +00940 +00941 <span class="keywordflow">if</span> (uc.Connection[j].IsServerConnection) +00942 <span class="keywordflow">continue</span>; +00943 +00944 <span class="keywordflow">if</span> (uc.Connection[j].CbNetBase->connected ()) +00945 { +00946 uc.Connection[j].CbNetBase->update(0); +00947 } +00948 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (enableRetry && uc.AutoRetry) +00949 { +00950 <a class="code" href="a04365.html#a4">H_AUTO</a>(L5AutoReconnect); +00951 <span class="keywordflow">try</span> +00952 { +00953 CCallbackClient *cbc = (CCallbackClient *)uc.Connection[j].CbNetBase; +00954 cbc->connect(uc.ExtAddress[j]); +00955 uc.Connection[j].CbNetBase->getSockId()->setAppId(uc.ServiceId); +00956 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: reconnection to %s-%hu success"</span>, uc.ServiceName.c_str(), uc.ServiceId); +00957 +00958 +00959 <span class="comment">// add the name only if at least one connection is ok</span> +00960 <span class="keywordflow">if</span> (!<a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd7">haveNamedCnx</a> (uc.ServiceName, uc.ServiceId)) +00961 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd0">addNamedCnx</a> (uc.ServiceName, uc.ServiceId); +00962 +00963 <span class="comment">// resend the identification is necessary</span> +00964 <span class="keywordflow">if</span> (uc.SendId) +00965 { +00966 <span class="comment">// send identification to the service</span> +00967 <a class="code" href="a02918.html">CMessage</a> msg(<span class="stringliteral">"UN_SIDENT"</span>); +00968 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(_Name); +00969 +00970 <a class="code" href="a04558.html#a9">uint16</a> ssid = <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">_SId</a>; +00971 <span class="keywordflow">if</span> (uc.IsExternal) +00972 { +00973 <span class="comment">// in the case that the service is external, we can't send our sid because the external service can</span> +00974 <span class="comment">// have other connection with the same sid (for example, LS can have 2 WS with same sid => sid = 0 and leave</span> +00975 <span class="comment">// the other side to find a good number</span> +00976 ssid = 0; +00977 } +00978 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(ssid); <span class="comment">// serializes a 16 bits service id</span> +00979 <a class="code" href="a04558.html#a7">uint8</a> pos = j; +00980 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(pos); <span class="comment">// send the position in the connection table</span> +00981 msg.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (uc.IsExternal); +00982 uc.Connection[j].CbNetBase->send (msg, uc.Connection[j].HostId); +00983 } +00984 +00985 <span class="comment">// call the user callback</span> +00986 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd3">callServiceUpCallback</a> (uc.ServiceName, uc.ServiceId); +00987 <span class="comment">/*</span> +00988 <span class="comment"> CUnifiedNetwork::TNameMappedCallback::iterator it = _UpCallbacks.find(uc.ServiceName);</span> +00989 <span class="comment"> if (it != _UpCallbacks.end())</span> +00990 <span class="comment"> {</span> +00991 <span class="comment"> // call it</span> +00992 <span class="comment"> for (list<TCallbackArgItem> it2 = (*it).second.begin(); it2 != (*it).second.end(); it2++)</span> +00993 <span class="comment"> {</span> +00994 <span class="comment"> TUnifiedNetCallback cb = (*it2).first;</span> +00995 <span class="comment"> if (cb) cb(uc.ServiceName, uc.ServiceId, (*it2).second);</span> +00996 <span class="comment"> }</span> +00997 <span class="comment"> }</span> +00998 <span class="comment"></span> +00999 <span class="comment"> for (uint c = 0; c < _UpUniCallback.size (); c++)</span> +01000 <span class="comment"> {</span> +01001 <span class="comment"> if (_UpUniCallback[c].first != NULL)</span> +01002 <span class="comment"> _UpUniCallback[c].first (uc.ServiceName, uc.ServiceId, _UpUniCallback[c].second);</span> +01003 <span class="comment"> }</span> +01004 <span class="comment"> */</span> +01005 } +01006 <span class="keywordflow">catch</span> (ESocketConnectionFailed &e) +01007 { +01008 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: can't connect to %s-%hu now (%s)"</span>, uc.ServiceName.c_str(), uc.ServiceId, e.what ()); +01009 } +01010 } +01011 } +01012 } +01013 +01014 enableRetry = <span class="keyword">false</span>; +01015 +01016 <span class="comment">// If it's the end, don't nlSleep()</span> +01017 <span class="keywordflow">if</span> (CTime::getLocalTime() - t0 > timeout) +01018 <span class="keywordflow">break</span>; +01019 +01020 <span class="comment">// Enable windows multithreading before rescanning all connections</span> +01021 <a class="code" href="a04365.html#a1">H_TIME</a>(L5UpdateSleep, <a class="code" href="a05378.html#a256">nlSleep</a>(1);); +01022 } +01023 +01024 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd1">autoCheck</a>(); +01025 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Friends And Related Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn0" doxytag="NLNET::CUnifiedNetwork::isServiceLocalClass" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend struct isServiceLocalClass<code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00510">510</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn1" doxytag="NLNET::CUnifiedNetwork::l5CallbackClass" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend struct l5CallbackClass<code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00511">511</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn2" doxytag="NLNET::CUnifiedNetwork::l5QueuesStatsClass" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend struct l5QueuesStatsClass<code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00512">512</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn3" doxytag="NLNET::CUnifiedNetwork::uncbConnection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void uncbConnection </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>from</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>void * </td> + <td class="mdname" nowrap> <em>arg</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l00172">172</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +<div class="fragment"><pre>00173 { +00174 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: + connec '%s'"</span>, <a class="code" href="a05333.html#a132">from</a>->asString().c_str()); +00175 +00176 <a class="code" href="a05333.html#a132">from</a>->setAppId (AppIdDeadConnection); +00177 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn4" doxytag="NLNET::CUnifiedNetwork::uncbDisconnection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void uncbDisconnection </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>from</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>void * </td> + <td class="mdname" nowrap> <em>arg</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l00179">179</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +<div class="fragment"><pre>00180 { +00181 <span class="keywordflow">if</span>(<a class="code" href="a05333.html#a132">from</a>->appId () == <a class="code" href="a05379.html#a63">AppIdDeadConnection</a>) +00182 { +00183 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: - connec '%s'"</span>, <a class="code" href="a05333.html#a132">from</a>->asString().c_str()); +00184 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"-connect dead conenction"</span>); +00185 } +00186 <span class="keywordflow">else</span> +00187 { +00188 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd4">CUnifiedNetwork</a> *uni = CUnifiedNetwork::getInstance(); +00189 <a class="code" href="a04558.html#a9">uint16</a> sid = (<a class="code" href="a04558.html#a9">uint16</a>)<a class="code" href="a05333.html#a132">from</a>->appId(); +00190 CUnifiedNetwork::CUnifiedConnection *uc = uni->getUnifiedConnection (sid); +00191 <span class="keywordflow">if</span> (uc == 0) +00192 { +00193 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: - connec '%s' sid %hu"</span>, <a class="code" href="a05333.html#a132">from</a>->asString().c_str(), sid); +00194 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"-connect '%s' %hu"</span>, <a class="code" href="a05333.html#a132">from</a>->asString ().c_str (), sid); +00195 } +00196 <span class="keywordflow">else</span> +00197 { +00198 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: - connec '%s' %s-%hu"</span>, <a class="code" href="a05333.html#a132">from</a>->asString().c_str(), uc->ServiceName.c_str (), sid); +00199 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"-connect "</span>+uc->ServiceName+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>(sid)+<span class="stringliteral">"\n"</span>; +00200 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"-connect %s-%hu"</span>, uc->ServiceName.c_str (), (<a class="code" href="a04558.html#a9">uint16</a>)(uc->ServiceId)); +00201 +00202 <span class="keywordflow">if</span> (uc->IsExternal) +00203 { +00204 <span class="keywordflow">if</span> (!uc->AutoRetry) +00205 { +00206 <span class="comment">// If it s a external service with no auto retry, remove the connection</span> +00207 +00208 <span class="comment">// call the user callback</span> +00209 uni->callServiceDownCallback(uc->ServiceName, uc->ServiceId); +00210 +00211 <span class="comment">/*CUnifiedNetwork::TNameMappedCallback::iterator it2 = uni->_DownCallbacks.find(uc->ServiceName);</span> +00212 <span class="comment"></span> +00213 <span class="comment"> if (it2 != uni->_DownCallbacks.end())</span> +00214 <span class="comment"> {</span> +00215 <span class="comment"> // call it</span> +00216 <span class="comment"> TUnifiedNetCallback cb = (*it2).second.first;</span> +00217 <span class="comment"> cb(uc->ServiceName, uc->ServiceId, (*it2).second.second);</span> +00218 <span class="comment"> }</span> +00219 <span class="comment"></span> +00220 <span class="comment"> for (uint c = 0; c < uni->_DownUniCallback.size (); c++)</span> +00221 <span class="comment"> {</span> +00222 <span class="comment"> if (uni->_DownUniCallback[c].first != NULL)</span> +00223 <span class="comment"> uni->_DownUniCallback[c].first(uc->ServiceName, uc->ServiceId, uni->_DownUniCallback[c].second);</span> +00224 <span class="comment"> }*/</span> +00225 +00226 uni->removeNamedCnx (uc->ServiceName, uc->ServiceId); +00227 +00228 <span class="comment">// remove the _UsedConnection</span> +00229 <span class="keywordtype">bool</span> found = <span class="keyword">false</span>; +00230 <span class="keywordflow">for</span> (vector<uint16>::iterator it = uni->_UsedConnection.begin (); it != uni->_UsedConnection.end(); it++) +00231 { +00232 <span class="keywordflow">if</span> (*it == uc->ServiceId) +00233 { +00234 found = <span class="keyword">true</span>; +00235 uni->_UsedConnection.erase (it); +00236 <span class="keywordflow">break</span>; +00237 } +00238 } +00239 <span class="keywordflow">if</span> (!found) <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: can't find the sid %hu in the _UsedConnection"</span>, uc->ServiceId); +00240 +00241 uc->reset (); +00242 } +00243 } +00244 <span class="keywordflow">else</span> +00245 { +00246 <span class="comment">// reset the connection</span> +00247 <a class="code" href="a04558.html#a15">uint</a> i; +00248 <span class="keywordflow">for</span> (i = 0; i < uc->Connection.size (); i++) +00249 { +00250 <span class="keywordflow">if</span> (uc->Connection[i].valid() && uc->Connection[i].CbNetBase->getSockId(uc->Connection[i].HostId) == <a class="code" href="a05333.html#a132">from</a>) +00251 { +00252 <span class="keywordflow">if</span> (uc->Connection[i].IsServerConnection) +00253 { +00254 <span class="comment">// we have to remove the stuffs now because HostId will not be accessible later</span> +00255 uc->Connection[i].reset(); +00256 } +00257 <span class="keywordflow">else</span> +00258 { +00259 <span class="comment">// if it s a client, we can't delete now because the callback client is currently in use</span> +00260 <span class="comment">// only disconnect</span> +00261 <span class="keywordflow">if</span>(uc->Connection[i].CbNetBase->connected ()) +00262 { +00263 uc->Connection[i].CbNetBase->disconnect (uc->Connection[i].HostId); +00264 } +00265 } +00266 <span class="keywordflow">break</span>; +00267 } +00268 } +00269 <span class="keywordflow">if</span> (i == uc->Connection.size ()) +00270 { +00271 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: received a disconnection from a service but the connection is not in my list!"</span>); +00272 } +00273 } +00274 } +00275 +00276 <a class="code" href="a05333.html#a132">from</a>->setAppId (AppIdDeadConnection); +00277 } +00278 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn5" doxytag="NLNET::CUnifiedNetwork::uncbMsgProcessing" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void uncbMsgProcessing </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msgin</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>from</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html">CCallbackNetBase</a> & </td> + <td class="mdname" nowrap> <em>netbase</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l00406">406</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +<div class="fragment"><pre>00407 { +00408 <span class="keywordflow">if</span> (<a class="code" href="a05333.html#a132">from</a>->appId() == <a class="code" href="a05379.html#a63">AppIdDeadConnection</a>) +00409 { +00410 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Receive a message from a dead connection"</span>); +00411 <span class="keywordflow">return</span>; +00412 } +00413 +00414 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd4">CUnifiedNetwork</a> *uni = CUnifiedNetwork::getInstance(); +00415 <a class="code" href="a04558.html#a9">uint16</a> sid = (<a class="code" href="a04558.html#a9">uint16</a>)<a class="code" href="a05333.html#a132">from</a>->appId(); +00416 CUnifiedNetwork::TMsgMappedCallback::iterator itcb; +00417 +00418 itcb = uni->_Callbacks.find(msgin.<a class="code" href="a02918.html#NLNET_1_1CMessagea16">getName</a>()); +00419 <span class="keywordflow">if</span> (itcb == uni->_Callbacks.end()) +00420 { +00421 <span class="comment">// the callback doesn't exist</span> +00422 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Can't find callback '%s' called by service %hu"</span>, msgin.<a class="code" href="a02918.html#NLNET_1_1CMessagea16">getName</a>().c_str(), sid); +00423 } +00424 <span class="keywordflow">else</span> +00425 { +00426 CUnifiedNetwork::CUnifiedConnection *uc = uni->getUnifiedConnection (sid); +00427 +00428 <span class="keywordflow">if</span> (uc == 0) +00429 { +00430 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Received a message from a service %hu that is not ready (bad appid? 0x%"</span>NL_I64<span class="stringliteral">"X)"</span>, sid, <a class="code" href="a05333.html#a132">from</a>->appId ()); +00431 <span class="keywordflow">return</span>; +00432 } +00433 <span class="keywordflow">if</span>((*itcb).second == 0) +00434 { +00435 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Received message %s from a service %hu but the associated callback is NULL"</span>, msgin.<a class="code" href="a02918.html#NLNET_1_1CMessagea16">getName</a> ().c_str(), sid); +00436 <span class="keywordflow">return</span>; +00437 } +00438 +00439 { +00440 <span class="keyword">static</span> map<string, CHTimer> timers; +00441 map<string, CHTimer>::iterator it; +00442 +00443 { +00444 <a class="code" href="a04365.html#a4">H_AUTO</a>(L5UCHTimerOverhead); +00445 string callbackName = <span class="stringliteral">"USRCB_"</span> + msgin.<a class="code" href="a02918.html#NLNET_1_1CMessagea16">getName</a>(); +00446 it = timers.find(callbackName); +00447 <span class="keywordflow">if</span>(it == timers.end()) +00448 { +00449 it = timers.insert(make_pair(callbackName, CHTimer(NULL))).first; +00450 (*it).second.setName((*it).first.c_str()); +00451 } +00452 } +00453 +00454 { +00455 <a class="code" href="a04365.html#a4">H_AUTO</a>(L5UserCallback); +00456 +00457 (*it).second.before(); +00458 (*itcb).second (msgin, uc->ServiceName, sid); +00459 (*it).second.after(); +00460 } +00461 } +00462 +00463 uc->TotalCallbackCalled++; +00464 <a class="code" href="a05379.html#a64">TotalCallbackCalled</a>++; +00465 } +00466 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn6" doxytag="NLNET::CUnifiedNetwork::uncbServiceIdentification" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void uncbServiceIdentification </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>msgin</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>from</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html">CCallbackNetBase</a> & </td> + <td class="mdname" nowrap> <em>netbase</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l00284">284</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. +<p> +<div class="fragment"><pre>00285 { +00286 string inSName; +00287 <a class="code" href="a04558.html#a9">uint16</a> inSid; +00288 +00289 <span class="keywordflow">if</span> (<a class="code" href="a05333.html#a132">from</a>->appId () != <a class="code" href="a05379.html#a63">AppIdDeadConnection</a>) +00290 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: received a connec ident from an unknown connection 0x%"</span>NL_I64<span class="stringliteral">"X"</span>, <a class="code" href="a05333.html#a132">from</a>->appId ()); +00291 +00292 <span class="comment">// recover the service name and id</span> +00293 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(inSName); +00294 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>(inSid); +00295 <a class="code" href="a04558.html#a7">uint8</a> pos; +00296 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (pos); +00297 <span class="keywordtype">bool</span> isExternal; +00298 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (isExternal); +00299 +00300 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: + connec ident '%s' %s-%hu pos %hu ext %d"</span>, <a class="code" href="a05333.html#a132">from</a>->asString().c_str(), inSName.c_str(), inSid, (<a class="code" href="a04558.html#a9">uint16</a>)pos, (<a class="code" href="a04558.html#a7">uint8</a>)isExternal); +00301 +00302 <a class="code" href="a05379.html#a65">allstuffs</a> += <span class="stringliteral">"+rconnect "</span>+inSName+<span class="stringliteral">"-"</span>+<a class="code" href="a05378.html#a244">toString</a>(inSid)+<span class="stringliteral">" pos "</span>+<a class="code" href="a05378.html#a244">toString</a>((<a class="code" href="a04558.html#a9">uint16</a>)pos)+<span class="stringliteral">"\n"</span>; +00303 <a class="code" href="a05373.html#a4">test</a>.displayNL (<span class="stringliteral">"+rconnect %s-%hu pos %hu"</span>, inSName.c_str (), (<a class="code" href="a04558.html#a9">uint16</a>)inSid, (<a class="code" href="a04558.html#a9">uint16</a>)pos); +00304 +00305 <span class="keywordflow">if</span>(isExternal) +00306 { +00307 <a class="code" href="a04199.html#a6">nlassert</a> (pos == 0); +00308 } +00309 +00310 <span class="keywordflow">if</span> (inSid == 0) +00311 { +00312 <span class="keywordflow">if</span> (isExternal) +00313 { +00314 inSid = CUnifiedNetwork::getInstance ()->_ExtSId++; +00315 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Received a connection from a service with a SId 0, we give him the SId %d"</span>, inSid); +00316 } +00317 <span class="keywordflow">else</span> +00318 { +00319 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"HNETL5: Received a connection from a service with a SId 0 and wasn't external, disconnecting it"</span>); +00320 netbase.disconnect(); +00321 <span class="keywordflow">return</span>; +00322 } +00323 } +00324 +00325 <a class="code" href="a05333.html#a132">from</a>->setAppId(inSid); +00326 +00327 <span class="comment">// add a new connection to the list</span> +00328 <a class="code" href="a03632.html#NLNET_1_1CUnifiedNetworkd4">CUnifiedNetwork</a> *uni= CUnifiedNetwork::getInstance(); +00329 +00330 <span class="keywordflow">if</span>(inSid >= uni->_IdCnx.size ()) +00331 { +00332 uni->_IdCnx.resize (inSid+1); +00333 } +00334 +00335 <span class="keywordflow">switch</span>(uni->_IdCnx[inSid].State) +00336 { +00337 <span class="keywordflow">case</span> CUnifiedNetwork::CUnifiedConnection::NotUsed: <span class="comment">// add the new unified connection</span> +00338 uni->_IdCnx[inSid] = CUnifiedNetwork::CUnifiedConnection(inSName, inSid, isExternal); +00339 uni->_UsedConnection.push_back (inSid); +00340 <span class="keywordflow">break</span>; +00341 <span class="keywordflow">default</span>: +00342 <span class="keywordflow">break</span>; +00343 } +00344 +00345 <span class="keywordflow">if</span> (uni->_IdCnx[inSid].IsExternal != isExternal) +00346 { +00347 <a class="code" href="a05222.html#a0">AUTOCHECK_DISPLAY</a> (<span class="stringliteral">"HNETL5: Receive a connection that is not totally external %d %d"</span>, uni->_IdCnx[inSid].IsExternal, isExternal); +00348 <span class="keywordflow">return</span>; +00349 } +00350 +00351 <span class="keywordtype">bool</span> FirstConnection = (uni->_IdCnx[inSid].Connection.size () == 0); +00352 +00353 <span class="comment">// add the connection to the already inserted unified connection</span> +00354 <span class="keywordflow">if</span> (pos >= uni->_IdCnx[inSid].Connection.size ()) +00355 uni->_IdCnx[inSid].Connection.resize(pos+1); +00356 uni->_IdCnx[inSid].Connection[pos] = CUnifiedNetwork::CUnifiedConnection::TConnection(&netbase, from); +00357 +00358 <span class="comment">// If the connection is external, we'll never receive the ExtAddress by the naming service, so add it manually</span> +00359 <span class="keywordflow">if</span> (isExternal) +00360 { +00361 uni->_IdCnx[inSid].ExtAddress.push_back (netbase.hostAddress (from)); +00362 uni->_IdCnx[inSid].setupNetworkAssociation (uni->_NetworkAssociations, uni->_DefaultNetwork); +00363 } +00364 +00365 +00366 <span class="comment">// todo ace temp to savoir comment c est possible ce cas la</span> +00367 <span class="keywordflow">if</span> (uni->_IdCnx[inSid].Connection.size() == 3) +00368 { +00369 CUnifiedNetwork::CUnifiedConnection *uc = &uni->_IdCnx[inSid]; +00370 <a class="code" href="a04199.html#a12">nlstop</a>; +00371 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: ext addr %s"</span>, vectorCInetAddressToString (uc->ExtAddress).c_str ()); +00372 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i = 0; i < uc->Connection.size(); i++) +00373 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: cnx %s"</span>, uc->Connection[i].HostId->asString ().c_str ()); +00374 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL5: %s"</span>, <a class="code" href="a05379.html#a65">allstuffs</a>.c_str ()); +00375 } +00376 +00377 <span class="comment">// send the callback to the user with the first connection</span> +00378 <span class="keywordflow">if</span> (FirstConnection) +00379 { +00380 <span class="comment">// insert the name in the map to be able to send message with the name</span> +00381 uni->addNamedCnx (inSName, inSid); +00382 +00383 uni->callServiceUpCallback (inSName, inSid); +00384 <span class="comment">/*</span> +00385 <span class="comment"> // now we warn the user</span> +00386 <span class="comment"> CUnifiedNetwork::TNameMappedCallback::iterator it = uni->_UpCallbacks.find(inSName);</span> +00387 <span class="comment"> if (it != uni->_UpCallbacks.end())</span> +00388 <span class="comment"> {</span> +00389 <span class="comment"> // call it</span> +00390 <span class="comment"> for (list<TCallbackArgItem> it2 = (*it).second.begin(); it2 != (*it).second.end(); it2++)</span> +00391 <span class="comment"> {</span> +00392 <span class="comment"> TUnifiedNetCallback cb = (*it2).first;</span> +00393 <span class="comment"> if (cb) cb(inSName, inSid, (*it2).second);</span> +00394 <span class="comment"> }</span> +00395 <span class="comment"> }</span> +00396 <span class="comment"></span> +00397 <span class="comment"> for (uint c = 0; c < uni->_UpUniCallback.size (); c++)</span> +00398 <span class="comment"> {</span> +00399 <span class="comment"> if (uni->_UpUniCallback[c].first != NULL)</span> +00400 <span class="comment"> uni->_UpUniCallback[c].first (inSName, inSid, uni->_UpUniCallback[c].second);</span> +00401 <span class="comment"> }*/</span> +00402 } +00403 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn7" doxytag="NLNET::CUnifiedNetwork::uNetRegistrationBroadcast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void uNetRegistrationBroadcast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkn8" doxytag="NLNET::CUnifiedNetwork::uNetUnregistrationBroadcast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void uNetUnregistrationBroadcast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr0" doxytag="NLNET::CUnifiedNetwork::_Callbacks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky1">TMsgMappedCallback</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr0">NLNET::CUnifiedNetwork::_Callbacks</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Map of callbacks. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00454">454</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01188">addCallbackArray()</a>, <a class="el" href="a06645.html#l01393">findCallback()</a>, <a class="el" href="a06645.html#l02136">NLNET::NLMISC_COMMAND()</a>, <a class="el" href="a06645.html#l00599">release()</a>, and <a class="el" href="a06645.html#l00406">NLNET::uncbMsgProcessing()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr1" doxytag="NLNET::CUnifiedNetwork::_CbServer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02307.html">CCallbackServer</a>* <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr1">NLNET::CUnifiedNetwork::_CbServer</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +The callback server. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00433">433</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06646.html#l00481">CUnifiedNetwork()</a>, <a class="el" href="a06645.html#l01263">getBytesReceived()</a>, <a class="el" href="a06645.html#l01239">getBytesSent()</a>, <a class="el" href="a06645.html#l01311">getReceiveQueueSize()</a>, <a class="el" href="a06645.html#l01287">getSendQueueSize()</a>, <a class="el" href="a06645.html#l00479">init()</a>, <a class="el" href="a06645.html#l00599">release()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr2" doxytag="NLNET::CUnifiedNetwork::_DefaultNetwork" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::string> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr2">NLNET::CUnifiedNetwork::_DefaultNetwork</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +for each services, which network to take +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00478">478</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06646.html#l00184">addDefaultNetwork()</a>, <a class="el" href="a06645.html#l00653">addService()</a>, <a class="el" href="a06646.html#l00187">clearDefaultNetwork()</a>, <a class="el" href="a06645.html#l00284">NLNET::uncbServiceIdentification()</a>, and <a class="el" href="a06645.html#l00058">NLNET::uNetRegistrationBroadcast()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr3" doxytag="NLNET::CUnifiedNetwork::_DownCallbacks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky2">TNameMappedCallback</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr3">NLNET::CUnifiedNetwork::_DownCallbacks</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00441">441</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01797">callServiceDownCallback()</a>, <a class="el" href="a06645.html#l00599">release()</a>, and <a class="el" href="a06645.html#l01216">setServiceDownCallback()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr4" doxytag="NLNET::CUnifiedNetwork::_DownUniCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a>> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr4">NLNET::CUnifiedNetwork::_DownUniCallback</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00442">442</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01797">callServiceDownCallback()</a>, and <a class="el" href="a06645.html#l01216">setServiceDownCallback()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr5" doxytag="NLNET::CUnifiedNetwork::_ExtSId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr5">NLNET::CUnifiedNetwork::_ExtSId</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Used for external service. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00457">457</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00653">addService()</a>, and <a class="el" href="a06646.html#l00481">CUnifiedNetwork()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr6" doxytag="NLNET::CUnifiedNetwork::_IdCnx" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03633.html">CUnifiedConnection</a>> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr6">NLNET::CUnifiedNetwork::_IdCnx</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Vector of connections by service id (sid is the entry in this array, it means that there s some hole). +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00424">424</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00653">addService()</a>, <a class="el" href="a06645.html#l01517">autoCheck()</a>, <a class="el" href="a06645.html#l01599">displayInternalTables()</a>, <a class="el" href="a06645.html#l01030">findConnectionId()</a>, <a class="el" href="a06645.html#l01263">getBytesReceived()</a>, <a class="el" href="a06645.html#l01239">getBytesSent()</a>, <a class="el" href="a06645.html#l01335">getNetBase()</a>, <a class="el" href="a06645.html#l01311">getReceiveQueueSize()</a>, <a class="el" href="a06645.html#l01287">getSendQueueSize()</a>, <a class="el" href="a06645.html#l01498">getUnifiedConnection()</a>, <a class="el" href="a06645.html#l01420">isServiceLocal()</a>, <a class="el" href="a06645.html#l02098">NLNET::NLMISC_COMMAND()</a>, <a class="el" href="a06645.html#l00599">release()</a>, <a class="el" href="a06645.html#l01091">send()</a>, <a class="el" href="a06645.html#l01160">sendAll()</a>, <a class="el" href="a06645.html#l00284">NLNET::uncbServiceIdentification()</a>, <a class="el" href="a06645.html#l00058">NLNET::uNetRegistrationBroadcast()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr7" doxytag="NLNET::CUnifiedNetwork::_Initialised" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr7">NLNET::CUnifiedNetwork::_Initialised</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +true if initialisation function called +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00472">472</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkv0" doxytag="NLNET::CUnifiedNetwork::_Instance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03632.html">CUnifiedNetwork</a> * <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkv0">NLNET::CUnifiedNetwork::_Instance</a> = NULL<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +The main instance. +<p> + +<p> +Definition at line <a class="el" href="a06645.html#l01479">1479</a> of file <a class="el" href="a06645.html">unified_network.cpp</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr8" doxytag="NLNET::CUnifiedNetwork::_LastRetry" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05378.html#a242">NLMISC::TTime</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr8">NLNET::CUnifiedNetwork::_LastRetry</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Last time of retry. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00460">460</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06646.html#l00481">CUnifiedNetwork()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr9" doxytag="NLNET::CUnifiedNetwork::_Name" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::string <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr9">NLNET::CUnifiedNetwork::_Name</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Service name. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00451">451</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr10" doxytag="NLNET::CUnifiedNetwork::_NamedCnx" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03635.html">TNameMappedConnection</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr10">NLNET::CUnifiedNetwork::_NamedCnx</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Map of connections by service name. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00430">430</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01700">addNamedCnx()</a>, <a class="el" href="a06645.html#l01517">autoCheck()</a>, <a class="el" href="a06645.html#l01599">displayInternalTables()</a>, <a class="el" href="a06645.html#l01335">getNetBase()</a>, <a class="el" href="a06645.html#l01684">haveNamedCnx()</a>, <a class="el" href="a06645.html#l01402">isServiceLocal()</a>, <a class="el" href="a06645.html#l00599">release()</a>, <a class="el" href="a06645.html#l01727">removeNamedCnx()</a>, and <a class="el" href="a06645.html#l01091">send()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr11" doxytag="NLNET::CUnifiedNetwork::_NamingServiceAddr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02665.html">NLNET::CInetAddress</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr11">NLNET::CUnifiedNetwork::_NamingServiceAddr</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Naming service. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00469">469</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00479">init()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr12" doxytag="NLNET::CUnifiedNetwork::_NetworkAssociations" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a11">uint32</a>> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr12">NLNET::CUnifiedNetwork::_NetworkAssociations</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +for each nid, which network address +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00475">475</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01759">addNetworkAssociation()</a>, <a class="el" href="a06645.html#l00653">addService()</a>, <a class="el" href="a06645.html#l01517">autoCheck()</a>, <a class="el" href="a06646.html#l00175">clearNetworkAssociation()</a>, <a class="el" href="a06645.html#l01599">displayInternalTables()</a>, <a class="el" href="a06645.html#l00284">NLNET::uncbServiceIdentification()</a>, and <a class="el" href="a06645.html#l00058">NLNET::uNetRegistrationBroadcast()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr13" doxytag="NLNET::CUnifiedNetwork::_NextUpdateTime" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05378.html#a242">NLMISC::TTime</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr13">NLNET::CUnifiedNetwork::_NextUpdateTime</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Time of the theorical next update. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00463">463</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr14" doxytag="NLNET::CUnifiedNetwork::_RecordingState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr14">NLNET::CUnifiedNetwork::_RecordingState</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Recording state. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00445">445</a> of file <a class="el" href="a06646.html">unified_network.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr15" doxytag="NLNET::CUnifiedNetwork::_ServerPort" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr15">NLNET::CUnifiedNetwork::_ServerPort</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +The server port. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00436">436</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00479">init()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr16" doxytag="NLNET::CUnifiedNetwork::_SId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05379.html#a93">TServiceId</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr16">NLNET::CUnifiedNetwork::_SId</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Service id of the running service. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00448">448</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l02156">NLNET::NLMISC_COMMAND()</a>, and <a class="el" href="a06645.html#l00058">NLNET::uNetRegistrationBroadcast()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr17" doxytag="NLNET::CUnifiedNetwork::_UpCallbacks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky2">TNameMappedCallback</a> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr17">NLNET::CUnifiedNetwork::_UpCallbacks</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Map of the up/down service callbacks. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00439">439</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01768">callServiceUpCallback()</a>, <a class="el" href="a06645.html#l00599">release()</a>, and <a class="el" href="a06645.html#l01197">setServiceUpCallback()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr18" doxytag="NLNET::CUnifiedNetwork::_UpUniCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworky0">TCallbackArgItem</a>> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr18">NLNET::CUnifiedNetwork::_UpUniCallback</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00440">440</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l01768">callServiceUpCallback()</a>, and <a class="el" href="a06645.html#l01197">setServiceUpCallback()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CUnifiedNetworkr19" doxytag="NLNET::CUnifiedNetwork::_UsedConnection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a9">uint16</a>> <a class="el" href="a03632.html#NLNET_1_1CUnifiedNetworkr19">NLNET::CUnifiedNetwork::_UsedConnection</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +This vector contains only an index to the unified connection. It is used to have quick access on the available connections. +<p> + +<p> +Definition at line <a class="el" href="a06646.html#l00427">427</a> of file <a class="el" href="a06646.html">unified_network.h</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00653">addService()</a>, <a class="el" href="a06645.html#l01517">autoCheck()</a>, <a class="el" href="a06645.html#l01599">displayInternalTables()</a>, <a class="el" href="a06645.html#l01263">getBytesReceived()</a>, <a class="el" href="a06645.html#l01239">getBytesSent()</a>, <a class="el" href="a06646.html#l00227">getConnectionList()</a>, <a class="el" href="a06645.html#l01311">getReceiveQueueSize()</a>, <a class="el" href="a06645.html#l01287">getSendQueueSize()</a>, <a class="el" href="a06645.html#l00599">release()</a>, <a class="el" href="a06645.html#l00179">NLNET::uncbDisconnection()</a>, <a class="el" href="a06645.html#l00284">NLNET::uncbServiceIdentification()</a>, <a class="el" href="a06645.html#l00058">NLNET::uNetRegistrationBroadcast()</a>, <a class="el" href="a06645.html#l00100">NLNET::uNetUnregistrationBroadcast()</a>, and <a class="el" href="a06645.html#l00857">update()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06646.html">unified_network.h</a><li><a class="el" href="a06645.html">unified_network.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:06:55 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |