summaryrefslogtreecommitdiff
path: root/src/gns/gns_api.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-02-16 20:38:29 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-02-16 20:38:29 +0000
commit349d176da232e5fdc6afd9c90ae02bf928365ac0 (patch)
tree0b3dd606f9e9f10d1c45d4113eead668648c99ce /src/gns/gns_api.c
parentf49e139a6fbcde654b2130e78665e48712713612 (diff)
downloadgnunet-349d176da232e5fdc6afd9c90ae02bf928365ac0.tar.gz
gnunet-349d176da232e5fdc6afd9c90ae02bf928365ac0.zip
- removed add, other feedback
Diffstat (limited to 'src/gns/gns_api.c')
-rw-r--r--src/gns/gns_api.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 14c1220c9..cb418c0a6 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -435,6 +435,7 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value)
435{ 435{
436 const struct GNUNET_GNS_ClientResultMessage *gns_msg = cls; 436 const struct GNUNET_GNS_ClientResultMessage *gns_msg = cls;
437 struct GNUNET_GNS_LookupHandle *lookup_handle = value; 437 struct GNUNET_GNS_LookupHandle *lookup_handle = value;
438 const char *name = (const char*) &lookup_handle[1];
438 const struct GNUNET_GNS_Record *records; 439 const struct GNUNET_GNS_Record *records;
439 uint32_t num_records; 440 uint32_t num_records;
440 size_t meta_length; 441 size_t meta_length;
@@ -467,7 +468,7 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value)
467 (unsigned int) (msize - meta_length), GNUNET_h2s (key)); 468 (unsigned int) (msize - meta_length), GNUNET_h2s (key));
468#endif 469#endif
469 records = (const struct GNUNET_GNS_Record *) &gns_msg[1]; 470 records = (const struct GNUNET_GNS_Record *) &gns_msg[1];
470 lookup_handle->iter (lookup_handle->iter_cls, key, records, num_records); 471 lookup_handle->iter (lookup_handle->iter_cls, name, records, num_records);
471 return GNUNET_YES; 472 return GNUNET_YES;
472} 473}
473 474
@@ -559,37 +560,10 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle)
559 560
560 561
561/** 562/**
562 * Add a new record to the GNS.
563 *
564 * @param handle handle to GNS service
565 * @param record the record to store
566 * @param exp desired expiration time for the value
567 * @param timeout how long to wait for transmission of this request
568 */
569void
570GNUNET_GNS_add_record (struct GNUNET_GNS_Handle *handle,
571 const char* name,
572 enum GNUNET_GNS_RecordType type,
573 size_t size, const char *data,
574 struct GNUNET_TIME_Absolute exp,
575 struct GNUNET_TIME_Relative timeout)
576{
577 /**
578 * build add record message
579 */
580 struct GNUNET_GNS_Record *record;
581
582 record = GNUNET_malloc(sizeof (struct GNUNET_GNS_Record));
583 /**
584 * TODO
585 * queue_record_msg(handle, record);
586 **/
587}
588
589
590/**
591 * Perform an asynchronous Lookup operation on the GNS. 563 * Perform an asynchronous Lookup operation on the GNS.
592 * TODO: Still not sure what we query for... "names" it is for now 564 * TODO:
565 * - Still not sure what we query for... "names" it is for now
566 * - Do we need such sophisticated message queueing like dht? simplify?
593 * 567 *
594 * @param handle handle to the GNS service 568 * @param handle handle to the GNS service
595 * @param timeout how long to wait for transmission of this request to the service 569 * @param timeout how long to wait for transmission of this request to the service
@@ -632,7 +606,6 @@ GNUNET_GNS_lookup_start (struct GNUNET_GNS_Handle *handle,
632 pending->free_on_send = GNUNET_NO; 606 pending->free_on_send = GNUNET_NO;
633 lookup_msg->header.size = htons (msize); 607 lookup_msg->header.size = htons (msize);
634 lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP); 608 lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_CLIENT_LOOKUP);
635 lookup_msg->namelen = strlen(name);
636 lookup_msg->key = key; 609 lookup_msg->key = key;
637 memcpy(&lookup_msg[1], name, strlen(name)); 610 memcpy(&lookup_msg[1], name, strlen(name));
638 handle->uid_gen++; 611 handle->uid_gen++;