telephonyprotocols/gprsumtsqosprt/src/guqos_prot.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 #include "guqos.h"
       
    17 
       
    18 
       
    19 
       
    20 class CExtensionModule : public CProtocolFamilyBase
       
    21 	{
       
    22 public:
       
    23 	CExtensionModule();
       
    24 	virtual ~CExtensionModule();
       
    25 	virtual TInt Install();
       
    26 	virtual CProtocolBase* NewProtocolL(TUint aSockType,TUint aProtocol);
       
    27 	virtual TUint ProtocolList(TServerProtocolDesc*& aProtocolList);
       
    28 	};
       
    29 
       
    30 
       
    31 
       
    32 // DLL Install
       
    33 GLDEF_C TInt E32Dll()
       
    34 	{
       
    35 	return(KErrNone);
       
    36 	}
       
    37 
       
    38 
       
    39 
       
    40 // Force export of non-mangled name
       
    41 extern "C" { IMPORT_C CProtocolFamilyBase *Install(); }
       
    42 EXPORT_C CProtocolFamilyBase *Install()
       
    43 	{
       
    44 	return new CExtensionModule;
       
    45 	}
       
    46 
       
    47 
       
    48 
       
    49 // CExtensionModule
       
    50 CExtensionModule::CExtensionModule()
       
    51 	{
       
    52 	}
       
    53 
       
    54 
       
    55 CExtensionModule::~CExtensionModule()
       
    56 	{
       
    57 	}
       
    58 
       
    59 
       
    60 TInt CExtensionModule::Install()
       
    61 	{
       
    62 	return KErrNone;
       
    63 	}
       
    64 
       
    65 
       
    66 TUint CExtensionModule::ProtocolList(TServerProtocolDesc*& aProtocolList)
       
    67 	{
       
    68 	aProtocolList = new TServerProtocolDesc[1];
       
    69 	if (aProtocolList == NULL)
       
    70 		return 0;
       
    71 
       
    72 	CModuleGuqos::Identify(aProtocolList[0]);
       
    73 	return 1;
       
    74 	}
       
    75 
       
    76 CProtocolBase* CExtensionModule::NewProtocolL(TUint aSockType,TUint aProtocol)
       
    77 	{
       
    78 	switch (aProtocol)
       
    79 		{
       
    80 	case KModuleGUQoS:
       
    81 		if (aSockType == KSockDatagram)
       
    82 			return CModuleGuqos::NewL();
       
    83 		break;
       
    84 	default:
       
    85 		break;
       
    86 		}
       
    87 	User::Leave(KErrNotSupported);
       
    88 	return NULL;	//not reached really (shut off a warning)
       
    89 	}