]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/inspsocket.h
irc::tokenstream is a token parser which using std::string and std::vector builds...
[user/henk/code/inspircd.git] / include / inspsocket.h
index 7e8593391790cab6c724390e4c25c79c2b230a3d..56c04373d4aa571a5d2c4339fcf3832c287f6968 100644 (file)
@@ -45,9 +45,9 @@ enum InspSocketError { I_ERR_TIMEOUT, I_ERR_SOCKET, I_ERR_CONNECT, I_ERR_BIND, I
  * and use the InspSocket constructors to establish connections
  * and bindings.
  */
-class InspSocket
+class InspSocket : public Extensible
 {
-private:
+protected:
 
        std::deque<std::string> outbuffer;
 
@@ -156,6 +156,12 @@ private:
         */
        bool ClosePending;
 
+       /** Set to true when we're waiting for a write event.
+        * If this is true and a write event comes in, we
+        * call the write instead of the read method.
+        */
+       bool WaitingForWriteEvent;
+
        bool BindAddr();
 
 public:
@@ -174,7 +180,7 @@ public:
         * will be set with the given IP address
         * and placed in CONNECTED state.
         */
-       InspSocket(int newfd, char* ip);
+       InspSocket(int newfd, const char* ip);
 
        /**
         * This constructor is used to create a new
@@ -224,6 +230,8 @@ public:
         */
        virtual bool OnDataReady();
 
+       virtual bool OnWriteReady();
+
        /**
         * When an outbound connection fails, and the
         * attempt times out, you will receive this event.
@@ -298,6 +306,13 @@ public:
         */
        void SetState(InspSocketState s);
 
+       /**
+        * Call this to receive the next write event
+        * that comes along for this fd to the OnWriteReady
+        * method.
+        */
+       void WantWrite();
+
        /**
         * Returns the current socket state.
         */