aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/gnunet-namestore.119
-rw-r--r--src/namestore/gnunet-namestore.c31
2 files changed, 37 insertions, 13 deletions
diff --git a/doc/man/gnunet-namestore.1 b/doc/man/gnunet-namestore.1
index ec99d088d..577785df1 100644
--- a/doc/man/gnunet-namestore.1
+++ b/doc/man/gnunet-namestore.1
@@ -1,4 +1,4 @@
1.TH GNUNET\-NAMESTORE 1 "Mar 5, 2012" "GNUnet" 1.TH GNUNET\-NAMESTORE 1 "Apr 15, 2014" "GNUnet"
2 2
3.SH NAME 3.SH NAME
4gnunet\-namestore \- manipulate GNUnet zones 4gnunet\-namestore \- manipulate GNUnet zones
@@ -9,7 +9,7 @@ gnunet\-namestore \- manipulate GNUnet zones
9.br 9.br
10 10
11.SH DESCRIPTION 11.SH DESCRIPTION
12\fBgnunet\-namestore\fP can be used to create and manipulate a GNS zone. 12\fBgnunet\-namestore\fP can be used to manipulate records in a GNS zone.
13 13
14.SH OPTIONS 14.SH OPTIONS
15.B 15.B
@@ -31,6 +31,9 @@ Specifies expiration time of record to add; format is relative time, i.e "1 h" o
31.IP "\-h, \-\-help" 31.IP "\-h, \-\-help"
32Print short help on options. 32Print short help on options.
33.B 33.B
34.IP "\-i NICKNAME, \-\-nick=NICKNAME"
35Set the desired NICKNAME for the zone. The nickname will be included in all (public) records and used as the suggested name for this zone.
36.B
34.IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL" 37.IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL"
35Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. 38Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR.
36.B 39.B
@@ -40,9 +43,18 @@ Monitor changes to the zone on an ongoing basis (in contrast to \-D, which merel
40.IP "\-n NAME, \-\-name=NAME" 43.IP "\-n NAME, \-\-name=NAME"
41Name of the record to add/delete/display 44Name of the record to add/delete/display
42.B 45.B
46.IP "\-p, \-\-public"
47Create a record that is public (shared with other users that know the label)
48.B
49.IP "\-P, \-\-pending"
50Create a record that is pending approval (stored in the namestore but unavailable for resolution to anyone)
51.B
43.IP "\-r PKEY, \-\-reverse=PKEY" 52.IP "\-r PKEY, \-\-reverse=PKEY"
44Determine our GNS name for the given public key (reverse lookup of the PKEY) in the given zone. 53Determine our GNS name for the given public key (reverse lookup of the PKEY) in the given zone.
45.B 54.B
55.IP "\-s, \-\-shadow"
56Create a record that is a shadow record. Shadow records are only used once all other records of the same type under the same label have expired.
57.B
46.IP "\-t TYPE, \-\-type=TYPE" 58.IP "\-t TYPE, \-\-type=TYPE"
47Type of the record to add/delete/display (i.e. "A", "AAAA", "NS", "PKEY", "MX" etc.) 59Type of the record to add/delete/display (i.e. "A", "AAAA", "NS", "PKEY", "MX" etc.)
48.B 60.B
@@ -64,4 +76,5 @@ Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic
64 76
65 77
66.SH "SEE ALSO" 78.SH "SEE ALSO"
67\fBgnunet\-gns\fP(1) 79\fBgnunet\-gns\fP(1), \fBgnunet\-namestore\-gtk\fP(1)
80
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index ec6ccbfbe..8dc35984e 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2012, 2013 Christian Grothoff (and other contributing authors) 3 (C) 2012, 2013, 2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -102,12 +102,17 @@ static int del;
102/** 102/**
103 * Is record public (opposite of #GNUNET_GNSRECORD_RF_PRIVATE) 103 * Is record public (opposite of #GNUNET_GNSRECORD_RF_PRIVATE)
104 */ 104 */
105static int public; 105static int is_public;
106 106
107/** 107/**
108 * Is record a shadow record (#GNUNET_GNSRECORD_RF_SHADOW_RECORD) 108 * Is record a shadow record (#GNUNET_GNSRECORD_RF_SHADOW_RECORD)
109 */ 109 */
110static int shadow; 110static int is_shadow;
111
112/**
113 * Is record pending approval (#GNUNET_GNSRECORD_RF_PENDING)
114 */
115static int is_pending;
111 116
112/** 117/**
113 * Queue entry for the 'del' operation. 118 * Queue entry for the 'del' operation.
@@ -475,10 +480,12 @@ get_existing_record (void *cls,
475 rde->data = data; 480 rde->data = data;
476 rde->data_size = data_size; 481 rde->data_size = data_size;
477 rde->record_type = type; 482 rde->record_type = type;
478 if (1 == shadow) 483 if (1 == is_shadow)
479 rde->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; 484 rde->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
480 if (1 != public) 485 if (1 != is_public)
481 rde->flags |= GNUNET_GNSRECORD_RF_PRIVATE; 486 rde->flags |= GNUNET_GNSRECORD_RF_PRIVATE;
487 if (1 == is_pending)
488 rde->flags |= GNUNET_GNSRECORD_RF_PENDING;
482 if (GNUNET_YES == etime_is_rel) 489 if (GNUNET_YES == etime_is_rel)
483 { 490 {
484 rde->expiration_time = etime_rel.rel_value_us; 491 rde->expiration_time = etime_rel.rel_value_us;
@@ -732,7 +739,7 @@ testservice_task (void *cls,
732 else 739 else
733 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 740 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
734 741
735 if (1 == shadow) 742 if (1 == is_shadow)
736 rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; 743 rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
737 add_qe_uri = GNUNET_NAMESTORE_records_store (ns, 744 add_qe_uri = GNUNET_NAMESTORE_records_store (ns,
738 &zone_pkey, 745 &zone_pkey,
@@ -905,8 +912,9 @@ run (void *cls, char *const *args, const char *cfgfile,
905int 912int
906main (int argc, char *const *argv) 913main (int argc, char *const *argv)
907{ 914{
908 public = -1; 915 is_public = -1;
909 shadow = -1; 916 is_pending = -1;
917 is_shadow = -1;
910 918
911 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 919 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
912 {'a', "add", NULL, 920 {'a', "add", NULL,
@@ -944,10 +952,13 @@ main (int argc, char *const *argv)
944 &GNUNET_GETOPT_set_string, &value}, 952 &GNUNET_GETOPT_set_string, &value},
945 {'p', "public", NULL, 953 {'p', "public", NULL,
946 gettext_noop ("create or list public record"), 0, 954 gettext_noop ("create or list public record"), 0,
947 &GNUNET_GETOPT_set_one, &public}, 955 &GNUNET_GETOPT_set_one, &is_public},
956 {'P', "pending", NULL,
957 gettext_noop ("create record that is pending approval (and thus for now inactive)"), 0,
958 &GNUNET_GETOPT_set_one, &is_pending},
948 {'s', "shadow", NULL, 959 {'s', "shadow", NULL,
949 gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), 0, 960 gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), 0,
950 &GNUNET_GETOPT_set_one, &shadow}, 961 &GNUNET_GETOPT_set_one, &is_shadow},
951 {'z', "zone", "EGO", 962 {'z', "zone", "EGO",
952 gettext_noop ("name of the ego controlling the zone"), 1, 963 gettext_noop ("name of the ego controlling the zone"), 1,
953 &GNUNET_GETOPT_set_string, &ego_name}, 964 &GNUNET_GETOPT_set_string, &ego_name},