- added pluto includes
[strongswan.git] / Source / charon / ike_sa_id.h
1 /**
2 * @file ike_sa_id.h
3 *
4 * @brief Class for identification of an IKE_SA
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23
24 #ifndef IKE_SA_ID_H_
25 #define IKE_SA_ID_H_
26
27 #include <freeswan.h>
28 #include <pluto/constants.h>
29 #include <pluto/defs.h>
30
31 #include "types.h"
32
33 /**
34 * @brief This class is used to identify an IKE_SA.
35 *
36 * An IKE_SA is identified by its initiator and responder spi's.
37 * Additionaly it contains the role of the actual running IKEv2-Daemon
38 * for the specific IKE_SA.
39 */
40 typedef struct ike_sa_id_s ike_sa_id_t;
41
42 struct ike_sa_id_s {
43
44 /**
45 * @brief Sets the SPI of the responder.
46 *
47 * This function is called when a request or reply of a IKE_SA_INIT is received.
48 *
49 * @param this ike_sa_id_t-object
50 * @param responder_spi SPI of responder to set
51 * @return SUCCESSFUL if succeeded, FAILED otherwise
52 */
53 status_t (*set_responder_spi) (ike_sa_id_t *this, spi_t responder_spi);
54
55 /**
56 * @brief Returns TRUE if the initiator spi is set (not zero)
57 *
58 * @param this ike_sa_id_t-object
59 * @return TRUE if the initiator spi is set, FALSE otherwise
60 */
61 bool (*initiator_spi_is_set) (ike_sa_id_t *this);
62
63 /**
64 * @brief Returns TRUE if the responder spi is set (not zero)
65 *
66 * @param this ike_sa_id_t-object
67 * @return TRUE if the responder spi is set, FALSE otherwise
68 */
69 bool (*responder_spi_is_set) (ike_sa_id_t *this);
70
71 /**
72 * @brief Check if two ike_sa_ids are equal
73 *
74 * @param this ike_sa_id_t-object
75 * @param other ike_sa_id object to check if equal
76 * @param are_equal is set to TRUE, if given ike_sa_ids are equal, FALSE otherwise
77 * @return SUCCESSFUL if succeeded, FAILED otherwise
78 */
79 status_t (*equals) (ike_sa_id_t *this,ike_sa_id_t *other, bool *are_equal);
80
81 /**
82 * @brief Replace the values of a given ike_sa_id_t-object with values
83 * from another ike_sa_id_t-Object
84 *
85 * @param this ike_sa_id_t-object
86 * @param other ike_sa_id_t object which values will be taken
87 * @return SUCCESSFUL if succeeded, FAILED otherwise
88 */
89 status_t (*replace_values) (ike_sa_id_t *this,ike_sa_id_t *other);
90
91 /**
92 * @brief Clones a given ike_sa_id_t-object
93 *
94 * @param this ike_sa_id_t-object
95 * @param clone_of_this ike_sa_id_t-object which will be created
96 * @return SUCCESSFUL if succeeded, FAILED otherwise
97 */
98 status_t (*clone) (ike_sa_id_t *this,ike_sa_id_t **clone_of_this);
99
100 /**
101 * @brief Destroys a ike_sa_id_tobject
102 *
103 * @param this ike_sa_id_t-object
104 * @return SUCCESSFUL if succeeded, FAILED otherwise
105 */
106 status_t (*destroy) (ike_sa_id_t *this);
107 };
108
109 /**
110 * Creates an ike_sa_id_t-object with specific spi's and defined role
111 *
112 * @warning The initiator SPI and role is not changeable after initiating a ike_sa_id-object
113 */
114 ike_sa_id_t * ike_sa_id_create(spi_t initiator_spi, spi_t responder_spi,ike_sa_role_t role);
115
116 #endif /*IKE_SA_ID_H_*/