Wait for a slot event like smart card insertion or removal
Namespace:
Cryptware.NCryptokiAssembly: NCryptoki (in NCryptoki.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function WaitForSlotEvent ( _ flags As Integer _ ) As Slot |
C# |
---|
public Slot WaitForSlotEvent( int flags ) |
Visual C++ |
---|
public: virtual Slot^ WaitForSlotEvent( int flags ) sealed |
JavaScript |
---|
function waitForSlotEvent(flags); |
Parameters
- flags
- Type: System..::..Int32
Flags specifing behaviour: CKF_DONT_BLOCK returns without waiting for a slot event
Return Value
The slot where the event occuredImplements
ICryptoki..::..WaitForSlotEvent(Int32)
Remarks
WaitForSlotEvent waits for a slot event, such as token insertion or token removal, to
occur. flags determines whether or not the WaitForSlotEvent call blocks (i.e., waits
for a slot event to occur);
At present, the only flag defined for use in the flags argument is CKF_DONT_BLOCK:
Internally, each Cryptoki application has a flag for each slot which is used to track
whether or not any unrecognized events involving that slot have occurred. When an
application initially calls Initialize, every slot’s event flag is cleared. Whenever a slot
event occurs, the flag corresponding to the slot in which the event occurred is set.
If WaitForSlotEvent is called with the CKF_DONT_BLOCK flag set in the flags
argument, and some slot’s event flag is set, then that event flag is cleared, and the call
returns with the ID of that slot in the location pointed to by pSlot. If more than one slot’s
event flag is set at the time of the call, one such slot is chosen by the library to have its
event flag cleared and to have its slot ID returned.
If WaitForSlotEvent is called with the CKF_DONT_BLOCK flag set in the flags
argument, and no slot’s event flag is set, then the call returns with the value
CKR_NO_EVENT. In this case, the contents of the location pointed to by pSlot when
WaitForSlotEvent are undefined.
If WaitForSlotEvent is called with the CKF_DONT_BLOCK flag clear in the flags argument, then the call behaves as above, except that it will block. That is, if no slot’s event flag is set at the time of the call, WaitForSlotEvent will wait until some slot’s event flag becomes set. If a thread of an application has a WaitForSlotEvent call blocking when another thread of that application calls Finalize, the WaitForSlotEvent throws an exception with the value CKR_CRYPTOKI_NOT_INITIALIZED.
If WaitForSlotEvent is called with the CKF_DONT_BLOCK flag clear in the flags argument, then the call behaves as above, except that it will block. That is, if no slot’s event flag is set at the time of the call, WaitForSlotEvent will wait until some slot’s event flag becomes set. If a thread of an application has a WaitForSlotEvent call blocking when another thread of that application calls Finalize, the WaitForSlotEvent throws an exception with the value CKR_CRYPTOKI_NOT_INITIALIZED.
Exceptions
Exception | Condition |
---|---|
Cryptware.NCryptoki..::..CryptokiException | CryptokiException if a native error occurs |