class MCTToken |
The base class for a token.
Token types must implement this class. It is created from a MCTTokenType using MCTTokenType::OpenToken().
A token represents one instance of a particular kind of cryptographic module; for instance, on a device with two WIMs, each WIM is a token. The token contains several interfaces, representing particular kinds of functions supported by the token (e.g. certificate management, key management, etc.)
v7.0
Public Member Functions | |
---|---|
void | AddRef() |
IMPORT_C void | CancelGetInterface() |
IMPORT_C void | CancelNotify() |
IMPORT_C void | GetInterface(TUid, MCTTokenInterface *&, TRequestStatus &) |
TCTTokenHandle | Handle() |
const TDesC & | Information(TTokenInformation) |
const TDesC & | Label() |
IMPORT_C void | NotifyOnRemoval(TRequestStatus &) |
IMPORT_C void | Release() |
MCTTokenType & | TokenType() |
Protected Member Functions | |
---|---|
~MCTToken() | |
TBool | DoCancelGetInterface() |
void | DoGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &) |
IMPORT_C void | DoRelease() |
TInt & | ReferenceCount() |
Private Member Functions | |
---|---|
void | ObjectCreated() |
Public Member Enumerations | |
---|---|
enum | TTokenInformation { EVersion, ESerialNo, EManufacturer } |
~MCTToken | ( | ) | [protected, inline, pure virtual] |
The destructor is protected so that users of the interface have to use the Release() function.
Destructor.
Frees all resources owned by the object, prior to its destruction.
void | AddRef | ( | ) | [inline] |
Allows the client to add a reference to the token (for example, when a reference to a token is copied elsewhere).
Does not need to be called if token is referenced through OpenToken().
IMPORT_C void | CancelGetInterface | ( | ) |
Cancels an asynchronous GetInterface() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelNotify | ( | ) | [virtual] |
Cancels an asynchronous NotifyOnRemoval() operation.
The operation completes with KErrCancel.
TBool | DoCancelGetInterface | ( | ) | [protected, pure virtual] |
Implements an asynchronous CancelGetInterface() request.
ETrue if there is an token interface running; EFalse, otherwise.
void | DoGetInterface | ( | TUid | aRequiredInterface, |
MCTTokenInterface *& | aReturnedInterface, | |||
TRequestStatus & | aStatus | |||
) | [protected, pure virtual] |
Implementation for getting a token interface.
This is called by GetInterface().
This is an asynchronous request.
TUid aRequiredInterface | The UID of the interface that should be returned. |
MCTTokenInterface *& aReturnedInterface | On success, this will be set to a pointer to the returned interface. |
TRequestStatus & aStatus | The request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled. |
IMPORT_C void | DoRelease | ( | ) | [protected, virtual] |
Destroys the token object.
This function is called when Release() has determined that the object is ready to be destroyed.
The default implementation just does a 'delete this', but classes can override that if they want different behaviour.
It should destroy the token; it MUST NOT release the token type, as Release() will do that.
IMPORT_C void | GetInterface | ( | TUid | aRequiredInterface, |
MCTTokenInterface *& | aReturnedInterface, | |||
TRequestStatus & | aStatus | |||
) |
Gets a token interface, or NULL if it's not supported by this token.
This is an asynchronous request.
TUid aRequiredInterface | The UID of the interface that should be returned. |
MCTTokenInterface *& aReturnedInterface | On success, this will be set to a pointer to the returned interface. |
TRequestStatus & aStatus | The request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled. |
TCTTokenHandle | Handle | ( | ) | [pure virtual] |
Gets the token's handle.
This can be used to identify a token to another process.
See the documentation of TCTTokenHandle for an explanation of the use of token handles.
The handle of the token.
const TDesC & | Information | ( | TTokenInformation | aRequiredInformation | ) | [pure virtual] |
Gets the specified information string about the token. The default implementation returns an empty descriptor.
TTokenInformation aRequiredInformation |
const TDesC & | Label | ( | ) | [pure virtual] |
Gets a label for the token.
This should be the same as the descriptor returned by MCTTokenType::List().
The label to the token type.
IMPORT_C void | NotifyOnRemoval | ( | TRequestStatus & | aStatus | ) | [virtual] |
Notifies the client when the token has been removed.
The base class assumes the token is not removable, and so does nothing. Removable tokens must implement these functions.
This is an asynchronous request.
TRequestStatus & aStatus | The request status object; contains the result of the NotifyOnRemoval() request when complete. Set to KErrCancel if an outstanding request is cancelled. |
TInt & | ReferenceCount | ( | ) | [protected, pure virtual] |
Gets a reference to the variable used as a reference counter.
The implementer should initialise this to 0. The value of the reference count should be treated as opaque by the implementer.
A reference to the variable used as a reference counter.
IMPORT_C void | Release | ( | ) |
Destroys the object.
The interface should be destroyed via this method as the destructor is protected.
The token implements reference counting, with one count for itself and one for every opened interface. Once the count reaches 0, it releases its count with the token type.
MCTTokenType & | TokenType | ( | ) | [pure virtual] |
Gets the associated token type.
The associated token type.