include/PacketParser.h
changeset 0 826dd5531eb0
child 3 724e07a9f155
equal deleted inserted replaced
-1:000000000000 0:826dd5531eb0
       
     1 /*
       
     2  *  $Id: PacketParser.h 2 2007-12-22 14:15:30Z mbroeker $
       
     3  * $URL: http://localhost/svn/cpp/qMonitor/trunk/include/PacketParser.h $
       
     4  */
       
     5 
       
     6 #ifndef PACKET_PARSER
       
     7 #define PACKET_PARSER
       
     8 
       
     9 #include <PacketReader.h>
       
    10 #include <sstream>
       
    11 #include <iomanip>
       
    12 #include <tools.h>
       
    13 
       
    14 extern "C" {
       
    15 #include <arpa/inet.h>
       
    16 #include <netdb.h>
       
    17 #include <netinet/tcp.h>
       
    18 #include <netinet/udp.h>
       
    19 #include <netinet/ip_icmp.h>
       
    20 }
       
    21 
       
    22 class PacketParser : public PacketReader
       
    23 {
       
    24  public:
       
    25 	PacketParser ( int tm=500 );
       
    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 
       
    34  private:
       
    35 	std::string str;
       
    36 	int protocol;
       
    37 	unsigned short port;
       
    38 
       
    39 	std::string shost;
       
    40 	std::string dhost;
       
    41 	unsigned short sport, dport;
       
    42 	struct protoent *proto;
       
    43 };
       
    44 
       
    45 #endif
       
    46