summaryrefslogtreecommitdiff
path: root/docs/module-doc/socket_8h-source.html
blob: 601404fc35f7eff838e21f2cbbea5604b67239b5 (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>InspIRCd: socket.h Source File</title>
<link href="inspircd.doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4-20050815 -->
<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">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</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">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">home</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000001.html">brain</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000002.html">inspircd-cvs</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000003.html">inspircd</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000004.html">include</a></div>
<h1>socket.h</h1><a href="socket_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*       +------------------------------------+</span>
<a name="l00002"></a>00002 <span class="comment"> *       | Inspire Internet Relay Chat Daemon |</span>
<a name="l00003"></a>00003 <span class="comment"> *       +------------------------------------+</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.</span>
<a name="l00006"></a>00006 <span class="comment"> *                       E-mail:</span>
<a name="l00007"></a>00007 <span class="comment"> *                &lt;brain@chatspike.net&gt;</span>
<a name="l00008"></a>00008 <span class="comment"> *                &lt;Craig@chatspike.net&gt;</span>
<a name="l00009"></a>00009 <span class="comment"> *     </span>
<a name="l00010"></a>00010 <span class="comment"> * Written by Craig Edwards, Craig McLure, and others.</span>
<a name="l00011"></a>00011 <span class="comment"> * This program is free but copyrighted software; see</span>
<a name="l00012"></a>00012 <span class="comment"> *            the file COPYING for details.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * ---------------------------------------------------</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef __INSP_SOCKET_H__</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __INSP_SOCKET_H__</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;netinet/in.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00025"></a>00025 
<a name="l00029"></a><a class="code" href="socket_8h.html#InspSocketState">00029</a> <span class="keyword">enum</span> <a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> { <a class="code" href="socket_8h.html#InspSocketStateI_5FDISCONNECTED">I_DISCONNECTED</a>, <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>, <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTED">I_CONNECTED</a>, <a class="code" href="socket_8h.html#InspSocketStateI_5FLISTENING">I_LISTENING</a>, <a class="code" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a> };
<a name="l00030"></a>00030 
<a name="l00034"></a><a class="code" href="socket_8h.html#InspSocketError">00034</a> <span class="keyword">enum</span> <a class="code" href="socket_8h.html#InspSocketError">InspSocketError</a> { <a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FTIMEOUT">I_ERR_TIMEOUT</a>, <a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FSOCKET">I_ERR_SOCKET</a>, <a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FCONNECT">I_ERR_CONNECT</a>, <a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FBIND">I_ERR_BIND</a> };
<a name="l00035"></a>00035 
<a name="l00047"></a><a class="code" href="classInspSocket.html">00047</a> <span class="keyword">class </span><a class="code" href="classInspSocket.html">InspSocket</a>
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049 <span class="keyword">private</span>:
<a name="l00050"></a>00050 
<a name="l00054"></a><a class="code" href="classInspSocket.html#fd">00054</a>         <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#fd">fd</a>;
<a name="l00055"></a>00055 
<a name="l00059"></a><a class="code" href="classInspSocket.html#host">00059</a>         <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#host">host</a>;
<a name="l00060"></a>00060 
<a name="l00065"></a><a class="code" href="classInspSocket.html#port">00065</a>         <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#port">port</a>;
<a name="l00066"></a>00066 
<a name="l00072"></a><a class="code" href="classInspSocket.html#state">00072</a>         <a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> <a class="code" href="classInspSocket.html#state">state</a>;
<a name="l00073"></a>00073 
<a name="l00078"></a><a class="code" href="classInspSocket.html#addr">00078</a>         sockaddr_in <a class="code" href="classInspSocket.html#addr">addr</a>;
<a name="l00079"></a>00079 
<a name="l00084"></a><a class="code" href="classInspSocket.html#addy">00084</a>         in_addr <a class="code" href="classInspSocket.html#addy">addy</a>;
<a name="l00085"></a>00085 
<a name="l00091"></a><a class="code" href="classInspSocket.html#timeout_5Fend">00091</a>         time_t <a class="code" href="classInspSocket.html#timeout_5Fend">timeout_end</a>;
<a name="l00092"></a>00092 
<a name="l00097"></a><a class="code" href="classInspSocket.html#timeout">00097</a>         <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#timeout">timeout</a>;
<a name="l00098"></a>00098         
<a name="l00106"></a><a class="code" href="classInspSocket.html#ibuf_5B_36_35_35_33_35_5D">00106</a>         <span class="keywordtype">char</span> <a class="code" href="classInspSocket.html#ibuf_5B_36_35_35_33_35_5D">ibuf</a>[65535];
<a name="l00107"></a>00107 
<a name="l00111"></a><a class="code" href="classInspSocket.html#Buffer">00111</a>         <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#Buffer">Buffer</a>;
<a name="l00112"></a>00112 
<a name="l00118"></a><a class="code" href="classInspSocket.html#IP">00118</a>         <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#IP">IP</a>;
<a name="l00119"></a>00119 
<a name="l00124"></a><a class="code" href="classInspSocket.html#client">00124</a>         sockaddr_in <a class="code" href="classInspSocket.html#client">client</a>;
<a name="l00125"></a>00125 
<a name="l00130"></a><a class="code" href="classInspSocket.html#server">00130</a>         sockaddr_in <a class="code" href="classInspSocket.html#server">server</a>;
<a name="l00131"></a>00131 
<a name="l00136"></a><a class="code" href="classInspSocket.html#length">00136</a>         socklen_t <a class="code" href="classInspSocket.html#length">length</a>;
<a name="l00137"></a>00137 
<a name="l00140"></a>00140         <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#FlushWriteBuffer_28_29">FlushWriteBuffer</a>();
<a name="l00141"></a>00141 
<a name="l00142"></a>00142 <span class="keyword">public</span>:
<a name="l00143"></a>00143 
<a name="l00148"></a>00148         <a class="code" href="classInspSocket.html#InspSocket_28_29">InspSocket</a>();
<a name="l00149"></a>00149 
<a name="l00158"></a>00158         <a class="code" href="classInspSocket.html#InspSocket_28_29">InspSocket</a>(<span class="keywordtype">int</span> newfd, <span class="keywordtype">char</span>* ip);
<a name="l00159"></a>00159 
<a name="l00169"></a>00169         <a class="code" href="classInspSocket.html#InspSocket_28_29">InspSocket</a>(<a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#host">host</a>, <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#port">port</a>, <span class="keywordtype">bool</span> listening, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxtime);
<a name="l00170"></a>00170 
<a name="l00176"></a>00176         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#OnConnected_28_29">OnConnected</a>();
<a name="l00177"></a>00177 
<a name="l00184"></a>00184         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a>(<a class="code" href="socket_8h.html#InspSocketError">InspSocketError</a> e);
<a name="l00185"></a>00185 
<a name="l00190"></a>00190         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#OnDisconnect_28_29">OnDisconnect</a>();
<a name="l00191"></a>00191 
<a name="l00204"></a>00204         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#OnDataReady_28_29">OnDataReady</a>();
<a name="l00205"></a>00205 
<a name="l00213"></a>00213         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnTimeout_28_29">OnTimeout</a>();
<a name="l00214"></a>00214 
<a name="l00223"></a>00223         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnClose_28_29">OnClose</a>();
<a name="l00224"></a>00224 
<a name="l00230"></a>00230         <span class="keyword">virtual</span> <span class="keywordtype">char</span>* <a class="code" href="classInspSocket.html#Read_28_29">Read</a>();
<a name="l00231"></a>00231 
<a name="l00237"></a>00237         <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#GetIP_28_29">GetIP</a>();
<a name="l00238"></a>00238 
<a name="l00245"></a>00245         <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#Timeout_28time_5Ft_20current_29">Timeout</a>(time_t current);
<a name="l00246"></a>00246 
<a name="l00252"></a>00252         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#Write_28std_3A_3Astring_20data_29">Write</a>(<a class="code" href="namespaceirc.html#string">std::string</a> data);
<a name="l00253"></a>00253 
<a name="l00267"></a>00267         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#OnIncomingConnection_28int_20newfd_2C_20char_20_2Aip_29">OnIncomingConnection</a>(<span class="keywordtype">int</span> newfd, <span class="keywordtype">char</span>* ip);
<a name="l00268"></a>00268 
<a name="l00274"></a>00274         <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#SetState_28InspSocketState_20s_29">SetState</a>(<a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> s);
<a name="l00275"></a>00275 
<a name="l00279"></a>00279         <a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> <a class="code" href="classInspSocket.html#GetState_28_29">GetState</a>();
<a name="l00280"></a>00280 
<a name="l00289"></a>00289         <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#Poll_28_29">Poll</a>();
<a name="l00290"></a>00290 
<a name="l00296"></a>00296         <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#GetFd_28_29">GetFd</a>();
<a name="l00297"></a>00297 
<a name="l00303"></a>00303         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#Close_28_29">Close</a>();
<a name="l00304"></a>00304 
<a name="l00310"></a>00310         <span class="keyword">virtual</span> <a class="code" href="classInspSocket.html#_7EInspSocket_28_29">~InspSocket</a>();
<a name="l00311"></a>00311 };
<a name="l00312"></a>00312 
<a name="l00313"></a>00313 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Dec 19 18:02:13 2005 for InspIRCd by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4-20050815 </small></address>
</body>
</html>