adding API for short (256-bit) hash codes
[oweals/gnunet.git] / src / vpn / vpn.h
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 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    * GNUNET_YES to notify only after completion of the mesh-level connection,
47    * GNUNET_NO to notify as soon as an address was allocated (in nbo).
48    */
49   int32_t nac GNUNET_PACKED;
50   
51   /**
52    * How long should the redirection be maintained at most?
53    */
54   struct GNUNET_TIME_AbsoluteNBO expiration_time;
55
56   /**
57    * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo)
58    */
59   int32_t result_af GNUNET_PACKED;
60
61   /**
62    * Address family used for the destination address (AF_INET or AF_INET6, in nbo)
63    */
64   int32_t addr_af GNUNET_PACKED;
65
66   /**
67    * Unique ID to match a future response to this request.
68    * Picked by the client.
69    */
70   uint64_t request_id GNUNET_PACKED;
71
72   /* followed by destination address ('struct in_addr' or 'struct in6_addr') */
73   
74 };
75
76
77 /**
78  * Message send by the VPN client to the VPN service requesting
79  * the setup of a redirection from some IP to a service running
80  * at a particular peer.
81  */
82 struct RedirectToServiceRequestMessage
83 {
84   /**
85    * Type is  GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP
86    */
87   struct GNUNET_MessageHeader header;
88
89   /**
90    * GNUNET_YES to notify only after completion of the mesh-level connection,
91    * GNUNET_NO to notify as soon as an address was allocated (in nbo).
92    */
93   int32_t nac GNUNET_PACKED;
94   
95   /**
96    * How long should the redirection be maintained at most?
97    */
98   struct GNUNET_TIME_AbsoluteNBO expiration_time;
99
100   /**
101    * Desired protocol (IPPROTO_UDP or IPPROTO_TCP)
102    */
103   int32_t protocol GNUNET_PACKED;
104   
105   /**
106    * Address family desired for the result (AF_INET or AF_INET6 or AF_UNSPEC, in nbo)
107    */
108   int32_t result_af GNUNET_PACKED;
109
110   /**
111    * Target peer offering the service.
112    */
113   struct GNUNET_PeerIdentity target;
114
115   /**
116    * Service descriptor identifying the service.
117    */
118   GNUNET_HashCode service_descriptor;
119
120   /**
121    * Unique ID to match a future response to this request.
122    * Picked by the client.
123    */
124   uint64_t request_id GNUNET_PACKED;
125
126 };
127
128
129 /**
130  * Response from the VPN service to a VPN client informing about
131  * the IP that was assigned for the requested redirection.
132  */
133 struct RedirectToIpResponseMessage
134 {
135   
136   /**
137    * Type is  GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP
138    */
139   struct GNUNET_MessageHeader header;
140
141   /**
142    * Address family of the allocated address that follows; will match
143    * "result_af" from the request, of be "AF_UNSPEC" on errors.
144    */
145   int32_t result_af GNUNET_PACKED;
146
147   /**
148    * Unique ID to match the response to a request.
149    */
150   uint64_t request_id GNUNET_PACKED;
151
152   /* followed by destination address ('struct in_addr' or 'struct in6_addr') */
153   
154 };
155
156 GNUNET_NETWORK_STRUCT_END
157
158
159 #endif