/* This file is part of GNUnet. Copyright (C) 2009 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . SPDX-License-Identifier: AGPL3.0-or-later */ /** * @file cadet/test_cadeT_util.c * @brief testcase for cadet.c * @author xrs */ #include /** * Testbed operation for connecting to the services. */ static struct GNUNET_TESTBED_Operation *testbed_to_svc[REQUESTED_PEERS]; /** * Testbed operation for requesting peer information. */ static struct GNUNET_TESTBED_Operation *testbed_info_req[REQUESTED_PEERS]; /** * Port name kown by the two peers. */ static struct GNUNET_HashCode hashed_portname; /** * Result of the test. */ int test_result = 0; /** * Counter for gathering peerinformation. */ static int peerinfo_cnt = 0; /************************** TESBED MANAGEMENT *****************************/ static void shutdown_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); for (int i=0; iid = *(pinfo->result.id); if (peerinfo_complete()) { testbed_to_svc[1] = GNUNET_TESTBED_service_connect (NULL, test_peers[1].testbed_peer, "cadet", &check_test_readyness, NULL, &setup_listening_peer, &disconnect_from_peer, NULL); testbed_to_svc[0] = GNUNET_TESTBED_service_connect (NULL, test_peers[0].testbed_peer, "cadet", &check_test_readyness, NULL, &setup_initiating_peer, &disconnect_from_peer, NULL); } } void prepare_test (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); GNUNET_assert (GNUNET_NO == links_failed); GNUNET_assert (REQUESTED_PEERS == num_peers); for (int i=0; i