include/PacketParser.h
changeset 3 724e07a9f155
parent 0 826dd5531eb0
child 4 fdf04a93faeb
equal deleted inserted replaced
2:62ddf5dd4db0 3:724e07a9f155
    15 #include <arpa/inet.h>
    15 #include <arpa/inet.h>
    16 #include <netdb.h>
    16 #include <netdb.h>
    17 #include <netinet/tcp.h>
    17 #include <netinet/tcp.h>
    18 #include <netinet/udp.h>
    18 #include <netinet/udp.h>
    19 #include <netinet/ip_icmp.h>
    19 #include <netinet/ip_icmp.h>
    20 }
    20 } class PacketParser:public PacketReader {
       
    21   public:
       
    22     PacketParser (int tm = 500);
       
    23       PacketParser (std::string);
       
    24      ~PacketParser ();
       
    25       std::string read ();
       
    26       std::string getPacket ();
       
    27     void setPort (unsigned short);
       
    28     void setProtocol (int);
       
    29       std::string getProtocol (int);
    21 
    30 
    22 class PacketParser : public PacketReader
    31   private:
    23 {
    32       std::string str;
    24  public:
    33     int protocol;
    25 	PacketParser ( int tm=500 );
    34     unsigned short port;
    26 	PacketParser ( std::string );
       
    27 	~PacketParser ();
       
    28 	std::string read();
       
    29 	std::string getPacket();
       
    30 	void setPort(unsigned short);
       
    31 	void setProtocol(int);
       
    32 	std::string getProtocol(int);
       
    33 
    35 
    34  private:
    36       std::string shost;
    35 	std::string str;
    37       std::string dhost;
    36 	int protocol;
    38     unsigned short sport, dport;
    37 	unsigned short port;
    39     struct protoent *proto;
    38 
       
    39 	std::string shost;
       
    40 	std::string dhost;
       
    41 	unsigned short sport, dport;
       
    42 	struct protoent *proto;
       
    43 };
    40 };
    44 
    41 
    45 #endif
    42 #endif
    46