diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-28 14:02:20 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-28 14:02:20 +0000 |
commit | 39dceb2cfe324e3f1b44958e3cf4cb936ab76881 (patch) | |
tree | be84fba9fed2e859805475b6bff5a8bd3915e854 /src/namestore/namestore_api.c | |
parent | 50a4192766dd96f383020f9b2989b047155e4db3 (diff) | |
download | gnunet-39dceb2cfe324e3f1b44958e3cf4cb936ab76881.tar.gz gnunet-39dceb2cfe324e3f1b44958e3cf4cb936ab76881.zip |
extended plugin api to support lookup function
added new index to both plugins
implemented lookup functionality in both plugins
namestore uses lookup function
Diffstat (limited to 'src/namestore/namestore_api.c')
-rw-r--r-- | src/namestore/namestore_api.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 303b05c98..c05386908 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -300,6 +300,7 @@ handle_lookup_result (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
300 | size_t name_len; | 300 | size_t name_len; |
301 | size_t rd_len; | 301 | size_t rd_len; |
302 | unsigned int rd_count; | 302 | unsigned int rd_count; |
303 | int found; | ||
303 | 304 | ||
304 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 305 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
305 | "Received `%s'\n", | 306 | "Received `%s'\n", |
@@ -309,7 +310,7 @@ handle_lookup_result (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
309 | rd_count = ntohs (msg->rd_count); | 310 | rd_count = ntohs (msg->rd_count); |
310 | msg_len = ntohs (msg->gns_header.header.size); | 311 | msg_len = ntohs (msg->gns_header.header.size); |
311 | name_len = ntohs (msg->name_len); | 312 | name_len = ntohs (msg->name_len); |
312 | GNUNET_break (0 == ntohs (msg->reserved)); | 313 | found = ntohs (msg->found); |
313 | exp_msg_len = sizeof (struct LabelLookupResponseMessage) + name_len + rd_len; | 314 | exp_msg_len = sizeof (struct LabelLookupResponseMessage) + name_len + rd_len; |
314 | if (msg_len != exp_msg_len) | 315 | if (msg_len != exp_msg_len) |
315 | { | 316 | { |
@@ -323,6 +324,17 @@ handle_lookup_result (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
323 | GNUNET_break (0); | 324 | GNUNET_break (0); |
324 | return GNUNET_SYSERR; | 325 | return GNUNET_SYSERR; |
325 | } | 326 | } |
327 | if (GNUNET_NO == found) | ||
328 | { | ||
329 | /* label was not in namestore */ | ||
330 | if (NULL != qe->proc) | ||
331 | qe->proc (qe->proc_cls, | ||
332 | &msg->private_key, | ||
333 | name, | ||
334 | 0, NULL); | ||
335 | return GNUNET_OK; | ||
336 | } | ||
337 | |||
326 | rd_tmp = &name[name_len]; | 338 | rd_tmp = &name[name_len]; |
327 | { | 339 | { |
328 | struct GNUNET_GNSRECORD_Data rd[rd_count]; | 340 | struct GNUNET_GNSRECORD_Data rd[rd_count]; |