2 This file is part of GNUnet.
3 Copyright (C) 2011, 2016 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
23 * @brief Messages for interaction with gnunet-nat-server and gnunet-nat-service
24 * @author Christian Grothoff
29 #include "gnunet_util_lib.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
36 * Request to test NAT traversal, sent to the gnunet-nat-server
39 struct GNUNET_NAT_TestMessage
42 * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST
44 struct GNUNET_MessageHeader header;
47 * IPv4 target IP address
52 * Port to use, 0 to send dummy ICMP response.
57 * Data to send OR advertised-port (in NBO) to use for dummy ICMP.
62 * #GNUNET_YES for TCP, #GNUNET_NO for UDP.
70 * Flags specifying the events this client would be
71 * interested in being told about.
73 enum GNUNET_NAT_RegisterFlags
76 * This client does not want any notifications.
78 GNUNET_NAT_RF_NONE = 0,
81 * This client wants to be informed about changes to our
82 * applicable addresses.
84 GNUNET_NAT_RF_ADDRESSES = 1,
87 * This client supports address reversal.
89 GNUNET_NAT_RF_REVERSAL = 2
94 * Message sent by a client to register with its addresses.
96 struct GNUNET_NAT_RegisterMessage
99 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REGISTER
101 struct GNUNET_MessageHeader header;
104 * An `enum GNUNET_NAT_RegisterFlags`.
109 * Client's IPPROTO, e.g. IPPROTO_UDP or IPPROTO_TCP.
114 * Number of bytes in the string that follow which
115 * specifies a section name in the configuration.
117 uint16_t str_len GNUNET_PACKED;
120 * Number of addresses that this service is bound to that follow.
121 * Given as an array of "struct sockaddr" entries, the size of
122 * each entry being determined by the "sa_family" at the beginning.
124 uint16_t num_addrs GNUNET_PACKED;
126 /* Followed by @e num_addrs addresses of type 'struct
129 /* Followed by @e str_len section name to use for options */
135 * Client telling the service to (possibly) handle a STUN message.
137 struct GNUNET_NAT_HandleStunMessage
140 * Header with type #GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN
142 struct GNUNET_MessageHeader header;
145 * Size of the sender address included, in NBO.
147 uint16_t sender_addr_size;
150 * Number of bytes of payload included, in NBO.
152 uint16_t payload_size;
154 /* followed by a `struct sockaddr` of @e sender_addr_size bytes */
156 /* followed by payload with @e payload_size bytes */
161 * Client asking the service to initiate connection reversal.
163 struct GNUNET_NAT_RequestConnectionReversalMessage
166 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL
168 struct GNUNET_MessageHeader header;
171 * Size of the local address included, in NBO.
173 uint16_t local_addr_size;
176 * Size of the remote address included, in NBO.
178 uint16_t remote_addr_size;
180 /* followed by a `struct sockaddr` of @e local_addr_size bytes */
182 /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
188 * Service telling a client that connection reversal was requested.
190 struct GNUNET_NAT_ConnectionReversalRequestedMessage
193 * Header with type #GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED
195 struct GNUNET_MessageHeader header;
197 /* followed by a `struct sockaddr_in` */
203 * Service notifying the client about changes in the set of
206 struct GNUNET_NAT_AddressChangeNotificationMessage
209 * Header with type #GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE
211 struct GNUNET_MessageHeader header;
214 * #GNUNET_YES to add, #GNUNET_NO to remove the address from the list.
216 int32_t add_remove GNUNET_PACKED;
219 * Type of the address, an `enum GNUNET_NAT_AddressClass` in NBO.
221 uint32_t addr_class GNUNET_PACKED;
222 /* followed by a `struct sockaddr` */
227 GNUNET_NETWORK_STRUCT_END