2 * Copyright (c) 2013 Red Hat, Inc
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * * Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the
10 * following disclaimer.
11 * * Redistributions in binary form must reproduce the
12 * above copyright notice, this list of conditions and
13 * the following disclaimer in the documentation and/or
14 * other materials provided with the distribution.
15 * * The names of contributors to this software may not be
16 * used to endorse or promote products derived from this
17 * software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
29 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32 * Author: Stef Walter <stefw@redhat.com>
35 #ifndef P11_KIT_ITER_H
36 #define P11_KIT_ITER_H
38 #include "p11-kit/p11-kit.h"
39 #include "p11-kit/pkcs11.h"
40 #include "p11-kit/uri.h"
46 #ifdef P11_KIT_FUTURE_UNSTABLE_API
48 typedef struct p11_kit_iter P11KitIter
;
49 typedef P11KitIter p11_kit_iter
;
52 P11_KIT_ITER_BUSY_SESSIONS
= 1 << 1,
53 P11_KIT_ITER_WANT_WRITABLE
= 1 << 2,
56 typedef CK_RV (* p11_kit_iter_callback
) (P11KitIter
*iter
,
60 P11KitIter
* p11_kit_iter_new (P11KitUri
*uri
,
61 P11KitIterBehavior behavior
);
63 void p11_kit_iter_free (P11KitIter
*iter
);
65 void p11_kit_iter_add_callback (P11KitIter
*iter
,
66 p11_kit_iter_callback callback
,
68 p11_kit_destroyer callback_destroy
);
70 void p11_kit_iter_add_filter (P11KitIter
*iter
,
71 CK_ATTRIBUTE
*matching
,
74 void p11_kit_iter_set_uri (P11KitIter
*iter
,
77 void p11_kit_iter_begin (P11KitIter
*iter
,
78 CK_FUNCTION_LIST_PTR
*modules
);
80 void p11_kit_iter_begin_with (P11KitIter
*iter
,
81 CK_FUNCTION_LIST_PTR module
,
83 CK_SESSION_HANDLE session
);
85 CK_RV
p11_kit_iter_next (P11KitIter
*iter
);
87 CK_FUNCTION_LIST_PTR
p11_kit_iter_get_module (P11KitIter
*iter
);
89 CK_SLOT_ID
p11_kit_iter_get_slot (P11KitIter
*iter
);
91 CK_TOKEN_INFO
* p11_kit_iter_get_token (P11KitIter
*iter
);
93 CK_SESSION_HANDLE
p11_kit_iter_get_session (P11KitIter
*iter
);
95 CK_OBJECT_HANDLE
p11_kit_iter_get_object (P11KitIter
*iter
);
97 CK_RV
p11_kit_iter_get_attributes (P11KitIter
*iter
,
98 CK_ATTRIBUTE
*template,
101 CK_RV
p11_kit_iter_load_attributes (P11KitIter
*iter
,
102 CK_ATTRIBUTE
*template,
105 CK_SESSION_HANDLE
p11_kit_iter_keep_session (P11KitIter
*iter
);
107 CK_RV
p11_kit_iter_destroy_object (P11KitIter
*iter
);
109 #endif /* P11_KIT_FUTURE_UNSTABLE_API */
115 #endif /* P11_KIT_ITER_H */