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 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.
18 * @brief Messages for interaction with gnunet-nat-server and gnunet-nat-service
19 * @author Christian Grothoff
24 #include "gnunet_util_lib.h"
28 GNUNET_NETWORK_STRUCT_BEGIN
31 * Request to test NAT traversal, sent to the gnunet-nat-server
34 struct GNUNET_NAT_TestMessage
37 * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST
39 struct GNUNET_MessageHeader header;
42 * IPv4 target IP address
47 * Port to use, 0 to send dummy ICMP response.
52 * Data to send OR advertised-port (in NBO) to use for dummy ICMP.
57 * #GNUNET_YES for TCP, #GNUNET_NO for UDP.
65 * Flags specifying the events this client would be
66 * interested in being told about.
68 enum GNUNET_NAT_RegisterFlags
71 * This client does not want any notifications.
73 GNUNET_NAT_RF_NONE = 0,
76 * This client wants to be informed about changes to our
77 * applicable addresses.
79 GNUNET_NAT_RF_ADDRESSES = 1,
82 * This client supports address reversal.
84 GNUNET_NAT_RF_REVERSAL = 2
89 * Message sent by a client to register with its addresses.
91 struct GNUNET_NAT_RegisterMessage
94 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REGISTER
96 struct GNUNET_MessageHeader header;
99 * An `enum GNUNET_NAT_RegisterFlags`.
104 * Client's IPPROTO, e.g. IPPROTO_UDP or IPPROTO_TCP.
109 * Number of bytes in the string that follow which
110 * specifies a section name in the configuration.
112 uint16_t str_len GNUNET_PACKED;
115 * Number of addresses that this service is bound to that follow.
116 * Given as an array of "struct sockaddr" entries, the size of
117 * each entry being determined by the "sa_family" at the beginning.
119 uint16_t num_addrs GNUNET_PACKED;
121 /* Followed by @e num_addrs addresses of type 'struct
124 /* Followed by @e str_len section name to use for options */
130 * Client telling the service to (possibly) handle a STUN message.
132 struct GNUNET_NAT_HandleStunMessage
135 * Header with type #GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN
137 struct GNUNET_MessageHeader header;
140 * Size of the sender address included, in NBO.
142 uint16_t sender_addr_size;
145 * Number of bytes of payload included, in NBO.
147 uint16_t payload_size;
149 /* followed by a `struct sockaddr` of @e sender_addr_size bytes */
151 /* followed by payload with @e payload_size bytes */
156 * Client asking the service to initiate connection reversal.
158 struct GNUNET_NAT_RequestConnectionReversalMessage
161 * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL
163 struct GNUNET_MessageHeader header;
166 * Size of the local address included, in NBO.
168 uint16_t local_addr_size;
171 * Size of the remote address included, in NBO.
173 uint16_t remote_addr_size;
175 /* followed by a `struct sockaddr` of @e local_addr_size bytes */
177 /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
183 * Service telling a client that connection reversal was requested.
185 struct GNUNET_NAT_ConnectionReversalRequestedMessage
188 * Header with type #GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED
190 struct GNUNET_MessageHeader header;
192 /* 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` */
222 GNUNET_NETWORK_STRUCT_END