diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-15 20:41:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-15 20:41:40 +0000 |
commit | 1574e0f8c2a55363c024a95f440ba7be647efbe1 (patch) | |
tree | 5e4507d9aa404ac983c5774b71b25ec6174ee7cc /src/include | |
parent | 5ec7048ed9ffeddbe06e34a31d388080fae143e5 (diff) | |
download | gnunet-1574e0f8c2a55363c024a95f440ba7be647efbe1.tar.gz gnunet-1574e0f8c2a55363c024a95f440ba7be647efbe1.zip |
-removing legacy dns/vpn/exit code and renaming -new versions to current
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_dns_service-new.h | 186 | ||||
-rw-r--r-- | src/include/gnunet_dns_service.h | 236 | ||||
-rw-r--r-- | src/include/gnunet_dnsparser_lib.h | 93 |
4 files changed, 107 insertions, 409 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index b066c7cdc..d0cd70d01 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -42,7 +42,6 @@ gnunetinclude_HEADERS = \ | |||
42 | gnunet_disk_lib.h \ | 42 | gnunet_disk_lib.h \ |
43 | gnunet_dnsparser_lib.h \ | 43 | gnunet_dnsparser_lib.h \ |
44 | gnunet_dns_service.h \ | 44 | gnunet_dns_service.h \ |
45 | gnunet_dns_service-new.h \ | ||
46 | gnunet_dv_service.h \ | 45 | gnunet_dv_service.h \ |
47 | gnunet_fragmentation_lib.h \ | 46 | gnunet_fragmentation_lib.h \ |
48 | gnunet_fs_service.h \ | 47 | gnunet_fs_service.h \ |
diff --git a/src/include/gnunet_dns_service-new.h b/src/include/gnunet_dns_service-new.h deleted file mode 100644 index 3517a4609..000000000 --- a/src/include/gnunet_dns_service-new.h +++ /dev/null | |||
@@ -1,186 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2012 Christian Grothoff (and other contributing authors) | ||
4 | |||
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 | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file include/gnunet_dns_service-new.h | ||
23 | * @brief API to access the DNS service. | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef GNUNET_DNS_SERVICE_NEW_H | ||
27 | #define GNUNET_DNS_SERVICE_NEW_H | ||
28 | |||
29 | #include "gnunet_common.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | |||
32 | |||
33 | /** | ||
34 | * Opaque DNS handle | ||
35 | */ | ||
36 | struct GNUNET_DNS_Handle; | ||
37 | |||
38 | /** | ||
39 | * Handle to identify an individual DNS request. | ||
40 | */ | ||
41 | struct GNUNET_DNS_RequestHandle; | ||
42 | |||
43 | /** | ||
44 | * Flags that specify when to call the client's handler. | ||
45 | */ | ||
46 | enum GNUNET_DNS_Flags | ||
47 | { | ||
48 | |||
49 | /** | ||
50 | * Useless option: never call the client. | ||
51 | */ | ||
52 | GNUNET_DNS_FLAG_NEVER = 0, | ||
53 | |||
54 | /** | ||
55 | * Set this flag to see all requests first prior to resolution | ||
56 | * (for monitoring). Clients that set this flag must then | ||
57 | * call "GNUNET_DNS_request_forward" when they process a request | ||
58 | * for the first time. Caling "GNUNET_DNS_request_answer" is | ||
59 | * not allowed for MONITOR peers. | ||
60 | */ | ||
61 | GNUNET_DNS_FLAG_REQUEST_MONITOR = 1, | ||
62 | |||
63 | /** | ||
64 | * This client should be called on requests that have not | ||
65 | * yet been resolved as this client provides a resolution | ||
66 | * service. Note that this does not guarantee that the | ||
67 | * client will see all requests as another client might be | ||
68 | * called first and that client might have already done the | ||
69 | * resolution, in which case other pre-resolution clients | ||
70 | * won't see the request anymore. | ||
71 | */ | ||
72 | GNUNET_DNS_FLAG_PRE_RESOLUTION = 2, | ||
73 | |||
74 | /** | ||
75 | * This client wants to be called on the results of a DNS resolution | ||
76 | * (either resolved by PRE-RESOLUTION clients or the global DNS). | ||
77 | * The client then has a chance to modify the answer (or cause it to | ||
78 | * be dropped). There is no guarantee that other POST-RESOLUTION | ||
79 | * client's won't modify (or drop) the answer afterwards. | ||
80 | */ | ||
81 | GNUNET_DNS_FLAG_POST_RESOLUTION = 4, | ||
82 | |||
83 | /** | ||
84 | * Set this flag to see all requests just before they are | ||
85 | * returned to the network. Clients that set this flag must then | ||
86 | * call "GNUNET_DNS_request_forward" when they process a request | ||
87 | * for the last time. Caling "GNUNET_DNS_request_answer" is | ||
88 | * not allowed for MONITOR peers. | ||
89 | */ | ||
90 | GNUNET_DNS_FLAG_RESPONSE_MONITOR = 8 | ||
91 | |||
92 | }; | ||
93 | |||
94 | |||
95 | |||
96 | /** | ||
97 | * Signature of a function that is called whenever the DNS service | ||
98 | * encounters a DNS request and needs to do something with it. The | ||
99 | * function has then the chance to generate or modify the response by | ||
100 | * calling one of the three "GNUNET_DNS_request_*" continuations. | ||
101 | * | ||
102 | * When a request is intercepted, this function is called first to | ||
103 | * give the client a chance to do the complete address resolution; | ||
104 | * "rdata" will be NULL for this first call for a DNS request, unless | ||
105 | * some other client has already filled in a response. | ||
106 | * | ||
107 | * If multiple clients exist, all of them are called before the global | ||
108 | * DNS. The global DNS is only called if all of the clients' | ||
109 | * functions call GNUNET_DNS_request_forward. Functions that call | ||
110 | * GNUNET_DNS_request_forward will be called again before a final | ||
111 | * response is returned to the application. If any of the clients' | ||
112 | * functions call GNUNET_DNS_request_drop, the response is dropped. | ||
113 | * | ||
114 | * @param cls closure | ||
115 | * @param rh request handle to user for reply | ||
116 | * @param request_length number of bytes in request | ||
117 | * @param request udp payload of the DNS request | ||
118 | */ | ||
119 | typedef void (*GNUNET_DNS_RequestHandler)(void *cls, | ||
120 | struct GNUNET_DNS_RequestHandle *rh, | ||
121 | size_t request_length, | ||
122 | const char *request); | ||
123 | |||
124 | |||
125 | /** | ||
126 | * If a GNUNET_DNS_RequestHandler calls this function, the client | ||
127 | * has no desire to interfer with the request and it should | ||
128 | * continue to be processed normally. | ||
129 | * | ||
130 | * @param rh request that should now be forwarded | ||
131 | */ | ||
132 | void | ||
133 | GNUNET_DNS_request_forward (struct GNUNET_DNS_RequestHandle *rh); | ||
134 | |||
135 | |||
136 | /** | ||
137 | * If a GNUNET_DNS_RequestHandler calls this function, the request is | ||
138 | * to be dropped and no response should be generated. | ||
139 | * | ||
140 | * @param rh request that should now be dropped | ||
141 | */ | ||
142 | void | ||
143 | GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh); | ||
144 | |||
145 | |||
146 | /** | ||
147 | * If a GNUNET_DNS_RequestHandler calls this function, the request is | ||
148 | * supposed to be answered with the data provided to this call (with | ||
149 | * the modifications the function might have made). The reply given | ||
150 | * must always be a valid DNS reply and not a mutated DNS request. | ||
151 | * | ||
152 | * @param rh request that should now be answered | ||
153 | * @param reply_length size of reply (uint16_t to force sane size) | ||
154 | * @param reply reply data | ||
155 | */ | ||
156 | void | ||
157 | GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, | ||
158 | uint16_t reply_length, | ||
159 | const char *reply); | ||
160 | |||
161 | |||
162 | /** | ||
163 | * Connect to the service-dns | ||
164 | * | ||
165 | * @param cfg configuration to use | ||
166 | * @param flags when to call rh | ||
167 | * @param rh function to call with DNS requests | ||
168 | * @param rh_cls closure to pass to rh | ||
169 | * @return DNS handle | ||
170 | */ | ||
171 | struct GNUNET_DNS_Handle * | ||
172 | GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
173 | enum GNUNET_DNS_Flags flags, | ||
174 | GNUNET_DNS_RequestHandler rh, | ||
175 | void *rh_cls); | ||
176 | |||
177 | |||
178 | /** | ||
179 | * Disconnect from the DNS service. | ||
180 | * | ||
181 | * @param dh DNS handle | ||
182 | */ | ||
183 | void | ||
184 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *dh); | ||
185 | |||
186 | #endif | ||
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h index 329a083ff..3517a4609 100644 --- a/src/include/gnunet_dns_service.h +++ b/src/include/gnunet_dns_service.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) 2012 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 |
@@ -19,190 +19,168 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_dns_service.h | 22 | * @file include/gnunet_dns_service-new.h |
23 | * @brief API to access the DNS service. Not finished at all, | 23 | * @brief API to access the DNS service. |
24 | * currently only contains the structs for the IPC, which | 24 | * @author Christian Grothoff |
25 | * don't even belong here (legacy code in transition) | ||
26 | * @author Philipp Toelke | ||
27 | * | ||
28 | * TODO: | ||
29 | * - replace (most?) structs with nice function (prototypes) that take | ||
30 | * the appropriate arguments to pass the data | ||
31 | * - clean up API implementation itself (nicer reconnect, etc.) | ||
32 | */ | 25 | */ |
33 | #ifndef GNUNET_DNS_SERVICE_H | 26 | #ifndef GNUNET_DNS_SERVICE_NEW_H |
34 | #define GNUNET_DNS_SERVICE_H | 27 | #define GNUNET_DNS_SERVICE_NEW_H |
35 | 28 | ||
36 | #include "gnunet_common.h" | 29 | #include "gnunet_common.h" |
37 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
38 | 31 | ||
39 | 32 | ||
40 | /** | 33 | /** |
41 | * Subtypes of DNS answers. | 34 | * Opaque DNS handle |
35 | */ | ||
36 | struct GNUNET_DNS_Handle; | ||
37 | |||
38 | /** | ||
39 | * Handle to identify an individual DNS request. | ||
42 | */ | 40 | */ |
43 | enum GNUNET_DNS_ANSWER_Subtype | 41 | struct GNUNET_DNS_RequestHandle; |
42 | |||
43 | /** | ||
44 | * Flags that specify when to call the client's handler. | ||
45 | */ | ||
46 | enum GNUNET_DNS_Flags | ||
44 | { | 47 | { |
48 | |||
45 | /** | 49 | /** |
46 | * Answers of this type contain a dns-packet that just has to be transmitted | 50 | * Useless option: never call the client. |
47 | */ | 51 | */ |
48 | GNUNET_DNS_ANSWER_TYPE_IP, | 52 | GNUNET_DNS_FLAG_NEVER = 0, |
49 | 53 | ||
50 | /** | 54 | /** |
51 | * Answers of this type contain an incomplete dns-packet. The IP-Address | 55 | * Set this flag to see all requests first prior to resolution |
52 | * is all 0s. The addroffset points to it. | 56 | * (for monitoring). Clients that set this flag must then |
57 | * call "GNUNET_DNS_request_forward" when they process a request | ||
58 | * for the first time. Caling "GNUNET_DNS_request_answer" is | ||
59 | * not allowed for MONITOR peers. | ||
53 | */ | 60 | */ |
54 | GNUNET_DNS_ANSWER_TYPE_SERVICE, | 61 | GNUNET_DNS_FLAG_REQUEST_MONITOR = 1, |
55 | 62 | ||
56 | /** | 63 | /** |
57 | * Answers of this type contain an incomplete dns-packet as answer to a | 64 | * This client should be called on requests that have not |
58 | * PTR-Query. The resolved name is not allocated. The addroffset points to it. | 65 | * yet been resolved as this client provides a resolution |
66 | * service. Note that this does not guarantee that the | ||
67 | * client will see all requests as another client might be | ||
68 | * called first and that client might have already done the | ||
69 | * resolution, in which case other pre-resolution clients | ||
70 | * won't see the request anymore. | ||
59 | */ | 71 | */ |
60 | GNUNET_DNS_ANSWER_TYPE_REV, | 72 | GNUNET_DNS_FLAG_PRE_RESOLUTION = 2, |
61 | 73 | ||
62 | /** | 74 | /** |
63 | * Answers of this type contains an IP6-Address but traffic to this IP should | 75 | * This client wants to be called on the results of a DNS resolution |
64 | * be routed through the GNUNet. | 76 | * (either resolved by PRE-RESOLUTION clients or the global DNS). |
77 | * The client then has a chance to modify the answer (or cause it to | ||
78 | * be dropped). There is no guarantee that other POST-RESOLUTION | ||
79 | * client's won't modify (or drop) the answer afterwards. | ||
65 | */ | 80 | */ |
66 | GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA, | 81 | GNUNET_DNS_FLAG_POST_RESOLUTION = 4, |
67 | 82 | ||
68 | /** | 83 | /** |
69 | * Answers of this type contains an IP4-Address but traffic to this IP should | 84 | * Set this flag to see all requests just before they are |
70 | * be routed through the GNUNet. | 85 | * returned to the network. Clients that set this flag must then |
86 | * call "GNUNET_DNS_request_forward" when they process a request | ||
87 | * for the last time. Caling "GNUNET_DNS_request_answer" is | ||
88 | * not allowed for MONITOR peers. | ||
71 | */ | 89 | */ |
72 | GNUNET_DNS_ANSWER_TYPE_REMOTE_A | 90 | GNUNET_DNS_FLAG_RESPONSE_MONITOR = 8 |
73 | 91 | ||
74 | }; | 92 | }; |
75 | 93 | ||
76 | 94 | ||
77 | GNUNET_NETWORK_STRUCT_BEGIN | ||
78 | struct GNUNET_vpn_service_descriptor | ||
79 | { | ||
80 | GNUNET_HashCode peer GNUNET_PACKED; | ||
81 | GNUNET_HashCode service_descriptor GNUNET_PACKED; | ||
82 | uint64_t ports GNUNET_PACKED; | ||
83 | uint32_t service_type GNUNET_PACKED; | ||
84 | }; | ||
85 | |||
86 | |||
87 | struct answer_packet | ||
88 | { | ||
89 | /* General data */ | ||
90 | struct GNUNET_MessageHeader hdr; | ||
91 | enum GNUNET_DNS_ANSWER_Subtype subtype GNUNET_PACKED; | ||
92 | |||
93 | char from[16]; | ||
94 | char to[16]; | ||
95 | char addrlen; | ||
96 | unsigned dst_port:16 GNUNET_PACKED; | ||
97 | /* -- */ | ||
98 | |||
99 | /* Data for GNUNET_DNS_ANSWER_TYPE_SERVICE */ | ||
100 | struct GNUNET_vpn_service_descriptor service_descr; | ||
101 | /* -- */ | ||
102 | |||
103 | /* Data for GNUNET_DNS_ANSWER_TYPE_REV */ | ||
104 | /* The offsett in octets from the beginning of the struct to the field | ||
105 | * in data where the IP-Address has to go. */ | ||
106 | uint16_t addroffset GNUNET_PACKED; | ||
107 | /* -- */ | ||
108 | |||
109 | /* Data for GNUNET_DNS_ANSWER_TYPE_REMOTE */ | ||
110 | /* either 4 or 16 */ | ||
111 | char addrsize; | ||
112 | unsigned char addr[16]; | ||
113 | /* -- */ | ||
114 | |||
115 | unsigned char data[1]; | ||
116 | }; | ||
117 | GNUNET_NETWORK_STRUCT_END | ||
118 | |||
119 | |||
120 | 95 | ||
121 | /** | 96 | /** |
122 | * Type of a function to be called by the DNS API whenever | 97 | * Signature of a function that is called whenever the DNS service |
123 | * a DNS reply is obtained. | 98 | * encounters a DNS request and needs to do something with it. The |
99 | * function has then the chance to generate or modify the response by | ||
100 | * calling one of the three "GNUNET_DNS_request_*" continuations. | ||
101 | * | ||
102 | * When a request is intercepted, this function is called first to | ||
103 | * give the client a chance to do the complete address resolution; | ||
104 | * "rdata" will be NULL for this first call for a DNS request, unless | ||
105 | * some other client has already filled in a response. | ||
106 | * | ||
107 | * If multiple clients exist, all of them are called before the global | ||
108 | * DNS. The global DNS is only called if all of the clients' | ||
109 | * functions call GNUNET_DNS_request_forward. Functions that call | ||
110 | * GNUNET_DNS_request_forward will be called again before a final | ||
111 | * response is returned to the application. If any of the clients' | ||
112 | * functions call GNUNET_DNS_request_drop, the response is dropped. | ||
124 | * | 113 | * |
125 | * @param cls closure | 114 | * @param cls closure |
126 | * @param pkt reply that we got | 115 | * @param rh request handle to user for reply |
116 | * @param request_length number of bytes in request | ||
117 | * @param request udp payload of the DNS request | ||
127 | */ | 118 | */ |
128 | typedef void (*GNUNET_DNS_ResponseCallback)(void *cls, | 119 | typedef void (*GNUNET_DNS_RequestHandler)(void *cls, |
129 | const struct answer_packet *pkt); | 120 | struct GNUNET_DNS_RequestHandle *rh, |
121 | size_t request_length, | ||
122 | const char *request); | ||
130 | 123 | ||
131 | 124 | ||
132 | /** | 125 | /** |
133 | * Opaque DNS handle | 126 | * If a GNUNET_DNS_RequestHandler calls this function, the client |
134 | */ | 127 | * has no desire to interfer with the request and it should |
135 | struct GNUNET_DNS_Handle; | 128 | * continue to be processed normally. |
136 | |||
137 | |||
138 | /** | ||
139 | * Connect to the service-dns | ||
140 | * | 129 | * |
141 | * @param cfg configuration to use | 130 | * @param rh request that should now be forwarded |
142 | * @param cb function to call with DNS replies | ||
143 | * @param cb_cls closure to pass to cb | ||
144 | * @return DNS handle | ||
145 | */ | 131 | */ |
146 | struct GNUNET_DNS_Handle * | 132 | void |
147 | GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 133 | GNUNET_DNS_request_forward (struct GNUNET_DNS_RequestHandle *rh); |
148 | GNUNET_DNS_ResponseCallback cb, | ||
149 | void *cb_cls); | ||
150 | 134 | ||
151 | 135 | ||
152 | /** | 136 | /** |
153 | * Signal the DNS service that it needs to re-initialize the DNS | 137 | * If a GNUNET_DNS_RequestHandler calls this function, the request is |
154 | * hijacking (the network setup has changed significantly). | 138 | * to be dropped and no response should be generated. |
155 | * | 139 | * |
156 | * @param h DNS handle | 140 | * @param rh request that should now be dropped |
157 | */ | 141 | */ |
158 | void | 142 | void |
159 | GNUNET_DNS_restart_hijack (struct GNUNET_DNS_Handle *h); | 143 | GNUNET_DNS_request_drop (struct GNUNET_DNS_RequestHandle *rh); |
160 | 144 | ||
161 | 145 | ||
162 | /** | 146 | /** |
163 | * Process a DNS request sent to an IPv4 resolver. Pass it | 147 | * If a GNUNET_DNS_RequestHandler calls this function, the request is |
164 | * to the DNS service for resolution. | 148 | * supposed to be answered with the data provided to this call (with |
149 | * the modifications the function might have made). The reply given | ||
150 | * must always be a valid DNS reply and not a mutated DNS request. | ||
165 | * | 151 | * |
166 | * @param h DNS handle | 152 | * @param rh request that should now be answered |
167 | * @param dst_ip destination IPv4 address | 153 | * @param reply_length size of reply (uint16_t to force sane size) |
168 | * @param src_ip source IPv4 address (usually local machine) | 154 | * @param reply reply data |
169 | * @param src_port source port (to be used for reply) | ||
170 | * @param udp_packet_len length of the UDP payload in bytes | ||
171 | * @param udp_packet UDP payload | ||
172 | */ | 155 | */ |
173 | void | 156 | void |
174 | GNUNET_DNS_queue_request_v4 (struct GNUNET_DNS_Handle *h, | 157 | GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh, |
175 | const struct in_addr *dst_ip, | 158 | uint16_t reply_length, |
176 | const struct in_addr *src_ip, | 159 | const char *reply); |
177 | uint16_t src_port, | 160 | |
178 | size_t udp_packet_len, | ||
179 | const char *udp_packet); | ||
180 | 161 | ||
181 | /** | 162 | /** |
182 | * Process a DNS request sent to an IPv6 resolver. Pass it | 163 | * Connect to the service-dns |
183 | * to the DNS service for resolution. | ||
184 | * | 164 | * |
185 | * @param h DNS handle | 165 | * @param cfg configuration to use |
186 | * @param dst_ip destination IPv6 address | 166 | * @param flags when to call rh |
187 | * @param src_ip source IPv6 address (usually local machine) | 167 | * @param rh function to call with DNS requests |
188 | * @param src_port source port (to be used for reply) | 168 | * @param rh_cls closure to pass to rh |
189 | * @param udp_packet_len length of the UDP payload in bytes | 169 | * @return DNS handle |
190 | * @param udp_packet UDP payload | ||
191 | */ | 170 | */ |
192 | void | 171 | struct GNUNET_DNS_Handle * |
193 | GNUNET_DNS_queue_request_v6 (struct GNUNET_DNS_Handle *h, | 172 | GNUNET_DNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
194 | const struct in6_addr *dst_ip, | 173 | enum GNUNET_DNS_Flags flags, |
195 | const struct in6_addr *src_ip, | 174 | GNUNET_DNS_RequestHandler rh, |
196 | uint16_t src_port, | 175 | void *rh_cls); |
197 | size_t udp_packet_len, | 176 | |
198 | const char *udp_packet); | ||
199 | 177 | ||
200 | /** | 178 | /** |
201 | * Disconnect from the DNS service. | 179 | * Disconnect from the DNS service. |
202 | * | 180 | * |
203 | * @param h DNS handle | 181 | * @param dh DNS handle |
204 | */ | 182 | */ |
205 | void | 183 | void |
206 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *h); | 184 | GNUNET_DNS_disconnect (struct GNUNET_DNS_Handle *dh); |
207 | 185 | ||
208 | #endif | 186 | #endif |
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h index 6654394be..a1fb920a7 100644 --- a/src/include/gnunet_dnsparser_lib.h +++ b/src/include/gnunet_dnsparser_lib.h | |||
@@ -394,97 +394,4 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
394 | size_t *buf_length); | 394 | size_t *buf_length); |
395 | 395 | ||
396 | 396 | ||
397 | |||
398 | |||
399 | /* legacy API below */ | ||
400 | |||
401 | // DNS-Stuff | ||
402 | GNUNET_NETWORK_STRUCT_BEGIN | ||
403 | |||
404 | struct dns_static | ||
405 | { | ||
406 | uint16_t id GNUNET_PACKED; | ||
407 | |||
408 | unsigned rd:1 GNUNET_PACKED; // recursion desired (client -> server) | ||
409 | unsigned tc:1 GNUNET_PACKED; // message is truncated | ||
410 | unsigned aa:1 GNUNET_PACKED; // authoritative answer | ||
411 | unsigned op:4 GNUNET_PACKED; // query:0, inverse q.:1, status: 2 | ||
412 | unsigned qr:1 GNUNET_PACKED; // query:0, response:1 | ||
413 | |||
414 | unsigned rcode:4 GNUNET_PACKED; // 0 No error | ||
415 | // 1 Format error | ||
416 | // 2 Server failure | ||
417 | // 3 Name Error | ||
418 | // 4 Not Implemented | ||
419 | // 5 Refused | ||
420 | unsigned z:3 GNUNET_PACKED; // reserved | ||
421 | unsigned ra:1 GNUNET_PACKED; // recursion available (server -> client) | ||
422 | |||
423 | uint16_t qdcount GNUNET_PACKED; // number of questions | ||
424 | uint16_t ancount GNUNET_PACKED; // number of answers | ||
425 | uint16_t nscount GNUNET_PACKED; // number of authority-records | ||
426 | uint16_t arcount GNUNET_PACKED; // number of additional records | ||
427 | }; | ||
428 | GNUNET_NETWORK_STRUCT_END | ||
429 | |||
430 | |||
431 | struct dns_pkt | ||
432 | { | ||
433 | struct dns_static s; | ||
434 | unsigned char data[1]; | ||
435 | }; | ||
436 | |||
437 | struct dns_pkt_parsed | ||
438 | { | ||
439 | struct dns_static s; | ||
440 | struct dns_query **queries; | ||
441 | struct dns_record **answers; | ||
442 | struct dns_record **nameservers; | ||
443 | struct dns_record **additional; | ||
444 | }; | ||
445 | |||
446 | struct dns_query_line | ||
447 | { | ||
448 | uint16_t type; | ||
449 | uint16_t class; | ||
450 | }; | ||
451 | |||
452 | struct dns_query | ||
453 | { | ||
454 | char *name; | ||
455 | unsigned char namelen; | ||
456 | uint16_t qtype; | ||
457 | uint16_t qclass; | ||
458 | }; | ||
459 | |||
460 | struct dns_record_line | ||
461 | { | ||
462 | uint16_t type; | ||
463 | uint16_t class; | ||
464 | uint32_t ttl; | ||
465 | uint16_t data_len; | ||
466 | unsigned char data; | ||
467 | }; | ||
468 | |||
469 | struct dns_record | ||
470 | { | ||
471 | char *name; | ||
472 | unsigned char namelen; | ||
473 | uint16_t type; | ||
474 | uint16_t class; | ||
475 | uint32_t ttl; | ||
476 | uint16_t data_len; | ||
477 | unsigned char *data; | ||
478 | }; | ||
479 | |||
480 | |||
481 | struct dns_pkt_parsed * | ||
482 | parse_dns_packet (struct dns_pkt *pkt); | ||
483 | |||
484 | struct dns_pkt * | ||
485 | unparse_dns_packet (struct dns_pkt_parsed *pkt); | ||
486 | |||
487 | void | ||
488 | free_parsed_dns_packet (struct dns_pkt_parsed *ppkt); | ||
489 | |||
490 | #endif | 397 | #endif |