/*
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.c
* @brief testcase for cadet.c
* @author xrs
*
* Goal:
* - test session resumption after a hard channel breakup
*
* ToDos:
* - setup peer A
* - setup peer B
* - setup cadet on peer B listening on port 1234
* - create a channel from peer A to B
* - create method to find out session initiator
* - send a message over channel
* - check if message was received
* - breakup the connection without sending a channel destroy message
* - assert tunnel is down
* - resume channel (second handshake for tunnel)
* - send second message over channel
* - check if message was receveived
* - end test
*
* Questions:
* - can we simulate hard breakups with TESTBED?
* - yes, with GNUNET_TESTBED_underlay_configure_link
* - how can we test the sublayers of CADET, e.g. connection, tunnel, channel?
*
* Development
* - red -> green -> refactor (cyclic)
*/
#include "platform.h"
#include "gnunet_testbed_service.h"
#include "cadet.h"
#define REQUESTED_PEERS 2
#define CONFIG "test_cadet.conf"
#define TESTPROGAM_NAME "test-cadet-channel-resumption"
#define PORTNAME "cadet_port"
struct GNUNET_TESTBED_Operation *testbed_to_svc[2];
/**
* Port name kown by the two peers.
*/
static struct GNUNET_HashCode hashed_portname;
static int test_result = 0;
// FIXME: temp cnt
static int cnt = 0;
/****************************** TEST LOGIC ********************************/
// TBD
/************************** TESBED MANAGEMENT *****************************/
static void
shutdown_task (void *cls)
{
for (int i=0; i