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/>.
20 * @file transport/communicator.h
21 * @brief common internal definitions for communicator services
22 * @author Christian Grothoff
24 #ifndef COMMUNICATOR_H
25 #define COMMUNICAOTR_H
27 #include "gnunet_util_lib.h"
28 #include "gnunet_protocols.h"
30 GNUNET_NETWORK_STRUCT_BEGIN
33 * Message used to tell a communicator about a successful
36 * Note that this style of KX acknowledgement typically only applies
37 * for communicators where the underlying network protocol is
38 * unidirectional and/or lacks cryptography. Furthermore, this is
39 * just the recommended "generic" style, communicators are always free
40 * to implement original designs that better fit their requirements.
42 struct GNUNET_TRANSPORT_CommunicatorGenericKXConfirmation
45 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_KX_CONFIRMATION
47 struct GNUNET_MessageHeader header;
50 * Timestamp from the original sender which identifies the original KX.
52 struct GNUNET_TIME_AbsoluteNBO monotonic_time;
55 * How long does the receiver of the KX believe that the address
56 * on which the KX was received will continue to be valid.
58 struct GNUNET_TIME_RelativeNBO validity;
61 * Hash of the shared secret. Specific hash function may depend on
62 * the communicator's protocol details.
64 struct GNUNET_HashCode token;
69 * Message used to tell a communicator about the receiver's
70 * flow control limits and to acknowledge receipt of certain
73 * Note that a sender MAY choose to violate the flow-control
74 * limits provided in this message by a receiver, which may
75 * result in messages being lost (after all, transport is an
76 * unreliable channel). So if the sender violates these
77 * constraints, it should expect that the receive will simply
78 * discard the (partially) received "old" messages.
80 * This way, if a sender or receiver crashes, there is no protocol
83 * Note that this style of flow control typically only applies
84 * for communicators where the underlying network protocol does
85 * not already implement flow control. Furthermore, this is
86 * just the recommended "generic" style, communicators are always
87 * free to implement original designs that better fit their
90 struct GNUNET_TRANSPORT_CommunicatorGenericFCLimits
93 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_FC_LIMITS
95 struct GNUNET_MessageHeader header;
98 * Maximum number of messages beyond the acknowledged message
99 * number that can still be transmitted concurrently without
100 * further acknowledgements.
102 uint32_t msg_window_size;
105 * Up to which message number were all messages received.
107 uint64_t msg_cummulative_ack;
110 * Maximum number of payload bytes beyond the acknowledged
111 * number of bytes can still be transmitted without further
114 uint64_t bytes_window_size;
117 * Cummulative acknowledgement for number of bytes received.
119 uint64_t bytes_cummulative_ack;
122 * Followed by a variable-size bitfield for messages received
123 * beyond @e msg_cummulative_ack. Index at offset 0 must thus
124 * be zero, otherwise @e msg_cummulative_ack should be
125 * increased. Note that this field can be overall of 0 bytes.
126 * The variable-size bitfield must be a multiple of 64 bits
129 /* uint64_t msg_selective_ack_field[]; */
136 GNUNET_NETWORK_STRUCT_END
138 /* end of communicator.h */