b88e3a46497625cd2c1af4f24391816cd0ae55ae
[strongswan.git] / src / charon / plugins / ha_sync / ha_sync_segments.h
1 /*
2 * Copyright (C) 2008 Martin Willi
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 *
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 ha_sync_segments ha_sync_segments
18 * @{ @ingroup ha_sync
19 */
20
21 #ifndef HA_SYNC_SEGMENTS_H_
22 #define HA_SYNC_SEGMENTS_H_
23
24 #include <daemon.h>
25
26 typedef struct ha_sync_segments_t ha_sync_segments_t;
27
28 /**
29 * Locally segmentsd HA state synced from other nodes.
30 */
31 struct ha_sync_segments_t {
32
33 /**
34 * Activate a set of IKE_SAs identified by a segments.
35 *
36 * Activating means do a takeover of SAs as the responsible node has failed.
37 * This involves moving all SAs to the daemons IKE_SA manager and handle
38 * them actively now.
39 *
40 * @param segment numerical segment to takeover, 0 for all
41 */
42 void (*activate)(ha_sync_segments_t *this, u_int segment);
43
44 /**
45 * Deactivate a set of IKE_SAs identified by a segments.
46 *
47 * @param segment numerical segment to takeover, 0 for all
48 */
49 void (*deactivate)(ha_sync_segments_t *this, u_int segment);
50
51 /**
52 * Resync an active segment.
53 *
54 * To reintegrade a node into the cluster, resynchronization is reqired.
55 * IKE_SAs and CHILD_SAs are synced automatically during rekeying. A call
56 * to this method enforces a rekeying immediately sync all state of a
57 * segment.
58 *
59 * @param segment segment to resync
60 */
61 void (*resync)(ha_sync_segments_t *this, u_int segment);
62
63 /**
64 * Destroy a ha_sync_segments_t.
65 */
66 void (*destroy)(ha_sync_segments_t *this);
67 };
68
69 /**
70 * Create a ha_sync_segments instance.
71 */
72 ha_sync_segments_t *ha_sync_segments_create();
73
74 #endif /* HA_SYNC_SEGMENTS_ @}*/