44 #ifndef GNUNET_TESTING_LIB_H
45 #define GNUNET_TESTING_LIB_H
63 #define GNUNET_TESTING_HOSTKEYFILESIZE sizeof(struct \
64 GNUNET_CRYPTO_EddsaPrivateKey)
70 #define GNUNET_TESTING_PREFIX "GNUNET_TESTING_PREFIX"
418 const char *cfgfilename,
447 const char *cfgfilename,
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static uint16_t port
Port number.
static char * hostname
Our hostname; we give this to all the peers we start.
static char * service_name
Option -s: service name (hash to get service descriptor)
API to create, modify and access statistics.
int GNUNET_TESTING_peer_stop(struct GNUNET_TESTING_Peer *peer)
Stop the peer.
struct GNUNET_TESTING_System * GNUNET_TESTING_system_create(const char *testdir, const char *trusted_ip, const char *hostname, const struct GNUNET_TESTING_SharedService *shared_services)
Create a system handle.
struct GNUNET_TESTING_System * GNUNET_TESTING_system_create_with_portrange(const char *testdir, const char *trusted_ip, const char *hostname, const struct GNUNET_TESTING_SharedService *shared_services, uint16_t lowport, uint16_t highport)
Create a system handle.
struct GNUNET_TESTING_Peer * GNUNET_TESTING_peer_configure(struct GNUNET_TESTING_System *system, struct GNUNET_CONFIGURATION_Handle *cfg, uint32_t key_number, struct GNUNET_PeerIdentity *id, char **emsg)
Configure a GNUnet peer.
void(* GNUNET_TESTING_PeerStopCallback)(void *cls, struct GNUNET_TESTING_Peer *peer, int success)
Callback to inform whether the peer is running or stopped.
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_TESTING_hostkey_get(const struct GNUNET_TESTING_System *system, uint32_t key_number, struct GNUNET_PeerIdentity *id)
Testing includes a number of pre-created hostkeys for faster peer startup.
int GNUNET_TESTING_peer_run(const char *testdir, const char *cfgfilename, GNUNET_TESTING_TestMain tm, void *tm_cls)
Start a single peer and run a test using the testing library.
void(* GNUNET_TESTING_TestMain)(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer)
Signature of the 'main' function for a (single-peer) testcase that is run using GNUNET_TESTING_peer_r...
void GNUNET_TESTING_system_destroy(struct GNUNET_TESTING_System *system, int remove_paths)
Free system resources.
int GNUNET_TESTING_service_run(const char *testdir, const char *service_name, const char *cfgfilename, GNUNET_TESTING_TestMain tm, void *tm_cls)
Start a single service (no ARM, except of course if the given service name is 'arm') and run a test u...
int GNUNET_TESTING_peer_start(struct GNUNET_TESTING_Peer *peer)
Start the peer.
uint16_t GNUNET_TESTING_reserve_port(struct GNUNET_TESTING_System *system)
Reserve a port for a peer.
void GNUNET_TESTING_release_port(struct GNUNET_TESTING_System *system, uint16_t port)
Release reservation of a TCP or UDP port for a peer (used during GNUNET_TESTING_peer_destroy).
void GNUNET_TESTING_peer_stop_async_cancel(struct GNUNET_TESTING_Peer *peer)
Cancel a previous asynchronous peer stop request.
int GNUNET_TESTING_peer_stop_async(struct GNUNET_TESTING_Peer *peer, GNUNET_TESTING_PeerStopCallback cb, void *cb_cls)
Stop a peer asynchronously using ARM API.
int GNUNET_TESTING_configuration_create(struct GNUNET_TESTING_System *system, struct GNUNET_CONFIGURATION_Handle *cfg)
Create a new configuration using the given configuration as a template; ports and paths will be modif...
char * GNUNET_TESTING_get_testname_from_underscore(const char *argv0)
Sometimes we use the binary name to determine which specific test to run.
int GNUNET_TESTING_peer_kill(struct GNUNET_TESTING_Peer *peer)
Sends SIGTERM to the peer's main process.
void GNUNET_TESTING_peer_destroy(struct GNUNET_TESTING_Peer *peer)
Destroy the peer.
int GNUNET_TESTING_peer_wait(struct GNUNET_TESTING_Peer *peer)
Waits for a peer to terminate.
void GNUNET_TESTING_peer_get_identity(struct GNUNET_TESTING_Peer *peer, struct GNUNET_PeerIdentity *id)
Obtain the peer identity from a peer handle.
Private ECC key encoded for transmission.
The identity of the host (wraps the signing key of the peer).
Handle for a GNUnet peer controlled by testing.
struct GNUNET_TESTING_System * system
The TESTING system associated with this peer.
uint32_t key_number
The keynumber of this peer's hostkey.
void * cb_cls
The closure for the above callback.
GNUNET_TESTING_PeerStopCallback cb
The callback to call asynchronously when a peer is stopped.
Specification of a service that is to be shared among peers.
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration template for the service.
unsigned int share
The number of peers which share an instance of the service.
const char * service
The name of the service.
Handle for a system on which GNUnet peers are executed; a system is used for reserving unique paths a...
uint16_t highport
Highest port we are allowed to use.
char * trusted_ip
The trusted ip.
struct SharedService * shared_services
uint16_t lowport
Lowest port we are allowed to use.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.