diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-08-04 14:00:27 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-08-04 14:00:27 +0000 |
commit | 3e7a23302a76455f8c0e6980329f8636a18ab8ad (patch) | |
tree | 6fa4d9d32df4ac94401e8bde3acf2b087f7f97be /src/cadet/gnunet-cadet.c | |
parent | da9bcb5ad48d9668e59fdf47ff4a12f6dafa7d7e (diff) | |
download | gnunet-3e7a23302a76455f8c0e6980329f8636a18ab8ad.tar.gz gnunet-3e7a23302a76455f8c0e6980329f8636a18ab8ad.zip |
- more descriptive tunnel statuses
Diffstat (limited to 'src/cadet/gnunet-cadet.c')
-rw-r--r-- | src/cadet/gnunet-cadet.c | 73 |
1 files changed, 63 insertions, 10 deletions
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index d9a9b3ba2..9f54adf07 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -126,6 +126,58 @@ static void | |||
126 | listen_stdio (void); | 126 | listen_stdio (void); |
127 | 127 | ||
128 | 128 | ||
129 | /** | ||
130 | * Convert encryption status to human readable string. | ||
131 | * | ||
132 | * @param status Encryption status. | ||
133 | * | ||
134 | * @return Human readable string. | ||
135 | */ | ||
136 | static const char * | ||
137 | enc_2s (uint16_t status) | ||
138 | { | ||
139 | switch (status) | ||
140 | { | ||
141 | case 0: | ||
142 | return "NULL "; | ||
143 | case 1: | ||
144 | return "KSENT"; | ||
145 | case 2: | ||
146 | return "KRECV"; | ||
147 | case 3: | ||
148 | return "READY"; | ||
149 | default: | ||
150 | return ""; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | |||
155 | /** | ||
156 | * Convert connection status to human readable string. | ||
157 | * | ||
158 | * @param status Connection status. | ||
159 | * | ||
160 | * @return Human readable string. | ||
161 | */ | ||
162 | static const char * | ||
163 | conn_2s (uint16_t status) | ||
164 | { | ||
165 | switch (status) | ||
166 | { | ||
167 | case 0: | ||
168 | return "OFF "; | ||
169 | case 1: | ||
170 | return "SENT "; | ||
171 | case 2: | ||
172 | return "ACK'D"; | ||
173 | case 3: | ||
174 | return "READY"; | ||
175 | default: | ||
176 | return ""; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | |||
129 | 181 | ||
130 | /** | 182 | /** |
131 | * Task run in monitor mode when the user presses CTRL-C to abort. | 183 | * Task run in monitor mode when the user presses CTRL-C to abort. |
@@ -557,8 +609,10 @@ tunnels_callback (void *cls, | |||
557 | } | 609 | } |
558 | return; | 610 | return; |
559 | } | 611 | } |
560 | FPRINTF (stdout, "%s [ENC: %u, CON: %u] CHs: %u, CONNs: %u\n", | 612 | FPRINTF (stdout, "%s [ENC: %s, CON: %s] CHs: %u, CONNs: %u\n", |
561 | GNUNET_i2s_full (peer), estate, cstate, channels, connections); | 613 | GNUNET_i2s_full (peer), |
614 | enc_2s (estate), conn_2s (cstate), | ||
615 | channels, connections); | ||
562 | } | 616 | } |
563 | 617 | ||
564 | 618 | ||
@@ -590,21 +644,20 @@ tunnel_callback (void *cls, | |||
590 | if (NULL != peer) | 644 | if (NULL != peer) |
591 | { | 645 | { |
592 | FPRINTF (stdout, "Tunnel %s\n", GNUNET_i2s_full (peer)); | 646 | FPRINTF (stdout, "Tunnel %s\n", GNUNET_i2s_full (peer)); |
593 | FPRINTF (stdout, "- %u channels\n", n_channels); | 647 | FPRINTF (stdout, "\t%u channels\n", n_channels); |
594 | for (i = 0; i < n_channels; i++) | 648 | for (i = 0; i < n_channels; i++) |
595 | FPRINTF (stdout, " %u\n", channels[i]); | 649 | FPRINTF (stdout, "\t\t%u\n", channels[i]); |
596 | FPRINTF (stdout, "- %u connections\n", n_connections); | 650 | FPRINTF (stdout, "\t%u connections\n", n_connections); |
597 | for (i = 0; i < n_connections; i++) | 651 | for (i = 0; i < n_connections; i++) |
598 | FPRINTF (stdout, " %s\n", GC_h2s (&connections[i])); | 652 | FPRINTF (stdout, "\t\t%s\n", GC_h2s (&connections[i])); |
599 | FPRINTF (stdout, "- enc state: %u\n", estate); | 653 | FPRINTF (stdout, "\tencryption state: %s\n", enc_2s (estate)); |
600 | FPRINTF (stdout, "- con state: %u\n", cstate); | 654 | FPRINTF (stdout, "\tconnection state: %s\n", conn_2s (cstate)); |
601 | } | 655 | } |
602 | if (GNUNET_YES != monitor_mode) | 656 | if (GNUNET_YES != monitor_mode) |
603 | { | 657 | { |
604 | GNUNET_SCHEDULER_shutdown(); | 658 | GNUNET_SCHEDULER_shutdown(); |
605 | } | 659 | } |
606 | return; | 660 | return; |
607 | |||
608 | } | 661 | } |
609 | 662 | ||
610 | 663 | ||
@@ -752,7 +805,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
752 | && target_id != NULL) | 805 | && target_id != NULL) |
753 | { | 806 | { |
754 | FPRINTF (stderr, | 807 | FPRINTF (stderr, |
755 | _("You must NOT give a TARGET" | 808 | _("You must NOT give a TARGET " |
756 | "when using 'request all' options\n")); | 809 | "when using 'request all' options\n")); |
757 | return; | 810 | return; |
758 | } | 811 | } |