2 node_sim_relay.c -- Implementation of Node Simulation for Meshlink Testing
3 Copyright (C) 2019 Guus Sliepen <guus@meshlink.io>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "../common/common_handlers.h"
27 #include "../common/test_step.h"
28 #include "../common/network_namespace_framework.h"
29 #include "../../utils.h"
30 #include "../run_blackbox_tests/test_optimal_pmtu.h"
32 extern bool test_pmtu_relay_running;
34 void *node_sim_pmtu_relay_01(void *arg) {
35 mesh_arg_t *mesh_arg = (mesh_arg_t *)arg;
36 struct timeval main_loop_wait = { 5, 0 };
38 // Run relay node instance
41 meshlink_handle_t *mesh;
42 mesh = meshlink_open(mesh_arg->node_name , mesh_arg->confbase, mesh_arg->app_name, mesh_arg->dev_class);
45 //meshlink_set_log_cb(mesh, MESHLINK_DEBUG, meshlink_callback_logger);
46 meshlink_enable_discovery(mesh, false);
49 //send_event(NODE_STARTED);
51 /* All test steps executed - wait for signals to stop/start or close the mesh */
52 while(test_pmtu_relay_running) {
53 select(1, NULL, NULL, NULL, &main_loop_wait);