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.h1241
1 files changed, 0 insertions, 1241 deletions
diff --git a/src/transport/transport.h b/src/transport/transport.h
deleted file mode 100644
index 8ffc87070..000000000
--- a/src/transport/transport.h
+++ /dev/null
@@ -1,1241 +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_crypto_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 /* followed by the message */
777};
778
779
780/**
781 * Transport informs us about being done with an incoming message.
782 * (only sent if fc_on was set).
783 */
784struct GNUNET_TRANSPORT_IncomingMessageAck
785{
786 /**
787 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK.
788 */
789 struct GNUNET_MessageHeader header;
790
791 /**
792 * Reserved (0)
793 */
794 uint32_t reserved GNUNET_PACKED;
795
796 /**
797 * Which message is being ACKed?
798 */
799 uint64_t fc_id GNUNET_PACKED;
800
801 /**
802 * Sender identifier of the original message.
803 */
804 struct GNUNET_PeerIdentity sender;
805};
806
807
808/**
809 * Add queue to the transport
810 */
811struct GNUNET_TRANSPORT_AddQueueMessage
812{
813 /**
814 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
815 */
816 struct GNUNET_MessageHeader header;
817
818 /**
819 * Queue identifier (used to identify the queue).
820 */
821 uint32_t qid GNUNET_PACKED;
822
823 /**
824 * Receiver that can be addressed via the queue.
825 */
826 struct GNUNET_PeerIdentity receiver;
827
828 /**
829 * An `enum GNUNET_NetworkType` in NBO.
830 */
831 uint32_t nt;
832
833 /**
834 * Maximum transmission unit, in NBO. UINT32_MAX for unlimited.
835 */
836 uint32_t mtu;
837
838 /**
839 * Queue length, in NBO. Defines how many messages may be
840 * send through this queue. UINT64_MAX for unlimited.
841 */
842 uint64_t q_len;
843
844 /**
845 * Priority of the queue in relation to other queues.
846 */
847 uint32_t priority;
848
849 /**
850 * An `enum GNUNET_TRANSPORT_ConnectionStatus` in NBO.
851 */
852 uint32_t cs;
853
854 /* followed by UTF-8 encoded, 0-terminated human-readable address */
855};
856
857
858/**
859 * Update queue
860 */
861struct GNUNET_TRANSPORT_UpdateQueueMessage
862{
863 /**
864 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP.
865 */
866 struct GNUNET_MessageHeader header;
867
868 /**
869 * Queue identifier (used to identify the queue).
870 */
871 uint32_t qid GNUNET_PACKED;
872
873 /**
874 * Receiver that can be addressed via the queue.
875 */
876 struct GNUNET_PeerIdentity receiver;
877
878 /**
879 * An `enum GNUNET_NetworkType` in NBO.
880 */
881 uint32_t nt;
882
883 /**
884 * Maximum transmission unit, in NBO. UINT32_MAX for unlimited.
885 */
886 uint32_t mtu;
887
888 /**
889 * Queue length, in NBO. Defines how many messages may be
890 * send through this queue. UINT64_MAX for unlimited.
891 */
892 uint64_t q_len;
893
894 /**
895 * Priority of the queue in relation to other queues.
896 */
897 uint32_t priority;
898
899 /**
900 * An `enum GNUNET_TRANSPORT_ConnectionStatus` in NBO.
901 */
902 uint32_t cs;
903};
904
905
906/**
907 * Remove queue, it is no longer available.
908 */
909struct GNUNET_TRANSPORT_DelQueueMessage
910{
911 /**
912 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN.
913 */
914 struct GNUNET_MessageHeader header;
915
916 /**
917 * Address identifier.
918 */
919 uint32_t qid GNUNET_PACKED;
920
921 /**
922 * Receiver that can be addressed via the queue.
923 */
924 struct GNUNET_PeerIdentity receiver;
925};
926
927
928/**
929 * Transport tells communicator that it wants a new queue.
930 */
931struct GNUNET_TRANSPORT_CreateQueue
932{
933 /**
934 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE.
935 */
936 struct GNUNET_MessageHeader header;
937
938 /**
939 * Unique ID for the request.
940 */
941 uint32_t request_id GNUNET_PACKED;
942
943 /**
944 * Receiver that can be addressed via the queue.
945 */
946 struct GNUNET_PeerIdentity receiver;
947
948 /* followed by UTF-8 encoded, 0-terminated human-readable address */
949};
950
951
952/**
953 * Communicator tells transport how queue creation went down.
954 */
955struct GNUNET_TRANSPORT_CreateQueueResponse
956{
957 /**
958 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK or
959 * #GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_FAIL.
960 */
961 struct GNUNET_MessageHeader header;
962
963 /**
964 * Unique ID for the request.
965 */
966 uint32_t request_id GNUNET_PACKED;
967};
968
969
970/**
971 * Inform communicator about transport's desire to send a message.
972 */
973struct GNUNET_TRANSPORT_SendMessageTo
974{
975 /**
976 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG.
977 */
978 struct GNUNET_MessageHeader header;
979
980 /**
981 * Which queue should we use?
982 */
983 uint32_t qid GNUNET_PACKED;
984
985 /**
986 * Message ID, used for flow control.
987 */
988 uint64_t mid GNUNET_PACKED;
989
990 /**
991 * Receiver identifier.
992 */
993 struct GNUNET_PeerIdentity receiver;
994
995 /* followed by the message */
996};
997
998
999/**
1000 * Inform transport that message was sent.
1001 */
1002struct GNUNET_TRANSPORT_SendMessageToAck
1003{
1004 /**
1005 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK.
1006 */
1007 struct GNUNET_MessageHeader header;
1008
1009 /**
1010 * Success (#GNUNET_OK), failure (#GNUNET_SYSERR).
1011 */
1012 uint32_t status GNUNET_PACKED;
1013
1014 /**
1015 * Message ID of the original message.
1016 */
1017 uint64_t mid GNUNET_PACKED;
1018
1019 /**
1020 * Receiver identifier.
1021 */
1022 struct GNUNET_PeerIdentity receiver;
1023};
1024
1025
1026/**
1027 * Message from communicator to transport service asking for
1028 * transmission of a backchannel message with the given peer @e pid
1029 * and communicator.
1030 */
1031struct GNUNET_TRANSPORT_CommunicatorBackchannel
1032{
1033 /**
1034 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL
1035 */
1036 struct GNUNET_MessageHeader header;
1037
1038 /**
1039 * Always zero, for alignment.
1040 */
1041 uint32_t reserved;
1042
1043 /**
1044 * Target peer.
1045 */
1046 struct GNUNET_PeerIdentity pid;
1047
1048 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1049 message to the communicator */
1050
1051 /* Followed by the 0-terminated string specifying the desired
1052 communicator at the target (@e pid) peer */
1053};
1054
1055
1056/**
1057 * Message from transport to communicator passing along a backchannel
1058 * message from the given peer @e pid.
1059 */
1060struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming
1061{
1062 /**
1063 * Type will be
1064 * #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING
1065 */
1066 struct GNUNET_MessageHeader header;
1067
1068 /**
1069 * Always zero, for alignment.
1070 */
1071 uint32_t reserved;
1072
1073 /**
1074 * Origin peer.
1075 */
1076 struct GNUNET_PeerIdentity pid;
1077
1078 /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1079 message to the communicator */
1080};
1081
1082
1083/**
1084 * Request to start monitoring.
1085 */
1086struct GNUNET_TRANSPORT_MonitorStart
1087{
1088 /**
1089 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START.
1090 */
1091 struct GNUNET_MessageHeader header;
1092
1093 /**
1094 * #GNUNET_YES for one-shot montoring, #GNUNET_NO for continuous monitoring.
1095 */
1096 uint32_t one_shot;
1097
1098 /**
1099 * Target identifier to monitor, all zeros for "all peers".
1100 */
1101 struct GNUNET_PeerIdentity peer;
1102};
1103
1104
1105/**
1106 * Monitoring data.
1107 */
1108struct GNUNET_TRANSPORT_MonitorData
1109{
1110 /**
1111 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_DATA.
1112 */
1113 struct GNUNET_MessageHeader header;
1114
1115 /**
1116 * Network type (an `enum GNUNET_NetworkType` in NBO).
1117 */
1118 uint32_t nt GNUNET_PACKED;
1119
1120 /**
1121 * Target identifier.
1122 */
1123 struct GNUNET_PeerIdentity peer;
1124
1125 /**
1126 * @deprecated To be discussed if we keep these...
1127 */
1128 struct GNUNET_TIME_AbsoluteNBO last_validation;
1129 struct GNUNET_TIME_AbsoluteNBO valid_until;
1130 struct GNUNET_TIME_AbsoluteNBO next_validation;
1131
1132 /**
1133 * Current round-trip time estimate.
1134 */
1135 struct GNUNET_TIME_RelativeNBO rtt;
1136
1137 /**
1138 * Connection status (in NBO).
1139 */
1140 uint32_t cs GNUNET_PACKED;
1141
1142 /**
1143 * Messages pending (in NBO).
1144 */
1145 uint32_t num_msg_pending GNUNET_PACKED;
1146
1147 /**
1148 * Bytes pending (in NBO).
1149 */
1150 uint32_t num_bytes_pending GNUNET_PACKED;
1151
1152 /* Followed by 0-terminated address of the peer */
1153};
1154
1155
1156/**
1157 * Request to verify address.
1158 */
1159struct GNUNET_TRANSPORT_AddressToVerify
1160{
1161 /**
1162 * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY.
1163 */
1164 struct GNUNET_MessageHeader header;
1165
1166 /**
1167 * Reserved. 0.
1168 */
1169 uint32_t reserved;
1170
1171 /**
1172 * Peer the address is from.
1173 */
1174 struct GNUNET_PeerIdentity peer;
1175
1176 /* followed by variable-size raw address */
1177};
1178
1179
1180/**
1181 * Application client to TRANSPORT service: we would like to have
1182 * address suggestions for this peer.
1183 */
1184struct ExpressPreferenceMessage
1185{
1186 /**
1187 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or
1188 * #GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop
1189 * suggestions.
1190 */
1191 struct GNUNET_MessageHeader header;
1192
1193 /**
1194 * What type of performance preference does the client have?
1195 * A `enum GNUNET_MQ_PreferenceKind` in NBO.
1196 */
1197 uint32_t pk GNUNET_PACKED;
1198
1199 /**
1200 * Peer to get address suggestions for.
1201 */
1202 struct GNUNET_PeerIdentity peer;
1203
1204 /**
1205 * How much bandwidth in bytes/second does the application expect?
1206 */
1207 struct GNUNET_BANDWIDTH_Value32NBO bw;
1208};
1209
1210
1211/**
1212 * We got an address of another peer, TRANSPORT service
1213 * should validate it. There is no response.
1214 */
1215struct RequestHelloValidationMessage
1216{
1217 /**
1218 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION.
1219 */
1220 struct GNUNET_MessageHeader header;
1221
1222 /**
1223 * What type of network does the other peer claim this is?
1224 * A `enum GNUNET_NetworkType` in NBO.
1225 */
1226 uint32_t nt GNUNET_PACKED;
1227
1228 /**
1229 * Peer to the address is presumably for.
1230 */
1231 struct GNUNET_PeerIdentity peer;
1232
1233 /* followed by 0-terminated address to validate */
1234};
1235
1236#endif
1237
1238GNUNET_NETWORK_STRUCT_END
1239
1240/* end of transport.h */
1241#endif