diff options
Diffstat (limited to 'src/service/vpn/vpn.h')
-rw-r--r-- | src/service/vpn/vpn.h | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/src/service/vpn/vpn.h b/src/service/vpn/vpn.h new file mode 100644 index 000000000..77cfd34e6 --- /dev/null +++ b/src/service/vpn/vpn.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012 Christian Grothoff | ||
4 | |||
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. | ||
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 | Affero General Public License for more details. | ||
14 | |||
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/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file vpn/vpn.h | ||
23 | * @brief IPC messages between VPN library and VPN service | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef VPN_H | ||
27 | #define VPN_H | ||
28 | |||
29 | #include "gnunet_util_lib.h" | ||
30 | |||
31 | GNUNET_NETWORK_STRUCT_BEGIN | ||
32 | |||
33 | /** | ||
34 | * Message send by the VPN client to the VPN service requesting | ||
35 | * the setup of a redirection from some IP via an exit node to | ||
36 | * some global Internet address. | ||
37 | */ | ||
38 | struct RedirectToIpRequestMessage | ||
39 | { | ||
40 | /** | ||
41 | * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP | ||
42 | */ | ||
43 | struct GNUNET_MessageHeader header; | ||
44 | |||
45 | /** | ||
46 | * Always zero. | ||
47 | */ | ||
48 | uint32_t reserved GNUNET_PACKED; | ||
49 | |||
50 | /** | ||
51 | * How long should the redirection be maintained at most? | ||
52 | */ | ||
53 | struct GNUNET_TIME_AbsoluteNBO expiration_time; | ||
54 | |||
55 | /** | ||
56 | * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo) | ||
57 | */ | ||
58 | int32_t result_af GNUNET_PACKED; | ||
59 | |||
60 | /** | ||
61 | * Address family used for the destination address (AF_INET or AF_INET6, in nbo) | ||
62 | */ | ||
63 | int32_t addr_af GNUNET_PACKED; | ||
64 | |||
65 | /** | ||
66 | * Unique ID to match a future response to this request. | ||
67 | * Picked by the client. | ||
68 | */ | ||
69 | uint64_t request_id GNUNET_PACKED; | ||
70 | |||
71 | /* followed by destination address ('struct in_addr' or 'struct in6_addr') */ | ||
72 | }; | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Message send by the VPN client to the VPN service requesting | ||
77 | * the setup of a redirection from some IP to a service running | ||
78 | * at a particular peer. | ||
79 | */ | ||
80 | struct RedirectToServiceRequestMessage | ||
81 | { | ||
82 | /** | ||
83 | * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE | ||
84 | */ | ||
85 | struct GNUNET_MessageHeader header; | ||
86 | |||
87 | /** | ||
88 | * Always zero. | ||
89 | */ | ||
90 | uint32_t reserved GNUNET_PACKED; | ||
91 | |||
92 | /** | ||
93 | * How long should the redirection be maintained at most? | ||
94 | */ | ||
95 | struct GNUNET_TIME_AbsoluteNBO expiration_time; | ||
96 | |||
97 | /** | ||
98 | * Desired protocol (IPPROTO_UDP or IPPROTO_TCP) | ||
99 | */ | ||
100 | int32_t protocol GNUNET_PACKED; | ||
101 | |||
102 | /** | ||
103 | * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo) | ||
104 | */ | ||
105 | int32_t result_af GNUNET_PACKED; | ||
106 | |||
107 | /** | ||
108 | * Target peer offering the service. | ||
109 | */ | ||
110 | struct GNUNET_PeerIdentity target; | ||
111 | |||
112 | /** | ||
113 | * Service descriptor identifying the service. | ||
114 | */ | ||
115 | struct GNUNET_HashCode service_descriptor; | ||
116 | |||
117 | /** | ||
118 | * Unique ID to match a future response to this request. | ||
119 | * Picked by the client. | ||
120 | */ | ||
121 | uint64_t request_id GNUNET_PACKED; | ||
122 | }; | ||
123 | |||
124 | |||
125 | /** | ||
126 | * Response from the VPN service to a VPN client informing about | ||
127 | * the IP that was assigned for the requested redirection. | ||
128 | */ | ||
129 | struct RedirectToIpResponseMessage | ||
130 | { | ||
131 | /** | ||
132 | * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP | ||
133 | */ | ||
134 | struct GNUNET_MessageHeader header; | ||
135 | |||
136 | /** | ||
137 | * Address family of the allocated address that follows; will match | ||
138 | * "result_af" from the request, of be "AF_UNSPEC" on errors. | ||
139 | */ | ||
140 | int32_t result_af GNUNET_PACKED; | ||
141 | |||
142 | /** | ||
143 | * Unique ID to match the response to a request. | ||
144 | */ | ||
145 | uint64_t request_id GNUNET_PACKED; | ||
146 | |||
147 | /* followed by destination address ('struct in_addr' or 'struct in6_addr') */ | ||
148 | }; | ||
149 | |||
150 | GNUNET_NETWORK_STRUCT_END | ||
151 | |||
152 | |||
153 | #endif | ||