GNUnet  0.11.x
plugin_testcmd.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2013, 2014 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 
26 #include "platform.h"
27 #include "gnunet_testing_ng_lib.h"
28 #include "gnunet_util_lib.h"
30 
34 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
35 
36 unsigned int are_all_peers_started;
37 
38 static void
40 {
43  "setting are_all_peers_started: %d\n",
45 }
46 
47 static void
49  char *node_ip,
50  char *n,
51  char *m,
52  char *local_m)
53 {
55 
57  "We got here 6!\n");
58 
60 
61  struct GNUNET_TESTING_Command commands[] = {
62  GNUNET_TESTING_cmd_hello_world_birth ("hello-world-birth-0",
63  &now),
64  GNUNET_TESTING_cmd_hello_world ("hello-world-0","hello-world-birth-0",""),
65  GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1",
66  write_message),
69  GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1",
70  write_message)
71  };
72 
73  GNUNET_TESTING_run (NULL,
74  commands,
77  "We got here 7!\n");
78 
79 }
80 
81 
88 void *
90 {
92 
96  return api;
97 }
98 
99 
106 void *
108 {
109  struct GNUNET_TESTING_PluginFunctions *api = cls;
110 
111  GNUNET_free (api);
112  return NULL;
113 }
114 
115 
116 /* end of plugin_testcmd.c */
void(* TESTBED_CMD_HELPER_write_cb)(struct GNUNET_MessageHeader *message, size_t msg_length)
A command to be run by the interpreter.
void * libgnunet_plugin_testcmd_done(void *cls)
Exit point from the plugin.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_local_test_finished(const char *label, TESTBED_CMD_HELPER_write_cb write_message)
Create command.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define LOG(kind,...)
Generic logging shortcut.
GNUNET_TESTING_PLUGIN_StartTestCase start_testcase
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_hello_world(const char *label, const char *birthLabel, char *message)
Create command.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_hello_world_birth(const char *label, struct GNUNET_TIME_Absolute *now)
Create command.
static void all_peers_started()
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_block_until_all_peers_started(const char *label, unsigned int *all_peers_started)
Create command.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:86
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
int GNUNET_TESTING_run(const char *cfg_filename, struct GNUNET_TESTING_Command *commands, struct GNUNET_TIME_Relative timeout)
Wait until we receive SIGCHLD signal.
static void start_testcase(TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, char *node_ip, char *n, char *m, char *local_m)
void * cls
Closure for all commands with command-specific context information.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_send_peer_ready(const char *label, TESTBED_CMD_HELPER_write_cb write_message)
Create command.
void * libgnunet_plugin_testcmd_init(void *cls)
Entry point for the plugin.
unsigned int are_all_peers_started
Time for absolute times used by GNUnet, in microseconds.
void * cls
Closure for all of the callbacks.
GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started
#define GNUNET_free(ptr)
Wrapper around free.