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 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 format for cadet messages exchanged between VPN service and exit daemon
19 * @author Christian Grothoff
24 #include "gnunet_util_lib.h"
26 GNUNET_NETWORK_STRUCT_BEGIN
29 * Message send via cadet to an exit daemon to initiate forwarding of
30 * TCP data to a local service.
32 struct GNUNET_EXIT_TcpServiceStartMessage
35 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START
37 struct GNUNET_MessageHeader header;
42 uint32_t reserved GNUNET_PACKED;
45 * Skeleton of the TCP header to send. Port numbers are to
46 * be replaced and the checksum may be updated as necessary.
48 struct GNUNET_TUN_TcpHeader tcp_header;
50 /* followed by TCP payload */
55 * Message send via cadet to an exit daemon to initiate forwarding of
56 * TCP data to the Internet.
58 struct GNUNET_EXIT_TcpInternetStartMessage
61 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START
63 struct GNUNET_MessageHeader header;
66 * Address family, AF_INET or AF_INET6, in network byte order.
68 int32_t af GNUNET_PACKED;
71 * Skeleton of the TCP header to send. Port numbers are to
72 * be replaced and the checksum may be updated as necessary.
74 struct GNUNET_TUN_TcpHeader tcp_header;
76 /* followed by IP address of the destination; either
77 'struct in_addr' or 'struct in6_addr', depending on af */
79 /* followed by TCP payload */
84 * Message send via cadet between VPN and entry and an exit daemon to
85 * transmit TCP data between the VPN entry and an exit session. This
86 * format is used for both Internet-exits and service-exits and
87 * in both directions (VPN to exit and exit to VPN).
89 struct GNUNET_EXIT_TcpDataMessage
92 * Type is #GNUNET_MESSAGE_TYPE_VPN_TCP_DATA
94 struct GNUNET_MessageHeader header;
99 uint32_t reserved GNUNET_PACKED;
102 * Skeleton of the TCP header to send. Port numbers are to
103 * 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.)
105 struct GNUNET_TUN_TcpHeader tcp_header;
107 /* followed by TCP payload */
112 * Message send via cadet to an exit daemon to send
113 * UDP data to a local service.
115 struct GNUNET_EXIT_UdpServiceMessage
118 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE
120 struct GNUNET_MessageHeader header;
123 * Source port to use for the UDP request (0 to use a random port). In NBO.
125 uint16_t source_port GNUNET_PACKED;
128 * Destination port to use for the UDP request. In NBO.
130 uint16_t destination_port GNUNET_PACKED;
132 /* followed by UDP payload */
137 * Message send via cadet to an exit daemon to forward
138 * UDP data to the Internet.
140 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
176 * Type is #GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY
178 struct GNUNET_MessageHeader header;
181 * Source port to use for the UDP reply (0 to use the same
182 * port as for the original request). In NBO.
184 uint16_t source_port GNUNET_PACKED;
187 * Destination port to use for the UDP reply (0 to use the same
188 * port as for the original request). In NBO.
190 uint16_t destination_port GNUNET_PACKED;
192 /* followed by UDP payload */
197 * Message send via cadet to an exit daemon to send
198 * ICMP data to a local service.
200 struct GNUNET_EXIT_IcmpServiceMessage
203 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE
205 struct GNUNET_MessageHeader header;
208 * Address family, AF_INET or AF_INET6, in network byte order. This
209 * AF value determines if the 'icmp_header' is ICMPv4 or ICMPv6.
210 * The receiver (exit) may still have to translate (PT) to the services'
211 * ICMP version (if possible).
213 int32_t af GNUNET_PACKED;
216 * ICMP header to use.
218 struct GNUNET_TUN_IcmpHeader icmp_header;
220 /* followed by ICMP payload; however, for certain ICMP message
221 types where the payload is the original IP packet, the payload
222 is omitted as it is useless for the receiver (who will need
223 to create some fake payload manually) */
228 * Message send via cadet to an exit daemon to forward
229 * ICMP data to the Internet.
231 struct GNUNET_EXIT_IcmpInternetMessage
234 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET
236 struct GNUNET_MessageHeader header;
239 * Address family, AF_INET or AF_INET6, in network byte order.
240 * Determines both the ICMP version used in the 'icmp_header' and
241 * the IP address format that is used for the target IP. If
242 * PT is necessary, the sender has already done it.
244 int32_t af GNUNET_PACKED;
247 * ICMP header to use. Must match the target 'af' given
250 struct GNUNET_TUN_IcmpHeader icmp_header;
252 /* followed by IP address of the destination; either
253 'struct in_addr' or 'struct in6_addr', depending on af */
255 /* followed by ICMP payload; however, for certain ICMP message
256 types where the payload is the original IP packet, the payload
257 is omitted as it is useless for the receiver (who will need
258 to create some fake payload manually) */
263 * Message send via cadet to the vpn service to send
264 * ICMP data to the VPN's TUN interface.
266 struct GNUNET_EXIT_IcmpToVPNMessage
269 * Type is #GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN
271 struct GNUNET_MessageHeader header;
274 * Address family, AF_INET or AF_INET6, in network byte order.
275 * Useful to determine if this is an ICMPv4 or ICMPv6 header.
277 int32_t af GNUNET_PACKED;
280 * ICMP header to use. ICMPv4 or ICMPv6, depending on 'af'.
282 struct GNUNET_TUN_IcmpHeader icmp_header;
284 /* followed by ICMP payload; however, for certain ICMP message
285 types where the payload is the original IP packet, the payload
286 is omitted as it is useless for the receiver (who will need
287 to create some fake payload manually) */
291 GNUNET_NETWORK_STRUCT_END