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 
841  uint32_t cs;
842 
843  /* followed by UTF-8 encoded, 0-terminated human-readable address */
844 };
845 
846 
850 struct GNUNET_TRANSPORT_DelQueueMessage
851 {
855  struct GNUNET_MessageHeader header;
856 
860  uint32_t qid GNUNET_PACKED;
861 
865  struct GNUNET_PeerIdentity receiver;
866 };
867 
868 
872 struct GNUNET_TRANSPORT_CreateQueue
873 {
877  struct GNUNET_MessageHeader header;
878 
882  uint32_t request_id GNUNET_PACKED;
883 
887  struct GNUNET_PeerIdentity receiver;
888 
889  /* followed by UTF-8 encoded, 0-terminated human-readable address */
890 };
891 
892 
896 struct GNUNET_TRANSPORT_CreateQueueResponse
897 {
902  struct GNUNET_MessageHeader header;
903 
907  uint32_t request_id GNUNET_PACKED;
908 };
909 
910 
914 struct GNUNET_TRANSPORT_SendMessageTo
915 {
919  struct GNUNET_MessageHeader header;
920 
924  uint32_t qid GNUNET_PACKED;
925 
929  uint64_t mid GNUNET_PACKED;
930 
934  struct GNUNET_PeerIdentity receiver;
935 
936  /* followed by the message */
937 };
938 
939 
943 struct GNUNET_TRANSPORT_SendMessageToAck
944 {
948  struct GNUNET_MessageHeader header;
949 
953  uint32_t status GNUNET_PACKED;
954 
958  uint64_t mid GNUNET_PACKED;
959 
963  struct GNUNET_PeerIdentity receiver;
964 };
965 
966 
972 struct GNUNET_TRANSPORT_CommunicatorBackchannel
973 {
977  struct GNUNET_MessageHeader header;
978 
982  uint32_t reserved;
983 
987  struct GNUNET_PeerIdentity pid;
988 
989  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
990  message to the communicator */
991 
992  /* Followed by the 0-terminated string specifying the desired
993  communicator at the target (@e pid) peer */
994 };
995 
996 
1001 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming
1002 {
1007  struct GNUNET_MessageHeader header;
1008 
1012  uint32_t reserved;
1013 
1017  struct GNUNET_PeerIdentity pid;
1018 
1019  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1020  message to the communicator */
1021 };
1022 
1023 
1027 struct GNUNET_TRANSPORT_MonitorStart
1028 {
1032  struct GNUNET_MessageHeader header;
1033 
1037  uint32_t one_shot;
1038 
1042  struct GNUNET_PeerIdentity peer;
1043 };
1044 
1045 
1049 struct GNUNET_TRANSPORT_MonitorData
1050 {
1054  struct GNUNET_MessageHeader header;
1055 
1059  uint32_t nt GNUNET_PACKED;
1060 
1064  struct GNUNET_PeerIdentity peer;
1065 
1069  struct GNUNET_TIME_AbsoluteNBO last_validation;
1070  struct GNUNET_TIME_AbsoluteNBO valid_until;
1071  struct GNUNET_TIME_AbsoluteNBO next_validation;
1072 
1076  struct GNUNET_TIME_RelativeNBO rtt;
1077 
1081  uint32_t cs GNUNET_PACKED;
1082 
1086  uint32_t num_msg_pending GNUNET_PACKED;
1087 
1091  uint32_t num_bytes_pending GNUNET_PACKED;
1092 
1093  /* Followed by 0-terminated address of the peer */
1094 };
1095 
1096 
1100 struct GNUNET_TRANSPORT_AddressToVerify
1101 {
1105  struct GNUNET_MessageHeader header;
1106 
1110  uint32_t reserved;
1111 
1115  struct GNUNET_PeerIdentity peer;
1116 
1117  /* followed by variable-size raw address */
1118 };
1119 
1120 
1125 struct ExpressPreferenceMessage
1126 {
1132  struct GNUNET_MessageHeader header;
1133 
1138  uint32_t pk GNUNET_PACKED;
1139 
1143  struct GNUNET_PeerIdentity peer;
1144 
1148  struct GNUNET_BANDWIDTH_Value32NBO bw;
1149 };
1150 
1151 
1156 struct RequestHelloValidationMessage
1157 {
1161  struct GNUNET_MessageHeader header;
1162 
1167  uint32_t nt GNUNET_PACKED;
1168 
1172  struct GNUNET_PeerIdentity peer;
1173 
1174  /* followed by 0-terminated address to validate */
1175 };
1176 
1177 #endif
1178 
1180 
1181 /* end of transport.h */
1182 #endif
Message used to notify the transport API about an address to string conversion.
Definition: transport.h:323
static struct GNUNET_CRYPTO_EddsaPrivateKey * pk
Private key of this peer.
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
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