e93d8cee222d844f21a2c8f58022845fefec6934
[strongswan.git] / src / charon / plugins / stroke / stroke_shared_key.h
1 /*
2 * Copyright (C) 2008 Martin Willi
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 * $Id$
16 */
17
18 /**
19 * @defgroup stroke_shared_key stroke_shared_key
20 * @{ @ingroup stroke
21 */
22
23 #ifndef STROKE_SHARED_KEY_H_
24 #define STROKE_SHARED_KEY_H_
25
26 #include <utils/identification.h>
27 #include <credentials/keys/shared_key.h>
28
29 typedef struct stroke_shared_key_t stroke_shared_key_t;
30
31 /**
32 * Shared key implementation for keys read from ipsec.secrets
33 */
34 struct stroke_shared_key_t {
35
36 /**
37 * Implements the shared_key_t interface.
38 */
39 shared_key_t shared;
40
41 /**
42 * Add an owner to the key.
43 *
44 * @param owner owner to add
45 */
46 void (*add_owner)(stroke_shared_key_t *this, identification_t *owner);
47
48 /**
49 * Check if a key has a specific owner.
50 *
51 * @param owner owner to check
52 * @return best match found
53 */
54 id_match_t (*has_owner)(stroke_shared_key_t *this, identification_t *owner);
55 };
56
57 /**
58 * Create a stroke_shared_key instance.
59 */
60 stroke_shared_key_t *stroke_shared_key_create(shared_key_type_t type, chunk_t key);
61
62 #endif /* STROKE_SHARED_KEY_H_ @}*/