linklayerprotocols/tunnelnif/src/tunnelFactory.cpp
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2006-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 // Implements the Tunnel Flow and Protocol Interface Factories.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "TunnelFactory.h"
       
    23 #include "tunnelFlow.h"
       
    24 #include "tunnelProvision.h"		// for TTunnelMessages
       
    25 
       
    26 using namespace ESock;
       
    27 
       
    28 // =====================================================================================
       
    29 //
       
    30 // Tunnel Flow Factory
       
    31 //
       
    32 
       
    33 CTunnelFlowFactory* CTunnelFlowFactory::NewL(TAny* aConstructionParameters)
       
    34 /**
       
    35 Constructs a Tunnel SubConnection Flow Factory
       
    36 
       
    37 @param aConstructionParameters construction data passed by ECOM
       
    38 
       
    39 @return pointer to a constructed factory
       
    40 */
       
    41 	{
       
    42 	CTunnelFlowFactory* ptr = new (ELeave) CTunnelFlowFactory(TUid::Uid(KTunnelFlowImplUid), *(reinterpret_cast<CSubConnectionFlowFactoryContainer*>(aConstructionParameters)));
       
    43 	CleanupStack::PushL(ptr);
       
    44 
       
    45 	//
       
    46 	// Register virtual constructors for Tunnel messages
       
    47 	//
       
    48 	// Note that factories are never unloaded at present, so this registration will
       
    49 	// effectively exist until ESockSvr unloads.
       
    50 	//
       
    51 
       
    52 	TTunnelMessages::RegisterL();
       
    53 	CleanupStack::Pop(ptr);
       
    54 	return ptr;
       
    55 	}
       
    56 
       
    57 
       
    58 CTunnelFlowFactory::CTunnelFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer)
       
    59 	: CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer)
       
    60 /**
       
    61 Tunnel SubConnection Flow Factory Constructor
       
    62 
       
    63 @param aFactoryId ECOM Implementation Id
       
    64 @param aParentContainer Object Owner
       
    65 */
       
    66 	{
       
    67 	}
       
    68 
       
    69 CTunnelFlowFactory::~CTunnelFlowFactory()
       
    70 	{
       
    71 	// De-register virtual constructors for Tunnel messages.
       
    72 	TTunnelMessages::DeRegister();
       
    73 	}
       
    74 
       
    75 CSubConnectionFlowBase* CTunnelFlowFactory::DoCreateFlowL(ESock::CProtocolIntfBase* aProtocol, ESock::TFactoryQueryBase& aQuery)
       
    76 	{
       
    77 	const TDefaultFlowFactoryQuery& query = static_cast<const TDefaultFlowFactoryQuery&>(aQuery);
       
    78  	CTunnelFlow* s = new (ELeave) CTunnelFlow(*this, query.iSCprId, aProtocol);
       
    79 	return s;
       
    80 	}
       
    81