Export/import/print HELLOs. More...
#include "gnunet_common.h"
#include "platform.h"
#include "gnunet_time_lib.h"
#include "gnunet_util_lib.h"
#include "gnunet_hello_uri_lib.h"
#include "gnunet_peerstore_service.h"
Go to the source code of this file.
Functions | |
static void | shutdown_task (void *cls) |
Task run in monitor mode when the user presses CTRL-C to abort. More... | |
static void | print_hello_addrs (void *cls, const struct GNUNET_PeerIdentity *pid, const char *uri) |
Callback function used to extract URIs from a builder. More... | |
static void | hello_iter (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) |
static void | hello_store_success (void *cls, int success) |
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 *const *argv) |
The main function to obtain peer information from CORE. More... | |
Variables | |
static int | ret |
Return code. More... | |
static struct GNUNET_PEERSTORE_Handle * | peerstore_handle |
static struct GNUNET_PEERSTORE_IterateContext * | iter_ctx |
PEERSTORE iteration context. More... | |
static struct GNUNET_PEERSTORE_StoreHelloContext * | shc |
HELLO store context handle. More... | |
static struct GNUNET_CRYPTO_EddsaPrivateKey | my_private_key |
Peer private key. More... | |
static struct GNUNET_PeerIdentity | my_full_id |
Peer identity. More... | |
static int | export_own_hello |
HELLO export option -H. More... | |
static char * | expirationstring |
Optional expiration string -E. More... | |
static struct GNUNET_TIME_Relative | hello_validity |
Expiration time for exported hello. More... | |
static enum GNUNET_GenericReturnValue | binary_output |
HELLO export/import format option. More... | |
static int | print_hellos |
Hello list option -D. More... | |
static enum GNUNET_GenericReturnValue | import_hello |
HELLO import option -I. More... | |
Export/import/print HELLOs.
Definition in file gnunet-hello.c.
|
static |
Task run in monitor mode when the user presses CTRL-C to abort.
Stops monitoring activity.
cls | NULL |
Definition at line 101 of file gnunet-hello.c.
References GNUNET_PEERSTORE_disconnect(), GNUNET_PEERSTORE_hello_add_cancel(), GNUNET_PEERSTORE_iteration_stop(), iter_ctx, peerstore_handle, and shc.
Referenced by run().
|
static |
Callback function used to extract URIs from a builder.
Called when we should consider connecting to a peer.
cls | closure pointing to a struct GNUNET_PeerIdentity * |
uri | one of the URIs |
Definition at line 129 of file gnunet-hello.c.
References uri.
Referenced by hello_iter().
|
static |
If we ever get here, we are newer than the existing record or the only/first record.
Definition at line 141 of file gnunet-hello.c.
References binary_output, env, expirationstring, export_own_hello, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_from_parser(), GNUNET_HELLO_builder_to_env(), GNUNET_HELLO_builder_to_url(), GNUNET_HELLO_builder_to_url2(), GNUNET_HELLO_get_expiration_time_from_msg(), GNUNET_HELLO_parser_free(), GNUNET_HELLO_parser_from_msg(), GNUNET_HELLO_parser_get_id(), GNUNET_HELLO_parser_iterate(), GNUNET_i2s(), GNUNET_log, GNUNET_memcmp, GNUNET_MQ_env_get_msg(), GNUNET_NO, GNUNET_PEERSTORE_iteration_next(), GNUNET_PEERSTORE_iteration_stop(), GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute_get_duration(), hello_validity, iter_ctx, msg, my_full_id, my_private_key, pid, print_hello_addrs(), print_hellos, record(), and GNUNET_MessageHeader::size.
Referenced by run().
|
static |
Definition at line 238 of file gnunet-hello.c.
References GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), and shc.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 260 of file gnunet-hello.c.
References _, consensus-simulation::args, cfg, env, expirationstring, export_own_hello, GNUNET_assert, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CRYPTO_eddsa_key_from_file(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_HELLO_parser_free(), GNUNET_HELLO_parser_from_url(), GNUNET_HELLO_parser_to_env(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_MQ_env_get_msg(), GNUNET_NO, GNUNET_OK, GNUNET_PEERSTORE_connect(), GNUNET_PEERSTORE_hello_add(), GNUNET_PEERSTORE_HELLO_KEY, GNUNET_PEERSTORE_iteration_start(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_SYSERR, GNUNET_TIME_UNIT_DAYS, GNUNET_YES, hello_iter(), hello_store_success(), hello_validity, import_hello, iter_ctx, my_full_id, my_private_key, peerstore_handle, print_hellos, GNUNET_PeerIdentity::public_key, ret, shc, and shutdown_task().
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function to obtain peer information from CORE.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 399 of file gnunet-hello.c.
References binary_output, expirationstring, export_own_hello, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), import_hello, options, print_hellos, res, ret, and run().
|
static |
|
static |
Definition at line 42 of file gnunet-hello.c.
Referenced by run(), and shutdown_task().
|
static |
PEERSTORE iteration context.
Definition at line 47 of file gnunet-hello.c.
Referenced by hello_iter(), run(), and shutdown_task().
|
static |
HELLO store context handle.
Definition at line 52 of file gnunet-hello.c.
Referenced by GNUNET_sh2s(), hello_store_success(), run(), and shutdown_task().
|
static |
Peer private key.
Definition at line 57 of file gnunet-hello.c.
Referenced by hello_iter(), and run().
|
static |
|
static |
HELLO export option -H.
Definition at line 67 of file gnunet-hello.c.
Referenced by hello_iter(), main(), and run().
|
static |
Optional expiration string -E.
Definition at line 72 of file gnunet-hello.c.
Referenced by hello_iter(), main(), parse_expiration(), and run().
|
static |
Expiration time for exported hello.
Definition at line 77 of file gnunet-hello.c.
Referenced by hello_iter(), and run().
|
static |
HELLO export/import format option.
Definition at line 82 of file gnunet-hello.c.
Referenced by hello_iter(), and main().
|
static |
Hello list option -D.
Definition at line 87 of file gnunet-hello.c.
Referenced by hello_iter(), main(), and run().
|
static |
HELLO import option -I.
Definition at line 92 of file gnunet-hello.c.