Moving charon to libcharon.
[strongswan.git] / src / libcharon / sa / mediation_manager.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 mediation_manager mediation_manager
18 * @{ @ingroup sa
19 */
20
21 #ifndef MEDIATION_MANAGER_H_
22 #define MEDIATION_MANAGER_H_
23
24 typedef struct mediation_manager_t mediation_manager_t;
25
26 #include <sa/ike_sa_id.h>
27 #include <utils/identification.h>
28
29 /**
30 * The mediation manager is responsible for managing currently online
31 * peers and registered requests for offline peers on the mediation server.
32 */
33 struct mediation_manager_t {
34
35 /**
36 * Remove the IKE_SA of a peer.
37 *
38 * @param ike_sa_id the IKE_SA ID of the peer's SA
39 */
40 void (*remove) (mediation_manager_t* this, ike_sa_id_t *ike_sa_id);
41
42 /**
43 * Update the ike_sa_id that is assigned to a peer's ID. If the peer
44 * is new, it gets a new record assigned.
45 *
46 * @param peer_id the peer's ID
47 * @param ike_sa_id the IKE_SA ID of the peer's SA
48 */
49 void (*update_sa_id) (mediation_manager_t* this, identification_t *peer_id,
50 ike_sa_id_t *ike_sa_id);
51
52 /**
53 * Checks if a specific peer is online.
54 *
55 * @param peer_id the peer's ID
56 * @returns
57 * - IKE_SA ID of the peer's SA.
58 * - NULL, if the peer is not online.
59 */
60 ike_sa_id_t* (*check) (mediation_manager_t* this,
61 identification_t *peer_id);
62
63 /**
64 * Checks if a specific peer is online and registers the requesting
65 * peer if it is not.
66 *
67 * @param peer_id the peer's ID
68 * @param requester the requesters ID
69 * @returns
70 * - IKE_SA ID of the peer's SA.
71 * - NULL, if the peer is not online.
72 */
73 ike_sa_id_t* (*check_and_register) (mediation_manager_t* this,
74 identification_t *peer_id,
75 identification_t *requester);
76
77 /**
78 * Destroys the manager with all data.
79 */
80 void (*destroy) (mediation_manager_t *this);
81 };
82
83 /**
84 * Create a manager.
85 *
86 * @returns mediation_manager_t object
87 */
88 mediation_manager_t *mediation_manager_create(void);
89
90 #endif /** MEDIATION_MANAGER_H_ @}*/