]> git.meshlink.io Git - meshlink/blob - test/blackbox/test_case_channel_blacklist_01/node_sim_relay_01.c
Fix __warn_unused_result__, add more of it and fix the resulting warnings.
[meshlink] / test / blackbox / test_case_channel_blacklist_01 / node_sim_relay_01.c
1 /*
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>
5
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.
10
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.
15
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.
19 */
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include "../common/common_handlers.h"
23 #include "../common/test_step.h"
24 #include "../common/network_namespace_framework.h"
25
26 bool test_channel_blacklist_disonnection_relay_01_running;
27
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;
32
33         // Run relay node instance
34
35         meshlink_handle_t *mesh;
36         mesh = meshlink_open(mesh_arg->node_name, mesh_arg->confbase, mesh_arg->app_name, mesh_arg->dev_class);
37         assert(mesh);
38
39         assert(meshlink_start(mesh));
40
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);
44         }
45
46         meshlink_close(mesh);
47
48         return NULL;
49 }