/*
This file is part of GNUnet
Copyright (C) 2008--2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* @file testbed/testbed_api_testbed.c
* @brief high-level testbed management
* @author Christian Grothoff
* @author Sree Harsha Totakura
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "testbed_api.h"
#include "testbed_api_peers.h"
#include "testbed_api_hosts.h"
#include "testbed_api_topology.h"
/**
* Generic loggins shorthand
*/
#define LOG(kind,...) \
GNUNET_log_from (kind, "testbed-api-testbed", __VA_ARGS__)
/**
* Debug logging shortcut
*/
#define DEBUG(...) \
LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
/**
* The default setup timeout in seconds
*/
#define DEFAULT_SETUP_TIMEOUT 300
/**
* Configuration section for testbed
*/
#define TESTBED_CONFIG_SECTION "testbed"
/**
* Option string for the maximum number of edges a peer is permitted to have
* while generating scale free topology
*/
#define SCALE_FREE_CAP "SCALE_FREE_TOPOLOGY_CAP"
/**
* Option string for the number of edges to be established when adding a new
* node to the scale free network
*/
#define SCALE_FREE_M "SCALE_FREE_TOPOLOGY_M"
/**
* Context information for the operation we start
*/
struct RunContextOperation
{
/**
* The testbed operation handle
*/
struct GNUNET_TESTBED_Operation *op;
/**
* Context information for GNUNET_TESTBED_run()
*/
struct GNUNET_TESTBED_RunHandle *rc;
/**
* Closure
*/
void *cls;
};
/**
* States of RunContext
*/
enum State
{
/**
* Initial state
*/
RC_INIT = 0,
/**
* Controllers on given hosts started and linked
*/
RC_LINKED,
/**
* Peers are created
*/
RC_PEERS_CREATED,
/**
* The testbed run is ready and the master callback can be called now. At this
* time the peers are all started and if a topology is provided in the
* configuration the topology would have been attempted