From 097b2479d0393d8a8bada4a50708d7a2404045ca Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 12 Dec 2005 13:32:15 +0000 Subject: Added new docs for class SocketEngine git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2339 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/classInspSocket.html | 477 +++++++++++++++++++---------------- 1 file changed, 258 insertions(+), 219 deletions(-) (limited to 'docs/module-doc/classInspSocket.html') diff --git a/docs/module-doc/classInspSocket.html b/docs/module-doc/classInspSocket.html index 6aee4b7e0..b4c7e7fba 100644 --- a/docs/module-doc/classInspSocket.html +++ b/docs/module-doc/classInspSocket.html @@ -43,6 +43,8 @@ Collaboration diagram for InspSocket:
-Definition at line 46 of file socket.cpp. +Definition at line 49 of file socket.cpp.
-References I_DISCONNECTED, and state.
00047 { -00048 this->state = I_DISCONNECTED; -00049 } +References I_DISCONNECTED, and state.00050 { +00051 this->state = I_DISCONNECTED; +00052 }@@ -155,13 +157,14 @@ References I
-Definition at line 51 of file socket.cpp. +Definition at line 54 of file socket.cpp.
-References fd, I_CONNECTED, IP, and state.
00052 { -00053 this->fd = newfd; -00054 this->state = I_CONNECTED; -00055 this->IP = ip; -00056 } +References SocketEngine::AddFd(), fd, I_CONNECTED, IP, state, and X_ESTAB_MODULE.00055 { +00056 this->fd = newfd; +00057 this->state = I_CONNECTED; +00058 this->IP = ip; +00059 SE->AddFd(this->fd,true,X_ESTAB_MODULE); +00060 }@@ -215,81 +218,83 @@ References fd, 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 } +Definition at line 62 of file socket.cpp. ++References SocketEngine::AddFd(), addr, addy, Close(), DEBUG, fd, I_CONNECTING, I_ERR_BIND, I_ERR_CONNECT, I_ERR_SOCKET, I_ERROR, I_LISTENING, IP, OnError(), state, timeout, timeout_end, and X_ESTAB_MODULE.
00063 { +00064 if (listening) { +00065 if ((this->fd = OpenTCPSocket()) == ERROR) +00066 { +00067 this->fd = -1; +00068 this->state = I_ERROR; +00069 this->OnError(I_ERR_SOCKET); +00070 log(DEBUG,"OpenTCPSocket() error"); +00071 return; +00072 } +00073 else +00074 { +00075 if (BindSocket(this->fd,this->client,this->server,port,(char*)host.c_str()) == ERROR) +00076 { +00077 this->Close(); +00078 this->fd = -1; +00079 this->state = I_ERROR; +00080 this->OnError(I_ERR_BIND); +00081 log(DEBUG,"BindSocket() error %s",strerror(errno)); +00082 return; +00083 } +00084 else +00085 { +00086 this->state = I_LISTENING; +00087 SE->AddFd(this->fd,true,X_ESTAB_MODULE); +00088 log(DEBUG,"New socket now in I_LISTENING state"); +00089 return; +00090 } +00091 } +00092 } else { +00093 char* ip; +00094 this->host = host; +00095 hostent* hoste = gethostbyname(host.c_str()); +00096 if (!hoste) { +00097 ip = (char*)host.c_str(); +00098 } else { +00099 struct in_addr* ia = (in_addr*)hoste->h_addr; +00100 ip = inet_ntoa(*ia); +00101 } +00102 +00103 this->IP = ip; +00104 +00105 timeout_end = time(NULL)+maxtime; +00106 timeout = false; +00107 if ((this->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) +00108 { +00109 this->state = I_ERROR; +00110 this->OnError(I_ERR_SOCKET); +00111 return; +00112 } +00113 this->port = port; +00114 inet_aton(ip,&addy); +00115 addr.sin_family = AF_INET; +00116 addr.sin_addr = addy; +00117 addr.sin_port = htons(this->port); +00118 +00119 int flags; +00120 flags = fcntl(this->fd, F_GETFL, 0); +00121 fcntl(this->fd, F_SETFL, flags | O_NONBLOCK); +00122 +00123 if(connect(this->fd, (sockaddr*)&this->addr,sizeof(this->addr)) == -1) +00124 { +00125 if (errno != EINPROGRESS) +00126 { +00127 this->Close(); +00128 this->OnError(I_ERR_CONNECT); +00129 this->state = I_ERROR; +00130 return; +00131 } +00132 } +00133 this->state = I_CONNECTING; +00134 SE->AddFd(this->fd,false,X_ESTAB_MODULE); +00135 return; +00136 } +00137 }@@ -321,11 +326,11 @@ References addr,
-Definition at line 254 of file socket.cpp. +Definition at line 265 of file socket.cpp.
-References Close().
00255 { -00256 this->Close(); -00257 } +References Close().00266 { +00267 this->Close(); +00268 }@@ -358,19 +363,55 @@ References Close().
-Definition at line 133 of file socket.cpp. +Definition at line 139 of file socket.cpp. +
+References fd, and OnClose(). +
+Referenced by InspSocket(), and ~InspSocket().
+00140 { +00141 if (this->fd != -1) +00142 { +00143 this->OnClose(); +00144 shutdown(this->fd,2); +00145 close(this->fd); +00146 this->fd = -1; +00147 } +00148 } ++
+
++ ++ ++
++ +int InspSocket::GetFd +( ++ ) ++ @@ -961,7 +1002,7 @@ Referenced by InspSocket()
Definition at line 38 of file socket.h.
-Referenced by InspSocket(). +Referenced by InspSocket().
@@ -988,7 +1029,7 @@ Referenced by InspSocket()
Definition at line 44 of file socket.h.
-Referenced by Poll(). +Referenced by Poll().
@@ -1015,7 +1056,7 @@ Referenced by Poll().
Definition at line 33 of file socket.h.
-Referenced by Close(), InspSocket(), and Poll(). +Referenced by Close(), GetFd(), and InspSocket().
@@ -1067,7 +1108,7 @@ Definition at line 34 of f
Definition at line 42 of file socket.h.
-Referenced by Read(). +Referenced by Read().
@@ -1094,7 +1135,7 @@ Referenced by Read().
Definition at line 43 of file socket.h.
-Referenced by GetIP(), and InspSocket(). +Referenced by GetIP(), and InspSocket().
@@ -1121,7 +1162,7 @@ Referenced by GetIP(), a
Definition at line 46 of file socket.h.
-Referenced by Poll(). +Referenced by Poll().
@@ -1146,9 +1187,7 @@ Referenced by Poll().
-Definition at line 41 of file socket.h. -
-Referenced by Poll(). +Definition at line 41 of file socket.h.
@@ -1225,7 +1264,7 @@ Definition at line 45 of f
Definition at line 36 of file socket.h.
-Referenced by GetState(), InspSocket(), Poll(), and SetState(). +Referenced by GetState(), InspSocket(), Poll(), and SetState().
@@ -1252,7 +1291,7 @@ Referenced by GetState()
Definition at line 40 of file socket.h.
-Referenced by InspSocket(), and Poll(). +Referenced by InspSocket(), and Poll().
@@ -1279,12 +1318,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 Fri Dec 9 20:20:12 2005 for InspIRCd by +
Generated on Mon Dec 12 13:31:12 2005 for InspIRCd by1.4.4-20050815