GNUnet 0.28.1-dev.2-13-g57ceb9dfb
 
Loading...
Searching...
No Matches
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"
33
34#define DEBUG_TRANSPORT GNUNET_EXTRA_LOGGING
35
36
47typedef void (*NotifyConnect) (
48 void *cls,
49 const struct GNUNET_PeerIdentity *peer,
50 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
51 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
52
53
55
56
63{
68
74 uint32_t options;
75
80 // TODO remove
82};
83
84
90{
95
96#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
97 defined(GNUNET_TRANSPORT_CORE_VERSION))
98
102 uint32_t reserved GNUNET_PACKED;
103#else
108#endif
109
114};
115
116
138
139
156
157
163{
168
169#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
170 defined(GNUNET_TRANSPORT_CORE_VERSION))
171
172 uint32_t reserved GNUNET_PACKED;
173#else
181
186
192#endif
193
198};
199
200
224
225
231{
236
241
242#if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
243 defined(GNUNET_TRANSPORT_CORE_VERSION))
244
249#endif
250
255};
256
257
258/* *********************** TNG messages ***************** */
259
265{
270
274 uint32_t cc;
275
279 uint32_t can_burst;
280
281 /* Followed by the address prefix of the communicator */
282};
283
284
289{
294
299
304
308 uint32_t nt;
309
310 /* followed by UTF-8 encoded, 0-terminated human-readable address */
311};
312
313
329
330
369
370
397
398
403{
408
413
418
422 uint32_t nt;
423
427 uint32_t mtu;
428
433 uint64_t q_len;
434
438 uint32_t priority;
439
443 uint32_t cs;
444
445 /* followed by UTF-8 encoded, 0-terminated human-readable address */
446};
447
448
453{
458
463
468
472 uint32_t nt;
473
477 uint32_t mtu;
478
483 uint64_t q_len;
484
488 uint32_t priority;
489
493 uint32_t cs;
494};
495
496
517
518
523{
528
533
538
539 /* followed by UTF-8 encoded, 0-terminated human-readable address */
540};
541
542
559
560
565{
570
575
580
585
586 /* followed by the message */
587};
588
589
620
621
628{
633
637 uint32_t reserved;
638
643
644 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
645 message to the communicator */
646
647 /* Followed by the 0-terminated string specifying the desired
648 communicator at the target (@e pid) peer */
649};
650
651
657{
663
667 uint32_t reserved;
668
673
674 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
675 message to the communicator */
676};
677
682{
687
692
694
695 /* followed by UTF-8 encoded, 0-terminated human-readable address */
696};
697
705
726
727
777
778
799
800
805{
810
815
820
825
831
837
844
850
855
860
865
870
875
880
886
891
896
901
906
911
912 /* Followed by a 0-terminated, comma-separated list of the address
913 prefixes of the communicators currently carrying this link ("tcp",
914 "udp", ...). For a DV link these are the communicators to the next
915 hop of the shortest path, not to @e target. May be empty. */
916};
917
918
923{
928
932 uint32_t reserved;
933
938
939 /* followed by variable-size raw address */
940};
941
942
972
973
979{
984
990
995
996 /* followed by 0-terminated address to validate */
997};
998
1000
1001/* end of transport.h */
1002#endif
static unsigned long long reserved
How much space have we currently reserved?
Functions related to time.
Monitoring / diagnostics API for the transport service.
#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:90
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT.
Definition transport.h:94
struct GNUNET_PeerIdentity id
Identity of the new neighbour.
Definition transport.h:113
struct GNUNET_BANDWIDTH_Value32NBO quota_out
Current outbound quota for this peer.
Definition transport.h:107
Message from the transport service to the library informing about disconnects.
Definition transport.h:122
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT.
Definition transport.h:126
uint32_t reserved
Reserved, always zero.
Definition transport.h:131
struct GNUNET_PeerIdentity peer
Who got disconnected?
Definition transport.h:136
Application client to TRANSPORT service: we would like to have address suggestions for this peer.
Definition transport.h:948
struct GNUNET_BANDWIDTH_Value32NBO bw
How much bandwidth in bytes/second does the application expect?
Definition transport.h:970
struct GNUNET_PeerIdentity peer
Peer to get address suggestions for.
Definition transport.h:965
uint32_t pk
What type of performance preference does the client have? A enum GNUNET_MQ_PreferenceKind in NBO.
Definition transport.h:960
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop...
Definition transport.h:954
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:289
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS.
Definition transport.h:293
struct GNUNET_TIME_RelativeNBO expiration
When does the address expire?
Definition transport.h:303
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition transport.h:308
uint32_t aid
Address identifier (used during deletion).
Definition transport.h:298
Add queue to the transport.
Definition transport.h:403
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition transport.h:422
uint32_t mtu
Maximum transmission unit, in NBO.
Definition transport.h:427
uint64_t q_len
Queue length, in NBO.
Definition transport.h:433
uint32_t priority
Priority of the queue in relation to other queues.
Definition transport.h:438
uint32_t qid
Queue identifier (used to identify the queue).
Definition transport.h:412
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition transport.h:417
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition transport.h:407
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition transport.h:443
Request to verify address.
Definition transport.h:923
struct GNUNET_MessageHeader header
Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY.
Definition transport.h:927
struct GNUNET_PeerIdentity peer
Peer the address is from.
Definition transport.h:937
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_BURST_FINISHED.
Definition transport.h:703
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR.
Definition transport.h:269
uint32_t cc
NBO encoding of enum GNUNET_TRANSPORT_CommunicatorCharacteristics
Definition transport.h:274
uint32_t can_burst
The communicator can do burst msgs.
Definition transport.h:279
Message from transport to communicator passing along a backchannel message from the given peer pid.
Definition transport.h:657
struct GNUNET_PeerIdentity pid
Origin peer.
Definition transport.h:672
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING.
Definition transport.h:662
uint32_t reserved
Always zero, for alignment.
Definition transport.h:667
Message from communicator to transport service asking for transmission of a backchannel message with ...
Definition transport.h:628
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL.
Definition transport.h:632
uint32_t reserved
Always zero, for alignment.
Definition transport.h:637
struct GNUNET_PeerIdentity pid
Target peer.
Definition transport.h:642
Communicator tells transport how queue creation went down.
Definition transport.h:547
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK or GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CRE...
Definition transport.h:552
uint32_t request_id
Unique ID for the request.
Definition transport.h:557
Transport tells communicator that it wants a new queue.
Definition transport.h:523
uint32_t request_id
Unique ID for the request.
Definition transport.h:532
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE.
Definition transport.h:527
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition transport.h:537
Remove address from the list.
Definition transport.h:318
uint32_t aid
Address identifier.
Definition transport.h:327
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS.
Definition transport.h:322
Remove queue, it is no longer available.
Definition transport.h:501
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN.
Definition transport.h:505
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition transport.h:515
uint32_t qid
Address identifier.
Definition transport.h:510
Transport informs us about being done with an incoming message.
Definition transport.h:376
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK.
Definition transport.h:380
struct GNUNET_PeerIdentity sender
Sender identifier of the original message.
Definition transport.h:395
uint64_t fc_id
Which message is being ACKed?
Definition transport.h:390
uint32_t reserved
Reserved (0)
Definition transport.h:385
Inform transport about an incoming message.
Definition transport.h:335
struct GNUNET_PeerIdentity neighbour_sender
Direct neighbour sender identifier.
Definition transport.h:365
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:355
struct GNUNET_PeerIdentity sender
Sender identifier.
Definition transport.h:360
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG.
Definition transport.h:339
uint32_t fc_on
Do we use flow control or not?
Definition transport.h:344
uint64_t fc_id
64-bit number to identify the matching ACK.
Definition transport.h:349
Request a one-shot listing of our virtual links.
Definition transport.h:783
struct GNUNET_PeerIdentity peer
Link to report on, all zeros for "all links".
Definition transport.h:797
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_LINK_LIST_REQUEST.
Definition transport.h:787
uint32_t include_unconfirmed
GNUNET_YES to also report links that are not confirmed.
Definition transport.h:792
State of one virtual link.
Definition transport.h:805
uint32_t stalled
Number of messages whose flow control ACK we are withholding because core_recv_window is exhausted.
Definition transport.h:849
struct GNUNET_TIME_AbsoluteNBO last_fc_transmission
When did we last send a flow control message?
Definition transport.h:910
uint32_t fc_retransmit_count
Number of flow control retransmissions of the running task.
Definition transport.h:859
uint32_t num_queues
Number of queues to the neighbour, 0 if route is GNUNET_TRANSPORT_LINK_ROUTE_DV.
Definition transport.h:836
uint64_t incoming_fc_window_size_ram
RAM currently held for this link.
Definition transport.h:869
uint64_t incoming_fc_window_size_used
How much of incoming_fc_window_size the other peer used.
Definition transport.h:879
uint32_t pending
Number of messages queued for transmission to target.
Definition transport.h:854
int64_t incoming_fc_window_size_loss
Current estimate of the message loss rate for the sender.
Definition transport.h:885
struct GNUNET_TIME_RelativeNBO other_rtt
RTT over all DV paths, as calculated by the target.
Definition transport.h:905
uint64_t outbound_fc_window_size
Window the other peer granted us.
Definition transport.h:890
uint64_t outbound_fc_window_size_used
How much of outbound_fc_window_size we used.
Definition transport.h:895
uint64_t incoming_fc_window_size
Window we last granted the other peer.
Definition transport.h:874
uint32_t route
An ‘enum GNUNET_TRANSPORT_LinkRoute’ in NBO.
Definition transport.h:824
uint32_t distance
Distance of the DV path, 0 if route is GNUNET_TRANSPORT_LINK_ROUTE_DIRECT.
Definition transport.h:830
struct GNUNET_PeerIdentity target
Peer at the other end of the link.
Definition transport.h:814
struct GNUNET_TIME_RelativeNBO last_fc_rtt
RTT of the last flow control exchange.
Definition transport.h:900
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_LINK_LIST_RESPONSE.
Definition transport.h:809
uint32_t confirmed
GNUNET_YES if the link is confirmed, i.e.
Definition transport.h:819
int32_t core_recv_window
How many more messages we may hand to CORE before it must acknowledge them.
Definition transport.h:843
uint64_t available_fc_window_size
RAM we are willing to spend on this link.
Definition transport.h:864
uint32_t num_msg_pending
Messages pending (in NBO).
Definition transport.h:768
struct GNUNET_PeerIdentity peer
Target identifier.
Definition transport.h:746
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA.
Definition transport.h:736
struct GNUNET_TIME_AbsoluteNBO valid_until
Definition transport.h:752
struct GNUNET_TIME_AbsoluteNBO last_validation
Definition transport.h:751
uint32_t num_bytes_pending
Bytes pending (in NBO).
Definition transport.h:773
struct GNUNET_TIME_AbsoluteNBO next_validation
Definition transport.h:753
uint32_t nt
Network type (an enum GNUNET_NetworkType in NBO).
Definition transport.h:741
struct GNUNET_TIME_RelativeNBO rtt
Current round-trip time estimate.
Definition transport.h:758
uint32_t cs
Connection status (in NBO).
Definition transport.h:763
Request to start monitoring.
Definition transport.h:710
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START.
Definition transport.h:714
uint32_t one_shot
GNUNET_YES for one-shot monitoring, GNUNET_NO for continuous monitoring.
Definition transport.h:719
struct GNUNET_PeerIdentity peer
Target identifier to monitor, all zeros for "all peers".
Definition transport.h:724
Inform transport that message was sent.
Definition transport.h:594
uint32_t status
Success (GNUNET_OK), failure (GNUNET_SYSERR).
Definition transport.h:603
uint64_t mid
Message ID of the original message.
Definition transport.h:608
uint32_t qid
Queue ID for the queue which was used to send the message.
Definition transport.h:613
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition transport.h:618
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK.
Definition transport.h:598
Inform communicator about transport's desire to send a message.
Definition transport.h:565
uint32_t qid
Which queue should we use?
Definition transport.h:574
uint64_t mid
Message ID, used for flow control.
Definition transport.h:579
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG.
Definition transport.h:569
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition transport.h:584
Message from transport to communicator to start a burst.
Definition transport.h:682
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START_BURST.
Definition transport.h:686
struct GNUNET_TIME_RelativeNBO rtt
Definition transport.h:693
struct GNUNET_PeerIdentity pid
Target peer.
Definition transport.h:691
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition transport.h:467
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition transport.h:493
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition transport.h:472
uint32_t priority
Priority of the queue in relation to other queues.
Definition transport.h:488
uint32_t mtu
Maximum transmission unit, in NBO.
Definition transport.h:477
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition transport.h:457
uint64_t q_len
Queue length, in NBO.
Definition transport.h:483
uint32_t qid
Queue identifier (used to identify the queue).
Definition transport.h:462
Message used to notify the transport API about a message received from the network.
Definition transport.h:145
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV.
Definition transport.h:149
struct GNUNET_PeerIdentity peer
Which peer sent the message?
Definition transport.h:154
Message used to notify the transport service about a message to be transmitted to another peer.
Definition transport.h:231
uint32_t priority
An enum GNUNET_MQ_PriorityPreferences in NBO.
Definition transport.h:240
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND.
Definition transport.h:235
struct GNUNET_PeerIdentity peer
Which peer should receive the message?
Definition transport.h:254
struct GNUNET_TIME_RelativeNBO timeout
Allowed delay.
Definition transport.h:248
Message used to notify the transport API that it can send another message to the transport service.
Definition transport.h:207
struct GNUNET_PeerIdentity peer
Which peer can CORE handle more from now?
Definition transport.h:222
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK.
Definition transport.h:211
uint32_t increase_window_delta
Number of messages by which to increase the window, greater or equal to one.
Definition transport.h:217
We got an address of another peer, TRANSPORT service should validate it.
Definition transport.h:979
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION.
Definition transport.h:983
struct GNUNET_PeerIdentity peer
Peer to the address is presumably for.
Definition transport.h:994
uint32_t nt
What type of network does the other peer claim this is? A enum GNUNET_NetworkType in NBO.
Definition transport.h:989
Message used to notify the transport API that it can send another message to the transport service.
Definition transport.h:163
uint16_t success
GNUNET_OK if the transmission succeeded, GNUNET_SYSERR if it failed (i.e.
Definition transport.h:180
uint16_t bytes_msg
Size of message sent.
Definition transport.h:185
uint32_t bytes_physical
Size of message sent over wire.
Definition transport.h:191
struct GNUNET_PeerIdentity peer
Which peer can send more now?
Definition transport.h:197
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK.
Definition transport.h:167
Message from the transport service to the library asking to check if both processes agree about this ...
Definition transport.h:63
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START.
Definition transport.h:67
uint32_t options
0: no options 1: The self field should be checked 2: this client is interested in payload traffic
Definition transport.h:74
struct GNUNET_PeerIdentity self
Identity we think we have.
Definition transport.h:81
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:47