GNUnet 0.21.1
gnunet_transport_testing_ng_lib.h File Reference
Include dependency graph for gnunet_transport_testing_ng_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_StartPeerState
 

Macros

#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS(op, prefix)
 Call op on all simple traits. More...
 

Typedefs

typedef void *(* GNUNET_TESTING_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_PeerIdentity *peer)
 

Functions

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_start_peer (const char *label, const char *system_label, uint32_t no, const char *node_ip, const char *cfgname, unsigned int broadcast)
 Create command. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_stop_peer (const char *label, const char *start_label)
 Create command. More...
 
struct GNUNET_PeerIdentityGNUNET_TESTING_get_peer (unsigned int num, const struct GNUNET_TESTING_System *tl_system)
 Retrieve peer identity from the test system with the unique node id. More...
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_connected_peers_map (const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_CONTAINER_MultiShortmap **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_connected_peers_map (const struct GNUNET_CONTAINER_MultiShortmap *value)
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_peer_id (const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_PeerIdentity **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_peer_id (const struct GNUNET_PeerIdentity *value)
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_hello_size (const struct GNUNET_TESTING_Command *cmd, const size_t **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_hello_size (const size_t *value)
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_hello (const struct GNUNET_TESTING_Command *cmd, const char **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_hello (const char *value)
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_application_handle (const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_TRANSPORT_ApplicationHandle **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_application_handle (const struct GNUNET_TRANSPORT_ApplicationHandle *value)
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_state (const struct GNUNET_TESTING_Command *cmd, const struct GNUNET_TESTING_StartPeerState **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_state (const struct GNUNET_TESTING_StartPeerState *value)
 
enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_broadcast (const struct GNUNET_TESTING_Command *cmd, const enum GNUNET_GenericReturnValue **ret)
 
struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_broadcast (const enum GNUNET_GenericReturnValue *value)
 

Macro Definition Documentation

◆ GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS

#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (   op,
  prefix 
)
Value:
op (prefix, connected_peers_map, const struct GNUNET_CONTAINER_MultiShortmap) \
op (prefix, peer_id, const struct GNUNET_PeerIdentity) \
op (prefix, hello_size, const size_t) \
op (prefix, hello, const char) \
op (prefix, application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \
op (prefix, broadcast, const enum GNUNET_GenericReturnValue)
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
static int prefix
If printing the value of PREFIX has been requested.
Definition: gnunet-config.c:59
enum State state
current state of profiling
GNUNET_GenericReturnValue
Named constants for return values.
Internal representation of the hash map.
The identity of the host (wraps the signing key of the peer).
Handle to the TRANSPORT subsystem for application management.

Call op on all simple traits.

Definition at line 199 of file gnunet_transport_testing_ng_lib.h.

Typedef Documentation

◆ GNUNET_TESTING_notify_connect_cb

typedef void *(* GNUNET_TESTING_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_PeerIdentity *peer)

Definition at line 44 of file gnunet_transport_testing_ng_lib.h.

Function Documentation

◆ GNUNET_TESTING_cmd_start_peer()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_start_peer ( const char *  label,
const char *  system_label,
uint32_t  no,
const char *  node_ip,
const char *  cfgname,
unsigned int  broadcast 
)

Create command.

Parameters
labelname for command.
system_labelLabel of the cmd to setup a test environment.
noDecimal number representing the last byte of the IP address of this peer.
node_ipThe IP address of this node.
cfgnameConfiguration file name for this peer.
broadcastFlag indicating, if broadcast should be switched on.
Returns
command.

Definition at line 271 of file testing_api_cmd_start_peer.c.

277{
279 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
281
283 sps->no = no;
284 sps->system_label = GNUNET_strdup (system_label);
285 sps->connected_peers_map = connected_peers_map;
286 sps->cfgname = GNUNET_strdup (cfgname);
287 sps->node_ip = GNUNET_strdup (node_ip);
288 sps->broadcast = broadcast;
289
290 return GNUNET_TESTING_command_new (sps,
291 label,
295 NULL);
296}
struct GNUNET_TESTING_Command GNUNET_TESTING_command_new(void *cls, const char *label, GNUNET_TESTING_CommandRunRoutine run, GNUNET_TESTING_CommandCleanupRoutine cleanup, GNUNET_TESTING_CommandGetTraits traits, struct GNUNET_TESTING_AsyncContext *ac)
Create a new command.
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
@ GNUNET_NO
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
char * system_label
The label of the command which was started by calling GNUNET_TESTING_cmd_system_create.
unsigned int no
An unique number to identify the peer.
struct GNUNET_CONTAINER_MultiShortmap * connected_peers_map
A map with struct GNUNET_MQ_Handle values for each peer this peer is connected to.
enum GNUNET_GenericReturnValue broadcast
Flag indicating, if udp broadcast should be switched on.
char * cfgname
GNUnet configuration file used to start a peer.
static void start_peer_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static int start_peer_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void start_peer_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will start all services of a peer to test the transport service.

◆ GNUNET_TESTING_cmd_stop_peer()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_stop_peer ( const char *  label,
const char *  start_label 
)

Create command.

Parameters
labelname for command.
start_labelLabel of the cmd to start the peer.
Returns
command.

Definition at line 117 of file testing_api_cmd_stop_peer.c.

119{
120 struct StopPeerState *sps;
121
122 sps = GNUNET_new (struct StopPeerState);
124 return GNUNET_TESTING_command_new (sps,
125 label,
129 NULL);
130}
Struct to hold information for callbacks.
static int stop_peer_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.
static void stop_peer_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static void stop_peer_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
The run method of this cmd will stop all services of a peer which were used to test the transport ser...

References GNUNET_new, GNUNET_TESTING_command_new(), StopPeerState::start_label, stop_peer_cleanup(), stop_peer_run(), and stop_peer_traits().

Here is the call graph for this function:

◆ GNUNET_TESTING_get_peer()

struct GNUNET_PeerIdentity * GNUNET_TESTING_get_peer ( unsigned int  num,
const struct GNUNET_TESTING_System tl_system 
)

Retrieve peer identity from the test system with the unique node id.

Parameters
numThe unique node id.
tl_systemThe test system.
Returns
The peer identity wrapping the public key.

Retrieve peer identity from the test system with the unique node id.

Parameters
numThe unique node id.
tl_systemThe test system.
Returns
The peer identity wrapping the public key.

Definition at line 2276 of file testing.c.

2278{
2279 struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
2280 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key;
2281
2282 priv_key = GNUNET_TESTING_hostkey_get (tl_system,
2283 num,
2284 peer);
2285
2287 &peer->public_key);
2288 GNUNET_free (priv_key);
2289 return peer;
2290}
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:198
#define GNUNET_free(ptr)
Wrapper around free.
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.
Definition: testing.c:732
Private ECC key encoded for transmission.
struct GNUNET_CRYPTO_EddsaPublicKey public_key

References GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_free, GNUNET_new, GNUNET_TESTING_hostkey_get(), and GNUNET_PeerIdentity::public_key.

Referenced by add_search_string(), connect_peers_run(), join_room_run(), and notify_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_connected_peers_map()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_connected_peers_map ( const struct GNUNET_TESTING_Command cmd,
const struct GNUNET_CONTAINER_MultiShortmap **  ret 
)

Referenced by send_simple_run().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_make_trait_connected_peers_map()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_connected_peers_map ( const struct GNUNET_CONTAINER_MultiShortmap value)

Referenced by start_peer_traits().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_peer_id()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_peer_id ( const struct GNUNET_TESTING_Command cmd,
const struct GNUNET_PeerIdentity **  ret 
)

◆ GNUNET_TRANSPORT_TESTING_make_trait_peer_id()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_peer_id ( const struct GNUNET_PeerIdentity value)

Referenced by start_peer_traits().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_hello_size()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_hello_size ( const struct GNUNET_TESTING_Command cmd,
const size_t **  ret 
)

◆ GNUNET_TRANSPORT_TESTING_make_trait_hello_size()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_hello_size ( const size_t *  value)

Referenced by start_peer_traits().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_hello()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_hello ( const struct GNUNET_TESTING_Command cmd,
const char **  ret 
)

◆ GNUNET_TRANSPORT_TESTING_make_trait_hello()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_hello ( const char *  value)

Referenced by start_peer_traits().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_application_handle()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_application_handle ( const struct GNUNET_TESTING_Command cmd,
const struct GNUNET_TRANSPORT_ApplicationHandle **  ret 
)

Referenced by backchannel_check_run(), and connect_peers_run().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_make_trait_application_handle()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_application_handle ( const struct GNUNET_TRANSPORT_ApplicationHandle value)

Referenced by start_peer_traits().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_state()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_state ( const struct GNUNET_TESTING_Command cmd,
const struct GNUNET_TESTING_StartPeerState **  ret 
)

Referenced by connect_peers_run(), start_service_run(), and stop_peer_run().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_make_trait_state()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_state ( const struct GNUNET_TESTING_StartPeerState value)

Referenced by start_peer_traits().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_get_trait_broadcast()

enum GNUNET_GenericReturnValue GNUNET_TRANSPORT_TESTING_get_trait_broadcast ( const struct GNUNET_TESTING_Command cmd,
const enum GNUNET_GenericReturnValue **  ret 
)

Referenced by connect_peers_run().

Here is the caller graph for this function:

◆ GNUNET_TRANSPORT_TESTING_make_trait_broadcast()

struct GNUNET_TESTING_Trait GNUNET_TRANSPORT_TESTING_make_trait_broadcast ( const enum GNUNET_GenericReturnValue value)

Referenced by start_peer_traits().

Here is the caller graph for this function: