diff options
author | Daiki Ueno <dueno@redhat.com> | 2016-12-17 07:11:36 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2017-02-08 15:16:13 +0100 |
commit | 3d54011b0d0bf1b31fbab8d7025b7201722d61c3 (patch) | |
tree | 5390058367c7be9e3a532a3d3bdbd7a5452e6b1b /p11-kit/iter.h | |
parent | 77913af71be81208b4e9af68cd10bc55669543e1 (diff) |
iter: Enable iteration over slots/tokens/modules
While PKCS#11 URI can identify slots/tokens/modules, P11KitIter is only
capable of iterating over objects.
This patch adds new behaviors to P11KitIter to support iterations over
slots/tokens/modules, using the C coroutine trick as described in:
http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
Diffstat (limited to 'p11-kit/iter.h')
-rw-r--r-- | p11-kit/iter.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/p11-kit/iter.h b/p11-kit/iter.h index 3f51041..fabcd2f 100644 --- a/p11-kit/iter.h +++ b/p11-kit/iter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Red Hat, Inc + * Copyright (c) 2013,2016 Red Hat, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,8 +49,20 @@ typedef struct p11_kit_iter P11KitIter; typedef P11KitIter p11_kit_iter; typedef enum { + P11_KIT_ITER_KIND_MODULE, + P11_KIT_ITER_KIND_SLOT, + P11_KIT_ITER_KIND_TOKEN, + P11_KIT_ITER_KIND_OBJECT, + P11_KIT_ITER_KIND_UNKNOWN = -1, +} P11KitIterKind; + +typedef enum { P11_KIT_ITER_BUSY_SESSIONS = 1 << 1, P11_KIT_ITER_WANT_WRITABLE = 1 << 2, + P11_KIT_ITER_WITH_MODULES = 1 << 3, + P11_KIT_ITER_WITH_SLOTS = 1 << 4, + P11_KIT_ITER_WITH_TOKENS = 1 << 5, + P11_KIT_ITER_WITHOUT_OBJECTS = 1 << 6, } P11KitIterBehavior; typedef CK_RV (* p11_kit_iter_callback) (P11KitIter *iter, @@ -84,6 +96,8 @@ void p11_kit_iter_begin_with (P11KitIter *iter, CK_RV p11_kit_iter_next (P11KitIter *iter); +P11KitIterKind p11_kit_iter_get_kind (P11KitIter *iter); + CK_FUNCTION_LIST_PTR p11_kit_iter_get_module (P11KitIter *iter); CK_SLOT_ID p11_kit_iter_get_slot (P11KitIter *iter); |