diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-15 10:52:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-15 10:52:06 +0000 |
commit | 3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8 (patch) | |
tree | ed49951102400f7086f4db23846fb7aaf32e5eb1 /src/include/gnunet_dnsparser_lib.h | |
parent | 9e94c69b299f74ac88b14f92b7a01bba0c33a776 (diff) | |
download | gnunet-3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8.tar.gz gnunet-3288af4a4651156c01bdf6ffe1b20c6fbedf4bd8.zip |
-eliminating duplicate struct definitions
Diffstat (limited to 'src/include/gnunet_dnsparser_lib.h')
-rw-r--r-- | src/include/gnunet_dnsparser_lib.h | 153 |
1 files changed, 5 insertions, 148 deletions
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h index fb8f588bd..b4f33dd5a 100644 --- a/src/include/gnunet_dnsparser_lib.h +++ b/src/include/gnunet_dnsparser_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -28,6 +28,7 @@ | |||
28 | #define GNUNET_DNSPARSER_LIB_H | 28 | #define GNUNET_DNSPARSER_LIB_H |
29 | 29 | ||
30 | #include "gnunet_common.h" | 30 | #include "gnunet_common.h" |
31 | #include "gnunet_tun_lib.h" | ||
31 | 32 | ||
32 | /** | 33 | /** |
33 | * Maximum length of a label in DNS. | 34 | * Maximum length of a label in DNS. |
@@ -54,150 +55,6 @@ | |||
54 | #define GNUNET_DNSPARSER_TYPE_SRV 33 | 55 | #define GNUNET_DNSPARSER_TYPE_SRV 33 |
55 | #define GNUNET_DNSPARSER_TYPE_TLSA 52 | 56 | #define GNUNET_DNSPARSER_TYPE_TLSA 52 |
56 | 57 | ||
57 | /** | ||
58 | * A few common DNS classes (ok, only one is common, but I list a | ||
59 | * couple more to make it clear what we're talking about here). | ||
60 | */ | ||
61 | #define GNUNET_DNSPARSER_CLASS_INTERNET 1 | ||
62 | #define GNUNET_DNSPARSER_CLASS_CHAOS 3 | ||
63 | #define GNUNET_DNSPARSER_CLASS_HESIOD 4 | ||
64 | |||
65 | #define GNUNET_DNSPARSER_OPCODE_QUERY 0 | ||
66 | #define GNUNET_DNSPARSER_OPCODE_INVERSE_QUERY 1 | ||
67 | #define GNUNET_DNSPARSER_OPCODE_STATUS 2 | ||
68 | |||
69 | /** | ||
70 | * RFC 1035 codes. | ||
71 | */ | ||
72 | #define GNUNET_DNSPARSER_RETURN_CODE_NO_ERROR 0 | ||
73 | #define GNUNET_DNSPARSER_RETURN_CODE_FORMAT_ERROR 1 | ||
74 | #define GNUNET_DNSPARSER_RETURN_CODE_SERVER_FAILURE 2 | ||
75 | #define GNUNET_DNSPARSER_RETURN_CODE_NAME_ERROR 3 | ||
76 | #define GNUNET_DNSPARSER_RETURN_CODE_NOT_IMPLEMENTED 4 | ||
77 | #define GNUNET_DNSPARSER_RETURN_CODE_REFUSED 5 | ||
78 | |||
79 | /** | ||
80 | * RFC 2136 codes | ||
81 | */ | ||
82 | #define GNUNET_DNSPARSER_RETURN_CODE_YXDOMAIN 6 | ||
83 | #define GNUNET_DNSPARSER_RETURN_CODE_YXRRSET 7 | ||
84 | #define GNUNET_DNSPARSER_RETURN_CODE_NXRRSET 8 | ||
85 | #define GNUNET_DNSPARSER_RETURN_CODE_NOT_AUTH 9 | ||
86 | #define GNUNET_DNSPARSER_RETURN_CODE_NOT_ZONE 10 | ||
87 | |||
88 | /** | ||
89 | * DNS flags (largely RFC 1035 / RFC 2136). | ||
90 | */ | ||
91 | struct GNUNET_DNSPARSER_Flags | ||
92 | { | ||
93 | #if __BYTE_ORDER == __LITTLE_ENDIAN | ||
94 | /** | ||
95 | * Set to 1 if recursion is desired (client -> server) | ||
96 | */ | ||
97 | unsigned int recursion_desired : 1 GNUNET_PACKED; | ||
98 | |||
99 | /** | ||
100 | * Set to 1 if message is truncated | ||
101 | */ | ||
102 | unsigned int message_truncated : 1 GNUNET_PACKED; | ||
103 | |||
104 | /** | ||
105 | * Set to 1 if this is an authoritative answer | ||
106 | */ | ||
107 | unsigned int authoritative_answer : 1 GNUNET_PACKED; | ||
108 | |||
109 | /** | ||
110 | * See GNUNET_DNSPARSER_OPCODE_ defines. | ||
111 | */ | ||
112 | unsigned int opcode : 4 GNUNET_PACKED; | ||
113 | |||
114 | /** | ||
115 | * query:0, response:1 | ||
116 | */ | ||
117 | unsigned int query_or_response : 1 GNUNET_PACKED; | ||
118 | |||
119 | /** | ||
120 | * See GNUNET_DNSPARSER_RETURN_CODE_ defines. | ||
121 | */ | ||
122 | unsigned int return_code : 4 GNUNET_PACKED; | ||
123 | |||
124 | /** | ||
125 | * See RFC 4035. | ||
126 | */ | ||
127 | unsigned int checking_disabled : 1 GNUNET_PACKED; | ||
128 | |||
129 | /** | ||
130 | * Response has been cryptographically verified, RFC 4035. | ||
131 | */ | ||
132 | unsigned int authenticated_data : 1 GNUNET_PACKED; | ||
133 | |||
134 | /** | ||
135 | * Always zero. | ||
136 | */ | ||
137 | unsigned int zero : 1 GNUNET_PACKED; | ||
138 | |||
139 | /** | ||
140 | * Set to 1 if recursion is available (server -> client) | ||
141 | */ | ||
142 | unsigned int recursion_available : 1 GNUNET_PACKED; | ||
143 | #elif __BYTE_ORDER == __BIG_ENDIAN | ||
144 | |||
145 | /** | ||
146 | * query:0, response:1 | ||
147 | */ | ||
148 | unsigned int query_or_response : 1 GNUNET_PACKED; | ||
149 | |||
150 | /** | ||
151 | * See GNUNET_DNSPARSER_OPCODE_ defines. | ||
152 | */ | ||
153 | unsigned int opcode : 4 GNUNET_PACKED; | ||
154 | |||
155 | /** | ||
156 | * Set to 1 if this is an authoritative answer | ||
157 | */ | ||
158 | unsigned int authoritative_answer : 1 GNUNET_PACKED; | ||
159 | |||
160 | /** | ||
161 | * Set to 1 if message is truncated | ||
162 | */ | ||
163 | unsigned int message_truncated : 1 GNUNET_PACKED; | ||
164 | |||
165 | /** | ||
166 | * Set to 1 if recursion is desired (client -> server) | ||
167 | */ | ||
168 | unsigned int recursion_desired : 1 GNUNET_PACKED; | ||
169 | |||
170 | |||
171 | /** | ||
172 | * Set to 1 if recursion is available (server -> client) | ||
173 | */ | ||
174 | unsigned int recursion_available : 1 GNUNET_PACKED; | ||
175 | |||
176 | /** | ||
177 | * Always zero. | ||
178 | */ | ||
179 | unsigned int zero : 1 GNUNET_PACKED; | ||
180 | |||
181 | /** | ||
182 | * Response has been cryptographically verified, RFC 4035. | ||
183 | */ | ||
184 | unsigned int authenticated_data : 1 GNUNET_PACKED; | ||
185 | |||
186 | /** | ||
187 | * See RFC 4035. | ||
188 | */ | ||
189 | unsigned int checking_disabled : 1 GNUNET_PACKED; | ||
190 | |||
191 | /** | ||
192 | * See GNUNET_DNSPARSER_RETURN_CODE_ defines. | ||
193 | */ | ||
194 | unsigned int return_code : 4 GNUNET_PACKED; | ||
195 | #else | ||
196 | #error byteorder undefined | ||
197 | #endif | ||
198 | |||
199 | } GNUNET_GCC_STRUCT_LAYOUT; | ||
200 | |||
201 | 58 | ||
202 | /** | 59 | /** |
203 | * A DNS query. | 60 | * A DNS query. |
@@ -220,7 +77,7 @@ struct GNUNET_DNSPARSER_Query | |||
220 | uint16_t type; | 77 | uint16_t type; |
221 | 78 | ||
222 | /** | 79 | /** |
223 | * See GNUNET_DNSPARSER_CLASS_*. | 80 | * See GNUNET_TUN_DNS_CLASS_*. |
224 | */ | 81 | */ |
225 | uint16_t class; | 82 | uint16_t class; |
226 | 83 | ||
@@ -459,7 +316,7 @@ struct GNUNET_DNSPARSER_Record | |||
459 | uint16_t type; | 316 | uint16_t type; |
460 | 317 | ||
461 | /** | 318 | /** |
462 | * See GNUNET_DNSPARSER_CLASS_*. | 319 | * See GNUNET_TUN_DNS_CLASS_*. |
463 | */ | 320 | */ |
464 | uint16_t class; | 321 | uint16_t class; |
465 | 322 | ||
@@ -514,7 +371,7 @@ struct GNUNET_DNSPARSER_Packet | |||
514 | /** | 371 | /** |
515 | * Bitfield of DNS flags. | 372 | * Bitfield of DNS flags. |
516 | */ | 373 | */ |
517 | struct GNUNET_DNSPARSER_Flags flags; | 374 | struct GNUNET_TUN_DnsFlags flags; |
518 | 375 | ||
519 | /** | 376 | /** |
520 | * DNS ID (to match replies to requests). | 377 | * DNS ID (to match replies to requests). |