forked from thewhoo/dpdk-tcp-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.h
56 lines (46 loc) · 1.01 KB
/
dns.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
//
// Created by postolka on 22.5.19.
//
#ifndef DPDK_TCP_GENERATOR_DNS_H
#define DPDK_TCP_GENERATOR_DNS_H
#include <stdint.h>
/**
* DNS query types
*/
#define DNS_QTYPE_A 1
#define DNS_QTYPE_NS 2
#define DNS_QTYPE_CNAME 5
#define DNS_QTYPE_SOA 6
#define DNS_QTYPE_MX 15
#define DNS_QTYPE_TXT 16
#define DNS_QTYPE_AXFR 252
#define DNS_QTYPE_MAX_TYPES 1 << 8
/**
* DNS RCodes
*/
#define DNS_RCODE_NOERROR 0
#define DNS_RCODE_FORMERR 1
#define DNS_RCODE_SERVFAIL 2
#define DNS_RCODE_NXDOMAIN 3
#define DNS_RCODE_NOTIMP 4
#define DNS_RCODE_REFUSED 5
#define DNS_RCODE_MAX_TYPES (1 << 8)
/**
* DNS query classes
*/
#define DNS_QCLASS_IN 1
#define DNS_QCLASS_CH 3
struct dns_hdr {
uint16_t len;
uint16_t tx_id;
uint16_t flags;
uint16_t q_cnt;
uint16_t an_cnt;
uint16_t auth_cnt;
uint16_t additional_cnt;
} __attribute__((__packed__));
struct dns_query_flags {
uint16_t qtype;
uint16_t qclass;
} __attribute__((__packed__));
#endif //DPDK_TCP_GENERATOR_DNS_H