summaryrefslogtreecommitdiff
path: root/include/socket.h
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-23 11:22:06 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-23 11:22:06 +0000
commit3f8978ceef854ab7c91e86751b61a4405c10c4c8 (patch)
treebd32f70b79616d3da8acf96befea6b58fd3e136a /include/socket.h
parente24156804d5bf625b200d4351fd4b65002df1fc5 (diff)
Added some stuff to socket classes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1929 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/socket.h')
-rw-r--r--include/socket.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/socket.h b/include/socket.h
index 3e681f1c4..499a4d375 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -14,10 +14,13 @@
* ---------------------------------------------------
*/
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#include <sstream>
#include <string>
-enum InspSocketState { I_DISCONNECTED, I_CONNECTING, I_CONNECTED, I_LISTENING };
+enum InspSocketState { I_DISCONNECTED, I_CONNECTING, I_CONNECTED, I_LISTENING, I_ERROR };
class InspSocket
{
@@ -26,13 +29,19 @@ private:
std::string host;
int port;
InspSocketState state;
+ sockaddr_in addr;
+ in_addr addy;
+ time_t timeout_end;
+ bool timeout;
public:
InspSocket();
- InspSocket(std::string host, int port, bool listening);
- void Poll();
+ InspSocket(std::string host, int port, bool listening, unsigned long maxtime);
virtual int OnConnected();
virtual int OnError();
virtual int OnDisconnect();
+ virtual int OnDataReady();
virtual int OnIncomingConnection();
- ~InspSocket();
+ void SetState(InspSocketState s);
+ void EngineTrigger();
+ virtual ~InspSocket();
};