1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "inspircd_config.h"
18 #include "connection.h"
26 #define LINK_INACTIVE 0
28 /** A class that defines the local server or a remote server
30 class serverrec : public connection
37 /** last ping response (ms)
40 /** invisible users on server
43 /** non-invisible users on server
49 /** number of hops away (for quick access)
55 /** is a JUPE server (faked to enforce a server ban)
59 /** Description of the server
61 char description[MAXBUF];
63 /** Holds nickserv's name on U:lined (services) servers (this is a kludge for ircservices which ASSUMES things :/)
65 char nickserv[NICKMAX];
72 /** Constructor which initialises some of the main variables
74 serverrec(char* n, long ver, bool jupe);
79 /** With a serverrec, this is a list of all established server connections.
81 std::vector<ircd_connector> connectors;
84 /** Create a listening socket on 'host' using port number 'p'
86 bool CreateListener(char* host, int p);
88 /** Begin an outbound link to another ircd at targethost.
90 bool BeginLink(char* targethost, int port, char* password, char* servername, int myport);
92 /** Begin an outbound mesh link to another ircd on a network you are already an authenticated member of
94 bool MeshCookie(char* targethost, int port, unsigned long cookie, char* servername);
96 /** Terminate a link to 'targethost' by calling the ircd_connector::CloseConnection method.
98 void TerminateLink(char* targethost);
100 /** Send a message to a server by name, if the server is unavailable directly route the packet via another server
101 * If the server still cannot be reached after attempting to route the message remotely, returns false.
103 bool SendPacket(char *message, const char* host);
105 /** Returns the next available packet and returns true if data is available. Writes the servername the data came from to 'host'.
106 * If no data is available this function returns false.
107 * This function will automatically close broken links and reroute pathways, generating split messages on the network.
109 bool RecvPacket(std::deque<std::string> &messages, char* host, std::deque<std::string> &sums);
111 /** Find the ircd_connector oject related to a certain servername given in 'host'
113 ircd_connector* FindHost(std::string host);
115 /** Add an incoming connection to the connection pool.
116 * (reserved for core use)
118 bool AddIncoming(int fd,char* targethost, int sourceport);