2 This file is part of GNUnet.
3 Copyright (C) 2012 Christian Grothoff
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 format for cadet messages exchanged between VPN service and exit daemon
24 * @author Christian Grothoff
29 #include "gnunet_util_lib.h"
31 GNUNET_NETWORK_STRUCT_BEGIN
34 * Message send via cadet to an exit daemon to initiate forwarding of
35 * TCP data to a local service.
37 struct GNUNET_EXIT_TcpServiceStartMessage {
39 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START
41 struct GNUNET_MessageHeader header;
46 uint32_t reserved GNUNET_PACKED;
49 * Skeleton of the TCP header to send. Port numbers are to
50 * be replaced and the checksum may be updated as necessary.
52 struct GNUNET_TUN_TcpHeader tcp_header;
54 /* followed by TCP payload */
59 * Message send via cadet to an exit daemon to initiate forwarding of
60 * TCP data to the Internet.
62 struct GNUNET_EXIT_TcpInternetStartMessage {
64 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START
66 struct GNUNET_MessageHeader header;
69 * Address family, AF_INET or AF_INET6, in network byte order.
71 int32_t af GNUNET_PACKED;
74 * Skeleton of the TCP header to send. Port numbers are to
75 * be replaced and the checksum may be updated as necessary.
77 struct GNUNET_TUN_TcpHeader tcp_header;
79 /* followed by IP address of the destination; either
80 'struct in_addr' or 'struct in6_addr', depending on af */
82 /* followed by TCP payload */
87 * Message send via cadet between VPN and entry and an exit daemon to
88 * transmit TCP data between the VPN entry and an exit session. This
89 * format is used for both Internet-exits and service-exits and
90 * in both directions (VPN to exit and exit to VPN).
92 struct GNUNET_EXIT_TcpDataMessage {
94 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_DATA
96 struct GNUNET_MessageHeader header;
101 uint32_t reserved GNUNET_PACKED;
104 * Skeleton of the TCP header to send. Port numbers are to
105 * be replaced and the checksum may be updated as necessary. (The destination port number should not be changed, as it contains the desired destination port.)
107 struct GNUNET_TUN_TcpHeader tcp_header;
109 /* followed by TCP payload */
114 * Message send via cadet to an exit daemon to send
115 * UDP data to a local service.
117 struct GNUNET_EXIT_UdpServiceMessage {
119 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE
121 struct GNUNET_MessageHeader header;
124 * Source port to use for the UDP request (0 to use a random port). In NBO.
126 uint16_t source_port GNUNET_PACKED;
129 * Destination port to use for the UDP request. In NBO.
131 uint16_t destination_port GNUNET_PACKED;
133 /* followed by UDP payload */
138 * Message send via cadet to an exit daemon to forward
139 * UDP data to the Internet.
141 struct GNUNET_EXIT_UdpInternetMessage {
143 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET
145 struct GNUNET_MessageHeader header;
148 * Address family, AF_INET or AF_INET6, in network byte order.
150 int32_t af GNUNET_PACKED;
153 * Source port to use for the UDP request (0 to use a random port). In NBO.
155 uint16_t source_port GNUNET_PACKED;
158 * Destination port to use for the UDP request. In NBO.
160 uint16_t destination_port GNUNET_PACKED;
162 /* followed by IP address of the destination; either
163 'struct in_addr' or 'struct in6_addr', depending on af */
165 /* followed by UDP payload */
170 * Message send from exit daemon back to the UDP entry point
171 * (used for both Internet and Service exit replies).
173 struct GNUNET_EXIT_UdpReplyMessage {
175 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY
177 struct GNUNET_MessageHeader header;
180 * Source port to use for the UDP reply (0 to use the same
181 * port as for the original request). In NBO.
183 uint16_t source_port GNUNET_PACKED;
186 * Destination port to use for the UDP reply (0 to use the same
187 * port as for the original request). In NBO.
189 uint16_t destination_port GNUNET_PACKED;
191 /* followed by UDP payload */
196 * Message send via cadet to an exit daemon to send
197 * ICMP data to a local service.
199 struct GNUNET_EXIT_IcmpServiceMessage {
201 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE
203 struct GNUNET_MessageHeader header;
206 * Address family, AF_INET or AF_INET6, in network byte order. This
207 * AF value determines if the 'icmp_header' is ICMPv4 or ICMPv6.
208 * The receiver (exit) may still have to translate (PT) to the services'
209 * ICMP version (if possible).
211 int32_t af GNUNET_PACKED;
214 * ICMP header to use.
216 struct GNUNET_TUN_IcmpHeader icmp_header;
218 /* followed by ICMP payload; however, for certain ICMP message
219 types where the payload is the original IP packet, the payload
220 is omitted as it is useless for the receiver (who will need
221 to create some fake payload manually) */
226 * Message send via cadet to an exit daemon to forward
227 * ICMP data to the Internet.
229 struct GNUNET_EXIT_IcmpInternetMessage {
231 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET
233 struct GNUNET_MessageHeader header;
236 * Address family, AF_INET or AF_INET6, in network byte order.
237 * Determines both the ICMP version used in the 'icmp_header' and
238 * the IP address format that is used for the target IP. If
239 * PT is necessary, the sender has already done it.
241 int32_t af GNUNET_PACKED;
244 * ICMP header to use. Must match the target 'af' given
247 struct GNUNET_TUN_IcmpHeader icmp_header;
249 /* followed by IP address of the destination; either
250 'struct in_addr' or 'struct in6_addr', depending on af */
252 /* followed by ICMP payload; however, for certain ICMP message
253 types where the payload is the original IP packet, the payload
254 is omitted as it is useless for the receiver (who will need
255 to create some fake payload manually) */
260 * Message send via cadet to the vpn service to send
261 * ICMP data to the VPN's TUN interface.
263 struct GNUNET_EXIT_IcmpToVPNMessage {
265 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN
267 struct GNUNET_MessageHeader header;
270 * Address family, AF_INET or AF_INET6, in network byte order.
271 * Useful to determine if this is an ICMPv4 or ICMPv6 header.
273 int32_t af GNUNET_PACKED;
276 * ICMP header to use. ICMPv4 or ICMPv6, depending on 'af'.
278 struct GNUNET_TUN_IcmpHeader icmp_header;
280 /* followed by ICMP payload; however, for certain ICMP message
281 types where the payload is the original IP packet, the payload
282 is omitted as it is useless for the receiver (who will need
283 to create some fake payload manually) */
287 GNUNET_NETWORK_STRUCT_END