Annotation of embedaddon/strongswan/src/libcharon/kernel/kernel_listener.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2010-2013 Tobias Brunner
3: * HSR 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: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * @defgroup kernel_listener kernel_listener
18: * @{ @ingroup kernel
19: */
20:
21: #ifndef KERNEL_LISTENER_H_
22: #define KERNEL_LISTENER_H_
23:
24: typedef struct kernel_listener_t kernel_listener_t;
25:
26: #include <networking/host.h>
27: #include <networking/tun_device.h>
28: #include <selectors/traffic_selector.h>
29: #include <kernel/kernel_ipsec.h>
30:
31: /**
32: * Interface for components interested in kernel events.
33: *
34: * All hooks are optional.
35: */
36: struct kernel_listener_t {
37:
38: /**
39: * Hook called if an acquire event for a policy is received.
40: *
41: * @param reqid reqid of the policy to acquire
42: * @param src_ts source traffic selector
43: * @param dst_ts destination traffic selector
44: * @return TRUE to remain registered, FALSE to unregister
45: */
46: bool (*acquire)(kernel_listener_t *this, uint32_t reqid,
47: traffic_selector_t *src_ts, traffic_selector_t *dst_ts);
48:
49: /**
50: * Hook called if an expire event for an IPsec SA is received.
51: *
52: * @param protocol protocol of the expired SA
53: * @param spi spi of the expired SA
54: * @param dst destination address of expired SA
55: * @param hard TRUE if it is a hard expire, FALSE otherwise
56: * @return TRUE to remain registered, FALSE to unregister
57: */
58: bool (*expire)(kernel_listener_t *this, uint8_t protocol, uint32_t spi,
59: host_t *dst, bool hard);
60:
61: /**
62: * Hook called if the NAT mappings of an IPsec SA changed.
63: *
64: * @param protocol IPsec protocol of affected SA
65: * @param spi spi of the SA
66: * @param dst old destination address of SA
67: * @param remote new remote host
68: * @return TRUE to remain registered, FALSE to unregister
69: */
70: bool (*mapping)(kernel_listener_t *this, uint8_t protocol, uint32_t spi,
71: host_t *dst, host_t *remote);
72:
73: /**
74: * Hook called if a migrate event for a policy is received.
75: *
76: * @param reqid reqid of the policy
77: * @param src_ts source traffic selector
78: * @param dst_ts destination traffic selector
79: * @param direction direction of the policy (in|out)
80: * @param local local host address to be used in the IKE_SA
81: * @param remote remote host address to be used in the IKE_SA
82: * @return TRUE to remain registered, FALSE to unregister
83: */
84: bool (*migrate)(kernel_listener_t *this, uint32_t reqid,
85: traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
86: policy_dir_t direction, host_t *local, host_t *remote);
87:
88: /**
89: * Hook called if changes in the networking layer occurred (interfaces
90: * up/down, routes added/deleted etc.).
91: *
92: * @param address TRUE if address list, FALSE if routing changed
93: * @return TRUE to remain registered, FALSE to unregister
94: */
95: bool (*roam)(kernel_listener_t *this, bool address);
96:
97: /**
98: * Hook called after a TUN device was created for a virtual IP address, or
99: * before such a device gets destroyed.
100: *
101: * @param tun TUN device
102: * @param created TRUE if created, FALSE if going to be destroyed
103: */
104: bool (*tun)(kernel_listener_t *this, tun_device_t *tun, bool created);
105: };
106:
107: #endif /** KERNEL_LISTENER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>