GNUnet 0.21.1
testing_api_traits.c File Reference

loop for trait resolution More...

Include dependency graph for testing_api_traits.c:

Go to the source code of this file.

Functions

struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end ()
 End a trait array. More...
 
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
 Pick the chosen trait from the traits array. More...
 

Detailed Description

loop for trait resolution

Author
Christian Grothoff (GNU Taler testing)
Marcello Stanisci (GNU Taler testing)
t3sserakt

Definition in file testing_api_traits.c.

Function Documentation

◆ GNUNET_TESTING_trait_end()

struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end ( void  )

End a trait array.

"end" of traits array.

Usually, commands offer several traits, and put them in arrays.

Definition at line 52 of file testing_api_traits.c.

53{
54 struct GNUNET_TESTING_Trait end = {
55 .index = 0,
56 .trait_name = NULL,
57 .ptr = NULL
58 };
59
60 return end;
61}
static int end
Set if we are to shutdown all services (including ARM).
Definition: gnunet-arm.c:34
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.

References end.

Referenced by barrier_reached_traits(), barrier_traits(), batch_traits(), block_until_external_trigger_traits(), connect_peers_traits(), local_test_prepared_traits(), netjail_exec_traits(), start_peer_traits(), start_service_traits(), and system_create_traits().

Here is the caller graph for this function:

◆ GNUNET_TESTING_get_trait()

enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait ( const struct GNUNET_TESTING_Trait traits,
const void **  ret,
const char *  trait,
unsigned int  index 
)

Pick the chosen trait from the traits array.

Obtain value of a trait from a command.

Parameters
traitsthe traits array.
retwhere to store the result.
traittype of the trait to extract.
indexindex number of the object to extract.
Returns
GNUNET_OK if no error occurred, GNUNET_SYSERR otherwise.

Definition at line 74 of file testing_api_traits.c.

78{
79 for (unsigned int i = 0; NULL != traits[i].trait_name; i++)
80 {
81 if ( (0 == strcmp (trait, traits[i].trait_name)) &&
82 (index == traits[i].index) )
83 {
84 *ret = (void *) traits[i].ptr;
85 return GNUNET_OK;
86 }
87 }
89 "Trait %s/%u not found.\n",
90 trait, index);
91
92 return GNUNET_SYSERR;
93}
static int ret
Final status code.
Definition: gnunet-arm.c:94
#define GNUNET_log(kind,...)
@ GNUNET_OK
@ GNUNET_SYSERR
@ GNUNET_ERROR_TYPE_INFO
const char * trait_name
Trait type, for example "reserve-pub" or "coin-priv".

References GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_Trait::index, GNUNET_TESTING_Trait::ptr, ret, and GNUNET_TESTING_Trait::trait_name.

Referenced by barrier_reached_traits(), barrier_traits(), batch_traits(), block_until_external_trigger_traits(), connect_peers_traits(), local_test_prepared_traits(), netjail_exec_traits(), start_peer_traits(), start_service_traits(), and system_create_traits().

Here is the caller graph for this function: