]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/inspsocket.h
- Fixed UDP Overlapped I/O under windows. (not the best way this could be done by...
[user/henk/code/inspircd.git] / include / inspsocket.h
index 739e4408d4b614d9c80f7f463a733effbcadacdb..3e65bf677f07606860d2420f38c4355a60579608 100644 (file)
@@ -6,7 +6,7 @@
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ *         the file COPYING for details.
  *
  * ---------------------------------------------------
  */
@@ -43,7 +43,7 @@ using irc::sockets::insp_aton;
 
 /** Used to time out socket connections
  */
-class SocketTimeout : public InspTimer
+class CoreExport SocketTimeout : public InspTimer
 {
  private:
        InspSocket* sock;
@@ -65,10 +65,12 @@ class SocketTimeout : public InspTimer
  * and use the InspSocket constructors to establish connections
  * and bindings.
  */
-class InspSocket : public EventHandler
+class CoreExport InspSocket : public EventHandler
 {
  public:
 
+       std::string cbindip;
+
        bool IsIOHooked;
 
        InspIRCd* Instance;
@@ -101,7 +103,7 @@ class InspSocket : public EventHandler
         * This value is true if the
         * socket has timed out.
         */
-        bool timeout;
+       bool timeout;
        
        /**
         * Socket input buffer, used by read(). The class which
@@ -149,7 +151,7 @@ class InspSocket : public EventHandler
         */
        bool WaitingForWriteEvent;
 
-       bool BindAddr();
+       bool BindAddr(const std::string &ip);
 
        /**
         * The default constructor does nothing
@@ -177,9 +179,10 @@ class InspSocket : public EventHandler
         * @param port The port number to connect to, or bind to
         * @param listening true to listen on the given host:port pair, or false to connect to them
         * @param maxtime Number of seconds to wait, if connecting, before the connection times out and an OnTimeout() event is generated
+        * @param connectbindip When creating an outbound connection, the IP to bind the connection to. If not defined, the port is not bound.
         * @return On exit, GetState() returns I_ERROR if an error occured, and errno can be used to read the socket error.
         */
-       InspSocket(InspIRCd* SI, const std::string &ipaddr, int port, bool listening, unsigned long maxtime);
+       InspSocket(InspIRCd* SI, const std::string &ipaddr, int port, bool listening, unsigned long maxtime, const std::string &connectbindip = "");
 
        /**
         * This method is called when an outbound