-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.h
76 lines (62 loc) · 1.41 KB
/
context.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef __CORE_H__
#define __CORE_H__
#include <stdio.h>
#include <stdio.h>
#include <inttypes.h> // PRId64
#include <pcap.h>
#include <pthread.h>
#include <libnet.h>
#include "utils/hash_table.h"
/**
* Data structure with all handles
* (so that cleanup can be simplified).
*/
typedef struct _resetter_context_t {
/**
* Device name to capture and inject packets on
* (e.g. "en0").
*
* If blank on startup, this will be automatically detected.
*/
char *device;
/**
* [Optional] Target IP address to block.
* If unspecified, then blocks all IPs.
*/
struct sockaddr_in target_addr;
/**
* [Optional] Target TCP port to block.
* If 0, then blocks all ports.
*/
uint16_t target_port;
/**
* pcap: handle.
*/
pcap_t *pcap;
/**
* pcap: BPF filter string.
*/
char filter_string[1000];
/**
* Is ARP poisoning mode enabled?
*/
int arp_poisoning;
/**
* Poisoned ARP table: IP -> original MAC address.
* Also used for unpoisoning.
*/
hash_table *arp_table;
/**
* libnet: handle.
*/
libnet_t *libnet;
/**
* libnet: Last time stats were printed to the console.
*/
u_long libnet_last_stats_at;
/**
* Cleanup function to call before program is terminated.
*/
void (*cleanup)(struct _resetter_context_t *);
} resetter_context_t;
#endif