diff -r 8d540f55e491 -r 425d8f4f7fa5 tcpiputils/tun/src/tunfamily.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tcpiputils/tun/src/tunfamily.cpp Wed Sep 15 00:18:51 2010 +0300 @@ -0,0 +1,90 @@ +// Copyright (c) 2010 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: +// + +#include "tunfamily.h" +#include "tun.h" +#include +#include + + +CProtocolFamilyTun::CProtocolFamilyTun() + { + __DECLARE_NAME(_S("CProtocolFamilyTun")); + } + +CProtocolFamilyTun::~CProtocolFamilyTun() +//Destructor + {} + +TInt CProtocolFamilyTun::Install() + { + return KErrNone; + } + +TInt CProtocolFamilyTun::Remove() + { + return KErrNone; + } + +TUint CProtocolFamilyTun::ProtocolList(TServerProtocolDesc* &aProtocolList) + { + const TInt KArraySize = 1; + // Esock catches this leave; hence TRAP is not needed + TServerProtocolDesc *p = new (ELeave) TServerProtocolDesc[KArraySize]; + CProtocolTun::Identify(p[KArraySize-1]); + aProtocolList = p; + return 1; + } + +CProtocolBase* CProtocolFamilyTun::NewProtocolL(TUint /*aSockType*/, + TUint aProtocol) + { + if (aProtocol != KProtocolTUN) + { + Panic(ETunPanic_BadBind); + } + + CProtocolTun* instance = CProtocolTun::NewL(); + return instance; + + } + + + +// +// Entrypoint +// +#ifndef EKA2 +GLDEF_C TInt E32Dll() + { + return KErrNone; + } +#endif //#ifndef EKA2 + +// Force export of non-mangled name +extern "C" { IMPORT_C CProtocolFamilyBase* Install(void); } +EXPORT_C CProtocolFamilyBase* Install(void) + { + CProtocolFamilyTun* protocol = new CProtocolFamilyTun(); + if (protocol) + { + return protocol; + } + else + { + return NULL; + } + } +