GNUnet 0.22.2
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
277 uint32_t can_burst;
278
279 /* Followed by the address prefix of the communicator */
280};
281
282
287{
292
297
302
306 uint32_t nt;
307
308 /* followed by UTF-8 encoded, 0-terminated human-readable address */
309};
310
311
316{
321
326};
327
328
333{
338
343
348
354
359
364
365 /* followed by the message */
366};
367
368
374{
379
384
389
394};
395
396
401{
406
411
416
420 uint32_t nt;
421
425 uint32_t mtu;
426
431 uint64_t q_len;
432
436 uint32_t priority;
437
441 uint32_t cs;
442
443 /* followed by UTF-8 encoded, 0-terminated human-readable address */
444};
445
446
451{
456
461
466
470 uint32_t nt;
471
475 uint32_t mtu;
476
481 uint64_t q_len;
482
486 uint32_t priority;
487
491 uint32_t cs;
492};
493
494
499{
504
509
514};
515
516
521{
526
531
536
537 /* followed by UTF-8 encoded, 0-terminated human-readable address */
538};
539
540
545{
551
556};
557
558
563{
568
573
578
583
584 /* followed by the message */
585};
586
587
592{
597
602
607
612
617};
618
619
626{
631
635 uint32_t reserved;
636
641
642 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
643 message to the communicator */
644
645 /* Followed by the 0-terminated string specifying the desired
646 communicator at the target (@e pid) peer */
647};
648
649
655{
661
665 uint32_t reserved;
666
671
672 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
673 message to the communicator */
674};
675
680{
685
690
692
693 /* followed by UTF-8 encoded, 0-terminated human-readable address */
694};
695
697{
702};
703
708{
713
717 uint32_t one_shot;
718
723};
724
725
730{
735
740
745
752
757
762
767
772
773 /* Followed by 0-terminated address of the peer */
774};
775
776
781{
786
790 uint32_t reserved;
791
796
797 /* followed by variable-size raw address */
798};
799
800
806{
813
819
824
829};
830
831
837{
842
848
853
854 /* followed by 0-terminated address to validate */
855};
856
858
859/* end of transport.h */
860#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:806
struct GNUNET_BANDWIDTH_Value32NBO bw
How much bandwidth in bytes/second does the application expect?
Definition: transport.h:828
struct GNUNET_PeerIdentity peer
Peer to get address suggestions for.
Definition: transport.h:823
uint32_t pk
What type of performance preference does the client have? A enum GNUNET_MQ_PreferenceKind in NBO.
Definition: transport.h:818
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop...
Definition: transport.h:812
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:287
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS.
Definition: transport.h:291
struct GNUNET_TIME_RelativeNBO expiration
When does the address expire?
Definition: transport.h:301
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:306
uint32_t aid
Address identifier (used during deletion).
Definition: transport.h:296
Add queue to the transport.
Definition: transport.h:401
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:420
uint32_t mtu
Maximum transmission unit, in NBO.
Definition: transport.h:425
uint64_t q_len
Queue length, in NBO.
Definition: transport.h:431
uint32_t priority
Priority of the queue in relation to other queues.
Definition: transport.h:436
uint32_t qid
Queue identifier (used to identify the queue).
Definition: transport.h:410
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:415
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition: transport.h:405
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition: transport.h:441
Request to verify address.
Definition: transport.h:781
uint32_t reserved
Reserved.
Definition: transport.h:790
struct GNUNET_MessageHeader header
Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY.
Definition: transport.h:785
struct GNUNET_PeerIdentity peer
Peer the address is from.
Definition: transport.h:795
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_BURST_FINISHED.
Definition: transport.h:701
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
uint32_t can_burst
The communicator can do burst msgs.
Definition: transport.h:277
Message from transport to communicator passing along a backchannel message from the given peer pid.
Definition: transport.h:655
struct GNUNET_PeerIdentity pid
Origin peer.
Definition: transport.h:670
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING.
Definition: transport.h:660
uint32_t reserved
Always zero, for alignment.
Definition: transport.h:665
Message from communicator to transport service asking for transmission of a backchannel message with ...
Definition: transport.h:626
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL.
Definition: transport.h:630
uint32_t reserved
Always zero, for alignment.
Definition: transport.h:635
struct GNUNET_PeerIdentity pid
Target peer.
Definition: transport.h:640
Communicator tells transport how queue creation went down.
Definition: transport.h:545
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK or GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CRE...
Definition: transport.h:550
uint32_t request_id
Unique ID for the request.
Definition: transport.h:555
Transport tells communicator that it wants a new queue.
Definition: transport.h:521
uint32_t request_id
Unique ID for the request.
Definition: transport.h:530
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE.
Definition: transport.h:525
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:535
Remove address from the list.
Definition: transport.h:316
uint32_t aid
Address identifier.
Definition: transport.h:325
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS.
Definition: transport.h:320
Remove queue, it is no longer available.
Definition: transport.h:499
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN.
Definition: transport.h:503
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:513
uint32_t qid
Address identifier.
Definition: transport.h:508
Transport informs us about being done with an incoming message.
Definition: transport.h:374
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK.
Definition: transport.h:378
struct GNUNET_PeerIdentity sender
Sender identifier of the original message.
Definition: transport.h:393
uint64_t fc_id
Which message is being ACKed?
Definition: transport.h:388
uint32_t reserved
Reserved (0)
Definition: transport.h:383
Inform transport about an incoming message.
Definition: transport.h:333
struct GNUNET_PeerIdentity neighbour_sender
Direct neighbour sender identifier.
Definition: transport.h:363
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:353
struct GNUNET_PeerIdentity sender
Sender identifier.
Definition: transport.h:358
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG.
Definition: transport.h:337
uint32_t fc_on
Do we use flow control or not?
Definition: transport.h:342
uint64_t fc_id
64-bit number to identify the matching ACK.
Definition: transport.h:347
uint32_t num_msg_pending
Messages pending (in NBO).
Definition: transport.h:766
struct GNUNET_PeerIdentity peer
Target identifier.
Definition: transport.h:744
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA.
Definition: transport.h:734
struct GNUNET_TIME_AbsoluteNBO valid_until
Definition: transport.h:750
struct GNUNET_TIME_AbsoluteNBO last_validation
Definition: transport.h:749
uint32_t num_bytes_pending
Bytes pending (in NBO).
Definition: transport.h:771
struct GNUNET_TIME_AbsoluteNBO next_validation
Definition: transport.h:751
uint32_t nt
Network type (an enum GNUNET_NetworkType in NBO).
Definition: transport.h:739
struct GNUNET_TIME_RelativeNBO rtt
Current round-trip time estimate.
Definition: transport.h:756
uint32_t cs
Connection status (in NBO).
Definition: transport.h:761
Request to start monitoring.
Definition: transport.h:708
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START.
Definition: transport.h:712
uint32_t one_shot
GNUNET_YES for one-shot montoring, GNUNET_NO for continuous monitoring.
Definition: transport.h:717
struct GNUNET_PeerIdentity peer
Target identifier to monitor, all zeros for "all peers".
Definition: transport.h:722
Inform transport that message was sent.
Definition: transport.h:592
uint32_t status
Success (GNUNET_OK), failure (GNUNET_SYSERR).
Definition: transport.h:601
uint64_t mid
Message ID of the original message.
Definition: transport.h:606
uint32_t qid
Queue ID for the queue which was used to send the message.
Definition: transport.h:611
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition: transport.h:616
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK.
Definition: transport.h:596
Inform communicator about transport's desire to send a message.
Definition: transport.h:563
uint32_t qid
Which queue should we use?
Definition: transport.h:572
uint64_t mid
Message ID, used for flow control.
Definition: transport.h:577
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG.
Definition: transport.h:567
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition: transport.h:582
Message from transport to communicator to start a burst.
Definition: transport.h:680
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START_BURST.
Definition: transport.h:684
struct GNUNET_TIME_RelativeNBO rtt
Definition: transport.h:691
struct GNUNET_PeerIdentity pid
Target peer.
Definition: transport.h:689
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:465
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition: transport.h:491
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:470
uint32_t priority
Priority of the queue in relation to other queues.
Definition: transport.h:486
uint32_t mtu
Maximum transmission unit, in NBO.
Definition: transport.h:475
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition: transport.h:455
uint64_t q_len
Queue length, in NBO.
Definition: transport.h:481
uint32_t qid
Queue identifier (used to identify the queue).
Definition: transport.h:460
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:837
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION.
Definition: transport.h:841
struct GNUNET_PeerIdentity peer
Peer to the address is presumably for.
Definition: transport.h:852
uint32_t nt
What type of network does the other peer claim this is? A enum GNUNET_NetworkType in NBO.
Definition: transport.h:847
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