]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classserverrec.html
Fixed 'fake direction' messages being put out by user->registered = 7 being set too...
[user/henk/code/inspircd.git] / docs / module-doc / classserverrec.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>InspIRCd: serverrec class Reference</title>
4 <link href="inspircd.doxygen.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.3.3 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
8 <h1>serverrec Class Reference</h1>A class that defines the local server or a remote server.  
9 <a href="#_details">More...</a>
10 <p>
11 <code>#include &lt;<a class="el" href="servers_8h-source.html">servers.h</a>&gt;</code>
12 <p>
13 Inheritance diagram for serverrec:<p><center><img src="classserverrec__inherit__graph.gif" border="0" usemap="#serverrec__inherit__map" alt="Inheritance graph"></center>
14 <map name="serverrec__inherit__map">
15 <area href="classconnection.html" shape="rect" coords="7,157,93,184" alt="">
16 <area href="classExtensible.html" shape="rect" coords="9,82,91,109" alt="">
17 <area href="classclassbase.html" shape="rect" coords="10,8,90,34" alt="">
18 </map>
19 <center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for serverrec:<p><center><img src="classserverrec__coll__graph.gif" border="0" usemap="#serverrec__coll__map" alt="Collaboration graph"></center>
20 <map name="serverrec__coll__map">
21 <area href="classconnection.html" shape="rect" coords="210,249,296,275" alt="">
22 </map>
23 <center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center><a href="classserverrec-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
24 <tr><td></td></tr>
25 <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
26 <tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a0">serverrec</a> ()</td></tr>
27
28 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. </em> <a href="#a0"></a><em><br><br></td></tr>
29 <tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a1">serverrec</a> (char *n, long ver, bool jupe)</td></tr>
30
31 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor which initialises some of the main variables. </em> <a href="#a1"></a><em><br><br></td></tr>
32 <tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a2">~serverrec</a> ()</td></tr>
33
34 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. </em> <a href="#a2"></a><em><br><br></td></tr>
35 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a3">CreateListener</a> (char *<a class="el" href="classconnection.html#o1">host</a>, int p)</td></tr>
36
37 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a listening socket on 'host' using port number 'p'. </em> <a href="#a3"></a><em><br><br></td></tr>
38 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a4">BeginLink</a> (char *targethost, int <a class="el" href="classconnection.html#o8">port</a>, char *password, char *servername, int myport)</td></tr>
39
40 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Begin an outbound link to another ircd at targethost. </em> <a href="#a4"></a><em><br><br></td></tr>
41 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a5">MeshCookie</a> (char *targethost, int <a class="el" href="classconnection.html#o8">port</a>, unsigned long cookie, char *servername)</td></tr>
42
43 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Begin an outbound mesh link to another ircd on a network you are already an authenticated member of. </em> <a href="#a5"></a><em><br><br></td></tr>
44 <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a6">TerminateLink</a> (char *targethost)</td></tr>
45
46 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Terminate a link to 'targethost' by calling the <a class="el" href="classircd__connector.html#a14">ircd_connector::CloseConnection</a> method. </em> <a href="#a6"></a><em><br><br></td></tr>
47 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a7">SendPacket</a> (char *message, const char *<a class="el" href="classconnection.html#o1">host</a>)</td></tr>
48
49 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send a message to a server by name, if the server is unavailable directly route the packet via another server If the server still cannot be reached after attempting to route the message remotely, returns false. </em> <a href="#a7"></a><em><br><br></td></tr>
50 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a8">RecvPacket</a> (std::deque&lt; std::string &gt; &amp;messages, char *<a class="el" href="classconnection.html#o1">host</a>, std::deque&lt; std::string &gt; &amp;sums)</td></tr>
51
52 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the next available packet and returns true if data is available. </em> <a href="#a8"></a><em><br><br></td></tr>
53 <tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="classircd__connector.html">ircd_connector</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a9">FindHost</a> (std::string <a class="el" href="classconnection.html#o1">host</a>)</td></tr>
54
55 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find the <a class="el" href="classircd__connector.html">ircd_connector</a> oject related to a certain servername given in 'host'. </em> <a href="#a9"></a><em><br><br></td></tr>
56 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a10">AddIncoming</a> (int <a class="el" href="classconnection.html#o0">fd</a>, char *targethost, int sourceport)</td></tr>
57
58 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add an incoming connection to the connection pool. </em> <a href="#a10"></a><em><br><br></td></tr>
59 <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#a11">FlushWriteBuffers</a> ()</td></tr>
60
61 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Flushes all data waiting to be written for all of this server's connections. </em> <a href="#a11"></a><em><br><br></td></tr>
62 <tr><td colspan=2><br><h2>Public Attributes</h2></td></tr>
63 <tr><td class="memItemLeft" nowrap align=right valign=top>char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o0">name</a> [MAXBUF]</td></tr>
64
65 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">server name </em> <a href="#o0"></a><em><br><br></td></tr>
66 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o1">pingtime</a></td></tr>
67
68 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">last ping response (ms) </em> <a href="#o1"></a><em><br><br></td></tr>
69 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o2">usercount_i</a></td></tr>
70
71 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">invisible users on server </em> <a href="#o2"></a><em><br><br></td></tr>
72 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o3">usercount</a></td></tr>
73
74 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">non-invisible users on server </em> <a href="#o3"></a><em><br><br></td></tr>
75 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o4">opercount</a></td></tr>
76
77 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">opers on server </em> <a href="#o4"></a><em><br><br></td></tr>
78 <tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o5">hops_away</a></td></tr>
79
80 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">number of hops away (for quick access) </em> <a href="#o5"></a><em><br><br></td></tr>
81 <tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o6">version</a></td></tr>
82
83 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">ircd version </em> <a href="#o6"></a><em><br><br></td></tr>
84 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o7">jupiter</a></td></tr>
85
86 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">is a JUPE server (faked to enforce a server ban) </em> <a href="#o7"></a><em><br><br></td></tr>
87 <tr><td class="memItemLeft" nowrap align=right valign=top>char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o8">description</a> [MAXBUF]</td></tr>
88
89 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Description of the server. </em> <a href="#o8"></a><em><br><br></td></tr>
90 <tr><td class="memItemLeft" nowrap align=right valign=top>char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o9">nickserv</a> [NICKMAX]</td></tr>
91
92 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Holds nickserv's name on U:lined (services) servers (this is a kludge for ircservices which ASSUMES things :/). </em> <a href="#o9"></a><em><br><br></td></tr>
93 <tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o10">sync_soon</a></td></tr>
94
95 <tr><td class="memItemLeft" nowrap align=right valign=top>std::vector&lt; <a class="el" href="classircd__connector.html">ircd_connector</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classserverrec.html#o11">connectors</a></td></tr>
96
97 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">With a serverrec, this is a list of all established server connections. </em> <a href="#o11"></a><em><br><br></td></tr>
98 </table>
99 <hr><a name="_details"></a><h2>Detailed Description</h2>
100 A class that defines the local server or a remote server. 
101 <p>
102
103 <p>
104 Definition at line <a class="el" href="servers_8h-source.html#l00030">30</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
105 <a name="a0" doxytag="serverrec::serverrec"></a><p>
106 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
107   <tr>
108     <td class="mdRow">
109       <table cellpadding="0" cellspacing="0" border="0">
110         <tr>
111           <td class="md" nowrap valign="top"> serverrec::serverrec </td>
112           <td class="md" valign="top">(&nbsp;</td>
113           <td class="mdname1" valign="top" nowrap>          </td>
114           <td class="md" valign="top">&nbsp;)&nbsp;</td>
115           <td class="md" nowrap></td>
116         </tr>
117
118       </table>
119     </td>
120   </tr>
121 </table>
122 <table cellspacing=5 cellpadding=0 border=0>
123   <tr>
124     <td>
125       &nbsp;
126     </td>
127     <td>
128
129 <p>
130 Constructor. 
131 <p>
132
133 <p>
134 Definition at line <a class="el" href="servers_8cpp-source.html#l00046">46</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
135 <p>
136 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="connection_8h-source.html#l00301">connection::fd</a>, <a class="el" href="servers_8h-source.html#l00051">hops_away</a>, <a class="el" href="servers_8h-source.html#l00057">jupiter</a>, <a class="el" href="connection_8h-source.html#l00343">connection::lastping</a>, <a class="el" href="servers_8h-source.html#l00036">name</a>, <a class="el" href="servers_8h-source.html#l00065">nickserv</a>, <a class="el" href="servers_8h-source.html#l00048">opercount</a>, <a class="el" href="servers_8h-source.html#l00039">pingtime</a>, <a class="el" href="connection_8h-source.html#l00347">connection::signon</a>, <a class="el" href="servers_8h-source.html#l00067">sync_soon</a>, <a class="el" href="channels_8cpp-source.html#l00101">TIME</a>, <a class="el" href="servers_8h-source.html#l00045">usercount</a>, <a class="el" href="servers_8h-source.html#l00042">usercount_i</a>, and <a class="el" href="servers_8h-source.html#l00054">version</a>.
137 <p>
138 <div class="fragment"><pre>00047 {
139 00048         strlcpy(name,<span class="stringliteral">""</span>,256);
140 00049         <a class="code" href="classserverrec.html#o1">pingtime</a> = 0;
141 00050         <a class="code" href="classconnection.html#o10">lastping</a> = <a class="code" href="channels_8cpp.html#a36">TIME</a>;
142 00051         <a class="code" href="classserverrec.html#o2">usercount_i</a> = <a class="code" href="classserverrec.html#o3">usercount</a> = <a class="code" href="classserverrec.html#o4">opercount</a> = <a class="code" href="classserverrec.html#o6">version</a> = 0;
143 00052         <a class="code" href="classserverrec.html#o5">hops_away</a> = 1;
144 00053         <a class="code" href="classconnection.html#o11">signon</a> = <a class="code" href="channels_8cpp.html#a36">TIME</a>;
145 00054         <a class="code" href="classserverrec.html#o7">jupiter</a> = <span class="keyword">false</span>;
146 00055         <a class="code" href="classconnection.html#o0">fd</a> = 0;
147 00056         <a class="code" href="classserverrec.html#o10">sync_soon</a> = <span class="keyword">false</span>;
148 00057         strlcpy(nickserv,<span class="stringliteral">""</span>,NICKMAX);
149 00058         <a class="code" href="classserverrec.html#o11">connectors</a>.clear();
150 00059 }
151 </pre></div>    </td>
152   </tr>
153 </table>
154 <a name="a1" doxytag="serverrec::serverrec"></a><p>
155 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
156   <tr>
157     <td class="mdRow">
158       <table cellpadding="0" cellspacing="0" border="0">
159         <tr>
160           <td class="md" nowrap valign="top"> serverrec::serverrec </td>
161           <td class="md" valign="top">(&nbsp;</td>
162           <td class="md" nowrap valign="top">char *&nbsp;</td>
163           <td class="mdname" nowrap> <em>n</em>, </td>
164         </tr>
165         <tr>
166           <td></td>
167           <td></td>
168           <td class="md" nowrap>long&nbsp;</td>
169           <td class="mdname" nowrap> <em>ver</em>, </td>
170         </tr>
171         <tr>
172           <td></td>
173           <td></td>
174           <td class="md" nowrap>bool&nbsp;</td>
175           <td class="mdname" nowrap> <em>jupe</em></td>
176         </tr>
177         <tr>
178           <td></td>
179           <td class="md">)&nbsp;</td>
180           <td class="md" colspan="2"></td>
181         </tr>
182
183       </table>
184     </td>
185   </tr>
186 </table>
187 <table cellspacing=5 cellpadding=0 border=0>
188   <tr>
189     <td>
190       &nbsp;
191     </td>
192     <td>
193
194 <p>
195 Constructor which initialises some of the main variables. 
196 <p>
197
198 <p>
199 Definition at line <a class="el" href="servers_8cpp-source.html#l00066">66</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
200 <p>
201 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="connection_8h-source.html#l00301">connection::fd</a>, <a class="el" href="servers_8h-source.html#l00051">hops_away</a>, <a class="el" href="servers_8h-source.html#l00057">jupiter</a>, <a class="el" href="connection_8h-source.html#l00343">connection::lastping</a>, <a class="el" href="servers_8h-source.html#l00036">name</a>, <a class="el" href="servers_8h-source.html#l00065">nickserv</a>, <a class="el" href="servers_8h-source.html#l00048">opercount</a>, <a class="el" href="connection_8h-source.html#l00347">connection::signon</a>, <a class="el" href="servers_8h-source.html#l00067">sync_soon</a>, <a class="el" href="channels_8cpp-source.html#l00101">TIME</a>, <a class="el" href="servers_8h-source.html#l00045">usercount</a>, <a class="el" href="servers_8h-source.html#l00042">usercount_i</a>, and <a class="el" href="servers_8h-source.html#l00054">version</a>.
202 <p>
203 <div class="fragment"><pre>00067 {
204 00068         strlcpy(name,n,256);
205 00069         <a class="code" href="classconnection.html#o10">lastping</a> = <a class="code" href="channels_8cpp.html#a36">TIME</a>;
206 00070         <a class="code" href="classserverrec.html#o2">usercount_i</a> = <a class="code" href="classserverrec.html#o3">usercount</a> = <a class="code" href="classserverrec.html#o4">opercount</a> = 0;
207 00071         <a class="code" href="classserverrec.html#o6">version</a> = ver;
208 00072         <a class="code" href="classserverrec.html#o5">hops_away</a> = 1;
209 00073         <a class="code" href="classconnection.html#o11">signon</a> = <a class="code" href="channels_8cpp.html#a36">TIME</a>;
210 00074         <a class="code" href="classserverrec.html#o7">jupiter</a> = jupe;
211 00075         <a class="code" href="classconnection.html#o0">fd</a> = 0;
212 00076         <a class="code" href="classserverrec.html#o10">sync_soon</a> = <span class="keyword">false</span>;
213 00077         strlcpy(nickserv,<span class="stringliteral">""</span>,NICKMAX);
214 00078         <a class="code" href="classserverrec.html#o11">connectors</a>.clear();
215 00079 }
216 </pre></div>    </td>
217   </tr>
218 </table>
219 <a name="a2" doxytag="serverrec::~serverrec"></a><p>
220 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
221   <tr>
222     <td class="mdRow">
223       <table cellpadding="0" cellspacing="0" border="0">
224         <tr>
225           <td class="md" nowrap valign="top"> serverrec::~<a class="el" href="classserverrec.html">serverrec</a> </td>
226           <td class="md" valign="top">(&nbsp;</td>
227           <td class="mdname1" valign="top" nowrap>          </td>
228           <td class="md" valign="top">&nbsp;)&nbsp;</td>
229           <td class="md" nowrap></td>
230         </tr>
231
232       </table>
233     </td>
234   </tr>
235 </table>
236 <table cellspacing=5 cellpadding=0 border=0>
237   <tr>
238     <td>
239       &nbsp;
240     </td>
241     <td>
242
243 <p>
244 Destructor. 
245 <p>
246
247 <p>
248 Definition at line <a class="el" href="servers_8cpp-source.html#l00062">62</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
249 <p>
250 <div class="fragment"><pre>00063 {
251 00064 }
252 </pre></div>    </td>
253   </tr>
254 </table>
255 <hr><h2>Member Function Documentation</h2>
256 <a name="a10" doxytag="serverrec::AddIncoming"></a><p>
257 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
258   <tr>
259     <td class="mdRow">
260       <table cellpadding="0" cellspacing="0" border="0">
261         <tr>
262           <td class="md" nowrap valign="top"> bool serverrec::AddIncoming </td>
263           <td class="md" valign="top">(&nbsp;</td>
264           <td class="md" nowrap valign="top">int&nbsp;</td>
265           <td class="mdname" nowrap> <em>fd</em>, </td>
266         </tr>
267         <tr>
268           <td></td>
269           <td></td>
270           <td class="md" nowrap>char *&nbsp;</td>
271           <td class="mdname" nowrap> <em>targethost</em>, </td>
272         </tr>
273         <tr>
274           <td></td>
275           <td></td>
276           <td class="md" nowrap>int&nbsp;</td>
277           <td class="mdname" nowrap> <em>sourceport</em></td>
278         </tr>
279         <tr>
280           <td></td>
281           <td class="md">)&nbsp;</td>
282           <td class="md" colspan="2"></td>
283         </tr>
284
285       </table>
286     </td>
287   </tr>
288 </table>
289 <table cellspacing=5 cellpadding=0 border=0>
290   <tr>
291     <td>
292       &nbsp;
293     </td>
294     <td>
295
296 <p>
297 Add an incoming connection to the connection pool. 
298 <p>
299 (reserved for core use) 
300 <p>
301 Definition at line <a class="el" href="servers_8cpp-source.html#l00212">212</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
302 <p>
303 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="modules_8h-source.html#l00023">DEBUG</a>, <a class="el" href="classircd__connector.html#a5">ircd_connector::SetDescriptor()</a>, <a class="el" href="classircd__connector.html#a13">ircd_connector::SetHostAndPort()</a>, <a class="el" href="classircd__connector.html#a3">ircd_connector::SetServerName()</a>, <a class="el" href="classircd__connector.html#a7">ircd_connector::SetState()</a>, and <a class="el" href="connection_8h-source.html#l00038">STATE_NOAUTH_INBOUND</a>.
304 <p>
305 <div class="fragment"><pre>00213 {
306 00214         <a class="code" href="classircd__connector.html">ircd_connector</a> connector;
307 00215 
308 00216         <span class="comment">// targethost has been turned into an ip...</span>
309 00217         <span class="comment">// we dont want this as the server name.</span>
310 00218         connector.<a class="code" href="classircd__connector.html#a3">SetServerName</a>(targethost);
311 00219         connector.<a class="code" href="classircd__connector.html#a5">SetDescriptor</a>(newfd);
312 00220         connector.<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_NOAUTH_INBOUND);
313 00221         <span class="keywordtype">int</span> flags = fcntl(newfd, F_GETFL, 0);
314 00222         fcntl(newfd, F_SETFL, flags | O_NONBLOCK);
315 00223         <span class="keywordtype">int</span> sendbuf = 32768;
316 00224         <span class="keywordtype">int</span> recvbuf = 32768;
317 00225         setsockopt(newfd,SOL_SOCKET,SO_SNDBUF,(<span class="keyword">const</span> <span class="keywordtype">void</span> *)&amp;sendbuf,<span class="keyword">sizeof</span>(sendbuf));
318 00226         setsockopt(newfd,SOL_SOCKET,SO_RCVBUF,(<span class="keyword">const</span> <span class="keywordtype">void</span> *)&amp;recvbuf,<span class="keyword">sizeof</span>(sendbuf));
319 00227         connector.<a class="code" href="classircd__connector.html#a13">SetHostAndPort</a>(targethost, sourceport);
320 00228         connector.<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_NOAUTH_INBOUND);
321 00229         log(DEBUG,<span class="stringliteral">"serverrec::AddIncoming() Added connection: %s:%d"</span>,targethost,sourceport);
322 00230         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.push_back(connector);
323 00231         <span class="keywordflow">return</span> <span class="keyword">true</span>;
324 00232 }
325 </pre></div>    </td>
326   </tr>
327 </table>
328 <a name="a4" doxytag="serverrec::BeginLink"></a><p>
329 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
330   <tr>
331     <td class="mdRow">
332       <table cellpadding="0" cellspacing="0" border="0">
333         <tr>
334           <td class="md" nowrap valign="top"> bool serverrec::BeginLink </td>
335           <td class="md" valign="top">(&nbsp;</td>
336           <td class="md" nowrap valign="top">char *&nbsp;</td>
337           <td class="mdname" nowrap> <em>targethost</em>, </td>
338         </tr>
339         <tr>
340           <td></td>
341           <td></td>
342           <td class="md" nowrap>int&nbsp;</td>
343           <td class="mdname" nowrap> <em>port</em>, </td>
344         </tr>
345         <tr>
346           <td></td>
347           <td></td>
348           <td class="md" nowrap>char *&nbsp;</td>
349           <td class="mdname" nowrap> <em>password</em>, </td>
350         </tr>
351         <tr>
352           <td></td>
353           <td></td>
354           <td class="md" nowrap>char *&nbsp;</td>
355           <td class="mdname" nowrap> <em>servername</em>, </td>
356         </tr>
357         <tr>
358           <td></td>
359           <td></td>
360           <td class="md" nowrap>int&nbsp;</td>
361           <td class="mdname" nowrap> <em>myport</em></td>
362         </tr>
363         <tr>
364           <td></td>
365           <td class="md">)&nbsp;</td>
366           <td class="md" colspan="2"></td>
367         </tr>
368
369       </table>
370     </td>
371   </tr>
372 </table>
373 <table cellspacing=5 cellpadding=0 border=0>
374   <tr>
375     <td>
376       &nbsp;
377     </td>
378     <td>
379
380 <p>
381 Begin an outbound link to another ircd at targethost. 
382 <p>
383
384 <p>
385 Definition at line <a class="el" href="servers_8cpp-source.html#l00142">142</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
386 <p>
387 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="connection_8h-source.html#l00301">connection::fd</a>, <a class="el" href="servers_8cpp-source.html#l00242">FindHost()</a>, <a class="el" href="classircd__connector.html#a1">ircd_connector::MakeOutboundConnection()</a>, <a class="el" href="servers_8cpp-source.html#l00350">SendPacket()</a>, <a class="el" href="classircd__connector.html#a13">ircd_connector::SetHostAndPort()</a>, <a class="el" href="classircd__connector.html#a3">ircd_connector::SetServerName()</a>, <a class="el" href="classircd__connector.html#a7">ircd_connector::SetState()</a>, <a class="el" href="connection_8h-source.html#l00035">STATE_DISCONNECTED</a>, and <a class="el" href="connection_8h-source.html#l00039">STATE_NOAUTH_OUTBOUND</a>.
388 <p>
389 <div class="fragment"><pre>00143 {
390 00144         <span class="keywordtype">char</span> connect[MAXBUF];
391 00145 
392 00146         <a class="code" href="classircd__connector.html">ircd_connector</a> connector;
393 00147         <a class="code" href="classircd__connector.html">ircd_connector</a> *cn = this-&gt;<a class="code" href="classserverrec.html#a9">FindHost</a>(servername);
394 00148 
395 00149 
396 00150         <span class="keywordflow">if</span> (cn)
397 00151         {
398 00152                 WriteOpers(<span class="stringliteral">"CONNECT aborted: Server %s already exists"</span>,servername);
399 00153                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
400 00154         }
401 00155 
402 00156 
403 00157         <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classconnection.html#o0">fd</a>)
404 00158         {
405 00159                 <span class="keywordflow">if</span> (connector.<a class="code" href="classircd__connector.html#a1">MakeOutboundConnection</a>(targethost,newport))
406 00160                 {
407 00161                         <span class="comment">// targethost has been turned into an ip...</span>
408 00162                         <span class="comment">// we dont want this as the server name.</span>
409 00163                         connector.<a class="code" href="classircd__connector.html#a3">SetServerName</a>(servername);
410 00164                         snprintf(connect,MAXBUF,<span class="stringliteral">"S %s %s %lu %s :%s"</span>,getservername().c_str(),password,(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)myport,GetRevision().c_str(),getserverdesc().c_str());
411 00165                         connector.<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_NOAUTH_OUTBOUND);
412 00166                         connector.<a class="code" href="classircd__connector.html#a13">SetHostAndPort</a>(targethost, newport);
413 00167                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.push_back(connector);
414 00168                         <span class="comment">// this packet isn't actually sent until the socket connects -- the STATE_NOAUTH_OUTBOUND state</span>
415 00169                         <span class="comment">// queues outbound data until the socket is polled as writeable (e.g. the connection is established)</span>
416 00170                         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classserverrec.html#a7">SendPacket</a>(connect, servername);
417 00171                 }
418 00172                 <span class="keywordflow">else</span>
419 00173                 {
420 00174                         connector.<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_DISCONNECTED);
421 00175                         WriteOpers(<span class="stringliteral">"Could not create outbound connection to %s:%d"</span>,targethost,newport);
422 00176                 }
423 00177         }
424 00178         <span class="keywordflow">return</span> <span class="keyword">false</span>;
425 00179 }
426 </pre></div>    </td>
427   </tr>
428 </table>
429 <a name="a3" doxytag="serverrec::CreateListener"></a><p>
430 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
431   <tr>
432     <td class="mdRow">
433       <table cellpadding="0" cellspacing="0" border="0">
434         <tr>
435           <td class="md" nowrap valign="top"> bool serverrec::CreateListener </td>
436           <td class="md" valign="top">(&nbsp;</td>
437           <td class="md" nowrap valign="top">char *&nbsp;</td>
438           <td class="mdname" nowrap> <em>host</em>, </td>
439         </tr>
440         <tr>
441           <td></td>
442           <td></td>
443           <td class="md" nowrap>int&nbsp;</td>
444           <td class="mdname" nowrap> <em>p</em></td>
445         </tr>
446         <tr>
447           <td></td>
448           <td class="md">)&nbsp;</td>
449           <td class="md" colspan="2"></td>
450         </tr>
451
452       </table>
453     </td>
454   </tr>
455 </table>
456 <table cellspacing=5 cellpadding=0 border=0>
457   <tr>
458     <td>
459       &nbsp;
460     </td>
461     <td>
462
463 <p>
464 Create a listening socket on 'host' using port number 'p'. 
465 <p>
466
467 <p>
468 Definition at line <a class="el" href="servers_8cpp-source.html#l00081">81</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
469 <p>
470 References <a class="el" href="connection_8h-source.html#l00301">connection::fd</a>, <a class="el" href="servers_8cpp-source.html#l00038">MaxConn</a>, and <a class="el" href="connection_8h-source.html#l00335">connection::port</a>.
471 <p>
472 <div class="fragment"><pre>00082 {
473 00083         sockaddr_in host_address;
474 00084         <span class="keywordtype">int</span> flags;
475 00085         in_addr addy;
476 00086         <span class="keywordtype">int</span> on = 0;
477 00087         <span class="keyword">struct </span>linger linger = { 0 };
478 00088 
479 00089         this-&gt;<a class="code" href="classconnection.html#o8">port</a> = p;
480 00090 
481 00091         <a class="code" href="classconnection.html#o0">fd</a> = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
482 00092         <span class="keywordflow">if</span> (<a class="code" href="classconnection.html#o0">fd</a> &lt;= 0)
483 00093         {
484 00094                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
485 00095         }
486 00096 
487 00097         setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(<span class="keyword">const</span> <span class="keywordtype">char</span>*)&amp;on,<span class="keyword">sizeof</span>(on));
488 00098         linger.l_onoff = 1;
489 00099         linger.l_linger = 1;
490 00100         setsockopt(fd,SOL_SOCKET,SO_LINGER,(<span class="keyword">const</span> <span class="keywordtype">char</span>*)&amp;linger,<span class="keyword">sizeof</span>(linger));
491 00101 
492 00102         <span class="comment">// attempt to increase socket sendq and recvq as high as its possible</span>
493 00103         <span class="comment">// to get them on linux.</span>
494 00104         <span class="keywordtype">int</span> sendbuf = 32768;
495 00105         <span class="keywordtype">int</span> recvbuf = 32768;
496 00106         setsockopt(fd,SOL_SOCKET,SO_SNDBUF,(<span class="keyword">const</span> <span class="keywordtype">void</span> *)&amp;sendbuf,<span class="keyword">sizeof</span>(sendbuf));
497 00107         setsockopt(fd,SOL_SOCKET,SO_RCVBUF,(<span class="keyword">const</span> <span class="keywordtype">void</span> *)&amp;recvbuf,<span class="keyword">sizeof</span>(sendbuf));
498 00108 
499 00109         memset((<span class="keywordtype">void</span>*)&amp;host_address, 0, <span class="keyword">sizeof</span>(host_address));
500 00110 
501 00111         host_address.sin_family = AF_INET;
502 00112 
503 00113         <span class="keywordflow">if</span> (!strcmp(newhost,<span class="stringliteral">""</span>))
504 00114         {
505 00115                 host_address.sin_addr.s_addr = htonl(INADDR_ANY);
506 00116         }
507 00117         <span class="keywordflow">else</span>
508 00118         {
509 00119                 inet_aton(newhost,&amp;addy);
510 00120                 host_address.sin_addr = addy;
511 00121         }
512 00122 
513 00123         host_address.sin_port = htons(p);
514 00124 
515 00125         <span class="keywordflow">if</span> (bind(fd,(sockaddr*)&amp;host_address,<span class="keyword">sizeof</span>(host_address))&lt;0)
516 00126         {
517 00127                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
518 00128         }
519 00129 
520 00130         <span class="comment">// make the socket non-blocking</span>
521 00131         flags = fcntl(fd, F_GETFL, 0);
522 00132         fcntl(fd, F_SETFL, flags | O_NONBLOCK);
523 00133 
524 00134         this-&gt;<a class="code" href="classconnection.html#o8">port</a> = p;
525 00135 
526 00136         listen(this-&gt;fd, MaxConn);
527 00137 
528 00138         <span class="keywordflow">return</span> <span class="keyword">true</span>;
529 00139 }
530 </pre></div>    </td>
531   </tr>
532 </table>
533 <a name="a9" doxytag="serverrec::FindHost"></a><p>
534 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
535   <tr>
536     <td class="mdRow">
537       <table cellpadding="0" cellspacing="0" border="0">
538         <tr>
539           <td class="md" nowrap valign="top"> <a class="el" href="classircd__connector.html">ircd_connector</a> * serverrec::FindHost </td>
540           <td class="md" valign="top">(&nbsp;</td>
541           <td class="md" nowrap valign="top">std::string&nbsp;</td>
542           <td class="mdname1" valign="top" nowrap> <em>host</em>          </td>
543           <td class="md" valign="top">&nbsp;)&nbsp;</td>
544           <td class="md" nowrap></td>
545         </tr>
546
547       </table>
548     </td>
549   </tr>
550 </table>
551 <table cellspacing=5 cellpadding=0 border=0>
552   <tr>
553     <td>
554       &nbsp;
555     </td>
556     <td>
557
558 <p>
559 Find the <a class="el" href="classircd__connector.html">ircd_connector</a> oject related to a certain servername given in 'host'. 
560 <p>
561
562 <p>
563 Definition at line <a class="el" href="servers_8cpp-source.html#l00242">242</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
564 <p>
565 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>.
566 <p>
567 Referenced by <a class="el" href="servers_8cpp-source.html#l00142">BeginLink()</a>, and <a class="el" href="servers_8cpp-source.html#l00350">SendPacket()</a>.
568 <p>
569 <div class="fragment"><pre>00243 {
570 00244         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.size(); i++)
571 00245         {
572 00246                 <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].GetServerName() == findhost)
573 00247                 {
574 00248                         <span class="keywordflow">return</span> &amp;this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i];
575 00249                 }
576 00250         }
577 00251         <span class="keywordflow">return</span> NULL;
578 00252 }
579 </pre></div>    </td>
580   </tr>
581 </table>
582 <a name="a11" doxytag="serverrec::FlushWriteBuffers"></a><p>
583 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
584   <tr>
585     <td class="mdRow">
586       <table cellpadding="0" cellspacing="0" border="0">
587         <tr>
588           <td class="md" nowrap valign="top"> void serverrec::FlushWriteBuffers </td>
589           <td class="md" valign="top">(&nbsp;</td>
590           <td class="mdname1" valign="top" nowrap>          </td>
591           <td class="md" valign="top">&nbsp;)&nbsp;</td>
592           <td class="md" nowrap></td>
593         </tr>
594
595       </table>
596     </td>
597   </tr>
598 </table>
599 <table cellspacing=5 cellpadding=0 border=0>
600   <tr>
601     <td>
602       &nbsp;
603     </td>
604     <td>
605
606 <p>
607 Flushes all data waiting to be written for all of this server's connections. 
608 <p>
609
610 <p>
611 Definition at line <a class="el" href="servers_8cpp-source.html#l00274">274</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
612 <p>
613 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="servers_8cpp-source.html#l00042">has_been_netsplit</a>, <a class="el" href="servers_8cpp-source.html#l00256">IsRoutable()</a>, <a class="el" href="connection_8h-source.html#l00035">STATE_DISCONNECTED</a>, <a class="el" href="connection_8h-source.html#l00038">STATE_NOAUTH_INBOUND</a>, <a class="el" href="connection_8h-source.html#l00039">STATE_NOAUTH_OUTBOUND</a>, and <a class="el" href="channels_8cpp-source.html#l00101">TIME</a>.
614 <p>
615 <div class="fragment"><pre>00275 {
616 00276         <span class="keywordtype">char</span> buffer[MAXBUF];
617 00277         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.size(); i++)
618 00278         {
619 00279                 <span class="comment">// don't try and ping a NOAUTH_OUTBOUND state, its not authed yet!</span>
620 00280                 <span class="keywordflow">if</span> ((this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].GetState() == <a class="code" href="connection_8h.html#a4">STATE_NOAUTH_OUTBOUND</a>) &amp;&amp; (<a class="code" href="channels_8cpp.html#a36">TIME</a> &gt; this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].age+30))
621 00281                 {
622 00282                         <span class="comment">// however if we reach this timer its connected timed out :)</span>
623 00283                         WriteOpers(<span class="stringliteral">"*** Connection to %s timed out"</span>,this-&gt;connectors[i].GetServerName().c_str());
624 00284                         snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
625 00285                         NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
626 00286                         DoSplit(this-&gt;connectors[i].GetServerName().c_str());
627 00287                         <span class="keywordflow">return</span>;
628 00288                 }
629 00289                 <span class="keywordflow">if</span> ((this-&gt;connectors[i].GetState() == <a class="code" href="connection_8h.html#a3">STATE_NOAUTH_INBOUND</a>) &amp;&amp; (<a class="code" href="channels_8cpp.html#a36">TIME</a> &gt; this-&gt;connectors[i].age+30))
630 00290                 {
631 00291                         WriteOpers(<span class="stringliteral">"*** Connection from %s timed out"</span>,this-&gt;connectors[i].GetServerName().c_str());
632 00292                         snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
633 00293                         NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
634 00294                         DoSplit(this-&gt;connectors[i].GetServerName().c_str());
635 00295                         <span class="keywordflow">return</span>;
636 00296                 }
637 00297                 <span class="keywordflow">if</span> (this-&gt;connectors[i].GetState() != <a class="code" href="connection_8h.html#a0">STATE_DISCONNECTED</a>)
638 00298                 {
639 00299                         <span class="keywordflow">if</span> (!this-&gt;connectors[i].CheckPing())
640 00300                         {
641 00301                                 WriteOpers(<span class="stringliteral">"*** Lost single connection to %s: Ping timeout"</span>,this-&gt;connectors[i].GetServerName().c_str());
642 00302                                 this-&gt;connectors[i].CloseConnection();
643 00303                                 this-&gt;connectors[i].SetState(STATE_DISCONNECTED);
644 00304                                 <span class="keywordflow">if</span> (!<a class="code" href="servers_8cpp.html#a5">IsRoutable</a>(this-&gt;connectors[i].GetServerName()))
645 00305                                 {
646 00306                                         WriteOpers(<span class="stringliteral">"*** Server %s is no longer routable, disconnecting."</span>,this-&gt;connectors[i].GetServerName().c_str());
647 00307                                         snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
648 00308                                         NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
649 00309                                         DoSplit(this-&gt;connectors[i].GetServerName().c_str());
650 00310                                 }
651 00311                                 <a class="code" href="servers_8cpp.html#a3">has_been_netsplit</a> = <span class="keyword">true</span>;
652 00312                         }
653 00313                 }
654 00314                 <span class="keywordflow">if</span> ((this-&gt;connectors[i].GetWriteError() !=<span class="stringliteral">""</span>) &amp;&amp; (this-&gt;connectors[i].GetState() != <a class="code" href="connection_8h.html#a0">STATE_DISCONNECTED</a>))
655 00315                 {
656 00316                         <span class="comment">// if we're here the write() caused an error, we cannot proceed</span>
657 00317                         WriteOpers(<span class="stringliteral">"*** Lost single connection to %s, link inactive and retrying: %s"</span>,this-&gt;connectors[i].GetServerName().c_str(),this-&gt;connectors[i].GetWriteError().c_str());
658 00318                         this-&gt;connectors[i].CloseConnection();
659 00319                         this-&gt;connectors[i].SetState(STATE_DISCONNECTED);
660 00320                         <span class="keywordflow">if</span> (!<a class="code" href="servers_8cpp.html#a5">IsRoutable</a>(this-&gt;connectors[i].GetServerName()))
661 00321                         {
662 00322                                 WriteOpers(<span class="stringliteral">"*** Server %s is no longer routable, disconnecting."</span>,this-&gt;connectors[i].GetServerName().c_str());
663 00323                                 snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
664 00324                                 NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
665 00325                                 DoSplit(this-&gt;connectors[i].GetServerName().c_str());
666 00326                         }
667 00327                         <a class="code" href="servers_8cpp.html#a3">has_been_netsplit</a> = <span class="keyword">true</span>;
668 00328                 }
669 00329                 <span class="keywordflow">if</span> ((this-&gt;connectors[i].HasBufferedOutput()) &amp;&amp; (this-&gt;connectors[i].GetState() != <a class="code" href="connection_8h.html#a0">STATE_DISCONNECTED</a>))
670 00330                 {
671 00331                         <span class="keywordflow">if</span> (!this-&gt;connectors[i].FlushWriteBuf())
672 00332                         {
673 00333                                 <span class="comment">// if we're here the write() caused an error, we cannot proceed</span>
674 00334                                 WriteOpers(<span class="stringliteral">"*** Lost single connection to %s, link inactive and retrying: %s"</span>,this-&gt;connectors[i].GetServerName().c_str(),this-&gt;connectors[i].GetWriteError().c_str());
675 00335                                 this-&gt;connectors[i].CloseConnection();
676 00336                                 this-&gt;connectors[i].SetState(STATE_DISCONNECTED);
677 00337                                 <span class="keywordflow">if</span> (!<a class="code" href="servers_8cpp.html#a5">IsRoutable</a>(this-&gt;connectors[i].GetServerName()))
678 00338                                 {
679 00339                                         WriteOpers(<span class="stringliteral">"*** Server %s is no longer routable, disconnecting."</span>,this-&gt;connectors[i].GetServerName().c_str());
680 00340                                         snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
681 00341                                         NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
682 00342                                         DoSplit(this-&gt;connectors[i].GetServerName().c_str());
683 00343                                 }
684 00344                                 <a class="code" href="servers_8cpp.html#a3">has_been_netsplit</a> = <span class="keyword">true</span>;
685 00345                         }
686 00346                 }
687 00347         }
688 00348 }
689 </pre></div>    </td>
690   </tr>
691 </table>
692 <a name="a5" doxytag="serverrec::MeshCookie"></a><p>
693 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
694   <tr>
695     <td class="mdRow">
696       <table cellpadding="0" cellspacing="0" border="0">
697         <tr>
698           <td class="md" nowrap valign="top"> bool serverrec::MeshCookie </td>
699           <td class="md" valign="top">(&nbsp;</td>
700           <td class="md" nowrap valign="top">char *&nbsp;</td>
701           <td class="mdname" nowrap> <em>targethost</em>, </td>
702         </tr>
703         <tr>
704           <td></td>
705           <td></td>
706           <td class="md" nowrap>int&nbsp;</td>
707           <td class="mdname" nowrap> <em>port</em>, </td>
708         </tr>
709         <tr>
710           <td></td>
711           <td></td>
712           <td class="md" nowrap>unsigned long&nbsp;</td>
713           <td class="mdname" nowrap> <em>cookie</em>, </td>
714         </tr>
715         <tr>
716           <td></td>
717           <td></td>
718           <td class="md" nowrap>char *&nbsp;</td>
719           <td class="mdname" nowrap> <em>servername</em></td>
720         </tr>
721         <tr>
722           <td></td>
723           <td class="md">)&nbsp;</td>
724           <td class="md" colspan="2"></td>
725         </tr>
726
727       </table>
728     </td>
729   </tr>
730 </table>
731 <table cellspacing=5 cellpadding=0 border=0>
732   <tr>
733     <td>
734       &nbsp;
735     </td>
736     <td>
737
738 <p>
739 Begin an outbound mesh link to another ircd on a network you are already an authenticated member of. 
740 <p>
741
742 <p>
743 Definition at line <a class="el" href="servers_8cpp-source.html#l00182">182</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
744 <p>
745 References <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="connection_8h-source.html#l00301">connection::fd</a>, <a class="el" href="classircd__connector.html#a1">ircd_connector::MakeOutboundConnection()</a>, <a class="el" href="servers_8cpp-source.html#l00350">SendPacket()</a>, <a class="el" href="classircd__connector.html#a13">ircd_connector::SetHostAndPort()</a>, <a class="el" href="classircd__connector.html#a3">ircd_connector::SetServerName()</a>, <a class="el" href="classircd__connector.html#a7">ircd_connector::SetState()</a>, <a class="el" href="connection_8h-source.html#l00035">STATE_DISCONNECTED</a>, and <a class="el" href="connection_8h-source.html#l00039">STATE_NOAUTH_OUTBOUND</a>.
746 <p>
747 <div class="fragment"><pre>00183 {
748 00184         <span class="keywordtype">char</span> connect[MAXBUF];
749 00185 
750 00186         <a class="code" href="classircd__connector.html">ircd_connector</a> connector;
751 00187 
752 00188         WriteOpers(<span class="stringliteral">"Establishing meshed link to %s:%d"</span>,servername,newport);
753 00189 
754 00190         <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classconnection.html#o0">fd</a>)
755 00191         {
756 00192                 <span class="keywordflow">if</span> (connector.<a class="code" href="classircd__connector.html#a1">MakeOutboundConnection</a>(targethost,newport))
757 00193                 {
758 00194                         <span class="comment">// targethost has been turned into an ip...</span>
759 00195                         <span class="comment">// we dont want this as the server name.</span>
760 00196                         connector.<a class="code" href="classircd__connector.html#a3">SetServerName</a>(servername);
761 00197                         snprintf(connect,MAXBUF,<span class="stringliteral">"- %lu %s :%s"</span>,cookie,getservername().c_str(),getserverdesc().c_str());
762 00198                         connector.<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_NOAUTH_OUTBOUND);
763 00199                         connector.<a class="code" href="classircd__connector.html#a13">SetHostAndPort</a>(targethost, newport);
764 00200                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.push_back(connector);
765 00201                         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classserverrec.html#a7">SendPacket</a>(connect, servername);
766 00202                 }
767 00203                 <span class="keywordflow">else</span>
768 00204                 {
769 00205                         connector.<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_DISCONNECTED);
770 00206                         WriteOpers(<span class="stringliteral">"Could not create outbound connection to %s:%d"</span>,targethost,newport);
771 00207                 }
772 00208         }
773 00209         <span class="keywordflow">return</span> <span class="keyword">false</span>;
774 00210 }
775 </pre></div>    </td>
776   </tr>
777 </table>
778 <a name="a8" doxytag="serverrec::RecvPacket"></a><p>
779 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
780   <tr>
781     <td class="mdRow">
782       <table cellpadding="0" cellspacing="0" border="0">
783         <tr>
784           <td class="md" nowrap valign="top"> bool serverrec::RecvPacket </td>
785           <td class="md" valign="top">(&nbsp;</td>
786           <td class="md" nowrap valign="top">std::deque&lt; std::string &gt; &amp;&nbsp;</td>
787           <td class="mdname" nowrap> <em>messages</em>, </td>
788         </tr>
789         <tr>
790           <td></td>
791           <td></td>
792           <td class="md" nowrap>char *&nbsp;</td>
793           <td class="mdname" nowrap> <em>host</em>, </td>
794         </tr>
795         <tr>
796           <td></td>
797           <td></td>
798           <td class="md" nowrap>std::deque&lt; std::string &gt; &amp;&nbsp;</td>
799           <td class="mdname" nowrap> <em>sums</em></td>
800         </tr>
801         <tr>
802           <td></td>
803           <td class="md">)&nbsp;</td>
804           <td class="md" colspan="2"></td>
805         </tr>
806
807       </table>
808     </td>
809   </tr>
810 </table>
811 <table cellspacing=5 cellpadding=0 border=0>
812   <tr>
813     <td>
814       &nbsp;
815     </td>
816     <td>
817
818 <p>
819 Returns the next available packet and returns true if data is available. 
820 <p>
821 Writes the servername the data came from to 'host'. If no data is available this function returns false. This function will automatically close broken links and reroute pathways, generating split messages on the network. 
822 <p>
823 Definition at line <a class="el" href="servers_8cpp-source.html#l00445">445</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
824 <p>
825 References <a class="el" href="servers_8cpp-source.html#l00425">already_have_sum()</a>, <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="modules_8h-source.html#l00023">DEBUG</a>, <a class="el" href="servers_8cpp-source.html#l00042">has_been_netsplit</a>, <a class="el" href="servers_8cpp-source.html#l00256">IsRoutable()</a>, and <a class="el" href="connection_8h-source.html#l00035">STATE_DISCONNECTED</a>.
826 <p>
827 <div class="fragment"><pre>00446 {
828 00447         <span class="keywordtype">char</span> data[65536],buffer[MAXBUF];
829 00448         memset(data, 0, 65536);
830 00449         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.size(); i++)
831 00450         {
832 00451                 <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].GetState() != <a class="code" href="connection_8h.html#a0">STATE_DISCONNECTED</a>)
833 00452                 {
834 00453                         <span class="comment">// returns false if the packet could not be sent (e.g. target host down)</span>
835 00454                         <span class="keywordtype">int</span> rcvsize = 0;
836 00455 
837 00456                         <span class="comment">// check if theres any data on this socket</span>
838 00457                         <span class="comment">// if not, continue onwards to the next.</span>
839 00458                         pollfd polls;
840 00459                         polls.fd = this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].GetDescriptor();
841 00460                         polls.events = POLLIN;
842 00461                         <span class="keywordtype">int</span> ret = poll(&amp;polls,1,1);
843 00462                         <span class="keywordflow">if</span> (ret &lt;= 0) <span class="keywordflow">continue</span>;
844 00463 
845 00464                         rcvsize = recv(this-&gt;connectors[i].GetDescriptor(),data,65000,0);
846 00465                         data[rcvsize] = <span class="charliteral">'\0'</span>;
847 00466                         <span class="keywordflow">if</span> (rcvsize == 0)
848 00467                         {
849 00468                                 log(DEBUG,<span class="stringliteral">"recv() failed for serverrec::RecvPacket(): EOF"</span>);
850 00469                                 log(DEBUG,<span class="stringliteral">"Disabling connector: %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
851 00470                                 this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].CloseConnection();
852 00471                                 this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].SetState(STATE_DISCONNECTED);
853 00472                                 <span class="keywordflow">if</span> (!<a class="code" href="servers_8cpp.html#a5">IsRoutable</a>(this-&gt;connectors[i].GetServerName()))
854 00473                                 {
855 00474                                         WriteOpers(<span class="stringliteral">"*** Server %s is no longer routable, disconnecting (EOF)"</span>,this-&gt;connectors[i].GetServerName().c_str());
856 00475                                         snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
857 00476                                         NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
858 00477                                         DoSplit(this-&gt;connectors[i].GetServerName().c_str());
859 00478                                 }
860 00479                                 <a class="code" href="servers_8cpp.html#a3">has_been_netsplit</a> = <span class="keyword">true</span>;
861 00480                         }
862 00481                         <span class="keywordflow">if</span> (rcvsize == -1)
863 00482                         {
864 00483                                 <span class="keywordflow">if</span> (errno != EAGAIN)
865 00484                                 {
866 00485                                         log(DEBUG,<span class="stringliteral">"recv() failed for serverrec::RecvPacket(): %s"</span>,strerror(errno));
867 00486                                         log(DEBUG,<span class="stringliteral">"Disabling connector: %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
868 00487                                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].CloseConnection();
869 00488                                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].SetState(STATE_DISCONNECTED);
870 00489                                         <span class="keywordflow">if</span> (!<a class="code" href="servers_8cpp.html#a5">IsRoutable</a>(this-&gt;connectors[i].GetServerName()))
871 00490                                         {
872 00491                                                 WriteOpers(<span class="stringliteral">"*** Server %s is no longer routable, disconnecting."</span>,this-&gt;connectors[i].GetServerName().c_str());
873 00492                                                 snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
874 00493                                                 NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
875 00494                                                 DoSplit(this-&gt;connectors[i].GetServerName().c_str());
876 00495                                         }
877 00496                                         <a class="code" href="servers_8cpp.html#a3">has_been_netsplit</a> = <span class="keyword">true</span>;
878 00497                                 }
879 00498                         }
880 00499                         <span class="keywordtype">int</span> pushed = 0;
881 00500                         <span class="keywordflow">if</span> (rcvsize &gt; 0)
882 00501                         {
883 00502                                 <span class="keywordflow">if</span> (!this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].AddBuffer(data))
884 00503                                 {
885 00504                                         WriteOpers(<span class="stringliteral">"*** Read buffer for %s exceeds maximum, closing connection!"</span>,this-&gt;connectors[i].GetServerName().c_str());
886 00505                                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].CloseConnection();
887 00506                                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].SetState(STATE_DISCONNECTED);
888 00507                                         <span class="keywordflow">if</span> (!<a class="code" href="servers_8cpp.html#a5">IsRoutable</a>(this-&gt;connectors[i].GetServerName()))
889 00508                                         {
890 00509                                                 WriteOpers(<span class="stringliteral">"*** Server %s is no longer routable, disconnecting."</span>,this-&gt;connectors[i].GetServerName().c_str());
891 00510                                                 snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,this-&gt;connectors[i].GetServerName().c_str());
892 00511                                                 NetSendToAllExcept(this-&gt;connectors[i].GetServerName().c_str(),buffer);
893 00512                                                 DoSplit(this-&gt;connectors[i].GetServerName().c_str());
894 00513                                         }
895 00514                                         <a class="code" href="servers_8cpp.html#a3">has_been_netsplit</a> = <span class="keyword">true</span>;
896 00515                                 }
897 00516                                 <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].BufferIsComplete())
898 00517                                 {
899 00518                                         this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].ResetPing();
900 00519                                         <span class="keywordflow">while</span> (this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].BufferIsComplete())
901 00520                                         {
902 00521                                                 std::string text = this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[i].GetBuffer();
903 00522                                                 <span class="keywordflow">if</span> (text != <span class="stringliteral">""</span>)
904 00523                                                 {
905 00524                                                         <span class="keywordflow">if</span> ((text[0] == <span class="charliteral">':'</span>) &amp;&amp; (text.find(<span class="stringliteral">" "</span>) != std::string::npos))
906 00525                                                         {
907 00526                                                                 std::string orig = text;
908 00527                                                                 log(DEBUG,<span class="stringliteral">"Original: %s"</span>,text.c_str());
909 00528                                                                 std::string sum = text.substr(1,text.find(<span class="stringliteral">" "</span>)-1);
910 00529                                                                 text = text.substr(text.find(<span class="stringliteral">" "</span>)+1,text.length());
911 00530                                                                 std::string possible_token = text.substr(1,text.find(<span class="stringliteral">" "</span>)-1);
912 00531                                                                 <span class="keywordflow">if</span> (possible_token.length() &gt; 1)
913 00532                                                                 {
914 00533                                                                         sums.push_back(<span class="stringliteral">"*"</span>);
915 00534                                                                         text = orig;
916 00535                                                                         log(DEBUG,<span class="stringliteral">"Non-mesh, non-tokenized string passed up the chain"</span>);
917 00536                                                                 }
918 00537                                                                 <span class="keywordflow">else</span>
919 00538                                                                 {
920 00539                                                                         log(DEBUG,<span class="stringliteral">"Packet sum: '%s'"</span>,sum.c_str());
921 00540                                                                         <span class="keywordflow">if</span> ((<a class="code" href="servers_8cpp.html#a6">already_have_sum</a>(sum)) &amp;&amp; (sum != <span class="stringliteral">"*"</span>))
922 00541                                                                         {
923 00542                                                                                 <span class="comment">// we don't accept dupes</span>
924 00543                                                                                 <span class="keywordflow">continue</span>;
925 00544                                                                         }
926 00545                                                                         sums.push_back(sum.c_str());
927 00546                                                                 }
928 00547                                                         }
929 00548                                                         <span class="keywordflow">else</span> sums.push_back(<span class="stringliteral">"*"</span>);
930 00549                                                         messages.push_back(text.c_str());
931 00550                                                         strlcpy(recvhost,this-&gt;connectors[i].GetServerName().c_str(),160);
932 00551                                                         log(DEBUG,<span class="stringliteral">"serverrec::RecvPacket() %d:%s-&gt;%s"</span>,pushed++,recvhost,text.c_str());
933 00552                                                 }
934 00553                                         }
935 00554                                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
936 00555                                 }
937 00556                         }
938 00557                 }
939 00558         }
940 00559         <span class="comment">// nothing new yet -- message and host will be undefined</span>
941 00560         <span class="keywordflow">return</span> <span class="keyword">false</span>;
942 00561 }
943 </pre></div>    </td>
944   </tr>
945 </table>
946 <a name="a7" doxytag="serverrec::SendPacket"></a><p>
947 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
948   <tr>
949     <td class="mdRow">
950       <table cellpadding="0" cellspacing="0" border="0">
951         <tr>
952           <td class="md" nowrap valign="top"> bool serverrec::SendPacket </td>
953           <td class="md" valign="top">(&nbsp;</td>
954           <td class="md" nowrap valign="top">char *&nbsp;</td>
955           <td class="mdname" nowrap> <em>message</em>, </td>
956         </tr>
957         <tr>
958           <td></td>
959           <td></td>
960           <td class="md" nowrap>const char *&nbsp;</td>
961           <td class="mdname" nowrap> <em>host</em></td>
962         </tr>
963         <tr>
964           <td></td>
965           <td class="md">)&nbsp;</td>
966           <td class="md" colspan="2"></td>
967         </tr>
968
969       </table>
970     </td>
971   </tr>
972 </table>
973 <table cellspacing=5 cellpadding=0 border=0>
974   <tr>
975     <td>
976       &nbsp;
977     </td>
978     <td>
979
980 <p>
981 Send a message to a server by name, if the server is unavailable directly route the packet via another server If the server still cannot be reached after attempting to route the message remotely, returns false. 
982 <p>
983
984 <p>
985 Definition at line <a class="el" href="servers_8cpp-source.html#l00350">350</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
986 <p>
987 References <a class="el" href="classircd__connector.html#a21">ircd_connector::AddWriteBuf()</a>, <a class="el" href="classircd__connector.html#a14">ircd_connector::CloseConnection()</a>, <a class="el" href="servers_8h-source.html#l00081">connectors</a>, <a class="el" href="modules_8h-source.html#l00023">DEBUG</a>, <a class="el" href="servers_8cpp-source.html#l00242">FindHost()</a>, <a class="el" href="classircd__connector.html#a22">ircd_connector::FlushWriteBuf()</a>, <a class="el" href="classircd__connector.html#a2">ircd_connector::GetServerName()</a>, <a class="el" href="classircd__connector.html#a6">ircd_connector::GetState()</a>, <a class="el" href="classircd__connector.html#a24">ircd_connector::GetWriteError()</a>, <a class="el" href="classircd__connector.html#a7">ircd_connector::SetState()</a>, and <a class="el" href="connection_8h-source.html#l00035">STATE_DISCONNECTED</a>.
988 <p>
989 Referenced by <a class="el" href="servers_8cpp-source.html#l00142">BeginLink()</a>, and <a class="el" href="servers_8cpp-source.html#l00182">MeshCookie()</a>.
990 <p>
991 <div class="fragment"><pre>00351 {
992 00352         <span class="keywordflow">if</span> ((!message) || (!sendhost))
993 00353                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
994 00354 
995 00355         <a class="code" href="classircd__connector.html">ircd_connector</a>* cn = this-&gt;<a class="code" href="classserverrec.html#a9">FindHost</a>(sendhost);
996 00356 
997 00357         <span class="keywordflow">if</span> (!strchr(message,<span class="charliteral">'\n'</span>))
998 00358         {
999 00359                 strlcat(message,<span class="stringliteral">"\n"</span>,MAXBUF);
1000 00360         }
1001 00361 
1002 00362         <span class="keywordflow">if</span> (cn)
1003 00363         {
1004 00364                 log(DEBUG,<span class="stringliteral">"main: serverrec::SendPacket() sent '%s' to %s"</span>,message,cn-&gt;<a class="code" href="classircd__connector.html#a2">GetServerName</a>().c_str());
1005 00365 
1006 00366                 <span class="keywordflow">if</span> (cn-&gt;<a class="code" href="classircd__connector.html#a6">GetState</a>() == <a class="code" href="connection_8h.html#a0">STATE_DISCONNECTED</a>)
1007 00367                 {
1008 00368                         <span class="comment">// fix: can only route one hop to avoid a loop</span>
1009 00369                         <span class="keywordflow">if</span> (strncmp(message,<span class="stringliteral">"R "</span>,2))
1010 00370                         {
1011 00371                                 log(DEBUG,<span class="stringliteral">"Not a double reroute"</span>);
1012 00372                                 <span class="comment">// this route is down, we must re-route the packet through an available point in the mesh.</span>
1013 00373                                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>.size(); k++)
1014 00374                                 {
1015 00375                                         log(DEBUG,<span class="stringliteral">"Check connector %d: %s"</span>,k,this-&gt;connectors[k].GetServerName().c_str());
1016 00376                                         <span class="comment">// search for another point in the mesh which can 'reach' where we want to go</span>
1017 00377                                         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> m = 0; m &lt; this-&gt;<a class="code" href="classserverrec.html#o11">connectors</a>[k].routes.size(); m++)
1018 00378                                         {
1019 00379                                                 <span class="keywordflow">if</span> (!strcasecmp(this-&gt;connectors[k].routes[m].c_str(),sendhost))
1020 00380                                                 {
1021 00381                                                         log(DEBUG,<span class="stringliteral">"Found alternative route for packet: %s"</span>,this-&gt;connectors[k].GetServerName().c_str());
1022 00382                                                         <span class="keywordtype">char</span> buffer[MAXBUF];
1023 00383                                                         snprintf(buffer,MAXBUF,<span class="stringliteral">"R %s %s"</span>,sendhost,message);
1024 00384                                                         this-&gt;<a class="code" href="classserverrec.html#a7">SendPacket</a>(buffer,this-&gt;connectors[k].GetServerName().c_str());
1025 00385                                                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
1026 00386                                                 }
1027 00387                                         }
1028 00388                                 }
1029 00389                         }
1030 00390                         <span class="keywordtype">char</span> buffer[MAXBUF];
1031 00391                         snprintf(buffer,MAXBUF,<span class="stringliteral">"&amp; %s"</span>,sendhost);
1032 00392                         WriteOpers(<span class="stringliteral">"*** All connections to %s lost."</span>,sendhost);
1033 00393                         NetSendToAllExcept(sendhost,buffer);
1034 00394                         DoSplit(sendhost);
1035 00395                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
1036 00396                 }
1037 00397 
1038 00398                 <span class="comment">// returns false if the packet could not be sent (e.g. target host down)</span>
1039 00399                 <span class="keywordflow">if</span> (!cn-&gt;<a class="code" href="classircd__connector.html#a21">AddWriteBuf</a>(message))
1040 00400                 {
1041 00401                         <span class="comment">// if we're here, there was an error pending, and the send cannot proceed</span>
1042 00402                         log(DEBUG,<span class="stringliteral">"cn-&gt;AddWriteBuf() failed for serverrec::SendPacket(): %s"</span>,cn-&gt;<a class="code" href="classircd__connector.html#a24">GetWriteError</a>().c_str());
1043 00403                         log(DEBUG,<span class="stringliteral">"Disabling connector: %s"</span>,cn-&gt;<a class="code" href="classircd__connector.html#a2">GetServerName</a>().c_str());
1044 00404                         cn-&gt;<a class="code" href="classircd__connector.html#a14">CloseConnection</a>();
1045 00405                         cn-&gt;<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_DISCONNECTED);
1046 00406                         WriteOpers(<span class="stringliteral">"*** Lost single connection to %s, link inactive and retrying: %s"</span>,cn-&gt;<a class="code" href="classircd__connector.html#a2">GetServerName</a>().c_str(),cn-&gt;<a class="code" href="classircd__connector.html#a24">GetWriteError</a>().c_str());
1047 00407                         <span class="comment">// retry the packet along a new route so either arrival OR failure are gauranteed (bugfix)</span>
1048 00408                         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classserverrec.html#a7">SendPacket</a>(message,sendhost);
1049 00409                 }
1050 00410                 <span class="keywordflow">if</span> (!cn-&gt;<a class="code" href="classircd__connector.html#a22">FlushWriteBuf</a>())
1051 00411                 {
1052 00412                         <span class="comment">// if we're here the write() caused an error, we cannot proceed</span>
1053 00413                         log(DEBUG,<span class="stringliteral">"cn-&gt;FlushWriteBuf() failed for serverrec::SendPacket(): %s"</span>,cn-&gt;<a class="code" href="classircd__connector.html#a24">GetWriteError</a>().c_str());
1054 00414                         log(DEBUG,<span class="stringliteral">"Disabling connector: %s"</span>,cn-&gt;<a class="code" href="classircd__connector.html#a2">GetServerName</a>().c_str());
1055 00415                         cn-&gt;<a class="code" href="classircd__connector.html#a14">CloseConnection</a>();
1056 00416                         cn-&gt;<a class="code" href="classircd__connector.html#a7">SetState</a>(STATE_DISCONNECTED);
1057 00417                         WriteOpers(<span class="stringliteral">"*** Lost single connection to %s, link inactive and retrying: %s"</span>,cn-&gt;<a class="code" href="classircd__connector.html#a2">GetServerName</a>().c_str(),cn-&gt;<a class="code" href="classircd__connector.html#a24">GetWriteError</a>().c_str());
1058 00418                         <span class="comment">// retry the packet along a new route so either arrival OR failure are gauranteed</span>
1059 00419                         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classserverrec.html#a7">SendPacket</a>(message,sendhost);
1060 00420                 }
1061 00421                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
1062 00422         }
1063 00423 }
1064 </pre></div>    </td>
1065   </tr>
1066 </table>
1067 <a name="a6" doxytag="serverrec::TerminateLink"></a><p>
1068 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1069   <tr>
1070     <td class="mdRow">
1071       <table cellpadding="0" cellspacing="0" border="0">
1072         <tr>
1073           <td class="md" nowrap valign="top"> void serverrec::TerminateLink </td>
1074           <td class="md" valign="top">(&nbsp;</td>
1075           <td class="md" nowrap valign="top">char *&nbsp;</td>
1076           <td class="mdname1" valign="top" nowrap> <em>targethost</em>          </td>
1077           <td class="md" valign="top">&nbsp;)&nbsp;</td>
1078           <td class="md" nowrap></td>
1079         </tr>
1080
1081       </table>
1082     </td>
1083   </tr>
1084 </table>
1085 <table cellspacing=5 cellpadding=0 border=0>
1086   <tr>
1087     <td>
1088       &nbsp;
1089     </td>
1090     <td>
1091
1092 <p>
1093 Terminate a link to 'targethost' by calling the <a class="el" href="classircd__connector.html#a14">ircd_connector::CloseConnection</a> method. 
1094 <p>
1095
1096 <p>
1097 Definition at line <a class="el" href="servers_8cpp-source.html#l00234">234</a> of file <a class="el" href="servers_8cpp-source.html">servers.cpp</a>.
1098 <p>
1099 <div class="fragment"><pre>00235 {
1100 00236         <span class="comment">// this locates the targethost in the serverrec::connectors vector of the class,</span>
1101 00237        <span class="comment">// and terminates it by sending it an SQUIT token and closing its descriptor.</span>
1102 00238         <span class="comment">// TerminateLink with a null string causes a terminate of ALL links</span>
1103 00239 }
1104 </pre></div>    </td>
1105   </tr>
1106 </table>
1107 <hr><h2>Member Data Documentation</h2>
1108 <a name="o11" doxytag="serverrec::connectors"></a><p>
1109 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1110   <tr>
1111     <td class="mdRow">
1112       <table cellpadding="0" cellspacing="0" border="0">
1113         <tr>
1114           <td class="md" nowrap valign="top"> std::vector&lt;<a class="el" href="classircd__connector.html">ircd_connector</a>&gt; <a class="el" href="classserverrec.html#o11">serverrec::connectors</a>
1115       </table>
1116     </td>
1117   </tr>
1118 </table>
1119 <table cellspacing=5 cellpadding=0 border=0>
1120   <tr>
1121     <td>
1122       &nbsp;
1123     </td>
1124     <td>
1125
1126 <p>
1127 With a serverrec, this is a list of all established server connections. 
1128 <p>
1129
1130 <p>
1131 Definition at line <a class="el" href="servers_8h-source.html#l00081">81</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1132 <p>
1133 Referenced by <a class="el" href="servers_8cpp-source.html#l00212">AddIncoming()</a>, <a class="el" href="servers_8cpp-source.html#l00142">BeginLink()</a>, <a class="el" href="servers_8cpp-source.html#l00242">FindHost()</a>, <a class="el" href="servers_8cpp-source.html#l00274">FlushWriteBuffers()</a>, <a class="el" href="servers_8cpp-source.html#l00256">IsRoutable()</a>, <a class="el" href="servers_8cpp-source.html#l00182">MeshCookie()</a>, <a class="el" href="servers_8cpp-source.html#l00445">RecvPacket()</a>, <a class="el" href="servers_8cpp-source.html#l00350">SendPacket()</a>, and <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1134   </tr>
1135 </table>
1136 <a name="o8" doxytag="serverrec::description"></a><p>
1137 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1138   <tr>
1139     <td class="mdRow">
1140       <table cellpadding="0" cellspacing="0" border="0">
1141         <tr>
1142           <td class="md" nowrap valign="top"> char <a class="el" href="classserverrec.html#o8">serverrec::description</a>[MAXBUF]
1143       </table>
1144     </td>
1145   </tr>
1146 </table>
1147 <table cellspacing=5 cellpadding=0 border=0>
1148   <tr>
1149     <td>
1150       &nbsp;
1151     </td>
1152     <td>
1153
1154 <p>
1155 Description of the server. 
1156 <p>
1157
1158 <p>
1159 Definition at line <a class="el" href="servers_8h-source.html#l00061">61</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.    </td>
1160   </tr>
1161 </table>
1162 <a name="o5" doxytag="serverrec::hops_away"></a><p>
1163 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1164   <tr>
1165     <td class="mdRow">
1166       <table cellpadding="0" cellspacing="0" border="0">
1167         <tr>
1168           <td class="md" nowrap valign="top"> int <a class="el" href="classserverrec.html#o5">serverrec::hops_away</a>
1169       </table>
1170     </td>
1171   </tr>
1172 </table>
1173 <table cellspacing=5 cellpadding=0 border=0>
1174   <tr>
1175     <td>
1176       &nbsp;
1177     </td>
1178     <td>
1179
1180 <p>
1181 number of hops away (for quick access) 
1182 <p>
1183
1184 <p>
1185 Definition at line <a class="el" href="servers_8h-source.html#l00051">51</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1186 <p>
1187 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1188   </tr>
1189 </table>
1190 <a name="o7" doxytag="serverrec::jupiter"></a><p>
1191 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1192   <tr>
1193     <td class="mdRow">
1194       <table cellpadding="0" cellspacing="0" border="0">
1195         <tr>
1196           <td class="md" nowrap valign="top"> bool <a class="el" href="classserverrec.html#o7">serverrec::jupiter</a>
1197       </table>
1198     </td>
1199   </tr>
1200 </table>
1201 <table cellspacing=5 cellpadding=0 border=0>
1202   <tr>
1203     <td>
1204       &nbsp;
1205     </td>
1206     <td>
1207
1208 <p>
1209 is a JUPE server (faked to enforce a server ban) 
1210 <p>
1211
1212 <p>
1213 Definition at line <a class="el" href="servers_8h-source.html#l00057">57</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1214 <p>
1215 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1216   </tr>
1217 </table>
1218 <a name="o0" doxytag="serverrec::name"></a><p>
1219 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1220   <tr>
1221     <td class="mdRow">
1222       <table cellpadding="0" cellspacing="0" border="0">
1223         <tr>
1224           <td class="md" nowrap valign="top"> char <a class="el" href="classserverrec.html#o0">serverrec::name</a>[MAXBUF]
1225       </table>
1226     </td>
1227   </tr>
1228 </table>
1229 <table cellspacing=5 cellpadding=0 border=0>
1230   <tr>
1231     <td>
1232       &nbsp;
1233     </td>
1234     <td>
1235
1236 <p>
1237 server name 
1238 <p>
1239
1240 <p>
1241 Definition at line <a class="el" href="servers_8h-source.html#l00036">36</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1242 <p>
1243 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1244   </tr>
1245 </table>
1246 <a name="o9" doxytag="serverrec::nickserv"></a><p>
1247 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1248   <tr>
1249     <td class="mdRow">
1250       <table cellpadding="0" cellspacing="0" border="0">
1251         <tr>
1252           <td class="md" nowrap valign="top"> char <a class="el" href="classserverrec.html#o9">serverrec::nickserv</a>[NICKMAX]
1253       </table>
1254     </td>
1255   </tr>
1256 </table>
1257 <table cellspacing=5 cellpadding=0 border=0>
1258   <tr>
1259     <td>
1260       &nbsp;
1261     </td>
1262     <td>
1263
1264 <p>
1265 Holds nickserv's name on U:lined (services) servers (this is a kludge for ircservices which ASSUMES things :/). 
1266 <p>
1267
1268 <p>
1269 Definition at line <a class="el" href="servers_8h-source.html#l00065">65</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1270 <p>
1271 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1272   </tr>
1273 </table>
1274 <a name="o4" doxytag="serverrec::opercount"></a><p>
1275 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1276   <tr>
1277     <td class="mdRow">
1278       <table cellpadding="0" cellspacing="0" border="0">
1279         <tr>
1280           <td class="md" nowrap valign="top"> long <a class="el" href="classserverrec.html#o4">serverrec::opercount</a>
1281       </table>
1282     </td>
1283   </tr>
1284 </table>
1285 <table cellspacing=5 cellpadding=0 border=0>
1286   <tr>
1287     <td>
1288       &nbsp;
1289     </td>
1290     <td>
1291
1292 <p>
1293 opers on server 
1294 <p>
1295
1296 <p>
1297 Definition at line <a class="el" href="servers_8h-source.html#l00048">48</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1298 <p>
1299 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1300   </tr>
1301 </table>
1302 <a name="o1" doxytag="serverrec::pingtime"></a><p>
1303 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1304   <tr>
1305     <td class="mdRow">
1306       <table cellpadding="0" cellspacing="0" border="0">
1307         <tr>
1308           <td class="md" nowrap valign="top"> long <a class="el" href="classserverrec.html#o1">serverrec::pingtime</a>
1309       </table>
1310     </td>
1311   </tr>
1312 </table>
1313 <table cellspacing=5 cellpadding=0 border=0>
1314   <tr>
1315     <td>
1316       &nbsp;
1317     </td>
1318     <td>
1319
1320 <p>
1321 last ping response (ms) 
1322 <p>
1323
1324 <p>
1325 Definition at line <a class="el" href="servers_8h-source.html#l00039">39</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1326 <p>
1327 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1328   </tr>
1329 </table>
1330 <a name="o10" doxytag="serverrec::sync_soon"></a><p>
1331 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1332   <tr>
1333     <td class="mdRow">
1334       <table cellpadding="0" cellspacing="0" border="0">
1335         <tr>
1336           <td class="md" nowrap valign="top"> bool <a class="el" href="classserverrec.html#o10">serverrec::sync_soon</a>
1337       </table>
1338     </td>
1339   </tr>
1340 </table>
1341 <table cellspacing=5 cellpadding=0 border=0>
1342   <tr>
1343     <td>
1344       &nbsp;
1345     </td>
1346     <td>
1347
1348 <p>
1349
1350 <p>
1351 Definition at line <a class="el" href="servers_8h-source.html#l00067">67</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1352 <p>
1353 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1354   </tr>
1355 </table>
1356 <a name="o3" doxytag="serverrec::usercount"></a><p>
1357 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1358   <tr>
1359     <td class="mdRow">
1360       <table cellpadding="0" cellspacing="0" border="0">
1361         <tr>
1362           <td class="md" nowrap valign="top"> long <a class="el" href="classserverrec.html#o3">serverrec::usercount</a>
1363       </table>
1364     </td>
1365   </tr>
1366 </table>
1367 <table cellspacing=5 cellpadding=0 border=0>
1368   <tr>
1369     <td>
1370       &nbsp;
1371     </td>
1372     <td>
1373
1374 <p>
1375 non-invisible users on server 
1376 <p>
1377
1378 <p>
1379 Definition at line <a class="el" href="servers_8h-source.html#l00045">45</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1380 <p>
1381 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1382   </tr>
1383 </table>
1384 <a name="o2" doxytag="serverrec::usercount_i"></a><p>
1385 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1386   <tr>
1387     <td class="mdRow">
1388       <table cellpadding="0" cellspacing="0" border="0">
1389         <tr>
1390           <td class="md" nowrap valign="top"> long <a class="el" href="classserverrec.html#o2">serverrec::usercount_i</a>
1391       </table>
1392     </td>
1393   </tr>
1394 </table>
1395 <table cellspacing=5 cellpadding=0 border=0>
1396   <tr>
1397     <td>
1398       &nbsp;
1399     </td>
1400     <td>
1401
1402 <p>
1403 invisible users on server 
1404 <p>
1405
1406 <p>
1407 Definition at line <a class="el" href="servers_8h-source.html#l00042">42</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1408 <p>
1409 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1410   </tr>
1411 </table>
1412 <a name="o6" doxytag="serverrec::version"></a><p>
1413 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1414   <tr>
1415     <td class="mdRow">
1416       <table cellpadding="0" cellspacing="0" border="0">
1417         <tr>
1418           <td class="md" nowrap valign="top"> long <a class="el" href="classserverrec.html#o6">serverrec::version</a>
1419       </table>
1420     </td>
1421   </tr>
1422 </table>
1423 <table cellspacing=5 cellpadding=0 border=0>
1424   <tr>
1425     <td>
1426       &nbsp;
1427     </td>
1428     <td>
1429
1430 <p>
1431 ircd version 
1432 <p>
1433
1434 <p>
1435 Definition at line <a class="el" href="servers_8h-source.html#l00054">54</a> of file <a class="el" href="servers_8h-source.html">servers.h</a>.
1436 <p>
1437 Referenced by <a class="el" href="servers_8cpp-source.html#l00046">serverrec()</a>.    </td>
1438   </tr>
1439 </table>
1440 <hr>The documentation for this class was generated from the following files:<ul>
1441 <li><a class="el" href="servers_8h-source.html">servers.h</a><li><a class="el" href="servers_8cpp-source.html">servers.cpp</a></ul>
1442 <hr size="1"><address style="align: right;"><small>Generated on Mon May 30 05:17:37 2005 for InspIRCd by
1443 <a href="http://www.doxygen.org/index.html">
1444 <img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
1445 </a>1.3.3 </small></address>
1446 </body>
1447 </html>