GNUnet  0.17.6
Data Structures | Macros | Functions
testing_api_cmd_local_test_finished.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 "gnunet_testing_netjail_lib.h"
#include "testing_cmds.h"
Include dependency graph for testing_api_cmd_local_test_finished.c:

Go to the source code of this file.

Data Structures

struct  LocalFinishedState
 Struct to hold information for callbacks. More...
 

Macros

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

Functions

static void local_test_finished_cleanup (void *cls)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static void local_test_finished_run (void *cls, struct GNUNET_TESTING_Interpreter *is)
 This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED message to the master loop. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_finished (const char *label, TESTING_CMD_HELPER_write_cb write_message)
 Create command. More...
 

Detailed Description

cmd to block the interpreter loop until all peers started.

Author
t3sserakt

Definition in file testing_api_cmd_local_test_finished.c.

Macro Definition Documentation

◆ LOG

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

Generic logging shortcut.

Definition at line 35 of file testing_api_cmd_local_test_finished.c.

Function Documentation

◆ local_test_finished_cleanup()

static void local_test_finished_cleanup ( void *  cls)
static

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

Definition at line 64 of file testing_api_cmd_local_test_finished.c.

65 {
66  struct LocalFinishedState *lfs = cls;
67 
68  GNUNET_free (lfs);
69 }
#define GNUNET_free(ptr)
Wrapper around free.
Struct to hold information for callbacks.

References GNUNET_free.

◆ local_test_finished_run()

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

This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED message to the master loop.

Definition at line 77 of file testing_api_cmd_local_test_finished.c.

79 {
80  struct LocalFinishedState *lfs = cls;
81  struct GNUNET_CMDS_LOCAL_FINISHED *reply;
82  size_t msg_length;
83 
84  msg_length = sizeof(struct GNUNET_CMDS_LOCAL_FINISHED);
85  reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_FINISHED);
87  reply->header.size = htons ((uint16_t) msg_length);
88  lfs->reply = reply;
89  lfs->write_message ((struct GNUNET_MessageHeader *) reply,
90  msg_length);
91 }
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED.
Definition: testing_cmds.h:85
Header for all communications.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
TESTING_CMD_HELPER_write_cb write_message
Callback to write messages to the master loop.
struct GNUNET_CMDS_LOCAL_FINISHED * reply
The message send back to the master loop.

References GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED, GNUNET_new, GNUNET_CMDS_LOCAL_FINISHED::header, LocalFinishedState::reply, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and LocalFinishedState::write_message.

◆ GNUNET_TESTING_cmd_local_test_finished()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_finished ( const char *  label,
TESTING_CMD_HELPER_write_cb  write_message 
)

Create command.

Parameters
labelname for command.
write_messageCallback to write messages to the master loop.
Returns
command.

Definition at line 77 of file testing_api_cmd_local_test_finished.c.

105 {
106  struct LocalFinishedState *lfs;
107 
108  lfs = GNUNET_new (struct LocalFinishedState);
110  {
111  struct GNUNET_TESTING_Command cmd = {
112  .cls = lfs,
113  .label = label,
114  .run = &local_test_finished_run,
115  .cleanup = &local_test_finished_cleanup,
116  };
117 
118  return cmd;
119  }
120 }
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
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 void local_test_finished_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED message to the master loop.
static void local_test_finished_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.