GNUnet debian-0.24.3-23-g589b01d60
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
79 // TODO remove
81};
82
83
89{
94
95#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
96 defined(GNUNET_TRANSPORT_CORE_VERSION))
97
101 uint32_t reserved GNUNET_PACKED;
102#else
107#endif
108
113};
114
115
121{
126
131
136};
137
138
144{
149
154};
155
156
162{
167
168#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
169 defined(GNUNET_TRANSPORT_CORE_VERSION))
170
171 uint32_t reserved GNUNET_PACKED;
172#else
180
185
191#endif
192
197};
198
199
206{
211
217
222};
223
224
230{
235
240
241#if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
242 defined(GNUNET_TRANSPORT_CORE_VERSION))
243
248#endif
249
254};
255
256
257/* *********************** TNG messages ***************** */
258
264{
269
273 uint32_t cc;
274
278 uint32_t can_burst;
279
280 /* Followed by the address prefix of the communicator */
281};
282
283
288{
293
298
303
307 uint32_t nt;
308
309 /* followed by UTF-8 encoded, 0-terminated human-readable address */
310};
311
312
317{
322
327};
328
329
334{
339
344
349
355
360
365
366 /* followed by the message */
367};
368
369
375{
380
385
390
395};
396
397
402{
407
412
417
421 uint32_t nt;
422
426 uint32_t mtu;
427
432 uint64_t q_len;
433
437 uint32_t priority;
438
442 uint32_t cs;
443
444 /* followed by UTF-8 encoded, 0-terminated human-readable address */
445};
446
447
452{
457
462
467
471 uint32_t nt;
472
476 uint32_t mtu;
477
482 uint64_t q_len;
483
487 uint32_t priority;
488
492 uint32_t cs;
493};
494
495
500{
505
510
515};
516
517
522{
527
532
537
538 /* followed by UTF-8 encoded, 0-terminated human-readable address */
539};
540
541
546{
552
557};
558
559
564{
569
574
579
584
585 /* followed by the message */
586};
587
588
593{
598
603
608
613
618};
619
620
627{
632
636 uint32_t reserved;
637
642
643 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
644 message to the communicator */
645
646 /* Followed by the 0-terminated string specifying the desired
647 communicator at the target (@e pid) peer */
648};
649
650
656{
662
666 uint32_t reserved;
667
672
673 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
674 message to the communicator */
675};
676
681{
686
691
693
694 /* followed by UTF-8 encoded, 0-terminated human-readable address */
695};
696
698{
703};
704
709{
714
718 uint32_t one_shot;
719
724};
725
726
731{
736
741
746
753
758
763
768
773
774 /* Followed by 0-terminated address of the peer */
775};
776
777
782{
787
791 uint32_t reserved;
792
797
798 /* followed by variable-size raw address */
799};
800
801
807{
814
820
825
830};
831
832
838{
843
849
854
855 /* followed by 0-terminated address to validate */
856};
857
859
860/* end of transport.h */
861#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:89
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT.
Definition: transport.h:93
struct GNUNET_PeerIdentity id
Identity of the new neighbour.
Definition: transport.h:112
struct GNUNET_BANDWIDTH_Value32NBO quota_out
Current outbound quota for this peer.
Definition: transport.h:106
Message from the transport service to the library informing about disconnects.
Definition: transport.h:121
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT.
Definition: transport.h:125
uint32_t reserved
Reserved, always zero.
Definition: transport.h:130
struct GNUNET_PeerIdentity peer
Who got disconnected?
Definition: transport.h:135
Application client to TRANSPORT service: we would like to have address suggestions for this peer.
Definition: transport.h:807
struct GNUNET_BANDWIDTH_Value32NBO bw
How much bandwidth in bytes/second does the application expect?
Definition: transport.h:829
struct GNUNET_PeerIdentity peer
Peer to get address suggestions for.
Definition: transport.h:824
uint32_t pk
What type of performance preference does the client have? A enum GNUNET_MQ_PreferenceKind in NBO.
Definition: transport.h:819
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop...
Definition: transport.h:813
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:288
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS.
Definition: transport.h:292
struct GNUNET_TIME_RelativeNBO expiration
When does the address expire?
Definition: transport.h:302
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:307
uint32_t aid
Address identifier (used during deletion).
Definition: transport.h:297
Add queue to the transport.
Definition: transport.h:402
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:421
uint32_t mtu
Maximum transmission unit, in NBO.
Definition: transport.h:426
uint64_t q_len
Queue length, in NBO.
Definition: transport.h:432
uint32_t priority
Priority of the queue in relation to other queues.
Definition: transport.h:437
uint32_t qid
Queue identifier (used to identify the queue).
Definition: transport.h:411
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:416
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition: transport.h:406
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition: transport.h:442
Request to verify address.
Definition: transport.h:782
uint32_t reserved
Reserved.
Definition: transport.h:791
struct GNUNET_MessageHeader header
Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY.
Definition: transport.h:786
struct GNUNET_PeerIdentity peer
Peer the address is from.
Definition: transport.h:796
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_BURST_FINISHED.
Definition: transport.h:702
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR.
Definition: transport.h:268
uint32_t cc
NBO encoding of enum GNUNET_TRANSPORT_CommunicatorCharacteristics
Definition: transport.h:273
uint32_t can_burst
The communicator can do burst msgs.
Definition: transport.h:278
Message from transport to communicator passing along a backchannel message from the given peer pid.
Definition: transport.h:656
struct GNUNET_PeerIdentity pid
Origin peer.
Definition: transport.h:671
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING.
Definition: transport.h:661
uint32_t reserved
Always zero, for alignment.
Definition: transport.h:666
Message from communicator to transport service asking for transmission of a backchannel message with ...
Definition: transport.h:627
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL.
Definition: transport.h:631
uint32_t reserved
Always zero, for alignment.
Definition: transport.h:636
struct GNUNET_PeerIdentity pid
Target peer.
Definition: transport.h:641
Communicator tells transport how queue creation went down.
Definition: transport.h:546
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK or GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CRE...
Definition: transport.h:551
uint32_t request_id
Unique ID for the request.
Definition: transport.h:556
Transport tells communicator that it wants a new queue.
Definition: transport.h:522
uint32_t request_id
Unique ID for the request.
Definition: transport.h:531
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE.
Definition: transport.h:526
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:536
Remove address from the list.
Definition: transport.h:317
uint32_t aid
Address identifier.
Definition: transport.h:326
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS.
Definition: transport.h:321
Remove queue, it is no longer available.
Definition: transport.h:500
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN.
Definition: transport.h:504
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:514
uint32_t qid
Address identifier.
Definition: transport.h:509
Transport informs us about being done with an incoming message.
Definition: transport.h:375
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK.
Definition: transport.h:379
struct GNUNET_PeerIdentity sender
Sender identifier of the original message.
Definition: transport.h:394
uint64_t fc_id
Which message is being ACKed?
Definition: transport.h:389
uint32_t reserved
Reserved (0)
Definition: transport.h:384
Inform transport about an incoming message.
Definition: transport.h:334
struct GNUNET_PeerIdentity neighbour_sender
Direct neighbour sender identifier.
Definition: transport.h:364
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:354
struct GNUNET_PeerIdentity sender
Sender identifier.
Definition: transport.h:359
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG.
Definition: transport.h:338
uint32_t fc_on
Do we use flow control or not?
Definition: transport.h:343
uint64_t fc_id
64-bit number to identify the matching ACK.
Definition: transport.h:348
uint32_t num_msg_pending
Messages pending (in NBO).
Definition: transport.h:767
struct GNUNET_PeerIdentity peer
Target identifier.
Definition: transport.h:745
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA.
Definition: transport.h:735
struct GNUNET_TIME_AbsoluteNBO valid_until
Definition: transport.h:751
struct GNUNET_TIME_AbsoluteNBO last_validation
Definition: transport.h:750
uint32_t num_bytes_pending
Bytes pending (in NBO).
Definition: transport.h:772
struct GNUNET_TIME_AbsoluteNBO next_validation
Definition: transport.h:752
uint32_t nt
Network type (an enum GNUNET_NetworkType in NBO).
Definition: transport.h:740
struct GNUNET_TIME_RelativeNBO rtt
Current round-trip time estimate.
Definition: transport.h:757
uint32_t cs
Connection status (in NBO).
Definition: transport.h:762
Request to start monitoring.
Definition: transport.h:709
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START.
Definition: transport.h:713
uint32_t one_shot
GNUNET_YES for one-shot monitoring, GNUNET_NO for continuous monitoring.
Definition: transport.h:718
struct GNUNET_PeerIdentity peer
Target identifier to monitor, all zeros for "all peers".
Definition: transport.h:723
Inform transport that message was sent.
Definition: transport.h:593
uint32_t status
Success (GNUNET_OK), failure (GNUNET_SYSERR).
Definition: transport.h:602
uint64_t mid
Message ID of the original message.
Definition: transport.h:607
uint32_t qid
Queue ID for the queue which was used to send the message.
Definition: transport.h:612
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition: transport.h:617
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK.
Definition: transport.h:597
Inform communicator about transport's desire to send a message.
Definition: transport.h:564
uint32_t qid
Which queue should we use?
Definition: transport.h:573
uint64_t mid
Message ID, used for flow control.
Definition: transport.h:578
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG.
Definition: transport.h:568
struct GNUNET_PeerIdentity receiver
Receiver identifier.
Definition: transport.h:583
Message from transport to communicator to start a burst.
Definition: transport.h:681
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START_BURST.
Definition: transport.h:685
struct GNUNET_TIME_RelativeNBO rtt
Definition: transport.h:692
struct GNUNET_PeerIdentity pid
Target peer.
Definition: transport.h:690
struct GNUNET_PeerIdentity receiver
Receiver that can be addressed via the queue.
Definition: transport.h:466
uint32_t cs
An enum GNUNET_TRANSPORT_ConnectionStatus in NBO.
Definition: transport.h:492
uint32_t nt
An enum GNUNET_NetworkType in NBO.
Definition: transport.h:471
uint32_t priority
Priority of the queue in relation to other queues.
Definition: transport.h:487
uint32_t mtu
Maximum transmission unit, in NBO.
Definition: transport.h:476
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
Definition: transport.h:456
uint64_t q_len
Queue length, in NBO.
Definition: transport.h:482
uint32_t qid
Queue identifier (used to identify the queue).
Definition: transport.h:461
Message used to notify the transport API about a message received from the network.
Definition: transport.h:144
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV.
Definition: transport.h:148
struct GNUNET_PeerIdentity peer
Which peer sent the message?
Definition: transport.h:153
Message used to notify the transport service about a message to be transmitted to another peer.
Definition: transport.h:230
uint32_t priority
An enum GNUNET_MQ_PriorityPreferences in NBO.
Definition: transport.h:239
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND.
Definition: transport.h:234
struct GNUNET_PeerIdentity peer
Which peer should receive the message?
Definition: transport.h:253
struct GNUNET_TIME_RelativeNBO timeout
Allowed delay.
Definition: transport.h:247
Message used to notify the transport API that it can send another message to the transport service.
Definition: transport.h:206
struct GNUNET_PeerIdentity peer
Which peer can CORE handle more from now?
Definition: transport.h:221
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK.
Definition: transport.h:210
uint32_t increase_window_delta
Number of messages by which to increase the window, greater or equal to one.
Definition: transport.h:216
We got an address of another peer, TRANSPORT service should validate it.
Definition: transport.h:838
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION.
Definition: transport.h:842
struct GNUNET_PeerIdentity peer
Peer to the address is presumably for.
Definition: transport.h:853
uint32_t nt
What type of network does the other peer claim this is? A enum GNUNET_NetworkType in NBO.
Definition: transport.h:848
Message used to notify the transport API that it can send another message to the transport service.
Definition: transport.h:162
uint16_t success
GNUNET_OK if the transmission succeeded, GNUNET_SYSERR if it failed (i.e.
Definition: transport.h:179
uint16_t bytes_msg
Size of message sent.
Definition: transport.h:184
uint32_t bytes_physical
Size of message sent over wire.
Definition: transport.h:190
struct GNUNET_PeerIdentity peer
Which peer can send more now?
Definition: transport.h:196
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK.
Definition: transport.h:166
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:80
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