2 node_sim_relay.c -- Implementation of Node Simulation for Meshlink Testing
3 for channel connections with respective to blacklisting their nodes
4 Copyright (C) 2019 Guus Sliepen <guus@meshlink.io>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "../common/common_handlers.h"
23 #include "../common/test_step.h"
24 #include "../common/network_namespace_framework.h"
26 bool test_channel_blacklist_disonnection_relay_01_running;
28 void *test_channel_blacklist_disonnection_relay_01(void *arg) {
29 struct timeval main_loop_wait = { 2, 0 };
30 mesh_arg_t *mesh_arg = (mesh_arg_t *)arg;
31 test_channel_blacklist_disonnection_relay_01_running = true;
33 // Run relay node instance
35 meshlink_handle_t *mesh;
36 mesh = meshlink_open(mesh_arg->node_name, mesh_arg->confbase, mesh_arg->app_name, mesh_arg->dev_class);
39 assert(meshlink_start(mesh));
41 /* All test steps executed - wait for signals to stop/start or close the mesh */
42 while(test_channel_blacklist_disonnection_relay_01_running) {
43 select(1, NULL, NULL, NULL, &main_loop_wait);