GNUnet debian-0.24.3-23-g589b01d60
messenger_api_handle.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2025 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
27
28#include "messenger_api_epoch.h"
31#include "messenger_api_room.h"
32#include "messenger_api_util.h"
33
37 void *msg_cls)
38{
40
42
44
45 handle->config = config;
46 handle->mq = NULL;
47
49 handle->config,
51 "MESSENGER_GROUP_KEYS");
52
53 if (handle->config)
54 handle->namestore = GNUNET_NAMESTORE_connect (handle->config);
55
56 handle->msg_callback = msg_callback;
57 handle->msg_cls = msg_cls;
58
59 handle->name = NULL;
60 handle->key = NULL;
61 handle->pubkey = NULL;
62
63 handle->reconnect_time = GNUNET_TIME_relative_get_zero_ ();
64 handle->reconnect_task = NULL;
65
66 handle->key_monitor = NULL;
67
69
71
72 return handle;
73}
74
75
78 const struct GNUNET_HashCode *key,
79 void *value)
80{
81 struct GNUNET_MESSENGER_Room *room;
82
84
85 room = value;
86
87 destroy_room (room);
88 return GNUNET_YES;
89}
90
91
92void
94{
96
98
99 if (handle->rooms)
100 {
102 handle->rooms, iterate_destroy_room, NULL);
103
105 }
106
107 if (handle->key_monitor)
109
110 if (handle->reconnect_task)
111 GNUNET_SCHEDULER_cancel (handle->reconnect_task);
112
113 if (handle->mq)
115
116 if (handle->namestore)
118
119 if (handle->name)
120 GNUNET_free (handle->name);
121
122 if (handle->key)
123 GNUNET_free (handle->key);
124
125 if (handle->pubkey)
126 GNUNET_free (handle->pubkey);
127
129}
130
131
132void
134 const char *name)
135{
137
138 if (handle->name)
139 GNUNET_free (handle->name);
140
141 handle->name = name ? GNUNET_strdup (name) : NULL;
142}
143
144
145const char*
147{
149
150 return handle->name;
151}
152
153
154static void
155cb_key_error (void *cls)
156{
158 const char *name;
159
160 GNUNET_assert (cls);
161
162 handle = cls;
164
165 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error on monitoring records: %s\n",
166 name);
167}
168
169
170static void
171cb_key_monitor (void *cls,
172 const struct GNUNET_CRYPTO_PrivateKey *zone,
173 const char *label,
174 unsigned int rd_count,
175 const struct GNUNET_GNSRECORD_Data *rd,
176 struct GNUNET_TIME_Absolute expiry)
177{
180 struct GNUNET_MESSENGER_Room *room;
181 struct GNUNET_MESSENGER_Epoch *epoch;
182 union GNUNET_MESSENGER_EpochIdentifier identifier;
183 enum GNUNET_GenericReturnValue valid;
184 struct GNUNET_CRYPTO_SymmetricSessionKey shared_key;
185
187 (cls) && (zone) && (label) && (rd_count) && (rd));
188
189 handle = cls;
190
191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitor record with label: %s\n",
192 label);
193
195 (sizeof (*record) != rd->data_size) || (! rd->data))
196 goto monitor_next;
197
198 record = rd->data;
199 room = get_handle_room (handle, &(record->key));
200
201 if (! room)
202 goto monitor_next;
203
204 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitor epoch key record of room: %s\n",
205 GNUNET_h2s (get_room_key (room)));
206
207 epoch = get_room_epoch (room, &(record->hash), GNUNET_NO);
208
209 if (! epoch)
210 goto monitor_next;
211
213 &identifier,
214 &(record->identifier),
215 sizeof (record->identifier));
217 GNUNET_NO);
218
219 {
222
223 if (GNUNET_YES != GNUNET_CRYPTO_kdf (&skey, sizeof (skey),
224 get_room_key (room),
225 sizeof (room->key),
226 zone,
227 sizeof (*zone),
228 &(epoch->hash),
229 sizeof (epoch->hash),
230 &(identifier.hash),
231 sizeof (identifier.hash),
232 NULL))
233 goto monitor_next;
234
236 &iv,
237 &skey,
238 get_room_key (room), sizeof (room->key),
239 &(epoch->hash), sizeof (epoch->hash),
240 &(identifier.hash), sizeof (identifier.hash),
241 NULL);
242
243 if (-1 == GNUNET_CRYPTO_symmetric_decrypt (&(record->shared_key),
244 sizeof (record->shared_key),
245 &skey,
246 &iv,
247 &shared_key))
248 goto monitor_next;
249
250 GNUNET_CRYPTO_zero_keys (&skey, sizeof (skey));
251 }
252
253 if (identifier.code.group_bit)
254 {
255 struct GNUNET_MESSENGER_EpochGroup *group;
256
258
259 if (! group)
260 goto monitor_next;
261
263 }
264 else
265 {
266 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
267
268 announcement = get_epoch_announcement (epoch, &identifier, valid);
269
270 if (! announcement)
271 goto monitor_next;
272
274 }
275
276monitor_next:
278}
279
280
284 void *value)
285{
286 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
287
289
290 announcement = value;
291
292 if ((cls) && (GNUNET_YES != announcement->stored))
294 else if (! cls)
295 announcement->stored = GNUNET_NO;
296
297 return GNUNET_YES;
298}
299
300
304 void *value)
305{
306 struct GNUNET_MESSENGER_EpochGroup *group;
307
309
310 group = value;
311
312 if ((cls) && (GNUNET_YES != group->stored))
314 else if (! cls)
315 group->stored = GNUNET_NO;
316
317 return GNUNET_YES;
318}
319
320
323 GNUNET_UNUSED const struct GNUNET_HashCode *key,
324 void *value)
325{
326 const struct GNUNET_MESSENGER_Epoch *epoch;
327
329
330 epoch = value;
331
335 cls);
336 return GNUNET_YES;
337}
338
339
342 GNUNET_UNUSED const struct GNUNET_HashCode *key,
343 void *value)
344{
345 const struct GNUNET_MESSENGER_Room *room;
346
348
349 room = value;
350
352 room->epochs,
354 cls);
355 return GNUNET_YES;
356}
357
358
359static void
360cb_key_sync (void *cls)
361{
363 const char *name;
364
365 GNUNET_assert (cls);
366
367 handle = cls;
369
371 "Syncing epoch and group keys completed: %s\n",
372 name);
373
376}
377
378
379void
381 const struct GNUNET_CRYPTO_PrivateKey *key)
382{
384
385 if (handle->key_monitor)
386 {
388 handle->key_monitor = NULL;
389 }
390
391 if (! key)
392 {
393 if (handle->key)
394 GNUNET_free (handle->key);
395
396 if (handle->pubkey)
397 GNUNET_free (handle->pubkey);
398
399 handle->key = NULL;
400 handle->pubkey = NULL;
401 return;
402 }
403
404 if (! handle->key)
406
407 if (! handle->pubkey)
408 handle->pubkey = GNUNET_new (struct GNUNET_CRYPTO_PublicKey);
409
410 GNUNET_memcpy (handle->key, key, sizeof(*key));
412
413 // Resets epoch and group keys as not stored yet
415 handle->rooms, it_room_store_keys, NULL);
416
418 handle->config,
419 handle->key,
422 handle,
424 handle,
426 handle,
428}
429
430
431const struct GNUNET_CRYPTO_PrivateKey*
433{
435
436 if (handle->key)
437 return handle->key;
438
440}
441
442
443const struct GNUNET_CRYPTO_PublicKey*
445{
447
448 if (handle->pubkey)
449 return handle->pubkey;
450
451 return get_anonymous_public_key ();
452}
453
454
457{
459
460 return &(handle->contact_store);
461}
462
463
466 const struct GNUNET_HashCode *key)
467{
468 struct GNUNET_MESSENGER_Room *room;
469 const struct GNUNET_ShortHashCode *contact_id;
470
471 GNUNET_assert ((handle) && (key));
472
474
475 if (! room)
476 return NULL;
477
478 contact_id = get_room_sender_id (room);
479
480 if (! contact_id)
481 return NULL;
482
483 {
485 get_context_from_member (key, contact_id, &context);
486
488 &context,
490 }
491}
492
493
494void
496 const struct GNUNET_HashCode *key)
497{
498 struct GNUNET_MESSENGER_Room *room;
499
500 GNUNET_assert ((handle) && (key));
501
503
504 if (room)
505 room->opened = GNUNET_YES;
506}
507
508
509void
511 const struct GNUNET_PeerIdentity *door,
512 const struct GNUNET_HashCode *key)
513{
514 struct GNUNET_MESSENGER_Room *room;
515
516 GNUNET_assert ((handle) && (door) && (key));
517
519
520 if (room)
521 add_to_list_tunnels (&(room->entries), door, NULL);
522}
523
524
525void
527 const struct GNUNET_HashCode *key)
528{
529 struct GNUNET_MESSENGER_Room *room;
530
531 GNUNET_assert ((handle) && (key));
532
534
536 handle->rooms, key, room)))
537 destroy_room (room);
538}
539
540
543 const struct GNUNET_HashCode *key)
544{
545 GNUNET_assert ((handle) && (key));
546
548}
549
550
553 const struct GNUNET_HashCode *key,
554 const struct GNUNET_HashCode *hash,
555 const struct GNUNET_ShortHashCode *identifier,
557 shared_key,
558 uint32_t flags,
560 void *cont_cls,
561 struct GNUNET_NAMESTORE_QueueEntry **query)
562{
563 const struct GNUNET_CRYPTO_PrivateKey *zone;
567 char *label;
568
569 GNUNET_assert ((handle) && (key) && (hash) && (identifier) && (query));
570
571 if (! handle->namestore)
572 return GNUNET_SYSERR;
573
574 zone = get_handle_key (handle);
575
576 if (! zone)
577 return GNUNET_SYSERR;
578
580
581 memset (&data, 0, sizeof (data));
582 memset (&record, 0, sizeof (record));
583
584 if (shared_key)
585 {
588
589 if (GNUNET_YES != GNUNET_CRYPTO_kdf (&skey, sizeof (skey),
590 key, sizeof (*key),
591 zone, sizeof (*zone),
592 hash, sizeof (*hash),
593 identifier, sizeof (*identifier),
594 NULL))
595 return GNUNET_SYSERR;
596
597 GNUNET_memcpy (&(record.key), key, sizeof (record.key));
598 GNUNET_memcpy (&(record.hash), hash, sizeof (record.hash));
600 &(record.identifier),
601 identifier,
602 sizeof (record.identifier));
603
605 &iv,
606 &skey,
607 key, sizeof (*key),
608 hash, sizeof (*hash),
609 identifier, sizeof (*identifier),
610 NULL);
611
612 if (-1 == GNUNET_CRYPTO_symmetric_encrypt (shared_key,
613 sizeof (*shared_key),
614 &skey,
615 &iv,
616 &(record.shared_key)))
617 return GNUNET_SYSERR;
618
619 record.flags = flags;
620
622 data.data = &record;
623 data.data_size = sizeof (record);
624 data.expiration_time = expiration.abs_value_us;
626
627 GNUNET_CRYPTO_zero_keys (&skey, sizeof (skey));
628 }
629
630 {
631 char lower_key [9];
632 char lower_hash [9];
633 char lower_id [7];
634 const char *s;
635
636 memset (lower_key, 0, sizeof (lower_key));
637 memset (lower_hash, 0, sizeof (lower_hash));
638 memset (lower_id, 0, sizeof (lower_id));
639
640 s = GNUNET_h2s (key);
641 if (GNUNET_OK != GNUNET_STRINGS_utf8_tolower (s, lower_key))
642 GNUNET_memcpy (lower_key, s, sizeof (lower_key));
643
644 s = GNUNET_h2s (hash);
645 if (GNUNET_OK != GNUNET_STRINGS_utf8_tolower (s, lower_hash))
646 GNUNET_memcpy (lower_hash, s, sizeof (lower_hash));
647
648 s = GNUNET_sh2s (identifier);
649 if (GNUNET_OK != GNUNET_STRINGS_utf8_tolower (s, lower_id))
650 GNUNET_memcpy (lower_id, s, sizeof (lower_id));
651
653 &label,
654 "epoch_key_%s%s%s",
655 lower_key,
656 lower_hash,
657 lower_id);
658 }
659
660 if (! label)
661 return GNUNET_SYSERR;
662
663 if (*query)
665
667 "Store epoch key record with label: %s [%d]\n",
668 label,
669 shared_key? 1 : 0);
670
672 handle->namestore,
673 zone,
674 label,
675 shared_key? 1 : 0,
676 &data,
677 cont,
678 cont_cls);
679
680 GNUNET_free (label);
681 return GNUNET_OK;
682}
#define GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_EPOCH_KEY
Record type to store epoch keys from a messenger room.
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_TIME_Relative expiration
User supplied expiration value.
static pa_context * context
Pulseaudio context.
const struct GNUNET_CONFIGURATION_Handle * config
static char * name
Name (label) of the records to list.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static char * value
Value of the record to add/remove.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
ssize_t GNUNET_CRYPTO_symmetric_encrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Encrypt a block using a symmetric sessionkey.
void GNUNET_CRYPTO_symmetric_derive_iv(struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const void *salt, size_t salt_len,...)
Derive an IV.
void GNUNET_CRYPTO_zero_keys(void *buffer, size_t length)
Zero out buffer, securely against compiler optimizations.
ssize_t GNUNET_CRYPTO_symmetric_decrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Decrypt a given block using a symmetric sessionkey.
@ GNUNET_GNSRECORD_RF_PRIVATE
This is a private record of this peer and it should thus not be published.
@ GNUNET_GNSRECORD_FILTER_NONE
No filter flags set.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
Definition: crypto_kdf.c:62
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
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.
enum GNUNET_GenericReturnValue 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.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multishortmap_iterate(struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_log(kind,...)
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: crypto_pkey.c:430
#define GNUNET_UNUSED
gcc-ism to document unused arguments
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void(* GNUNET_MESSENGER_MessageCallback)(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags)
Method called whenever a message is sent or received from a room.
#define GNUNET_MESSENGER_SERVICE_NAME
Identifier of GNUnet MESSENGER Service.
@ GNUNET_MESSENGER_FLAG_EPOCH_VALID
The valid flag.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:700
void(* GNUNET_NAMESTORE_ContinuationWithStatus)(void *cls, enum GNUNET_ErrorCode ec)
Continuation called to notify client about result of the operation.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void GNUNET_NAMESTORE_zone_monitor_stop(struct GNUNET_NAMESTORE_ZoneMonitor *zm)
Stop monitoring a zone for changes.
struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start2(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_PrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordSetMonitor monitor, void *monitor_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls, enum GNUNET_GNSRECORD_Filter filter)
Begin monitoring a zone for changes.
void GNUNET_NAMESTORE_zone_monitor_next(struct GNUNET_NAMESTORE_ZoneMonitor *zm, uint64_t limit)
Calls the monitor processor specified in GNUNET_NAMESTORE_zone_monitor_start for the next record(s).
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980
enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_tolower(const char *input, char *output)
Convert the utf-8 input string to lower case.
Definition: strings.c:475
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero_(void)
Return relative time of 0ms.
Definition: time.c:133
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_forever_(void)
Return "forever".
Definition: time.c:205
void get_context_from_member(const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, struct GNUNET_HashCode *context)
Calculates the context hash of a member in a room and returns it.
void clear_contact_store(struct GNUNET_MESSENGER_ContactStore *store)
Clears a contact store, wipes its content and deallocates its memory.
void init_contact_store(struct GNUNET_MESSENGER_ContactStore *store)
Initializes a contact store as fully empty.
struct GNUNET_MESSENGER_Contact * get_store_contact(struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, const struct GNUNET_CRYPTO_PublicKey *pubkey)
Returns a contact using a specific public key.
struct GNUNET_MESSENGER_EpochGroup * get_epoch_group(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch group of a given epoch using a specific unique identifier or NULL.
struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch announcement of a given epoch using a specific unique identifier or NULL.
void set_epoch_announcement_key(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch announcement to a shared key.
void write_epoch_announcement_record(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, enum GNUNET_GenericReturnValue deleted)
Writes/Deletes the GNS record of a given epoch announcement depending on a provided flag that states ...
void write_epoch_group_record(struct GNUNET_MESSENGER_EpochGroup *group, enum GNUNET_GenericReturnValue deleted)
Writes/Deletes the GNS record of a given epoch group depending on a provided flag that states wether ...
void set_epoch_group_key(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch group to a shared key.
void entry_handle_room_at(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
Adds a tunnel for a room known to a handle identified by a given key to a list of opened connections.
struct GNUNET_MESSENGER_Handle * create_handle(const struct GNUNET_CONFIGURATION_Handle *config, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Creates and allocates a new handle using a given configuration and a custom message callback with a g...
static enum GNUNET_GenericReturnValue iterate_destroy_room(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_MESSENGER_ContactStore * get_handle_contact_store(struct GNUNET_MESSENGER_Handle *handle)
Returns the used contact store of a given handle.
void open_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Marks a room known to a handle identified by a given key as open.
struct GNUNET_MESSENGER_Contact * get_handle_contact(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Returns the contact of a given handle in a room identified by a given key.
const char * get_handle_name(const struct GNUNET_MESSENGER_Handle *handle)
Returns the current name of a given handle or NULL if no valid name was assigned yet.
void destroy_handle(struct GNUNET_MESSENGER_Handle *handle)
Destroys a handle and frees its memory fully from the client API.
struct GNUNET_MESSENGER_Room * get_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Returns the room known to a handle identified by a given key.
enum GNUNET_GenericReturnValue store_handle_epoch_key(const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_HashCode *hash, const struct GNUNET_ShortHashCode *identifier, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, uint32_t flags, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls, struct GNUNET_NAMESTORE_QueueEntry **query)
Stores/deletes a shared_key for a given room from a handle identified by its key in an epoch with cer...
static enum GNUNET_GenericReturnValue it_epoch_store_keys(void *cls, const struct GNUNET_HashCode *key, void *value)
void set_handle_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_PrivateKey *key)
Sets the keypair of a given handle to the keypair of a specific private key.
void close_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Destroys and so implicitly closes a room known to a handle identified by a given key.
static void cb_key_error(void *cls)
void set_handle_name(struct GNUNET_MESSENGER_Handle *handle, const char *name)
Sets the name of a handle to a specific name.
static enum GNUNET_GenericReturnValue it_room_store_keys(void *cls, const struct GNUNET_HashCode *key, void *value)
const struct GNUNET_CRYPTO_PrivateKey * get_handle_key(const struct GNUNET_MESSENGER_Handle *handle)
Returns the private key of a given handle.
const struct GNUNET_CRYPTO_PublicKey * get_handle_pubkey(const struct GNUNET_MESSENGER_Handle *handle)
Returns the public key of a given handle.
static void cb_key_sync(void *cls)
static enum GNUNET_GenericReturnValue it_group_store_key(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
static enum GNUNET_GenericReturnValue it_announcement_store_key(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
static void cb_key_monitor(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry)
void add_to_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HashCode *hash)
Adds a specific peer from a tunnel to the end of the list.
struct GNUNET_MESSENGER_Epoch * get_room_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue recent)
Returns the epoch in a given room from a specific epoch hash that represents the exact message the ep...
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.
const struct GNUNET_ShortHashCode * get_room_sender_id(const struct GNUNET_MESSENGER_Room *room)
Returns the member id of the room's sender.
void destroy_room(struct GNUNET_MESSENGER_Room *room)
Destroys a room and frees its memory fully from the client API.
const struct GNUNET_CRYPTO_PrivateKey * get_anonymous_private_key(void)
Returns the private identity key of GNUNET_IDENTITY_ego_get_anonymous() without recalculating it ever...
const struct GNUNET_CRYPTO_PublicKey * get_anonymous_public_key(void)
Returns the public identity key of GNUNET_IDENTITY_ego_get_anonymous() without recalculating it every...
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
A 512-bit hashcode.
struct GNUNET_CRYPTO_SymmetricSessionKey * shared_key
union GNUNET_MESSENGER_EpochIdentifier identifier
enum GNUNET_GenericReturnValue valid
enum GNUNET_GenericReturnValue stored
struct GNUNET_CRYPTO_SymmetricSessionKey * shared_key
struct GNUNET_MESSENGER_Epoch * epoch
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_CONTAINER_MultiShortmap * announcements
struct GNUNET_CONTAINER_MultiShortmap * groups
struct GNUNET_HashCode hash
GNUNET_MESSENGER_MessageCallback msg_callback
A room epoch key record specifies an epoch key for a given room that can be identified via a given ke...
struct GNUNET_ShortHashCode identifier
The short hash identifying the epoch or group key.
struct GNUNET_CRYPTO_SymmetricSessionKey shared_key
The shared epoch or group key in the room.
struct GNUNET_HashCode hash
The hash identifying the epoch.
enum GNUNET_GenericReturnValue opened
union GNUNET_MESSENGER_RoomKey key
struct GNUNET_CONTAINER_MultiHashMap * epochs
struct GNUNET_MESSENGER_ListTunnels entries
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:49
The identity of the host (wraps the signing key of the peer).
A 256-bit hashcode.
Time for absolute times used by GNUnet, in microseconds.
struct GNUNET_MQ_Handle * mq
Connection to VPN service.
Definition: vpn_api.c:44
An epoch identifier unifies an epoch identifier code and its 256bit hash representation.
struct GNUNET_MESSENGER_EpochIdentifierCode code