]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libstrongswan/plugins/pkcs11/pkcs11_manager.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / plugins / pkcs11 / pkcs11_manager.h
CommitLineData
2e209bec
MW
1/*
2 * Copyright (C) 2010 Martin Willi
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
2e209bec
MW
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17/**
18 * @defgroup pkcs11_manager pkcs11_manager
19 * @{ @ingroup pkcs11
20 */
21
22#ifndef PKCS11_MANAGER_H_
23#define PKCS11_MANAGER_H_
24
25typedef struct pkcs11_manager_t pkcs11_manager_t;
26
fdd7e212
MW
27#include <library.h>
28
29#include "pkcs11_library.h"
30
31/**
32 * Token event callback function.
33 *
34 * @param data user supplied data, as passed to pkcs11_manager_create()
35 * @param p11 loaded PKCS#11 library token belongs to
f3bb1bd0 36 * @param slot slot number the event occurred in
fdd7e212
MW
37 * @param add TRUE if token was added to the slot, FALSE if removed
38 */
39typedef void (*pkcs11_manager_token_event_t)(void *data, pkcs11_library_t *p11,
40 CK_SLOT_ID slot, bool add);
41
42
2e209bec
MW
43/**
44 * Manages multiple PKCS#11 libraries with hot pluggable slots
45 */
46struct pkcs11_manager_t {
47
36c852a0
MW
48 /**
49 * Create an enumerator over all tokens.
50 *
51 * @return enumerator over (pkcs11_library_t*,CK_SLOT_ID)
52 */
53 enumerator_t* (*create_token_enumerator)(pkcs11_manager_t *this);
54
2e209bec
MW
55 /**
56 * Destroy a pkcs11_manager_t.
57 */
58 void (*destroy)(pkcs11_manager_t *this);
59};
60
61/**
62 * Create a pkcs11_manager instance.
36c852a0
MW
63 *
64 * @param cb token event callback function
65 * @param data user data to pass to token event callback
66 * @return instance
2e209bec 67 */
fdd7e212
MW
68pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb,
69 void *data);
2e209bec
MW
70
71#endif /** PKCS11_MANAGER_H_ @}*/