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
|
<!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 Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">home</a> » <a class="el" href="dir_000001.html">brain</a> » <a class="el" href="dir_000002.html">inspircd-cvs</a> » <a class="el" href="dir_000003.html">inspircd</a> » <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"> * <brain@chatspike.net></span>
<a name="l00008"></a>00008 <span class="comment"> * <Craig@chatspike.net></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 <sys/types.h></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include <sys/socket.h></span>
<a name="l00022"></a>00022 <span class="preprocessor">#include <netinet/in.h></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include <poll.h></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include <sstream></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include <string></span>
<a name="l00026"></a>00026
<a name="l00027"></a><a class="code" href="socket_8h.html#InspSocketState">00027</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="l00028"></a><a class="code" href="socket_8h.html#InspSocketError">00028</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="l00029"></a>00029
<a name="l00030"></a><a class="code" href="classInspSocket.html">00030</a> <span class="keyword">class </span><a class="code" href="classInspSocket.html">InspSocket</a>
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032 <span class="keyword">private</span>:
<a name="l00033"></a><a class="code" href="classInspSocket.html#fd">00033</a> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#fd">fd</a>;
<a name="l00034"></a><a class="code" href="classInspSocket.html#host">00034</a> <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#host">host</a>;
<a name="l00035"></a><a class="code" href="classInspSocket.html#port">00035</a> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#port">port</a>;
<a name="l00036"></a><a class="code" href="classInspSocket.html#state">00036</a> <a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> <a class="code" href="classInspSocket.html#state">state</a>;
<a name="l00037"></a><a class="code" href="classInspSocket.html#addr">00037</a> sockaddr_in <a class="code" href="classInspSocket.html#addr">addr</a>;
<a name="l00038"></a><a class="code" href="classInspSocket.html#addy">00038</a> in_addr <a class="code" href="classInspSocket.html#addy">addy</a>;
<a name="l00039"></a><a class="code" href="classInspSocket.html#timeout_5Fend">00039</a> time_t <a class="code" href="classInspSocket.html#timeout_5Fend">timeout_end</a>;
<a name="l00040"></a><a class="code" href="classInspSocket.html#timeout">00040</a> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#timeout">timeout</a>;
<a name="l00041"></a><a class="code" href="classInspSocket.html#polls">00041</a> pollfd <a class="code" href="classInspSocket.html#polls">polls</a>;
<a name="l00042"></a><a class="code" href="classInspSocket.html#ibuf_5B_31_36_33_38_34_5D">00042</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="l00043"></a><a class="code" href="classInspSocket.html#IP">00043</a> <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#IP">IP</a>;
<a name="l00044"></a><a class="code" href="classInspSocket.html#client">00044</a> sockaddr_in <a class="code" href="classInspSocket.html#client">client</a>;
<a name="l00045"></a><a class="code" href="classInspSocket.html#server">00045</a> sockaddr_in <a class="code" href="classInspSocket.html#server">server</a>;
<a name="l00046"></a><a class="code" href="classInspSocket.html#length">00046</a> socklen_t <a class="code" href="classInspSocket.html#length">length</a>;
<a name="l00047"></a>00047 <span class="keyword">public</span>:
<a name="l00048"></a>00048 <a class="code" href="classInspSocket.html#InspSocket_28_29">InspSocket</a>();
<a name="l00049"></a>00049 <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="l00050"></a>00050 <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="l00051"></a>00051 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#OnConnected_28_29">OnConnected</a>();
<a name="l00052"></a>00052 <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="l00053"></a>00053 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classInspSocket.html#OnDisconnect_28_29">OnDisconnect</a>();
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#OnDataReady_28_29">OnDataReady</a>();
<a name="l00055"></a>00055 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnTimeout_28_29">OnTimeout</a>();
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#OnClose_28_29">OnClose</a>();
<a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keywordtype">char</span>* <a class="code" href="classInspSocket.html#Read_28_29">Read</a>();
<a name="l00058"></a>00058 <a class="code" href="namespaceirc.html#string">std::string</a> <a class="code" href="classInspSocket.html#GetIP_28_29">GetIP</a>();
<a name="l00059"></a>00059 <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="l00060"></a>00060 <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="l00061"></a>00061 <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="l00062"></a>00062 <a class="code" href="socket_8h.html#InspSocketState">InspSocketState</a> <a class="code" href="classInspSocket.html#GetState_28_29">GetState</a>();
<a name="l00063"></a>00063 <span class="keywordtype">bool</span> <a class="code" href="classInspSocket.html#Poll_28_29">Poll</a>();
<a name="l00064"></a>00064 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classInspSocket.html#Close_28_29">Close</a>();
<a name="l00065"></a>00065 <span class="keyword">virtual</span> <a class="code" href="classInspSocket.html#_7EInspSocket_28_29">~InspSocket</a>();
<a name="l00066"></a>00066 };
<a name="l00067"></a>00067
<a name="l00068"></a>00068 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 9 20:20:03 2005 for InspIRCd by
<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>
|