GNUnet  0.17.6
Macros | Functions
testing_api_cmd_block_until_external_trigger.c File Reference
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "gnunet_testing_netjail_lib.h"
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 34 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 42 of file testing_api_cmd_block_until_external_trigger.c.

43 {
44  struct BlockState *bs = cls;
45 
46  GNUNET_free (bs);
47 }
#define GNUNET_free(ptr)
Wrapper around free.
Struct with information for callbacks.

References GNUNET_free.

◆ 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 50 of file testing_api_cmd_block_until_external_trigger.c.

54 {
55  struct BlockState *bs = cls;
56  struct GNUNET_TESTING_AsyncContext *ac = &bs->ac;
57  struct GNUNET_TESTING_Trait traits[] = {
59  GNUNET_TESTING_make_trait_block_state ((const void *) bs),
61  };
62 
63  return GNUNET_TESTING_get_trait (traits,
64  ret,
65  trait,
66  index);
67 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_async_context(const struct GNUNET_TESTING_AsyncContext *value)
struct GNUNET_TESTING_Trait GNUNET_TESTING_make_trait_block_state(const struct BlockState *value)
struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end(void)
"end" trait.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait(const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
Extract a trait.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
State each asynchronous command must have in its closure.
unsigned int index
Index number associated with the trait.

References BlockState::ac, 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.

Here is the call 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 75 of file testing_api_cmd_block_until_external_trigger.c.

77 {
78  struct BlockState *bs = cls;
79  struct GNUNET_TESTING_Command *cmd =
81 
83  "block %s running %u!\n",
84  bs->label,
87  {
89  "block %s running asynchronous!\n",
90  bs->label);
92  }
93 }
static struct GNUNET_NT_InterfaceScanner * is
Network scanner to determine network types.
struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_get_current_command(struct GNUNET_TESTING_Interpreter *is)
Returns the actual running command.
@ 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.

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

Here is the call 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.

Parameters
labelname for command.
all_peers_startedFlag which will be set from outside.
asynchronous_finishIf GNUNET_YES this command will not block. Can be NULL.
Returns
command.

Definition at line 75 of file testing_api_cmd_block_until_external_trigger.c.

107 {
108  struct BlockState *bs;
109 
110  bs = GNUNET_new (struct BlockState);
111  bs->label = label;
113  {
114  struct GNUNET_TESTING_Command cmd = {
115  .cls = bs,
116  .label = label,
118  .ac = &bs->ac,
121  };
122 
123  return cmd;
124  }
125 }
@ GNUNET_NO
Definition: gnunet_common.h:98
#define GNUNET_new(type)
Allocate a struct or union of the given type.
const char * label
Label for the command.
void * cls
Closure for all commands with command-specific context information.
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.