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