hlswmaster-ng/netpkt.h

35 lines
580 B
C++

#ifndef _NETPKT_H_
#define _NETPKT_H_
#include <net/if.h>
#include <netinet/in.h>
#define PARSE_ACCEPT 1
#define PARSE_ACCEPT_FREED 2
#define PARSE_REJECT 4
class NetPkt {
public:
~NetPkt();
static NetPkt* createFromSocket(int fd);
int show(char* buf, int size);
int checkPortArray(struct game_ports* arr);
bool compare(int offset, const char* buf, int len);
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_