X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fmodules%2Fm_spanningtree%2Ftreesocket.h;h=520026a99db9d264ea8504c7770a217da5d696f6;hb=78aabc62e7510af5075b2056f703f0aa42e328a4;hp=6d99c2a767beedf254a94124c6bbf9dbd956d73d;hpb=219993bc9018d9f0d9568330d7a972b68b785d27;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 6d99c2a76..520026a99 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -14,8 +14,6 @@ #ifndef __TREESOCKET_H__ #define __TREESOCKET_H__ -#include "commands/cmd_whois.h" -#include "commands/cmd_stats.h" #include "socket.h" #include "inspircd.h" #include "xline.h" @@ -73,7 +71,6 @@ class TreeSocket : public BufferedSocket { SpanningTreeUtilities* Utils; /* Utility class */ std::string myhost; /* Canonical hostname */ - std::string in_buffer; /* Input buffer */ ServerState LinkState; /* Link state */ std::string InboundServerName; /* Server name sent to us by other side */ std::string InboundDescription; /* Server description (GECOS) sent to us by the other side */ @@ -82,30 +79,34 @@ class TreeSocket : public BufferedSocket int num_lost_servers; /* Servers lost in split */ time_t NextPing; /* Time when we are due to ping this server */ bool LastPingWasGood; /* Responded to last ping we sent? */ - std::string ModuleList; /* Module list of other server from CAPAB */ + std::string IP; + std::string ModuleList; /* Required module list of other server from CAPAB */ + std::string OptModuleList; /* Optional module list of other server from CAPAB */ std::map CapKeys; /* CAPAB keys from other server */ - Module* Hook; /* I/O hooking module that we're attached to for this socket */ std::string ourchallenge; /* Challenge sent for challenge/response */ std::string theirchallenge; /* Challenge recv for challenge/response */ std::string OutboundPass; /* Outbound password */ - bool sentcapab; /* Have sent CAPAB already */ + int capab_phase; /* Have sent CAPAB already */ bool auth_fingerprint; /* Did we auth using SSL fingerprint */ bool auth_challenge; /* Did we auth using challenge/response */ + int proto_version; /* Remote protocol version */ public: HandshakeTimer* hstimer; /* Handshake timer, needed to work around I/O hook buffering */ + reference myautoconnect; /* Autoconnect used to cause this connection, if any */ + time_t age; /** Because most of the I/O gubbins are encapsulated within * BufferedSocket, we just call the superclass constructor for * most of the action, and append a few of our own values * to it. */ - TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod = NULL); + TreeSocket(SpanningTreeUtilities* Util, std::string host, int port, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Autoconnect* myac, Module* HookMod = NULL); /** When a listening socket gives us a new file descriptor, * we must associate it with a socket without creating a new * connection. This constructor is used for this purpose. */ - TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, char* ip, Module* HookMod = NULL); + TreeSocket(SpanningTreeUtilities* Util, int newfd, char* ip, Autoconnect* myac, Module* HookMod = NULL); /** Get link state */ @@ -135,10 +136,6 @@ class TreeSocket : public BufferedSocket */ void CleanNegotiationInfo(); - /** Return the module which we are hooking to for I/O encapsulation - */ - Module* GetHook(); - /** Destructor */ ~TreeSocket(); @@ -158,7 +155,7 @@ class TreeSocket : public BufferedSocket * to server docs on the inspircd.org site, the other side * will then send back its own server string. */ - virtual bool OnConnected(); + virtual void OnConnected(); /** Handle socket error event */ @@ -169,10 +166,6 @@ class TreeSocket : public BufferedSocket */ void SendError(const std::string &errormessage); - /** Handle socket disconnect event - */ - virtual int OnDisconnect(); - /** Recursively send the server tree with distances as hops. * This is used during network burst to inform the other server * (and any of ITS servers too) of what servers we know about. @@ -184,13 +177,17 @@ class TreeSocket : public BufferedSocket */ void SendServers(TreeServer* Current, TreeServer* s, int hops); - /** Returns my capabilities as a string + /** Returns module list as a string, filtered by filter + * @param filter a module version bitmask, such as VF_COMMON or VF_OPTCOMMON */ - std::string MyCapabilities(); + std::string MyModules(int filter); /** Send my capabilities to the remote side */ - void SendCapabilities(); + void SendCapabilities(int phase); + + /** Add modules to VF_COMMON list for backwards compatability */ + void CompatAddModules(std::vector& modlist); /* Check a comma seperated list for an item */ bool HasItem(const std::string &list, const std::string &item); @@ -252,14 +249,9 @@ class TreeSocket : public BufferedSocket void DoBurst(TreeServer* s); /** This function is called when we receive data from a remote - * server. We buffer the data in a std::string (it doesnt stay - * there for long), reading using BufferedSocket::Read() which can - * read up to 16 kilobytes in one operation. - * - * IF THIS FUNCTION RETURNS FALSE, THE CORE CLOSES AND DELETES - * THE SOCKET OBJECT FOR US. + * server. */ - virtual bool OnDataReady(); + void OnDataReady(); /** Send one or more complete lines down the socket */ @@ -284,9 +276,15 @@ class TreeSocket : public BufferedSocket */ bool OperType(const std::string &prefix, parameterlist ¶ms); + /** Remote AWAY */ + bool Away(const std::string &prefix, parameterlist ¶ms); + /** Because Andy insists that services-compatible servers must * implement SVSNICK and SVSJOIN, that's exactly what we do :p */ + bool SVSNick(const std::string &prefix, parameterlist ¶ms); + + /** SAVE to resolve nick collisions without killing */ bool ForceNick(const std::string &prefix, parameterlist ¶ms); /** PRIVMSG or NOTICE with server origin ONLY @@ -341,6 +339,9 @@ class TreeSocket : public BufferedSocket */ bool ChangeName(const std::string &prefix, parameterlist ¶ms); + /** FIDENT */ + bool ChangeIdent(const std::string &prefix, parameterlist ¶ms); + /** WHOIS */ bool Whois(const std::string &prefix, parameterlist ¶ms); @@ -389,10 +390,9 @@ class TreeSocket : public BufferedSocket /** Handle socket timeout from connect() */ virtual void OnTimeout(); - - /** Handle socket close event + /** Handle server quit on close */ - virtual void OnClose(); + virtual void Close(); }; /* Used to validate the value lengths of multiple parameters for a command */