GNUnet 0.21.1
testing_api_cmd_block_until_external_trigger.c File Reference
Include dependency graph for testing_api_cmd_block_until_external_trigger.c:

Go to the source code of this file.

Macros

#define LOG(kind, ...)   GNUNET_log (kind, __VA_ARGS__)
 Generic logging shortcut. More...
 

Functions

static void block_until_all_peers_started_cleanup (void *cls)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static int block_until_external_trigger_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 
static void block_until_all_peers_started_run (void *cls, struct GNUNET_TESTING_Interpreter *is)
 This function does nothing but to start the cmd. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_external_trigger (const char *label)
 Create command. More...
 

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log (kind, __VA_ARGS__)

Generic logging shortcut.

Definition at line 36 of file testing_api_cmd_block_until_external_trigger.c.

Function Documentation

◆ block_until_all_peers_started_cleanup()

static void block_until_all_peers_started_cleanup ( void *  cls)
static

The cleanup function of this cmd frees resources the cmd allocated.

Definition at line 44 of file testing_api_cmd_block_until_external_trigger.c.

45{
46 struct BlockState *bs = cls;
47
48 GNUNET_free (bs);
49}
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_free.

Referenced by GNUNET_TESTING_cmd_block_until_external_trigger().

Here is the caller graph for this function:

◆ block_until_external_trigger_traits()

static int block_until_external_trigger_traits ( void *  cls,
const void **  ret,
const char *  trait,
unsigned int  index 
)
static

Definition at line 53 of file testing_api_cmd_block_until_external_trigger.c.

57{
58 struct GNUNET_TESTING_BlockState *bs = cls;
59 struct GNUNET_TESTING_AsyncContext *ac = &bs->ac;
60 struct GNUNET_TESTING_Trait traits[] = {
64 };
65
66 return GNUNET_TESTING_get_trait (traits,
67 ret,
68 trait,
69 index);
70}
static int ret
Final status code.
Definition: gnunet-arm.c:94
struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end(void)
"end" of traits array.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait(const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
Obtain value of a trait from a command.
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_async_context(struct GNUNET_TESTING_AsyncContext *value)
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_block_state(struct GNUNET_TESTING_BlockState *value)
State each asynchronous command must have in its closure.
Struct with information for callbacks.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
unsigned int index
Index number associated with the trait.

References GNUNET_TESTING_BlockState::ac, GNUNET_TESTING_get_trait(), GNUNET_TESTING_make_trait_async_context(), GNUNET_TESTING_make_trait_block_state(), GNUNET_TESTING_trait_end(), GNUNET_TESTING_Trait::index, and ret.

Referenced by GNUNET_TESTING_cmd_block_until_external_trigger().

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

◆ block_until_all_peers_started_run()

static void block_until_all_peers_started_run ( void *  cls,
struct GNUNET_TESTING_Interpreter is 
)
static

This function does nothing but to start the cmd.

Definition at line 78 of file testing_api_cmd_block_until_external_trigger.c.

80{
81 struct GNUNET_TESTING_BlockState *bs = cls;
82 struct GNUNET_TESTING_Command *cmd =
84
86 "block %s running %u!\n",
87 bs->label,
90 {
92 "block %s running asynchronous!\n",
93 bs->label);
95 }
96}
struct GNUNET_TESTING_Interpreter * is
@ GNUNET_YES
@ GNUNET_ERROR_TYPE_DEBUG
unsigned int asynchronous_finish
If this command will block.
const char * label
The label of this command.
A command to be run by the interpreter.
bool asynchronous_finish
If "true", the interpreter should not immediately call finish, even if finish is non-NULL.
#define LOG(kind,...)
Generic logging shortcut.
struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_get_current_command(struct GNUNET_TESTING_Interpreter *is)
Returns the actual running command.

References GNUNET_TESTING_Command::asynchronous_finish, GNUNET_TESTING_BlockState::asynchronous_finish, GNUNET_ERROR_TYPE_DEBUG, GNUNET_TESTING_interpreter_get_current_command(), GNUNET_YES, is, GNUNET_TESTING_BlockState::label, and LOG.

Referenced by GNUNET_TESTING_cmd_block_until_external_trigger().

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

◆ GNUNET_TESTING_cmd_block_until_external_trigger()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_external_trigger ( const char *  label)

Create command.

This command is used to block the loop, until the command is finished by other commands, using a trait to get this commands struct GNUNET_TESTING_AsyncContext.

Parameters
labelname for command.
Returns
command.

Definition at line 106 of file testing_api_cmd_block_until_external_trigger.c.

108{
109 struct GNUNET_TESTING_BlockState *bs;
110
112 bs->label = label;
114 label,
118 &bs->ac);
119}
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.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void block_until_all_peers_started_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static int block_until_external_trigger_traits(void *cls, const void **ret, const char *trait, unsigned int index)
static void block_until_all_peers_started_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function does nothing but to start the cmd.

References GNUNET_TESTING_BlockState::ac, block_until_all_peers_started_cleanup(), block_until_all_peers_started_run(), block_until_external_trigger_traits(), GNUNET_new, GNUNET_TESTING_command_new(), and GNUNET_TESTING_BlockState::label.

Here is the call graph for this function: