diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-09 22:38:49 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-09 22:38:49 +0000 |
commit | d2c214f97316f90f0242a0921fb4f060313c6c18 (patch) | |
tree | 9062233053a29b0689e039c1619b4d3c77f5b679 /src/exit/exit.h | |
parent | 428ea7205a76b37863e7d987512aaae45029f37b (diff) | |
download | gnunet-d2c214f97316f90f0242a0921fb4f060313c6c18.tar.gz gnunet-d2c214f97316f90f0242a0921fb4f060313c6c18.zip |
-defining proper structs for vpn-exit mesh communication
Diffstat (limited to 'src/exit/exit.h')
-rw-r--r-- | src/exit/exit.h | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/src/exit/exit.h b/src/exit/exit.h new file mode 100644 index 000000000..1e92cc501 --- /dev/null +++ b/src/exit/exit.h | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2012 Christian Grothoff | ||
4 | |||
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. | ||
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 | General Public License for more details. | ||
14 | |||
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., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file exit/exit.h | ||
23 | * @brief format for mesh messages exchanged between VPN service and exit daemon | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef EXIT_H | ||
27 | #define EXIT_H | ||
28 | |||
29 | #include "gnunet_util_lib.h" | ||
30 | |||
31 | /** | ||
32 | * Message send via mesh to an exit daemon to initiate forwarding of | ||
33 | * TCP data to a local service. | ||
34 | */ | ||
35 | struct GNUNET_EXIT_TcpServiceStartMessage | ||
36 | { | ||
37 | /** | ||
38 | * Type is GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START | ||
39 | */ | ||
40 | struct GNUNET_MessageHeader header; | ||
41 | |||
42 | /** | ||
43 | * Always 0. | ||
44 | */ | ||
45 | uint32_t reserved; | ||
46 | |||
47 | /** | ||
48 | * Identification for the desired service. | ||
49 | */ | ||
50 | GNUNET_HashCode service_descriptor; | ||
51 | |||
52 | /** | ||
53 | * Skeleton of the TCP header to send. Port numbers are to | ||
54 | * be replaced and the checksum may be updated as necessary. | ||
55 | */ | ||
56 | struct tcp_packet tcp_header; | ||
57 | |||
58 | /* followed by TCP payload */ | ||
59 | }; | ||
60 | |||
61 | |||
62 | /** | ||
63 | * Message send via mesh to an exit daemon to initiate forwarding of | ||
64 | * TCP data to the Internet. | ||
65 | */ | ||
66 | struct GNUNET_EXIT_TcpInternetStartMessage | ||
67 | { | ||
68 | /** | ||
69 | * Type is GNUNET_MESSAGE_TYPE_VPN_TCP_TO_INTERNET_START | ||
70 | */ | ||
71 | struct GNUNET_MessageHeader header; | ||
72 | |||
73 | /** | ||
74 | * Address family, AF_INET or AF_INET6, in network byte order. | ||
75 | */ | ||
76 | int32_t af; | ||
77 | |||
78 | /** | ||
79 | * Skeleton of the TCP header to send. Port numbers are to | ||
80 | * be replaced and the checksum may be updated as necessary. | ||
81 | */ | ||
82 | struct tcp_packet tcp_header; | ||
83 | |||
84 | /* followed by IP address of the destination; either | ||
85 | 'struct in_addr' or 'struct in6_addr', depending on af */ | ||
86 | |||
87 | /* followed by TCP payload */ | ||
88 | }; | ||
89 | |||
90 | |||
91 | /** | ||
92 | * Message send via mesh between VPN and entry and an exit daemon to | ||
93 | * transmit TCP data between the VPN entry and an exit session. This | ||
94 | * format is used for both Internet-exits and service-exits and | ||
95 | * in both directions (VPN to exit and exit to VPN). | ||
96 | */ | ||
97 | struct GNUNET_EXIT_TcpDataMessage | ||
98 | { | ||
99 | /** | ||
100 | * Type is GNUNET_MESSAGE_TYPE_VPN_TCP_DATA | ||
101 | */ | ||
102 | struct GNUNET_MessageHeader header; | ||
103 | |||
104 | /** | ||
105 | * Always 0. | ||
106 | */ | ||
107 | uint32_t reserved; | ||
108 | |||
109 | /** | ||
110 | * Skeleton of the TCP header to send. Port numbers are to | ||
111 | * be replaced and the checksum may be updated as necessary. | ||
112 | */ | ||
113 | struct tcp_packet tcp_header; | ||
114 | |||
115 | /* followed by TCP payload */ | ||
116 | }; | ||
117 | |||
118 | |||
119 | /** | ||
120 | * Message send via mesh to an exit daemon to send | ||
121 | * UDP data to a local service. | ||
122 | */ | ||
123 | struct GNUNET_EXIT_UdpServiceMessage | ||
124 | { | ||
125 | /** | ||
126 | * Type is GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE | ||
127 | */ | ||
128 | struct GNUNET_MessageHeader header; | ||
129 | |||
130 | /** | ||
131 | * Always 0. | ||
132 | */ | ||
133 | uint32_t reserved; | ||
134 | |||
135 | /** | ||
136 | * Identification for the desired service. | ||
137 | */ | ||
138 | GNUNET_HashCode service_descriptor; | ||
139 | |||
140 | /* followed by UDP payload */ | ||
141 | }; | ||
142 | |||
143 | |||
144 | /** | ||
145 | * Message send via mesh to an exit daemon to forward | ||
146 | * UDP data to the Internet. | ||
147 | */ | ||
148 | struct GNUNET_EXIT_UdpInternetMessage | ||
149 | { | ||
150 | /** | ||
151 | * Type is GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET | ||
152 | */ | ||
153 | struct GNUNET_MessageHeader header; | ||
154 | |||
155 | /** | ||
156 | * Address family, AF_INET or AF_INET6, in network byte order. | ||
157 | */ | ||
158 | int32_t af; | ||
159 | |||
160 | |||
161 | /* followed by IP address of the destination; either | ||
162 | 'struct in_addr' or 'struct in6_addr', depending on af */ | ||
163 | |||
164 | /* followed by UDP payload */ | ||
165 | }; | ||
166 | |||
167 | |||
168 | /** | ||
169 | * Message send from exit daemon back to the UDP entry point | ||
170 | * (used for both Internet and Service exit replies). | ||
171 | */ | ||
172 | struct GNUNET_EXIT_UdpReplyMessage | ||
173 | { | ||
174 | /** | ||
175 | * Type is GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY | ||
176 | */ | ||
177 | struct GNUNET_MessageHeader header; | ||
178 | |||
179 | /** | ||
180 | * Source port to use for the UDP reply (0 to use the same | ||
181 | * port as for the original request). In NBO. | ||
182 | */ | ||
183 | uint16_t source_port; | ||
184 | |||
185 | /** | ||
186 | * Destination port to use for the UDP reply (0 to use the same | ||
187 | * port as for the original request). In NBO. | ||
188 | */ | ||
189 | uint16_t destination_port; | ||
190 | |||
191 | /* followed by UDP payload */ | ||
192 | }; | ||
193 | |||
194 | |||
195 | #endif | ||