blob: d312f8931ce0540d4ed70c637f2ff526529f9aa0 (
plain)
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
|
/*
This file is part of GNUnet
(C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file dns/dnsparser.h
* @brief helper library to parse DNS packets.
* @author Philipp Toelke
* @author Christian Grothoff
* @author Martin Schanzenbach
*/
GNUNET_NETWORK_STRUCT_BEGIN
/* FIXME: replace this one with the one from tcpip_tun.h!? */
/**
* Head of a any DNS message.
*/
struct GNUNET_TUN_DnsHeader
{
/**
* Request/response ID. (NBO)
*/
uint16_t id GNUNET_PACKED;
/**
* Flags for the operation.
*/
struct GNUNET_DNSPARSER_Flags flags;
/**
* number of questions (NBO)
*/
uint16_t query_count GNUNET_PACKED;
/**
* number of answers (NBO)
*/
uint16_t answer_rcount GNUNET_PACKED;
/**
* number of authority-records (NBO)
*/
uint16_t authority_rcount GNUNET_PACKED;
/**
* number of additional records (NBO)
*/
uint16_t additional_rcount GNUNET_PACKED;
};
/**
* DNS query prefix.
*/
struct query_line
{
/**
* Desired type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
*/
uint16_t type GNUNET_PACKED;
/**
* Desired class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
*/
uint16_t class GNUNET_PACKED;
};
/**
* General DNS record prefix.
*/
struct record_line
{
/**
* Record type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
*/
uint16_t type GNUNET_PACKED;
/**
* Record class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
*/
uint16_t class GNUNET_PACKED;
/**
* Expiration for the record (in seconds). (NBO)
*/
uint32_t ttl GNUNET_PACKED;
/**
* Number of bytes of data that follow. (NBO)
*/
uint16_t data_len GNUNET_PACKED;
};
/**
* Payload of DNS SOA record (header).
*/
struct soa_data
{
/**
* The version number of the original copy of the zone. (NBO)
*/
uint32_t serial GNUNET_PACKED;
/**
* Time interval before the zone should be refreshed. (NBO)
*/
uint32_t refresh GNUNET_PACKED;
/**
* Time interval that should elapse before a failed refresh should
* be retried. (NBO)
*/
uint32_t retry GNUNET_PACKED;
/**
* Time value that specifies the upper limit on the time interval
* that can elapse before the zone is no longer authoritative. (NBO)
*/
uint32_t expire GNUNET_PACKED;
/**
* The bit minimum TTL field that should be exported with any RR
* from this zone. (NBO)
*/
uint32_t minimum GNUNET_PACKED;
};
/**
* Payload of DNS SRV record (header).
*/
struct srv_data
{
/**
* Preference for this entry (lower value is higher preference). Clients
* will contact hosts from the lowest-priority group first and fall back
* to higher priorities if the low-priority entries are unavailable. (NBO)
*/
uint16_t prio GNUNET_PACKED;
/**
* Relative weight for records with the same priority. Clients will use
* the hosts of the same (lowest) priority with a probability proportional
* to the weight given. (NBO)
*/
uint16_t weight GNUNET_PACKED;
/**
* TCP or UDP port of the service. (NBO)
*/
uint16_t port GNUNET_PACKED;
/* followed by 'target' name */
};
/**
* Payload of GNS VPN record
*/
struct vpn_data
{
/**
* The peer to contact
*/
struct GNUNET_HashCode peer;
/**
* The protocol to use
*/
uint16_t proto GNUNET_PACKED;
/* followed by the servicename / identifier / password (0-terminated) */
};
GNUNET_NETWORK_STRUCT_END
|