GNUnet  0.11.x
Data Structures | Functions
testbed_api_cmd_send_peer_ready.c File Reference
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "testbed_helper.h"
Include dependency graph for testbed_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...
 

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 41 of file testbed_api_cmd_send_peer_ready.c.

References GNUNET_OK.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

45 {
46  return GNUNET_OK;
47 }
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 51 of file testbed_api_cmd_send_peer_ready.c.

References GNUNET_free, and SendPeerReadyState::reply.

Referenced by GNUNET_TESTING_cmd_send_peer_ready().

53 {
54  struct SendPeerReadyState *sprs = cls;
55 
56  GNUNET_free (sprs->reply);
57  GNUNET_free (sprs);
58 }
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 62 of file testbed_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().

65 {
66  struct SendPeerReadyState *sprs = cls;
67  struct GNUNET_CMDS_PEER_STARTED *reply;
68  size_t msg_length;
69 
70  msg_length = sizeof(struct GNUNET_CMDS_PEER_STARTED);
71  reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED);
73  reply->header.size = htons ((uint16_t) msg_length);
74  sprs->reply = reply;
75  sprs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
76 }
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...
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: