]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libcharon/plugins/kernel_libipsec/kernel_libipsec_router.h
234292a45883c1c2b3579d5a38d9004f48c5d0e3
[thirdparty/strongswan.git] / src / libcharon / plugins / kernel_libipsec / kernel_libipsec_router.h
1 /*
2 * Copyright (C) 2013 Tobias Brunner
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup kernel_libipsec_router kernel_libipsec_router
19 * @{ @ingroup kernel_libipsec
20 */
21
22 #ifndef KERNEL_LIBIPSEC_ROUTER_H_
23 #define KERNEL_LIBIPSEC_ROUTER_H_
24
25 #include <kernel/kernel_listener.h>
26
27 typedef struct kernel_libipsec_router_t kernel_libipsec_router_t;
28
29 /**
30 * Class that routes the network packets between TUN device, libipsec and
31 * charon's IKE socket.
32 */
33 struct kernel_libipsec_router_t {
34
35 /**
36 * Implements kernel_listener_t interface
37 */
38 kernel_listener_t listener;
39
40 /**
41 * Get the name of the TUN device to be used with the given virtual IP.
42 *
43 * @param vip virtual IP
44 * @return allocated name
45 */
46 char *(*get_tun_name)(kernel_libipsec_router_t *this, host_t *vip);
47
48 /**
49 * Destroy the given instance
50 */
51 void (*destroy)(kernel_libipsec_router_t *this);
52 };
53
54 /**
55 * Single instance of this class, if created
56 */
57 extern kernel_libipsec_router_t *router;
58
59 /**
60 * Create a kernel_libipsec_router_t instance.
61 *
62 * @return kernel_libipsec_router_t instance
63 */
64 kernel_libipsec_router_t *kernel_libipsec_router_create();
65
66 #endif /** KERNEL_LIBIPSEC_ROUTER_H_ @}*/