aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/gnunet-core.16
-rw-r--r--src/cli/core/gnunet-core.c42
2 files changed, 39 insertions, 9 deletions
diff --git a/doc/man/gnunet-core.1 b/doc/man/gnunet-core.1
index 745a666b8..921f2ead6 100644
--- a/doc/man/gnunet-core.1
+++ b/doc/man/gnunet-core.1
@@ -39,8 +39,6 @@
39.Nm 39.Nm
40is a tool to access various functions of GNUnet's core subsystem 40is a tool to access various functions of GNUnet's core subsystem
41from the command-line. 41from the command-line.
42The only function right now is to monitor the status of peers
43known to the CORE service.
44.Bl -tag -width indent 42.Bl -tag -width indent
45.It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME 43.It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME
46Configuration file to use. 44Configuration file to use.
@@ -52,6 +50,10 @@ Possible values for LOGLEVEL are ERROR, WARNING, INFO and DEBUG.
52.It Fl m | -monitor 50.It Fl m | -monitor
53In monitor mode, gnunet-core will continuously print the connection status, 51In monitor mode, gnunet-core will continuously print the connection status,
54instead of giving just a snapshot. 52instead of giving just a snapshot.
53.It Fl i | -show-identity
54Output current local peer identity.
55.It Fl s | -connection-status
56Show current peer connection status.
55.It Fl v | -version 57.It Fl v | -version
56Print the version number. 58Print the version number.
57.It Fl V | -verbose 59.It Fl V | -verbose
diff --git a/src/cli/core/gnunet-core.c b/src/cli/core/gnunet-core.c
index c7aef5349..9d6eccb81 100644
--- a/src/cli/core/gnunet-core.c
+++ b/src/cli/core/gnunet-core.c
@@ -34,6 +34,16 @@
34static int monitor_connections; 34static int monitor_connections;
35 35
36/** 36/**
37 * Option -i.
38 */
39static int show_pid;
40
41/**
42 * Option -s.
43 */
44static int show_conns;
45
46/**
37 * Handle to the CORE monitor. 47 * Handle to the CORE monitor.
38 */ 48 */
39static struct GNUNET_CORE_MonitorHandle *mh; 49static struct GNUNET_CORE_MonitorHandle *mh;
@@ -184,14 +194,18 @@ run (void *cls,
184 return; 194 return;
185 } 195 }
186 GNUNET_CRYPTO_eddsa_key_get_public (&pk, &pub); 196 GNUNET_CRYPTO_eddsa_key_get_public (&pk, &pub);
187 fprintf (stdout, 197 if (show_pid)
188 _ ("Local peer: %s\n\n"), 198 fprintf (stdout,
189 GNUNET_i2s ((struct GNUNET_PeerIdentity*) &pub)); 199 _ ("Current local peer identity: %s\n"),
190 mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL); 200 GNUNET_i2s_full ((struct GNUNET_PeerIdentity*) &pub));
191 if (NULL == mh) 201 if (show_conns || monitor_connections)
192 { 202 {
193 fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n")); 203 mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL);
194 return; 204 if (NULL == mh)
205 {
206 fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n"));
207 return;
208 }
195 } 209 }
196 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 210 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
197} 211}
@@ -215,6 +229,20 @@ main (int argc, char *const *argv)
215 gettext_noop ( 229 gettext_noop (
216 "provide information about all current connections (continuously)"), 230 "provide information about all current connections (continuously)"),
217 &monitor_connections), 231 &monitor_connections),
232 GNUNET_GETOPT_option_flag (
233 'i',
234 "show-identity",
235 gettext_noop (
236 "Show our current peer identity"
237 ),
238 &show_pid),
239 GNUNET_GETOPT_option_flag (
240 's',
241 "connection-status",
242 gettext_noop (
243 "Show current connections"
244 ),
245 &show_conns),
218 GNUNET_GETOPT_OPTION_END }; 246 GNUNET_GETOPT_OPTION_END };
219 247
220 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 248 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))