-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs_netfpga.h
204 lines (181 loc) · 2.93 KB
/
structs_netfpga.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*
* * FILE NAME: structs.h
* * STRUCTURES FOR THE DNS SERVER
* * CREATED BY: RICK W. WALLEN
* * DATE CREATED: SEPTEMBER.29.2014
* * DATE LAST MOD: SEPTEMBER.29.2014
* * ___________
* * | |
* * [[|___________|]]
* * \___________/
* * __|[ ]||||[ ]|__
* * \_| # |||| # |_/
* * ___ ===Jeep=== ___
* * |\/\| '' '' |\/\|
* * |/\/| |/\/|
* * |_\_| |_\_|
* */
/**********************************************************************/
/*
* * MODIFIED LOG:
* * <date>-<description>
* * September.29.2014-Adapted from
* */
/**********************************************************************/
#ifndef _STRUCTS_NETFPGA_
#define _STRUCTS_NETFPGA_ 1
//#include <arpa/inet.h>
#include "dns_netfpga.h"
/* Structures */
/*Server Structs*/
/*
* For use if ever switch to one client per thread
typedef struct cliInfo
{
socklen_t len;
struct sockaddr_in sockAddrInfo;
char msg[PKT_SZ];
struct trieptr *rt;
double start;
FILE *fptr;
}CliInfo;
*/
/*Trie Structs*/
typedef struct trieptr
{
char key;
struct rr *val;
struct trieptr *par;
struct trieptr *snt;
struct trieptr *spv;
struct trieptr *cdn;
}Trie;
/*Header Structs*/
typedef struct
{
unsigned qr : 1;
unsigned opcode : 4;
unsigned aa : 1;
unsigned tc : 1;
unsigned rd : 1;
unsigned ra : 1;
unsigned z : 3;
unsigned rcode : 4;
} DnsHdrFlags;
typedef struct
{
uint16_t id;
uint16_t flags;
uint16_t qdcount;
uint16_t ancount;
uint16_t nscount;
uint16_t arcount;
}DnsHeader;
/*Record Structs*/
typedef struct
{
uint16_t qtype;
uint16_t qclass;
}DnsQuery;
typedef struct rr
{
struct arec *ars;
struct nsrec *nsrs;
struct cnamerec *cnamers;
struct ptrrec *ptrrs;
struct mxrec *mxrs;
struct aaaarec *aaaars;
struct soarec *soars;
}RR;
typedef struct arec
{
struct in_addr address;
uint16_t rclass;
int32_t ttl;
uint16_t rdlen;
struct arec *anxt;
} A;
typedef struct nsrec
{
char *nsdname;
uint16_t rclass;
int32_t ttl;
uint16_t rdlen;
struct nsrec *nsnxt;
} NS;
typedef struct cnamerec
{
char *cname;
uint16_t rclass;
int32_t ttl;
uint16_t rdlen;
} CNAME;
typedef struct soarec
{
char *mname;
char *rname;
uint32_t serial;
int32_t refresh;
int32_t retry;
int32_t expire;
uint32_t minimum;
uint16_t rclass;
uint16_t rdlen;
} SOA;
typedef struct ptrrec
{
char *ptrdname;
uint16_t rclass;
int32_t ttl;
uint16_t rdlen;
} PTR;
typedef struct mxrec
{
uint16_t preference;
char *exchange;
uint16_t rclass;
int32_t ttl;
uint16_t rdlen;
struct mxrec *mxnxt;
} MX;
typedef struct aaaarec
{
struct in6_addr address;
uint16_t rclass;
int32_t ttl;
uint16_t rdlen;
struct aaaarec *aaaanxt;
} AAAA;
typedef enum
{
a = 1,
ns,
md,
mf,
cname,
soa,
mb,
mg,
mr,
null,
wks,
ptr,
hinfo,
minfo,
mx,
txt,
aaaa = 28,
axfr = 252,
mailb,
maila,
allTypes
}DnsType;
typedef enum
{
in = 1,
cs,
ch,
hs,
allClasses = 255
}DnsClass;
#endif //end if structs_netfpga.h