]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/inspsocket.h
Include <array> or <tr1/array> globally
[user/henk/code/inspircd.git] / include / inspsocket.h
index 0c5f3b3af8a140c81e7c292e10ffd5ab9ceab57a..751374fdf1aab978bfeae12e45c3ade7881359d2 100644 (file)
@@ -198,6 +198,13 @@ class CoreExport StreamSocket : public EventHandler
                        nbytes = 0;
                }
 
+               void moveall(SendQueue& other)
+               {
+                       nbytes += other.bytes();
+                       data.insert(data.end(), other.data.begin(), other.data.end());
+                       other.clear();
+               }
+
         private:
                /** Private send queue. Note that individual strings may be shared.
                 */
@@ -240,6 +247,16 @@ class CoreExport StreamSocket : public EventHandler
         */
        int ReadToRecvQ(std::string& rq);
 
+       /** Read data from a hook chain recursively, starting at 'hook'.
+        * If 'hook' is NULL, the recvq is filled with data from SocketEngine::Recv(), otherwise it is filled with data from the
+        * next hook in the chain.
+        * @param hook Next IOHook in the chain, can be NULL
+        * @param rq Receive queue to put incoming data into
+        * @return < 0 on error or close, 0 if no new data is ready (but the socket is still connected), > 0 if data was read from
+        the socket and put into the recvq
+        */
+       int HookChainRead(IOHook* hook, std::string& rq);
+
  protected:
        std::string recvq;
  public:
@@ -286,7 +303,7 @@ class CoreExport StreamSocket : public EventHandler
         */
        bool GetNextLine(std::string& line, char delim = '\n');
        /** Useful for implementing sendq exceeded */
-       size_t getSendQSize() const { return sendq.size(); }
+       size_t getSendQSize() const;
 
        SendQueue& GetSendQ() { return sendq; }
 
@@ -376,5 +393,4 @@ class CoreExport BufferedSocket : public StreamSocket
 };
 
 inline IOHook* StreamSocket::GetIOHook() const { return iohook; }
-inline void StreamSocket::AddIOHook(IOHook* hook) { iohook = hook; }
 inline void StreamSocket::DelIOHook() { iohook = NULL; }