GNUnet  0.11.x
Data Structures | Macros | Functions
testing_api_cmd_block_until_all_peers_started.c File Reference

cmd to block the interpreter loop until all peers started. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
Include dependency graph for testing_api_cmd_block_until_all_peers_started.c:

Go to the source code of this file.

Data Structures

struct  BlockState
 Struct with information for callbacks. More...
 

Macros

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

Functions

static int block_until_all_peers_started_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 Trait function of this cmd does nothing. More...
 
static void block_until_all_peers_started_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static void block_until_all_peers_started_run (void *cls, const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is)
 This function does nothing but to start the cmd. More...
 
static int block_until_all_peers_started_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls)
 Function to check if BlockState::all_peers_started is GNUNET_YES. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, unsigned int *all_peers_started)
 Create command. More...
 

Detailed Description

cmd to block the interpreter loop until all peers started.

Author
t3sserakt

Definition in file testing_api_cmd_block_until_all_peers_started.c.

Macro Definition Documentation

◆ LOG

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

Generic logging shortcut.

Definition at line 33 of file testing_api_cmd_block_until_all_peers_started.c.

Function Documentation

◆ block_until_all_peers_started_traits()

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

Trait function of this cmd does nothing.

Definition at line 54 of file testing_api_cmd_block_until_all_peers_started.c.

58 {
59  return GNUNET_OK;
60 }
@ GNUNET_OK
Definition: gnunet_common.h:95

References GNUNET_OK.

◆ block_until_all_peers_started_cleanup()

static void block_until_all_peers_started_cleanup ( void *  cls,
const struct GNUNET_TESTING_Command cmd 
)
static

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

Definition at line 68 of file testing_api_cmd_block_until_all_peers_started.c.

70 {
71  struct BlockState *bs = cls;
72 
73  GNUNET_free (bs);
74 }
#define GNUNET_free(ptr)
Wrapper around free.
Struct with information for callbacks.

References GNUNET_free.

◆ block_until_all_peers_started_run()

static void block_until_all_peers_started_run ( void *  cls,
const struct GNUNET_TESTING_Command cmd,
struct GNUNET_TESTING_Interpreter is 
)
static

This function does nothing but to start the cmd.

Definition at line 82 of file testing_api_cmd_block_until_all_peers_started.c.

85 {
87  "block_until_all_peers_started_run!\n");
88 }
@ GNUNET_ERROR_TYPE_DEBUG
#define LOG(kind,...)
Generic logging shortcut.

References GNUNET_ERROR_TYPE_DEBUG, and LOG.

◆ block_until_all_peers_started_finish()

static int block_until_all_peers_started_finish ( void *  cls,
GNUNET_SCHEDULER_TaskCallback  cont,
void *  cont_cls 
)
static

Function to check if BlockState::all_peers_started is GNUNET_YES.

In that case interpreter_next will be called.

Definition at line 96 of file testing_api_cmd_block_until_all_peers_started.c.

99 {
100  struct BlockState *bs = cls;
101  unsigned int *ret = bs->all_peers_started;
102 
103  if (GNUNET_YES == *ret)
104  {
105  cont (cont_cls);
106  }
107 
108  return *ret;
109 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
@ GNUNET_YES
Definition: gnunet_common.h:97
unsigned int * all_peers_started
Flag to indicate if all peers have started.

References BlockState::all_peers_started, GNUNET_YES, and ret.

◆ GNUNET_TESTING_cmd_block_until_all_peers_started()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_all_peers_started ( const char *  label,
unsigned int *  all_peers_started 
)

Create command.

Parameters
labelname for command.
all_peers_startedFlag which will be set from outside.
Returns
command.

Definition at line 96 of file testing_api_cmd_block_until_all_peers_started.c.

123 {
124  struct BlockState *bs;
125 
126  bs = GNUNET_new (struct BlockState);
128 
129  struct GNUNET_TESTING_Command cmd = {
130  .cls = bs,
131  .label = label,
136  };
137 
138  return cmd;
139 }
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A command to be run by the interpreter.
const char * label
Label for the command.
void * cls
Closure for all commands with command-specific context information.
static int block_until_all_peers_started_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.
static void block_until_all_peers_started_run(void *cls, const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is)
This function does nothing but to start the cmd.
static int block_until_all_peers_started_finish(void *cls, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls)
Function to check if BlockState::all_peers_started is GNUNET_YES.
static void block_until_all_peers_started_cleanup(void *cls, const struct GNUNET_TESTING_Command *cmd)
The cleanup function of this cmd frees resources the cmd allocated.