GNUnet 0.21.1
testing_api_cmd_local_test_prepared.c File Reference

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

Include dependency graph for testing_api_cmd_local_test_prepared.c:

Go to the source code of this file.

Macros

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

Functions

enum GNUNET_GenericReturnValue local_test_prepared_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 This function prepares an array with traits. More...
 
static void local_test_prepared_cleanup (void *cls)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static void local_test_prepared_run (void *cls, struct GNUNET_TESTING_Interpreter *is)
 This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_prepared (const char *label, GNUNET_TESTING_cmd_helper_write_cb write_message)
 This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop. More...
 

Detailed Description

cmd to block the interpreter loop until all peers started.

Author
t3sserakt

Definition in file testing_api_cmd_local_test_prepared.c.

Macro Definition Documentation

◆ LOG

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

Generic logging shortcut.

Definition at line 37 of file testing_api_cmd_local_test_prepared.c.

Function Documentation

◆ local_test_prepared_traits()

enum GNUNET_GenericReturnValue local_test_prepared_traits ( void *  cls,
const void **  ret,
const char *  trait,
unsigned int  index 
)

This function prepares an array with traits.

Definition at line 45 of file testing_api_cmd_local_test_prepared.c.

49{
50 struct LocalPreparedState *lfs = cls;
51 struct GNUNET_TESTING_Trait traits[] = {
54 };
55 return GNUNET_TESTING_get_trait (traits,
56 ret,
57 trait,
58 index);
59}
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_local_prepared_state(const struct GNUNET_TESTING_LocalPreparedState *value)
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_get_trait(), GNUNET_TESTING_make_trait_local_prepared_state(), GNUNET_TESTING_trait_end(), GNUNET_TESTING_Trait::index, and ret.

Referenced by GNUNET_TESTING_cmd_local_test_prepared().

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

◆ local_test_prepared_cleanup()

static void local_test_prepared_cleanup ( void *  cls)
static

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

Definition at line 67 of file testing_api_cmd_local_test_prepared.c.

68{
69 struct LocalPreparedState *lfs = cls;
70
71 GNUNET_free (lfs);
72}
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_free.

Referenced by GNUNET_TESTING_cmd_local_test_prepared().

Here is the caller graph for this function:

◆ local_test_prepared_run()

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

This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop.

Definition at line 80 of file testing_api_cmd_local_test_prepared.c.

82{
83 struct GNUNET_TESTING_LocalPreparedState *lfs = cls;
84
86 size_t msg_length;
87
88 msg_length = sizeof(struct GNUNET_TESTING_CommandLocalTestPrepared);
90 reply->header.type = htons (
92 reply->header.size = htons ((uint16_t) msg_length);
93 lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
94}
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED
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.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED.
Definition: testing_cmds.h:100
Struct to hold information for callbacks.
GNUNET_TESTING_cmd_helper_write_cb write_message
Callback to write messages to the master loop.

References GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED, GNUNET_new, GNUNET_TESTING_CommandLocalTestPrepared::header, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and GNUNET_TESTING_LocalPreparedState::write_message.

Referenced by GNUNET_TESTING_cmd_local_test_prepared().

Here is the caller graph for this function:

◆ GNUNET_TESTING_cmd_local_test_prepared()

struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_prepared ( const char *  label,
GNUNET_TESTING_cmd_helper_write_cb  write_message 
)

This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop.

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

Definition at line 98 of file testing_api_cmd_local_test_prepared.c.

101{
103
106
107 return GNUNET_TESTING_command_new (lfs, label,
111 &lfs->ac);
112}
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
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.
struct GNUNET_TESTING_AsyncContext ac
Context for our asynchronous completion.
static void local_test_prepared_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop...
enum GNUNET_GenericReturnValue local_test_prepared_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void local_test_prepared_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.

References GNUNET_TESTING_LocalPreparedState::ac, GNUNET_new, GNUNET_TESTING_command_new(), local_test_prepared_cleanup(), local_test_prepared_run(), local_test_prepared_traits(), GNUNET_TESTING_LocalPreparedState::write_message, and write_message().

Here is the call graph for this function: