2 This file is part of GNUnet.
3 (C) 2009 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 * @file transport/transport.h
23 * @brief common internal definitions for transport service
24 * @author Christian Grothoff
29 #include "gnunet_crypto_lib.h"
30 #include "gnunet_time_lib.h"
31 #include "gnunet_transport_service.h"
33 #define DEBUG_TRANSPORT 3
35 #define DEBUG_TRANSPORT_TIMEOUT GNUNET_NO
37 #define DEBUG_TRANSPORT_DISCONNECT GNUNET_NO
40 * For how long do we allow unused bandwidth
41 * from the past to carry over into the future? (in seconds)
43 #define MAX_BANDWIDTH_CARRY_S 5
46 * How often do we (at most) do a full quota
47 * recalculation? (in ms)
49 #define MIN_QUOTA_REFRESH_TIME 2000
52 * Message from the transport service to the library
53 * asking to check if both processes agree about this
60 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START
62 struct GNUNET_MessageHeader header;
65 * Should the 'self' field be checked?
70 * Identity we think we have. If it does not match, the
71 * receiver should print out an error message and disconnect.
73 struct GNUNET_PeerIdentity self;
79 * Message from the transport service to the library
80 * informing about neighbors.
82 struct ConnectInfoMessage
86 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT
88 struct GNUNET_MessageHeader header;
91 * Number of ATS key-value pairs that follow this struct
92 * (excluding the 0-terminator).
94 uint32_t ats_count GNUNET_PACKED;
97 * Identity of the new neighbour.
99 struct GNUNET_PeerIdentity id;
102 * First of the ATS information blocks (we must have at least
103 * one due to the 0-termination requirement).
105 struct GNUNET_TRANSPORT_ATS_Information ats;
110 * Message from the transport service to the library
111 * informing about disconnects.
113 struct DisconnectInfoMessage
117 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT
119 struct GNUNET_MessageHeader header;
122 * Reserved, always zero.
124 uint32_t reserved GNUNET_PACKED;
127 * Who got disconnected?
129 struct GNUNET_PeerIdentity peer;
134 * Message type for sending a request connect message
135 * to the transport service. Must be done before transport
136 * api will allow messages to be queued/sent to transport
137 * service for transmission to a peer.
139 struct TransportRequestConnectMessage
144 struct GNUNET_MessageHeader header;
152 * Identity of the peer we would like to connect to.
154 struct GNUNET_PeerIdentity peer;
158 * Message used to set a particular bandwidth quota. Send TO the
159 * service to set an incoming quota, send FROM the service to update
162 struct QuotaSetMessage
166 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_NEIGHBOUR_INFO
168 struct GNUNET_MessageHeader header;
173 struct GNUNET_BANDWIDTH_Value32NBO quota;
176 * About which peer are we talking here?
178 struct GNUNET_PeerIdentity peer;
184 * Message used to notify the transport API about a message
185 * received from the network. The actual message follows.
187 struct InboundMessage
191 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV
193 struct GNUNET_MessageHeader header;
198 uint32_t reserved GNUNET_PACKED;
201 * Number of ATS key-value pairs that follow this struct
202 * (excluding the 0-terminator).
204 uint32_t ats_count GNUNET_PACKED;
207 * Which peer sent the message?
209 struct GNUNET_PeerIdentity peer;
212 * First of the ATS information blocks (we must have at least
213 * one due to the 0-termination requirement).
215 struct GNUNET_TRANSPORT_ATS_Information ats;
220 * Message used to notify the transport API that it can
221 * send another message to the transport service.
227 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK
229 struct GNUNET_MessageHeader header;
232 * GNUNET_OK if the transmission succeeded,
233 * GNUNET_SYSERR if it failed (i.e. network disconnect);
234 * in either case, it is now OK for this client to
235 * send us another message for the given peer.
237 uint32_t success GNUNET_PACKED;
242 struct GNUNET_TIME_RelativeNBO latency;
245 * Which peer can send more now?
247 struct GNUNET_PeerIdentity peer;
253 * Message used to notify the transport service about a message
254 * to be transmitted to another peer. The actual message follows.
256 struct OutboundMessage
260 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND
262 struct GNUNET_MessageHeader header;
267 uint32_t priority GNUNET_PACKED;
272 struct GNUNET_TIME_RelativeNBO timeout;
275 * Which peer should receive the message?
277 struct GNUNET_PeerIdentity peer;
283 * Message from the library to the transport service
284 * asking for converting a transport address to a
285 * human-readable UTF-8 string.
287 struct AddressLookupMessage
291 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP
293 struct GNUNET_MessageHeader header;
296 * Should the conversion use numeric IP addresses (otherwise
297 * a reverse DNS lookup is OK -- if applicable).
299 int32_t numeric_only GNUNET_PACKED;
302 * timeout to give up.
304 struct GNUNET_TIME_AbsoluteNBO timeout;
307 * Length of the (binary) address in bytes, in big-endian.
309 uint32_t addrlen GNUNET_PACKED;
311 /* followed by 'addrlen' bytes of the actual address, then
312 followed by the 0-terminated name of the transport */
316 * Message from the library to the transport service
317 * asking for human readable addresses known for a peer.
319 struct PeerAddressLookupMessage
322 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP
324 struct GNUNET_MessageHeader header;
327 * timeout to give up.
329 struct GNUNET_TIME_AbsoluteNBO timeout;
332 * The identity of the peer to look up.
334 struct GNUNET_PeerIdentity peer;
338 * Message from the library to the transport service
339 * asking for human readable addresses known for a peer.
341 struct AddressIterateMessage
344 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE
346 struct GNUNET_MessageHeader header;
349 * timeout to give up.
351 struct GNUNET_TIME_AbsoluteNBO timeout;
355 * Change in blacklisting (either request or notification,
356 * depending on which direction it is going).
358 struct BlacklistMessage
362 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY or
363 * GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY.
365 struct GNUNET_MessageHeader header;
368 * 0 for the query, GNUNET_OK (allowed) or GNUNET_SYSERR (disallowed)
371 uint32_t is_allowed GNUNET_PACKED;
374 * Which peer is being blacklisted or queried?
376 struct GNUNET_PeerIdentity peer;
381 /* end of transport.h */