GNUnet  0.11.x
Data Structures | Functions
gnunet-service-messenger_handle.c File Reference

GNUnet MESSENGER service. More...

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

Go to the source code of this file.

Data Structures

struct  GNUNET_MESSENGER_MessageHandle
 

Functions

struct GNUNET_MESSENGER_SrvHandlecreate_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). More...
 
int iterate_free_member_ids (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle)
 Destroys a handle and frees its memory fully. More...
 
void get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir)
 Writes the path of the directory for a given handle using a specific name to the parameter dir. More...
 
static int create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
 
const struct GNUNET_ShortHashCodeget_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. More...
 
int change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *unique_id)
 Changes the member id of a given handle in a specific room to match a unique_id and returns GNUNET_OK on success. More...
 
static void change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
 
static void change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
 
static int iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
 Sets the EGO used by a given handle. More...
 
const struct GNUNET_MESSENGER_Egoget_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle)
 Returns the EGO used by a given handle. More...
 
static void callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
 
void setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
 Tries to set the name and EGO key of a handle initially by looking up a specific name. More...
 
static void callback_update_handle (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
 
void update_handle (struct GNUNET_MESSENGER_SrvHandle *handle)
 Tries to change the key pair of an EGO of a handle under the same name and informs all rooms about the change automatically. More...
 
static void callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
 
void set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
 Tries to rename the handle which implies renaming the EGO its using and moving all related data into the directory fitting to the changed name. More...
 
int open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
 Makes a given handle a member of the room using a specific key and opens the room from the handles service. More...
 
int entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
 Makes a given handle a member of the room using a specific key and enters the room through a tunnel to a peer identified by a given door (peer identity). More...
 
int close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
 Removes the membership of the room using a specific key and closes it if no other handle from this service is still a member of it. More...
 
int send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_Message *message)
 Sends a message from a given handle to the room using a specific key. More...
 
static const struct GNUNET_HashCodeget_next_member_session_contect (const struct GNUNET_MESSENGER_MemberSession *session)
 
static const struct GNUNET_MESSENGER_MemberSessionget_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
 
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. More...
 
static int callback_scan_for_rooms (void *cls, const char *filename)
 
void load_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle)
 Loads member ids and other potential configuration from a given handle which depends on the given name the handle uses. More...
 
static int iterate_save_rooms (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void save_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle)
 Saves member ids and other potential configuration from a given handle which depends on the given name the handle uses. More...
 

Detailed Description

GNUnet MESSENGER service.

Author
Tobias Frisch

Definition in file gnunet-service-messenger_handle.c.

Function Documentation

◆ create_handle()

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

Parameters

Definition at line 34 of file gnunet-service-messenger_handle.c.

References GNUNET_MESSENGER_SrvHandle::ego, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_new, GNUNET_NO, handle, GNUNET_MESSENGER_SrvHandle::member_ids, mq, GNUNET_MESSENGER_SrvHandle::mq, GNUNET_MESSENGER_SrvHandle::name, GNUNET_MESSENGER_SrvHandle::service, and service.

Referenced by add_service_handle(), and GNUNET_MESSENGER_connect().

35 {
36  GNUNET_assert((service) && (mq));
37 
39 
40  handle->service = service;
41  handle->mq = mq;
42 
43  handle->name = NULL;
44  handle->ego = NULL;
45 
47 
48  return handle;
49 }
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
struct GNUNET_MESSENGER_Service * service
#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.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
const struct GNUNET_MESSENGER_Ego * ego
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_CONTAINER_MultiHashMap * member_ids
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iterate_free_member_ids()

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

Definition at line 52 of file gnunet-service-messenger_handle.c.

References GNUNET_free, and GNUNET_YES.

Referenced by destroy_handle().

53 {
55 
56  return GNUNET_YES;
57 }
static char * value
Value of the record to add/remove.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ destroy_handle()

void destroy_handle ( struct GNUNET_MESSENGER_SrvHandle handle)

Destroys a handle and frees its memory fully.

Parameters

Definition at line 60 of file gnunet-service-messenger_handle.c.

References GNUNET_MESSENGER_Service::dir, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, iterate_free_member_ids(), GNUNET_MESSENGER_SrvHandle::member_ids, GNUNET_MESSENGER_SrvHandle::name, save_handle_configuration(), and GNUNET_MESSENGER_SrvHandle::service.

Referenced by clear_list_handles(), GNUNET_MESSENGER_connect(), GNUNET_MESSENGER_disconnect(), and remove_service_handle().

61 {
62  GNUNET_assert(handle);
63 
64  if (handle->service->dir)
66 
67  if (handle->name)
68  GNUNET_free(handle->name);
69 
72 
73  GNUNET_free(handle);
74 }
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void save_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle)
Saves member ids and other potential configuration from a given handle which depends on the given nam...
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
int iterate_free_member_ids(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_CONTAINER_MultiHashMap * member_ids
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_handle_data_subdir()

void get_handle_data_subdir ( const struct GNUNET_MESSENGER_SrvHandle handle,
const char *  name,
char **  dir 
)

Writes the path of the directory for a given handle using a specific name to the parameter dir.

This directory will be used to store data regarding the handle and its messages.

Parameters
[in]handleHandle
[in]namePotential name of the handle
[out]dirPath to store data

Definition at line 77 of file gnunet-service-messenger_handle.c.

References GNUNET_MESSENGER_Service::dir, DIR_SEPARATOR, GNUNET_asprintf(), GNUNET_assert, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by callback_set_handle_name(), iterate_save_rooms(), load_handle_configuration(), and save_handle_configuration().

78 {
79  GNUNET_assert((handle) && (dir));
80 
81  if (name)
82  GNUNET_asprintf (dir, "%s%s%c%s%c", handle->service->dir, "identities",
84  else
85  GNUNET_asprintf (dir, "%s%s%c", handle->service->dir, "anonymous",
87 }
static char * dir
Set to the directory where runtime files are stored.
Definition: gnunet-arm.c:89
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define DIR_SEPARATOR
Definition: platform.h:164
const char * name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_handle_member_id()

static int create_handle_member_id ( const struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key 
)
static

Definition at line 90 of file gnunet-service-messenger_handle.c.

References generate_free_member_id(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_sh2s(), GNUNET_YES, and GNUNET_MESSENGER_SrvHandle::member_ids.

Referenced by entry_handle_room(), and open_handle_room().

91 {
92  GNUNET_assert((handle) && (key));
93 
94  struct GNUNET_ShortHashCode *random_id = GNUNET_new(struct GNUNET_ShortHashCode);
95 
96  if (!random_id)
97  return GNUNET_NO;
98 
99  generate_free_member_id (random_id, NULL);
100 
101  if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (handle->member_ids, key, random_id,
103  {
104  GNUNET_free(random_id);
105  return GNUNET_NO;
106  }
107 
108  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Created a new member id (%s) for room: %s\n", GNUNET_sh2s (random_id),
109  GNUNET_h2s (key));
110 
111  return GNUNET_YES;
112 }
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A 256-bit hashcode.
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
int generate_free_member_id(struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members)
Tries to generate an unused member id and store it into the id parameter.
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.
#define GNUNET_log(kind,...)
struct GNUNET_CONTAINER_MultiHashMap * member_ids
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_handle_member_id()

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.

If the handle is not a member of the specific room, NULL gets returned.

Parameters
[in]handleHandle
[in]keyKey of a room
Returns
Member id or NULL

Definition at line 115 of file gnunet-service-messenger_handle.c.

References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), and GNUNET_MESSENGER_SrvHandle::member_ids.

Referenced by close_handle_room(), close_service_room(), entry_handle_room(), find_list_handle_by_member(), get_handle_member_session(), handle_get_message(), handle_room_close(), handle_room_entry(), handle_room_open(), join_room_locally(), notify_handle_message(), open_handle_room(), open_room(), pack_room_message(), send_handle_message(), send_room_message(), and solve_room_member_collisions().

116 {
117  GNUNET_assert((handle) && (key));
118 
119  return GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key);
120 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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.
struct GNUNET_CONTAINER_MultiHashMap * member_ids
Here is the call graph for this function:
Here is the caller graph for this function:

◆ change_handle_member_id()

int change_handle_member_id ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key,
const struct GNUNET_ShortHashCode unique_id 
)

Changes the member id of a given handle in a specific room to match a unique_id and returns GNUNET_OK on success.

The client connected to the handle will be informed afterwards automatically.

Parameters

Definition at line 123 of file gnunet-service-messenger_handle.c.

References env, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_memcmp, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_sh2s(), GNUNET_SYSERR, GNUNET_MESSENGER_MemberMessage::id, GNUNET_MESSENGER_MemberMessage::key, GNUNET_MESSENGER_SrvHandle::member_ids, GNUNET_MESSENGER_SrvHandle::mq, and msg.

Referenced by callback_scan_for_rooms(), join_room(), and send_message_id().

125 {
126  GNUNET_assert((handle) && (key) && (unique_id));
127 
128  struct GNUNET_ShortHashCode *member_id = GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key);
129 
130  if (!member_id)
131  {
132  member_id = GNUNET_new(struct GNUNET_ShortHashCode);
133  GNUNET_memcpy(member_id, unique_id, sizeof(*member_id));
134 
135  if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (handle->member_ids, key, member_id,
137  {
138  GNUNET_free(member_id);
139  return GNUNET_SYSERR;
140  }
141  }
142 
143  if (0 == GNUNET_memcmp(unique_id, member_id))
144  goto send_message_to_client;
145 
146  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Change a member id (%s) for room (%s).\n", GNUNET_sh2s (member_id),
147  GNUNET_h2s (key));
148 
149  GNUNET_memcpy(member_id, unique_id, sizeof(*unique_id));
150 
151  GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member id changed to (%s).\n", GNUNET_sh2s (unique_id));
152 
154  struct GNUNET_MQ_Envelope *env;
155 
156 send_message_to_client:
157 
159 
160  GNUNET_memcpy(&(msg->key), key, sizeof(*key));
161  GNUNET_memcpy(&(msg->id), member_id, sizeof(*member_id));
162 
163  GNUNET_MQ_send (handle->mq, env);
164  return GNUNET_OK;
165 }
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
Message to receive the current member id of a handle in room.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A 256-bit hashcode.
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.
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
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.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
struct GNUNET_ShortHashCode id
#define GNUNET_log(kind,...)
struct GNUNET_CONTAINER_MultiHashMap * member_ids
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ change_handle_name()

static void change_handle_name ( struct GNUNET_MESSENGER_SrvHandle handle,
const char *  name 
)
static

Definition at line 168 of file gnunet-service-messenger_handle.c.

References env, GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_NAME, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_strdup, GNUNET_MESSENGER_SrvHandle::mq, msg, and GNUNET_MESSENGER_SrvHandle::name.

Referenced by callback_set_handle_name(), callback_setup_handle_name(), and set_handle_name().

169 {
170  GNUNET_assert(handle);
171 
172  if (handle->name)
173  GNUNET_free(handle->name);
174 
175  handle->name = name ? GNUNET_strdup(name) : NULL;
176 
177  const uint16_t name_len = handle->name ? strlen (handle->name) : 0;
178 
180  struct GNUNET_MQ_Envelope *env;
181 
183 
184  char *extra = ((char*) msg) + sizeof(*msg);
185 
186  if (name_len)
187  GNUNET_memcpy(extra, handle->name, name_len);
188 
189  extra[name_len] = '\0';
190 
191  GNUNET_MQ_send (handle->mq, env);
192 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_NAME
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
const char * name
Message to receive the current name of a handle.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ change_handle_ego()

static void change_handle_ego ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_MESSENGER_Ego ego 
)
static

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

References GNUNET_MESSENGER_SrvHandle::ego, env, get_handle_ego(), GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_IDENTITY_key_get_length(), GNUNET_IDENTITY_write_key_to_buffer(), GNUNET_log, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_MESSENGER_SrvHandle::mq, msg, and GNUNET_MESSENGER_Ego::pub.

Referenced by callback_setup_handle_name(), callback_update_handle(), and set_handle_ego().

196 {
197  GNUNET_assert(handle);
198 
199  handle->ego = ego;
200 
201  ego = get_handle_ego (handle);
202 
203  const uint16_t length = GNUNET_IDENTITY_key_get_length(&(ego->pub));
204 
206  struct GNUNET_MQ_Envelope *env;
207 
209 
210  char *extra = ((char*) msg) + sizeof(*msg);
211 
212  if (GNUNET_IDENTITY_write_key_to_buffer(&(ego->pub), extra, length) < 0)
213  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Could not write key to buffer.\n");
214 
215  GNUNET_MQ_send (handle->mq, env);
216 }
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
ssize_t GNUNET_IDENTITY_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
Definition: identity_api.c:976
ssize_t GNUNET_IDENTITY_write_key_to_buffer(const struct GNUNET_IDENTITY_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PublicKey to a compact buffer.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
struct GNUNET_IDENTITY_PublicKey pub
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
const struct GNUNET_MESSENGER_Ego * ego
Message to receive the current public key of a handle.
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
const struct GNUNET_MESSENGER_Ego * get_handle_ego(const struct GNUNET_MESSENGER_SrvHandle *handle)
Returns the EGO used by a given handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iterate_send_message()

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

Definition at line 225 of file gnunet-service-messenger_handle.c.

References GNUNET_YES, GNUNET_MESSENGER_MessageHandle::handle, GNUNET_MESSENGER_MessageHandle::message, and send_handle_message().

Referenced by callback_set_handle_name(), and set_handle_ego().

226 {
227  struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls;
228 
229  send_handle_message (msg_handle->handle, key, msg_handle->message);
230 
231  return GNUNET_YES;
232 }
struct GNUNET_MESSENGER_SrvHandle * handle
struct GNUNET_MESSENGER_Message * message
int send_handle_message(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_Message *message)
Sends a message from a given handle to the room using a specific key.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_handle_ego()

void set_handle_ego ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_MESSENGER_Ego ego 
)

Sets the EGO used by a given handle.

Parameters

Definition at line 235 of file gnunet-service-messenger_handle.c.

References change_handle_ego(), create_message_key(), destroy_message(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_MESSENGER_MessageHandle::handle, iterate_send_message(), GNUNET_MESSENGER_SrvHandle::member_ids, GNUNET_MESSENGER_MessageHandle::message, and GNUNET_MESSENGER_Ego::priv.

Referenced by callback_ego_create().

236 {
237  GNUNET_assert((handle) && (ego));
238 
239  struct GNUNET_MESSENGER_MessageHandle msg_handle;
240 
241  msg_handle.handle = handle;
242  msg_handle.message = create_message_key (&(ego->priv));
243 
245 
246  destroy_message (msg_handle.message);
247 
248  change_handle_ego (handle, ego);
249 }
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MESSENGER_SrvHandle * handle
static void change_handle_ego(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static int iterate_send_message(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_CONTAINER_MultiHashMap * member_ids
struct GNUNET_IDENTITY_PrivateKey priv
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_MESSENGER_Message * create_message_key(const struct GNUNET_IDENTITY_PrivateKey *key)
Creates and allocates a new key message containing the public key to change to derived from its priva...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_handle_ego()

const struct GNUNET_MESSENGER_Ego* get_handle_ego ( const struct GNUNET_MESSENGER_SrvHandle handle)

Returns the EGO used by a given handle.

Parameters
[in]handleHandle
Returns
EGO key pair

Definition at line 252 of file gnunet-service-messenger_handle.c.

References GNUNET_MESSENGER_SrvHandle::ego, GNUNET_assert, GNUNET_IDENTITY_ego_get_anonymous(), GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_memcpy, GNUNET_MESSENGER_Ego::priv, and GNUNET_MESSENGER_Ego::pub.

Referenced by change_handle_ego(), get_handle_member_session(), handle_get_message(), join_room(), join_room_locally(), notify_handle_message(), pack_room_message(), recv_message_info(), send_room_info(), and solve_room_member_collisions().

253 {
254  GNUNET_assert(handle);
255 
256  static struct GNUNET_MESSENGER_Ego anonymous;
257  static int read_keys = 0;
258 
259  if (handle->ego)
260  return handle->ego;
261 
262  if (!read_keys)
263  {
265  GNUNET_memcpy(&(anonymous.priv), GNUNET_IDENTITY_ego_get_private_key (ego), sizeof(anonymous.priv));
266  GNUNET_IDENTITY_ego_get_public_key (ego, &(anonymous.pub));
267  read_keys = 1;
268  }
269 
270  return &anonymous;
271 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_IDENTITY_PublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:652
Handle for an ego.
Definition: identity.h:36
struct GNUNET_IDENTITY_Ego * GNUNET_IDENTITY_ego_get_anonymous()
Obtain the ego representing &#39;anonymous&#39; users.
Definition: identity_api.c:156
const struct GNUNET_MESSENGER_Ego * ego
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:639
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_setup_handle_name()

static void callback_setup_handle_name ( void *  cls,
const char *  name,
const struct GNUNET_MESSENGER_Ego ego 
)
static

Definition at line 274 of file gnunet-service-messenger_handle.c.

References change_handle_ego(), change_handle_name(), GNUNET_MESSENGER_Service::dir, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSENGER_MessageHandle::handle, load_handle_configuration(), and GNUNET_MESSENGER_SrvHandle::service.

Referenced by setup_handle_name().

275 {
276  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
277 
278  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Setting up handle...\n");
279 
280  change_handle_name (handle, name);
281  change_handle_ego (handle, ego);
282 
283  if (handle->service->dir)
284  load_handle_configuration (handle);
285 }
struct GNUNET_MESSENGER_Service * service
static void change_handle_ego(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
const char * name
#define GNUNET_log(kind,...)
void load_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle)
Loads member ids and other potential configuration from a given handle which depends on the given nam...
static void change_handle_name(struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_handle_name()

void setup_handle_name ( struct GNUNET_MESSENGER_SrvHandle handle,
const char *  name 
)

Tries to set the name and EGO key of a handle initially by looking up a specific name.

Parameters

Definition at line 288 of file gnunet-service-messenger_handle.c.

References callback_setup_handle_name(), get_service_ego_store(), GNUNET_assert, lookup_store_ego(), and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_create().

289 {
290  GNUNET_assert(handle);
291 
293 
295 }
void lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls)
Lookups an EGO which was registered to a store under a specific identifier.
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void callback_setup_handle_name(void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
struct GNUNET_MESSENGER_EgoStore * get_service_ego_store(struct GNUNET_MESSENGER_Service *service)
Returns the used EGO-store of a given service.
const char * name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_update_handle()

static void callback_update_handle ( void *  cls,
const char *  name,
const struct GNUNET_MESSENGER_Ego ego 
)
static

Definition at line 298 of file gnunet-service-messenger_handle.c.

References change_handle_ego(), create_store_ego(), get_service_ego_store(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSENGER_MessageHandle::handle, GNUNET_MESSENGER_SrvHandle::name, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by update_handle().

299 {
300  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
301 
302  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Updating handle...\n");
303 
305 
306  if (!ego)
307  create_store_ego(store, handle->name, handle);
308  else
309  change_handle_ego (handle, ego);
310 }
struct GNUNET_MESSENGER_Service * service
void create_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, void *handle)
Creates a new EGO which will be registered to a store under a specific identifier.
static void change_handle_ego(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
struct GNUNET_MESSENGER_EgoStore * get_service_ego_store(struct GNUNET_MESSENGER_Service *service)
Returns the used EGO-store of a given service.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_handle()

void update_handle ( struct GNUNET_MESSENGER_SrvHandle handle)

Tries to change the key pair of an EGO of a handle under the same name and informs all rooms about the change automatically.

Parameters

Definition at line 313 of file gnunet-service-messenger_handle.c.

References callback_update_handle(), get_service_ego_store(), GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, lookup_store_ego(), GNUNET_MESSENGER_SrvHandle::name, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_update().

314 {
315  GNUNET_assert(handle);
316 
317  if (!handle->name)
318  {
319  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating handle failed: Name is required!\n");
320  return;
321  }
322 
324 
325  lookup_store_ego (store, handle->name, callback_update_handle, handle);
326 }
static void callback_update_handle(void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
void lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls)
Lookups an EGO which was registered to a store under a specific identifier.
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MESSENGER_EgoStore * get_service_ego_store(struct GNUNET_MESSENGER_Service *service)
Returns the used EGO-store of a given service.
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_set_handle_name()

static void callback_set_handle_name ( void *  cls,
const char *  name,
const struct GNUNET_MESSENGER_Ego ego 
)
static

Definition at line 329 of file gnunet-service-messenger_handle.c.

References change_handle_name(), create_message_name(), destroy_message(), GNUNET_MESSENGER_SrvHandle::ego, get_handle_data_subdir(), get_service_ego_store(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_DISK_directory_create_for_file(), GNUNET_DISK_directory_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_MessageHandle::handle, iterate_send_message(), GNUNET_MESSENGER_SrvHandle::member_ids, GNUNET_MESSENGER_MessageHandle::message, GNUNET_MESSENGER_SrvHandle::name, rename_store_ego(), result, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by set_handle_name().

330 {
331  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
332 
333  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Renaming handle...\n");
334 
335  if (ego)
336  {
337  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Renaming handle failed: Name is occupied! (%s)\n", name);
338  return;
339  }
340 
342 
343  int rename_ego_in_store = handle->ego? GNUNET_YES : GNUNET_NO;
344 
345  char *old_dir;
346  get_handle_data_subdir (handle, handle->name, &old_dir);
347 
348  char *new_dir;
349  get_handle_data_subdir (handle, name, &new_dir);
350 
351  int result = 0;
352 
354  {
356 
357  result = rename (old_dir, new_dir);
358  }
359  else if (GNUNET_YES == GNUNET_DISK_directory_test (new_dir, GNUNET_NO))
360  result = -1;
361 
362  if (0 == result)
363  {
364  struct GNUNET_MESSENGER_MessageHandle msg_handle;
365 
366  msg_handle.handle = handle;
367  msg_handle.message = create_message_name (name);
368 
370 
371  destroy_message (msg_handle.message);
372 
373  change_handle_name (handle, name);
374  }
375  else
376  rename_ego_in_store = GNUNET_NO;
377 
378  GNUNET_free(old_dir);
379  GNUNET_free(new_dir);
380 
381  if (GNUNET_YES == rename_ego_in_store)
382  rename_store_ego(store, handle->name, name);
383 }
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
struct GNUNET_MESSENGER_Service * service
struct GNUNET_MESSENGER_SrvHandle * handle
struct GNUNET_MESSENGER_EgoStore * get_service_ego_store(struct GNUNET_MESSENGER_Service *service)
Returns the used EGO-store of a given service.
void rename_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, const char *new_identifier)
Updates the location of a registered EGO in a store to a different one under a specific new_identifie...
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static int result
Global testing status.
static int iterate_send_message(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_MESSENGER_Message * create_message_name(const char *name)
Creates and allocates a new name message containing the name to change to.
const struct GNUNET_MESSENGER_Ego * ego
const char * name
#define GNUNET_log(kind,...)
struct GNUNET_CONTAINER_MultiHashMap * member_ids
void get_handle_data_subdir(const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir)
Writes the path of the directory for a given handle using a specific name to the parameter dir...
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
Definition: disk.c:582
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
static void change_handle_name(struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
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
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_handle_name()

void set_handle_name ( struct GNUNET_MESSENGER_SrvHandle handle,
const char *  name 
)

Tries to rename the handle which implies renaming the EGO its using and moving all related data into the directory fitting to the changed name.

The client connected to the handle will be informed afterwards automatically.

Parameters

Definition at line 386 of file gnunet-service-messenger_handle.c.

References callback_set_handle_name(), change_handle_name(), GNUNET_MESSENGER_SrvHandle::ego, get_service_ego_store(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, lookup_store_ego(), and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_get_name(), and handle_set_name().

387 {
388  GNUNET_assert(handle);
389 
390  if (!name)
391  {
392  if (handle->ego)
393  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Renaming handle failed: Name is required!\n");
394  else
395  change_handle_name (handle, name);
396 
397  return;
398  }
399 
401 
403 }
void lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls)
Lookups an EGO which was registered to a store under a specific identifier.
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MESSENGER_EgoStore * get_service_ego_store(struct GNUNET_MESSENGER_Service *service)
Returns the used EGO-store of a given service.
const struct GNUNET_MESSENGER_Ego * ego
static void callback_set_handle_name(void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
const char * name
#define GNUNET_log(kind,...)
static void change_handle_name(struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_handle_room()

int open_handle_room ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key 
)

Makes a given handle a member of the room using a specific key and opens the room from the handles service.

Parameters

Definition at line 406 of file gnunet-service-messenger_handle.c.

References create_handle_member_id(), get_handle_member_id(), GNUNET_assert, GNUNET_NO, GNUNET_YES, open_service_room(), and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_room_open().

407 {
408  GNUNET_assert((handle) && (key));
409 
410  if ((!get_handle_member_id (handle, key)) && (GNUNET_YES != create_handle_member_id (handle, key)))
411  return GNUNET_NO;
412 
413  return open_service_room (handle->service, handle, key);
414 }
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.
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static int create_handle_member_id(const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entry_handle_room()

int entry_handle_room ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_PeerIdentity door,
const struct GNUNET_HashCode key 
)

Makes a given handle a member of the room using a specific key and enters the room through a tunnel to a peer identified by a given door (peer identity).

Parameters

Definition at line 417 of file gnunet-service-messenger_handle.c.

References create_handle_member_id(), entry_service_room(), get_handle_member_id(), GNUNET_assert, GNUNET_NO, GNUNET_YES, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_room_entry().

419 {
420  GNUNET_assert((handle) && (door) && (key));
421 
422  if ((!get_handle_member_id (handle, key)) && (GNUNET_YES != create_handle_member_id (handle, key)))
423  return GNUNET_NO;
424 
425  return entry_service_room (handle->service, handle, door, key);
426 }
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.
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static int create_handle_member_id(const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ close_handle_room()

int close_handle_room ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key 
)

Removes the membership of the room using a specific key and closes it if no other handle from this service is still a member of it.

Parameters

Definition at line 429 of file gnunet-service-messenger_handle.c.

References close_service_room(), get_handle_member_id(), GNUNET_assert, GNUNET_NO, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_room_close().

430 {
431  GNUNET_assert((handle) && (key));
432 
433  if (!get_handle_member_id (handle, key))
434  return GNUNET_NO;
435 
436  return close_service_room (handle->service, handle, key);
437 }
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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.
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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_handle_message()

int send_handle_message ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key,
const struct GNUNET_MESSENGER_Message message 
)

Sends a message from a given handle to the room using a specific key.

Parameters

Definition at line 440 of file gnunet-service-messenger_handle.c.

References copy_message(), get_handle_member_id(), get_service_room(), GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_MESSENGER_Message::header, msg, send_room_message(), GNUNET_MESSENGER_MessageHeader::sender_id, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by handle_send_message(), and iterate_send_message().

442 {
443  GNUNET_assert((handle) && (key) && (message));
444 
445  const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, key);
446 
447  if (!id)
448  {
449  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "It is required to be a member of a room to send messages!\n");
450  return GNUNET_NO;
451  }
452 
453  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (handle->service, key);
454 
455  if (!room)
456  {
457  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "The room (%s) is unknown!\n", GNUNET_h2s (key));
458  return GNUNET_NO;
459  }
460 
461  struct GNUNET_MESSENGER_Message *msg = copy_message(message);
462 
463  GNUNET_memcpy(&(msg->header.sender_id), id, sizeof(*id));
464 
465  return send_room_message (room, handle, msg);
466 }
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MESSENGER_Service * service
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
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.
A 256-bit hashcode.
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.
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
#define GNUNET_log(kind,...)
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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_next_member_session_contect()

static const struct GNUNET_HashCode* get_next_member_session_contect ( const struct GNUNET_MESSENGER_MemberSession session)
static

Definition at line 469 of file gnunet-service-messenger_handle.c.

References get_member_session_context(), and GNUNET_MESSENGER_MemberSession::next.

Referenced by notify_handle_message().

470 {
471  if (session->next)
472  return get_next_member_session_contect (session->next);
473  else
474  return get_member_session_context(session);
475 }
struct GNUNET_MESSENGER_MemberSession * next
const struct GNUNET_HashCode * get_member_session_context(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the member context of a given member session.
static const struct GNUNET_HashCode * get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *session)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_handle_member_session()

static const struct GNUNET_MESSENGER_MemberSession* get_handle_member_session ( struct GNUNET_MESSENGER_SrvHandle handle,
const struct GNUNET_HashCode key 
)
static

Definition at line 478 of file gnunet-service-messenger_handle.c.

References get_handle_ego(), get_handle_member_id(), get_member_session(), get_room_member_store(), get_service_room(), get_store_member(), GNUNET_assert, GNUNET_MESSENGER_Ego::pub, and GNUNET_MESSENGER_SrvHandle::service.

Referenced by notify_handle_message().

479 {
480  GNUNET_assert((handle) && (key) && (handle->service));
481 
482  const struct GNUNET_ShortHashCode *id = get_handle_member_id(handle, key);
483  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room(handle->service, key);
484 
485  if ((!id) || (!room))
486  return NULL;
487 
489  struct GNUNET_MESSENGER_Member *member = get_store_member(store, id);
490 
491  const struct GNUNET_MESSENGER_Ego *ego = get_handle_ego(handle);
492 
493  if (!ego)
494  return NULL;
495 
496  return get_member_session(member, &(ego->pub));
497 }
struct GNUNET_MESSENGER_Service * service
struct GNUNET_MESSENGER_MemberSession * get_member_session(const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key)
Returns the member session of a member identified by a given public key.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MESSENGER_MemberStore * get_room_member_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used member store of a given room.
A 256-bit hashcode.
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.
struct GNUNET_IDENTITY_PublicKey pub
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_Member * get_store_member(const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id)
Returns the member in a store identified by a given id.
const struct GNUNET_MESSENGER_Ego * get_handle_ego(const struct GNUNET_MESSENGER_SrvHandle *handle)
Returns the EGO used by a given handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify_handle_message()

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.

Parameters

Definition at line 500 of file gnunet-service-messenger_handle.c.

References GNUNET_MESSENGER_MemberSession::contact, context, GNUNET_MESSENGER_RecvMessage::context, copy_message(), decrypt_message(), destroy_message(), encode_message(), env, GNUNET_MESSENGER_RecvMessage::flags, get_contact_key(), get_handle_ego(), get_handle_member_id(), get_handle_member_session(), get_message_size(), get_next_member_session_contect(), GNUNET_assert, GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE, GNUNET_MESSENGER_FLAG_NONE, GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_YES, GNUNET_MESSENGER_RecvMessage::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_RecvMessage::key, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_SrvHandle::mq, msg, pubkey, and GNUNET_MESSENGER_RecvMessage::sender.

Referenced by callback_found_message(), handle_service_message(), and notify_about_members().

503 {
504  GNUNET_assert((handle) && (key) && (session) && (message) && (hash));
505 
506  if ((!handle->mq) || (!get_handle_member_id (handle, key)))
507  {
508  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Notifying client about message requires membership!\n");
509  return;
510  }
511 
512  const struct GNUNET_IDENTITY_PublicKey *pubkey = get_contact_key(session->contact);
513 
514  struct GNUNET_HashCode sender;
515  GNUNET_CRYPTO_hash(pubkey, sizeof(*pubkey), &sender);
516 
517  const struct GNUNET_HashCode *context = get_next_member_session_contect (session);
518 
519  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Notifying client about message: %s\n", GNUNET_h2s (hash));
520 
521  struct GNUNET_MESSENGER_Message *private_message = NULL;
522 
523  if (GNUNET_MESSENGER_KIND_PRIVATE == message->header.kind)
524  {
525  private_message = copy_message(message);
526 
527  if (GNUNET_YES != decrypt_message(private_message, &(get_handle_ego(handle)->priv)))
528  {
529  destroy_message(private_message);
530  private_message = NULL;
531  }
532  else
533  message = private_message;
534  }
535 
537  struct GNUNET_MQ_Envelope *env;
538 
539  uint16_t length = get_message_size (message, GNUNET_YES);
540 
542 
543  GNUNET_memcpy(&(msg->key), key, sizeof(msg->key));
544  GNUNET_memcpy(&(msg->sender), &sender, sizeof(msg->sender));
545  GNUNET_memcpy(&(msg->context), context, sizeof(msg->context));
546  GNUNET_memcpy(&(msg->hash), hash, sizeof(msg->hash));
547 
548  msg->flags = (uint32_t) GNUNET_MESSENGER_FLAG_NONE;
549 
550  if (get_handle_member_session(handle, key) == session)
551  msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_SENT;
552 
553  if (private_message)
554  msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_PRIVATE;
555 
556  char *buffer = ((char*) msg) + sizeof(*msg);
557  encode_message (message, length, buffer, GNUNET_YES);
558 
559  if (private_message)
560  destroy_message(private_message);
561 
562  GNUNET_MQ_send (handle->mq, env);
563 }
struct GNUNET_MESSENGER_MessageHeader header
Header.
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
const struct GNUNET_IDENTITY_PublicKey * get_contact_key(const struct GNUNET_MESSENGER_Contact *contact)
Returns the public key of a given contact.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
void encode_message(const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, int include_signature)
Encodes a given message into a buffer of a maximal length in bytes.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
int decrypt_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key)
Decrypts a private message using a given private key and replaces its body and kind with the inner en...
static pa_context * context
Pulseaudio context.
static const struct GNUNET_HashCode * get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *session)
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
static struct GNUNET_IDENTITY_PublicKey pubkey
Public key of the zone to look in.
A 512-bit hashcode.
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
An identity key as per LSD0001.
#define GNUNET_log(kind,...)
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.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
static const struct GNUNET_MESSENGER_MemberSession * get_handle_member_session(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE
Message to receive something from a room.
const struct GNUNET_MESSENGER_Ego * get_handle_ego(const struct GNUNET_MESSENGER_SrvHandle *handle)
Returns the EGO used by a given handle.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
uint16_t get_message_size(const struct GNUNET_MESSENGER_Message *message, int include_signature)
Returns the exact size in bytes to encode a given message.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_scan_for_rooms()

static int callback_scan_for_rooms ( void *  cls,
const char *  filename 
)
static

Definition at line 566 of file gnunet-service-messenger_handle.c.

References cfg, change_handle_member_id(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_get_data(), GNUNET_CONFIGURATION_parse(), GNUNET_DISK_file_test(), GNUNET_OK, GNUNET_YES, and GNUNET_MESSENGER_MessageHandle::handle.

Referenced by load_handle_configuration().

567 {
568  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
569 
571 
573  {
574  struct GNUNET_HashCode key;
575  struct GNUNET_ShortHashCode member_id;
576 
577  if ((GNUNET_OK == GNUNET_CONFIGURATION_get_data (cfg, "room", "key", &key, sizeof(key))) &&
578  (GNUNET_OK == GNUNET_CONFIGURATION_get_data (cfg, "room", "member_id", &member_id, sizeof(member_id))))
579  change_handle_member_id (handle, &key, &member_id);
580  }
581 
583  return GNUNET_OK;
584 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Parse a configuration file, add all of the options in the file to the configuration environment...
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
int change_handle_member_id(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *unique_id)
Changes the member id of a given handle in a specific room to match a unique_id and returns GNUNET_OK...
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_data(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, void *buf, size_t buf_size)
Get Crockford32-encoded fixed-size binary data from a configuration.
A 256-bit hashcode.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
static char * filename
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
configuration data
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory)...
Definition: disk.c:482
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_handle_configuration()

void load_handle_configuration ( struct GNUNET_MESSENGER_SrvHandle handle)

Loads member ids and other potential configuration from a given handle which depends on the given name the handle uses.

Parameters
[out]handleHandle

Definition at line 587 of file gnunet-service-messenger_handle.c.

References callback_scan_for_rooms(), DIR_SEPARATOR, get_handle_data_subdir(), GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_scan(), GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_SrvHandle::name, and find_typedefs::scan_dir().

Referenced by callback_setup_handle_name().

588 {
589  GNUNET_assert(handle);
590 
591  char *id_dir;
592  get_handle_data_subdir (handle, handle->name, &id_dir);
593 
595  {
596  char *scan_dir;
597  GNUNET_asprintf (&scan_dir, "%s%s%c", id_dir, "rooms", DIR_SEPARATOR);
598 
601 
602  GNUNET_free(scan_dir);
603  }
604 
605  GNUNET_free(id_dir);
606 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
Definition: disk.c:814
static int callback_scan_for_rooms(void *cls, const char *filename)
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define DIR_SEPARATOR
Definition: platform.h:164
void get_handle_data_subdir(const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir)
Writes the path of the directory for a given handle using a specific name to the parameter dir...
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
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iterate_save_rooms()

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

Definition at line 609 of file gnunet-service-messenger_handle.c.

References cfg, DIR_SEPARATOR, filename, get_handle_data_subdir(), GNUNET_asprintf(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_CONFIGURATION_write(), GNUNET_free, GNUNET_h2s(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_MESSENGER_MessageHandle::handle, GNUNET_MESSENGER_SrvHandle::name, and value.

Referenced by save_handle_configuration().

610 {
611  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
612  struct GNUNET_ShortHashCode *member_id = value;
613 
614  char *id_dir;
615  get_handle_data_subdir (handle, handle->name, &id_dir);
616 
617  char *filename;
618  GNUNET_asprintf (&filename, "%s%s%c%s.cfg", id_dir, "rooms", DIR_SEPARATOR, GNUNET_h2s (key));
619 
620  GNUNET_free(id_dir);
621 
623 
624  char *key_data = GNUNET_STRINGS_data_to_string_alloc (key, sizeof(*key));
625 
626  if (key_data)
627  {
628  GNUNET_CONFIGURATION_set_value_string (cfg, "room", "key", key_data);
629 
630  GNUNET_free(key_data);
631  }
632 
633  char *member_id_data = GNUNET_STRINGS_data_to_string_alloc (member_id, sizeof(*member_id));
634 
635  if (member_id_data)
636  {
637  GNUNET_CONFIGURATION_set_value_string (cfg, "room", "member_id", member_id_data);
638 
639  GNUNET_free(member_id_data);
640  }
641 
642  GNUNET_CONFIGURATION_write (cfg, filename);
644 
645  GNUNET_free(filename);
646 
647  return GNUNET_YES;
648 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Write configuration file.
A 256-bit hashcode.
static char * value
Value of the record to add/remove.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
static char * filename
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
void GNUNET_CONFIGURATION_set_value_string(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Set a configuration value that should be a string.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define DIR_SEPARATOR
Definition: platform.h:164
configuration data
void get_handle_data_subdir(const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir)
Writes the path of the directory for a given handle using a specific name to the parameter dir...
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:750
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_handle_configuration()

void save_handle_configuration ( struct GNUNET_MESSENGER_SrvHandle handle)

Saves member ids and other potential configuration from a given handle which depends on the given name the handle uses.

Parameters
[in]handleHandle

Definition at line 651 of file gnunet-service-messenger_handle.c.

References DIR_SEPARATOR, get_handle_data_subdir(), GNUNET_asprintf(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_DISK_directory_create(), GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_YES, iterate_save_rooms(), GNUNET_MESSENGER_SrvHandle::member_ids, and GNUNET_MESSENGER_SrvHandle::name.

Referenced by destroy_handle().

652 {
653  GNUNET_assert(handle);
654 
655  char *id_dir;
656  get_handle_data_subdir (handle, handle->name, &id_dir);
657 
659  == GNUNET_DISK_directory_create (id_dir)))
660  {
661  char *save_dir;
662  GNUNET_asprintf (&save_dir, "%s%s%c", id_dir, "rooms", DIR_SEPARATOR);
663 
664  if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
665  (GNUNET_OK == GNUNET_DISK_directory_create (save_dir)))
667 
668  GNUNET_free(save_dir);
669  }
670 
671  GNUNET_free(id_dir);
672 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create(const char *dir)
Implementation of "mkdir -p".
Definition: disk.c:496
static int iterate_save_rooms(void *cls, const struct GNUNET_HashCode *key, void *value)
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define DIR_SEPARATOR
Definition: platform.h:164
struct GNUNET_CONTAINER_MultiHashMap * member_ids
void get_handle_data_subdir(const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir)
Writes the path of the directory for a given handle using a specific name to the parameter dir...
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
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
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: