linklayerprotocols/tunnelnif/src/tunnelFactory.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 17:25:18 +0300
branchRCL_3
changeset 40 d566d76acea1
parent 0 af10295192d8
permissions -rw-r--r--
Revision: 201025 Kit: 2010125

// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// Implements the Tunnel Flow and Protocol Interface Factories.
// 
//

/**
 @file
*/

#include "TunnelFactory.h"
#include "tunnelFlow.h"
#include "tunnelProvision.h"		// for TTunnelMessages

using namespace ESock;

// =====================================================================================
//
// Tunnel Flow Factory
//

CTunnelFlowFactory* CTunnelFlowFactory::NewL(TAny* aConstructionParameters)
/**
Constructs a Tunnel SubConnection Flow Factory

@param aConstructionParameters construction data passed by ECOM

@return pointer to a constructed factory
*/
	{
	CTunnelFlowFactory* ptr = new (ELeave) CTunnelFlowFactory(TUid::Uid(KTunnelFlowImplUid), *(reinterpret_cast<CSubConnectionFlowFactoryContainer*>(aConstructionParameters)));
	CleanupStack::PushL(ptr);

	//
	// Register virtual constructors for Tunnel messages
	//
	// Note that factories are never unloaded at present, so this registration will
	// effectively exist until ESockSvr unloads.
	//

	TTunnelMessages::RegisterL();
	CleanupStack::Pop(ptr);
	return ptr;
	}


CTunnelFlowFactory::CTunnelFlowFactory(TUid aFactoryId, CSubConnectionFlowFactoryContainer& aParentContainer)
	: CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer)
/**
Tunnel SubConnection Flow Factory Constructor

@param aFactoryId ECOM Implementation Id
@param aParentContainer Object Owner
*/
	{
	}

CTunnelFlowFactory::~CTunnelFlowFactory()
	{
	// De-register virtual constructors for Tunnel messages.
	TTunnelMessages::DeRegister();
	}

CSubConnectionFlowBase* CTunnelFlowFactory::DoCreateFlowL(ESock::CProtocolIntfBase* aProtocol, ESock::TFactoryQueryBase& aQuery)
	{
	const TDefaultFlowFactoryQuery& query = static_cast<const TDefaultFlowFactoryQuery&>(aQuery);
 	CTunnelFlow* s = new (ELeave) CTunnelFlow(*this, query.iSCprId, aProtocol);
	return s;
	}