GNUnet  0.20.0
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" trait.

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

Definition at line 1 of file testing_api_traits.c.

47 {
48  struct GNUNET_TESTING_Trait end = {
49  .index = 0,
50  .trait_name = NULL,
51  .ptr = NULL
52  };
53 
54  return end;
55 }
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.

Referenced by block_until_external_trigger_traits(), start_peer_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.

Extract a trait.

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 1 of file testing_api_traits.c.

72 {
73  for (unsigned int i = 0; NULL != traits[i].trait_name; i++)
74  {
75  if ( (0 == strcmp (trait, traits[i].trait_name)) &&
76  (index == traits[i].index) )
77  {
78  *ret = (void *) traits[i].ptr;
79  return GNUNET_OK;
80  }
81  }
83  "Trait %s/%u not found.\n",
84  trait, index);
85 
86  return GNUNET_SYSERR;
87 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
#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 end.

Referenced by block_until_external_trigger_traits(), start_peer_traits(), and system_create_traits().

Here is the caller graph for this function: