-
Notifications
You must be signed in to change notification settings - Fork 0
/
typedef.h
67 lines (59 loc) · 1.16 KB
/
typedef.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
#ifndef GLOBALS_H
#include "globals.h"
#endif // !GLOBALS_H
#define TYPEDEF_H
typedef struct {
libnet_t *context;
char *errorBuffer;
} Libnet;
typedef struct {
uint16_t length;
uint8_t tos;
uint16_t id;
uint16_t fragments;
uint8_t ttl;
uint8_t protocol;
uint16_t checksum;
uint32_t source;
uint32_t destination;
const uint8_t *payload;
uint32_t payloadLength;
Libnet libnet;
libnet_ptag_t ptag;
} IPv4Options;
typedef struct {
uint16_t sourcePort;
uint16_t destinationPort;
uint32_t sequence;
uint32_t acknowledgement;
uint8_t control;
uint16_t windowSize;
uint16_t checksum;
uint16_t urgentPointer;
uint16_t packetLength;
const uint8_t *payload;
uint32_t payloadLength;
Libnet libnet;
libnet_ptag_t ptag;
} TCPOptions;
typedef struct {
uint32_t source;
uint32_t destination;
} IPAddresses;
typedef struct {
char *payload;
uint32_t payloadLength;
Libnet libnet;
libnet_ptag_t ptag;
} PayloadOptions;
typedef struct {
char *errorBuffer;
pcap_t *handle;
bpf_u_int32 netMask;
bpf_u_int32 deviceIP;
} Pcap;
typedef struct {
struct ethhdr *ethernet;
struct iphdr *ip;
struct tcphdr *tcp;
} Packet;