#ifndef _NETPKT_H_ #define _NETPKT_H_ #include #include #define PARSE_ACCEPT 1 #define PARSE_ACCEPT_FREED 2 #define PARSE_REJECT 4 /* avoid cyclic deps */ class Socket; class NetPkt { friend class Socket; public: NetPkt(const char* data, int size); NetPkt(int size); ~NetPkt(); int show(char* buf, int size); bool compare(int offset, const char* buf, int len); int find(int offset, const char *buf, int len); void setAddress(struct sockaddr_in *addr); struct sockaddr_in * getAddress(); protected: NetPkt(const NetPkt& x); NetPkt& operator=(const NetPkt& x); struct sockaddr_in addr; const char *data; int used; private: int size; }; #endif // _NETPKT_H_