Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

connection.h

Go to the documentation of this file.
00001 /*
00002 
00003 */
00004 
00005 #include "inspircd_config.h"
00006 #include "base.h"
00007 #include <string>
00008 #include <map>
00009 #include <sys/socket.h>
00010 #include <sys/types.h>
00011 #include <netdb.h>
00012 #include <netinet/in.h>
00013 #include <unistd.h>
00014 #include <errno.h>
00015 #include <time.h>
00016 
00017 #ifndef __CONNECTION_H__
00018 #define __CONNECTION_H__
00019 
00020 #define PT_SYN_ONLY 0
00021 #define PT_ACK_ONLY 1
00022 #define PT_SYN_WITH_DATA 2
00023 #define PT_KEY_EXCHANGE 3
00024 
00025 
00026 class packet : public classbase
00027 {
00028  public:
00029         long key;
00030         short int id;
00031         short int type;
00032         char data[MAXBUF];
00033 
00034         packet();
00035         ~packet();
00036 };
00037 
00038 
00039 class connection : public classbase
00040 {
00041  public:
00042         long key;
00043         int fd;                 // file descriptor
00044         char host[256];         // hostname
00045         long ip;                // ipv4 address
00046         char inbuf[MAXBUF];     // recvQ
00047         long bytes_in;
00048         long bytes_out;
00049         long cmds_in;
00050         long cmds_out;
00051         bool haspassed;
00052         int port;
00053         int registered;
00054         time_t lastping;
00055         time_t signon;
00056         time_t idle_lastmsg;
00057         time_t nping;
00058         char internal_addr[1024];
00059         
00060         connection();
00061         bool CreateListener(char* host, int p);
00062         bool BeginLink(char* targethost, int port, char* password);
00063         void TerminateLink(char* targethost);
00064         bool SendPacket(char *message, char* host, int port, long ourkey);
00065         bool RecvPacket(char *message, char* host, int &prt, long &theirkey);
00066         bool SendSYN(char* host, int port);
00067         bool SendACK(char* host, int port, int reply_id);
00068         long GenKey();
00069 };
00070 
00071 
00072 #endif
00073 

Generated on Thu Apr 8 19:12:27 2004 for InspIRCd by doxygen1.3-rc3