/*
This file is part of GNUnet.
(C) 2009, 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 transport/transport_api.c
* @brief library to access the low-level P2P IO service
* @author Christian Grothoff
*
* TODO:
* - adjust testcases to use new 'try connect' style (should be easy, breaks API compatibility!)
* - adjust core service to use new 'try connect' style (should be MUCH nicer there as well!)
* - test test test
*/
#include "platform.h"
#include "gnunet_bandwidth_lib.h"
#include "gnunet_client_lib.h"
#include "gnunet_constants.h"
#include "gnunet_container_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_server_lib.h"
#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"
/**
* How large to start with for the hashmap of neighbours.
*/
#define STARTING_NEIGHBOURS_SIZE 16
/**
* Handle for a message that should be transmitted to the service.
* Used for both control messages and normal messages.
*/
struct GNUNET_TRANSPORT_TransmitHandle
{
/**
* We keep all requests in a DLL.
*/
struct GNUNET_TRANSPORT_TransmitHandle *next;
/**
* We keep all requests in a DLL.
*/
struct GNUNET_TRANSPORT_TransmitHandle *prev;
/**
* Neighbour for this handle, NULL for control messages.
*/
struct Neighbour *neighbour;
/**
* Function to call when notify_size bytes are available
* for transmission.
*/
GNUNET_CONNECTION_TransmitReadyNotify notify;
/**
* Closure for notify.
*/
void *notify_cls;
/**
* Timeout for this request, 0 for control messages.
*/
struct