Print information about messenger groups. More...
#include "platform.h"
#include <stdio.h>
#include "gnunet_util_lib.h"
#include "gnunet_messenger_service.h"
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_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 | 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 | |
struct GNUNET_MESSENGER_Handle * | messenger |
struct GNUNET_SCHEDULER_Task * | read_task |
int | private_mode |
char * | door_id |
char * | ego_name |
char * | room_key |
struct GNUNET_SCHEDULER_Task * | shutdown_task |
Print information about messenger groups.
Definition in file gnunet-messenger.c.
#define MAX_BUFFER_SIZE 60000 |
Definition at line 127 of file gnunet-messenger.c.
void on_message | ( | void * | cls, |
struct GNUNET_MESSENGER_Room * | room, | ||
const struct GNUNET_MESSENGER_Contact * | sender, | ||
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.
[in,out] | cls | Closure |
[in] | room | Room |
[in] | sender | Sender of message |
[in] | message | Message |
[in] | hash | Hash of message |
[in] | flags | Flags of message |
Definition at line 45 of file gnunet-messenger.c.
References GNUNET_MESSENGER_Message::body, GNUNET_i2s_full(), GNUNET_MESSENGER_contact_get_name(), GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_MESSENGER_FLAG_SENT, 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_sh2s(), GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageName::name, GNUNET_MESSENGER_MessageBody::name, GNUNET_MESSENGER_MessagePeer::peer, GNUNET_MESSENGER_MessageBody::peer, GNUNET_MESSENGER_MessageHeader::sender_id, GNUNET_MESSENGER_MessageText::text, and GNUNET_MESSENGER_MessageBody::text.
Referenced by run().
|
static |
Task to shut down this application.
[in,out] | cls | Closure |
Definition at line 110 of file gnunet-messenger.c.
References GNUNET_MESSENGER_close_room(), GNUNET_MESSENGER_disconnect(), GNUNET_SCHEDULER_cancel(), messenger, and read_task.
Referenced by on_identity(), and run().
|
static |
Wait for input on STDIO and send it out over the ch.
[in,out] | cls | Closure |
Definition at line 190 of file gnunet-messenger.c.
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().
|
static |
Definition at line 130 of file gnunet-messenger.c.
References GNUNET_MESSENGER_contact_get_key(), GNUNET_MESSENGER_send_message(), and GNUNET_YES.
Referenced by read_stdio().
|
static |
Task run in stdio mode, after some data is available at stdin.
[in,out] | cls | Closure |
Definition at line 150 of file gnunet-messenger.c.
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().
|
static |
Initial task to startup application.
[in,out] | cls | Closure |
Definition at line 211 of file gnunet-messenger.c.
References GNUNET_SCHEDULER_add_now(), listen_stdio(), and read_task.
Referenced by on_identity(), and updateUsage().
|
static |
Function called when an identity is retrieved.
[in,out] | cls | Closure |
[in,out] | handle | Handle of messenger service |
Definition at line 233 of file gnunet-messenger.c.
References GNUNET_MESSENGER_Message::body, door_id, GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_get_name(), GNUNET_MESSENGER_KIND_NAME, GNUNET_MESSENGER_open_room(), GNUNET_MESSENGER_send_message(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed_with_priority(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_PRIORITY_IDLE, GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_TIME_relative_get_zero_(), handle, GNUNET_MESSENGER_Message::header, idle(), key, GNUNET_MESSENGER_MessageHeader::kind, messenger, name, GNUNET_MESSENGER_MessageName::name, GNUNET_MESSENGER_MessageBody::name, GNUNET_PeerIdentity::public_key, room_key, shutdown_hook(), and shutdown_task.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
[in/out] | cls closure | |
[in] | args | remaining command-line arguments |
[in] | cfgfile | name of the configuration file used (for saving, can be NULL!) |
[in] | cfg | configuration |
Definition at line 300 of file gnunet-messenger.c.
References cfg, ego_name, GNUNET_MESSENGER_connect(), GNUNET_SCHEDULER_add_shutdown(), messenger, on_identity(), on_message(), shutdown_hook(), and shutdown_task.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
The main function to obtain messenger information.
[in] | argc | number of arguments from the command line |
[in] | argv | command line arguments |
Definition at line 318 of file gnunet-messenger.c.
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().
struct GNUNET_MESSENGER_Handle* messenger |
Definition at line 32 of file gnunet-messenger.c.
Referenced by on_identity(), run(), and shutdown_hook().
struct GNUNET_SCHEDULER_Task* read_task |
Definition at line 102 of file gnunet-messenger.c.
Referenced by idle(), listen_stdio(), proto_read_kx(), read_stdio(), and shutdown_hook().
int private_mode |
Definition at line 142 of file gnunet-messenger.c.
Referenced by main(), and read_stdio().
char* door_id |
Definition at line 220 of file gnunet-messenger.c.
Referenced by main(), and on_identity().
char* ego_name |
Definition at line 221 of file gnunet-messenger.c.
Referenced by identity_zone_cb(), main(), and run().
char* room_key |
Definition at line 222 of file gnunet-messenger.c.
Referenced by main(), and on_identity().
struct GNUNET_SCHEDULER_Task* shutdown_task |
Definition at line 224 of file gnunet-messenger.c.
Referenced by continuation_print(), on_identity(), and run().