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
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
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
40 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START
42 struct GNUNET_MessageHeader header;
47 uint32_t reserved GNUNET_PACKED;
50 * Skeleton of the TCP header to send. Port numbers are to
51 * be replaced and the checksum may be updated as necessary.
53 struct GNUNET_TUN_TcpHeader tcp_header;
55 /* followed by TCP payload */
60 * Message send via cadet to an exit daemon to initiate forwarding of
61 * TCP data to the Internet.
63 struct GNUNET_EXIT_TcpInternetStartMessage
66 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START
68 struct GNUNET_MessageHeader header;
71 * Address family, AF_INET or AF_INET6, in network byte order.
73 int32_t af GNUNET_PACKED;
76 * Skeleton of the TCP header to send. Port numbers are to
77 * be replaced and the checksum may be updated as necessary.
79 struct GNUNET_TUN_TcpHeader tcp_header;
81 /* followed by IP address of the destination; either
82 'struct in_addr' or 'struct in6_addr', depending on af */
84 /* followed by TCP payload */
89 * Message send via cadet between VPN and entry and an exit daemon to
90 * transmit TCP data between the VPN entry and an exit session. This
91 * format is used for both Internet-exits and service-exits and
92 * in both directions (VPN to exit and exit to VPN).
94 struct GNUNET_EXIT_TcpDataMessage
97 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_DATA
99 struct GNUNET_MessageHeader header;
104 uint32_t reserved GNUNET_PACKED;
107 * Skeleton of the TCP header to send. Port numbers are to
108 * 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.)
110 struct GNUNET_TUN_TcpHeader tcp_header;
112 /* followed by TCP payload */
117 * Message send via cadet to an exit daemon to send
118 * UDP data to a local service.
120 struct GNUNET_EXIT_UdpServiceMessage
123 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE
125 struct GNUNET_MessageHeader header;
128 * Source port to use for the UDP request (0 to use a random port). In NBO.
130 uint16_t source_port GNUNET_PACKED;
133 * Destination port to use for the UDP request. In NBO.
135 uint16_t destination_port GNUNET_PACKED;
137 /* followed by UDP payload */
142 * Message send via cadet to an exit daemon to forward
143 * UDP data to the Internet.
145 struct GNUNET_EXIT_UdpInternetMessage
148 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET
150 struct GNUNET_MessageHeader header;
153 * Address family, AF_INET or AF_INET6, in network byte order.
155 int32_t af GNUNET_PACKED;
158 * Source port to use for the UDP request (0 to use a random port). In NBO.
160 uint16_t source_port GNUNET_PACKED;
163 * Destination port to use for the UDP request. In NBO.
165 uint16_t destination_port GNUNET_PACKED;
167 /* followed by IP address of the destination; either
168 'struct in_addr' or 'struct in6_addr', depending on af */
170 /* followed by UDP payload */
175 * Message send from exit daemon back to the UDP entry point
176 * (used for both Internet and Service exit replies).
178 struct GNUNET_EXIT_UdpReplyMessage
181 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY
183 struct GNUNET_MessageHeader header;
186 * Source port to use for the UDP reply (0 to use the same
187 * port as for the original request). In NBO.
189 uint16_t source_port GNUNET_PACKED;
192 * Destination port to use for the UDP reply (0 to use the same
193 * port as for the original request). In NBO.
195 uint16_t destination_port GNUNET_PACKED;
197 /* followed by UDP payload */
202 * Message send via cadet to an exit daemon to send
203 * ICMP data to a local service.
205 struct GNUNET_EXIT_IcmpServiceMessage
208 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE
210 struct GNUNET_MessageHeader header;
213 * Address family, AF_INET or AF_INET6, in network byte order. This
214 * AF value determines if the 'icmp_header' is ICMPv4 or ICMPv6.
215 * The receiver (exit) may still have to translate (PT) to the services'
216 * ICMP version (if possible).
218 int32_t af GNUNET_PACKED;
221 * ICMP header to use.
223 struct GNUNET_TUN_IcmpHeader icmp_header;
225 /* followed by ICMP payload; however, for certain ICMP message
226 types where the payload is the original IP packet, the payload
227 is omitted as it is useless for the receiver (who will need
228 to create some fake payload manually) */
233 * Message send via cadet to an exit daemon to forward
234 * ICMP data to the Internet.
236 struct GNUNET_EXIT_IcmpInternetMessage
239 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET
241 struct GNUNET_MessageHeader header;
244 * Address family, AF_INET or AF_INET6, in network byte order.
245 * Determines both the ICMP version used in the 'icmp_header' and
246 * the IP address format that is used for the target IP. If
247 * PT is necessary, the sender has already done it.
249 int32_t af GNUNET_PACKED;
252 * ICMP header to use. Must match the target 'af' given
255 struct GNUNET_TUN_IcmpHeader icmp_header;
257 /* followed by IP address of the destination; either
258 'struct in_addr' or 'struct in6_addr', depending on af */
260 /* followed by ICMP payload; however, for certain ICMP message
261 types where the payload is the original IP packet, the payload
262 is omitted as it is useless for the receiver (who will need
263 to create some fake payload manually) */
268 * Message send via cadet to the vpn service to send
269 * ICMP data to the VPN's TUN interface.
271 struct GNUNET_EXIT_IcmpToVPNMessage
274 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN
276 struct GNUNET_MessageHeader header;
279 * Address family, AF_INET or AF_INET6, in network byte order.
280 * Useful to determine if this is an ICMPv4 or ICMPv6 header.
282 int32_t af GNUNET_PACKED;
285 * ICMP header to use. ICMPv4 or ICMPv6, depending on 'af'.
287 struct GNUNET_TUN_IcmpHeader icmp_header;
289 /* followed by ICMP payload; however, for certain ICMP message
290 types where the payload is the original IP packet, the payload
291 is omitted as it is useless for the receiver (who will need
292 to create some fake payload manually) */
296 GNUNET_NETWORK_STRUCT_END