summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-26 17:29:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-26 17:29:22 +0000
commitf3a1d7ea4bc13126996daf10031e89fd850c5945 (patch)
tree7b722843906ded7ce5d93338f0cdb45ce059f732 /include
parent17b5f19bf1476cb22ccb409145600dac7209f823 (diff)
Added listening socket support for InspSocket
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1957 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/socket.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/socket.h b/include/socket.h
index 051d9a453..f148b8e34 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -25,7 +25,7 @@
#include <string>
enum InspSocketState { I_DISCONNECTED, I_CONNECTING, I_CONNECTED, I_LISTENING, I_ERROR };
-enum InspSocketError { I_ERR_TIMEOUT, I_ERR_SOCKET, I_ERR_CONNECT };
+enum InspSocketError { I_ERR_TIMEOUT, I_ERR_SOCKET, I_ERR_CONNECT, I_ERR_BIND };
class InspSocket
{
@@ -40,8 +40,12 @@ private:
bool timeout;
pollfd polls;
char ibuf[1024];
+ sockaddr_in client;
+ sockaddr_in server;
+ socklen_t length;
public:
InspSocket();
+ InspSocket(int newfd);
InspSocket(std::string host, int port, bool listening, unsigned long maxtime);
virtual bool OnConnected();
virtual void OnError(InspSocketError e);
@@ -51,7 +55,7 @@ public:
virtual void OnClose();
virtual char* Read();
virtual int Write(std::string data);
- virtual int OnIncomingConnection();
+ virtual int OnIncomingConnection(int newfd, char* ip);
void SetState(InspSocketState s);
bool Poll();
virtual void Close();