aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r--src/gns/gnunet-service-gns.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 02613dbb1..198e4c33b 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -317,7 +317,6 @@ process_authority_lookup(void* cls, const GNUNET_HashCode *zone,
317 const char *name, uint32_t record_type, 317 const char *name, uint32_t record_type,
318 struct GNUNET_TIME_Absolute expiration, 318 struct GNUNET_TIME_Absolute expiration,
319 enum GNUNET_NAMESTORE_RecordFlags flags, 319 enum GNUNET_NAMESTORE_RecordFlags flags,
320 const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
321 size_t size, const void *data) 320 size_t size, const void *data)
322{ 321{
323 struct GNUNET_GNS_PendingQuery *query; 322 struct GNUNET_GNS_PendingQuery *query;
@@ -344,7 +343,7 @@ process_authority_lookup(void* cls, const GNUNET_HashCode *zone,
344 */ 343 */
345 if (GNUNET_CRYPTO_hash_cmp(zone, &zone_hash)) 344 if (GNUNET_CRYPTO_hash_cmp(zone, &zone_hash))
346 { 345 {
347 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "NX record\n"); 346 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Authority unknown\n");
348 //FIXME return NX answer 347 //FIXME return NX answer
349 return; 348 return;
350 } 349 }
@@ -420,10 +419,10 @@ reply_to_dns(struct GNUNET_GNS_PendingQuery *answer)
420 { 419 {
421 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 420 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
422 "Answering DNS request\n"); 421 "Answering DNS request\n");
423 //GNUNET_DNS_request_answer(answer->request_handle, 422 GNUNET_DNS_request_answer(answer->request_handle,
424 // len, 423 len,
425 // buf); 424 buf);
426 GNUNET_free(answer); 425 //GNUNET_free(answer);
427 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Answered DNS request\n"); 426 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Answered DNS request\n");
428 //FIXME return code, free datastructures 427 //FIXME return code, free datastructures
429 } 428 }
@@ -454,7 +453,6 @@ process_authoritative_result(void* cls, const GNUNET_HashCode *zone,
454 const char *name, uint32_t record_type, 453 const char *name, uint32_t record_type,
455 struct GNUNET_TIME_Absolute expiration, 454 struct GNUNET_TIME_Absolute expiration,
456 enum GNUNET_NAMESTORE_RecordFlags flags, 455 enum GNUNET_NAMESTORE_RecordFlags flags,
457 const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
458 size_t size, const void *data) 456 size_t size, const void *data)
459{ 457{
460 struct GNUNET_GNS_PendingQuery *query; 458 struct GNUNET_GNS_PendingQuery *query;
@@ -621,7 +619,7 @@ resolve_name(struct GNUNET_GNS_PendingQuery *query, GNUNET_HashCode *zone)
621 if (is_canonical(query->name)) 619 if (is_canonical(query->name))
622 { 620 {
623 //We only need to check this zone's ns 621 //We only need to check this zone's ns
624 GNUNET_NAMESTORE_lookup_name(namestore_handle, 622 GNUNET_NAMESTORE_lookup_record(namestore_handle,
625 zone, 623 zone,
626 query->name, 624 query->name,
627 query->type, 625 query->type,
@@ -632,7 +630,7 @@ resolve_name(struct GNUNET_GNS_PendingQuery *query, GNUNET_HashCode *zone)
632 { 630 {
633 //We have to resolve the authoritative entity 631 //We have to resolve the authoritative entity
634 char *new_authority = move_up(query->name); 632 char *new_authority = move_up(query->name);
635 GNUNET_NAMESTORE_lookup_name(namestore_handle, 633 GNUNET_NAMESTORE_lookup_record(namestore_handle,
636 zone, 634 zone,
637 new_authority, 635 new_authority,
638 GNUNET_GNS_RECORD_PKEY, 636 GNUNET_GNS_RECORD_PKEY,
@@ -761,7 +759,6 @@ put_some_records(void)
761 GNUNET_GNS_RECORD_TYPE_A, 759 GNUNET_GNS_RECORD_TYPE_A,
762 GNUNET_TIME_absolute_get_forever(), 760 GNUNET_TIME_absolute_get_forever(),
763 GNUNET_NAMESTORE_RF_AUTHORITY, 761 GNUNET_NAMESTORE_RF_AUTHORITY,
764 NULL, //sig loc
765 sizeof(struct in_addr), 762 sizeof(struct in_addr),
766 alice, 763 alice,
767 NULL, 764 NULL,
@@ -772,7 +769,6 @@ put_some_records(void)
772 GNUNET_GNS_RECORD_TYPE_A, 769 GNUNET_GNS_RECORD_TYPE_A,
773 GNUNET_TIME_absolute_get_forever(), 770 GNUNET_TIME_absolute_get_forever(),
774 GNUNET_NAMESTORE_RF_AUTHORITY, 771 GNUNET_NAMESTORE_RF_AUTHORITY,
775 NULL, //sig loc
776 sizeof(struct in_addr), 772 sizeof(struct in_addr),
777 bob, 773 bob,
778 NULL, 774 NULL,
@@ -802,7 +798,6 @@ void
802put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name, 798put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name,
803 uint32_t record_type, struct GNUNET_TIME_Absolute expiration, 799 uint32_t record_type, struct GNUNET_TIME_Absolute expiration,
804 enum GNUNET_NAMESTORE_RecordFlags flags, 800 enum GNUNET_NAMESTORE_RecordFlags flags,
805 const struct GNUNET_NAMESTORE_SignatureLocation *sig_loc,
806 size_t size, const void *record_data) 801 size_t size, const void *record_data)
807{ 802{
808 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Putting a record into the DHT\n"); 803 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Putting a record into the DHT\n");
@@ -814,9 +809,6 @@ put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name,
814 exp_nbo = GNUNET_TIME_absolute_hton (expiration); 809 exp_nbo = GNUNET_TIME_absolute_hton (expiration);
815 uint32_t namelen = htonl(strlen(name)); 810 uint32_t namelen = htonl(strlen(name));
816 uint16_t flags_nbo = htons(flags); 811 uint16_t flags_nbo = htons(flags);
817 uint64_t offset = GNUNET_htonll(sig_loc->offset);
818 uint32_t depth = htonl(sig_loc->depth);
819 uint32_t revision = htonl(sig_loc->revision);
820 GNUNET_HashCode name_hash; 812 GNUNET_HashCode name_hash;
821 GNUNET_HashCode xor_hash; 813 GNUNET_HashCode xor_hash;
822 814
@@ -826,7 +818,6 @@ put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name,
826 */ 818 */
827 size_t record_len = sizeof(size_t) + sizeof(uint32_t) + 819 size_t record_len = sizeof(size_t) + sizeof(uint32_t) +
828 sizeof(uint16_t) + 820 sizeof(uint16_t) +
829 sizeof(struct GNUNET_NAMESTORE_SignatureLocation) +
830 sizeof(uint32_t) + strlen(name) + size; 821 sizeof(uint32_t) + strlen(name) + size;
831 822
832 record_type = htonl(record_type); 823 record_type = htonl(record_type);
@@ -850,15 +841,6 @@ put_gns_record(void *cls, const GNUNET_HashCode *zone, const char *name,
850 memcpy(data_ptr, &flags_nbo, sizeof(uint16_t)); 841 memcpy(data_ptr, &flags_nbo, sizeof(uint16_t));
851 data_ptr += sizeof(uint16_t); 842 data_ptr += sizeof(uint16_t);
852 843
853 memcpy(data_ptr, &offset, sizeof(uint64_t));
854 data_ptr += sizeof(uint64_t);
855
856 memcpy(data_ptr, &depth, sizeof(uint32_t));
857 data_ptr += sizeof(uint32_t);
858
859 memcpy(data_ptr, &revision, sizeof(uint32_t));
860 data_ptr += sizeof(uint32_t);
861
862 memcpy(data_ptr, &size, sizeof(uint32_t)); 844 memcpy(data_ptr, &size, sizeof(uint32_t));
863 data_ptr += sizeof(uint32_t); 845 data_ptr += sizeof(uint32_t);
864 846