diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-08-03 08:22:59 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-08-03 08:22:59 +0000 |
commit | 7d86288c8819afc624d08cb88e3ed77ab05f541d (patch) | |
tree | ac95abbcf293a8ed18317d8f902fdc1ae421957b /src | |
parent | 6805357073d73c41c8712c8e852f3a95030bad89 (diff) | |
download | gnunet-7d86288c8819afc624d08cb88e3ed77ab05f541d.tar.gz gnunet-7d86288c8819afc624d08cb88e3ed77ab05f541d.zip |
iterate topoogy header related stuff
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_core_service.h | 14 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 4 | ||||
-rw-r--r-- | src/include/gnunet_testing_lib.h | 28 |
3 files changed, 46 insertions, 0 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 2434e3770..5dac1fa38 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -359,6 +359,20 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_SCHEDULER_Handle *sched, | |||
359 | void | 359 | void |
360 | GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequestContext *irc); | 360 | GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequestContext *irc); |
361 | 361 | ||
362 | /** | ||
363 | * Obtain statistics and/or change preferences for the given peer. | ||
364 | * | ||
365 | * @param sched scheduler to use | ||
366 | * @param cfg configuration to use | ||
367 | * @param peer_cb function to call with the peer information | ||
368 | * @param cb_cls closure for peer_cb | ||
369 | * @return GNUNET_OK if iterating, GNUNET_SYSERR on error | ||
370 | */ | ||
371 | int | ||
372 | GNUNET_CORE_iterate_peers (struct GNUNET_SCHEDULER_Handle *sched, | ||
373 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
374 | GNUNET_CORE_ConnectEventHandler peer_cb, | ||
375 | void *cb_cls); | ||
362 | 376 | ||
363 | /** | 377 | /** |
364 | * Handle for a transmission request. | 378 | * Handle for a transmission request. |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 3f9f45395..e3f266e25 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -360,6 +360,10 @@ extern "C" | |||
360 | */ | 360 | */ |
361 | #define GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT 75 | 361 | #define GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT 75 |
362 | 362 | ||
363 | /** | ||
364 | * Request from client asking to call back with all connected peers. | ||
365 | */ | ||
366 | #define GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS 76 | ||
363 | 367 | ||
364 | /** | 368 | /** |
365 | * Session key exchange between peers. | 369 | * Session key exchange between peers. |
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 04a2d8191..479cb07e0 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -364,6 +364,23 @@ typedef void (*GNUNET_TESTING_NotifyConnection)(void *cls, | |||
364 | const char *emsg); | 364 | const char *emsg); |
365 | 365 | ||
366 | /** | 366 | /** |
367 | * Prototype of a callback function indicating that two peers | ||
368 | * are currently connected. | ||
369 | * | ||
370 | * @param cls closure | ||
371 | * @param first peer id for first daemon | ||
372 | * @param second peer id for the second daemon | ||
373 | * @param distance distance between the connected peers | ||
374 | * @param emsg error message (NULL on success) | ||
375 | */ | ||
376 | typedef void (*GNUNET_TESTING_NotifyTopology)(void *cls, | ||
377 | const struct GNUNET_PeerIdentity *first, | ||
378 | const struct GNUNET_PeerIdentity *second, | ||
379 | struct GNUNET_TIME_Relative latency, | ||
380 | uint32_t distance, | ||
381 | const char *emsg); | ||
382 | |||
383 | /** | ||
367 | * Starts a GNUnet daemon. GNUnet must be installed on the target | 384 | * Starts a GNUnet daemon. GNUnet must be installed on the target |
368 | * system and available in the PATH. The machine must furthermore be | 385 | * system and available in the PATH. The machine must furthermore be |
369 | * reachable via "ssh" (unless the hostname is "NULL") without the | 386 | * reachable via "ssh" (unless the hostname is "NULL") without the |
@@ -743,6 +760,17 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
743 | char *restrict_transports); | 760 | char *restrict_transports); |
744 | 761 | ||
745 | /** | 762 | /** |
763 | * Iterate over all (running) peers in the peer group, retrieve | ||
764 | * all connections that each currently has. | ||
765 | * | ||
766 | * @param pg the peer group we are concerned with | ||
767 | * @param cb callback for topology information | ||
768 | * @param cls closure for callback | ||
769 | */ | ||
770 | void | ||
771 | GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_NotifyTopology cb, void *cls); | ||
772 | |||
773 | /** | ||
746 | * There are many ways to connect peers that are supported by this function. | 774 | * There are many ways to connect peers that are supported by this function. |
747 | * To connect peers in the same topology that was created via the | 775 | * To connect peers in the same topology that was created via the |
748 | * GNUNET_TESTING_create_topology, the topology variable must be set to | 776 | * GNUNET_TESTING_create_topology, the topology variable must be set to |