authenticationservices/authenticationserver/source/common/authserveripc.cpp
changeset 102 deec7e509f66
parent 94 0e6c5a9328b5
child 108 ca9a0fc2f082
equal deleted inserted replaced
94:0e6c5a9328b5 102:deec7e509f66
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * authserver client server IPC parameters implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22 */
       
    23 #include "authcommon_impl.h"
       
    24 #include "authserveripc.h"
       
    25 
       
    26 using namespace AuthServer;
       
    27 
       
    28 
       
    29 
       
    30 EXPORT_C CAuthParams* CAuthParams::NewL(TTimeIntervalSeconds aTimeout,
       
    31 							   TBool aClientKey,
       
    32 							   TUid  aClientSid,
       
    33 							   TBool aWithString,
       
    34 							   const TDesC& aClientMessage)
       
    35 	{
       
    36 	CAuthParams* self = new (ELeave)CAuthParams(aTimeout,
       
    37 												aClientKey,
       
    38 												aClientSid,
       
    39 												aWithString);
       
    40 	CleanupStack::PushL(self);
       
    41 	self->ConstructL(aClientMessage);
       
    42 	CleanupStack::Pop(self);
       
    43 	return self;
       
    44 	}
       
    45 
       
    46 
       
    47 void CAuthParams::ConstructL(const TDesC& aClientMessage)
       
    48 	{
       
    49 	iClientMessage = aClientMessage.AllocL();
       
    50 	}
       
    51 
       
    52 
       
    53 CAuthParams::CAuthParams(TTimeIntervalSeconds aTimeout,
       
    54 						TBool aClientKey,
       
    55 						TUid  aClientSid,
       
    56 						TBool aWithString):
       
    57 	iTimeout(aTimeout),
       
    58 	iClientKey(aClientKey),
       
    59 	iClientSid(aClientSid),
       
    60 	iWithString(aWithString)
       
    61 	{
       
    62 	
       
    63 	}
       
    64 	
       
    65 
       
    66 EXPORT_C void CAuthParams::ExternalizeL(RWriteStream& aStream) const
       
    67 	{
       
    68 	aStream.WriteInt32L(iClientMessage->Des().Length());
       
    69 	aStream.WriteInt32L(iTimeout.Int());
       
    70 	aStream.WriteInt8L(iClientKey);
       
    71 	aStream.WriteInt32L(iClientSid.iUid);
       
    72 	aStream.WriteInt8L(iWithString);
       
    73 
       
    74 	aStream << *iClientMessage;
       
    75 	}
       
    76 
       
    77 
       
    78 EXPORT_C void CAuthParams::InternalizeL(RReadStream& aStream)
       
    79 	{
       
    80 	TInt maxLength 	= aStream.ReadInt32L();
       
    81 	iTimeout       	= aStream.ReadInt32L();
       
    82 	iClientKey     	= aStream.ReadInt8L();
       
    83 	iClientSid.iUid	= aStream.ReadInt32L();
       
    84 	iWithString     = aStream.ReadInt8L();
       
    85 	
       
    86 	*iClientMessage = KNullDesC;
       
    87 	iClientMessage = iClientMessage->ReAllocL(maxLength);
       
    88 	TPtr ptr(iClientMessage->Des());
       
    89 	aStream >> ptr;
       
    90 	}
       
    91 
       
    92 
       
    93 CAuthParams::~CAuthParams()
       
    94 	{
       
    95 	delete iClientMessage;
       
    96 	iClientMessage = 0;
       
    97 	}