GNUnet 0.21.1
gnunet_testing_lib.h File Reference

Convenience API for writing testcases for GNUnet. More...

Include dependency graph for gnunet_testing_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_TESTING_SharedService
 Specification of a service that is to be shared among peers. More...
 

Macros

#define GNUNET_TESTING_HOSTKEYFILESIZE
 Size of each hostkey in the hostkey file (in BYTES). More...
 
#define GNUNET_TESTING_PREFIX   "GNUNET_TESTING_PREFIX"
 The environmental variable, if set, that dictates where testing should place generated peer configurations. More...
 

Typedefs

typedef void(* GNUNET_TESTING_PeerStopCallback) (void *cls, struct GNUNET_TESTING_Peer *peer, int success)
 Callback to inform whether the peer is running or stopped. More...
 
typedef 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_run(). More...
 

Functions

struct GNUNET_TESTING_SystemGNUNET_TESTING_system_create (const char *testdir, const char *trusted_ip, const char *hostname, const struct GNUNET_TESTING_SharedService *shared_services)
 Create a system handle. More...
 
struct GNUNET_TESTING_SystemGNUNET_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. More...
 
void GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, int remove_paths)
 Free system resources. More...
 
struct GNUNET_CRYPTO_EddsaPrivateKeyGNUNET_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. More...
 
uint16_t GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
 Reserve a port for a peer. More...
 
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). More...
 
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 modified to select available ports on the local system. More...
 
struct GNUNET_TESTING_PeerGNUNET_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. More...
 
void GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, struct GNUNET_PeerIdentity *id)
 Obtain the peer identity from a peer handle. More...
 
int GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
 Start the peer. More...
 
int GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer)
 Stop the peer. More...
 
void GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer)
 Destroy the peer. More...
 
int GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer)
 Sends SIGTERM to the peer's main process. More...
 
int GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer)
 Waits for a peer to terminate. More...
 
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. More...
 
void GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer)
 Cancel a previous asynchronous peer stop request. More...
 
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. More...
 
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 using the testing library. More...
 

Detailed Description

Convenience API for writing testcases for GNUnet.

Definition in file gnunet_testing_lib.h.