X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Frps%2Fgnunet-service-rps_sampler.h;h=83705b013722256f9e49ffe472e01912b10710f1;hb=155b8c7cd322add8dad4924da358688eeb035ec2;hp=3bbfc2a4090a17d4b8ec67380e265459e8a84265;hpb=9faea17ef30144323b311e282238f5caaabe451e;p=oweals%2Fgnunet.git diff --git a/src/rps/gnunet-service-rps_sampler.h b/src/rps/gnunet-service-rps_sampler.h index 3bbfc2a40..83705b013 100644 --- a/src/rps/gnunet-service-rps_sampler.h +++ b/src/rps/gnunet-service-rps_sampler.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) + Copyright (C) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** @@ -35,28 +35,6 @@ struct RPS_Sampler; -/** - * Callback that is called when a new PeerID is inserted into a sampler. - * - * @param cls the closure given alongside this function. - * @param id the PeerID that is inserted - */ -typedef void -(*RPS_sampler_insert_cb) (void *cls, - struct RPS_Sampler *sampler, - const struct GNUNET_PeerIdentity *id); - -/** - * Callback that is called when a new PeerID is removed from a sampler. - * - * @param cls the closure given alongside this function. - * @param id the PeerID that is removed - */ -typedef void -(*RPS_sampler_remove_cb) (void *cls, - struct RPS_Sampler *sampler, - const struct GNUNET_PeerIdentity *id); - /** * Callback that is called from _get_n_rand_peers() when the PeerIDs are ready. * @@ -93,20 +71,24 @@ RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size); * Initialise a tuple of samplers. * * @param init_size the size the sampler is initialised with - * @param id with which all newly created sampler elements are initialised - * @param ins_cb the callback that will be called on every PeerID that is - * newly inserted into a sampler element - * @param ins_cls the closure given to #ins_cb - * @param rem_cb the callback that will be called on every PeerID that is - * removed from a sampler element - * @param rem_cls the closure given to #rem_cb + * @param max_round_interval maximum time a round takes * @return a handle to a sampler that consists of sampler elements. */ struct RPS_Sampler * RPS_sampler_init (size_t init_size, - struct GNUNET_TIME_Relative max_round_interval, - RPS_sampler_insert_cb ins_cb, void *ins_cls, - RPS_sampler_remove_cb rem_cb, void *rem_cls); + struct GNUNET_TIME_Relative max_round_interval); + + +/** + * Initialise a modified tuple of sampler elements. + * + * @param init_size the size the sampler is initialised with + * @param max_round_interval maximum time a round takes + * @return a handle to a sampler that consists of sampler elements. + */ +struct RPS_Sampler * +RPS_sampler_mod_init (size_t init_size, + struct GNUNET_TIME_Relative max_round_interval); /** @@ -151,7 +133,7 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler, void RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler, RPS_sampler_n_rand_peers_ready_cb cb, - void *cls, uint32_t num_peers, int for_client); + void *cls, uint32_t num_peers); /**