b356017142c0c6999fcd6e8969e745aa76fa6ab6
[strongswan.git] / Source / charon / ike_sa.h
1 /**
2 * @file ike_sa.h
3 *
4 * @brief Class ike_sa_t. An object of this type is managed by an
5 * ike_sa_manager_t object and represents an IKE_SA
6 *
7 */
8
9 /*
10 * Copyright (C) 2005 Jan Hutter, Martin Willi
11 * Hochschule fuer Technik Rapperswil
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 */
23
24 #ifndef IKE_SA_H_
25 #define IKE_SA_H_
26
27 #include "types.h"
28 #include "message.h"
29 #include "configuration.h"
30 #include "ike_sa_id.h"
31
32 /**
33 * @brief This class is used to represent an IKE_SA
34 *
35 */
36 typedef struct ike_sa_s ike_sa_t;
37
38 struct ike_sa_s {
39
40 /**
41 * @brief Processes a incoming IKEv2-Message of type message_t
42 *
43 * @param this ike_sa_t object object
44 * @param[in] message message_t object to process
45 * @return SUCCESSFUL if succeeded, FAILED otherwise
46 */
47 status_t (*process_message) (ike_sa_t *this,message_t *message);
48
49 /**
50 * @brief Processes a specific configuration
51 *
52 * This function is called when a new IKE_SA is created
53 *
54 * @param this ike_sa_t-message_t object object
55 * @param[in] message message_t object to process
56 * @return SUCCESSFUL if succeeded, FAILED otherwise
57 */
58 status_t (*process_configuration) (ike_sa_t *this,configuration_t *configuration);
59
60 /**
61 * @brief Get the id of the SA
62 *
63 * @param this ike_sa_t-message_t object object
64 * @return ike_sa's ike_sa_id_t
65 */
66 ike_sa_id_t* (*get_id) (ike_sa_t *this);
67
68 /**
69 * @brief Destroys a ike_sa_t object
70 *
71 * @param this ike_sa_t object
72 * @return SUCCESSFUL if succeeded, FAILED otherwise
73 */
74 status_t (*destroy) (ike_sa_t *this);
75 };
76
77 /**
78 * Creates an ike_sa_t object with a specific ike_sa_id_t object
79 *
80 * @param[in] ike_sa_id ike_sa_id_t object to associate with new IKE_SA.
81 * The object is internal getting cloned
82 * and so has to be destroyed by the caller.
83 *
84 * @warning the Content of internal ike_sa_id_t object can change over time
85 * e.g. when a IKE_SA_INIT has been finished
86 *
87 * @return created ike_sa_t object
88 */
89 ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id);
90
91 #endif /*IKE_SA_H_*/