aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport.h')
-rw-r--r--src/transport/transport.h1246
1 files changed, 0 insertions, 1246 deletions
diff --git a/src/transport/transport.h b/src/transport/transport.h
deleted file mode 100644
index e060f81ba..000000000
--- a/src/transport/transport.h
+++ /dev/null
@@ -1,1246 +0,0 @@
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
21/**
22 * @file transport/transport.h
23 * @brief common internal definitions for transport service
24 * @author Christian Grothoff
25 */
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
36/**
37 * For how long do we allow unused bandwidth
38 * from the past to carry over into the future? (in seconds)
39 */
40#define MAX_BANDWIDTH_CARRY_S GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S
41
42/**
43 * How often do we (at most) do a full quota
44 * recalculation? (in ms)
45 */
46#define MIN_QUOTA_REFRESH_TIME 2000
47
48/**
49 * What's the maximum number of sockets transport uses for validation and
50 * neighbors
51 */
52#define DEFAULT_MAX_FDS 256
53
54/**
55 * Maximum frequency for re-evaluating latencies for all transport addresses.
56 */
57#define LATENCY_EVALUATION_MAX_DELAY \
58 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1)
59
60/**
61 * Maximum frequency for re-evaluating latencies for connected addresses.
62 */
63#define CONNECTED_LATENCY_EVALUATION_MAX_DELAY \
64 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
65
66/**
67 * Similar to GNUNET_TRANSPORT_NotifyDisconnect but in and out quotas are
68 * included here. These values are not required outside transport_api
69 *
70 * @param cls closure
71 * @param peer the peer that connected
72 * @param bandwidth_in inbound bandwidth in NBO
73 * @param bandwidth_out outbound bandwidth in NBO
74 *
75 */
76typedef void (*NotifyConnect) (
77 void *cls,
78 const struct GNUNET_PeerIdentity *peer,
79 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
80 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
81
82
83GNUNET_NETWORK_STRUCT_BEGIN
84
85
86/**
87 * Message from the transport service to the library
88 * asking to check if both processes agree about this
89 * peers identity.
90 */
91struct StartMessage
92{
93 /**
94 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_START
95 */
96 struct GNUNET_MessageHeader header;
97
98 /**
99 * 0: no options
100 * 1: The @e self field should be checked
101 * 2: this client is interested in payload traffic
102 */
103 uint32_t options;
104
105 /**
106 * Identity we think we have. If it does not match, the
107 * receiver should print out an error message and disconnect.
108 */
109 struct GNUNET_PeerIdentity self;
110};
111
112
113/**
114 * Message from the transport service to the library
115 * informing about neighbors.
116 */
117struct ConnectInfoMessage
118{
119 /**
120 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT
121 */
122 struct GNUNET_MessageHeader header;
123
124#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
125 defined(GNUNET_TRANSPORT_CORE_VERSION))
126
127 /**
128 * Always zero, for alignment.
129 */
130 uint32_t reserved GNUNET_PACKED;
131#else
132 /**
133 * Current outbound quota for this peer
134 */
135 struct GNUNET_BANDWIDTH_Value32NBO quota_out;
136#endif
137
138 /**
139 * Identity of the new neighbour.
140 */
141 struct GNUNET_PeerIdentity id;
142};
143
144
145/**
146 * Message from the transport service to the library
147 * informing about disconnects.
148 */
149struct DisconnectInfoMessage
150{
151 /**
152 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT
153 */
154 struct GNUNET_MessageHeader header;
155
156 /**
157 * Reserved, always zero.
158 */
159 uint32_t reserved GNUNET_PACKED;
160
161 /**
162 * Who got disconnected?
163 */
164 struct GNUNET_PeerIdentity peer;
165};
166
167
168/**
169 * Message used to set a particular bandwidth quota. Sent TO the
170 * service to set an incoming quota, sent FROM the service to update
171 * an outgoing quota.
172 *
173 * NOTE: no longer used in TNG!
174 */
175struct QuotaSetMessage
176{
177 /**
178 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA
179 */
180 struct GNUNET_MessageHeader header;
181
182 /**
183 * Quota.
184 */
185 struct GNUNET_BANDWIDTH_Value32NBO quota;
186
187 /**
188 * About which peer are we talking here?
189 */
190 struct GNUNET_PeerIdentity peer;
191};
192
193
194/**
195 * Message used to notify the transport API about a message
196 * received from the network. The actual message follows.
197 */
198struct InboundMessage
199{
200 /**
201 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_RECV
202 */
203 struct GNUNET_MessageHeader header;
204
205 /**
206 * Which peer sent the message?
207 */
208 struct GNUNET_PeerIdentity peer;
209};
210
211
212/**
213 * Message used to notify the transport API that it can
214 * send another message to the transport service.
215 */
216struct SendOkMessage
217{
218 /**
219 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK
220 */
221 struct GNUNET_MessageHeader header;
222
223#if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
224 defined(GNUNET_TRANSPORT_CORE_VERSION))
225
226 uint32_t reserved GNUNET_PACKED;
227#else
228 /**
229 * #GNUNET_OK if the transmission succeeded,
230 * #GNUNET_SYSERR if it failed (i.e. network disconnect);
231 * in either case, it is now OK for this client to
232 * send us another message for the given peer.
233 */
234 uint16_t success GNUNET_PACKED;
235
236 /**
237 * Size of message sent
238 */
239 uint16_t bytes_msg GNUNET_PACKED;
240
241 /**
242 * Size of message sent over wire.
243 * Includes plugin and protocol specific overheads.
244 */
245 uint32_t bytes_physical GNUNET_PACKED;
246#endif
247
248 /**
249 * Which peer can send more now?
250 */
251 struct GNUNET_PeerIdentity peer;
252};
253
254
255/**
256 * Message used to notify the transport API that it can
257 * send another message to the transport service.
258 * (Used to implement flow control.)
259 */
260struct RecvOkMessage
261{
262 /**
263 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK
264 */
265 struct GNUNET_MessageHeader header;
266
267 /**
268 * Number of messages by which to increase the window, greater or
269 * equal to one.
270 */
271 uint32_t increase_window_delta GNUNET_PACKED;
272
273 /**
274 * Which peer can CORE handle more from now?
275 */
276 struct GNUNET_PeerIdentity peer;
277};
278
279
280/**
281 * Message used to notify the transport service about a message
282 * to be transmitted to another peer. The actual message follows.
283 */
284struct OutboundMessage
285{
286 /**
287 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND
288 */
289 struct GNUNET_MessageHeader header;
290
291 /**
292 * An `enum GNUNET_MQ_PriorityPreferences` in NBO.
293 */
294 uint32_t priority GNUNET_PACKED;
295
296#if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
297 defined(GNUNET_TRANSPORT_CORE_VERSION))
298
299 /**
300 * Allowed delay.
301 */
302 struct GNUNET_TIME_RelativeNBO timeout;
303#endif
304
305 /**
306 * Which peer should receive the message?
307 */
308 struct GNUNET_PeerIdentity peer;
309};
310
311
312#if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
313 defined(GNUNET_TRANSPORT_CORE_VERSION))
314
315
316/**
317 * Message used to notify the transport API about an address to string
318 * conversion. Message is followed by the string with the humand-readable
319 * address. For each lookup, multiple results may be returned. The
320 * last message must have a @e res of #GNUNET_OK and an @e addr_len
321 * of zero.
322 */
323struct AddressToStringResultMessage
324{
325 /**
326 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY
327 */
328 struct GNUNET_MessageHeader header;
329
330 /**
331 * #GNUNET_OK if the conversion succeeded,
332 * #GNUNET_SYSERR if it failed
333 */
334 uint32_t res GNUNET_PACKED;
335
336 /**
337 * Length of the following string, zero if @e is #GNUNET_SYSERR
338 */
339 uint32_t addr_len GNUNET_PACKED;
340};
341
342
343/**
344 * Message from the library to the transport service
345 * asking for converting a transport address to a
346 * human-readable UTF-8 string.
347 */
348struct AddressLookupMessage
349{
350 /**
351 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING
352 */
353 struct GNUNET_MessageHeader header;
354
355 /**
356 * Should the conversion use numeric IP addresses (otherwise
357 * a reverse DNS lookup is OK -- if applicable).
358 */
359 int16_t numeric_only GNUNET_PACKED;
360
361 /**
362 * Length of the (binary) address in bytes, in big-endian.
363 */
364 uint16_t addrlen GNUNET_PACKED;
365
366 /**
367 * timeout to give up (for DNS resolution timeout mostly)
368 */
369 struct GNUNET_TIME_RelativeNBO timeout;
370
371 /* followed by @e addrlen bytes of the actual address, then
372 * followed by the 0-terminated name of the transport */
373};
374
375
376/**
377 * Message from the transport service to the library containing information
378 * about a peer. Information contained are:
379 * - current address used to communicate with this peer
380 * - state
381 * - state timeout
382 *
383 * Memory layout:
384 * [AddressIterateResponseMessage][address[addrlen]][transportname[pluginlen]]
385 */
386struct ValidationIterateResponseMessage
387{
388 /**
389 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE
390 */
391 struct GNUNET_MessageHeader header;
392
393 /**
394 * For alignment.
395 */
396 uint32_t reserved;
397
398 /**
399 * Peer identity
400 */
401 struct GNUNET_PeerIdentity peer;
402
403 /**
404 * Local info about the address
405 */
406 uint32_t local_address_info GNUNET_PACKED;
407
408 /**
409 * Address length
410 */
411 uint32_t addrlen GNUNET_PACKED;
412
413 /**
414 * Length of the plugin name
415 */
416 uint32_t pluginlen GNUNET_PACKED;
417
418 /**
419 * State
420 */
421 uint32_t state GNUNET_PACKED;
422
423 /**
424 * At what time did we successfully validate the address last.
425 * Will be NEVER if the address failed validation.
426 */
427 struct GNUNET_TIME_AbsoluteNBO last_validation;
428
429 /**
430 * Until when is the address believed to be valid.
431 * Will be ZERO if the address is not believed to be valid.
432 */
433 struct GNUNET_TIME_AbsoluteNBO valid_until;
434
435 /**
436 * When will we next try to validate the address (typically
437 * done before @e valid_until happens).
438 */
439 struct GNUNET_TIME_AbsoluteNBO next_validation;
440};
441
442
443/**
444 * Message from the library to the transport service
445 * asking for binary addresses known for a peer.
446 */
447struct ValidationMonitorMessage
448{
449 /**
450 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_REQUEST
451 */
452 struct GNUNET_MessageHeader header;
453
454 /**
455 * One shot call or continuous replies?
456 */
457 uint32_t one_shot GNUNET_PACKED;
458
459 /**
460 * The identity of the peer to look up.
461 */
462 struct GNUNET_PeerIdentity peer;
463};
464
465
466/**
467 * Message from the library to the transport service
468 * asking for binary addresses known for a peer.
469 */
470struct PeerMonitorMessage
471{
472 /**
473 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST
474 */
475 struct GNUNET_MessageHeader header;
476
477 /**
478 * One shot call or continuous replies?
479 */
480 uint32_t one_shot GNUNET_PACKED;
481
482 /**
483 * The identity of the peer to look up.
484 */
485 struct GNUNET_PeerIdentity peer;
486};
487
488
489/**
490 * Message from the library to the transport service
491 * asking for binary addresses known for a peer.
492 */
493struct TrafficMetricMessage
494{
495 /**
496 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC
497 */
498 struct GNUNET_MessageHeader header;
499
500 /**
501 * Always zero.
502 */
503 uint32_t reserved GNUNET_PACKED;
504
505 /**
506 * The identity of the peer to look up.
507 */
508 struct GNUNET_PeerIdentity peer;
509
510 /**
511 * Fake properties to generate.
512 */
513 struct GNUNET_ATS_PropertiesNBO properties;
514
515 /**
516 * Fake delay to add on inbound traffic.
517 */
518 struct GNUNET_TIME_RelativeNBO delay_in;
519
520 /**
521 * Fake delay to add on outbound traffic.
522 */
523 struct GNUNET_TIME_RelativeNBO delay_out;
524};
525
526
527/**
528 * Message from the transport service to the library containing information
529 * about a peer. Information contained are:
530 * - current address used to communicate with this peer
531 * - state
532 * - state timeout
533 *
534 * Memory layout:
535 * [AddressIterateResponseMessage][address[addrlen]][transportname[pluginlen]]
536 */
537struct PeerIterateResponseMessage
538{
539 /**
540 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE
541 */
542 struct GNUNET_MessageHeader header;
543
544 /**
545 * For alignment.
546 */
547 uint32_t reserved;
548
549 /**
550 * Peer identity
551 */
552 struct GNUNET_PeerIdentity peer;
553
554 /**
555 * Timeout for the state this peer is in
556 */
557 struct GNUNET_TIME_AbsoluteNBO state_timeout;
558
559 /**
560 * Local info about the address
561 */
562 uint32_t local_address_info GNUNET_PACKED;
563
564 /**
565 * State this peer is in as an `enum GNUNET_TRANSPORT_PeerState`
566 */
567 uint32_t state GNUNET_PACKED;
568
569 /**
570 * Address length
571 */
572 uint32_t addrlen GNUNET_PACKED;
573
574 /**
575 * Length of the plugin name
576 */
577 uint32_t pluginlen GNUNET_PACKED;
578};
579
580
581/**
582 * Change in blacklisting (either request or notification,
583 * depending on which direction it is going).
584 */
585struct BlacklistMessage
586{
587 /**
588 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY or
589 * #GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY.
590 */
591 struct GNUNET_MessageHeader header;
592
593 /**
594 * 0 for the query, #GNUNET_OK (allowed) or #GNUNET_SYSERR (disallowed)
595 * for the response.
596 */
597 uint32_t is_allowed GNUNET_PACKED;
598
599 /**
600 * Which peer is being blacklisted or queried?
601 */
602 struct GNUNET_PeerIdentity peer;
603};
604
605
606/**
607 * Transport-level connection status update.
608 */
609struct TransportPluginMonitorMessage
610{
611 /**
612 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT.
613 */
614 struct GNUNET_MessageHeader header;
615
616 /**
617 * An `enum GNUNET_TRANSPORT_SessionState` in NBO.
618 */
619 uint16_t session_state GNUNET_PACKED;
620
621 /**
622 * #GNUNET_YES if this is an inbound connection,
623 * #GNUNET_NO if this is an outbound connection,
624 * #GNUNET_SYSERR if connections of this plugin
625 * are so fundamentally bidirectional
626 * that they have no 'initiator'
627 * Value given in NBO.
628 */
629 int16_t is_inbound GNUNET_PACKED;
630
631 /**
632 * Number of messages waiting transmission.
633 */
634 uint32_t msgs_pending GNUNET_PACKED;
635
636 /**
637 * Number of bytes waiting for transmission.
638 */
639 uint32_t bytes_pending GNUNET_PACKED;
640
641 /**
642 * When will this transport plugin session time out?
643 */
644 struct GNUNET_TIME_AbsoluteNBO timeout;
645
646 /**
647 * Until how long is this plugin currently blocked from reading?
648 */
649 struct GNUNET_TIME_AbsoluteNBO delay;
650
651 /**
652 * Which peer is this connection for?
653 */
654 struct GNUNET_PeerIdentity peer;
655
656 /**
657 * Unique identifier for the session.
658 */
659 uint64_t session_id;
660
661 /**
662 * Length of the plugin name in bytes, including 0-termination.
663 */
664 uint16_t plugin_name_len GNUNET_PACKED;
665
666 /**
667 * Length of the plugin address in bytes.
668 */
669 uint16_t plugin_address_len GNUNET_PACKED;
670
671 /* followed by 0-terminated plugin name and
672 @e plugin_address_len bytes of plugin address */
673};
674
675#else
676
677/* *********************** TNG messages ***************** */
678
679/**
680 * Communicator goes online. Note which addresses it can
681 * work with.
682 */
683struct GNUNET_TRANSPORT_CommunicatorAvailableMessage
684{
685 /**
686 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR.
687 */
688 struct GNUNET_MessageHeader header;
689
690 /**
691 * NBO encoding of `enum GNUNET_TRANSPORT_CommunicatorCharacteristics`
692 */
693 uint32_t cc;
694
695 /* Followed by the address prefix of the communicator */
696};
697
698
699/**
700 * Add address to the list.
701 */
702struct GNUNET_TRANSPORT_AddAddressMessage
703{
704 /**
705 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS.
706 */
707 struct GNUNET_MessageHeader header;
708
709 /**
710 * Address identifier (used during deletion).
711 */
712 uint32_t aid GNUNET_PACKED;
713
714 /**
715 * When does the address expire?
716 */
717 struct GNUNET_TIME_RelativeNBO expiration;
718
719 /**
720 * An `enum GNUNET_NetworkType` in NBO.
721 */
722 uint32_t nt;
723
724 /* followed by UTF-8 encoded, 0-terminated human-readable address */
725};
726
727
728/**
729 * Remove address from the list.
730 */
731struct GNUNET_TRANSPORT_DelAddressMessage
732{
733 /**
734 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS.
735 */
736 struct GNUNET_MessageHeader header;
737
738 /**
739 * Address identifier.
740 */
741 uint32_t aid GNUNET_PACKED;
742};
743
744
745/**
746 * Inform transport about an incoming message.
747 */
748struct GNUNET_TRANSPORT_IncomingMessage
749{
750 /**
751 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG.
752 */
753 struct GNUNET_MessageHeader header;
754
755 /**
756 * Do we use flow control or not?
757 */
758 uint32_t fc_on GNUNET_PACKED;
759
760 /**
761 * 64-bit number to identify the matching ACK.
762 */
763 uint64_t fc_id GNUNET_PACKED;
764
765 /**
766 * How long does the communicator believe the address on which
767 * the message was received to remain valid?
768 */
769 struct GNUNET_TIME_RelativeNBO expected_address_validity;
770
771 /**
772 * Sender identifier.
773 */
774 struct GNUNET_PeerIdentity sender;
775
776 /**
777 * Direct neighbour sender identifier.
778 */
779 struct GNUNET_PeerIdentity neighbour_sender;
780
781 /* followed by the message */
782};
783
784
785/**
786 * Transport informs us about being done with an incoming message.
787 * (only sent if fc_on was set).
788 */
789struct GNUNET_TRANSPORT_IncomingMessageAck
790{
791 /**
792 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK.
793 */
794 struct GNUNET_MessageHeader header;
795
796 /**
797 * Reserved (0)
798 */
799 uint32_t reserved GNUNET_PACKED;
800
801 /**
802 * Which message is being ACKed?
803 */
804 uint64_t fc_id GNUNET_PACKED;
805
806 /**
807 * Sender identifier of the original message.
808 */
809 struct GNUNET_PeerIdentity sender;
810};
811
812
813/**
814 * Add queue to the transport
815 */
816struct GNUNET_TRANSPORT_AddQueueMessage
817{
818 /**
819 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
820 */
821 struct GNUNET_MessageHeader header;
822
823 /**
824 * Queue identifier (used to identify the queue).
825 */
826 uint32_t qid GNUNET_PACKED;
827
828 /**
829 * Receiver that can be addressed via the queue.
830 */
831 struct GNUNET_PeerIdentity receiver;
832
833 /**
834 * An `enum GNUNET_NetworkType` in NBO.
835 */
836 uint32_t nt;
837
838 /**
839 * Maximum transmission unit, in NBO. UINT32_MAX for unlimited.
840 */
841 uint32_t mtu;
842
843 /**
844 * Queue length, in NBO. Defines how many messages may be
845 * send through this queue. UINT64_MAX for unlimited.
846 */
847 uint64_t q_len;
848
849 /**
850 * Priority of the queue in relation to other queues.
851 */
852 uint32_t priority;
853
854 /**
855 * An `enum GNUNET_TRANSPORT_ConnectionStatus` in NBO.
856 */
857 uint32_t cs;
858
859 /* followed by UTF-8 encoded, 0-terminated human-readable address */
860};
861
862
863/**
864 * Update queue
865 */
866struct GNUNET_TRANSPORT_UpdateQueueMessage
867{
868 /**
869 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
870 */
871 struct GNUNET_MessageHeader header;
872
873 /**
874 * Queue identifier (used to identify the queue).
875 */
876 uint32_t qid GNUNET_PACKED;
877
878 /**
879 * Receiver that can be addressed via the queue.
880 */
881 struct GNUNET_PeerIdentity receiver;
882
883 /**
884 * An `enum GNUNET_NetworkType` in NBO.
885 */
886 uint32_t nt;
887
888 /**
889 * Maximum transmission unit, in NBO. UINT32_MAX for unlimited.
890 */
891 uint32_t mtu;
892
893 /**
894 * Queue length, in NBO. Defines how many messages may be
895 * send through this queue. UINT64_MAX for unlimited.
896 */
897 uint64_t q_len;
898
899 /**
900 * Priority of the queue in relation to other queues.
901 */
902 uint32_t priority;
903
904 /**
905 * An `enum GNUNET_TRANSPORT_ConnectionStatus` in NBO.
906 */
907 uint32_t cs;
908};
909
910
911/**
912 * Remove queue, it is no longer available.
913 */
914struct GNUNET_TRANSPORT_DelQueueMessage
915{
916 /**
917 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN.
918 */
919 struct GNUNET_MessageHeader header;
920
921 /**
922 * Address identifier.
923 */
924 uint32_t qid GNUNET_PACKED;
925
926 /**
927 * Receiver that can be addressed via the queue.
928 */
929 struct GNUNET_PeerIdentity receiver;
930};
931
932
933/**
934 * Transport tells communicator that it wants a new queue.
935 */
936struct GNUNET_TRANSPORT_CreateQueue
937{
938 /**
939 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE.
940 */
941 struct GNUNET_MessageHeader header;
942
943 /**
944 * Unique ID for the request.
945 */
946 uint32_t request_id GNUNET_PACKED;
947
948 /**
949 * Receiver that can be addressed via the queue.
950 */
951 struct GNUNET_PeerIdentity receiver;
952
953 /* followed by UTF-8 encoded, 0-terminated human-readable address */
954};
955
956
957/**
958 * Communicator tells transport how queue creation went down.
959 */
960struct GNUNET_TRANSPORT_CreateQueueResponse
961{
962 /**
963 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK or
964 * #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_FAIL.
965 */
966 struct GNUNET_MessageHeader header;
967
968 /**
969 * Unique ID for the request.
970 */
971 uint32_t request_id GNUNET_PACKED;
972};
973
974
975/**
976 * Inform communicator about transport's desire to send a message.
977 */
978struct GNUNET_TRANSPORT_SendMessageTo
979{
980 /**
981 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG.
982 */
983 struct GNUNET_MessageHeader header;
984
985 /**
986 * Which queue should we use?
987 */
988 uint32_t qid GNUNET_PACKED;
989
990 /**
991 * Message ID, used for flow control.
992 */
993 uint64_t mid GNUNET_PACKED;
994
995 /**
996 * Receiver identifier.
997 */
998 struct GNUNET_PeerIdentity receiver;
999
1000 /* followed by the message */
1001};
1002
1003
1004/**
1005 * Inform transport that message was sent.
1006 */
1007struct GNUNET_TRANSPORT_SendMessageToAck
1008{
1009 /**
1010 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK.
1011 */
1012 struct GNUNET_MessageHeader header;
1013
1014 /**
1015 * Success (#GNUNET_OK), failure (#GNUNET_SYSERR).
1016 */
1017 uint32_t status GNUNET_PACKED;
1018
1019 /**
1020 * Message ID of the original message.
1021 */
1022 uint64_t mid GNUNET_PACKED;
1023
1024 /**
1025 * Receiver identifier.
1026 */
1027 struct GNUNET_PeerIdentity receiver;
1028};
1029
1030
1031/**
1032 * Message from communicator to transport service asking for
1033 * transmission of a backchannel message with the given peer @e pid
1034 * and communicator.
1035 */
1036struct GNUNET_TRANSPORT_CommunicatorBackchannel
1037{
1038 /**
1039 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL
1040 */
1041 struct GNUNET_MessageHeader header;
1042
1043 /**
1044 * Always zero, for alignment.
1045 */
1046 uint32_t reserved;
1047
1048 /**
1049 * Target peer.
1050 */
1051 struct GNUNET_PeerIdentity pid;
1052
1053 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1054 message to the communicator */
1055
1056 /* Followed by the 0-terminated string specifying the desired
1057 communicator at the target (@e pid) peer */
1058};
1059
1060
1061/**
1062 * Message from transport to communicator passing along a backchannel
1063 * message from the given peer @e pid.
1064 */
1065struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming
1066{
1067 /**
1068 * Type will be
1069 * #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING
1070 */
1071 struct GNUNET_MessageHeader header;
1072
1073 /**
1074 * Always zero, for alignment.
1075 */
1076 uint32_t reserved;
1077
1078 /**
1079 * Origin peer.
1080 */
1081 struct GNUNET_PeerIdentity pid;
1082
1083 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1084 message to the communicator */
1085};
1086
1087
1088/**
1089 * Request to start monitoring.
1090 */
1091struct GNUNET_TRANSPORT_MonitorStart
1092{
1093 /**
1094 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START.
1095 */
1096 struct GNUNET_MessageHeader header;
1097
1098 /**
1099 * #GNUNET_YES for one-shot montoring, #GNUNET_NO for continuous monitoring.
1100 */
1101 uint32_t one_shot;
1102
1103 /**
1104 * Target identifier to monitor, all zeros for "all peers".
1105 */
1106 struct GNUNET_PeerIdentity peer;
1107};
1108
1109
1110/**
1111 * Monitoring data.
1112 */
1113struct GNUNET_TRANSPORT_MonitorData
1114{
1115 /**
1116 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA.
1117 */
1118 struct GNUNET_MessageHeader header;
1119
1120 /**
1121 * Network type (an `enum GNUNET_NetworkType` in NBO).
1122 */
1123 uint32_t nt GNUNET_PACKED;
1124
1125 /**
1126 * Target identifier.
1127 */
1128 struct GNUNET_PeerIdentity peer;
1129
1130 /**
1131 * @deprecated To be discussed if we keep these...
1132 */
1133 struct GNUNET_TIME_AbsoluteNBO last_validation;
1134 struct GNUNET_TIME_AbsoluteNBO valid_until;
1135 struct GNUNET_TIME_AbsoluteNBO next_validation;
1136
1137 /**
1138 * Current round-trip time estimate.
1139 */
1140 struct GNUNET_TIME_RelativeNBO rtt;
1141
1142 /**
1143 * Connection status (in NBO).
1144 */
1145 uint32_t cs GNUNET_PACKED;
1146
1147 /**
1148 * Messages pending (in NBO).
1149 */
1150 uint32_t num_msg_pending GNUNET_PACKED;
1151
1152 /**
1153 * Bytes pending (in NBO).
1154 */
1155 uint32_t num_bytes_pending GNUNET_PACKED;
1156
1157 /* Followed by 0-terminated address of the peer */
1158};
1159
1160
1161/**
1162 * Request to verify address.
1163 */
1164struct GNUNET_TRANSPORT_AddressToVerify
1165{
1166 /**
1167 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY.
1168 */
1169 struct GNUNET_MessageHeader header;
1170
1171 /**
1172 * Reserved. 0.
1173 */
1174 uint32_t reserved;
1175
1176 /**
1177 * Peer the address is from.
1178 */
1179 struct GNUNET_PeerIdentity peer;
1180
1181 /* followed by variable-size raw address */
1182};
1183
1184
1185/**
1186 * Application client to TRANSPORT service: we would like to have
1187 * address suggestions for this peer.
1188 */
1189struct ExpressPreferenceMessage
1190{
1191 /**
1192 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or
1193 * #GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop
1194 * suggestions.
1195 */
1196 struct GNUNET_MessageHeader header;
1197
1198 /**
1199 * What type of performance preference does the client have?
1200 * A `enum GNUNET_MQ_PreferenceKind` in NBO.
1201 */
1202 uint32_t pk GNUNET_PACKED;
1203
1204 /**
1205 * Peer to get address suggestions for.
1206 */
1207 struct GNUNET_PeerIdentity peer;
1208
1209 /**
1210 * How much bandwidth in bytes/second does the application expect?
1211 */
1212 struct GNUNET_BANDWIDTH_Value32NBO bw;
1213};
1214
1215
1216/**
1217 * We got an address of another peer, TRANSPORT service
1218 * should validate it. There is no response.
1219 */
1220struct RequestHelloValidationMessage
1221{
1222 /**
1223 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION.
1224 */
1225 struct GNUNET_MessageHeader header;
1226
1227 /**
1228 * What type of network does the other peer claim this is?
1229 * A `enum GNUNET_NetworkType` in NBO.
1230 */
1231 uint32_t nt GNUNET_PACKED;
1232
1233 /**
1234 * Peer to the address is presumably for.
1235 */
1236 struct GNUNET_PeerIdentity peer;
1237
1238 /* followed by 0-terminated address to validate */
1239};
1240
1241#endif
1242
1243GNUNET_NETWORK_STRUCT_END
1244
1245/* end of transport.h */
1246#endif