diff options
Diffstat (limited to 'include/connection.h')
-rw-r--r-- | include/connection.h | 46 |
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(); }; |