GNUnet  0.19.5
gnunet-namestore-zonefile.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012, 2013, 2014, 2019, 2022 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #include "platform.h"
27 #include <gnunet_util_lib.h>
29 
30 #define MAX_RECORDS_PER_NAME 50
31 
35 #define MAX_ZONEFILE_LINE_LEN 4096
36 
40 #define MAX_ZONEFILE_RECORD_DATA_LEN 2048
41 
47 
51 static struct GNUNET_TIME_Relative ttl;
52 
57 
61 static unsigned int rd_count = 0;
62 
66 static int ret = 0;
67 
71 static char *ego_name = NULL;
72 
76 static char *res;
77 
81 static unsigned int published_sets = 0;
82 
86 static unsigned int published_records = 0;
87 
88 
93 
98 
103 
108 
113 
117 static struct GNUNET_IDENTITY_Handle *id;
118 
122 static const struct GNUNET_CONFIGURATION_Handle *cfg;
123 
128 
132 static int state;
133 
135 {
136 
137  /* Uninitialized */
139 
140  /* The initial state */
142 
143  /* The $ORIGIN has changed */
145 
146  /* The record name/label has changed */
148 
149 };
150 
151 
152 
158 static void
159 do_shutdown (void *cls)
160 {
161  (void) cls;
162  if (NULL != ego_name)
164  if (NULL != el)
165  {
167  el = NULL;
168  }
169  if (NULL != ns_qe)
171  if (NULL != id_op)
173  if (NULL != ns)
175  if (NULL != id)
177  for (int i = 0; i < rd_count; i++)
178  {
179  void *rd_ptr = (void*) rd[i].data;
180  GNUNET_free (rd_ptr);
181  }
182  if (NULL != parse_task)
184 }
185 
186 static void
187 tx_end (void *cls, enum GNUNET_ErrorCode ec)
188 {
189  ns_qe = NULL;
190  if (GNUNET_EC_NONE != ec)
191  {
192  fprintf (stderr,
193  _ ("Ego `%s' not known to identity service\n"),
194  ego_name);
196  ret = -1;
197  }
199 }
200 
201 static void
202 parse (void *cls);
203 
204 static char*
205 trim (char *line)
206 {
207  char *ltrimmed = line;
208  int ltrimmed_len;
209  int quoted = 0;
210 
211  // Trim all whitespace to the left
212  while (*ltrimmed == ' ')
213  ltrimmed++;
214  ltrimmed_len = strlen (ltrimmed);
215  // Find the first occurence of an unqoted ';', which is our comment
216  for (int i = 0; i < ltrimmed_len; i++)
217  {
218  if (ltrimmed[i] == '"')
219  quoted = ! quoted;
220  if ((ltrimmed[i] != ';') || quoted)
221  continue;
222  ltrimmed[i] = '\0';
223  }
224  ltrimmed_len = strlen (ltrimmed);
225  // Remove trailing whitespace
226  for (int i = ltrimmed_len; i > 0; i--)
227  {
228  if (ltrimmed[i - 1] != ' ')
229  break;
230  ltrimmed[i - 1] = '\0';
231  }
232  ltrimmed_len = strlen (ltrimmed);
233  if (ltrimmed[ltrimmed_len - 1] == '\n')
234  ltrimmed[ltrimmed_len - 1] = ' ';
235  return ltrimmed;
236 }
237 
238 static char*
239 next_token (char *token)
240 {
241  char *next = token;
242  while (*next == ' ')
243  next++;
244  return next;
245 }
246 
247 static int
248 parse_ttl (char *token, struct GNUNET_TIME_Relative *ttl)
249 {
250  char *next;
251  unsigned int ttl_tmp;
252 
253  next = strchr (token, ';');
254  if (NULL != next)
255  next[0] = '\0';
256  next = strchr (token, ' ');
257  if (NULL != next)
258  next[0] = '\0';
259  if (1 != sscanf (token, "%u", &ttl_tmp))
260  {
261  fprintf (stderr, "Unable to parse TTL `%s'\n", token);
262  return GNUNET_SYSERR;
263  }
264  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TTL is: %u\n", ttl_tmp);
265  ttl->rel_value_us = ttl_tmp * 1000 * 1000;
266  return GNUNET_OK;
267 }
268 
269 static int
270 parse_origin (char *token, char *origin)
271 {
272  char *next;
273  next = strchr (token, ';');
274  if (NULL != next)
275  next[0] = '\0';
276  next = strchr (token, ' ');
277  if (NULL != next)
278  next[0] = '\0';
279  strcpy (origin, token);
280  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Origin is: %s\n", origin);
281  return GNUNET_OK;
282 }
283 
284 static void
286  enum GNUNET_ErrorCode ec)
287 {
288  id_op = NULL;
289  if (GNUNET_EC_NONE != ec)
290  {
291  fprintf (stderr, "Error: %s\n", GNUNET_ErrorCode_get_hint (ec));
292  ret = 1;
294  return;
295  }
297  zone_pkey = *pk;
299 }
300 
301 static void
302 origin_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
303 {
304 
305  el = NULL;
306 
307  if (NULL == ego)
308  {
310  "$ORIGIN %s does not exist, creating...\n", ego_name);
312  GNUNET_IDENTITY_TYPE_ECDSA, // FIXME make configurable
314  NULL);
315  return;
316  }
320 }
321 
322 static void
323 add_continuation (void *cls, enum GNUNET_ErrorCode ec)
324 {
325  ns_qe = NULL;
326  if (GNUNET_EC_NONE != ec)
327  {
328  fprintf (stderr,
329  _ ("Failed to store records...\n"));
331  ret = -1;
332  }
333  if (ZS_ORIGIN_CHANGED == state)
334  {
335  if (NULL != ego_name)
338  if (ego_name[strlen (ego_name) - 1] == '.')
339  ego_name[strlen (ego_name) - 1] = '\0';
341  "Changing origin to %s\n", ego_name);
343  &origin_lookup_cb, NULL);
344  return;
345  }
347 }
348 
349 
350 
367 static void
368 parse (void *cls)
369 {
372  char *next;
373  char *token;
374  char *payload_pos;
375  static char lastname[GNUNET_DNSPARSER_MAX_LABEL_LENGTH];
376  char newname[GNUNET_DNSPARSER_MAX_LABEL_LENGTH];
377  void *data;
378  size_t data_size;
379  int ttl_line = 0;
380  int type;
381  int bracket_unclosed = 0;
382  int quoted = 0;
383 
384  parse_task = NULL;
385  /* use filename provided as 1st argument (stdin by default) */
386  int ln = 0;
387  while ((res = fgets (buf, sizeof(buf), stdin))) /* read each line of input */
388  {
389  ln++;
390  ttl_line = 0;
391  token = trim (buf);
393  "Trimmed line (bracket %s): `%s'\n",
394  (bracket_unclosed > 0) ? "unclosed" : "closed",
395  token);
396  if ((0 == strlen (token)) ||
397  ((1 == strlen (token)) && (' ' == *token)))
398  continue; // I guess we can safely ignore blank lines
399  if (bracket_unclosed == 0)
400  {
401  /* Payload is already parsed */
402  payload_pos = payload;
403  /* Find space */
404  next = strchr (token, ' ');
405  if (NULL == next)
406  {
407  fprintf (stderr, "Error at line %u: %s\n", ln, token);
408  ret = 1;
410  return;
411  }
412  next[0] = '\0';
413  next++;
414  if (0 == (strcmp (token, "$ORIGIN")))
415  {
417  token = next_token (next);
418  }
419  else if (0 == (strcmp (token, "$TTL")))
420  {
421  ttl_line = 1;
422  token = next_token (next);
423  }
424  else
425  {
426  if (0 == strcmp (token, "IN")) // Inherit name from before
427  {
429  "Old name: %s\n", lastname);
430  strcpy (newname, lastname);
431  token[strlen (token)] = ' ';
432  }
433  else if (token[strlen (token) - 1] != '.') // no fqdn
434  {
435  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: %s\n", token);
436  if (GNUNET_DNSPARSER_MAX_LABEL_LENGTH < strlen (token))
437  {
438  fprintf (stderr,
439  _ ("Name `%s' is too long\n"),
440  token);
441  ret = 1;
443  return;
444  }
445  strcpy (newname, token);
446  token = next_token (next);
447  }
448  else if (0 == strcmp (token, origin))
449  {
450  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: @\n");
451  strcpy (newname, "@");
452  token = next_token (next);
453  }
454  else
455  {
456  if (strlen (token) < strlen (origin))
457  {
458  fprintf (stderr, "Wrong origin: %s (expected %s)\n", token, origin);
459  break; // FIXME error?
460  }
461  if (0 != strcmp (token + (strlen (token) - strlen (origin)), origin))
462  {
463  fprintf (stderr, "Wrong origin: %s (expected %s)\n", token, origin);
464  break;
465  }
466  token[strlen (token) - strlen (origin) - 1] = '\0';
467  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: %s\n", token);
468  if (GNUNET_DNSPARSER_MAX_LABEL_LENGTH < strlen (token))
469  {
470  fprintf (stderr,
471  _ ("Name `%s' is too long\n"),
472  token);
473  ret = 1;
475  return;
476  }
477  strcpy (newname, token);
478  token = next_token (next);
479  }
480  if (0 != strcmp (newname, lastname) &&
481  (0 < rd_count))
482  {
484  "Name changed %s->%s, storing record set of %u elements\n",
485  lastname, newname,
486  rd_count);
488  }
489  else {
490  strcpy (lastname, newname);
491  }
492  }
493 
494  if (ttl_line)
495  {
496  if (GNUNET_SYSERR == parse_ttl (token, &ttl))
497  {
498  fprintf (stderr, _ ("Failed to parse $TTL\n"));
499  ret = 1;
501  return;
502  }
503  continue;
504  }
505  if (ZS_ORIGIN_CHANGED == state)
506  {
507  if (GNUNET_SYSERR == parse_origin (token, origin))
508  {
509  fprintf (stderr, _ ("Failed to parse $ORIGIN from %s\n"), token);
510  ret = 1;
512  return;
513  }
514  break;
515  }
516  if (ZS_READY == state)
517  {
518  fprintf (stderr,
519  _ (
520  "You must provide $ORIGIN in your zonefile or via arguments (--zone)!\n"));
521  ret = 1;
523  return;
524  }
525  // This is a record, let's go
527  {
528  fprintf (stderr,
529  _ ("Only %u records per unique name supported.\n"),
531  ret = 1;
533  return;
534  }
537  next = strchr (token, ' ');
538  if (NULL == next)
539  {
540  fprintf (stderr, "Error, last token: %s\n", token);
541  ret = 1;
543  break;
544  }
545  next[0] = '\0';
546  next++;
547  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "class is: %s\n", token);
548  while (*next == ' ')
549  next++;
550  token = next;
551  next = strchr (token, ' ');
552  if (NULL == next)
553  {
554  fprintf (stderr, "Error\n");
555  break;
556  }
557  next[0] = '\0';
558  next++;
559  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "type is: %s\n", token);
562  while (*next == ' ')
563  next++;
564  token = next;
565  }
566  for (int i = 0; i < strlen (token); i++)
567  {
568  if (token[i] == '"')
569  quoted = ! quoted;
570  if ((token[i] == '(') && ! quoted)
571  bracket_unclosed++;
572  if ((token[i] == ')') && ! quoted)
573  bracket_unclosed--;
574  }
575  memcpy (payload_pos, token, strlen (token));
576  payload_pos += strlen (token);
577  if (bracket_unclosed > 0)
578  {
579  *payload_pos = ' ';
580  payload_pos++;
581  continue;
582  }
583  *payload_pos = '\0';
584  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "data is: %s\n\n", payload);
585  if (GNUNET_OK !=
587  &data,
588  &data_size))
589  {
590  fprintf (stderr,
591  _ ("Data `%s' invalid\n"),
592  payload);
593  ret = 1;
595  return;
596  }
597  rd[rd_count].data = data;
599  if (ZS_NAME_CHANGED == state)
600  break;
601  rd_count++;
602  }
603  if (rd_count > 0)
604  {
606  &zone_pkey,
607  lastname,
608  rd_count,
609  rd,
611  NULL);
612  published_sets++;
614  for (int i = 0; i < rd_count; i++)
615  {
616  data = (void*) rd[i].data;
617  GNUNET_free (data);
618  }
619  if (ZS_NAME_CHANGED == state)
620  {
621  rd[0] = rd[rd_count]; // recover last rd parsed.
622  rd_count = 1;
623  strcpy (lastname, newname);
625  }
626  else
627  rd_count = 0;
628  return;
629  }
630  if (ZS_ORIGIN_CHANGED == state)
631  {
632  if (NULL != ego_name)
635  if (ego_name[strlen (ego_name) - 1] == '.')
636  ego_name[strlen (ego_name) - 1] = '\0';
638  "Changing origin to %s\n", ego_name);
640  &origin_lookup_cb, NULL);
641  return;
642  }
643  printf ("Published %u records sets with total %u records\n",
646  &tx_end,
647  NULL);
648 }
649 
650 static void
651 tx_start (void *cls, enum GNUNET_ErrorCode ec)
652 {
653  ns_qe = NULL;
654  if (GNUNET_EC_NONE != ec)
655  {
656  fprintf (stderr,
657  _ ("Ego `%s' not known to identity service\n"),
658  ego_name);
660  ret = -1;
661  return;
662  }
664 }
665 
666 static void
667 identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
668 {
669 
670  el = NULL;
671  if (NULL == ego)
672  {
673  if (NULL != ego_name)
674  {
675  fprintf (stderr,
676  _ ("Ego `%s' not known to identity service\n"),
677  ego_name);
678 
679  }
681  ret = -1;
682  return;
683  }
685  sprintf (origin, "%s.", ego_name);
688  &tx_start,
689  NULL);
690 }
691 
692 
693 static void
694 run (void *cls,
695  char *const *args,
696  const char *cfgfile,
697  const struct GNUNET_CONFIGURATION_Handle *_cfg)
698 {
699  cfg = _cfg;
702  if (NULL == ns)
703  {
704  fprintf (stderr,
705  _ ("Failed to connect to NAMESTORE\n"));
706  return;
707  }
708  id = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
709  if (NULL == id)
710  {
711  fprintf (stderr,
712  _ ("Failed to connect to IDENTITY\n"));
713  return;
714  }
715  if (NULL != ego_name)
717  else
719  state = ZS_READY;
720 }
721 
722 
730 int
731 main (int argc, char *const *argv)
732 {
735  "zone",
736  "EGO",
737  gettext_noop (
738  "name of the ego controlling the zone"),
739  &ego_name),
741  };
742  int lret;
743 
744  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
745  return 2;
746 
747  GNUNET_log_setup ("gnunet-namestore-dbtool", "WARNING", NULL);
748  if (GNUNET_OK !=
749  (lret = GNUNET_PROGRAM_run (argc,
750  argv,
751  "gnunet-namestore-zonefile",
752  _ (
753  "GNUnet namestore database manipulation tool"),
754  options,
755  &run,
756  NULL)))
757  {
758  GNUNET_free_nz ((void *) argv);
759  return lret;
760  }
761  GNUNET_free_nz ((void *) argv);
762  return ret;
763 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NONE
No error (success).
#define gettext_noop(String)
Definition: gettext.h:70
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static char * line
Desired phone line (string to be converted to a hash).
uint32_t data
The data value.
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
static struct GNUNET_NAMESTORE_QueueEntry * ns_qe
Queue entry for the 'add' operation.
static int parse_ttl(char *token, struct GNUNET_TIME_Relative *ttl)
static struct GNUNET_IDENTITY_Operation * id_op
Origin create operations.
static int parse_origin(char *token, char *origin)
static struct GNUNET_IDENTITY_PrivateKey zone_pkey
Private key for the our zone.
static char * next_token(char *token)
static void identity_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
static void parse(void *cls)
Main function that will be run.
static unsigned int published_records
Statistics, how many records published in aggregate.
static void origin_create_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *pk, enum GNUNET_ErrorCode ec)
static const struct GNUNET_CONFIGURATION_Handle * cfg
Current configurataion.
static void tx_end(void *cls, enum GNUNET_ErrorCode ec)
static struct GNUNET_SCHEDULER_Task * parse_task
Scheduled parse task.
static struct GNUNET_TIME_Relative ttl
Current record $TTL to use.
#define MAX_RECORDS_PER_NAME
static int ret
Return code.
static void do_shutdown(void *cls)
Task run on shutdown.
static struct GNUNET_IDENTITY_EgoLookup * el
Handle to identity lookup.
static char * ego_name
Name of the ego.
#define MAX_ZONEFILE_LINE_LEN
Maximum length of a zonefile line.
static char origin[GNUNET_DNSPARSER_MAX_NAME_LENGTH]
Current origin.
#define MAX_ZONEFILE_RECORD_DATA_LEN
FIXME: Soft limit this?
static int state
The current state of the parser.
static void add_continuation(void *cls, enum GNUNET_ErrorCode ec)
static unsigned int rd_count
Number of records for currently parsed set.
static void tx_start(void *cls, enum GNUNET_ErrorCode ec)
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *_cfg)
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
static char * res
Currently read line or NULL on EOF.
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
int main(int argc, char *const *argv)
The main function for gnunet-namestore-dbtool.
static char * trim(char *line)
static void origin_lookup_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static unsigned int published_sets
Statistics, how many published record sets.
static unsigned long long payload
How much data are we currently storing in the database?
static char buf[2048]
Plugin API for the namestore database backend.
#define GNUNET_DNSPARSER_MAX_LABEL_LENGTH
Maximum length of a label in DNS.
#define GNUNET_DNSPARSER_MAX_NAME_LENGTH
Maximum length of a name in DNS.
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.
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
uint32_t GNUNET_GNSRECORD_typename_to_number(const char *dns_typename)
Convert a type name (e.g.
Definition: gnsrecord.c:200
int GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of the value s of a record of type type to the respective binary repre...
Definition: gnsrecord.c:177
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:560
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create(struct GNUNET_IDENTITY_Handle *h, const char *name, const struct GNUNET_IDENTITY_PrivateKey *privkey, enum GNUNET_IDENTITY_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
Create a new ego with the given name.
Definition: identity_api.c:586
void GNUNET_IDENTITY_cancel(struct GNUNET_IDENTITY_Operation *op)
Cancel an identity operation.
Definition: identity_api.c:740
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
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:531
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:757
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
@ GNUNET_IDENTITY_TYPE_ECDSA
The identity type.
#define GNUNET_log(kind,...)
@ GNUNET_OK
@ GNUNET_SYSERR
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_free_nz(ptr)
Wrapper around free.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_begin(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
New API draft.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_commit(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Commit a namestore transaction.
enum GNUNET_GenericReturnValue 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,...
Definition: program.c:400
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1299
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:1334
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1222
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
Definition of a command line option.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.
Handle for ego lookup.
Handle for an ego.
Definition: identity.h:37
Handle for the service.
Definition: identity_api.c:97
Handle for an operation with the identity service.
Definition: identity_api.c:41
A private key for an identity as per LSD0001.
Connection to the NAMESTORE service.
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:53
Entry in list of pending tasks.
Definition: scheduler.c:136
struct GNUNET_SCHEDULER_Task * next
This is a linked list.
Definition: scheduler.c:140
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model