GNUnet 0.22.2
testing_messenger.c File Reference
#include "messenger-testing.h"
#include "gnunet_util_lib.h"
Include dependency graph for testing_messenger.c:

Go to the source code of this file.

Functions

struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_skip ()
 
struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_open_room ()
 
struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_enter_room (uint32_t door_id)
 
struct GNUNET_MESSENGER_TestStageTopologyGNUNET_MESSENGER_create_topo (unsigned int peer_amount, unsigned int stage_amount, const struct GNUNET_MESSENGER_TestStage peer_stages[static peer_amount *stage_amount])
 
void GNUNET_MESSENGER_destroy_topo (struct GNUNET_MESSENGER_TestStageTopology *topology)
 
struct GNUNET_MESSENGER_RoomStateGNUNET_MESSENGER_create_room_state (struct GNUNET_MESSENGER_TestStageTopology *topology)
 
void GNUNET_MESSENGER_destroy_room_state (struct GNUNET_MESSENGER_RoomState *room_state)
 

Function Documentation

◆ GNUNET_MESSENGER_create_stage_skip()

struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_skip ( )

◆ GNUNET_MESSENGER_create_stage_open_room()

struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_open_room ( )

Definition at line 42 of file testing_messenger.c.

43{
44 struct GNUNET_MESSENGER_TestStage stage;
45 stage.door_id = 0;
47 return stage;
48}
@ GNUNET_MESSENGER_STAGE_JOIN_OPEN_ROOM

References GNUNET_MESSENGER_TestStage::door_id, GNUNET_MESSENGER_STAGE_JOIN_OPEN_ROOM, and GNUNET_MESSENGER_TestStage::join.

◆ GNUNET_MESSENGER_create_stage_enter_room()

struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_enter_room ( uint32_t  door_id)

Definition at line 52 of file testing_messenger.c.

53{
54 struct GNUNET_MESSENGER_TestStage stage;
55 stage.door_id = door_id;
57 return stage;
58}
char * door_id
@ GNUNET_MESSENGER_STAGE_JOIN_ENTER_ROOM

References GNUNET_MESSENGER_TestStage::door_id, GNUNET_MESSENGER_STAGE_JOIN_ENTER_ROOM, and GNUNET_MESSENGER_TestStage::join.

◆ GNUNET_MESSENGER_create_topo()

struct GNUNET_MESSENGER_TestStageTopology * GNUNET_MESSENGER_create_topo ( unsigned int  peer_amount,
unsigned int  stage_amount,
const struct GNUNET_MESSENGER_TestStage  peer_stages[static peer_amount *stage_amount] 
)

Definition at line 62 of file testing_messenger.c.

66{
67 GNUNET_assert ((peer_amount) && (stage_amount) && (peer_stages));
68
73
74 const unsigned int size = tp->peer_amount * tp->stage_amount;
76
77 for (unsigned int i = 0; i < size; i++)
78 tp->peer_stages[i] = peer_stages[i];
79
80 return tp;
81}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
static unsigned int size
Size of the "table".
Definition: peer.c:68
struct GNUNET_MESSENGER_TestStage * peer_stages

References GNUNET_assert, GNUNET_new, GNUNET_new_array, GNUNET_MESSENGER_TestStageTopology::peer_amount, GNUNET_MESSENGER_TestStageTopology::peer_stages, size, and GNUNET_MESSENGER_TestStageTopology::stage_amount.

◆ GNUNET_MESSENGER_destroy_topo()

void GNUNET_MESSENGER_destroy_topo ( struct GNUNET_MESSENGER_TestStageTopology topology)

Definition at line 85 of file testing_messenger.c.

87{
88 GNUNET_assert ((topology) && (topology->peer_stages));
89 GNUNET_free (topology->peer_stages);
90 GNUNET_free (topology);
91}
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_assert, GNUNET_free, and GNUNET_MESSENGER_TestStageTopology::peer_stages.

◆ GNUNET_MESSENGER_create_room_state()

struct GNUNET_MESSENGER_RoomState * GNUNET_MESSENGER_create_room_state ( struct GNUNET_MESSENGER_TestStageTopology topology)

Definition at line 95 of file testing_messenger.c.

97{
101 GNUNET_NO);
102 rs->required_doors = 0;
103 return rs;
104}
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
@ GNUNET_NO
struct GNUNET_CONTAINER_MultiPeerMap * doors

References GNUNET_MESSENGER_RoomState::doors, GNUNET_CONTAINER_multipeermap_create(), GNUNET_new, GNUNET_NO, GNUNET_MESSENGER_TestStageTopology::peer_amount, and GNUNET_MESSENGER_RoomState::required_doors.

Referenced by join_room_run().

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

◆ GNUNET_MESSENGER_destroy_room_state()

void GNUNET_MESSENGER_destroy_room_state ( struct GNUNET_MESSENGER_RoomState room_state)

Definition at line 108 of file testing_messenger.c.

110{
111 GNUNET_assert ((room_state) && (room_state->doors));
113 GNUNET_free (room_state);
114}
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.

References GNUNET_MESSENGER_RoomState::doors, GNUNET_assert, GNUNET_CONTAINER_multipeermap_destroy(), and GNUNET_free.

Referenced by cleanup_rooms_cb().

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