GNUnet 0.28.1-dev.2-13-g57ceb9dfb
 
Loading...
Searching...
No Matches
gnunet-hello.c File Reference

Export/import/print HELLOs. More...

Include dependency graph for gnunet-hello.c:

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_Handlepeerstore_handle
 
static struct GNUNET_PILS_Handlepils_handle
 
static struct GNUNET_PEERSTORE_IterateContextiter_ctx
 PEERSTORE iteration context.
 
static struct GNUNET_PEERSTORE_StoreHelloContextshc
 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_Operationop
 PILS op.
 

Detailed Description

Export/import/print HELLOs.

Author
Nathan Evans

Definition in file gnunet-hello.c.

Function Documentation

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task run in monitor mode when the user presses CTRL-C to abort.

Stops monitoring activity.

Parameters
clsNULL

Definition at line 103 of file gnunet-hello.c.

104{
105 (void) cls;
106 if (NULL != shc)
107 {
109 shc = NULL;
110 }
111 if (NULL != iter_ctx)
112 {
114 }
115 if (NULL != peerstore_handle)
116 {
118 peerstore_handle = NULL;
119 }
120 if (NULL != op)
122 if (NULL != pils_handle)
123 {
125 peerstore_handle = NULL;
126 }
127}
static struct GNUNET_PILS_Handle * pils_handle
static struct GNUNET_PEERSTORE_IterateContext * iter_ctx
PEERSTORE iteration context.
struct GNUNET_PILS_Operation * op
PILS op.
static struct GNUNET_PEERSTORE_Handle * peerstore_handle
static struct GNUNET_PEERSTORE_StoreHelloContext * shc
HELLO store context handle.
void GNUNET_PILS_disconnect(struct GNUNET_PILS_Handle *handle)
Disconnect from the PILS service.
Definition pils_api.c:647
void GNUNET_PILS_cancel(struct GNUNET_PILS_Operation *op)
Cancel request.
Definition pils_api.c:776
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the PEERSTORE service.
void GNUNET_PEERSTORE_hello_add_cancel(struct GNUNET_PEERSTORE_StoreHelloContext *huc)
Cancel the request to add a hello.
void GNUNET_PEERSTORE_iteration_stop(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iteration.

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.

Here is the call graph for this function:

◆ print_hello_addrs()

static void print_hello_addrs ( void *  cls,
const struct GNUNET_PeerIdentity pid,
const char *  uri 
)
static

Callback function used to extract URIs from a builder.

Called when we should consider connecting to a peer.

Parameters
clsclosure pointing to a struct GNUNET_PeerIdentity *
urione of the URIs

Definition at line 138 of file gnunet-hello.c.

141{
142 (void) cls;
143
144
145 printf ("|- %s\n", uri);
146}
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...

References uri.

Referenced by hello_iter().

Here is the caller graph for this function:

◆ url_resign_cb()

static void url_resign_cb ( void *  cls,
const struct GNUNET_PeerIdentity pid,
const struct GNUNET_CRYPTO_EddsaSignature sig 
)
static

Definition at line 150 of file gnunet-hello.c.

153{
154 struct GNUNET_HELLO_Builder *builder = cls;
155 char *url;
156
157 op = NULL;
159 pid,
160 sig,
162 &url);
163
164 printf ("%s\n", url);
165 GNUNET_free (url); // TODO is this right?
168}
static struct HostSet * builder
NULL if we are not currently iterating over peer information.
static struct GNUNET_TIME_Absolute hello_validity
Expiration time for exported hello.
void GNUNET_HELLO_builder_free(struct GNUNET_HELLO_Builder *builder)
Release resources of a builder.
Definition hello-uri.c:398
enum GNUNET_GenericReturnValue GNUNET_HELLO_builder_to_url2(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute validity, char **result)
Generate GNUnet HELLO URI from a builder.
Definition hello-uri.c:1336
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition scheduler.c:572
Context for building (or parsing) HELLO URIs.
Definition hello-uri.c:185

References builder, GNUNET_free, GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_to_url2(), GNUNET_SCHEDULER_shutdown(), hello_validity, and op.

Referenced by pid_changed_cb().

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

◆ output_env()

static void output_env ( const struct GNUNET_MQ_Envelope env)
static

Definition at line 172 of file gnunet-hello.c.

173{
174 const struct GNUNET_MessageHeader *msg;
175
177 fwrite (msg, 1, ntohs (msg->size), stdout);
178}
struct GNUNET_MessageHeader * msg
Definition 005.c:2
struct GNUNET_MQ_Envelope * env
Definition 005.c:1
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
const struct GNUNET_MessageHeader * GNUNET_MQ_env_get_msg(const struct GNUNET_MQ_Envelope *env)
Obtain message contained in envelope.
Definition mq.c:928
Header for all communications.

References env, GNUNET_MQ_env_get_msg(), msg, and GNUNET_MessageHeader::size.

Referenced by env_resign_cb(), and output_parser().

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

◆ output_parser()

static void output_parser ( const struct GNUNET_HELLO_Parser parser)
static

Definition at line 182 of file gnunet-hello.c.

183{
185 {
186 char *url;
187 url = GNUNET_HELLO_parser_to_url (parser);
188 printf ("%s\n", url);
189 GNUNET_free (url);
191 return;
192 }
193 else
194 {
195 struct GNUNET_MQ_Envelope *env;
197 output_env (env);
199 }
200}
static void output_env(const struct GNUNET_MQ_Envelope *env)
static enum GNUNET_GenericReturnValue binary_output
HELLO export/import format option.
char * GNUNET_HELLO_parser_to_url(const struct GNUNET_HELLO_Parser *parser)
Generate GNUnet HELLO URI from a parser.
Definition hello-uri.c:859
struct GNUNET_MQ_Envelope * GNUNET_HELLO_parser_to_env(const struct GNUNET_HELLO_Parser *parser)
Generate envelope with GNUnet HELLO message (including peer ID) from a parser.
Definition hello-uri.c:959
@ GNUNET_NO

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().

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

◆ env_resign_cb()

static void env_resign_cb ( void *  cls,
const struct GNUNET_PeerIdentity pid,
const struct GNUNET_CRYPTO_EddsaSignature sig 
)
static

Definition at line 204 of file gnunet-hello.c.

207{
208 struct GNUNET_HELLO_Builder *builder = cls;
209 struct GNUNET_MQ_Envelope *env;
210
211 op = NULL;
213 pid,
214 sig,
216 output_env (env);
220}
struct GNUNET_MQ_Envelope * GNUNET_HELLO_builder_to_env(const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig, struct GNUNET_TIME_Absolute expiration_time)
Generate envelope with GNUnet HELLO message (including peer ID) from a builder.
Definition hello-uri.c:1198

References builder, env, GNUNET_free, GNUNET_HELLO_builder_free(), GNUNET_HELLO_builder_to_env(), GNUNET_SCHEDULER_shutdown(), hello_validity, op, and output_env().

Referenced by pid_changed_cb().

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

◆ hello_iter()

static void hello_iter ( void *  cls,
const struct GNUNET_PEERSTORE_Record record,
const char *  emsg 
)
static

If we ever get here, we are newer than the existing record or the only/first record.

Definition at line 224 of file gnunet-hello.c.

226{
227 struct GNUNET_HELLO_Parser *hp;
228 struct GNUNET_TIME_Absolute hello_exp;
229 const struct GNUNET_PeerIdentity *pid;
230
231 if ((NULL == record) && (NULL == emsg))
232 {
236 iter_ctx = NULL;
238 return;
239 }
240 if (NULL != emsg)
241 {
242 /* @a emsg comes with a NULL record, i.e. the iteration is over and the
243 context is gone -- asking it for another record uses freed memory. */
244 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg);
245 iter_ctx = NULL;
247 return;
248 }
250 &record->peer);
251 if (NULL == hp)
252 {
254 "The HELLO is invalid. Skipping.\n");
256 return;
257 }
260 if (print_hellos)
261 {
262 printf ("`%s' (expires: %s):\n", GNUNET_i2s (pid),
265 }
268}
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
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 int print_hellos
Hello list option -D.
void GNUNET_HELLO_parser_free(struct GNUNET_HELLO_Parser *parser)
Release resources of a builder.
Definition hello-uri.c:380
const struct GNUNET_PeerIdentity * GNUNET_HELLO_parser_iterate(const struct GNUNET_HELLO_Parser *parser, GNUNET_HELLO_UriCallback uc, void *uc_cls)
Iterate over URIs in a parser.
Definition hello-uri.c:1031
struct GNUNET_TIME_Absolute GNUNET_HELLO_get_expiration_time_from_msg(const struct GNUNET_MessageHeader *msg)
Get the expiration time for this HELLO.
Definition hello-uri.c:642
const struct GNUNET_PeerIdentity * GNUNET_HELLO_parser_get_id(const struct GNUNET_HELLO_Parser *parser)
Get the PeerIdentity for this builder.
Definition hello-uri.c:354
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_msg(const struct GNUNET_MessageHeader *msg, const struct GNUNET_PeerIdentity *pid)
Parse msg.
Definition hello-uri.c:416
#define GNUNET_log(kind,...)
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
void GNUNET_PEERSTORE_iteration_next(struct GNUNET_PEERSTORE_IterateContext *ic, uint64_t limit)
Continue an iteration.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition strings.c:671
Context for parsing HELLOs.
Definition hello-uri.c:233
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.

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, print_hello_addrs(), print_hellos, and record().

Referenced by run().

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

◆ hello_store_success()

static void hello_store_success ( void *  cls,
int  success 
)
static

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

273{
274 shc = NULL;
275 if (GNUNET_OK != success)
276 {
278 "Storing hello uri failed\n");
279 }
280 printf ("HELLO imported.");
282}
@ GNUNET_OK
@ GNUNET_ERROR_TYPE_WARNING

References GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), and shc.

Referenced by run().

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

◆ pid_changed_cb()

static void pid_changed_cb ( void *  cls,
const struct GNUNET_HELLO_Parser parser,
const struct GNUNET_HashCode addr_hash 
)
static

Definition at line 286 of file gnunet-hello.c.

289{
291 if (! export_own_hello)
292 return;
293
294 if (NULL != expirationstring)
295 {
299 builder,
302 builder);
303 return;
304 }
305 output_parser (parser);
307}
static int export_own_hello
HELLO export option -H.
static void env_resign_cb(void *cls, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig)
static void output_parser(const struct GNUNET_HELLO_Parser *parser)
static void url_resign_cb(void *cls, const struct GNUNET_PeerIdentity *pid, const struct GNUNET_CRYPTO_EddsaSignature *sig)
static char * expirationstring
Optional expiration string -E.
struct GNUNET_PILS_Operation * GNUNET_PILS_sign_hello(struct GNUNET_PILS_Handle *handle, const struct GNUNET_HELLO_Builder *builder, struct GNUNET_TIME_Absolute et, GNUNET_PILS_SignResultCallback cb, void *cb_cls)
Create HELLO signature.
Definition pils_api.c:851
struct GNUNET_HELLO_Builder * GNUNET_HELLO_builder_from_parser(const struct GNUNET_HELLO_Parser *parser, struct GNUNET_PeerIdentity *pid)
Allocate builder from parser.
Definition hello-uri.c:361

References binary_output, builder, env_resign_cb(), expirationstring, export_own_hello, 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().

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
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cfgconfiguration

Definition at line 319 of file gnunet-hello.c.

323{
324 struct GNUNET_HELLO_Parser *hp;
325 struct GNUNET_MQ_Envelope *env;
326 struct GNUNET_TIME_Relative hello_validity_rel;
327 char *keyfile;
328 (void) cls;
329 (void) cfgfile;
330
331 if (NULL != args[0])
332 {
333 fprintf (stderr, _ ("Invalid command line argument `%s'\n"), args[0]);
334 return;
335 }
336 if (! print_hellos &&
339 {
340 fprintf (stderr, "%s", _ ("No argument given.\n"));
341 ret = 1;
343 return;
344 }
346 if (GNUNET_OK !=
348 "PEER",
349 "PRIVATE_KEY",
350 &keyfile))
351 {
352 GNUNET_log (
354 _ ("Core service is lacking HOSTKEY configuration setting. Exiting.\n"));
356 ret = 1;
357 return;
358 }
362 GNUNET_assert (NULL != pils_handle);
363 hello_validity_rel = GNUNET_TIME_UNIT_DAYS;
364 if (NULL != expirationstring)
365 {
367 &hello_validity_rel)
368 )
369 {
370 fprintf (stderr, "Invalid expiration time `%s'", expirationstring);
372 return;
373 }
374 }
377 {
378 char buffer[GNUNET_MAX_MESSAGE_SIZE - 1];
379 char *write_ptr;
380 ssize_t nread;
381 size_t read_total = 0;
382
383 write_ptr = buffer;
384 while (0 < (nread = fread (write_ptr, 1,
385 sizeof buffer - read_total, stdin)))
386 {
387 read_total += nread;
388 write_ptr += nread;
389 }
390 buffer[read_total] = '\0';
391 if (strlen ("gnunet://hello/") > read_total)
392 {
393 fprintf (stderr, "HELLO malformed\n");
395 return;
396 }
397 if (0 == strncasecmp ("gnunet://hello/",
398 buffer, strlen ("gnunet://hello/")))
399 {
400 // Remove newline
401 buffer[read_total - 1] = '\0';
402 hp = GNUNET_HELLO_parser_from_url (buffer);
403 if (NULL == hp)
404 {
405 fprintf (stderr, "Unable to parse URI `%s'\n", buffer);
407 return;
408 }
412 &hello_store_success, NULL);
415 }
416 else if (read_total > sizeof (struct GNUNET_MessageHeader))
417 {
419 (const struct GNUNET_MessageHeader*)
420 buffer,
421 &hello_store_success, NULL);
422 }
423 else
424 {
425 fprintf (stderr, "HELLO malformed\n");
427 }
428 return;
429 }
430
431 if (print_hellos)
432 {
434 "peerstore",
435 NULL,
437 &hello_iter,
438 NULL);
439 }
440}
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
static void hello_iter(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
static enum GNUNET_GenericReturnValue import_hello
HELLO import option -I.
static int ret
Return code.
static void pid_changed_cb(void *cls, const struct GNUNET_HELLO_Parser *parser, const struct GNUNET_HashCode *addr_hash)
static void hello_store_success(void *cls, int success)
struct GNUNET_SCHEDULER_Task * shutdown_task
struct GNUNET_PILS_Handle * GNUNET_PILS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PILS_PidChangeCallback pid_change_cb, void *cls)
Connect to the PILS service.
Definition pils_api.c:624
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_url(const char *url)
Parse GNUnet HELLO url.
Definition hello-uri.c:719
@ GNUNET_YES
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_PEERSTORE_IterateContext * GNUNET_PEERSTORE_iteration_start(struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
Iterate over peerstore entries.
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
#define GNUNET_PEERSTORE_HELLO_KEY
Key used for storing HELLO in the peerstore.
struct GNUNET_PEERSTORE_StoreHelloContext * GNUNET_PEERSTORE_hello_add(struct GNUNET_PEERSTORE_Handle *h, const struct GNUNET_MessageHeader *msg, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Add hello to peerstore.
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:1345
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
Definition strings.c:259
#define GNUNET_TIME_UNIT_DAYS
One day.
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
Definition time.c:316
#define _(String)
GNU gettext support macro.
Definition platform.h:179
Time for relative time used by GNUnet, in microseconds.

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().

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

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function to obtain peer information from CORE.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 451 of file gnunet-hello.c.

452{
453 int res;
456 "export-hello",
458 "Print a HELLO for our peer identity"),
461 "binary",
463 "Output HELLO in binary format. Use with `--export'."),
466 "import-hello",
467 gettext_noop ("Import a HELLO"),
468 &import_hello),
470 "expiration",
471 "TIME",
473 "Expiration time to set for exported hello. (Default: 1 day)"),
476 "dump-hellos",
478 "List all known HELLOs in peerstore"),
479 &print_hellos),
481 };
482
484 argc,
485 argv,
486 "gnunet-hello",
488 "Import/export/print HELLOs."),
489 options,
490 &run,
491 NULL);
492
493 if (GNUNET_OK == res)
494 return ret;
495 return 1;
496}
struct GNUNET_GETOPT_CommandLineOption options[]
Definition 002.c:5
#define gettext_noop(String)
Definition gettext.h:74
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.
static char * res
Currently read line or NULL on EOF.
#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.
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:406
Definition of a command line option.

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().

Here is the call graph for this function:

Variable Documentation

◆ ret

int ret
static

Return code.

Definition at line 39 of file gnunet-hello.c.

Referenced by main(), and run().

◆ peerstore_handle

struct GNUNET_PEERSTORE_Handle* peerstore_handle
static

Definition at line 44 of file gnunet-hello.c.

Referenced by run(), and shutdown_task().

◆ pils_handle

struct GNUNET_PILS_Handle* pils_handle
static

Definition at line 49 of file gnunet-hello.c.

Referenced by pid_changed_cb(), run(), and shutdown_task().

◆ iter_ctx

struct GNUNET_PEERSTORE_IterateContext* iter_ctx
static

PEERSTORE iteration context.

Definition at line 54 of file gnunet-hello.c.

Referenced by hello_iter(), run(), and shutdown_task().

◆ shc

HELLO store context handle.

Definition at line 59 of file gnunet-hello.c.

Referenced by GNUNET_sh2s(), hello_store_success(), run(), and shutdown_task().

◆ export_own_hello

int export_own_hello
static

HELLO export option -H.

Definition at line 64 of file gnunet-hello.c.

Referenced by main(), pid_changed_cb(), and run().

◆ expirationstring

char* expirationstring
static

Optional expiration string -E.

Definition at line 69 of file gnunet-hello.c.

Referenced by main(), parse_expiration(), pid_changed_cb(), and run().

◆ hello_validity

struct GNUNET_TIME_Absolute hello_validity
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().

◆ binary_output

enum GNUNET_GenericReturnValue binary_output
static

HELLO export/import format option.

Definition at line 79 of file gnunet-hello.c.

Referenced by main(), output_parser(), and pid_changed_cb().

◆ print_hellos

int print_hellos
static

Hello list option -D.

Definition at line 84 of file gnunet-hello.c.

Referenced by hello_iter(), main(), and run().

◆ import_hello

enum GNUNET_GenericReturnValue import_hello
static

HELLO import option -I.

Definition at line 89 of file gnunet-hello.c.

Referenced by main(), and run().

◆ op

PILS op.

Definition at line 94 of file gnunet-hello.c.

Referenced by env_resign_cb(), pid_changed_cb(), shutdown_task(), and url_resign_cb().