GNUnet  0.11.x
nat.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2011, 2016 GNUnet e.V.
4 
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.
9 
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.
14 
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/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
27 #ifndef NAT_H
28 #define NAT_H
29 #include "gnunet_util_lib.h"
30 
31 
33 
39 {
44 
48  uint32_t dst_ipv4;
49 
53  uint16_t dport;
54 
58  uint16_t data;
59 
63  int32_t is_tcp;
64 };
65 
66 
72 {
77 
83 
88 };
89 
90 
95 {
100 
104  uint8_t flags;
105 
109  uint8_t proto;
110 
116 
123 
124  /* Followed by @e num_addrs addresses of type 'struct
125  sockaddr' */
126 
127  /* Followed by @e str_len section name to use for options */
128 };
129 
130 
135 {
140 
145 
149  uint16_t payload_size;
150 
151  /* followed by a `struct sockaddr` of @e sender_addr_size bytes */
152 
153  /* followed by payload with @e payload_size bytes */
154 };
155 
156 
161 {
166 
170  uint16_t local_addr_size;
171 
176 
177  /* followed by a `struct sockaddr` of @e local_addr_size bytes */
178 
179  /* followed by a `struct sockaddr` of @e remote_addr_size bytes */
180 };
181 
182 
187 {
192 
193  /* followed by a `struct sockaddr_in` */
194 };
195 
196 
202 {
207 
212 
217  /* followed by a `struct sockaddr` */
218 };
219 
220 
222 
223 #endif
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
GNUNET_NAT_RegisterFlags
Flags specifying the events this client would be interested in being told about.
Definition: nat.h:72
@ GNUNET_NAT_RF_ADDRESSES
This client wants to be informed about changes to our applicable addresses.
Definition: nat.h:82
@ GNUNET_NAT_RF_NONE
This client does not want any notifications.
Definition: nat.h:76
@ GNUNET_NAT_RF_REVERSAL
This client supports address reversal.
Definition: nat.h:87
Header for all communications.
Service notifying the client about changes in the set of addresses it has.
Definition: nat.h:202
int32_t add_remove
GNUNET_YES to add, GNUNET_NO to remove the address from the list.
Definition: nat.h:211
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE.
Definition: nat.h:206
uint32_t addr_class
Type of the address, an enum GNUNET_NAT_AddressClass in NBO.
Definition: nat.h:216
Service telling a client that connection reversal was requested.
Definition: nat.h:187
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED.
Definition: nat.h:191
Client telling the service to (possibly) handle a STUN message.
Definition: nat.h:135
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_HANDLE_STUN.
Definition: nat.h:139
uint16_t payload_size
Number of bytes of payload included, in NBO.
Definition: nat.h:149
uint16_t sender_addr_size
Size of the sender address included, in NBO.
Definition: nat.h:144
Message sent by a client to register with its addresses.
Definition: nat.h:95
uint16_t num_addrs
Number of addresses that this service is bound to that follow.
Definition: nat.h:122
uint16_t str_len
Number of bytes in the string that follow which specifies a section name in the configuration.
Definition: nat.h:115
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_REGISTER.
Definition: nat.h:99
uint8_t flags
An enum GNUNET_NAT_RegisterFlags.
Definition: nat.h:104
uint8_t proto
Client's IPPROTO, e.g.
Definition: nat.h:109
Client asking the service to initiate connection reversal.
Definition: nat.h:161
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL.
Definition: nat.h:165
uint16_t local_addr_size
Size of the local address included, in NBO.
Definition: nat.h:170
uint16_t remote_addr_size
Size of the remote address included, in NBO.
Definition: nat.h:175
Request to test NAT traversal, sent to the gnunet-nat-server (not the service!).
Definition: nat.h:39
uint16_t dport
Port to use, 0 to send dummy ICMP response.
Definition: nat.h:53
uint32_t dst_ipv4
IPv4 target IP address.
Definition: nat.h:48
uint16_t data
Data to send OR advertised-port (in NBO) to use for dummy ICMP.
Definition: nat.h:58
int32_t is_tcp
GNUNET_YES for TCP, GNUNET_NO for UDP.
Definition: nat.h:63
struct GNUNET_MessageHeader header
Header with type GNUNET_MESSAGE_TYPE_NAT_TEST.
Definition: nat.h:43