-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
48 lines (40 loc) · 1 KB
/
header.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
#ifndef HEADER_H
#define HEADER_H
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include<pcap.h>
#include<netinet/ether.h>
#include<netinet/if_ether.h>
#include<netinet/in.h>
#include<netinet/ip.h>
#include<stdint.h>
#include<string.h>
#include<arpa/inet.h>
#include <libnet.h>
#include <netinet/udp.h>
#include <resolv.h>
#include <arpa/nameser.h>
#define ETHERTYPE_IP 0x0800
#define SIZE_ETHERNET 14
#define IP_HEADER_SIZE 20
#define UDP_HEADER_SIZE 8
#define DNS_HEADER_SIZE 12
struct dnshdr {
unsigned id: 16;
unsigned rd: 1;
unsigned tc: 1;
unsigned aa: 1;
unsigned opcode: 4;
unsigned qr: 1;
unsigned rcode: 4;
unsigned cd: 1;
unsigned ad: 1;
unsigned unused: 1;
unsigned ra: 1;
unsigned qdcount: 16;
unsigned ancount: 16;
unsigned nscount: 16;
unsigned arcount: 16;
};
#endif