Merge branch 'android-fixes'
[strongswan.git] / src / libcharon / sa / redirect_provider.h
1 /*
2 * Copyright (C) 2015 Tobias Brunner
3 * HSR 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 redirect_provider redirect_provider
18 * @{ @ingroup sa
19 */
20
21 #ifndef REDIRECT_PROVIDER_H_
22 #define REDIRECT_PROVIDER_H_
23
24 typedef struct redirect_provider_t redirect_provider_t;
25
26 #include <library.h>
27 #include <sa/ike_sa.h>
28
29 /**
30 * Interface that allows implementations to decide whether a client is
31 * redirected during IKE_SA_INIT or IKE_AUTH using RFC 5685.
32 */
33 struct redirect_provider_t {
34
35 /**
36 * Decide whether a client is redirect directly upon receipt of the
37 * IKE_SA_INIT message.
38 *
39 * @param ike_sa IKE_SA for which this is called
40 * @param gateway[out] new IKE gateway (IP or FQDN)
41 * @return TRUE if client should be redirected, FALSE otherwise
42 */
43 bool (*redirect_on_init)(redirect_provider_t *this, ike_sa_t *ike_sa,
44 identification_t **gateway);
45
46 /**
47 * Decide whether a client is redirect after the IKE_AUTH has been
48 * handled. This is called after the client is authenticated and when the
49 * server authenticates itself.
50 *
51 * @param ike_sa IKE_SA for which this is called
52 * @param gateway[out] new IKE gateway (IP or FQDN)
53 * @return TRUE if client should be redirected, FALSE otherwise
54 */
55 bool (*redirect_on_auth)(redirect_provider_t *this, ike_sa_t *ike_sa,
56 identification_t **gateway);
57 };
58
59 #endif /** REDIRECT_PROVIDER_H_ @}*/