commsfwsupport/commselements/serverden/src/sd_apiextension.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-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 // SS_API_EXT.CPP
       
    15 // TODO PREQ1116 disabled to get catchup to build #define SYMBIAN_NETWORKING_UPS
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @released
       
    22 */
       
    23 
       
    24 #include "sd_apiextension.h"
       
    25 
       
    26 
       
    27 #ifdef _DEBUG
       
    28 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
       
    29 // (if it could happen through user error then you should give it an explicit, documented, category + code)
       
    30 _LIT(KSpecAssert_ElemSvrDenApiXC, "ElemSvrDenApiXC");
       
    31 #endif
       
    32 
       
    33 using namespace Elements;
       
    34 using namespace Den;
       
    35 using namespace Messages;
       
    36 using namespace Meta;
       
    37 
       
    38 //
       
    39 // CExtItfMsgPluginInfo
       
    40 //
       
    41 
       
    42 EXPORT_C CExtItfMsgPluginInfo* CExtItfMsgPluginInfo::NewInstanceL(const STypeId& aTypeId)
       
    43 	{
       
    44 	TUid destroyUid;
       
    45 	CExtItfMsgPluginInfo* obj = reinterpret_cast<CExtItfMsgPluginInfo*>(REComSession::CreateImplementationL(aTypeId.iUid, destroyUid, (TAny*)aTypeId.iType));
       
    46 	obj->iDestroyUid = destroyUid;
       
    47 	return obj;
       
    48 	}
       
    49 
       
    50 EXPORT_C CExtItfMsgPluginInfo::~CExtItfMsgPluginInfo()
       
    51 	{
       
    52 	__ASSERT_DEBUG(iDestroyUid.iUid!=0, User::Panic(KSpecAssert_ElemSvrDenApiXC, 1));
       
    53 	REComSession::DestroyedImplementation(iDestroyUid);
       
    54 	}
       
    55 
       
    56 
       
    57 //
       
    58 // AIpcExtensionInterfaceBase
       
    59 //
       
    60 EXPORT_C AIpcExtensionInterfaceBase::AIpcExtensionInterfaceBase()
       
    61 :	iMsgPluginInfo(NULL)
       
    62 	{
       
    63 	}
       
    64 
       
    65 void AIpcExtensionInterfaceBase::RegisterMessagesL()
       
    66 	{
       
    67 	//RegisterInterfaceL is reference counted, make sure you always call
       
    68 	//it from RegisterMessagesL to avoid premature deregistration scenarios.
       
    69 	Meta::STypeId msgTid = MsgImplTid();
       
    70 	CExtItfMsgPluginInfo* msgPluginInfo = iMsgPluginInfo;
       
    71 	if (iMsgPluginInfo==NULL)
       
    72 		{
       
    73 		__ASSERT_DEBUG(msgTid.iUid.iUid!=0, User::Panic(KSpecAssert_ElemSvrDenApiXC, 2));
       
    74 		msgPluginInfo = static_cast<CExtItfMsgPluginInfo*>(CExtItfMsgPluginInfo::NewInstanceL(msgTid));
       
    75 		CleanupStack::PushL(msgPluginInfo);
       
    76 		}
       
    77 
       
    78 	const TImplementationProxy* implProxyTable = msgPluginInfo->ImplementationProxy();
       
    79 	TlsGlobals::Get().RegisterInterfaceL(msgTid.iUid, msgPluginInfo->ImplementationProxyTableSize(), implProxyTable);
       
    80 	if (iMsgPluginInfo==NULL)
       
    81 		{
       
    82 		CleanupStack::Pop(msgPluginInfo);
       
    83 		iMsgPluginInfo = msgPluginInfo; //Set only when all done
       
    84 		}
       
    85 	}
       
    86 
       
    87 void AIpcExtensionInterfaceBase::DeregisterMessages()
       
    88 	{
       
    89 	TlsGlobals::Get().DeregisterInterface(MsgImplTid().iUid);
       
    90 	delete iMsgPluginInfo;
       
    91 	iMsgPluginInfo = NULL;
       
    92 	}
       
    93 
       
    94