GNUnet 0.21.1
gnunet-messenger.c File Reference
#include "platform.h"
#include <stdio.h>
#include "gnunet_util_lib.h"
#include "gnunet_messenger_service.h"
Include dependency graph for gnunet-messenger.c:

Go to the source code of this file.

Macros

#define MAX_BUFFER_SIZE   60000
 

Functions

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. More...
 
static void shutdown_hook (void *cls)
 Task to shut down this application. More...
 
static void listen_stdio (void *cls)
 Wait for input on STDIO and send it out over the ch. More...
 
static int iterate_send_private_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
 
static void read_stdio (void *cls)
 Task run in stdio mode, after some data is available at stdin. More...
 
static void idle (void *cls)
 Initial task to startup application. More...
 
static void on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
 Function called when an identity is retrieved. More...
 
static void on_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 
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. More...
 
int main (int argc, char **argv)
 The main function to obtain messenger information. More...
 

Variables

const struct GNUNET_CONFIGURATION_Handleconfig
 
struct GNUNET_MESSENGER_Handlemessenger
 
struct GNUNET_SCHEDULER_Taskread_task
 
struct GNUNET_IDENTITY_EgoLookupego_lookup
 
int private_mode
 
char * door_id
 
char * ego_name
 
char * room_key
 
struct GNUNET_SCHEDULER_Taskshutdown_task
 

Macro Definition Documentation

◆ MAX_BUFFER_SIZE

#define MAX_BUFFER_SIZE   60000

Definition at line 161 of file gnunet-messenger.c.

Function Documentation

◆ on_message()

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.

Parameters
[in,out]clsClosure
[in]roomRoom
[in]senderSender of message
[in]messageMessage
[in]hashHash of message
[in]flagsFlags of message

Definition at line 46 of file gnunet-messenger.c.

53{
54 const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender);
55 const char *recipient_name = GNUNET_MESSENGER_contact_get_name (recipient);
56
57 if (! sender_name)
58 sender_name = "anonymous";
59
60 if (! recipient_name)
61 recipient_name = "anonymous";
62
63 printf ("[%s ->", GNUNET_h2s (&(message->header.previous)));
64 printf (" %s]", GNUNET_h2s (hash));
65 printf ("[%s] ", GNUNET_sh2s (&(message->header.sender_id)));
66
68 printf ("*( '%s' ) ", recipient_name);
69
70 switch (message->header.kind)
71 {
73 {
74 printf ("* '%s' joined the room!\n", sender_name);
75 break;
76 }
78 {
79 printf ("* '%s' gets renamed to '%s'\n", sender_name,
80 message->body.name.name);
81 break;
82 }
84 {
85 printf ("* '%s' leaves the room!\n", sender_name);
86 break;
87 }
89 {
90 printf ("* '%s' opened the room on: %s\n", sender_name,
91 GNUNET_i2s_full (&(message->body.peer.peer)));
92 break;
93 }
95 {
97 printf (">");
98 else
99 printf ("<");
100
101 printf (" '%s' says: \"%s\"\n", sender_name, message->body.text.text);
102 break;
103 }
104 default:
105 {
106 printf ("~ message: %s\n",
108 break;
109 }
110 }
111
112 if ((GNUNET_MESSENGER_KIND_JOIN == message->header.kind) &&
114 {
116
117 if (! name)
118 return;
119
122 response.body.name.name = GNUNET_strdup (name);
123
125
126 GNUNET_free (response.body.name.name);
127 }
128}
static struct MHD_Response * response
Our canonical response.
struct GNUNET_MESSENGER_Handle * messenger
static char * name
Name (label) of the records to list.
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.
const char * GNUNET_MESSENGER_name_of_kind(enum GNUNET_MESSENGER_MessageKind kind)
Get the name of a message kind.
Definition: messenger_api.c:43
const char * GNUNET_MESSENGER_contact_get_name(const struct GNUNET_MESSENGER_Contact *contact)
Get the name used by the contact.
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_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.
@ GNUNET_MESSENGER_KIND_NAME
The name kind.
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_PEER
The peer kind.
@ GNUNET_MESSENGER_KIND_TEXT
The text kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_FLAG_PRIVATE
The private flag.
@ GNUNET_MESSENGER_FLAG_SENT
The sent flag.
struct GNUNET_MESSENGER_MessageText text
struct GNUNET_MESSENGER_MessageName name
struct GNUNET_MESSENGER_MessagePeer peer
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.
char * name
The new name which replaces the current senders name.
struct GNUNET_PeerIdentity peer
The peer identity of the sender opening a room.
char * text
The containing text.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.

References GNUNET_MESSENGER_Message::body, GNUNET_free, GNUNET_h2s(), GNUNET_i2s_full(), GNUNET_MESSENGER_contact_get_name(), GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_get_name(), GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_NAME, GNUNET_MESSENGER_KIND_PEER, GNUNET_MESSENGER_KIND_TEXT, GNUNET_MESSENGER_name_of_kind(), GNUNET_MESSENGER_send_message(), GNUNET_sh2s(), GNUNET_strdup, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, messenger, name, GNUNET_MESSENGER_MessageName::name, GNUNET_MESSENGER_MessageBody::name, GNUNET_MESSENGER_MessagePeer::peer, GNUNET_MESSENGER_MessageBody::peer, GNUNET_MESSENGER_MessageHeader::previous, response, GNUNET_MESSENGER_MessageHeader::sender_id, GNUNET_MESSENGER_MessageText::text, and GNUNET_MESSENGER_MessageBody::text.

Referenced by on_ego_lookup(), and run().

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

◆ shutdown_hook()

static void shutdown_hook ( void *  cls)
static

Task to shut down this application.

Parameters
[in,out]clsClosure

Definition at line 140 of file gnunet-messenger.c.

141{
142 struct GNUNET_MESSENGER_Room *room = cls;
143
144 if (read_task)
146
147 if (room)
149
150 if (messenger)
152
153 if (ego_lookup)
155}
struct GNUNET_IDENTITY_EgoLookup * ego_lookup
struct GNUNET_SCHEDULER_Task * read_task
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
void GNUNET_MESSENGER_disconnect(struct GNUNET_MESSENGER_Handle *handle)
Disconnect all of the messengers used services and clears up its used memory.
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_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:981

References ego_lookup, GNUNET_IDENTITY_ego_lookup_cancel(), GNUNET_MESSENGER_close_room(), GNUNET_MESSENGER_disconnect(), GNUNET_SCHEDULER_cancel(), messenger, and read_task.

Referenced by on_identity(), and run().

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

◆ listen_stdio()

static void listen_stdio ( void *  cls)
static

Wait for input on STDIO and send it out over the ch.

Parameters
[in,out]clsClosure

Definition at line 227 of file gnunet-messenger.c.

228{
229 read_task = NULL;
230
232
234
237 NULL, &read_stdio, cls);
238
240}
static void read_stdio(void *cls)
Task run in stdio mode, after some data is available at stdin.
@ GNUNET_SCHEDULER_PRIORITY_DEFAULT
Run with the default priority (normal P2P operations).
void GNUNET_NETWORK_fdset_destroy(struct GNUNET_NETWORK_FDSet *fds)
Releases the associated memory of an fd set.
Definition: network.c:1186
struct GNUNET_NETWORK_FDSet * GNUNET_NETWORK_fdset_create(void)
Creates an fd set.
Definition: network.c:1170
void GNUNET_NETWORK_fdset_set_native(struct GNUNET_NETWORK_FDSet *to, int nfd)
Set a native fd in a set.
Definition: network.c:1057
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:1836
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
collection of IO descriptors

References GNUNET_NETWORK_fdset_create(), GNUNET_NETWORK_fdset_destroy(), GNUNET_NETWORK_fdset_set_native(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_PRIORITY_DEFAULT, GNUNET_TIME_UNIT_FOREVER_REL, read_stdio(), and read_task.

Referenced by idle(), and read_stdio().

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

◆ iterate_send_private_message()

static int iterate_send_private_message ( void *  cls,
struct GNUNET_MESSENGER_Room room,
const struct GNUNET_MESSENGER_Contact contact 
)
static

Definition at line 164 of file gnunet-messenger.c.

167{
168 struct GNUNET_MESSENGER_Message *message = cls;
169
171 GNUNET_MESSENGER_send_message (room, message, contact);
172
173 return GNUNET_YES;
174}
@ GNUNET_YES
const struct GNUNET_CRYPTO_PublicKey * 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.

References GNUNET_MESSENGER_contact_get_key(), GNUNET_MESSENGER_send_message(), and GNUNET_YES.

Referenced by read_stdio().

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

◆ read_stdio()

static void read_stdio ( void *  cls)
static

Task run in stdio mode, after some data is available at stdin.

Parameters
[in,out]clsClosure

Definition at line 185 of file gnunet-messenger.c.

186{
187 read_task = NULL;
188
189 char buffer[MAX_BUFFER_SIZE];
190 ssize_t length;
191
192 length = read (0, buffer, MAX_BUFFER_SIZE);
193
194 if ((length <= 0) || (length >= MAX_BUFFER_SIZE))
195 {
197 return;
198 }
199
200 if (buffer[length - 1] == '\n')
201 buffer[length - 1] = '\0';
202 else
203 buffer[length] = '\0';
204
205 struct GNUNET_MESSENGER_Room *room = cls;
206
207 struct GNUNET_MESSENGER_Message message;
209 message.body.text.text = buffer;
210
213 &message);
214 else
215 GNUNET_MESSENGER_send_message (room, &message, NULL);
216
218}
static void listen_stdio(void *cls)
Wait for input on STDIO and send it out over the ch.
int private_mode
static int iterate_send_private_message(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
#define MAX_BUFFER_SIZE
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...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:567
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:1305

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_iterate_members(), GNUNET_MESSENGER_KIND_TEXT, GNUNET_MESSENGER_send_message(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, GNUNET_MESSENGER_Message::header, iterate_send_private_message(), GNUNET_MESSENGER_MessageHeader::kind, listen_stdio(), MAX_BUFFER_SIZE, private_mode, read_task, GNUNET_MESSENGER_MessageText::text, and GNUNET_MESSENGER_MessageBody::text.

Referenced by listen_stdio().

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

◆ idle()

static void idle ( void *  cls)
static

Initial task to startup application.

Parameters
[in,out]clsClosure

Definition at line 249 of file gnunet-messenger.c.

250{
251 struct GNUNET_MESSENGER_Room *room = cls;
252
253 printf ("* You joined the room.\n");
254
256}

References GNUNET_SCHEDULER_add_now(), listen_stdio(), and read_task.

Referenced by on_identity().

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

◆ on_identity()

static void on_identity ( void *  cls,
struct GNUNET_MESSENGER_Handle handle 
)
static

Function called when an identity is retrieved.

Parameters
[in,out]clsClosure
[in,out]handleHandle of messenger service

Definition at line 272 of file gnunet-messenger.c.

274{
275 struct GNUNET_HashCode key;
276 memset (&key, 0, sizeof(key));
277
278 if (room_key)
280
281 struct GNUNET_PeerIdentity door_peer;
282 struct GNUNET_PeerIdentity *door = NULL;
283
284 if ((door_id) &&
286 strlen (
287 door_id),
288 &(door_peer.
289 public_key))))
290 door = &door_peer;
291
292 const char *name = GNUNET_MESSENGER_get_name (handle);
293
294 if (! name)
295 name = "anonymous";
296
297 printf ("* Welcome to the messenger, '%s'!\n", name);
298
299 struct GNUNET_MESSENGER_Room *room;
300
301 if (door)
302 {
303 printf ("* You try to entry a room...\n");
304
306 }
307 else
308 {
309 printf ("* You try to open a room...\n");
310
312 }
313
315
317
318 if (! room)
320 else
321 {
325 idle, room);
326 }
327}
struct GNUNET_HashCode key
The key used in the DHT.
static void idle(void *cls)
Initial task to startup application.
char * door_id
struct GNUNET_SCHEDULER_Task * shutdown_task
char * room_key
static void shutdown_hook(void *cls)
Task to shut down this application.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
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
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:358
@ GNUNET_SCHEDULER_PRIORITY_IDLE
Run when otherwise idle.
@ GNUNET_OK
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Open a room to send and receive messages.
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_enter_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.
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:1340
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed_with_priority(struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1208
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero_(void)
Return relative time of 0ms.
Definition: time.c:133
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key

References door_id, GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_CRYPTO_hash(), GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_get_name(), GNUNET_MESSENGER_open_room(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed_with_priority(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_PRIORITY_IDLE, GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_relative_get_zero_(), handle, idle(), key, messenger, name, GNUNET_PeerIdentity::public_key, room_key, shutdown_hook(), and shutdown_task.

Referenced by on_ego_lookup(), and run().

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

◆ on_ego_lookup()

static void on_ego_lookup ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Definition at line 331 of file gnunet-messenger.c.

333{
334 ego_lookup = NULL;
335
336 const struct GNUNET_CRYPTO_PrivateKey *key;
337 key = ego ? GNUNET_IDENTITY_ego_get_private_key (ego) : NULL;
338
340 NULL);
341
342 on_identity (NULL, messenger);
343}
static void on_identity(void *cls, struct GNUNET_MESSENGER_Handle *handle)
Function called when an identity is retrieved.
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.
char * ego_name
const struct GNUNET_CONFIGURATION_Handle * config
const struct GNUNET_CRYPTO_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:517
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_PrivateKey *key, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Set up a handle for the messenger related functions and connects to all necessary services.
A private key for an identity as per LSD0001.

References config, ego_lookup, ego_name, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_MESSENGER_connect(), key, messenger, on_identity(), and on_message().

Referenced by run().

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

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Main function that will be run by the scheduler.

Parameters
[in/out]cls closure
[in]argsremaining command-line arguments
[in]cfgfilename of the configuration file used (for saving, can be NULL!)
[in]cfgconfiguration

Definition at line 355 of file gnunet-messenger.c.

359{
360 config = cfg;
361
362 if (ego_name)
363 {
365 NULL);
366 messenger = NULL;
367 }
368 else
369 {
370 ego_lookup = NULL;
371 messenger = GNUNET_MESSENGER_connect (cfg, NULL, NULL, &on_message, NULL);
372 }
373
375
376 if (messenger)
377 on_identity (NULL, messenger);
378}
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
static void on_ego_lookup(void *cls, struct GNUNET_IDENTITY_Ego *ego)
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.

References cfg, config, ego_lookup, ego_name, GNUNET_IDENTITY_ego_lookup(), GNUNET_MESSENGER_connect(), GNUNET_SCHEDULER_add_shutdown(), messenger, on_ego_lookup(), on_identity(), on_message(), shutdown_hook(), and shutdown_task.

Referenced by main().

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

◆ main()

int main ( int  argc,
char **  argv 
)

The main function to obtain messenger information.

Parameters
[in]argcnumber of arguments from the command line
[in]argvcommand line arguments
Returns
#EXIT_SUCCESS ok, #EXIT_FAILURE on error

Definition at line 389 of file gnunet-messenger.c.

391{
392 const char *description =
393 "Open and connect to rooms using the MESSENGER to chat.";
394
396 GNUNET_GETOPT_option_string ('d', "door", "PEERIDENTITY",
397 "peer identity to entry into the room",
398 &door_id),
399 GNUNET_GETOPT_option_string ('e', "ego", "IDENTITY",
400 "identity to use for messaging",
401 &ego_name),
402 GNUNET_GETOPT_option_string ('r', "room", "ROOMKEY",
403 "key of the room to connect to",
404 &room_key),
405 GNUNET_GETOPT_option_flag ('p', "private", "flag to enable private mode",
406 &private_mode),
408 };
409
410 return (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "gnunet-messenger\0",
412 &run,
413 NULL) ? EXIT_SUCCESS : EXIT_FAILURE);
414}
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:70
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.
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.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(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:400
Definition of a command line option.
const char * description
Help text for the option (description)

References GNUNET_GETOPT_CommandLineOption::description, door_id, ego_name, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), options, private_mode, room_key, and run().

Here is the call graph for this function:

Variable Documentation

◆ config

◆ messenger

struct GNUNET_MESSENGER_Handle* messenger

Definition at line 33 of file gnunet-messenger.c.

Referenced by on_ego_lookup(), on_identity(), on_message(), run(), and shutdown_hook().

◆ read_task

struct GNUNET_SCHEDULER_Task* read_task

Definition at line 131 of file gnunet-messenger.c.

Referenced by idle(), listen_stdio(), proto_read_kx(), read_stdio(), and shutdown_hook().

◆ ego_lookup

struct GNUNET_IDENTITY_EgoLookup* ego_lookup

Definition at line 132 of file gnunet-messenger.c.

Referenced by on_ego_lookup(), run(), and shutdown_hook().

◆ private_mode

int private_mode

Definition at line 177 of file gnunet-messenger.c.

Referenced by main(), and read_stdio().

◆ door_id

char* door_id

Definition at line 259 of file gnunet-messenger.c.

Referenced by main(), and on_identity().

◆ ego_name

char* ego_name

Definition at line 260 of file gnunet-messenger.c.

Referenced by identity_zone_cb(), main(), on_ego_lookup(), and run().

◆ room_key

char* room_key

Definition at line 261 of file gnunet-messenger.c.

Referenced by GNUNET_MESSENGER_cmd_join_room(), main(), and on_identity().

◆ shutdown_task

struct GNUNET_SCHEDULER_Task* shutdown_task

Definition at line 263 of file gnunet-messenger.c.

Referenced by continuation_print(), on_identity(), and run().