00001 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // Contains the implementation of functions described in the RSecureSubSession class. 00015 // 00016 00017 00018 00023 #include "secureclientandserver.h" 00024 #include "secureclient.h" 00025 00031 TInt RSecureSubSession::Open(RSecureSession &aSession) 00032 { 00033 return CreateSubSession(aSession,ESecureServerCreateSubSession); 00034 } 00035 00039 void RSecureSubSession::Close() 00040 { 00041 RSubSessionBase::CloseSubSession(ESecureServerCloseSubSession); 00042 } 00043 00049 TInt RSecureSubSession::SetFromString(const TDesC& aString) 00050 { 00051 TIpcArgs args(&aString); 00052 return SendReceive(ESecureServerInitSubSession, args); 00053 } 00054 00058 void RSecureSubSession::Increase() 00059 { 00060 if (SubSessionHandle()) 00061 { 00062 SendReceive(ESecureServerIncrease); 00063 } 00064 } 00065 00070 void RSecureSubSession::IncreaseByL(TInt aInt) 00071 { 00072 if (SubSessionHandle()) 00073 { 00074 TIpcArgs args(aInt); 00075 User::LeaveIfError(SendReceive(ESecureServerIncreaseBy, args)); 00076 } 00077 } 00078 00082 void RSecureSubSession::Decrease() 00083 { 00084 if (SubSessionHandle()) 00085 { 00086 SendReceive(ESecureServerDecrease); 00087 } 00088 } 00089 00094 void RSecureSubSession::DecreaseByL(TInt aInt) 00095 { 00096 if (SubSessionHandle()) 00097 { 00098 TIpcArgs args(aInt); 00099 User::LeaveIfError(SendReceive(ESecureServerDecreaseBy, args)); 00100 } 00101 } 00102 00106 void RSecureSubSession::Reset() 00107 { 00108 if (SubSessionHandle()) 00109 { 00110 SendReceive(ESecureServerReset); 00111 } 00112 } 00113 00118 TInt RSecureSubSession::CounterValueL() 00119 { 00120 TInt res = KErrNotFound; 00121 TPckgBuf<TInt> pckg; 00122 00123 if (SubSessionHandle()) 00124 { 00125 TIpcArgs args(&pckg); 00126 User::LeaveIfError(SendReceive(ESecureServerValue, args)); 00127 res = pckg(); 00128 } 00129 return res; 00130 } 00131 00136 void RSecureSubSession::SaveCounterL() 00137 { 00138 if (SubSessionHandle()) 00139 { 00140 User::LeaveIfError(SendReceive(ESecureServerSaveCounter)); 00141 } 00142 } 00143 00148 void RSecureSubSession::SetCounterFromFileL() 00149 { 00150 if (SubSessionHandle()) 00151 { 00152 User::LeaveIfError(SendReceive(ESecureServerSetCounterFromFile)); 00153 } 00154 }