updated Doxyfile
[strongswan.git] / src / charon / sa / connect_manager.h
1 /*
2 * Copyright (C) 2007-2008 Tobias Brunner
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 * $Id$
16 */
17
18 /**
19 * @defgroup connect_manager connect_manager
20 * @{ @ingroup sa
21 */
22
23 #ifndef CONNECT_MANAGER_H_
24 #define CONNECT_MANAGER_H_
25
26 typedef struct connect_manager_t connect_manager_t;
27
28 #include <encoding/message.h>
29 #include <sa/ike_sa_id.h>
30 #include <utils/identification.h>
31
32 /**
33 * The connection manager is responsible for establishing a direct
34 * connection with another peer.
35 */
36 struct connect_manager_t {
37
38 /**
39 * Checks if a there is already a mediated connection registered
40 * between two peers.
41 *
42 * @param id my id
43 * @param peer_id the other peer's id
44 * @param mediated_sa the IKE_SA ID of the mediated connection
45 * @returns
46 * - TRUE, if there was already a mediated connection registered
47 * - FALSE, otherwise
48 */
49 bool (*check_and_register) (connect_manager_t *this,
50 identification_t *id, identification_t *peer_id, ike_sa_id_t *mediated_sa);
51
52 /**
53 * Checks if there are waiting connections with a specific peer.
54 * If so, reinitiate them.
55 *
56 * @param id my id
57 * @param peer_id the other peer's id
58 */
59 void (*check_and_initiate) (connect_manager_t *this, ike_sa_id_t *mediation_sa,
60 identification_t *id, identification_t *peer_id);
61
62 /**
63 * Creates a checklist and sets the initiator's data.
64 *
65 * @param initiator ID of the initiator
66 * @param responder ID of the responder
67 * @param connect_id the connect ID provided by the initiator
68 * @param key the initiator's key
69 * @param endpoints the initiator's endpoints
70 * @param is_initiator TRUE, if the caller of this method is the initiator
71 * FALSE, otherwise
72 * @returns SUCCESS
73 */
74 status_t (*set_initiator_data) (connect_manager_t *this,
75 identification_t *initiator, identification_t *responder,
76 chunk_t connect_id, chunk_t key, linked_list_t *endpoints, bool is_initiator);
77
78 /**
79 * Updates a checklist and sets the responder's data. The checklist's
80 * state is advanced to WAITING which means that checks will be sent.
81 *
82 * @param connect_id the connect ID
83 * @param chunk_t the responder's key
84 * @param endpoints the responder's endpoints
85 * @returns
86 * - NOT_FOUND, if the checklist has not been found
87 * - SUCCESS, otherwise
88 */
89 status_t (*set_responder_data) (connect_manager_t *this,
90 chunk_t connect_id, chunk_t key, linked_list_t *endpoints);
91
92 /**
93 * Stops checks for a checklist. Used after the responder received an IKE_SA_INIT
94 * request which contains a ME_CONNECTID payload.
95 *
96 * @param connect_id the connect ID
97 * @returns
98 * - NOT_FOUND, if the checklist has not been found
99 * - SUCCESS, otherwise
100 */
101 status_t (*stop_checks) (connect_manager_t *this, chunk_t connect_id);
102
103 /**
104 * Processes a connectivity check
105 *
106 * @param message the received message
107 */
108 void (*process_check) (connect_manager_t *this, message_t *message);
109
110 /**
111 * Destroys the manager with all data.
112 */
113 void (*destroy) (connect_manager_t *this);
114 };
115
116 /**
117 * Create a manager.
118 *
119 * @returns connect_manager_t object
120 */
121 connect_manager_t *connect_manager_create(void);
122
123 #endif /** CONNECT_MANAGER_H_ @}*/