]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/connection.h
Added some netsplit handling stuff (untested)
[user/henk/code/inspircd.git] / include / connection.h
index a18d201efbb960c7736debae7de85357e2c46b00..3316bd6c0fd09a8f7546f4c3299edbe31aa1214a 100644 (file)
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <time.h>
 #include <vector>
+#include <deque>
 
 #ifndef __CONNECTION_H__
 #define __CONNECTION_H__
@@ -35,7 +36,7 @@ class ircd_connector : public classbase
         */
        sockaddr_in addr;
        
-       /** File descriptor of the outbound connection
+       /** File descriptor of the connection
         */
        int fd;
        
@@ -43,11 +44,9 @@ class ircd_connector : public classbase
         */
        std::string servername;
        
-       /** Server names of servers that this server is linked to
-        * So for A->B->C, if this was the record for B it would contain A and C
-        * whilever both servers are connected to B.
+       /** Server 'GECOS'
         */
-       std::vector<std::string> routes;
+       std::string description;
        
        /** State. STATE_NOAUTH_INBOUND, STATE_NOAUTH_OUTBOUND
         * STATE_SYNC, STATE_DISCONNECTED, STATE_CONNECTED
@@ -57,6 +56,15 @@ class ircd_connector : public classbase
        bool SetHostAddress(char* host, int port);
 
  public:
+       char host[MAXBUF];
+       int port;
+       
+       /** Server names of servers that this server is linked to
+        * So for A->B->C, if this was the record for B it would contain A and C
+        * whilever both servers are connected to B.
+        */
+       std::vector<std::string> routes;
+       
  
        bool MakeOutboundConnection(char* host, int port);
        std::string GetServerName();
@@ -65,6 +73,12 @@ class ircd_connector : public classbase
        void SetDescriptor(int fd);
        int GetState();
        void SetState(int state);
+       char* GetServerIP();
+       std::string GetDescription();
+       void SetDescription(std::string desc);
+       int GetServerPort();
+       bool SetHostAndPort(char* host, int port);
+       void CloseConnection();
 };
 
 
@@ -108,11 +122,12 @@ class connection : public classbase
        connection();
        bool CreateListener(char* host, int p);
        bool BeginLink(char* targethost, int port, char* password, char* servername);
+       bool MeshCookie(char* targethost, int port, long cookie, char* servername);
        void TerminateLink(char* targethost);
-       bool SendPacket(char *message, char* host);
-       bool RecvPacket(char *message, char* host);
+       bool SendPacket(char *message, const char* host);
+       bool RecvPacket(std::deque<std::string> &messages, char* host);
        ircd_connector* FindHost(std::string host);
-       bool AddIncoming(int fd,char* targethost);
+       bool AddIncoming(int fd,char* targethost, int sourceport);
        long GenKey();
 };