summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
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();