certificate_t->issued_by takes an argument to receive signature scheme
[strongswan.git] / src / libstrongswan / credentials / sets / callback_cred.h
1 /*
2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
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 callback_cred callback_cred
18 * @{ @ingroup sets
19 */
20
21 #ifndef CALLBACK_CRED_H_
22 #define CALLBACK_CRED_H_
23
24 typedef struct callback_cred_t callback_cred_t;
25
26 #include <credentials/credential_set.h>
27
28 /**
29 * Callback function to get shared keys.
30 *
31 * @param type type of requested shared key
32 * @param me own identity
33 * @param other other identity
34 * @param match_me match result of own identity
35 * @param match_other match result of other identity
36 */
37 typedef shared_key_t* (*callback_cred_shared_cb_t)(
38 void *data, shared_key_type_t type,
39 identification_t *me, identification_t *other,
40 id_match_t *match_me, id_match_t *match_other);
41
42 /**
43 * Generic callbcack using user specified callback functions.
44 */
45 struct callback_cred_t {
46
47 /**
48 * Implements credential_set_t.
49 */
50 credential_set_t set;
51
52 /**
53 * Destroy a callback_cred_t.
54 */
55 void (*destroy)(callback_cred_t *this);
56 };
57
58 /**
59 * Create a callback_cred instance, for a shared key.
60 *
61 * @param cb callback function
62 * @param data data to pass to callback
63 */
64 callback_cred_t *callback_cred_create_shared(callback_cred_shared_cb_t cb,
65 void *data);
66
67 #endif /** CALLBACK_CRED_H_ @}*/