From d743a7e758a4fd96f5997a2b6d0f2ce4d62e13cf Mon Sep 17 00:00:00 2001 From: Omar Tarabai Date: Mon, 12 May 2014 17:01:59 +0000 Subject: towards PEERSTORE iterate --- src/include/gnunet_peerstore_plugin.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/include/gnunet_peerstore_plugin.h') diff --git a/src/include/gnunet_peerstore_plugin.h b/src/include/gnunet_peerstore_plugin.h index f693072c0..2d397088c 100644 --- a/src/include/gnunet_peerstore_plugin.h +++ b/src/include/gnunet_peerstore_plugin.h @@ -38,6 +38,21 @@ extern "C" #endif +/** + * Function called by for each matching record. + * + * @param cls closure + * @param peer peer identity + * @param sub_system name of the GNUnet sub system responsible + * @param value stored value + * @param size size of stored value + */ +typedef void (*GNUNET_PEERSTORE_RecordIterator) (void *cls, + const struct GNUNET_PeerIdentity *peer, + const char *sub_system, + const void *value, + size_t size); + /** * @brief struct returned by the initialization function of the plugin */ @@ -68,6 +83,23 @@ struct GNUNET_PEERSTORE_PluginFunctions const void *value, size_t size); + /** + * Iterate over the records given an optional peer id + * and/or sub system. + * + * @param cls closure (internal context for the plugin) + * @param peer Peer identity (can be NULL) + * @param sub_system name of sub system (can be NULL) + * @param iter function to call with the result + * @param iter_cls closure for @a iter + * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error + */ + int + (*iterate_records) (void *cls, + const struct GNUNET_PeerIdentity *peer, + const char *sub_system, + GNUNET_PEERSTORE_RecordIterator iter, void *iter_cls); + }; -- cgit v1.2.3