summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-25 09:32:17 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-25 09:32:17 +0000
commit6550242735047783301150f3551174797dddc7f5 (patch)
treeb568e1434a30005a03cc1f29a2a282c2936bc78c /include
parent3f8978ceef854ab7c91e86751b61a4405c10c4c8 (diff)
Started removal of server linking code from core and implementation of socket API
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1930 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/socket.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/socket.h b/include/socket.h
index 499a4d375..fd5e26586 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -21,6 +21,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 };
class InspSocket
{
@@ -33,15 +34,22 @@ private:
in_addr addy;
time_t timeout_end;
bool timeout;
+ pollfd polls;
+ char ibuf[1024];
public:
InspSocket();
InspSocket(std::string host, int port, bool listening, unsigned long maxtime);
- virtual int OnConnected();
- virtual int OnError();
+ virtual bool OnConnected();
+ virtual void OnError(InspSocketError e);
virtual int OnDisconnect();
- virtual int OnDataReady();
+ virtual bool OnDataReady();
+ virtual void OnTimeout();
+ virtual void OnClose();
+ virtual char* Read();
+ virtual int Write(std::string data);
virtual int OnIncomingConnection();
void SetState(InspSocketState s);
- void EngineTrigger();
+ bool Poll();
+ virtual void Close();
virtual ~InspSocket();
};