summaryrefslogtreecommitdiff
path: root/docs/module-doc/socket_8h-source.html
blob: 4001154a5816fc813d4b26dac8021e5076b9b936 (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
<!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_31_36_33_38_34_5D">00106</a>         <span class="keywordtype">char</span> <a class="code" href="classInspSocket.html#ibuf_5B_31_36_33_38_34_5D">ibuf</a>[16384];
<a name="l00107"></a>00107 
<a name="l00113"></a><a class="code" href="classInspSocket.html#IP">00113</a>         <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#IP">IP</a>;
<a name="l00114"></a>00114 
<a name="l00119"></a><a class="code" href="classInspSocket.html#client">00119</a>         sockaddr_in <a class="code" href="classInspSocket.html#client">client</a>;
<a name="l00120"></a>00120 
<a name="l00125"></a><a class="code" href="classInspSocket.html#server">00125</a>         sockaddr_in <a class="code" href="classInspSocket.html#server">server</a>;
<a name="l00126"></a>00126 
<a name="l00131"></a><a class="code" href="classInspSocket.html#length">00131</a>         socklen_t <a class="code" href="classInspSocket.html#length">length</a>;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133 <span class="keyword">public</span>:
<a name="l00134"></a>00134 
<a name="l00139"></a>00139         <a class="code" href="classInspSocket.html#InspSocket_28_29">InspSocket</a>();
<a name="l00140"></a>00140 
<a name="l00149"></a>00149         <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="l00150"></a>00150 
<a name="l00160"></a>00160         <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="l00161"></a>00161 
<a name="l00167"></a>00167         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#OnConnected_28_29">OnConnected</a>();
<a name="l00168"></a>00168 
<a name="l00175"></a>00175         <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="l00176"></a>00176 
<a name="l00181"></a>00181         <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#OnDisconnect_28_29">OnDisconnect</a>();
<a name="l00182"></a>00182 
<a name="l00195"></a>00195         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#OnDataReady_28_29">OnDataReady</a>();
<a name="l00196"></a>00196 
<a name="l00204"></a>00204         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnTimeout_28_29">OnTimeout</a>();
<a name="l00205"></a>00205 
<a name="l00214"></a>00214         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnClose_28_29">OnClose</a>();
<a name="l00215"></a>00215 
<a name="l00221"></a>00221         <span class="keyword">virtual</span> <span class="keywordtype">char</span>* <a class="code" href="classInspSocket.html#Read_28_29">Read</a>();
<a name="l00222"></a>00222 
<a name="l00228"></a>00228         <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#GetIP_28_29">GetIP</a>();
<a name="l00229"></a>00229 
<a name="l00236"></a>00236         <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#Timeout_28time_5Ft_20current_29">Timeout</a>(time_t current);
<a name="l00237"></a>00237 
<a name="l00243"></a>00243         <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="l00244"></a>00244 
<a name="l00258"></a>00258         <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="l00259"></a>00259 
<a name="l00265"></a>00265         <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="l00266"></a>00266 
<a name="l00270"></a>00270         <a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> <a class="code" href="classInspSocket.html#GetState_28_29">GetState</a>();
<a name="l00271"></a>00271 
<a name="l00280"></a>00280         <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#Poll_28_29">Poll</a>();
<a name="l00281"></a>00281 
<a name="l00287"></a>00287         <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#GetFd_28_29">GetFd</a>();
<a name="l00288"></a>00288 
<a name="l00294"></a>00294         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#Close_28_29">Close</a>();
<a name="l00295"></a>00295 
<a name="l00301"></a>00301         <span class="keyword">virtual</span> <a class="code" href="classInspSocket.html#_7EInspSocket_28_29">~InspSocket</a>();
<a name="l00302"></a>00302 };
<a name="l00303"></a>00303 
<a name="l00304"></a>00304 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Dec 15 11:14:14 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>