|
|||
|
|||
|
#include <treeserver.h>
Inheritance diagram for TreeServer:


Public Member Functions | |
| TreeServer (SpanningTreeUtilities *Util, InspIRCd *Instance, const std::string &id) | |
| We don't use this constructor. | |
| TreeServer (SpanningTreeUtilities *Util, InspIRCd *Instance, std::string Name, std::string Desc, const std::string &id) | |
| We use this constructor only to create the 'root' item, Utils->TreeRoot, which represents our own server. | |
| TreeServer (SpanningTreeUtilities *Util, InspIRCd *Instance, std::string Name, std::string Desc, const std::string &id, TreeServer *Above, TreeSocket *Sock, bool Hide) | |
| When we create a new server, we call this constructor to initialize it. | |
| int | QuitUsers (const std::string &reason) |
| void | AddHashEntry () |
| This method is used to add the structure to the hash_map for linear searches. | |
| void | DelHashEntry () |
| This method removes the reference to this object from the hash_map which is used for linear searches. | |
| TreeServer * | GetRoute () |
| Get route. | |
| std::string | GetName () |
| Get server name. | |
| std::string | GetDesc () |
| Get server description (GECOS). | |
| std::string | GetVersion () |
| Get server version string. | |
| void | SetNextPingTime (time_t t) |
| Set time we are next due to ping this server. | |
| time_t | NextPingTime () |
| Get the time we are next due to ping this server. | |
| bool | AnsweredLastPing () |
| True if the server answered their last ping. | |
| void | SetPingFlag () |
| Set the server as responding to its last ping. | |
| unsigned int | GetUserCount () |
| Get the number of users on this server. | |
| void | SetUserCount (int diff) |
| Increment or decrement the user count by diff. | |
| unsigned int | GetOperCount () |
| Gets the numbers of opers on this server. | |
| void | SetOperCount (int diff) |
| Increment or decrement the oper count by diff. | |
| TreeSocket * | GetSocket () |
| Get the TreeSocket pointer for local servers. | |
| TreeServer * | GetParent () |
| Get the parent server. | |
| void | SetVersion (const std::string &Version) |
| Set the server version string. | |
| unsigned int | ChildCount () |
| Return number of child servers. | |
| TreeServer * | GetChild (unsigned int n) |
| Return a child server indexed 0. | |
| void | AddChild (TreeServer *Child) |
| Add a child server. | |
| bool | DelChild (TreeServer *Child) |
| Delete a child server, return false if it didn't exist. | |
| bool | Tidy () |
| Removes child nodes of this node, and of that node, etc etc. | |
| std::string & | GetID () |
| Get server ID. | |
| bool | DuplicateID () |
| True on duplicate server ID (server not usable). | |
| void | FinishBurst () |
| Marks a server as having finished bursting and performs appropriate actions. | |
| ~TreeServer () | |
| Destructor. | |
Public Attributes | |
| bool | Warned |
| bool | bursting |
| unsigned long | LastPingMsec |
| Last ping time in microseconds, used to calculate round trip time. | |
| unsigned long | rtt |
| Round trip time of last ping. | |
| unsigned long | StartBurst |
| When we recieved BURST from this server, used to calculate total burst time at ENDBURST. | |
| bool | Hidden |
| True if this server is hidden. | |
Private Member Functions | |
| void | SetID (const std::string &id) |
| Set server ID. | |
Private Attributes | |
| InspIRCd * | ServerInstance |
| TreeServer * | Parent |
| TreeServer * | Route |
| std::vector< TreeServer * > | Children |
| irc::string | ServerName |
| std::string | ServerDesc |
| std::string | VersionString |
| unsigned int | ServerUserCount |
| unsigned int | ServerOperCount |
| TreeSocket * | Socket |
| time_t | NextPing |
| bool | LastPingWasGood |
| SpanningTreeUtilities * | Utils |
| std::string | sid |
| bool | DupError |
A locally connected TreeServer can have a class of type TreeSocket associated with it, for remote servers, the TreeSocket entry will be NULL. Each server also maintains a pointer to its parent (NULL if this server is ours, at the top of the tree) and a pointer to its "Route" (see the comments in the constructors below), and also a dynamic list of pointers to its children which can be iterated recursively if required. Creating or deleting objects of type i* TreeServer automatically maintains the hash_map of TreeServer items, deleting and inserting them as they are created and destroyed.
Definition at line 31 of file treeserver.h.
|
||||||||||||||||
|
We don't use this constructor. Its a dummy, and won't cause any insertion of the TreeServer into the hash_map. See below for the two we DO use. Definition at line 26 of file treeserver.cpp. References bursting, DupError, InspIRCd::GetVersionString(), Hidden, Parent, rtt, ServerDesc, ServerInstance, ServerName, ServerOperCount, ServerUserCount, SetID(), StartBurst, VersionString, and Warned. |
|
||||||||||||||||||||||||
|
We use this constructor only to create the 'root' item, Utils->TreeRoot, which represents our own server. Therefore, it has no route, no parent, and no socket associated with it. Its version string is our own local version. Definition at line 44 of file treeserver.cpp. References AddHashEntry(), bursting, DupError, InspIRCd::GetVersionString(), Hidden, Parent, Route, rtt, ServerInstance, ServerOperCount, ServerUserCount, SetID(), Socket, StartBurst, VersionString, and Warned. |
|
||||||||||||||||||||||||||||||||||||
|
When we create a new server, we call this constructor to initialize it. This constructor initializes the server's Route and Parent, and sets up its ping counters so that it will be pinged one minute from now. Definition at line 64 of file treeserver.cpp. References AddHashEntry(), bursting, DEBUG, DupError, GetParent(), LogManager::Log(), InspIRCd::Logs, SpanningTreeUtilities::PingFreq, Route, rtt, ServerInstance, ServerOperCount, ServerUserCount, SetID(), SetNextPingTime(), SetPingFlag(), StartBurst, InspIRCd::Time(), SpanningTreeUtilities::TreeRoot, Utils, VersionString, and Warned. |
|
|
Destructor.
Definition at line 363 of file treeserver.cpp. References DelHashEntry(), GetID(), SpanningTreeUtilities::sidlist, and Utils. |
|
|
Add a child server.
Definition at line 322 of file treeserver.cpp. References Children. Referenced by TreeSocket::Outbound_Reply_Server(), TreeSocket::ProcessLine(), and TreeSocket::RemoteServer(). |
|
|
This method is used to add the structure to the hash_map for linear searches. It is only called by the constructors. Definition at line 203 of file treeserver.cpp. References SpanningTreeUtilities::serverlist, ServerName, and Utils. Referenced by TreeServer(). |
|
|
True if the server answered their last ping.
Definition at line 255 of file treeserver.cpp. References LastPingWasGood. Referenced by ModuleSpanningTree::DoPingChecks(). |
|
|
Return number of child servers.
Definition at line 300 of file treeserver.cpp. References Children. Referenced by ModuleSpanningTree::CountLocalServs(), SpanningTreeUtilities::DoOneToAllButSender(), SpanningTreeUtilities::DoOneToAllButSenderRaw(), SpanningTreeUtilities::DoOneToMany(), and SpanningTreeUtilities::~SpanningTreeUtilities(). |
|
|
Delete a child server, return false if it didn't exist.
Definition at line 327 of file treeserver.cpp. References Children. Referenced by TreeSocket::Squit(). |
|
|
This method removes the reference to this object from the hash_map which is used for linear searches. It is only called by the default destructor. Definition at line 214 of file treeserver.cpp. References SpanningTreeUtilities::serverlist, and Utils. Referenced by ~TreeServer(). |
|
|
True on duplicate server ID (server not usable).
Definition at line 166 of file treeserver.cpp. References DupError. Referenced by TreeSocket::Outbound_Reply_Server(), TreeSocket::ProcessLine(), and TreeSocket::RemoteServer(). |
|
|
Marks a server as having finished bursting and performs appropriate actions.
Definition at line 142 of file treeserver.cpp. References XLineManager::ApplyLines(), bursting, SpanningTreeUtilities::Creator, Event::Send(), ServerInstance, ServerName, InspIRCd::SNO, StartBurst, Utils, SnomaskManager::WriteToSnoMask(), and InspIRCd::XLines. Referenced by TreeSocket::ProcessLine(). |
|
|
Return a child server indexed 0. .n Definition at line 305 of file treeserver.cpp. References Children. Referenced by SpanningTreeUtilities::DoOneToAllButSender(), SpanningTreeUtilities::DoOneToAllButSenderRaw(), SpanningTreeUtilities::DoOneToMany(), TreeSocket::SendServers(), ModuleSpanningTree::ShowLinks(), ModuleSpanningTree::ShowMap(), TreeSocket::SquitServer(), and SpanningTreeUtilities::~SpanningTreeUtilities(). |
|
|
Get server description (GECOS).
Definition at line 234 of file treeserver.cpp. References ServerDesc. Referenced by ModuleSpanningTree::OnGetServerDescription(), TreeSocket::SendServers(), and ModuleSpanningTree::ShowLinks(). |
|
|
Get server ID.
Definition at line 137 of file treeserver.cpp. References sid. Referenced by ModuleSpanningTree::DoPingChecks(), TreeSocket::Inbound_Server(), TreeSocket::ProcessLine(), TreeSocket::SendServers(), TreeSocket::SendUsers(), ModuleSpanningTree::ShowMap(), and ~TreeServer(). |
|
|
|
Gets the numbers of opers on this server.
Definition at line 280 of file treeserver.cpp. References ServerOperCount. |
|
|
Get the parent server. For the root node, this returns NULL. Definition at line 290 of file treeserver.cpp. References Parent. Referenced by cmd_rsquit::Handle(), ModuleSpanningTree::HandleConnect(), TreeSocket::Inbound_Server(), TreeSocket::Outbound_Reply_Server(), ModuleSpanningTree::ShowLinks(), TreeSocket::Squit(), and TreeServer(). |
|
|
Get route. The 'route' is defined as the locally- connected server which can be used to reach this server. Definition at line 224 of file treeserver.cpp. References Route. Referenced by SpanningTreeUtilities::BestRouteTo(). |
|
|
Get the TreeSocket pointer for local servers. For remote servers, this returns NULL. Definition at line 285 of file treeserver.cpp. References Socket. Referenced by SpanningTreeUtilities::DoOneToAllButSender(), SpanningTreeUtilities::DoOneToAllButSenderRaw(), SpanningTreeUtilities::DoOneToMany(), SpanningTreeUtilities::DoOneToOne(), ModuleSpanningTree::DoPingChecks(), TreeSocket::ForceJoin(), cmd_rsquit::Handle(), ModuleSpanningTree::HandleSquit(), TreeSocket::ProcessLine(), SpanningTreeProtocolInterface::SendUserNotice(), SpanningTreeProtocolInterface::SendUserPrivmsg(), and SpanningTreeUtilities::~SpanningTreeUtilities(). |
|
|
Get the number of users on this server.
Definition at line 265 of file treeserver.cpp. References ServerUserCount. Referenced by ModuleSpanningTree::ShowMap(). |
|
|
Get server version string.
Definition at line 239 of file treeserver.cpp. References VersionString. Referenced by ModuleSpanningTree::HandleVersion(), and TreeSocket::SendServers(). |
|
|
Get the time we are next due to ping this server.
Definition at line 250 of file treeserver.cpp. References NextPing. Referenced by ModuleSpanningTree::DoPingChecks(). |
|
|
Definition at line 171 of file treeserver.cpp. References UserManager::clientlist, InspIRCd::Config, InspIRCd::GlobalCulls, ServerConfig::HideSplits, IS_LOCAL, CullList::MakeSilent(), UserManager::QuitUser(), ServerInstance, and InspIRCd::Users. Referenced by TreeSocket::SquitServer(). |
|
|
Set server ID.
Definition at line 155 of file treeserver.cpp. References DEBUG, DupError, LogManager::Log(), InspIRCd::Logs, ServerInstance, sid, SpanningTreeUtilities::sidlist, and Utils. Referenced by TreeServer(). |
|
|
Set time we are next due to ping this server.
Definition at line 244 of file treeserver.cpp. References LastPingWasGood, and NextPing. Referenced by ModuleSpanningTree::DoPingChecks(), TreeSocket::ProcessLine(), and TreeServer(). |
|
|
Increment or decrement the oper count by diff.
Definition at line 275 of file treeserver.cpp. References ServerOperCount. |
|
|
Set the server as responding to its last ping.
Definition at line 260 of file treeserver.cpp. References LastPingWasGood. Referenced by TreeSocket::LocalPong(), TreeSocket::ProcessLine(), and TreeServer(). |
|
|
Increment or decrement the user count by diff.
Definition at line 270 of file treeserver.cpp. References ServerUserCount. Referenced by SpanningTreeProtocolInterface::Introduce(), and ModuleSpanningTree::OnUserQuit(). |
|
|
Set the server version string.
Definition at line 295 of file treeserver.cpp. References VersionString. Referenced by TreeSocket::ServerVersion(). |
|
|
Removes child nodes of this node, and of that node, etc etc. This is used during netsplits to automatically tidy up the server tree. It is slow, we don't use it for much else. Definition at line 344 of file treeserver.cpp. References Children, and Tidy(). Referenced by TreeSocket::Squit(), and Tidy(). |
|
|
Definition at line 58 of file treeserver.h. Referenced by TreeSocket::AddLine(), FinishBurst(), TreeSocket::OperType(), TreeSocket::Outbound_Reply_Server(), TreeSocket::ParseUID(), TreeSocket::ProcessLine(), and TreeServer(). |
|
|
Definition at line 36 of file treeserver.h. Referenced by AddChild(), ChildCount(), DelChild(), GetChild(), and Tidy(). |
|
|
Definition at line 47 of file treeserver.h. Referenced by DuplicateID(), SetID(), and TreeServer(). |
|
|
True if this server is hidden.
Definition at line 131 of file treeserver.h. Referenced by TreeSocket::Outbound_Reply_Server(), ModuleSpanningTree::ShowLinks(), ModuleSpanningTree::ShowMap(), and TreeServer(). |
|
|
Last ping time in microseconds, used to calculate round trip time.
Definition at line 119 of file treeserver.h. Referenced by ModuleSpanningTree::DoPingChecks(), and TreeSocket::LocalPong(). |
|
|
Definition at line 44 of file treeserver.h. Referenced by AnsweredLastPing(), SetNextPingTime(), and SetPingFlag(). |
|
|
Definition at line 43 of file treeserver.h. Referenced by NextPingTime(), and SetNextPingTime(). |
|
|
Definition at line 34 of file treeserver.h. Referenced by GetParent(), and TreeServer(). |
|
|
Definition at line 35 of file treeserver.h. Referenced by GetRoute(), and TreeServer(). |
|
|
Round trip time of last ping.
Definition at line 123 of file treeserver.h. Referenced by TreeSocket::LocalPong(), ModuleSpanningTree::MapOperInfo(), and TreeServer(). |
|
|
Definition at line 38 of file treeserver.h. Referenced by GetDesc(), and TreeServer(). |
|
|
Definition at line 33 of file treeserver.h. Referenced by FinishBurst(), QuitUsers(), SetID(), and TreeServer(). |
|
|
Definition at line 37 of file treeserver.h. Referenced by AddHashEntry(), FinishBurst(), GetName(), and TreeServer(). |
|
|
Definition at line 41 of file treeserver.h. Referenced by GetOperCount(), SetOperCount(), and TreeServer(). |
|
|
Definition at line 40 of file treeserver.h. Referenced by GetUserCount(), SetUserCount(), and TreeServer(). |
|
|
Definition at line 46 of file treeserver.h. |
|
|
Definition at line 42 of file treeserver.h. Referenced by GetSocket(), and TreeServer(). |
|
|
When we recieved BURST from this server, used to calculate total burst time at ENDBURST.
Definition at line 127 of file treeserver.h. Referenced by FinishBurst(), and TreeServer(). |
|
|
Definition at line 45 of file treeserver.h. Referenced by AddHashEntry(), DelHashEntry(), FinishBurst(), SetID(), TreeServer(), and ~TreeServer(). |
|
|
Definition at line 39 of file treeserver.h. Referenced by GetVersion(), SetVersion(), and TreeServer(). |
|
|
Definition at line 57 of file treeserver.h. Referenced by ModuleSpanningTree::DoPingChecks(), and TreeServer(). |