child-create: Update CHILD_SA IP addresses before installation
[strongswan.git] / src / libipsec / ipsec_event_relay.h
1 /*
2 * Copyright (C) 2012 Giuliano Grassi
3 * Copyright (C) 2012 Ralf Sager
4 * HSR Hochschule fuer Technik Rapperswil
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 ipsec_event_relay ipsec_event_relay
19 * @{ @ingroup libipsec
20 */
21
22 #ifndef IPSEC_EVENT_RELAY_H_
23 #define IPSEC_EVENT_RELAY_H_
24
25 #include "ipsec_event_listener.h"
26
27 #include <library.h>
28
29 typedef struct ipsec_event_relay_t ipsec_event_relay_t;
30
31 /**
32 * Event relay manager.
33 *
34 * Used to notify upper layers about changes
35 */
36 struct ipsec_event_relay_t {
37
38 /**
39 * Raise an expire event.
40 *
41 * @param protocol protocol (e.g ESP) of the expired SA
42 * @param spi SPI of the expired SA
43 * @param dst destination address of expired SA
44 * @param hard TRUE for a hard expire, FALSE otherwise
45 */
46 void (*expire)(ipsec_event_relay_t *this, uint8_t protocol, uint32_t spi,
47 host_t *dst, bool hard);
48
49 /**
50 * Register a listener to events raised by this manager
51 *
52 * @param listener the listener to register
53 */
54 void (*register_listener)(ipsec_event_relay_t *this,
55 ipsec_event_listener_t *listener);
56
57 /**
58 * Unregister a listener
59 *
60 * @param listener the listener to unregister
61 */
62 void (*unregister_listener)(ipsec_event_relay_t *this,
63 ipsec_event_listener_t *listener);
64
65 /**
66 * Destroy an ipsec_event_relay_t
67 */
68 void (*destroy)(ipsec_event_relay_t *this);
69
70 };
71
72 /**
73 * Create an ipsec_event_relay_t instance
74 *
75 * @return IPsec event relay instance
76 */
77 ipsec_event_relay_t *ipsec_event_relay_create();
78
79 #endif /** IPSEC_EVENT_RELAY_H_ @}*/