// // Socket // /* prevent multiple inclusions */ #ifndef __RawSocket__ #define __RawSocket__ /* includes *****************************************************************/ #include "Socket.h" #include //Provides declarations for icmp header #include //Provides declarations for udp header #include //Provides declarations for tcp header #include //Provides declarations for ip header #include #include /* defines ******************************************************************/ /* macros *******************************************************************/ /* structs & typedefs *******************************************************/ /* c class definitions ******************************************************/ class RawSocket : public Socket { // public data public: struct sockaddr_storage sock_addr; socklen_t sock_len; // protected data protected: // private data private: // static data // public methods public: // constructors RawSocket(); // destructor virtual ~RawSocket(); // copy constructor RawSocket( const RawSocket &src ) ; const RawSocket& operator=( const RawSocket &src ); // public methods int Socket(); int RecvFrom( void *buf, int max ); // control // status int GetIPHdrLen( const void *buf ); int GetProtocol( const void *buf ); struct iphdr *GetIPHeader( const void *buf ) {return (struct iphdr*)buf;}; struct tcphdr *GetTcpHeader( const void *buf ); struct udphdr *GetUdpHeader( const void *buf ); unsigned char *GetData( const void *buf, int *length, int proto=0 ); // virtual functions // exceptions // static methods // private methods private: }; #endif