summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2003-02-02 16:43:53 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2003-02-02 16:43:53 +0000
commit8cc90ca14d84ef8ec83989de45854a2c7855ee4f (patch)
tree771a440c41b57f043119decee41e4fcaac3ba12a /include
parent6e442fdbe3e2bebea9049399163698f4a892f685 (diff)
Added first part of server linking code
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@160 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/connection.h46
-rw-r--r--include/inspircd.h1
-rw-r--r--include/servers.h12
3 files changed, 45 insertions, 14 deletions
diff --git a/include/connection.h b/include/connection.h
index 91eb7f0dc..94b657288 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -2,17 +2,43 @@
*/
-#include "inspircd_config.h"
+#include "inspircd_config.h"
#include "base.h"
#include <string>
#include <map.h>
-
-#ifndef __CONNECTION_H__
-#define __CONNECTION_H__
-
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <errno.h>
+#include <time.h>
+
+#ifndef __CONNECTION_H__
+#define __CONNECTION_H__
+
+#define PT_SYN_ONLY 0
+#define PT_ACK_ONLY 1
+#define PT_SYN_WITH_DATA 2
+
+
+class packet : public classbase
+{
+ public:
+ long key;
+ short int id;
+ short int type;
+ char data[MAXBUF];
+
+ packet();
+ ~packet();
+};
+
+
class connection : public classbase
{
public:
+ long key;
int fd; // file descriptor
char host[256]; // hostname
long ip; // ipv4 address
@@ -28,6 +54,16 @@ class connection : public classbase
time_t signon;
time_t idle_lastmsg;
time_t nping;
+
+ connection();
+ bool CreateListener(char* host, int port);
+ bool BeginLink(char* targethost, int port, char* password);
+ void TerminateLink(char* targethost);
+ bool SendPacket(char *message, char* host, int port);
+ bool RecvPacket(char *message, char* host, int &port);
+ bool SendSYN(char* host, int port);
+ bool SendACK(char* host, int port, int reply_id);
+ long GenKey();
};
diff --git a/include/inspircd.h b/include/inspircd.h
index 100b47334..1e1582723 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -68,6 +68,7 @@ userrec* Find(string nick);
chanrec* FindChan(const char* chan);
char* cmode(userrec *user, chanrec *chan);
string getservername();
+string getserverdesc();
string getnetworkname();
string getadminname();
string getadminemail();
diff --git a/include/servers.h b/include/servers.h
index 876b54566..fc271b37e 100644
--- a/include/servers.h
+++ b/include/servers.h
@@ -17,25 +17,19 @@
class serverrec : public connection
{
private:
- map<string, serverrec*> leaf; // list of child servers (leaves)
public:
char name[MAXBUF]; // server name
- int pingtime; // last ping response (ms)
- int linktype; // link type, LINK_ACTIVE or LINK_INACTIVE
- time_t lastping; // time the link was last pinged
+ long pingtime; // last ping response (ms)
long usercount_i; // invisible users on server
long usercount; // non-invisible users on server
long opercount; // opers on server
- time_t connected_at; // time server was connected into the network
- time_t hops_away; // number of hops away (for quick access)
+ int hops_away; // number of hops away (for quick access)
long version; // ircd version
bool jupiter; // is a JUPE server (faked to enforce a server ban)
serverrec();
- serverrec(char* n, int link_t, long ver, bool jupe);
+ serverrec(char* n, long ver, bool jupe);
~serverrec();
- void AddLeaf(serverrec *child);
- void DelLeaf(string n);
};