aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_dht_service.h
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-04-04 17:11:37 +0000
committerNathan S. Evans <evans@in.tum.de>2010-04-04 17:11:37 +0000
commit22b296d98d4a6657b53edfd87935db840acfd978 (patch)
tree19ed83080481f421d77055f1f28e300e7af46c0f /src/include/gnunet_dht_service.h
parent7ffce01b3c21f4d39200c09c277620a953247381 (diff)
downloadgnunet-22b296d98d4a6657b53edfd87935db840acfd978.tar.gz
gnunet-22b296d98d4a6657b53edfd87935db840acfd978.zip
forgotten commit
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r--src/include/gnunet_dht_service.h118
1 files changed, 79 insertions, 39 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index 09a891842..85b144e38 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -44,6 +44,22 @@ extern "C"
44struct GNUNET_DHT_Handle; 44struct GNUNET_DHT_Handle;
45 45
46/** 46/**
47 * Handle to control a route operation.
48 */
49struct GNUNET_DHT_RouteHandle;
50
51/**
52 * Handle to control a get operation.
53 */
54struct GNUNET_DHT_GetHandle;
55
56/**
57 * Handle to control a find peer operation.
58 */
59struct GNUNET_DHT_FindPeerHandle;
60
61
62/**
47 * Iterator called on each result obtained from a generic route 63 * Iterator called on each result obtained from a generic route
48 * operation 64 * operation
49 */ 65 */
@@ -62,7 +78,7 @@ typedef void (*GNUNET_DHT_MessageCallback)(void *cls,
62struct GNUNET_DHT_Handle * 78struct GNUNET_DHT_Handle *
63GNUNET_DHT_connect (struct GNUNET_SCHEDULER_Handle *sched, 79GNUNET_DHT_connect (struct GNUNET_SCHEDULER_Handle *sched,
64 const struct GNUNET_CONFIGURATION_Handle *cfg, 80 const struct GNUNET_CONFIGURATION_Handle *cfg,
65 unsigned int ht_len); 81 unsigned int ht_len);
66 82
67 83
68/** 84/**
@@ -105,12 +121,6 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
105 121
106 122
107/** 123/**
108 * Handle to control a GET operation.
109 */
110struct GNUNET_DHT_GetHandle;
111
112
113/**
114 * Iterator called on each result obtained for a DHT 124 * Iterator called on each result obtained for a DHT
115 * operation that expects a reply 125 * operation that expects a reply
116 * 126 *
@@ -131,7 +141,7 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls,
131 141
132 142
133/** 143/**
134 * Perform an asynchronous GET operation on the DHT identified. 144 * Perform an asynchronous GET operation on the DHT.
135 * 145 *
136 * @param handle handle to the DHT service 146 * @param handle handle to the DHT service
137 * @param timeout timeout for this request to be sent to the 147 * @param timeout timeout for this request to be sent to the
@@ -145,15 +155,15 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls,
145 * 155 *
146 * @return handle to stop the async get, NULL on error 156 * @return handle to stop the async get, NULL on error
147 */ 157 */
148struct GNUNET_DHT_RouteHandle * 158struct GNUNET_DHT_GetHandle *
149GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, 159GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
150 struct GNUNET_TIME_Relative timeout, 160 struct GNUNET_TIME_Relative timeout,
151 uint32_t type, 161 uint32_t type,
152 const GNUNET_HashCode * key, 162 const GNUNET_HashCode * key,
153 GNUNET_DHT_GetIterator iter, 163 GNUNET_DHT_GetIterator iter,
154 void *iter_cls, 164 void *iter_cls,
155 GNUNET_SCHEDULER_Task cont, 165 GNUNET_SCHEDULER_Task cont,
156 void *cont_cls); 166 void *cont_cls);
157 167
158/** 168/**
159 * Stop async DHT-get. Frees associated resources. 169 * Stop async DHT-get. Frees associated resources.
@@ -161,7 +171,25 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
161 * @param get_handle GET operation to stop. 171 * @param get_handle GET operation to stop.
162 */ 172 */
163void 173void
164GNUNET_DHT_get_stop (struct GNUNET_DHT_RouteHandle *get_handle); 174GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle, GNUNET_SCHEDULER_Task cont, void *cont_cls);
175
176
177/**
178 * Options for routing.
179 */
180enum GNUNET_DHT_RouteOption
181 {
182 /**
183 * Default. Do nothing special.
184 */
185 GNUNET_DHT_RO_NONE = 0,
186
187 /**
188 * Each peer along the way should look at 'enc' (otherwise
189 * only the k-peers closest to the key should look at it).
190 */
191 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE = 1
192 };
165 193
166 194
167/** 195/**
@@ -177,34 +205,46 @@ typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls,
177 205
178 206
179/** 207/**
180 * Iterator called on each result obtained from a generic route 208 * Perform an asynchronous FIND PEER operation on the DHT.
181 * operation 209 *
210 * @param handle handle to the DHT service
211 * @param timeout timeout for this request to be sent to the
212 * service
213 * @param options routing options for this message
214 * @param message a message to inject at found peers (may be null)
215 * @param key the key to look up
216 * @param iter function to call on each result
217 * @param iter_cls closure for iter
218 * @param cont continuation to call once message sent
219 * @param cont_cls closure for continuation
220 *
221 * @return handle to stop the async get, NULL on error
182 */ 222 */
183typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls, 223struct GNUNET_DHT_FindPeerHandle *
184 const struct GNUNET_MessageHeader *reply); 224GNUNET_DHT_find_peer_start (struct GNUNET_DHT_Handle *handle,
185 225 struct GNUNET_TIME_Relative timeout,
226 enum GNUNET_DHT_RouteOption options,
227 struct GNUNET_MessageHeader *message,
228 const GNUNET_HashCode * key,
229 GNUNET_DHT_FindPeerProcessor iter,
230 void *iter_cls,
231 GNUNET_SCHEDULER_Task cont,
232 void *cont_cls);
186 233
187/** 234/**
188 * Options for routing. 235 * Stop async find peer. Frees associated resources.
236 *
237 * @param find_peer_handle GET operation to stop.
189 */ 238 */
190enum GNUNET_DHT_RouteOption 239void
191 { 240GNUNET_DHT_find_peer_stop (struct GNUNET_DHT_FindPeerHandle *find_peer_handle, GNUNET_SCHEDULER_Task cont, void *cont_cls);
192 /**
193 * Default. Do nothing special.
194 */
195 GNUNET_DHT_RO_NONE = 0,
196
197 /**
198 * Each peer along the way should look at 'enc' (otherwise
199 * only the k-peers closest to the key should look at it).
200 */
201 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE = 1
202 };
203 241
204/** 242/**
205 * Handle to control a route operation. 243 * Iterator called on each result obtained from a generic route
244 * operation
206 */ 245 */
207struct GNUNET_DHT_RouteHandle; 246typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls,
247 const struct GNUNET_MessageHeader *reply);
208 248
209/** 249/**
210 * Perform an asynchronous FIND_PEER operation on the DHT. 250 * Perform an asynchronous FIND_PEER operation on the DHT.
@@ -218,7 +258,7 @@ struct GNUNET_DHT_RouteHandle;
218 * @param enc send the encapsulated message to a peer close to the key 258 * @param enc send the encapsulated message to a peer close to the key
219 * @param timeout when to abort with an error if we fail to get 259 * @param timeout when to abort with an error if we fail to get
220 * a confirmation for the request (when necessary) or how long 260 * a confirmation for the request (when necessary) or how long
221 * to wait for tramission to the service 261 * to wait for transmission to the service
222 * @param iter function to call on each result, NULL if no replies are expected 262 * @param iter function to call on each result, NULL if no replies are expected
223 * @param iter_cls closure for iter 263 * @param iter_cls closure for iter
224 264
@@ -240,7 +280,7 @@ GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle,
240 void *cont_cls); 280 void *cont_cls);
241 281
242void 282void
243GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *fph); 283GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle, GNUNET_SCHEDULER_Task cont, void *cont_cls);
244 284
245 285
246#if 0 /* keep Emacsens' auto-indent happy */ 286#if 0 /* keep Emacsens' auto-indent happy */