]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket.h
This will royally fuck 1.2's linking right now, but..
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket.h
index 5a5ec52f874a3676e36205df2a2061db91c28fe6..55a83f3efa950b2a047303fa7792c9614773f2d6 100644 (file)
@@ -1,3 +1,16 @@
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
 #ifndef __TREESOCKET_H__
 #define __TREESOCKET_H__
 
@@ -79,7 +92,10 @@ class TreeSocket : public InspSocket
        std::string ModuleList;                 /* Module list of other server from CAPAB */
        std::map<std::string,std::string> 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 */
  public:
 
        /** Because most of the I/O gubbins are encapsulated within
@@ -106,6 +122,26 @@ class TreeSocket : public InspSocket
         */
        ServerState GetLinkState();
 
+       /** Get challenge set in our CAPAB for challenge/response
+        */
+       const std::string& GetOurChallenge();
+
+       /** Get challenge set in our CAPAB for challenge/response
+        */
+       void SetOurChallenge(const std::string &c);
+
+       /** Get challenge set in their CAPAB for challenge/response
+        */
+       const std::string& GetTheirChallenge();
+
+       /** Get challenge set in their CAPAB for challenge/response
+        */
+       void SetTheirChallenge(const std::string &c);
+
+       /** Compare two passwords based on authentication scheme
+        */
+       bool ComparePass(const std::string &ours, const std::string &theirs);
+
        /** Return the module which we are hooking to for I/O encapsulation
         */
        Module* GetHook();
@@ -114,6 +150,15 @@ class TreeSocket : public InspSocket
         */
        ~TreeSocket();
 
+       /** Generate random string used for challenge-response auth
+        */
+       std::string RandString(unsigned int length);
+
+       /** Construct a password, optionally hashed with the other side's
+        * challenge string
+        */
+       std::string MakePass(const std::string &password, const std::string &challenge);
+
        /** When an outbound connection finishes connecting, we receive
         * this event, and must send our SERVER string to the other
         * side. If the other side is happy, as outlined in the server
@@ -126,6 +171,11 @@ class TreeSocket : public InspSocket
         */
        virtual void OnError(InspSocketError e);
 
+       /** Sends an error to the remote server, and displays it locally to show
+        * that it was sent.
+        */
+       void SendError(const std::string &errormessage);
+
        /** Handle socket disconnect event
         */
        virtual int OnDisconnect();
@@ -180,8 +230,8 @@ class TreeSocket : public InspSocket
        /** FJOIN, similar to TS6 SJOIN, but not quite. */
        bool ForceJoin(const std::string &source, std::deque<std::string> &params);
 
-       /** NICK command */
-       bool IntroduceClient(const std::string &source, std::deque<std::string> &params);
+       /** UID command */
+       bool ParseUID(const std::string &source, std::deque<std::string> &params);
 
        /** Send one or more FJOINs for a channel of users.
         * If the length of a single line is more than 480-NICKMAX
@@ -228,6 +278,9 @@ class TreeSocket : public InspSocket
        /** remote ADMIN. leet, huh? */
        bool Admin(const std::string &prefix, std::deque<std::string> &params);
 
+       /** Remote MODULES */
+       bool Modules(const std::string &prefix, std::deque<std::string> &params);
+
        bool Stats(const std::string &prefix, std::deque<std::string> &params);
 
        /** Because the core won't let users or even SERVERS set +o,
@@ -242,12 +295,6 @@ class TreeSocket : public InspSocket
 
        bool OperQuit(const std::string &prefix, std::deque<std::string> &params);
 
-       /** Remote SQUIT (RSQUIT). Routing works similar to SVSNICK: Route it to the server that the target is connected to locally,
-        * then let that server do the dirty work (squit it!). Example:
-        * A -> B -> C -> D: oper on A squits D, A routes to B, B routes to C, C notices D connected locally, kills it. -- w00t
-        */
-       bool RemoteSquit(const std::string &prefix, std::deque<std::string> &params);
-
        /** SVSJOIN
         */
        bool ServiceJoin(const std::string &prefix, std::deque<std::string> &params);
@@ -346,5 +393,21 @@ class TreeSocket : public InspSocket
        virtual int OnIncomingConnection(int newsock, char* ip);
 };
 
+/* Used to validate the value lengths of multiple parameters for a command */
+struct cmd_validation
+{
+       const char* item;
+       size_t param;
+       size_t length;
+};
+
+/* Used to validate the length values in CAPAB CAPABILITIES */
+struct cap_validation
+{
+       const char* reason;
+       const char* key;
+       size_t size;
+};
+
 #endif