From b0144a11f14f33ab010fd7cf8c61bdd361f20fd3 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 15 Jan 2014 17:16:10 +0000 Subject: [PATCH] header for transport validation monitoring API --- src/include/gnunet_protocols.h | 2 -- src/include/gnunet_transport_service.h | 43 +++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 1861c318b..ee8a1272c 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -1319,8 +1319,6 @@ extern "C" */ #define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE 387 - - /******************************************************************************* * FS-PUBLISH-HELPER IPC Messages ******************************************************************************/ diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 432eb702f..6e9d47b48 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h @@ -206,7 +206,28 @@ enum GNUNET_TRANSPORT_PeerState GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED }; +enum GNUNET_TRANSPORT_ValidationState +{ + /** + * Fresh validation entry + */ + GNUNET_TRANSPORT_VS_NEW, + /** + * Updated validation entry + */ + GNUNET_TRANSPORT_VS_UPDATE, + + /** + * Timeout for validation entry + */ + GNUNET_TRANSPORT_VS_TIMEOUT, + + /** + * Validation entry is removed + */ + GNUNET_TRANSPORT_VS_REMOVE, +}; /** * Function called by the transport for each received message. @@ -319,10 +340,12 @@ typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) (void *cls, * */ typedef void (*GNUNET_TRANSPORT_ValidationIterateCallback) (void *cls, - const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_HELLO_Address *address, - struct GNUNET_TIME_Absolute valid_until, - struct GNUNET_TIME_Absolute next_validation); + const struct GNUNET_PeerIdentity *peer, + const struct GNUNET_HELLO_Address *address, + struct GNUNET_TIME_Absolute last_validation, + struct GNUNET_TIME_Absolute valid_until, + struct GNUNET_TIME_Absolute next_validation, + enum GNUNET_TRANSPORT_ValidationState state); @@ -601,7 +624,7 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct * @param state the state */ const char * -GNUNET_TRANSPORT_p2s (enum GNUNET_TRANSPORT_PeerState state); +GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state); /** @@ -614,6 +637,16 @@ int GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state); +/** + * Convert validation state to human-readable string. + * + * @param state the state value + * @return corresponding string + */ +const char * +GNUNET_TRANSPORT_vs2s (enum GNUNET_TRANSPORT_ValidationState state); + + /** * Return information about a specific peer or all peers currently known to * transport service once or in monitoring mode. To obtain information about -- 2.25.1