-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessage.h
56 lines (44 loc) · 1.05 KB
/
Message.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 92798 on 2021/7/6.
//
#ifndef CM_DNS_CPP_MESSAGE_H
#define CM_DNS_CPP_MESSAGE_H
#include <winsock2.h>
#include <string>
#include <vector>
#define MESSAGE_HEADER_LENGTH 12
typedef struct dns_header {
u_short id;
u_short flags;
u_short question;
u_short answer_RR;
u_short authority_RR;
u_short additional_RR;
} DNS_HEADER;
typedef struct dns_query {
std::string name;
std::string type;
u_short class_;
int headerAndQueryLength;
} DNS_QUERY;
typedef struct dns_response {
std::string name;
std::string type;
u_short class_;
u_long ttl;
u_short data_length;
std::string data;
} DNS_RESPONSE;
class Message {
DNS_HEADER* header;
DNS_QUERY* query;
std::vector<DNS_RESPONSE> responses;
public:
DNS_QUERY* getQuery();
DNS_HEADER* getHeader();
std::vector<DNS_RESPONSE> getResponses();
void setQuery(DNS_QUERY* dnsQuery);
void setHeader(DNS_HEADER* dnsHeader);
void setResponses(std::vector<DNS_RESPONSE> dnsResponses);
};
#endif //CM_DNS_CPP_MESSAGE_H