]> git.ipfire.org Git - thirdparty/strongswan.git/blame - programs/charon/charon/sa/ike_sa_id.h
- import of strongswan-2.7.0
[thirdparty/strongswan.git] / programs / charon / charon / sa / ike_sa_id.h
CommitLineData
53f7a5f8 1/**
31732357 2 * @file ike_sa_id.h
c3dc6f1a 3 *
d048df5c 4 * @brief Interface of ike_sa_id_t.
c3dc6f1a 5 *
53f7a5f8
JH
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
16b9a73c
MW
24#ifndef IKE_SA_ID_H_
25#define IKE_SA_ID_H_
f7cf9f61
JH
26
27#include <types.h>
53f7a5f8 28
53f7a5f8 29
5796aa16
MW
30typedef struct ike_sa_id_t ike_sa_id_t;
31
53f7a5f8 32/**
f7cf9f61 33 * @brief An object of type ike_sa_id_t is used to identify an IKE_SA.
c3dc6f1a 34 *
53f7a5f8 35 * An IKE_SA is identified by its initiator and responder spi's.
c3dc6f1a 36 * Additionaly it contains the role of the actual running IKEv2-Daemon
f7cf9f61
JH
37 * for the specific IKE_SA (original initiator or responder).
38 *
39 * @b Constructors:
40 * - ike_sa_id_create()
df3c59d0
MW
41 *
42 * @ingroup sa
53f7a5f8 43 */
5796aa16 44struct ike_sa_id_t {
53f7a5f8
JH
45
46 /**
f7cf9f61 47 * @brief Set the SPI of the responder.
c3dc6f1a 48 *
53f7a5f8 49 * This function is called when a request or reply of a IKE_SA_INIT is received.
c3dc6f1a 50 *
f7cf9f61 51 * @param this calling object
d048df5c 52 * @param responder_spi SPI of responder to set
53f7a5f8 53 */
d048df5c 54 void (*set_responder_spi) (ike_sa_id_t *this, u_int64_t responder_spi);
c3dc6f1a 55
472217f1 56 /**
f7cf9f61 57 * @brief Set the SPI of the initiator.
c3dc6f1a 58 *
f7cf9f61 59 * @param this calling object
d048df5c 60 * @param initiator_spi SPI to set
472217f1 61 */
d048df5c 62 void (*set_initiator_spi) (ike_sa_id_t *this, u_int64_t initiator_spi);
53f7a5f8
JH
63
64 /**
f7cf9f61 65 * @brief Get the initiator SPI.
c3dc6f1a 66 *
f7cf9f61
JH
67 * @param this calling object
68 * @return SPI of the initiator
53f7a5f8 69 */
7b3d1389 70 u_int64_t (*get_initiator_spi) (ike_sa_id_t *this);
53f7a5f8
JH
71
72 /**
f7cf9f61 73 * @brief Get the responder SPI.
c3dc6f1a 74 *
f7cf9f61
JH
75 * @param this calling object
76 * @return SPI of the responder
53f7a5f8 77 */
7b3d1389 78 u_int64_t (*get_responder_spi) (ike_sa_id_t *this);
c3dc6f1a 79
53f7a5f8 80 /**
f7cf9f61
JH
81 * @brief Check if two ike_sa_id_t objects are equal.
82 *
83 * Two ike_sa_id_t objects are equal if both SPI values and the role matches.
c3dc6f1a 84 *
f7cf9f61
JH
85 * @param this calling object
86 * @param other ike_sa_id_t object to check if equal
87 * @return TRUE if given ike_sa_id_t are equal, FALSE otherwise
53f7a5f8 88 */
d048df5c 89 bool (*equals) (ike_sa_id_t *this, ike_sa_id_t *other);
c3dc6f1a 90
2598643a 91 /**
f7cf9f61 92 * @brief Replace all values of a given ike_sa_id_t object with values.
d048df5c 93 * from another ike_sa_id_t object.
f7cf9f61
JH
94 *
95 * After calling this function, both objects are equal.
c3dc6f1a 96 *
f7cf9f61
JH
97 * @param this calling object
98 * @param other ike_sa_id_t object from which values will be taken
8491b298 99 */
d048df5c 100 void (*replace_values) (ike_sa_id_t *this, ike_sa_id_t *other);
c3dc6f1a 101
472217f1 102 /**
f7cf9f61 103 * @brief Get the initiator flag.
c3dc6f1a 104 *
f7cf9f61 105 * @param this calling object
d048df5c 106 * @return TRUE if we are the original initator
7b3d1389
MW
107 */
108 bool (*is_initiator) (ike_sa_id_t *this);
109
110 /**
f7cf9f61 111 * @brief Switche the original initiator flag.
7b3d1389 112 *
f7cf9f61
JH
113 * @param this calling object
114 * @return TRUE if we are the original initator after switch, FALSE otherwise
472217f1 115 */
7b3d1389 116 bool (*switch_initiator) (ike_sa_id_t *this);
c3dc6f1a 117
8491b298 118 /**
d048df5c 119 * @brief Clones a given ike_sa_id_t object.
c3dc6f1a 120 *
f7cf9f61
JH
121 * @param this calling object
122 * @return cloned ike_sa_id_t object
2598643a 123 */
d048df5c 124 ike_sa_id_t *(*clone) (ike_sa_id_t *this);
53f7a5f8
JH
125
126 /**
f7cf9f61 127 * @brief Destroys an ike_sa_id_t object.
c3dc6f1a 128 *
f7cf9f61 129 * @param this calling object
53f7a5f8 130 */
d048df5c 131 void (*destroy) (ike_sa_id_t *this);
53f7a5f8
JH
132};
133
134/**
f7cf9f61 135 * @brief Creates an ike_sa_id_t object with specific SPI's and defined role.
c3dc6f1a 136 *
f7cf9f61
JH
137 * @param initiator_spi initiators SPI
138 * @param responder_spi responders SPI
19f78a6f 139 * @param is_initiaor TRUE if we are the original initiator
f7cf9f61 140 * @return ike_sa_id_t object
df3c59d0
MW
141 *
142 * @ingroup sa
53f7a5f8 143 */
91443667 144ike_sa_id_t * ike_sa_id_create(u_int64_t initiator_spi, u_int64_t responder_spi, bool is_initiaor);
53f7a5f8 145
16b9a73c 146#endif /*IKE_SA_ID_H_*/