summaryrefslogtreecommitdiff
path: root/docs/module-doc/connection_8h-source.html
blob: 6935811b93a1eac5ecededb7d53a393848f4f14a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>InspIRCd: connection.h Source File</title>
<link href="inspircd.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.3 -->
<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="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>connection.h</h1><a href="connection_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*       +------------------------------------+</span>
00002 <span class="comment"> *       | Inspire Internet Relay Chat Daemon |</span>
00003 <span class="comment"> *       +------------------------------------+</span>
00004 <span class="comment"> *</span>
00005 <span class="comment"> *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.</span>
00006 <span class="comment"> *                       E-mail:</span>
00007 <span class="comment"> *                &lt;brain@chatspike.net&gt;</span>
00008 <span class="comment"> *                &lt;Craig@chatspike.net&gt;</span>
00009 <span class="comment"> *     </span>
00010 <span class="comment"> * Written by Craig Edwards, Craig McLure, and others.</span>
00011 <span class="comment"> * This program is free but copyrighted software; see</span>
00012 <span class="comment"> *            the file COPYING for details.</span>
00013 <span class="comment"> *</span>
00014 <span class="comment"> * ---------------------------------------------------</span>
00015 <span class="comment"> */</span>
00016 
00017 <span class="preprocessor">#include "inspircd_config.h"</span>
00018 <span class="preprocessor">#include "<a class="code" href="base_8h.html">base.h</a>"</span>
00019 <span class="preprocessor">#include &lt;string&gt;</span>
00020 <span class="preprocessor">#include &lt;map&gt;</span>
00021 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
00022 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span>
00023 <span class="preprocessor">#include &lt;netdb.h&gt;</span>
00024 <span class="preprocessor">#include &lt;netinet/in.h&gt;</span>
00025 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
00026 <span class="preprocessor">#include &lt;errno.h&gt;</span>
00027 <span class="preprocessor">#include &lt;time.h&gt;</span>
00028 <span class="preprocessor">#include &lt;vector&gt;</span>
00029 <span class="preprocessor">#include &lt;deque&gt;</span>
00030 
00031 <span class="preprocessor">#ifndef __CONNECTION_H__</span>
00032 <span class="preprocessor"></span><span class="preprocessor">#define __CONNECTION_H__</span>
00033 <span class="preprocessor"></span>
<a name="l00034"></a><a class="code" href="connection_8h.html#a0">00034</a> <span class="preprocessor">#define STATE_DISCONNECTED      0</span>
<a name="l00035"></a><a class="code" href="connection_8h.html#a1">00035</a> <span class="preprocessor"></span><span class="preprocessor">#define STATE_CONNECTED         1</span>
<a name="l00036"></a><a class="code" href="connection_8h.html#a2">00036</a> <span class="preprocessor"></span><span class="preprocessor">#define STATE_SYNC              2</span>
<a name="l00037"></a><a class="code" href="connection_8h.html#a3">00037</a> <span class="preprocessor"></span><span class="preprocessor">#define STATE_NOAUTH_INBOUND    3</span>
<a name="l00038"></a><a class="code" href="connection_8h.html#a4">00038</a> <span class="preprocessor"></span><span class="preprocessor">#define STATE_NOAUTH_OUTBOUND   4</span>
<a name="l00039"></a><a class="code" href="connection_8h.html#a5">00039</a> <span class="preprocessor"></span><span class="preprocessor">#define STATE_SERVICES          5</span>
00040 <span class="preprocessor"></span>
<a name="l00053"></a><a class="code" href="classircd__connector.html">00053</a> <span class="keyword">class </span><a class="code" href="classircd__connector.html">ircd_connector</a> : <span class="keyword">public</span> <a class="code" href="classExtensible.html">Extensible</a>
00054 {
00055  <span class="keyword">private</span>:
<a name="l00058"></a><a class="code" href="classircd__connector.html#r0">00058</a>         sockaddr_in <a class="code" href="classircd__connector.html#r0">addr</a>;
00059         
<a name="l00062"></a><a class="code" href="classircd__connector.html#r1">00062</a>         <span class="keywordtype">int</span> <a class="code" href="classircd__connector.html#r1">fd</a>;
00063         
<a name="l00066"></a><a class="code" href="classircd__connector.html#r2">00066</a>         std::string <a class="code" href="classircd__connector.html#r2">servername</a>;
00067         
<a name="l00070"></a><a class="code" href="classircd__connector.html#r3">00070</a>         std::string <a class="code" href="classircd__connector.html#r3">description</a>;
00071         
<a name="l00075"></a><a class="code" href="classircd__connector.html#r4">00075</a>         <span class="keywordtype">int</span> <a class="code" href="classircd__connector.html#r4">state</a>;
00076         
00079         <span class="keywordtype">bool</span> <a class="code" href="classircd__connector.html#d0">SetHostAddress</a>(<span class="keywordtype">char</span>* host, <span class="keywordtype">int</span> port);
00080 
00081  <span class="keyword">public</span>:
00082  
<a name="l00087"></a><a class="code" href="classircd__connector.html#o0">00087</a>         <span class="keywordtype">char</span> <a class="code" href="classircd__connector.html#o0">host</a>[MAXBUF];
00088 
<a name="l00093"></a><a class="code" href="classircd__connector.html#o1">00093</a>         <span class="keywordtype">int</span> <a class="code" href="classircd__connector.html#o1">port</a>;
00094         
<a name="l00099"></a><a class="code" href="classircd__connector.html#o2">00099</a>         std::vector&lt;std::string&gt; <a class="code" href="classircd__connector.html#o2">routes</a>;
00100         
00101 
00104         <span class="keywordtype">bool</span> <a class="code" href="classircd__connector.html#a0">MakeOutboundConnection</a>(<span class="keywordtype">char</span>* host, <span class="keywordtype">int</span> port);
00105         
00108         std::string <a class="code" href="classircd__connector.html#a1">GetServerName</a>();
00109         
00112         <span class="keywordtype">void</span> <a class="code" href="classircd__connector.html#a2">SetServerName</a>(std::string serv);
00113         
00116         <span class="keywordtype">int</span> <a class="code" href="classircd__connector.html#a3">GetDescriptor</a>();
00117         
00120         <span class="keywordtype">void</span> <a class="code" href="classircd__connector.html#a4">SetDescriptor</a>(<span class="keywordtype">int</span> fd);
00121         
00124         <span class="keywordtype">int</span> <a class="code" href="classircd__connector.html#a5">GetState</a>();
00125         
00128         <span class="keywordtype">void</span> <a class="code" href="classircd__connector.html#a6">SetState</a>(<span class="keywordtype">int</span> state);
00129         
00132         <span class="keywordtype">char</span>* <a class="code" href="classircd__connector.html#a7">GetServerIP</a>();
00133         
00136         std::string <a class="code" href="classircd__connector.html#a8">GetDescription</a>();
00137         
00140         <span class="keywordtype">void</span> <a class="code" href="classircd__connector.html#a9">SetDescription</a>(std::string desc);
00141         
00147         <span class="keywordtype">int</span> <a class="code" href="classircd__connector.html#a10">GetServerPort</a>();
00148         
00151         <span class="keywordtype">void</span> <a class="code" href="classircd__connector.html#a11">SetServerPort</a>(<span class="keywordtype">int</span> p);
00152         
00155         <span class="keywordtype">bool</span> <a class="code" href="classircd__connector.html#a12">SetHostAndPort</a>(<span class="keywordtype">char</span>* host, <span class="keywordtype">int</span> port);
00156         
00160         <span class="keywordtype">void</span> <a class="code" href="classircd__connector.html#a13">CloseConnection</a>();
00161 };
00162 
00163 
<a name="l00166"></a><a class="code" href="classconnection.html">00166</a> <span class="keyword">class </span><a class="code" href="classconnection.html">connection</a> : <span class="keyword">public</span> <a class="code" href="classExtensible.html">Extensible</a>
00167 {
00168  <span class="keyword">public</span>:
<a name="l00171"></a><a class="code" href="classconnection.html#o0">00171</a>         <span class="keywordtype">int</span> <a class="code" href="classconnection.html#o0">fd</a>;
00172         
<a name="l00175"></a><a class="code" href="classconnection.html#o1">00175</a>         <span class="keywordtype">char</span> <a class="code" href="classconnection.html#o1">host</a>[256];
00176         
<a name="l00179"></a><a class="code" href="classconnection.html#o2">00179</a>         <span class="keywordtype">char</span> <a class="code" href="classconnection.html#o2">ip</a>[32];
00180         
<a name="l00183"></a><a class="code" href="classconnection.html#o3">00183</a>         <span class="keywordtype">char</span> <a class="code" href="classconnection.html#o3">inbuf</a>[MAXBUF];
00184         
<a name="l00187"></a><a class="code" href="classconnection.html#o4">00187</a>         <span class="keywordtype">long</span> <a class="code" href="classconnection.html#o4">bytes_in</a>;
00188 
<a name="l00191"></a><a class="code" href="classconnection.html#o5">00191</a>         <span class="keywordtype">long</span> <a class="code" href="classconnection.html#o5">bytes_out</a>;
00192 
<a name="l00195"></a><a class="code" href="classconnection.html#o6">00195</a>         <span class="keywordtype">long</span> <a class="code" href="classconnection.html#o6">cmds_in</a>;
00196 
<a name="l00199"></a><a class="code" href="classconnection.html#o7">00199</a>         <span class="keywordtype">long</span> <a class="code" href="classconnection.html#o7">cmds_out</a>;
00200 
<a name="l00203"></a><a class="code" href="classconnection.html#o8">00203</a>         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#o8">haspassed</a>;
00204 
<a name="l00209"></a><a class="code" href="classconnection.html#o9">00209</a>         <span class="keywordtype">int</span> <a class="code" href="classconnection.html#o9">port</a>;
00210         
<a name="l00213"></a><a class="code" href="classconnection.html#o10">00213</a>         <span class="keywordtype">int</span> <a class="code" href="classconnection.html#o10">registered</a>;
00214         
<a name="l00217"></a><a class="code" href="classconnection.html#o11">00217</a>         <span class="keywordtype">short</span> <span class="keywordtype">int</span> <a class="code" href="classconnection.html#o11">state</a>;
00218         
<a name="l00221"></a><a class="code" href="classconnection.html#o12">00221</a>         time_t <a class="code" href="classconnection.html#o12">lastping</a>;
00222         
<a name="l00225"></a><a class="code" href="classconnection.html#o13">00225</a>         time_t <a class="code" href="classconnection.html#o13">signon</a>;
00226         
<a name="l00229"></a><a class="code" href="classconnection.html#o14">00229</a>         time_t <a class="code" href="classconnection.html#o14">idle_lastmsg</a>;
00230         
<a name="l00233"></a><a class="code" href="classconnection.html#o15">00233</a>         time_t <a class="code" href="classconnection.html#o15">nping</a>;
00234         
<a name="l00237"></a><a class="code" href="classconnection.html#o16">00237</a>         <span class="keywordtype">char</span> <a class="code" href="classconnection.html#o16">internal_addr</a>[MAXBUF];
00238         
<a name="l00241"></a><a class="code" href="classconnection.html#o17">00241</a>         <span class="keywordtype">int</span> <a class="code" href="classconnection.html#o17">internal_port</a>;
00242 
<a name="l00246"></a><a class="code" href="classconnection.html#o18">00246</a>         std::vector&lt;ircd_connector&gt; <a class="code" href="classconnection.html#o18">connectors</a>;
00247         
00250         <a class="code" href="classconnection.html#a0">connection</a>();
00251         
00254         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#a1">CreateListener</a>(<span class="keywordtype">char</span>* host, <span class="keywordtype">int</span> p);
00255         
00258         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#a2">BeginLink</a>(<span class="keywordtype">char</span>* targethost, <span class="keywordtype">int</span> port, <span class="keywordtype">char</span>* password, <span class="keywordtype">char</span>* servername, <span class="keywordtype">int</span> myport);
00259         
00262         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#a3">MeshCookie</a>(<span class="keywordtype">char</span>* targethost, <span class="keywordtype">int</span> port, <span class="keywordtype">long</span> cookie, <span class="keywordtype">char</span>* servername);
00263         
00266         <span class="keywordtype">void</span> <a class="code" href="classconnection.html#a4">TerminateLink</a>(<span class="keywordtype">char</span>* targethost);
00267         
00271         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#a5">SendPacket</a>(<span class="keywordtype">char</span> *message, <span class="keyword">const</span> <span class="keywordtype">char</span>* host);
00272         
00277         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#a6">RecvPacket</a>(std::deque&lt;std::string&gt; &amp;messages, <span class="keywordtype">char</span>* host);
00278         
00281         <a class="code" href="classircd__connector.html">ircd_connector</a>* <a class="code" href="classconnection.html#a7">FindHost</a>(std::string host);
00282         
00286         <span class="keywordtype">bool</span> <a class="code" href="classconnection.html#a8">AddIncoming</a>(<span class="keywordtype">int</span> fd,<span class="keywordtype">char</span>* targethost, <span class="keywordtype">int</span> sourceport);
00287         
00290         <span class="keywordtype">long</span> <a class="code" href="classconnection.html#a9">GenKey</a>();
00291 };
00292 
00293 
00294 <span class="preprocessor">#endif</span>
00295 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Apr 15 14:50:45 2005 for InspIRCd by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.3 </small></address>
</body>
</html>