sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // SD_BUF.CPP sl@0: // HDbsBuf class - "DBMS security" related code only sl@0: // sl@0: // sl@0: sl@0: #include "SD_STD.H" sl@0: sl@0: /** sl@0: Standard phase-one factory method for HDbsBuf instances. sl@0: @param aDbSession RDbs session instance. sl@0: @param aFunction DBMS server function code. EDbsDatabaseList DBMS function code is only used. sl@0: @param aArgs EDbsDatabaseList related set of arguments. sl@0: @return A pointer to the created HDbsBuf instance. sl@0: @leave One of the system-wide error codes, including KErrNoMemory. sl@0: */ sl@0: HDbsBuf* HDbsBuf::NewLC(const RDbs& aDbSession, TDbsFunction aFunction, TIpcArgs& aArgs) sl@0: { sl@0: HDbsBuf* self = new (ELeave) HDbsBuf; sl@0: self->PushL(); sl@0: self->ConstructL(aDbSession, aFunction, aArgs); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: Standard phase-two construction method for HDbsBuf instances. sl@0: @param aDbSession RDbs session instance. sl@0: @param aFunction DBMS server function code. EDbsDatabaseList DBMS function code is only used. sl@0: @param aArgs EDbsDatabaseList related set of arguments. sl@0: @leave One of the system-wide error codes, including KErrNoMemory. sl@0: */ sl@0: void HDbsBuf::ConstructL(const RDbs& aDbSession, TDbsFunction aFunction, TIpcArgs& aArgs) sl@0: { sl@0: TPckg pckg(iBuf); sl@0: aArgs.Set(3, &pckg); sl@0: iIpc.OpenL(aDbSession, aFunction, aArgs); sl@0: TUint8* base = iBuf.iData; sl@0: // if reading we already have one buffer-full of data sl@0: TInt avail = Max(0, Min(iBuf.iExt, KDbsStreamBufSize)); sl@0: SetBuf(ERead, base, base + avail); sl@0: SetPos(ERead, avail); sl@0: SetBuf(EWrite, base, base); sl@0: SetPos(EWrite, 0); sl@0: }