2 This file is part of GNUnet.
3 (C) 2010,2011 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @brief automatic transport selection API common includes
23 * @author Christian Grothoff
24 * @author Matthias Wachs
29 #include "gnunet_util_lib.h"
32 * Allocation record for a peer's address.
34 struct AllocationRecord
38 * Performance information associated with this address (array).
40 struct GNUNET_ATS_Information *ats;
48 * Address this record represents, allocated at the end of this struct.
50 const void *plugin_addr;
53 * Session associated with this record.
55 struct Session *session;
58 * Number of bytes in plugin_addr.
60 size_t plugin_addr_len;
63 * Number of entries in 'ats'.
68 * Inbound bandwidth assigned to this address right now, 0 for none.
70 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
73 * Outbound bandwidth assigned to this address right now, 0 for none.
75 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
78 * Tracking bandwidth for receiving from this peer. Used for
79 * applications that want to 'reserve' bandwidth for replies.
81 struct GNUNET_BANDWIDTH_Tracker available_recv_window;
84 * Set to GNUNET_YES if this is the connected address of a connected peer.
92 * Handle to the ATS subsystem.
94 struct GNUNET_ATS_SchedulingHandle
99 const struct GNUNET_CONFIGURATION_Handle *cfg;
102 * Function to call when the allocation changes.
104 GNUNET_ATS_AddressSuggestionCallback alloc_cb;
107 * Closure for 'alloc_cb'.
112 * Information about all connected peers. Maps peer identities
113 * to one or more 'struct AllocationRecord' values.
115 struct GNUNET_CONTAINER_MultiHashMap *peers;
118 * Map of PeerIdentities to 'struct GNUNET_ATS_SuggestionContext's.
120 struct GNUNET_CONTAINER_MultiHashMap *notify_map;
123 * Task scheduled to update our bandwidth assignment.
125 GNUNET_SCHEDULER_TaskIdentifier ba_task;
128 * Total inbound bandwidth per configuration.
130 unsigned long long total_bps_in;
133 * Total outbound bandwidth per configuration.
135 unsigned long long total_bps_out;