|
|||
|
|||
|
#include <treesocket.h>
Inheritance diagram for TreeSocket:


Public Member Functions | |
| TreeSocket (SpanningTreeUtilities *Util, InspIRCd *SI, std::string host, int port, bool listening, unsigned long maxtime, Module *HookMod=NULL) | |
| Because most of the I/O gubbins are encapsulated within BufferedSocket, we just call the superclass constructor for most of the action, and append a few of our own values to it. | |
| TreeSocket (SpanningTreeUtilities *Util, InspIRCd *SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module *HookMod=NULL) | |
| Because most of the I/O gubbins are encapsulated within BufferedSocket, we just call the superclass constructor for most of the action, and append a few of our own values to it. | |
| TreeSocket (SpanningTreeUtilities *Util, InspIRCd *SI, int newfd, char *ip, Module *HookMod=NULL) | |
| When a listening socket gives us a new file descriptor, we must associate it with a socket without creating a new connection. | |
| ServerState | GetLinkState () |
| Get link state. | |
| const std::string & | GetOurChallenge () |
| Get challenge set in our CAPAB for challenge/response. | |
| void | SetOurChallenge (const std::string &c) |
| Get challenge set in our CAPAB for challenge/response. | |
| const std::string & | GetTheirChallenge () |
| Get challenge set in their CAPAB for challenge/response. | |
| void | SetTheirChallenge (const std::string &c) |
| Get challenge set in their CAPAB for challenge/response. | |
| bool | ComparePass (const std::string &ours, const std::string &theirs) |
| Compare two passwords based on authentication scheme. | |
| Module * | GetHook () |
| Return the module which we are hooking to for I/O encapsulation. | |
| ~TreeSocket () | |
| Destructor. | |
| std::string | RandString (unsigned int length) |
| Generate random string used for challenge-response auth. | |
| std::string | MakePass (const std::string &password, const std::string &challenge) |
| Construct a password, optionally hashed with the other side's challenge string. | |
| virtual bool | OnConnected () |
| When an outbound connection finishes connecting, we receive this event, and must send our SERVER string to the other side. | |
| virtual void | OnError (BufferedSocketError e) |
| Handle socket error event. | |
| void | SendError (const std::string &errormessage) |
| Sends an error to the remote server, and displays it locally to show that it was sent. | |
| virtual int | OnDisconnect () |
| Handle socket disconnect event. | |
| void | SendServers (TreeServer *Current, TreeServer *s, int hops) |
| Recursively send the server tree with distances as hops. | |
| std::string | MyCapabilities () |
| Returns my capabilities as a string. | |
| void | SendCapabilities () |
| Send my capabilities to the remote side. | |
| bool | HasItem (const std::string &list, const std::string &item) |
| std::string | ListDifference (const std::string &one, const std::string &two) |
| bool | Capab (const std::deque< std::string > ¶ms) |
| void | SquitServer (std::string &from, TreeServer *Current) |
| This function forces this server to quit, removing this server and any users on it (and servers and users below that, etc etc). | |
| void | Squit (TreeServer *Current, const std::string &reason) |
| This is a wrapper function for SquitServer above, which does some validation first and passes on the SQUIT to all other remaining servers. | |
| bool | ForceMode (const std::string &source, std::deque< std::string > ¶ms) |
| FMODE command - server mode with timestamp checks. | |
| bool | ForceTopic (const std::string &source, std::deque< std::string > ¶ms) |
| FTOPIC command. | |
| bool | ForceJoin (const std::string &source, std::deque< std::string > ¶ms) |
| FJOIN, similar to TS6 SJOIN, but not quite. | |
| int | DoCollision (User *u, time_t remotets, const std::string &remoteident, const std::string &remoteip, const std::string &remoteuid) |
| bool | ParseUID (const std::string &source, std::deque< std::string > ¶ms) |
| UID command. | |
| void | SendFJoins (TreeServer *Current, Channel *c) |
| Send one or more FJOINs for a channel of users. | |
| void | SendXLines (TreeServer *Current) |
| Send G, Q, Z and E lines. | |
| void | SendChannelModes (TreeServer *Current) |
| Send channel modes and topics. | |
| void | SendUsers (TreeServer *Current) |
| send all users and their oper state/modes | |
| void | DoBurst (TreeServer *s) |
| This function is called when we want to send a netburst to a local server. | |
| virtual bool | OnDataReady () |
| This function is called when we receive data from a remote server. | |
| void | WriteLine (std::string line) |
| Send one or more complete lines down the socket. | |
| bool | Error (std::deque< std::string > ¶ms) |
| Handle ERROR command. | |
| bool | Motd (const std::string &prefix, std::deque< std::string > ¶ms) |
| remote MOTD. | |
| bool | Admin (const std::string &prefix, std::deque< std::string > ¶ms) |
| remote ADMIN. | |
| bool | Modules (const std::string &prefix, std::deque< std::string > ¶ms) |
| Remote MODULES. | |
| bool | Stats (const std::string &prefix, std::deque< std::string > ¶ms) |
| bool | OperType (const std::string &prefix, std::deque< std::string > ¶ms) |
| Because the core won't let users or even SERVERS set +o, we use the OPERTYPE command to do this. | |
| bool | ForceNick (const std::string &prefix, std::deque< std::string > ¶ms) |
| Because Andy insists that services-compatible servers must implement SVSNICK and SVSJOIN, that's exactly what we do :p. | |
| bool | ServerMessage (const std::string &messagetype, const std::string &prefix, std::deque< std::string > ¶ms, const std::string &sourceserv) |
| PRIVMSG or NOTICE with server origin ONLY. | |
| bool | Encap (const std::string &prefix, std::deque< std::string > ¶ms) |
| ENCAP command. | |
| bool | OperQuit (const std::string &prefix, std::deque< std::string > ¶ms) |
| OPERQUIT command. | |
| bool | ServiceJoin (const std::string &prefix, std::deque< std::string > ¶ms) |
| SVSJOIN. | |
| bool | ServicePart (const std::string &prefix, std::deque< std::string > ¶ms) |
| SVSPART. | |
| bool | RemoteKill (const std::string &prefix, std::deque< std::string > ¶ms) |
| KILL. | |
| bool | LocalPong (const std::string &prefix, std::deque< std::string > ¶ms) |
| PONG. | |
| bool | MetaData (const std::string &prefix, std::deque< std::string > ¶ms) |
| METADATA. | |
| bool | ServerVersion (const std::string &prefix, std::deque< std::string > ¶ms) |
| VERSION. | |
| bool | ChangeHost (const std::string &prefix, std::deque< std::string > ¶ms) |
| CHGHOST. | |
| bool | AddLine (const std::string &prefix, std::deque< std::string > ¶ms) |
| ADDLINE. | |
| bool | DelLine (const std::string &prefix, std::deque< std::string > ¶ms) |
| DELLINE. | |
| bool | ChangeName (const std::string &prefix, std::deque< std::string > ¶ms) |
| CHGNAME. | |
| bool | Whois (const std::string &prefix, std::deque< std::string > ¶ms) |
| WHOIS. | |
| bool | Push (const std::string &prefix, std::deque< std::string > ¶ms) |
| PUSH. | |
| bool | Time (const std::string &prefix, std::deque< std::string > ¶ms) |
| TIME. | |
| bool | LocalPing (const std::string &prefix, std::deque< std::string > ¶ms) |
| PING. | |
| bool | RemoveStatus (const std::string &prefix, std::deque< std::string > ¶ms) |
| Remove all modes from a channel, including statusmodes (+qaovh etc), simplemodes, parameter modes. | |
| bool | RemoteServer (const std::string &prefix, std::deque< std::string > ¶ms) |
| <- (remote) <- SERVER | |
| bool | Outbound_Reply_Server (std::deque< std::string > ¶ms) |
| (local) -> SERVER | |
| bool | Inbound_Server (std::deque< std::string > ¶ms) |
| (local) <- SERVER | |
| void | Split (const std::string &line, std::deque< std::string > &n) |
| Handle netsplit. | |
| bool | ProcessLine (std::string &line) |
| Process complete line from buffer. | |
| virtual std::string | GetName () |
| Get this server's name. | |
| virtual void | OnTimeout () |
| Handle socket timeout from connect(). | |
| virtual void | OnClose () |
| Handle socket close event. | |
| virtual int | OnIncomingConnection (int newsock, char *ip) |
| Handle incoming connection event. | |
Private Attributes | |
| SpanningTreeUtilities * | Utils |
| std::string | myhost |
| std::string | in_buffer |
| ServerState | LinkState |
| std::string | InboundServerName |
| std::string | InboundDescription |
| std::string | InboundSID |
| int | num_lost_users |
| int | num_lost_servers |
| time_t | NextPing |
| bool | LastPingWasGood |
| unsigned int | keylength |
| std::string | ModuleList |
| std::map< std::string, std::string > | CapKeys |
| Module * | Hook |
| std::string | ourchallenge |
| std::string | theirchallenge |
| std::string | OutboundPass |
| bool | sentcapab |
TreeSockets, being inherited from BufferedSocket, can be tied into the core socket engine, and we cn therefore receive activity events for them, just like activex objects on speed. (yes really, that is a technical term!) Each of these which relates to a locally connected server is assocated with it, by hooking it onto a TreeSocket class using its constructor. In this way, we can maintain a list of servers, some of which are directly connected, some of which are not.
Definition at line 73 of file treesocket.h.
|
||||||||||||||||||||||||||||||||
|
Because most of the I/O gubbins are encapsulated within BufferedSocket, we just call the superclass constructor for most of the action, and append a few of our own values to it.
Definition at line 39 of file treesocket1.cpp. References SpanningTreeUtilities::Creator, Hook, BufferedSocket::host, LinkState, LISTENER, myhost, ourchallenge, theirchallenge, and Utils. Referenced by OnIncomingConnection(). |
|
||||||||||||||||||||||||||||||||||||||||
|
Because most of the I/O gubbins are encapsulated within BufferedSocket, we just call the superclass constructor for most of the action, and append a few of our own values to it.
Definition at line 50 of file treesocket1.cpp. References CONNECTING, SpanningTreeUtilities::Creator, Hook, LinkState, myhost, ourchallenge, theirchallenge, and Utils. |
|
||||||||||||||||||||||||
|
When a listening socket gives us a new file descriptor, we must associate it with a socket without creating a new connection. This constructor is used for this purpose. Definition at line 65 of file treesocket1.cpp. References TimerManager::AddTimer(), SpanningTreeUtilities::Creator, Hook, BufferedSocket::Instance, SpanningTreeUtilities::LinkBlocks, LinkState, ourchallenge, sentcapab, theirchallenge, InspIRCd::Timers, Utils, and WAIT_AUTH_1. |
|
|
Destructor.
Definition at line 91 of file treesocket1.cpp. References SpanningTreeUtilities::Creator, Hook, and Utils. |
|
||||||||||||
|
||||||||||||
|
remote ADMIN. leet, huh? Definition at line 24 of file admin.cpp. References ServerConfig::AdminEmail, ServerConfig::AdminName, ServerConfig::AdminNick, InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), InspIRCd::FindNick(), BufferedSocket::Instance, InspIRCd::Match(), User::nick, User::server, ServerConfig::ServerName, and Utils. Referenced by ProcessLine(). |
|
|
||||||||||||
|
CHGHOST.
Definition at line 24 of file fhost.cpp. References User::ChangeDisplayedHost(), SpanningTreeUtilities::DoOneToAllButSender(), InspIRCd::FindNick(), BufferedSocket::Instance, User::server, and Utils. Referenced by ProcessLine(). |
|
||||||||||||
|
CHGNAME.
Definition at line 24 of file fname.cpp. References User::ChangeName(), SpanningTreeUtilities::DoOneToAllButSender(), InspIRCd::FindNick(), BufferedSocket::Instance, User::server, and Utils. Referenced by ProcessLine(). |
|
||||||||||||
|
Compare two passwords based on authentication scheme.
Definition at line 131 of file hmac.cpp. References SpanningTreeUtilities::ChallengeResponse, ModuleManager::Find(), BufferedSocket::Instance, InspIRCd::Modules, and Utils. Referenced by Inbound_Server(), and Outbound_Reply_Server(). |
|
||||||||||||
|
DELLINE.
Definition at line 24 of file delline.cpp. References XLineManager::DelLine(), SpanningTreeUtilities::DoOneToAllButSender(), InspIRCd::FindNick(), SpanningTreeUtilities::FindServer(), TreeServer::GetName(), BufferedSocket::Instance, User::nick, InspIRCd::SNO, Utils, SnomaskManager::WriteToSnoMask(), and InspIRCd::XLines. Referenced by ProcessLine(). |
|
|
This function is called when we want to send a netburst to a local server. There is a set order we must do this, because for example users require their servers to exist, and channels require their users to exist. You get the idea. Definition at line 29 of file netburst.cpp. References InspIRCd::Config, ConvToStr(), SpanningTreeUtilities::Creator, FOREACH_MOD_I, TreeServer::GetName(), ServerConfig::GetSID(), GetTheirChallenge(), InspIRCd::GetVersionString(), I_OnSyncOtherMetaData, BufferedSocket::Instance, SendChannelModes(), SendServers(), SendUsers(), SendXLines(), InspIRCd::SNO, InspIRCd::Time(), SpanningTreeUtilities::TreeRoot, Utils, WriteLine(), and SnomaskManager::WriteToSnoMask(). Referenced by Outbound_Reply_Server(), and ProcessLine(). |
|
||||||||||||||||||||||||
|
Definition at line 30 of file nickcollide.cpp. References ConvToStr(), InspIRCd::FindUUID(), User::ForceNickChange(), BufferedSocket::Instance, localident, localip, localts, User::uuid, and WriteLine(). Referenced by ParseUID(), and ProcessLine(). |
|
||||||||||||
|
ENCAP command. leet, huh? Definition at line 26 of file encap.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToAllButSender(), SpanningTreeUtilities::DoOneToOne(), ServerConfig::GetSID(), BufferedSocket::Instance, InspIRCd::Match(), Event::Send(), and Utils. Referenced by ProcessLine(). |
|
|
Handle ERROR command.
Definition at line 41 of file treesocket2.cpp. References InboundServerName, BufferedSocket::Instance, myhost, InspIRCd::SNO, and SnomaskManager::WriteToSnoMask(). Referenced by ProcessLine(). |
|
||||||||||||
|
||||||||||||
|
FMODE command - server mode with timestamp checks.
Definition at line 25 of file fmode.cpp. References classbase::age, InspIRCd::CallCommandHandler(), DEFAULT, SpanningTreeUtilities::DoOneToAllButSender(), InspIRCd::FakeClient, InspIRCd::FindChan(), InspIRCd::FindNick(), BufferedSocket::Instance, LogManager::Log(), InspIRCd::Logs, InspIRCd::SendMode(), User::server, InspIRCd::SNO, Utils, and SnomaskManager::WriteToSnoMask(). Referenced by ProcessLine(). |
|
||||||||||||
|
Because Andy insists that services-compatible servers must implement SVSNICK and SVSJOIN, that's exactly what we do :p.
Definition at line 32 of file svsnick.cpp. References classbase::age, SpanningTreeUtilities::DoOneToAllButSender(), InspIRCd::FindNick(), User::ForceNickChange(), BufferedSocket::Instance, IS_LOCAL, UserManager::QuitUser(), InspIRCd::Users, Utils, and User::uuid. Referenced by ProcessLine(). |
|
||||||||||||
|
FTOPIC command.
Definition at line 25 of file ftopic.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToAllButSender(), InspIRCd::FindChan(), InspIRCd::FindNick(), BufferedSocket::Instance, ServerConfig::Limits, ServerLimits::MaxTopic, Channel::name, ServerConfig::ServerName, Channel::setby, Channel::topic, Channel::topicset, Utils, Channel::WriteChannel(), and Channel::WriteChannelWithServ(). Referenced by ProcessLine(). |
|
|
Return the module which we are hooking to for I/O encapsulation.
Definition at line 86 of file treesocket1.cpp. References Hook. Referenced by HandshakeTimer::Tick(). |
|
|
Get link state.
Definition at line 81 of file treesocket1.cpp. References LinkState. |
|
|
Get this server's name.
Definition at line 628 of file treesocket2.cpp. References InboundServerName, and myhost. Referenced by ProcessLine(). |
|
|
Get challenge set in our CAPAB for challenge/response.
Definition at line 33 of file hmac.cpp. References ourchallenge. Referenced by SendCapabilities(). |
|
|
Get challenge set in their CAPAB for challenge/response.
Definition at line 43 of file hmac.cpp. References theirchallenge. Referenced by DoBurst(), Inbound_Server(), and Outbound_Reply_Server(). |
|
||||||||||||
|
Definition at line 105 of file capab.cpp. References irc::sepstream::GetToken(). Referenced by ListDifference(). |
|
|
||||||||||||
|
Definition at line 119 of file capab.cpp. References irc::sepstream::GetToken(), and HasItem(). Referenced by Capab(). |
|
||||||||||||
|
PING.
Definition at line 29 of file ping.cpp. References SpanningTreeUtilities::DoOneToOne(), Utils, and WriteLine(). Referenced by ProcessLine(). |
|
||||||||||||
|
PONG.
Definition at line 29 of file pong.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), InspIRCd::FindNick(), SpanningTreeUtilities::FindServer(), ServerConfig::GetSID(), BufferedSocket::Instance, TreeServer::LastPingMsec, TreeServer::rtt, ServerConfig::ServerName, TreeServer::SetPingFlag(), Utils, and User::WriteServ(). Referenced by ProcessLine(). |
|