5 #include "inspircd_config.h"
9 #include <sys/socket.h>
10 #include <sys/types.h>
12 #include <netinet/in.h>
18 #ifndef __CONNECTION_H__
19 #define __CONNECTION_H__
23 #define PT_SYN_WITH_DATA 2
24 #define PT_KEY_EXCHANGE 3
27 class packet : public classbase
39 class packet_buf : public classbase
49 class connection : public classbase
53 int fd; // file descriptor
54 char host[256]; // hostname
55 long ip; // ipv4 address
56 char inbuf[MAXBUF]; // recvQ
69 char internal_addr[1024];
71 std::vector<packet_buf> buffer;
74 bool CreateListener(char* host, int p);
75 bool BeginLink(char* targethost, int port, char* password);
76 void TerminateLink(char* targethost);
77 bool SendPacket(char *message, char* host, int port, long ourkey);
78 bool RecvPacket(char *message, char* host, int &prt, long &theirkey);
79 bool SendSYN(char* host, int port);
80 bool SendACK(char* host, int port, int reply_id);