aboutsummaryrefslogtreecommitdiff
path: root/src/nse/gnunet-nse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nse/gnunet-nse.c')
-rw-r--r--src/nse/gnunet-nse.c77
1 files changed, 39 insertions, 38 deletions
diff --git a/src/nse/gnunet-nse.c b/src/nse/gnunet-nse.c
index 73b80e28b..3735373b5 100644
--- a/src/nse/gnunet-nse.c
+++ b/src/nse/gnunet-nse.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @file nse/gnunet-nse.c 22 * @file nse/gnunet-nse.c
@@ -44,14 +44,14 @@ static int status;
44 * @param cls NULL 44 * @param cls NULL
45 */ 45 */
46static void 46static void
47do_shutdown (void *cls) 47do_shutdown(void *cls)
48{ 48{
49 (void) cls; 49 (void)cls;
50 if (NULL != nse) 50 if (NULL != nse)
51 { 51 {
52 GNUNET_NSE_disconnect (nse); 52 GNUNET_NSE_disconnect(nse);
53 nse = NULL; 53 nse = NULL;
54 } 54 }
55} 55}
56 56
57 57
@@ -65,19 +65,19 @@ do_shutdown (void *cls)
65 * of the size estimation values seen 65 * of the size estimation values seen
66 */ 66 */
67static void 67static void
68handle_estimate (void *cls, 68handle_estimate(void *cls,
69 struct GNUNET_TIME_Absolute timestamp, 69 struct GNUNET_TIME_Absolute timestamp,
70 double estimate, 70 double estimate,
71 double std_dev) 71 double std_dev)
72{ 72{
73 (void) cls; 73 (void)cls;
74 status = 0; 74 status = 0;
75 fprintf (stdout, 75 fprintf(stdout,
76 "%llu %f %f %f\n", 76 "%llu %f %f %f\n",
77 (unsigned long long) timestamp.abs_value_us, 77 (unsigned long long)timestamp.abs_value_us,
78 GNUNET_NSE_log_estimate_to_n (estimate), 78 GNUNET_NSE_log_estimate_to_n(estimate),
79 estimate, 79 estimate,
80 std_dev); 80 std_dev);
81} 81}
82 82
83 83
@@ -90,16 +90,16 @@ handle_estimate (void *cls,
90 * @param cfg configuration handle 90 * @param cfg configuration handle
91 */ 91 */
92static void 92static void
93run (void *cls, 93run(void *cls,
94 char *const *args, 94 char *const *args,
95 const char *cfgfile, 95 const char *cfgfile,
96 const struct GNUNET_CONFIGURATION_Handle *cfg) 96 const struct GNUNET_CONFIGURATION_Handle *cfg)
97{ 97{
98 (void) cls; 98 (void)cls;
99 (void) args; 99 (void)args;
100 (void) cfgfile; 100 (void)cfgfile;
101 nse = GNUNET_NSE_connect (cfg, &handle_estimate, NULL); 101 nse = GNUNET_NSE_connect(cfg, &handle_estimate, NULL);
102 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 102 GNUNET_SCHEDULER_add_shutdown(&do_shutdown, NULL);
103} 103}
104 104
105 105
@@ -109,21 +109,22 @@ run (void *cls,
109 * @return 0 on success 109 * @return 0 on success
110 */ 110 */
111int 111int
112main (int argc, char *const *argv) 112main(int argc, char *const *argv)
113{ 113{
114 static struct GNUNET_GETOPT_CommandLineOption options[] = { 114 static struct GNUNET_GETOPT_CommandLineOption options[] = {
115 GNUNET_GETOPT_OPTION_END}; 115 GNUNET_GETOPT_OPTION_END
116 };
116 117
117 status = 1; 118 status = 1;
118 if (GNUNET_OK != 119 if (GNUNET_OK !=
119 GNUNET_PROGRAM_run (argc, 120 GNUNET_PROGRAM_run(argc,
120 argv, 121 argv,
121 "gnunet-nse", 122 "gnunet-nse",
122 gettext_noop ( 123 gettext_noop(
123 "Show network size estimates from NSE service."), 124 "Show network size estimates from NSE service."),
124 options, 125 options,
125 &run, 126 &run,
126 NULL)) 127 NULL))
127 return 2; 128 return 2;
128 return status; 129 return status;
129} 130}