Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

tcp.h

00001 /*** This Programs/Libraries are (C)opyright by Sebastian Krahmer.
00002  *** You may use it under the terms of the GPL. You should have
00003  *** already received the file COPYING that shows you your rights.
00004  *** Please look at COPYING for further license-details.
00005  ***  
00006  *** THERE IS ABSOLUTELY NO WARRANTY. SO YOU USE IT AT YOUR OWN RISK.
00007  *** IT WAS WRITTEN IN THE HOPE THAT IT WILL BE USEFULL. I AM NOT RESPONSIBLE
00008  *** FOR ANY DAMAGE YOU MAYBE GET DUE TO USING MY PROGRAMS.
00009  ***/
00010 
00011 
00012 #ifndef _TCP_H_
00013 #define _TCP_H_
00014 
00015 #include "usi-structs.h"
00016 #include "datalink.h"
00017 #include "ip.h"
00018 
00019 namespace usipp {
00020 
00024 class TCP : public IP {
00025 private:
00026         struct tcphdr tcph;
00027         char tcpOptions[40];
00028         struct pseudohdr pseudo;
00029 public:
00030         
00033         TCP(const char*);
00034 
00037         virtual ~TCP();
00038   
00041         TCP &operator=(const TCP&);    
00042 
00045         TCP(const TCP&);
00046 
00049         u_int16_t get_srcport();
00050 
00053         u_int16_t get_dstport();
00054 
00057         u_int32_t  get_seq();
00058 
00061         u_int32_t  get_ack();
00062 
00066         u_int8_t get_off();
00067 
00078         u_int8_t get_flags();      
00079       
00080         
00081         u_int16_t get_win();
00082       
00083         
00084         u_int16_t get_tcpsum();
00085         
00088         u_int16_t get_urg();
00089       
00092         int set_srcport(u_int16_t);
00093 
00096         int set_dstport(u_int16_t);
00097 
00100         int set_seq(u_int32_t);
00101 
00102         
00103         int set_ack(u_int32_t);
00104 
00105         
00106         int set_off(u_int8_t);
00107 
00108         
00109         int set_flags(u_int8_t);
00110 
00111         
00112         int set_win(u_int16_t);
00113 
00119         int set_tcpsum(u_int16_t);
00120 
00121         
00122         int set_urg(u_int16_t);
00123      
00127         tcphdr get_tcphdr();
00128 
00129         /* The following functions are already defined in IP {}.
00130          * We need them too for TCP {}, and TCP{} calls IP::function() then.
00131          */
00132  
00133 
00136         virtual int sniffpack(void *buf, size_t buflen);
00137         
00140         virtual int sendpack(void *payload, size_t paylen);
00141 
00144         virtual int sendpack(char *pay_string);
00145       
00148         virtual int init_device(char *, int, size_t);
00149 
00152         int set_tcpopt(char kind, unsigned char len, union tcp_options t);
00153 
00156         int reset_tcpopt();
00157       
00160         int get_tcpopt(char *);
00161 };
00162 
00163 
00164 } // namespace usipp
00165 
00166 #endif // _TCP_H_
00167 

Generated at Fri May 11 13:02:56 2001 for libusi++ by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000