aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-dht-get.c')
-rw-r--r--src/dht/gnunet-dht-get.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index b807a798f..161f0f41b 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -117,15 +117,14 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
117 * @param data pointer to the result data 117 * @param data pointer to the result data
118 */ 118 */
119void 119void
120get_result_iterator (void *cls, 120get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
121 struct GNUNET_TIME_Absolute exp,
122 const GNUNET_HashCode * key, 121 const GNUNET_HashCode * key,
123 const struct GNUNET_PeerIdentity *const *get_path, 122 const struct GNUNET_PeerIdentity *const *get_path,
124 const struct GNUNET_PeerIdentity *const *put_path, 123 const struct GNUNET_PeerIdentity *const *put_path,
125 enum GNUNET_BLOCK_Type type, size_t size, const void *data) 124 enum GNUNET_BLOCK_Type type, size_t size, const void *data)
126{ 125{
127 fprintf (stdout, "Result %d, type %d:\n%.*s\n", 126 fprintf (stdout, "Result %d, type %d:\n%.*s\n", result_count, type,
128 result_count, type, (unsigned int) size, (char *) data); 127 (unsigned int) size, (char *) data);
129 result_count++; 128 result_count++;
130} 129}
131 130
@@ -139,9 +138,8 @@ get_result_iterator (void *cls,
139 * @param c configuration 138 * @param c configuration
140 */ 139 */
141static void 140static void
142run (void *cls, 141run (void *cls, char *const *args, const char *cfgfile,
143 char *const *args, 142 const struct GNUNET_CONFIGURATION_Handle *c)
144 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
145{ 143{
146 struct GNUNET_TIME_Relative timeout; 144 struct GNUNET_TIME_Relative timeout;
147 GNUNET_HashCode key; 145 GNUNET_HashCode key;
@@ -181,14 +179,10 @@ run (void *cls,
181 fprintf (stderr, "Issuing GET request for %s!\n", query_key); 179 fprintf (stderr, "Issuing GET request for %s!\n", query_key);
182 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining 180 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
183 (absolute_timeout), &cleanup_task, NULL); 181 (absolute_timeout), &cleanup_task, NULL);
184 get_handle = GNUNET_DHT_get_start (dht_handle, 182 get_handle =
185 timeout, 183 GNUNET_DHT_get_start (dht_handle, timeout, query_type, &key,
186 query_type, 184 DEFAULT_GET_REPLICATION, GNUNET_DHT_RO_NONE, NULL,
187 &key, 185 0, NULL, 0, &get_result_iterator, NULL);
188 DEFAULT_GET_REPLICATION,
189 GNUNET_DHT_RO_NONE,
190 NULL, 0,
191 NULL, 0, &get_result_iterator, NULL);
192 186
193} 187}
194 188
@@ -224,9 +218,7 @@ int
224main (int argc, char *const *argv) 218main (int argc, char *const *argv)
225{ 219{
226 return (GNUNET_OK == 220 return (GNUNET_OK ==
227 GNUNET_PROGRAM_run (argc, 221 GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-get",
228 argv,
229 "gnunet-dht-get",
230 gettext_noop 222 gettext_noop
231 ("Issue a GET request to the GNUnet DHT, prints results."), 223 ("Issue a GET request to the GNUnet DHT, prints results."),
232 options, &run, NULL)) ? ret : 1; 224 options, &run, NULL)) ? ret : 1;