aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gns/Makefile.am32
-rw-r--r--src/gns/gns.conf.in3
-rw-r--r--src/gns/gns_api.c87
-rw-r--r--src/gns/gnunet-service-gns.c139
-rw-r--r--src/gns/test_gns_simple_lookup.c68
-rw-r--r--src/gns/test_gns_simple_lookup.conf2
-rw-r--r--src/gns/test_gns_simple_shorten.c9
-rw-r--r--src/include/gnunet_gns_service.h15
8 files changed, 289 insertions, 66 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 65081436f..912468774 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -27,7 +27,8 @@ bin_PROGRAMS = \
27# gnunet-gns-lookup 27# gnunet-gns-lookup
28 28
29check_PROGRAMS = \ 29check_PROGRAMS = \
30 test_gns_simple_shorten 30 test_gns_simple_shorten \
31 test_gns_simple_lookup
31 32
32 33
33# test_gns_simple_lookup 34# test_gns_simple_lookup
@@ -49,16 +50,18 @@ plugin_LTLIBRARIES = \
49# $(top_builddir)/src/namestore/libgnunetnamestore.la \ 50# $(top_builddir)/src/namestore/libgnunetnamestore.la \
50# $(top_builddir)/src/testing/libgnunettesting.la 51# $(top_builddir)/src/testing/libgnunettesting.la
51 52
52#test_gns_simple_lookup_SOURCES = \ 53test_gns_simple_lookup_SOURCES = \
53# test_gns_simple_lookup.c 54 test_gns_simple_lookup.c
54#test_gns_simple_lookup_LDADD = \ 55test_gns_simple_lookup_LDADD = \
55# $(top_builddir)/src/util/libgnunetutil.la \ 56 $(top_builddir)/src/util/libgnunetutil.la \
56# $(top_builddir)/src/namestore/libgnunetnamestore.la \ 57 $(top_builddir)/src/namestore/libgnunetnamestore.la \
57# $(top_builddir)/src/testing/libgnunettesting.la 58 $(top_builddir)/src/gns/libgnunetgns.la \
58#test_gns_simple_lookup_DEPENDENCIES = \ 59 $(top_builddir)/src/testing/libgnunettesting.la
59# $(top_builddir)/src/util/libgnunetutil.la \ 60test_gns_simple_lookup_DEPENDENCIES = \
60# $(top_builddir)/src/namestore/libgnunetnamestore.la \ 61 $(top_builddir)/src/util/libgnunetutil.la \
61# $(top_builddir)/src/testing/libgnunettesting.la 62 $(top_builddir)/src/namestore/libgnunetnamestore.la \
63 $(top_builddir)/src/gns/libgnunetgns.la \
64 $(top_builddir)/src/testing/libgnunettesting.la
62 65
63#test_gns_simple_delegated_lookup_SOURCES = \ 66#test_gns_simple_delegated_lookup_SOURCES = \
64# test_gns_simple_delegated_lookup.c 67# test_gns_simple_delegated_lookup.c
@@ -104,6 +107,7 @@ gnunet_gns_SOURCES = \
104gnunet_gns_LDADD = \ 107gnunet_gns_LDADD = \
105 $(top_builddir)/src/gns/libgnunetgns.la \ 108 $(top_builddir)/src/gns/libgnunetgns.la \
106 $(top_builddir)/src/util/libgnunetutil.la \ 109 $(top_builddir)/src/util/libgnunetutil.la \
110 $(top_builddir)/src/namestore/libgnunetnamestore.la \
107 $(GN_LIBINTL) 111 $(GN_LIBINTL)
108gnunet_gns_DEPENDENCIES = \ 112gnunet_gns_DEPENDENCIES = \
109 libgnunetgns.la 113 libgnunetgns.la
@@ -145,11 +149,13 @@ gnunet_gns_fcfsd_DEPENDENCIES = \
145libgnunetgns_la_SOURCES = \ 149libgnunetgns_la_SOURCES = \
146 gns_api.c gns.h 150 gns_api.c gns.h
147libgnunetgns_la_LIBADD = \ 151libgnunetgns_la_LIBADD = \
148 $(top_builddir)/src/util/libgnunetutil.la $(XLIB) 152 $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \
153 $(top_builddir)/src/namestore/libgnunetnamestore.la
149libgnunetgns_la_LDFLAGS = \ 154libgnunetgns_la_LDFLAGS = \
150 $(GN_LIB_LDFLAGS) 155 $(GN_LIB_LDFLAGS)
151libgnunetgns_la_DEPENDENCIES = \ 156libgnunetgns_la_DEPENDENCIES = \
152 $(top_builddir)/src/util/libgnunetutil.la 157 $(top_builddir)/src/util/libgnunetutil.la \
158 $(top_builddir)/src/namestore/libgnunetnamestore.la
153 159
154libgnunet_plugin_block_gns_la_SOURCES = \ 160libgnunet_plugin_block_gns_la_SOURCES = \
155 plugin_block_gns.c 161 plugin_block_gns.c
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 07a955a9c..a2286f232 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -6,8 +6,7 @@ CONFIG = $DEFAULTCONFIG
6BINARY = gnunet-service-gns 6BINARY = gnunet-service-gns
7UNIXPATH = /tmp/gnunet-service-gns.sock 7UNIXPATH = /tmp/gnunet-service-gns.sock
8ZONEKEY = $SERVICEHOME/gns/zonekey 8ZONEKEY = $SERVICEHOME/gns/zonekey
9HIJACK_DNS = YES 9HIJACK_DNS = NO
10OPTIONS = -L INFO
11 10
12[fcfsd] 11[fcfsd]
13HTTPPORT = 18080 12HTTPPORT = 18080
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 47efe5058..f9aa63335 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -35,10 +35,6 @@
35#include "gns.h" 35#include "gns.h"
36#include "gnunet_gns_service.h" 36#include "gnunet_gns_service.h"
37 37
38#define DEBUG_GNS_API GNUNET_EXTRA_LOGGING
39
40#define LOG(kind,...) GNUNET_log_from (kind, "gns-api",__VA_ARGS__)
41
42/* TODO into gnunet_protocols */ 38/* TODO into gnunet_protocols */
43#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP 23 39#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP 23
44#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT 24 40#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT 24
@@ -67,7 +63,10 @@ struct GNUNET_GNS_QueueEntry
67 struct GNUNET_GNS_Handle *gns_handle; 63 struct GNUNET_GNS_Handle *gns_handle;
68 64
69 /* processor to call on shorten result */ 65 /* processor to call on shorten result */
70 GNUNET_GNS_ShortenResultProcessor proc; 66 GNUNET_GNS_ShortenResultProcessor shorten_proc;
67
68 /* processor to call on lookup result */
69 GNUNET_GNS_LookupResultProcessor lookup_proc;
71 70
72 /* processor closure */ 71 /* processor closure */
73 void *proc_cls; 72 void *proc_cls;
@@ -355,7 +354,7 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe,
355 "Received shortened reply `%s' from GNS service\n", 354 "Received shortened reply `%s' from GNS service\n",
356 short_name); 355 short_name);
357 356
358 qe->proc(qe->proc_cls, short_name); 357 qe->shorten_proc(qe->proc_cls, short_name);
359 358
360} 359}
361 360
@@ -373,6 +372,31 @@ static void
373process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe, 372process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe,
374 const struct GNUNET_GNS_ClientLookupResultMessage *msg) 373 const struct GNUNET_GNS_ClientLookupResultMessage *msg)
375{ 374{
375 struct GNUNET_GNS_Handle *h = qe->gns_handle;
376 int rd_count = ntohl(msg->rd_count);
377 size_t len = ntohs (((struct GNUNET_MessageHeader*)msg)->size);
378 struct GNUNET_NAMESTORE_RecordData rd[rd_count];
379
380 GNUNET_CONTAINER_DLL_remove(h->lookup_head, h->lookup_tail, qe);
381
382 if (len < sizeof (struct GNUNET_GNS_ClientLookupResultMessage))
383 {
384 GNUNET_break (0);
385 force_reconnect (h);
386 return;
387 }
388
389 len -= sizeof(struct GNUNET_GNS_ClientLookupResultMessage);
390
391 GNUNET_NAMESTORE_records_deserialize (len, (char*)&msg[1],
392 rd_count,
393 rd);
394
395 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
396 "Received lookup reply from GNS service (count=%d)\n",
397 ntohl(msg->rd_count));
398
399 qe->lookup_proc(qe->proc_cls, rd_count, rd);
376} 400}
377 401
378/** 402/**
@@ -522,12 +546,51 @@ get_request_id (struct GNUNET_GNS_Handle *h)
522 */ 546 */
523struct GNUNET_GNS_QueueEntry * 547struct GNUNET_GNS_QueueEntry *
524GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, 548GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
525 const char * name, 549 const char * name,
526 enum GNUNET_GNS_RecordType type, 550 enum GNUNET_GNS_RecordType type,
527 GNUNET_GNS_LookupIterator iter, 551 GNUNET_GNS_LookupResultProcessor proc,
528 void *iter_cls) 552 void *proc_cls)
529{ 553{
530 return NULL; 554 /* IPC to shorten gns names, return shorten_handle */
555 struct GNUNET_GNS_ClientLookupMessage *lookup_msg;
556 struct GNUNET_GNS_QueueEntry *qe;
557 size_t msize;
558 struct PendingMessage *pending;
559
560 if (NULL == name)
561 {
562 return NULL;
563 }
564
565 msize = sizeof (struct GNUNET_GNS_ClientLookupMessage) + strlen(name) + 1;
566 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to shorten %s in GNS\n", name);
567
568 qe = GNUNET_malloc(sizeof (struct GNUNET_GNS_QueueEntry));
569 qe->gns_handle = handle;
570 qe->lookup_proc = proc;
571 qe->proc_cls = proc_cls;
572 qe->r_id = get_request_id(handle);
573 GNUNET_CONTAINER_DLL_insert_tail(handle->lookup_head,
574 handle->lookup_tail, qe);
575
576 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
577 memset(pending, 0, (sizeof (struct PendingMessage) + msize));
578
579 pending->size = msize;
580
581 lookup_msg = (struct GNUNET_GNS_ClientLookupMessage *) &pending[1];
582 lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP);
583 lookup_msg->header.size = htons (msize);
584 lookup_msg->id = htonl(qe->r_id);
585 lookup_msg->type = htonl(type);
586
587 memcpy(&lookup_msg[1], name, strlen(name));
588
589 GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
590 pending);
591
592 process_pending_messages (handle);
593 return qe;
531} 594}
532 595
533 596
@@ -562,7 +625,7 @@ GNUNET_GNS_shorten (struct GNUNET_GNS_Handle *handle,
562 625
563 qe = GNUNET_malloc(sizeof (struct GNUNET_GNS_QueueEntry)); 626 qe = GNUNET_malloc(sizeof (struct GNUNET_GNS_QueueEntry));
564 qe->gns_handle = handle; 627 qe->gns_handle = handle;
565 qe->proc = proc; 628 qe->shorten_proc = proc;
566 qe->proc_cls = proc_cls; 629 qe->proc_cls = proc_cls;
567 qe->r_id = get_request_id(handle); 630 qe->r_id = get_request_id(handle);
568 GNUNET_CONTAINER_DLL_insert_tail(handle->shorten_head, 631 GNUNET_CONTAINER_DLL_insert_tail(handle->shorten_head,
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index ce83af60d..19195d419 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -153,8 +153,8 @@ struct ClientShortenHandle
153 /* request id */ 153 /* request id */
154 uint64_t unique_id; 154 uint64_t unique_id;
155 155
156 /* request key */ 156 /* request type */
157 GNUNET_HashCode key; 157 enum GNUNET_GNS_RecordType type;
158 158
159 /* name to shorten */ 159 /* name to shorten */
160 char* name; 160 char* name;
@@ -172,8 +172,8 @@ struct ClientLookupHandle
172 /* request id */ 172 /* request id */
173 uint64_t unique_id; 173 uint64_t unique_id;
174 174
175 /* request key */ 175 /* request type */
176 GNUNET_HashCode key; 176 enum GNUNET_GNS_RecordType type;
177 177
178 /* the name to look up */ 178 /* the name to look up */
179 char* name; //Needed? 179 char* name; //Needed?
@@ -2229,13 +2229,142 @@ static void handle_shorten(void *cls,
2229} 2229}
2230 2230
2231/** 2231/**
2232 * TODO 2232 * Reply to client with the result from our lookup.
2233 *
2234 * @param cls the closure (our client lookup handle)
2235 * @param rh the request handle of the lookup
2236 * @param rd_count the number of records
2237 * @param rd the record data
2238 */
2239static void
2240reply_to_client(void* cls, struct GNUNET_GNS_ResolverHandle *rh,
2241 uint32_t rd_count,
2242 const struct GNUNET_NAMESTORE_RecordData *rd)
2243{
2244 struct ClientLookupHandle* clh = (struct ClientLookupHandle*)cls;
2245 struct GNUNET_GNS_ClientLookupResultMessage *rmsg;
2246 size_t len;
2247
2248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with %d results\n",
2249 "LOOKUP_RESULT", rd_count);
2250
2251 len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
2252 rmsg = GNUNET_malloc(len+sizeof(struct GNUNET_GNS_ClientLookupResultMessage));
2253
2254 rmsg->id = clh->unique_id;
2255 rmsg->rd_count = htonl(rd_count);
2256 rmsg->header.type = htons(GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT);
2257 rmsg->header.size =
2258 htons(len+sizeof(struct GNUNET_GNS_ClientLookupResultMessage));
2259
2260 GNUNET_NAMESTORE_records_serialize (rd_count, rd, len, (char*)&rmsg[1]);
2261
2262 GNUNET_SERVER_notification_context_unicast (nc, clh->client,
2263 (const struct GNUNET_MessageHeader *) rmsg,
2264 GNUNET_NO);
2265 GNUNET_SERVER_receive_done (clh->client, GNUNET_OK);
2266 GNUNET_free(rmsg);
2267 GNUNET_free(clh->name);
2268 GNUNET_free(clh);
2269
2270}
2271
2272/**
2273 * Lookup a given name
2274 *
2275 * @param name the name to looku[
2276 * @param clh the client lookup handle
2277 */
2278static void
2279lookup_name(char* name, struct ClientLookupHandle* clh)
2280{
2281
2282 struct GNUNET_GNS_ResolverHandle *rh;
2283 struct RecordLookupHandle* rlh;
2284
2285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2286 "Starting resolution for %s (type=%d)!\n",
2287 name, clh->type);
2288
2289 rh = GNUNET_malloc(sizeof (struct GNUNET_GNS_ResolverHandle));
2290 rlh = GNUNET_malloc(sizeof(struct RecordLookupHandle));
2291
2292 rh->authority = zone_hash;
2293
2294 rlh->record_type = clh->type;
2295 rlh->name = clh->name;
2296 rlh->proc = &reply_to_client;
2297 rlh->proc_cls = clh;
2298
2299 rh->proc_cls = rlh;
2300
2301 rh->name = GNUNET_malloc(strlen(name)
2302 - strlen(gnunet_tld) + 1);
2303 memset(rh->name, 0,
2304 strlen(name)-strlen(gnunet_tld) + 1);
2305 memcpy(rh->name, name,
2306 strlen(name)-strlen(gnunet_tld));
2307
2308 rh->authority_name = GNUNET_malloc(sizeof(char)*MAX_DNS_LABEL_LENGTH);
2309
2310 rh->authority_chain_head = GNUNET_malloc(sizeof(struct AuthorityChain));
2311 rh->authority_chain_head->prev = NULL;
2312 rh->authority_chain_head->next = NULL;
2313 rh->authority_chain_tail = rh->authority_chain_head;
2314 rh->authority_chain_head->zone = zone_hash;
2315
2316 /* Start resolution in our zone */
2317 rh->proc = &process_ns_delegation_dns; //FIXME rename
2318 resolve_delegation_from_ns(rh);
2319}
2320
2321
2322/**
2323 * Handle lookup requests from client
2324 *
2325 * @param cls the closure
2326 * @param client the client
2327 * @param message the message
2233 */ 2328 */
2234static void 2329static void
2235handle_lookup(void *cls, 2330handle_lookup(void *cls,
2236 struct GNUNET_SERVER_Client * client, 2331 struct GNUNET_SERVER_Client * client,
2237 const struct GNUNET_MessageHeader * message) 2332 const struct GNUNET_MessageHeader * message)
2238{ 2333{
2334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "LOOKUP");
2335
2336 size_t msg_size = 0;
2337 struct ClientLookupHandle *clh;
2338
2339 if (ntohs (message->size) < sizeof (struct GNUNET_GNS_ClientLookupMessage))
2340 {
2341 GNUNET_break_op (0);
2342 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2343 return;
2344 }
2345
2346 GNUNET_SERVER_notification_context_add (nc, client);
2347
2348 struct GNUNET_GNS_ClientLookupMessage *sh_msg =
2349 (struct GNUNET_GNS_ClientLookupMessage *) message;
2350
2351 msg_size = ntohs(message->size);
2352
2353 if (msg_size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
2354 {
2355 GNUNET_break_op (0);
2356 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2357 return;
2358 }
2359
2360 clh = GNUNET_malloc(sizeof(struct ClientLookupHandle));
2361 clh->client = client;
2362 clh->name = GNUNET_malloc(strlen((char*)&sh_msg[1]) + 1);
2363 strcpy(clh->name, (char*)&sh_msg[1]);
2364 clh->unique_id = sh_msg->id;
2365 clh->type = ntohl(sh_msg->type);
2366
2367 lookup_name((char*)&sh_msg[1], clh);
2239} 2368}
2240 2369
2241/** 2370/**
diff --git a/src/gns/test_gns_simple_lookup.c b/src/gns/test_gns_simple_lookup.c
index d75ff2d28..0142677d7 100644
--- a/src/gns/test_gns_simple_lookup.c
+++ b/src/gns/test_gns_simple_lookup.c
@@ -77,6 +77,8 @@ static int ok;
77 77
78static struct GNUNET_NAMESTORE_Handle *namestore_handle; 78static struct GNUNET_NAMESTORE_Handle *namestore_handle;
79 79
80static struct GNUNET_GNS_Handle *gns_handle;
81
80const struct GNUNET_CONFIGURATION_Handle *cfg; 82const struct GNUNET_CONFIGURATION_Handle *cfg;
81 83
82/** 84/**
@@ -95,41 +97,39 @@ shutdown_callback (void *cls, const char *emsg)
95 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok); 97 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok);
96} 98}
97 99
98/** 100
99 * Function scheduled to be run on the successful start of services
100 * tries to look up the dns record for TEST_DOMAIN
101 */
102static void 101static void
103finish_testing (void *cls, int32_t success, const char *emsg) 102on_lookup_result(void *cls, uint32_t rd_count,
103 const struct GNUNET_NAMESTORE_RecordData *rd)
104{ 104{
105 struct hostent *he;
106 struct in_addr a; 105 struct in_addr a;
106 int i;
107 char* addr; 107 char* addr;
108 108
109 GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES); 109 if (rd_count == 0)
110
111 he = gethostbyname (TEST_DOMAIN);
112
113 if (!he)
114 { 110 {
115 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 111 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
116 "gethostbyname failed, rp_filtering?\n"); 112 "Lookup failed, rp_filtering?\n");
117 ok = 2; 113 ok = 2;
118 } 114 }
119 else 115 else
120 { 116 {
121 ok = 1; 117 ok = 1;
122 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", he->h_name); 118 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
123 while (*he->h_addr_list) 119 for (i=0; i<rd_count; i++)
124 { 120 {
125 memcpy(&a, *he->h_addr_list++, sizeof(a)); 121 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
126 addr = inet_ntoa(a); 122 if (rd[i].record_type == GNUNET_GNS_RECORD_TYPE_A)
127 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
128 if (0 == strcmp(addr, TEST_IP))
129 { 123 {
130 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 124 memcpy(&a, rd[i].data, sizeof(a));
125 addr = inet_ntoa(a);
126 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
127 if (0 == strcmp(addr, TEST_IP))
128 {
129 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
131 "%s correctly resolved to %s!\n", TEST_DOMAIN, addr); 130 "%s correctly resolved to %s!\n", TEST_DOMAIN, addr);
132 ok = 0; 131 ok = 0;
132 }
133 } 133 }
134 else 134 else
135 { 135 {
@@ -142,6 +142,32 @@ finish_testing (void *cls, int32_t success, const char *emsg)
142 GNUNET_YES, GNUNET_NO); 142 GNUNET_YES, GNUNET_NO);
143} 143}
144 144
145
146/**
147 * Function scheduled to be run on the successful start of services
148 * tries to look up the dns record for TEST_DOMAIN
149 */
150static void
151commence_testing (void *cls, int32_t success, const char *emsg)
152{
153
154
155 GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES);
156
157 gns_handle = GNUNET_GNS_connect(cfg);
158
159 if (NULL == gns_handle)
160 {
161 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
162 "Failed to connect to GNS!\n");
163 ok = 2;
164 }
165
166 GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A,
167 &on_lookup_result, TEST_DOMAIN);
168}
169
170
145/** 171/**
146 * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut 172 * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut
147 * down the peers without freeing memory associated with GET request. 173 * down the peers without freeing memory associated with GET request.
@@ -216,7 +242,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
216 alice_key, 242 alice_key,
217 TEST_RECORD_NAME, 243 TEST_RECORD_NAME,
218 &rd, 244 &rd,
219 &finish_testing, 245 &commence_testing,
220 NULL); 246 NULL);
221 247
222} 248}
diff --git a/src/gns/test_gns_simple_lookup.conf b/src/gns/test_gns_simple_lookup.conf
index cda207a1e..da61f3d25 100644
--- a/src/gns/test_gns_simple_lookup.conf
+++ b/src/gns/test_gns_simple_lookup.conf
@@ -74,7 +74,7 @@ DNS_EXIT = 8.8.8.8
74AUTOSTART = YES 74AUTOSTART = YES
75BINARY = gnunet-service-gns 75BINARY = gnunet-service-gns
76ZONEKEY = zonekey 76ZONEKEY = zonekey
77HIJACK_DNS = YES 77HIJACK_DNS = NO
78UNIXPATH = /tmp/gnunet-service-gns.sock 78UNIXPATH = /tmp/gnunet-service-gns.sock
79HOME = $SERVICEHOME 79HOME = $SERVICEHOME
80CONFIG = $DEFAULTCONFIG 80CONFIG = $DEFAULTCONFIG
diff --git a/src/gns/test_gns_simple_shorten.c b/src/gns/test_gns_simple_shorten.c
index 0f36447f6..fc0c0f1f0 100644
--- a/src/gns/test_gns_simple_shorten.c
+++ b/src/gns/test_gns_simple_shorten.c
@@ -93,7 +93,7 @@ shutdown_callback (void *cls, const char *emsg)
93 * Called when gns shorten finishes 93 * Called when gns shorten finishes
94 */ 94 */
95static void 95static void
96process_shorten_result(void* cls, const char* lname, const char* sname) 96process_shorten_result(void* cls, const char* sname)
97{ 97{
98 GNUNET_GNS_disconnect(gns_handle); 98 GNUNET_GNS_disconnect(gns_handle);
99 99
@@ -108,12 +108,12 @@ process_shorten_result(void* cls, const char* lname, const char* sname)
108 else 108 else
109 { 109 {
110 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 110 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
111 "%s shortened to %s\n", lname, sname); 111 "%s shortened to %s\n", (char*)cls, sname);
112 if (0 != strcmp(sname, TEST_EXPECTED_RESULT)) 112 if (0 != strcmp(sname, TEST_EXPECTED_RESULT))
113 { 113 {
114 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 114 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
115 "shorten test failed! (wanted: %s got: %s\n", 115 "shorten test failed! (wanted: %s got: %s\n",
116 lname, sname); 116 (char*)cls, sname);
117 ok = 1; 117 ok = 1;
118 } 118 }
119 119
@@ -152,7 +152,8 @@ commence_testing (void *cls, int32_t success, const char *emsg)
152 return; 152 return;
153 } 153 }
154 154
155 GNUNET_GNS_shorten(gns_handle, TEST_DOMAIN, &process_shorten_result, NULL); 155 GNUNET_GNS_shorten(gns_handle, TEST_DOMAIN, &process_shorten_result,
156 TEST_DOMAIN);
156 157
157} 158}
158 159
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 60a2fb227..5ae7fbefe 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -104,7 +104,7 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
104/* *************** Standard API: lookup ******************* */ 104/* *************** Standard API: lookup ******************* */
105 105
106/** 106/**
107 * Iterator called on each result obtained for a GNS 107 * Iterator called on obtained result for a GNS
108 * lookup 108 * lookup
109 * 109 *
110 * @param cls closure 110 * @param cls closure
@@ -112,8 +112,7 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle);
112 * @param rd_count number of records 112 * @param rd_count number of records
113 * @param rd the records in reply 113 * @param rd the records in reply
114 */ 114 */
115typedef void (*GNUNET_GNS_LookupIterator) (void *cls, 115typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls,
116 const char * name,
117 uint32_t rd_count, 116 uint32_t rd_count,
118 const struct GNUNET_NAMESTORE_RecordData *rd); 117 const struct GNUNET_NAMESTORE_RecordData *rd);
119 118
@@ -125,17 +124,17 @@ typedef void (*GNUNET_GNS_LookupIterator) (void *cls,
125 * @param handle handle to the GNS service 124 * @param handle handle to the GNS service
126 * @param name the name to look up 125 * @param name the name to look up
127 * @param type the GNUNET_GNS_RecordType to look for 126 * @param type the GNUNET_GNS_RecordType to look for
128 * @param iter function to call on each result 127 * @param proc function to call on result
129 * @param iter_cls closure for iter 128 * @param proc_cls closure for iter
130 * 129 *
131 * @return handle to stop the async lookup 130 * @return handle to the queued request
132 */ 131 */
133struct GNUNET_GNS_QueueEntry * 132struct GNUNET_GNS_QueueEntry *
134GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, 133GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
135 const char * name, 134 const char * name,
136 enum GNUNET_GNS_RecordType type, 135 enum GNUNET_GNS_RecordType type,
137 GNUNET_GNS_LookupIterator iter, 136 GNUNET_GNS_LookupResultProcessor proc,
138 void *iter_cls); 137 void *proc_cls);
139 138
140 139
141/* *************** Standard API: shorten ******************* */ 140/* *************** Standard API: shorten ******************* */