/*
This file is part of GNUnet
(C) 2008, 2009, 2012 Christian Grothoff (and other contributing authors)
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file include/gnunet_testbed_service.h
* @brief API for writing tests and creating large-scale
* emulation testbeds for GNUnet.
* @author Christian Grothoff
*/
#ifndef GNUNET_TESTBED_SERVICE_H
#define GNUNET_TESTBED_SERVICE_H
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#ifdef __cplusplus
extern "C"
{
#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
/**
* Opaque handle to a host running experiments managed by the testbed framework.
* The master process must be able to SSH to this host without password (via
* ssh-agent).
*/
struct GNUNET_TESTBED_Host;
/**
* Opaque handle to a peer controlled by the testbed framework. A peer runs
* at a particular host.
*/
struct GNUNET_TESTBED_Peer;
/**
* Opaque handle to an abstract operation to be executed by the testbed framework.
*/
struct GNUNET_TESTBED_Operation;
/**
* Handle to interact with a GNUnet testbed controller. Each
* controller has at least one master handle which is created when the
* controller is created; this master handle interacts with the
* controller process, destroying it destroys the controller (by
* closing stdin of the controller process). Additionally,
* controllers can interact with each other (in a P2P fashion); those
* links are established via TCP/IP on the controller's service port.
*/
struct GNUNET_TESTBED_Controller;
/**
* Create a host to run peers and controllers on.
*
* @param hostname name of the host, use "NULL" for localhost
* @param username username to use for the login; may be NULL
* @param port port number to use for ssh; use 0 to let ssh decide
* @return handle to the host, NULL on error
*/
struct GNUNET_TESTBED_Host *
GNUNET_TESTBED_host_create (const char *hostname,
const char *username,
uint16_t port);
/**
* Create a host to run peers and controllers on. This function is used
* if a peer learns about a host via IPC between controllers (and thus
* some higher-level controller has already determined the unique IDs).
*
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @param hostname name of the host, use "NULL" for localhost
* @param username username to use for the login; may be NULL
* @param port port number to use for ssh; use 0 to let ssh decide
* @return handle to the host, NULL on error
*/
struct GNUNET_TESTBED_Host *
GNUNET_TESTBED_host_create_with_id (uint32_t id,
const char *hostname,
const char *username,
uint16_t port);
/**
* Load a set of hosts from a configuration file.
*
* @param filename file with the host specification
* @param hosts set to the hosts found in the file; caller must free this if
* number of hosts returned is greater than 0
* @return number of hosts returned in 'hosts', 0 on error