* TODO:
* - allow users to set record options (not just 'RF_AUTHORITY')
* - test
- * - parsing SOA, PTR and MX value specifications (and define format!)
* - add options to list/lookup individual records
*/
#include "platform.h"
*/
static int del;
+/**
+ * Is record public
+ */
+static int public;
+
+/**
+ * Is record authority
+ */
+static int nonauthority;
+
/**
* Queue entry for the 'del' operation.
*/
}
if (NULL != expirationstring)
{
- if (GNUNET_OK !=
+ if (0 == strcmp (expirationstring, "never"))
+ {
+ etime = GNUNET_TIME_relative_get_forever();
+ }
+ else if (GNUNET_OK !=
GNUNET_STRINGS_fancy_time_to_relative (expirationstring,
&etime))
{
rd.data_size = data_size;
rd.record_type = type;
rd.expiration = GNUNET_TIME_relative_to_absolute (etime);
- rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
+ if (1 != nonauthority)
+ rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY;
+ if (1 != public)
+ rd.flags |= GNUNET_NAMESTORE_RF_PRIVATE;
add_qe = GNUNET_NAMESTORE_record_create (ns,
zone_pkey,
name,
}
if (list)
{
+ uint32_t must_not_flags = 0;
+
+ if (1 == nonauthority) /* List non-authority records */
+ must_not_flags |= GNUNET_NAMESTORE_RF_AUTHORITY;
+
+ if (1 == public)
+ must_not_flags |= GNUNET_NAMESTORE_RF_PRIVATE;
+
list_it = GNUNET_NAMESTORE_zone_iteration_start (ns,
&zone,
- 0, 0,
+ 0,
+ must_not_flags,
&display_record,
NULL);
}
int
main (int argc, char *const *argv)
{
+ nonauthority = -1;
+ public = -1;
+
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
{'a', "add", NULL,
gettext_noop ("add record"), 0,
gettext_noop ("display records"), 0,
&GNUNET_GETOPT_set_one, &list},
{'e', "expiration", "TIME",
- gettext_noop ("expiration time for record to use (for adding only)"), 1,
+ gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1,
&GNUNET_GETOPT_set_string, &expirationstring},
{'n', "name", "NAME",
gettext_noop ("name of the record to add/delete/display"), 1,
{'V', "value", "VALUE",
gettext_noop ("value of the record to add/delete"), 1,
&GNUNET_GETOPT_set_string, &value},
+ {'p', "public", NULL,
+ gettext_noop ("create or list public record"), 0,
+ &GNUNET_GETOPT_set_one, &public},
+ {'N', "non-authority", NULL,
+ gettext_noop ("create or list non-authority record"), 0,
+ &GNUNET_GETOPT_set_one, &nonauthority},
{'z', "zonekey", "FILENAME",
gettext_noop ("filename with the zone key"), 1,
&GNUNET_GETOPT_set_string, &keyfile},