]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treeserver.h
Merge pull request #708 from SaberUK/master+development-branch
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treeserver.h
index faaa47aa100d882caada2501fac152f2431a8387..8178c87faf0c758112593833b125d75017f7c335 100644 (file)
@@ -45,7 +45,7 @@ class TreeServer : public classbase
        std::string ServerName;                 /* Server's name */
        std::string ServerDesc;                 /* Server's description */
        std::string VersionString;              /* Version string or empty string */
-       TreeSocket* Socket;                     /* For directly connected servers this points at the socket object */
+       TreeSocket* Socket;                     /* Socket used to communicate with this server */
        time_t NextPing;                        /* After this time, the server should be PINGed*/
        bool LastPingWasGood;                   /* True if the server responded to the last PING with a PONG */
        std::string sid;                        /* Server ID */
@@ -56,6 +56,7 @@ class TreeServer : public classbase
        void AddHashEntry();
 
  public:
+       typedef std::vector<TreeServer*> ChildServers;
        FakeUser* const ServerUser;             /* User representing this server */
        const time_t age;
 
@@ -85,6 +86,14 @@ class TreeServer : public classbase
         */
        TreeServer* GetRoute();
 
+       /** Returns true if this server is the tree root (i.e.: us)
+        */
+       bool IsRoot() const { return (this->Parent == NULL); }
+
+       /** Returns true if this server is locally connected
+        */
+       bool IsLocal() const { return (this->Route == this); }
+
        /** Get server name
         */
        const std::string& GetName() const { return ServerName; }
@@ -143,13 +152,9 @@ class TreeServer : public classbase
         */
        void SetVersion(const std::string &Version);
 
-       /** Return number of child servers
-        */
-       unsigned int ChildCount();
-
-       /** Return a child server indexed 0..n
+       /** Return all child servers
         */
-       TreeServer* GetChild(unsigned int n);
+       const ChildServers& GetChildren() const { return Children; }
 
        /** Add a child server
         */