Export/import/print HELLOs. More...
#include "platform.h"
#include "gnunet_common.h"
#include "gnunet_time_lib.h"
#include "gnunet_util_lib.h"
#include "gnunet_hello_uri_lib.h"
#include "gnunet_pils_service.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. | |
static void | print_hello_addrs (void *cls, const struct GNUNET_PeerIdentity *pid, const char *uri) |
Callback function used to extract URIs from a builder. | |
static void | url_resign_cb (void *cls, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
static void | output_env (const struct GNUNET_MQ_Envelope *env) |
static void | output_parser (const struct GNUNET_HELLO_Parser *parser) |
static void | env_resign_cb (void *cls, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
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 | pid_changed_cb (void *cls, const struct GNUNET_HELLO_Parser *parser, const struct GNUNET_HashCode *addr_hash) |
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 | main (int argc, char *const *argv) |
The main function to obtain peer information from CORE. | |
Variables | |
static int | ret |
Return code. | |
static struct GNUNET_PEERSTORE_Handle * | peerstore_handle |
static struct GNUNET_PILS_Handle * | pils_handle |
static struct GNUNET_PEERSTORE_IterateContext * | iter_ctx |
PEERSTORE iteration context. | |
static struct GNUNET_PEERSTORE_StoreHelloContext * | shc |
HELLO store context handle. | |
static int | export_own_hello |
HELLO export option -H. | |
static char * | expirationstring |
Optional expiration string -E. | |
static struct GNUNET_TIME_Absolute | hello_validity |
Expiration time for exported hello. | |
static enum GNUNET_GenericReturnValue | binary_output |
HELLO export/import format option. | |
static int | print_hellos |
Hello list option -D. | |
static enum GNUNET_GenericReturnValue | import_hello |
HELLO import option -I. | |
struct GNUNET_PILS_Operation * | op |
PILS op. | |
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 103 of file gnunet-hello.c.
References GNUNET_PEERSTORE_disconnect(), GNUNET_PEERSTORE_hello_add_cancel(), GNUNET_PEERSTORE_iteration_stop(), GNUNET_PILS_cancel(), GNUNET_PILS_disconnect(), iter_ctx, op, peerstore_handle, pils_handle, and shc.
|
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 138 of file gnunet-hello.c.
References uri.
Referenced by hello_iter().
|
static |
Definition at line 150 of file gnunet-hello.c.
References builder, GNUNET_free, GNUNET_HELLO_builder_to_url2(), hello_validity, and pid.
Referenced by pid_changed_cb().
|
static |
Definition at line 169 of file gnunet-hello.c.
References env, GNUNET_MQ_env_get_msg(), msg, and GNUNET_MessageHeader::size.
Referenced by env_resign_cb(), and output_parser().
|
static |
Definition at line 179 of file gnunet-hello.c.
References binary_output, env, GNUNET_free, GNUNET_HELLO_parser_to_env(), GNUNET_HELLO_parser_to_url(), GNUNET_NO, GNUNET_SCHEDULER_shutdown(), and output_env().
Referenced by pid_changed_cb().
|
static |
Definition at line 201 of file gnunet-hello.c.
References builder, env, GNUNET_free, GNUNET_HELLO_builder_to_env(), hello_validity, output_env(), and pid.
Referenced by pid_changed_cb().
|
static |
If we ever get here, we are newer than the existing record or the only/first record.
Definition at line 218 of file gnunet-hello.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, 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_PEERSTORE_iteration_next(), GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_absolute_time_to_string(), iter_ctx, pid, print_hello_addrs(), print_hellos, and record().
Referenced by run().
|
static |
Definition at line 262 of file gnunet-hello.c.
References GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), and shc.
Referenced by run().
|
static |
Definition at line 276 of file gnunet-hello.c.
References binary_output, builder, env_resign_cb(), expirationstring, export_own_hello, GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_from_parser(), GNUNET_NO, GNUNET_PILS_sign_hello(), GNUNET_SCHEDULER_shutdown(), hello_validity, op, output_parser(), pils_handle, and url_resign_cb().
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 310 of file gnunet-hello.c.
References _, cfg, env, expirationstring, export_own_hello, GNUNET_assert, GNUNET_CONFIGURATION_get_value_filename(), 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_PILS_connect(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_DAYS, GNUNET_YES, hello_iter(), hello_store_success(), hello_validity, import_hello, iter_ctx, peerstore_handle, pid_changed_cb(), pils_handle, print_hellos, 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 442 of file gnunet-hello.c.
References binary_output, expirationstring, export_own_hello, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), import_hello, options, print_hellos, res, ret, and run().
|
static |
|
static |
Definition at line 44 of file gnunet-hello.c.
Referenced by run(), and shutdown_task().
|
static |
Definition at line 49 of file gnunet-hello.c.
Referenced by pid_changed_cb(), run(), and shutdown_task().
|
static |
PEERSTORE iteration context.
Definition at line 54 of file gnunet-hello.c.
Referenced by hello_iter(), run(), and shutdown_task().
|
static |
HELLO store context handle.
Definition at line 59 of file gnunet-hello.c.
Referenced by GNUNET_sh2s(), hello_store_success(), run(), and shutdown_task().
|
static |
HELLO export option -H.
Definition at line 64 of file gnunet-hello.c.
Referenced by main(), pid_changed_cb(), and run().
|
static |
Optional expiration string -E.
Definition at line 69 of file gnunet-hello.c.
Referenced by main(), parse_expiration(), pid_changed_cb(), and run().
|
static |
Expiration time for exported hello.
Definition at line 74 of file gnunet-hello.c.
Referenced by env_resign_cb(), pid_changed_cb(), run(), and url_resign_cb().
|
static |
HELLO export/import format option.
Definition at line 79 of file gnunet-hello.c.
Referenced by main(), output_parser(), and pid_changed_cb().
|
static |
Hello list option -D.
Definition at line 84 of file gnunet-hello.c.
Referenced by hello_iter(), main(), and run().
|
static |
HELLO import option -I.
Definition at line 89 of file gnunet-hello.c.
struct GNUNET_PILS_Operation* op |
PILS op.
Definition at line 94 of file gnunet-hello.c.
Referenced by pid_changed_cb(), and shutdown_task().