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 GNUNET_NO
34 #define DEBUG_TRANSPORT_TIMEOUT GNUNET_NO
35 #define DEBUG_TRANSPORT_DISCONNECT GNUNET_NO
38 * For how long do we allow unused bandwidth
39 * from the past to carry over into the future? (in seconds)
41 #define MAX_BANDWIDTH_CARRY_S 5
44 * How often do we (at most) do a full quota
45 * recalculation? (in ms)
47 #define MIN_QUOTA_REFRESH_TIME 2000
50 * Message from the transport service to the library
51 * asking to check if both processes agree about this
58 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START
60 struct GNUNET_MessageHeader header;
63 * Should the 'self' field be checked?
68 * Identity we think we have. If it does not match, the
69 * receiver should print out an error message and disconnect.
71 struct GNUNET_PeerIdentity self;
77 * Message from the transport service to the library
78 * informing about neighbors.
80 struct ConnectInfoMessage
84 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT
86 struct GNUNET_MessageHeader header;
89 * Number of ATS key-value pairs that follow this struct
90 * (excluding the 0-terminator).
92 uint32_t ats_count GNUNET_PACKED;
95 * Identity of the new neighbour.
97 struct GNUNET_PeerIdentity id;
100 * First of the ATS information blocks (we must have at least
101 * one due to the 0-termination requirement).
103 struct GNUNET_TRANSPORT_ATS_Information ats;
108 * Message from the transport service to the library
109 * informing about disconnects.
111 struct DisconnectInfoMessage
115 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT
117 struct GNUNET_MessageHeader header;
120 * Reserved, always zero.
122 uint32_t reserved GNUNET_PACKED;
125 * Who got disconnected?
127 struct GNUNET_PeerIdentity peer;
132 * Message type for sending a request connect message
133 * to the transport service. Must be done before transport
134 * api will allow messages to be queued/sent to transport
135 * service for transmission to a peer.
137 struct TransportRequestConnectMessage
142 struct GNUNET_MessageHeader header;
145 * Identity of the peer we would like to connect to.
147 struct GNUNET_PeerIdentity peer;
151 * Message used to set a particular bandwidth quota. Send TO the
152 * service to set an incoming quota, send FROM the service to update
155 struct QuotaSetMessage
159 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_NEIGHBOUR_INFO
161 struct GNUNET_MessageHeader header;
166 struct GNUNET_BANDWIDTH_Value32NBO quota;
169 * About which peer are we talking here?
171 struct GNUNET_PeerIdentity peer;
177 * Message used to notify the transport API about a message
178 * received from the network. The actual message follows.
180 struct InboundMessage
184 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV
186 struct GNUNET_MessageHeader header;
191 uint32_t reserved GNUNET_PACKED;
194 * Number of ATS key-value pairs that follow this struct
195 * (excluding the 0-terminator).
197 uint32_t ats_count GNUNET_PACKED;
200 * Which peer sent the message?
202 struct GNUNET_PeerIdentity peer;
205 * First of the ATS information blocks (we must have at least
206 * one due to the 0-termination requirement).
208 struct GNUNET_TRANSPORT_ATS_Information ats;
213 * Message used to notify the transport API that it can
214 * send another message to the transport service.
220 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK
222 struct GNUNET_MessageHeader header;
225 * GNUNET_OK if the transmission succeeded,
226 * GNUNET_SYSERR if it failed (i.e. network disconnect);
227 * in either case, it is now OK for this client to
228 * send us another message for the given peer.
230 uint32_t success GNUNET_PACKED;
235 struct GNUNET_TIME_RelativeNBO latency;
238 * Which peer can send more now?
240 struct GNUNET_PeerIdentity peer;
246 * Message used to notify the transport service about a message
247 * to be transmitted to another peer. The actual message follows.
249 struct OutboundMessage
253 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND
255 struct GNUNET_MessageHeader header;
260 uint32_t priority GNUNET_PACKED;
265 struct GNUNET_TIME_RelativeNBO timeout;
268 * Which peer should receive the message?
270 struct GNUNET_PeerIdentity peer;
276 * Message from the library to the transport service
277 * asking for converting a transport address to a
278 * human-readable UTF-8 string.
280 struct AddressLookupMessage
284 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP
286 struct GNUNET_MessageHeader header;
289 * Should the conversion use numeric IP addresses (otherwise
290 * a reverse DNS lookup is OK -- if applicable).
292 int32_t numeric_only GNUNET_PACKED;
295 * timeout to give up.
297 struct GNUNET_TIME_AbsoluteNBO timeout;
300 * Length of the (binary) address in bytes, in big-endian.
302 uint32_t addrlen GNUNET_PACKED;
304 /* followed by 'addrlen' bytes of the actual address, then
305 followed by the 0-terminated name of the transport */
311 * Change in blacklisting (either request or notification,
312 * depending on which direction it is going).
314 struct BlacklistMessage
318 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY or
319 * GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY.
321 struct GNUNET_MessageHeader header;
324 * 0 for the query, GNUNET_OK (allowed) or GNUNET_SYSERR (disallowed)
327 uint32_t is_allowed GNUNET_PACKED;
330 * Which peer is being blacklisted or queried?
332 struct GNUNET_PeerIdentity peer;
337 /* end of transport.h */