aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-cmd.c')
-rw-r--r--src/testbed/gnunet-cmd.c123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/testbed/gnunet-cmd.c b/src/testbed/gnunet-cmd.c
deleted file mode 100644
index f232bd805..000000000
--- a/src/testbed/gnunet-cmd.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008--2013, 2016 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testbed/gnunet-cmd.c
23 *
24 * @brief Binary to start testcase plugins
25 *
26 * @author t3sserakt
27 */
28
29#include "platform.h"
30#include "gnunet_util_lib.h"
31#include "gnunet_testing_lib.h"
32#include "gnunet_testing_plugin.h"
33
34/**
35 * Generic logging shortcut
36 */
37#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
38
39#define NODE_BASE_IP "192.168.15."
40
41#define ROUTER_BASE_IP "92.68.150."
42
43/**
44 * Handle for a plugin.
45 */
46struct Plugin
47{
48 /**
49 * Name of the shared library.
50 */
51 char *library_name;
52
53 /**
54 * Plugin API.
55 */
56 struct GNUNET_TESTING_PluginFunctions *api;
57
58 char *node_ip;
59
60 char *plugin_name;
61
62 char *global_n;
63
64 char *local_m;
65
66 char *n;
67
68 char *m;
69};
70
71
72/**
73 * Main function to run the test cases.
74 *
75 * @param cls plugin to use.
76 *
77 */
78static void
79run (void *cls)
80{
81 struct Plugin *plugin = cls;
82 char *router_ip;
83 char *node_ip;
84
85 router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + 1);
86 strcpy (router_ip, ROUTER_BASE_IP);
87 strcat (router_ip, plugin->m);
88
89 node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1);
90 strcat (node_ip, NODE_BASE_IP);
91 strcat (node_ip, plugin->n);
92
93 plugin->api->start_testcase (NULL, router_ip, node_ip, NULL, NULL);
94
95}
96
97
98int
99main (int argc, char *const *argv)
100{
101 int rv = 0;
102 struct Plugin *plugin;
103
104 GNUNET_log_setup ("gnunet-cmd",
105 "DEBUG",
106 NULL);
107
108 plugin = GNUNET_new (struct Plugin);
109 plugin->api = GNUNET_PLUGIN_load (argv[0],
110 NULL);
111 plugin->library_name = GNUNET_strdup (argv[0]);
112
113 plugin->global_n = argv[1];
114 plugin->local_m = argv[2];
115 plugin->n = argv[3];
116 plugin->m = argv[4];
117
118 GNUNET_SCHEDULER_run (&run,
119 plugin);
120
121 GNUNET_free (plugin);
122 return rv;
123}