Replace bools in public API with enums #54
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since we are already breaking assembly reference compatibility in #52 I am also going to explore the possibility of making API more user friendly.
This PR replaces several most annoying occurrences of
bool
type in public APIs withenum
types. I believe that code with enums is not only easier to write but most importantly it is much easier to read.Five new enums have been introduced:
1 - Net.Pkcs11Interop.Common.AppType
Previous code that initializes unmanaged PKCS#11 library in multi-threaded applications:
Current code that initializes unmanaged PKCS#11 library in multi-threaded applications:
2 - Net.Pkcs11Interop.Common.InitType
Previous code that initializes unmanaged PKCS#11 library with function pointers acquired with a single call of
C_GetFunctionList
function:Current code that initializes unmanaged PKCS#11 library with function pointers acquired with a single call of
C_GetFunctionList
function:3 - Net.Pkcs11Interop.Common.SlotsType
Previous code that obtains list of slots with token present:
Current code that obtains list of slots with token present:
4 - Net.Pkcs11Interop.Common.WaitType
Previous code that analyzes slot events in non-blocking mode:
Current code that analyzes slot events in non-blocking mode:
5 - Net.Pkcs11Interop.Common.SessionType
Previous code that opens new read-only session:
Current code that opens new read-only session: