GNUnet 0.21.1
messenger-testing.h File Reference

testing lib for messenger service More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_MESSENGER_TestStage
 
struct  GNUNET_MESSENGER_TestStageTopology
 
struct  GNUNET_MESSENGER_RoomState
 
struct  GNUNET_MESSENGER_StartServiceState
 

Enumerations

enum  GNUNET_MESSENGER_TestStageJoin { GNUNET_MESSENGER_STAGE_JOIN_NONE = 0x0 , GNUNET_MESSENGER_STAGE_JOIN_OPEN_ROOM = 0x1 , GNUNET_MESSENGER_STAGE_JOIN_ENTER_ROOM = 0x2 }
 

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 (unsigned int 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)
 

Detailed Description

testing lib for messenger service

Author
Tobias Frisch

Definition in file messenger-testing.h.

Enumeration Type Documentation

◆ GNUNET_MESSENGER_TestStageJoin

Enumerator
GNUNET_MESSENGER_STAGE_JOIN_NONE 
GNUNET_MESSENGER_STAGE_JOIN_OPEN_ROOM 
GNUNET_MESSENGER_STAGE_JOIN_ENTER_ROOM 

Definition at line 30 of file messenger-testing.h.

31{
35};
@ GNUNET_MESSENGER_STAGE_JOIN_ENTER_ROOM
@ GNUNET_MESSENGER_STAGE_JOIN_OPEN_ROOM
@ GNUNET_MESSENGER_STAGE_JOIN_NONE

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 ( )

◆ GNUNET_MESSENGER_create_stage_enter_room()

struct GNUNET_MESSENGER_TestStage GNUNET_MESSENGER_create_stage_enter_room ( unsigned int  door_id)

◆ 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 messenger-testing.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 messenger-testing.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 messenger-testing.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 messenger-testing.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: