Program to generate a database file containing given underlay topology. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "testbed_api_topology.h"
#include "sqlite3.h"
Go to the source code of this file.
Macros | |
#define | LOG(type, ...) GNUNET_log (type, __VA_ARGS__) |
#define | LOG_ERROR(...) LOG (GNUNET_ERROR_TYPE_ERROR, __VA_ARGS__) |
#define | LOG_SQLITE(db, msg, level, cmd) |
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' on file 'filename' with the message given by strerror(errno). More... | |
Functions | |
static int | link_processor (void *cls, unsigned int A, unsigned int B, unsigned int bandwidth, unsigned int latency, unsigned int loss) |
Functions of this type are called to process underlay link. More... | |
static int | setup_db (const char *dbfile) |
Open the database file, creating a new database if not existing and setup the whitelist table. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *config) |
Main run function. More... | |
int | main (int argc, char *const argv[]) |
Main. More... | |
Variables | |
static struct sqlite3 * | db |
Handle to the sqlite3 database. More... | |
struct sqlite3_stmt * | stmt_insert |
Prepared statement for inserting link values into db. More... | |
enum GNUNET_TESTBED_TopologyOption | topology |
The topology to generate. More... | |
static unsigned int | num_peers |
The number of peers to include in the topology. More... | |
static int | exit_result |
program result More... | |
Program to generate a database file containing given underlay topology.
Definition in file generate-underlay-topology.c.
#define LOG | ( | type, | |
... | |||
) | GNUNET_log (type, __VA_ARGS__) |
Definition at line 33 of file generate-underlay-topology.c.
#define LOG_ERROR | ( | ... | ) | LOG (GNUNET_ERROR_TYPE_ERROR, __VA_ARGS__) |
Definition at line 36 of file generate-underlay-topology.c.
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' on file 'filename' with the message given by strerror(errno).
Definition at line 43 of file generate-underlay-topology.c.
|
static |
Functions of this type are called to process underlay link.
cls | closure |
A | offset of first peer |
B | offset of second peer |
bandwidth | the bandwidth of the link in bytes per second |
latency | the latency of link in milliseconds |
loss | the percentage of messages dropped on the link |
Definition at line 101 of file generate-underlay-topology.c.
References db, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_OK, GNUNET_SYSERR, LOG_SQLITE, and stmt_insert.
Referenced by run().
|
static |
Open the database file, creating a new database if not existing and setup the whitelist table.
dbfile | the database filename |
Definition at line 151 of file generate-underlay-topology.c.
References db, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_OK, GNUNET_SYSERR, LOG_SQLITE, ret, and stmt_insert.
Referenced by run().
|
static |
Main run function.
cls | NULL |
args | arguments passed to GNUNET_PROGRAM_run |
cfgfile | the path to configuration file |
cfg | the configuration file handle |
Definition at line 217 of file generate-underlay-topology.c.
References _, consensus-simulation::args, GNUNET_assert, GNUNET_OK, GNUNET_TESTBED_TOPOLOGY_2D_TORUS, GNUNET_TESTBED_TOPOLOGY_CLIQUE, GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, GNUNET_TESTBED_TOPOLOGY_FROM_FILE, GNUNET_TESTBED_topology_get_(), GNUNET_TESTBED_TOPOLOGY_LINE, GNUNET_TESTBED_TOPOLOGY_RING, GNUNET_TESTBED_TOPOLOGY_SCALE_FREE, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING, GNUNET_TESTBED_TOPOLOGY_STAR, GNUNET_TESTBED_underlay_construct_(), GNUNET_YES, link_processor(), LOG_ERROR, num_peers, setup_db(), topology, and value.
Referenced by main().
int main | ( | int | argc, |
char *const | argv[] | ||
) |
Main.
Definition at line 360 of file generate-underlay-topology.c.
References _, db, exit_result, gettext_noop, GNUNET_break, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_uint(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_SYSERR, num_peers, ret, run(), and stmt_insert.
|
static |
Handle to the sqlite3 database.
Definition at line 66 of file generate-underlay-topology.c.
Referenced by link_processor(), main(), and setup_db().
struct sqlite3_stmt* stmt_insert |
Prepared statement for inserting link values into db.
Definition at line 71 of file generate-underlay-topology.c.
Referenced by link_processor(), main(), and setup_db().
enum GNUNET_TESTBED_TopologyOption topology |
The topology to generate.
Definition at line 71 of file generate-underlay-topology.c.
Referenced by get_node_info(), GNUNET_TESTBED_run(), GNUNET_TESTBED_topology_get_(), GNUNET_TESTBED_topology_to_str_(), GNUNET_TESTBED_underlay_construct_(), GNUNET_TESTING_calculate_num(), GNUNET_TESTING_free_topology(), GNUNET_TESTING_get_additional_connects(), GNUNET_TESTING_get_connections(), GNUNET_TESTING_get_node(), log_topo(), run(), and start_helper().
|
static |
The number of peers to include in the topology.
Definition at line 81 of file generate-underlay-topology.c.
|
static |