2 * Copyright (C) 2013 Tobias Brunner
4 * Copyright (C) secunet Security Networks AG
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>.
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
18 * @defgroup kernel_libipsec_router kernel_libipsec_router
19 * @{ @ingroup kernel_libipsec
22 #ifndef KERNEL_LIBIPSEC_ROUTER_H_
23 #define KERNEL_LIBIPSEC_ROUTER_H_
25 #include <kernel/kernel_listener.h>
27 typedef struct kernel_libipsec_router_t kernel_libipsec_router_t
;
30 * Class that routes the network packets between TUN device, libipsec and
31 * charon's IKE socket.
33 struct kernel_libipsec_router_t
{
36 * Implements kernel_listener_t interface
38 kernel_listener_t listener
;
41 * Get the name of the TUN device to be used with the given virtual IP.
43 * @param vip virtual IP
44 * @return allocated name
46 char *(*get_tun_name
)(kernel_libipsec_router_t
*this, host_t
*vip
);
49 * Destroy the given instance
51 void (*destroy
)(kernel_libipsec_router_t
*this);
55 * Single instance of this class, if created
57 extern kernel_libipsec_router_t
*router
;
60 * Create a kernel_libipsec_router_t instance.
62 * @return kernel_libipsec_router_t instance
64 kernel_libipsec_router_t
*kernel_libipsec_router_create();
66 #endif /** KERNEL_LIBIPSEC_ROUTER_H_ @}*/