random peer sampling More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_rps_service.h"
#include <inttypes.h>
Go to the source code of this file.
Functions | |
static void | do_shutdown (void *cls) |
Task run when user presses CTRL-C to abort. More... | |
static void | reply_handle (void *cls, uint64_t n, const struct GNUNET_PeerIdentity *recv_peers) |
Callback called on receipt of reply. More... | |
static void | view_update_handle (void *cls, uint64_t n, const struct GNUNET_PeerIdentity *recv_peers) |
Callback called on receipt view update. More... | |
static void | stream_input_handle (void *cls, uint64_t num_peers, const struct GNUNET_PeerIdentity *recv_peers) |
Callback called on receipt of peer from biased stream. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
The main function to rps. More... | |
Variables | |
static int | ret |
static struct GNUNET_RPS_Handle * | rps_handle |
RPS handle. More... | |
static struct GNUNET_RPS_Request_Handle * | req_handle |
Request handle. More... | |
static struct GNUNET_PeerIdentity | peer_id |
PeerID (Option –seed) More... | |
static int | view_update |
Do we want to receive updates of the view? (Option –view) More... | |
static int | stream_input |
Do we want to receive updates of the view? (Option –view) More... | |
static uint64_t | num_view_updates |
Number of updates we want to receive. More... | |
random peer sampling
Definition in file gnunet-rps.c.
|
static |
Task run when user presses CTRL-C to abort.
Cancels pending request and disconnects.
cls | NULL |
Definition at line 71 of file gnunet-rps.c.
References GNUNET_RPS_disconnect(), GNUNET_RPS_request_cancel(), req_handle, and rps_handle.
Referenced by run().
|
static |
Callback called on receipt of reply.
Prints replied PeerIDs.
cls | closure |
n | number of peers |
recv_peers | the received peers |
Definition at line 90 of file gnunet-rps.c.
References GNUNET_i2s_full(), GNUNET_SCHEDULER_shutdown(), req_handle, and ret.
Referenced by run().
|
static |
Callback called on receipt view update.
Prints view.
n | number of peers |
recv_peers | the received peers |
Definition at line 118 of file gnunet-rps.c.
References GNUNET_i2s_full(), GNUNET_SCHEDULER_shutdown(), num_view_updates, req_handle, and ret.
Referenced by run().
|
static |
Callback called on receipt of peer from biased stream.
num_peers | number of peers |
recv_peers | the received peers |
Definition at line 156 of file gnunet-rps.c.
References GNUNET_i2s_full(), num_peers, and req_handle.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 186 of file gnunet-rps.c.
References consensus-simulation::args, cfg, do_shutdown(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s_full(), GNUNET_log, GNUNET_RPS_connect(), GNUNET_RPS_request_peers(), GNUNET_RPS_seed_ids(), GNUNET_RPS_stream_request(), GNUNET_RPS_view_request(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), num_peers, num_view_updates, peer_id, reply_handle(), req_handle, ret, rps_handle, stream_input, stream_input_handle(), view_update, and view_update_handle().
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function to rps.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 262 of file gnunet-rps.c.
References gettext_noop, GNUNET_GETOPT_option_base32_auto, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, peer_id, ret, run(), stream_input, and view_update.
|
static |
Definition at line 31 of file gnunet-rps.c.
Referenced by main(), reply_handle(), run(), and view_update_handle().
|
static |
RPS handle.
Definition at line 36 of file gnunet-rps.c.
Referenced by cancel_stream(), do_shutdown(), GNUNET_RPS_request_peer_info(), GNUNET_RPS_request_peers(), GNUNET_RPS_stream_cancel(), GNUNET_RPS_stream_request(), GNUNET_RPS_view_request(), GNUNET_RPS_view_request_cancel(), new_stream_request(), remove_stream_request(), and run().
|
static |
Request handle.
Definition at line 41 of file gnunet-rps.c.
Referenced by check_n_peers_ready(), check_peer_info_ready(), do_shutdown(), reply_handle(), RPS_sampler_get_n_rand_peers(), RPS_sampler_get_rand_peer_info(), RPS_sampler_request_cancel(), run(), stream_input_handle(), and view_update_handle().
|
static |
|
static |
Do we want to receive updates of the view? (Option –view)
Definition at line 51 of file gnunet-rps.c.
Referenced by main(), reconnect(), and run().
|
static |
Do we want to receive updates of the view? (Option –view)
Definition at line 56 of file gnunet-rps.c.
Referenced by main(), reconnect(), and run().
|
static |
Number of updates we want to receive.
Definition at line 61 of file gnunet-rps.c.
Referenced by run(), and view_update_handle().