GNUnet 0.26.2-15-g4c7b9ce93
 
Loading...
Searching...
No Matches
gnunet-messenger.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2026 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 */
26#include <stdio.h>
27#include <unistd.h>
28
29#include "gnunet_common.h"
32#include "gnunet_util_lib.h"
33
36
37uint64_t waiting;
38
43
49static void
50delay_shutdown (void *cls)
51{
52 read_task = NULL;
53
54 if (waiting)
55 return;
56
58}
59
60
61static void
62idle (void *cls);
63
74static void
75on_message (void *cls,
76 struct GNUNET_MESSENGER_Room *room,
77 const struct GNUNET_MESSENGER_Contact *sender,
78 const struct GNUNET_MESSENGER_Contact *recipient,
79 const struct GNUNET_MESSENGER_Message *message,
80 const struct GNUNET_HashCode *hash,
82{
83 uint64_t waited;
84 const char *sender_name;
85 const char *recipient_name;
86
87 waited = waiting;
88
89 if (GNUNET_YES == talk_mode)
90 {
92 {
94 {
95 waiting = waiting > message->body.talk.length?
96 waiting - message->body.talk.length : 0;
97 }
98 else if ((GNUNET_YES != silence_flag) &&
99 (0 < write (1, message->body.talk.data,
100 message->body.talk.length)))
101 {
102 fflush (stdout);
103 }
104 }
105
106 goto skip_printing;
107 }
108 else
109 {
111 {
114
115 GNUNET_MESSENGER_get_message (room, &(message->header.previous));
116 }
117
119 goto skip_printing;
120 }
121
122 sender_name = GNUNET_MESSENGER_contact_get_name (sender);
123 recipient_name = GNUNET_MESSENGER_contact_get_name (recipient);
124
125 if (! sender_name)
126 sender_name = "anonymous";
127
128 if (! recipient_name)
129 recipient_name = "anonymous";
130
131 printf ("[%s ->", GNUNET_h2s (&(message->header.previous)));
132 printf (" %s]", GNUNET_h2s (hash));
133 printf ("[%s] ", GNUNET_sh2s (&(message->header.sender_id)));
134
136 printf ("*( '%s' ) ", recipient_name);
138 printf ("*(~) ");
139
140 switch (message->header.kind)
141 {
143 {
144 printf ("* '%s' joins the room!\n", sender_name);
145 break;
146 }
148 {
149 printf ("* '%s' leaves the room!\n", sender_name);
150 break;
151 }
153 {
154 printf ("* '%s' gets renamed to '%s'\n", sender_name,
155 message->body.name.name);
156 break;
157 }
159 {
160 printf ("* '%s' updates key!\n", sender_name);
161 break;
162 }
164 {
165 printf ("* '%s' opens the room on: %s\n", sender_name,
166 GNUNET_i2s_full (&(message->body.peer.peer)));
167 break;
168 }
170 {
171 printf ("* '%s' changes id to: %s\n", sender_name,
172 GNUNET_sh2s (&(message->body.id.id)));
173 break;
174 }
176 {
177 printf ("* '%s' misses peer: %s\n", sender_name,
178 GNUNET_i2s_full (&(message->body.miss.peer)));
179 break;
180 }
182 {
183 printf ("* '%s' merges: ", sender_name);
184 printf ("[%s ->", GNUNET_h2s (&(message->body.merge.previous)));
185 printf (" %s]\n", GNUNET_h2s (hash));
186 break;
187 }
189 {
190 printf ("* '%s' requests: [%s]\n", sender_name,
191 GNUNET_h2s (&(message->body.request.hash)));
192 break;
193 }
195 {
196 printf ("* '%s' invites to chat on: %s %s\n", sender_name,
197 GNUNET_i2s_full (&(message->body.invite.door)),
198 GNUNET_h2s_full (&(message->body.invite.key.hash)));
199 break;
200 }
202 {
203 uint16_t len;
204
205 if (message->body.text.text)
206 len = strlen (message->body.text.text) + 1;
207 else
208 len = 0;
209
210 if (flags & GNUNET_MESSENGER_FLAG_SENT)
211 {
212 waiting = waiting > len? waiting - len : 0;
213
214 printf (">");
215 }
216 else
217 printf ("<");
218
219 if (message->body.text.text)
220 printf (" '%s' says: \"%s\"\n", sender_name,
221 message->body.text.text);
222 else
223 printf (" '%s' mumbles\n", sender_name);
224 break;
225 }
227 {
228 if (flags & GNUNET_MESSENGER_FLAG_SENT)
229 printf (">");
230 else
231 printf ("<");
232
233 printf (" '%s' shares: \"%s\"\n%s\n", sender_name,
234 message->body.file.name, message->body.file.uri);
235 break;
236 }
238 {
239 if (flags & GNUNET_MESSENGER_FLAG_SENT)
240 printf (">");
241 else
242 printf ("<");
243
244 printf (" '%s' whispers\n", sender_name);
245 break;
246 }
248 {
249 printf ("* '%s' deletes: [%s]\n", sender_name,
250 GNUNET_h2s (&(message->body.deletion.hash)));
251 break;
252 }
254 {
255 printf ("* '%s' updates connection details: %u, %x\n",
256 sender_name,
257 message->body.connection.amount,
258 message->body.connection.flags);
259 break;
260 }
262 {
263 printf ("* '%s' provides ticket: %s\n", sender_name,
264 message->body.ticket.identifier);
265 break;
266 }
268 {
269 if (flags & GNUNET_MESSENGER_FLAG_SENT)
270 printf (">");
271 else
272 printf ("<");
273
274 if (message->body.tag.tag)
275 printf (" '%s' tags [%s] with: \"%s\"\n", sender_name,
276 GNUNET_h2s (&(message->body.tag.hash)),
277 message->body.tag.tag);
278 else
279 printf (" '%s' blocks [%s]\n", sender_name,
280 GNUNET_h2s (&(message->body.tag.hash)));
281 break;
282 }
284 {
285 printf ("* '%s' subscribes: %s\n", sender_name,
286 GNUNET_sh2s (&(message->body.subscription.discourse)));
287 break;
288 }
290 {
291 printf ("* '%s' talks %u bytes in: %s\n", sender_name,
292 message->body.talk.length,
293 GNUNET_sh2s (&(message->body.talk.discourse)));
294 break;
295 }
297 {
298 printf ("* '%s' announces epoch key [%s]%s\n", sender_name,
301 " of group" : "");
302 break;
303 }
305 {
306 if (flags & GNUNET_MESSENGER_FLAG_SENT)
307 printf (">");
308 else
309 printf ("<");
310
311 printf (" '%s' whispers towards: %s\n", sender_name,
312 GNUNET_sh2s (&(message->body.secret.identifier.hash)));
313 break;
314 }
316 {
317 printf ("* '%s' appeals the epoch key from: %s\n", sender_name,
318 GNUNET_h2s (&(message->body.appeal.event)));
319 break;
320 }
322 {
323 printf ("* '%s' grants access to: %s\n", sender_name,
324 GNUNET_h2s (&(message->body.access.event)));
325 break;
326 }
328 {
329 printf ("* '%s' revolutionizes the epoch key [%s]%s\n", sender_name,
332 " of group" : "");
333 break;
334 }
336 {
337 printf ("* '%s' proposes group [%s] of { %s", sender_name,
338 GNUNET_sh2s (&(message->body.group.identifier.hash)),
339 GNUNET_h2s (&(message->body.group.initiator)));
340 printf (", %s }\n",
341 GNUNET_h2s (&(message->body.group.partner)));
342 break;
343 }
345 {
346 printf ("* '%s' authorizes group [%s] to: %s\n", sender_name,
348 GNUNET_h2s (&(message->body.authorization.event)));
349 break;
350 }
351 default:
352 {
353 printf ("~ message: %s\n",
355 break;
356 }
357 }
358
359skip_printing:
360 if ((! read_task) && (! waiting) && (waited))
363 delay_shutdown, NULL);
364
365 if ((GNUNET_MESSENGER_KIND_JOIN == message->header.kind) &&
367 {
369 const char *name;
370
371 if (! read_task)
374 idle, room);
375
377
378 if (! name)
379 return;
380
382 response.body.name.name = GNUNET_strdup (name);
383
385
386 GNUNET_free (response.body.name.name);
387
388 if (GNUNET_YES != talk_mode)
389 return;
390
392 response.body.subscription.flags =
394 response.body.subscription.time =
396
397 memset (&(response.body.subscription.discourse), 0,
398 sizeof(response.body.subscription.discourse));
399
401 }
402}
403
404
406
412static void
413shutdown_hook (void *cls)
414{
415 struct GNUNET_MESSENGER_Room *room;
416
417 GNUNET_assert (cls);
418
419 room = cls;
420
421 if (read_task)
423
424 if (room)
426
427 if (messenger)
429
430 if (ego_lookup)
432}
433
434
435static void
436listen_stdio (void *cls);
437
438#define MAX_BUFFER_SIZE 57345
439
440static int
442 struct GNUNET_MESSENGER_Room *room,
443 const struct GNUNET_MESSENGER_Contact *contact)
444{
445 struct GNUNET_MESSENGER_Message *message;
446
447 GNUNET_assert ((cls) && (room) && (contact));
448
449 message = cls;
450
452 GNUNET_MESSENGER_send_message (room, message, contact);
453
454 return GNUNET_YES;
455}
456
457
459
465static void
466read_stdio (void *cls)
467{
468 struct GNUNET_MESSENGER_Room *room;
469 struct GNUNET_MESSENGER_Message message;
470 char buffer[MAX_BUFFER_SIZE];
471 ssize_t length;
472
473 GNUNET_assert (cls);
474
475 room = cls;
476 read_task = NULL;
477
478 length = read (0, buffer, MAX_BUFFER_SIZE - 1);
479
480 if ((length <= 0) || (length >= MAX_BUFFER_SIZE))
481 {
482 delay_shutdown (NULL);
483 return;
484 }
485
486 waiting += length;
487
488 if (GNUNET_YES == talk_mode)
489 {
491 message.body.talk.length = length;
492 message.body.talk.data = buffer;
493
494 memset (&(message.body.talk.discourse), 0,
495 sizeof(message.body.talk.discourse));
496 }
497 else
498 {
499 if (buffer[length - 1] == '\n')
500 buffer[length - 1] = '\0';
501 else
502 buffer[length] = '\0';
503
505 message.body.text.text = buffer;
506 }
507
510 &message);
511 else
512 GNUNET_MESSENGER_send_message (room, &message, NULL);
513
515}
516
517
523static void
539
540
546static void
547idle (void *cls)
548{
549 struct GNUNET_MESSENGER_Room *room;
550
551 GNUNET_assert (cls);
552
553 room = cls;
554
555 if ((GNUNET_YES != talk_mode) ||
557 printf ("* You joined the room.\n");
558
560}
561
562
567
569
571
578static void
579on_identity (void *cls,
581{
583 struct GNUNET_MESSENGER_Room *room;
584 struct GNUNET_PeerIdentity door_peer;
585 struct GNUNET_PeerIdentity *door;
586 const char *name;
587
589 &key,
590 room_key,
593 GNUNET_NO);
594
595 door = NULL;
596
597 if ((door_id) &&
599 strlen (
600 door_id),
601 &(door_peer.
602 public_key))))
603 door = &door_peer;
604
605 if ((GNUNET_YES == talk_mode) ||
607 goto skip_welcome;
608
610
611 if (! name)
612 name = "anonymous";
613
614 printf ("* Welcome to the messenger, '%s'!\n", name);
615
616skip_welcome:
617 if (door)
618 {
619 if ((GNUNET_YES != talk_mode) ||
621 printf ("* You try to entry a room...\n");
622
624 }
625 else
626 {
627 if ((GNUNET_YES != talk_mode) ||
629 printf ("* You try to open a room...\n");
630
632 }
633
635
637
638 waiting = 0;
639
640 if (! room)
642 else
643 read_task = NULL;
644}
645
646
647static void
648on_ego_lookup (void *cls,
649 struct GNUNET_IDENTITY_Ego *ego)
650{
652 struct GNUNET_HashCode secret;
653
654 ego_lookup = NULL;
655
656 key = ego ? GNUNET_IDENTITY_ego_get_private_key (ego) : NULL;
657
658 if (secret_value)
660
662 secret_value? &secret : NULL,
663 &on_message, NULL);
664
665 on_identity (NULL, messenger);
666}
667
668
677static void
678run (void *cls,
679 char *const *args,
680 const char *cfgfile,
681 const struct GNUNET_CONFIGURATION_Handle *cfg)
682{
683 config = cfg;
684
685 if (ego_name)
686 {
688 &on_ego_lookup, NULL);
689 messenger = NULL;
690 }
691 else
692 {
693 ego_lookup = NULL;
694 messenger = GNUNET_MESSENGER_connect (cfg, NULL, NULL, NULL,
695 &on_message, NULL);
696 }
697
699
700 if (messenger)
701 on_identity (NULL, messenger);
702}
703
704
712int
713main (int argc,
714 char **argv)
715{
716 const char *description =
717 "Open and connect to rooms using the MESSENGER to chat.";
718
720 GNUNET_GETOPT_option_string ('d', "door", "PEERIDENTITY",
721 "peer identity to entry into the room",
722 &door_id),
723 GNUNET_GETOPT_option_string ('e', "ego", "IDENTITY",
724 "identity to use for messaging",
725 &ego_name),
726 GNUNET_GETOPT_option_string ('r', "room", "ROOMKEY",
727 "key of the room to connect to",
728 &room_key),
729 GNUNET_GETOPT_option_flag ('p', "private", "flag to enable private mode",
730 &private_mode),
731 GNUNET_GETOPT_option_flag ('s', "silence",
732 "flag to silence all others to send only",
733 &silence_flag),
734 GNUNET_GETOPT_option_flag ('R', "request",
735 "flag to enable requesting older messages",
736 &request_flag),
737 GNUNET_GETOPT_option_flag ('t', "talk", "flag to enable talk mode",
738 &talk_mode),
739 GNUNET_GETOPT_option_flag ('P', "public", "flag to disable forward secrecy",
740 &public_mode),
741 GNUNET_GETOPT_option_string ('S', "secret", "SECRET",
742 "storage secret for local keys",
743 &secret_value),
745 };
746
747 return (GNUNET_OK ==
749 argc,
750 argv,
751 "gnunet-messenger\0",
753 &run,
754 NULL) ? EXIT_SUCCESS : EXIT_FAILURE);
755}
struct GNUNET_GETOPT_CommandLineOption options[]
Definition 002.c:5
int main()
Program to simulate results from GCP_get_desirability_of_path() for various plausible inputs.
#define gettext_noop(String)
Definition gettext.h:74
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
static void listen_stdio(void)
Wait for input on STDIO and send it out over the ch.
static struct MHD_Response * response
Our canonical response.
struct GNUNET_HashCode key
The key used in the DHT.
static void on_identity(void *cls, struct GNUNET_MESSENGER_Handle *handle)
Function called when an identity is retrieved.
int public_mode
static void delay_shutdown(void *cls)
Delay forced shutdown by input to wait for data processing.
int talk_mode
char * secret_value
uint64_t waiting
static void idle(void *cls)
Initial task to startup application.
static void read_stdio(void *cls)
Task run in stdio mode, after some data is available at stdin.
struct GNUNET_MESSENGER_Handle * messenger
char * door_id
char * ego_name
struct GNUNET_IDENTITY_EgoLookup * ego_lookup
struct GNUNET_SCHEDULER_Task * read_task
int private_mode
const struct GNUNET_CONFIGURATION_Handle * config
static int iterate_send_private_message(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
struct GNUNET_SCHEDULER_Task * shutdown_task
char * room_key
int silence_flag
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
int request_flag
#define MAX_BUFFER_SIZE
static void on_ego_lookup(void *cls, struct GNUNET_IDENTITY_Ego *ego)
static void shutdown_hook(void *cls)
Task to shut down this application.
static void on_message(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)
Function called whenever a message is received or sent.
static char * name
Name (label) of the records to list.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Identity service; implements identity management for GNUnet.
#define GNUNET_GETOPT_OPTION_END
Marker for the end of the list of options.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
#define GNUNET_CRYPTO_hash_from_string(enc, result)
Convert ASCII encoding back to struct GNUNET_HashCode
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
const struct GNUNET_CRYPTO_BlindablePrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_public_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a string representing a public key to a public key.
Definition crypto_ecc.c:361
@ GNUNET_SCHEDULER_PRIORITY_IDLE
Run when otherwise idle.
@ GNUNET_SCHEDULER_PRIORITY_DEFAULT
Run with the default priority (normal P2P operations).
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
const char * GNUNET_h2s_full(const struct GNUNET_HashCode *hc)
Convert a 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_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity 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).
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_HashCode *secret, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Set up a handle for the messenger related functions and connects to all necessary services.
int GNUNET_MESSENGER_iterate_members(struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Iterates through all members of a given room and calls a selected callback for each of them with a pr...
const char * GNUNET_MESSENGER_name_of_kind(enum GNUNET_MESSENGER_MessageKind kind)
Get the name of a message kind.
GNUNET_MESSENGER_MessageFlags
Enum for the different supported flags used by message handling.
const char * GNUNET_MESSENGER_contact_get_name(const struct GNUNET_MESSENGER_Contact *contact)
Get the name used by the contact.
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_enter_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const union GNUNET_MESSENGER_RoomKey *key)
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.
const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_contact_get_key(const struct GNUNET_MESSENGER_Contact *contact)
Get the public key used by the contact or NULL if the anonymous key was used.
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room(struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key)
Open a room to send and receive messages.
const struct GNUNET_MESSENGER_Message * GNUNET_MESSENGER_get_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the message in a room identified by its hash and requests it if necessary.
void GNUNET_MESSENGER_disconnect(struct GNUNET_MESSENGER_Handle *handle)
Disconnect all of the messengers used services and clears up its used memory.
const char * GNUNET_MESSENGER_get_name(const struct GNUNET_MESSENGER_Handle *handle)
Get the name (if specified, otherwise NULL) used by the messenger.
void GNUNET_MESSENGER_close_room(struct GNUNET_MESSENGER_Room *room)
Close a room which was entered, opened or both in various order and variety.
void GNUNET_MESSENGER_send_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact)
Send a message into a room.
void GNUNET_MESSENGER_create_room_key(union GNUNET_MESSENGER_RoomKey *key, const char *input, enum GNUNET_GenericReturnValue is_public, enum GNUNET_GenericReturnValue is_group, enum GNUNET_GenericReturnValue is_feed)
Creates a room key from given optional input string using certain properties for this targeted room.
@ GNUNET_MESSENGER_KIND_MISS
The miss kind.
@ GNUNET_MESSENGER_KIND_INVITE
The invite kind.
@ GNUNET_MESSENGER_KIND_AUTHORIZATION
The authorization kind.
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
@ GNUNET_MESSENGER_KIND_PRIVATE
The private kind.
@ GNUNET_MESSENGER_KIND_TAG
The tag kind.
@ GNUNET_MESSENGER_KIND_FILE
The file kind.
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
@ GNUNET_MESSENGER_KIND_REQUEST
The request kind.
@ GNUNET_MESSENGER_KIND_NAME
The name kind.
@ GNUNET_MESSENGER_KIND_ACCESS
The access kind.
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_TALK
The talk kind.
@ GNUNET_MESSENGER_KIND_REVOLUTION
The revolution kind.
@ GNUNET_MESSENGER_KIND_PEER
The peer kind.
@ GNUNET_MESSENGER_KIND_KEY
The key kind.
@ GNUNET_MESSENGER_KIND_TEXT
The text kind.
@ GNUNET_MESSENGER_KIND_SECRET
The secret kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_KIND_SUBSCRIBTION
The subscription kind.
@ GNUNET_MESSENGER_KIND_DELETION
The deletion kind.
@ GNUNET_MESSENGER_KIND_CONNECTION
The connection kind.
@ GNUNET_MESSENGER_KIND_TICKET
The ticket kind.
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
@ GNUNET_MESSENGER_KIND_GROUP
The group kind.
@ GNUNET_MESSENGER_KIND_ID
The id kind.
@ GNUNET_MESSENGER_FLAG_SECRET
The secret flag.
@ GNUNET_MESSENGER_FLAG_PRIVATE
The private flag.
@ GNUNET_MESSENGER_FLAG_SENT
The sent flag.
@ GNUNET_MESSENGER_FLAG_SUBSCRIPTION_KEEP_ALIVE
The keep alive flag.
void GNUNET_NETWORK_fdset_destroy(struct GNUNET_NETWORK_FDSet *fds)
Releases the associated memory of an fd set.
Definition network.c:1185
struct GNUNET_NETWORK_FDSet * GNUNET_NETWORK_fdset_create(void)
Creates an fd set.
Definition network.c:1169
void GNUNET_NETWORK_fdset_set_native(struct GNUNET_NETWORK_FDSet *to, int nfd)
Set a native fd in a set.
Definition network.c:1058
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition program.c:407
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition scheduler.c:567
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_select(enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when any of the specified file descriptor set...
Definition scheduler.c:1835
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition scheduler.c:1339
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:980
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition scheduler.c:1304
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_with_priority(enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified priority.
Definition scheduler.c:1231
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_second_(void)
Return relative time of 1s.
Definition time.c:169
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
Definition time.c:616
A private key for an identity as per LSD0001.
Definition of a command line option.
const char * description
Help text for the option (description)
A 512-bit hashcode.
Handle for ego lookup.
Handle for an ego.
Definition identity.h:37
struct GNUNET_HashCode event
The hash of the linked announcement or group message event.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_HashCode event
The hash of the linked announcement message event.
struct GNUNET_HashCode event
The hash of the linked group message event.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
struct GNUNET_MESSENGER_MessageGroup group
struct GNUNET_MESSENGER_MessageSecret secret
struct GNUNET_MESSENGER_MessageDeletion deletion
struct GNUNET_MESSENGER_MessageConnection connection
struct GNUNET_MESSENGER_MessageText text
struct GNUNET_MESSENGER_MessageRequest request
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_MESSENGER_MessageId id
struct GNUNET_MESSENGER_MessageName name
struct GNUNET_MESSENGER_MessageRevolution revolution
struct GNUNET_MESSENGER_MessageTalk talk
struct GNUNET_MESSENGER_MessageFile file
struct GNUNET_MESSENGER_MessageTag tag
struct GNUNET_MESSENGER_MessageInvite invite
struct GNUNET_MESSENGER_MessageAccess access
struct GNUNET_MESSENGER_MessageSubscribtion subscription
struct GNUNET_MESSENGER_MessageAuthorization authorization
struct GNUNET_MESSENGER_MessageAppeal appeal
struct GNUNET_MESSENGER_MessageMiss miss
struct GNUNET_MESSENGER_MessagePeer peer
struct GNUNET_MESSENGER_MessageTicket ticket
uint32_t amount
The amount of connections of a peer.
uint32_t flags
The flags about the connections of a peer.
struct GNUNET_HashCode hash
The hash of the message to delete.
char * uri
The uri of the encrypted file.
char name[NAME_MAX]
The name of the original file.
struct GNUNET_HashCode initiator
The hash of the initiator group announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_HashCode partner
The hash of the partner group announcement.
struct GNUNET_HashCode previous
The hash of the previous message from the senders perspective.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_ShortHashCode id
The new id which will replace the senders id in a room.
union GNUNET_MESSENGER_RoomKey key
The hash identifying the port of the room.
struct GNUNET_PeerIdentity door
The peer identity of an open door to a room.
struct GNUNET_HashCode previous
The hash of a second previous message.
struct GNUNET_PeerIdentity peer
The peer identity of a disconnected door to a room.
char * name
The new name which replaces the current senders name.
struct GNUNET_PeerIdentity peer
The peer identity of the sender opening a room.
struct GNUNET_HashCode hash
The hash of the requested message.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_ShortHashCode discourse
The hash of the discourse to subscription.
struct GNUNET_HashCode hash
The hash of the message to tag.
uint16_t length
The length of the talk message data.
char * data
The data of the talk message.
struct GNUNET_ShortHashCode discourse
The hash of the discourse to talk.
char * identifier
The identifier of a ticket.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.
collection of IO descriptors
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Entry in list of pending tasks.
Definition scheduler.c:136
struct GNUNET_MESSENGER_EpochIdentifierCode code
A room key unifies a room key code and its 512bit hash representation.