GNUnet 0.21.1
testing_api_cmd_send_peer_ready.c File Reference

cmd to send a helper message if peer is ready. More...

Include dependency graph for testing_api_cmd_send_peer_ready.c:

Go to the source code of this file.

Data Structures

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

Functions

static enum GNUNET_GenericReturnValue send_peer_ready_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 Trait function of this cmd does nothing. More...
 
static void send_peer_ready_cleanup (void *cls)
 The cleanup function of this cmd frees resources the cmd allocated. More...
 
static void send_peer_ready_run (void *cls, struct GNUNET_TESTING_Interpreter *is)
 This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop. More...
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready (const char *label, GNUNET_TESTING_cmd_helper_write_cb write_message)
 Create command. More...
 

Detailed Description

cmd to send a helper message if peer is ready.

Author
t3sserakt

Definition in file testing_api_cmd_send_peer_ready.c.

Function Documentation

◆ send_peer_ready_traits()

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

Trait function of this cmd does nothing.

Definition at line 60 of file testing_api_cmd_send_peer_ready.c.

64{
65 return GNUNET_NO;
66}
@ GNUNET_NO

References GNUNET_NO.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

Here is the caller graph for this function:

◆ send_peer_ready_cleanup()

static void send_peer_ready_cleanup ( void *  cls)
static

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

Definition at line 74 of file testing_api_cmd_send_peer_ready.c.

75{
76 struct SendPeerReadyState *sprs = cls;
77
78 GNUNET_free (sprs);
79}
#define GNUNET_free(ptr)
Wrapper around free.
Struct to hold information for callbacks.

References GNUNET_free.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

Here is the caller graph for this function:

◆ send_peer_ready_run()

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

This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.

Definition at line 87 of file testing_api_cmd_send_peer_ready.c.

89{
90 struct SendPeerReadyState *sprs = cls;
92 size_t msg_length;
93
94 msg_length = sizeof(struct GNUNET_TESTING_CommandPeerStarted);
97 reply->header.size = htons ((uint16_t) msg_length);
98 sprs->reply = reply;
99 sprs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
100}
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED
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_PEER_STARTED.
Definition: testing_cmds.h:70
struct GNUNET_TESTING_CommandPeerStarted * reply
The message send back to the master loop.
GNUNET_TESTING_cmd_helper_write_cb write_message
Callback to write messages to the master loop.

References GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED, GNUNET_new, GNUNET_TESTING_CommandPeerStarted::header, SendPeerReadyState::reply, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and SendPeerReadyState::write_message.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

Here is the caller graph for this function:

◆ GNUNET_TESTING_cmd_send_peer_ready()

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

Create command.

DEPRECATED This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.

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

Definition at line 111 of file testing_api_cmd_send_peer_ready.c.

114{
115 struct SendPeerReadyState *sprs;
116
117 sprs = GNUNET_new (struct SendPeerReadyState);
119 return GNUNET_TESTING_command_new (sprs, label,
123}
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.
static void send_peer_ready_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.
static void send_peer_ready_cleanup(void *cls)
The cleanup function of this cmd frees resources the cmd allocated.
static enum GNUNET_GenericReturnValue send_peer_ready_traits(void *cls, const void **ret, const char *trait, unsigned int index)
Trait function of this cmd does nothing.

References GNUNET_new, GNUNET_TESTING_command_new(), send_peer_ready_cleanup(), send_peer_ready_run(), send_peer_ready_traits(), write_message(), and SendPeerReadyState::write_message.

Here is the call graph for this function: