-adding options to gnunet-gns
authorChristian Grothoff <christian@grothoff.org>
Sun, 4 Mar 2012 16:19:07 +0000 (16:19 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 4 Mar 2012 16:19:07 +0000 (16:19 +0000)
doc/man/gnunet-gns.1
src/gns/gnunet-gns.c

index 12fd5e316398bf44093500191aa6cb4fb411b3f8..8fd4b33e4ca7f62cdf17c5b344aa7d9b2126b13b 100644 (file)
@@ -13,20 +13,41 @@ gnunet\-gns \- manipulate GNUnet GNS zones
 
 .SH OPTIONS
 .B
-.IP "\-z FILENAME, \-\-zonekey=FILENAME"
-Specifies the filename with the private key for the zone (mandatory option)
+.IP "\-a, \-\-add"
+Desired operation is adding a record
 .B
 .IP "\-c FILENAME,  \-\-config=FILENAME"
 Use the configuration file FILENAME.
 .B
+.IP "\-d, \-\-delete"
+Desired operation is deleting a record
+.B
+.IP "\-D, \-\-display"
+Desired operation is listing of matching records
+.B
+.IP "\-e TIME, \-\-expiration=TIME"
+Specifies expiration time of record to add; format is relative time, i.e "1 h" or "7 d 30 m".  Supported units are "ms", "s", "min" or "minutes", "h" (hours), "d" (days) and "a" (years).
+.B
 .IP "\-h, \-\-help"
 Print short help on options.
 .B
 .IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL"
 Use LOGLEVEL for logging.  Valid values are DEBUG, INFO, WARNING and ERROR.
 .B
+.IP "\-n NAME, \-\-name=NAME"
+Name of the record to add/delete/display
+.B
+.IP "\-t TYPE, \-\-type=TYPE"
+Type of the record to add/delete/display (i.e. "A", "AAAA", "NS", "PKEY", "MX" etc.)
+.B
 .IP "\-v, \-\-version"
 Print GNUnet version number.
+.B
+.IP "\-V VALUE, \-\-value=VALUE"
+Value to store or remove from the GNS zone.  Specific format depends on the record type.  A records expect a dotted decimal IPv4 address, AAAA records an IPv6 address, PKEY a public key in GNUnet's printable format, and CNAME and NS records should be a domain name.
+.B
+.IP "\-z FILENAME, \-\-zonekey=FILENAME"
+Specifies the filename with the private key for the zone (mandatory option)
 
 
 .SH BUGS
index a56b229b5a5228e9957740784187f8c9036f5f88..b56423c04eeba6bcdd496244b3fe49e01bea67de 100644 (file)
@@ -48,6 +48,41 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *zone_pkey;
  * Keyfile to manipulate.
  */
 static char *keyfile;  
+
+/**
+ * Desired action is to add a record.
+ */
+static int add;
+
+/**
+ * Desired action is to list records.
+ */
+static int list;
+
+/**
+ * Desired action is to remove a record.
+ */
+static int del;
+
+/**
+ * Name of the records to add/list/remove.
+ */
+static char *name;
+
+/**
+ * Value of the record to add/remove.
+ */
+static char *value;
+
+/**
+ * Type of the record to add/remove, NULL to remove all.
+ */
+static char *typestring;
+
+/**
+ * Desired expiration time.
+ */
+static char *expirationstring;
                
 
 /**
@@ -113,8 +148,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                  _("Failed to connect to namestore\n"));
       return;
     }
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                               &do_shutdown, NULL);
+  GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
 }
 
 
@@ -129,6 +163,27 @@ int
 main (int argc, char *const *argv)
 {
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+    {'a', "add", NULL,
+     gettext_noop ("add record"), 0,
+     &GNUNET_GETOPT_set_one, &add},   
+    {'d', "delete", NULL,
+     gettext_noop ("delete record"), 0,
+     &GNUNET_GETOPT_set_one, &del},   
+    {'D', "display", NULL,
+     gettext_noop ("display records"), 0,
+     &GNUNET_GETOPT_set_one, &list},   
+    {'e', "expiration", "TIME",
+     gettext_noop ("expiration time to use (for adding only)"), 1,
+     &GNUNET_GETOPT_set_string, &expirationstring},   
+    {'n', "name", "NAME",
+     gettext_noop ("name of the record to add/delete/display"), 1,
+     &GNUNET_GETOPT_set_string, &name},   
+    {'t', "type", "TYPE",
+     gettext_noop ("type of the record to add/delete/display"), 1,
+     &GNUNET_GETOPT_set_string, &typestring},   
+    {'V', "value", "VALUE",
+     gettext_noop ("value of the record to add/delete"), 1,
+     &GNUNET_GETOPT_set_string, &value},   
     {'z', "zonekey", "FILENAME",
      gettext_noop ("filename with the zone key"), 1,
      &GNUNET_GETOPT_set_string, &keyfile},