summaryrefslogtreecommitdiff
path: root/include/connection.h
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/connection.h
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/connection.h')
-rw-r--r--include/connection.h46
1 files changed, 41 insertions, 5 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();
};