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.
31 #include "../common/common_handlers.h"
32 #include "../common/test_step.h"
33 #include "../common/network_namespace_framework.h"
34 #include "../../utils.h"
35 #include "../run_blackbox_tests/test_optimal_pmtu.h"
37 extern bool test_pmtu_relay_running;
39 void *node_sim_pmtu_relay_01(void *arg) {
40 mesh_arg_t *mesh_arg = (mesh_arg_t *)arg;
41 struct timeval main_loop_wait = { 5, 0 };
43 // Run relay node instance
46 meshlink_handle_t *mesh;
47 mesh = meshlink_open(mesh_arg->node_name, mesh_arg->confbase, mesh_arg->app_name, mesh_arg->dev_class);
50 //meshlink_set_log_cb(mesh, MESHLINK_DEBUG, meshlink_callback_logger);
51 meshlink_enable_discovery(mesh, false);
53 assert(meshlink_start(mesh));
54 //send_event(NODE_STARTED);
56 /* All test steps executed - wait for signals to stop/start or close the mesh */
57 while(test_pmtu_relay_running) {
58 select(1, NULL, NULL, NULL, &main_loop_wait);