GNUnet  0.11.x
Functions | Variables
gnunet-gns-import.c File Reference
#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_identity_service.h>
#include <gnunet_namestore_service.h>
Include dependency graph for gnunet-gns-import.c:

Go to the source code of this file.

Functions

static int run_process_and_wait (int pipe_control, 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_Handlecfg
 Configuration we are using. More...
 
static struct GNUNET_IDENTITY_Handlesh
 Handle to IDENTITY service. More...
 
struct GNUNET_NAMESTORE_ZoneIteratorlist_it
 Zone iterator for master zone. More...
 
static struct GNUNET_NAMESTORE_Handlens
 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...
 

Function Documentation

◆ run_process_and_wait()

static int run_process_and_wait ( int  pipe_control,
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

Definition at line 90 of file gnunet-gns-import.c.

References find_typedefs::arg, gnunet-chk::args, GNUNET_free, GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_OS_process_status(), GNUNET_OS_process_wait(), GNUNET_OS_start_process_va(), GNUNET_SYSERR, p, and ret.

Referenced by run(), and zone_iteration_error().

97 {
98  static struct GNUNET_OS_Process *p;
99  int arglen;
100  char *arg;
101  char *args;
102  char *argp;
103  va_list ap, apc1, apc2;
104 
105  va_start (ap, filename);
106  va_copy (apc1, ap);
107  va_copy (apc2, ap);
108  arglen = 0;
109  while (NULL != (arg = va_arg (apc1, char *)))
110  arglen += strlen (arg) + 1;
111  va_end (apc1);
112  args = argp = GNUNET_malloc (arglen);
113  while (NULL != (arg = va_arg (apc2, char *)))
114  {
115  strcpy (argp, arg);
116  argp += strlen (arg);
117  *argp = ' ';
118  argp += 1;
119  }
120  va_end (apc2);
121  if (arglen > 0)
122  argp[-1] = '\0';
123  p = GNUNET_OS_start_process_va (pipe_control, std_inheritance,
124  pipe_stdin,
125  pipe_stdout,
126  NULL,
127  filename, ap);
128  va_end (ap);
129  if (NULL == p)
130  {
131  ret = 3;
132  fprintf (stderr, "Failed to run `%s'\n", args);
133  GNUNET_free (args);
134  return 1;
135  }
136 
138  {
139  ret = 4;
140  fprintf (stderr, "Failed to wait for `%s'\n", args);
141  GNUNET_free (args);
142  return 1;
143  }
144 
145  switch (GNUNET_OS_process_status (p, st, code))
146  {
147  case GNUNET_OK:
148  break;
149 
150  case GNUNET_NO:
151  ret = 5;
152  fprintf (stderr, "`%s' is still running\n", args);
153  GNUNET_free (args);
154  return 1;
155 
156  default:
157  case GNUNET_SYSERR:
158  ret = 6;
159  fprintf (stderr, "Failed to check the status of `%s'\n", args);
160  GNUNET_free (args);
161  return 1;
162  }
163  return 0;
164 }
int GNUNET_OS_process_status(struct GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusType *type, unsigned long *code)
Retrieve the status of a process, waiting on it if dead.
Definition: os_priority.c:963
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_OS_Process * GNUNET_OS_start_process_va(int pipe_control, enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename, va_list va)
Start a process.
Definition: os_priority.c:639
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
static char * filename
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static int ret
Exit code.
int GNUNET_OS_process_wait(struct GNUNET_OS_Process *proc)
Wait for a process to terminate.
Definition: os_priority.c:1000
static struct GNUNET_SCHEDULER_Task * st
The shutdown task.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_pkey()

static void check_pkey ( unsigned int  rd_len,
const struct GNUNET_GNSRECORD_Data rd,
char *  pk,
int *  found_rec 
)
static

Definition at line 168 of file gnunet-gns-import.c.

References data, data_size, GNUNET_free, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_value_to_string(), and GNUNET_YES.

Referenced by zone_iterator().

170 {
171  int i;
172 
173  for (i = 0; i < rd_len; i++)
174  {
175  char *s;
176  if ((GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type) ||
177  (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) )
178  continue;
179  s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
180  rd[i].data,
181  rd[i].data_size);
182  if (NULL == s)
183  continue;
184  if (0 == strcmp (s, pk))
185  *found_rec = GNUNET_YES;
186  GNUNET_free (s);
187  }
188 }
static struct GNUNET_CRYPTO_EddsaPrivateKey * pk
Private key of this peer.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_GNSRECORD_TYPE_PKEY
Record type for GNS zone transfer ("PKEY").
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
#define GNUNET_YES
Definition: gnunet_common.h:77
uint32_t data
The data value.
char * GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;value&#39; of a record to a string.
Definition: gnsrecord.c:143
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zone_iterator()

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 
)
static

Process a record that was stored in the namestore.

Parameters
clsclosure
zone_keyprivate key of the zone
rnamename that is being mapped (at most 255 characters long)
rd_lennumber of entries in rd array
rdarray of records with data to store

Definition at line 201 of file gnunet-gns-import.c.

References check_pkey(), found_pin_rec, found_private_rec, GNUNET_NAMESTORE_zone_iterator_next(), pin_zone_pkey, and private_zone_pkey.

Referenced by get_ego().

205 {
206  if (NULL != rname)
207  {
208  if (0 == strcmp (rname, "private"))
210  else if (0 == strcmp (rname, "pin"))
211  check_pkey (rd_len, rd, pin_zone_pkey, &found_pin_rec);
212  }
214 }
static char * pin_zone_pkey
String version of PKEY for pin-zone.
static char * private_zone_pkey
String version of PKEY for private-zone.
struct GNUNET_NAMESTORE_ZoneIterator * list_it
Zone iterator for master zone.
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record...
static int found_pin_rec
Set to GNUNET_YES if pin record was found;.
static int found_private_rec
Set to GNUNET_YES if private record was found;.
static void check_pkey(unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, char *pk, int *found_rec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zone_iteration_error()

static void zone_iteration_error ( void *  cls)
static

Definition at line 218 of file gnunet-gns-import.c.

References found_pin_rec, found_private_rec, GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_SCHEDULER_shutdown(), pin_zone_pkey, private_zone_pkey, ret, run_process_and_wait(), and st.

Referenced by get_ego().

219 {
221  unsigned long code;
222 
223  if (! found_private_rec)
224  {
226  NULL, NULL, &st, &code,
227  "gnunet-namestore",
228  "gnunet-namestore", "-z", "master-zone",
229  "-a", "-e", "never", "-n", "private", "-p",
230  "-t", "PKEY", "-V",
231  private_zone_pkey, NULL))
232  {
233  ret = 8;
234  return;
235  }
236  }
237  if (! found_pin_rec)
238  {
240  NULL, NULL, &st, &code,
241  "gnunet-namestore",
242  "gnunet-namestore", "-z", "master-zone",
243  "-a", "-e", "never", "-n", "pin", "-p", "-t",
244  "PKEY", "-V", pin_zone_pkey,
245  NULL))
246  {
247  ret = 10;
248  return;
249  }
250  }
251  list_it = NULL;
253 }
static char * pin_zone_pkey
String version of PKEY for pin-zone.
static char * private_zone_pkey
String version of PKEY for private-zone.
struct GNUNET_NAMESTORE_ZoneIterator * list_it
Zone iterator for master zone.
#define GNUNET_NO
Definition: gnunet_common.h:78
static int run_process_and_wait(int pipe_control, 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,...)
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:526
GNUNET_OS_ProcessStatusType
Process status types.
static int found_pin_rec
Set to GNUNET_YES if pin record was found;.
When these flags are set, the child process will inherit stdout and stderr of the parent...
Definition: gnunet_os_lib.h:97
static int found_private_rec
Set to GNUNET_YES if private record was found;.
static int ret
Exit code.
static struct GNUNET_SCHEDULER_Task * st
The shutdown task.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zone_iteration_finished()

static void zone_iteration_finished ( void *  cls)
static

Definition at line 257 of file gnunet-gns-import.c.

Referenced by get_ego().

258 {
259 }
Here is the caller graph for this function:

◆ get_ego()

static void get_ego ( void *  cls,
struct GNUNET_IDENTITY_Ego ego,
void **  ctx,
const char *  identifier 
)
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 (i.e. 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).

Parameters
clsclosure
egoego handle
ctxcontext for application to store data for this ego (during the lifetime of this process, initially NULL)
identifieridentifier 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 296 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(), master_pk, master_zone_pkey, private_zone_pkey, ret, zone_iteration_error(), zone_iteration_finished(), and zone_iterator().

Referenced by run().

300 {
301  static struct GNUNET_CRYPTO_EcdsaPublicKey pk;
302 
303  if (NULL == ego)
304  {
305  if ((NULL == master_zone_pkey) ||
306  (NULL == private_zone_pkey) )
307  {
308  ret = 11;
310  return;
311  }
313  &master_pk,
315  NULL, &zone_iterator, NULL,
317  NULL);
318  if (NULL == list_it)
319  {
320  ret = 12;
322  }
323  return;
324  }
326  if (NULL != identifier)
327  {
328  if ((NULL == master_zone_pkey) && (0 == strcmp ("master-zone",
329  identifier)) )
330  {
333  }
334  else if ((NULL == private_zone_pkey) && (0 == strcmp ("private-zone",
335  identifier)) )
337  }
338 }
static struct GNUNET_CRYPTO_EddsaPrivateKey * pk
Private key of this peer.
static char * private_zone_pkey
String version of PKEY for private-zone.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
struct GNUNET_NAMESTORE_ZoneIterator * list_it
Zone iterator for master zone.
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:555
static struct GNUNET_CRYPTO_EcdsaPrivateKey master_pk
Binary version of PKEY for master-zone.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:526
static void zone_iteration_finished(void *cls)
char * GNUNET_CRYPTO_ecdsa_public_key_to_string(const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Convert a public key to a string.
Definition: crypto_ecc.c:332
static int ret
Exit code.
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
void GNUNET_IDENTITY_ego_get_public_key(const struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:568
static char * master_zone_pkey
String version of PKEY for master-zone.
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.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
static void zone_iteration_error(void *cls)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task run on shutdown.

Parameters
clsNULL

Definition at line 347 of file gnunet-gns-import.c.

References GNUNET_free_non_null, GNUNET_IDENTITY_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_iteration_stop(), master_zone_pkey, and private_zone_pkey.

Referenced by run().

348 {
350  master_zone_pkey = NULL;
352  private_zone_pkey = NULL;
353  if (NULL != list_it)
354  {
356  list_it = NULL;
357  }
358  if (NULL != ns)
359  {
361  ns = NULL;
362  }
363  if (NULL != sh)
364  {
366  sh = NULL;
367  }
368 }
static char * private_zone_pkey
String version of PKEY for private-zone.
struct GNUNET_NAMESTORE_ZoneIterator * list_it
Zone iterator for master zone.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:837
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
static char * master_zone_pkey
String version of PKEY for master-zone.
static struct GNUNET_IDENTITY_Handle * sh
Handle to IDENTITY service.
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 c 
)
static

Main function that will be run.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cconfiguration

Definition at line 380 of file gnunet-gns-import.c.

References get_ego(), GNUNET_IDENTITY_connect(), GNUNET_NAMESTORE_connect(), GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_SCHEDULER_add_shutdown(), ret, run_process_and_wait(), shutdown_task(), and st.

Referenced by main().

382 {
384  unsigned long code;
385 
386  cfg = c;
387 
388  if (0 != run_process_and_wait (GNUNET_NO, 0, NULL, NULL, &st, &code,
389  "gnunet-arm",
390  "gnunet-arm", "-I", NULL))
391  {
392  if (7 == ret)
393  fprintf (stderr,
394  "GNUnet is not running, please start GNUnet before running import\n");
395  return;
396  }
397 
399  NULL, NULL, &st, &code,
400  "gnunet-identity",
401  "gnunet-identity", "-C", "master-zone", NULL))
402  return;
403 
405  NULL, NULL, &st, &code,
406  "gnunet-identity",
407  "gnunet-identity", "-C", "private-zone", NULL))
408  return;
409 
411  NULL, NULL, &st, &code,
412  "gnunet-identity",
413  "gnunet-identity", "-C", "sks-zone", NULL))
414  return;
415 
417  NULL, NULL, &st, &code,
418  "gnunet-identity",
419  "gnunet-identity", "-e", "master-zone", "-s",
420  "gns-master", NULL))
421  return;
422 
424  NULL, NULL, &st, &code,
425  "gnunet-identity",
426  "gnunet-identity", "-e", "master-zone", "-s",
427  "namestore", NULL))
428  return;
429 
431  NULL, NULL, &st, &code,
432  "gnunet-identity",
433  "gnunet-identity", "-e", "master-zone", "-s",
434  "gns-proxy", NULL))
435  return;
436 
438  NULL, NULL, &st, &code,
439  "gnunet-identity",
440  "gnunet-identity", "-e", "master-zone", "-s",
441  "gns-intercept", NULL))
442  return;
443 
445  NULL, NULL, &st, &code,
446  "gnunet-identity",
447  "gnunet-identity", "-e", "private-zone", "-s",
448  "gns-private", NULL))
449  return;
450 
452  NULL, NULL, &st, &code,
453  "gnunet-identity",
454  "gnunet-identity", "-e", "sks-zone", "-s",
455  "fs-sks", NULL))
456  return;
457 
461 }
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:527
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
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, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1300
#define GNUNET_NO
Definition: gnunet_common.h:78
static int run_process_and_wait(int pipe_control, 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,...)
GNUNET_OS_ProcessStatusType
Process status types.
When these flags are set, the child process will inherit stdout and stderr of the parent...
Definition: gnunet_os_lib.h:97
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
static int ret
Exit code.
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
static void get_ego(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier)
Get master-zone and private-zone keys.
static void shutdown_task(void *cls)
Task run on shutdown.
static struct GNUNET_IDENTITY_Handle * sh
Handle to IDENTITY service.
static struct GNUNET_SCHEDULER_Task * st
The shutdown task.
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 for gnunet-gns.

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

Definition at line 472 of file gnunet-gns-import.c.

References _, GNUNET_free, GNUNET_GETOPT_OPTION_END, GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), ret, and run().

473 {
474  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
476  };
477  int r;
478 
479  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
480  return 2;
481 
482  GNUNET_log_setup ("gnunet-gns-import", "WARNING", NULL);
483  ret = 0;
484  r = GNUNET_PROGRAM_run (argc, argv, "gnunet-gns-import",
485  _ (
486  "This program will import some GNS authorities into your GNS namestore."),
487  options,
488  &run, NULL);
489  GNUNET_free ((void*) argv);
490  return GNUNET_OK == r ? ret : 1;
491 }
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1438
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
Definition of a command line option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run.
static int ret
Exit code.
int GNUNET_PROGRAM_run(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, parse options).
Definition: program.c:367
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

Variable Documentation

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Configuration we are using.

Definition at line 35 of file gnunet-gns-import.c.

◆ sh

struct GNUNET_IDENTITY_Handle* sh
static

Handle to IDENTITY service.

Definition at line 40 of file gnunet-gns-import.c.

◆ list_it

Zone iterator for master zone.

Definition at line 45 of file gnunet-gns-import.c.

◆ ns

struct GNUNET_NAMESTORE_Handle* ns
static

Handle to the namestore.

Definition at line 50 of file gnunet-gns-import.c.

◆ master_zone_pkey

char* master_zone_pkey
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().

◆ master_pk

struct GNUNET_CRYPTO_EcdsaPrivateKey master_pk
static

Binary version of PKEY for master-zone.

Definition at line 60 of file gnunet-gns-import.c.

Referenced by get_ego().

◆ private_zone_pkey

char* private_zone_pkey
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().

◆ pin_zone_pkey

char* pin_zone_pkey
static
Initial value:
=
"72QC35CO20UJN1E91KPJFNT9TG4CLKAPB4VK9S3Q758S9MLBRKOG"

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

◆ found_private_rec

int found_private_rec = GNUNET_NO
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().

◆ found_pin_rec

int found_pin_rec = GNUNET_NO
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().

◆ ret

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