Merge branch 'android-app'
[strongswan.git] / src / frontends / android / jni / libandroidbridge / kernel / android_net.c
1 /*
2 * Copyright (C) 2012 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 #include "android_net.h"
16
17 typedef struct private_kernel_android_net_t private_kernel_android_net_t;
18
19 struct private_kernel_android_net_t {
20
21 /**
22 * Public kernel interface
23 */
24 kernel_android_net_t public;
25 };
26
27 METHOD(kernel_net_t, add_ip, status_t,
28 private_kernel_android_net_t *this, host_t *virtual_ip, host_t *iface_ip)
29 {
30 /* we get the IP from the IKE_SA once the CHILD_SA is established */
31 return SUCCESS;
32 }
33
34 METHOD(kernel_net_t, destroy, void,
35 private_kernel_android_net_t *this)
36 {
37 free(this);
38 }
39
40 /*
41 * Described in header.
42 */
43 kernel_android_net_t *kernel_android_net_create()
44 {
45 private_kernel_android_net_t *this;
46
47 INIT(this,
48 .public = {
49 .interface = {
50 .get_source_addr = (void*)return_null,
51 .get_nexthop = (void*)return_null,
52 .get_interface = (void*)return_null,
53 .create_address_enumerator = (void*)enumerator_create_empty,
54 .add_ip = _add_ip,
55 .del_ip = (void*)return_failed,
56 .add_route = (void*)return_failed,
57 .del_route = (void*)return_failed,
58 .destroy = _destroy,
59 },
60 },
61 );
62
63 return &this->public;
64 };