-
Notifications
You must be signed in to change notification settings - Fork 1
/
ipv4.h
54 lines (46 loc) · 938 Bytes
/
ipv4.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
//
// Created by sarunas on 20.5.8.
//
#ifndef ARP_IPV4_H
#define ARP_IPV4_H
#include <net/ethernet.h>
#include <netinet/ip.h>
struct iphdr2 {
__u8 version;
__u8 tos;
__be16 tot_len;
__be16 id;
__be16 frag_off;
__u8 ttl;
__u8 protocol;
__sum16 check;
__be32 saddr;
__be32 daddr;
/*The options start here. */
};
struct ipv4_resp
{
// ETH header
struct ether_header eh;
// IPv4 header
struct iphdr2 ih;
// Max possible payload
char payload[1466]; // 1500 (MTU) - 14 (Ether hdr) - 20 (IP hdr)
// Real packet length
size_t length;
} __attribute__ ((__packed__));
struct fragment_data
{
__be32 saddr;
__be32 daddr;
__be16 id;
__u8 protocol;
__u8 bitmap_ptr; // Bitfield of existing bytes
};
typedef struct fragment
{
struct fragment_data data;
struct fragment *next;
struct fragment *prev;
} fragment_t;
#endif //ARP_IPV4_H