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/>.
21 * @brief Messages for interaction with gnunet-nat-server and gnunet-nat-service
22 * @author Christian Grothoff
27 #include "gnunet_util_lib.h"
31 GNUNET_NETWORK_STRUCT_BEGIN
34 * Request to test NAT traversal, sent to the gnunet-nat-server
37 struct GNUNET_NAT_TestMessage
40 * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST
42 struct GNUNET_MessageHeader header;
45 * IPv4 target IP address
50 * Port to use, 0 to send dummy ICMP response.
55 * Data to send OR advertised-port (in NBO) to use for dummy ICMP.
60 * #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 */
133 * Client telling the service to (possibly) handle a STUN message.
135 struct GNUNET_NAT_HandleStunMessage
138 * Header with type #GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN
140 struct GNUNET_MessageHeader header;
143 * Size of the sender address included, in NBO.
145 uint16_t sender_addr_size;
148 * Number of bytes of payload included, in NBO.
150 uint16_t payload_size;
152 /* followed by a `struct sockaddr` of @e sender_addr_size bytes */
154 /* followed by payload with @e payload_size bytes */
159 * Client asking the service to initiate connection reversal.
161 struct GNUNET_NAT_RequestConnectionReversalMessage
164 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL
166 struct GNUNET_MessageHeader header;
169 * Size of the local address included, in NBO.
171 uint16_t local_addr_size;
174 * Size of the remote address included, in NBO.
176 uint16_t remote_addr_size;
178 /* followed by a `struct sockaddr` of @e local_addr_size bytes */
180 /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
186 * Service telling a client that connection reversal was requested.
188 struct GNUNET_NAT_ConnectionReversalRequestedMessage
191 * Header with type #GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED
193 struct GNUNET_MessageHeader header;
195 /* followed by a `struct sockaddr_in` */
201 * Service notifying the client about changes in the set of
204 struct GNUNET_NAT_AddressChangeNotificationMessage
207 * Header with type #GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE
209 struct GNUNET_MessageHeader header;
212 * #GNUNET_YES to add, #GNUNET_NO to remove the address from the list.
214 int32_t add_remove GNUNET_PACKED;
217 * Type of the address, an `enum GNUNET_NAT_AddressClass` in NBO.
219 uint32_t addr_class GNUNET_PACKED;
220 /* followed by a `struct sockaddr` */
225 GNUNET_NETWORK_STRUCT_END