Removed strayed code fragment
[strongswan.git] / src / charon / sa / tasks / ike_me.h
1 /*
2 * Copyright (C) 2007 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
16 /**
17 * @defgroup ike_me ike_me
18 * @{ @ingroup tasks
19 */
20
21 #ifndef IKE_ME_H_
22 #define IKE_ME_H_
23
24 typedef struct ike_me_t ike_me_t;
25
26 #include <library.h>
27 #include <sa/ike_sa.h>
28 #include <sa/tasks/task.h>
29
30 /**
31 * Task of type IKE_ME, detects and handles IKE-ME extensions.
32 *
33 * This tasks handles the ME_MEDIATION Notify exchange to setup a mediation
34 * connection, allows to initiate mediated connections using ME_CONNECT
35 * exchanges and to request reflexive addresses from the mediation server using
36 * ME_ENDPOINT notifies.
37 *
38 * @note This task has to be activated before the IKE_AUTH task, because that
39 * task generates the IKE_SA_INIT message so that no more payloads can be added
40 * to it afterwards.
41 */
42 struct ike_me_t {
43 /**
44 * Implements the task_t interface
45 */
46 task_t task;
47
48 /**
49 * Initiates a connection with another peer (i.e. sends a ME_CONNECT
50 * to the mediation server)
51 *
52 * @param peer_id ID of the other peer (gets cloned)
53 */
54 void (*connect)(ike_me_t *this, identification_t *peer_id);
55
56 /**
57 * Responds to a ME_CONNECT from another peer (i.e. sends a ME_CONNECT
58 * to the mediation server)
59 *
60 * Data gets cloned.
61 *
62 * @param peer_id ID of the other peer
63 * @param connect_id the connect ID as provided by the initiator
64 */
65 void (*respond)(ike_me_t *this, identification_t *peer_id,
66 chunk_t connect_id);
67
68 /**
69 * Sends a ME_CALLBACK to a peer that previously requested some other peer.
70 *
71 * @param peer_id ID of the other peer (gets cloned)
72 */
73 void (*callback)(ike_me_t *this, identification_t *peer_id);
74
75 /**
76 * Relays data to another peer (i.e. sends a ME_CONNECT to the peer)
77 *
78 * Data gets cloned.
79 *
80 * @param requester ID of the requesting peer
81 * @param connect_id content of the ME_CONNECTID notify
82 * @param connect_key content of the ME_CONNECTKEY notify
83 * @param endpoints endpoints
84 * @param response TRUE if this is a response
85 */
86 void (*relay)(ike_me_t *this, identification_t *requester,
87 chunk_t connect_id, chunk_t connect_key,
88 linked_list_t *endpoints, bool response);
89 };
90
91 /**
92 * Create a new ike_me task.
93 *
94 * @param ike_sa IKE_SA this task works for
95 * @param initiator TRUE if task is initiated by us
96 * @return ike_me task to be handled by the task_manager
97 */
98 ike_me_t *ike_me_create(ike_sa_t *ike_sa, bool initiator);
99
100 #endif /** IKE_ME_H_ @}*/