#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_identity_service.h>
#include <gnunet_namestore_service.h>
Go to the source code of this file.
Functions | |
static int | run_process_and_wait (enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, enum GNUNET_OS_ProcessStatusType *st, unsigned long *code, const char *filename,...) |
static void | check_pkey (unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, char *pk, int *found_rec) |
static void | zone_iterator (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore. More... | |
static void | zone_iteration_error (void *cls) |
static void | zone_iteration_finished (void *cls) |
static void | get_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier) |
Get master-zone and private-zone keys. More... | |
static void | shutdown_task (void *cls) |
Task run on shutdown. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
Main function that will be run. More... | |
int | main (int argc, char *const *argv) |
The main function for gnunet-gns. More... | |
Variables | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
Configuration we are using. More... | |
static struct GNUNET_IDENTITY_Handle * | sh |
Handle to IDENTITY service. More... | |
struct GNUNET_NAMESTORE_ZoneIterator * | list_it |
Zone iterator for master zone. More... | |
static struct GNUNET_NAMESTORE_Handle * | ns |
Handle to the namestore. More... | |
static char * | master_zone_pkey |
String version of PKEY for master-zone. More... | |
static struct GNUNET_CRYPTO_EcdsaPrivateKey | master_pk |
Binary version of PKEY for master-zone. More... | |
static char * | private_zone_pkey |
String version of PKEY for private-zone. More... | |
static char * | pin_zone_pkey |
String version of PKEY for pin-zone. More... | |
static int | found_private_rec = GNUNET_NO |
Set to GNUNET_YES if private record was found;. More... | |
static int | found_pin_rec = GNUNET_NO |
Set to GNUNET_YES if pin record was found;. More... | |
static int | ret |
Exit code. More... | |
|
static |
Definition at line 90 of file gnunet-gns-import.c.
References find_typedefs::arg, consensus-simulation::args, filename, GNUNET_free, GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_OS_process_status(), GNUNET_OS_process_wait(), GNUNET_OS_start_process_va(), GNUNET_SYSERR, p, ret, and st.
Referenced by run(), and zone_iteration_error().
|
static |
Definition at line 167 of file gnunet-gns-import.c.
References data, data_size, GNUNET_free, GNUNET_GNSRECORD_identity_from_data(), GNUNET_GNSRECORD_value_to_string(), GNUNET_OK, GNUNET_YES, pk, pubkey, and rd.
Referenced by zone_iterator().
|
static |
Process a record that was stored in the namestore.
cls | closure |
zone_key | private key of the zone |
rname | name that is being mapped (at most 255 characters long) |
rd_len | number of entries in rd array |
rd | array of records with data to store |
Definition at line 205 of file gnunet-gns-import.c.
References check_pkey(), found_pin_rec, found_private_rec, GNUNET_NAMESTORE_zone_iterator_next(), list_it, pin_zone_pkey, private_zone_pkey, and rd.
Referenced by get_ego().
|
static |
Definition at line 222 of file gnunet-gns-import.c.
References found_pin_rec, found_private_rec, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_SCHEDULER_shutdown(), list_it, pin_zone_pkey, private_zone_pkey, ret, run_process_and_wait(), and st.
Referenced by get_ego().
|
static |
Definition at line 261 of file gnunet-gns-import.c.
Referenced by get_ego().
|
static |
Get master-zone and private-zone keys.
This function is initially called for all egos and then again whenever a ego's identifier changes or if it is deleted. At the end of the initial pass over all egos, the function is once called with 'NULL' for 'ego'. That does NOT mean that the callback won't be invoked in the future or that there was an error.
When used with 'GNUNET_IDENTITY_create' or 'GNUNET_IDENTITY_get', this function is only called ONCE, and 'NULL' being passed in 'ego' does indicate an error (for example because name is taken or no default value is known). If 'ego' is non-NULL and if '*ctx' is set in those callbacks, the value WILL be passed to a subsequent call to the identity callback of 'GNUNET_IDENTITY_connect' (if that one was not NULL).
When an identity is renamed, this function is called with the (known) ego but the NEW identifier.
When an identity is deleted, this function is called with the (known) ego and "NULL" for the 'identifier'. In this case, the 'ego' is henceforth invalid (and the 'ctx' should also be cleaned up).
cls | closure |
ego | ego handle |
ctx | context for application to store data for this ego (during the lifetime of this process, initially NULL) |
identifier | identifier assigned by the user for this ego, NULL if the user just deleted the ego and it must thus no longer be used |
Definition at line 299 of file gnunet-gns-import.c.
References GNUNET_CRYPTO_ecdsa_public_key_to_string(), GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_SCHEDULER_shutdown(), list_it, master_pk, master_zone_pkey, ns, pk, private_zone_pkey, ret, zone_iteration_error(), zone_iteration_finished(), and zone_iterator().
Referenced by run().
|
static |
Task run on shutdown.
cls | NULL |
Definition at line 350 of file gnunet-gns-import.c.
References GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_iteration_stop(), list_it, master_zone_pkey, ns, private_zone_pkey, and sh.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
c | configuration |
Definition at line 383 of file gnunet-gns-import.c.
References cfg, get_ego(), GNUNET_IDENTITY_connect(), GNUNET_NAMESTORE_connect(), GNUNET_OS_INHERIT_STD_NONE, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_SCHEDULER_add_shutdown(), ns, ret, run_process_and_wait(), sh, shutdown_task(), and st.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function for gnunet-gns.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 476 of file gnunet-gns-import.c.
References _, GNUNET_GETOPT_OPTION_END, GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), options, ret, and run().
|
static |
|
static |
Handle to IDENTITY service.
Definition at line 40 of file gnunet-gns-import.c.
Referenced by run(), and shutdown_task().
struct GNUNET_NAMESTORE_ZoneIterator* list_it |
Zone iterator for master zone.
Definition at line 45 of file gnunet-gns-import.c.
Referenced by get_ego(), shutdown_task(), zone_iteration_error(), and zone_iterator().
|
static |
Handle to the namestore.
Definition at line 50 of file gnunet-gns-import.c.
Referenced by get_ego(), run(), and shutdown_task().
|
static |
String version of PKEY for master-zone.
Definition at line 55 of file gnunet-gns-import.c.
Referenced by get_ego(), and shutdown_task().
|
static |
Binary version of PKEY for master-zone.
Definition at line 60 of file gnunet-gns-import.c.
Referenced by get_ego().
|
static |
String version of PKEY for private-zone.
Definition at line 65 of file gnunet-gns-import.c.
Referenced by get_ego(), shutdown_task(), zone_iteration_error(), and zone_iterator().
|
static |
String version of PKEY for pin-zone.
Definition at line 70 of file gnunet-gns-import.c.
Referenced by zone_iteration_error(), and zone_iterator().
|
static |
Set to GNUNET_YES if private record was found;.
Definition at line 76 of file gnunet-gns-import.c.
Referenced by zone_iteration_error(), and zone_iterator().
|
static |
Set to GNUNET_YES if pin record was found;.
Definition at line 81 of file gnunet-gns-import.c.
Referenced by zone_iteration_error(), and zone_iterator().
|
static |
Exit code.
Definition at line 86 of file gnunet-gns-import.c.
Referenced by get_ego(), main(), run(), run_process_and_wait(), and zone_iteration_error().