aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-wdht_neighbours.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-wdht_neighbours.c')
-rw-r--r--src/dht/gnunet-service-wdht_neighbours.c81
1 files changed, 53 insertions, 28 deletions
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c
index 2a88ffa09..d3b92585b 100644
--- a/src/dht/gnunet-service-wdht_neighbours.c
+++ b/src/dht/gnunet-service-wdht_neighbours.c
@@ -39,10 +39,9 @@
39#include "gnunet_transport_service.h" 39#include "gnunet_transport_service.h"
40#include "gnunet_dht_service.h" 40#include "gnunet_dht_service.h"
41#include "gnunet_statistics_service.h" 41#include "gnunet_statistics_service.h"
42#include "gnunet-service-wdht.h" 42#include "gnunet-service-dht.h"
43#include "gnunet-service-wdht_clients.h"
44#include "gnunet-service-dht_datacache.h" 43#include "gnunet-service-dht_datacache.h"
45#include "gnunet-service-wdht_neighbours.h" 44#include "gnunet-service-dht_neighbours.h"
46#include "gnunet-service-dht_nse.h" 45#include "gnunet-service-dht_nse.h"
47#include "dht.h" 46#include "dht.h"
48 47
@@ -585,20 +584,29 @@ static struct GNUNET_CORE_Handle *core_api;
585/** 584/**
586 * Handle the put request from the client. 585 * Handle the put request from the client.
587 * 586 *
588 * @param key Key for the content
589 * @param block_type Type of the block 587 * @param block_type Type of the block
590 * @param options Routing options 588 * @param options routing options
591 * @param desired_replication_level Desired replication count 589 * @param desired_replication_level desired replication level
592 * @param expiration_time When does the content expire 590 * @param expiration_time when does the content expire
593 * @param data Content to store 591 * @param hop_count how many hops has this message traversed so far
594 * @param data_size Size of content @a data in bytes 592 * @param bf Bloom filter of peers this PUT has already traversed
593 * @param key key for the content
594 * @param put_path_length number of entries in put_path
595 * @param put_path peers this request has traversed so far (if tracked)
596 * @param data payload to store
597 * @param data_size number of bytes in data
598 * @return #GNUNET_OK if the request was forwarded, #GNUNET_NO if not
595 */ 599 */
596void 600int
597GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key, 601GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type block_type,
598 enum GNUNET_BLOCK_Type block_type,
599 enum GNUNET_DHT_RouteOption options, 602 enum GNUNET_DHT_RouteOption options,
600 uint32_t desired_replication_level, 603 uint32_t desired_replication_level,
601 struct GNUNET_TIME_Absolute expiration_time, 604 struct GNUNET_TIME_Absolute expiration_time,
605 uint32_t hop_count,
606 struct GNUNET_CONTAINER_BloomFilter *bf,
607 const struct GNUNET_HashCode *key,
608 unsigned int put_path_length,
609 struct GNUNET_PeerIdentity *put_path,
602 const void *data, 610 const void *data,
603 size_t data_size) 611 size_t data_size)
604{ 612{
@@ -610,34 +618,51 @@ GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key,
610 data); 618 data);
611 GDS_CLIENTS_process_put (options, 619 GDS_CLIENTS_process_put (options,
612 block_type, 620 block_type,
613 0, 0, 621 hop_count,
614 0, NULL, 622 desired_replication_level,
623 put_path_length, put_path,
615 expiration_time, 624 expiration_time,
616 key, 625 key,
617 data, 626 data,
618 data_size); 627 data_size);
628 return GNUNET_OK; /* FIXME... */
619} 629}
620 630
621 631
622/** 632/**
623 * Handle the get request from the client file. If I am destination do 633 * Perform a GET operation. Forwards the given request to other
624 * datacache put and return. Else find the target friend and forward message 634 * peers. Does not lookup the key locally. May do nothing if this is
625 * to it. 635 * the only peer in the network (or if we are the closest peer in the
636 * network).
626 * 637 *
627 * @param key Key for the content 638 * @param type type of the block
628 * @param block_type Type of the block 639 * @param options routing options
629 * @param options Routing options 640 * @param desired_replication_level desired replication count
630 * @param desired_replication_level Desired replication count 641 * @param hop_count how many hops did this request traverse so far?
642 * @param key key for the content
643 * @param xquery extended query
644 * @param xquery_size number of bytes in @a xquery
645 * @param reply_bf bloomfilter to filter duplicates
646 * @param reply_bf_mutator mutator for @a reply_bf
647 * @param peer_bf filter for peers not to select (again, updated)
648 * @return #GNUNET_OK if the request was forwarded, #GNUNET_NO if not
631 */ 649 */
632void 650int
633GDS_NEIGHBOURS_handle_get (const struct GNUNET_HashCode *key, 651GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
634 enum GNUNET_BLOCK_Type block_type,
635 enum GNUNET_DHT_RouteOption options, 652 enum GNUNET_DHT_RouteOption options,
636 uint32_t desired_replication_level) 653 uint32_t desired_replication_level,
654 uint32_t hop_count,
655 const struct GNUNET_HashCode *key,
656 const void *xquery, size_t xquery_size,
657 const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
658 uint32_t reply_bf_mutator,
659 struct GNUNET_CONTAINER_BloomFilter *peer_bf)
637{ 660{
638 // find closest finger(s) on all layers 661 // find closest finger(s) on all layers
639 // use TrailRoute with PeerGetMessage embedded to contact peer 662 // use TrailRoute with PeerGetMessage embedded to contact peer
640 // NOTE: actually more complicated, see paper! 663 // NOTE: actually more complicated, see paper!
664 GNUNET_break (0); // not implemented!
665 return GNUNET_SYSERR;
641} 666}
642 667
643 668
@@ -1734,10 +1759,10 @@ GDS_NEIGHBOURS_done (void)
1734 * 1759 *
1735 * @return my identity 1760 * @return my identity
1736 */ 1761 */
1737struct GNUNET_PeerIdentity 1762struct GNUNET_PeerIdentity *
1738GDS_NEIGHBOURS_get_my_id (void) 1763GDS_NEIGHBOURS_get_id (void)
1739{ 1764{
1740 return my_identity; 1765 return &my_identity;
1741} 1766}
1742 1767
1743/* end of gnunet-service-wdht_neighbours.c */ 1768/* end of gnunet-service-wdht_neighbours.c */