2 This file is part of GNUnet.
3 Copyright (C) 2009-2014 GNUnet e.V.
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.
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.
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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @file transport/communicator.h
23 * @brief common internal definitions for communicator services
24 * @author Christian Grothoff
26 #ifndef COMMUNICATOR_H
27 #define COMMUNICAOTR_H
29 #include "gnunet_util_lib.h"
30 #include "gnunet_protocols.h"
32 GNUNET_NETWORK_STRUCT_BEGIN
35 * Message used to tell a communicator about a successful
38 * Note that this style of KX acknowledgement typically only applies
39 * for communicators where the underlying network protocol is
40 * unidirectional and/or lacks cryptography. Furthermore, this is
41 * just the recommended "generic" style, communicators are always free
42 * to implement original designs that better fit their requirements.
44 struct GNUNET_TRANSPORT_CommunicatorGenericKXConfirmation
47 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_KX_CONFIRMATION
49 struct GNUNET_MessageHeader header;
52 * Timestamp from the original sender which identifies the original KX.
54 struct GNUNET_TIME_AbsoluteNBO monotonic_time;
57 * How long does the receiver of the KX believe that the address
58 * on which the KX was received will continue to be valid.
60 struct GNUNET_TIME_RelativeNBO validity;
63 * Hash of the shared secret. Specific hash function may depend on
64 * the communicator's protocol details.
66 struct GNUNET_HashCode token;
71 * Message used to tell a communicator about the receiver's
72 * flow control limits and to acknowledge receipt of certain
75 * Note that a sender MAY choose to violate the flow-control
76 * limits provided in this message by a receiver, which may
77 * result in messages being lost (after all, transport is an
78 * unreliable channel). So if the sender violates these
79 * constraints, it should expect that the receive will simply
80 * discard the (partially) received "old" messages.
82 * This way, if a sender or receiver crashes, there is no protocol
85 * Note that this style of flow control typically only applies
86 * for communicators where the underlying network protocol does
87 * not already implement flow control. Furthermore, this is
88 * just the recommended "generic" style, communicators are always
89 * free to implement original designs that better fit their
92 struct GNUNET_TRANSPORT_CommunicatorGenericFCLimits
95 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_FC_LIMITS
97 struct GNUNET_MessageHeader header;
100 * Maximum number of messages beyond the acknowledged message
101 * number that can still be transmitted concurrently without
102 * further acknowledgements.
104 uint32_t msg_window_size;
107 * Up to which message number were all messages received.
109 uint64_t msg_cummulative_ack;
112 * Maximum number of payload bytes beyond the acknowledged
113 * number of bytes can still be transmitted without further
116 uint64_t bytes_window_size;
119 * Cummulative acknowledgement for number of bytes received.
121 uint64_t bytes_cummulative_ack;
124 * Followed by a variable-size bitfield for messages received
125 * beyond @e msg_cummulative_ack. Index at offset 0 must thus
126 * be zero, otherwise @e msg_cummulative_ack should be
127 * increased. Note that this field can be overall of 0 bytes.
128 * The variable-size bitfield must be a multiple of 64 bits
131 /* uint64_t msg_selective_ack_field[]; */
138 GNUNET_NETWORK_STRUCT_END
140 /* end of communicator.h */