aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-04 20:00:59 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-04 20:00:59 +0000
commit09372b5120f5905546bd4e73f02f8afeec7e1b1e (patch)
treec9f301491073ca43d34152683d7b108a52e24288 /src/include
parentc3a877682c2ce72aa38c58642875563b918aca86 (diff)
downloadgnunet-09372b5120f5905546bd4e73f02f8afeec7e1b1e.tar.gz
gnunet-09372b5120f5905546bd4e73f02f8afeec7e1b1e.zip
New DHT-monitor functionality
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_dht_service.h64
-rw-r--r--src/include/gnunet_protocols.h20
2 files changed, 84 insertions, 0 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index f047bd8f8..fd89642c6 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -214,6 +214,70 @@ void
214GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); 214GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle);
215 215
216 216
217/* *************** Extended API: monitor ******************* */
218
219struct GNUNET_DHT_MonitorHandle;
220
221/**
222 * Callback called on each request going through the DHT.
223 *
224 * @param cls Closure.
225 * @param mtype Type of the DHT message monitored.
226 * @param exp When will this value expire.
227 * @param key Key of the result/request.
228 * @param get_path Peers on reply path (or NULL if not recorded).
229 * @param get_path_length number of entries in get_path.
230 * @param put_path peers on the PUT path (or NULL if not recorded).
231 * @param put_path_length number of entries in get_path.
232 * @param desired_replication_level Desired replication level.
233 * @param type Type of the result/request.
234 * @param data Pointer to the result data.
235 * @param size Number of bytes in data.
236 */
237typedef void (*GNUNET_DHT_MonitorCB) (void *cls,
238 uint16_t mtype,
239 struct GNUNET_TIME_Absolute exp,
240 const GNUNET_HashCode * key,
241 const struct GNUNET_PeerIdentity *
242 get_path, unsigned int get_path_length,
243 const struct GNUNET_PeerIdentity *
244 put_path, unsigned int put_path_length,
245 uint32_t desired_replication_level,
246 enum GNUNET_DHT_RouteOption options,
247 enum GNUNET_BLOCK_Type type,
248 const void *data,
249 size_t size);
250
251/**
252 * Start monitoring the local DHT service.
253 *
254 * @param handle Handle to the DHT service.
255 * @param type Type of blocks that are of interest.
256 * @param key Key of data of interest, NULL for all.
257 * @param cb Callback to process all monitored data.
258 * @param cb_cls Closure for cb.
259 *
260 * @return Handle to stop monitoring.
261 */
262struct GNUNET_DHT_MonitorHandle *
263GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
264 enum GNUNET_BLOCK_Type type,
265 const GNUNET_HashCode *key,
266 GNUNET_DHT_MonitorCB cb,
267 void *cb_cls);
268
269
270/**
271 * Stop monitoring.
272 *
273 * @param handle The handle to the monitor request returned by monitor_start.
274 *
275 * On return get_handle will no longer be valid, caller must not use again!!!
276 */
277void
278GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle);
279
280
217#if 0 /* keep Emacsens' auto-indent happy */ 281#if 0 /* keep Emacsens' auto-indent happy */
218{ 282{
219#endif 283#endif
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 89b00e20d..790457f72 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -517,6 +517,26 @@ extern "C"
517 */ 517 */
518#define GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT 148 518#define GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT 148
519 519
520/**
521 * Request / receive information about transiting GETs
522 */
523#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET 149
524
525/**
526 * Request / receive information about transiting GET responses
527 */
528#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP 150
529
530/**
531 * Request / receive information about transiting PUTs
532 */
533#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT 151
534
535/**
536 * Request / receive information about transiting PUT responses (TODO)
537 */
538#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT_RESP 152
539
520 540
521/******************************************************************************* 541/*******************************************************************************
522 * HOSTLIST message types 542 * HOSTLIST message types