5 #include "inspircd_config.h"
9 #include <sys/socket.h>
10 #include <sys/types.h>
12 #include <netinet/in.h>
17 #ifndef __CONNECTION_H__
18 #define __CONNECTION_H__
22 #define PT_SYN_WITH_DATA 2
23 #define PT_KEY_EXCHANGE 3
26 class packet : public classbase
39 class connection : public classbase
43 int fd; // file descriptor
44 char host[256]; // hostname
45 long ip; // ipv4 address
46 char inbuf[MAXBUF]; // recvQ
58 char internal_addr[1024];
61 bool CreateListener(char* host, int p);
62 bool BeginLink(char* targethost, int port, char* password);
63 void TerminateLink(char* targethost);
64 bool SendPacket(char *message, char* host, int port, long ourkey);
65 bool RecvPacket(char *message, char* host, int &prt, long &theirkey);
66 bool SendSYN(char* host, int port);
67 bool SendACK(char* host, int port, int reply_id);