#ifndef __ST__UTIL__
#define __ST__UTIL__
-#include "configreader.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
#include "inspircd.h"
/* Foward declarations */
/* This hash_map holds the hash equivalent of the server
* tree, used for rapid linear lookups.
*/
+#ifdef WINDOWS
+typedef nspace::hash_map<std::string, TreeServer*, nspace::hash_compare<string, less<string> > > server_hash;
+#else
typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<string>, irc::StrHashComp> server_hash;
+#endif
typedef std::map<TreeServer*,TreeServer*> TreeServerList;
/** Socket bindings for listening sockets
*/
std::vector<TreeSocket*> Bindings;
+ /* Number of seconds that a server can go without ping
+ * before opers are warned of high latency.
+ */
+ int PingWarnTime;
/** This variable represents the root of the server tree
*/
TreeServer *TreeRoot;
/** Hash of currently connected servers by name
*/
server_hash serverlist;
+ /** Hash of currently known server ids
+ */
+ server_hash sidlist;
/** Hash of servers currently bursting but not initialized as connected
*/
std::map<irc::string,TreeSocket*> burstingserverlist;
*/
bool ChallengeResponse;
+ /** Ping frequency of server to server links
+ */
+ int PingFreq;
+
/** Initialise utility class
*/
SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningTree* Creator);
void AddThisServer(TreeServer* server, TreeServerList &list);
/** Compile a list of servers which contain members of channel c
*/
- void GetListOfServersForChannel(chanrec* c, TreeServerList &list, char status, const CUList &exempt_list);
+ void GetListOfServersForChannel(Channel* c, TreeServerList &list, char status, const CUList &exempt_list);
/** Find a server by name
*/
TreeServer* FindServer(const std::string &ServerName);
+ /** Find server by SID
+ */
+ TreeServer* FindServerID(const std::string &id);
/** Find a remote bursting server by name
*/
TreeServer* FindRemoteBurstServer(TreeServer* Server);
void AddBurstingServer(const std::string &ServerName, TreeSocket* s);
void DelBurstingServer(TreeSocket* s);
+
+ /** Return true if str looks like a server ID
+ * @param string to check against
+ */
+ bool IsSID(const std::string &str);
};
#endif