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