#include #include "Untrusted.hpp" #include "start.hpp" static void route_test(NetIO &netio, char **args) { // Count the number of arguments size_t nargs = 0; while (args[nargs]) { ++nargs; } uint16_t num_nodes = netio.num_nodes; size_t sq_nodes = num_nodes; sq_nodes *= sq_nodes; if (nargs != sq_nodes) { printf("Expecting %lu arguments, found %lu\n", sq_nodes, nargs); return; } // The arguments are num_nodes sets of num_nodes values. The jth // value in the ith set is the number of private routing tokens // ingestion node i holds for storage node j. // We are node i = netio.me, so ignore the other sets of values. uint32_t num_tokens[num_nodes]; uint32_t tot_tokens = 0; for (nodenum_t j=0;j 0) { // Pick a random remaining token uint32_t r = uint32_t(lrand48()) % rem_tokens; for (nodenum_t j=0;j