GNUnet  0.11.x
transport.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009-2014 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
26 #ifndef TRANSPORT_H
27 #define TRANSPORT_H
28 
29 #include "gnunet_crypto_lib.h"
30 #include "gnunet_time_lib.h"
31 #include "gnunet_constants.h"
32 
33 #define DEBUG_TRANSPORT GNUNET_EXTRA_LOGGING
34 
35 
40 #define MAX_BANDWIDTH_CARRY_S GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S
41 
46 #define MIN_QUOTA_REFRESH_TIME 2000
47 
52 #define DEFAULT_MAX_FDS 256
53 
57 #define LATENCY_EVALUATION_MAX_DELAY \
58  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1)
59 
63 #define CONNECTED_LATENCY_EVALUATION_MAX_DELAY \
64  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
65 
76 typedef 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 
84 
85 
92 {
97 
103  uint32_t options;
104 
110 };
111 
112 
118 {
123 
124 #if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
125  defined(GNUNET_TRANSPORT_CORE_VERSION))
126 
130  uint32_t reserved GNUNET_PACKED;
131 #else
132 
135  struct GNUNET_BANDWIDTH_Value32NBO quota_out;
136 #endif
137 
142 };
143 
144 
150 {
155 
160 
164  struct GNUNET_PeerIdentity peer;
165 };
166 
167 
176 {
181 
186 
190  struct GNUNET_PeerIdentity peer;
191 };
192 
193 
199 {
204 
208  struct GNUNET_PeerIdentity peer;
209 };
210 
211 
217 {
222 
223 #if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
224  defined(GNUNET_TRANSPORT_CORE_VERSION))
225 
226  uint32_t reserved GNUNET_PACKED;
227 #else
228 
234  uint16_t success GNUNET_PACKED;
235 
239  uint16_t bytes_msg GNUNET_PACKED;
240 
245  uint32_t bytes_physical GNUNET_PACKED;
246 #endif
247 
251  struct GNUNET_PeerIdentity peer;
252 };
253 
254 
261 {
266 
271  uint32_t increase_window_delta GNUNET_PACKED;
272 
276  struct GNUNET_PeerIdentity peer;
277 };
278 
279 
285 {
290 
294  uint32_t priority GNUNET_PACKED;
295 
296 #if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
297  defined(GNUNET_TRANSPORT_CORE_VERSION))
298 
303 #endif
304 
308  struct GNUNET_PeerIdentity peer;
309 };
310 
311 
312 #if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
313  defined(GNUNET_TRANSPORT_CORE_VERSION))
314 
315 
324 {
329 
334  uint32_t res GNUNET_PACKED;
335 
339  uint32_t addr_len GNUNET_PACKED;
340 };
341 
342 
349 {
354 
359  int16_t numeric_only GNUNET_PACKED;
360 
364  uint16_t addrlen GNUNET_PACKED;
365 
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 
387 {
392 
396  uint32_t reserved;
397 
401  struct GNUNET_PeerIdentity peer;
402 
406  uint32_t local_address_info GNUNET_PACKED;
407 
411  uint32_t addrlen GNUNET_PACKED;
412 
416  uint32_t pluginlen GNUNET_PACKED;
417 
422 
427  struct GNUNET_TIME_AbsoluteNBO last_validation;
428 
433  struct GNUNET_TIME_AbsoluteNBO valid_until;
434 
439  struct GNUNET_TIME_AbsoluteNBO next_validation;
440 };
441 
442 
448 {
453 
457  uint32_t one_shot GNUNET_PACKED;
458 
462  struct GNUNET_PeerIdentity peer;
463 };
464 
465 
471 {
476 
480  uint32_t one_shot GNUNET_PACKED;
481 
485  struct GNUNET_PeerIdentity peer;
486 };
487 
488 
494 {
499 
504 
508  struct GNUNET_PeerIdentity peer;
509 
513  struct GNUNET_ATS_PropertiesNBO properties;
514 
519 
524 };
525 
526 
538 {
543 
547  uint32_t reserved;
548 
552  struct GNUNET_PeerIdentity peer;
553 
557  struct GNUNET_TIME_AbsoluteNBO state_timeout;
558 
562  uint32_t local_address_info GNUNET_PACKED;
563 
568 
572  uint32_t addrlen GNUNET_PACKED;
573 
577  uint32_t pluginlen GNUNET_PACKED;
578 };
579 
580 
586 {
592 
597  uint32_t is_allowed GNUNET_PACKED;
598 
602  struct GNUNET_PeerIdentity peer;
603 };
604 
605 
610 {
615 
619  uint16_t session_state GNUNET_PACKED;
620 
629  int16_t is_inbound GNUNET_PACKED;
630 
634  uint32_t msgs_pending GNUNET_PACKED;
635 
639  uint32_t bytes_pending GNUNET_PACKED;
640 
644  struct GNUNET_TIME_AbsoluteNBO timeout;
645 
650 
654  struct GNUNET_PeerIdentity peer;
655 
659  uint64_t session_id;
660 
664  uint16_t plugin_name_len GNUNET_PACKED;
665 
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 
683 struct GNUNET_TRANSPORT_CommunicatorAvailableMessage
684 {
688  struct GNUNET_MessageHeader header;
689 
693  uint32_t cc;
694 
695  /* Followed by the address prefix of the communicator */
696 };
697 
698 
702 struct GNUNET_TRANSPORT_AddAddressMessage
703 {
707  struct GNUNET_MessageHeader header;
708 
712  uint32_t aid GNUNET_PACKED;
713 
717  struct GNUNET_TIME_RelativeNBO expiration;
718 
722  uint32_t nt;
723 
724  /* followed by UTF-8 encoded, 0-terminated human-readable address */
725 };
726 
727 
731 struct GNUNET_TRANSPORT_DelAddressMessage
732 {
736  struct GNUNET_MessageHeader header;
737 
741  uint32_t aid GNUNET_PACKED;
742 };
743 
744 
748 struct GNUNET_TRANSPORT_IncomingMessage
749 {
753  struct GNUNET_MessageHeader header;
754 
758  uint32_t fc_on GNUNET_PACKED;
759 
763  uint64_t fc_id GNUNET_PACKED;
764 
769  struct GNUNET_TIME_RelativeNBO expected_address_validity;
770 
774  struct GNUNET_PeerIdentity sender;
775 
776  /* followed by the message */
777 };
778 
779 
784 struct GNUNET_TRANSPORT_IncomingMessageAck
785 {
789  struct GNUNET_MessageHeader header;
790 
794  uint32_t reserved GNUNET_PACKED;
795 
799  uint64_t fc_id GNUNET_PACKED;
800 
804  struct GNUNET_PeerIdentity sender;
805 };
806 
807 
811 struct GNUNET_TRANSPORT_AddQueueMessage
812 {
816  struct GNUNET_MessageHeader header;
817 
821  uint32_t qid GNUNET_PACKED;
822 
826  struct GNUNET_PeerIdentity receiver;
827 
831  uint32_t nt;
832 
836  uint32_t mtu;
837 
842  uint64_t q_len;
843 
847  uint32_t priority;
848 
852  uint32_t cs;
853 
854  /* followed by UTF-8 encoded, 0-terminated human-readable address */
855 };
856 
857 
861 struct GNUNET_TRANSPORT_UpdateQueueMessage
862 {
866  struct GNUNET_MessageHeader header;
867 
871  uint32_t qid GNUNET_PACKED;
872 
876  struct GNUNET_PeerIdentity receiver;
877 
881  uint32_t nt;
882 
886  uint32_t mtu;
887 
892  uint64_t q_len;
893 
897  uint32_t priority;
898 
902  uint32_t cs;
903 };
904 
905 
906 
910 struct GNUNET_TRANSPORT_DelQueueMessage
911 {
915  struct GNUNET_MessageHeader header;
916 
920  uint32_t qid GNUNET_PACKED;
921 
925  struct GNUNET_PeerIdentity receiver;
926 };
927 
928 
932 struct GNUNET_TRANSPORT_CreateQueue
933 {
937  struct GNUNET_MessageHeader header;
938 
942  uint32_t request_id GNUNET_PACKED;
943 
947  struct GNUNET_PeerIdentity receiver;
948 
949  /* followed by UTF-8 encoded, 0-terminated human-readable address */
950 };
951 
952 
956 struct GNUNET_TRANSPORT_CreateQueueResponse
957 {
962  struct GNUNET_MessageHeader header;
963 
967  uint32_t request_id GNUNET_PACKED;
968 };
969 
970 
974 struct GNUNET_TRANSPORT_SendMessageTo
975 {
979  struct GNUNET_MessageHeader header;
980 
984  uint32_t qid GNUNET_PACKED;
985 
989  uint64_t mid GNUNET_PACKED;
990 
994  struct GNUNET_PeerIdentity receiver;
995 
996  /* followed by the message */
997 };
998 
999 
1003 struct GNUNET_TRANSPORT_SendMessageToAck
1004 {
1008  struct GNUNET_MessageHeader header;
1009 
1013  uint32_t status GNUNET_PACKED;
1014 
1018  uint64_t mid GNUNET_PACKED;
1019 
1023  struct GNUNET_PeerIdentity receiver;
1024 };
1025 
1026 
1032 struct GNUNET_TRANSPORT_CommunicatorBackchannel
1033 {
1037  struct GNUNET_MessageHeader header;
1038 
1042  uint32_t reserved;
1043 
1047  struct GNUNET_PeerIdentity pid;
1048 
1049  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1050  message to the communicator */
1051 
1052  /* Followed by the 0-terminated string specifying the desired
1053  communicator at the target (@e pid) peer */
1054 };
1055 
1056 
1061 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming
1062 {
1067  struct GNUNET_MessageHeader header;
1068 
1072  uint32_t reserved;
1073 
1077  struct GNUNET_PeerIdentity pid;
1078 
1079  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1080  message to the communicator */
1081 };
1082 
1083 
1087 struct GNUNET_TRANSPORT_MonitorStart
1088 {
1092  struct GNUNET_MessageHeader header;
1093 
1097  uint32_t one_shot;
1098 
1102  struct GNUNET_PeerIdentity peer;
1103 };
1104 
1105 
1109 struct GNUNET_TRANSPORT_MonitorData
1110 {
1114  struct GNUNET_MessageHeader header;
1115 
1119  uint32_t nt GNUNET_PACKED;
1120 
1124  struct GNUNET_PeerIdentity peer;
1125 
1129  struct GNUNET_TIME_AbsoluteNBO last_validation;
1130  struct GNUNET_TIME_AbsoluteNBO valid_until;
1131  struct GNUNET_TIME_AbsoluteNBO next_validation;
1132 
1136  struct GNUNET_TIME_RelativeNBO rtt;
1137 
1141  uint32_t cs GNUNET_PACKED;
1142 
1146  uint32_t num_msg_pending GNUNET_PACKED;
1147 
1151  uint32_t num_bytes_pending GNUNET_PACKED;
1152 
1153  /* Followed by 0-terminated address of the peer */
1154 };
1155 
1156 
1160 struct GNUNET_TRANSPORT_AddressToVerify
1161 {
1165  struct GNUNET_MessageHeader header;
1166 
1170  uint32_t reserved;
1171 
1175  struct GNUNET_PeerIdentity peer;
1176 
1177  /* followed by variable-size raw address */
1178 };
1179 
1180 
1185 struct ExpressPreferenceMessage
1186 {
1192  struct GNUNET_MessageHeader header;
1193 
1198  uint32_t pk GNUNET_PACKED;
1199 
1203  struct GNUNET_PeerIdentity peer;
1204 
1208  struct GNUNET_BANDWIDTH_Value32NBO bw;
1209 };
1210 
1211 
1216 struct RequestHelloValidationMessage
1217 {
1221  struct GNUNET_MessageHeader header;
1222 
1227  uint32_t nt GNUNET_PACKED;
1228 
1232  struct GNUNET_PeerIdentity peer;
1233 
1234  /* followed by 0-terminated address to validate */
1235 };
1236 
1237 #endif
1238 
1240 
1241 /* end of transport.h */
1242 #endif
Message used to notify the transport API about an address to string conversion.
Definition: transport.h:323
static struct GNUNET_TIME_Relative delay_in
Inbound delay to apply to all peers.
Message used to notify the transport API that it can send another message to the transport service...
Definition: transport.h:260
struct GNUNET_CRYPTO_EcdsaPrivateKey pk
Private key from command line option, or NULL.
Message from the transport service to the library containing information about a peer.
Definition: transport.h:537
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
Message from the library to the transport service asking for binary addresses known for a peer...
Definition: transport.h:447
struct GNUNET_PeerIdentity self
Identity we think we have.
Definition: transport.h:109
Time for relative time used by GNUnet, in microseconds and in network byte order. ...
Time for absolute time used by GNUnet, in microseconds and in network byte order. ...
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32.
void(* NotifyConnect)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
Similiar to GNUNET_TRANSPORT_NotifyDisconnect but in and out quotas are included here.
Definition: transport.h:76
Message from the transport service to the library containing information about a peer.
Definition: transport.h:386
cryptographic primitives for GNUnet
Change in blacklisting (either request or notification, depending on which direction it is going)...
Definition: transport.h:585
enum State state
current state of profiling
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
Message from the library to the transport service asking for binary addresses known for a peer...
Definition: transport.h:470
uint32_t options
0: no options 1: The self field should be checked 2: this client is interested in payload traffic ...
Definition: transport.h:103
uint16_t status
See PRISM_STATUS_*-constants.
Message from the transport service to the library informing about neighbors.
Definition: transport.h:117
Message from the library to the transport service asking for binary addresses known for a peer...
Definition: transport.h:493
Message used to set a particular bandwidth quota.
Definition: transport.h:175
static int res
static struct GNUNET_NAT_AUTO_Test * nt
Handle to a NAT test operation.
Message used to notify the transport service about a message to be transmitted to another peer...
Definition: transport.h:284
Message from the transport service to the library asking to check if both processes agree about this ...
Definition: transport.h:91
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
Transport-level connection status update.
Definition: transport.h:609
Message from the transport service to the library informing about disconnects.
Definition: transport.h:149
uint32_t reserved
For alignment.
Definition: transport.h:396
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
Message from the library to the transport service asking for converting a transport address to a huma...
Definition: transport.h:348
static unsigned long long quota
How much space are we allowed to use?
static struct GNUNET_TIME_Relative delay_out
Outbound delay to apply to all peers.
uint32_t reserved
For alignment.
Definition: transport.h:547
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32;.
uint64_t session_id
Unique identifier for the session.
Definition: transport.h:659
The identity of the host (wraps the signing key of the peer).
Message used to notify the transport API that it can send another message to the transport service...
Definition: transport.h:216
#define GNUNET_PACKED
gcc-ism to get packed structs.
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START.
Definition: transport.h:96
Header for all communications.
static unsigned long long reserved
How much space have we currently reserved?
ATS performance characteristics for an address in network byte order (for IPC).
Message used to notify the transport API about a message received from the network.
Definition: transport.h:198