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 */
void AddHashEntry();
public:
+ typedef std::vector<TreeServer*> ChildServers;
FakeUser* const ServerUser; /* User representing this server */
const time_t age;
*/
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; }
*/
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
*/