os/security/cryptomgmtlibs/cryptotokenfw/inc/ct/tcttokenobjecthandle.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @publishedAll
sl@0
    22
 @released
sl@0
    23
*/
sl@0
    24
sl@0
    25
#ifndef __TCTTOKENOBJECTHANDLE_H__
sl@0
    26
#define __TCTTOKENOBJECTHANDLE_H__
sl@0
    27
sl@0
    28
#include <e32std.h>
sl@0
    29
#include <ct/tcttokenhandle.h>
sl@0
    30
sl@0
    31
sl@0
    32
/** 
sl@0
    33
 * Defines a handle to an object represented by a class which is a subclass of 
sl@0
    34
 * the MCTTokenObject class.
sl@0
    35
 * 
sl@0
    36
 * The handle identifies the object, not the instance of the subclass of MCTTokenObject 
sl@0
    37
 * used to manage that object. It is guaranteed to be unique within the context 
sl@0
    38
 * of a specific device (e.g. mobile phone, etc.) at a specific point in time. 
sl@0
    39
 * This limitation in time is due to the fact that objects can be created and 
sl@0
    40
 * destroyed. We cannot guarantee that a handle will still point to the same 
sl@0
    41
 * object after we add or remove one or more objects from the store from which 
sl@0
    42
 * the object comes. However, it is guaranteed that the addition of objects to 
sl@0
    43
 * the store will not affect the validity of the handles that were obtained previously. 
sl@0
    44
 * For instance, if the object is a certificate in a certificate store, the subclass 
sl@0
    45
 * of MCTTokenObject will be CCTCertInfo and the handle will identify the certificate 
sl@0
    46
 * in the certificate store, not the instance of CCTCertInfo.
sl@0
    47
 * 
sl@0
    48
 * The handle is especially useful for communication across process boundaries. 
sl@0
    49
 * For example: a process (A) can get a handle to an object, and then give the handle 
sl@0
    50
 * to another process (B). This process (B) can then try to get the same object using that handle. 
sl@0
    51
 *
sl@0
    52
 * @since v7.0 
sl@0
    53
 */
sl@0
    54
class TCTTokenObjectHandle
sl@0
    55
	{
sl@0
    56
public:
sl@0
    57
	/** 
sl@0
    58
	 * Creates an invalid handle.
sl@0
    59
	 *
sl@0
    60
	 * An invalid handle has an invalid iTokenHandle and an iObjectId equal to 0. 
sl@0
    61
	 */
sl@0
    62
	IMPORT_C TCTTokenObjectHandle();
sl@0
    63
	
sl@0
    64
	/** 
sl@0
    65
	 * Creates a handle.
sl@0
    66
	 *
sl@0
    67
	 * @param aTokenHandle	The handle that identifies the Token where the object 
sl@0
    68
	 * 						is stored.
sl@0
    69
	 * @param aObjectId		The identifier of the object within the Token. 
sl@0
    70
	 */
sl@0
    71
	IMPORT_C TCTTokenObjectHandle(TCTTokenHandle aTokenHandle, TInt aObjectId);
sl@0
    72
	
sl@0
    73
	/** 
sl@0
    74
	 * Copy Constructor.
sl@0
    75
	 *
sl@0
    76
	 * @param aTokenHandle	The handle to copy. 
sl@0
    77
	 */
sl@0
    78
	IMPORT_C TCTTokenObjectHandle(const TCTTokenObjectHandle& aTokenHandle);
sl@0
    79
	
sl@0
    80
	/** 
sl@0
    81
	 * Equality operator.
sl@0
    82
	 *
sl@0
    83
	 * Tests whether this TCTTokenObjectHandle object is equal to the specified 
sl@0
    84
	 * TCTTokenObjectHandle object.	
sl@0
    85
	 *
sl@0
    86
	 * @param aTokenHandle	The TCTTokenObjectHandle object to be compared.
sl@0
    87
	 * @return				ETrue, if thisTCTTokenObjectHandle object is equal to 
sl@0
    88
	 * 						the specified TCTTokenObjectHandle object; EFalse otherwise. 
sl@0
    89
	 */
sl@0
    90
	IMPORT_C TBool operator ==(const TCTTokenObjectHandle& aTokenHandle) const;
sl@0
    91
	
sl@0
    92
	/** Inequality operator */
sl@0
    93
	inline TBool operator !=(const TCTTokenObjectHandle& aTokenHandle) const;
sl@0
    94
 
sl@0
    95
 public:
sl@0
    96
	/** The handle that identifies the Token where the object is stored. */
sl@0
    97
	TCTTokenHandle iTokenHandle;
sl@0
    98
	
sl@0
    99
	/** 
sl@0
   100
	 * The identifier of the object within the Token.
sl@0
   101
	 *
sl@0
   102
	 * This is unique within the context of a particular Token and only at a specific 
sl@0
   103
	 * point in time. 
sl@0
   104
	 */
sl@0
   105
	TInt iObjectId;
sl@0
   106
	};
sl@0
   107
sl@0
   108
inline TBool TCTTokenObjectHandle::operator !=(const TCTTokenObjectHandle& aHandle) const
sl@0
   109
	{
sl@0
   110
	return !(*this == aHandle);
sl@0
   111
	}
sl@0
   112
sl@0
   113
#endif