GNUnet  0.11.x
Data Structures | Functions
testing_api_cmd_send_peer_ready.c File Reference

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

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "testbed_api.h"
#include "testbed_helper.h"
Include dependency graph for testing_api_cmd_send_peer_ready.c:

Go to the source code of this file.

Data Structures

struct  SendPeerReadyState
 

Functions

static int send_peer_ready_traits (void *cls, const void **ret, const char *trait, unsigned int index)
 
static void send_peer_ready_cleanup (void *cls, const struct GNUNET_TESTING_Command *cmd)
 
static void send_peer_ready_run (void *cls, const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is)
 
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready (const char *label, TESTBED_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 int send_peer_ready_traits ( void *  cls,
const void **  ret,
const char *  trait,
unsigned int  index 
)
static

Definition at line 42 of file testing_api_cmd_send_peer_ready.c.

References GNUNET_OK.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

46 {
47  return GNUNET_OK;
48 }
Here is the caller graph for this function:

◆ send_peer_ready_cleanup()

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

Definition at line 52 of file testing_api_cmd_send_peer_ready.c.

References GNUNET_free, and SendPeerReadyState::reply.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

54 {
55  struct SendPeerReadyState *sprs = cls;
56 
57  GNUNET_free (sprs->reply);
58  GNUNET_free (sprs);
59 }
struct GNUNET_CMDS_PEER_STARTED * reply
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ send_peer_ready_run()

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

Definition at line 63 of file testing_api_cmd_send_peer_ready.c.

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

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

66 {
67  struct SendPeerReadyState *sprs = cls;
68  struct GNUNET_CMDS_PEER_STARTED *reply;
69  size_t msg_length;
70 
71  msg_length = sizeof(struct GNUNET_CMDS_HelperInit);// GNUNET_CMDS_PEER_STARTED);
72  reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED);
74  reply->header.size = htons ((uint16_t) msg_length);
75  sprs->reply = reply;
76  sprs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
77 }
TESTBED_CMD_HELPER_write_cb write_message
#define GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Initialization message for gnunet-cmds-testbed to start cmd binary.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED.
Header for all communications.
struct GNUNET_CMDS_PEER_STARTED * reply
Here is the caller graph for this function: