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 
91 struct StartMessage {
96 
102  uint32_t options;
103 
109 };
110 
111 
121 
122 #if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
123  defined(GNUNET_TRANSPORT_CORE_VERSION))
124 
128  uint32_t reserved GNUNET_PACKED;
129 #else
130 
133  struct GNUNET_BANDWIDTH_Value32NBO quota_out;
134 #endif
135 
140 };
141 
142 
152 
157 
161  struct GNUNET_PeerIdentity peer;
162 };
163 
164 
177 
182 
186  struct GNUNET_PeerIdentity peer;
187 };
188 
189 
199 
203  struct GNUNET_PeerIdentity peer;
204 };
205 
206 
216 
217 #if (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
218  defined(GNUNET_TRANSPORT_CORE_VERSION))
219 
220  uint32_t reserved GNUNET_PACKED;
221 #else
222 
228  uint16_t success GNUNET_PACKED;
229 
233  uint16_t bytes_msg GNUNET_PACKED;
234 
239  uint32_t bytes_physical GNUNET_PACKED;
240 #endif
241 
245  struct GNUNET_PeerIdentity peer;
246 };
247 
248 
259 
264  uint32_t increase_window_delta GNUNET_PACKED;
265 
269  struct GNUNET_PeerIdentity peer;
270 };
271 
272 
282 
286  uint32_t priority GNUNET_PACKED;
287 
288 #if !(defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
289  defined(GNUNET_TRANSPORT_CORE_VERSION))
290 
295 #endif
296 
300  struct GNUNET_PeerIdentity peer;
301 };
302 
303 
304 #if !(defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
305  defined(GNUNET_TRANSPORT_CORE_VERSION))
306 
307 
320 
325  uint32_t res GNUNET_PACKED;
326 
330  uint32_t addr_len GNUNET_PACKED;
331 };
332 
333 
344 
349  int16_t numeric_only GNUNET_PACKED;
350 
354  uint16_t addrlen GNUNET_PACKED;
355 
360 
361  /* followed by @e addrlen bytes of the actual address, then
362  * followed by the 0-terminated name of the transport */
363 };
364 
365 
381 
385  uint32_t reserved;
386 
390  struct GNUNET_PeerIdentity peer;
391 
395  uint32_t local_address_info GNUNET_PACKED;
396 
400  uint32_t addrlen GNUNET_PACKED;
401 
405  uint32_t pluginlen GNUNET_PACKED;
406 
411 
416  struct GNUNET_TIME_AbsoluteNBO last_validation;
417 
422  struct GNUNET_TIME_AbsoluteNBO valid_until;
423 
428  struct GNUNET_TIME_AbsoluteNBO next_validation;
429 };
430 
431 
441 
445  uint32_t one_shot GNUNET_PACKED;
446 
450  struct GNUNET_PeerIdentity peer;
451 };
452 
453 
463 
467  uint32_t one_shot GNUNET_PACKED;
468 
472  struct GNUNET_PeerIdentity peer;
473 };
474 
475 
485 
490 
494  struct GNUNET_PeerIdentity peer;
495 
499  struct GNUNET_ATS_PropertiesNBO properties;
500 
505 
510 };
511 
512 
528 
532  uint32_t reserved;
533 
537  struct GNUNET_PeerIdentity peer;
538 
542  struct GNUNET_TIME_AbsoluteNBO state_timeout;
543 
547  uint32_t local_address_info GNUNET_PACKED;
548 
553 
557  uint32_t addrlen GNUNET_PACKED;
558 
562  uint32_t pluginlen GNUNET_PACKED;
563 };
564 
565 
576 
581  uint32_t is_allowed GNUNET_PACKED;
582 
586  struct GNUNET_PeerIdentity peer;
587 };
588 
589 
598 
602  uint16_t session_state GNUNET_PACKED;
603 
612  int16_t is_inbound GNUNET_PACKED;
613 
617  uint32_t msgs_pending GNUNET_PACKED;
618 
622  uint32_t bytes_pending GNUNET_PACKED;
623 
627  struct GNUNET_TIME_AbsoluteNBO timeout;
628 
633 
637  struct GNUNET_PeerIdentity peer;
638 
642  uint64_t session_id;
643 
647  uint16_t plugin_name_len GNUNET_PACKED;
648 
652  uint16_t plugin_address_len GNUNET_PACKED;
653 
654  /* followed by 0-terminated plugin name and
655  @e plugin_address_len bytes of plugin address */
656 };
657 
658 #else
659 
660 /* *********************** TNG messages ***************** */
661 
666 struct GNUNET_TRANSPORT_CommunicatorAvailableMessage {
670  struct GNUNET_MessageHeader header;
671 
675  uint32_t cc;
676 
677  /* Followed by the address prefix of the communicator */
678 };
679 
680 
684 struct GNUNET_TRANSPORT_AddAddressMessage {
688  struct GNUNET_MessageHeader header;
689 
693  uint32_t aid GNUNET_PACKED;
694 
698  struct GNUNET_TIME_RelativeNBO expiration;
699 
703  uint32_t nt;
704 
705  /* followed by UTF-8 encoded, 0-terminated human-readable address */
706 };
707 
708 
712 struct GNUNET_TRANSPORT_DelAddressMessage {
716  struct GNUNET_MessageHeader header;
717 
721  uint32_t aid GNUNET_PACKED;
722 };
723 
724 
728 struct GNUNET_TRANSPORT_IncomingMessage {
732  struct GNUNET_MessageHeader header;
733 
737  uint32_t fc_on GNUNET_PACKED;
738 
742  uint64_t fc_id GNUNET_PACKED;
743 
748  struct GNUNET_TIME_RelativeNBO expected_address_validity;
749 
753  struct GNUNET_PeerIdentity sender;
754 
755  /* followed by the message */
756 };
757 
758 
763 struct GNUNET_TRANSPORT_IncomingMessageAck {
767  struct GNUNET_MessageHeader header;
768 
772  uint32_t reserved GNUNET_PACKED;
773 
777  uint64_t fc_id GNUNET_PACKED;
778 
782  struct GNUNET_PeerIdentity sender;
783 };
784 
785 
789 struct GNUNET_TRANSPORT_AddQueueMessage {
793  struct GNUNET_MessageHeader header;
794 
798  uint32_t qid GNUNET_PACKED;
799 
803  struct GNUNET_PeerIdentity receiver;
804 
808  uint32_t nt;
809 
813  uint32_t mtu;
814 
818  uint32_t cs;
819 
820  /* followed by UTF-8 encoded, 0-terminated human-readable address */
821 };
822 
823 
827 struct GNUNET_TRANSPORT_DelQueueMessage {
831  struct GNUNET_MessageHeader header;
832 
836  uint32_t qid GNUNET_PACKED;
837 
841  struct GNUNET_PeerIdentity receiver;
842 };
843 
844 
848 struct GNUNET_TRANSPORT_CreateQueue {
852  struct GNUNET_MessageHeader header;
853 
857  uint32_t request_id GNUNET_PACKED;
858 
862  struct GNUNET_PeerIdentity receiver;
863 
864  /* followed by UTF-8 encoded, 0-terminated human-readable address */
865 };
866 
867 
871 struct GNUNET_TRANSPORT_CreateQueueResponse {
876  struct GNUNET_MessageHeader header;
877 
881  uint32_t request_id GNUNET_PACKED;
882 };
883 
884 
888 struct GNUNET_TRANSPORT_SendMessageTo {
892  struct GNUNET_MessageHeader header;
893 
897  uint32_t qid GNUNET_PACKED;
898 
902  uint64_t mid GNUNET_PACKED;
903 
907  struct GNUNET_PeerIdentity receiver;
908 
909  /* followed by the message */
910 };
911 
912 
916 struct GNUNET_TRANSPORT_SendMessageToAck {
920  struct GNUNET_MessageHeader header;
921 
925  uint32_t status GNUNET_PACKED;
926 
930  uint64_t mid GNUNET_PACKED;
931 
935  struct GNUNET_PeerIdentity receiver;
936 };
937 
938 
944 struct GNUNET_TRANSPORT_CommunicatorBackchannel {
948  struct GNUNET_MessageHeader header;
949 
953  uint32_t reserved;
954 
958  struct GNUNET_PeerIdentity pid;
959 
960  /* Followed by a `struct GNUNET_MessageHeader` with the encapsulated
961  message to the communicator */
962 
963  /* Followed by the 0-terminated string specifying the desired
964  communicator at the target (@e pid) peer */
965 };
966 
967 
972 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming {
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 
993 
997 struct GNUNET_TRANSPORT_MonitorStart {
1001  struct GNUNET_MessageHeader header;
1002 
1006  uint32_t one_shot;
1007 
1011  struct GNUNET_PeerIdentity peer;
1012 };
1013 
1014 
1018 struct GNUNET_TRANSPORT_MonitorData {
1022  struct GNUNET_MessageHeader header;
1023 
1027  uint32_t nt GNUNET_PACKED;
1028 
1032  struct GNUNET_PeerIdentity peer;
1033 
1037  struct GNUNET_TIME_AbsoluteNBO last_validation;
1038  struct GNUNET_TIME_AbsoluteNBO valid_until;
1039  struct GNUNET_TIME_AbsoluteNBO next_validation;
1040 
1044  struct GNUNET_TIME_RelativeNBO rtt;
1045 
1049  uint32_t cs GNUNET_PACKED;
1050 
1054  uint32_t num_msg_pending GNUNET_PACKED;
1055 
1059  uint32_t num_bytes_pending GNUNET_PACKED;
1060 
1061  /* Followed by 0-terminated address of the peer */
1062 };
1063 
1064 
1068 struct GNUNET_TRANSPORT_AddressToVerify {
1072  struct GNUNET_MessageHeader header;
1073 
1077  uint32_t reserved;
1078 
1082  struct GNUNET_PeerIdentity peer;
1083 
1084  /* followed by variable-size raw address */
1085 };
1086 
1087 
1092 struct ExpressPreferenceMessage {
1098  struct GNUNET_MessageHeader header;
1099 
1104  uint32_t pk GNUNET_PACKED;
1105 
1109  struct GNUNET_PeerIdentity peer;
1110 
1114  struct GNUNET_BANDWIDTH_Value32NBO bw;
1115 };
1116 
1117 
1122 struct RequestHelloValidationMessage {
1126  struct GNUNET_MessageHeader header;
1127 
1132  uint32_t nt GNUNET_PACKED;
1133 
1137  struct GNUNET_PeerIdentity peer;
1138 
1139  /* followed by 0-terminated address to validate */
1140 };
1141 
1142 #endif
1143 
1145 
1146 /* end of transport.h */
1147 #endif
Message used to notify the transport API about an address to string conversion.
Definition: transport.h:315
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:254
Message from the transport service to the library containing information about a peer.
Definition: transport.h:523
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:436
struct GNUNET_PeerIdentity self
Identity we think we have.
Definition: transport.h:108
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:376
cryptographic primitives for GNUnet
Change in blacklisting (either request or notification, depending on which direction it is going)...
Definition: transport.h:570
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:458
uint32_t options
0: no options 1: The self field should be checked 2: this client is interested in payload traffic ...
Definition: transport.h:102
uint16_t status
See PRISM_STATUS_*-constants.
Message from the transport service to the library informing about neighbors.
Definition: transport.h:116
Message from the library to the transport service asking for binary addresses known for a peer...
Definition: transport.h:480
Message used to set a particular bandwidth quota.
Definition: transport.h:172
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:277
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:593
Message from the transport service to the library informing about disconnects.
Definition: transport.h:147
uint32_t reserved
For alignment.
Definition: transport.h:385
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:339
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:532
#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:642
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:211
#define GNUNET_PACKED
gcc-ism to get packed structs.
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START.
Definition: transport.h:95
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:109
Message used to notify the transport API about a message received from the network.
Definition: transport.h:194