GNUnet 0.22.1
messenger-testing-cmds.h File Reference

testing lib for messenger service More...

#include "gnunet_testing_lib.h"
#include "messenger-testing.h"
Include dependency graph for messenger-testing-cmds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GNUNET_MESSENGER_MAKE_DECL_SIMPLE_TRAIT(name, type)
 Create headers for a trait with name name for statically allocated data of type type. More...
 
#define GNUNET_MESSENGER_MAKE_IMPL_SIMPLE_TRAIT(name, type)
 Create C implementation for a trait with name name for statically allocated data of type type. More...
 
#define GNUNET_MESSENGER_SIMPLE_TRAITS(op)    op (state, struct GNUNET_MESSENGER_StartServiceState)
 Call op on all simple traits. More...
 

Functions

struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_start_service (const char *label, const char *peer_label, const char *system_label, struct GNUNET_MESSENGER_TestStageTopology *topology, unsigned int peer_index)
 
struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_stop_service (const char *label, const char *service_label)
 
struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_join_room (const char *label, const char *service_label, const char *room_key)
 
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_get_trait_state (const struct GNUNET_TESTING_Command *cmd, struct GNUNET_MESSENGER_StartServiceState **ret)
 
struct GNUNET_TESTING_Trait GNUNET_MESSENGER_make_trait_state (struct GNUNET_MESSENGER_StartServiceState *value)
 

Detailed Description

testing lib for messenger service

Author
Tobias Frisch

Definition in file messenger-testing-cmds.h.

Macro Definition Documentation

◆ GNUNET_MESSENGER_MAKE_DECL_SIMPLE_TRAIT

#define GNUNET_MESSENGER_MAKE_DECL_SIMPLE_TRAIT (   name,
  type 
)
Value:
enum GNUNET_GenericReturnValue \
GNUNET_MESSENGER_get_trait_ ## name ( \
const struct GNUNET_TESTING_Command *cmd, \
type * *ret); \
struct GNUNET_TESTING_Trait \
GNUNET_MESSENGER_make_trait_ ## name ( \
type * value);
static int ret
Final status code.
Definition: gnunet-arm.c:93
static char * name
Name (label) of the records to list.
static char * value
Value of the record to add/remove.
static uint32_t type
Type string converted to DNS type value.
A command to be run by the interpreter.

Create headers for a trait with name name for statically allocated data of type type.

Definition at line 54 of file messenger-testing-cmds.h.

◆ GNUNET_MESSENGER_MAKE_IMPL_SIMPLE_TRAIT

#define GNUNET_MESSENGER_MAKE_IMPL_SIMPLE_TRAIT (   name,
  type 
)
Value:
enum GNUNET_GenericReturnValue \
GNUNET_MESSENGER_get_trait_ ## name ( \
const struct GNUNET_TESTING_Command *cmd, \
type * *ret) \
{ \
if (NULL == cmd->traits) return GNUNET_SYSERR; \
return cmd->traits (cmd->cls, \
(const void **) ret, \
0); \
} \
GNUNET_MESSENGER_make_trait_ ## name ( \
type * value) \
{ \
struct GNUNET_TESTING_Trait ret = { \
.trait_name = GNUNET_S (name), \
.ptr = (const void *) value \
}; \
return ret; \
}
#define GNUNET_S(a)
Stringify operator.
@ GNUNET_SYSERR
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
static enum GNUNET_GenericReturnValue traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.

Create C implementation for a trait with name name for statically allocated data of type type.

Definition at line 68 of file messenger-testing-cmds.h.

◆ GNUNET_MESSENGER_SIMPLE_TRAITS

#define GNUNET_MESSENGER_SIMPLE_TRAITS (   op)     op (state, struct GNUNET_MESSENGER_StartServiceState)

Call op on all simple traits.

Definition at line 95 of file messenger-testing-cmds.h.

Function Documentation

◆ GNUNET_MESSENGER_cmd_start_service()

struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_start_service ( const char *  label,
const char *  peer_label,
const char *  system_label,
struct GNUNET_MESSENGER_TestStageTopology topology,
unsigned int  peer_index 
)

Definition at line 145 of file testing_messenger_cmd_start_service.c.

151{
153
157 sss->topology = topology;
158
159 sss->is = NULL;
160 sss->tl_system = NULL;
161 sss->msg = NULL;
162 sss->rooms = NULL;
163 sss->peer_index = peer_index;
164 sss->stage_index = 0;
165
166 return GNUNET_TESTING_command_new (sss,
167 label,
171}
#define GNUNET_TESTING_command_new(cls, label, run, cleanup, traits)
Create a new command.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_MESSENGER_Handle * msg
struct GNUNET_MESSENGER_TestStageTopology * topology
struct GNUNET_TESTING_Interpreter * is
struct GNUNET_CONTAINER_MultiHashMap * rooms
const struct GNUNET_TESTING_System * tl_system
static enum GNUNET_GenericReturnValue start_service_traits(void *cls, const void **ret, const char *trait, unsigned int index)
static void start_service_cleanup(void *cls)
static void start_service_run(void *cls, struct GNUNET_TESTING_Interpreter *is)

References GNUNET_new, GNUNET_strdup, GNUNET_TESTING_command_new, GNUNET_MESSENGER_StartServiceState::is, GNUNET_MESSENGER_StartServiceState::msg, GNUNET_MESSENGER_StartServiceState::peer_index, GNUNET_MESSENGER_StartServiceState::peer_label, GNUNET_MESSENGER_StartServiceState::rooms, GNUNET_MESSENGER_StartServiceState::stage_index, start_service_cleanup(), start_service_run(), start_service_traits(), GNUNET_MESSENGER_StartServiceState::system_label, GNUNET_MESSENGER_StartServiceState::tl_system, and GNUNET_MESSENGER_StartServiceState::topology.

Here is the call graph for this function:

◆ GNUNET_MESSENGER_cmd_stop_service()

struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_stop_service ( const char *  label,
const char *  service_label 
)

Definition at line 82 of file testing_messenger_cmd_stop_service.c.

84{
86
89
91 label,
94 NULL);
95}
static void stop_service_cleanup(void *cls)
static void stop_service_run(void *cls, struct GNUNET_TESTING_Interpreter *is)

References GNUNET_new, GNUNET_strdup, GNUNET_TESTING_command_new, GNUNET_MESSENGER_StopServiceState::service_label, stop_service_cleanup(), and stop_service_run().

Here is the call graph for this function:

◆ GNUNET_MESSENGER_cmd_join_room()

struct GNUNET_TESTING_Command GNUNET_MESSENGER_cmd_join_room ( const char *  label,
const char *  service_label,
const char *  room_key 
)

Definition at line 166 of file testing_messenger_cmd_join_room.c.

169{
171
175
176 return GNUNET_TESTING_command_new (jrs,
177 label,
180 NULL);
181}
char * room_key
static void join_room_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
static void join_room_cleanup(void *cls)

References GNUNET_new, GNUNET_strdup, GNUNET_TESTING_command_new, join_room_cleanup(), join_room_run(), room_key, GNUNET_MESSENGER_JoinRoomState::room_key, and GNUNET_MESSENGER_JoinRoomState::service_label.

Here is the call graph for this function:

◆ GNUNET_MESSENGER_get_trait_state()

enum GNUNET_GenericReturnValue GNUNET_MESSENGER_get_trait_state ( const struct GNUNET_TESTING_Command cmd,
struct GNUNET_MESSENGER_StartServiceState **  ret 
)

Definition at line 29 of file testing_messenger_traits.c.

Referenced by join_room_run(), and stop_service_run().

Here is the caller graph for this function:

◆ GNUNET_MESSENGER_make_trait_state()

struct GNUNET_TESTING_Trait GNUNET_MESSENGER_make_trait_state ( struct GNUNET_MESSENGER_StartServiceState value)

Definition at line 29 of file testing_messenger_traits.c.

Referenced by start_service_traits().

Here is the caller graph for this function: