diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-09 12:22:04 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-01-09 12:22:04 +0100 |
commit | ec19c1e316efdd29a7af0524fc2ff33cc4b19d09 (patch) | |
tree | 184a59ff1c8408c462254e53f7e2004be829e237 /src/dht | |
parent | c3ecadd45b11f82e22ba81b42864c7826d0f97c6 (diff) | |
download | gnunet-ec19c1e316efdd29a7af0524fc2ff33cc4b19d09.tar.gz gnunet-ec19c1e316efdd29a7af0524fc2ff33cc4b19d09.zip |
DHT: modify API and protocol messages to add path signatures, except for now the actual signatures are just placeholders (signing and signature verification are missing)
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/dht_api.c | 177 | ||||
-rw-r--r-- | src/dht/gnunet-dht-get.c | 78 | ||||
-rw-r--r-- | src/dht/gnunet-dht-monitor.c | 8 | ||||
-rw-r--r-- | src/dht/gnunet-dht-put.c | 75 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht.h | 6 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_clients.c | 55 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.c | 5 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.h | 2 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 200 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.h | 4 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_routing.c | 6 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_routing.h | 2 | ||||
-rw-r--r-- | src/dht/gnunet_dht_profiler.c | 4 | ||||
-rw-r--r-- | src/dht/test_dht_api.c | 4 | ||||
-rw-r--r-- | src/dht/test_dht_monitor.c | 12 | ||||
-rw-r--r-- | src/dht/test_dht_topo.c | 4 |
16 files changed, 259 insertions, 383 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 727f1a1f6..1ba2f7277 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -260,7 +260,7 @@ struct GNUNET_DHT_Handle | |||
260 | * @param h DHT handle to reconnect | 260 | * @param h DHT handle to reconnect |
261 | * @return #GNUNET_YES on success, #GNUNET_NO on failure. | 261 | * @return #GNUNET_YES on success, #GNUNET_NO on failure. |
262 | */ | 262 | */ |
263 | static int | 263 | static enum GNUNET_GenericReturnValue |
264 | try_connect (struct GNUNET_DHT_Handle *h); | 264 | try_connect (struct GNUNET_DHT_Handle *h); |
265 | 265 | ||
266 | 266 | ||
@@ -344,7 +344,7 @@ send_get_known_results (struct GNUNET_DHT_GetHandle *gh, | |||
344 | * @param value the `struct GNUNET_DHT_GetHandle *` | 344 | * @param value the `struct GNUNET_DHT_GetHandle *` |
345 | * @return #GNUNET_YES (always) | 345 | * @return #GNUNET_YES (always) |
346 | */ | 346 | */ |
347 | static int | 347 | static enum GNUNET_GenericReturnValue |
348 | add_get_request_to_pending (void *cls, | 348 | add_get_request_to_pending (void *cls, |
349 | const struct GNUNET_HashCode *key, | 349 | const struct GNUNET_HashCode *key, |
350 | void *value) | 350 | void *value) |
@@ -488,7 +488,7 @@ mq_error_handler (void *cls, | |||
488 | * @return #GNUNET_OK if everything went fine, | 488 | * @return #GNUNET_OK if everything went fine, |
489 | * #GNUNET_SYSERR if the message is malformed. | 489 | * #GNUNET_SYSERR if the message is malformed. |
490 | */ | 490 | */ |
491 | static int | 491 | static enum GNUNET_GenericReturnValue |
492 | check_monitor_get (void *cls, | 492 | check_monitor_get (void *cls, |
493 | const struct GNUNET_DHT_MonitorGetMessage *msg) | 493 | const struct GNUNET_DHT_MonitorGetMessage *msg) |
494 | { | 494 | { |
@@ -496,7 +496,7 @@ check_monitor_get (void *cls, | |||
496 | uint16_t msize = ntohs (msg->header.size) - sizeof(*msg); | 496 | uint16_t msize = ntohs (msg->header.size) - sizeof(*msg); |
497 | 497 | ||
498 | if ((plen > UINT16_MAX) || | 498 | if ((plen > UINT16_MAX) || |
499 | (plen * sizeof(struct GNUNET_PeerIdentity) != msize)) | 499 | (plen * sizeof(struct GNUNET_DHT_PathElement) != msize)) |
500 | { | 500 | { |
501 | GNUNET_break (0); | 501 | GNUNET_break (0); |
502 | return GNUNET_SYSERR; | 502 | return GNUNET_SYSERR; |
@@ -534,7 +534,7 @@ handle_monitor_get (void *cls, | |||
534 | ntohl (msg->hop_count), | 534 | ntohl (msg->hop_count), |
535 | ntohl (msg->desired_replication_level), | 535 | ntohl (msg->desired_replication_level), |
536 | ntohl (msg->get_path_length), | 536 | ntohl (msg->get_path_length), |
537 | (struct GNUNET_PeerIdentity *) &msg[1], | 537 | (struct GNUNET_DHT_PathElement *) &msg[1], |
538 | &msg->key); | 538 | &msg->key); |
539 | } | 539 | } |
540 | } | 540 | } |
@@ -548,7 +548,7 @@ handle_monitor_get (void *cls, | |||
548 | * @return #GNUNET_OK if everything went fine, | 548 | * @return #GNUNET_OK if everything went fine, |
549 | * #GNUNET_SYSERR if the message is malformed. | 549 | * #GNUNET_SYSERR if the message is malformed. |
550 | */ | 550 | */ |
551 | static int | 551 | static enum GNUNET_GenericReturnValue |
552 | check_monitor_get_resp (void *cls, | 552 | check_monitor_get_resp (void *cls, |
553 | const struct GNUNET_DHT_MonitorGetRespMessage *msg) | 553 | const struct GNUNET_DHT_MonitorGetRespMessage *msg) |
554 | { | 554 | { |
@@ -557,7 +557,7 @@ check_monitor_get_resp (void *cls, | |||
557 | uint32_t putl = ntohl (msg->put_path_length); | 557 | uint32_t putl = ntohl (msg->put_path_length); |
558 | 558 | ||
559 | if ((getl + putl < getl) || | 559 | if ((getl + putl < getl) || |
560 | ((msize / sizeof(struct GNUNET_PeerIdentity)) < getl + putl)) | 560 | ((msize / sizeof(struct GNUNET_DHT_PathElement)) < getl + putl)) |
561 | { | 561 | { |
562 | GNUNET_break (0); | 562 | GNUNET_break (0); |
563 | return GNUNET_SYSERR; | 563 | return GNUNET_SYSERR; |
@@ -578,12 +578,12 @@ handle_monitor_get_resp (void *cls, | |||
578 | { | 578 | { |
579 | struct GNUNET_DHT_Handle *handle = cls; | 579 | struct GNUNET_DHT_Handle *handle = cls; |
580 | size_t msize = ntohs (msg->header.size) - sizeof(*msg); | 580 | size_t msize = ntohs (msg->header.size) - sizeof(*msg); |
581 | const struct GNUNET_PeerIdentity *path; | 581 | const struct GNUNET_DHT_PathElement *path; |
582 | uint32_t getl = ntohl (msg->get_path_length); | 582 | uint32_t getl = ntohl (msg->get_path_length); |
583 | uint32_t putl = ntohl (msg->put_path_length); | 583 | uint32_t putl = ntohl (msg->put_path_length); |
584 | struct GNUNET_DHT_MonitorHandle *mh; | 584 | struct GNUNET_DHT_MonitorHandle *mh; |
585 | 585 | ||
586 | path = (const struct GNUNET_PeerIdentity *) &msg[1]; | 586 | path = (const struct GNUNET_DHT_PathElement *) &msg[1]; |
587 | for (mh = handle->monitor_head; NULL != mh; mh = mh->next) | 587 | for (mh = handle->monitor_head; NULL != mh; mh = mh->next) |
588 | { | 588 | { |
589 | if (NULL == mh->get_resp_cb) | 589 | if (NULL == mh->get_resp_cb) |
@@ -603,8 +603,8 @@ handle_monitor_get_resp (void *cls, | |||
603 | GNUNET_TIME_absolute_ntoh (msg->expiration_time), | 603 | GNUNET_TIME_absolute_ntoh (msg->expiration_time), |
604 | &msg->key, | 604 | &msg->key, |
605 | (const void *) &path[getl + putl], | 605 | (const void *) &path[getl + putl], |
606 | msize - sizeof(struct GNUNET_PeerIdentity) * (putl | 606 | msize - sizeof(struct GNUNET_DHT_PathElement) * (putl |
607 | + getl)); | 607 | + getl)); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 | ||
@@ -617,7 +617,7 @@ handle_monitor_get_resp (void *cls, | |||
617 | * @return #GNUNET_OK if everything went fine, | 617 | * @return #GNUNET_OK if everything went fine, |
618 | * #GNUNET_SYSERR if the message is malformed. | 618 | * #GNUNET_SYSERR if the message is malformed. |
619 | */ | 619 | */ |
620 | static int | 620 | static enum GNUNET_GenericReturnValue |
621 | check_monitor_put (void *cls, | 621 | check_monitor_put (void *cls, |
622 | const struct GNUNET_DHT_MonitorPutMessage *msg) | 622 | const struct GNUNET_DHT_MonitorPutMessage *msg) |
623 | { | 623 | { |
@@ -626,7 +626,7 @@ check_monitor_put (void *cls, | |||
626 | 626 | ||
627 | msize = ntohs (msg->header.size) - sizeof(*msg); | 627 | msize = ntohs (msg->header.size) - sizeof(*msg); |
628 | putl = ntohl (msg->put_path_length); | 628 | putl = ntohl (msg->put_path_length); |
629 | if ((msize / sizeof(struct GNUNET_PeerIdentity)) < putl) | 629 | if ((msize / sizeof(struct GNUNET_DHT_PathElement)) < putl) |
630 | { | 630 | { |
631 | GNUNET_break (0); | 631 | GNUNET_break (0); |
632 | return GNUNET_SYSERR; | 632 | return GNUNET_SYSERR; |
@@ -648,10 +648,10 @@ handle_monitor_put (void *cls, | |||
648 | struct GNUNET_DHT_Handle *handle = cls; | 648 | struct GNUNET_DHT_Handle *handle = cls; |
649 | size_t msize = ntohs (msg->header.size) - sizeof(*msg); | 649 | size_t msize = ntohs (msg->header.size) - sizeof(*msg); |
650 | uint32_t putl = ntohl (msg->put_path_length); | 650 | uint32_t putl = ntohl (msg->put_path_length); |
651 | const struct GNUNET_PeerIdentity *path; | 651 | const struct GNUNET_DHT_PathElement *path; |
652 | struct GNUNET_DHT_MonitorHandle *mh; | 652 | struct GNUNET_DHT_MonitorHandle *mh; |
653 | 653 | ||
654 | path = (const struct GNUNET_PeerIdentity *) &msg[1]; | 654 | path = (const struct GNUNET_DHT_PathElement *) &msg[1]; |
655 | for (mh = handle->monitor_head; NULL != mh; mh = mh->next) | 655 | for (mh = handle->monitor_head; NULL != mh; mh = mh->next) |
656 | { | 656 | { |
657 | if (NULL == mh->put_cb) | 657 | if (NULL == mh->put_cb) |
@@ -672,7 +672,7 @@ handle_monitor_put (void *cls, | |||
672 | GNUNET_TIME_absolute_ntoh (msg->expiration_time), | 672 | GNUNET_TIME_absolute_ntoh (msg->expiration_time), |
673 | &msg->key, | 673 | &msg->key, |
674 | (const void *) &path[putl], | 674 | (const void *) &path[putl], |
675 | msize - sizeof(struct GNUNET_PeerIdentity) * putl); | 675 | msize - sizeof(struct GNUNET_DHT_PathElement) * putl); |
676 | } | 676 | } |
677 | } | 677 | } |
678 | 678 | ||
@@ -685,7 +685,7 @@ handle_monitor_put (void *cls, | |||
685 | * @return #GNUNET_OK if everything went fine, | 685 | * @return #GNUNET_OK if everything went fine, |
686 | * #GNUNET_SYSERR if the message is malformed. | 686 | * #GNUNET_SYSERR if the message is malformed. |
687 | */ | 687 | */ |
688 | static int | 688 | static enum GNUNET_GenericReturnValue |
689 | check_client_result (void *cls, | 689 | check_client_result (void *cls, |
690 | const struct GNUNET_DHT_ClientResultMessage *msg) | 690 | const struct GNUNET_DHT_ClientResultMessage *msg) |
691 | { | 691 | { |
@@ -695,12 +695,12 @@ check_client_result (void *cls, | |||
695 | size_t meta_length; | 695 | size_t meta_length; |
696 | 696 | ||
697 | meta_length = | 697 | meta_length = |
698 | sizeof(struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); | 698 | sizeof(struct GNUNET_DHT_PathElement) * (get_path_length + put_path_length); |
699 | if ((msize < meta_length) || | 699 | if ((msize < meta_length) || |
700 | (get_path_length > | 700 | (get_path_length > |
701 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) || | 701 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) || |
702 | (put_path_length > | 702 | (put_path_length > |
703 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity))) | 703 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement))) |
704 | { | 704 | { |
705 | GNUNET_break (0); | 705 | GNUNET_break (0); |
706 | return GNUNET_SYSERR; | 706 | return GNUNET_SYSERR; |
@@ -717,7 +717,7 @@ check_client_result (void *cls, | |||
717 | * @param value the `struct GNUNET_DHT_GetHandle` of a request matching the same key | 717 | * @param value the `struct GNUNET_DHT_GetHandle` of a request matching the same key |
718 | * @return #GNUNET_YES to continue to iterate over all results | 718 | * @return #GNUNET_YES to continue to iterate over all results |
719 | */ | 719 | */ |
720 | static int | 720 | static enum GNUNET_GenericReturnValue |
721 | process_client_result (void *cls, | 721 | process_client_result (void *cls, |
722 | const struct GNUNET_HashCode *key, | 722 | const struct GNUNET_HashCode *key, |
723 | void *value) | 723 | void *value) |
@@ -727,8 +727,8 @@ process_client_result (void *cls, | |||
727 | size_t msize = ntohs (crm->header.size) - sizeof(*crm); | 727 | size_t msize = ntohs (crm->header.size) - sizeof(*crm); |
728 | uint32_t put_path_length = ntohl (crm->put_path_length); | 728 | uint32_t put_path_length = ntohl (crm->put_path_length); |
729 | uint32_t get_path_length = ntohl (crm->get_path_length); | 729 | uint32_t get_path_length = ntohl (crm->get_path_length); |
730 | const struct GNUNET_PeerIdentity *put_path; | 730 | const struct GNUNET_DHT_PathElement *put_path; |
731 | const struct GNUNET_PeerIdentity *get_path; | 731 | const struct GNUNET_DHT_PathElement *get_path; |
732 | struct GNUNET_HashCode hc; | 732 | struct GNUNET_HashCode hc; |
733 | size_t data_length; | 733 | size_t data_length; |
734 | size_t meta_length; | 734 | size_t meta_length; |
@@ -746,18 +746,18 @@ process_client_result (void *cls, | |||
746 | } | 746 | } |
747 | /* FIXME: might want to check that type matches */ | 747 | /* FIXME: might want to check that type matches */ |
748 | meta_length = | 748 | meta_length = |
749 | sizeof(struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); | 749 | sizeof(struct GNUNET_DHT_PathElement) * (get_path_length + put_path_length); |
750 | data_length = msize - meta_length; | 750 | data_length = msize - meta_length; |
751 | put_path = (const struct GNUNET_PeerIdentity *) &crm[1]; | 751 | put_path = (const struct GNUNET_DHT_PathElement *) &crm[1]; |
752 | get_path = &put_path[put_path_length]; | 752 | get_path = &put_path[put_path_length]; |
753 | { | 753 | { |
754 | char *pp; | 754 | char *pp; |
755 | char *gp; | 755 | char *gp; |
756 | 756 | ||
757 | gp = GNUNET_STRINGS_pp2s (get_path, | 757 | gp = GNUNET_DHT_pp2s (get_path, |
758 | get_path_length); | 758 | get_path_length); |
759 | pp = GNUNET_STRINGS_pp2s (put_path, | 759 | pp = GNUNET_DHT_pp2s (put_path, |
760 | put_path_length); | 760 | put_path_length); |
761 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 761 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
762 | "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n", | 762 | "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n", |
763 | (unsigned int) data_length, | 763 | (unsigned int) data_length, |
@@ -838,7 +838,7 @@ handle_put_cont (void *cls) | |||
838 | * @param h DHT handle to reconnect | 838 | * @param h DHT handle to reconnect |
839 | * @return #GNUNET_YES on success, #GNUNET_NO on failure. | 839 | * @return #GNUNET_YES on success, #GNUNET_NO on failure. |
840 | */ | 840 | */ |
841 | static int | 841 | static enum GNUNET_GenericReturnValue |
842 | try_connect (struct GNUNET_DHT_Handle *h) | 842 | try_connect (struct GNUNET_DHT_Handle *h) |
843 | { | 843 | { |
844 | struct GNUNET_MQ_MessageHandler handlers[] = { | 844 | struct GNUNET_MQ_MessageHandler handlers[] = { |
@@ -878,14 +878,6 @@ try_connect (struct GNUNET_DHT_Handle *h) | |||
878 | } | 878 | } |
879 | 879 | ||
880 | 880 | ||
881 | /** | ||
882 | * Initialize the connection with the DHT service. | ||
883 | * | ||
884 | * @param cfg configuration to use | ||
885 | * @param ht_len size of the internal hash table to use for | ||
886 | * processing multiple GET/FIND requests in parallel | ||
887 | * @return handle to the DHT service, or NULL on error | ||
888 | */ | ||
889 | struct GNUNET_DHT_Handle * | 881 | struct GNUNET_DHT_Handle * |
890 | GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 882 | GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
891 | unsigned int ht_len) | 883 | unsigned int ht_len) |
@@ -909,11 +901,6 @@ GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
909 | } | 901 | } |
910 | 902 | ||
911 | 903 | ||
912 | /** | ||
913 | * Shutdown connection with the DHT service. | ||
914 | * | ||
915 | * @param handle handle of the DHT connection to stop | ||
916 | */ | ||
917 | void | 904 | void |
918 | GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) | 905 | GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) |
919 | { | 906 | { |
@@ -942,26 +929,6 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) | |||
942 | } | 929 | } |
943 | 930 | ||
944 | 931 | ||
945 | /** | ||
946 | * Perform a PUT operation storing data in the DHT. FIXME: we should | ||
947 | * change the protocol to get a confirmation for the PUT from the DHT | ||
948 | * and call 'cont' only after getting the confirmation; otherwise, the | ||
949 | * client has no good way of telling if the 'PUT' message actually got | ||
950 | * to the DHT service! | ||
951 | * | ||
952 | * @param handle handle to DHT service | ||
953 | * @param key the key to store under | ||
954 | * @param desired_replication_level estimate of how many | ||
955 | * nearest peers this request should reach | ||
956 | * @param options routing options for this message | ||
957 | * @param type type of the value | ||
958 | * @param size number of bytes in data; must be less than 64k | ||
959 | * @param data the data to store | ||
960 | * @param exp desired expiration time for the value | ||
961 | * @param cont continuation to call when done (transmitting request to service) | ||
962 | * You must not call #GNUNET_DHT_disconnect in this continuation | ||
963 | * @param cont_cls closure for @a cont | ||
964 | */ | ||
965 | struct GNUNET_DHT_PutHandle * | 932 | struct GNUNET_DHT_PutHandle * |
966 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | 933 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, |
967 | const struct GNUNET_HashCode *key, | 934 | const struct GNUNET_HashCode *key, |
@@ -1020,17 +987,6 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | |||
1020 | } | 987 | } |
1021 | 988 | ||
1022 | 989 | ||
1023 | /** | ||
1024 | * Cancels a DHT PUT operation. Note that the PUT request may still | ||
1025 | * go out over the network (we can't stop that); However, if the PUT | ||
1026 | * has not yet been sent to the service, cancelling the PUT will stop | ||
1027 | * this from happening (but there is no way for the user of this API | ||
1028 | * to tell if that is the case). The only use for this API is to | ||
1029 | * prevent a later call to 'cont' from #GNUNET_DHT_put (e.g. because | ||
1030 | * the system is shutting down). | ||
1031 | * | ||
1032 | * @param ph put operation to cancel ('cont' will no longer be called) | ||
1033 | */ | ||
1034 | void | 990 | void |
1035 | GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph) | 991 | GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph) |
1036 | { | 992 | { |
@@ -1047,21 +1003,6 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph) | |||
1047 | } | 1003 | } |
1048 | 1004 | ||
1049 | 1005 | ||
1050 | /** | ||
1051 | * Perform an asynchronous GET operation on the DHT identified. | ||
1052 | * | ||
1053 | * @param handle handle to the DHT service | ||
1054 | * @param type expected type of the response object | ||
1055 | * @param key the key to look up | ||
1056 | * @param desired_replication_level estimate of how many | ||
1057 | nearest peers this request should reach | ||
1058 | * @param options routing options for this message | ||
1059 | * @param xquery extended query data (can be NULL, depending on type) | ||
1060 | * @param xquery_size number of bytes in @a xquery | ||
1061 | * @param iter function to call on each result | ||
1062 | * @param iter_cls closure for @a iter | ||
1063 | * @return handle to stop the async get | ||
1064 | */ | ||
1065 | struct GNUNET_DHT_GetHandle * | 1006 | struct GNUNET_DHT_GetHandle * |
1066 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | 1007 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, |
1067 | enum GNUNET_BLOCK_Type type, | 1008 | enum GNUNET_BLOCK_Type type, |
@@ -1111,16 +1052,6 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |||
1111 | } | 1052 | } |
1112 | 1053 | ||
1113 | 1054 | ||
1114 | /** | ||
1115 | * Tell the DHT not to return any of the following known results | ||
1116 | * to this client. | ||
1117 | * | ||
1118 | * @param get_handle get operation for which results should be filtered | ||
1119 | * @param num_results number of results to be blocked that are | ||
1120 | * provided in this call (size of the @a results array) | ||
1121 | * @param results array of hash codes over the 'data' of the results | ||
1122 | * to be blocked | ||
1123 | */ | ||
1124 | void | 1055 | void |
1125 | GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle, | 1056 | GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle, |
1126 | unsigned int num_results, | 1057 | unsigned int num_results, |
@@ -1145,11 +1076,6 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle, | |||
1145 | } | 1076 | } |
1146 | 1077 | ||
1147 | 1078 | ||
1148 | /** | ||
1149 | * Stop async DHT-get. | ||
1150 | * | ||
1151 | * @param get_handle handle to the GET operation to stop | ||
1152 | */ | ||
1153 | void | 1079 | void |
1154 | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle) | 1080 | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle) |
1155 | { | 1081 | { |
@@ -1183,18 +1109,6 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle) | |||
1183 | } | 1109 | } |
1184 | 1110 | ||
1185 | 1111 | ||
1186 | /** | ||
1187 | * Start monitoring the local DHT service. | ||
1188 | * | ||
1189 | * @param handle Handle to the DHT service. | ||
1190 | * @param type Type of blocks that are of interest. | ||
1191 | * @param key Key of data of interest, NULL for all. | ||
1192 | * @param get_cb Callback to process monitored get messages. | ||
1193 | * @param get_resp_cb Callback to process monitored get response messages. | ||
1194 | * @param put_cb Callback to process monitored put messages. | ||
1195 | * @param cb_cls Closure for callbacks. | ||
1196 | * @return Handle to stop monitoring. | ||
1197 | */ | ||
1198 | struct GNUNET_DHT_MonitorHandle * | 1112 | struct GNUNET_DHT_MonitorHandle * |
1199 | GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | 1113 | GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, |
1200 | enum GNUNET_BLOCK_Type type, | 1114 | enum GNUNET_BLOCK_Type type, |
@@ -1227,13 +1141,6 @@ GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | |||
1227 | } | 1141 | } |
1228 | 1142 | ||
1229 | 1143 | ||
1230 | /** | ||
1231 | * Stop monitoring. | ||
1232 | * | ||
1233 | * @param mh The handle to the monitor request returned by monitor_start. | ||
1234 | * | ||
1235 | * On return get_handle will no longer be valid, caller must not use again!!! | ||
1236 | */ | ||
1237 | void | 1144 | void |
1238 | GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *mh) | 1145 | GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *mh) |
1239 | { | 1146 | { |
@@ -1262,4 +1169,28 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *mh) | |||
1262 | } | 1169 | } |
1263 | 1170 | ||
1264 | 1171 | ||
1172 | char * | ||
1173 | GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, | ||
1174 | unsigned int path_len) | ||
1175 | { | ||
1176 | char *buf; | ||
1177 | size_t off; | ||
1178 | size_t plen = path_len * 5 + 1; | ||
1179 | |||
1180 | GNUNET_assert (path_len < UINT32_MAX / 5); | ||
1181 | off = 0; | ||
1182 | buf = GNUNET_malloc (plen); | ||
1183 | for (unsigned int i = 0; i < path_len; i++) | ||
1184 | { | ||
1185 | off += GNUNET_snprintf (&buf[off], | ||
1186 | plen - off, | ||
1187 | "%s%s", | ||
1188 | GNUNET_i2s (&path[i].pred), | ||
1189 | (i == path_len - 1) ? "" : "-"); | ||
1190 | } | ||
1191 | return buf; | ||
1192 | |||
1193 | } | ||
1194 | |||
1195 | |||
1265 | /* end of dht_api.c */ | 1196 | /* end of dht_api.c */ |
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c index c8a1cb735..f1076490b 100644 --- a/src/dht/gnunet-dht-get.c +++ b/src/dht/gnunet-dht-get.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V. | 3 | Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009, 2022 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -146,16 +146,17 @@ static void | |||
146 | get_result_iterator (void *cls, | 146 | get_result_iterator (void *cls, |
147 | struct GNUNET_TIME_Absolute exp, | 147 | struct GNUNET_TIME_Absolute exp, |
148 | const struct GNUNET_HashCode *key, | 148 | const struct GNUNET_HashCode *key, |
149 | const struct GNUNET_PeerIdentity *get_path, | 149 | const struct GNUNET_DHT_PathElement *get_path, |
150 | unsigned int get_path_length, | 150 | unsigned int get_path_length, |
151 | const struct GNUNET_PeerIdentity *put_path, | 151 | const struct GNUNET_DHT_PathElement *put_path, |
152 | unsigned int put_path_length, | 152 | unsigned int put_path_length, |
153 | enum GNUNET_BLOCK_Type type, | 153 | enum GNUNET_BLOCK_Type type, |
154 | size_t size, | 154 | size_t size, |
155 | const void *data) | 155 | const void *data) |
156 | { | 156 | { |
157 | fprintf (stdout, | 157 | fprintf (stdout, |
158 | (GNUNET_BLOCK_TYPE_TEST == type) ? _ ("Result %d, type %d:\n%.*s\n") | 158 | (GNUNET_BLOCK_TYPE_TEST == type) |
159 | ? _ ("Result %d, type %d:\n%.*s\n") | ||
159 | : _ ("Result %d, type %d:\n"), | 160 | : _ ("Result %d, type %d:\n"), |
160 | result_count, | 161 | result_count, |
161 | type, | 162 | type, |
@@ -163,13 +164,22 @@ get_result_iterator (void *cls, | |||
163 | (char *) data); | 164 | (char *) data); |
164 | if (verbose) | 165 | if (verbose) |
165 | { | 166 | { |
166 | fprintf (stdout, " GET path: "); | 167 | fprintf (stdout, |
168 | " GET path: "); | ||
167 | for (unsigned int i = 0; i < get_path_length; i++) | 169 | for (unsigned int i = 0; i < get_path_length; i++) |
168 | fprintf (stdout, "%s%s", (0 == i) ? "" : "-", GNUNET_i2s (&get_path[i])); | 170 | fprintf (stdout, |
169 | fprintf (stdout, "\n PUT path: "); | 171 | "%s%s", |
172 | (0 == i) ? "" : "-", | ||
173 | GNUNET_i2s (&get_path[i].pred)); | ||
174 | fprintf (stdout, | ||
175 | "\n PUT path: "); | ||
170 | for (unsigned int i = 0; i < put_path_length; i++) | 176 | for (unsigned int i = 0; i < put_path_length; i++) |
171 | fprintf (stdout, "%s%s", (0 == i) ? "" : "-", GNUNET_i2s (&put_path[i])); | 177 | fprintf (stdout, |
172 | fprintf (stdout, "\n"); | 178 | "%s%s", |
179 | (0 == i) ? "" : "-", | ||
180 | GNUNET_i2s (&put_path[i].pred)); | ||
181 | fprintf (stdout, | ||
182 | "\n"); | ||
173 | } | 183 | } |
174 | result_count++; | 184 | result_count++; |
175 | } | 185 | } |
@@ -194,13 +204,17 @@ run (void *cls, | |||
194 | cfg = c; | 204 | cfg = c; |
195 | if (NULL == query_key) | 205 | if (NULL == query_key) |
196 | { | 206 | { |
197 | fprintf (stderr, "%s", _ ("Must provide key for DHT GET!\n")); | 207 | fprintf (stderr, |
208 | "%s", | ||
209 | _ ("Must provide key for DHT GET!\n")); | ||
198 | ret = 1; | 210 | ret = 1; |
199 | return; | 211 | return; |
200 | } | 212 | } |
201 | if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) | 213 | if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) |
202 | { | 214 | { |
203 | fprintf (stderr, "%s", _ ("Failed to connect to DHT service!\n")); | 215 | fprintf (stderr, |
216 | "%s", | ||
217 | _ ("Failed to connect to DHT service!\n")); | ||
204 | ret = 1; | 218 | ret = 1; |
205 | return; | 219 | return; |
206 | } | 220 | } |
@@ -238,39 +252,45 @@ run (void *cls, | |||
238 | int | 252 | int |
239 | main (int argc, char *const *argv) | 253 | main (int argc, char *const *argv) |
240 | { | 254 | { |
241 | struct GNUNET_GETOPT_CommandLineOption options[] = | 255 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
242 | { GNUNET_GETOPT_option_string ('k', | 256 | GNUNET_GETOPT_option_string ( |
243 | "key", | 257 | 'k', |
244 | "KEY", | 258 | "key", |
245 | gettext_noop ("the query key"), | 259 | "KEY", |
246 | &query_key), | 260 | gettext_noop ("the query key"), |
261 | &query_key), | ||
247 | GNUNET_GETOPT_option_uint ( | 262 | GNUNET_GETOPT_option_uint ( |
248 | 'r', | 263 | 'r', |
249 | "replication", | 264 | "replication", |
250 | "LEVEL", | 265 | "LEVEL", |
251 | gettext_noop ("how many parallel requests (replicas) to create"), | 266 | gettext_noop ("how many parallel requests (replicas) to create"), |
252 | &replication), | 267 | &replication), |
253 | GNUNET_GETOPT_option_uint ('t', | 268 | GNUNET_GETOPT_option_uint ( |
254 | "type", | 269 | 't', |
255 | "TYPE", | 270 | "type", |
256 | gettext_noop ("the type of data to look for"), | 271 | "TYPE", |
257 | &query_type), | 272 | gettext_noop ("the type of data to look for"), |
273 | &query_type), | ||
258 | GNUNET_GETOPT_option_relative_time ( | 274 | GNUNET_GETOPT_option_relative_time ( |
259 | 'T', | 275 | 'T', |
260 | "timeout", | 276 | "timeout", |
261 | "TIMEOUT", | 277 | "TIMEOUT", |
262 | gettext_noop ("how long to execute this query before giving up?"), | 278 | gettext_noop ("how long to execute this query before giving up?"), |
263 | &timeout_request), | 279 | &timeout_request), |
264 | GNUNET_GETOPT_option_flag ('x', | 280 | GNUNET_GETOPT_option_flag ( |
265 | "demultiplex", | 281 | 'x', |
266 | gettext_noop ( | 282 | "demultiplex", |
267 | "use DHT's demultiplex everywhere option"), | 283 | gettext_noop ( |
268 | &demultixplex_everywhere), | 284 | "use DHT's demultiplex everywhere option"), |
285 | &demultixplex_everywhere), | ||
269 | GNUNET_GETOPT_option_verbose (&verbose), | 286 | GNUNET_GETOPT_option_verbose (&verbose), |
270 | GNUNET_GETOPT_OPTION_END }; | 287 | GNUNET_GETOPT_OPTION_END |
288 | }; | ||
271 | 289 | ||
272 | 290 | ||
273 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 291 | if (GNUNET_OK != |
292 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
293 | &argc, &argv)) | ||
274 | return 2; | 294 | return 2; |
275 | return (GNUNET_OK == | 295 | return (GNUNET_OK == |
276 | GNUNET_PROGRAM_run ( | 296 | GNUNET_PROGRAM_run ( |
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c index 8dc14e223..b4ec497e4 100644 --- a/src/dht/gnunet-dht-monitor.c +++ b/src/dht/gnunet-dht-monitor.c | |||
@@ -137,7 +137,7 @@ get_callback (void *cls, | |||
137 | uint32_t hop_count, | 137 | uint32_t hop_count, |
138 | uint32_t desired_replication_level, | 138 | uint32_t desired_replication_level, |
139 | unsigned int path_length, | 139 | unsigned int path_length, |
140 | const struct GNUNET_PeerIdentity *path, | 140 | const struct GNUNET_DHT_PathElement *path, |
141 | const struct GNUNET_HashCode *key) | 141 | const struct GNUNET_HashCode *key) |
142 | { | 142 | { |
143 | fprintf (stdout, | 143 | fprintf (stdout, |
@@ -166,9 +166,9 @@ get_callback (void *cls, | |||
166 | static void | 166 | static void |
167 | get_resp_callback (void *cls, | 167 | get_resp_callback (void *cls, |
168 | enum GNUNET_BLOCK_Type type, | 168 | enum GNUNET_BLOCK_Type type, |
169 | const struct GNUNET_PeerIdentity *get_path, | 169 | const struct GNUNET_DHT_PathElement *get_path, |
170 | unsigned int get_path_length, | 170 | unsigned int get_path_length, |
171 | const struct GNUNET_PeerIdentity *put_path, | 171 | const struct GNUNET_DHT_PathElement *put_path, |
172 | unsigned int put_path_length, | 172 | unsigned int put_path_length, |
173 | struct GNUNET_TIME_Absolute exp, | 173 | struct GNUNET_TIME_Absolute exp, |
174 | const struct GNUNET_HashCode *key, | 174 | const struct GNUNET_HashCode *key, |
@@ -211,7 +211,7 @@ put_callback (void *cls, | |||
211 | uint32_t hop_count, | 211 | uint32_t hop_count, |
212 | uint32_t desired_replication_level, | 212 | uint32_t desired_replication_level, |
213 | unsigned int path_length, | 213 | unsigned int path_length, |
214 | const struct GNUNET_PeerIdentity *path, | 214 | const struct GNUNET_DHT_PathElement *path, |
215 | struct GNUNET_TIME_Absolute exp, | 215 | struct GNUNET_TIME_Absolute exp, |
216 | const struct GNUNET_HashCode *key, | 216 | const struct GNUNET_HashCode *key, |
217 | const void *data, | 217 | const void *data, |
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c index 7ee4ec185..531107ef2 100644 --- a/src/dht/gnunet-dht-put.c +++ b/src/dht/gnunet-dht-put.c | |||
@@ -179,48 +179,57 @@ run (void *cls, | |||
179 | int | 179 | int |
180 | main (int argc, char *const *argv) | 180 | main (int argc, char *const *argv) |
181 | { | 181 | { |
182 | struct GNUNET_GETOPT_CommandLineOption options[] = | 182 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
183 | { GNUNET_GETOPT_option_string ('d', | 183 | GNUNET_GETOPT_option_string ( |
184 | "data", | 184 | 'd', |
185 | "DATA", | 185 | "data", |
186 | gettext_noop ( | 186 | "DATA", |
187 | "the data to insert under the key"), | 187 | gettext_noop ( |
188 | &data), | 188 | "the data to insert under the key"), |
189 | &data), | ||
189 | GNUNET_GETOPT_option_relative_time ( | 190 | GNUNET_GETOPT_option_relative_time ( |
190 | 'e', | 191 | 'e', |
191 | "expiration", | 192 | "expiration", |
192 | "EXPIRATION", | 193 | "EXPIRATION", |
193 | gettext_noop ("how long to store this entry in the dht (in seconds)"), | 194 | gettext_noop ("how long to store this entry in the dht (in seconds)"), |
194 | &expiration), | 195 | &expiration), |
195 | GNUNET_GETOPT_option_string ('k', | 196 | GNUNET_GETOPT_option_string ( |
196 | "key", | 197 | 'k', |
197 | "KEY", | 198 | "key", |
198 | gettext_noop ("the query key"), | 199 | "KEY", |
199 | &query_key), | 200 | gettext_noop ("the query key"), |
200 | GNUNET_GETOPT_option_flag ('x', | 201 | &query_key), |
201 | "demultiplex", | 202 | GNUNET_GETOPT_option_flag ( |
202 | gettext_noop ( | 203 | 'x', |
203 | "use DHT's demultiplex everywhere option"), | 204 | "demultiplex", |
204 | &demultixplex_everywhere), | 205 | gettext_noop ( |
205 | GNUNET_GETOPT_option_uint ('r', | 206 | "use DHT's demultiplex everywhere option"), |
206 | "replication", | 207 | &demultixplex_everywhere), |
207 | "LEVEL", | 208 | GNUNET_GETOPT_option_uint ( |
208 | gettext_noop ("how many replicas to create"), | 209 | 'r', |
209 | &replication), | 210 | "replication", |
210 | GNUNET_GETOPT_option_flag ('R', | 211 | "LEVEL", |
211 | "record", | 212 | gettext_noop ("how many replicas to create"), |
212 | gettext_noop ("use DHT's record route option"), | 213 | &replication), |
213 | &record_route), | 214 | GNUNET_GETOPT_option_flag ( |
214 | GNUNET_GETOPT_option_uint ('t', | 215 | 'R', |
215 | "type", | 216 | "record", |
216 | "TYPE", | 217 | gettext_noop ("use DHT's record route option"), |
217 | gettext_noop ("the type to insert data as"), | 218 | &record_route), |
218 | &query_type), | 219 | GNUNET_GETOPT_option_uint ( |
220 | 't', | ||
221 | "type", | ||
222 | "TYPE", | ||
223 | gettext_noop ("the type to insert data as"), | ||
224 | &query_type), | ||
219 | GNUNET_GETOPT_option_verbose (&verbose), | 225 | GNUNET_GETOPT_option_verbose (&verbose), |
220 | GNUNET_GETOPT_OPTION_END }; | 226 | GNUNET_GETOPT_OPTION_END |
227 | }; | ||
221 | 228 | ||
222 | 229 | ||
223 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 230 | if (GNUNET_OK != |
231 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
232 | &argc, &argv)) | ||
224 | return 2; | 233 | return 2; |
225 | expiration = GNUNET_TIME_UNIT_HOURS; | 234 | expiration = GNUNET_TIME_UNIT_HOURS; |
226 | return (GNUNET_OK == | 235 | return (GNUNET_OK == |
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h index e9b1ff63a..367ff426e 100644 --- a/src/dht/gnunet-service-dht.h +++ b/src/dht/gnunet-service-dht.h | |||
@@ -73,7 +73,7 @@ void | |||
73 | GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd, | 73 | GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd, |
74 | const struct GNUNET_HashCode *query_hash, | 74 | const struct GNUNET_HashCode *query_hash, |
75 | unsigned int get_path_length, | 75 | unsigned int get_path_length, |
76 | const struct GNUNET_PeerIdentity *get_path); | 76 | const struct GNUNET_DHT_PathElement *get_path); |
77 | 77 | ||
78 | 78 | ||
79 | /** | 79 | /** |
@@ -94,7 +94,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options, | |||
94 | uint32_t hop_count, | 94 | uint32_t hop_count, |
95 | uint32_t desired_replication_level, | 95 | uint32_t desired_replication_level, |
96 | unsigned int path_length, | 96 | unsigned int path_length, |
97 | const struct GNUNET_PeerIdentity *path, | 97 | const struct GNUNET_DHT_PathElement *path, |
98 | const struct GNUNET_HashCode *key); | 98 | const struct GNUNET_HashCode *key); |
99 | 99 | ||
100 | 100 | ||
@@ -108,7 +108,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options, | |||
108 | */ | 108 | */ |
109 | void | 109 | void |
110 | GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd, | 110 | GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd, |
111 | const struct GNUNET_PeerIdentity *get_path, | 111 | const struct GNUNET_DHT_PathElement *get_path, |
112 | unsigned int get_path_length); | 112 | unsigned int get_path_length); |
113 | 113 | ||
114 | 114 | ||
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index 245130dbc..a1c3024de 100644 --- a/src/dht/gnunet-service-dht_clients.c +++ b/src/dht/gnunet-service-dht_clients.c | |||
@@ -644,8 +644,8 @@ handle_dht_local_get (void *cls, | |||
644 | cqr->type, | 644 | cqr->type, |
645 | 0, /* hop count */ | 645 | 0, /* hop count */ |
646 | cqr->replication, | 646 | cqr->replication, |
647 | 1, /* path length */ | 647 | 0, /* path length */ |
648 | GDS_NEIGHBOURS_get_id (), | 648 | NULL, |
649 | &get->key); | 649 | &get->key); |
650 | /* start remote requests */ | 650 | /* start remote requests */ |
651 | if (NULL != retry_task) | 651 | if (NULL != retry_task) |
@@ -867,7 +867,7 @@ struct ForwardReplyContext | |||
867 | /** | 867 | /** |
868 | * GET path taken. | 868 | * GET path taken. |
869 | */ | 869 | */ |
870 | const struct GNUNET_PeerIdentity *get_path; | 870 | const struct GNUNET_DHT_PathElement *get_path; |
871 | 871 | ||
872 | /** | 872 | /** |
873 | * Number of entries in @e get_path. | 873 | * Number of entries in @e get_path. |
@@ -900,7 +900,7 @@ forward_reply (void *cls, | |||
900 | enum GNUNET_BLOCK_ReplyEvaluationResult eval; | 900 | enum GNUNET_BLOCK_ReplyEvaluationResult eval; |
901 | bool do_free; | 901 | bool do_free; |
902 | struct GNUNET_HashCode ch; | 902 | struct GNUNET_HashCode ch; |
903 | struct GNUNET_PeerIdentity *paths; | 903 | struct GNUNET_DHT_PathElement *paths; |
904 | 904 | ||
905 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | 905 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, |
906 | "CLIENT-RESULT %s\n", | 906 | "CLIENT-RESULT %s\n", |
@@ -989,7 +989,7 @@ forward_reply (void *cls, | |||
989 | env = GNUNET_MQ_msg_extra (reply, | 989 | env = GNUNET_MQ_msg_extra (reply, |
990 | frc->bd->data_size | 990 | frc->bd->data_size |
991 | + (frc->get_path_length + frc->bd->put_path_length) | 991 | + (frc->get_path_length + frc->bd->put_path_length) |
992 | * sizeof(struct GNUNET_PeerIdentity), | 992 | * sizeof(struct GNUNET_DHT_PathElement), |
993 | GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT); | 993 | GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT); |
994 | reply->type = htonl (frc->bd->type); | 994 | reply->type = htonl (frc->bd->type); |
995 | reply->get_path_length = htonl (frc->get_path_length); | 995 | reply->get_path_length = htonl (frc->get_path_length); |
@@ -997,13 +997,14 @@ forward_reply (void *cls, | |||
997 | reply->unique_id = record->unique_id; | 997 | reply->unique_id = record->unique_id; |
998 | reply->expiration = GNUNET_TIME_absolute_hton (frc->bd->expiration_time); | 998 | reply->expiration = GNUNET_TIME_absolute_hton (frc->bd->expiration_time); |
999 | reply->key = frc->bd->key; | 999 | reply->key = frc->bd->key; |
1000 | paths = (struct GNUNET_PeerIdentity *) &reply[1]; | 1000 | paths = (struct GNUNET_DHT_PathElement *) &reply[1]; |
1001 | GNUNET_memcpy (paths, | 1001 | GNUNET_memcpy (paths, |
1002 | frc->bd->put_path, | 1002 | frc->bd->put_path, |
1003 | sizeof(struct GNUNET_PeerIdentity) * frc->bd->put_path_length); | 1003 | sizeof(struct GNUNET_DHT_PathElement) |
1004 | * frc->bd->put_path_length); | ||
1004 | GNUNET_memcpy (&paths[frc->bd->put_path_length], | 1005 | GNUNET_memcpy (&paths[frc->bd->put_path_length], |
1005 | frc->get_path, | 1006 | frc->get_path, |
1006 | sizeof(struct GNUNET_PeerIdentity) * frc->get_path_length); | 1007 | sizeof(struct GNUNET_DHT_PathElement) * frc->get_path_length); |
1007 | GNUNET_memcpy (&paths[frc->get_path_length + frc->bd->put_path_length], | 1008 | GNUNET_memcpy (&paths[frc->get_path_length + frc->bd->put_path_length], |
1008 | frc->bd->data, | 1009 | frc->bd->data, |
1009 | frc->bd->data_size); | 1010 | frc->bd->data_size); |
@@ -1023,13 +1024,13 @@ void | |||
1023 | GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd, | 1024 | GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd, |
1024 | const struct GNUNET_HashCode *query_hash, | 1025 | const struct GNUNET_HashCode *query_hash, |
1025 | unsigned int get_path_length, | 1026 | unsigned int get_path_length, |
1026 | const struct GNUNET_PeerIdentity *get_path) | 1027 | const struct GNUNET_DHT_PathElement *get_path) |
1027 | { | 1028 | { |
1028 | struct ForwardReplyContext frc; | 1029 | struct ForwardReplyContext frc; |
1029 | size_t msize = sizeof (struct GNUNET_DHT_ClientResultMessage) | 1030 | size_t msize = sizeof (struct GNUNET_DHT_ClientResultMessage) |
1030 | + bd->data_size | 1031 | + bd->data_size |
1031 | + (get_path_length + bd->put_path_length) | 1032 | + (get_path_length + bd->put_path_length) |
1032 | * sizeof(struct GNUNET_PeerIdentity); | 1033 | * sizeof(struct GNUNET_DHT_PathElement); |
1033 | 1034 | ||
1034 | if (msize >= GNUNET_MAX_MESSAGE_SIZE) | 1035 | if (msize >= GNUNET_MAX_MESSAGE_SIZE) |
1035 | { | 1036 | { |
@@ -1203,7 +1204,7 @@ struct GetActionContext | |||
1203 | uint32_t hop_count; | 1204 | uint32_t hop_count; |
1204 | uint32_t desired_replication_level; | 1205 | uint32_t desired_replication_level; |
1205 | unsigned int get_path_length; | 1206 | unsigned int get_path_length; |
1206 | const struct GNUNET_PeerIdentity *get_path; | 1207 | const struct GNUNET_DHT_PathElement *get_path; |
1207 | const struct GNUNET_HashCode *key; | 1208 | const struct GNUNET_HashCode *key; |
1208 | }; | 1209 | }; |
1209 | 1210 | ||
@@ -1222,10 +1223,10 @@ get_action (void *cls, | |||
1222 | struct GetActionContext *gac = cls; | 1223 | struct GetActionContext *gac = cls; |
1223 | struct GNUNET_MQ_Envelope *env; | 1224 | struct GNUNET_MQ_Envelope *env; |
1224 | struct GNUNET_DHT_MonitorGetMessage *mmsg; | 1225 | struct GNUNET_DHT_MonitorGetMessage *mmsg; |
1225 | struct GNUNET_PeerIdentity *msg_path; | 1226 | struct GNUNET_DHT_PathElement *msg_path; |
1226 | size_t msize; | 1227 | size_t msize; |
1227 | 1228 | ||
1228 | msize = gac->get_path_length * sizeof(struct GNUNET_PeerIdentity); | 1229 | msize = gac->get_path_length * sizeof(struct GNUNET_DHT_PathElement); |
1229 | env = GNUNET_MQ_msg_extra (mmsg, | 1230 | env = GNUNET_MQ_msg_extra (mmsg, |
1230 | msize, | 1231 | msize, |
1231 | GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET); | 1232 | GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET); |
@@ -1235,10 +1236,10 @@ get_action (void *cls, | |||
1235 | mmsg->desired_replication_level = htonl (gac->desired_replication_level); | 1236 | mmsg->desired_replication_level = htonl (gac->desired_replication_level); |
1236 | mmsg->get_path_length = htonl (gac->get_path_length); | 1237 | mmsg->get_path_length = htonl (gac->get_path_length); |
1237 | mmsg->key = *gac->key; | 1238 | mmsg->key = *gac->key; |
1238 | msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; | 1239 | msg_path = (struct GNUNET_DHT_PathElement *) &mmsg[1]; |
1239 | GNUNET_memcpy (msg_path, | 1240 | GNUNET_memcpy (msg_path, |
1240 | gac->get_path, | 1241 | gac->get_path, |
1241 | gac->get_path_length * sizeof(struct GNUNET_PeerIdentity)); | 1242 | gac->get_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
1242 | GNUNET_MQ_send (m->ch->mq, | 1243 | GNUNET_MQ_send (m->ch->mq, |
1243 | env); | 1244 | env); |
1244 | } | 1245 | } |
@@ -1262,7 +1263,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options, | |||
1262 | uint32_t hop_count, | 1263 | uint32_t hop_count, |
1263 | uint32_t desired_replication_level, | 1264 | uint32_t desired_replication_level, |
1264 | unsigned int path_length, | 1265 | unsigned int path_length, |
1265 | const struct GNUNET_PeerIdentity *path, | 1266 | const struct GNUNET_DHT_PathElement *path, |
1266 | const struct GNUNET_HashCode *key) | 1267 | const struct GNUNET_HashCode *key) |
1267 | { | 1268 | { |
1268 | struct GetActionContext gac = { | 1269 | struct GetActionContext gac = { |
@@ -1288,7 +1289,7 @@ GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options, | |||
1288 | struct ResponseActionContext | 1289 | struct ResponseActionContext |
1289 | { | 1290 | { |
1290 | const struct GDS_DATACACHE_BlockData *bd; | 1291 | const struct GDS_DATACACHE_BlockData *bd; |
1291 | const struct GNUNET_PeerIdentity *get_path; | 1292 | const struct GNUNET_DHT_PathElement *get_path; |
1292 | unsigned int get_path_length; | 1293 | unsigned int get_path_length; |
1293 | }; | 1294 | }; |
1294 | 1295 | ||
@@ -1309,12 +1310,12 @@ response_action (void *cls, | |||
1309 | 1310 | ||
1310 | struct GNUNET_MQ_Envelope *env; | 1311 | struct GNUNET_MQ_Envelope *env; |
1311 | struct GNUNET_DHT_MonitorGetRespMessage *mmsg; | 1312 | struct GNUNET_DHT_MonitorGetRespMessage *mmsg; |
1312 | struct GNUNET_PeerIdentity *path; | 1313 | struct GNUNET_DHT_PathElement *path; |
1313 | size_t msize; | 1314 | size_t msize; |
1314 | 1315 | ||
1315 | msize = bd->data_size; | 1316 | msize = bd->data_size; |
1316 | msize += (resp_ctx->get_path_length + bd->put_path_length) | 1317 | msize += (resp_ctx->get_path_length + bd->put_path_length) |
1317 | * sizeof(struct GNUNET_PeerIdentity); | 1318 | * sizeof(struct GNUNET_DHT_PathElement); |
1318 | env = GNUNET_MQ_msg_extra (mmsg, | 1319 | env = GNUNET_MQ_msg_extra (mmsg, |
1319 | msize, | 1320 | msize, |
1320 | GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP); | 1321 | GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP); |
@@ -1323,14 +1324,14 @@ response_action (void *cls, | |||
1323 | mmsg->get_path_length = htonl (resp_ctx->get_path_length); | 1324 | mmsg->get_path_length = htonl (resp_ctx->get_path_length); |
1324 | mmsg->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); | 1325 | mmsg->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); |
1325 | mmsg->key = bd->key; | 1326 | mmsg->key = bd->key; |
1326 | path = (struct GNUNET_PeerIdentity *) &mmsg[1]; | 1327 | path = (struct GNUNET_DHT_PathElement *) &mmsg[1]; |
1327 | GNUNET_memcpy (path, | 1328 | GNUNET_memcpy (path, |
1328 | bd->put_path, | 1329 | bd->put_path, |
1329 | bd->put_path_length * sizeof(struct GNUNET_PeerIdentity)); | 1330 | bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
1330 | GNUNET_memcpy (path, | 1331 | GNUNET_memcpy (path, |
1331 | resp_ctx->get_path, | 1332 | resp_ctx->get_path, |
1332 | resp_ctx->get_path_length * sizeof(struct | 1333 | resp_ctx->get_path_length * sizeof(struct |
1333 | GNUNET_PeerIdentity)); | 1334 | GNUNET_DHT_PathElement)); |
1334 | GNUNET_memcpy (&path[resp_ctx->get_path_length], | 1335 | GNUNET_memcpy (&path[resp_ctx->get_path_length], |
1335 | bd->data, | 1336 | bd->data, |
1336 | bd->data_size); | 1337 | bd->data_size); |
@@ -1341,7 +1342,7 @@ response_action (void *cls, | |||
1341 | 1342 | ||
1342 | void | 1343 | void |
1343 | GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd, | 1344 | GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd, |
1344 | const struct GNUNET_PeerIdentity *get_path, | 1345 | const struct GNUNET_DHT_PathElement *get_path, |
1345 | unsigned int get_path_length) | 1346 | unsigned int get_path_length) |
1346 | { | 1347 | { |
1347 | struct ResponseActionContext rac = { | 1348 | struct ResponseActionContext rac = { |
@@ -1384,12 +1385,12 @@ put_action (void *cls, | |||
1384 | const struct GDS_DATACACHE_BlockData *bd = put_ctx->bd; | 1385 | const struct GDS_DATACACHE_BlockData *bd = put_ctx->bd; |
1385 | struct GNUNET_MQ_Envelope *env; | 1386 | struct GNUNET_MQ_Envelope *env; |
1386 | struct GNUNET_DHT_MonitorPutMessage *mmsg; | 1387 | struct GNUNET_DHT_MonitorPutMessage *mmsg; |
1387 | struct GNUNET_PeerIdentity *msg_path; | 1388 | struct GNUNET_DHT_PathElement *msg_path; |
1388 | size_t msize; | 1389 | size_t msize; |
1389 | 1390 | ||
1390 | msize = bd->data_size | 1391 | msize = bd->data_size |
1391 | + bd->put_path_length | 1392 | + bd->put_path_length |
1392 | * sizeof(struct GNUNET_PeerIdentity); | 1393 | * sizeof(struct GNUNET_DHT_PathElement); |
1393 | env = GNUNET_MQ_msg_extra (mmsg, | 1394 | env = GNUNET_MQ_msg_extra (mmsg, |
1394 | msize, | 1395 | msize, |
1395 | GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT); | 1396 | GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT); |
@@ -1400,10 +1401,10 @@ put_action (void *cls, | |||
1400 | mmsg->put_path_length = htonl (bd->put_path_length); | 1401 | mmsg->put_path_length = htonl (bd->put_path_length); |
1401 | mmsg->key = bd->key; | 1402 | mmsg->key = bd->key; |
1402 | mmsg->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); | 1403 | mmsg->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); |
1403 | msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; | 1404 | msg_path = (struct GNUNET_DHT_PathElement *) &mmsg[1]; |
1404 | GNUNET_memcpy (msg_path, | 1405 | GNUNET_memcpy (msg_path, |
1405 | bd->put_path, | 1406 | bd->put_path, |
1406 | bd->put_path_length * sizeof(struct GNUNET_PeerIdentity)); | 1407 | bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
1407 | GNUNET_memcpy (&msg_path[bd->put_path_length], | 1408 | GNUNET_memcpy (&msg_path[bd->put_path_length], |
1408 | bd->data, | 1409 | bd->data, |
1409 | bd->data_size); | 1410 | bd->data_size); |
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 214c4a3f4..cb778717b 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c | |||
@@ -152,7 +152,7 @@ datacache_get_iterator (void *cls, | |||
152 | enum GNUNET_BLOCK_Type type, | 152 | enum GNUNET_BLOCK_Type type, |
153 | struct GNUNET_TIME_Absolute exp, | 153 | struct GNUNET_TIME_Absolute exp, |
154 | unsigned int put_path_length, | 154 | unsigned int put_path_length, |
155 | const struct GNUNET_PeerIdentity *put_path) | 155 | const struct GNUNET_DHT_PathElement *put_path) |
156 | { | 156 | { |
157 | struct GetRequestContext *ctx = cls; | 157 | struct GetRequestContext *ctx = cls; |
158 | enum GNUNET_BLOCK_ReplyEvaluationResult eval; | 158 | enum GNUNET_BLOCK_ReplyEvaluationResult eval; |
@@ -301,7 +301,8 @@ datacache_get_successors_iterator (void *cls, | |||
301 | enum GNUNET_BLOCK_Type type, | 301 | enum GNUNET_BLOCK_Type type, |
302 | struct GNUNET_TIME_Absolute exp, | 302 | struct GNUNET_TIME_Absolute exp, |
303 | unsigned int put_path_length, | 303 | unsigned int put_path_length, |
304 | const struct GNUNET_PeerIdentity *put_path) | 304 | const struct |
305 | GNUNET_DHT_PathElement *put_path) | ||
305 | { | 306 | { |
306 | const struct SuccContext *sc = cls; | 307 | const struct SuccContext *sc = cls; |
307 | struct GDS_DATACACHE_BlockData bd = { | 308 | struct GDS_DATACACHE_BlockData bd = { |
diff --git a/src/dht/gnunet-service-dht_datacache.h b/src/dht/gnunet-service-dht_datacache.h index 249bb8ee3..691a51e0e 100644 --- a/src/dht/gnunet-service-dht_datacache.h +++ b/src/dht/gnunet-service-dht_datacache.h | |||
@@ -50,7 +50,7 @@ struct GDS_DATACACHE_BlockData | |||
50 | /** | 50 | /** |
51 | * PUT path taken by the block, array of peer identities. | 51 | * PUT path taken by the block, array of peer identities. |
52 | */ | 52 | */ |
53 | const struct GNUNET_PeerIdentity *put_path; | 53 | const struct GNUNET_DHT_PathElement *put_path; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Actual block data. | 56 | * Actual block data. |
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 35502e0f5..e100ae2ee 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -346,11 +346,6 @@ struct ConnectInfo | |||
346 | static int cache_results; | 346 | static int cache_results; |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * Should routing details be logged to stderr (for debugging)? | ||
350 | */ | ||
351 | static int log_route_details_stderr; | ||
352 | |||
353 | /** | ||
354 | * The lowest currently used bucket, initially 0 (for 0-bits matching bucket). | 349 | * The lowest currently used bucket, initially 0 (for 0-bits matching bucket). |
355 | */ | 350 | */ |
356 | static unsigned int closest_bucket; | 351 | static unsigned int closest_bucket; |
@@ -1437,7 +1432,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, | |||
1437 | struct GNUNET_MQ_Envelope *env; | 1432 | struct GNUNET_MQ_Envelope *env; |
1438 | struct PeerGetMessage *pgm; | 1433 | struct PeerGetMessage *pgm; |
1439 | char *xq; | 1434 | char *xq; |
1440 | 1435 | ||
1441 | if (GNUNET_MQ_get_length (target->mq) >= MAXIMUM_PENDING_PER_PEER) | 1436 | if (GNUNET_MQ_get_length (target->mq) >= MAXIMUM_PENDING_PER_PEER) |
1442 | { | 1437 | { |
1443 | /* skip */ | 1438 | /* skip */ |
@@ -1503,20 +1498,20 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi, | |||
1503 | const struct GDS_DATACACHE_BlockData *bd, | 1498 | const struct GDS_DATACACHE_BlockData *bd, |
1504 | const struct GNUNET_HashCode *query_hash, | 1499 | const struct GNUNET_HashCode *query_hash, |
1505 | unsigned int get_path_length, | 1500 | unsigned int get_path_length, |
1506 | const struct GNUNET_PeerIdentity *get_path) | 1501 | const struct GNUNET_DHT_PathElement *get_path) |
1507 | { | 1502 | { |
1508 | struct GNUNET_MQ_Envelope *env; | 1503 | struct GNUNET_MQ_Envelope *env; |
1509 | struct PeerResultMessage *prm; | 1504 | struct PeerResultMessage *prm; |
1510 | struct GNUNET_PeerIdentity *paths; | 1505 | struct GNUNET_DHT_PathElement *paths; |
1511 | size_t msize; | 1506 | size_t msize; |
1512 | 1507 | ||
1513 | msize = bd->data_size + (get_path_length + bd->put_path_length) | 1508 | msize = bd->data_size + (get_path_length + bd->put_path_length) |
1514 | * sizeof(struct GNUNET_PeerIdentity); | 1509 | * sizeof(struct GNUNET_DHT_PathElement); |
1515 | if ( (msize + sizeof(struct PeerResultMessage) >= GNUNET_MAX_MESSAGE_SIZE) || | 1510 | if ( (msize + sizeof(struct PeerResultMessage) >= GNUNET_MAX_MESSAGE_SIZE) || |
1516 | (get_path_length > | 1511 | (get_path_length > |
1517 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) || | 1512 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) || |
1518 | (bd->put_path_length > | 1513 | (bd->put_path_length > |
1519 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) || | 1514 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) || |
1520 | (bd->data_size > GNUNET_MAX_MESSAGE_SIZE)) | 1515 | (bd->data_size > GNUNET_MAX_MESSAGE_SIZE)) |
1521 | { | 1516 | { |
1522 | GNUNET_break (0); | 1517 | GNUNET_break (0); |
@@ -1551,13 +1546,13 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi, | |||
1551 | prm->get_path_length = htonl (get_path_length); | 1546 | prm->get_path_length = htonl (get_path_length); |
1552 | prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); | 1547 | prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); |
1553 | prm->key = *query_hash; | 1548 | prm->key = *query_hash; |
1554 | paths = (struct GNUNET_PeerIdentity *) &prm[1]; | 1549 | paths = (struct GNUNET_DHT_PathElement *) &prm[1]; |
1555 | GNUNET_memcpy (paths, | 1550 | GNUNET_memcpy (paths, |
1556 | bd->put_path, | 1551 | bd->put_path, |
1557 | bd->put_path_length * sizeof(struct GNUNET_PeerIdentity)); | 1552 | bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
1558 | GNUNET_memcpy (&paths[bd->put_path_length], | 1553 | GNUNET_memcpy (&paths[bd->put_path_length], |
1559 | get_path, | 1554 | get_path, |
1560 | get_path_length * sizeof(struct GNUNET_PeerIdentity)); | 1555 | get_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
1561 | GNUNET_memcpy (&paths[bd->put_path_length + get_path_length], | 1556 | GNUNET_memcpy (&paths[bd->put_path_length + get_path_length], |
1562 | bd->data, | 1557 | bd->data, |
1563 | bd->data_size); | 1558 | bd->data_size); |
@@ -1582,7 +1577,7 @@ core_init (void *cls, | |||
1582 | GNUNET_i2s (identity)); | 1577 | GNUNET_i2s (identity)); |
1583 | my_identity = *identity; | 1578 | my_identity = *identity; |
1584 | GNUNET_CRYPTO_hash (identity, | 1579 | GNUNET_CRYPTO_hash (identity, |
1585 | sizeof(struct GNUNET_PeerIdentity), | 1580 | sizeof(struct GNUNET_PeerIdentity), |
1586 | &my_identity_hash); | 1581 | &my_identity_hash); |
1587 | GNUNET_SERVICE_resume (GDS_service); | 1582 | GNUNET_SERVICE_resume (GDS_service); |
1588 | } | 1583 | } |
@@ -1605,9 +1600,9 @@ check_dht_p2p_put (void *cls, | |||
1605 | (void) cls; | 1600 | (void) cls; |
1606 | if ( (msize < | 1601 | if ( (msize < |
1607 | sizeof(struct PeerPutMessage) | 1602 | sizeof(struct PeerPutMessage) |
1608 | + putlen * sizeof(struct GNUNET_PeerIdentity)) || | 1603 | + putlen * sizeof(struct GNUNET_DHT_PathElement)) || |
1609 | (putlen > | 1604 | (putlen > |
1610 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) ) | 1605 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ) |
1611 | { | 1606 | { |
1612 | GNUNET_break_op (0); | 1607 | GNUNET_break_op (0); |
1613 | return GNUNET_SYSERR; | 1608 | return GNUNET_SYSERR; |
@@ -1635,13 +1630,13 @@ handle_dht_p2p_put (void *cls, | |||
1635 | .expiration_time = GNUNET_TIME_absolute_ntoh (put->expiration_time), | 1630 | .expiration_time = GNUNET_TIME_absolute_ntoh (put->expiration_time), |
1636 | .type = ntohl (put->type) | 1631 | .type = ntohl (put->type) |
1637 | }; | 1632 | }; |
1638 | const struct GNUNET_PeerIdentity *put_path | 1633 | const struct GNUNET_DHT_PathElement *put_path |
1639 | = (const struct GNUNET_PeerIdentity *) &put[1]; | 1634 | = (const struct GNUNET_DHT_PathElement *) &put[1]; |
1640 | uint32_t putlen | 1635 | uint32_t putlen |
1641 | = ntohl (put->put_path_length); | 1636 | = ntohl (put->put_path_length); |
1642 | 1637 | ||
1643 | bd.data_size = msize - (sizeof(*put) | 1638 | bd.data_size = msize - (sizeof(*put) |
1644 | + putlen * sizeof(struct GNUNET_PeerIdentity)); | 1639 | + putlen * sizeof(struct GNUNET_DHT_PathElement)); |
1645 | bd.data = &put_path[putlen]; | 1640 | bd.data = &put_path[putlen]; |
1646 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1641 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1647 | "PUT for `%s' from %s\n", | 1642 | "PUT for `%s' from %s\n", |
@@ -1663,35 +1658,6 @@ handle_dht_p2p_put (void *cls, | |||
1663 | "# P2P PUT bytes received", | 1658 | "# P2P PUT bytes received", |
1664 | msize, | 1659 | msize, |
1665 | GNUNET_NO); | 1660 | GNUNET_NO); |
1666 | if (GNUNET_YES == log_route_details_stderr) | ||
1667 | { | ||
1668 | char *tmp; | ||
1669 | char *pp; | ||
1670 | struct GNUNET_HashCode mxor; | ||
1671 | struct GNUNET_HashCode pxor; | ||
1672 | |||
1673 | GNUNET_CRYPTO_hash_xor (&my_identity_hash, | ||
1674 | &put->key, | ||
1675 | &mxor); | ||
1676 | GNUNET_CRYPTO_hash_xor (&peer->phash, | ||
1677 | &put->key, | ||
1678 | &pxor); | ||
1679 | pp = GNUNET_STRINGS_pp2s (put_path, | ||
1680 | putlen); | ||
1681 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); | ||
1682 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | ||
1683 | "R5N PUT %s: %s->%s (%u, %u=>%u, PP: %s)\n", | ||
1684 | GNUNET_h2s (&put->key), | ||
1685 | GNUNET_i2s (peer->id), | ||
1686 | tmp, | ||
1687 | ntohl (put->hop_count), | ||
1688 | GNUNET_CRYPTO_hash_count_leading_zeros (&pxor), | ||
1689 | GNUNET_CRYPTO_hash_count_leading_zeros (&mxor), | ||
1690 | pp); | ||
1691 | GNUNET_free (pp); | ||
1692 | GNUNET_free (tmp); | ||
1693 | } | ||
1694 | |||
1695 | { | 1661 | { |
1696 | struct GNUNET_HashCode test_key; | 1662 | struct GNUNET_HashCode test_key; |
1697 | enum GNUNET_GenericReturnValue ret; | 1663 | enum GNUNET_GenericReturnValue ret; |
@@ -1733,7 +1699,7 @@ handle_dht_p2p_put (void *cls, | |||
1733 | 1699 | ||
1734 | { | 1700 | { |
1735 | struct GNUNET_CONTAINER_BloomFilter *bf; | 1701 | struct GNUNET_CONTAINER_BloomFilter *bf; |
1736 | struct GNUNET_PeerIdentity pp[putlen + 1]; | 1702 | struct GNUNET_DHT_PathElement pp[putlen + 1]; |
1737 | 1703 | ||
1738 | bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, | 1704 | bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, |
1739 | DHT_BLOOM_SIZE, | 1705 | DHT_BLOOM_SIZE, |
@@ -1742,7 +1708,7 @@ handle_dht_p2p_put (void *cls, | |||
1742 | GNUNET_CONTAINER_bloomfilter_test (bf, | 1708 | GNUNET_CONTAINER_bloomfilter_test (bf, |
1743 | &peer->phash)); | 1709 | &peer->phash)); |
1744 | /* extend 'put path' by sender */ | 1710 | /* extend 'put path' by sender */ |
1745 | bd.put_path = (const struct GNUNET_PeerIdentity *) pp; | 1711 | bd.put_path = (const struct GNUNET_DHT_PathElement *) pp; |
1746 | bd.put_path_length = putlen + 1; | 1712 | bd.put_path_length = putlen + 1; |
1747 | if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) | 1713 | if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) |
1748 | { | 1714 | { |
@@ -1752,18 +1718,22 @@ handle_dht_p2p_put (void *cls, | |||
1752 | for (unsigned int j = 0; j < i; j++) | 1718 | for (unsigned int j = 0; j < i; j++) |
1753 | { | 1719 | { |
1754 | GNUNET_break (0 != | 1720 | GNUNET_break (0 != |
1755 | GNUNET_memcmp (&pp[i], | 1721 | GNUNET_memcmp (&pp[i].pred, |
1756 | &pp[j])); | 1722 | &pp[j].pred)); |
1757 | } | 1723 | } |
1758 | GNUNET_break (0 != | 1724 | GNUNET_break (0 != |
1759 | GNUNET_memcmp (&pp[i], | 1725 | GNUNET_memcmp (&pp[i].pred, |
1760 | peer->id)); | 1726 | peer->id)); |
1761 | } | 1727 | } |
1762 | #endif | 1728 | #endif |
1763 | GNUNET_memcpy (pp, | 1729 | GNUNET_memcpy (pp, |
1764 | put_path, | 1730 | put_path, |
1765 | putlen * sizeof(struct GNUNET_PeerIdentity)); | 1731 | putlen * sizeof(struct GNUNET_DHT_PathElement)); |
1766 | pp[putlen] = *peer->id; | 1732 | pp[putlen].pred = *peer->id; |
1733 | /* zero-out signature, not valid until we actually do forward! */ | ||
1734 | memset (&pp[putlen].sig, | ||
1735 | 0, | ||
1736 | sizeof (pp[putlen].sig)); | ||
1767 | putlen++; | 1737 | putlen++; |
1768 | } | 1738 | } |
1769 | else | 1739 | else |
@@ -1938,17 +1908,6 @@ handle_local_result (void *cls, | |||
1938 | { | 1908 | { |
1939 | struct PeerInfo *peer = cls; | 1909 | struct PeerInfo *peer = cls; |
1940 | 1910 | ||
1941 | { | ||
1942 | char *pp; | ||
1943 | |||
1944 | pp = GNUNET_STRINGS_pp2s (bd->put_path, | ||
1945 | bd->put_path_length); | ||
1946 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1947 | "Found local result for %s (PP: %s)\n", | ||
1948 | GNUNET_h2s (&bd->key), | ||
1949 | pp); | ||
1950 | GNUNET_free (pp); | ||
1951 | } | ||
1952 | GDS_NEIGHBOURS_handle_reply (peer, | 1911 | GDS_NEIGHBOURS_handle_reply (peer, |
1953 | bd, | 1912 | bd, |
1954 | &bd->key, | 1913 | &bd->key, |
@@ -1996,7 +1955,8 @@ handle_dht_p2p_get (void *cls, | |||
1996 | uint32_t hop_count = ntohl (get->hop_count); | 1955 | uint32_t hop_count = ntohl (get->hop_count); |
1997 | size_t reply_bf_size = msize - (sizeof(*get) + xquery_size); | 1956 | size_t reply_bf_size = msize - (sizeof(*get) + xquery_size); |
1998 | enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type); | 1957 | enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type); |
1999 | enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohl (get->options); | 1958 | enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohl ( |
1959 | get->options); | ||
2000 | enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE; | 1960 | enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE; |
2001 | const void *xquery = (const void *) &get[1]; | 1961 | const void *xquery = (const void *) &get[1]; |
2002 | 1962 | ||
@@ -2009,31 +1969,6 @@ handle_dht_p2p_get (void *cls, | |||
2009 | "# P2P GET bytes received", | 1969 | "# P2P GET bytes received", |
2010 | msize, | 1970 | msize, |
2011 | GNUNET_NO); | 1971 | GNUNET_NO); |
2012 | if (GNUNET_YES == log_route_details_stderr) | ||
2013 | { | ||
2014 | char *tmp; | ||
2015 | struct GNUNET_HashCode mxor; | ||
2016 | struct GNUNET_HashCode pxor; | ||
2017 | |||
2018 | GNUNET_CRYPTO_hash_xor (&my_identity_hash, | ||
2019 | &get->key, | ||
2020 | &mxor); | ||
2021 | GNUNET_CRYPTO_hash_xor (&peer->phash, | ||
2022 | &get->key, | ||
2023 | &pxor); | ||
2024 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); | ||
2025 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | ||
2026 | "R5N GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n", | ||
2027 | GNUNET_h2s (&get->key), | ||
2028 | GNUNET_i2s (peer->id), | ||
2029 | tmp, | ||
2030 | hop_count, | ||
2031 | GNUNET_CRYPTO_hash_count_leading_zeros (&pxor), | ||
2032 | GNUNET_CRYPTO_hash_count_leading_zeros (&mxor), | ||
2033 | ntohl (get->xquery_size), | ||
2034 | (const char *) xquery); | ||
2035 | GNUNET_free (tmp); | ||
2036 | } | ||
2037 | if (GNUNET_NO == | 1972 | if (GNUNET_NO == |
2038 | GNUNET_BLOCK_check_query (GDS_block_context, | 1973 | GNUNET_BLOCK_check_query (GDS_block_context, |
2039 | type, | 1974 | type, |
@@ -2096,13 +2031,13 @@ handle_dht_p2p_get (void *cls, | |||
2096 | } | 2031 | } |
2097 | } | 2032 | } |
2098 | else | 2033 | else |
2099 | { | 2034 | { |
2100 | GNUNET_STATISTICS_update (GDS_stats, | 2035 | GNUNET_STATISTICS_update (GDS_stats, |
2101 | "# P2P GET requests ONLY routed", | 2036 | "# P2P GET requests ONLY routed", |
2102 | 1, | 2037 | 1, |
2103 | GNUNET_NO); | 2038 | GNUNET_NO); |
2104 | } | 2039 | } |
2105 | 2040 | ||
2106 | /* remember request for routing replies */ | 2041 | /* remember request for routing replies */ |
2107 | GDS_ROUTING_add (peer->id, | 2042 | GDS_ROUTING_add (peer->id, |
2108 | type, | 2043 | type, |
@@ -2115,7 +2050,8 @@ handle_dht_p2p_get (void *cls, | |||
2115 | /* P2P forwarding */ | 2050 | /* P2P forwarding */ |
2116 | { | 2051 | { |
2117 | bool forwarded = false; | 2052 | bool forwarded = false; |
2118 | uint32_t desired_replication_level = ntohl (get->desired_replication_level); | 2053 | uint32_t desired_replication_level = ntohl ( |
2054 | get->desired_replication_level); | ||
2119 | 2055 | ||
2120 | if (eval != GNUNET_BLOCK_REPLY_OK_LAST) | 2056 | if (eval != GNUNET_BLOCK_REPLY_OK_LAST) |
2121 | forwarded = (GNUNET_OK == | 2057 | forwarded = (GNUNET_OK == |
@@ -2129,8 +2065,8 @@ handle_dht_p2p_get (void *cls, | |||
2129 | bg, | 2065 | bg, |
2130 | peer_bf)); | 2066 | peer_bf)); |
2131 | GDS_CLIENTS_process_get ( | 2067 | GDS_CLIENTS_process_get ( |
2132 | options | | 2068 | options |
2133 | (forwarded | 2069 | | (forwarded |
2134 | ? 0 | 2070 | ? 0 |
2135 | : GNUNET_DHT_RO_LAST_HOP), | 2071 | : GNUNET_DHT_RO_LAST_HOP), |
2136 | type, | 2072 | type, |
@@ -2158,7 +2094,7 @@ static void | |||
2158 | process_reply_with_path (const struct GDS_DATACACHE_BlockData *bd, | 2094 | process_reply_with_path (const struct GDS_DATACACHE_BlockData *bd, |
2159 | const struct GNUNET_HashCode *query_hash, | 2095 | const struct GNUNET_HashCode *query_hash, |
2160 | unsigned int get_path_length, | 2096 | unsigned int get_path_length, |
2161 | const struct GNUNET_PeerIdentity *get_path) | 2097 | const struct GNUNET_DHT_PathElement *get_path) |
2162 | { | 2098 | { |
2163 | /* forward to local clients */ | 2099 | /* forward to local clients */ |
2164 | GDS_CLIENTS_handle_reply (bd, | 2100 | GDS_CLIENTS_handle_reply (bd, |
@@ -2170,16 +2106,16 @@ process_reply_with_path (const struct GDS_DATACACHE_BlockData *bd, | |||
2170 | get_path_length); | 2106 | get_path_length); |
2171 | if (GNUNET_YES == cache_results) | 2107 | if (GNUNET_YES == cache_results) |
2172 | { | 2108 | { |
2173 | struct GNUNET_PeerIdentity xput_path[GNUNET_NZL (get_path_length | 2109 | struct GNUNET_DHT_PathElement xput_path[GNUNET_NZL (get_path_length |
2174 | + bd->put_path_length)]; | 2110 | + bd->put_path_length)]; |
2175 | struct GDS_DATACACHE_BlockData bdx = *bd; | 2111 | struct GDS_DATACACHE_BlockData bdx = *bd; |
2176 | 2112 | ||
2177 | GNUNET_memcpy (xput_path, | 2113 | GNUNET_memcpy (xput_path, |
2178 | bd->put_path, | 2114 | bd->put_path, |
2179 | bd->put_path_length * sizeof(struct GNUNET_PeerIdentity)); | 2115 | bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
2180 | GNUNET_memcpy (&xput_path[bd->put_path_length], | 2116 | GNUNET_memcpy (&xput_path[bd->put_path_length], |
2181 | get_path, | 2117 | get_path, |
2182 | get_path_length * sizeof(struct GNUNET_PeerIdentity)); | 2118 | get_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
2183 | bdx.put_path = xput_path; | 2119 | bdx.put_path = xput_path; |
2184 | bdx.put_path_length += get_path_length; | 2120 | bdx.put_path_length += get_path_length; |
2185 | GDS_DATACACHE_handle_put (&bdx); | 2121 | GDS_DATACACHE_handle_put (&bdx); |
@@ -2211,11 +2147,11 @@ check_dht_p2p_result (void *cls, | |||
2211 | if ( (msize < | 2147 | if ( (msize < |
2212 | sizeof(struct PeerResultMessage) | 2148 | sizeof(struct PeerResultMessage) |
2213 | + (get_path_length + put_path_length) | 2149 | + (get_path_length + put_path_length) |
2214 | * sizeof(struct GNUNET_PeerIdentity)) || | 2150 | * sizeof(struct GNUNET_DHT_PathElement)) || |
2215 | (get_path_length > | 2151 | (get_path_length > |
2216 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) || | 2152 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) || |
2217 | (put_path_length > | 2153 | (put_path_length > |
2218 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_PeerIdentity)) ) | 2154 | GNUNET_MAX_MESSAGE_SIZE / sizeof(struct GNUNET_DHT_PathElement)) ) |
2219 | { | 2155 | { |
2220 | GNUNET_break_op (0); | 2156 | GNUNET_break_op (0); |
2221 | return GNUNET_SYSERR; | 2157 | return GNUNET_SYSERR; |
@@ -2239,11 +2175,11 @@ handle_dht_p2p_result (void *cls, | |||
2239 | uint32_t get_path_length = ntohl (prm->get_path_length); | 2175 | uint32_t get_path_length = ntohl (prm->get_path_length); |
2240 | struct GDS_DATACACHE_BlockData bd = { | 2176 | struct GDS_DATACACHE_BlockData bd = { |
2241 | .expiration_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time), | 2177 | .expiration_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time), |
2242 | .put_path = (const struct GNUNET_PeerIdentity *) &prm[1], | 2178 | .put_path = (const struct GNUNET_DHT_PathElement *) &prm[1], |
2243 | .put_path_length = ntohl (prm->put_path_length), | 2179 | .put_path_length = ntohl (prm->put_path_length), |
2244 | .type = ntohl (prm->type) | 2180 | .type = ntohl (prm->type) |
2245 | }; | 2181 | }; |
2246 | const struct GNUNET_PeerIdentity *get_path | 2182 | const struct GNUNET_DHT_PathElement *get_path |
2247 | = &bd.put_path[bd.put_path_length]; | 2183 | = &bd.put_path[bd.put_path_length]; |
2248 | 2184 | ||
2249 | /* parse and validate message */ | 2185 | /* parse and validate message */ |
@@ -2259,7 +2195,7 @@ handle_dht_p2p_result (void *cls, | |||
2259 | bd.data = (const void *) &get_path[get_path_length]; | 2195 | bd.data = (const void *) &get_path[get_path_length]; |
2260 | bd.data_size = msize - (sizeof(struct PeerResultMessage) | 2196 | bd.data_size = msize - (sizeof(struct PeerResultMessage) |
2261 | + (get_path_length + bd.put_path_length) | 2197 | + (get_path_length + bd.put_path_length) |
2262 | * sizeof(struct GNUNET_PeerIdentity)); | 2198 | * sizeof(struct GNUNET_DHT_PathElement)); |
2263 | GNUNET_STATISTICS_update (GDS_stats, | 2199 | GNUNET_STATISTICS_update (GDS_stats, |
2264 | "# P2P RESULTS received", | 2200 | "# P2P RESULTS received", |
2265 | 1, | 2201 | 1, |
@@ -2295,29 +2231,6 @@ handle_dht_p2p_result (void *cls, | |||
2295 | } | 2231 | } |
2296 | } | 2232 | } |
2297 | 2233 | ||
2298 | if (GNUNET_YES == log_route_details_stderr) | ||
2299 | { | ||
2300 | char *tmp; | ||
2301 | char *pp; | ||
2302 | char *gp; | ||
2303 | |||
2304 | gp = GNUNET_STRINGS_pp2s (get_path, | ||
2305 | get_path_length); | ||
2306 | pp = GNUNET_STRINGS_pp2s (bd.put_path, | ||
2307 | bd.put_path_length); | ||
2308 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); | ||
2309 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | ||
2310 | "R5N RESULT %s: %s->%s (GP: %s, PP: %s)\n", | ||
2311 | GNUNET_h2s (&prm->key), | ||
2312 | GNUNET_i2s (peer->id), | ||
2313 | tmp, | ||
2314 | gp, | ||
2315 | pp); | ||
2316 | GNUNET_free (gp); | ||
2317 | GNUNET_free (pp); | ||
2318 | GNUNET_free (tmp); | ||
2319 | } | ||
2320 | |||
2321 | /* if we got a HELLO, consider it for our own routing table */ | 2234 | /* if we got a HELLO, consider it for our own routing table */ |
2322 | if (GNUNET_BLOCK_TYPE_DHT_HELLO == bd.type) | 2235 | if (GNUNET_BLOCK_TYPE_DHT_HELLO == bd.type) |
2323 | { | 2236 | { |
@@ -2352,7 +2265,7 @@ handle_dht_p2p_result (void *cls, | |||
2352 | /* First, check if 'peer' is already on the path, and if | 2265 | /* First, check if 'peer' is already on the path, and if |
2353 | so, truncate it instead of expanding. */ | 2266 | so, truncate it instead of expanding. */ |
2354 | for (unsigned int i = 0; i <= get_path_length; i++) | 2267 | for (unsigned int i = 0; i <= get_path_length; i++) |
2355 | if (0 == GNUNET_memcmp (&get_path[i], | 2268 | if (0 == GNUNET_memcmp (&get_path[i].pred, |
2356 | peer->id)) | 2269 | peer->id)) |
2357 | { | 2270 | { |
2358 | process_reply_with_path (&bd, | 2271 | process_reply_with_path (&bd, |
@@ -2363,12 +2276,15 @@ handle_dht_p2p_result (void *cls, | |||
2363 | 2276 | ||
2364 | /* Need to append 'peer' to 'get_path' (normal case) */ | 2277 | /* Need to append 'peer' to 'get_path' (normal case) */ |
2365 | { | 2278 | { |
2366 | struct GNUNET_PeerIdentity xget_path[get_path_length + 1]; | 2279 | struct GNUNET_DHT_PathElement xget_path[get_path_length + 1]; |
2367 | 2280 | ||
2368 | GNUNET_memcpy (xget_path, | 2281 | GNUNET_memcpy (xget_path, |
2369 | get_path, | 2282 | get_path, |
2370 | get_path_length * sizeof(struct GNUNET_PeerIdentity)); | 2283 | get_path_length * sizeof(struct GNUNET_DHT_PathElement)); |
2371 | xget_path[get_path_length] = *peer->id; | 2284 | xget_path[get_path_length].pred = *peer->id; |
2285 | memset (&xget_path[get_path_length].sig, | ||
2286 | 0, | ||
2287 | sizeof (xget_path[get_path_length].sig)); | ||
2372 | process_reply_with_path (&bd, | 2288 | process_reply_with_path (&bd, |
2373 | &prm->key, | 2289 | &prm->key, |
2374 | get_path_length + 1, xget_path); | 2290 | get_path_length + 1, xget_path); |
@@ -2411,8 +2327,6 @@ GDS_NEIGHBOURS_init () | |||
2411 | "DHT", | 2327 | "DHT", |
2412 | "CACHE_RESULTS"); | 2328 | "CACHE_RESULTS"); |
2413 | 2329 | ||
2414 | log_route_details_stderr = | ||
2415 | (NULL != getenv ("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO; | ||
2416 | ats_ch = GNUNET_ATS_connectivity_init (GDS_cfg); | 2330 | ats_ch = GNUNET_ATS_connectivity_init (GDS_cfg); |
2417 | core_api = GNUNET_CORE_connect (GDS_cfg, | 2331 | core_api = GNUNET_CORE_connect (GDS_cfg, |
2418 | NULL, | 2332 | NULL, |
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h index 28468c740..35bbb125d 100644 --- a/src/dht/gnunet-service-dht_neighbours.h +++ b/src/dht/gnunet-service-dht_neighbours.h | |||
@@ -42,7 +42,7 @@ struct PeerInfo; | |||
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Lookup peer by peer's identity. | 44 | * Lookup peer by peer's identity. |
45 | * | 45 | * |
46 | * @param target peer to look up | 46 | * @param target peer to look up |
47 | * @return NULL if we are not connected to @a target | 47 | * @return NULL if we are not connected to @a target |
48 | */ | 48 | */ |
@@ -118,7 +118,7 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi, | |||
118 | const struct GDS_DATACACHE_BlockData *bd, | 118 | const struct GDS_DATACACHE_BlockData *bd, |
119 | const struct GNUNET_HashCode *query_hash, | 119 | const struct GNUNET_HashCode *query_hash, |
120 | unsigned int get_path_length, | 120 | unsigned int get_path_length, |
121 | const struct GNUNET_PeerIdentity *get_path); | 121 | const struct GNUNET_DHT_PathElement *get_path); |
122 | 122 | ||
123 | 123 | ||
124 | /** | 124 | /** |
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index ec36eae75..e7b5c3571 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -109,7 +109,7 @@ struct ProcessContext | |||
109 | /** | 109 | /** |
110 | * Path of the reply. | 110 | * Path of the reply. |
111 | */ | 111 | */ |
112 | const struct GNUNET_PeerIdentity *get_path; | 112 | const struct GNUNET_DHT_PathElement *get_path; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Number of entries in @e get_path. | 115 | * Number of entries in @e get_path. |
@@ -181,7 +181,7 @@ process (void *cls, | |||
181 | case GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED: | 181 | case GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED: |
182 | { | 182 | { |
183 | struct PeerInfo *pi; | 183 | struct PeerInfo *pi; |
184 | 184 | ||
185 | GNUNET_STATISTICS_update (GDS_stats, | 185 | GNUNET_STATISTICS_update (GDS_stats, |
186 | "# Good REPLIES matched against routing table", | 186 | "# Good REPLIES matched against routing table", |
187 | 1, | 187 | 1, |
@@ -244,7 +244,7 @@ void | |||
244 | GDS_ROUTING_process (const struct GDS_DATACACHE_BlockData *bd, | 244 | GDS_ROUTING_process (const struct GDS_DATACACHE_BlockData *bd, |
245 | const struct GNUNET_HashCode *query_hash, | 245 | const struct GNUNET_HashCode *query_hash, |
246 | unsigned int get_path_length, | 246 | unsigned int get_path_length, |
247 | const struct GNUNET_PeerIdentity *get_path) | 247 | const struct GNUNET_DHT_PathElement *get_path) |
248 | { | 248 | { |
249 | struct ProcessContext pc = { | 249 | struct ProcessContext pc = { |
250 | .bd = bd, | 250 | .bd = bd, |
diff --git a/src/dht/gnunet-service-dht_routing.h b/src/dht/gnunet-service-dht_routing.h index 1a1514cc5..1e35f3dc0 100644 --- a/src/dht/gnunet-service-dht_routing.h +++ b/src/dht/gnunet-service-dht_routing.h | |||
@@ -47,7 +47,7 @@ void | |||
47 | GDS_ROUTING_process (const struct GDS_DATACACHE_BlockData *bd, | 47 | GDS_ROUTING_process (const struct GDS_DATACACHE_BlockData *bd, |
48 | const struct GNUNET_HashCode *query_hash, | 48 | const struct GNUNET_HashCode *query_hash, |
49 | unsigned int get_path_length, | 49 | unsigned int get_path_length, |
50 | const struct GNUNET_PeerIdentity *get_path); | 50 | const struct GNUNET_DHT_PathElement *get_path); |
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index ba50c3d1a..bac101bdd 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -469,9 +469,9 @@ static void | |||
469 | get_iter (void *cls, | 469 | get_iter (void *cls, |
470 | struct GNUNET_TIME_Absolute exp, | 470 | struct GNUNET_TIME_Absolute exp, |
471 | const struct GNUNET_HashCode *key, | 471 | const struct GNUNET_HashCode *key, |
472 | const struct GNUNET_PeerIdentity *get_path, | 472 | const struct GNUNET_DHT_PathElement *get_path, |
473 | unsigned int get_path_length, | 473 | unsigned int get_path_length, |
474 | const struct GNUNET_PeerIdentity *put_path, | 474 | const struct GNUNET_DHT_PathElement *put_path, |
475 | unsigned int put_path_length, | 475 | unsigned int put_path_length, |
476 | enum GNUNET_BLOCK_Type type, | 476 | enum GNUNET_BLOCK_Type type, |
477 | size_t size, const void *data) | 477 | size_t size, const void *data) |
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index 957c71d7f..4d557bba8 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c | |||
@@ -87,9 +87,9 @@ static void | |||
87 | test_get_iterator (void *cls, | 87 | test_get_iterator (void *cls, |
88 | struct GNUNET_TIME_Absolute exp, | 88 | struct GNUNET_TIME_Absolute exp, |
89 | const struct GNUNET_HashCode *key, | 89 | const struct GNUNET_HashCode *key, |
90 | const struct GNUNET_PeerIdentity *get_path, | 90 | const struct GNUNET_DHT_PathElement *get_path, |
91 | unsigned int get_path_length, | 91 | unsigned int get_path_length, |
92 | const struct GNUNET_PeerIdentity *put_path, | 92 | const struct GNUNET_DHT_PathElement *put_path, |
93 | unsigned int put_path_length, | 93 | unsigned int put_path_length, |
94 | enum GNUNET_BLOCK_Type type, | 94 | enum GNUNET_BLOCK_Type type, |
95 | size_t size, | 95 | size_t size, |
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c index 95fb37bcd..8af02ad8a 100644 --- a/src/dht/test_dht_monitor.c +++ b/src/dht/test_dht_monitor.c | |||
@@ -174,9 +174,9 @@ timeout_task_cb (void *cls) | |||
174 | static void | 174 | static void |
175 | dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, | 175 | dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp, |
176 | const struct GNUNET_HashCode *key, | 176 | const struct GNUNET_HashCode *key, |
177 | const struct GNUNET_PeerIdentity *get_path, | 177 | const struct GNUNET_DHT_PathElement *get_path, |
178 | unsigned int get_path_length, | 178 | unsigned int get_path_length, |
179 | const struct GNUNET_PeerIdentity *put_path, | 179 | const struct GNUNET_DHT_PathElement *put_path, |
180 | unsigned int put_path_length, | 180 | unsigned int put_path_length, |
181 | enum GNUNET_BLOCK_Type type, | 181 | enum GNUNET_BLOCK_Type type, |
182 | size_t size, const void *data) | 182 | size_t size, const void *data) |
@@ -261,7 +261,7 @@ monitor_get_cb (void *cls, | |||
261 | uint32_t hop_count, | 261 | uint32_t hop_count, |
262 | uint32_t desired_replication_level, | 262 | uint32_t desired_replication_level, |
263 | unsigned int path_length, | 263 | unsigned int path_length, |
264 | const struct GNUNET_PeerIdentity *path, | 264 | const struct GNUNET_DHT_PathElement *path, |
265 | const struct GNUNET_HashCode *key) | 265 | const struct GNUNET_HashCode *key) |
266 | { | 266 | { |
267 | unsigned int i; | 267 | unsigned int i; |
@@ -298,7 +298,7 @@ monitor_put_cb (void *cls, | |||
298 | uint32_t hop_count, | 298 | uint32_t hop_count, |
299 | uint32_t desired_replication_level, | 299 | uint32_t desired_replication_level, |
300 | unsigned int path_length, | 300 | unsigned int path_length, |
301 | const struct GNUNET_PeerIdentity *path, | 301 | const struct GNUNET_DHT_PathElement *path, |
302 | struct GNUNET_TIME_Absolute exp, | 302 | struct GNUNET_TIME_Absolute exp, |
303 | const struct GNUNET_HashCode *key, | 303 | const struct GNUNET_HashCode *key, |
304 | const void *data, | 304 | const void *data, |
@@ -334,9 +334,9 @@ monitor_put_cb (void *cls, | |||
334 | static void | 334 | static void |
335 | monitor_res_cb (void *cls, | 335 | monitor_res_cb (void *cls, |
336 | enum GNUNET_BLOCK_Type type, | 336 | enum GNUNET_BLOCK_Type type, |
337 | const struct GNUNET_PeerIdentity *get_path, | 337 | const struct GNUNET_DHT_PathElement *get_path, |
338 | unsigned int get_path_length, | 338 | unsigned int get_path_length, |
339 | const struct GNUNET_PeerIdentity *put_path, | 339 | const struct GNUNET_DHT_PathElement *put_path, |
340 | unsigned int put_path_length, | 340 | unsigned int put_path_length, |
341 | struct GNUNET_TIME_Absolute exp, | 341 | struct GNUNET_TIME_Absolute exp, |
342 | const struct GNUNET_HashCode *key, | 342 | const struct GNUNET_HashCode *key, |
diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c index 7f737ea03..dfe969bb9 100644 --- a/src/dht/test_dht_topo.c +++ b/src/dht/test_dht_topo.c | |||
@@ -302,9 +302,9 @@ static void | |||
302 | dht_get_handler (void *cls, | 302 | dht_get_handler (void *cls, |
303 | struct GNUNET_TIME_Absolute exp, | 303 | struct GNUNET_TIME_Absolute exp, |
304 | const struct GNUNET_HashCode *key, | 304 | const struct GNUNET_HashCode *key, |
305 | const struct GNUNET_PeerIdentity *get_path, | 305 | const struct GNUNET_DHT_PathElement *get_path, |
306 | unsigned int get_path_length, | 306 | unsigned int get_path_length, |
307 | const struct GNUNET_PeerIdentity *put_path, | 307 | const struct GNUNET_DHT_PathElement *put_path, |
308 | unsigned int put_path_length, | 308 | unsigned int put_path_length, |
309 | enum GNUNET_BLOCK_Type type, | 309 | enum GNUNET_BLOCK_Type type, |
310 | size_t size, | 310 | size_t size, |