1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/cryptotokenfw/inc/ct/tcttokenhandle.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,114 @@
1.4 +/*
1.5 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __TCTTOKENHANDLE_H__
1.29 +#define __TCTTOKENHANDLE_H__
1.30 +
1.31 +#include <e32std.h>
1.32 +
1.33 +
1.34 +/**
1.35 + * Defines a handle to a subclass of the MCTToken class.
1.36 + *
1.37 + * The handle identifies the class, not a particular instance of that class.
1.38 + * It is guaranteed to be unique within the context of a specific device (e.g.
1.39 + * mobile phone, etc.).
1.40 + *
1.41 + * The handle is especially useful for communication across process boundaries.
1.42 + * For example: a process (A) can open a token (T), get a handle to it and then
1.43 + * give the handle to another process (B). This process (B) can then try to open
1.44 + * the token (T) using that handle.
1.45 + *
1.46 + * @since v7.0
1.47 + */
1.48 +class TCTTokenHandle
1.49 + {
1.50 +public:
1.51 + /**
1.52 + * Creates an invalid handle for the token.
1.53 + *
1.54 + * An invalid handle has a iTokenTypeUid and a iTokenId equal to 0.
1.55 + */
1.56 + IMPORT_C TCTTokenHandle();
1.57 +
1.58 + /**
1.59 + * Creates a handle for the token.
1.60 + *
1.61 + * @param aTokenTypeUid The value of the TokenType Uid.
1.62 + * @param aTokenId The identity of the Token.
1.63 + */
1.64 + IMPORT_C TCTTokenHandle(TUid aTokenTypeUid, TInt aTokenId);
1.65 +
1.66 + /** The copy constructor.
1.67 + *
1.68 + * @param aTokenHandle The Token Handle object to copy
1.69 + */
1.70 + IMPORT_C TCTTokenHandle(const TCTTokenHandle& aTokenHandle);
1.71 +
1.72 + /**
1.73 + * Equality operator.
1.74 + *
1.75 + * Tests whether this Token Handle object is equal to the specified
1.76 + * Token Handle object.
1.77 + *
1.78 + * @param aTokenHandle The Token Handle object to be compared.
1.79 + * @return ETrue, if this Token Handle object is equal to
1.80 + * the specified Token Handle object; EFalse otherwise.
1.81 + */
1.82 + IMPORT_C TBool operator ==(const TCTTokenHandle& aTokenHandle) const;
1.83 +
1.84 + /**
1.85 + * Inequality operator.
1.86 + *
1.87 + * Tests whether this Token Handle object is not equal to the specified
1.88 + * Token Handle object.
1.89 + *
1.90 + * @param aTokenHandle The Token Handle object to be compared.
1.91 + * @return ETrue, if this Token Handle object is not equal to
1.92 + * the specified Token Handle object; EFalse, otherwise.
1.93 + */
1.94 + inline TBool operator !=(const TCTTokenHandle& aTokenHandle) const;
1.95 +
1.96 +public:
1.97 + /**
1.98 + * The UID of the TokenType.
1.99 + *
1.100 + * This identifies to which TokenType the Token belongs.
1.101 + */
1.102 + TUid iTokenTypeUid;
1.103 +
1.104 + /**
1.105 + * The identity of the Token.
1.106 + *
1.107 + * This Id is unique within the context of a TokenType.
1.108 + */
1.109 + TInt iTokenId;
1.110 + };
1.111 +
1.112 +inline TBool TCTTokenHandle::operator !=(const TCTTokenHandle& aTokenHandle) const
1.113 + {
1.114 + return !(*this == aTokenHandle);
1.115 + }
1.116 +
1.117 +#endif