diff options
Diffstat (limited to 'src/gnsrecord/gnsrecord.c')
-rw-r--r-- | src/gnsrecord/gnsrecord.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c index 35005b5ca..b80d86073 100644 --- a/src/gnsrecord/gnsrecord.c +++ b/src/gnsrecord/gnsrecord.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013 GNUnet e.V. | 3 | Copyright (C) 2009-2013 GNUnet e.V. |
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 it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
@@ -30,7 +28,9 @@ | |||
30 | #include "gnunet_constants.h" | 28 | #include "gnunet_constants.h" |
31 | #include "gnunet_gnsrecord_lib.h" | 29 | #include "gnunet_gnsrecord_lib.h" |
32 | #include "gnunet_gnsrecord_plugin.h" | 30 | #include "gnunet_gnsrecord_plugin.h" |
31 | #include "gnunet_json_lib.h" | ||
33 | #include "gnunet_tun_lib.h" | 32 | #include "gnunet_tun_lib.h" |
33 | #include <jansson.h> | ||
34 | 34 | ||
35 | 35 | ||
36 | #define LOG(kind,...) GNUNET_log_from (kind, "gnsrecord",__VA_ARGS__) | 36 | #define LOG(kind,...) GNUNET_log_from (kind, "gnsrecord",__VA_ARGS__) |
@@ -114,10 +114,9 @@ init () | |||
114 | void __attribute__ ((destructor)) | 114 | void __attribute__ ((destructor)) |
115 | GNSRECORD_fini () | 115 | GNSRECORD_fini () |
116 | { | 116 | { |
117 | unsigned int i; | ||
118 | struct Plugin *plugin; | 117 | struct Plugin *plugin; |
119 | 118 | ||
120 | for (i = 0; i < num_plugins; i++) | 119 | for (unsigned int i = 0; i < num_plugins; i++) |
121 | { | 120 | { |
122 | plugin = gns_plugins[i]; | 121 | plugin = gns_plugins[i]; |
123 | GNUNET_break (NULL == | 122 | GNUNET_break (NULL == |
@@ -146,12 +145,11 @@ GNUNET_GNSRECORD_value_to_string (uint32_t type, | |||
146 | const void *data, | 145 | const void *data, |
147 | size_t data_size) | 146 | size_t data_size) |
148 | { | 147 | { |
149 | unsigned int i; | ||
150 | struct Plugin *plugin; | 148 | struct Plugin *plugin; |
151 | char *ret; | 149 | char *ret; |
152 | 150 | ||
153 | init (); | 151 | init (); |
154 | for (i = 0; i < num_plugins; i++) | 152 | for (unsigned int i = 0; i < num_plugins; i++) |
155 | { | 153 | { |
156 | plugin = gns_plugins[i]; | 154 | plugin = gns_plugins[i]; |
157 | if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls, | 155 | if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls, |
@@ -180,11 +178,10 @@ GNUNET_GNSRECORD_string_to_value (uint32_t type, | |||
180 | void **data, | 178 | void **data, |
181 | size_t *data_size) | 179 | size_t *data_size) |
182 | { | 180 | { |
183 | unsigned int i; | ||
184 | struct Plugin *plugin; | 181 | struct Plugin *plugin; |
185 | 182 | ||
186 | init (); | 183 | init (); |
187 | for (i = 0; i < num_plugins; i++) | 184 | for (unsigned int i = 0; i < num_plugins; i++) |
188 | { | 185 | { |
189 | plugin = gns_plugins[i]; | 186 | plugin = gns_plugins[i]; |
190 | if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls, | 187 | if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls, |
@@ -207,7 +204,6 @@ GNUNET_GNSRECORD_string_to_value (uint32_t type, | |||
207 | uint32_t | 204 | uint32_t |
208 | GNUNET_GNSRECORD_typename_to_number (const char *dns_typename) | 205 | GNUNET_GNSRECORD_typename_to_number (const char *dns_typename) |
209 | { | 206 | { |
210 | unsigned int i; | ||
211 | struct Plugin *plugin; | 207 | struct Plugin *plugin; |
212 | uint32_t ret; | 208 | uint32_t ret; |
213 | 209 | ||
@@ -215,7 +211,7 @@ GNUNET_GNSRECORD_typename_to_number (const char *dns_typename) | |||
215 | "ANY")) | 211 | "ANY")) |
216 | return GNUNET_GNSRECORD_TYPE_ANY; | 212 | return GNUNET_GNSRECORD_TYPE_ANY; |
217 | init (); | 213 | init (); |
218 | for (i = 0; i < num_plugins; i++) | 214 | for (unsigned int i = 0; i < num_plugins; i++) |
219 | { | 215 | { |
220 | plugin = gns_plugins[i]; | 216 | plugin = gns_plugins[i]; |
221 | if (UINT32_MAX != (ret = plugin->api->typename_to_number (plugin->api->cls, | 217 | if (UINT32_MAX != (ret = plugin->api->typename_to_number (plugin->api->cls, |
@@ -235,14 +231,13 @@ GNUNET_GNSRECORD_typename_to_number (const char *dns_typename) | |||
235 | const char * | 231 | const char * |
236 | GNUNET_GNSRECORD_number_to_typename (uint32_t type) | 232 | GNUNET_GNSRECORD_number_to_typename (uint32_t type) |
237 | { | 233 | { |
238 | unsigned int i; | ||
239 | struct Plugin *plugin; | 234 | struct Plugin *plugin; |
240 | const char * ret; | 235 | const char * ret; |
241 | 236 | ||
242 | if (GNUNET_GNSRECORD_TYPE_ANY == type) | 237 | if (GNUNET_GNSRECORD_TYPE_ANY == type) |
243 | return "ANY"; | 238 | return "ANY"; |
244 | init (); | 239 | init (); |
245 | for (i = 0; i < num_plugins; i++) | 240 | for (unsigned int i = 0; i < num_plugins; i++) |
246 | { | 241 | { |
247 | plugin = gns_plugins[i]; | 242 | plugin = gns_plugins[i]; |
248 | if (NULL != (ret = plugin->api->number_to_typename (plugin->api->cls, | 243 | if (NULL != (ret = plugin->api->number_to_typename (plugin->api->cls, |
@@ -252,5 +247,4 @@ GNUNET_GNSRECORD_number_to_typename (uint32_t type) | |||
252 | return NULL; | 247 | return NULL; |
253 | } | 248 | } |
254 | 249 | ||
255 | |||
256 | /* end of gnsrecord.c */ | 250 | /* end of gnsrecord.c */ |