datacommsserver/esockserver/ssock/ss_protocolparameterset.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 #include "ss_protocolparameterset.h"
       
    18 
       
    19 namespace ESock
       
    20 {
       
    21 EXPORT_C CSubConnectionProtocolParameterSet* CSubConnectionProtocolParameterSet::NewL(
       
    22 	CSubConParameterFamily& aFamily,
       
    23 	CSubConParameterFamily::TParameterSetType aType)
       
    24 	{
       
    25 	CSubConnectionProtocolParameterSet* obj = NewL();
       
    26 	CleanupStack::PushL(obj);
       
    27 	aFamily.SetGenericSetL(*obj, aType);
       
    28 	CleanupStack::Pop(obj);
       
    29 	return obj;
       
    30 	}
       
    31 
       
    32 EXPORT_C CSubConnectionProtocolParameterSet* CSubConnectionProtocolParameterSet::NewL(
       
    33 	RParameterFamily& aFamily,
       
    34 	RParameterFamily::TParameterSetType aType)
       
    35 	{
       
    36 	CSubConnectionProtocolParameterSet* obj = NewL();
       
    37 	CleanupStack::PushL(obj);
       
    38 	aFamily.AddParameterSetL(obj, aType);
       
    39 	CleanupStack::Pop(obj);
       
    40 	return obj;
       
    41 	}
       
    42 
       
    43 EXPORT_C CSubConnectionProtocolParameterSet* CSubConnectionProtocolParameterSet::NewL()
       
    44 	{
       
    45 	STypeId typeId = STypeId::CreateSTypeId(CSubConnectionProtocolParameterSet::EUid, CSubConnectionProtocolParameterSet::EType);
       
    46 	return new(ELeave) CSubConnectionProtocolParameterSet;
       
    47 	}
       
    48 
       
    49 EXPORT_C CSubConnectionProtocolParameterSet::CSubConnectionProtocolParameterSet()
       
    50 	{
       
    51 	}
       
    52 
       
    53 EXPORT_C TInt CSubConnectionProtocolParameterSet::FindAndRemoveExtension(
       
    54 	TProtocolExtensionSpecifier& aExtensionSpec,
       
    55 	const TUid& aTierId)
       
    56 	{
       
    57 	TInt index = 0;
       
    58 
       
    59 	// This ought to be a short list so just walk it
       
    60 	while(index < iExtensions.Count())
       
    61 		{
       
    62 		if(iExtensions[index].iTierId == aTierId)
       
    63 			{
       
    64 			aExtensionSpec = iExtensions[index];
       
    65 			iExtensions.Remove(index);
       
    66 			return KErrNone;
       
    67 			}
       
    68 		index++;
       
    69 		}
       
    70 	return KErrNotFound;
       
    71 	}
       
    72 
       
    73 EXPORT_C TInt CSubConnectionProtocolParameterSet::AddExtension(const TProtocolExtensionSpecifier& aExtensionSpec)
       
    74 	{
       
    75 	return iExtensions.Append(aExtensionSpec);
       
    76 	}
       
    77 
       
    78 
       
    79 EXPORT_C /*virtual*/ CSubConnectionProtocolParameterSet::~CSubConnectionProtocolParameterSet()
       
    80 	{
       
    81 	iExtensions.Close();
       
    82 	}
       
    83 
       
    84 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(CSubConnectionProtocolParameterSet, CSubConnectionProtocolParameterSet::EUid, CSubConnectionProtocolParameterSet::EType)
       
    85 	REGISTER_ATTRIBUTE(CSubConnectionProtocolParameterSet, iExtensions, TMetaArray<TProtocolExtensionSpecifier>)
       
    86 END_ATTRIBUTE_TABLE()
       
    87 
       
    88 
       
    89 
       
    90 // CFlowRequestParameters
       
    91 //-----------------------
       
    92 
       
    93 EXPORT_C CFlowRequestParameters* CFlowRequestParameters::NewL(
       
    94 	CSubConParameterFamily& aFamily,
       
    95 	CSubConParameterFamily::TParameterSetType aType)
       
    96 	{
       
    97 	CFlowRequestParameters* obj = NewL();
       
    98 	CleanupStack::PushL(obj);
       
    99 	aFamily.SetGenericSetL(*obj, aType);
       
   100 	CleanupStack::Pop(obj);
       
   101 	return obj;
       
   102 	}
       
   103 
       
   104 EXPORT_C CFlowRequestParameters* CFlowRequestParameters::NewL()
       
   105 	{
       
   106 	STypeId typeId = STypeId::CreateSTypeId(CFlowRequestParameters::EUid, CFlowRequestParameters::EType);
       
   107 	CFlowRequestParameters* paramSet = static_cast<CFlowRequestParameters*>(CSubConParameterSet::NewL(typeId));
       
   108 	return paramSet;
       
   109 	}
       
   110 }
       
   111