aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_neighbours.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.h')
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h84
1 files changed, 74 insertions, 10 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h
index 35bbb125d..4f4172f71 100644
--- a/src/dht/gnunet-service-dht_neighbours.h
+++ b/src/dht/gnunet-service-dht_neighbours.h
@@ -30,13 +30,9 @@
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_block_lib.h" 31#include "gnunet_block_lib.h"
32#include "gnunet_dht_service.h" 32#include "gnunet_dht_service.h"
33#include "gnunet_dhtu_plugin.h"
33#include "gnunet-service-dht_datacache.h" 34#include "gnunet-service-dht_datacache.h"
34 35
35/**
36 * Hash of the identity of this peer.
37 */
38extern struct GNUNET_HashCode my_identity_hash;
39
40 36
41struct PeerInfo; 37struct PeerInfo;
42 38
@@ -67,8 +63,8 @@ GDS_NEIGHBOURS_lookup_peer (const struct GNUNET_PeerIdentity *target);
67enum GNUNET_GenericReturnValue 63enum GNUNET_GenericReturnValue
68GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd, 64GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
69 enum GNUNET_DHT_RouteOption options, 65 enum GNUNET_DHT_RouteOption options,
70 uint32_t desired_replication_level, 66 uint16_t desired_replication_level,
71 uint32_t hop_count, 67 uint16_t hop_count,
72 struct GNUNET_CONTAINER_BloomFilter *bf); 68 struct GNUNET_CONTAINER_BloomFilter *bf);
73 69
74 70
@@ -92,8 +88,8 @@ GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
92enum GNUNET_GenericReturnValue 88enum GNUNET_GenericReturnValue
93GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, 89GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
94 enum GNUNET_DHT_RouteOption options, 90 enum GNUNET_DHT_RouteOption options,
95 uint32_t desired_replication_level, 91 uint16_t desired_replication_level,
96 uint32_t hop_count, 92 uint16_t hop_count,
97 const struct GNUNET_HashCode *key, 93 const struct GNUNET_HashCode *key,
98 const void *xquery, 94 const void *xquery,
99 size_t xquery_size, 95 size_t xquery_size,
@@ -112,8 +108,9 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
112 * @param query_hash query that was used for the request 108 * @param query_hash query that was used for the request
113 * @param get_path_length number of entries in put_path 109 * @param get_path_length number of entries in put_path
114 * @param get_path peers this reply has traversed so far (if tracked) 110 * @param get_path peers this reply has traversed so far (if tracked)
111 * @return true on success
115 */ 112 */
116void 113bool
117GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi, 114GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
118 const struct GDS_DATACACHE_BlockData *bd, 115 const struct GDS_DATACACHE_BlockData *bd,
119 const struct GNUNET_HashCode *query_hash, 116 const struct GNUNET_HashCode *query_hash,
@@ -137,6 +134,73 @@ GDS_am_closest_peer (const struct GNUNET_HashCode *key,
137 134
138 135
139/** 136/**
137 * Callback function used to extract URIs from a builder.
138 * Called when we should consider connecting to a peer.
139 *
140 * @param cls closure pointing to a `struct GNUNET_PeerIdentity *`
141 * @param uri one of the URIs
142 */
143void
144GDS_try_connect (void *cls,
145 const char *uri);
146
147
148/**
149 * Function to call when we connect to a peer and can henceforth transmit to
150 * that peer.
151 *
152 * @param cls the closure, must be a `struct GDS_Underlay`
153 * @param target handle to the target,
154 * pointer will remain valid until @e disconnect_cb is called
155 * @para pid peer identity,
156 * pointer will remain valid until @e disconnect_cb is called
157 * @param[out] ctx storage space for DHT to use in association with this target
158 */
159void
160GDS_u_connect (void *cls,
161 struct GNUNET_DHTU_Target *target,
162 const struct GNUNET_PeerIdentity *pid,
163 void **ctx);
164
165
166/**
167 * Function to call when we disconnected from a peer and can henceforth
168 * cannot transmit to that peer anymore.
169 *
170 * @param[in] ctx storage space used by the DHT in association with this target
171 */
172void
173GDS_u_disconnect (void *ctx);
174
175
176/**
177 * Function to call when we receive a message.
178 *
179 * @param cls the closure
180 * @param origin where the message originated from
181 * @param[in,out] tctx ctx of target address where we received the message from
182 * @param[in,out] sctx ctx of our own source address at which we received the message
183 * @param message the message we received @param message_size number of
184 * bytes in @a message
185 */
186void
187GDS_u_receive (void *cls,
188 void **tctx,
189 void **sctx,
190 const void *message,
191 size_t message_size);
192
193
194/**
195 * Send @a msg to all peers in our buckets.
196 *
197 * @param msg message to broadcast
198 */
199void
200GDS_NEIGHBOURS_broadcast (const struct GNUNET_MessageHeader *msg);
201
202
203/**
140 * Initialize neighbours subsystem. 204 * Initialize neighbours subsystem.
141 * 205 *
142 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 206 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error