hlswmaster-ng/netpkt.h

33 lines
504 B
C++

#ifndef _NETPKT_H_
#define _NETPKT_H_
#include <net/if.h>
#include <netinet/in.h>
#define PKT_ACCEPT 1
#define PKT_ACCEPT_FREED 2
#define PKT_REJECT 4
class NetPkt {
public:
~NetPkt();
static NetPkt* createFromSocket(int fd);
NetPkt* append(NetPkt* pkt);
int show(char* buf, int size);
protected:
NetPkt(const NetPkt& x);
NetPkt& operator=(const NetPkt& x);
private:
NetPkt(int size);
int readFromSocket(int fd);
struct sockaddr_in addr;
int size;
char *data;
};
#endif // _NETPKT_H_