GNUnet  0.10.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 {
93 
98 
104  uint32_t options;
105 
111 };
112 
113 
119 {
120 
125 
126 #if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
127  defined(GNUNET_TRANSPORT_CORE_VERSION))
128 
132  uint32_t reserved GNUNET_PACKED;
133 
134 #else
135 
139  struct GNUNET_BANDWIDTH_Value32NBO quota_out;
140 #endif
141 
146 };
147 
148 
154 {
155 
160 
165 
169  struct GNUNET_PeerIdentity peer;
170 };
171 
172 
181 {
182 
187 
192 
196  struct GNUNET_PeerIdentity peer;
197 };
198 
199 
205 {
206 
211 
215  struct GNUNET_PeerIdentity peer;
216 };
217 
218 
224 {
225 
230 
231 #if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
232  defined(GNUNET_TRANSPORT_CORE_VERSION))
233 
234  uint32_t reserved GNUNET_PACKED;
235 
236 #else
237 
244  uint16_t success GNUNET_PACKED;
245 
249  uint16_t bytes_msg GNUNET_PACKED;
250 
255  uint32_t bytes_physical GNUNET_PACKED;
256 
257 #endif
258 
262  struct GNUNET_PeerIdentity peer;
263 };
264 
265 
272 {
273 
278 
283  uint32_t increase_window_delta GNUNET_PACKED;
284 
288  struct GNUNET_PeerIdentity peer;
289 };
290 
291 
297 {
298 
303 
307  uint32_t priority GNUNET_PACKED;
308 
309 #if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
310  defined(GNUNET_TRANSPORT_CORE_VERSION))
311 
316 #endif
317 
321  struct GNUNET_PeerIdentity peer;
322 };
323 
324 
325 #if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
326  defined(GNUNET_TRANSPORT_CORE_VERSION))
327 
328 
337 {
338 
343 
348  uint32_t res GNUNET_PACKED;
349 
353  uint32_t addr_len GNUNET_PACKED;
354 };
355 
356 
363 {
364 
369 
374  int16_t numeric_only GNUNET_PACKED;
375 
379  uint16_t addrlen GNUNET_PACKED;
380 
385 
386  /* followed by @e addrlen bytes of the actual address, then
387  * followed by the 0-terminated name of the transport */
388 };
389 
390 
402 {
407 
411  uint32_t reserved;
412 
416  struct GNUNET_PeerIdentity peer;
417 
421  uint32_t local_address_info GNUNET_PACKED;
422 
426  uint32_t addrlen GNUNET_PACKED;
427 
431  uint32_t pluginlen GNUNET_PACKED;
432 
437 
442  struct GNUNET_TIME_AbsoluteNBO last_validation;
443 
448  struct GNUNET_TIME_AbsoluteNBO valid_until;
449 
454  struct GNUNET_TIME_AbsoluteNBO next_validation;
455 };
456 
457 
463 {
468 
472  uint32_t one_shot GNUNET_PACKED;
473 
477  struct GNUNET_PeerIdentity peer;
478 };
479 
480 
486 {
491 
495  uint32_t one_shot GNUNET_PACKED;
496 
500  struct GNUNET_PeerIdentity peer;
501 };
502 
503 
509 {
514 
519 
523  struct GNUNET_PeerIdentity peer;
524 
528  struct GNUNET_ATS_PropertiesNBO properties;
529 
534 
539 };
540 
541 
553 {
558 
562  uint32_t reserved;
563 
567  struct GNUNET_PeerIdentity peer;
568 
572  struct GNUNET_TIME_AbsoluteNBO state_timeout;
573 
577  uint32_t local_address_info GNUNET_PACKED;
578 
583 
587  uint32_t addrlen GNUNET_PACKED;
588 
592  uint32_t pluginlen GNUNET_PACKED;
593 };
594 
595 
601 {
602 
608 
613  uint32_t is_allowed GNUNET_PACKED;
614 
618  struct GNUNET_PeerIdentity peer;
619 };
620 
621 
626 {
627 
632 
636  uint16_t session_state GNUNET_PACKED;
637 
646  int16_t is_inbound GNUNET_PACKED;
647 
651  uint32_t msgs_pending GNUNET_PACKED;
652 
656  uint32_t bytes_pending GNUNET_PACKED;
657 
661  struct GNUNET_TIME_AbsoluteNBO timeout;
662 
667 
671  struct GNUNET_PeerIdentity peer;
672 
676  uint64_t session_id;
677 
681  uint16_t plugin_name_len GNUNET_PACKED;
682 
686  uint16_t plugin_address_len GNUNET_PACKED;
687 
688  /* followed by 0-terminated plugin name and
689  @e plugin_address_len bytes of plugin address */
690 };
691 
692 #else
693 
694 /* *********************** TNG messages ***************** */
695 
700 struct GNUNET_TRANSPORT_CommunicatorAvailableMessage
701 {
702 
706  struct GNUNET_MessageHeader header;
707 
711  uint32_t cc;
712 
713  /* Followed by the address prefix of the communicator */
714 };
715 
716 
720 struct GNUNET_TRANSPORT_AddAddressMessage
721 {
722 
726  struct GNUNET_MessageHeader header;
727 
731  uint32_t aid GNUNET_PACKED;
732 
736  struct GNUNET_TIME_RelativeNBO expiration;
737 
741  uint32_t nt;
742 
743  /* followed by UTF-8 encoded, 0-terminated human-readable address */
744 };
745 
746 
750 struct GNUNET_TRANSPORT_DelAddressMessage
751 {
752 
756  struct GNUNET_MessageHeader header;
757 
761  uint32_t aid GNUNET_PACKED;
762 };
763 
764 
768 struct GNUNET_TRANSPORT_IncomingMessage
769 {
770 
774  struct GNUNET_MessageHeader header;
775 
779  uint32_t fc_on GNUNET_PACKED;
780 
784  uint64_t fc_id GNUNET_PACKED;
785 
790  struct GNUNET_TIME_RelativeNBO expected_address_validity;
791 
795  struct GNUNET_PeerIdentity sender;
796 
797  /* followed by the message */
798 };
799 
800 
805 struct GNUNET_TRANSPORT_IncomingMessageAck
806 {
807 
811  struct GNUNET_MessageHeader header;
812 
816  uint32_t reserved GNUNET_PACKED;
817 
821  uint64_t fc_id GNUNET_PACKED;
822 
826  struct GNUNET_PeerIdentity sender;
827 };
828 
829 
833 struct GNUNET_TRANSPORT_AddQueueMessage
834 {
835 
839  struct GNUNET_MessageHeader header;
840 
844  uint32_t qid GNUNET_PACKED;
845 
849  struct GNUNET_PeerIdentity receiver;
850 
854  uint32_t nt;
855 
859  uint32_t mtu;
860 
864  uint32_t cs;
865 
866  /* followed by UTF-8 encoded, 0-terminated human-readable address */
867 };
868 
869 
873 struct GNUNET_TRANSPORT_DelQueueMessage
874 {
875 
879  struct GNUNET_MessageHeader header;
880 
884  uint32_t qid GNUNET_PACKED;
885 
889  struct GNUNET_PeerIdentity receiver;
890 };
891 
892 
896 struct GNUNET_TRANSPORT_CreateQueue
897 {
898 
902  struct GNUNET_MessageHeader header;
903 
907  uint32_t request_id GNUNET_PACKED;
908 
912  struct GNUNET_PeerIdentity receiver;
913 
914  /* followed by UTF-8 encoded, 0-terminated human-readable address */
915 };
916 
917 
921 struct GNUNET_TRANSPORT_CreateQueueResponse
922 {
923 
928  struct GNUNET_MessageHeader header;
929 
933  uint32_t request_id GNUNET_PACKED;
934 };
935 
936 
940 struct GNUNET_TRANSPORT_SendMessageTo
941 {
942 
946  struct GNUNET_MessageHeader header;
947 
951  uint32_t qid GNUNET_PACKED;
952 
956  uint64_t mid GNUNET_PACKED;
957 
961  struct GNUNET_PeerIdentity receiver;
962 
963  /* followed by the message */
964 };
965 
966 
970 struct GNUNET_TRANSPORT_SendMessageToAck
971 {
972 
976  struct GNUNET_MessageHeader header;
977 
981  uint32_t status GNUNET_PACKED;
982 
986  uint64_t mid GNUNET_PACKED;
987 
991  struct GNUNET_PeerIdentity receiver;
992 };
993 
994 
1000 struct GNUNET_TRANSPORT_CommunicatorBackchannel
1001 {
1005  struct GNUNET_MessageHeader header;
1006 
1010  uint32_t reserved;
1011 
1015  struct GNUNET_PeerIdentity pid;
1016 
1017  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1018  message to the communicator */
1019 
1020  /* Followed by the 0-terminated string specifying the desired
1021  communicator at the target (@e pid) peer */
1022 };
1023 
1024 
1029 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming
1030 {
1035  struct GNUNET_MessageHeader header;
1036 
1040  uint32_t reserved;
1041 
1045  struct GNUNET_PeerIdentity pid;
1046 
1047  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
1048  message to the communicator */
1049 };
1050 
1051 
1055 struct GNUNET_TRANSPORT_MonitorStart
1056 {
1057 
1061  struct GNUNET_MessageHeader header;
1062 
1066  uint32_t one_shot;
1067 
1071  struct GNUNET_PeerIdentity peer;
1072 };
1073 
1074 
1078 struct GNUNET_TRANSPORT_MonitorData
1079 {
1080 
1084  struct GNUNET_MessageHeader header;
1085 
1089  uint32_t nt GNUNET_PACKED;
1090 
1094  struct GNUNET_PeerIdentity peer;
1095 
1099  struct GNUNET_TIME_AbsoluteNBO last_validation;
1100  struct GNUNET_TIME_AbsoluteNBO valid_until;
1101  struct GNUNET_TIME_AbsoluteNBO next_validation;
1102 
1106  struct GNUNET_TIME_RelativeNBO rtt;
1107 
1111  uint32_t cs GNUNET_PACKED;
1112 
1116  uint32_t num_msg_pending GNUNET_PACKED;
1117 
1121  uint32_t num_bytes_pending GNUNET_PACKED;
1122 
1123  /* Followed by 0-terminated address of the peer */
1124 };
1125 
1126 
1130 struct GNUNET_TRANSPORT_AddressToVerify
1131 {
1132 
1136  struct GNUNET_MessageHeader header;
1137 
1141  uint32_t reserved;
1142 
1146  struct GNUNET_PeerIdentity peer;
1147 
1148  /* followed by variable-size raw address */
1149 };
1150 
1151 
1157 {
1163  struct GNUNET_MessageHeader header;
1164 
1169  uint32_t pk GNUNET_PACKED;
1170 
1174  struct GNUNET_PeerIdentity peer;
1175 
1179  struct GNUNET_BANDWIDTH_Value32NBO bw;
1180 };
1181 
1182 
1187 struct RequestHelloValidationMessage
1188 {
1189 
1193  struct GNUNET_MessageHeader header;
1194 
1199  uint32_t nt GNUNET_PACKED;
1200 
1204  struct GNUNET_PeerIdentity peer;
1205 
1206  /* followed by 0-terminated address to validate */
1207 };
1208 
1209 #endif
1210 
1212 
1213 /* end of transport.h */
1214 #endif
Message used to notify the transport API about an address to string conversion.
Definition: transport.h:336
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:271
Message from the transport service to the library containing information about a peer.
Definition: transport.h:552
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:462
struct GNUNET_PeerIdentity self
Identity we think we have.
Definition: transport.h:110
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:401
cryptographic primitives for GNUnet
Change in blacklisting (either request or notification, depending on which direction it is going)...
Definition: transport.h:600
enum State state
current state of profiling
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:114
Message from the library to the transport service asking for binary addresses known for a peer...
Definition: transport.h:485
uint32_t options
0: no options 1: The self field should be checked 2: this client is interested in payload traffic ...
Definition: transport.h:104
uint16_t status
See PRISM_STATUS_*-constants.
Message from the transport service to the library informing about neighbors.
Definition: transport.h:118
Message from the library to the transport service asking for binary addresses known for a peer...
Definition: transport.h:508
Message used to set a particular bandwidth quota.
Definition: transport.h:180
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:296
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:625
Message from the transport service to the library informing about disconnects.
Definition: transport.h:153
uint32_t reserved
For alignment.
Definition: transport.h:411
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:362
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:562
#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:676
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:223
#define GNUNET_PACKED
gcc-ism to get packed structs.
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START.
Definition: transport.h:97
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).
Application client to ATS service: we would like to have address suggestions for this peer...
Definition: ats2.h:112
Message used to notify the transport API about a message received from the network.
Definition: transport.h:204