GNUnet 0.21.0
transport.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009-2014 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
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 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
26#ifndef TRANSPORT_H
27#define TRANSPORT_H
28
29#include "gnunet_util_lib.h"
30#include "gnunet_time_lib.h"
31#include "gnunet_constants.h"
32
33#define DEBUG_TRANSPORT GNUNET_EXTRA_LOGGING
34
35
46typedef void (*NotifyConnect) (
47 void *cls,
48 const struct GNUNET_PeerIdentity *peer,
49 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
50 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
51
52
54
55
62{
67
73 uint32_t options;
74
80};
81
82
88{
93
94#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
95 defined(GNUNET_TRANSPORT_CORE_VERSION))
96
100 uint32_t reserved GNUNET_PACKED;
101#else
106#endif
107
112};
113
114
120{
125
130
135};
136
137
143{
148
153};
154
155
161{
166
167#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
168 defined(GNUNET_TRANSPORT_CORE_VERSION))
169
170 uint32_t reserved GNUNET_PACKED;
171#else
179
184
190#endif
191
196};
197
198
205{
210
216
221};
222
223
229{
234
239
240#if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
241 defined(GNUNET_TRANSPORT_CORE_VERSION))
242
247#endif
248
253};
254
255
256/* *********************** TNG messages ***************** */
257
263{
268
272 uint32_t cc;
273
274 /* Followed by the address prefix of the communicator */
275};
276
277
282{
287
292
297
301 uint32_t nt;
302
303 /* followed by UTF-8 encoded, 0-terminated human-readable address */
304};
305
306
311{
316
321};
322
323
328{
333
338
343
349
354
359
360 /* followed by the message */
361};
362
363
369{
374
379
384
389};
390
391
396{
401
406
411
415 uint32_t nt;
416
420 uint32_t mtu;
421
426 uint64_t q_len;
427
431 uint32_t priority;
432
436 uint32_t cs;
437
438 /* followed by UTF-8 encoded, 0-terminated human-readable address */
439};
440
441
446{
451
456
461
465 uint32_t nt;
466
470 uint32_t mtu;
471
476 uint64_t q_len;
477
481 uint32_t priority;
482
486 uint32_t cs;
487};
488
489
494{
499
504
509};
510
511
516{
521
526
531
532 /* followed by UTF-8 encoded, 0-terminated human-readable address */
533};
534
535
540{
546
551};
552
553
558{
563
568
573
578
579 /* followed by the message */
580};
581
582
587{
592
597
602
607
612};
613
614
621{
626
630 uint32_t reserved;
631
636
637 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
638 message to the communicator */
639
640 /* Followed by the 0-terminated string specifying the desired
641 communicator at the target (@e pid) peer */
642};
643
644
650{
656
660 uint32_t reserved;
661
666
667 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
668 message to the communicator */
669};
670
671
676{
681
685 uint32_t one_shot;
686
691};
692
693
698{
703
708
713
720
725
730
735
740
741 /* Followed by 0-terminated address of the peer */
742};
743
744
749{
754
758 uint32_t reserved;
759
764
765 /* followed by variable-size raw address */
766};
767
768
774{
781
787
792
797};
798
799
805{
810
816
821
822 /* followed by 0-terminated address to validate */
823};
824
826
827/* end of transport.h */
828#endif
static unsigned long long reserved
How much space have we currently reserved?
Functions related to time.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
Message from the transport service to the library informing about neighbors.
Definition: transport.h:88
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT.
Definition: transport.h:92
struct GNUNET_PeerIdentity id
Identity of the new neighbour.
Definition: transport.h:111
struct GNUNET_BANDWIDTH_Value32NBO quota_out
Current outbound quota for this peer.
Definition: transport.h:105
Message from the transport service to the library informing about disconnects.
Definition: transport.h:120
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT.
Definition: transport.h:124
uint32_t reserved
Reserved, always zero.
Definition: transport.h:129
struct GNUNET_PeerIdentity peer
Who got disconnected?
Definition: transport.h:134
Application client to TRANSPORT service: we would like to have address suggestions for this peer.
Definition: transport.h:774
struct GNUNET_BANDWIDTH_Value32NBO bw
How much bandwidth in bytes/second does the application expect?
Definition: transport.h:796
struct GNUNET_PeerIdentity peer
Peer to get address suggestions for.
Definition: transport.h:791
uint32_t pk
What type of performance preference does the client have? A enum GNUNET_MQ_PreferenceKind in NBO.
Definition: transport.h:786
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop...
Definition: transport.h:780
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for relative time used by GNUnet, in microseconds and in network byte order.
Add address to the list.
Definition: transport.h:282
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS.
Definition: transport.h:286
struct GNUNET_TIME_RelativeNBO expiration
When does the address expire?
Definition: transport.h:296
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:301
uint32_t aid
Address identifier (used during deletion).
Definition: transport.h:291
Add queue to the transport.
Definition: transport.h:396
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:415
uint32_t mtu
Maximum transmission unit, in NBO.
Definition: transport.h:420
uint64_t q_len
Queue length, in NBO.
Definition: transport.h:426
uint32_t priority
Priority of the queue in relation to other queues.
Definition: transport.h:431
uint32_t qid
Queue identifier (used to identify the queue).
Definition: transport.h:405
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:410
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition: transport.h:400
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition: transport.h:436
Request to verify address.
Definition: transport.h:749
uint32_t reserved
Reserved.
Definition: transport.h:758
struct GNUNET_MessageHeader header
Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY.
Definition: transport.h:753
struct GNUNET_PeerIdentity peer
Peer the address is from.
Definition: transport.h:763
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR.
Definition: transport.h:267
uint32_t cc
NBO encoding of enum GNUNET_TRANSPORT_CommunicatorCharacteristics
Definition: transport.h:272
Message from transport to communicator passing along a backchannel message from the given peer pid.
Definition: transport.h:650
struct GNUNET_PeerIdentity pid
Origin peer.
Definition: transport.h:665
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING.
Definition: transport.h:655
uint32_t reserved
Always zero, for alignment.
Definition: transport.h:660
Message from communicator to transport service asking for transmission of a backchannel message with ...
Definition: transport.h:621
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL.
Definition: transport.h:625
uint32_t reserved
Always zero, for alignment.
Definition: transport.h:630
struct GNUNET_PeerIdentity pid
Target peer.
Definition: transport.h:635
Communicator tells transport how queue creation went down.
Definition: transport.h:540
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK or GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CRE...
Definition: transport.h:545
uint32_t request_id
Unique ID for the request.
Definition: transport.h:550
Transport tells communicator that it wants a new queue.
Definition: transport.h:516
uint32_t request_id
Unique ID for the request.
Definition: transport.h:525
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE.
Definition: transport.h:520
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:530
Remove address from the list.
Definition: transport.h:311
uint32_t aid
Address identifier.
Definition: transport.h:320
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS.
Definition: transport.h:315
Remove queue, it is no longer available.
Definition: transport.h:494
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN.
Definition: transport.h:498
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:508
uint32_t qid
Address identifier.
Definition: transport.h:503
Transport informs us about being done with an incoming message.
Definition: transport.h:369
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK.
Definition: transport.h:373
struct GNUNET_PeerIdentity sender
Sender identifier of the original message.
Definition: transport.h:388
uint64_t fc_id
Which message is being ACKed?
Definition: transport.h:383
uint32_t reserved
Reserved (0)
Definition: transport.h:378
Inform transport about an incoming message.
Definition: transport.h:328
struct GNUNET_PeerIdentity neighbour_sender
Direct neighbour sender identifier.
Definition: transport.h:358
struct GNUNET_TIME_RelativeNBO expected_address_validity
How long does the communicator believe the address on which the message was received to remain valid?
Definition: transport.h:348
struct GNUNET_PeerIdentity sender
Sender identifier.
Definition: transport.h:353
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG.
Definition: transport.h:332
uint32_t fc_on
Do we use flow control or not?
Definition: transport.h:337
uint64_t fc_id
64-bit number to identify the matching ACK.
Definition: transport.h:342
uint32_t num_msg_pending
Messages pending (in NBO).
Definition: transport.h:734
struct GNUNET_PeerIdentity peer
Target identifier.
Definition: transport.h:712
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA.
Definition: transport.h:702
struct GNUNET_TIME_AbsoluteNBO valid_until
Definition: transport.h:718
struct GNUNET_TIME_AbsoluteNBO last_validation
Definition: transport.h:717
uint32_t num_bytes_pending
Bytes pending (in NBO).
Definition: transport.h:739
struct GNUNET_TIME_AbsoluteNBO next_validation
Definition: transport.h:719
uint32_t nt
Network type (an enum GNUNET_NetworkType in NBO).
Definition: transport.h:707
struct GNUNET_TIME_RelativeNBO rtt
Current round-trip time estimate.
Definition: transport.h:724
uint32_t cs
Connection status (in NBO).
Definition: transport.h:729
Request to start monitoring.
Definition: transport.h:676
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START.
Definition: transport.h:680
uint32_t one_shot
GNUNET_YES for one-shot montoring, GNUNET_NO for continuous monitoring.
Definition: transport.h:685
struct GNUNET_PeerIdentity peer
Target identifier to monitor, all zeros for "all peers".
Definition: transport.h:690
Inform transport that message was sent.
Definition: transport.h:587
uint32_t status
Success (GNUNET_OK), failure (GNUNET_SYSERR).
Definition: transport.h:596
uint64_t mid
Message ID of the original message.
Definition: transport.h:601
uint32_t qid
Queue ID for the queue which was used to send the message.
Definition: transport.h:606
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition: transport.h:611
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK.
Definition: transport.h:591
Inform communicator about transport's desire to send a message.
Definition: transport.h:558
uint32_t qid
Which queue should we use?
Definition: transport.h:567
uint64_t mid
Message ID, used for flow control.
Definition: transport.h:572
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG.
Definition: transport.h:562
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition: transport.h:577
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:460
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition: transport.h:486
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:465
uint32_t priority
Priority of the queue in relation to other queues.
Definition: transport.h:481
uint32_t mtu
Maximum transmission unit, in NBO.
Definition: transport.h:470
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition: transport.h:450
uint64_t q_len
Queue length, in NBO.
Definition: transport.h:476
uint32_t qid
Queue identifier (used to identify the queue).
Definition: transport.h:455
Message used to notify the transport API about a message received from the network.
Definition: transport.h:143
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV.
Definition: transport.h:147
struct GNUNET_PeerIdentity peer
Which peer sent the message?
Definition: transport.h:152
Message used to notify the transport service about a message to be transmitted to another peer.
Definition: transport.h:229
uint32_t priority
An enum GNUNET_MQ_PriorityPreferences in NBO.
Definition: transport.h:238
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND.
Definition: transport.h:233
struct GNUNET_PeerIdentity peer
Which peer should receive the message?
Definition: transport.h:252
struct GNUNET_TIME_RelativeNBO timeout
Allowed delay.
Definition: transport.h:246
Message used to notify the transport API that it can send another message to the transport service.
Definition: transport.h:205
struct GNUNET_PeerIdentity peer
Which peer can CORE handle more from now?
Definition: transport.h:220
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK.
Definition: transport.h:209
uint32_t increase_window_delta
Number of messages by which to increase the window, greater or equal to one.
Definition: transport.h:215
We got an address of another peer, TRANSPORT service should validate it.
Definition: transport.h:805
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION.
Definition: transport.h:809
struct GNUNET_PeerIdentity peer
Peer to the address is presumably for.
Definition: transport.h:820
uint32_t nt
What type of network does the other peer claim this is? A enum GNUNET_NetworkType in NBO.
Definition: transport.h:815
Message used to notify the transport API that it can send another message to the transport service.
Definition: transport.h:161
uint16_t success
GNUNET_OK if the transmission succeeded, GNUNET_SYSERR if it failed (i.e.
Definition: transport.h:178
uint16_t bytes_msg
Size of message sent.
Definition: transport.h:183
uint32_t bytes_physical
Size of message sent over wire.
Definition: transport.h:189
struct GNUNET_PeerIdentity peer
Which peer can send more now?
Definition: transport.h:195
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK.
Definition: transport.h:165
Message from the transport service to the library asking to check if both processes agree about this ...
Definition: transport.h:62
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START.
Definition: transport.h:66
uint32_t options
0: no options 1: The self field should be checked 2: this client is interested in payload traffic
Definition: transport.h:73
struct GNUNET_PeerIdentity self
Identity we think we have.
Definition: transport.h:79
void(* NotifyConnect)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
Similar to GNUNET_TRANSPORT_NotifyDisconnect but in and out quotas are included here.
Definition: transport.h:46