GNUnet  0.11.x
Functions
gnunet-service-messenger_service.c File Reference

GNUnet MESSENGER service. More...

#include "gnunet-service-messenger_service.h"
#include "gnunet-service-messenger_message_kind.h"
#include "gnunet-service-messenger.h"
Include dependency graph for gnunet-service-messenger_service.c:

Go to the source code of this file.

Functions

static void callback_shutdown_service (void *cls)
 
struct GNUNET_MESSENGER_Servicecreate_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle)
 Creates and allocates a new service using a given config and a GNUnet service handle. More...
 
static int iterate_destroy_rooms (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void destroy_service (struct GNUNET_MESSENGER_Service *service)
 Destroys a service and frees its memory fully. More...
 
struct GNUNET_MESSENGER_EgoStoreget_service_ego_store (struct GNUNET_MESSENGER_Service *service)
 Returns the used EGO-store of a given service. More...
 
struct GNUNET_MESSENGER_ContactStoreget_service_contact_store (struct GNUNET_MESSENGER_Service *service)
 Returns the used contact store of a given service. More...
 
struct GNUNET_MESSENGER_SrvHandleadd_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq)
 Creates and adds a new handle to a service using a given message queue. More...
 
void remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle)
 Removes a handle from a service and destroys it. More...
 
int get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer)
 Tries to write the peer identity of the peer running a service on to the peer parameter. More...
 
struct GNUNET_MESSENGER_SrvRoomget_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key)
 Returns the room identified by a given key for a service. More...
 
int open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
 Tries to open a room using a given key for a service by a specific handle. More...
 
int entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
 Tries to enter a room using a given key for a service by a specific handle. More...
 
int close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
 Tries to close a room using a given key for a service by a specific handle. More...
 
void handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Sends a received or sent message with a given hash to each handle of a service which is currently member of a specific room for handling it in the client API. More...
 

Detailed Description

GNUnet MESSENGER service.

Author
Tobias Frisch

Definition in file gnunet-service-messenger_service.c.

Function Documentation

◆ callback_shutdown_service()

static void callback_shutdown_service ( void *  cls)
static

Definition at line 31 of file gnunet-service-messenger_service.c.

32 {
33  struct GNUNET_MESSENGER_Service *service = cls;
34 
35  if (service)
36  {
37  service->shutdown = NULL;
38 
40  }
41 }
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
void destroy_service(struct GNUNET_MESSENGER_Service *service)
Destroys a service and frees its memory fully.

References destroy_service(), and service.

Referenced by create_service().

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

◆ create_service()

struct GNUNET_MESSENGER_Service* create_service ( const struct GNUNET_CONFIGURATION_Handle config,
struct GNUNET_SERVICE_Handle service_handle 
)

Creates and allocates a new service using a given config and a GNUnet service handle.

Parameters
[in]configConfiguration
[in/out]service_handle GNUnet service handle
Returns
New service

Definition at line 44 of file gnunet-service-messenger_service.c.

46 {
47  GNUNET_assert((config) && (service_handle));
48 
50 
51  service->config = config;
52  service->service = service_handle;
53 
55 
56  service->dir = NULL;
57 
60  "MESSENGER_DIR", &(service->dir)))
61  {
62  if (service->dir)
63  GNUNET_free(service->dir);
64 
65  service->dir = NULL;
66  }
67  else
68  {
71  {
72  GNUNET_free(service->dir);
73 
74  service->dir = NULL;
75  }
76  }
77 
78  service->cadet = GNUNET_CADET_connect (service->config);
79 
81 
82  init_list_handles (&(service->handles));
83 
85 
87 
88  return service;
89 }
void init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config)
Initializes an EGO-store as fully empty.
void init_list_handles(struct GNUNET_MESSENGER_ListHandles *handles)
Initializes list of handles as empty list.
struct GNUNET_MESSENGER_EgoStore * get_service_ego_store(struct GNUNET_MESSENGER_Service *service)
Returns the used EGO-store of a given service.
static void callback_shutdown_service(void *cls)
struct GNUNET_MESSENGER_ContactStore * get_service_contact_store(struct GNUNET_MESSENGER_Service *service)
Returns the used contact store of a given service.
static const struct GNUNET_CONFIGURATION_Handle * config
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_YES
Definition: gnunet_common.h:97
@ GNUNET_NO
Definition: gnunet_common.h:94
struct GNUNET_CADET_Handle * GNUNET_CADET_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the MQ-based cadet service.
Definition: cadet_api.c:910
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_test(const char *fil, int is_readable)
Test if fil is a directory and listable.
Definition: disk.c:404
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create(const char *dir)
Implementation of "mkdir -p".
Definition: disk.c:496
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#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_free(ptr)
Wrapper around free.
#define GNUNET_MESSENGER_SERVICE_NAME
Identifier of GNUnet MESSENGER Service.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1331
void init_contact_store(struct GNUNET_MESSENGER_ContactStore *store)
Initializes a contact store as fully empty.

References callback_shutdown_service(), config, get_service_contact_store(), get_service_ego_store(), GNUNET_assert, GNUNET_CADET_connect(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_DISK_directory_create(), GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_MESSENGER_SERVICE_NAME, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_YES, init_contact_store(), init_ego_store(), init_list_handles(), and service.

Referenced by run().

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

◆ iterate_destroy_rooms()

static int iterate_destroy_rooms ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 92 of file gnunet-service-messenger_service.c.

95 {
96  struct GNUNET_MESSENGER_SrvRoom *room = value;
97  destroy_room (room);
98  return GNUNET_YES;
99 }
static char * value
Value of the record to add/remove.
void destroy_room(struct GNUNET_MESSENGER_SrvRoom *room)
Destroys a room and frees its memory fully.

References destroy_room(), GNUNET_YES, and value.

Referenced by destroy_service().

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

◆ destroy_service()

void destroy_service ( struct GNUNET_MESSENGER_Service service)

Destroys a service and frees its memory fully.

Parameters
[in/out]service Service

Definition at line 102 of file gnunet-service-messenger_service.c.

103 {
105 
106  if (service->shutdown)
107  {
108  GNUNET_SCHEDULER_cancel (service->shutdown);
109 
110  service->shutdown = NULL;
111  }
112 
114  clear_list_handles (&(service->handles));
115 
118 
120 
121  if (service->cadet)
122  {
124 
125  service->cadet = NULL;
126  }
127 
128  if (service->dir)
129  {
130  GNUNET_free(service->dir);
131 
132  service->dir = NULL;
133  }
134 
135  GNUNET_SERVICE_shutdown (service->service);
136 
138 }
void clear_ego_store(struct GNUNET_MESSENGER_EgoStore *store)
Clears an EGO-store, wipes its content and deallocates its memory.
void clear_list_handles(struct GNUNET_MESSENGER_ListHandles *handles)
Destroys remaining handles and clears the list.
static int iterate_destroy_rooms(void *cls, const struct GNUNET_HashCode *key, void *value)
void GNUNET_CADET_disconnect(struct GNUNET_CADET_Handle *handle)
Disconnect from the cadet service.
Definition: cadet_api.c:775
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972
void GNUNET_SERVICE_shutdown(struct GNUNET_SERVICE_Handle *sh)
Explicitly stops the service.
Definition: service.c:2384
void clear_contact_store(struct GNUNET_MESSENGER_ContactStore *store)
Clears a contact store, wipes its content and deallocates its memory.

References clear_contact_store(), clear_ego_store(), clear_list_handles(), get_service_contact_store(), get_service_ego_store(), GNUNET_assert, GNUNET_CADET_disconnect(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_SERVICE_shutdown(), iterate_destroy_rooms(), and service.

Referenced by callback_shutdown_service().

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

◆ get_service_ego_store()

struct GNUNET_MESSENGER_EgoStore* get_service_ego_store ( struct GNUNET_MESSENGER_Service service)

Returns the used EGO-store of a given service.

Parameters
[in/out]service Service
Returns
EGO-store

Definition at line 141 of file gnunet-service-messenger_service.c.

142 {
144 
145  return &(service->ego_store);
146 }

References GNUNET_assert, and service.

Referenced by callback_set_handle_name(), callback_update_handle(), create_service(), destroy_service(), set_handle_name(), setup_handle_name(), and update_handle().

Here is the caller graph for this function:

◆ get_service_contact_store()

struct GNUNET_MESSENGER_ContactStore* get_service_contact_store ( struct GNUNET_MESSENGER_Service service)

Returns the used contact store of a given service.

Parameters
[in/out]service Service
Returns
Contact store

Definition at line 149 of file gnunet-service-messenger_service.c.

150 {
152 
153  return &(service->contact_store);
154 }

References GNUNET_assert, and service.

Referenced by create_service(), destroy_service(), and get_member_contact_store().

Here is the caller graph for this function:

◆ add_service_handle()

struct GNUNET_MESSENGER_SrvHandle* add_service_handle ( struct GNUNET_MESSENGER_Service service,
struct GNUNET_MQ_Handle mq 
)

Creates and adds a new handle to a service using a given message queue.

Parameters
[in/out]service Service
[in/out]mq Message queue
Returns
New handle

Definition at line 157 of file gnunet-service-messenger_service.c.

159 {
160  GNUNET_assert((service) && (mq));
161 
163 
164  if (handle)
165  {
166  add_list_handle (&(service->handles), handle);
167  }
168 
169  return handle;
170 }
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_MESSENGER_SrvHandle * create_handle(struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq)
Creates and allocates a new handle related to a service and using a given mq (message queue).
void add_list_handle(struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle)
Adds a specific handle to the end of the list.

References add_list_handle(), create_handle(), GNUNET_assert, handle, mq, and service.

Referenced by callback_client_connect().

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

◆ remove_service_handle()

void remove_service_handle ( struct GNUNET_MESSENGER_Service service,
struct GNUNET_MESSENGER_SrvHandle handle 
)

Removes a handle from a service and destroys it.

Parameters
[in/out]service Service
[in/out]handle Handle

Definition at line 173 of file gnunet-service-messenger_service.c.

175 {
176  GNUNET_assert((service) && (handle));
177 
178  if (!handle)
179  return;
180 
181  if (GNUNET_YES == remove_list_handle (&(service->handles), handle))
183 }
void destroy_handle(struct GNUNET_MESSENGER_SrvHandle *handle)
Destroys a handle and frees its memory fully.
int remove_list_handle(struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle)
Removes the first entry matching with a specific handle from the list of handles and returns GNUNET_Y...

References destroy_handle(), GNUNET_assert, GNUNET_YES, handle, remove_list_handle(), and service.

Referenced by callback_client_disconnect().

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

◆ get_service_peer_identity()

int get_service_peer_identity ( const struct GNUNET_MESSENGER_Service service,
struct GNUNET_PeerIdentity peer 
)

Tries to write the peer identity of the peer running a service on to the peer parameter.

The functions returns GNUNET_OK on success, otherwise GNUNET_SYSERR.

Parameters
[in]serviceService
[out]peerPeer identity
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 186 of file gnunet-service-messenger_service.c.

188 {
189  GNUNET_assert((service) && (peer));
190 
191  return GNUNET_CRYPTO_get_peer_identity (service->config, peer);
192 }
int GNUNET_CRYPTO_get_peer_identity(const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_PeerIdentity *dst)
Retrieve the identity of the host's peer.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References GNUNET_assert, GNUNET_CRYPTO_get_peer_identity(), peer, and service.

Referenced by create_message_peer(), enter_room_at(), and rebuild_room_basement_structure().

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

◆ get_service_room()

struct GNUNET_MESSENGER_SrvRoom* get_service_room ( const struct GNUNET_MESSENGER_Service service,
const struct GNUNET_HashCode key 
)

Returns the room identified by a given key for a service.

If the service doesn't know any room using the given key, NULL gets returned.

Parameters
[in]serviceService
[in]keyKey of room
Returns
Room or NULL

Definition at line 195 of file gnunet-service-messenger_service.c.

197 {
198  GNUNET_assert((service) && (key));
199 
201 }
struct GNUNET_HashCode key
The key used in the DHT.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.

References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), key, and service.

Referenced by close_service_room(), entry_service_room(), get_handle_member_session(), handle_get_message(), open_service_room(), and send_handle_message().

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

◆ open_service_room()

int open_service_room ( struct GNUNET_MESSENGER_Service service,
struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key 
)

Tries to open a room using a given key for a service by a specific handle.

The room will be created if necessary. If the function is successful, it returns GNUNET_YES, otherwise GNUNET_NO.

Parameters
[in/out]service Service
[in/out]handle Handle
[in]keyKey of room
Returns
GNUNET_YES on success, otherwise GNUNET_NO

Definition at line 204 of file gnunet-service-messenger_service.c.

207 {
208  GNUNET_assert((service) && (handle) && (key));
209 
211 
212  if (room)
213  return open_room (room, handle);
214 
215  room = create_room (handle, key);
216 
217  if ((GNUNET_YES == open_room (room, handle)) &&
219  key, room,
221  return GNUNET_YES;
222 
223  destroy_room (room);
224  return GNUNET_NO;
225 }
int open_room(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle)
Tries to open a room for a given handle.
struct GNUNET_MESSENGER_SrvRoom * create_room(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
Creates and allocates a new room for a handle with a given key.
struct GNUNET_MESSENGER_SrvRoom * get_service_room(const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key)
Returns the room identified by a given key for a service.
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...

References create_room(), destroy_room(), get_service_room(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_NO, GNUNET_OK, GNUNET_YES, handle, key, open_room(), and service.

Referenced by open_handle_room().

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

◆ entry_service_room()

int entry_service_room ( struct GNUNET_MESSENGER_Service service,
struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_PeerIdentity door,
const struct GNUNET_HashCode key 
)

Tries to enter a room using a given key for a service by a specific handle.

The room will be created if necessary. If the function is successful, it returns GNUNET_YES, otherwise GNUNET_NO.

The room will be entered through the peer identitied by the peer identity provided as door parameter and a new connection will be made.

Parameters
[in/out]service Service
[in/out]handle Handle
[in]doorPeer identity
[in]keyKey of room
Returns
GNUNET_YES on success, otherwise GNUNET_NO

Definition at line 228 of file gnunet-service-messenger_service.c.

232 {
233  GNUNET_assert((service) && (handle) && (door) && (key));
234 
236 
237  if (room)
238  {
239  if (GNUNET_YES == enter_room_at (room, handle, door))
240  return GNUNET_YES;
241  else
242  return GNUNET_NO;
243  }
244 
245  room = create_room (handle, key);
246 
247  if ((GNUNET_YES == enter_room_at (room, handle, door)) &&
249  key, room,
251  {
252  return GNUNET_YES;
253  }
254  else
255  {
256  destroy_room (room);
257  return GNUNET_NO;
258  }
259 
260 }
int enter_room_at(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door)
Connects a tunnel to a hosting peer of a room through a so called door which is represented by a peer...

References create_room(), destroy_room(), enter_room_at(), get_service_room(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_NO, GNUNET_OK, GNUNET_YES, handle, key, and service.

Referenced by entry_handle_room().

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

◆ close_service_room()

int close_service_room ( struct GNUNET_MESSENGER_Service service,
struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key 
)

Tries to close a room using a given key for a service by a specific handle.

The room will be created if necessary. If the function is successful, it returns GNUNET_YES, otherwise GNUNET_NO.

If the specific handle is currently the host of the room for this service, a new handle which is a member will take its place. Otherwise the room will be destroyed for this service.

Parameters
[in/out]service Service
[in/out]handle Handle
[in]keyKey of room
Returns
GNUNET_YES on success, otherwise GNUNET_NO

Definition at line 263 of file gnunet-service-messenger_service.c.

266 {
267  GNUNET_assert((service) && (handle) && (key));
268 
270 
271  if (!room)
272  return GNUNET_NO;
273 
275 
276  const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, key);
277 
278  GNUNET_assert(id);
279 
280  if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (handle->member_ids, key, id))
281  return GNUNET_NO;
282 
284  &(service->handles), key);
285 
286  if (!member_handle)
287  {
289  {
290  destroy_room (room);
291  return GNUNET_YES;
292  }
293  else
294  return GNUNET_NO;
295  }
296 
297  if (room->host == handle)
298  room->host = member_handle;
299 
300  return GNUNET_YES;
301 }
const struct GNUNET_ShortHashCode * get_handle_member_id(const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
Returns the member id of a given handle in a specific room.
struct GNUNET_MESSENGER_SrvHandle * find_list_handle_by_member(const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key)
Searches linearly through the list of handles for members of a specific room which is identified by a...
struct GNUNET_MESSENGER_Message * create_message_leave()
Creates and allocates a new leave message.
int send_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message)
Sends a message from a given handle into a room.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
struct GNUNET_MESSENGER_SrvHandle * host
A 256-bit hashcode.

References create_message_leave(), destroy_room(), find_list_handle_by_member(), get_handle_member_id(), get_service_room(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_NO, GNUNET_OK, GNUNET_YES, handle, GNUNET_MESSENGER_SrvRoom::host, key, send_room_message(), and service.

Referenced by close_handle_room().

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

◆ handle_service_message()

void handle_service_message ( struct GNUNET_MESSENGER_Service service,
struct GNUNET_MESSENGER_SrvRoom room,
const struct GNUNET_MESSENGER_MemberSession session,
const struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Sends a received or sent message with a given hash to each handle of a service which is currently member of a specific room for handling it in the client API.

Parameters
[in/out]service Service
[in/out]room Room
[in]sessionMember session
[in]messageMessage
[in]hashHash of message

Definition at line 304 of file gnunet-service-messenger_service.c.

309 {
310  GNUNET_assert((service) && (room) && (session) && (message) && (hash));
311 
312  struct GNUNET_MESSENGER_ListHandle *element = service->handles.head;
313 
314  while (element)
315  {
316  notify_handle_message (element->handle, get_room_key(room), session, message, hash);
317  element = element->next;
318  }
319 }
void notify_handle_message(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Notifies the handle that a new message was received or sent.
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the shared secret you need to access a room.
struct GNUNET_MESSENGER_ListHandle * next
struct GNUNET_MESSENGER_SrvHandle * handle

References get_room_key(), GNUNET_assert, GNUNET_MESSENGER_ListHandle::handle, GNUNET_MESSENGER_ListHandle::next, notify_handle_message(), and service.

Referenced by handle_room_messages().

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