implemented xauth as a pluto plugin
[strongswan.git] / src / pluto / xauth / xauth_manager.h
1 /*
2 * Copyright (C) 2010 Andreas Steffen
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 xauth_manager xauth_manager
18 * @{ @ingroup xauth
19 */
20
21 #ifndef XAUTH_MANAGER_H_
22 #define XAUTH_MANAGER_H_
23
24 #include "xauth_provider.h"
25 #include "xauth_verifier.h"
26
27 typedef struct xauth_manager_t xauth_manager_t;
28
29 /**
30 * An xauth_manager registers xauth_providers and xauth_verifiers.
31 */
32 struct xauth_manager_t {
33
34 /**
35 * Register an xauth_provider
36 *
37 * @param provider xauth_provider to be registered
38 */
39 void (*add_provider)(xauth_manager_t *this, xauth_provider_t *provider);
40
41 /**
42 * Register an xauth_verifier
43 *
44 * @param verifier xauth_verifier to be registered
45 */
46 void (*add_verifier)(xauth_manager_t *this, xauth_verifier_t *verifier);
47
48 /**
49 * Use registered providers to retrieve an XAUTH user secret
50 * based on connection information.
51 *
52 * @param c connection information
53 * @param secret secret if found, chunk_empty otherwise
54 * @return TRUE if a matching secret was found
55 */
56 bool (*get_secret)(xauth_manager_t *this, connection_t *c, chunk_t *secret);
57
58 /**
59 * Use registered verifiers to verify an XAUTH user secret
60 * based on connection information
61 *
62 * @param c connection information
63 * @param secret secret to be compared
64 * @return TRUE if secret matches
65 */
66 bool (*verify_secret)(xauth_manager_t *this, connection_t *c, chunk_t secret);
67
68 /**
69 * Destroy an xauth_verifier instance.
70 */
71 void (*destroy)(xauth_manager_t *this);
72 };
73
74 /**
75 * Create an xauth_manager instance.
76 */
77 xauth_manager_t *xauth_manager_create();
78
79 #endif /** XAUTH_MANAGER_H_ @}*/
80