experimental P2P-NAT-T for IKEv2 merged back from branch
[strongswan.git] / src / charon / sa / mediation_manager.h
1 /**
2 * @file mediation_manager.h
3 *
4 * @brief Interface of mediation_manager_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 Tobias Brunner
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 #ifndef MEDIATION_MANAGER_H_
24 #define MEDIATION_MANAGER_H_
25
26 typedef struct mediation_manager_t mediation_manager_t;
27
28 #include <sa/ike_sa_id.h>
29 #include <utils/identification.h>
30
31 /**
32 * @brief The mediation manager is responsible for managing currently online
33 * peers and registered requests for offline peers on the mediation server.
34 *
35 * @b Constructors:
36 * - mediation_manager_create()
37 *
38 * @ingroup sa
39 */
40 struct mediation_manager_t {
41
42 /**
43 * @brief Remove the IKE_SA of a peer.
44 *
45 * @param this the manager object
46 * @param ike_sa_id the IKE_SA ID of the peer's SA
47 */
48 void (*remove) (mediation_manager_t* this, ike_sa_id_t *ike_sa_id);
49
50 /**
51 * @brief Update the ike_sa_id that is assigned to a peer's ID. If the peer
52 * is new, it gets a new record assigned.
53 *
54 * @param this the manager object
55 * @param peer_id the peer's ID
56 * @param ike_sa_id the IKE_SA ID of the peer's SA
57 */
58 void (*update_sa_id) (mediation_manager_t* this, identification_t *peer_id,
59 ike_sa_id_t *ike_sa_id);
60
61 /**
62 * @brief Checks if a specific peer is online.
63 *
64 * @param this the manager object
65 * @param peer_id the peer's ID
66 * @returns
67 * - IKE_SA ID of the peer's SA.
68 * - NULL, if the peer is not online.
69 */
70 ike_sa_id_t* (*check) (mediation_manager_t* this,
71 identification_t *peer_id);
72
73 /**
74 * @brief Checks if a specific peer is online and registers the requesting
75 * peer if it is not.
76 *
77 * @param this the manager object
78 * @param peer_id the peer's ID
79 * @param requester the requesters ID
80 * @returns
81 * - IKE_SA ID of the peer's SA.
82 * - NULL, if the peer is not online.
83 */
84 ike_sa_id_t* (*check_and_register) (mediation_manager_t* this,
85 identification_t *peer_id, identification_t *requester);
86
87 /**
88 * @brief Destroys the manager with all data.
89 *
90 * @param this the manager object
91 */
92 void (*destroy) (mediation_manager_t *this);
93 };
94
95 /**
96 * @brief Create a manager.
97 *
98 * @returns mediation_manager_t object
99 *
100 * @ingroup sa
101 */
102 mediation_manager_t *mediation_manager_create(void);
103
104 #endif /*MEDIATION_MANAGER_H_*/