39 #define BIT(n) (1 << (n))
117 "# rounds blocked - too many pushes",
118 "# rounds blocked - no pushes",
119 "# rounds blocked - no pull replies",
120 "# rounds blocked - too many pushes, no pull replies",
121 "# rounds blocked - no pushes, no pull replies",
122 "# push send issued",
123 "# push send issued (multi-hop peer)",
124 "# pull request send issued",
125 "# pull request send issued (multi-hop peer)",
126 "# pull reply send issued",
128 "# pull requests sent",
129 "# pull requests sent (multi-hop peer)",
130 "# pull replies sent",
131 "# push message received",
132 "# push message received (multi-hop peer)",
133 "# pull request message received",
134 "# pull request message received (multi-hop peer)",
135 "# pull reply messages received",
136 "# pull reply messages received (multi-hop peer)",
141 "# pending online checks",
142 "# unrequested pull replies",
143 "# peers in push map at end of round",
144 "# peers in pull map at end of round",
145 "# peers in view at end of round",
879 "Not able to open file %s\n",
894 size = strlen (
line) *
sizeof(char);
900 "Unable to write to file! (Size: %lu, size2: %lu)\n",
906 "Unable to close file\n");
914 "Unable to close file\n");
922 #define tofile(file_name, ...) do { \
925 size = GNUNET_snprintf (tmp_buf, sizeof(tmp_buf), __VA_ARGS__); \
927 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \
928 "Failed to create tmp_buf\n"); \
930 tofile_ (file_name, tmp_buf); \
968 "%u. peer [%s] received %u of %u expected peer_ids: %i\n",
976 return tmp_ok ? 0 : 1;
1005 const struct RPSPeer *rps_peer)
1035 "At least Peer %" PRIu32
1036 " did not yet receive all statistics values\n",
1042 "All peers received their statistics values\n");
1062 "Cancelling pending rps get request\n");
1079 "Cancelling rps get reply\n");
1093 while (NULL != (pending_req =
rps_peers[peer_index].pending_req_head))
1104 if (NULL !=
rps_peers[peer_index].h_stat_get[stat_type])
1107 "(%u) did not yet receive stat value for `%s'\n",
1111 rps_peers[peer_index].h_stat_get[stat_type]);
1134 "Shutdown task scheduled, going down.\n");
1156 "Operation still pending on shutdown (%u)\n",
1176 "Shutdown was triggered by timeout, going down.\n");
1195 "Executing post test op.\n");
1204 "Executing post test op. (peer %" PRIu32
")\n",
1211 "Cancelled testbed operation\n");
1249 if ((NULL == pinfo) || (NULL != emsg))
1269 tofile (
"/tmp/rps/peer_ids",
1295 struct RPSPeer *rps_peer = cls;
1311 "Failed to connect to RPS service: %s\n",
1319 "Started client successfully (%u)\n",
1367 return peer->stats_h;
1389 peer->stats_h = NULL;
1445 "disconnect_adapter (%u)\n",
1448 if (NULL !=
peer->rps_handle)
1450 while (NULL != (pending_rep =
peer->pending_rep_head))
1460 peer->rps_handle = NULL;
1491 "[%s] got %" PRIu64
" peers:\n",
1495 for (i = 0; i < n; i++)
1512 "Test succeeded before end of duration\n");
1525 uint32_t num_observed);
1546 "Requesting one peer\n");
1574 "Scheduling %u - %u missing requests\n",
1580 i < rps_peer->num_ids_to_request; i++)
1601 "Cancelling all (pending) requests.\n");
1725 "Failed to start/stop RPS at a peer\n");
1738 "peer %s was expected to go offline but is still marked as online\n",
1745 "peer %s probably went offline as expected\n",
1751 else if (PEER_GO_ONLINE < entry->
delta)
1756 "peer %s was expected to go online but is still marked as offline\n",
1763 "peer %s probably went online as expected\n",
1777 "Invalid value for delta: %i\n", entry->
delta);
1800 double prob_go_on_off)
1806 if (NULL !=
rps_peers[j].entry_op_manage)
1814 "%u. selected peer (%u: %s) is %s.\n",
1819 if (prob < prob_go_on_off * UINT32_MAX)
1848 double portion_online;
1849 unsigned int *permut;
1850 double prob_go_offline;
1851 double portion_go_online;
1852 double portion_go_offline;
1861 "Churn function executing\n");
1869 "Portion online: %f\n",
1871 portion_go_online = ((1 - portion_online) * .5 * .66);
1873 "Portion that should go online: %f\n",
1875 portion_go_offline = (portion_online + portion_go_online) - .75;
1877 "Portion that probably goes offline: %f\n",
1878 portion_go_offline);
1879 prob_go_offline = portion_go_offline / (portion_online * .5);
1881 "Probability of a selected online peer to go offline: %f\n",
1940 char file_name_buf[128];
1941 char file_name_dh_buf[128];
1942 char file_name_dhr_buf[128];
1943 char file_name_dhru_buf[128];
1945 char *file_name_dh = file_name_dh_buf;
1946 char *file_name_dhr = file_name_dhr_buf;
1947 char *file_name_dhru = file_name_dhru_buf;
1955 "/tmp/rps/received_ids-%u",
1959 "/tmp/rps/diehard_input-%u",
1962 "/tmp/rps/diehard_input_raw-%u",
1965 "/tmp/rps/diehard_input_raw_aligned-%u",
1968 "[%s] got %" PRIu64
" peers:\n",
1971 for (i = 0; i < n; i++)
1984 (uint32_t) rcv_rps_peer->
index);
1987 (
char *) &rcv_rps_peer->
index,
1990 (
char *) &rcv_rps_peer->
index,
2010 uint32_t num_observed)
2014 char file_name_buf[128];
2015 char file_name_dh_buf[128];
2016 char file_name_dhr_buf[128];
2017 char file_name_dhru_buf[128];
2019 char *file_name_dh = file_name_dh_buf;
2020 char *file_name_dhr = file_name_dhr_buf;
2021 char *file_name_dhru = file_name_dhru_buf;
2028 "/tmp/rps/received_ids-%u",
2032 "/tmp/rps/diehard_input-%u",
2035 "/tmp/rps/diehard_input_raw-%u",
2038 "/tmp/rps/diehard_input_raw_aligned-%u",
2041 "[%s] got peer with info:\n",
2047 "%s %f %" PRIu32
" \n",
2055 (uint32_t) rcv_rps_peer->
index);
2058 (
char *) &rcv_rps_peer->
index,
2061 (
char *) &rcv_rps_peer->
index,
2081 "Starting churn task\n");
2090 "Not starting churn task\n");
2113 if (NULL != strstr (
filename,
"sampler_el"))
2117 const char *key_char;
2190 if (0 == memcmp (
pid,
2199 "No known _PeerIdentity %s!\n",
2244 size_t probs_as_str_size = (
num_peers * 10 + 2) *
sizeof(
char);
2246 char *probs_as_str_cpy;
2251 uint32_t cont_views;
2252 uint32_t number_of_being_in_pull_events;
2254 double sum_non_zero_prob = 0;
2255 double sum_non_zero_prob_hist = 0;
2258 "Computing probabilities for peer %" PRIu32
"\n", peer_idx);
2263 "\tfor peer %" PRIu32
":\n", i);
2266 "\t\tview_size: %" PRIu32
"\n", view_size);
2275 (1 <= (0.45 * view_size)))
2277 if (0 ==
binom (view_size, 0.45 * view_size))
2281 prob_push = 1.0 *
binom (0.45 * view_size, 1)
2283 binom (view_size, 0.45 * view_size);
2286 "\t\t%" PRIu32
" is in %" PRIu32
"'s view, prob: %f\n",
2291 "\t\tposs choices from view: %" PRIu32
", containing i: %"
2293 binom (view_size, 0.45 * view_size),
2294 binom (0.45 * view_size, 1));
2300 "\t\t%" PRIu32
" is not in %" PRIu32
"'s view, prob: 0\n",
2307 number_of_being_in_pull_events =
2308 (
binom (view_size, 0.45 * view_size)
2309 -
binom (view_size - cont_views, 0.45 * view_size));
2310 if (0 != number_of_being_in_pull_events)
2312 prob_pull = number_of_being_in_pull_events
2314 (1.0 *
binom (view_size, 0.45 * view_size));
2320 probs[i] = prob_push + prob_pull - (prob_push * prob_pull);
2322 "\t\t%" PRIu32
" has %" PRIu32
" of %" PRIu32
2323 " peers in its view who know %" PRIu32
" prob: %f\n",
2330 "\t\tnumber of possible pull combinations: %" PRIu32
"\n",
2331 binom (view_size, 0.45 * view_size));
2333 "\t\tnumber of possible pull combinations without %" PRIu32
2336 binom (view_size - cont_views, 0.45 * view_size));
2338 "\t\tnumber of possible pull combinations with %" PRIu32
2341 number_of_being_in_pull_events);
2346 sum_non_zero_prob += probs[i];
2347 sum_non_zero_prob_hist += probs_hist[i];
2350 if (0 != sum_non_zero_prob)
2354 probs[i] = probs[i] * (1.0 / sum_non_zero_prob);
2357 if (0 != sum_non_zero_prob_hist)
2361 probs_hist[i] = probs_hist[i] * (1.0 / sum_non_zero_prob_hist);
2368 probs_as_str_cpy =
GNUNET_strndup (probs_as_str, probs_as_str_size);
2371 "%s %7.6f", probs_as_str_cpy, probs[i]);
2381 probs_as_str[0] =
'\0';
2384 probs_as_str_cpy =
GNUNET_strndup (probs_as_str, probs_as_str_size);
2387 "%s %7.6f", probs_as_str_cpy, probs_hist[i]);
2473 uint32_t views_total_size;
2478 views_total_size = 0;
2487 "Counted representation of %" PRIu32
"th peer [%s]: %" PRIu32
2495 "size of all views combined: %" PRIu32
"\n",
2497 expected = ((double) 1 /
num_peers) * views_total_size;
2499 "Expected number of occurrences of each peer in all views: %f\n",
2503 deviation[i] = expected - count_peers[i];
2505 "Deviation from expectation: %f\n", deviation[i]);
2520 "View size of %" PRIu32
". [%s] is %" PRIu32
"\n",
2542 "View was updated (%" PRIu64
")\n", view_size);
2544 to_file (
"/tmp/rps/view_sizes.txt",
2545 "%" PRIu32
" %" PRIu64
"",
2548 for (uint64_t i = 0; i < view_size; i++)
2560 to_file (
"/tmp/rps/count_in_views.txt",
2561 "%" PRIu32
" %" PRIu32
"",
2606 for (uint32_t i = 0; i <
num_peers; i++)
2608 to_file (
"/tmp/rps/final_stats.csv",
2612 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2614 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2615 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2616 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2669 to_file (
"/tmp/rps/final_stats.dat",
2672 PRIu64
" %" PRIu64
" %" PRIu64
" %" PRIu64
" %" PRIu64
" %" PRIu64
2674 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2675 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2676 PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %" PRIu64
", %"
2750 "Peer %u did not receive statistics value\n",
2757 if ((NULL != rps_peer->
stat_op) &&
2802 (void) is_persistent;
2805 "Got stat value: %s - %" PRIu64
" (%u)\n",
2810 "%s: %" PRIu64
"\n",
2830 "Going to request statistic values with mask 0x%" PRIx32
"\n",
2855 "Requested statistics for %s (peer %" PRIu32
")\n",
2884 unsigned int n_peers,
2886 unsigned int links_succeeded,
2887 unsigned int links_failed)
2894 (void) links_failed;
2901 (0 == links_succeeded) )
2904 "Going down due to args (eg. timeout)\n");
2942 for (i = 0; i < n_peers; i++)
2958 "Connecting to statistics service\n");
2992 const char *cfgfile,
3088 "duration is %lus\n",
3091 "timeout is %lus\n",
3098 "Need %u bits to represent %" PRIu32
" peers\n",
3142 "duration of the profiling"),
3148 "timeout for the profiling"),
3158 unsetenv (
"XDG_DATA_HOME");
3159 unsetenv (
"XDG_CONFIG_HOME");
3168 "gnunet-rps-profiler",
3170 "Measure quality and performance of the RPS service."),
3180 "Test did not run successfully!\n");
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_ARM_Operation * op
Current operation.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct CadetPeer * peers
Operation to get peer ids.
static char * peer_id
Option –peer.
static char * line
Desired phone line (string to be converted to a hash).
static char * file_name
Dump file name.
static char * value
Value of the record to add/remove.
static struct GNUNET_TESTBED_Peer ** testbed_peers
Handles to all of the running peers.
static int ok
Return value from 'main'.
@ STAT_TYPE_SENT_PULL_REQ_MH
@ STAT_TYPE_RECV_PULL_REP
@ STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL
@ STAT_TYPE_SENT_PULL_REP
@ STAT_TYPE_RECV_PUSH_SEND
@ STAT_TYPE_BLOCKS_NO_PULL
@ STAT_TYPE_ISSUED_PUSH_SEND
@ STAT_TYPE_ISSUED_PUSH_SEND_MH
@ STAT_TYPE_RECV_PULL_REQ_MH
@ STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL
@ STAT_TYPE_ISSUED_PULL_REQ
@ STAT_TYPE_ISSUED_PULL_REP
@ STAT_TYPE_ISSUED_PULL_REQ_MH
@ STAT_TYPE_VIEW_SIZE_AIM
@ STAT_TYPE_PEERS_IN_PUSH_MAP
@ STAT_TYPE_SENT_PULL_REQ
@ STAT_TYPE_SENT_PUSH_SEND
@ STAT_TYPE_BLOCKS_MANY_PUSH
@ STAT_TYPE_RECV_PULL_REQ
@ STAT_TYPE_PEERS_IN_VIEW
@ STAT_TYPE_BLOCKS_NO_PUSH
@ STAT_TYPE_PEERS_IN_PULL_MAP
@ STAT_TYPE_UNREQUESTED_PULL_REPLIES
@ STAT_TYPE_RECV_PUSH_SEND_MH
@ STAT_TYPE_PENDING_ONLINE_CHECKS
@ STAT_TYPE_RECV_PULL_REP_MH
PEER_ONLINE_DELTA
Indicates whether peer should go off- or online.
@ PEER_GO_ONLINE
Indicates peer going online.
@ PEER_GO_OFFLINE
Indicates peer going offline.
static void default_reply_handle(void *cls, uint64_t n, const struct GNUNET_PeerIdentity *recv_peers)
Callback to call on receipt of a reply.
int main(int argc, char *argv[])
Entry point for the testcase, sets up the testbed.
static void trigger_shutdown(void *cls)
void schedule_missing_requests(struct RPSPeer *rps_peer)
Schedule requests for peer rps_peer that have neither been scheduled, nor issued, nor replied.
void info_cb(void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Get the id of peer i.
static struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to get the index of a given peer ID quick.
static uint32_t get_idx_of_pid(const struct GNUNET_PeerIdentity *pid)
static void profiler_cb(struct RPSPeer *rps_peer)
static struct OpListEntry * oplist_head
OpList DLL head.
static struct GNUNET_SCHEDULER_Task * post_test_task
Identifier for the task that runs after the test to collect results.
static void profiler_reply_handle_info(void *cls, const struct GNUNET_PeerIdentity *recv_peer, double probability, uint32_t num_observed)
Callback to call on receipt of a reply.
OPTION_QUICK_QUIT
Is it ok to quit the test before the timeout?
@ HAVE_QUICK_QUIT
It is ok for the test to quit before the timeout triggers.
@ HAVE_NO_QUICK_QUIT
It is NOT ok for the test to quit before the timeout triggers.
static void stat_disconnect_adapter(void *cls, void *op_result)
Called to disconnect from peer's statistics service.
enum STAT_TYPE stat_str_2_type(const char *stat_str)
Converts string representation to the corresponding STAT_TYPE enum.
static uint32_t count_peer_in_views_2(uint32_t peer_idx)
This counts the number of peers in which views a given peer occurs.
static void * rps_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Adapter function called to establish a connection to the RPS service.
void all_views_updated_cb()
static void test_run(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int n_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed)
Actual "main" function for the testcase.
OPTION_COLLECT_STATISTICS
Do we collect statistics at the end?
@ COLLECT_STATISTICS
We collect statistics at the end.
@ NO_COLLECT_STATISTICS
We do not collect statistics at the end.
static void compute_probabilities(uint32_t peer_idx)
Computes the probability for each other peer to be selected by the sampling process based on the view...
static struct OpListEntry * oplist_tail
OpList DLL tail.
int stat_iterator(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values.
static void count_peer_in_views(uint32_t *count_peers)
void(* InitPeer)(struct RPSPeer *rps_peer)
Called to initialise the given RPSPeer.
static struct RPSPeer * rps_peers
Information for all the peers.
void clean_peer(unsigned peer_index)
static struct GNUNET_PeerIdentity * rps_peer_ids
IDs of the peers.
static struct GNUNET_PeerIdentity * target_peer
ID of the targeted peer.
static void rps_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy connection to RPS service.
OPTION_CHURN
Do we have Churn?
@ HAVE_CHURN
If we have churn this is set.
@ HAVE_NO_CHURN
If we have no churn this is set.
static int evaluate(void)
Write the ids and their according index in the given array to a file Unused.
static int file_name_cb(void *cls, const char *filename)
Function called from profiler_eval with a filename.
void(* MainTest)(struct RPSPeer *rps_peer)
Executes functions to test the api/service for a given peer.
static uint32_t count_containing_views(uint32_t a, uint32_t b)
Counts number of peers in view of a that have b in their view.
static void profiler_reply_handle(void *cls, uint64_t n, const struct GNUNET_PeerIdentity *recv_peers)
Callback to call on receipt of a reply.
void cancel_pending_req_rep(struct RPSPeer *rps_peer)
static int in_shutdown
Are we shutting down?
static void cancel_request(struct PendingReply *pending_rep)
static void churn_cb(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when RPS service is started or stopped at peers.
struct SingleTestRun cur_test_run
static void manage_service_wrapper(unsigned int i, unsigned int j, enum PEER_ONLINE_DELTA delta, double prob_go_on_off)
Set the rps-service up or down for a specific peer.
static void churn(void *cls)
**
static int check_statistics_collect_completed_single_peer(const struct RPSPeer *rps_peer)
Checks if given peer already received its statistics value from the statistics service.
OPTION_COLLECT_VIEW
Do we collect views during run?
@ NO_COLLECT_VIEW
We do not collect the view during run.
@ COLLECT_VIEW
We collect view during run.
static struct GNUNET_TIME_Relative duration
How long do we run the test?
static uint32_t cumulated_view_sizes()
static int is_in_view(uint32_t a, uint32_t b)
is b in view of a?
static uint32_t num_peers
How many peers do we start?
static void pre_profiler(struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
static int check_statistics_collect_completed()
Checks if all peers already received their statistics value from the statistics service.
static int profiler_eval(void)
This is run after the test finished.
static unsigned int view_sizes
The added sizes of the peer's views.
static unsigned int num_peers_online
Number of online peers.
static unsigned int mal_type
Type of malicious peer to test.
static struct GNUNET_SCHEDULER_Task * churn_task
Identifier for the churn task that runs periodically.
static char * stat_type_strings[]
#define tofile(file_name,...)
This function is used to facilitate writing important information to disk.
void(* PostTest)(struct RPSPeer *peer)
Called directly before disconnecting from the service.
static struct GNUNET_SCHEDULER_Task * shutdown_task
Identifier for the shutdown task.
static struct GNUNET_TIME_Relative timeout
When do we do a hard shutdown?
static void request_peers(void *cls)
Request random peers.
void view_update_cb(void *cls, uint64_t view_size, const struct GNUNET_PeerIdentity *peers)
void(* PreTest)(struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
Called directly after connecting to the service.
static void tofile_(const char *file_name, const char *line)
Append arguments to file.
static void shutdown_op(void *cls)
Task run on timeout to shut everything down.
static void cancel_pending_req(struct PendingRequest *pending_req)
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Entry point for the testcase, sets up the testbed.
static unsigned bits_needed
number of bits required to represent the largest peer id
static struct OpListEntry * make_oplist_entry()
Creates an oplist entry and adds it to the oplist DLL.
void post_profiler(struct RPSPeer *rps_peer)
static void profiler_init_peer(struct RPSPeer *rps_peer)
Initialise given RPSPeer.
static void rps_connect_complete_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when RPS service connect operation is completed.
void(* ReplyHandle)(void *cls, uint64_t n, const struct GNUNET_PeerIdentity *recv_peers)
Callback called once the requested random peers are available.
void write_final_stats(void)
void post_test_shutdown_ready_cb(void *cls, int success)
Continuation called by GNUNET_STATISTICS_get() functions.
static void * stat_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Called to open a connection to the peer's statistics.
int(* EvaluationCallback)(void)
Function called after disconnect to evaluate test success.
static void post_test_op(void *cls)
Task run after duration to collect statistics and potentially shut down.
static int post_test
Did we finish the test?
static void stat_complete_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Called after successfully opening a connection to a peer's statistics service; we register statistics...
static struct GNUNET_RPS_Handle * rps_handle
RPS handle.
struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
void RPS_sampler_elem_set(struct RPS_SamplerElement *sampler_elem, struct GNUNET_CRYPTO_AuthKey auth_key)
Set the min-wise independent function of the given sampler element.
void RPS_sampler_elem_destroy(struct RPS_SamplerElement *sampler_elem)
Destroy a sampler element.
void RPS_sampler_elem_next(struct RPS_SamplerElement *sampler_elem, const struct GNUNET_PeerIdentity *new_ID)
Update a sampler element with a PeerID.
struct RPS_SamplerElement * RPS_sampler_elem_create(void)
Create a sampler element and initialise it.
sampler element implementation
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
API for writing tests and creating large-scale emulation testbeds for GNUnet.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
unsigned int * GNUNET_CRYPTO_random_permute(enum GNUNET_CRYPTO_Quality mode, unsigned int n)
Get an array with a random permutation of the numbers 0...n-1.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create(const char *dir)
Implementation of "mkdir -p".
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
@ GNUNET_DISK_OPEN_WRITE
Open the file for writing.
@ GNUNET_DISK_OPEN_CREATE
Create file if it doesn't exist.
@ GNUNET_DISK_OPEN_APPEND
Append to the file.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_GROUP_READ
Group can read.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
@ GNUNET_DISK_PERM_OTHER_READ
Everybody can read.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned int.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time).
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
void GNUNET_RPS_view_request(struct GNUNET_RPS_Handle *rps_handle, uint32_t num_updates, GNUNET_RPS_NotifyReadyCB view_update_cb, void *cls)
Request updates of view.
struct GNUNET_RPS_Request_Handle_Single_Info * GNUNET_RPS_request_peer_info(struct GNUNET_RPS_Handle *rps_handle, GNUNET_RPS_NotifyReadySingleInfoCB ready_cb, void *cls)
Request one random peer, getting additional information.
struct GNUNET_RPS_Handle * GNUNET_RPS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the rps service.
void GNUNET_RPS_disconnect(struct GNUNET_RPS_Handle *h)
Disconnect from the rps service.
void GNUNET_RPS_request_single_info_cancel(struct GNUNET_RPS_Request_Handle_Single_Info *rhs)
Cancel an issued single info request.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
void GNUNET_STATISTICS_get_cancel(struct GNUNET_STATISTICS_GetHandle *gh)
Cancel a GNUNET_STATISTICS_get request.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_get_information(struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_PeerInformationType pit, GNUNET_TESTBED_PeerInfoCallback cb, void *cb_cls)
Request information about a peer.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_manage_service(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, unsigned int start)
Start or stop given service at a peer.
void GNUNET_TESTBED_run(const char *host_filename, const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a testbed with a single call.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
@ GNUNET_TESTBED_PIT_IDENTITY
What is the identity of the peer? Returns a 'const struct GNUNET_PeerIdentity *'.
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
static unsigned int size
Size of the "table".
void to_file_raw_unaligned(const char *file_name, const char *buf, size_t size_buf, unsigned bits_needed)
char * store_prefix_file_name(const unsigned int index, const char *prefix)
int close_all_files()
Close all files that were opened with get_file_handle.
void to_file_raw(const char *file_name, const char *buf, size_t size_buf)
struct GNUNET_CRYPTO_AuthKey string_to_auth_key(const char *str)
uint32_t binom(uint32_t n, uint32_t k)
Binomial coefficient (n choose k)
Some utils facilitating the view into the internals for the sampler needed for evaluation.
#define to_file_w_len(file_name, len,...)
#define to_file(file_name,...)
This function is used to facilitate writing important information to disk.
static struct GNUNET_TIME_Relative delta
Internal representation of the hash map.
type for (message) authentication keys
Handle used to access files (and pipes).
Definition of a command line option.
The identity of the host (wraps the signing key of the peer).
Handler to handle requests from a client.
Handler for a single request from a client.
Entry in list of pending tasks.
Linked list of things we still need to do.
Opaque handle to an abstract operation to be executed by the testing framework.
A peer controlled by the testing framework.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
struct OpListEntry * prev
DLL prev ptr.
struct GNUNET_TESTBED_Operation * op
The testbed operation.
int delta
Depending on whether we start or stop NSE service at the peer set this to 1 or -1.
unsigned int index
Index of the regarding peer.
struct OpListEntry * next
DLL next ptr.
A pending reply: A request was sent and the reply is pending.
struct PendingReply * prev
struct RPSPeer * rps_peer
The peer that requested.
struct PendingReply * next
DLL next,prev ptr.
struct GNUNET_RPS_Request_Handle_Single_Info * req_handle
Handle to the request we are waiting for.
A pending request: A request was not made yet but is scheduled for later.
struct PendingRequest * next
DLL next,prev ptr.
struct RPSPeer * rps_peer
The peer that requested.
struct PendingRequest * prev
struct GNUNET_SCHEDULER_Task * request_task
Handle to the request we are waiting for.
Information we track for each peer.
struct PendingRequest * pending_req_tail
unsigned int num_pending_reps
Number of pending replies.
uint32_t stat_collected_flags
flags to indicate which statistics values have been already collected from the statistics service.
struct PendingReply * pending_rep_head
Pending replies DLL.
struct GNUNET_PeerIdentity * peer_id
ID of the peer.
unsigned int num_pending_reqs
Number of pending requests.
struct GNUNET_STATISTICS_Handle * stats_h
Handle to the statistics service.
struct PendingRequest * pending_req_head
Pending requests DLL.
const char * file_name_probs_hist
File name of the file the stats are finally written to.
double * eval_probs_cache
Keep the probabilities in cache for computing the probabilities with respect to history.
uint64_t stats[STAT_TYPE_MAX]
statistics values
const char * file_name_stats
File name of the file the stats are finally written to.
struct PendingReply * pending_rep_tail
const struct OpListEntry * entry_op_manage
Pending operation on that peer.
uint32_t count_in_views
Number of occurrences in other peer's view.
uint32_t index
Index of the peer.
struct GNUNET_STATISTICS_GetHandle * h_stat_get[STAT_TYPE_MAX]
Handle for the statistics get request.
struct GNUNET_PeerIdentity * cur_view
The current view.
int online
A request handle to check for an request.
uint32_t cur_view_count
Number of peers in the cur_view.
unsigned int num_ids_to_request
Number of Peer IDs to request during the whole test.
struct GNUNET_TESTBED_Operation * op
Handle for RPS connect operation.
struct GNUNET_RPS_Handle * rps_handle
Handle to RPS service.
const char * file_name_probs
File name of the file the stats are finally written to.
struct GNUNET_TESTBED_Operation * stat_op
Testbed operation to connect to statistics service.
unsigned int num_recv_ids
Number of received PeerIDs.
A sampler element sampling one PeerID at a time.
struct RPSPeer * rps_peer
Structure to define a single test.
enum OPTION_COLLECT_STATISTICS have_collect_statistics
Collect statistics at the end?
uint32_t num_requests
Number of Requests to make.
EvaluationCallback eval_cb
Function to evaluate the test results.
uint32_t request_interval
Request interval.
MainTest main_test
Main function for each peer.
enum OPTION_COLLECT_VIEW have_collect_view
Collect view during run?
PostTest post_test
Called directly before disconnecting from the service.
uint32_t stat_collect_flags
Mark which values from the statistics service to collect at the end of the run.
enum OPTION_QUICK_QUIT have_quick_quit
Quit test before timeout?
char * name
Name of the test.
ReplyHandle reply_handle
Callback called once the requested peers are available.
enum OPTION_CHURN have_churn
Run with (-out) churn.
InitPeer init_peer
Called with a single peer in order to initialise that peer.
PreTest pre_test
Called directly after connecting to the service.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.