android: Set preferred language for remediation instructions
[strongswan.git] / src / frontends / android / jni / libandroidbridge / vpnservice_builder.h
1 /*
2 * Copyright (C) 2012-2014 Tobias Brunner
3 * Copyright (C) 2012 Giuliano Grassi
4 * Copyright (C) 2012 Ralf Sager
5 * Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 /**
19 * @defgroup vpnservice_builder vpnservice_builder
20 * @{ @ingroup libandroidbridge
21 */
22
23 #ifndef VPNSERVICE_BUILDER_H_
24 #define VPNSERVICE_BUILDER_H_
25
26 #include <jni.h>
27
28 #include <library.h>
29 #include <networking/host.h>
30
31 typedef struct vpnservice_builder_t vpnservice_builder_t;
32
33 /**
34 * VpnService.Builder, used to build a TUN device.
35 *
36 * Communicates with CharonVpnService.BuilderAdapter via JNI
37 */
38 struct vpnservice_builder_t {
39
40 /**
41 * Add an interface address
42 *
43 * @param addr the desired interface address
44 * @return TRUE on success
45 */
46 bool (*add_address)(vpnservice_builder_t *this, host_t *addr);
47
48 /**
49 * Add a route
50 *
51 * @param net the network address
52 * @param prefix_length the prefix length
53 * @return TRUE on success
54 */
55 bool (*add_route)(vpnservice_builder_t *this, host_t *net, int prefix);
56
57 /**
58 * Add a DNS server
59 *
60 * @param dns the address of the DNS server
61 * @return TRUE on success
62 */
63 bool (*add_dns)(vpnservice_builder_t *this, host_t *dns);
64
65 /**
66 * Set the MTU for the TUN device
67 *
68 * @param mtu the MTU to set
69 * @return TRUE on success
70 */
71 bool (*set_mtu)(vpnservice_builder_t *this, int mtu);
72
73 /**
74 * Build the TUN device
75 *
76 * @return the TUN file descriptor, -1 if failed
77 */
78 int (*establish)(vpnservice_builder_t *this);
79
80 /**
81 * Build the TUN device without DNS related data
82 *
83 * @return the TUN file descriptor, -1 if failed
84 */
85 int (*establish_no_dns)(vpnservice_builder_t *this);
86
87 /**
88 * Destroy a vpnservice_builder
89 */
90 void (*destroy)(vpnservice_builder_t *this);
91
92 };
93
94 /**
95 * Create a vpnservice_builder instance
96 *
97 * @param builder CharonVpnService.BuilderAdapter object
98 * @return vpnservice_builder_t instance
99 */
100 vpnservice_builder_t *vpnservice_builder_create(jobject builder);
101
102 #endif /** VPNSERVICE_BUILDER_H_ @}*/