GNUnet  0.11.x
Functions
testing_api_traits.c File Reference

loop for trait resolution More...

#include "platform.h"
#include "gnunet_testing_ng_lib.h"
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.

38 {
39  struct GNUNET_TESTING_Trait end = {
40  .index = 0,
41  .trait_name = NULL,
42  .ptr = NULL
43  };
44 
45  return end;
46 }
static int end
Set if we are to shutdown all services (including ARM).
Definition: gnunet-arm.c:34

Referenced by block_until_external_trigger_traits(), connect_peers_traits(), hello_world_birth_traits(), netjail_exec_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.

63 {
64  for (unsigned int i = 0; NULL != traits[i].trait_name; i++)
65  {
66  if ( (0 == strcmp (trait, traits[i].trait_name)) &&
67  (index == traits[i].index) )
68  {
69  *ret = (void *) traits[i].ptr;
70  return GNUNET_OK;
71  }
72  }
74  "Trait %s/%u not found.\n",
75  trait, index);
76 
77  return GNUNET_SYSERR;
78 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
#define GNUNET_log(kind,...)
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
@ 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(), connect_peers_traits(), hello_world_birth_traits(), netjail_exec_traits(), start_peer_traits(), and system_create_traits().

Here is the caller graph for this function: