-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrequest_context.h
59 lines (44 loc) · 1.19 KB
/
request_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
/**
* This module defines a data structure for contextual information
* for a request.
*/
#ifndef _REQUEST_CONTEXT_H
#define _REQUEST_CONTEXT_H
#include "dns.h"
#include "dns_data.h"
#include "response_info.h"
enum REQUEST_TYPE {
REQUEST_TYPE_UDP,
REQUEST_TYPE_TCP
};
class hash_cache;
struct request_context_t {
// request info
REQUEST_TYPE request_type;
// socket related info for this request
struct sockaddr_storage* sockaddr;
char source_addr[INET6_ADDRSTRLEN + 1];
// data used to handle this request
dns_data_t* dns_data;
dns_domain_rrs_t* dnssec_nsec_data;
// request in buffer (bytes we got from the client)
char* buf;
int query_len;
// DNS header
dns_header request_header;
dns_header response_header;
// DNSSEC
bool dnssec_do;
hash_cache* dnssec_hash_cache;
response_info_t response_info_chain[DNS_MAX_ITERATE];
int number_of_response_infos;
unsigned int thread_id;
// METHODS
char* get_source_address();
response_info_t* get_current_response_info();
response_info_t* start_response_info();
void debug_print();
protected:
void _new_response_info();
};
#endif //_REQUEST_CONTEXT_H