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"
32 GNUNET_NETWORK_STRUCT_BEGIN
35 * Request to test NAT traversal, sent to the gnunet-nat-server
38 struct GNUNET_NAT_TestMessage
41 * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST
43 struct GNUNET_MessageHeader header;
46 * IPv4 target IP address
51 * Port to use, 0 to send dummy ICMP response.
56 * Data to send OR advertised-port (in NBO) to use for dummy ICMP.
61 * #GNUNET_YES for TCP, #GNUNET_NO for UDP.
68 * Flags specifying the events this client would be
69 * interested in being told about.
71 enum GNUNET_NAT_RegisterFlags
74 * This client does not want any notifications.
76 GNUNET_NAT_RF_NONE = 0,
79 * This client wants to be informed about changes to our
80 * applicable addresses.
82 GNUNET_NAT_RF_ADDRESSES = 1,
85 * This client supports address reversal.
87 GNUNET_NAT_RF_REVERSAL = 2
92 * Message sent by a client to register with its addresses.
94 struct GNUNET_NAT_RegisterMessage
97 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REGISTER
99 struct GNUNET_MessageHeader header;
102 * An `enum GNUNET_NAT_RegisterFlags`.
107 * Client's IPPROTO, e.g. IPPROTO_UDP or IPPROTO_TCP.
112 * Number of bytes in the string that follow which
113 * specifies a section name in the configuration.
115 uint16_t str_len GNUNET_PACKED;
118 * Number of addresses that this service is bound to that follow.
119 * Given as an array of "struct sockaddr" entries, the size of
120 * each entry being determined by the "sa_family" at the beginning.
122 uint16_t num_addrs GNUNET_PACKED;
124 /* Followed by @e num_addrs addresses of type 'struct
127 /* Followed by @e str_len section name to use for options */
132 * Client telling the service to (possibly) handle a STUN message.
134 struct GNUNET_NAT_HandleStunMessage
137 * Header with type #GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN
139 struct GNUNET_MessageHeader header;
142 * Size of the sender address included, in NBO.
144 uint16_t sender_addr_size;
147 * Number of bytes of payload included, in NBO.
149 uint16_t payload_size;
151 /* followed by a `struct sockaddr` of @e sender_addr_size bytes */
153 /* followed by payload with @e payload_size bytes */
158 * Client asking the service to initiate connection reversal.
160 struct GNUNET_NAT_RequestConnectionReversalMessage
163 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL
165 struct GNUNET_MessageHeader header;
168 * Size of the local address included, in NBO.
170 uint16_t local_addr_size;
173 * Size of the remote address included, in NBO.
175 uint16_t remote_addr_size;
177 /* followed by a `struct sockaddr` of @e local_addr_size bytes */
179 /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
184 * Service telling a client that connection reversal was requested.
186 struct GNUNET_NAT_ConnectionReversalRequestedMessage
189 * Header with type #GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED
191 struct GNUNET_MessageHeader header;
193 /* followed by a `struct sockaddr_in` */
198 * Service notifying the client about changes in the set of
201 struct GNUNET_NAT_AddressChangeNotificationMessage
204 * Header with type #GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE
206 struct GNUNET_MessageHeader header;
209 * #GNUNET_YES to add, #GNUNET_NO to remove the address from the list.
211 int32_t add_remove GNUNET_PACKED;
214 * Type of the address, an `enum GNUNET_NAT_AddressClass` in NBO.
216 uint32_t addr_class GNUNET_PACKED;
217 /* followed by a `struct sockaddr` */
221 GNUNET_NETWORK_STRUCT_END