-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPacketHandler.hpp
46 lines (36 loc) · 1.13 KB
/
PacketHandler.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef _PACKET_HANDLER_HPP_
#define _PACKET_HANDLER_HPP_
#include <vector>
#include <random>
#include <netinet/ip.h>
#include "TamperMethod.hpp"
/**
* @brief Handles packets received by the NFQueue, and applies tampers
*/
class PacketHandler {
private:
std::vector<TamperMethod *> meths; /*!< List of configured tamper methods, in order they are to be applied */
std::random_device rand_rd;
std::mt19937 rand_engine;
int handleTCPPacket(struct iphdr *_ip_head);
int handleUDPPacket(struct iphdr *_ip_head);
int doTamper(size_t len, uint8_t *data);
public:
PacketHandler();
/**
* @brief Add tamper method to the end of the list
*
* @param _meth Tamper method
*/
void addTamperMethod(TamperMethod *_meth);
/**
* @brief Handle a packet
*
* @param len Length of packet data
* @param data pointer to packet data
*
* @return <Return value currently unused >
*/
int handlePacket(size_t len, uint8_t *data);
};
#endif /* _PACKET_HANDLER_HPP_ */