2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 #ifndef __TCTTOKENOBJECTHANDLE_H__
26 #define __TCTTOKENOBJECTHANDLE_H__
29 #include <ct/tcttokenhandle.h>
33 * Defines a handle to an object represented by a class which is a subclass of
34 * the MCTTokenObject class.
36 * The handle identifies the object, not the instance of the subclass of MCTTokenObject
37 * used to manage that object. It is guaranteed to be unique within the context
38 * of a specific device (e.g. mobile phone, etc.) at a specific point in time.
39 * This limitation in time is due to the fact that objects can be created and
40 * destroyed. We cannot guarantee that a handle will still point to the same
41 * object after we add or remove one or more objects from the store from which
42 * the object comes. However, it is guaranteed that the addition of objects to
43 * the store will not affect the validity of the handles that were obtained previously.
44 * For instance, if the object is a certificate in a certificate store, the subclass
45 * of MCTTokenObject will be CCTCertInfo and the handle will identify the certificate
46 * in the certificate store, not the instance of CCTCertInfo.
48 * The handle is especially useful for communication across process boundaries.
49 * For example: a process (A) can get a handle to an object, and then give the handle
50 * to another process (B). This process (B) can then try to get the same object using that handle.
54 class TCTTokenObjectHandle
58 * Creates an invalid handle.
60 * An invalid handle has an invalid iTokenHandle and an iObjectId equal to 0.
62 IMPORT_C TCTTokenObjectHandle();
67 * @param aTokenHandle The handle that identifies the Token where the object
69 * @param aObjectId The identifier of the object within the Token.
71 IMPORT_C TCTTokenObjectHandle(TCTTokenHandle aTokenHandle, TInt aObjectId);
76 * @param aTokenHandle The handle to copy.
78 IMPORT_C TCTTokenObjectHandle(const TCTTokenObjectHandle& aTokenHandle);
83 * Tests whether this TCTTokenObjectHandle object is equal to the specified
84 * TCTTokenObjectHandle object.
86 * @param aTokenHandle The TCTTokenObjectHandle object to be compared.
87 * @return ETrue, if thisTCTTokenObjectHandle object is equal to
88 * the specified TCTTokenObjectHandle object; EFalse otherwise.
90 IMPORT_C TBool operator ==(const TCTTokenObjectHandle& aTokenHandle) const;
92 /** Inequality operator */
93 inline TBool operator !=(const TCTTokenObjectHandle& aTokenHandle) const;
96 /** The handle that identifies the Token where the object is stored. */
97 TCTTokenHandle iTokenHandle;
100 * The identifier of the object within the Token.
102 * This is unique within the context of a particular Token and only at a specific
108 inline TBool TCTTokenObjectHandle::operator !=(const TCTTokenObjectHandle& aHandle) const
110 return !(*this == aHandle);