/*
This file is part of GNUnet.
(C) 2010,2011 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 ats/ats_api_scheduling.c
* @brief automatic transport selection and outbound bandwidth determination
* @author Christian Grothoff
* @author Matthias Wachs
*/
#include "platform.h"
#include "gnunet_ats_service.h"
#include "ats.h"
#define INTERFACE_PROCESSING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
#define NOT_FOUND 0
/**
* Message in linked list we should send to the ATS service. The
* actual binary message follows this struct.
*/
struct PendingMessage
{
/**
* Kept in a DLL.
*/
struct PendingMessage *next;
/**
* Kept in a DLL.
*/
struct PendingMessage *prev;
/**
* Size of the message.
*/
size_t size;
/**
* Is this the 'ATS_START' message?
*/
int is_init;
};
/**
* Information we track per session.
*/
struct SessionRecord
{
/**
* Identity of the peer (just needed for error checking).
*/
struct GNUNET_PeerIdentity peer;
/**
* Session handle.
*/
struct Session *session;
/**
* Set to GNUNET_YES if the slot is used.
*/
int slot_used;
};
struct ATS_Network
{
struct ATS_Network * next;
struct ATS_Network * prev;
struct sockaddr *network;
struct sockaddr *netmask;
socklen_t length;
};
/**
* Handle for address suggestions
*/
struct GNUNET_ATS_SuggestHandle
{
struct GNUNET_ATS_SuggestHandle *prev;
struct GNUNET_ATS_SuggestHandle