/*
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 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 <http://www.gnu.org/licenses/>.
*/
/**
* @file testbed/gnunet-service-testbed_links.c
* @brief TESTBED service components that deals with starting slave controllers
* and establishing lateral links between controllers
* @author Sree Harsha Totakura
*/
#include "gnunet-service-testbed.h"
/**
* Redefine LOG with a changed log component string
*/
#ifdef LOG
#undef LOG
#endif
#define LOG(kind,...) \
GNUNET_log_from (kind, "testbed-links", __VA_ARGS__)
/**
* The event mask for the events we listen from sub-controllers
*/
#define EVENT_MASK (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED)
/**
* States of LCFContext
*/
enum LCFContextState
{
/**
* The Context has been initialized; Nothing has been done on it
*/
INIT,
/**
* Delegated host has been registered at the forwarding controller
*/
DELEGATED_HOST_REGISTERED,
/**
* The slave host has been registred at the forwarding controller
*/
SLAVE_HOST_REGISTERED,
/**
* The context has been finished (may have error)
*/
FINISHED
};
/**
* Link controllers request forwarding context
*/
struct LCFContext
{
/**
* The LCFContext
*/
struct LCFContext *next;
/**
* The LCFContext
*/
struct LCFContext *prev;
/**
* The gateway which will pass the link message to delegated host
*/
struct Slave *gateway;
/**
* The client which has asked to perform this operation
*/
struct GNUNET_SERVICE_Client *client;
/**
* Handle for operations which are forwarded while linking controllers
*/
struct GNUNET_TESTBED_Operation *op;
/**
* The timeout task
*/
struct GNUNET_SCHEDULER_Task *timeout_task;
/**
* The id of the operation which created this context
*/
uint64_t operation_id;
/**
* should the slave controller start the delegated controller?
*/
int is_subordinate;
/**
* The state of this context