diff options
-rw-r--r-- | doc/man/gnunet-gns.1 | 25 | ||||
-rw-r--r-- | src/gns/gnunet-gns.c | 59 |
2 files changed, 80 insertions, 4 deletions
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1 index 12fd5e316..8fd4b33e4 100644 --- a/doc/man/gnunet-gns.1 +++ b/doc/man/gnunet-gns.1 | |||
@@ -13,20 +13,41 @@ gnunet\-gns \- manipulate GNUnet GNS zones | |||
13 | 13 | ||
14 | .SH OPTIONS | 14 | .SH OPTIONS |
15 | .B | 15 | .B |
16 | .IP "\-z FILENAME, \-\-zonekey=FILENAME" | 16 | .IP "\-a, \-\-add" |
17 | Specifies the filename with the private key for the zone (mandatory option) | 17 | Desired operation is adding a record |
18 | .B | 18 | .B |
19 | .IP "\-c FILENAME, \-\-config=FILENAME" | 19 | .IP "\-c FILENAME, \-\-config=FILENAME" |
20 | Use the configuration file FILENAME. | 20 | Use the configuration file FILENAME. |
21 | .B | 21 | .B |
22 | .IP "\-d, \-\-delete" | ||
23 | Desired operation is deleting a record | ||
24 | .B | ||
25 | .IP "\-D, \-\-display" | ||
26 | Desired operation is listing of matching records | ||
27 | .B | ||
28 | .IP "\-e TIME, \-\-expiration=TIME" | ||
29 | 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). | ||
30 | .B | ||
22 | .IP "\-h, \-\-help" | 31 | .IP "\-h, \-\-help" |
23 | Print short help on options. | 32 | Print short help on options. |
24 | .B | 33 | .B |
25 | .IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL" | 34 | .IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL" |
26 | Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. | 35 | Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. |
27 | .B | 36 | .B |
37 | .IP "\-n NAME, \-\-name=NAME" | ||
38 | Name of the record to add/delete/display | ||
39 | .B | ||
40 | .IP "\-t TYPE, \-\-type=TYPE" | ||
41 | Type of the record to add/delete/display (i.e. "A", "AAAA", "NS", "PKEY", "MX" etc.) | ||
42 | .B | ||
28 | .IP "\-v, \-\-version" | 43 | .IP "\-v, \-\-version" |
29 | Print GNUnet version number. | 44 | Print GNUnet version number. |
45 | .B | ||
46 | .IP "\-V VALUE, \-\-value=VALUE" | ||
47 | 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. | ||
48 | .B | ||
49 | .IP "\-z FILENAME, \-\-zonekey=FILENAME" | ||
50 | Specifies the filename with the private key for the zone (mandatory option) | ||
30 | 51 | ||
31 | 52 | ||
32 | .SH BUGS | 53 | .SH BUGS |
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index a56b229b5..b56423c04 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -48,6 +48,41 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *zone_pkey; | |||
48 | * Keyfile to manipulate. | 48 | * Keyfile to manipulate. |
49 | */ | 49 | */ |
50 | static char *keyfile; | 50 | static char *keyfile; |
51 | |||
52 | /** | ||
53 | * Desired action is to add a record. | ||
54 | */ | ||
55 | static int add; | ||
56 | |||
57 | /** | ||
58 | * Desired action is to list records. | ||
59 | */ | ||
60 | static int list; | ||
61 | |||
62 | /** | ||
63 | * Desired action is to remove a record. | ||
64 | */ | ||
65 | static int del; | ||
66 | |||
67 | /** | ||
68 | * Name of the records to add/list/remove. | ||
69 | */ | ||
70 | static char *name; | ||
71 | |||
72 | /** | ||
73 | * Value of the record to add/remove. | ||
74 | */ | ||
75 | static char *value; | ||
76 | |||
77 | /** | ||
78 | * Type of the record to add/remove, NULL to remove all. | ||
79 | */ | ||
80 | static char *typestring; | ||
81 | |||
82 | /** | ||
83 | * Desired expiration time. | ||
84 | */ | ||
85 | static char *expirationstring; | ||
51 | 86 | ||
52 | 87 | ||
53 | /** | 88 | /** |
@@ -113,8 +148,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
113 | _("Failed to connect to namestore\n")); | 148 | _("Failed to connect to namestore\n")); |
114 | return; | 149 | return; |
115 | } | 150 | } |
116 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 151 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
117 | &do_shutdown, NULL); | ||
118 | } | 152 | } |
119 | 153 | ||
120 | 154 | ||
@@ -129,6 +163,27 @@ int | |||
129 | main (int argc, char *const *argv) | 163 | main (int argc, char *const *argv) |
130 | { | 164 | { |
131 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 165 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
166 | {'a', "add", NULL, | ||
167 | gettext_noop ("add record"), 0, | ||
168 | &GNUNET_GETOPT_set_one, &add}, | ||
169 | {'d', "delete", NULL, | ||
170 | gettext_noop ("delete record"), 0, | ||
171 | &GNUNET_GETOPT_set_one, &del}, | ||
172 | {'D', "display", NULL, | ||
173 | gettext_noop ("display records"), 0, | ||
174 | &GNUNET_GETOPT_set_one, &list}, | ||
175 | {'e', "expiration", "TIME", | ||
176 | gettext_noop ("expiration time to use (for adding only)"), 1, | ||
177 | &GNUNET_GETOPT_set_string, &expirationstring}, | ||
178 | {'n', "name", "NAME", | ||
179 | gettext_noop ("name of the record to add/delete/display"), 1, | ||
180 | &GNUNET_GETOPT_set_string, &name}, | ||
181 | {'t', "type", "TYPE", | ||
182 | gettext_noop ("type of the record to add/delete/display"), 1, | ||
183 | &GNUNET_GETOPT_set_string, &typestring}, | ||
184 | {'V', "value", "VALUE", | ||
185 | gettext_noop ("value of the record to add/delete"), 1, | ||
186 | &GNUNET_GETOPT_set_string, &value}, | ||
132 | {'z', "zonekey", "FILENAME", | 187 | {'z', "zonekey", "FILENAME", |
133 | gettext_noop ("filename with the zone key"), 1, | 188 | gettext_noop ("filename with the zone key"), 1, |
134 | &GNUNET_GETOPT_set_string, &keyfile}, | 189 | &GNUNET_GETOPT_set_string, &keyfile}, |