From bab9f4b4bc0f6aa0e1377745fd216ef9874b3f27 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 9 Dec 2005 20:21:39 +0000 Subject: Added new module docs git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2301 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/classInspSocket.html | 505 ++++++++++++++++++++--------------- 1 file changed, 292 insertions(+), 213 deletions(-) (limited to 'docs/module-doc/classInspSocket.html') diff --git a/docs/module-doc/classInspSocket.html b/docs/module-doc/classInspSocket.html index ba3112cbe..6aee4b7e0 100644 --- a/docs/module-doc/classInspSocket.html +++ b/docs/module-doc/classInspSocket.html @@ -13,7 +13,7 @@ Collaboration diagram for InspSocket:
| @@ -124,9 +128,18 @@ References I | InspSocket::InspSocket | ( | int | -newfd | -) | -+ | newfd, | +
| + | + | char * | +ip | +||||
| + | ) | +||||||
Definition at line 51 of file socket.cpp.
-References fd, I_CONNECTED, and state.
00052 { +References fd, I_CONNECTED, IP, and state.00052 { 00053 this->fd = newfd; 00054 this->state = I_CONNECTED; -00055 } +00055 this->IP = ip; +00056 }@@ -201,79 +215,81 @@ References fd, 57 of file socket.cpp. -
-References addr, addy, Close(), DEBUG, fd, I_CONNECTING, I_ERR_BIND, I_ERR_CONNECT, I_ERR_SOCKET, I_ERROR, I_LISTENING, OnError(), state, timeout, and timeout_end.
00058 { -00059 if (listening) { -00060 if ((this->fd = OpenTCPSocket()) == ERROR) -00061 { -00062 this->fd = -1; -00063 this->state = I_ERROR; -00064 this->OnError(I_ERR_SOCKET); -00065 log(DEBUG,"OpenTCPSocket() error"); -00066 return; -00067 } -00068 else -00069 { -00070 if (BindSocket(this->fd,this->client,this->server,port,(char*)host.c_str()) == ERROR) -00071 { -00072 this->Close(); -00073 this->fd = -1; -00074 this->state = I_ERROR; -00075 this->OnError(I_ERR_BIND); -00076 log(DEBUG,"BindSocket() error %s",strerror(errno)); -00077 return; -00078 } -00079 else -00080 { -00081 this->state = I_LISTENING; -00082 log(DEBUG,"New socket now in I_LISTENING state"); -00083 return; -00084 } -00085 } -00086 } else { -00087 char* ip; -00088 this->host = host; -00089 hostent* hoste = gethostbyname(host.c_str()); -00090 if (!hoste) { -00091 ip = (char*)host.c_str(); -00092 } else { -00093 struct in_addr* ia = (in_addr*)hoste->h_addr; -00094 ip = inet_ntoa(*ia); -00095 } -00096 -00097 timeout_end = time(NULL)+maxtime; -00098 timeout = false; -00099 if ((this->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) -00100 { -00101 this->state = I_ERROR; -00102 this->OnError(I_ERR_SOCKET); -00103 return; -00104 } -00105 this->port = port; -00106 inet_aton(ip,&addy); -00107 addr.sin_family = AF_INET; -00108 addr.sin_addr = addy; -00109 addr.sin_port = htons(this->port); -00110 -00111 int flags; -00112 flags = fcntl(this->fd, F_GETFL, 0); -00113 fcntl(this->fd, F_SETFL, flags | O_NONBLOCK); -00114 -00115 if(connect(this->fd, (sockaddr*)&this->addr,sizeof(this->addr)) == -1) -00116 { -00117 if (errno != EINPROGRESS) -00118 { -00119 this->Close(); -00120 this->OnError(I_ERR_CONNECT); -00121 this->state = I_ERROR; -00122 return; -00123 } -00124 } -00125 this->state = I_CONNECTING; -00126 return; -00127 } -00128 } +Definition at line 58 of file socket.cpp. ++References addr, addy, Close(), DEBUG, fd, I_CONNECTING, I_ERR_BIND, I_ERR_CONNECT, I_ERR_SOCKET, I_ERROR, I_LISTENING, IP, OnError(), state, timeout, and timeout_end.
00059 { +00060 if (listening) { +00061 if ((this->fd = OpenTCPSocket()) == ERROR) +00062 { +00063 this->fd = -1; +00064 this->state = I_ERROR; +00065 this->OnError(I_ERR_SOCKET); +00066 log(DEBUG,"OpenTCPSocket() error"); +00067 return; +00068 } +00069 else +00070 { +00071 if (BindSocket(this->fd,this->client,this->server,port,(char*)host.c_str()) == ERROR) +00072 { +00073 this->Close(); +00074 this->fd = -1; +00075 this->state = I_ERROR; +00076 this->OnError(I_ERR_BIND); +00077 log(DEBUG,"BindSocket() error %s",strerror(errno)); +00078 return; +00079 } +00080 else +00081 { +00082 this->state = I_LISTENING; +00083 log(DEBUG,"New socket now in I_LISTENING state"); +00084 return; +00085 } +00086 } +00087 } else { +00088 char* ip; +00089 this->host = host; +00090 hostent* hoste = gethostbyname(host.c_str()); +00091 if (!hoste) { +00092 ip = (char*)host.c_str(); +00093 } else { +00094 struct in_addr* ia = (in_addr*)hoste->h_addr; +00095 ip = inet_ntoa(*ia); +00096 } +00097 +00098 this->IP = ip; +00099 +00100 timeout_end = time(NULL)+maxtime; +00101 timeout = false; +00102 if ((this->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) +00103 { +00104 this->state = I_ERROR; +00105 this->OnError(I_ERR_SOCKET); +00106 return; +00107 } +00108 this->port = port; +00109 inet_aton(ip,&addy); +00110 addr.sin_family = AF_INET; +00111 addr.sin_addr = addy; +00112 addr.sin_port = htons(this->port); +00113 +00114 int flags; +00115 flags = fcntl(this->fd, F_GETFL, 0); +00116 fcntl(this->fd, F_SETFL, flags | O_NONBLOCK); +00117 +00118 if(connect(this->fd, (sockaddr*)&this->addr,sizeof(this->addr)) == -1) +00119 { +00120 if (errno != EINPROGRESS) +00121 { +00122 this->Close(); +00123 this->OnError(I_ERR_CONNECT); +00124 this->state = I_ERROR; +00125 return; +00126 } +00127 } +00128 this->state = I_CONNECTING; +00129 return; +00130 } +00131 }@@ -305,11 +321,11 @@ References addr,
-Definition at line 246 of file socket.cpp. +Definition at line 254 of file socket.cpp.
-References Close().
00247 { -00248 this->Close(); -00249 } +References Close().00255 { +00256 this->Close(); +00257 }@@ -342,19 +358,55 @@ References Close().
-Definition at line 130 of file socket.cpp. +Definition at line 133 of file socket.cpp.
-References fd, and OnClose(). +References fd, and OnClose().
-Referenced by InspSocket(), and ~InspSocket().
00131 { -00132 if (this->fd != -1) -00133 { -00134 this->OnClose(); -00135 shutdown(this->fd,2); -00136 close(this->fd); -00137 this->fd = -1; -00138 } -00139 } +Referenced by InspSocket(), and ~InspSocket().+00134 { +00135 if (this->fd != -1) +00136 { +00137 this->OnClose(); +00138 shutdown(this->fd,2); +00139 close(this->fd); +00140 this->fd = -1; +00141 } +00142 } ++
+
++ ++ ++
++ +std::string InspSocket::GetIP +( ++ ) ++ @@ -909,7 +961,7 @@ Referenced by InspSocket()
Definition at line 38 of file socket.h.
-Referenced by InspSocket(). +Referenced by InspSocket().
@@ -934,9 +986,9 @@ Referenced by InspSocket()
-Definition at line 43 of file socket.h. +Definition at line 44 of file socket.h.
-Referenced by Poll(). +Referenced by Poll().
@@ -963,7 +1015,7 @@ Referenced by Poll().
Definition at line 33 of file socket.h.
-Referenced by Close(), InspSocket(), and Poll(). +Referenced by Close(), InspSocket(), and Poll().
@@ -991,13 +1043,13 @@ Referenced by Close(), < Definition at line 34 of file socket.h. -
+
+ @@ -1015,7 +1067,34 @@ Definition at line 34 of f
- char InspSocket::ibuf[1024] +[private]char InspSocket::ibuf[16384] [private]+
+
++ ++ ++
++ +std::string InspSocket::IP +[private]+
+ + + ++ + + +
+Definition at line 43 of file socket.h. +
+Referenced by GetIP(), and InspSocket().
@@ -1040,9 +1119,9 @@ Referenced by Read().
-Definition at line 45 of file socket.h. +Definition at line 46 of file socket.h.
-Referenced by Poll(). +Referenced by Poll().
@@ -1069,7 +1148,7 @@ Referenced by Poll().
Definition at line 41 of file socket.h.
-Referenced by Poll(). +Referenced by Poll().
@@ -1119,7 +1198,7 @@ Definition at line 35 of f
-Definition at line 44 of file socket.h. +Definition at line 45 of file socket.h.
@@ -1146,7 +1225,7 @@ Definition at line 44 of f
Definition at line 36 of file socket.h.
-Referenced by GetState(), InspSocket(), Poll(), and SetState(). +Referenced by GetState(), InspSocket(), Poll(), and SetState().
@@ -1173,7 +1252,7 @@ Referenced by GetState()
Definition at line 40 of file socket.h.
-Referenced by InspSocket(), and Poll(). +Referenced by InspSocket(), and Poll().
@@ -1200,12 +1279,12 @@ Referenced by InspSocket()
Definition at line 39 of file socket.h.
-Referenced by InspSocket(), and Poll(). +Referenced by InspSocket(), and Poll().
The documentation for this class was generated from the following files: -
Generated on Sun Nov 27 01:43:25 2005 for InspIRCd by +
Generated on Fri Dec 9 20:20:12 2005 for InspIRCd by1.4.4-20050815