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/>.
21 * @brief format for cadet messages exchanged between VPN service and exit daemon
22 * @author Christian Grothoff
27 #include "gnunet_util_lib.h"
29 GNUNET_NETWORK_STRUCT_BEGIN
32 * Message send via cadet to an exit daemon to initiate forwarding of
33 * TCP data to a local service.
35 struct GNUNET_EXIT_TcpServiceStartMessage
38 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START
40 struct GNUNET_MessageHeader header;
45 uint32_t reserved GNUNET_PACKED;
48 * Skeleton of the TCP header to send. Port numbers are to
49 * be replaced and the checksum may be updated as necessary.
51 struct GNUNET_TUN_TcpHeader tcp_header;
53 /* followed by TCP payload */
58 * Message send via cadet to an exit daemon to initiate forwarding of
59 * TCP data to the Internet.
61 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
95 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_DATA
97 struct GNUNET_MessageHeader header;
102 uint32_t reserved GNUNET_PACKED;
105 * Skeleton of the TCP header to send. Port numbers are to
106 * 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.)
108 struct GNUNET_TUN_TcpHeader tcp_header;
110 /* followed by TCP payload */
115 * Message send via cadet to an exit daemon to send
116 * UDP data to a local service.
118 struct GNUNET_EXIT_UdpServiceMessage
121 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE
123 struct GNUNET_MessageHeader header;
126 * Source port to use for the UDP request (0 to use a random port). In NBO.
128 uint16_t source_port GNUNET_PACKED;
131 * Destination port to use for the UDP request. In NBO.
133 uint16_t destination_port GNUNET_PACKED;
135 /* followed by UDP payload */
140 * Message send via cadet to an exit daemon to forward
141 * UDP data to the Internet.
143 struct GNUNET_EXIT_UdpInternetMessage
146 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET
148 struct GNUNET_MessageHeader header;
151 * Address family, AF_INET or AF_INET6, in network byte order.
153 int32_t af GNUNET_PACKED;
156 * Source port to use for the UDP request (0 to use a random port). In NBO.
158 uint16_t source_port GNUNET_PACKED;
161 * Destination port to use for the UDP request. In NBO.
163 uint16_t destination_port GNUNET_PACKED;
165 /* followed by IP address of the destination; either
166 'struct in_addr' or 'struct in6_addr', depending on af */
168 /* followed by UDP payload */
173 * Message send from exit daemon back to the UDP entry point
174 * (used for both Internet and Service exit replies).
176 struct GNUNET_EXIT_UdpReplyMessage
179 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY
181 struct GNUNET_MessageHeader header;
184 * Source port to use for the UDP reply (0 to use the same
185 * port as for the original request). In NBO.
187 uint16_t source_port GNUNET_PACKED;
190 * Destination port to use for the UDP reply (0 to use the same
191 * port as for the original request). In NBO.
193 uint16_t destination_port GNUNET_PACKED;
195 /* followed by UDP payload */
200 * Message send via cadet to an exit daemon to send
201 * ICMP data to a local service.
203 struct GNUNET_EXIT_IcmpServiceMessage
206 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE
208 struct GNUNET_MessageHeader header;
211 * Address family, AF_INET or AF_INET6, in network byte order. This
212 * AF value determines if the 'icmp_header' is ICMPv4 or ICMPv6.
213 * The receiver (exit) may still have to translate (PT) to the services'
214 * ICMP version (if possible).
216 int32_t af GNUNET_PACKED;
219 * ICMP header to use.
221 struct GNUNET_TUN_IcmpHeader icmp_header;
223 /* followed by ICMP payload; however, for certain ICMP message
224 types where the payload is the original IP packet, the payload
225 is omitted as it is useless for the receiver (who will need
226 to create some fake payload manually) */
231 * Message send via cadet to an exit daemon to forward
232 * ICMP data to the Internet.
234 struct GNUNET_EXIT_IcmpInternetMessage
237 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET
239 struct GNUNET_MessageHeader header;
242 * Address family, AF_INET or AF_INET6, in network byte order.
243 * Determines both the ICMP version used in the 'icmp_header' and
244 * the IP address format that is used for the target IP. If
245 * PT is necessary, the sender has already done it.
247 int32_t af GNUNET_PACKED;
250 * ICMP header to use. Must match the target 'af' given
253 struct GNUNET_TUN_IcmpHeader icmp_header;
255 /* followed by IP address of the destination; either
256 'struct in_addr' or 'struct in6_addr', depending on af */
258 /* followed by ICMP payload; however, for certain ICMP message
259 types where the payload is the original IP packet, the payload
260 is omitted as it is useless for the receiver (who will need
261 to create some fake payload manually) */
266 * Message send via cadet to the vpn service to send
267 * ICMP data to the VPN's TUN interface.
269 struct GNUNET_EXIT_IcmpToVPNMessage
272 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN
274 struct GNUNET_MessageHeader header;
277 * Address family, AF_INET or AF_INET6, in network byte order.
278 * Useful to determine if this is an ICMPv4 or ICMPv6 header.
280 int32_t af GNUNET_PACKED;
283 * ICMP header to use. ICMPv4 or ICMPv6, depending on 'af'.
285 struct GNUNET_TUN_IcmpHeader icmp_header;
287 /* followed by ICMP payload; however, for certain ICMP message
288 types where the payload is the original IP packet, the payload
289 is omitted as it is useless for the receiver (who will need
290 to create some fake payload manually) */
294 GNUNET_NETWORK_STRUCT_END