Revision: 200911 platform_MCL.001
authorKiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
Mon, 30 Mar 2009 12:51:20 +0300
changeset 0 99ef825efeca
child 1 ed1ec54c34f0
child 10 e20d19ef9b09
Revision: 200911 Kit: 200912
group/bld.inf
languageinterworkingfw/group/bld.inf
languageinterworkingfw/servicehandler/EABI/liwServiceHandlerU.DEF
languageinterworkingfw/servicehandler/bwins/liwServiceHandlerU.DEF
languageinterworkingfw/servicehandler/data/2000B5D4.rss
languageinterworkingfw/servicehandler/data/liwservicehandler.rss
languageinterworkingfw/servicehandler/group/bld.inf
languageinterworkingfw/servicehandler/group/liwresolver.mmp
languageinterworkingfw/servicehandler/group/servicehandler.mmp
languageinterworkingfw/servicehandler/inc/liwbinding.h
languageinterworkingfw/servicehandler/inc/liwbinding.inl
languageinterworkingfw/servicehandler/inc/liwecommonitor.h
languageinterworkingfw/servicehandler/inc/liwmenubinding.h
languageinterworkingfw/servicehandler/inc/liwmenubinding.inl
languageinterworkingfw/servicehandler/inc/liwmenuslot.hrh
languageinterworkingfw/servicehandler/inc/liwresolver.h
languageinterworkingfw/servicehandler/inc/liwservicedata.h
languageinterworkingfw/servicehandler/inc/liwservicehandlerimpl.h
languageinterworkingfw/servicehandler/inc/liwtlsdata.h
languageinterworkingfw/servicehandler/inc/liwuids.hrh
languageinterworkingfw/servicehandler/inc/liwxmlhandler.h
languageinterworkingfw/servicehandler/install/liwservicehandler.pkg
languageinterworkingfw/servicehandler/install/liwservicehandler_PU.pkg
languageinterworkingfw/servicehandler/install/liwservicehandlerstub.pkg
languageinterworkingfw/servicehandler/install/liwservicehandlerstub.sis
languageinterworkingfw/servicehandler/src/liwbinding.cpp
languageinterworkingfw/servicehandler/src/liwcommon.cpp
languageinterworkingfw/servicehandler/src/liwecommonitor.cpp
languageinterworkingfw/servicehandler/src/liwgenericparam.cpp
languageinterworkingfw/servicehandler/src/liwmenu.cpp
languageinterworkingfw/servicehandler/src/liwmenubinding.cpp
languageinterworkingfw/servicehandler/src/liwresolver.cpp
languageinterworkingfw/servicehandler/src/liwservicedata.cpp
languageinterworkingfw/servicehandler/src/liwservicehandler.cpp
languageinterworkingfw/servicehandler/src/liwservicehandlerimpl.cpp
languageinterworkingfw/servicehandler/src/liwserviceifbase.cpp
languageinterworkingfw/servicehandler/src/liwserviceifmenu.cpp
languageinterworkingfw/servicehandler/src/liwtlsdata.cpp
languageinterworkingfw/servicehandler/src/liwvariant.cpp
languageinterworkingfw/servicehandler/src/liwxmlhandler.cpp
layers.sysdef.xml
rtsecuritymanager/group/bld.inf
rtsecuritymanager/inc/rtsecmgrdef.h
rtsecuritymanager/inc/rtsecmgrmsg.h
rtsecuritymanager/inc/rtsecmgrtracer.h
rtsecuritymanager/install/backup_registration.xml
rtsecuritymanager/install/rtsecuritymanager.pkg
rtsecuritymanager/install/rtsecuritymanager_PU.pkg
rtsecuritymanager/install/rtsecuritymanagerstub.pkg
rtsecuritymanager/install/rtsecuritymanagerstub.sis
rtsecuritymanager/rtsecuritymanagerclient/BWINS/RTSecMgrClientU.DEF
rtsecuritymanager/rtsecuritymanagerclient/EABI/RTSecMgrClientU.DEF
rtsecuritymanager/rtsecuritymanagerclient/data/rtsecmanager.rss
rtsecuritymanager/rtsecuritymanagerclient/group/bld.inf
rtsecuritymanager/rtsecuritymanagerclient/group/rtsecmgrclient.mmp
rtsecuritymanager/rtsecuritymanagerclient/inc/rtsecmgrclient.h
rtsecuritymanager/rtsecuritymanagerclient/loc/rtsecmanager.loc
rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmanager.cpp
rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmgrclient.cpp
rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmgrscriptsession.cpp
rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmgrtrustinfo.cpp
rtsecuritymanager/rtsecuritymanagerserver/group/RTSecMgrServer.mmp
rtsecuritymanager/rtsecuritymanagerserver/group/bld.inf
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrdata.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicy.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicy.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicymanager.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicymanager.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicyparser.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrprotectiondomain.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrprotectiondomain.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrscriptmanager.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserver.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserver.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserverdef.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserverpolicy.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsession.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsession.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrshutdown.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrstore.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrstore.inl
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsubsession.h
rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsubsession.inl
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrclientapi.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrpolicy.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrpolicymanager.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrpolicyparser.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrprotectiondomain.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrscriptmanager.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserver.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserversession.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserverstartUp.cpp
rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrstore.cpp
rtsecuritymanager/rtsecuritymanagerutil/BWINS/RTSecMgrUtilU.DEF
rtsecuritymanager/rtsecuritymanagerutil/EABI/RTSecMgrUtilU.DEF
rtsecuritymanager/rtsecuritymanagerutil/group/RTSecMgrUtil.mmp
rtsecuritymanager/rtsecuritymanagerutil/group/bld.inf
rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrmsg.cpp
rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrpermission.cpp
rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrscript.cpp
serviceapifw_plat/group/bld.inf
serviceapifw_plat/liw_criteria_api/group/bld.inf
serviceapifw_plat/liw_criteria_api/inc/liwcommon.h
serviceapifw_plat/liw_criteria_api/inc/liwcommon.hrh
serviceapifw_plat/liw_criteria_api/inc/liwcommon.rh
serviceapifw_plat/liw_criteria_api/liw_criteria_api.metaxml
serviceapifw_plat/liw_criteria_api/tsrc/bmarm/liwtestcasesu.def
serviceapifw_plat/liw_criteria_api/tsrc/bwins/liwtestcasesu.def
serviceapifw_plat/liw_criteria_api/tsrc/conf/tliwtestcases.cfg
serviceapifw_plat/liw_criteria_api/tsrc/data/liwaccesspolicy.xml
serviceapifw_plat/liw_criteria_api/tsrc/eabi/liwtestcasesu.def
serviceapifw_plat/liw_criteria_api/tsrc/group/bld.inf
serviceapifw_plat/liw_criteria_api/tsrc/group/liwtestcases.mmp
serviceapifw_plat/liw_criteria_api/tsrc/inc/liw_async_testcase.h
serviceapifw_plat/liw_criteria_api/tsrc/inc/liwtestapplit.h
serviceapifw_plat/liw_criteria_api/tsrc/inc/liwtestcases.h
serviceapifw_plat/liw_criteria_api/tsrc/init/testframework.ini
serviceapifw_plat/liw_criteria_api/tsrc/liwtestcases.pkg
serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcases.cpp
serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcasesasync.cpp
serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcasesblocks.cpp
serviceapifw_plat/liw_generic_parameter_api/group/bld.inf
serviceapifw_plat/liw_generic_parameter_api/inc/liwbufferextension.h
serviceapifw_plat/liw_generic_parameter_api/inc/liwgenericparam.h
serviceapifw_plat/liw_generic_parameter_api/inc/liwgenericparam.hrh
serviceapifw_plat/liw_generic_parameter_api/inc/liwgenericparam.inl
serviceapifw_plat/liw_generic_parameter_api/inc/liwvariant.h
serviceapifw_plat/liw_generic_parameter_api/inc/liwvariant.inl
serviceapifw_plat/liw_generic_parameter_api/inc/liwvarianttype.hrh
serviceapifw_plat/liw_generic_parameter_api/liw_generic_parameter_api.metaxml
serviceapifw_plat/liw_provider_utility_api/group/bld.inf
serviceapifw_plat/liw_provider_utility_api/inc/liwmenu.h
serviceapifw_plat/liw_provider_utility_api/liw_provider_utility_api.metaxml
serviceapifw_plat/liw_service_handler_api/group/bld.inf
serviceapifw_plat/liw_service_handler_api/inc/liwservicehandler.h
serviceapifw_plat/liw_service_handler_api/liw_service_handler_api.metaxml
serviceapifw_plat/liw_service_interface_base_api/group/bld.inf
serviceapifw_plat/liw_service_interface_base_api/inc/liwserviceifbase.h
serviceapifw_plat/liw_service_interface_base_api/liw_service_interface_base_api.metaxml
serviceapifw_plat/liw_service_interface_menu_api/group/bld.inf
serviceapifw_plat/liw_service_interface_menu_api/inc/liwserviceifmenu.h
serviceapifw_plat/liw_service_interface_menu_api/liw_service_interface_menu_api.metaxml
serviceapifw_plat/rtsecuritymanager_client_api/group/bld.inf
serviceapifw_plat/rtsecuritymanager_client_api/inc/rtsecmanager.h
serviceapifw_plat/rtsecuritymanager_client_api/inc/rtsecmgrscriptsession.h
serviceapifw_plat/rtsecuritymanager_client_api/inc/rtsecmgrtrustInfo.h
serviceapifw_plat/rtsecuritymanager_client_api/rtsecuritymanager_client_api.metaxml
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/bwins/ui_tsecuritymanageru.def
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/conf/ui_tsecuritymanager.cfg
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/conf/ui_tsecuritymanager_comb.cfg
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy.xml
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy_1.xml
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy_2.xml
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy_3.xml
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/eabi/ui_tsecuritymanageru.def
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/group/bld.inf
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/group/ui_tsecuritymanager.mmp
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/inc/ui_tsecuritymanager.h
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/init/testframework.ini
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/src/ui_tsecuritymanager.cpp
serviceapifw_plat/rtsecuritymanager_client_api/tsrc/src/ui_tsecuritymanagerblocks.cpp
serviceapifw_plat/rtsecuritymanager_common_api/group/bld.inf
serviceapifw_plat/rtsecuritymanager_common_api/inc/rtsecmgrcommondef.h
serviceapifw_plat/rtsecuritymanager_common_api/rtsecuritymanager_common_api.metaxml
serviceapifw_plat/rtsecuritymanager_common_api/tsrc/group/bld.inf
serviceapifw_plat/rtsecuritymanager_utility_api/group/bld.inf
serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrpermission.h
serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrpermissionset.h
serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrscript.h
serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrutility.h
serviceapifw_plat/rtsecuritymanager_utility_api/rtsecuritymanager_utility_api.metaxml
serviceapifw_plat/rtsecuritymanager_utility_api/tsrc/group/bld.inf
serviceapifw_pub/group/bld.inf
sysdef_1_4_0.dtd
tsrc/group/bld.inf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "../serviceapifw_plat/group/bld.inf"
+#include "../serviceapifw_pub/group/bld.inf"
+#include "../rtsecuritymanager/group/bld.inf"
+#include "../languageinterworkingfw/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "../servicehandler/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/EABI/liwServiceHandlerU.DEF	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,227 @@
+EXPORTS
+	_Z4DumpRK11TLiwVariant @ 1 NONAME
+	_ZN11TLiwVariant3SetEPK10CLiwBuffer @ 2 NONAME
+	_ZN11TLiwVariant3SetEPK12CLiwIterable @ 3 NONAME
+	_ZN11TLiwVariant3SetEPK13MLiwInterface @ 4 NONAME
+	_ZN11TLiwVariant3SetEPK7CLiwMap @ 5 NONAME
+	_ZN11TLiwVariant3SetEPK8CLiwList @ 6 NONAME
+	_ZN11TLiwVariant3SetERK4TUid @ 7 NONAME
+	_ZN11TLiwVariant3SetERK5RFile @ 8 NONAME
+	_ZN11TLiwVariant3SetERK5TTime @ 9 NONAME
+	_ZN11TLiwVariant3SetERK6TDesC8 @ 10 NONAME
+	_ZN11TLiwVariant3SetERK7TDesC16 @ 11 NONAME
+	_ZN11TLiwVariant3SetEd @ 12 NONAME
+	_ZN11TLiwVariant3SetEi @ 13 NONAME
+	_ZN11TLiwVariant3SetEj @ 14 NONAME
+	_ZN11TLiwVariant3SetEl @ 15 NONAME
+	_ZN11TLiwVariant4SetLERKS_ @ 16 NONAME
+	_ZN11TLiwVariant5ResetEv @ 17 NONAME
+	_ZN11TLiwVariantC1ERKS_ @ 18 NONAME
+	_ZN11TLiwVariantC2ERKS_ @ 19 NONAME
+	_ZN11TLiwVariantaSERKS_ @ 20 NONAME
+	_ZN12CLiwIterableeqERS_ @ 21 NONAME
+	_ZN12CLiwMenuPane12AddMenuItemLEiRN16CEikMenuPaneItem5SDataEi @ 22 NONAME
+	_ZN12CLiwMenuPane12AddMenuItemLEiRN16CEikMenuPaneItem5SDataEiRK7TDesC16 @ 23 NONAME
+	_ZN12CLiwMenuPane13AddMenuItemsLER15TResourceReaderiii @ 24 NONAME
+	_ZN12CLiwMenuPane13AddMenuItemsLER4TBufILi256EEiiii @ 25 NONAME
+	_ZN12CLiwMenuPane13AddTitleItemLERK7TDesC16i @ 26 NONAME
+	_ZN12CLiwMenuPaneC1ER12CEikMenuPanei @ 27 NONAME
+	_ZN12CLiwMenuPaneC2ER12CEikMenuPanei @ 28 NONAME
+	_ZN12CLiwMenuPaneD0Ev @ 29 NONAME
+	_ZN12CLiwMenuPaneD1Ev @ 30 NONAME
+	_ZN12CLiwMenuPaneD2Ev @ 31 NONAME
+	_ZN13CLiwContainerD0Ev @ 32 NONAME
+	_ZN13CLiwContainerD1Ev @ 33 NONAME
+	_ZN13CLiwContainerD2Ev @ 34 NONAME
+	_ZN14CLiwDefaultMap4NewLEv @ 35 NONAME
+	_ZN14CLiwDefaultMap5NewLCER11RReadStream @ 36 NONAME
+	_ZN14CLiwDefaultMap6RemoveERK6TDesC8 @ 37 NONAME
+	_ZN14CLiwDefaultMap7InsertLERK6TDesC8RK11TLiwVariant @ 38 NONAME
+	_ZN14CLiwDefaultMapD0Ev @ 39 NONAME
+	_ZN14CLiwDefaultMapD1Ev @ 40 NONAME
+	_ZN14CLiwDefaultMapD2Ev @ 41 NONAME
+	_ZN15CLiwDefaultList4NewLEv @ 42 NONAME
+	_ZN15CLiwDefaultList5NewLCER11RReadStream @ 43 NONAME
+	_ZN15CLiwDefaultList6RemoveEi @ 44 NONAME
+	_ZN15CLiwDefaultList7AppendLERK11TLiwVariant @ 45 NONAME
+	_ZN15CLiwDefaultListD0Ev @ 46 NONAME
+	_ZN15CLiwDefaultListD1Ev @ 47 NONAME
+	_ZN15CLiwDefaultListD2Ev @ 48 NONAME
+	_ZN16CLiwCriteriaItem10SetOptionsEj @ 49 NONAME
+	_ZN16CLiwCriteriaItem13SetServiceCmdEi @ 50 NONAME
+	_ZN16CLiwCriteriaItem14SetServiceCmdLERK6TDesC8 @ 51 NONAME
+	_ZN16CLiwCriteriaItem15SetContentTypeLERK6TDesC8 @ 52 NONAME
+	_ZN16CLiwCriteriaItem15SetMaxProvidersEi @ 53 NONAME
+	_ZN16CLiwCriteriaItem15SetServiceClassERK4TUid @ 54 NONAME
+	_ZN16CLiwCriteriaItem16ReadFromResoureLER15TResourceReader @ 55 NONAME
+	_ZN16CLiwCriteriaItem18SetDefaultProviderEi @ 56 NONAME
+	_ZN16CLiwCriteriaItem18SetMetaDataOptionsERK11TLiwVariant @ 57 NONAME
+	_ZN16CLiwCriteriaItem4NewLEiRK6TDesC8S2_ @ 58 NONAME
+	_ZN16CLiwCriteriaItem4NewLEiiRK6TDesC8 @ 59 NONAME
+	_ZN16CLiwCriteriaItem4NewLEv @ 60 NONAME
+	_ZN16CLiwCriteriaItem5NewLCEiRK6TDesC8S2_ @ 61 NONAME
+	_ZN16CLiwCriteriaItem5NewLCEiiRK6TDesC8 @ 62 NONAME
+	_ZN16CLiwCriteriaItem5NewLCEv @ 63 NONAME
+	_ZN16CLiwCriteriaItem5SetIdEi @ 64 NONAME
+	_ZN16CLiwCriteriaItemD0Ev @ 65 NONAME
+	_ZN16CLiwCriteriaItemD1Ev @ 66 NONAME
+	_ZN16CLiwCriteriaItemD2Ev @ 67 NONAME
+	_ZN16CLiwCriteriaItemeqERKS_ @ 68 NONAME
+	_ZN17CLiwServiceIfBase18ExtensionInterfaceE4TUid @ 69 NONAME
+	_ZN17CLiwServiceIfBaseD0Ev @ 70 NONAME
+	_ZN17CLiwServiceIfBaseD1Ev @ 71 NONAME
+	_ZN17CLiwServiceIfBaseD2Ev @ 72 NONAME
+	_ZN17CLiwServiceIfMenu18ExtensionInterfaceE4TUid @ 73 NONAME
+	_ZN17CLiwServiceIfMenuD0Ev @ 74 NONAME
+	_ZN17CLiwServiceIfMenuD1Ev @ 75 NONAME
+	_ZN17CLiwServiceIfMenuD2Ev @ 76 NONAME
+	_ZN18CLiwServiceHandler10DetachMenuEii @ 77 NONAME
+	_ZN18CLiwServiceHandler11AttachMenuLER6RArrayIiEiR13RPointerArrayI16CLiwCriteriaItemE @ 78 NONAME
+	_ZN18CLiwServiceHandler11AttachMenuLEiR15TResourceReader @ 79 NONAME
+	_ZN18CLiwServiceHandler11AttachMenuLEiRK13RPointerArrayI16CLiwCriteriaItemE @ 80 NONAME
+	_ZN18CLiwServiceHandler11AttachMenuLEii @ 81 NONAME
+	_ZN18CLiwServiceHandler11GetCriteriaEi @ 82 NONAME
+	_ZN18CLiwServiceHandler11GetInterestER13RPointerArrayI16CLiwCriteriaItemE @ 83 NONAME
+	_ZN18CLiwServiceHandler12InParamListLEv @ 84 NONAME
+	_ZN18CLiwServiceHandler13OutParamListLEv @ 85 NONAME
+	_ZN18CLiwServiceHandler14HandleSubmenuLER12CEikMenuPane @ 86 NONAME
+	_ZN18CLiwServiceHandler14IsSubMenuEmptyEi @ 87 NONAME
+	_ZN18CLiwServiceHandler14NbrOfProvidersEPK16CLiwCriteriaItem @ 88 NONAME
+	_ZN18CLiwServiceHandler15ExecuteMenuCmdLEiRK20CLiwGenericParamListRS0_jP18MLiwNotifyCallback @ 89 NONAME
+	_ZN18CLiwServiceHandler16ReportMenuLaunchEv @ 90 NONAME
+	_ZN18CLiwServiceHandler18ExecuteServiceCmdLERK16CLiwCriteriaItemRK20CLiwGenericParamListRS3_jP18MLiwNotifyCallback @ 91 NONAME
+	_ZN18CLiwServiceHandler18ExecuteServiceCmdLERKiRK20CLiwGenericParamListRS2_jP18MLiwNotifyCallback @ 92 NONAME
+	_ZN18CLiwServiceHandler19InitializeMenuPaneLER12CEikMenuPaneiiRK20CLiwGenericParamList @ 93 NONAME
+	_ZN18CLiwServiceHandler19InitializeMenuPaneLER12CEikMenuPaneiiRK20CLiwGenericParamListi @ 94 NONAME
+	_ZN18CLiwServiceHandler20QueryImplementationLER13RPointerArrayI16CLiwCriteriaItemES3_ @ 95 NONAME
+	_ZN18CLiwServiceHandler4NewLEv @ 96 NONAME
+	_ZN18CLiwServiceHandler5NewLCEv @ 97 NONAME
+	_ZN18CLiwServiceHandler5ResetEv @ 98 NONAME
+	_ZN18CLiwServiceHandler7AttachLERK13RPointerArrayI16CLiwCriteriaItemE @ 99 NONAME
+	_ZN18CLiwServiceHandler7AttachLERK13RPointerArrayI16CLiwCriteriaItemER22CRTSecMgrScriptSession @ 100 NONAME
+	_ZN18CLiwServiceHandler7AttachLEi @ 101 NONAME
+	_ZN18CLiwServiceHandler7DetachLERK13RPointerArrayI16CLiwCriteriaItemE @ 102 NONAME
+	_ZN18CLiwServiceHandler7DetachLEi @ 103 NONAME
+	_ZN18CLiwServiceHandler9IsLiwMenuEi @ 104 NONAME
+	_ZN18CLiwServiceHandlerD0Ev @ 105 NONAME
+	_ZN18CLiwServiceHandlerD1Ev @ 106 NONAME
+	_ZN18CLiwServiceHandlerD2Ev @ 107 NONAME
+	_ZN18MLiwNotifyCallback16GetTransactionIDEv @ 108 NONAME
+	_ZN20CLiwGenericParamList12InternalizeLER11RReadStream @ 109 NONAME
+	_ZN20CLiwGenericParamList14PackForServerLER8TIpcArgs @ 110 NONAME
+	_ZN20CLiwGenericParamList17UnpackFromClientLERK9RMessage2 @ 111 NONAME
+	_ZN20CLiwGenericParamList4NewLER11RReadStream @ 112 NONAME
+	_ZN20CLiwGenericParamList4NewLEv @ 113 NONAME
+	_ZN20CLiwGenericParamList5NewLCER11RReadStream @ 114 NONAME
+	_ZN20CLiwGenericParamList5NewLCEv @ 115 NONAME
+	_ZN20CLiwGenericParamList5ResetEv @ 116 NONAME
+	_ZN20CLiwGenericParamList6RemoveERK6TDesC8 @ 117 NONAME
+	_ZN20CLiwGenericParamList6RemoveEi @ 118 NONAME
+	_ZN20CLiwGenericParamList7AppendLERK16TLiwGenericParam @ 119 NONAME
+	_ZN20CLiwGenericParamList7AppendLERKS_ @ 120 NONAME
+	_ZNK11TLiwVariant10AsIterableEv @ 121 NONAME
+	_ZNK11TLiwVariant11AsInterfaceEv @ 122 NONAME
+	_ZNK11TLiwVariant12AsFileHandleEv @ 123 NONAME
+	_ZNK11TLiwVariant3GetER4TUid @ 124 NONAME
+	_ZNK11TLiwVariant3GetER5RFile @ 125 NONAME
+	_ZNK11TLiwVariant3GetER5TDes8 @ 126 NONAME
+	_ZNK11TLiwVariant3GetER5TTime @ 127 NONAME
+	_ZNK11TLiwVariant3GetER6TDes16 @ 128 NONAME
+	_ZNK11TLiwVariant3GetER6TPtrC8 @ 129 NONAME
+	_ZNK11TLiwVariant3GetER7CLiwMap @ 130 NONAME
+	_ZNK11TLiwVariant3GetER7TPtrC16 @ 131 NONAME
+	_ZNK11TLiwVariant3GetER8CLiwList @ 132 NONAME
+	_ZNK11TLiwVariant3GetERd @ 133 NONAME
+	_ZNK11TLiwVariant3GetERi @ 134 NONAME
+	_ZNK11TLiwVariant3GetERj @ 135 NONAME
+	_ZNK11TLiwVariant3GetERl @ 136 NONAME
+	_ZNK11TLiwVariant5AsDesEv @ 137 NONAME
+	_ZNK11TLiwVariant5AsMapEv @ 138 NONAME
+	_ZNK11TLiwVariant6AsDataEv @ 139 NONAME
+	_ZNK11TLiwVariant6AsListEv @ 140 NONAME
+	_ZNK11TLiwVariant6AsTUidEv @ 141 NONAME
+	_ZNK11TLiwVariant7AsTBoolEv @ 142 NONAME
+	_ZNK11TLiwVariant7AsTRealEv @ 143 NONAME
+	_ZNK11TLiwVariant7AsTTimeEv @ 144 NONAME
+	_ZNK11TLiwVariant7AsTUintEv @ 145 NONAME
+	_ZNK11TLiwVariant8AsBufferEv @ 146 NONAME
+	_ZNK11TLiwVariant8AsTInt32Ev @ 147 NONAME
+	_ZNK12CLiwMenuPane12ServiceCmdIdEi @ 148 NONAME
+	_ZNK12CLiwMenuPane8DynCmdIdEi @ 149 NONAME
+	_ZNK12CLiwMenuPane9MenuCmdIdEi @ 150 NONAME
+	_ZNK13CLiwContainer12ExternalizeLER12RWriteStream @ 151 NONAME
+	_ZNK13CLiwContainer4SizeEv @ 152 NONAME
+	_ZNK14CLiwDefaultMap12ExternalizeLER12RWriteStream @ 153 NONAME
+	_ZNK14CLiwDefaultMap3AtLEi @ 154 NONAME
+	_ZNK14CLiwDefaultMap3AtLEiR5TDes8 @ 155 NONAME
+	_ZNK14CLiwDefaultMap4SizeEv @ 156 NONAME
+	_ZNK14CLiwDefaultMap5CountEv @ 157 NONAME
+	_ZNK14CLiwDefaultMap5FindLERK6TDesC8R11TLiwVariant @ 158 NONAME
+	_ZNK15CLiwDefaultList12ExternalizeLER12RWriteStream @ 159 NONAME
+	_ZNK15CLiwDefaultList3AtLEiR11TLiwVariant @ 160 NONAME
+	_ZNK15CLiwDefaultList4SizeEv @ 161 NONAME
+	_ZNK15CLiwDefaultList5CountEv @ 162 NONAME
+	_ZNK16CLiwCriteriaItem10ServiceCmdEv @ 163 NONAME
+	_ZNK16CLiwCriteriaItem11ContentTypeEv @ 164 NONAME
+	_ZNK16CLiwCriteriaItem12MaxProvidersEv @ 165 NONAME
+	_ZNK16CLiwCriteriaItem12ServiceClassEv @ 166 NONAME
+	_ZNK16CLiwCriteriaItem13ServiceCmdStrEv @ 167 NONAME
+	_ZNK16CLiwCriteriaItem15DefaultProviderEv @ 168 NONAME
+	_ZNK16CLiwCriteriaItem18GetMetaDataOptionsER11TLiwVariant @ 169 NONAME
+	_ZNK16CLiwCriteriaItem2IdEv @ 170 NONAME
+	_ZNK16CLiwCriteriaItem7OptionsEv @ 171 NONAME
+	_ZNK17CLiwServiceIfMenu8MenuPaneEv @ 172 NONAME
+	_ZNK18CLiwServiceHandler19ServiceCmdByMenuCmdEi @ 173 NONAME
+	_ZNK18CLiwServiceHandler9MenuCmdIdEi @ 174 NONAME
+	_ZNK20CLiwGenericParamList12ExternalizeLER12RWriteStream @ 175 NONAME
+	_ZNK20CLiwGenericParamList3AtLEiR16TLiwGenericParam @ 176 NONAME
+	_ZNK20CLiwGenericParamList4SizeEv @ 177 NONAME
+	_ZNK20CLiwGenericParamList5CountEiN3LIW14TVariantTypeIdE @ 178 NONAME
+	_ZNK20CLiwGenericParamList5CountEv @ 179 NONAME
+	_ZNK20CLiwGenericParamList8FindNextERiRK6TDesC8N3LIW14TVariantTypeIdE @ 180 NONAME
+	_ZNK20CLiwGenericParamList8FindNextERiiN3LIW14TVariantTypeIdE @ 181 NONAME
+	_ZNK20CLiwGenericParamList9FindFirstERiRK6TDesC8N3LIW14TVariantTypeIdE @ 182 NONAME
+	_ZNK20CLiwGenericParamList9FindFirstERiiN3LIW14TVariantTypeIdE @ 183 NONAME
+	_ZNK20CLiwGenericParamListixEi @ 184 NONAME
+	_ZNK7CLiwMapeqERKS_ @ 185 NONAME
+	_ZNK8CLiwListeqERKS_ @ 186 NONAME
+	_ZTI12CLiwIterable @ 187 NONAME ; #<TI>#
+	_ZTI12CLiwMenuPane @ 188 NONAME ; #<TI>#
+	_ZTI13CLiwContainer @ 189 NONAME ; #<TI>#
+	_ZTI14CLiwDefaultMap @ 190 NONAME ; #<TI>#
+	_ZTI14CLiwXmlHandler @ 191 NONAME ; #<TI>#
+	_ZTI15CLiwDefaultList @ 192 NONAME ; #<TI>#
+	_ZTI15CLiwEcomMonitor @ 193 NONAME ; #<TI>#
+	_ZTI15CLiwServiceData @ 194 NONAME ; #<TI>#
+	_ZTI16CLiwCriteriaItem @ 195 NONAME ; #<TI>#
+	_ZTI17CLiwServiceIfBase @ 196 NONAME ; #<TI>#
+	_ZTI17CLiwServiceIfMenu @ 197 NONAME ; #<TI>#
+	_ZTI7CLiwMap @ 198 NONAME ; #<TI>#
+	_ZTI8CLiwList @ 199 NONAME ; #<TI>#
+	_ZTV12CLiwIterable @ 200 NONAME ; #<VT>#
+	_ZTV12CLiwMenuPane @ 201 NONAME ; #<VT>#
+	_ZTV13CLiwContainer @ 202 NONAME ; #<VT>#
+	_ZTV14CLiwDefaultMap @ 203 NONAME ; #<VT>#
+	_ZTV14CLiwXmlHandler @ 204 NONAME ; #<VT>#
+	_ZTV15CLiwDefaultList @ 205 NONAME ; #<VT>#
+	_ZTV15CLiwEcomMonitor @ 206 NONAME ; #<VT>#
+	_ZTV15CLiwServiceData @ 207 NONAME ; #<VT>#
+	_ZTV16CLiwCriteriaItem @ 208 NONAME ; #<VT>#
+	_ZTV17CLiwServiceIfBase @ 209 NONAME ; #<VT>#
+	_ZTV17CLiwServiceIfMenu @ 210 NONAME ; #<VT>#
+	_ZTV7CLiwMap @ 211 NONAME ; #<VT>#
+	_ZTV8CLiwList @ 212 NONAME ; #<VT>#
+	_ZeqRK11TLiwVariantS1_ @ 213 NONAME
+	_ZeqRK16TLiwGenericParamS1_ @ 214 NONAME
+	_ZN11TLiwVariant14VariantCleanupEPv @ 215 NONAME
+	_ZN13CLiwContainer5CloseEv @ 216 NONAME
+	_ZN16TLiwGenericParam12ParamCleanupEPv @ 217 NONAME
+	_ZN11TLiwVariant5PushLEv @ 218 NONAME
+	_ZN14CLiwDefaultMap5NewLCEv @ 219 NONAME
+	_ZN15CLiwDefaultList5NewLCEv @ 220 NONAME
+	_ZN13CLiwContainer5PushLEv @ 221 NONAME
+	_ZN16TLiwGenericParam5PushLEv @ 222 NONAME
+	_ZN11TLiwVariant3SetEx @ 223 NONAME
+	_ZNK11TLiwVariant3GetERx @ 224 NONAME
+	_ZNK11TLiwVariant8AsTInt64Ev @ 225 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/bwins/liwServiceHandlerU.DEF	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,183 @@
+EXPORTS
+	??0CLiwMenuPane@@QAE@AAVCEikMenuPane@@H@Z @ 1 NONAME ; CLiwMenuPane::CLiwMenuPane(class CEikMenuPane &, int)
+	??0TLiwVariant@@QAE@ABV0@@Z @ 2 NONAME ; TLiwVariant::TLiwVariant(class TLiwVariant const &)
+	??1CLiwContainer@@MAE@XZ @ 3 NONAME ; CLiwContainer::~CLiwContainer(void)
+	??1CLiwCriteriaItem@@UAE@XZ @ 4 NONAME ; CLiwCriteriaItem::~CLiwCriteriaItem(void)
+	??1CLiwDefaultList@@EAE@XZ @ 5 NONAME ; CLiwDefaultList::~CLiwDefaultList(void)
+	??1CLiwDefaultMap@@EAE@XZ @ 6 NONAME ; CLiwDefaultMap::~CLiwDefaultMap(void)
+	??1CLiwMenuPane@@UAE@XZ @ 7 NONAME ; CLiwMenuPane::~CLiwMenuPane(void)
+	??1CLiwServiceHandler@@UAE@XZ @ 8 NONAME ; CLiwServiceHandler::~CLiwServiceHandler(void)
+	??1CLiwServiceIfBase@@UAE@XZ @ 9 NONAME ; CLiwServiceIfBase::~CLiwServiceIfBase(void)
+	??1CLiwServiceIfMenu@@UAE@XZ @ 10 NONAME ; CLiwServiceIfMenu::~CLiwServiceIfMenu(void)
+	??4TLiwVariant@@QAEAAV0@ABV0@@Z @ 11 NONAME ; class TLiwVariant & TLiwVariant::operator=(class TLiwVariant const &)
+	??8@YAHABVTLiwGenericParam@@0@Z @ 12 NONAME ; int operator==(class TLiwGenericParam const &, class TLiwGenericParam const &)
+	??8@YAHABVTLiwVariant@@0@Z @ 13 NONAME ; int operator==(class TLiwVariant const &, class TLiwVariant const &)
+	??8CLiwCriteriaItem@@QAEHABV0@@Z @ 14 NONAME ; int CLiwCriteriaItem::operator==(class CLiwCriteriaItem const &)
+	??8CLiwIterable@@UAEHAAV0@@Z @ 15 NONAME ; int CLiwIterable::operator==(class CLiwIterable &)
+	??8CLiwList@@UBEHABV0@@Z @ 16 NONAME ; int CLiwList::operator==(class CLiwList const &) const
+	??8CLiwMap@@UBEHABV0@@Z @ 17 NONAME ; int CLiwMap::operator==(class CLiwMap const &) const
+	??ACLiwGenericParamList@@QBEABVTLiwGenericParam@@H@Z @ 18 NONAME ; class TLiwGenericParam const & CLiwGenericParamList::operator[](int) const
+	?AddMenuItemL@CLiwMenuPane@@QAEXHAAUSData@CEikMenuPaneItem@@H@Z @ 19 NONAME ; void CLiwMenuPane::AddMenuItemL(int, struct CEikMenuPaneItem::SData &, int)
+	?AddMenuItemL@CLiwMenuPane@@QAEXHAAUSData@CEikMenuPaneItem@@HABVTDesC16@@@Z @ 20 NONAME ; void CLiwMenuPane::AddMenuItemL(int, struct CEikMenuPaneItem::SData &, int, class TDesC16 const &)
+	?AddMenuItemsL@CLiwMenuPane@@QAEXAAV?$TBuf@$0BAA@@@HHHH@Z @ 21 NONAME ; void CLiwMenuPane::AddMenuItemsL(class TBuf<256> &, int, int, int, int)
+	?AddMenuItemsL@CLiwMenuPane@@QAEXAAVTResourceReader@@HHH@Z @ 22 NONAME ; void CLiwMenuPane::AddMenuItemsL(class TResourceReader &, int, int, int)
+	?AddTitleItemL@CLiwMenuPane@@QAEXABVTDesC16@@H@Z @ 23 NONAME ; void CLiwMenuPane::AddTitleItemL(class TDesC16 const &, int)
+	?AppendL@CLiwDefaultList@@UAEXABVTLiwVariant@@@Z @ 24 NONAME ; void CLiwDefaultList::AppendL(class TLiwVariant const &)
+	?AppendL@CLiwGenericParamList@@QAEXABV1@@Z @ 25 NONAME ; void CLiwGenericParamList::AppendL(class CLiwGenericParamList const &)
+	?AppendL@CLiwGenericParamList@@QAEXABVTLiwGenericParam@@@Z @ 26 NONAME ; void CLiwGenericParamList::AppendL(class TLiwGenericParam const &)
+	?AsBuffer@TLiwVariant@@QBEPAVCLiwBuffer@@XZ @ 27 NONAME ; class CLiwBuffer * TLiwVariant::AsBuffer(void) const
+	?AsData@TLiwVariant@@QBE?AVTPtrC8@@XZ @ 28 NONAME ; class TPtrC8 TLiwVariant::AsData(void) const
+	?AsDes@TLiwVariant@@QBE?AVTPtrC16@@XZ @ 29 NONAME ; class TPtrC16 TLiwVariant::AsDes(void) const
+	?AsFileHandle@TLiwVariant@@QBE?AVRFile@@XZ @ 30 NONAME ; class RFile TLiwVariant::AsFileHandle(void) const
+	?AsInterface@TLiwVariant@@QBEPAVMLiwInterface@@XZ @ 31 NONAME ; class MLiwInterface * TLiwVariant::AsInterface(void) const
+	?AsIterable@TLiwVariant@@QBEPAVCLiwIterable@@XZ @ 32 NONAME ; class CLiwIterable * TLiwVariant::AsIterable(void) const
+	?AsList@TLiwVariant@@QBEPBVCLiwList@@XZ @ 33 NONAME ; class CLiwList const * TLiwVariant::AsList(void) const
+	?AsMap@TLiwVariant@@QBEPBVCLiwMap@@XZ @ 34 NONAME ; class CLiwMap const * TLiwVariant::AsMap(void) const
+	?AsTBool@TLiwVariant@@QBEHXZ @ 35 NONAME ; int TLiwVariant::AsTBool(void) const
+	?AsTInt32@TLiwVariant@@QBEJXZ @ 36 NONAME ; long TLiwVariant::AsTInt32(void) const
+	?AsTReal@TLiwVariant@@QBENXZ @ 37 NONAME ; double TLiwVariant::AsTReal(void) const
+	?AsTTime@TLiwVariant@@QBE?AVTTime@@XZ @ 38 NONAME ; class TTime TLiwVariant::AsTTime(void) const
+	?AsTUid@TLiwVariant@@QBE?AVTUid@@XZ @ 39 NONAME ; class TUid TLiwVariant::AsTUid(void) const
+	?AsTUint@TLiwVariant@@QBEHXZ @ 40 NONAME ; int TLiwVariant::AsTUint(void) const
+	?AtL@CLiwDefaultList@@UBEHHAAVTLiwVariant@@@Z @ 41 NONAME ; int CLiwDefaultList::AtL(int, class TLiwVariant &) const
+	?AtL@CLiwDefaultMap@@QBEABVTDesC8@@H@Z @ 42 NONAME ; class TDesC8 const & CLiwDefaultMap::AtL(int) const
+	?AtL@CLiwDefaultMap@@UBEHHAAVTDes8@@@Z @ 43 NONAME ; int CLiwDefaultMap::AtL(int, class TDes8 &) const
+	?AtL@CLiwGenericParamList@@QBEXHAAVTLiwGenericParam@@@Z @ 44 NONAME ; void CLiwGenericParamList::AtL(int, class TLiwGenericParam &) const
+	?AttachL@CLiwServiceHandler@@QAEHABV?$RPointerArray@VCLiwCriteriaItem@@@@@Z @ 45 NONAME ; int CLiwServiceHandler::AttachL(class RPointerArray<class CLiwCriteriaItem> const &)
+	?AttachL@CLiwServiceHandler@@QAEHABV?$RPointerArray@VCLiwCriteriaItem@@@@AAVCRTSecMgrScriptSession@@@Z @ 46 NONAME ; int CLiwServiceHandler::AttachL(class RPointerArray<class CLiwCriteriaItem> const &, class CRTSecMgrScriptSession &)
+	?AttachL@CLiwServiceHandler@@QAEXH@Z @ 47 NONAME ; void CLiwServiceHandler::AttachL(int)
+	?AttachMenuL@CLiwServiceHandler@@QAEXAAV?$RArray@H@@HAAV?$RPointerArray@VCLiwCriteriaItem@@@@@Z @ 48 NONAME ; void CLiwServiceHandler::AttachMenuL(class RArray<int> &, int, class RPointerArray<class CLiwCriteriaItem> &)
+	?AttachMenuL@CLiwServiceHandler@@QAEXHAAVTResourceReader@@@Z @ 49 NONAME ; void CLiwServiceHandler::AttachMenuL(int, class TResourceReader &)
+	?AttachMenuL@CLiwServiceHandler@@QAEXHABV?$RPointerArray@VCLiwCriteriaItem@@@@@Z @ 50 NONAME ; void CLiwServiceHandler::AttachMenuL(int, class RPointerArray<class CLiwCriteriaItem> const &)
+	?AttachMenuL@CLiwServiceHandler@@QAEXHH@Z @ 51 NONAME ; void CLiwServiceHandler::AttachMenuL(int, int)
+	?ContentType@CLiwCriteriaItem@@QBEABVTDesC8@@XZ @ 52 NONAME ; class TDesC8 const & CLiwCriteriaItem::ContentType(void) const
+	?Count@CLiwDefaultList@@UBEHXZ @ 53 NONAME ; int CLiwDefaultList::Count(void) const
+	?Count@CLiwDefaultMap@@UBEHXZ @ 54 NONAME ; int CLiwDefaultMap::Count(void) const
+	?Count@CLiwGenericParamList@@QBEHHW4TVariantTypeId@LIW@@@Z @ 55 NONAME ; int CLiwGenericParamList::Count(int, enum LIW::TVariantTypeId) const
+	?Count@CLiwGenericParamList@@QBEHXZ @ 56 NONAME ; int CLiwGenericParamList::Count(void) const
+	?DefaultProvider@CLiwCriteriaItem@@QBE?AVTUid@@XZ @ 57 NONAME ; class TUid CLiwCriteriaItem::DefaultProvider(void) const
+	?DetachL@CLiwServiceHandler@@QAEXABV?$RPointerArray@VCLiwCriteriaItem@@@@@Z @ 58 NONAME ; void CLiwServiceHandler::DetachL(class RPointerArray<class CLiwCriteriaItem> const &)
+	?DetachL@CLiwServiceHandler@@QAEXH@Z @ 59 NONAME ; void CLiwServiceHandler::DetachL(int)
+	?DetachMenu@CLiwServiceHandler@@QAEXHH@Z @ 60 NONAME ; void CLiwServiceHandler::DetachMenu(int, int)
+	?Dump@@YAXABVTLiwVariant@@@Z @ 61 NONAME ; void Dump(class TLiwVariant const &)
+	?DynCmdId@CLiwMenuPane@@QBEHH@Z @ 62 NONAME ; int CLiwMenuPane::DynCmdId(int) const
+	?ExecuteMenuCmdL@CLiwServiceHandler@@QAEXHABVCLiwGenericParamList@@AAV2@IPAVMLiwNotifyCallback@@@Z @ 63 NONAME ; void CLiwServiceHandler::ExecuteMenuCmdL(int, class CLiwGenericParamList const &, class CLiwGenericParamList &, unsigned int, class MLiwNotifyCallback *)
+	?ExecuteServiceCmdL@CLiwServiceHandler@@QAEXABHABVCLiwGenericParamList@@AAV2@IPAVMLiwNotifyCallback@@@Z @ 64 NONAME ; void CLiwServiceHandler::ExecuteServiceCmdL(int const &, class CLiwGenericParamList const &, class CLiwGenericParamList &, unsigned int, class MLiwNotifyCallback *)
+	?ExecuteServiceCmdL@CLiwServiceHandler@@QAEXABVCLiwCriteriaItem@@ABVCLiwGenericParamList@@AAV3@IPAVMLiwNotifyCallback@@@Z @ 65 NONAME ; void CLiwServiceHandler::ExecuteServiceCmdL(class CLiwCriteriaItem const &, class CLiwGenericParamList const &, class CLiwGenericParamList &, unsigned int, class MLiwNotifyCallback *)
+	?ExtensionInterface@CLiwServiceIfBase@@MAEPAXVTUid@@@Z @ 66 NONAME ; void * CLiwServiceIfBase::ExtensionInterface(class TUid)
+	?ExtensionInterface@CLiwServiceIfMenu@@MAEPAXVTUid@@@Z @ 67 NONAME ; void * CLiwServiceIfMenu::ExtensionInterface(class TUid)
+	?ExternalizeL@CLiwContainer@@UBEXAAVRWriteStream@@@Z @ 68 NONAME ; void CLiwContainer::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CLiwDefaultList@@UBEXAAVRWriteStream@@@Z @ 69 NONAME ; void CLiwDefaultList::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CLiwDefaultMap@@UBEXAAVRWriteStream@@@Z @ 70 NONAME ; void CLiwDefaultMap::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CLiwGenericParamList@@QBEXAAVRWriteStream@@@Z @ 71 NONAME ; void CLiwGenericParamList::ExternalizeL(class RWriteStream &) const
+	?FindFirst@CLiwGenericParamList@@QBEPBVTLiwGenericParam@@AAHABVTDesC8@@W4TVariantTypeId@LIW@@@Z @ 72 NONAME ; class TLiwGenericParam const * CLiwGenericParamList::FindFirst(int &, class TDesC8 const &, enum LIW::TVariantTypeId) const
+	?FindFirst@CLiwGenericParamList@@QBEPBVTLiwGenericParam@@AAHHW4TVariantTypeId@LIW@@@Z @ 73 NONAME ; class TLiwGenericParam const * CLiwGenericParamList::FindFirst(int &, int, enum LIW::TVariantTypeId) const
+	?FindL@CLiwDefaultMap@@UBEHABVTDesC8@@AAVTLiwVariant@@@Z @ 74 NONAME ; int CLiwDefaultMap::FindL(class TDesC8 const &, class TLiwVariant &) const
+	?FindNext@CLiwGenericParamList@@QBEPBVTLiwGenericParam@@AAHABVTDesC8@@W4TVariantTypeId@LIW@@@Z @ 75 NONAME ; class TLiwGenericParam const * CLiwGenericParamList::FindNext(int &, class TDesC8 const &, enum LIW::TVariantTypeId) const
+	?FindNext@CLiwGenericParamList@@QBEPBVTLiwGenericParam@@AAHHW4TVariantTypeId@LIW@@@Z @ 76 NONAME ; class TLiwGenericParam const * CLiwGenericParamList::FindNext(int &, int, enum LIW::TVariantTypeId) const
+	?Get@TLiwVariant@@QBEHAAH@Z @ 77 NONAME ; int TLiwVariant::Get(int &) const
+	?Get@TLiwVariant@@QBEHAAI@Z @ 78 NONAME ; int TLiwVariant::Get(unsigned int &) const
+	?Get@TLiwVariant@@QBEHAAJ@Z @ 79 NONAME ; int TLiwVariant::Get(long &) const
+	?Get@TLiwVariant@@QBEHAAN@Z @ 80 NONAME ; int TLiwVariant::Get(double &) const
+	?Get@TLiwVariant@@QBEHAAVCLiwList@@@Z @ 81 NONAME ; int TLiwVariant::Get(class CLiwList &) const
+	?Get@TLiwVariant@@QBEHAAVCLiwMap@@@Z @ 82 NONAME ; int TLiwVariant::Get(class CLiwMap &) const
+	?Get@TLiwVariant@@QBEHAAVRFile@@@Z @ 83 NONAME ; int TLiwVariant::Get(class RFile &) const
+	?Get@TLiwVariant@@QBEHAAVTDes16@@@Z @ 84 NONAME ; int TLiwVariant::Get(class TDes16 &) const
+	?Get@TLiwVariant@@QBEHAAVTDes8@@@Z @ 85 NONAME ; int TLiwVariant::Get(class TDes8 &) const
+	?Get@TLiwVariant@@QBEHAAVTPtrC16@@@Z @ 86 NONAME ; int TLiwVariant::Get(class TPtrC16 &) const
+	?Get@TLiwVariant@@QBEHAAVTPtrC8@@@Z @ 87 NONAME ; int TLiwVariant::Get(class TPtrC8 &) const
+	?Get@TLiwVariant@@QBEHAAVTTime@@@Z @ 88 NONAME ; int TLiwVariant::Get(class TTime &) const
+	?Get@TLiwVariant@@QBEHAAVTUid@@@Z @ 89 NONAME ; int TLiwVariant::Get(class TUid &) const
+	?GetCriteria@CLiwServiceHandler@@QAEPBVCLiwCriteriaItem@@H@Z @ 90 NONAME ; class CLiwCriteriaItem const * CLiwServiceHandler::GetCriteria(int)
+	?GetInterest@CLiwServiceHandler@@QAEXAAV?$RPointerArray@VCLiwCriteriaItem@@@@@Z @ 91 NONAME ; void CLiwServiceHandler::GetInterest(class RPointerArray<class CLiwCriteriaItem> &)
+	?GetMetaDataOptions@CLiwCriteriaItem@@QBEXAAVTLiwVariant@@@Z @ 92 NONAME ; void CLiwCriteriaItem::GetMetaDataOptions(class TLiwVariant &) const
+	?GetTransactionID@MLiwNotifyCallback@@SAJXZ @ 93 NONAME ; long MLiwNotifyCallback::GetTransactionID(void)
+	?HandleSubmenuL@CLiwServiceHandler@@QAEHAAVCEikMenuPane@@@Z @ 94 NONAME ; int CLiwServiceHandler::HandleSubmenuL(class CEikMenuPane &)
+	?Id@CLiwCriteriaItem@@QBEHXZ @ 95 NONAME ; int CLiwCriteriaItem::Id(void) const
+	?InParamListL@CLiwServiceHandler@@QAEAAVCLiwGenericParamList@@XZ @ 96 NONAME ; class CLiwGenericParamList & CLiwServiceHandler::InParamListL(void)
+	?InitializeMenuPaneL@CLiwServiceHandler@@QAEXAAVCEikMenuPane@@HHABVCLiwGenericParamList@@@Z @ 97 NONAME ; void CLiwServiceHandler::InitializeMenuPaneL(class CEikMenuPane &, int, int, class CLiwGenericParamList const &)
+	?InitializeMenuPaneL@CLiwServiceHandler@@QAEXAAVCEikMenuPane@@HHABVCLiwGenericParamList@@H@Z @ 98 NONAME ; void CLiwServiceHandler::InitializeMenuPaneL(class CEikMenuPane &, int, int, class CLiwGenericParamList const &, int)
+	?InsertL@CLiwDefaultMap@@UAEXABVTDesC8@@ABVTLiwVariant@@@Z @ 99 NONAME ; void CLiwDefaultMap::InsertL(class TDesC8 const &, class TLiwVariant const &)
+	?InternalizeL@CLiwGenericParamList@@QAEXAAVRReadStream@@@Z @ 100 NONAME ; void CLiwGenericParamList::InternalizeL(class RReadStream &)
+	?IsLiwMenu@CLiwServiceHandler@@QAEHH@Z @ 101 NONAME ; int CLiwServiceHandler::IsLiwMenu(int)
+	?IsSubMenuEmpty@CLiwServiceHandler@@QAEHH@Z @ 102 NONAME ; int CLiwServiceHandler::IsSubMenuEmpty(int)
+	?MaxProviders@CLiwCriteriaItem@@QBEHXZ @ 103 NONAME ; int CLiwCriteriaItem::MaxProviders(void) const
+	?MenuCmdId@CLiwMenuPane@@QBEHH@Z @ 104 NONAME ; int CLiwMenuPane::MenuCmdId(int) const
+	?MenuCmdId@CLiwServiceHandler@@QBEHH@Z @ 105 NONAME ; int CLiwServiceHandler::MenuCmdId(int) const
+	?MenuPane@CLiwServiceIfMenu@@QBEPBVCLiwMenuPane@@XZ @ 106 NONAME ; class CLiwMenuPane const * CLiwServiceIfMenu::MenuPane(void) const
+	?NbrOfProviders@CLiwServiceHandler@@QAEHPBVCLiwCriteriaItem@@@Z @ 107 NONAME ; int CLiwServiceHandler::NbrOfProviders(class CLiwCriteriaItem const *)
+	?NewL@CLiwCriteriaItem@@SAPAV1@HABVTDesC8@@0@Z @ 108 NONAME ; class CLiwCriteriaItem * CLiwCriteriaItem::NewL(int, class TDesC8 const &, class TDesC8 const &)
+	?NewL@CLiwCriteriaItem@@SAPAV1@HHABVTDesC8@@@Z @ 109 NONAME ; class CLiwCriteriaItem * CLiwCriteriaItem::NewL(int, int, class TDesC8 const &)
+	?NewL@CLiwCriteriaItem@@SAPAV1@XZ @ 110 NONAME ; class CLiwCriteriaItem * CLiwCriteriaItem::NewL(void)
+	?NewL@CLiwDefaultList@@SAPAV1@XZ @ 111 NONAME ; class CLiwDefaultList * CLiwDefaultList::NewL(void)
+	?NewL@CLiwDefaultMap@@SAPAV1@XZ @ 112 NONAME ; class CLiwDefaultMap * CLiwDefaultMap::NewL(void)
+	?NewL@CLiwGenericParamList@@SAPAV1@AAVRReadStream@@@Z @ 113 NONAME ; class CLiwGenericParamList * CLiwGenericParamList::NewL(class RReadStream &)
+	?NewL@CLiwGenericParamList@@SAPAV1@XZ @ 114 NONAME ; class CLiwGenericParamList * CLiwGenericParamList::NewL(void)
+	?NewL@CLiwServiceHandler@@SAPAV1@XZ @ 115 NONAME ; class CLiwServiceHandler * CLiwServiceHandler::NewL(void)
+	?NewLC@CLiwCriteriaItem@@SAPAV1@HABVTDesC8@@0@Z @ 116 NONAME ; class CLiwCriteriaItem * CLiwCriteriaItem::NewLC(int, class TDesC8 const &, class TDesC8 const &)
+	?NewLC@CLiwCriteriaItem@@SAPAV1@HHABVTDesC8@@@Z @ 117 NONAME ; class CLiwCriteriaItem * CLiwCriteriaItem::NewLC(int, int, class TDesC8 const &)
+	?NewLC@CLiwCriteriaItem@@SAPAV1@XZ @ 118 NONAME ; class CLiwCriteriaItem * CLiwCriteriaItem::NewLC(void)
+	?NewLC@CLiwDefaultList@@SAPAV1@AAVRReadStream@@@Z @ 119 NONAME ; class CLiwDefaultList * CLiwDefaultList::NewLC(class RReadStream &)
+	?NewLC@CLiwDefaultMap@@SAPAV1@AAVRReadStream@@@Z @ 120 NONAME ; class CLiwDefaultMap * CLiwDefaultMap::NewLC(class RReadStream &)
+	?NewLC@CLiwGenericParamList@@SAPAV1@AAVRReadStream@@@Z @ 121 NONAME ; class CLiwGenericParamList * CLiwGenericParamList::NewLC(class RReadStream &)
+	?NewLC@CLiwGenericParamList@@SAPAV1@XZ @ 122 NONAME ; class CLiwGenericParamList * CLiwGenericParamList::NewLC(void)
+	?NewLC@CLiwServiceHandler@@SAPAV1@XZ @ 123 NONAME ; class CLiwServiceHandler * CLiwServiceHandler::NewLC(void)
+	?Options@CLiwCriteriaItem@@QBEIXZ @ 124 NONAME ; unsigned int CLiwCriteriaItem::Options(void) const
+	?OutParamListL@CLiwServiceHandler@@QAEAAVCLiwGenericParamList@@XZ @ 125 NONAME ; class CLiwGenericParamList & CLiwServiceHandler::OutParamListL(void)
+	?PackForServerL@CLiwGenericParamList@@QAEPAVHBufC8@@AAVTIpcArgs@@@Z @ 126 NONAME ; class HBufC8 * CLiwGenericParamList::PackForServerL(class TIpcArgs &)
+	?QueryImplementationL@CLiwServiceHandler@@QAEXAAV?$RPointerArray@VCLiwCriteriaItem@@@@0@Z @ 127 NONAME ; void CLiwServiceHandler::QueryImplementationL(class RPointerArray<class CLiwCriteriaItem> &, class RPointerArray<class CLiwCriteriaItem> &)
+	?ReadFromResoureL@CLiwCriteriaItem@@QAEXAAVTResourceReader@@@Z @ 128 NONAME ; void CLiwCriteriaItem::ReadFromResoureL(class TResourceReader &)
+	?Remove@CLiwDefaultList@@UAEXH@Z @ 129 NONAME ; void CLiwDefaultList::Remove(int)
+	?Remove@CLiwDefaultMap@@UAEXABVTDesC8@@@Z @ 130 NONAME ; void CLiwDefaultMap::Remove(class TDesC8 const &)
+	?Remove@CLiwGenericParamList@@QAEHH@Z @ 131 NONAME ; int CLiwGenericParamList::Remove(int)
+	?Remove@CLiwGenericParamList@@QAEXABVTDesC8@@@Z @ 132 NONAME ; void CLiwGenericParamList::Remove(class TDesC8 const &)
+	?ReportMenuLaunch@CLiwServiceHandler@@SAXXZ @ 133 NONAME ; void CLiwServiceHandler::ReportMenuLaunch(void)
+	?Reset@CLiwGenericParamList@@QAEXXZ @ 134 NONAME ; void CLiwGenericParamList::Reset(void)
+	?Reset@CLiwServiceHandler@@QAEXXZ @ 135 NONAME ; void CLiwServiceHandler::Reset(void)
+	?Reset@TLiwVariant@@QAEXXZ @ 136 NONAME ; void TLiwVariant::Reset(void)
+	?ServiceClass@CLiwCriteriaItem@@QBEABVTUid@@XZ @ 137 NONAME ; class TUid const & CLiwCriteriaItem::ServiceClass(void) const
+	?ServiceCmd@CLiwCriteriaItem@@QBEHXZ @ 138 NONAME ; int CLiwCriteriaItem::ServiceCmd(void) const
+	?ServiceCmdByMenuCmd@CLiwServiceHandler@@QBEHH@Z @ 139 NONAME ; int CLiwServiceHandler::ServiceCmdByMenuCmd(int) const
+	?ServiceCmdId@CLiwMenuPane@@QBEHH@Z @ 140 NONAME ; int CLiwMenuPane::ServiceCmdId(int) const
+	?ServiceCmdStr@CLiwCriteriaItem@@QBEABVTDesC8@@XZ @ 141 NONAME ; class TDesC8 const & CLiwCriteriaItem::ServiceCmdStr(void) const
+	?Set@TLiwVariant@@QAEXABVRFile@@@Z @ 142 NONAME ; void TLiwVariant::Set(class RFile const &)
+	?Set@TLiwVariant@@QAEXABVTDesC16@@@Z @ 143 NONAME ; void TLiwVariant::Set(class TDesC16 const &)
+	?Set@TLiwVariant@@QAEXABVTDesC8@@@Z @ 144 NONAME ; void TLiwVariant::Set(class TDesC8 const &)
+	?Set@TLiwVariant@@QAEXABVTTime@@@Z @ 145 NONAME ; void TLiwVariant::Set(class TTime const &)
+	?Set@TLiwVariant@@QAEXABVTUid@@@Z @ 146 NONAME ; void TLiwVariant::Set(class TUid const &)
+	?Set@TLiwVariant@@QAEXH@Z @ 147 NONAME ; void TLiwVariant::Set(int)
+	?Set@TLiwVariant@@QAEXI@Z @ 148 NONAME ; void TLiwVariant::Set(unsigned int)
+	?Set@TLiwVariant@@QAEXJ@Z @ 149 NONAME ; void TLiwVariant::Set(long)
+	?Set@TLiwVariant@@QAEXN@Z @ 150 NONAME ; void TLiwVariant::Set(double)
+	?Set@TLiwVariant@@QAEXPBVCLiwBuffer@@@Z @ 151 NONAME ; void TLiwVariant::Set(class CLiwBuffer const *)
+	?Set@TLiwVariant@@QAEXPBVCLiwIterable@@@Z @ 152 NONAME ; void TLiwVariant::Set(class CLiwIterable const *)
+	?Set@TLiwVariant@@QAEXPBVCLiwList@@@Z @ 153 NONAME ; void TLiwVariant::Set(class CLiwList const *)
+	?Set@TLiwVariant@@QAEXPBVCLiwMap@@@Z @ 154 NONAME ; void TLiwVariant::Set(class CLiwMap const *)
+	?Set@TLiwVariant@@QAEXPBVMLiwInterface@@@Z @ 155 NONAME ; void TLiwVariant::Set(class MLiwInterface const *)
+	?SetContentTypeL@CLiwCriteriaItem@@QAEXABVTDesC8@@@Z @ 156 NONAME ; void CLiwCriteriaItem::SetContentTypeL(class TDesC8 const &)
+	?SetDefaultProvider@CLiwCriteriaItem@@QAEXH@Z @ 157 NONAME ; void CLiwCriteriaItem::SetDefaultProvider(int)
+	?SetId@CLiwCriteriaItem@@QAEXH@Z @ 158 NONAME ; void CLiwCriteriaItem::SetId(int)
+	?SetL@TLiwVariant@@QAEXABV1@@Z @ 159 NONAME ; void TLiwVariant::SetL(class TLiwVariant const &)
+	?SetMaxProviders@CLiwCriteriaItem@@QAEXH@Z @ 160 NONAME ; void CLiwCriteriaItem::SetMaxProviders(int)
+	?SetMetaDataOptions@CLiwCriteriaItem@@QAEXABVTLiwVariant@@@Z @ 161 NONAME ; void CLiwCriteriaItem::SetMetaDataOptions(class TLiwVariant const &)
+	?SetOptions@CLiwCriteriaItem@@QAEXI@Z @ 162 NONAME ; void CLiwCriteriaItem::SetOptions(unsigned int)
+	?SetServiceClass@CLiwCriteriaItem@@QAEXABVTUid@@@Z @ 163 NONAME ; void CLiwCriteriaItem::SetServiceClass(class TUid const &)
+	?SetServiceCmd@CLiwCriteriaItem@@QAEXH@Z @ 164 NONAME ; void CLiwCriteriaItem::SetServiceCmd(int)
+	?SetServiceCmdL@CLiwCriteriaItem@@QAEXABVTDesC8@@@Z @ 165 NONAME ; void CLiwCriteriaItem::SetServiceCmdL(class TDesC8 const &)
+	?Size@CLiwContainer@@UBEHXZ @ 166 NONAME ; int CLiwContainer::Size(void) const
+	?Size@CLiwDefaultList@@UBEHXZ @ 167 NONAME ; int CLiwDefaultList::Size(void) const
+	?Size@CLiwDefaultMap@@UBEHXZ @ 168 NONAME ; int CLiwDefaultMap::Size(void) const
+	?Size@CLiwGenericParamList@@QBEHXZ @ 169 NONAME ; int CLiwGenericParamList::Size(void) const
+	?UnpackFromClientL@CLiwGenericParamList@@QAEXABVRMessage2@@@Z @ 170 NONAME ; void CLiwGenericParamList::UnpackFromClientL(class RMessage2 const &)
+	?VariantCleanup@TLiwVariant@@SAXPAX@Z @ 171 NONAME ; void TLiwVariant::VariantCleanup(void *)
+	?Close@CLiwContainer@@QAEXXZ @ 172 NONAME ; void CLiwContainer::Close(void)
+	?ParamCleanup@TLiwGenericParam@@SAXPAX@Z @ 173 NONAME ; void TLiwGenericParam::ParamCleanup(void *)
+	?NewLC@CLiwDefaultList@@SAPAV1@XZ @ 174 NONAME ; class CLiwDefaultList * CLiwDefaultList::NewLC(void)
+	?NewLC@CLiwDefaultMap@@SAPAV1@XZ @ 175 NONAME ; class CLiwDefaultMap * CLiwDefaultMap::NewLC(void)
+	?PushL@TLiwVariant@@QAEXXZ @ 176 NONAME ; void TLiwVariant::PushL(void)
+	?PushL@CLiwContainer@@QAEXXZ @ 177 NONAME ; void CLiwContainer::PushL(void)
+	?PushL@TLiwGenericParam@@QAEXXZ @ 178 NONAME ; void TLiwGenericParam::PushL(void)
+	?AsTInt64@TLiwVariant@@QBE_JXZ @ 179 NONAME ; long long TLiwVariant::AsTInt64(void) const
+	?Get@TLiwVariant@@QBEHAA_J@Z @ 180 NONAME ; int TLiwVariant::Get(long long &) const
+	?Set@TLiwVariant@@QAEX_J@Z @ 181 NONAME ; void TLiwVariant::Set(long long)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/data/2000B5D4.rss	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Registry info for LIW Custom Resolver.
+*
+*/
+
+
+
+
+
+
+
+#include "registryinfo.rh"
+#include "liwuids.hrh"
+
+// Declares the interface implementation provided: a custom resolver
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = KLiwResolverDLLUidValue;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // Interface UID of resolvers
+            interface_uid = 0x10009D90; // Uid for CResolver interface
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KLiwResolverImplUidValue;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/data/liwservicehandler.rss	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       LIW menu resource placeholders are defined here.
+*
+*/
+
+
+
+
+
+
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include "liwmenuslot.hrh"
+
+NAME LIWR
+
+RESOURCE RSS_SIGNATURE { }
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_0
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot0; }
+        };
+    } 
+
+RESOURCE MENU_PANE r_liw_empty_menu_1
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot1; }
+        };
+    } 
+
+RESOURCE MENU_PANE r_liw_empty_menu_2
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot2; }
+        };
+    } 
+
+RESOURCE MENU_PANE r_liw_empty_menu_3
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot3; }
+        };
+    } 
+
+RESOURCE MENU_PANE r_liw_empty_menu_4
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot4; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_5
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot5; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_6
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot6; }
+        };
+    } 
+
+RESOURCE MENU_PANE r_liw_empty_menu_7
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot7; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_8
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot8; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_9
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot9; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_10
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot10; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_11
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot11; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_12
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot12; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_13
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot13; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_14
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot14; }
+        };
+    } 
+
+
+RESOURCE MENU_PANE r_liw_empty_menu_15
+    {
+    items =
+        {
+        MENU_ITEM { command=ELiwMenuSlot15; }
+        };
+    } 
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       This file provides the information required for
+*                building the whole LIWFW.
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+//../inc/LiwServiceData.h						 					 MW_LAYER_PLATFORM_EXPORT_PATH(LiwServiceData.h)
+
+
+// ../install/liwservicehandlerstub.sis      /epoc32/data/z/system/install/liwservicehandlerstub.sis
+
+// Export IBY  and LOC files as per CP50 build improvements.
+// ../rom/liwservicehandler.iby  					CORE_MW_LAYER_IBY_EXPORT_PATH(liwservicehandler.iby)
+
+PRJ_MMPFILES
+
+#ifndef TOOLS
+
+ServiceHandler.mmp
+LiwResolver.mmp
+
+#endif
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/group/liwresolver.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Project definition file for LiwResolver.
+*
+*/
+
+
+
+
+
+
+
+#include "../inc/liwuids.hrh"
+#include <platform_paths.hrh>
+
+TARGET          liwResolver.dll
+CAPABILITY      CAP_ECOM_PLUGIN
+TARGETTYPE      PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D KLiwResolverDLLUidValue
+VENDORID        VID_DEFAULT
+
+VERSION 10.1
+paged
+
+SOURCEPATH      ../src
+SOURCE          LiwResolver.cpp
+
+USERINCLUDE     ../inc
+SYSTEMINCLUDE   /epoc32/include/ecom
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/2000B5D4.RSS
+TARGET liwResolver.rsc                                                              
+END
+
+LIBRARY         euser.lib
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/group/servicehandler.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       LIW project file.
+*
+*/
+
+
+
+
+
+
+
+#include "../inc/liwuids.hrh"
+#include <platform_paths.hrh>
+
+TARGET          liwServiceHandler.dll
+TARGETTYPE      DLL
+UID             0x1000008d KLiwServiceHandlerDLLUidValue
+
+
+VERSION 10.1
+paged
+
+CAPABILITY      CAP_GENERAL_DLL
+
+SOURCEPATH      ../src
+SOURCE          LiwCommon.cpp
+SOURCE          LiwServiceHandler.cpp
+SOURCE          LiwServiceHandlerImpl.cpp
+SOURCE          LiwMenu.cpp
+SOURCE          LiwBinding.cpp
+SOURCE          LiwMenuBinding.cpp
+SOURCE          LiwServiceIfBase.cpp
+SOURCE          LiwServiceIfMenu.cpp
+SOURCE          LiwGenericParam.cpp
+SOURCE          LiwVariant.cpp
+SOURCE          LiwEcomMonitor.cpp
+SOURCE          LiwTlsData.cpp
+SOURCE          LiwXmlHandler.cpp
+SOURCE          LiwServiceData.cpp
+
+USERINCLUDE     . 
+USERINCLUDE     ../inc
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+
+#include <data_caging_paths.hrh>
+
+START RESOURCE ../data/liwServiceHandler.rss
+	HEADER    
+	TARGETPATH   RESOURCE_FILES_DIR  
+END
+
+LIBRARY         euser.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         ecom.lib
+LIBRARY         cone.lib
+LIBRARY         bafl.lib 
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         eikcore.lib 
+LIBRARY			SenXML.lib
+LIBRARY	 	  	RTSecMgrClient.lib
+LIBRARY	 	  	inetprotutil.lib
+
+START WINS
+END
+
+START MARM
+END
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwbinding.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Criteria binding base class declaration.
+*
+*/
+
+
+
+
+
+
+
+#ifndef _LIW_BINDING_H
+#define _LIW_BINDING_H
+
+#include "liwcommon.h" 
+#include "liwserviceifbase.h"
+
+class CLiwBinding : public CBase
+    {
+    public:
+        static CLiwBinding* NewL();
+        static CLiwBinding* NewLC();
+
+        inline virtual ~CLiwBinding();
+        inline RPointerArray<CLiwCriteriaItem>& Interest(); 
+        inline void AddCriteriaL(CLiwCriteriaItem* aItem);
+        inline CLiwServiceIfBase* BaseProvider(TInt aIndex);
+        inline TInt NumberOfProviders() const;
+        void AddProviderL(CLiwServiceIfBase* aProvider, TBool aIsDefault);
+        TBool RemoveProvider(TInt aImplUid);
+        TInt HasCriteriaItem(CLiwCriteriaItem& aItem) const;
+        void RemoveCriteria(TInt aIndex);
+        TBool HasProvider(CLiwServiceIfBase* aProvider) const;
+        TBool HasServiceCmd(TInt aServiceCmd) const;
+    protected:
+        inline CLiwBinding();
+    
+    private:
+    
+    protected:
+        RPointerArray<CLiwCriteriaItem> iInterest;
+        RPointerArray<CLiwServiceIfBase> iProviders;
+    };
+
+
+#include "liwbinding.inl"
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwbinding.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Criteria binding base class declaration.
+*
+*/
+
+
+
+
+
+
+
+inline CLiwBinding::~CLiwBinding()
+    {
+    iInterest.Reset();
+    iProviders.Reset();
+    }
+
+
+inline CLiwBinding::CLiwBinding()
+    {
+    }
+
+
+inline RPointerArray<CLiwCriteriaItem>& CLiwBinding::Interest()
+    {
+    return iInterest;
+    }
+
+
+inline void CLiwBinding::AddCriteriaL(CLiwCriteriaItem* aItem)
+    {
+    User::LeaveIfError(iInterest.Append(aItem));
+    }
+
+
+inline CLiwServiceIfBase* CLiwBinding::BaseProvider(TInt aIndex)
+    {
+    if (aIndex < iProviders.Count())
+        {
+        return iProviders[aIndex];
+        }
+    return NULL;
+    }
+
+    
+inline TInt CLiwBinding::NumberOfProviders() const
+    {
+    return iProviders.Count();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwecommonitor.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares ECom monitoring class for LIW framework.
+*
+*/
+
+
+
+
+
+
+#ifndef _LIWECOMMONITOR_H
+#define _LIWECOMMONITOR_H
+
+#include <ecom/ecom.h>
+
+// FORWARD DECLARATIONS
+class CLiwCriteriaItem;
+class CLiwServiceIfBase;
+
+class CLiwEcomMonitor : public CActive
+    {
+    public:
+        static CLiwEcomMonitor* NewL(TCallBack& aSynchronizeCallBack);
+        virtual ~CLiwEcomMonitor();
+
+    protected:  // Functions from base classes
+        /**
+        * From CActive
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+    public:
+        inline REComSession& EComSession();
+        void ListImplemetationsL(RImplInfoPtrArray& aResult, CLiwCriteriaItem* aItem) const;
+        CLiwServiceIfBase* CreateImplementationL(TUid aImplUid);
+
+    protected:
+        /**
+        * C++ default constructor.
+        */
+        CLiwEcomMonitor(TCallBack& aSynchronizeCallBack);
+        void ConstructL();
+        void StartMonitoring();
+
+    private:
+        TCallBack    iSynchronizeCallBack;
+        REComSession iEcomSession;
+    };
+
+
+inline REComSession& CLiwEcomMonitor::EComSession()
+    {
+    return iEcomSession;
+    }
+
+#endif // _LIWECOMMONITOR_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwmenubinding.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares LIW Menu utilities for providers to access consumer menu.
+*
+*/
+
+
+
+
+
+
+#ifndef _LIW_MENUBINDING_H
+#define _LIW_MENUBINDING_H
+
+#include "liwserviceifmenu.h"
+#include "liwbinding.h"
+
+/**
+* This utility class is used for binding a set of providers to a menu placeholder.
+*/
+NONSHARABLE_CLASS(CLiwMenuBinding) : public CLiwBinding
+    {
+    public:
+        static CLiwMenuBinding* NewL();
+        static CLiwMenuBinding* NewL(TInt aMenuItemIndex, TInt aMenuId);
+        static CLiwMenuBinding* NewLC();
+        static CLiwMenuBinding* NewLC(TInt aMenuItemIndex, TInt aMenuId);
+
+        virtual ~CLiwMenuBinding();
+
+        inline void SetMenuItemIndex(TInt aMenuItemIndex);
+        inline TInt MenuItemIndex() const;
+        inline CLiwServiceIfMenu* MenuProvider(TInt aIndex);
+        inline TInt MenuCmd() const;
+        inline void SetMenuCmd(TInt aMenuCmd);
+        inline TInt MenuId();
+        inline void SetMenuId(TInt aId);
+        inline void SetMenuPane(CLiwMenuPane* aPane);
+        inline CLiwMenuPane* MenuPane();
+        
+    private:
+        CLiwMenuBinding();
+        CLiwMenuBinding(TInt aMenItemIndex, TInt aParentId);
+        void ConstructL();
+
+    private:
+        TInt iMenuItemIndex;
+        TInt iMenuCmd;      
+        TInt iMenuId;
+        CLiwMenuPane* iMenuPane;
+    };
+
+#include "liwmenubinding.inl"
+
+#endif // _LIW_MENUBINDING_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwmenubinding.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Inline methods for CLiwMenuBinding class.    
+*
+*/
+
+
+
+
+
+
+inline void CLiwMenuBinding::SetMenuItemIndex(TInt aMenuItemIndex)
+    {
+    iMenuItemIndex = aMenuItemIndex;
+    }
+
+
+inline TInt CLiwMenuBinding::MenuItemIndex() const
+    {
+    return iMenuItemIndex;
+    }
+
+
+inline TInt CLiwMenuBinding::MenuCmd() const
+    {
+    return iMenuCmd;
+    }
+
+
+inline void CLiwMenuBinding::SetMenuCmd(TInt aMenuCmd)
+    {
+    iMenuCmd = aMenuCmd;
+    }
+
+
+inline TInt CLiwMenuBinding::MenuId()
+    {
+    return iMenuId;
+    }
+
+
+inline void CLiwMenuBinding::SetMenuId(TInt aId)
+    {
+    iMenuId = aId;
+    }
+
+
+inline CLiwServiceIfMenu* CLiwMenuBinding::MenuProvider(TInt aIndex)
+    {
+    if (aIndex >= 0 && aIndex < iProviders.Count())
+        {
+        return reinterpret_cast<CLiwServiceIfMenu*>(iProviders[aIndex]);
+        }
+    return NULL;
+    }
+
+
+inline void CLiwMenuBinding::SetMenuPane(CLiwMenuPane* aPane)
+    {
+    iMenuPane = aPane;
+    }
+
+
+inline CLiwMenuPane* CLiwMenuBinding::MenuPane()
+    {
+    return iMenuPane;
+    }   
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwmenuslot.hrh	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Menu resource slot definitions.
+*
+*/
+
+
+
+
+
+
+
+#ifndef _LIW_MENU_SLOT_HRH
+#define _LIW_MENU_SLOT_HRH
+
+// Base value can be changed if needed, but other values
+// MUST be consecutive.
+#define ELiwMenuSlotBase 0x5000
+#define ELiwMenuSlot0    ELiwMenuSlotBase
+#define ELiwMenuSlot1    (ELiwMenuSlotBase + 1)
+#define ELiwMenuSlot2    (ELiwMenuSlotBase + 2)
+#define ELiwMenuSlot3    (ELiwMenuSlotBase + 3)
+#define ELiwMenuSlot4    (ELiwMenuSlotBase + 4)
+#define ELiwMenuSlot5    (ELiwMenuSlotBase + 5)
+#define ELiwMenuSlot6    (ELiwMenuSlotBase + 6)
+#define ELiwMenuSlot7    (ELiwMenuSlotBase + 7)
+#define ELiwMenuSlot8    (ELiwMenuSlotBase + 8)
+#define ELiwMenuSlot9    (ELiwMenuSlotBase + 9)
+#define ELiwMenuSlot10   (ELiwMenuSlotBase + 10)
+#define ELiwMenuSlot11   (ELiwMenuSlotBase + 11)
+#define ELiwMenuSlot12   (ELiwMenuSlotBase + 12)
+#define ELiwMenuSlot13   (ELiwMenuSlotBase + 13)
+#define ELiwMenuSlot14   (ELiwMenuSlotBase + 14)
+#define ELiwMenuSlot15   (ELiwMenuSlotBase + 15)
+    
+
+#endif  // LIW_MENU_SLOT_HRH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwresolver.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares custom ECom resolver.
+*
+*/
+
+
+
+
+
+
+#ifndef _LIW_RESOLVER_H
+#define _LIW_RESOLVER_H
+
+#include "liwuids.hrh"
+#include <ecom/resolver.h>
+#include <ecom/publicregistry.h>
+#include <ecom/implementationproxy.h>
+
+// FORWARD DECLARATIONS
+class TEComResolverParams;
+
+// DynFeature resolver's UID
+const TUid KLiwResolverImplUid = { KLiwResolverImplUidValue };
+
+/**
+ * Implements a non-default resolver.
+ *
+ * This controls the identification, (resolution), of which implementation
+ * will be used to satisfy an interface implementation instantiation.
+ */
+class CLiwResolver : public CResolver
+    {
+    public:
+
+        /**
+        * Factory function
+        * @param aRegistry <add description>
+        */
+        static CLiwResolver* NewL(MPublicRegistry& aRegistry);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CLiwResolver();
+
+        /**
+        * Request that the resolver identify the most appropriate interface implementation.
+        * 
+        * @param aInterfaceUid          The interface for which implementations are requested.
+        * @param aAdditionalParameters  Data to be used to refine the search further.
+        * @return                       The Uid of the best fit interface implementation - 
+        *                               KNullUid if no match is found.
+        */
+        TUid IdentifyImplementationL(TUid aInterfaceUid, 
+            const TEComResolverParams& aAdditionalParameters) const;
+
+        /**
+        * List all the implementations which satisfy the specified interface.
+        *
+        * @param aInterfaceUid          The interface for which implementations are requested
+        * @param aAdditionalParameters  Data to be used to refine the search further
+        * @return                       Pointer to an array of suitable implementations. 
+        *                               Ownership of this array is passed to the calling function.
+        */
+        RImplInfoArray* ListAllL(TUid aInterfaceUid, 
+            const TEComResolverParams& aAdditionalParameters) const;
+
+    private:
+
+        /**
+        * Constructor.
+        * @param aRegistry <add description>
+        */
+        explicit CLiwResolver(MPublicRegistry& aRegistry);
+
+        /**
+        * Called by IdentifyImplementationL to select an appropriate implementation from a 
+        * list of possibles.
+        *
+        * @param aImplementationsInfo   Information on the potential implementations
+        * @param aAdditionalParameters  The data to match against to detemine the implementation
+        * @return                       The Uid of the selected implementation - 
+        *                               KNullUid if no match is found
+        */
+        TUid Resolve(const RImplInfoArray& aImplementationsInfo, 
+            const TEComResolverParams& aAdditionalParameters) const;
+
+        /**
+        * Searches for a match of a data type on an implementation type.
+        * Match returns ETrue if aMatchType is found within aImplementationType according 
+        * to the following rules:
+        *
+        * 1) aImplementationType is treated as a series of descriptors separated by double
+        * bars (||). ETrue is returned if aMatchType matches exactly any of the short
+        * descriptors.  If no double bar is present then aImplementationType is treated as a
+        * single descriptor.
+        *
+        * 2) If aUseWildcards == ETrue then a '?' in aMatchType will be matched to any single
+        * character and '*' will be matched to any series of characters.
+        *
+        * @param aImplementationType  The implementation data type to search for a match
+        * @param aMatchType           The data to search for
+        * @param aUseWildcards        ETrue if wildcard matching should be allowed
+        * @return                     ETrue if a match was found, EFalse otherwise
+        */
+        TBool Match(const TDesC8& aImplementationType, const TDesC8& aMatchType, 
+            TBool aUseWildcards) const;
+
+        TBool MatchServiceCmd(const TDesC8& aOpaqueData, const TDesC8& aServiceCmd) const;
+
+        void ParseInput(const TDesC8& aParam, TDes8& aContent, TDes8& aOpaque) const;
+
+    private:
+
+        mutable RImplInfoArray* iImplementationInfoArray;
+    };
+
+
+#endif  // LIW_RESOLVER_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwservicedata.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares Service Data and Service Provider Metadata classes
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_SERVICEDATA_H
+#define LIW_SERVICEDATA_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CLiwServiceData;
+class CLiwXmlHandler;
+class CLiwServiceHandlerImpl;
+class CDesC8Array;
+
+class CLiwMap;
+class CLiwGenericParamList;
+class TLiwVariant;
+
+/**
+* CLiwServiceData models the service provider data/information.
+* A Service provider can obtain its metadata through the interfaces
+* of this class. The Service metadata is a name-value pair defined 
+* by the provider as part of its registration information (Refer \c REGISTRY_INFO).
+*
+* One of the key metadata value is the capability set which are expected 
+* from the service consumer by the provider. The required capability set
+* is specifed in the provider registration information (Refer \c REGISTRY_INFO).
+*
+* ServiceHandler queries for those capabilities using \c CLiwServiceData::GetCapabilitiesL
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwServiceHandler
+* @see CLiwMetaData
+* @see TCapability
+*/
+class CLiwServiceData : public CBase
+{
+public:
+
+	
+	/**
+    * Returns the service metadata.
+    *
+    * @return the service metadata
+    */
+    CLiwGenericParamList* GetMetaData() const;
+	
+	// Destructor
+	virtual ~CLiwServiceData();
+													
+private:
+	
+	/*
+	 * Creates and returns an instance of \c CLiwServiceData
+	 * This is private and not available for external clients.
+	 *
+	 * @return the instance of created instance of \c CLiwServiceData
+	 */
+	static CLiwServiceData* NewL();
+	
+	/*
+	 * Creates and returns an instance of \c CLiwServiceData
+	 * The created instance is left in the cleanupstack.
+	 * This is private and not available for external clients.
+	 *
+	 * @return the instance of created instance of \c CLiwServiceData
+	 */
+	static CLiwServiceData* NewLC();
+	
+	/*
+	 * Default private constructor.
+	 * Creates the metadata associated with the service data
+	 */
+	CLiwServiceData();
+	
+	/*
+	 * Second phase constructor
+	 */
+	void ConstructL();
+
+	/*
+	 * Adds a metadata name-value pair. If the key already exists,
+	 * then the value will be added to the list of values associated
+	 * with the metadata key 
+	 *
+	 * @param aKey the metadata key to be inserted
+	 * @param aValue the value associated with the metadata key to be inserted
+	 */
+	void AddMetaDataL(const TDesC8& aKey, const TDesC8& aValue);
+	void AddMetaDataL(const TDesC8& aKey, const TLiwVariant& aValue);
+	
+	/*
+	 * Removes all the metadata key-value pairs.
+	 * This is called from service handler implementation if and only
+	 * if there is an error in parsing. Since, the FW uses SAX parser
+	 * and if the XML error happens after the metadata entries are 
+	 * created, the entries should be cleaned up.
+	 */
+	void CleanUpMetaData();
+	
+	
+	
+	CLiwGenericParamList* iDataList;
+	
+	friend class CLiwXmlHandler;
+	friend class CLiwServiceHandlerImpl;
+};
+
+#endif 
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwservicehandlerimpl.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,431 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation class for CLiwServiceHandler. 
+*                See also LiwServiceHandler.h.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_SERVICE_HANDLER_IMPL_H
+#define LIW_SERVICE_HANDLER_IMPL_H
+
+// INCLUDES
+#include <ecom/ecom.h>
+#include <barsread.h> 
+#include <liwcommon.h>
+#include "liwtlsdata.h"
+#include <eikmobs.h> 
+#include <e32capability.h>
+
+// CONSTANTS
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CLiwMenuBinding;
+class CLiwMenuPane;
+class CLiwServiceIfMenu;
+class CLiwServiceIfBase;
+class CLiwEcomMonitor;
+class CRTSecMgrScriptSession;
+
+// CLASS DECLARATION
+
+/**
+* Internal implementation class for CLiwServiceHandler. 
+*
+* Contains the actual implementation logic for Service Handler, whereas the
+* CLiwServiceHandler class provides only the public API. 
+*
+* @see CLiwServiceHandler for API documentation.
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS(CLiwServiceHandlerImpl) :
+    public CBase,
+    public MLiwNotifyCallback,
+    public MEikMenuObserver,
+    public MLiwMenuLaunchObserver
+    {
+    public:  // Construction & destruction
+        /**
+        * Constructs CLiwServiceHandlerImpl instance.
+        *
+        * @return Pointer to the new instance.
+        */
+        static CLiwServiceHandlerImpl* NewL();
+
+        /** 
+        * Destructor.
+        */
+        virtual ~CLiwServiceHandlerImpl();
+        
+    public:  // Management
+        /**
+        * @see CLiwServiceHandler::Reset()
+        */
+        void Reset();
+
+        /**
+        * @see CLiwServiceHandler::NbrOfProviders() 
+        */
+        TInt NbrOfProviders(const CLiwCriteriaItem* aCriteria);
+        
+        
+        
+    public:  // Interest handling
+        /**
+        * @see CLiwServiceHandler::AttachL() 
+        */
+        void AttachL(TInt aInterestResourceId);
+
+        /**
+        * @see CLiwServiceHandler::AttachL() 
+        */
+        TInt AttachL(const RCriteriaArray& aInterest);
+        
+        TInt AttachL(const RCriteriaArray& aInterest,CRTSecMgrScriptSession* aSecMgrScriptSession);
+        /**
+        * @see CLiwServiceHandler::QueryImplementationL() 
+        */
+        void QueryImplementationL(CLiwCriteriaItem* aItem, RCriteriaArray& aProviderList);
+		void GetCapabilitiesL(RArray<TCapability>& secMgrCapList,CLiwGenericParamList* pMetaData);
+        
+        /**
+        * @see CLiwServiceHandler::GetInterest()
+        */
+        void GetInterest(RCriteriaArray& aInterest);
+
+        /**
+        * @see CLiwServiceHandler::DetachL()
+        */
+        void DetachL(const RCriteriaArray& aInterest);
+
+        /**
+        * @see CLiwServiceHandler::DetachL()
+        */
+        void DetachL(TInt aInterestResourceId); 
+        
+        /**
+        * @see CLiwServiceHandler::GetCriteria()
+        */
+        const CLiwCriteriaItem* GetCriteria(TInt aId);
+
+        /**
+        * @see CLiwServiceHandler::InParamListL()
+        */
+        CLiwGenericParamList& InParamListL();
+
+        /**
+        * @see CLiwServiceHandler::OutParamListL()
+        */
+        CLiwGenericParamList& OutParamListL();
+        
+    public:  // Menu handling
+        /**
+        * @see CLiwServiceHandler::InitializeMenuPaneL()
+        */
+        void InitializeMenuPaneL(
+            CEikMenuPane& aMenuPane,
+            TInt aMenuResourceId,
+            TInt aBaseMenuCmdId,
+            const CLiwGenericParamList& aInParamList);
+        /**
+        * @see CLiwServiceHandler::InitializeMenuPaneL()
+        */
+        void InitializeMenuPaneL(
+            CEikMenuPane& aMenuPane,
+            TInt aMenuResourceId,
+            TInt aBaseMenuCmdId,
+            const CLiwGenericParamList& aInParamList,
+            TBool aUseSubmenuTextsIfAvailable);            
+        
+        /**
+        * @see CLiwServiceHandler::ServiceCmdByMenuCmd()
+        */
+        TInt ServiceCmdByMenuCmd(TInt aMenuCmdId) const;
+
+        /**
+        * @see CLiwServiceHandler::ExecuteMenuCmdL()
+        */
+        void ExecuteMenuCmdL(
+            TInt aMenuCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            MLiwNotifyCallback* aCallback= NULL);
+
+        /**
+        * @see CLiwServiceHandler::AttachMenuL()
+        */
+        void AttachMenuL(TInt aMenuResourceId, TInt aInterestResourceId);
+
+        /**
+        * @see CLiwServiceHandler::AttachMenuL()
+        */
+        void AttachMenuL(TInt aMenuResourceId, TResourceReader& aReader);
+        
+        /**
+        * @see CLiwServiceHandler::AttachMenuL()
+        */
+        void AttachMenuL(TInt aMenuResourceId, const RCriteriaArray& aInterest);
+        
+        /**
+        * Attach menu related criteria items to given menu.
+        *
+        * @param aMenuEntries     List of menu command ids.
+        * @param aMenuResourceId  Menu to be attached.
+        * @param aInterest        Interest list.
+        */
+        void AttachMenuL(RArray<TInt>& aMenuEntries, TInt aMenuResourceId, RCriteriaArray& aInterest);        
+
+        /**
+        * Attach menu related criteria items to given menu.
+        *
+        * @param aMenuResourceId    Resource reader pointing
+        *                           to menu to be attached.
+        */
+        
+        //void AttachMenuL(TResourceReader& aReader, TInt aMenuId, RCriteriaArray& aInterest);
+
+        /**
+        * @see CLiwServiceHandler::DetachMenu()
+        */
+        void DetachMenu(TInt aMenuResourceId, TInt aInterestResourceId);
+
+        /**
+        * @see CLiwServiceHandler::IsSubMenuEmpty()
+        */
+        TBool IsSubMenuEmpty(TInt aSubMenuId);
+
+        /**
+        * @see CLiwServiceHandler::IsLiwMenu()
+        */
+        TBool IsLiwMenu(TInt aMenuResourceId);
+
+        /**
+        * @see CLiwServiceHandler::HandleSubmenuL()
+        */
+        TBool HandleSubmenuL(CEikMenuPane& aPane);
+
+    public:  // Generic service command handling
+        /**
+        * @see CLiwServiceHandler::ExecuteServiceCmdL()
+        */
+        void ExecuteServiceCmdL(
+            const TInt& aCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            MLiwNotifyCallback* aCallback = 0);
+        
+        /**
+        * @see CLiwServiceHandler::ExecuteServiceCmdL()
+        */
+        void ExecuteServiceCmdL(                        
+            const CLiwCriteriaItem& aCmd,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            MLiwNotifyCallback* aCallback = 0);
+
+        /**
+        * @see CLiwServiceHandler::MenuCmdId()
+        */
+        TInt MenuCmdId(TInt aMenuCmdId) const;            
+
+    public:  // Other new methods
+        /** 
+        * Called by CLiwEcomMonitor.
+        *
+        * @param aImpl An object representing this class.
+        * @return An error code. KErrNone if successful.
+        */ 
+        static TInt SynchronizeCallBack(TAny* aImpl);
+        
+    public: // From MLiwNotifyCallback
+        TInt HandleNotifyL(
+            TInt aCmdId,
+            TInt aEventId,
+            CLiwGenericParamList& aEventParamList,
+            const CLiwGenericParamList& aInParamList);
+
+    public: // From MEikMenuObserver
+        void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis);
+
+    public: // From MEikCommandObserver (via MEikMenuObserver)
+        void ProcessCommandL(TInt aCommandId);
+
+	    void GetProviderCapability(CLiwCriteriaItem* aItem,RCriteriaArray& aOutItem);
+	
+    private: // From MLiwMenuLaunchObserver
+        void MenuLaunched();
+
+    private:
+        // Possible placeholder types.
+        enum TLiwPlaceholderType
+            {
+            ELiwPlaceholderNormal,
+            ELiwPlaceholderCascade,     
+            ELiwPlaceholderIntelligentCascade
+            };
+
+    private:
+        CLiwServiceHandlerImpl();
+        void ConstructL();
+
+        // Attach menu related criteria items to given menu. 
+        void DoAttachMenuL(TResourceReader& aReader, TInt aMenuId, RCriteriaArray& aInterest);
+
+        TInt DoAttachL(const RCriteriaArray& aInterest,CRTSecMgrScriptSession* aScriptSession);
+        void DoAttachL(const RCriteriaArray& aInterest);
+        
+        void ReadInterestListL(TResourceReader& aReader, RPointerArray<CLiwCriteriaItem>& aResult);
+        TInt ResolveProvidersL(CLiwBinding* aBinding, CLiwCriteriaItem* aItem, CRTSecMgrScriptSession* aScriptSession);
+        TInt ResolveProvidersL(CLiwBinding* aBinding, CLiwCriteriaItem* aItem);
+        
+        TBool IsCached(CLiwServiceIfBase* aProvider);
+        
+        CLiwMenuPane* CreateEmptyLiwMenuPaneL(TInt aBaseMenuCmdId, TInt aResourceId);
+        void DeleteLiwMenuPane(CLiwMenuPane* aLiwPane);
+        
+        TInt ResourceIdForNextFreeSlot();
+        void CopyMenuItemsL(CLiwMenuPane* aSource, CEikMenuPane& aDest, TInt aStartIndex, 
+            TBool aIsSubmenu);
+        TInt SlotItemCmd(CEikMenuPane& aPane);
+        CLiwMenuPane* MenuPaneForSlotCmd(TInt aCmdId);
+        TLiwPlaceholderType PlaceholderType(CEikMenuPane& aPane, TInt aCmd, TBool& aTitleLocked);
+        void ConvertPlaceholderL(CEikMenuPane& aPane, TInt aCmd, CLiwMenuPane& aLiwPane, 
+            const TDesC& aTitle);
+        void UnCascadeL(CEikMenuPane& aPane, TInt aCmd, CLiwMenuPane& aLiwPane);
+        void SkipMenuFields(TResourceReader& aReader);
+        TBool IsInLastInitialized(CLiwMenuPane* liwPane) const;
+        TBool GetSubmenuTitle(CEikMenuPane& aPane, TDes& aResult);
+        TBool IsCriteriaAlreadyInInterest(CLiwCriteriaItem& aItem, 
+            RPointerArray<CLiwCriteriaItem>& aInterest) const;
+        CLiwCriteriaItem* ConvertCriteriaItemPointerL(CLiwCriteriaItem* aCandidate);
+        void FilterInterestListL(RPointerArray<CLiwCriteriaItem>& aOrginal,
+            RPointerArray<CLiwCriteriaItem>& aFiltered);
+        void FilterInfoArray(RImplInfoPtrArray& aArray, RArray<TInt32>& aArrayPlugin,
+            CLiwCriteriaItem* aItem);   
+        CLiwMenuBinding* AlreadyBound(TInt aMenuId, TInt aMenuCmd, TInt aMenuItemIndex) const;
+        void SynchronizeDbL();
+        void ListProvidersForCriteriaL(RArray<TInt>& aResult, CLiwCriteriaItem& aItem);
+        void HandleRemovedProviders(RArray<TInt>& aInMemory, RImplInfoPtrArray& aOnSystem);
+        void HandleNewProvidersL(RArray<TInt>& aInMemory, RImplInfoPtrArray& aOnSystem, 
+            CLiwCriteriaItem* aItem);
+        void RemoveProvider(TInt aImplUid);
+        void AddProviderL(TUid aImplUid, CLiwCriteriaItem* aItem);
+        inline void ClearMenuPaneArray();
+        void AttachServiceManagerPluginsL();
+        void ServiceManagerPlugin_ListImplementationsL(RArray<TInt32>& aArray, CLiwCriteriaItem* aItem);
+        CLiwServiceIfBase* ServiceManagerPlugin_CreateImplementationL(TInt32 aImplUid);
+        TInt NumAlreadyInitializedPaneIdsL() const;
+
+        // Leaving helper method. Handler cleanupstack issues and calls ReadInterestListL().
+        void ReadInterestL(RCriteriaArray& aInterest, TInt aInterestResourceId);
+
+        // Detaches all items from given menu.        
+        void DoDetachMenu(TInt aMenuResourceId);
+
+        // Detaches only those items from a given menu, which match the given interest.
+
+
+        void DoDetachMenu(TInt aMenuResourceId, RCriteriaArray& aInterest);
+        
+        // Removes unnecessary criteria items from Service Handler.
+        void RemoveObsoleteCriteriaItems();
+        
+        // Removes unnecessary providers from Service Handler.
+        void RemoveObsoleteProviders();
+        
+        /* Parses the metadata information stored in the opaque_data field
+		 * of service provider registration information \c REGISTRY_INFO.
+		 *
+		 * The metadata information is seprated from the service command definition 
+		 * in the opaque_data field using a separator "::".
+		 *
+		 * @param aOpaque	the opaque_data values specified in the registration information
+		 * @param aMetaData the parsed metadata entries will be stored in this variable
+		 * 
+		 */
+		void ParseMetaData(const TDesC8& aOpaque, TDes8& aMetaData);
+		
+		//To fetch the infoArray
+        void QueryImplementationL(CLiwCriteriaItem* aItem, RImplInfoPtrArray& aInfoArray);
+
+  		TCapability GetServiceCapability(const TDesC& aCapName);
+		
+		//To fetch the version range specified by the consumer while creating Criteria
+		TBool GetVersionRange(CLiwCriteriaItem* aItem,TReal& aMinVersion, TReal& aMaxVersion);
+		
+		//To fetch the version range specified by the consumer while creating Criteria
+		TBool GetVersion (CLiwCriteriaItem* aItem,TReal& aVersion);
+		
+		//To fetch the implementation version specified in provider metadata
+		void ComputeIntfVersion(CLiwServiceData* pProvMetaData,TReal& aIntfVersion);
+		
+    private:
+        // Pointer to the control environment.
+        CCoeEnv* iCoeEnv;
+        
+        // Owns all the attached criteria items.
+        RPointerArray<CLiwCriteriaItem> iInterestList;  
+        
+        // Criteria -> provider bindings for base service providers.
+        RPointerArray<CLiwBinding>      iBaseBindings;  
+        
+        // Criteria -> provider bindings for menu service providers.
+        RPointerArray<CLiwMenuBinding>  iMenuBindings;  
+        
+        // Contains the LIW menu panes.
+        RPointerArray<CLiwMenuPane>     iMenuPanes;     
+
+        // Input parameter list which can be given to the consumer application.
+        CLiwGenericParamList* iInParams;
+        
+        // Output parameter list which can be given to the consumer application.
+        CLiwGenericParamList* iOutParams; 
+        
+        // Resource offset for LiwServiceHandler.rsc.
+        TInt iResourceOffset;
+        
+        // Owns all the providers currently in memory.
+        RPointerArray<CLiwServiceIfBase> iProviders;  
+          
+        TInt                             iNextFreeSlot;
+        RPointerArray<CLiwMenuPane>      iLastInitialized;
+        CLiwMenuPane*                    iSubmenu;
+        TInt                             iSubmenuCmd;
+        CLiwEcomMonitor*                 iEcomMonitor;
+        TBool                            iTlsDataOpened;
+    };
+
+
+inline void CLiwServiceHandlerImpl::ClearMenuPaneArray()
+    {
+    iMenuPanes.ResetAndDestroy();
+    }
+
+#endif // LIW_SERVICE_HANDLER_IMPL_H
+
+// END of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwtlsdata.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       TLS data object.
+*
+*/
+
+
+
+
+
+
+
+#ifndef _LIW_TLS_DATA_H
+#define _LIW_TLS_DATA_H
+
+#include <e32base.h>
+
+class MLiwMenuLaunchObserver
+    {
+    public:
+        virtual void MenuLaunched() = 0;
+    };
+
+NONSHARABLE_CLASS( CLiwTlsData ) : public CBase
+	{
+	public:
+		static CLiwTlsData* OpenL();
+		static void Close();
+		
+		inline static CLiwTlsData* Instance()
+		    {
+		    return static_cast<CLiwTlsData*>( Dll::Tls() );
+		    }
+
+        void AddMenuLaunchObserverL( MLiwMenuLaunchObserver* aObserver );
+        void RemoveMenuLaunchObserver( MLiwMenuLaunchObserver* aObserver );
+	
+	    // CEikMenuPane uses this to inform LIW when a menu is launched.
+	    void ReportMenuLaunch();
+	
+	private:
+	    CLiwTlsData();
+	    virtual ~CLiwTlsData();
+	    
+	    static CLiwTlsData* NewL();
+	    void ConstructL();
+	
+	private:
+	    TInt iRefCount;
+		RPointerArray<MLiwMenuLaunchObserver> iMenuLaunchObservers;
+	};
+
+#endif // _LIW_TLS_DATA_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwuids.hrh	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       UID definitions for Language Interworking Framework.
+*
+*/
+
+
+
+
+
+
+
+#ifndef INC_LIWUIDS_HRH
+#define INC_LIWUIDS_HRH
+
+#define KLiwServiceHandlerDLLUidValue 0x2000B5D3
+
+#define KLiwResolverDLLUidValue       0x2000B5D4
+#define KLiwResolverImplUidValue      0x2000B5D5
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/inc/liwxmlhandler.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Wrapper to XML parser interface. Loads the inline and external XML metadata
+*				 				 and populates the service provider metadata information. This class
+*				 				 uses Symbian SAX parser to load the metadata information.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_XMLHANDLER_H
+#define LIW_XMLHANDLER_H
+
+#include <SenXmlReader.h>
+#include <MSenContentHandlerClient.h>
+#include <xml/ContentHandler.h>
+#include <e32capability.h>
+
+// CONSTANTS
+const TInt KMaxBufLen = 255;
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CLiwServiceData;
+class CLiwList;
+
+/**
+* Wrapper class for XML parser. This class is used to parse inline
+* and file-based external metadata definitions. SAX (Simple API for XML)
+* parser is used to parse the XML content.
+*
+* @lib ServiceHandler.lib
+*
+* @see MSenContentHandlerClient
+* @see CSenXmlReader
+* @see CLiwServiceData
+**/
+class CLiwXmlHandler : public CBase, public MSenContentHandlerClient
+{
+public:
+	
+	/*
+	 * Creates and returns an instance of \c CLiwXmlHandler
+	 *
+	 * @return an instance of \c CLiwXmlHandler
+	 */
+	static CLiwXmlHandler* NewL();
+	
+	/*
+	 * Creates and returns an instance of \c CLiwXmlHandler
+	 * Leaves the created instance in the cleanupstack.
+	 *
+	 * @return an instance of \c CLiwXmlHandler
+	 */
+	static CLiwXmlHandler* NewLC();
+	
+	/*
+	 * Destructor
+	 */
+	virtual ~CLiwXmlHandler();
+	
+	/**
+	* Receive notification of the beginning of a document.
+	* @return KErrNone or some of the system-wide Symbian error codes.
+	*/		
+	virtual TInt StartDocument();
+
+	/**
+	* Receive notification of the end of a document.
+	* @return KErrNone or some of the system-wide Symbian error codes.
+	*/
+	virtual TInt EndDocument();
+	
+	/**
+	* Receive notification of the start of an element.
+	* @return KErrNone or some of the system-wide Symbian error codes.
+	*/
+	virtual TInt StartElement(	const TDesC8& /*aURI*/, 
+										const TDesC8& /*aLocalName*/, 
+										const TDesC8& /*aName*/, 
+										const RAttributeArray& /* apAttrs */);
+
+	/**
+	* Receive notification of the end of an element.
+	* @return KErrNone or some of the system-wide Symbian error codes.
+	*/
+	virtual TInt EndElement(	const TDesC8& /*aURI*/, 
+									const TDesC8& /*aLocalName*/, 
+									const TDesC8& /*aName*/);
+	/**
+	* Receive notification of the character data found in the XML document.
+	* @return KErrNone or some of the system-wide Symbian error codes.
+	*/
+	virtual TInt Characters(const TDesC8& /*aBuf*/, 
+	   							   const TInt /*aStart*/, 
+								   const TInt /*aLength*/);
+	
+	/**
+	 * Called when there is an error in parsing.
+	 * @return KErrNone or some of the system-wide Symbian error codes.
+	*/
+	inline virtual TInt Error(TInt /*aErrorCode*/);
+		
+	/**
+    * Loads service data from an external file specified 
+    * in aFileToParse parameter.
+    *
+    * @param aFileToParse a valid well defined XML file having metadata definition 
+    * @param aServiceData service data to be populated with service provider information. 
+    *  					  The caller should pass a properly instantiated pointer to CLiwServiceData instance
+    *
+    * @return KErrNone if the loading of service data is successful
+    		  KSrvDataLoadFailed if the loading of XML file failed
+    */				
+	TInt LoadServiceData(const TDesC& aFileToParse, CLiwServiceData* aServiceData);
+	
+	/**
+    * Loads service data from a XML data buffer. The passed XML data buffer
+    * should be well defined and well formatted valid XML content.
+    *
+    * @param aXmlBuffer a valid well defined and well formatted XML data content
+    * @param aServiceData service data to be populated with service provider information. 
+    *  					  The caller should pass a properly instantiated pointer to CLiwServiceData instance
+    *
+    * @return KErrNone if the loading of service data is successful
+    		  KSrvDataLoadFailed if the loading of XML buffer content failed
+    */
+	TInt LoadServiceData(const TDesC8& aXmlBuffer, CLiwServiceData* aServiceData);
+	
+	/*
+     * Enumeration IDs corresponding to XML parsing status
+     */ 
+	enum TLiwXmlParseStatus
+	{
+		ESrvDataLoadSuccess=0, 
+		ESrvDataLoadFailed,	//General failures other than below
+		ESrvDataFileNotFnd, 
+		ESrvDataInvalidFile, //Parse error
+		ESrvDataCapNotSpecified	
+	};
+												
+private:
+
+	//private default constructor
+	CLiwXmlHandler();
+	
+	//second phase constructor
+	void ConstructL();
+	
+	//the SAX parser instance
+	CSenXmlReader* iXmlHandler;	
+	
+	//the service data instance to be populated with metadata information
+	CLiwServiceData* iServiceData;
+	
+	HBufC8* iBuffer;
+	TBuf8<KMaxBufLen> startBuf;
+};
+
+#endif 
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/install/liwservicehandler.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,40 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+;
+; UID is the app's UID
+;
+#{"LIWServiceHandler"},(0x2000B5D3),1,0,0
+
+;
+; List of localised vendor names
+%{"Vendor-EN"}
+
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+;
+; Two files to install
+;
+"\epoc32\release\armv5\urel\liwServiceHandler.dll"     	-"!:\sys\bin\liwServiceHandler.dll"
+"\epoc32\release\armv5\urel\liwResolver.dll"          	-"!:\sys\bin\liwResolver.dll"
+"\epoc32\data\z\resource\liwServiceHandler.RSC"    			-"!:\resource\liwServiceHandler.RSC"
+"\epoc32\data\z\resource\plugins\liwResolver.RSC"				-"!:\resource\plugins\liwResolver.RSC"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/install/liwservicehandler_PU.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,40 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+;
+; UID is the app's UID
+;
+#{"LIWServiceHandler"},(0x2000B5D3),1,0,0, TYPE = PU
+
+;
+; List of localised vendor names
+%{"Vendor-EN"}
+
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+;
+; Two files to install
+;
+"\epoc32\release\armv5\urel\liwServiceHandler.dll"     	-"!:\sys\bin\liwServiceHandler.dll"
+"\epoc32\release\armv5\urel\liwResolver.dll"          	-"!:\sys\bin\liwResolver.dll"
+"\epoc32\data\z\resource\liwServiceHandler.RSC"    			-"!:\resource\liwServiceHandler.RSC"
+"\epoc32\data\z\resource\plugins\liwResolver.RSC"				-"!:\resource\plugins\liwResolver.RSC"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/install/liwservicehandlerstub.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,31 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+
+; standard SIS file header
+#{"LIWServiceHandler"}, (0x2000b5d3), 1, 0, 0, TYPE=SA
+
+;Localized Vendor Name
+%{"Nokia-EN"}
+
+;Unique Vendor name
+:"Nokia"
+
+; Files to copy
+""-"z:\sys\bin\liwServiceHandler.dll"
+""-"z:\sys\bin\liwResolver.dll"
+""-"z:\resource\liwResolver.RSC"
+""-"z:\resource\liwServiceHandler.RSC"
\ No newline at end of file
Binary file languageinterworkingfw/servicehandler/install/liwservicehandlerstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwbinding.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "liwbinding.h"
+
+
+CLiwBinding* CLiwBinding::NewL()
+    {
+    return new (ELeave) CLiwBinding();
+    }
+
+
+
+CLiwBinding* CLiwBinding::NewLC()
+    {
+    CLiwBinding* bind = new (ELeave) CLiwBinding();
+    CleanupStack::PushL(bind);
+    return bind;
+    }
+
+
+void CLiwBinding::AddProviderL(CLiwServiceIfBase* aProvider, TBool aIsDefault)
+    {
+    if (aIsDefault)
+        {
+        // Default provider will be the first item in array.
+        User::LeaveIfError(iProviders.Insert(aProvider, 0));
+        }
+    else
+        {
+        User::LeaveIfError(iProviders.Append(aProvider));
+        }
+    }
+
+
+
+TInt CLiwBinding::HasCriteriaItem(CLiwCriteriaItem& aItem) const
+    {
+    const TInt count = iInterest.Count();
+    for (TInt index = 0; index < count; index++)
+        {
+        if ((*iInterest[index]) == aItem)
+            {
+            return index;
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+
+TBool CLiwBinding::HasProvider(CLiwServiceIfBase* aProvider) const
+    {
+    for (TInt index = 0; index < iProviders.Count(); index++)
+        {
+        if (iProviders[index] == aProvider)
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+
+void CLiwBinding::RemoveCriteria(TInt aIndex)
+    {
+    iInterest.Remove( aIndex ); 
+    }
+
+
+
+TBool CLiwBinding::RemoveProvider(TInt aImplUid)
+    {
+    for (TInt index = 0; index < iProviders.Count(); index++)
+        {
+        if (iProviders[index]->ImplementationUid().iUid == aImplUid)
+            {
+            iProviders.Remove( index );
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+TBool CLiwBinding::HasServiceCmd(TInt aServiceCmd) const    
+    {
+    for (TInt index = 0; index < iInterest.Count(); index++)
+        {
+        if(iInterest[index]->ServiceCmd() == aServiceCmd)
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwcommon.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation for common LIW classes to be used both
+*                consumer and provider side.
+*
+*/
+
+
+
+
+
+
+#include "liwcommon.h"
+#include <eikenv.h>
+const TInt KInitialMaxProviders = 0xff;
+
+CLiwCriteriaItem::CLiwCriteriaItem()
+    {
+    }
+
+
+
+EXPORT_C CLiwCriteriaItem* CLiwCriteriaItem::NewL()
+    {
+    CLiwCriteriaItem* item = new (ELeave) CLiwCriteriaItem();
+    CleanupStack::PushL( item );
+    item->ConstructL();
+    CleanupStack::Pop(item); // item
+    return item;
+    }
+
+
+
+EXPORT_C CLiwCriteriaItem* CLiwCriteriaItem::NewLC()
+    {
+    CLiwCriteriaItem* item = new (ELeave) CLiwCriteriaItem();
+    CleanupStack::PushL( item );
+    item->ConstructL();
+    return item;
+    }
+
+
+
+EXPORT_C CLiwCriteriaItem* CLiwCriteriaItem::NewL(
+    TInt aCriteriaId,
+    TInt aServiceCmd,
+    const TDesC8& aContentType)
+    {
+    CLiwCriteriaItem* item = new (ELeave) CLiwCriteriaItem();
+    CleanupStack::PushL( item );
+    item->ConstructL(aCriteriaId, aServiceCmd, aContentType);
+    CleanupStack::Pop(item); // item
+    return item;
+    }
+
+
+
+EXPORT_C CLiwCriteriaItem* CLiwCriteriaItem::NewLC(
+    TInt aCriteriaId,
+    TInt aServiceCmd,
+    const TDesC8& aContentType)
+    {
+    CLiwCriteriaItem* item = new (ELeave) CLiwCriteriaItem();
+    CleanupStack::PushL( item );
+    item->ConstructL(aCriteriaId, aServiceCmd, aContentType);
+    return item;    
+    }
+
+EXPORT_C CLiwCriteriaItem* CLiwCriteriaItem::NewL(       
+                                    TInt aCriteriaId,
+                                    const TDesC8& aServiceCmd,
+                                    const TDesC8& aContentType)
+    {
+    CLiwCriteriaItem* item = new (ELeave) CLiwCriteriaItem();
+    CleanupStack::PushL( item );
+    item->ConstructL(aCriteriaId, aServiceCmd, aContentType);
+    CleanupStack::Pop(item); // item
+    return item;
+    }
+
+EXPORT_C CLiwCriteriaItem* CLiwCriteriaItem::NewLC(
+                                TInt aCriteriaId,
+                                const TDesC8& aServiceCmd,
+                                const TDesC8& aContentType)
+    {
+    CLiwCriteriaItem* item = new (ELeave) CLiwCriteriaItem();
+    CleanupStack::PushL( item );
+    item->ConstructL(aCriteriaId, aServiceCmd, aContentType);
+    return item;    
+    }
+
+
+EXPORT_C CLiwCriteriaItem::~CLiwCriteriaItem()
+    {
+    delete iReserved.iData.iBufC8; 
+    delete iContentType;
+    iOptions.Reset();
+    
+    iMetadataOptions.Reset();
+    }
+
+
+void CLiwCriteriaItem::ConstructL()
+    {
+    iMaxProviders = KInitialMaxProviders;
+    }
+
+
+
+void CLiwCriteriaItem::ConstructL(TInt aCriteriaId, TInt aServiceCmd,
+    const TDesC8& aContentType)
+    {
+    iMaxProviders = KInitialMaxProviders;
+	iCriteriaId = aCriteriaId;
+    iServiceCmd = aServiceCmd;
+    SetContentTypeL( aContentType );
+    }
+
+void CLiwCriteriaItem::ConstructL(TInt aCriteriaId, const TDesC8& aServiceCmd,
+                                  const TDesC8& aContentType)
+    {
+    iMaxProviders = KInitialMaxProviders;
+    iCriteriaId = aCriteriaId;
+    SetServiceCmdL( aServiceCmd );
+    SetContentTypeL( aContentType );
+    }
+
+EXPORT_C void CLiwCriteriaItem::SetId(TInt aId)
+    {
+    iCriteriaId = aId;      
+    }
+
+
+
+EXPORT_C void CLiwCriteriaItem::SetServiceClass(const TUid& aServiceUid)
+    {
+    iServiceClass = aServiceUid;
+    }
+    
+
+
+EXPORT_C void CLiwCriteriaItem::SetServiceCmd(TInt aServiceCmd)
+    {
+    iServiceCmd = aServiceCmd;
+    }
+
+EXPORT_C void CLiwCriteriaItem::SetServiceCmdL(const TDesC8& aServiceCmd)
+    {
+    iServiceCmd = KLiwCmdAsStr;
+    delete iReserved.iData.iBufC8;
+    iReserved.iData.iBufC8 = NULL;
+    iReserved.iData.iBufC8 = HBufC8::NewL(aServiceCmd.Length());
+    TPtr8 content(iReserved.iData.iBufC8->Des());
+    content.SetLength(aServiceCmd.Length());
+    content.Copy(aServiceCmd);
+    }
+
+EXPORT_C void CLiwCriteriaItem::SetContentTypeL(const TDesC8& aContentType)
+    {
+    delete iContentType;
+    iContentType = NULL;
+    iContentType = HBufC8::NewL(aContentType.Length());
+    TPtr8 content(iContentType->Des());
+    content.SetLength(aContentType.Length());
+    content.Copy(aContentType);
+    }
+
+
+
+EXPORT_C TInt CLiwCriteriaItem::Id() const
+    {
+    return iCriteriaId;
+    }
+
+
+
+EXPORT_C const TUid& CLiwCriteriaItem::ServiceClass() const
+    {
+    return iServiceClass;
+    }
+    
+
+
+EXPORT_C TInt CLiwCriteriaItem::ServiceCmd() const
+    {   
+    return iServiceCmd;
+    }
+
+EXPORT_C const TDesC8& CLiwCriteriaItem::ServiceCmdStr() const
+    {   
+    return ((iReserved.iData.iBufC8) ? *iReserved.iData.iBufC8 : KNullDesC8());
+    }
+
+EXPORT_C const TDesC8& CLiwCriteriaItem::ContentType() const
+    {
+    if (iContentType)
+        {
+        return *iContentType;
+        }
+
+    return KNullDesC8();
+    }
+
+
+
+EXPORT_C void CLiwCriteriaItem::SetOptions(TUint aOptions)
+    {
+    if(aOptions == 0)
+    	return;
+    
+    iOptions.Set(aOptions);
+    }
+
+
+EXPORT_C void CLiwCriteriaItem::SetMetaDataOptions(const TLiwVariant& aMetaDataOptions)
+    {
+    iMetadataOptions.SetL(aMetaDataOptions);
+    }
+
+EXPORT_C void CLiwCriteriaItem::GetMetaDataOptions(TLiwVariant& aMetaDataOptions) const
+    {
+    aMetaDataOptions.SetL(iMetadataOptions);
+    }
+
+EXPORT_C TUint CLiwCriteriaItem::Options() const
+    {
+    return iOptions.AsTUint();
+    }
+
+
+
+EXPORT_C void CLiwCriteriaItem::ReadFromResoureL(TResourceReader& aReader)
+    {
+    delete iContentType;
+    iContentType = NULL;
+
+    delete iReserved.iData.iBufC8;   
+    iReserved.iData.iBufC8 = NULL;   
+    
+    iCriteriaId = aReader.ReadInt32();
+    iServiceCmd = aReader.ReadInt32();
+
+    if (iServiceCmd == KLiwCmdAsStr)   
+      {
+        TPtrC8 txtptr = aReader.ReadTPtrC8();
+        iReserved.iData.iBufC8 = HBufC8::NewL(txtptr.Length());
+        TPtr8 content(iReserved.iData.iBufC8->Des());
+        content.Copy( txtptr );
+      }
+
+    {
+      TPtrC8 txtptr = aReader.ReadTPtrC8();
+      iContentType = HBufC8::NewL(txtptr.Length());
+      TPtr8 content(iContentType->Des());
+      content.Copy( txtptr );
+    }
+
+    iServiceClass = TUid::Uid(aReader.ReadInt32());
+
+    iDefaultProvider = TUid::Uid(aReader.ReadInt32());
+
+    iMaxProviders = aReader.ReadUint8();
+    
+    SetOptions((TUint)aReader.ReadUint8());
+    
+    TInt capResID = aReader.ReadInt32(); // Skip over reserved field.
+    
+    
+    }
+
+
+
+EXPORT_C TUid CLiwCriteriaItem::DefaultProvider() const
+    {
+    return iDefaultProvider;
+    }
+
+
+
+EXPORT_C void CLiwCriteriaItem::SetDefaultProvider(TInt aDefault)
+    {
+    iDefaultProvider = TUid::Uid(aDefault);
+    }   
+
+
+EXPORT_C TInt CLiwCriteriaItem::MaxProviders() const
+    {
+    return iMaxProviders;
+    }
+
+
+EXPORT_C void CLiwCriteriaItem::SetMaxProviders(TInt aMaxProviders)
+    {
+    iMaxProviders = aMaxProviders;
+    }
+
+
+EXPORT_C TBool CLiwCriteriaItem::operator==(const CLiwCriteriaItem& aItem)
+    {
+      if (iServiceCmd != KLiwCmdAsStr) 
+        {
+          return ((iCriteriaId                                  == aItem.iCriteriaId)           &&
+                  (iServiceCmd                                  == aItem.iServiceCmd)           &&
+                  (iContentType->Compare(*(aItem.iContentType)) == KErrNone)                    &&
+                  (iServiceClass.iUid                           == aItem.iServiceClass.iUid)    &&
+                  (iDefaultProvider.iUid                        == aItem.iDefaultProvider.iUid) &&
+                  (iMaxProviders                                == aItem.iMaxProviders)         &&
+                  (iOptions                                     == aItem.iOptions)				&&       
+                  (iMetadataOptions                             == aItem.iMetadataOptions));       
+        }
+      else
+        {
+        	if(iCriteriaId== aItem.iCriteriaId)
+        	{
+        		if(0 == iReserved.iData.iBufC8->Des().Compare(aItem.iReserved.iData.iBufC8->Des()))
+        		{
+        			if(iContentType->Compare(*(aItem.iContentType)) == KErrNone)
+        			{
+        				if(iServiceClass.iUid == aItem.iServiceClass.iUid)
+        				{
+        					if(iDefaultProvider.iUid == aItem.iDefaultProvider.iUid)
+        					{
+        						if(iMaxProviders == aItem.iMaxProviders)
+        						{
+        							if((iOptions == aItem.iOptions))
+        							{
+        								if((iMetadataOptions == aItem.iMetadataOptions))
+        								{
+        									return ETrue;
+        								}
+        							}
+        						}
+        					}
+        				}
+        			}
+        		}
+        	}
+           	return EFalse;
+        }
+    }
+
+EXPORT_C TInt32 MLiwNotifyCallback::GetTransactionID()
+{
+	TTime currentTime;
+	const TInt KMin = 60;
+	const TInt KSec = 60;
+	const TInt KMcSec = 1000;
+	currentTime.HomeTime();
+	return	 (KMin * KSec * currentTime.DateTime().Hour())+ 
+			 (KMin * currentTime.DateTime().Minute())+
+			 (KMcSec * currentTime.DateTime().Second()) + 
+			 (currentTime.DateTime().MicroSecond());
+}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwecommonitor.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation for ECom monitoring class for LIW framework.
+*
+*/
+
+
+
+
+
+
+#include "liwecommonitor.h"
+#include "liwcommon.h"
+#include "liwuids.hrh"
+#include "liwserviceifbase.h"
+
+// CONSTANTS
+_LIT8(KContentTag, "<CONTENT>");
+_LIT8(KOpaqueTag, "<OPAQUE>");
+_LIT8(KLiwMimeTypeAll, "*");
+
+const TInt KMaxDataParamSize = 255;
+
+CLiwEcomMonitor* CLiwEcomMonitor::NewL(TCallBack& aSynchronizeCallBack)
+    {
+    CLiwEcomMonitor* self = new (ELeave) CLiwEcomMonitor(aSynchronizeCallBack); 
+    CleanupStack::PushL(self);  
+    self->ConstructL();
+    CleanupStack::Pop(self); // self
+    return self;
+    }
+
+
+CLiwEcomMonitor::CLiwEcomMonitor(TCallBack& aSynchronizeCallBack) 
+:CActive(CActive::EPriorityStandard), iSynchronizeCallBack(aSynchronizeCallBack)
+    {
+    }
+
+
+CLiwEcomMonitor::~CLiwEcomMonitor()
+    {
+    Cancel();
+    iEcomSession.Close();
+    REComSession::FinalClose();
+    }
+
+
+void CLiwEcomMonitor::ConstructL()
+    {
+    iEcomSession = REComSession::OpenL();
+    CActiveScheduler::Add(this);
+    StartMonitoring();
+    }
+
+      
+void CLiwEcomMonitor::RunL()
+    {
+    iSynchronizeCallBack.CallBack();
+    StartMonitoring();
+    }
+
+
+    
+void CLiwEcomMonitor::DoCancel()
+    {
+    iEcomSession.CancelNotifyOnChange(iStatus);
+    }
+
+
+void CLiwEcomMonitor::StartMonitoring()
+    {
+    iEcomSession.NotifyOnChange(iStatus);
+    SetActive();
+    }
+
+
+
+void CLiwEcomMonitor::ListImplemetationsL(RImplInfoPtrArray& aResult, 
+    CLiwCriteriaItem* aItem) const
+    {
+    TEComResolverParams params;
+    
+    TUid resolvUid = { KLiwResolverImplUidValue };  
+    
+    TBuf8<KMaxDataParamSize> dataType;     
+    dataType.Copy(KContentTag);
+    dataType.Append(aItem->ContentType());
+    dataType.Append(KOpaqueTag);
+    if (aItem->ServiceCmd() != KLiwCmdAsStr)
+      {
+        dataType.AppendNumUC(aItem->ServiceCmd(), EHex);
+      }
+    else
+      {
+        dataType.Append(aItem->ServiceCmdStr());
+      }
+    params.SetDataType(dataType);
+    params.SetWildcardMatch(dataType.Find(KLiwMimeTypeAll) != KErrNotFound);
+    
+    iEcomSession.ListImplementationsL(aItem->ServiceClass(), params, resolvUid, aResult);
+    }
+
+
+
+CLiwServiceIfBase* CLiwEcomMonitor::CreateImplementationL(TUid aImplUid)
+    {
+    TUid dtorKeyId;
+
+    CLiwServiceIfBase* iface = (CLiwServiceIfBase*)iEcomSession.CreateImplementationL(aImplUid, 
+        dtorKeyId);
+
+    if (iface)
+        {
+        iface->SetDtorKeyId( dtorKeyId );               
+        iface->SetImplementationUid( aImplUid );
+        }           
+    
+    return iface;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwgenericparam.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,575 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation of TLiwGenericParam and CLiwGenericParamList.
+*
+*/
+
+
+
+
+
+
+
+// INCLUDES
+#include <s32mem.h>
+#include "liwgenericparam.h"
+using namespace LIW;
+namespace {
+
+// CONSTANTS
+// Protect against possible data format changes
+const TInt KVersion = 10;  // Version 1.0
+
+enum TPanicCode
+    {
+    EPanicPostCond_CopyLC = 1,
+    EPanicPostCond_AppendL,
+    EPanicPostCond_Reset
+    };
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+#ifdef _DEBUG
+void Panic(TPanicCode aCode)
+    {
+    _LIT(KPanicText, "GenericParam");
+    User::Panic(KPanicText, aCode);
+    }
+#endif
+
+}
+
+
+const TInt KRFsSlot = 2;
+const TInt KRFileSlot = 3;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/**
+ * Releases any dynamic data owned by this parameter.
+ */
+void TLiwGenericParam::Destroy()
+    {
+    if (iSemanticId != EGenericParamNameAsStringTransient)
+        {
+        delete iReserved;
+        iReserved = NULL;   
+        }
+    iValue.Destroy();
+    }
+
+/**
+ * Copies aParam to this parameter. Takes an own copy of the value held in 
+ * aParam.
+ */
+void TLiwGenericParam::CopyLC(const TLiwGenericParam& aParam)
+    {
+    // Take a copy of value
+    iValue.SetL(aParam.iValue);
+    // Copy semantic id
+    iSemanticId = aParam.iSemanticId;
+    // Copy name  
+    if (iSemanticId == EGenericParamNameAsString) {
+      delete iReserved;
+      iReserved = NULL;
+      iReserved = ((HBufC8*)aParam.iReserved)->AllocL();
+    }
+    else if (iSemanticId == EGenericParamNameAsStringTransient) {
+      delete iReserved;
+      iReserved = NULL;
+      iReserved = ((TDesC8*)aParam.iReserved)->AllocL();
+      iSemanticId = EGenericParamNameAsString;
+    }
+    CleanupStack::PushL(*this);
+
+    //__ASSERT_DEBUG(*this==aParam, Panic(EPanicPostCond_CopyLC));
+    }
+
+
+EXPORT_C void TLiwGenericParam::PushL()
+	{
+	CleanupStack::PushL( TCleanupItem( TLiwGenericParam::ParamCleanup , this) ); 
+	}
+
+EXPORT_C void TLiwGenericParam::ParamCleanup( TAny* aObj )
+    {
+    static_cast<TLiwGenericParam*>(aObj)->Destroy();
+    }
+
+/**
+ * Returns a cleanup item that will call Destroy to this object when 
+ * PopAndDestroy'ed.
+ */
+TLiwGenericParam::operator TCleanupItem()
+    {
+    return TCleanupItem(&CleanupDestroy,this);
+    }
+
+/**
+ * Callback for operator TCleanupItem().
+ */
+void TLiwGenericParam::CleanupDestroy(TAny* aObj)
+    {
+    static_cast<TLiwGenericParam*>(aObj)->Destroy();
+    }
+/**
+ * Internalizes this parameter from aStream.
+ */
+void TLiwGenericParam::InternalizeL(RReadStream& aStream)
+    {
+    /*const TInt version =*/ aStream.ReadInt8L();
+    const TGenericParamId id = 
+        static_cast<TGenericParamId>(aStream.ReadInt32L());
+    if (id == EGenericParamNameAsString)
+      {
+        TInt len = aStream.ReadInt32L();
+        delete iReserved;
+        iReserved = NULL;
+        iReserved = HBufC8::NewL(aStream, len);
+      }
+    iValue.InternalizeL(aStream);
+    iSemanticId = id;
+    }
+
+/**
+ * Externalizes this parameter to aStream.
+ */
+void TLiwGenericParam::ExternalizeL(RWriteStream& aStream) const
+    {
+    aStream.WriteInt8L(KVersion);
+    aStream.WriteInt32L(iSemanticId);
+    if (iSemanticId == EGenericParamNameAsString)
+      {
+        aStream.WriteInt32L(((HBufC8*)iReserved)->Length());
+        aStream << (*((HBufC8*)iReserved));
+      }
+    iValue.ExternalizeL(aStream);
+    }
+
+/**
+ * Returns the maximum externalized size of this parameter.
+ */
+TInt TLiwGenericParam::Size() const
+    {
+    TInt size = sizeof (TInt8); // version
+    size += sizeof (TInt32); // semantic ID
+    if (iSemanticId == EGenericParamNameAsString)
+      {
+        size += sizeof (TInt32); // name length
+        //size += 1;   // header written by operator<<
+        if(((HBufC8*)iReserved)->Size()>=64)
+        	{
+           	size += 2;
+        	}
+        else
+        	{
+        	size += 1;
+           	}
+        	
+        size += ((HBufC8*)iReserved)->Size();
+      }
+    size += iValue.Size();
+    return size;
+    }
+
+EXPORT_C TBool operator==(const TLiwGenericParam& aLhs, 
+    const TLiwGenericParam& aRhs)
+    {
+      if (((aLhs.SemanticId() == EGenericParamNameAsString) ||
+           (aLhs.SemanticId() == EGenericParamNameAsStringTransient)) &&
+          ((aRhs.SemanticId() == EGenericParamNameAsString) ||
+           (aRhs.SemanticId() == EGenericParamNameAsStringTransient)))
+        return ((aLhs.Name() == aRhs.Name()) && (aLhs.Value() == aRhs.Value()));
+      else
+        return 
+          ((aLhs.SemanticId() == aRhs.SemanticId()) && 
+           (aLhs.Value() == aRhs.Value()));
+    }
+
+
+// CLiwGenericParamList
+
+inline CLiwGenericParamList::CLiwGenericParamList()
+    {
+    }
+
+EXPORT_C CLiwGenericParamList* CLiwGenericParamList::NewL()
+    {
+    CLiwGenericParamList *self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+EXPORT_C CLiwGenericParamList* CLiwGenericParamList::NewL(RReadStream& aReadStream)
+    {
+    CLiwGenericParamList *self = NewLC(aReadStream);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+EXPORT_C CLiwGenericParamList* CLiwGenericParamList::NewLC()
+    {
+    CLiwGenericParamList *self = new( ELeave ) CLiwGenericParamList();
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+EXPORT_C CLiwGenericParamList* CLiwGenericParamList::NewLC(RReadStream& aReadStream)
+    {
+    CLiwGenericParamList *self = new( ELeave ) CLiwGenericParamList();
+    CleanupStack::PushL( self );
+    self->AppendL(aReadStream);
+    return self;
+    }
+
+CLiwGenericParamList::~CLiwGenericParamList()
+    {
+    for (TInt index = iParameters.Count()-1; index >= 0; --index)
+        {
+        // Can use Destroy because the parameters cannot be accessed anymore
+        iParameters[index].Destroy();
+        }
+    iParameters.Close();
+    }
+
+EXPORT_C TInt CLiwGenericParamList::Count() const
+    {
+    return iParameters.Count();
+    }
+    
+EXPORT_C TInt CLiwGenericParamList::Count(TGenericParamId aSemanticId, 
+    TVariantTypeId aDataType) const
+    {
+    TInt result = 0;
+    const TInt count = iParameters.Count();
+
+    for (TInt index = 0; index < count; index++)
+        {
+        const TLiwGenericParam& param = iParameters[index];
+        if (param.SemanticId() == aSemanticId)
+            {
+            if (aDataType==EVariantTypeAny || param.Value().TypeId()==aDataType)
+                {
+                result++;                   
+                }
+            }
+        }       
+    return result;     
+    }
+
+
+EXPORT_C const TLiwGenericParam& CLiwGenericParamList::operator[](TInt aIndex) const
+    {
+        return iParameters[aIndex]; 
+    }
+
+EXPORT_C void CLiwGenericParamList::AtL(TInt aIndex, TLiwGenericParam& aParam) const
+    {
+    aParam.CopyLC(iParameters[aIndex]); 
+    CleanupStack::Pop(&aParam);   
+    }
+
+EXPORT_C void CLiwGenericParamList::AppendL(const TLiwGenericParam& aParam)
+    {
+    TLiwGenericParam newParam;
+    newParam.CopyLC(aParam);
+    User::LeaveIfError(iParameters.Append(newParam));
+    CleanupStack::Pop(&newParam);
+
+    //__ASSERT_DEBUG((*this)[Count()-1]==aParam, Panic(EPanicPostCond_AppendL));
+    }
+
+
+EXPORT_C TBool CLiwGenericParamList::Remove(TInt aSemanticId)
+    {
+    const TInt count = iParameters.Count();
+    for (TInt index = 0; index < count; ++index)
+        {
+        const TLiwGenericParam& param = iParameters[index];
+        if (param.SemanticId() == aSemanticId)
+            {
+            iParameters.Remove(index);
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+EXPORT_C void CLiwGenericParamList::Remove(const TDesC8& aName)
+    {
+    TInt start = 0;
+    FindFirst(start, aName);
+    while (start != KErrNotFound)
+        {
+        // Can use Destroy because the parameters cannot be accessed anymore
+        iParameters[start].Destroy();
+        iParameters.Remove(start);
+        start = 0;   
+        FindFirst(start, aName);
+        }
+    }
+    
+EXPORT_C void CLiwGenericParamList::Reset()
+    {
+    for (TInt index = iParameters.Count()-1; index >= 0; --index)
+        {
+        // Can use Destroy because the parameters cannot be accessed anymore
+        iParameters[index].Destroy();
+        iParameters.Remove(index);
+        }
+
+    __ASSERT_DEBUG(Count()==0, Panic(EPanicPostCond_Reset));
+    }
+
+EXPORT_C const TLiwGenericParam* CLiwGenericParamList::FindFirst(
+    TInt &aIndex, 
+    TGenericParamId aSemanticId, 
+    TVariantTypeId aDataType) const
+    {
+    if (aIndex >= 0)
+        {
+        const TInt count = iParameters.Count();
+        for (TInt index = aIndex; index < count; ++index)
+            {
+            const TLiwGenericParam& param = iParameters[index];
+            if (param.SemanticId() == aSemanticId)
+                {
+                if (aDataType==EVariantTypeAny || param.Value().TypeId()==aDataType)
+                    {
+                    aIndex = index;
+                    return &param;
+                    }
+                }
+            }
+        }
+    aIndex = KErrNotFound;
+    return NULL;
+    }
+
+EXPORT_C const TLiwGenericParam* CLiwGenericParamList::FindNext(
+    TInt &aIndex, 
+    TGenericParamId aSemanticId,
+    TVariantTypeId aDataType) const
+    {
+    if (aIndex < 0)
+        {
+        aIndex = KErrNotFound;
+        return NULL;
+        }
+
+    TInt index = aIndex+1;
+    const TLiwGenericParam* result = FindFirst(index, aSemanticId, aDataType);
+    aIndex = index;
+    return result;
+    }
+
+EXPORT_C const TLiwGenericParam* CLiwGenericParamList::FindNext(
+    TInt &aIndex, 
+    const TDesC8& aName,
+    TVariantTypeId aDataType) const
+    {
+    if (aIndex < 0)
+        {
+        aIndex = KErrNotFound;
+        return NULL;
+        }
+
+    TInt index = aIndex+1;
+    const TLiwGenericParam* result = FindFirst(index, aName, aDataType);
+    aIndex = index;
+    return result;
+    }
+
+EXPORT_C const TLiwGenericParam* CLiwGenericParamList::FindFirst 
+        (TInt &aIndex, const TDesC8& aName, 
+        TVariantTypeId aDataType) const
+    {
+    if (aIndex >= 0)
+        {
+        const TInt count = iParameters.Count();
+        for (TInt index = aIndex; index < count; ++index)
+            {
+            const TLiwGenericParam& param = iParameters[index];
+            if ((param.SemanticId() == EGenericParamNameAsString) &&
+                (param.Name() == aName))
+                {
+                if (aDataType==EVariantTypeAny || param.Value().TypeId()==aDataType)
+                    {
+                    aIndex = index;
+                    return &param;
+                    }
+                }
+            }
+        }
+    aIndex = KErrNotFound;
+    return NULL;
+    }
+
+EXPORT_C void CLiwGenericParamList::ExternalizeL(RWriteStream& aStream) const
+    {
+    aStream.WriteInt8L(KVersion);
+    const TInt count = iParameters.Count();
+    aStream.WriteInt32L(count);
+    for (TInt index = 0; index < count; ++index)
+        {
+        iParameters[index].ExternalizeL(aStream);
+        }
+    }
+
+EXPORT_C TInt CLiwGenericParamList::Size() const
+    {
+    TInt size = sizeof (TInt8); // version
+    size += sizeof (TInt32);  // param count
+    const TInt count = iParameters.Count();
+    for (TInt index = 0; index < count; ++index)
+        {
+        size += iParameters[index].Size();
+        }
+    return size;
+    }
+
+/**
+ * Appends parameters to this list from aStream.
+ */
+void CLiwGenericParamList::AppendL(RReadStream& aReadStream)
+    {
+    /*const TInt version =*/ aReadStream.ReadInt8L();
+    
+    TInt count = aReadStream.ReadInt32L();
+    while (count--)
+        {
+        TLiwGenericParam param;
+        CleanupStack::PushL(param);
+        param.InternalizeL(aReadStream);
+        User::LeaveIfError(iParameters.Append(param));
+        CleanupStack::Pop(&param);
+        }
+    }
+
+
+
+EXPORT_C void CLiwGenericParamList::InternalizeL(RReadStream& aStream)
+    {
+    AppendL(aStream);
+    }
+
+
+EXPORT_C HBufC8* CLiwGenericParamList::PackForServerL(TIpcArgs& aArgs)
+    {   
+    TInt index;
+    TInt rfileCount = 0;
+    RFile fhandle;
+
+    HBufC8* buf = HBufC8::NewLC(Size() + iParameters.Count());
+    TPtr8 des = buf->Des();
+    RDesWriteStream outstrm(des);    
+    CleanupClosePushL(outstrm);
+
+    outstrm.WriteInt16L(iParameters.Count());   
+
+    for (index = 0; index < iParameters.Count(); index++)
+        {       
+        if (iParameters[index].Value().TypeId() == EVariantTypeFileHandle)
+            {
+            if (rfileCount == 0)
+                {
+                outstrm.WriteInt8L(iParameters[index].Value().TypeId());
+                outstrm.WriteInt32L(iParameters[index].SemanticId());
+                if (iParameters[index].Value().Get(fhandle))
+                    {
+                    rfileCount++;
+                    }
+                }
+            }
+        else
+            {
+            outstrm.WriteInt8L(iParameters[index].Value().TypeId());
+            iParameters[index].ExternalizeL( outstrm );
+            }
+        }
+        
+    outstrm.CommitL();  
+    CleanupStack::PopAndDestroy(&outstrm);
+                        
+    aArgs.Set(0, buf);
+    aArgs.Set(1, des.MaxLength());    
+        
+    if (rfileCount)
+        {
+        fhandle.TransferToServer(aArgs, KRFsSlot, KRFileSlot);      
+        }   
+
+    CleanupStack::Pop(buf);    // buf
+
+    return buf;
+    }
+
+
+EXPORT_C void CLiwGenericParamList::UnpackFromClientL(const RMessage2& aMsg)
+    {
+    TInt8 type;
+    TInt index;
+    TLiwGenericParam param; 
+    TGenericParamId handleId = EGenericParamUnspecified;
+    TInt numFileHandles = 0;
+
+    HBufC8* buf = HBufC8::NewLC(aMsg.Int1());
+    TPtr8 ptr(buf->Des());
+    aMsg.ReadL(0, ptr);
+    RDesReadStream instrm(buf->Des());
+
+    const TInt16 count = instrm.ReadInt16L();
+    for (index = 0; index < count; index++)
+        {
+        type = instrm.ReadInt8L();
+        if (type == EVariantTypeFileHandle)
+            {
+            if (numFileHandles == 0)
+                {
+                handleId = (TGenericParamId)instrm.ReadInt32L();
+                numFileHandles++;
+                }
+            }
+        else
+            {
+            param.InternalizeL(instrm);
+            AppendL(param);
+            param.Reset();
+            }
+        }
+
+    if (numFileHandles)
+        {
+        RFile file;
+        file.AdoptFromClient(aMsg, KRFsSlot, KRFileSlot);
+        TLiwVariant variant(file);
+        AppendL(TLiwGenericParam(handleId, variant));               
+        }
+        
+    CleanupStack::PopAndDestroy(buf); // buf       
+    }
+    
+
+EXPORT_C void CLiwGenericParamList::AppendL(const CLiwGenericParamList& aList)
+    {
+    for (TInt index = 0; index < aList.iParameters.Count(); index++)
+        {
+        AppendL(aList.iParameters[index]);
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwmenu.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 LIW Menu utilities for providers to access consumer menu.
+*
+*/
+
+
+
+
+
+
+#include <barsread.h> 
+#include <barsc.h> 
+#include <bautils.h>
+#include "liwmenu.h"
+#include "liwcommon.hrh"
+
+// This is needed for resource reading.
+const TInt KCCMask(0x00000fff);
+
+
+EXPORT_C CLiwMenuPane::CLiwMenuPane(CEikMenuPane& aMenuPane, TInt aBaseCmdId) 
+: iMenuPane(&aMenuPane), iBaseCmdId(aBaseCmdId)
+    {
+    iNextCmdId = aBaseCmdId;
+    }
+
+
+EXPORT_C CLiwMenuPane::~CLiwMenuPane()
+    {   
+    delete iMenuPane;
+    
+    for(TInt i = 0; i < iIdMap.Count(); i++)
+        {
+        iIdMap[i].extraText.Close();
+        }
+    
+    iIdMap.Reset();
+    }
+
+
+EXPORT_C void CLiwMenuPane::AddMenuItemL(
+    TInt aServiceCmd,
+    CEikMenuPaneItem::SData& aMenuItem, 
+    TInt aIndex)
+    {
+    AddMenuItemL(aServiceCmd, aMenuItem, aIndex, KNullDesC());
+    }
+    
+    
+EXPORT_C void CLiwMenuPane::AddMenuItemL(
+    TInt aServiceCmd,
+    CEikMenuPaneItem::SData& aMenuItem, 
+    TInt aIndex,
+    const TDesC& aExtraText)
+    {
+    SMenuIdMap map;
+
+    map.dynMenuCmdId = iNextCmdId + iPaneOffset;
+    map.serviceCmdId = aServiceCmd;
+    map.origCmdId = aMenuItem.iCommandId;
+    map.owner = iInitializingOwner;
+    map.extraText.Assign(aExtraText.AllocL());
+    CleanupClosePushL(map.extraText);
+
+    aMenuItem.iCommandId = iNextCmdId + iPaneOffset;
+    iNextCmdId++;
+
+    iMenuPane->InsertMenuItemL(aMenuItem, aIndex); 
+    User::LeaveIfError(iIdMap.Append( map ));
+    CleanupStack::Pop(&(map.extraText)); // map.extraText
+    }    
+
+
+    
+EXPORT_C void CLiwMenuPane::AddMenuItemsL(
+    TResourceReader& aReader,
+    TInt aServiceCmd,
+    TInt aIndex,
+    TBool /*aAddSeperator*/)
+    {
+    CEikMenuPaneItem::SData data;
+
+    TInt index = aIndex;
+   
+    TInt count = aReader.ReadInt16();
+    for (TInt i = 0; i < count; i++)
+        {
+        data.iCommandId = aReader.ReadInt32();
+        data.iCascadeId = aReader.ReadInt32();  
+        data.iFlags = aReader.ReadInt32();
+        data.iText.Copy(aReader.ReadTPtrC());
+        
+        // Extra text (additional submenu text) must be handled separately
+        // because SData doesn't offer space for it.
+        TPtrC extraText = aReader.ReadTPtrC();
+        
+        aReader.ReadTPtrC(); // Skip bmpfile.
+        aReader.ReadInt16(); // Skip bmpid.
+        aReader.ReadInt16(); // Skip bmpmask. 
+        aReader.ReadInt32(); // Skip extension.   
+
+        if (data.iCommandId == LIW_SUBMENU_TITLE)
+            {
+            AddTitleItemL(data.iText, index);
+            }
+        else
+            {
+            AddMenuItemL(aServiceCmd, data, index++, extraText);
+            }
+        } 
+    }
+
+
+  
+EXPORT_C void CLiwMenuPane::AddMenuItemsL(
+    TFileName& aFileName,
+    TInt aResId,
+    TInt aServiceCmd,
+    TInt aIndex,
+    TBool aAddSeparator)
+    {
+    TResourceReader reader; 
+
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    CleanupClosePushL( fsSession );
+
+    BaflUtils::NearestLanguageFile(fsSession, aFileName);
+
+    RResourceFile rsFile;
+    rsFile.OpenL( fsSession, aFileName );
+    CleanupClosePushL( rsFile );
+
+    // Read multitapping resource.
+    HBufC8* rBuffer = rsFile.AllocReadLC(aResId & KCCMask); // Remove offset from id
+    reader.SetBuffer( rBuffer );
+
+    AddMenuItemsL(reader, aServiceCmd, aIndex, aAddSeparator);
+
+    CleanupStack::PopAndDestroy(rBuffer);  // rBuffer, rsFile, fsSession
+    CleanupStack::PopAndDestroy(&rsFile);
+    CleanupStack::PopAndDestroy(&fsSession);
+    }
+
+
+
+EXPORT_C TInt CLiwMenuPane::MenuCmdId(TInt aDynCmdId) const
+    {
+    for (TInt i = 0; i < iIdMap.Count(); i++)
+        {
+        if (iIdMap[i].dynMenuCmdId == aDynCmdId)
+            {
+            return iIdMap[i].origCmdId;
+            }
+        }
+
+    return 0;
+    }
+
+    
+
+EXPORT_C TInt CLiwMenuPane::DynCmdId(TInt aMenuCmdId) const
+    {
+    for (TInt i = 0; i < iIdMap.Count(); i++)
+        {
+        if (iIdMap[i].origCmdId == aMenuCmdId)
+            {
+            return iIdMap[i].dynMenuCmdId;
+            }
+        }
+
+    return 0;
+    }
+
+
+
+EXPORT_C TInt CLiwMenuPane::ServiceCmdId(TInt aDynCmdId) const
+    {
+    for (TInt i = 0; i < iIdMap.Count(); i++)
+        {
+        if (iIdMap[i].dynMenuCmdId == aDynCmdId)
+            {
+            return iIdMap[i].serviceCmdId;
+            }
+        }
+
+    return 0; 
+    }
+
+
+
+TInt CLiwMenuPane::FindCmdId(TInt aIndex)
+    {
+    TInt index;
+
+    for (TInt i = 0; i < iIdMap.Count(); i++)
+        {
+        if (iMenuPane->MenuItemExists(iIdMap[i].dynMenuCmdId, index))   
+            {
+            if (aIndex == index)
+                {
+                return iIdMap[i].dynMenuCmdId;
+                }
+            }
+        }
+
+    return -1;
+    }
+
+
+
+EXPORT_C void CLiwMenuPane::AddTitleItemL(const TDesC& aTitle, TInt aIndex) 
+    {
+    CEikMenuPaneItem::SData data;
+    
+    data.iCommandId = LIW_SUBMENU_TITLE;
+    data.iCascadeId = 0;  
+    data.iFlags = 0;
+    data.iText.Copy(aTitle);
+
+    iMenuPane->InsertMenuItemL(data, aIndex);       
+    }
+
+
+TBool CLiwMenuPane::IsCmdInRange(TInt aCmdSpaceSize, TInt aCmd)
+    {
+    if ((aCmd >= iPaneOffset + iBaseCmdId) &&
+        (aCmd < iPaneOffset + iBaseCmdId + aCmdSpaceSize))
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+
+CLiwServiceIfBase* CLiwMenuPane::CommandOwner(TInt aDynCmd) const
+    {
+    for (TInt i = 0; i < iIdMap.Count(); i++)
+        {
+        if (iIdMap[i].dynMenuCmdId == aDynCmd)
+            {
+            return iIdMap[i].owner;
+            }
+        }   
+
+    return NULL;
+    }
+    
+    
+const TDesC& CLiwMenuPane::ExtraText(TInt aDynMenuCmdId)
+    {
+    TInt count = iIdMap.Count();
+    for(TInt i = 0; i < count; i++)
+        {
+        if(iIdMap[i].dynMenuCmdId == aDynMenuCmdId)
+            {
+            return iIdMap[i].extraText;
+            }
+        }
+    return KNullDesC;        
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwmenubinding.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <ecom/ecom.h>
+#include "liwmenubinding.h"
+
+CLiwMenuBinding* CLiwMenuBinding::NewL()
+    {
+    CLiwMenuBinding* bind = new (ELeave) CLiwMenuBinding();
+    CleanupStack::PushL(bind);
+    bind->ConstructL();
+    CleanupStack::Pop(bind); // bind
+    return bind;
+    }
+
+
+CLiwMenuBinding* CLiwMenuBinding::NewL(TInt aMenuItemIndex, TInt aParentId)
+    {
+    CLiwMenuBinding* bind = new (ELeave) CLiwMenuBinding(aMenuItemIndex, aParentId);
+    CleanupStack::PushL(bind);
+    bind->ConstructL();
+    CleanupStack::Pop(bind); // bind
+    return bind;
+    }
+
+
+CLiwMenuBinding* CLiwMenuBinding::NewLC()
+    {
+    CLiwMenuBinding* bind = new (ELeave) CLiwMenuBinding();
+    CleanupStack::PushL(bind);
+    bind->ConstructL();
+    return bind;
+    }
+
+
+CLiwMenuBinding* CLiwMenuBinding::NewLC(TInt aMenuItemIndex, TInt aMenuId)
+    {
+    CLiwMenuBinding* bind = new (ELeave) CLiwMenuBinding(aMenuItemIndex, aMenuId);
+    CleanupStack::PushL(bind);
+    bind->ConstructL();
+    return bind;
+    }
+
+
+
+CLiwMenuBinding::CLiwMenuBinding()
+    {
+    }
+
+
+void CLiwMenuBinding::ConstructL()
+    {
+    }
+
+
+CLiwMenuBinding::CLiwMenuBinding(TInt aMenuItemIndex, TInt aMenuId) 
+:iMenuItemIndex(aMenuItemIndex), iMenuId(aMenuId)
+    {
+    // Nothing to do here.
+    }
+
+
+
+CLiwMenuBinding::~CLiwMenuBinding()
+    {
+    }
+
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwresolver.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation of Custom ECom Resolver for LIW.
+*
+*/
+
+
+
+
+
+
+#include "liwresolver.h"
+
+const TInt KMaxDataItemSize = 150;
+_LIT8(KContentTag, "<CONTENT>");
+_LIT8(KOpaqueTag, "<OPAQUE>");
+
+
+CLiwResolver* CLiwResolver::NewL(MPublicRegistry& aRegistry)
+    {
+    return new (ELeave) CLiwResolver(aRegistry);
+    }
+
+
+CLiwResolver::CLiwResolver(MPublicRegistry& aRegistry) : CResolver(aRegistry)
+    {
+    // Nothing to do.
+    }
+
+
+CLiwResolver::~CLiwResolver()
+    {
+    if (iImplementationInfoArray)
+        {
+        iImplementationInfoArray->Reset();  
+        delete iImplementationInfoArray;
+        }
+    }
+
+
+
+TUid CLiwResolver::IdentifyImplementationL(TUid aInterfaceUid, 
+    const TEComResolverParams& aAdditionalParameters) const
+    {
+    RImplInfoArray& implementationsInfo = iRegistry.ListImplementationsL(aInterfaceUid);
+    TUid found = KNullUid;
+
+    if(implementationsInfo.Count())
+        {
+        found = Resolve(implementationsInfo, aAdditionalParameters);
+        }
+
+    return found;
+    }
+
+
+
+RImplInfoArray* CLiwResolver::ListAllL(TUid aInterfaceUid, 
+    const TEComResolverParams& aAdditionalParameters) const
+    {
+    // Use the member var to create the array so that we get proper cleanup behaviour
+    delete iImplementationInfoArray;
+    iImplementationInfoArray = NULL;
+    iImplementationInfoArray = new (ELeave) RImplInfoArray;
+    RImplInfoArray* retList = iImplementationInfoArray;
+
+    RImplInfoArray& fullList = iRegistry.ListImplementationsL(aInterfaceUid);
+
+    const TBool useWildcards = aAdditionalParameters.IsWildcardMatch();
+    TBuf8<KMaxDataItemSize> content;
+    TBuf8<KMaxDataItemSize> opaque;
+
+    ParseInput(aAdditionalParameters.DataType(), content, opaque);
+    const TInt numImps = fullList.Count();
+
+    for (TInt index = 0; index < numImps; ++index)
+        {
+        if (Match(fullList[index]->DataType(), content, useWildcards) &&
+            MatchServiceCmd(fullList[index]->OpaqueData(), opaque))
+            {
+            User::LeaveIfError(retList->Append(fullList[index]));
+            }
+        }
+
+    // Reset the member variable because we are passing ownership back
+    iImplementationInfoArray = NULL;
+
+    return retList;
+    }
+
+
+
+void CLiwResolver::ParseInput(const TDesC8& aParam, TDes8& aContent, TDes8& aOpaque) const
+    {
+    TInt cind = aParam.Find(KContentTag);
+    TInt oind = aParam.Find(KOpaqueTag);
+        
+    if (cind != KErrNotFound)
+        {
+        if (oind != KErrNotFound)
+            {
+            aContent.Copy(aParam.Mid(cind + (&KContentTag)->Length(), 
+                                     oind - (cind + (&KContentTag)->Length())));
+            }
+        else
+            {
+            aContent.Copy(aParam.Mid(cind + (&KContentTag)->Length()));
+            }
+        }
+
+    if (oind != KErrNotFound)
+        {
+        aOpaque.Copy(aParam.Mid(oind + (&KOpaqueTag)->Length()));
+        }
+    }
+
+
+
+TUid CLiwResolver::Resolve(const RImplInfoArray& aImplementationsInfo, 
+    const TEComResolverParams& aAdditionalParameters) const
+    {
+    // Loop through the implementations matching on type
+    const TInt count = aImplementationsInfo.Count();
+
+    for (TInt index = 0; index < count; ++index)
+        {
+        const CImplementationInformation& impData = *aImplementationsInfo[index];
+        // As soon as we get a match on the datatype then return uid of the
+        // implementation found.
+        if (Match(impData.DataType(),                   // The Datatype of this implementation
+            aAdditionalParameters.DataType(),           // The type we are trying to find
+            aAdditionalParameters.IsWildcardMatch()))   // If wildcards should be used
+            {
+            return impData.ImplementationUid();
+            }
+        }
+
+    return KNullUid;
+    }
+
+
+TBool CLiwResolver::Match(const TDesC8& aImplementationType, const TDesC8& aMatchType, 
+    TBool aUseWildcards) const
+    {
+    TInt matchPos = KErrNotFound;
+
+    _LIT8(dataSeparator, "||");
+    const TInt separatorLength = dataSeparator().Length();
+
+    // Look for the section separator marker '||'
+    TInt separatorPos = aImplementationType.Find(dataSeparator);
+
+    if (separatorPos == KErrNotFound)
+        {
+        // Match against the whole string
+        if (aUseWildcards)
+            {
+            matchPos = aImplementationType.Match(aMatchType);
+            }
+        else
+            {
+
+            if (aImplementationType.Compare(aMatchType) == 0)
+                {
+                matchPos = KErrNone;    
+                }
+            }
+        }
+    else
+        {
+        // Find the first section, up to the separator
+        TPtrC8 dataSection = aImplementationType.Left(separatorPos);
+        TPtrC8 remainingData = aImplementationType.Mid(separatorPos + separatorLength);
+
+        // Match against each section in turn
+        while (separatorPos != KErrNotFound)
+            {
+            // Search this section
+            if (aUseWildcards)
+                {          
+                matchPos = dataSection.Match(aMatchType);
+                }
+            else
+                {
+                matchPos = dataSection.Compare(aMatchType);
+                }
+
+            // If we found it then no need to continue, so return
+            if (matchPos != KErrNotFound)
+                {
+                return ETrue;
+                }
+
+            // Move on to the next section
+            separatorPos = remainingData.Find(dataSeparator);
+
+            if (separatorPos != KErrNotFound)
+                {
+                dataSection.Set(remainingData.Left(separatorPos));
+                remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
+                }
+            else
+                {
+                dataSection.Set(remainingData);
+                }   
+            }
+
+        // Check the final part
+        if (aUseWildcards)
+            {
+            matchPos = dataSection.Match(aMatchType);
+            }
+        else
+            {
+            matchPos = dataSection.Compare(aMatchType);
+            }
+
+        }
+
+    return matchPos != KErrNotFound;
+    }
+
+
+
+
+TBool CLiwResolver::MatchServiceCmd(const TDesC8& aOpaqueData, const TDesC8& aServiceCmd) const
+   {
+   _LIT8(KWild,"*");
+   
+   //check for wildcard character *
+   //if yes, return immediatly
+   if(0==aServiceCmd.Compare(KWild))
+   	return ETrue;
+   
+   // Extract List Of service command from OpaQue Data
+    _LIT8(MetadataSeparator, "::");
+    TPtrC8 dataSection;
+    TInt MetadataSeparatorPos = aOpaqueData.Find(MetadataSeparator);
+    if (MetadataSeparatorPos != KErrNotFound)
+    { 
+        dataSection.Set(aOpaqueData.Left(MetadataSeparatorPos));
+    }
+    else
+    {
+        dataSection.Set(aOpaqueData);
+    }
+    
+    _LIT8(dataSeparator, "||");
+    const TInt separatorLength = dataSeparator().Length();
+
+    // Look for the section separator marker '||'
+    TInt separatorPos = dataSection.Find(dataSeparator);
+
+    if (separatorPos == KErrNotFound)
+        {
+         if (aServiceCmd.Compare(dataSection) == 0)
+            {
+            return ETrue;   
+            }
+        }
+    else
+        {
+         // Find the first section, up to the separator
+        TPtrC8 remainingData = dataSection.Mid(separatorPos + separatorLength);
+        dataSection.Set(dataSection.Left(separatorPos));
+
+        // Match against each section in turn
+        while (separatorPos != KErrNotFound)
+            {
+            if (dataSection.Compare(aServiceCmd) == 0)
+                {
+                return ETrue;
+                }
+
+            // Move on to the next section
+            separatorPos = remainingData.Find(dataSeparator);
+
+            if (separatorPos != KErrNotFound)
+                {
+                dataSection.Set(remainingData.Left(separatorPos));
+                remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
+                }
+            else
+                {
+                dataSection.Set(remainingData);
+                }   
+            }
+
+        if (dataSection.Compare(aServiceCmd) == 0)
+            {
+            return ETrue;   
+            }       
+        }
+
+    return EFalse;
+    }
+
+// Map the interface UIDs
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(KLiwResolverImplUidValue, CLiwResolver::NewL)
+    };
+
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------
+//
+//
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwservicedata.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Class modelling service provider data. The important
+*				 service provider data that are part of this class
+*				 is metadata information.
+*
+*/
+
+
+
+
+
+
+
+#include "LiwServiceData.h"
+#include <LiwVariant.h>
+#include <LiwGenericParam.h>
+
+#include <escapeUtils.h>
+
+#include <BADESCA.H> 
+
+/**
+* Creates and returns an instance of \c CLiwServiceData
+*
+* @return an instance of \c CLiwServiceData
+*/
+CLiwServiceData* CLiwServiceData::NewL()
+{
+	CLiwServiceData* srvData = CLiwServiceData::NewLC();
+	CleanupStack::Pop(srvData);
+	return srvData;
+}
+
+/**
+* Creates and returns an instance of \c CLiwServiceData.
+* Leaves the created instance in the cleanupstack. 
+*
+* @return an instance of \c CLiwServiceData
+*/
+CLiwServiceData* CLiwServiceData::NewLC()
+{
+	CLiwServiceData* srvData = new (ELeave) CLiwServiceData();
+	CleanupStack::PushL( srvData );
+	srvData->ConstructL();
+	return srvData;
+}
+
+/**
+* Default constructor
+*
+*/
+CLiwServiceData::CLiwServiceData():iDataList(NULL)
+{
+}
+
+/**
+* Instantiates metadata instance
+*
+*/
+void CLiwServiceData::ConstructL()
+{
+	iDataList = CLiwGenericParamList::NewL();
+}
+
+/**
+* Destructor. Cleans up the metadata instance
+*
+*/
+CLiwServiceData::~CLiwServiceData()
+{
+	if(iDataList)
+	{
+		iDataList->Reset();
+		delete iDataList;
+	}
+}
+
+CLiwGenericParamList* CLiwServiceData::GetMetaData() const
+{
+	if(iDataList)
+		return iDataList;
+	else
+		return NULL;
+}
+
+void CLiwServiceData::AddMetaDataL(const TDesC8& aKey, const TLiwVariant& aValue)
+{
+	TInt idx(0);
+	const TLiwGenericParam* constParam = iDataList->FindFirst(idx,aKey);
+	
+	if(constParam)
+	{
+			TLiwGenericParam* param = const_cast<TLiwGenericParam*>(constParam);
+			
+			//list exists already..fetch the value list and append aValue to it
+			CLiwList* pValues = const_cast<CLiwList*>(param->Value().AsList());
+			pValues->AppendL(aValue);
+	}
+	else
+	{
+	 		//key does not exist so far..
+			CLiwList* pValues = CLiwDefaultList::NewLC();
+			pValues->AppendL(aValue);
+			
+			iDataList->AppendL(TLiwGenericParam(aKey,TLiwVariant(pValues)));
+			CleanupStack::Pop(pValues);
+			pValues->DecRef();
+	}
+}
+
+/*
+ * Adds a metadata name-value pair if not already added. If the key already
+ * exists, then the new metadata value (if does not exist already) will be added
+ * to the list of values associated with a metadata key.
+ *
+ * @param aKey		the metadata key to be inserted
+ * @param aValue  the metadata value corresponding to the key to be added
+ *
+ */
+void CLiwServiceData::AddMetaDataL(const TDesC8& aKey, const TDesC8& aValue)
+{
+	HBufC *buff = EscapeUtils::ConvertToUnicodeFromUtf8L(aValue);
+	CleanupStack::PushL(buff);
+	TPtrC ptr = buff->Des();
+    TLiwVariant tempVar(ptr);
+    tempVar.PushL();
+    
+	this->AddMetaDataL(aKey,tempVar);
+	
+	CleanupStack::Pop(&tempVar);
+	tempVar.Reset();
+	CleanupStack::PopAndDestroy(buff);	
+}
+
+/*
+ * Removes all the metadata key-value pairs.
+ * This is called from service handler implementation if and only
+ * if there is an error in parsing. Since, the FW uses SAX parser
+ * and if the XML error happens after the metadata entries are 
+ * created, the entries should be cleaned up.
+ *
+ */
+void CLiwServiceData::CleanUpMetaData()
+{
+	iDataList->Reset();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwservicehandler.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 API for consumer application to access Language
+*                Interworking Framework. 
+*
+*/
+
+
+
+
+
+
+#include <eikenv.h>
+#include <liwservicehandler.rsg>
+#include "liwmenubinding.h"
+#include "liwservicehandler.h"
+#include "liwservicehandlerimpl.h"
+#include "liwmenu.h"
+#include "liwuids.hrh"
+#include "liwcommon.hrh"
+#include "liwtlsdata.h"
+
+
+//
+// LiwServiceHandler
+//
+
+EXPORT_C CLiwServiceHandler* CLiwServiceHandler::NewL()
+    {
+    CLiwServiceHandler* handler = new (ELeave) CLiwServiceHandler();
+    CleanupStack::PushL( handler );
+    handler->ConstructL();
+    CleanupStack::Pop(handler); // handler
+    return handler;
+    }
+
+
+EXPORT_C CLiwServiceHandler* CLiwServiceHandler::NewLC()
+    {
+    CLiwServiceHandler* handler = new (ELeave) CLiwServiceHandler();
+    CleanupStack::PushL( handler );
+    handler->ConstructL();
+    return handler;     
+    }
+
+
+CLiwServiceHandler::CLiwServiceHandler()
+    {
+    // Nothing to do here.
+    }
+
+
+void CLiwServiceHandler::ConstructL()
+    {
+    iImpl = CLiwServiceHandlerImpl::NewL();
+    }
+
+
+EXPORT_C CLiwServiceHandler::~CLiwServiceHandler()
+    {
+    delete iImpl;
+    }
+
+
+EXPORT_C void CLiwServiceHandler::Reset()
+    {
+    iImpl->Reset();
+    }
+
+
+EXPORT_C TInt CLiwServiceHandler::NbrOfProviders(const CLiwCriteriaItem* aCriteria)
+    {
+    return iImpl->NbrOfProviders(aCriteria);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::AttachL(TInt aInterestResourceId)
+    {
+    iImpl->AttachL(aInterestResourceId);
+    }
+
+
+EXPORT_C TInt CLiwServiceHandler::AttachL(const RCriteriaArray& aInterest)
+    {
+    return (iImpl->AttachL(aInterest,NULL));
+    }
+
+EXPORT_C TInt CLiwServiceHandler::AttachL(const RCriteriaArray& aInterest,CRTSecMgrScriptSession& aSecMgrScriptSession)
+    {
+    return (iImpl->AttachL(aInterest,&aSecMgrScriptSession));
+    }
+
+EXPORT_C void CLiwServiceHandler::GetInterest(RCriteriaArray& aInterest)
+    {
+    iImpl->GetInterest(aInterest);
+    }
+    
+    
+EXPORT_C void CLiwServiceHandler::DetachL(const RCriteriaArray& aInterest)
+    {
+    iImpl->DetachL(aInterest);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::DetachL(TInt aInterestResourceId)
+    {
+    iImpl->DetachL(aInterestResourceId);
+    }
+
+
+EXPORT_C const CLiwCriteriaItem* CLiwServiceHandler::GetCriteria(TInt aId)
+    {
+    return iImpl->GetCriteria(aId);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::InitializeMenuPaneL(
+    CEikMenuPane& aMenuPane,
+    TInt aMenuResourceId,
+    TInt aBaseMenuCmdId,
+    const CLiwGenericParamList& aInParamList)
+    {
+    iImpl->InitializeMenuPaneL(aMenuPane, aMenuResourceId, aBaseMenuCmdId, aInParamList);   
+    }
+    
+EXPORT_C void CLiwServiceHandler::InitializeMenuPaneL(
+    CEikMenuPane& aMenuPane,
+    TInt aMenuResourceId,
+    TInt aBaseMenuCmdId,
+    const CLiwGenericParamList& aInParamList,
+    TBool aUseSubmenuTextsIfAvailable)
+    {
+    iImpl->InitializeMenuPaneL(aMenuPane, 
+        aMenuResourceId, 
+        aBaseMenuCmdId, 
+        aInParamList, 
+        aUseSubmenuTextsIfAvailable);
+    }    
+
+    
+EXPORT_C TInt CLiwServiceHandler::ServiceCmdByMenuCmd(TInt aMenuCmdId) const
+    {
+    return iImpl->ServiceCmdByMenuCmd(aMenuCmdId);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::ExecuteMenuCmdL(
+    TInt aMenuCmdId,
+    const CLiwGenericParamList& aInParamList,
+    CLiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    MLiwNotifyCallback* aCallback)
+    {
+    iImpl->ExecuteMenuCmdL(aMenuCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::AttachMenuL(TInt aMenuResourceId, TInt aInterestResourceId)
+    {
+    iImpl->AttachMenuL(aMenuResourceId, aInterestResourceId);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::AttachMenuL(TInt aMenuResourceId, TResourceReader& aReader)
+    {
+    iImpl->AttachMenuL(aMenuResourceId, aReader);
+    }
+    
+EXPORT_C void CLiwServiceHandler::AttachMenuL(TInt aMenuResourceId, const RCriteriaArray& aInterest)
+    {
+    iImpl->AttachMenuL(aMenuResourceId, aInterest);
+    }  
+
+EXPORT_C void CLiwServiceHandler::AttachMenuL(RArray<TInt>& aMenuEntries, TInt aMenuResourceId,
+                                              RCriteriaArray& aInterest)
+    {
+    iImpl->AttachMenuL(aMenuEntries, aMenuResourceId, aInterest);
+    }
+
+EXPORT_C void CLiwServiceHandler::DetachMenu(TInt aMenuResourceId, TInt aInterestResourceId)
+    {
+    iImpl->DetachMenu(aMenuResourceId, aInterestResourceId);
+    }
+
+
+EXPORT_C TBool CLiwServiceHandler::IsSubMenuEmpty(TInt aSubMenuId)
+    {
+    return iImpl->IsSubMenuEmpty(aSubMenuId);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::ExecuteServiceCmdL(
+    const TInt& aCmdId,
+    const CLiwGenericParamList& aInParamList,
+    CLiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    MLiwNotifyCallback* aCallback)
+    {
+    iImpl->ExecuteServiceCmdL(aCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback);
+    }
+
+EXPORT_C void CLiwServiceHandler::ExecuteServiceCmdL(
+    const CLiwCriteriaItem& aCmd,
+    const CLiwGenericParamList& aInParamList,
+    CLiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    MLiwNotifyCallback* aCallback)
+    {
+    iImpl->ExecuteServiceCmdL(aCmd, aInParamList, aOutParamList, aCmdOptions, aCallback);
+    }
+
+EXPORT_C CLiwGenericParamList& CLiwServiceHandler::InParamListL()
+    {
+    return iImpl->InParamListL();
+    }
+
+
+EXPORT_C CLiwGenericParamList& CLiwServiceHandler::OutParamListL()
+    {
+    return iImpl->OutParamListL();
+    }
+
+
+EXPORT_C TBool CLiwServiceHandler::IsLiwMenu(TInt aMenuResourceId)
+    {
+    return iImpl->IsLiwMenu(aMenuResourceId);
+    }
+
+
+EXPORT_C TBool CLiwServiceHandler::HandleSubmenuL(CEikMenuPane& aPane)
+    {
+    return iImpl->HandleSubmenuL(aPane);
+    }
+    
+
+EXPORT_C TInt CLiwServiceHandler::MenuCmdId(TInt aMenuCmdId) const
+    {
+    return iImpl->MenuCmdId(aMenuCmdId);
+    }
+
+
+EXPORT_C void CLiwServiceHandler::ReportMenuLaunch()
+    {
+    CLiwTlsData* data = CLiwTlsData::Instance();
+    if(data)
+        {
+        data->ReportMenuLaunch();
+        }
+    }
+
+
+EXPORT_C void CLiwServiceHandler::QueryImplementationL(RCriteriaArray& aFilterItem, RCriteriaArray& aProviderList)
+	{
+		for(TInt itemIndex = 0; itemIndex < aFilterItem.Count(); ++itemIndex)
+		{
+			iImpl->QueryImplementationL(aFilterItem[itemIndex], aProviderList);
+		}
+			
+	}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwservicehandlerimpl.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,3033 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 API for consumer application to access Language
+*                Interworking Framework. 
+*
+*/
+
+
+
+
+
+
+#include <eikenv.h>
+#include <bautils.h>    // file helpers
+#include <liwservicehandler.rsg>
+#include "liwmenubinding.h"
+#include "liwservicehandler.h"
+#include "liwservicehandlerimpl.h"
+#include "liwmenu.h"
+#include "liwuids.hrh"
+#include "liwcommon.hrh"
+#include "liwmenuslot.hrh"
+#include "liwecommonitor.h"
+#include "liwtlsdata.h"
+#include "data_caging_path_literals.hrh"
+
+#include "LiwXmlHandler.h"
+#include "LiwServiceData.h"
+
+#include <RTSecMgrScriptSession.h>
+
+// CONSTANTS
+// Max number of empty menu resource slots.
+const TInt KMaxMenuResources = 16;
+
+// This value tells how many times consumer can call InitializeMenuPaneL() without 
+// closing the Options-menu.
+const TInt KMaxPaneIds = KMaxMenuResources;
+
+// The range reserved for individual menu pane.
+const TInt KIndividualMenuPaneIdRange = 10000;
+
+// The whole range that is reserved to all menu panes. Currently value is 170 000.
+const TInt KMenuPaneCommandRange = (KMaxMenuResources + 1) * KIndividualMenuPaneIdRange; 
+
+_LIT(KLiwResourceFile, "liwServiceHandler.rsc");
+_LIT(KLiwZDrive, "z:");
+_LIT8(KDataSeparator, "||");
+_LIT(KPerExtension,".per");
+
+const TInt KMaxMenuTitleSize = 100;
+
+// Command id space reserved for single placeholder.
+const TInt KPlaceholderCmdIdRange = 200;
+
+const TInt KMaxLength=255;
+
+const TReal KDefVersion = 1.0;
+const TReal KUnspVersion = 0.0;
+
+void Cleanup(TAny* aAny);
+void InterestCleanup(TAny* aAny);
+void IntArrayCleanup(TAny* aAny);
+void FilteredCleanup(TAny* aAny);
+void Int32ArrayCleanup(TAny* aAny);
+void InterfaceCleanup(TAny* aAny);
+
+_LIT8(KResolverInterface, "IResolver");
+_LIT8(KResolverDomain, "ServiceManager");
+_LIT8(serviceCmdSeparator, "::");
+
+const TInt KDummySrvCmd=1;
+_LIT(KCapabilityCommDD,"CDD");
+_LIT(KCapabilityPowerMgmt,"PMT");
+_LIT(KCapabilityMultimediaDD,"MDD");
+_LIT(KCapabilityReadDeviceData,"RDD");
+_LIT(KCapabilityWriteDeviceData,"WDD");
+_LIT(KCapabilityDRM,"DRM");
+_LIT(KCapabilityTrustedUI,"TUI");
+_LIT(KCapabilityProtServ,"PSV");
+_LIT(KCapabilityDiskAdmin,"DAD");
+_LIT(KCapabilityNetworkControl,"NWC");
+_LIT(KCapabilityAllFiles,"ALF");
+_LIT(KCapabilitySwEvent,"SWE");
+_LIT(KCapabilityNetworkServices,"NWS");
+_LIT(KCapabilityLocalServices,"LOS");
+_LIT(KCapabilityReadUserData,"RUD");
+_LIT(KCapabilityWriteUserData,"WUD");
+_LIT(KCapabilityLocation,"LOC");
+_LIT(KCapabilitySurroundingsDD,"SDD");
+_LIT(KCapabilityUserEnvironment,"USE");
+
+using namespace LIW;
+//
+// LiwServiceHandler
+//
+
+CLiwServiceHandlerImpl* CLiwServiceHandlerImpl::NewL()
+    {
+    CLiwServiceHandlerImpl* handler = new (ELeave) CLiwServiceHandlerImpl();
+    CleanupStack::PushL( handler );
+    handler->ConstructL();
+    CleanupStack::Pop(handler); // handler
+    return handler;
+    }
+
+
+
+CLiwServiceHandlerImpl::CLiwServiceHandlerImpl()
+    {
+    // Nothing to do here.
+    }
+
+
+
+void CLiwServiceHandlerImpl::ConstructL()
+    {
+    TFileName resFile;
+    TCallBack callBack(SynchronizeCallBack, this);
+    iEcomMonitor = CLiwEcomMonitor::NewL(callBack);
+	
+    
+    iCoeEnv = CCoeEnv::Static();
+    RFs rFs;
+    TInt err = rFs.Connect();
+    
+    TFileName dllName;
+    Dll::FileName(dllName);
+
+    TBuf<2> drive = dllName.Left(2);
+    resFile.Copy(drive);
+    resFile.Append(KDC_RESOURCE_FILES_DIR);
+    resFile.Append(KLiwResourceFile);	
+    TBool fileExists( BaflUtils::FileExists(rFs, resFile) );
+    if ( ! fileExists )
+    {
+	resFile.Copy(KLiwZDrive);
+	resFile.Append(KDC_RESOURCE_FILES_DIR);
+	resFile.Append(KLiwResourceFile);
+    }
+    rFs.Close();
+    // A Service Handler instance can be created also when CCoeEnv is not 
+    // available (e.g. from server applications). In this case, the methods 
+    // needing CCoeEnv/CEikonEnv will leave with KErrNotSupported.
+    if(iCoeEnv)
+        {
+        // This is commented to avoid resource file getting locked affecting the IAD update. 
+	// Also, there is no use of resource file since LIW does not support menu related services
+        // iResourceOffset = iCoeEnv->AddResourceFileL(resFile);
+        }
+    // CLiwTlsData has a reference count so each OpenL call
+    // must have a matching Close call (done in destructor).
+    // OpenL is called only here, the TLS data object can be
+    // referenced by calling CLiwTlsData::Instance().
+    CLiwTlsData* data = CLiwTlsData::OpenL();
+    iTlsDataOpened = ETrue;
+
+    // CEikMenuPane informs all menu launch observers
+    // when an options menu is launched.
+    data->AddMenuLaunchObserverL( this );
+    }
+
+
+
+CLiwServiceHandlerImpl::~CLiwServiceHandlerImpl()
+    {
+    if (iResourceOffset && iCoeEnv)
+        {
+	// This is commented to avoid resource file getting locked affecting the IAD update. 
+	// Also, there is no use of resource file since LIW does not support menu related services
+        // iCoeEnv->DeleteResourceFile(iResourceOffset);
+        }
+    Reset();
+
+    delete iEcomMonitor;
+
+    if ( iTlsDataOpened )
+        {
+        CLiwTlsData* data = CLiwTlsData::Instance();
+        data->RemoveMenuLaunchObserver( this );
+        CLiwTlsData::Close();
+        }
+    }
+
+
+
+void CLiwServiceHandlerImpl::Reset()
+    {
+    iInterestList.ResetAndDestroy();
+    iMenuBindings.ResetAndDestroy();
+    iBaseBindings.ResetAndDestroy();
+    iProviders.ResetAndDestroy();
+
+    iLastInitialized.Reset();
+
+    iMenuPanes.ResetAndDestroy();
+
+    delete iInParams;
+    iInParams = NULL;
+    delete iOutParams;
+    iOutParams = NULL;
+    }
+
+void CLiwServiceHandlerImpl::AttachServiceManagerPluginsL()
+{
+  CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(KDummySrvCmd, KResolverInterface, KResolverDomain);
+  crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+  
+  RCriteriaArray a;
+  a.AppendL(crit);
+  
+  AttachL(a);
+  
+  CleanupStack::Pop(crit); // crit
+  a.ResetAndDestroy();
+}  
+
+void CLiwServiceHandlerImpl::ServiceManagerPlugin_ListImplementationsL(RArray<TInt32>& aArray,
+                                                                       CLiwCriteriaItem* aItem)
+{
+  CLiwGenericParamList* inps = &(InParamListL());
+  CLiwGenericParamList* outps = &(OutParamListL());
+  
+  CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(KDummySrvCmd, KResolverInterface, KResolverDomain);
+  crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+  ExecuteServiceCmdL(*crit, *inps, *outps);  
+  CleanupStack::PopAndDestroy(crit); // crit
+
+  TInt pos = 0;
+  MLiwInterface* ifp;
+  const TLiwGenericParam* p = outps->FindFirst(pos, KResolverInterface, EVariantTypeInterface);
+  if (p) {
+    ifp = p->Value().AsInterface();
+    CleanupStack::PushL(TCleanupItem(InterfaceCleanup, ifp));
+  }
+  else
+    return;
+  
+  outps->Reset();
+  inps->Reset();
+  
+  _LIT8(KId,"id");
+  _LIT8(KCmd,"cmd");
+  _LIT8(KCmdStr,"cmd_str");
+  _LIT8(KType,"type");
+  _LIT8(KListImpl,"ListImplementations");
+  
+  inps->AppendL(TLiwGenericParam(KId, TLiwVariant(aItem->Id())));
+  inps->AppendL(TLiwGenericParam(KCmd, TLiwVariant(aItem->ServiceCmd())));
+  inps->AppendL(TLiwGenericParam(KCmdStr, TLiwVariant(aItem->ServiceCmdStr())));
+  inps->AppendL(TLiwGenericParam(KType, TLiwVariant(aItem->ContentType())));
+  ifp->ExecuteCmdL(KListImpl, *inps, *outps);
+  
+  pos = 0;
+  p = outps->FindFirst(pos, EGenericParamError);
+  if (p && (p->Value().AsTInt32() == KErrNone)) {
+    pos = 0;
+    const CLiwList* list;
+    _LIT8(KIdList,"id_list");
+    p = outps->FindFirst(pos, KIdList, EVariantTypeList);
+    if (p) {
+      list = p->Value().AsList();
+      for (TInt i = 0; i < list->Count(); i++) {
+        TLiwVariant v;
+        v.PushL();
+        list->AtL(i, v);
+        aArray.AppendL(v.AsTInt32());
+        CleanupStack::Pop(&v);
+        v.Reset();
+      }
+    }
+  }
+
+  CleanupStack::Pop(ifp); // ifp
+  ifp->Close();
+}
+
+CLiwServiceIfBase* CLiwServiceHandlerImpl::ServiceManagerPlugin_CreateImplementationL(TInt32 aImplUid)
+{
+  CLiwGenericParamList* inps = &(InParamListL());
+  CLiwGenericParamList* outps = &(OutParamListL());
+  
+  CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(KDummySrvCmd, KResolverInterface, KResolverDomain);
+  crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+  ExecuteServiceCmdL(*crit, *inps, *outps);  
+  CleanupStack::PopAndDestroy(crit); // crit
+
+  TInt pos = 0;
+  MLiwInterface* ifp = NULL;
+  const TLiwGenericParam* p = outps->FindFirst(pos, KResolverInterface, EVariantTypeInterface);
+  if (p) {
+    ifp = p->Value().AsInterface();
+    CleanupStack::PushL(TCleanupItem(InterfaceCleanup, ifp));
+  }
+  else
+    User::Leave(KErrNotFound);
+  
+  outps->Reset();
+  inps->Reset();
+  _LIT8(KUid,"uid");
+  _LIT8(KCreateImpl,"CreateImplementation");
+  
+  inps->AppendL(TLiwGenericParam(KUid, TLiwVariant(aImplUid)));
+  ifp->ExecuteCmdL(KCreateImpl, *inps, *outps);
+  
+  pos = 0;
+  p = outps->FindFirst(pos, EGenericParamError);
+  User::LeaveIfError(p->Value().AsTInt32());
+
+  pos = 0;
+  CLiwServiceIfBase* iface = NULL;
+  _LIT8(KImplPtr, "impl_ptr");
+  p = outps->FindFirst(pos, KImplPtr, EVariantTypeDesC8);
+  if (p) {
+    TPtrC8 buf = p->Value().AsData();
+    if (buf.Size() == sizeof(iface))
+      Mem::Copy(&iface, buf.Ptr(), buf.Size());
+    else
+      User::Leave(KErrNotFound);
+  }
+  else
+    User::Leave(KErrNotFound);
+
+  CleanupStack::Pop(ifp); // ifp
+  ifp->Close();
+
+  return iface;
+}
+
+void CLiwServiceHandlerImpl::ListProvidersForCriteriaL(RArray<TInt>& aResult, 
+    CLiwCriteriaItem& aItem)
+    {
+    TInt i;
+
+    for (i = 0; i < iProviders.Count(); i++)
+        {   
+        if (iProviders[i]->HasCriteria(aItem))
+            {
+            User::LeaveIfError(aResult.Append(iProviders[i]->ImplementationUid().iUid));
+            }
+        }
+    }
+
+
+
+TInt CLiwServiceHandlerImpl::NbrOfProviders(const CLiwCriteriaItem* aCriteria)
+    {
+    if(!aCriteria)
+        {
+        return 0;
+        }
+    
+    TInt i, j;
+
+    for (i = 0; i < iBaseBindings.Count(); i++)
+        {
+        for (j = 0; j < iBaseBindings[i]->Interest().Count(); j++)
+            {
+            if ((*iBaseBindings[i]->Interest()[j]) == (*aCriteria))
+                {
+                return iBaseBindings[i]->NumberOfProviders();
+                }
+            }
+        }
+
+    for (i = 0; i < iMenuBindings.Count(); i++)
+        {
+        for (j = 0; j < iMenuBindings[i]->Interest().Count(); j++)
+            {
+            if ((*iMenuBindings[i]->Interest()[j]) == (*aCriteria))
+                {
+                return iMenuBindings[i]->NumberOfProviders();
+                }
+            }       
+        }
+
+    return 0;
+    }
+
+
+
+void CLiwServiceHandlerImpl::AttachL(TInt aInterestResourceId)
+    {
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    RCriteriaArray interest, filtered;
+
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &interest ) );
+    CleanupStack::PushL( TCleanupItem( FilteredCleanup, &filtered ) );
+
+    TResourceReader reader;
+    iCoeEnv->CreateResourceReaderLC(reader, aInterestResourceId);
+    ReadInterestListL(reader, interest);
+    CleanupStack::PopAndDestroy(); //reader
+
+    FilterInterestListL(interest, filtered);
+    
+    DoAttachL(filtered,NULL);
+
+    filtered.Reset();
+
+    CleanupStack::Pop(&filtered); // filtered
+    CleanupStack::Pop(&interest); // interest
+    }
+
+
+
+TInt CLiwServiceHandlerImpl::AttachL(const RCriteriaArray& aInterest)
+    {
+    	return (this->AttachL(aInterest,NULL));
+    }
+
+TInt CLiwServiceHandlerImpl::AttachL(const RCriteriaArray& aInterest ,CRTSecMgrScriptSession* aSecMgrScriptSession)
+    {
+    RCriteriaArray interest, filtered;
+    
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &interest ) );
+    CleanupStack::PushL( TCleanupItem( FilteredCleanup, &filtered ) );
+        
+    for(TInt i = 0; i < aInterest.Count(); i++)
+        {
+        CLiwCriteriaItem* item = CLiwCriteriaItem::NewLC();
+        	
+        item->SetId(               aInterest[i]->Id()                    );
+        if (aInterest[i]->ServiceCmd() == KLiwCmdAsStr)
+          item->SetServiceCmdL(    aInterest[i]->ServiceCmdStr()         );
+        else
+          item->SetServiceCmd(     aInterest[i]->ServiceCmd()            );
+        item->SetContentTypeL(     aInterest[i]->ContentType()           );
+        item->SetServiceClass(     aInterest[i]->ServiceClass()          );
+        
+        item->SetOptions(          aInterest[i]->Options()               );
+		
+		//Setting the imetadataOptions of item
+		TLiwVariant metadataOption;
+		metadataOption.PushL();
+		
+        aInterest[i]->GetMetaDataOptions(metadataOption);
+		item->SetMetaDataOptions(metadataOption);
+		metadataOption.Reset();
+				
+        item->SetDefaultProvider( (aInterest[i]->DefaultProvider()).iUid );
+        item->SetMaxProviders(     aInterest[i]->MaxProviders()          ); 
+        
+        User::LeaveIfError(interest.Append(item));
+        CleanupStack::Pop(&metadataOption); 
+        CleanupStack::Pop(item); 
+        }
+        
+    FilterInterestListL(interest, filtered);        
+
+	TInt result = DoAttachL(filtered,aSecMgrScriptSession);
+
+    filtered.Reset();
+		
+    CleanupStack::Pop(&filtered); // filtered
+    CleanupStack::Pop(&interest); // interest
+    
+    return result;
+    }
+
+TInt CLiwServiceHandlerImpl::DoAttachL(const RCriteriaArray& aInterest,CRTSecMgrScriptSession* aSecMgrScriptSession)
+    {
+    CLiwBinding* bind;
+    TInt success = -1;
+    for (TInt i = 0; i < aInterest.Count(); i++)
+        {
+        bind = CLiwBinding::NewLC();
+        
+        success = ResolveProvidersL(bind, aInterest[i],aSecMgrScriptSession);
+        
+        if (success == KLiwServiceLoadSuccess)
+            {
+            User::LeaveIfError(iBaseBindings.Append( bind ));
+            CleanupStack::Pop(bind); // bind
+            bind->AddCriteriaL(aInterest[i]);
+
+            // Initialise providers.
+            for (TInt k = 0; k < bind->NumberOfProviders(); k++)
+                {
+                // Trap the initialisation. If not done, a leaving provider
+                // could prevent the initialisation of other providers.
+                TRAPD(err, bind->BaseProvider(k)->InitialiseL(*this, bind->Interest()));
+                
+                
+                
+                if(err)
+                    {
+#ifdef _DEBUG                    
+                    RDebug::Print(_L("LIW PROVIDER ERROR: CLiwServiceIfBase::InitialiseL() failed, leave code:%d"), err);
+#endif                    
+                    }
+                }
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy(bind); // bind
+            }
+        }
+    	return success; // returns status of 'n'th criteria in interest
+    }
+
+
+void CLiwServiceHandlerImpl::GetInterest(RCriteriaArray& aInterest)
+    {
+    for (TInt i = 0; i < iInterestList.Count(); i++)
+        {
+        if (aInterest.Append(iInterestList[i]) != KErrNone)
+            {
+            return;
+            }
+        }
+    }
+    
+    
+
+void CLiwServiceHandlerImpl::DetachL(const RCriteriaArray& aInterest)
+    {
+    // First, remove relevant criteria items from relevat base bindings.
+    for (TInt i = 0; i < aInterest.Count(); i++)
+        {
+        for (TInt j = 0; j < iBaseBindings.Count(); j++)
+            {
+            TInt index = iBaseBindings[j]->HasCriteriaItem(*aInterest[i]);
+            if (index != KErrNotFound)
+                {
+                iBaseBindings[j]->RemoveCriteria(index);
+                }                           
+            }
+        }
+
+    // Second pass removes empty bindings.
+    for (TInt i = 0; i < iBaseBindings.Count(); i++)
+        {
+        if (iBaseBindings[i]->Interest().Count() == 0)
+            {
+            delete iBaseBindings[i];
+            iBaseBindings.Remove(i);
+            i--;
+            }
+        }
+
+    // Then check if there were left obselete criteria items and remove them.   
+    RemoveObsoleteCriteriaItems();
+    
+    // Finally check if there were left obselete providers and remove them.
+    RemoveObsoleteProviders();        
+    }
+
+
+
+void CLiwServiceHandlerImpl::DetachL(TInt aInterestResourceId)
+    { 
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    RCriteriaArray interest;
+
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &interest ) );
+
+    TResourceReader reader;
+    iCoeEnv->CreateResourceReaderLC(reader, aInterestResourceId);
+    ReadInterestListL(reader, interest);
+    CleanupStack::PopAndDestroy(); //reader
+
+    DetachL( interest );
+
+    interest.ResetAndDestroy();
+    CleanupStack::Pop(&interest); // interest
+    }
+
+
+const CLiwCriteriaItem* CLiwServiceHandlerImpl::GetCriteria(TInt aId)
+    {
+    for (TInt i = 0; i < iInterestList.Count(); i++)
+        {
+        if (iInterestList[i]->Id() == aId)
+            {
+            return iInterestList[i];
+            }
+        }
+
+    return NULL;  
+    }
+    
+TInt CLiwServiceHandlerImpl::NumAlreadyInitializedPaneIdsL() const
+    {
+    TInt ret = 0;
+    TInt paneIds[KMaxPaneIds] = {0};
+    TBool found = EFalse;
+    
+    for (TInt i = 0; i < iLastInitialized.Count(); i++)
+        {
+        found = EFalse;
+        
+        for (TInt j = 0; j < ret; j++)
+            {
+            if (iLastInitialized[i]->MenuResourceId() == paneIds[j])
+                {
+                found = ETrue;
+                break;              
+                }
+            }
+                
+        if (!found) 
+            {
+            // Create new item.
+            if (ret >= KMaxPaneIds)
+                {
+#ifdef _DEBUG
+                RDebug::Print(_L("ERROR: OVERFLOW in CLiwServiceHandlerImpl::NumAlreadyInitializedPaneIdsL()"));
+#endif
+                User::Leave(KErrOverflow);
+                }
+            paneIds[ret] = iLastInitialized[i]->MenuResourceId();
+            ret++;
+            }                       
+        }
+    return ret;         
+    }    
+
+void CLiwServiceHandlerImpl::InitializeMenuPaneL(
+    CEikMenuPane& aMenuPane,
+    TInt aMenuResourceId, 
+    TInt aBaseMenuCmdId,
+    const CLiwGenericParamList& aInParamList)
+    {
+    InitializeMenuPaneL(aMenuPane, aMenuResourceId, aBaseMenuCmdId, aInParamList, EFalse);    
+    }        
+        
+void CLiwServiceHandlerImpl::InitializeMenuPaneL(
+    CEikMenuPane& aMenuPane,
+    TInt aMenuResourceId, 
+    TInt aBaseMenuCmdId,
+    const CLiwGenericParamList& aInParamList,
+    TBool aUseSubmenuTextsIfAvailable)
+    {        
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    if (!iMenuBindings.Count())
+        {
+        // Either no menu is attached to interest or menu was attached but
+        // it didn't contain any placeholders for criteria items. So
+        // nothing to do, get out.
+        return;
+        }
+
+    TInt index;
+    TInt slotcmd;
+    TBuf <KMaxMenuTitleSize> subTitle;
+    TBool titleLocked;
+    TInt paneOffset = NumAlreadyInitializedPaneIdsL() * KIndividualMenuPaneIdRange;
+
+    iSubmenuCmd = aBaseMenuCmdId + KMenuPaneCommandRange;
+    slotcmd = SlotItemCmd(aMenuPane);
+    if (slotcmd >= 0)
+        {
+        // aMenuPane is liw submenu. At this point it is empty and we must
+        // copy provider menu items to it.
+        CLiwMenuPane* liwPane = MenuPaneForSlotCmd(slotcmd);
+        if (liwPane)
+            {
+            CopyMenuItemsL(liwPane, aMenuPane, 0, ETrue);
+            aMenuPane.DeleteMenuItem(slotcmd);
+            iSubmenu = liwPane;
+            }
+        }
+    else
+        {
+        iSubmenu = NULL;
+        
+        const TInt bindcount = iMenuBindings.Count();
+        for (TInt i = 0; i < bindcount; i++)
+            {
+            if  ((iMenuBindings[i]->MenuId() == aMenuResourceId) &&
+                (aMenuPane.MenuItemExists(iMenuBindings[i]->MenuCmd(), index)))
+                {
+                CLiwMenuPane* liwPane = iMenuBindings[i]->MenuPane();
+                TInt menuResourceId = -1;
+                if(liwPane)
+                    {
+                    // An LIW menu pane already exists (this means that a normal
+                    // non-LIW submenu with LIW items has been opened more than once). 
+                    // In this case we use the existing resource slot id.
+                    menuResourceId = liwPane->ResourceSlotId();
+                    paneOffset = liwPane->PaneOffset();
+                    DeleteLiwMenuPane(liwPane);
+                    liwPane = NULL;
+                    }
+                liwPane = CreateEmptyLiwMenuPaneL(aBaseMenuCmdId, menuResourceId);
+                CleanupStack::PushL(liwPane);
+                liwPane->SetPaneOffset(paneOffset);
+                paneOffset += KPlaceholderCmdIdRange;
+                iMenuBindings[i]->SetMenuPane(liwPane);     
+
+                // Clean previous service commands from list.
+                CLiwGenericParamList& list = const_cast<CLiwGenericParamList&>(aInParamList);
+                while (list.Remove(EGenericParamServiceCommand)) 
+                    {
+                    // Intentionally left empty.    
+                    }
+
+                // Add service commands for current placeholder.
+                const TInt icount = iMenuBindings[i]->Interest().Count();
+                for (TInt k = 0; k < icount; k++)
+                    {
+                    list.AppendL(TLiwGenericParam(EGenericParamServiceCommand,
+                        TLiwVariant(iMenuBindings[i]->Interest()[k]->ServiceCmd())));
+                    }
+
+                // Loop from last entry to first entry always inserting to same index.
+                // Default provider is the first item in list, so if there is a default
+                // provider defined, it will be the first one to appear in menus.               
+                for (TInt j = iMenuBindings[i]->NumberOfProviders() - 1; j >= 0; j--)
+                    {
+                    liwPane->SetInitializingOwner(iMenuBindings[i]->MenuProvider(j));
+                    iMenuBindings[i]->MenuProvider(j)->InitializeMenuPaneHookL(liwPane,
+                        0, 0, aInParamList);
+                    }
+
+                GetSubmenuTitle(liwPane->MenuPane(), subTitle);
+            
+                TLiwPlaceholderType phtype = PlaceholderType(aMenuPane, 
+                    iMenuBindings[i]->MenuCmd(), titleLocked);
+
+                if ((phtype == ELiwPlaceholderCascade) ||
+                    (phtype == ELiwPlaceholderIntelligentCascade))
+                    {
+                    if (liwPane->MenuPane().NumberOfItemsInPane() == 1)
+                        {
+                        // Remove placeholder item.
+                        aMenuPane.DeleteMenuItem(iMenuBindings[i]->MenuCmd());
+                        CleanupStack::PopAndDestroy(liwPane); // liwPane
+                        continue;
+                        }
+                    else if ((liwPane->MenuPane().NumberOfItemsInPane() == 2) &&
+                        (phtype == ELiwPlaceholderIntelligentCascade))
+                        {
+                        UnCascadeL(aMenuPane, iMenuBindings[i]->MenuCmd(), *liwPane);
+                        User::LeaveIfError(iLastInitialized.Append(liwPane));
+                        }
+                    else
+                        {
+                        if (titleLocked)
+                            {
+                            subTitle.Zero();
+                            }
+                        ConvertPlaceholderL(aMenuPane, iMenuBindings[i]->MenuCmd(), *liwPane, 
+                            subTitle);
+                        }       
+                    }
+                else
+                    {
+                    // Remove placeholder item.
+                    aMenuPane.DeleteMenuItem(iMenuBindings[i]->MenuCmd());
+        
+                    // Copy menu items to actual menu pane
+                    CopyMenuItemsL(liwPane, aMenuPane, index, aUseSubmenuTextsIfAvailable);
+                    User::LeaveIfError(iLastInitialized.Append(liwPane));
+                    }
+                liwPane->SetMenuResourceId(aMenuResourceId);
+                User::LeaveIfError(iMenuPanes.Append(liwPane));
+                CleanupStack::Pop(liwPane); // liwPane
+                }
+            }
+        }
+    }
+
+
+
+
+TInt CLiwServiceHandlerImpl::ServiceCmdByMenuCmd(TInt aMenuCmdId) const
+    {
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        if ((IsInLastInitialized(iMenuBindings[i]->MenuPane())) &&
+            (iMenuBindings[i]->MenuPane()->IsCmdInRange(KPlaceholderCmdIdRange, aMenuCmdId)))
+            {
+            return iMenuBindings[i]->MenuPane()->ServiceCmdId(aMenuCmdId); 
+            }
+        }
+
+    return 0;   
+    }
+
+
+
+void CLiwServiceHandlerImpl::ExecuteMenuCmdL(
+    TInt aMenuCmdId,
+    const CLiwGenericParamList& aInParamList,
+    CLiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    MLiwNotifyCallback* aCallback)
+    {
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    if (!iMenuBindings.Count())
+        {
+        return;
+        }   
+
+    // Handle real menu providers.
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        CLiwMenuPane* menuPane = iMenuBindings[i]->MenuPane();
+
+        if (IsInLastInitialized(menuPane))
+            {
+            for (TInt j = 0; j < iMenuBindings[i]->NumberOfProviders(); j++)
+                {
+                if ((menuPane->IsCmdInRange(KPlaceholderCmdIdRange, aMenuCmdId)) && 
+                    (menuPane->CommandOwner(aMenuCmdId) == iMenuBindings[i]->MenuProvider(j)))
+                    {
+                    iMenuBindings[i]->MenuProvider(j)->HandleMenuCmdHookL(
+                        menuPane, 
+                        aMenuCmdId, 
+                        aInParamList, 
+                        aOutParamList, 
+                        aCmdOptions, 
+                        aCallback); 
+                    return;
+                    }
+                }
+            }
+        }
+    }
+
+
+
+void CLiwServiceHandlerImpl::AttachMenuL(TInt aMenuResourceId, TInt aInterestResourceId)
+    {
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    RCriteriaArray interest, filtered;
+    TResourceReader reader;
+
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &interest ) );
+    CleanupStack::PushL( TCleanupItem( FilteredCleanup, &filtered ) );
+    iCoeEnv->CreateResourceReaderLC(reader, aInterestResourceId);
+    ReadInterestListL(reader, interest);
+    CleanupStack::PopAndDestroy(); //reader
+    FilterInterestListL(interest, filtered);
+
+    iCoeEnv->CreateResourceReaderLC(reader, aMenuResourceId);
+    DoAttachMenuL(reader, aMenuResourceId, filtered);
+    filtered.Reset();
+    CleanupStack::PopAndDestroy(); //reader
+    CleanupStack::Pop(&filtered); // filtered
+    CleanupStack::Pop(&interest); // interest
+    }
+
+
+
+void CLiwServiceHandlerImpl::AttachMenuL(TInt aMenuResourceId, TResourceReader& aReader)
+    {
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    RCriteriaArray interest, filtered;
+    TResourceReader reader;
+
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &interest ) );
+    CleanupStack::PushL( TCleanupItem( FilteredCleanup, &filtered ) );
+    ReadInterestListL(aReader, interest);
+    FilterInterestListL(interest, filtered);
+
+    iCoeEnv->CreateResourceReaderLC(reader, aMenuResourceId);
+    DoAttachMenuL(reader, aMenuResourceId, filtered);
+    filtered.Reset();
+    CleanupStack::PopAndDestroy(); //reader
+    CleanupStack::Pop(&filtered); // filtered
+    CleanupStack::Pop(&interest); // interest
+    }
+
+void CLiwServiceHandlerImpl::AttachMenuL(TInt aMenuResourceId, const RCriteriaArray& aInterest)
+    {
+    // CCoeEnv/CEikonEnv needs to be accessible.
+    if(!iCoeEnv)
+        {
+        User::Leave(KErrNotSupported);
+        }    
+    
+    RCriteriaArray interest, filtered;
+    TResourceReader reader;
+    
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &interest ) );
+    CleanupStack::PushL( TCleanupItem( FilteredCleanup, &filtered ) );
+        
+    for(TInt i = 0; i < aInterest.Count(); i++)
+        {
+        CLiwCriteriaItem* item = CLiwCriteriaItem::NewLC();
+        
+        item->SetId(               aInterest[i]->Id()                    );
+        item->SetServiceCmd(       aInterest[i]->ServiceCmd()            );
+        item->SetContentTypeL(     aInterest[i]->ContentType()           );
+        item->SetServiceClass(     aInterest[i]->ServiceClass()          );
+        item->SetOptions(          aInterest[i]->Options()               );
+        item->SetDefaultProvider( (aInterest[i]->DefaultProvider()).iUid );
+        item->SetMaxProviders(     aInterest[i]->MaxProviders()          );       
+        
+        User::LeaveIfError(interest.Append(item));
+        CleanupStack::Pop(item); 
+        }
+        
+    FilterInterestListL(interest, filtered);        
+
+    iCoeEnv->CreateResourceReaderLC(reader, aMenuResourceId);
+    DoAttachMenuL(reader, aMenuResourceId, filtered);
+    filtered.Reset();
+    CleanupStack::PopAndDestroy(); //reader
+    CleanupStack::Pop(&filtered); // filtered
+    CleanupStack::Pop(&interest); // interest    
+    }   
+
+void CLiwServiceHandlerImpl::AttachMenuL(RArray<TInt>& aMenuEntries,
+                                         TInt aMenuResourceId,
+                                         RCriteriaArray& aInterest)
+    {
+    RCriteriaArray filtered;
+
+    CleanupStack::PushL( TCleanupItem( FilteredCleanup, &filtered ) );
+    FilterInterestListL(aInterest, filtered);
+    
+    TInt menuCmd;
+    TInt count = aMenuEntries.Count();
+    TBool bound;
+
+    for (TInt i = 0; i < count; i++)
+        {
+        menuCmd = aMenuEntries[i];
+        CLiwMenuBinding* bind = NULL;
+        bound = EFalse;
+
+        if (!menuCmd)
+          continue;
+
+        for (TInt j = 0; j < filtered.Count(); j++)
+            {           
+            if (filtered[j]->Id() == menuCmd)
+                {                       
+                if (!bind)
+                    {
+                    bind = AlreadyBound(aMenuResourceId, menuCmd, i);
+                    if (!bind)
+                        {
+                        bind = CLiwMenuBinding::NewLC(i, aMenuResourceId);
+                        bind->SetMenuCmd( menuCmd );
+                        }
+                    else
+                        {
+                        bound = ETrue;
+                        }
+                    }
+                
+                if (bind->HasCriteriaItem(*(filtered[j])) == KErrNotFound)
+                    {
+                    	ResolveProvidersL(bind, filtered[j],NULL);
+                    bind->AddCriteriaL(filtered[j]);
+                    }
+                }
+            }
+
+        // Initialise providers.
+        if (bind)
+            {
+            for (TInt k = 0; k < bind->NumberOfProviders(); k++)
+                {
+                bind->MenuProvider(k)->InitialiseL(*this, bind->Interest());
+                }
+            if (!bound)
+                {
+                User::LeaveIfError(iMenuBindings.Append( bind ));
+                CleanupStack::Pop(bind);  // bind                       
+                }
+            }
+        }
+
+    filtered.Reset();
+    CleanupStack::Pop(&filtered); // filtered
+    }
+
+void CLiwServiceHandlerImpl::DoAttachMenuL(TResourceReader& aReader, TInt aMenuId, 
+    RCriteriaArray& aInterest)
+    {
+    TInt menuCmd;
+    TInt count = aReader.ReadInt16();
+    TBool bound;
+
+    for (TInt i = 0; i < count; i++)
+        {
+        menuCmd = aReader.ReadInt32();
+        CLiwMenuBinding* bind = NULL;
+        bound = EFalse;
+
+        for (TInt j = 0; j < aInterest.Count(); j++)
+            {           
+            if (aInterest[j]->Id() == menuCmd)
+                {                       
+                if (!bind)
+                    {
+                    bind = AlreadyBound(aMenuId, menuCmd, i);
+                    if (!bind)
+                        {
+                        bind = CLiwMenuBinding::NewLC(i, aMenuId);
+                        bind->SetMenuCmd( menuCmd );
+                        }
+                    else
+                        {
+                        bound = ETrue;
+                        }
+                    }
+                
+                if (bind->HasCriteriaItem(*(aInterest[j])) == KErrNotFound)
+                    {
+                    	ResolveProvidersL(bind, aInterest[j],NULL);
+                    bind->AddCriteriaL(aInterest[j]);
+                    }
+                }
+            }
+
+        // Initialise providers.
+        if (bind)
+            {
+            for (TInt k = 0; k < bind->NumberOfProviders(); k++)
+                {
+                TRAPD(err, bind->MenuProvider(k)->InitialiseL(*this, bind->Interest()));
+                if(err)
+                    {
+#ifdef _DEBUG
+                    RDebug::Print(_L("LIW PROVIDER ERROR: CLiwServiceIfMenu::InitialiseL() failed, leave code:%d"), err);
+#endif                     
+                    // The provider failed to initialise.
+                    // Remove the failed provider from this menu binding.
+                    CLiwServiceIfMenu* provider = bind->MenuProvider(k);
+                    TInt implUid = provider->ImplementationUid().iUid;
+                    bind->RemoveProvider(implUid);
+                    
+                    // Remove the failed provider also from other menu bindings.
+                    for (TInt m = 0; m < iMenuBindings.Count(); m++)
+                        {
+                        iMenuBindings[m]->RemoveProvider(implUid);
+                        }
+
+                    // Then remove provider from the owner list and delete it.
+                    for (TInt m = 0; m < iProviders.Count(); m++)
+                        {
+                        if (iProviders[m]->ImplementationUid().iUid == implUid)
+                            {
+                            delete iProviders[m];
+                            iProviders.Remove(m);
+                            m--;
+                            }
+                        }                    
+                    }
+                }
+            if (!bound)
+                {
+                User::LeaveIfError(iMenuBindings.Append( bind ));
+                CleanupStack::Pop(bind);  // bind                       
+                }
+            }
+        SkipMenuFields(aReader);  // Jump to next menu item
+        }
+    }
+
+void CLiwServiceHandlerImpl::ReadInterestL(RCriteriaArray& aInterest, TInt aInterestResourceId)
+    {
+    CleanupStack::PushL( TCleanupItem( InterestCleanup, &aInterest ) );
+    TResourceReader reader;
+    iCoeEnv->CreateResourceReaderLC(reader, aInterestResourceId);
+    ReadInterestListL(reader, aInterest);
+    CleanupStack::PopAndDestroy(); //reader
+    CleanupStack::Pop(&aInterest);
+    }
+
+
+void CLiwServiceHandlerImpl::DetachMenu(TInt aMenuResourceId, TInt aInterestResourceId)
+    {
+    // If interest resource id is null, then detach all items in the given menu.
+    if (!aInterestResourceId)
+        {
+        DoDetachMenu(aMenuResourceId);        
+        }
+    else
+        {
+        // CCoeEnv/CEikonEnv needs to be accessible.
+        if(!iCoeEnv)
+            {
+            // We cannot leave because this is a non-leaving method.
+            return; 
+            }    
+
+        RCriteriaArray interest;
+        TRAPD(err, ReadInterestL(interest, aInterestResourceId));
+        if (err)
+            {
+            return;
+            }
+        
+        DoDetachMenu(aMenuResourceId, interest);
+        
+        interest.ResetAndDestroy();
+        }
+    }
+        
+
+void CLiwServiceHandlerImpl::DoDetachMenu(TInt aMenuResourceId)
+    {
+    // First, delete the relevant menu bindings.
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        if (iMenuBindings[i]->MenuId() == aMenuResourceId)
+            {
+            delete iMenuBindings[i];
+            iMenuBindings.Remove(i);
+            i--;
+            }
+        }
+
+    // Then check if there were left obselete criteria items and remove them.   
+    RemoveObsoleteCriteriaItems();
+    
+    // Finally check if there were left obselete providers and remove them.
+    RemoveObsoleteProviders();  
+    }
+
+    
+void CLiwServiceHandlerImpl::DoDetachMenu(TInt aMenuResourceId, RCriteriaArray& aInterest)
+    {
+    // First, remove relevant criteria items from relevant menu bindings.
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        if (iMenuBindings[i]->MenuId() == aMenuResourceId) 
+            {
+            for (TInt j = 0; j < aInterest.Count(); j++)
+                {
+                TInt index = iMenuBindings[i]->HasCriteriaItem(*aInterest[j]);
+                if (index != KErrNotFound)
+                    {
+                    iMenuBindings[i]->RemoveCriteria(index);
+                    }
+                }
+            }
+        }
+
+    // Second pass removes empty bindings.
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        if (iMenuBindings[i]->Interest().Count() == 0)
+            {
+            delete iMenuBindings[i];
+            iMenuBindings.Remove(i);
+            i--;
+            }
+        }
+    
+    // Then check if there were left obselete criteria items and remove them.   
+    RemoveObsoleteCriteriaItems();
+    
+    // Finally check if there were left obselete providers and remove them.
+    RemoveObsoleteProviders();        
+    }    
+    
+    
+void CLiwServiceHandlerImpl::RemoveObsoleteCriteriaItems()
+    {
+    for (TInt i = 0; i < iInterestList.Count(); i++)
+        {
+        CLiwCriteriaItem* criteria = iInterestList[i];
+        TBool found = EFalse;
+        
+        // Loop through base bindings.
+        for (TInt j = 0; j < iBaseBindings.Count(); j++)
+            {
+            if (iBaseBindings[j]->HasCriteriaItem(*criteria) != KErrNotFound)
+                {
+                found = ETrue;
+                break;
+                }
+            }
+
+        // If still not found, loop through menu bindings.        
+        if (!found)
+            {
+            for (TInt j = 0; j < iMenuBindings.Count(); j++)
+                {
+                if (iMenuBindings[j]->HasCriteriaItem(*criteria) != KErrNotFound)
+                    {
+                    found = ETrue;
+                    break;
+                    }
+                }            
+            }
+            
+        // Criteria item can be deleted if it was not found.            
+        if (!found)
+            {
+            delete iInterestList[i];
+            iInterestList.Remove(i);
+            i--;
+            }
+        }    
+    }
+    
+    
+void CLiwServiceHandlerImpl::RemoveObsoleteProviders()
+    {
+    for (TInt i = 0; i < iProviders.Count(); i++)
+        {
+        CLiwServiceIfBase* provider = iProviders[i];
+        TBool found = EFalse;
+        
+        // Loop through base bindings.
+        for (TInt j = 0; j < iBaseBindings.Count(); j++)
+            {
+            if (iBaseBindings[j]->HasProvider(provider))
+                {
+                found = ETrue;
+                break;
+                }
+            }
+
+        // If still not found, loop through menu bindings.        
+        if (!found)
+            {
+            for (TInt j = 0; j < iMenuBindings.Count(); j++)
+                {
+                if (iMenuBindings[j]->HasProvider(provider))
+                    {
+                    found = ETrue;
+                    break;
+                    }
+                }            
+            }
+            
+        // Criteria item can be deleted if it was not found.            
+        if (!found)
+            {
+            delete iProviders[i];
+            iProviders.Remove(i);
+            i--;
+            }
+        }    
+    }
+
+
+TBool CLiwServiceHandlerImpl::IsSubMenuEmpty(TInt aSubMenuId)
+    {
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        if (iMenuBindings[i]->MenuId() == aSubMenuId)
+            {
+            if (iMenuBindings[i]->NumberOfProviders() > 0)
+                {
+                return EFalse;
+                }
+
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+
+
+
+CLiwMenuBinding* CLiwServiceHandlerImpl::AlreadyBound(TInt aMenuId, TInt aMenuCmd, 
+    TInt aMenuItemIndex) const
+    {
+    for (TInt i = 0; i < iMenuBindings.Count(); i++)
+        {
+        if ((iMenuBindings[i]->MenuId() == aMenuId) &&
+            (iMenuBindings[i]->MenuCmd() == aMenuCmd) &&
+            (iMenuBindings[i]->MenuItemIndex() == aMenuItemIndex))
+            {
+            return iMenuBindings[i];
+            }
+        }
+
+    return NULL;
+    }
+
+
+void CLiwServiceHandlerImpl::ExecuteServiceCmdL(
+    const TInt& aCmdId,
+    const CLiwGenericParamList& aInParamList,
+    CLiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    MLiwNotifyCallback* aCallback)
+    {
+    for (TInt i = 0; i < iBaseBindings.Count(); i++)
+        {
+        if(iBaseBindings[i]->HasServiceCmd(aCmdId))
+            {
+        for (TInt j = 0; j < iBaseBindings[i]->NumberOfProviders(); j++)
+            {
+            iBaseBindings[i]->BaseProvider(j)->HandleServiceCmdL(aCmdId,
+                            aInParamList, aOutParamList, aCmdOptions, aCallback);
+            }
+        }
+	}
+}
+
+void CLiwServiceHandlerImpl::ExecuteServiceCmdL(    
+        const CLiwCriteriaItem& aCmd,
+        const CLiwGenericParamList& aInParamList,
+        CLiwGenericParamList& aOutParamList,
+        TUint aCmdOptions,
+        MLiwNotifyCallback* aCallback)
+    {
+      for (TInt i = 0; i < iBaseBindings.Count(); i++) {
+        for (TInt k = 0; k < iBaseBindings[i]->Interest().Count(); k++) {
+          if ((iBaseBindings[i]->Interest()[k]->ServiceCmd() == KLiwCmdAsStr) &&
+              (aCmd.ServiceCmd() == KLiwCmdAsStr) &&
+              (iBaseBindings[i]->Interest()[k]->ServiceCmdStr() == aCmd.ServiceCmdStr()) &&
+              (iBaseBindings[i]->Interest()[k]->ContentType() == aCmd.ContentType()))
+            {
+              //call only one provider
+              if (iBaseBindings[i]->NumberOfProviders() > 0) {
+                iBaseBindings[i]->BaseProvider(0)->HandleServiceCmdL(aCmd.ServiceCmdStr(),
+                  aInParamList, aOutParamList, aCmdOptions, aCallback);
+              }
+            }
+        }
+      }
+    }
+
+void CLiwServiceHandlerImpl::ReadInterestListL(TResourceReader& aReader, 
+    RPointerArray<CLiwCriteriaItem>& aResult)  
+    {
+    const TInt count = aReader.ReadInt16();
+    for (TInt ii = 0; ii < count; ++ii)
+        {
+        CLiwCriteriaItem* item = CLiwCriteriaItem::NewLC();
+        item->ReadFromResoureL( aReader );
+        User::LeaveIfError(aResult.Append(item));
+        CleanupStack::Pop(item); // item
+        }
+    }
+
+/* Parses the metadata information stored in the opaque_data field
+ * of service provider registration information \c REGISTRY_INFO.
+ *
+ * The metadata information is seprated from the service command definition 
+ * in the opaque_data field using a separator "::".
+ *
+ * @param aOpaque	the opaque_data values specified in the registration information
+ * @param aMetaData the parsed metadata entries will be stored in this variable
+ * 
+ */
+void CLiwServiceHandlerImpl::ParseMetaData(const TDesC8& aOpaque, TDes8& aMetaData)
+    {
+    
+       _LIT8(serviceCmdSeparator, "::");
+       const TInt metaDataStartPos=2;
+       
+       TInt separatorPos = aOpaque.Find(serviceCmdSeparator);
+        
+        if (separatorPos != KErrNotFound)
+        {
+        	// Find the first section, up to the separator
+        	separatorPos += metaDataStartPos;
+        	aMetaData.Copy(aOpaque.Mid(separatorPos,aOpaque.Length()-separatorPos));        
+        }
+    }
+
+/* 
+	QueryImplementationL finds the providers that match the given criteria item that is passed as the parameters
+*/
+void CLiwServiceHandlerImpl::QueryImplementationL(CLiwCriteriaItem* aItem, RCriteriaArray& aProviderList)
+	{
+    RImplInfoPtrArray infoArray;
+	_LIT8(KWild,"*");
+
+    if(0 == aItem->ContentType().Compare(KNullDesC8))
+    	aItem->SetContentTypeL(KWild);
+    
+	if(0 == aItem->ServiceCmdStr().Compare(KNullDesC8))
+		aItem->SetServiceCmdL(KWild);
+    
+    //to fetch the infoArray
+    QueryImplementationL(aItem,infoArray);
+    
+   	CLiwXmlHandler* pXmlHandler = CLiwXmlHandler::NewLC();
+		
+	CLiwServiceData* pServiceData = NULL;
+	
+	TInt versionCheck = 0;
+	
+	for (TInt index = 0; index < infoArray.Count(); ++index)
+    	{
+        if ((aItem->Options() & LIW_OPTIONS_ROM_ONLY) && (infoArray[index]->RomBased() == EFalse))
+           	{
+            continue;
+            }
+
+		CImplementationInformation* pImplInfo = infoArray[index];
+		const TInt separatorLength = KDataSeparator().Length();//find "||"		
+		TInt separatorPos = pImplInfo->OpaqueData().Find(KDataSeparator);
+		
+		TInt leftExtractPos = 0;
+		TBool separatorFound = EFalse;
+		
+		do
+		{
+			//Constructing the Criteria Item and appending to providerList
+			CLiwCriteriaItem* item = CLiwCriteriaItem::NewLC(); //iCriteriaId & iServiceCmd are ignored...
+			item->SetServiceClass(TUid::Uid(KLiwClassBase));
+			item->SetContentTypeL(infoArray[index]->DataType());
+			
+			TBuf8<KMaxLength> sName;    		
+			TBuf8<KMaxLength> opaq;
+			
+			if(separatorPos != KErrNotFound && (leftExtractPos < separatorPos))
+			{
+				separatorFound = ETrue;
+				sName = pImplInfo->OpaqueData().Mid(leftExtractPos, separatorPos-leftExtractPos); //ServiceName					
+				leftExtractPos = separatorLength + separatorPos;
+		 	 	TPtrC8 remainingData = pImplInfo->OpaqueData().Mid(separatorPos + separatorLength);	
+        	 	separatorPos = remainingData.Find(KDataSeparator) + separatorPos + separatorLength;	
+			}
+			else
+			{
+				separatorFound = EFalse;
+				TInt mDataSepPos = pImplInfo->OpaqueData().Find(serviceCmdSeparator);
+				if(mDataSepPos != KErrNotFound)
+					sName = pImplInfo->OpaqueData().Mid(leftExtractPos, mDataSepPos - leftExtractPos);
+				else
+					sName = pImplInfo->OpaqueData().Mid(leftExtractPos);
+			}
+
+		   	//check for wildcard character *
+		   	//if yes, return immediatly
+			if(0 == aItem->ServiceCmdStr().Compare(sName) || 0 == aItem->ServiceCmdStr().Compare(KWild))
+			{
+				//parse metadata and if metadata valid,
+				//setmetadataoptions to criteriaitem..
+				pServiceData = CLiwServiceData::NewLC();  
+				TInt loadStatus = CLiwXmlHandler::ESrvDataLoadFailed;
+				
+				ParseMetaData(pImplInfo->OpaqueData(),opaq);
+				
+				//Inline metadata defined
+				if(opaq.Length()>0)
+				{
+					loadStatus=pXmlHandler->LoadServiceData(opaq,pServiceData);
+				}
+				else
+				{
+					//Obtain the capabilities from the metadata
+		    		TUid implUid = pImplInfo->ImplementationUid();  
+		    		TUidName srvProvUid = implUid.Name();        
+		    		
+		    		TPtrC16 ptrSrv = srvProvUid.Right(srvProvUid.Length()-1);      
+		    		TPtrC16 srvFile = ptrSrv.Left(ptrSrv.Length()-1);		       
+		    		TDriveUnit driveUnit = pImplInfo->Drive();
+		    		TFileName fileName = driveUnit.Name();
+		    		fileName.Append(KDC_RESOURCE_FILES_DIR);
+		    		fileName.Append(srvFile);
+		    		fileName.Append(KPerExtension);
+		    		loadStatus=pXmlHandler->LoadServiceData(fileName,pServiceData);
+				}
+				
+				if(CLiwXmlHandler::ESrvDataLoadSuccess==loadStatus)
+				{	    		
+					versionCheck = 0;
+					
+	    			TReal implVersion(KDefVersion);
+	    			this->ComputeIntfVersion(pServiceData,implVersion); //fetch impl version..
+	    			
+	    			TReal minVer(KDefVersion);
+	    			TReal maxVer(KUnspVersion);
+	    			
+	    			if(this->GetVersionRange(aItem,minVer,maxVer)) //Get version queried by consumer
+	    			{
+	    				if(minVer == KUnspVersion)
+	    					minVer = KDefVersion;
+	    				
+	    				//perform comparison...
+    					if(maxVer!=KUnspVersion)
+    					{
+	    					if((implVersion>=minVer) && (implVersion<=maxVer))
+	    					{
+	    						versionCheck = 1;
+	    						//current impl is the best choice..this is THE CHOSEN ONE..
+	    					}
+    					}
+    					else
+    					{
+    						//means maxVer == KUnspVersion
+    						if(implVersion>=minVer)
+	    					{
+	    						versionCheck = 1;
+	    						
+	    						//current impl is the best choice..this is THE CHOSEN ONE..
+	    				 	}
+    					}
+					}
+				}
+				else //means no metadata information
+				{
+					versionCheck = 1;
+				}
+				 
+				if(versionCheck) 
+				{
+					//Since version matches, this item is appended to the providerList
+					//before which the metadata information is SET
+					CLiwMap* metadataMap = CLiwDefaultMap::NewLC();
+					
+					CLiwGenericParamList* pMetaData = pServiceData->GetMetaData();    					
+					
+					for(TInt mdataIdx(0); mdataIdx<pMetaData->Count(); ++mdataIdx)
+					{
+					    TLiwGenericParam param;	    			    
+						pMetaData->AtL(mdataIdx,param);						
+						metadataMap->InsertL(param.Name(),param.Value());						
+						param.Reset();
+					}
+										
+					TLiwVariant mdataVar(metadataMap);
+					mdataVar.PushL();
+					
+					item->SetMetaDataOptions(mdataVar);
+					
+					item->SetServiceCmdL(sName);
+					CleanupStack::Pop(&mdataVar);
+					mdataVar.Reset();
+					
+					CleanupStack::Pop(metadataMap);
+					metadataMap->DecRef();
+					                     
+					User::LeaveIfError(aProviderList.Append(item));
+				}
+				
+				if(pServiceData)
+				 		pServiceData->CleanUpMetaData();
+				
+				CleanupStack::PopAndDestroy(pServiceData); //pServiceData::CLiwServiceData*
+				CleanupStack::Pop(item); //item::CLiwCriteriaItem*
+			}
+			else
+			{
+				CleanupStack::PopAndDestroy(item); //item::CLiwCriteriaItem*
+			}
+		}while(separatorFound);
+	}// end of outer for loop
+
+    CleanupStack::PopAndDestroy(pXmlHandler); //pXmlHandler::CLiwXMLHandler*
+    infoArray.ResetAndDestroy();
+	}
+
+
+void CLiwServiceHandlerImpl::QueryImplementationL(CLiwCriteriaItem* aItem, RImplInfoPtrArray& infoArray)
+	{
+	iEcomMonitor->ListImplemetationsL(infoArray, (CLiwCriteriaItem*)aItem);
+	}
+
+
+void CLiwServiceHandlerImpl::FilterInfoArray(RImplInfoPtrArray& aArray,
+                                             RArray<TInt32>& aArrayPlugin,
+                                             CLiwCriteriaItem* aItem)
+    {
+    if (aItem->MaxProviders() <= 0)
+        {
+        aArray.ResetAndDestroy();
+        aArrayPlugin.Reset();
+        }
+    else
+        {
+        while ((aArray.Count() + aArrayPlugin.Count()) > aItem->MaxProviders())
+            {
+            if (aArrayPlugin.Count() == 0)
+              break;
+            // Skip default provider.
+            if (aArrayPlugin[0] == aItem->DefaultProvider())
+                {
+                if (aArrayPlugin.Count() == 1)
+                  break;
+                aArrayPlugin.Remove(1);
+                }
+            else
+                {
+                aArrayPlugin.Remove(0);               
+                }
+            }
+
+        while ((aArray.Count() + aArrayPlugin.Count()) > aItem->MaxProviders())
+            {
+            // Skip default provider.
+            if (aArray[0]->ImplementationUid() == aItem->DefaultProvider())
+                {
+                delete aArray[1];
+                aArray.Remove(1);               
+                }
+            else
+                {
+                delete aArray[0];
+                aArray.Remove(0);               
+                }
+            }
+        }
+    }
+
+
+
+TBool CLiwServiceHandlerImpl::IsCached(CLiwServiceIfBase* /*aProvider*/)
+    {
+    return EFalse;
+    }
+
+
+CLiwGenericParamList& CLiwServiceHandlerImpl::InParamListL()
+    {
+    if (!iInParams)
+        {
+        iInParams = CLiwGenericParamList::NewL();
+        }
+    iInParams->Reset();
+    return *iInParams;
+    }
+
+
+
+CLiwGenericParamList& CLiwServiceHandlerImpl::OutParamListL()
+    {
+    if (!iOutParams)
+        {
+        iOutParams = CLiwGenericParamList::NewL();
+        }
+    iOutParams->Reset();
+    return *iOutParams;
+    }
+
+
+
+TBool CLiwServiceHandlerImpl::IsInLastInitialized(CLiwMenuPane* liwPane) const
+    {
+    if (liwPane)
+        {
+        if (iSubmenu == liwPane)
+            {
+            return ETrue;       
+            }
+
+        for (TInt i = 0; i < iLastInitialized.Count(); i++)
+            {
+            if (iLastInitialized[i] == liwPane)
+                {
+                return ETrue;
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+
+TInt CLiwServiceHandlerImpl::HandleNotifyL(
+    TInt /*aCmdId*/,
+    TInt /*aEventId*/,
+    CLiwGenericParamList& /*aEventParamList*/,
+    const CLiwGenericParamList& /*aInParamList*/)
+    {
+    return KErrNone;    
+    }
+
+
+// CEikMenuPane::ConstructFromresourceL is defined as 'protected' so
+// we have to use a wrapper class for accessing it.
+class CLiwMenuResource : public CEikMenuPane
+    {
+    public:
+        CLiwMenuResource() : CEikMenuPane(NULL) {}
+        CLiwMenuResource(MEikMenuObserver* aObserver) : CEikMenuPane(aObserver) {}
+
+        void CreateL(TResourceReader& aReader)
+            {
+            ConstructFromResourceL(aReader);
+            }
+    };
+
+
+CLiwMenuPane* CLiwServiceHandlerImpl::CreateEmptyLiwMenuPaneL(TInt aBaseMenuCmdId, 
+    TInt aResourceId)
+    {
+    CLiwMenuPane* result = NULL;
+    TResourceReader reader; 
+    
+    TInt id;
+    if(aResourceId >= 0)
+        {
+        // Use existing id.
+        id = aResourceId;
+        }
+    else
+        {
+        // Create new id.
+        id = ResourceIdForNextFreeSlot();
+        if (id < 0)
+            {
+            User::Leave(KErrOverflow);
+            }
+        }
+    iCoeEnv->CreateResourceReaderLC(reader, id);
+    
+    CLiwMenuResource* pane = new (ELeave) CLiwMenuResource(this);
+    CleanupStack::PushL(pane);
+    pane->ConstructL(NULL);
+    pane->CreateL(reader);
+
+    result = new (ELeave) CLiwMenuPane(*pane, aBaseMenuCmdId);
+    
+    CleanupStack::Pop(pane);
+    CleanupStack::PopAndDestroy(); //reader
+    
+    result->SetResourceSlotId( id );
+    
+    return result;
+    }
+
+
+void CLiwServiceHandlerImpl::DeleteLiwMenuPane(CLiwMenuPane* aLiwPane)
+    {
+    delete aLiwPane->iMenuPane;
+    aLiwPane->iMenuPane = NULL;
+
+    // Reset iIdMap and extraText.
+    for(TInt i = 0; i < aLiwPane->iIdMap.Count(); i++)
+        {
+        aLiwPane->iIdMap[i].extraText.Close();
+        }
+    aLiwPane->iIdMap.Reset();
+    
+    // Remove the liw menu pane from iMenuPanes array.
+    for(TInt i = 0; i < iMenuPanes.Count(); i++)
+        {
+        if(iMenuPanes[i] == aLiwPane)
+            {
+            iMenuPanes.Remove(i);
+            break;                            
+            }
+        }
+    
+    // Remove the liw menu pane from iMenuLastInitialized array.
+    for(TInt i = 0; i < iLastInitialized.Count(); i++)
+        {
+        if(iLastInitialized[i] == aLiwPane)
+            {
+            iLastInitialized.Remove(i);
+            break;                            
+            }
+        }                        
+    
+    delete aLiwPane;
+    aLiwPane = NULL;    
+    }
+
+const TInt resourceSlotIds[KMaxMenuResources] =
+    {
+    R_LIW_EMPTY_MENU_0,
+    R_LIW_EMPTY_MENU_1,
+    R_LIW_EMPTY_MENU_2,
+    R_LIW_EMPTY_MENU_3,
+    R_LIW_EMPTY_MENU_4,
+    R_LIW_EMPTY_MENU_5,
+    R_LIW_EMPTY_MENU_6,
+    R_LIW_EMPTY_MENU_7,
+    R_LIW_EMPTY_MENU_8,
+    R_LIW_EMPTY_MENU_9,
+    R_LIW_EMPTY_MENU_10,
+    R_LIW_EMPTY_MENU_11,
+    R_LIW_EMPTY_MENU_12,
+    R_LIW_EMPTY_MENU_13,
+    R_LIW_EMPTY_MENU_14,
+    R_LIW_EMPTY_MENU_15
+    };
+
+
+TInt CLiwServiceHandlerImpl::ResourceIdForNextFreeSlot()
+    {
+    if (iNextFreeSlot < KMaxMenuResources)
+        {
+        return resourceSlotIds[iNextFreeSlot++];
+        }
+
+    return -1;
+    }
+
+
+void CLiwServiceHandlerImpl::SetEmphasis(CCoeControl* /*aMenuControl*/,TBool /*aEmphasis*/)
+    {
+    }
+
+
+void CLiwServiceHandlerImpl::ProcessCommandL(TInt /*aCommandId*/) 
+    {
+    }
+
+
+// Rewrite this method. It doesn't make sense. Variable j is not used at all.    
+TInt CLiwServiceHandlerImpl::MenuCmdId(TInt aMenuCmdId) const
+    {
+    TInt ret( KErrNotFound );
+    
+    for (TInt i = 0; i < iMenuBindings.Count() && (ret == KErrNotFound); i++)
+        {
+        for (TInt j = 0; j < iMenuBindings[i]->NumberOfProviders() && (ret == KErrNotFound); j++)
+            {
+            if ((IsInLastInitialized(iMenuBindings[i]->MenuPane())) &&
+                (iMenuBindings[i]->MenuPane()->IsCmdInRange(KPlaceholderCmdIdRange, aMenuCmdId)) &&
+                (ret == KErrNotFound ))
+                {
+                ret = iMenuBindings[i]->MenuPane()->MenuCmdId(aMenuCmdId); 
+                }   
+            }
+        }
+
+    return ret;     
+    }
+
+
+void Cleanup( TAny* aAny )
+    {
+    RImplInfoPtrArray* implArray = 
+        reinterpret_cast< RImplInfoPtrArray*> ( aAny );
+    implArray->ResetAndDestroy();
+    implArray->Close();
+    }
+
+
+void InterestCleanup( TAny* aAny )
+    {
+    RPointerArray<CLiwCriteriaItem>* interestArray = 
+        reinterpret_cast<RPointerArray<CLiwCriteriaItem>*> ( aAny );
+
+    interestArray->ResetAndDestroy();   
+    }
+
+void FilteredCleanup( TAny* aAny )
+    {
+    RPointerArray<CLiwCriteriaItem>* filteredArray = 
+        reinterpret_cast<RPointerArray<CLiwCriteriaItem>*> ( aAny );
+
+    filteredArray->Reset();   
+    }
+
+
+void IntArrayCleanup(TAny* aAny)
+    {
+    RArray<TInt>* intArray = 
+        reinterpret_cast<RArray<TInt>*> ( aAny );
+
+    intArray->Close();
+    }
+
+void Int32ArrayCleanup(TAny* aAny)
+    {
+    RArray<TInt32>* intArray = 
+        reinterpret_cast<RArray<TInt32>*> ( aAny );
+
+    intArray->Close();
+    }
+
+void InterfaceCleanup( TAny* aAny )
+    {
+    MLiwInterface* interface = reinterpret_cast<MLiwInterface*>(aAny);
+    interface->Close();
+    }
+
+void CLiwServiceHandlerImpl::CopyMenuItemsL(CLiwMenuPane* aSource, CEikMenuPane& aDest, 
+    TInt aStartIndex, TBool aIsSubmenu)
+    {
+    TInt cmdId;
+    TInt inPos = aStartIndex;
+
+    for (TInt i = 0; i < aSource->MenuPane().NumberOfItemsInPane(); i++)
+        {
+        cmdId = aSource->FindCmdId(i);
+        if (cmdId >= 0)
+            {
+            CEikMenuPaneItem::SData itemData = aSource->MenuPane().ItemData(cmdId);
+            
+            // The menu item might include alternative texts for a main menu level 
+            // and for submenu. Use submenu string if it is intended so.       
+            if(aIsSubmenu)
+                {
+                const TDesC& extraText = aSource->ExtraText(cmdId);
+                if(extraText.Length())
+                    {
+                    itemData.iText.Zero();
+                    itemData.iText.Append(extraText);
+                    }                 
+                }
+            
+            aDest.InsertMenuItemL(itemData, inPos++);
+            }   
+        }   
+    }
+
+
+
+TInt CLiwServiceHandlerImpl::SlotItemCmd(CEikMenuPane& aPane)
+    {
+    TInt index;
+
+    for (TInt i = 0; i < KMaxMenuResources; i++)
+        {
+        if (aPane.MenuItemExists(ELiwMenuSlotBase + i, index))
+            {
+            return ELiwMenuSlotBase + i;
+            }
+        }
+
+    return -1;
+    }
+
+
+
+CLiwMenuPane* CLiwServiceHandlerImpl::MenuPaneForSlotCmd(TInt aCmdId)
+    {
+    TInt index = aCmdId - ELiwMenuSlotBase; 
+
+    if (index < KMaxMenuResources)
+        {
+        TInt resId = resourceSlotIds[index];
+        for (TInt i = 0; i < iMenuPanes.Count(); i++)
+            {
+            if (iMenuPanes[i]->ResourceSlotId() == resId)
+                {
+                return iMenuPanes[i];
+                }
+            }
+        }
+
+    return NULL;
+    }
+
+
+
+CLiwServiceHandlerImpl::TLiwPlaceholderType CLiwServiceHandlerImpl::PlaceholderType(
+    CEikMenuPane& aPane, TInt aCmd, TBool& aTitleLocked)
+    {
+    CEikMenuPaneItem::SData& itemData = aPane.ItemData(aCmd);
+
+    aTitleLocked = EFalse;
+
+    if ((itemData.iCascadeId & LIW_CASCADE_ID) == LIW_CASCADE_ID)
+        {
+        if (itemData.iCascadeId & LIW_LOCK_SUBMENU_TITLE)
+            {
+            aTitleLocked = ETrue;
+            }
+        return ELiwPlaceholderCascade;
+        }
+    else if ((itemData.iCascadeId & LIW_INTELLIGENT_CASCADE_ID) == LIW_INTELLIGENT_CASCADE_ID)
+        {
+        if (itemData.iCascadeId & LIW_LOCK_SUBMENU_TITLE)
+            {
+            aTitleLocked = ETrue;
+            }
+        return ELiwPlaceholderIntelligentCascade;
+        }
+
+    return ELiwPlaceholderNormal;
+    }
+
+
+
+void CLiwServiceHandlerImpl::ConvertPlaceholderL(CEikMenuPane& aPane, TInt aCmd, 
+    CLiwMenuPane& aLiwPane, const TDesC& aTitle)
+    {
+    CEikMenuPaneItem::SData itemData = aPane.ItemData(aCmd);
+    TInt index;
+
+    // Remenber index.
+    aPane.MenuItemExists(aCmd, index);
+
+    // Remove placeholder item.
+    aPane.DeleteMenuItem(aCmd);
+
+    // Replace liw cascade id with actual menu resource id.
+    itemData.iCascadeId = aLiwPane.iResourceSlotId;
+
+    if (aTitle.Length())
+        {
+        itemData.iText.Copy(aTitle);
+        }
+
+    // Set unused dynamic cmd id.   
+    itemData.iCommandId = iSubmenuCmd++;
+
+    // Insert cascade item.
+    aPane.InsertMenuItemL(itemData, index);
+    }
+
+
+
+void CLiwServiceHandlerImpl::UnCascadeL(CEikMenuPane& aPane, TInt aCmd, CLiwMenuPane& aLiwPane)
+    {
+    CEikMenuPaneItem::SData itemData = aLiwPane.MenuPane().ItemData(aLiwPane.FindCmdId(0));
+    TInt index;
+
+    // Remenber index.
+    aPane.MenuItemExists(aCmd, index);
+
+    // Remove placeholder item.
+    aPane.DeleteMenuItem(aCmd);
+
+    // Uncascade 
+    itemData.iCascadeId = 0;
+
+    // Insert cascade item.
+    aPane.InsertMenuItemL(itemData, index);     
+    }
+
+
+
+void CLiwServiceHandlerImpl::SkipMenuFields(TResourceReader& aReader)
+    {
+    aReader.ReadInt32(); // Skip cascade id
+    aReader.ReadInt32(); // Skip flags
+    aReader.ReadTPtrC(); // Skip text
+    aReader.ReadTPtrC(); // Skip extra text
+    aReader.ReadTPtrC(); // Skip bmpfile.
+    aReader.ReadInt16(); // Skip bmpid.
+    aReader.ReadInt16(); // Skip bmpmask. 
+    aReader.ReadInt32(); // Skip extension.   
+    }
+
+
+TBool CLiwServiceHandlerImpl::IsLiwMenu(TInt aMenuResourceId)
+    {
+    TInt index;
+
+    // First check if this is liw submenu id
+    for (index = 0; index < KMaxMenuResources; index++)
+        {
+        if (aMenuResourceId == resourceSlotIds[index])
+            {
+            return ETrue;
+            }
+        }
+
+    // Then check if this menu is among attached menus.
+    for (index = 0; index < iMenuBindings.Count(); index++)
+        {
+        if (iMenuBindings[index]->MenuId() == aMenuResourceId)
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+
+
+TBool CLiwServiceHandlerImpl::HandleSubmenuL(CEikMenuPane& aPane)
+    {
+    TInt slotcmd = SlotItemCmd(aPane);
+    if (slotcmd >= 0)
+        {
+        // aPane is liw submenu. At this point it is empty and we must
+        // copy provider menu items to it.
+        CLiwMenuPane* liwPane = MenuPaneForSlotCmd(slotcmd);
+        if (liwPane)
+            {
+            CopyMenuItemsL(liwPane, aPane, 0, ETrue);
+            aPane.DeleteMenuItem(slotcmd);
+            iSubmenu = liwPane;     
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+
+
+TBool CLiwServiceHandlerImpl::GetSubmenuTitle(CEikMenuPane& aPane, TDes& aResult)
+    {
+    TInt index;
+    
+    aResult.Zero();
+    while (aPane.MenuItemExists(LIW_SUBMENU_TITLE, index))
+        {
+        CEikMenuPaneItem::SData& itemData = aPane.ItemData(LIW_SUBMENU_TITLE);
+        if (aResult.Length() == 0)
+            {
+            aResult.Copy(itemData.iText);
+            }
+        aPane.DeleteMenuItem(LIW_SUBMENU_TITLE);
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+
+
+CLiwCriteriaItem* CLiwServiceHandlerImpl::ConvertCriteriaItemPointerL(CLiwCriteriaItem* aCandidate)
+    {
+    for (TInt index = 0; index < iInterestList.Count(); index++)
+        {
+        if ((*iInterestList[index]) == (*aCandidate))
+            {
+            // Already in list, aCandidate is not needed.
+            delete aCandidate;
+            return iInterestList[index];
+            }
+        }
+
+    CleanupStack::PushL(aCandidate);
+    User::LeaveIfError(iInterestList.Append(aCandidate));
+    CleanupStack::Pop(aCandidate); // aCandidate
+
+    return aCandidate;
+    }
+
+
+
+void CLiwServiceHandlerImpl::FilterInterestListL(RPointerArray<CLiwCriteriaItem>& aOrginal,
+    RPointerArray<CLiwCriteriaItem>& aFiltered)
+    {
+    CLiwCriteriaItem* item;
+
+    while (aOrginal.Count() > 0)
+        {
+        item = aOrginal[0];
+        aOrginal.Remove(0);
+        item = ConvertCriteriaItemPointerL(item);
+        User::LeaveIfError(aFiltered.Append(item));
+        }
+    aOrginal.Reset();
+    }
+
+
+
+void CLiwServiceHandlerImpl::RemoveProvider(TInt aImplUid)
+    {
+    TInt index;
+
+    // First go through bindings and remove all the 
+    // references to given provider.
+    for (index = 0; index < iBaseBindings.Count(); index++)
+        {
+        iBaseBindings[index]->RemoveProvider(aImplUid);
+        }
+
+    for (index = 0; index < iMenuBindings.Count(); index++)
+        {
+        iMenuBindings[index]->RemoveProvider(aImplUid);
+        }
+    
+    // Then remove provider from the owner list and delete it.
+    for (index = 0; index < iProviders.Count(); index++)
+        {
+        if (iProviders[index]->ImplementationUid().iUid == aImplUid)
+            {
+            delete iProviders[index];
+            iProviders.Remove(index);
+            index--;
+            }
+        }
+    }
+
+
+void CLiwServiceHandlerImpl::AddProviderL(TUid aImplUid, CLiwCriteriaItem* aItem)
+    {
+    TInt index;
+    CLiwServiceIfBase* iface = iEcomMonitor->CreateImplementationL(aImplUid);
+    
+    if (iface)
+        {
+        CleanupStack::PushL(iface);
+        iface->AddCriteria(aItem);
+        User::LeaveIfError(iProviders.Append( iface ));
+        CleanupStack::Pop(iface);
+
+        for (index = 0; index < iBaseBindings.Count(); index++)
+            {
+            if (iBaseBindings[index]->HasCriteriaItem(*aItem) != KErrNotFound)
+                {
+                iBaseBindings[index]->AddProviderL(iface, aImplUid == aItem->DefaultProvider());
+                iface->InitialiseL(*this, iBaseBindings[index]->Interest());
+                }               
+            }
+
+        for (index = 0; index < iMenuBindings.Count(); index++)
+            {
+            if (iMenuBindings[index]->HasCriteriaItem(*aItem) != KErrNotFound)
+                {
+                iMenuBindings[index]->AddProviderL(iface, aImplUid == aItem->DefaultProvider());
+                iface->InitialiseL(*this, iMenuBindings[index]->Interest());
+                }               
+            }
+        }
+    }
+
+
+
+TInt CLiwServiceHandlerImpl::SynchronizeCallBack(TAny* aImpl)
+    {
+    CLiwServiceHandlerImpl* impl = reinterpret_cast<CLiwServiceHandlerImpl*>(aImpl);
+    TRAPD(err, impl->SynchronizeDbL());
+    return err;
+    }
+
+
+
+void CLiwServiceHandlerImpl::SynchronizeDbL()
+    {
+    TInt index;
+    RArray<TInt> providers;
+    RImplInfoPtrArray infoArray;
+
+    CleanupStack::PushL( TCleanupItem( IntArrayCleanup, &providers ) );
+    CleanupStack::PushL( TCleanupItem( Cleanup, &infoArray ) );
+
+    for (index = 0; index < iInterestList.Count(); index++)
+        {
+        if (iInterestList[index]->RomOnly())  // Rom-only criterias can be skipped.
+            {
+            continue;
+            }
+
+        providers.Reset();
+        infoArray.ResetAndDestroy();
+        ListProvidersForCriteriaL(providers, *(iInterestList[index]));
+        iEcomMonitor->ListImplemetationsL(infoArray, iInterestList[index]);
+        HandleRemovedProviders(providers, infoArray);          
+        HandleNewProvidersL(providers, infoArray, iInterestList[index]);        
+        }
+
+    CleanupStack::PopAndDestroy(&infoArray); // providers, infoArray
+    CleanupStack::PopAndDestroy(&providers);
+    }
+
+
+void CLiwServiceHandlerImpl::HandleRemovedProviders(RArray<TInt>& aInMemory, 
+    RImplInfoPtrArray& aInSystem)
+    {
+    TInt index, index2;
+
+    for (index = 0; index < aInMemory.Count(); index++)
+        {
+        for (index2 = 0; index2 < aInSystem.Count(); index2++)
+            {
+            if (aInSystem[index2]->ImplementationUid().iUid == aInMemory[index])
+                {
+                break;
+                }
+            }
+        if (index2 >= aInSystem.Count())  // Was removed from system.
+            {
+            RemoveProvider(aInMemory[index]);
+            }
+        }
+    }
+
+
+void CLiwServiceHandlerImpl::HandleNewProvidersL(RArray<TInt>& aInMemory, 
+    RImplInfoPtrArray& aInSystem, CLiwCriteriaItem* aItem)
+    {
+    TInt index;
+
+    for (index = 0; index < aInSystem.Count(); index++)
+        {
+        if (aInMemory.Find(aInSystem[index]->ImplementationUid().iUid) == KErrNotFound)
+            {
+            AddProviderL(aInSystem[index]->ImplementationUid(), aItem);
+            }       
+        }
+    }
+    
+void CLiwServiceHandlerImpl::MenuLaunched()
+    {  
+    ClearMenuPaneArray();
+    iNextFreeSlot = 0;
+    iLastInitialized.Reset();
+
+    // Reset the iMenuPane pointers from iMenuBindings.
+    for(TInt index = 0; index < iMenuBindings.Count(); index++)
+        {
+        iMenuBindings[index]->SetMenuPane(NULL);
+        }
+    }
+
+/* Utility function to get the symbian TCapability enum value
+ * from the string defined in the providers xml file
+ *
+ * @param aCapName name of the capabiility to be converted to \c TCapability enum
+ *
+ */
+
+TCapability CLiwServiceHandlerImpl::GetServiceCapability(const TDesC& aCapName)
+{
+	TCapability cap(ECapability_None);
+
+	if(0==aCapName.Compare(KCapabilityCommDD))
+	{
+		cap=ECapabilityCommDD;
+	}
+	else if(0==aCapName.Compare(KCapabilityPowerMgmt))
+	{
+		cap=ECapabilityPowerMgmt;
+	}
+	else if(0==aCapName.Compare(KCapabilityMultimediaDD))
+	{
+		cap=ECapabilityMultimediaDD;
+	}
+	else if(0==aCapName.Compare(KCapabilityReadDeviceData))
+	{
+		cap=ECapabilityReadDeviceData;
+	}
+	else if(0==aCapName.Compare(KCapabilityWriteDeviceData))
+	{
+		cap=ECapabilityWriteDeviceData;
+	}
+	else if(0==aCapName.Compare(KCapabilityDRM))
+	{
+		cap=ECapabilityDRM;
+	}
+	else if(0==aCapName.Compare(KCapabilityTrustedUI))
+	{
+		cap=ECapabilityTrustedUI;
+	}
+	else if(0==aCapName.Compare(KCapabilityProtServ))
+	{
+		cap=ECapabilityProtServ;
+	}
+	else if(0==aCapName.Compare(KCapabilityDiskAdmin))
+	{
+		cap=ECapabilityDiskAdmin;
+	}
+	else if(0==aCapName.Compare(KCapabilityNetworkControl))
+	{
+		cap=ECapabilityNetworkControl;
+	}
+	else if(0==aCapName.Compare(KCapabilityAllFiles))
+	{
+		cap=ECapabilityAllFiles;
+	}
+	else if(0==aCapName.Compare(KCapabilitySwEvent))
+	{
+		cap=ECapabilitySwEvent;
+	}
+	else if(0==aCapName.Compare(KCapabilityNetworkServices))
+	{
+		cap=ECapabilityNetworkServices;
+	}
+	else if(0==aCapName.Compare(KCapabilityLocalServices))
+	{
+		cap=ECapabilityLocalServices;
+	}
+	else if(0==aCapName.Compare(KCapabilityReadUserData))
+	{
+		cap=ECapabilityReadUserData;
+	}
+	else if(0==aCapName.Compare(KCapabilityWriteUserData))
+	{
+		cap=ECapabilityWriteUserData;
+	}
+	else if(0==aCapName.Compare(KCapabilityLocation))
+	{
+		cap=ECapabilityLocation;
+	}
+	else if(0==aCapName.Compare(KCapabilitySurroundingsDD))
+	{
+		cap=ECapabilitySurroundingsDD;
+	}
+	else if(0==aCapName.Compare(KCapabilityUserEnvironment))
+	{
+		cap=ECapabilityUserEnvironment;
+	}
+
+	return cap;
+}
+
+
+/**
+* Returns the capability set defined in the service provider
+* metadata information. The capability set is a pre-requisite
+* for the service consumer to load the service provider module.
+*
+* The capability metadata information are defined as XML character
+* data inside the element <capability/>. The capability information
+* are type of metadata information. Hence, the capability element tags
+* should appear as child element of <metadata> element.
+*
+* @param aCapability Capability set that the consumer should posess while
+*		 loading the service provider
+*
+* @example
+*
+* @code
+* <!-- consumer should posess the following capability set -->
+* <metadata>
+*	<capability>CapabilityReadUserData</capability>
+*	<capability>CapabilityWriteUserData</capability>
+*	<capability>CapabilityDRM</capability>
+* </metadata>
+* @endcode
+*
+*/
+
+void CLiwServiceHandlerImpl::GetCapabilitiesL(RArray<TCapability>& secMgrCapList,CLiwGenericParamList* pMetaData)
+{	
+	_LIT8(KCapability,"cap");
+
+	TInt pos = 0;
+	const TLiwGenericParam* pCapData = pMetaData->FindFirst(pos,KCapability);
+
+	if(pCapData)
+	{
+		const CLiwList* pCapList = pCapData->Value().AsList();
+		if(pCapList)
+		{
+			for(TInt idx(0);idx!=pCapList->Count();++idx)
+			{
+				TLiwVariant capVar;
+				capVar.PushL();
+				pCapList->AtL(idx, capVar);
+				TPtrC capStr = capVar.AsDes();
+				
+				TCapability cap = this->GetServiceCapability(capStr);
+				if( (cap>=ECapabilityTCB)  && (cap < ECapability_Limit))
+					secMgrCapList.AppendL(cap);
+				CleanupStack::Pop(&capVar);
+				capVar.Reset();
+			}
+		}
+		
+	}
+}
+
+void CLiwServiceHandlerImpl::ComputeIntfVersion(CLiwServiceData* pProvMetaData,TReal& aIntfVersion)
+{
+	CLiwGenericParamList* pMetaDataList = pProvMetaData->GetMetaData();
+	
+	if(pMetaDataList)
+	{	
+		TInt verPos(KErrNone);
+		_LIT8(KVer,"ver");
+		const TLiwGenericParam* pVerParam = pMetaDataList->FindFirst(verPos,KVer);
+		if(pVerParam)
+		{
+			const CLiwList* pVersionList = pVerParam->Value().AsList(); 
+			if(pVersionList)
+			{
+				if(pVersionList->Count())
+				{
+					TLiwVariant verVar;
+					verVar.PushL();
+					pVersionList->AtL(0,verVar);//pick up the value in 0th index..
+					aIntfVersion = verVar.AsTReal();
+					CleanupStack::Pop(&verVar);
+					verVar.Reset();
+				}					
+			}			
+		}	
+	}	
+}
+
+
+TInt CLiwServiceHandlerImpl::ResolveProvidersL(CLiwBinding* aBinding, 
+					       CLiwCriteriaItem* aItem,
+					       CRTSecMgrScriptSession* aScriptSession)
+    {
+    TInt result = 0;
+    TInt status = KLiwUnknown;
+
+    // First resolve for providers already in memory.
+    TInt index;
+    for (index = 0; index < iProviders.Count(); index++)
+        {
+        if (iProviders[index]->Match(aItem))
+            {
+            aBinding->AddProviderL((CLiwServiceIfBase*)iProviders[index], 
+                iProviders[index]->ImplementationUid() == aItem->DefaultProvider());          
+            result++;
+            }     
+        }
+
+
+    // If cached providers were found, then it means that all the matching
+    // providers must be already in memory. No need to query from ECom framework.
+    if (!result)
+        {
+        RImplInfoPtrArray infoArray;
+        RArray<TInt32> infoArrayPlugin;
+
+        CleanupStack::PushL( TCleanupItem( Cleanup, &infoArray ) );
+        CleanupStack::PushL( TCleanupItem( Int32ArrayCleanup, &infoArrayPlugin ) );
+        
+        iEcomMonitor->ListImplemetationsL(infoArray, aItem);
+        
+        FilterInfoArray(infoArray, infoArrayPlugin, aItem);
+
+		CLiwServiceData* pServiceData = NULL;
+		
+		CLiwServiceData* pPrevSData = NULL;
+		
+		CImplementationInformation* pChosenImpl = NULL;
+		
+		TReal currentMax(KDefVersion); 
+
+        for (index = 0; index < infoArray.Count(); index++)
+            {
+            TBool stackPop = EFalse;
+            if ((aItem->Options() & LIW_OPTIONS_ROM_ONLY) && (infoArray[index]->RomBased() == EFalse))
+                {
+                continue;
+                }
+    
+    		//Check whether consumer has capability
+    		//mandated by provider
+    		CImplementationInformation* pImplInfo = infoArray[index];
+    		
+    		TBuf8<KMaxLength> opaq;
+    		
+    		ParseMetaData(pImplInfo->OpaqueData(),opaq);
+    		
+    		CLiwXmlHandler* pXmlHandler = CLiwXmlHandler::NewLC();
+    		
+			pServiceData = CLiwServiceData::NewLC();
+    		
+    		TInt loadStatus= CLiwXmlHandler::ESrvDataLoadFailed;
+    		
+    		//Inline metadata defined
+    		if(opaq.Length()>0)
+    		{
+    			loadStatus=pXmlHandler->LoadServiceData(opaq,pServiceData);
+    		}
+    		else
+    		{
+    			//Obtain the capabilities from the metadata
+	    		TUid implUid = pImplInfo->ImplementationUid();
+	    		TUidName srvProvUid = implUid.Name();
+	    
+	    		
+	    		TPtrC16 ptrSrv = srvProvUid.Right(srvProvUid.Length()-1);
+	    		TPtrC16 srvFile = ptrSrv.Left(ptrSrv.Length()-1);		
+	    		TDriveUnit driveUnit = pImplInfo->Drive();
+	    		TFileName fileName = driveUnit.Name();
+	    		fileName.Append(KDC_RESOURCE_FILES_DIR);
+	    		fileName.Append(srvFile);
+	    		fileName.Append(KPerExtension);
+	    		loadStatus=pXmlHandler->LoadServiceData(fileName,pServiceData);
+    		}
+    		
+    		/*
+    		 *  - Get version range specified by the consumer
+    		 *  - Iterate over the list of intf impl
+    		 *
+    		 * //LOOP:
+    		 *  - For each implementation item,
+    		 *
+    		 *  	- Check if intf impl has version tag from its metadata
+    		 *		- Pick up interface impl's version tag
+    		 *		- If intf impl has NO specifed version tag
+    		 *			- set this intf impl version as DEFAULT VERSION (//pref 1.0)..
+    		 *
+    		 *   //CHOOSE LATEST VERSION:
+    		 *		- If consumer has specifed version range
+    		 *			- CALL COMPARE routine (//To check if this is the latest version so far)
+    		 *				- Mark this as the chosen implementation
+    		 *			- Else (//This is NOT the latest)
+    		 *				- Continue;
+    		 *
+    		 *		- Else (//If consumer did not specify version range)
+    		 *			- CALL COMPARE routine (//To check if this is the latest version so far)
+    		 *				- Mark this as the chosen implementation
+    		 *			- Else (//This is NOT the latest)
+    		 *				- Continue;
+    		 *  	
+    		 *  //COMPARE (currentMax,implVersion,minVer,maxVer): //default minVer=1.0
+    		 *		- if(implVersion>currentMax)
+    		 *			- if(implVersion>=minVer && implVersion<=maxVer)
+    		 *				- currentMax = implVersion;
+    		 *				- return; //mark pServiceData to point to the current impl's service data
+    		 *			- else
+    		 *				- return; //leave pServiceData as it is
+    		 *		- else
+    		 *			- return; //leave pServiceData as it is
+    		 *
+    		 */
+    		 
+    		if(CLiwXmlHandler::ESrvDataLoadSuccess==loadStatus) //metadata is parsed successfully
+    		{
+    			TReal implVersion(KDefVersion);
+    			this->ComputeIntfVersion(pServiceData,implVersion); //fetch impl version..
+    			
+    			TReal minVer(KDefVersion);
+    			TReal maxVer(KUnspVersion);
+    			
+    			TBool verChk = this->GetVersionRange(aItem,minVer,maxVer);
+    			
+    			if(verChk) //Get version queried by consumer
+    			{
+    				if(minVer == KUnspVersion)
+    					minVer = KDefVersion;
+    				
+    				//perform comparison...
+    				if(implVersion>=currentMax)
+    				{
+    					if(maxVer!=KUnspVersion)
+    					{
+	    					if((implVersion>=minVer) && (implVersion<=maxVer))
+	    					{
+	    						currentMax = implVersion;
+	    						pChosenImpl = infoArray[index];
+	    						//current impl is the best choice..this is THE CHOSEN ONE..
+	    						if(pPrevSData)
+	    						{
+	    							pPrevSData->CleanUpMetaData();
+	    							delete pPrevSData;
+	    							
+	    						}
+	    						
+	    						pPrevSData = pServiceData;
+	    						
+	    					}
+	    					else
+	    					{
+	    						//current impl is NOT THE RIGHT CHOICE.. since not within the range
+		    					if(pServiceData)
+		    					{
+		    						if(!stackPop)
+						    		{
+							    		stackPop = ETrue;
+										CleanupStack::Pop(pServiceData);	
+						    		}
+						    		pServiceData->CleanUpMetaData();
+		    						delete pServiceData;
+		    						pServiceData = NULL;
+		    					}
+		    					status = KLiwVersionOutOfRange;
+	    					}
+    					}
+    					else
+    					{
+    						//means maxVer == KUnspVersion
+    						if(implVersion>=minVer)
+	    					{
+	    						currentMax = implVersion;
+	    						pChosenImpl = infoArray[index];
+	    						
+	    						//current impl is the best choice..this is THE CHOSEN ONE..
+	    						if(pPrevSData)
+	    						{
+	    							pPrevSData->CleanUpMetaData();
+	    							delete pPrevSData;
+	    						}
+	    						
+	    						pPrevSData = pServiceData;
+	    				 	}
+	    					else
+	    					{
+	    						//current impl is NOT THE RIGHT CHOICE..
+		    					if(pServiceData)
+		    					{
+		    						if(!stackPop)
+						    		{
+							    		stackPop = ETrue;
+										CleanupStack::Pop(pServiceData);	
+						    		}
+		    						pServiceData->CleanUpMetaData();
+		    						delete pServiceData;
+		    						pServiceData = NULL;
+		    					}
+		    					
+		    					status = KLiwVersionOutOfRange;
+	    					 }
+    					}
+    				}
+    				else
+    				{
+    					//current impl is NOT THE RIGHT CHOICE..since implVer > maxVer
+    					if(pServiceData)
+    					{
+    						if(!stackPop)
+				    		{
+					    		stackPop = ETrue;
+								CleanupStack::Pop(pServiceData);	
+				    		}
+		    				pServiceData->CleanUpMetaData();
+    						delete pServiceData;
+    						pServiceData = NULL;
+    					}
+    					
+    					status = KLiwVersionOutOfRange;
+    				}    				
+    			}
+    			else
+    			{
+    				//GetVersionRange Fails.. 
+    				//abort service resolution process..
+    				if(pServiceData)
+					{
+						if(!stackPop)
+			    		{
+				    		stackPop = ETrue;
+							CleanupStack::Pop(pServiceData);	
+			    		}
+			    		pServiceData->CleanUpMetaData();
+						delete pServiceData;
+						pServiceData = NULL;
+					} 
+					
+    				status = KLiwInvalidVersionSpecification;
+    			}
+    			
+	    		//other cases like parse error, capability not
+	    		//specified in meta data are handled
+				
+    			if(currentMax == implVersion)
+		    	{
+			    	if(pPrevSData && (pPrevSData!=pServiceData)) //just in case...
+			    	{
+			    		pPrevSData->CleanUpMetaData();
+						delete pPrevSData;
+						pPrevSData = NULL;
+			    	}	
+		    	}
+		    	else
+		    	{
+		    		if(!stackPop)
+		    		{
+			    		stackPop = ETrue;
+						CleanupStack::Pop(pServiceData);	
+		    		}
+					pServiceData = pPrevSData;
+		    	}	
+    		}
+    		else
+    		{
+    			//Metadata specification not found.. Hence Load Fails
+    			if(CLiwXmlHandler::ESrvDataFileNotFnd==loadStatus)
+    			{	
+					pChosenImpl = infoArray[index];    				
+    			}
+    			else  //Some error like parse error, capability not specified are handled
+    			{
+    				if(pServiceData)
+					{
+						if(!stackPop)
+			    		{
+				    		stackPop = ETrue;
+							CleanupStack::Pop(pServiceData);	
+			    		}
+		    			pServiceData->CleanUpMetaData();
+						delete pServiceData;
+						pServiceData = NULL;
+					}	
+					
+					status = KLiwMetaDataInvalidFormat;
+    			}
+	    	}	    		
+    		
+    		for (TInt idx = 0; idx < infoArrayPlugin.Count(); idx++)
+            {
+            	// currently assumed that implementations managed by plugins cannot be in ROM
+            	if (aItem->Options() & LIW_OPTIONS_ROM_ONLY) 
+                {
+                continue;
+                }
+            }
+            
+            if(!stackPop)
+            {
+            	CleanupStack::Pop(pServiceData);	
+            }
+            
+            CleanupStack::Pop(pXmlHandler);
+            
+            if(pXmlHandler)
+			{
+				delete pXmlHandler;
+			}			
+
+	        
+        } //end of for loop
+        
+    	if(pChosenImpl)
+		{
+		 	RArray<TCapability> provCaps;
+	    	GetCapabilitiesL(provCaps,pServiceData->GetMetaData());
+	    		
+	    	TInt isAllowed(KErrNone);
+	    	
+	    	if(aScriptSession)
+	    		isAllowed = aScriptSession->IsAllowed(provCaps);
+	    		
+	    	if(KErrNone==isAllowed)
+		    {
+				CLiwServiceIfBase* iface = iEcomMonitor->CreateImplementationL(
+	            pChosenImpl->ImplementationUid());
+
+	            if (iface)
+		        {
+		            if(pServiceData)
+		            {
+		            	iface->iReserved=pServiceData;
+		            }
+		            	
+		            
+		            if (!IsCached(iface))
+		            {
+		                CleanupStack::PushL(iface);
+		                status = KLiwServiceLoadSuccess;
+		                iface->AddCriteria(aItem);
+		                User::LeaveIfError(iProviders.Append( iface ));
+		                CleanupStack::Pop(iface);
+		                
+		                aBinding->AddProviderL(iface, 
+		                    pChosenImpl->ImplementationUid() == aItem->DefaultProvider());
+		            }                           
+		            else    
+		            {
+		                delete iface;
+		                iface = NULL;                
+		             }
+		         }
+		         
+			  }
+			  else
+			  {
+			  	  status = KLiwSecurityAccessCheckFailed;
+				 
+					if(pServiceData)
+			      	{
+			      		pServiceData->CleanUpMetaData();
+			      		delete pServiceData;
+			       		pServiceData = NULL;	
+			      	}
+			     
+				//enhancement : Should assign this to the previous service data						      	
+			  }
+			  
+			  provCaps.Close();
+		  }
+		  else
+          {
+          	//No Chosen implementation.. 
+          	
+          	if(pServiceData)  //This should ideally fail always
+          	{
+          		pServiceData->CleanUpMetaData();
+          		delete pServiceData;
+           		pServiceData = NULL;	
+          	}
+          } 
+          
+          if(0 == infoArray.Count())
+          	status = KLiwUnknown; 
+         
+         CleanupStack::PopAndDestroy(2);//infoArray and infoArrayPlugin 
+        }
+        else
+        {
+        	status = KLiwServiceAlreadyLoaded;
+        }
+    
+    return status;
+    
+    }
+
+
+TBool CLiwServiceHandlerImpl::GetVersionRange(CLiwCriteriaItem* aItem,TReal& aMinVersion, TReal& aMaxVersion)
+{
+	TBool bFailed=EFalse;
+	TLiwVariant metaDataVar;
+	metaDataVar.PushL();
+	
+	aItem->GetMetaDataOptions(metaDataVar);
+	
+	const CLiwMap* metaDataMap = metaDataVar.AsMap();
+	
+	if(metaDataMap)
+	{
+	_LIT8(KRangeKey,"range");
+	TLiwVariant rangeVar;
+	rangeVar.PushL();
+	
+	if(metaDataMap->FindL(KRangeKey, rangeVar))
+	{
+		const CLiwList* pRangeList = rangeVar.AsList();
+		if(pRangeList)
+		{
+			TLiwVariant verCheck;
+			verCheck.PushL();
+			_LIT8(KVersion,"ver");
+			pRangeList->AtL(0,verCheck);
+			
+			if(EVariantTypeDesC8==verCheck.TypeId())
+			{
+				if(0==KVersion().CompareF(verCheck.AsData()))
+				{
+					TLiwVariant minVerVar, maxVerVar;
+					minVerVar.PushL();
+					maxVerVar.PushL();
+					
+					pRangeList->AtL(1,minVerVar);
+					aMinVersion = minVerVar.AsTReal();
+					
+					if(minVerVar.AsTReal() < KDefVersion)
+						bFailed = ETrue;
+					
+					pRangeList->AtL(2,maxVerVar);
+					aMaxVersion = maxVerVar.AsTReal();
+					
+					if(maxVerVar.AsTReal() < aMinVersion && maxVerVar.AsTReal() != KUnspVersion)
+						bFailed = ETrue;
+					
+					CleanupStack::Pop(&maxVerVar); 
+    				CleanupStack::Pop(&minVerVar); 
+    				minVerVar.Reset();
+					maxVerVar.Reset();
+				}
+			}
+			CleanupStack::Pop(&verCheck); 
+    		verCheck.Reset();
+		}	
+	}
+	CleanupStack::Pop(&rangeVar); 
+    rangeVar.Reset();
+	}
+	
+	CleanupStack::Pop(&metaDataVar); 
+    metaDataVar.Reset();
+
+    return !bFailed;
+}
+
+TBool CLiwServiceHandlerImpl::GetVersion(CLiwCriteriaItem* aItem,TReal& aVersion)
+{
+	TBool bFailed=EFalse;
+	TLiwVariant metaDataVar;
+	metaDataVar.PushL();
+	
+	aItem->GetMetaDataOptions(metaDataVar);
+	
+	const CLiwMap* metaDataMap = metaDataVar.AsMap();
+	
+	if(metaDataMap)
+	{
+	_LIT8(KExactKey,"exact");
+	TLiwVariant exactVar;
+	exactVar.PushL();
+	
+		if(metaDataMap->FindL(KExactKey, exactVar))
+		{
+			const CLiwList* pExactList = exactVar.AsList();
+			if(pExactList)
+			{
+				TLiwVariant verCheck;
+				verCheck.PushL();
+				_LIT8(KVersion,"ver");
+				pExactList->AtL(0,verCheck);
+				
+				if(EVariantTypeDesC8==verCheck.TypeId())
+				{
+					if(0==KVersion().CompareF(verCheck.AsData()))
+					{
+						TLiwVariant versionVar;
+						versionVar.PushL();
+						
+						pExactList->AtL(1,versionVar);
+						
+	    				if((versionVar.AsTReal()) < KDefVersion)
+	    				{
+	    					bFailed = ETrue;
+	    				}
+	    				
+	    				aVersion = versionVar.AsTReal();
+						CleanupStack::Pop(&versionVar); 
+	    				versionVar.Reset();
+					}
+				}
+				CleanupStack::Pop(&verCheck); 
+	    		verCheck.Reset();
+			}	
+		}
+	
+	CleanupStack::Pop(&exactVar); 
+    exactVar.Reset();
+	}
+	
+	CleanupStack::Pop(&metaDataVar); 
+    metaDataVar.Reset();
+	
+	return !bFailed;
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwserviceifbase.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <ecom/ecom.h>
+#include "liwserviceifbase.h"
+#include "liwcommon.h"
+#include "liwservicedata.h"
+
+EXPORT_C CLiwServiceIfBase::~CLiwServiceIfBase()
+    {
+    if (iDtorKeyId.iUid)
+        {
+        REComSession::DestroyedImplementation(iDtorKeyId);
+        }
+    iCriterias.Close();
+    
+    if(iReserved)
+    	delete (CLiwServiceData*)iReserved;
+    }
+
+
+void CLiwServiceIfBase::SetDtorKeyId(TUid aDtorKeyId)
+    {
+    iDtorKeyId = aDtorKeyId;
+    }
+
+
+TBool CLiwServiceIfBase::Match(CLiwCriteriaItem* aItem)
+    {
+    for (TInt index = 0; index < iCriterias.Count(); index++)
+        {   
+        if ((iCriterias[index]->ServiceClass() == aItem->ServiceClass()) &&
+            (iCriterias[index]->ServiceCmd() == aItem->ServiceCmd()) &&
+            (iCriterias[index]->ContentType() == aItem->ContentType()) &&
+            (iCriterias[index]->Options() == aItem->Options()) &&
+            (iCriterias[index]->DefaultProvider() == aItem->DefaultProvider()))
+            {
+            if (iCriterias[index]->ServiceCmd() == KLiwCmdAsStr)
+                {
+                return (iCriterias[index]->ServiceCmdStr() == aItem->ServiceCmdStr()) ? ETrue : EFalse;   
+                }
+              
+            else
+                {
+                 return ETrue;    
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+
+void CLiwServiceIfBase::AddCriteria(CLiwCriteriaItem* aItem)
+    {
+    iCriterias.Append(aItem);
+    }
+
+
+
+TUid CLiwServiceIfBase::ImplementationUid() const
+    {
+    return iImplUid;
+    }
+
+
+
+void CLiwServiceIfBase::SetImplementationUid(TUid aUid)
+    {
+    iImplUid = aUid;
+    }
+
+
+
+TBool CLiwServiceIfBase::HasCriteria(CLiwCriteriaItem& aItem) const
+    {
+    TInt index;
+
+    for (index = 0; index < iCriterias.Count(); index++)
+        {
+        if (aItem == *(iCriterias[index]))
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+
+EXPORT_C void* CLiwServiceIfBase::ExtensionInterface(TUid aInterface)
+    {
+    if(KLiwGetServiceDataIf==aInterface.iUid)
+    {
+    	return iReserved;
+    }
+    
+    return NULL;
+    }
+// Enf of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwserviceifmenu.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 service API for providers offering menu services 
+*                for consumers.
+*
+*/
+
+
+
+
+
+
+#include <ecom/ecom.h>
+#include "liwserviceifmenu.h"
+#include "liwmenu.h"
+
+
+void CLiwServiceIfMenu::InitializeMenuPaneHookL(
+    CLiwMenuPane* aMenuPane,
+    TInt aIndex,
+    TInt aCascadeId,
+    const CLiwGenericParamList& aInParamList)
+    {
+    iMenuPane = aMenuPane;  
+
+    // Trapping prevents a leaving provider from breaking the whole consumer menu.  
+    TRAPD(err, InitializeMenuPaneL(*aMenuPane, aIndex, aCascadeId, aInParamList));
+    if(err)
+        {
+#ifdef _DEBUG
+        RDebug::Print(_L("LIW PROVIDER ERROR: CLiwServiceIfMenu::InitializeMenuPaneL() failed, leave code:%d"), err);
+#endif        
+        }
+    }
+
+
+
+void CLiwServiceIfMenu::HandleMenuCmdHookL(
+    CLiwMenuPane* aMenuPane,
+    TInt aMenuCmdId,
+    const CLiwGenericParamList& aInParamList,
+    CLiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    const MLiwNotifyCallback* aCallback)
+    {
+    if (!iMenuPane)
+        {
+        return;
+        }
+
+    HandleMenuCmdL(aMenuPane->MenuCmdId(aMenuCmdId), aInParamList, aOutParamList,
+        aCmdOptions, aCallback);
+    }       
+
+
+EXPORT_C const CLiwMenuPane* CLiwServiceIfMenu::MenuPane() const
+    {
+    return iMenuPane;
+    }
+
+
+EXPORT_C CLiwServiceIfMenu::~CLiwServiceIfMenu()
+    {
+    }
+    
+    
+EXPORT_C void* CLiwServiceIfMenu::ExtensionInterface(TUid /*aInterface*/)
+    {
+    return NULL;
+    }    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwtlsdata.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       TLS data object.
+*
+*/
+
+
+
+
+
+
+// INCLUDE FILES
+#include "liwtlsdata.h"
+
+// CONSTANTS
+
+const TInt KMenuLaunchObserversGranularity = 2;
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+CLiwTlsData::CLiwTlsData() :
+    iMenuLaunchObservers( KMenuLaunchObserversGranularity )
+    {
+    }
+
+CLiwTlsData::~CLiwTlsData()
+    {
+    iMenuLaunchObservers.Reset();
+    Dll::FreeTls();
+    }
+    
+CLiwTlsData* CLiwTlsData::NewL()
+    {
+    CLiwTlsData* data = new( ELeave ) CLiwTlsData;
+    CleanupStack::PushL( data );
+    data->ConstructL();
+    CleanupStack::Pop(data); // data
+    return data;
+    }
+    
+void CLiwTlsData::ConstructL()
+    {
+    User::LeaveIfError( Dll::SetTls( this ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CLiwTlsData::OpenL
+// -----------------------------------------------------------------------------
+//
+CLiwTlsData* CLiwTlsData::OpenL()
+    {
+    CLiwTlsData* data = Instance();
+    if ( !data )
+        {
+        data = NewL();
+        }
+    
+    data->iRefCount++;
+    return data;
+    }
+
+// -----------------------------------------------------------------------------
+// CLiwTlsData::Close
+// -----------------------------------------------------------------------------
+//
+void CLiwTlsData::Close()
+    {
+    CLiwTlsData* data = Instance();
+    __ASSERT_DEBUG( data, User::Invariant() );
+    if ( data )
+        {
+        if ( --data->iRefCount == 0 )
+            {
+            delete data; // also frees TLS
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CLiwTlsData::AddMenuLaunchObserverL
+// -----------------------------------------------------------------------------
+//
+void CLiwTlsData::AddMenuLaunchObserverL( MLiwMenuLaunchObserver* aObserver )
+    {
+    User::LeaveIfError( iMenuLaunchObservers.Append( aObserver ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CLiwTlsData::RemoveMenuLaunchObserver
+// -----------------------------------------------------------------------------
+//   
+void CLiwTlsData::RemoveMenuLaunchObserver( MLiwMenuLaunchObserver* aObserver )
+    {
+    TInt index = iMenuLaunchObservers.Find( aObserver );
+    if ( index >= 0 )
+        {
+        iMenuLaunchObservers.Remove( index );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CLiwTlsData::ReportMenuLaunch
+// -----------------------------------------------------------------------------
+//
+void CLiwTlsData::ReportMenuLaunch()
+    {
+    TInt count = iMenuLaunchObservers.Count();
+    for ( TInt index = 0 ; index < count ; index++ )
+        {
+        iMenuLaunchObservers[index]->MenuLaunched();
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwvariant.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,1767 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation of class TLiwVariant.
+*
+*/
+
+
+
+
+
+
+
+// INCLUDES
+#ifdef _DEBUG
+#include <e32svr.h>
+#endif
+#include "liwvariant.h"
+#include "liwgenericparam.h" 
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+using namespace LIW;
+namespace {
+
+// CONSTANTS
+/// TLiwVariant streaming version
+const TInt KVersion = 10;  // Version 1.0
+
+
+const TInt KBufSizeMid = 128;
+const TInt KBufSizeSmall = 64;
+const TInt KBufSizeLarge = 8192;
+
+   
+// Debug helpers
+#ifdef _DEBUG
+
+enum TPanicCode
+    {
+    EPanicPostCond_Constructor = 1,
+    EPanicPostCond_Reset,
+    EPanicPostCond_Set_TInt32,
+    EPanicPostCond_Set_TUid,
+    EPanicPostCond_Set_TTime,
+    EPanicPostCond_Set_TDesC,
+    EPanicPostCond_CopyL,
+    EPanicInvariant_InvalidDesCState,
+    EPanicPostCond_Set_TDesC8,
+    EPanicPreCond_DataSizeMismatch,
+    EPanicPostCond_Set_TBool,
+    EPanicPostCond_Set_TUint,
+    EPanicPostCond_Set_TReal,
+    EPanicPostCond_Set_TInt64
+    };
+
+void Panic(TPanicCode aCode)
+    {
+    _LIT(KPanicText, "TLiwVariant");
+    User::Panic(KPanicText, aCode);
+    }
+
+#endif  // #ifdef _DEBUG
+
+}  // namespace
+ 
+_LIT8(KDummy, "Dummy"); // needed for BC-preserving hack to store info about ownership of container
+
+/*
+ * class CLiwContainer, class CLiwIterable, class CLiwList, class CLiwMap,
+ * class CLiwDefaultList, class CLiwDefaultMap
+ */
+
+EXPORT_C void CLiwContainer::PushL() 
+    {
+    CleanupClosePushL(*this);
+    }
+
+EXPORT_C void CLiwContainer::ExternalizeL(RWriteStream&) const
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+EXPORT_C TInt CLiwContainer::Size() const
+    {
+    return KErrNotSupported;
+    }
+
+EXPORT_C CLiwContainer::~CLiwContainer()
+    {
+   /*
+    * Since CLiwContainer is based on reference count mechanism, it does not go with CleanupStack::PushL()
+    *
+    * LIW takes care of managing the memory in heap for CLiwContainer using the reference count logic
+    * 
+    * The container should not be destroyed until the reference count is ZERO.
+    * If the reference count is not equal to ZERO, it means there are some more owners of that container
+    * 
+    * This panics if the reference count is not equal to ZERO, in DEBUG Mode only
+    *
+    * Hence it is recommended to use CleanupClosePushL for Container objects when using CleanupStack
+    */
+    
+    __ASSERT_DEBUG(iRefCount == 0, User::Panic(_L("E32USER-CBase: 33"), 1));
+    }
+
+EXPORT_C void CLiwContainer::Close()
+    {
+    DecRef();
+    }
+
+
+EXPORT_C TBool CLiwIterable::operator==(CLiwIterable& aOther)
+    {
+    if (this == &aOther)
+    return ETrue;
+
+    Reset();
+    aOther.Reset();
+
+    TBool rval = ETrue;
+    TLiwVariant variant1, variant2;
+
+    TRAPD(error, {
+    while (NextL(variant1)) 
+	    {
+	      if (!aOther.NextL(variant2) || (variant1 != variant2))
+	        rval = EFalse;
+	    }
+    });
+
+    if (rval && (error == KErrNone))
+        {
+        TRAP(error, (rval = !(aOther.NextL(variant2))));
+        }
+
+    variant1.Reset();
+    variant2.Reset();
+    
+    return (error == KErrNone) ? rval : EFalse;
+    }
+
+EXPORT_C TBool CLiwList::operator==(const CLiwList& aOther) const
+    {
+    TInt count = Count();
+    if (count != aOther.Count())
+    return EFalse;
+
+    TInt error = KErrNone;
+    TBool retval = ETrue;
+    TLiwVariant variant1, variant2;
+    for (TInt index = 0; index < count; index++) {
+    TRAP(error, {
+      AtL(index, variant1); aOther.AtL(index, variant2);
+    });
+    if ((error != KErrNone) || (!(variant1 == variant2)))
+        {
+        retval = EFalse;
+        break;
+        }
+    }
+    variant1.Reset();
+    variant2.Reset();
+    return retval;
+    }
+
+EXPORT_C TBool CLiwMap::operator==(const CLiwMap& aOther) const
+    {
+    TInt count = Count();
+    if (count != aOther.Count())
+    return EFalse;
+
+    TInt error = KErrNone;
+    TBool retval = ETrue;
+    TLiwVariant variant1, variant2;
+    TBuf8<KBufSizeMid> buf1, buf2;
+    for (TInt index = 0; index < count; index++)
+        {
+        TRAP(error, {
+          AtL(index, buf1); aOther.AtL(index, buf2);
+          retval = (FindL(buf1, variant1) && aOther.FindL(buf2, variant2));
+        });
+        if (error != KErrNone)
+          retval = EFalse;
+        if (!retval || (!(variant1 == variant2)))
+            {
+            retval = EFalse;
+            break;
+            }
+        }
+    variant1.Reset();
+    variant2.Reset();
+    return retval;
+    }
+
+EXPORT_C CLiwDefaultList* CLiwDefaultList::NewL()
+    {
+    CLiwGenericParamList* gl = CLiwGenericParamList::NewLC();
+    CLiwDefaultList* tempList = new (ELeave) CLiwDefaultList(gl);
+    CleanupStack::Pop(gl); // gl
+    return tempList;
+    }
+
+EXPORT_C CLiwDefaultList* CLiwDefaultList::NewLC()
+    {
+    CLiwGenericParamList* gl = CLiwGenericParamList::NewLC();
+    CLiwDefaultList* tempList = new (ELeave) CLiwDefaultList(gl);
+    CleanupStack::Pop(gl); // gl
+    CleanupClosePushL(*tempList);
+    return tempList;
+    }
+
+EXPORT_C CLiwDefaultList* CLiwDefaultList::NewLC(RReadStream& aStream)
+    {
+    CLiwDefaultList* tempList = CLiwDefaultList::NewL();
+    CleanupClosePushL(*tempList);
+    tempList->iList->InternalizeL(aStream);
+    return tempList;
+    }
+
+EXPORT_C void CLiwDefaultList::AppendL(const TLiwVariant& aValue)
+    {
+    iList->AppendL(TLiwGenericParam(EGenericParamUnspecified, aValue));
+    }
+
+EXPORT_C TBool CLiwDefaultList::AtL(TInt aIndex, TLiwVariant& aValue) const
+    {
+    if(0 <= aIndex && aIndex < iList->Count())
+        {
+        aValue.SetL((*iList)[aIndex].Value());
+        return ETrue;   
+        }
+    else
+        {
+        return EFalse;    
+        }
+    }
+
+EXPORT_C void CLiwDefaultList::Remove(TInt aIndex)
+    {
+    if(0 <= aIndex && aIndex < iList->Count())
+        {
+        iList->iParameters[aIndex].Destroy();
+        iList->iParameters.Remove(aIndex);   
+        }
+    }
+
+EXPORT_C TInt CLiwDefaultList::Count() const
+    {
+    return iList->Count();
+    }
+
+EXPORT_C void CLiwDefaultList::ExternalizeL(RWriteStream& aStream) const
+    {
+    iList->ExternalizeL(aStream);
+    }
+
+EXPORT_C TInt CLiwDefaultList::Size() const
+    {
+    return iList->Size();
+    }
+
+EXPORT_C CLiwDefaultList::~CLiwDefaultList()
+    {
+    delete iList;
+    }
+
+EXPORT_C CLiwDefaultMap* CLiwDefaultMap::NewL()
+    {
+    CLiwGenericParamList* gl = CLiwGenericParamList::NewLC();
+    CLiwDefaultMap* tempMap = new (ELeave) CLiwDefaultMap(gl);
+    CleanupStack::Pop(gl); // gl
+    return tempMap;
+    }
+
+EXPORT_C CLiwDefaultMap* CLiwDefaultMap::NewLC()
+    {
+    CLiwGenericParamList* gl = CLiwGenericParamList::NewLC();
+    CLiwDefaultMap* tempMap = new (ELeave) CLiwDefaultMap(gl);
+    CleanupStack::Pop(gl); // gl
+    CleanupClosePushL(*tempMap);
+    return tempMap;
+    }
+
+EXPORT_C CLiwDefaultMap* CLiwDefaultMap::NewLC(RReadStream& aStream)
+    {
+    CLiwDefaultMap* tempMap = CLiwDefaultMap::NewL();
+    CleanupClosePushL(*tempMap);
+    tempMap->iMap->InternalizeL(aStream);
+    return tempMap;
+    }
+
+EXPORT_C void CLiwDefaultMap::InsertL(const TDesC8& aKey, const TLiwVariant& aValue)
+    {
+    Remove(aKey);
+    TLiwGenericParam mp;
+    mp.SetNameAndValueL(aKey, aValue);
+    iMap->AppendL(mp);
+    mp.Reset();
+    }
+
+EXPORT_C TBool CLiwDefaultMap::FindL(const TDesC8& aKey, TLiwVariant& aValue) const
+    {
+    TInt pos = 0;
+    const TLiwGenericParam* tempParam = iMap->FindFirst(pos, aKey);
+    if (tempParam)
+        {
+        aValue.SetL(tempParam->Value());
+        return ETrue;
+        }
+    else
+        return EFalse;
+    }
+
+EXPORT_C TInt CLiwDefaultMap::Count() const
+    {
+    return iMap->Count();
+    }
+
+EXPORT_C TBool CLiwDefaultMap::AtL(TInt aIndex, TDes8& aKey) const
+    {
+    if(0 <= aIndex && aIndex < iMap->Count())
+        {
+        aKey = ((*iMap)[aIndex]).Name();
+        return ETrue;   
+        }
+    else
+        {
+        return EFalse;  
+        }
+    }
+
+EXPORT_C const TDesC8& CLiwDefaultMap::AtL(TInt aIndex) const
+    {
+    if(0 <= aIndex && aIndex < iMap->Count())
+        {
+        return ((*iMap)[aIndex]).Name();
+        }
+    else
+        {
+        User::LeaveIfError(KErrArgument);  
+        return KNullDesC8;
+        }
+    }
+
+EXPORT_C void CLiwDefaultMap::Remove(const TDesC8& aKey)
+    {
+    TInt pos = 0;
+    iMap->FindFirst(pos, aKey);
+    if (pos != KErrNotFound)
+        {
+        iMap->iParameters[pos].Destroy();
+        iMap->iParameters.Remove(pos);
+        }
+    }
+
+EXPORT_C void CLiwDefaultMap::ExternalizeL(RWriteStream& aStream) const
+    {
+    iMap->ExternalizeL(aStream);
+    }
+
+EXPORT_C TInt CLiwDefaultMap::Size() const
+    {
+    return iMap->Size();
+    }
+
+EXPORT_C CLiwDefaultMap::~CLiwDefaultMap()
+    {
+    delete iMap;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+#ifdef _DEBUG
+void TLiwVariant::__DbgTestInvariant() const
+    {
+    if (iTypeId==EVariantTypeDesC && iData.iBufC)
+        {
+        __ASSERT_ALWAYS(iData.iBufC->Ptr() == iPtrC.Ptr(), 
+            Panic(EPanicInvariant_InvalidDesCState));
+        
+        }
+    }
+#endif  // #ifdef _DEBUG
+
+
+EXPORT_C void TLiwVariant::PushL()
+    {
+    CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , this) );
+    }
+
+EXPORT_C void TLiwVariant::VariantCleanup( TAny* aObj )
+    {
+    static_cast<TLiwVariant*>(aObj)->Destroy();
+    }
+
+inline void TLiwVariant::SInt64::InternalizeL(RReadStream& aStream)
+    {
+    TInt32 low = aStream.ReadInt32L();
+    iHigh = aStream.ReadInt32L();
+    iLow = low;
+    }
+
+inline void TLiwVariant::SInt64::ExternalizeL(RWriteStream& aStream) const
+    {
+    aStream.WriteInt32L(iLow);
+    aStream.WriteInt32L(iHigh);
+    }
+
+inline void TLiwVariant::SInt64::Set(const TInt64& aTInt64)
+    {
+    iLow = I64LOW(aTInt64);
+    iHigh = I64HIGH(aTInt64);
+    }
+
+inline TLiwVariant::SInt64::operator TInt64() const
+    {
+    return MAKE_TINT64(iHigh,iLow);
+    }
+
+inline TBool TLiwVariant::SInt64::operator==(const SInt64& aRhs) const
+    {
+    return (iHigh==aRhs.iHigh && iLow==aRhs.iLow);
+    }
+
+
+EXPORT_C TLiwVariant::TLiwVariant(const TLiwVariant& aSrc) :
+    iTypeId(aSrc.iTypeId), iData(aSrc.iData), iPtrC(), iPtrC8()
+    {
+    if (iTypeId == EVariantTypeDesC)
+        {
+        iPtrC.Set(aSrc.iPtrC);
+        // Do not take ownership of data
+        iData.iBufC = NULL;
+        }
+    else if ( iTypeId == EVariantTypeDesC8 )
+        {
+        iPtrC8.Set( aSrc.iPtrC8 );
+        // Do not take ownership of data
+        iData.iBufC8 = NULL;
+        }
+    }
+
+EXPORT_C TLiwVariant& TLiwVariant::operator=(const TLiwVariant& aSrc)
+    {
+    // Check self-assignment first.
+    if (this == &aSrc)
+        {
+        return *this;
+        }
+    Reset(); 
+    iTypeId = aSrc.iTypeId;
+    iData = aSrc.iData;
+    if (iTypeId == EVariantTypeDesC)
+        {
+        iPtrC.Set(aSrc.iPtrC);
+        // Do not take ownership of data
+        iData.iBufC = NULL;
+        }
+    else if ( iTypeId == EVariantTypeDesC8 )
+        {
+        iPtrC8.Set( aSrc.iPtrC8 );
+        // Do not take ownership of data
+        iData.iBufC8 = NULL;
+        }
+    return *this;
+    }
+
+EXPORT_C TBool TLiwVariant::Get(TInt32& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTInt32)
+        {
+        aValue = iData.iInt32;
+        return ETrue;
+        }
+    else if (iTypeId == EVariantTypeTReal)
+	    {
+	    aValue = (TInt32)iData.iReal;
+	    return ETrue;
+	    }
+	else if (iTypeId == EVariantTypeDesC8)  //string to real conversion
+		{
+		TLex8 parseString(iPtrC8);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;
+		}
+	else if (iTypeId == EVariantTypeDesC)  //string to real conversion
+		{
+		TLex16 parseString(iPtrC);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;		
+		}
+	else if (iTypeId == EVariantTypeTUint) //TUint to int conversion
+	    {
+	    aValue = (TInt32)iData.iUint;
+	    return ETrue;
+	    }
+	else if (iTypeId == EVariantTypeTInt64) //TInt64 to TInt32 conversion
+	    {
+	    aValue = (TInt32)iData.iLong; //Warning : Results in loss of data sometimes
+	    return ETrue;
+	    }
+	return EFalse;
+    }
+    
+EXPORT_C TBool TLiwVariant::Get(TInt64& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTInt64)
+        {
+        aValue = iData.iLong;
+        return ETrue;
+        }
+    else if (iTypeId == EVariantTypeTInt32)
+        {
+        aValue = iData.iInt32;
+        return ETrue;
+        }
+    else if (iTypeId == EVariantTypeTReal)
+	    {
+	    aValue = (TInt32)iData.iReal;
+	    return ETrue;
+	    }
+	else if (iTypeId == EVariantTypeDesC8)  //string to real conversion
+		{
+		TLex8 parseString(iPtrC8);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;
+		}
+	else if (iTypeId == EVariantTypeDesC)  //string to real conversion
+		{
+		TLex16 parseString(iPtrC);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;		
+		}
+	else if (iTypeId == EVariantTypeTUint) //TUint to int conversion
+	    {
+	    aValue = (TInt32)iData.iUint;
+	    return ETrue;
+	    }
+    return EFalse;
+    }
+    
+EXPORT_C TBool TLiwVariant::Get(TReal& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTReal)
+        {
+        aValue = iData.iReal;
+        return ETrue;
+        }
+    else if(iTypeId == EVariantTypeTInt32)
+    	{
+    	aValue = iData.iInt32;
+    	return ETrue;
+    	}
+    else if (iTypeId == EVariantTypeDesC8)  //string to integer conversion
+		{
+		TLex8 parseString(iPtrC8);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;		
+		}
+	else if (iTypeId == EVariantTypeDesC)  //string to integer conversion
+		{
+		TLex16 parseString(iPtrC);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;		
+		}
+	else if (iTypeId == EVariantTypeTUint) //TUint to real conversion
+	    {
+	    aValue = iData.iUint;
+	    return ETrue;
+	    }
+    else if(iTypeId == EVariantTypeTInt64)
+    	{
+    	aValue = iData.iLong; //Warning : Results in loss of data
+    	return ETrue;
+    	}
+    return EFalse;
+    }
+EXPORT_C TBool TLiwVariant::Get(TBool& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTBool)
+        {
+        aValue = iData.iBool;
+        return ETrue;
+        }
+    return EFalse;
+    }
+    
+EXPORT_C TBool TLiwVariant::Get(TUint& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTUint)
+        {
+        aValue = iData.iUint;
+        return ETrue;
+        }        
+    else if (iTypeId == EVariantTypeTReal) //real to TUint conversion
+        {
+        aValue = static_cast<TUint>(iData.iReal);
+        return ETrue;
+        }
+    else if(iTypeId == EVariantTypeTInt32) // TInt32 to TUint conversion
+    	{
+        aValue = static_cast<TUint>(iData.iInt32);
+    	return ETrue;
+    	}
+    else if (iTypeId == EVariantTypeDesC8)  //desc8 to TUint conversion
+		{
+		TLex8 parseString(iPtrC8);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+			return ETrue;		
+		}
+	else if (iTypeId == EVariantTypeDesC)  //desc16 to TUint conversion
+		{
+		TLex16 parseString(iPtrC);
+		TInt err = parseString.Val(aValue);
+		if(err == KErrNone)
+        return ETrue;
+        }
+    else if(iTypeId == EVariantTypeTInt64) // TInt32 to TUint conversion
+    	{
+        aValue = static_cast<TUint>(iData.iLong); //Warning : Results in loss of data
+    	return ETrue;
+    	}
+    return EFalse;
+    }
+
+EXPORT_C TBool TLiwVariant::Get(TUid& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTUid)
+        {
+        aValue = TUid::Uid(iData.iInt32);
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+EXPORT_C TBool TLiwVariant::Get(TPtrC& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeDesC)
+        {
+        aValue.Set(iPtrC);
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+EXPORT_C TBool TLiwVariant::Get(TTime& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeTTime)
+        {
+        aValue = TTime(iData.iInt64);
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+EXPORT_C TBool TLiwVariant::Get(TPtrC8& aValue) const
+    {
+     __TEST_INVARIANT;  
+    if (iTypeId == EVariantTypeDesC8)
+        {
+        aValue.Set(iPtrC8);
+        return ETrue;
+        }   
+
+    return EFalse;
+    }
+
+EXPORT_C TBool TLiwVariant::Get(TDes& aValue) const
+    {
+     __TEST_INVARIANT;  
+    if (iTypeId == EVariantTypeDesC)
+        {
+        aValue.Copy(iPtrC);
+        return ETrue;
+        }   
+	else if (iTypeId == EVariantTypeDesC8)
+        {
+        aValue.Copy(iPtrC8);
+        return ETrue;
+        }   
+	else if (iTypeId == EVariantTypeTReal) //real to TDes conversion
+        {
+        const TRealFormat realFormat;
+        aValue.Num(iData.iReal,realFormat);
+        return ETrue;
+        }
+    else if(iTypeId == EVariantTypeTInt32) // TInt32 to TDes conversion
+    	{
+    	aValue.Num(iData.iInt32);
+    	return ETrue;
+    	}
+    else if(iTypeId == EVariantTypeTUint) // TInt32 to TDes conversion
+    	{
+    	aValue.Num(iData.iUint,EDecimal);
+    	return ETrue;
+    	}
+    else if(iTypeId == EVariantTypeTInt64) // TInt32 to TDes conversion
+    	{
+    	aValue.Num(iData.iLong);
+    	return ETrue;
+    	}
+    return EFalse;
+    }
+
+
+EXPORT_C TBool TLiwVariant::Get(TDes8& aValue) const
+    {
+     __TEST_INVARIANT;  
+    if (iTypeId == EVariantTypeDesC8)
+        {
+        aValue.Copy(iPtrC8);
+        return ETrue;
+        }   
+	else if (iTypeId == EVariantTypeDesC)
+        {
+        aValue.Copy(iPtrC);
+        return ETrue;
+        }   
+	else if (iTypeId == EVariantTypeTReal) //real to TDes8 conversion
+        {
+        const TRealFormat realFormat;
+        aValue.Num(iData.iReal,realFormat);
+        return ETrue;
+        }
+   else if(iTypeId == EVariantTypeTInt32) // TInt32 to TDes8 conversion
+    	{
+    	aValue.Num(iData.iInt32);
+    	return ETrue;
+    	}
+    else if(iTypeId == EVariantTypeTUint) // TInt32 to TDes conversion
+    	{
+    	aValue.Num(iData.iUint,EDecimal);
+    	return ETrue;
+    	}
+    else if(iTypeId == EVariantTypeTInt64) // TInt32 to TDes8 conversion
+    	{
+    	aValue.Num(iData.iLong);
+    	return ETrue;
+    	}
+    return EFalse;
+    }
+
+
+EXPORT_C TBool TLiwVariant::Get(RFile& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeFileHandle)
+        {
+        aValue = *((RFile*)&iData.iInt64);      
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+EXPORT_C TBool TLiwVariant::Get(CLiwList& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeList)
+        {
+        TInt pos = 0;
+        TLiwVariant tempVarient;
+        tempVarient.PushL();
+        // Overwrite the list
+        if(0 != aValue.Count())
+            {
+            // make the list Empty
+            for (pos = aValue.Count() - 1; pos >= 0 ; pos--)
+                aValue.Remove(pos);
+            }
+        // Copy List varient by varient
+        for (pos = 0; pos < iData.iList->Count(); pos++)
+            {
+            iData.iList->AtL(pos, tempVarient);
+            aValue.AppendL(tempVarient);
+            }
+        CleanupStack::Pop(&tempVarient);
+    	tempVarient.Reset();
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+    
+EXPORT_C TBool TLiwVariant::Get(CLiwMap& aValue) const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeMap)
+        {
+        TInt pos = 0;
+        TLiwVariant tempVarient;
+        tempVarient.PushL();
+        // Overwrite the Map
+        if(0 != aValue.Count())
+            {
+            // make the Map Empty
+            for (pos = aValue.Count() - 1; pos >= 0 ; pos--)
+                {
+                TBuf8<KBufSizeSmall> mapKey;
+                aValue.AtL(pos, mapKey);
+                aValue.Remove(mapKey);
+                }
+            }
+        // Copy Map varient by varient
+        for (pos = 0; pos < iData.iMap->Count(); pos++)
+            {
+            TBuf8<KBufSizeSmall> mapKey;
+            iData.iMap->AtL(pos, mapKey);
+            iData.iMap->FindL(mapKey, tempVarient);
+            aValue.InsertL(mapKey, tempVarient);
+            }
+        CleanupStack::Pop(&tempVarient);
+    	tempVarient.Reset();      
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+EXPORT_C TReal TLiwVariant::AsTReal() const
+    {
+    TReal value = 0;
+    Get(value);
+    return value;
+    }   
+    
+EXPORT_C TInt32 TLiwVariant::AsTInt32() const
+    {
+    TInt32 value = 0;
+    Get(value);
+    return value;
+    }   
+
+EXPORT_C TInt64 TLiwVariant::AsTInt64() const
+    {
+    TInt64 value = 0;
+    Get(value);
+    return value;
+    }   
+
+EXPORT_C CLiwBuffer* TLiwVariant::AsBuffer() const
+    {
+    __TEST_INVARIANT;
+    if (iTypeId == EVariantTypeBuffer)
+    	{
+	    return iData.iBuffer;
+    	}    
+    	
+    return NULL;	
+    }   
+    
+EXPORT_C TBool TLiwVariant::AsTBool() const
+    {
+    TBool value = 0;
+    Get(value);
+    return value;
+    }   
+
+EXPORT_C TBool TLiwVariant::AsTUint() const
+    {
+    TUint value = 0;
+    Get(value);
+    return value;
+    } 
+
+EXPORT_C TUid TLiwVariant::AsTUid() const
+    {
+    __TEST_INVARIANT;
+    TUid value = {0};
+    Get(value);
+    return value;
+    }
+
+EXPORT_C TPtrC TLiwVariant::AsDes() const
+    {
+    __TEST_INVARIANT;
+    TPtrC value;
+    Get(value);
+    return value;
+    }
+
+EXPORT_C TTime TLiwVariant::AsTTime() const
+    {
+    __TEST_INVARIANT;
+    TTime value(Time::NullTTime());
+    Get(value);
+    return value;
+    }
+
+
+EXPORT_C TPtrC8 TLiwVariant::AsData() const
+    {
+     __TEST_INVARIANT;
+    TPtrC8 value;
+    Get(value);
+    return value;
+    }
+
+
+EXPORT_C RFile TLiwVariant::AsFileHandle() const
+    {
+    __TEST_INVARIANT;
+    RFile value;
+    Get(value);
+    return value;
+    }
+
+EXPORT_C const CLiwList* TLiwVariant::AsList() const
+    {
+    __TEST_INVARIANT;
+    return (iTypeId == EVariantTypeList) ? iData.iList : NULL;
+    }
+
+EXPORT_C const CLiwMap* TLiwVariant::AsMap() const
+   {
+   __TEST_INVARIANT;
+   return (iTypeId == EVariantTypeMap) ? iData.iMap : NULL;
+   }
+
+EXPORT_C MLiwInterface* TLiwVariant::AsInterface() const
+   {
+   __TEST_INVARIANT;
+   return (iTypeId == EVariantTypeInterface) ? iData.iSession : NULL;
+   }
+
+EXPORT_C CLiwIterable* TLiwVariant::AsIterable() const
+    {
+    __TEST_INVARIANT;
+    return (iTypeId == EVariantTypeIterable) ? iData.iIterable : NULL;
+    }
+
+EXPORT_C void TLiwVariant::Reset()
+    {
+    __TEST_INVARIANT;
+
+    if (iTypeId == EVariantTypeDesC)
+        {
+        // Delete any owned buffer
+        delete iData.iBufC;
+        iData.iBufC = NULL;
+        }
+    else if (iTypeId == EVariantTypeDesC8)
+        {
+        delete iData.iBufC8;
+        iData.iBufC8 = NULL;
+        }       
+    else if (iTypeId == EVariantTypeList)
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iList->DecRef();
+            iData.iList = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }   
+    else if (iTypeId == EVariantTypeMap)
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iMap->DecRef();
+            iData.iMap = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }   
+    else if (iTypeId == EVariantTypeIterable)
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iIterable->DecRef();
+            iData.iIterable = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }
+	else if (iTypeId == EVariantTypeBuffer)
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iBuffer->DecRef();
+            iData.iBuffer = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }        
+    // No need to clear other data, because Get methods wont't do anything if type
+    // is Null.
+    iTypeId = EVariantTypeNull;
+
+    __ASSERT_DEBUG(IsEmpty(), Panic(EPanicPostCond_Reset));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(TInt32 aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTInt32;
+    iData.iInt32 = aValue;
+    
+    __ASSERT_DEBUG(this->AsTInt32()==aValue, Panic(EPanicPostCond_Set_TInt32));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(TInt64 aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTInt64;
+    iData.iLong = aValue;
+    
+    __ASSERT_DEBUG(this->AsTInt64()==aValue, Panic(EPanicPostCond_Set_TInt64));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(TReal aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTReal;
+    iData.iReal = aValue;
+    
+    __ASSERT_DEBUG(this->AsTReal()==aValue, Panic(EPanicPostCond_Set_TReal));
+    __TEST_INVARIANT;
+    }
+EXPORT_C void TLiwVariant::Set(const CLiwBuffer* aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeBuffer;
+    iData.iBuffer = (CLiwBuffer*)aValue;
+    
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(TBool aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTBool;
+    iData.iBool = aValue;
+    
+    __ASSERT_DEBUG(this->AsTBool()==aValue, Panic(EPanicPostCond_Set_TBool));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(TUint aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTUint;
+    iData.iUint = aValue;
+    
+    __ASSERT_DEBUG(this->AsTUint()==aValue, Panic(EPanicPostCond_Set_TUint));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const TUid& aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTUid;
+    iData.iInt32 = aValue.iUid;
+    
+    __ASSERT_DEBUG(this->AsTUid()==aValue, Panic(EPanicPostCond_Set_TUid));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const TTime& aValue)
+    {
+    __TEST_INVARIANT;
+    
+    Reset();
+    iTypeId = EVariantTypeTTime;
+    iData.iInt64.Set(aValue.Int64());
+    
+    __ASSERT_DEBUG(this->AsTTime()==aValue, Panic(EPanicPostCond_Set_TTime));
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const TDesC& aValue)
+    {
+    __TEST_INVARIANT;
+
+    Reset();
+    iTypeId = EVariantTypeDesC;
+    iData.iBufC = NULL;  // not owned
+    iPtrC.Set(aValue);
+
+    __ASSERT_DEBUG(this->AsDes()==aValue, Panic(EPanicPostCond_Set_TDesC));
+    __TEST_INVARIANT;
+    }
+
+
+
+EXPORT_C void TLiwVariant::Set(const TDesC8& aValue)
+    {
+   __TEST_INVARIANT;
+
+    Reset();
+    iTypeId = EVariantTypeDesC8;
+    iData.iBufC8 = NULL;  // not owned
+    iPtrC8.Set(aValue);
+
+    __ASSERT_DEBUG(this->AsData()==aValue, Panic(EPanicPostCond_Set_TDesC));
+    __TEST_INVARIANT;
+    }
+
+
+
+EXPORT_C void TLiwVariant::Set(const RFile& aValue)
+    {
+    __TEST_INVARIANT;
+    __ASSERT_DEBUG(sizeof(SInt64) == sizeof(RFile), Panic(EPanicPreCond_DataSizeMismatch));
+
+    Reset();
+    iTypeId = EVariantTypeFileHandle;
+    *((RFile*)&iData.iInt64) = aValue;
+
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const CLiwList* aValue)
+    {
+    __TEST_INVARIANT;
+
+    Reset();
+    iTypeId = EVariantTypeList;
+    iData.iList = (CLiwList*)aValue;
+
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const CLiwMap* aValue)
+    {
+    __TEST_INVARIANT;
+
+    Reset();
+    iTypeId = EVariantTypeMap;
+    iData.iMap = (CLiwMap*)aValue;
+
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const MLiwInterface* aValue)
+    {
+    __TEST_INVARIANT;
+
+    Reset();
+    iTypeId = EVariantTypeInterface;
+    iData.iSession = (MLiwInterface*)aValue;
+
+    __TEST_INVARIANT;
+    }
+
+EXPORT_C void TLiwVariant::Set(const CLiwIterable* aValue)
+    {
+    __TEST_INVARIANT;
+
+    Reset();
+    iTypeId = EVariantTypeIterable;
+    iData.iIterable = (CLiwIterable*)aValue;
+
+    __TEST_INVARIANT;
+    }
+    
+EXPORT_C void TLiwVariant::SetL(const TLiwVariant& aValue)
+    {
+    __TEST_INVARIANT;
+
+    if (aValue.iTypeId == EVariantTypeDesC)
+        {
+        // Take an own copy of the string value
+        HBufC* buf = aValue.iPtrC.AllocL();
+        Reset();
+        iTypeId = EVariantTypeDesC;
+        iData.iBufC = buf;
+        iPtrC.Set(*iData.iBufC);
+        }
+    else if (aValue.iTypeId == EVariantTypeDesC8)
+        {
+        // Take an own copy of the data
+        HBufC8* buf = aValue.iPtrC8.AllocL();
+        Reset();
+        iTypeId = EVariantTypeDesC8;
+        iData.iBufC8 = buf;
+        iPtrC8.Set(*iData.iBufC8);
+        }
+    else if (aValue.iTypeId == EVariantTypeList)
+        {
+        // Take an own copy of the data by increasing the reference count
+        Reset();
+        iTypeId = EVariantTypeList;
+        iData.iList = aValue.iData.iList;
+        iData.iList->IncRef();
+        iPtrC8.Set(KDummy);  // hack: mark owned
+        }
+    else if (aValue.iTypeId == EVariantTypeMap) 
+        {
+        // Take an own copy of the data by increasing the reference count
+        Reset();
+        iTypeId = EVariantTypeMap;
+        iData.iMap = aValue.iData.iMap;
+        iData.iMap->IncRef();
+        iPtrC8.Set(KDummy);  // hack: mark owned
+        }
+    else if (aValue.iTypeId == EVariantTypeIterable) 
+        {
+        // Take an own copy of the data by increasing the reference count
+        Reset();
+        iTypeId = EVariantTypeIterable;
+        iData.iIterable = aValue.iData.iIterable;
+        iData.iIterable->IncRef();
+        iPtrC8.Set(KDummy);  // hack: mark owned
+        }
+	else if (aValue.iTypeId == EVariantTypeBuffer) 
+        {
+        Reset();
+        iTypeId = EVariantTypeBuffer;
+        iData.iBuffer = aValue.iData.iBuffer;
+       	iData.iBuffer->IncRef();
+        iPtrC8.Set(KDummy);  // hack: mark owned
+        }        
+    else
+        {
+        Reset();
+        iTypeId = aValue.iTypeId;
+        // Copy the data union as one block
+        iData = aValue.iData;
+        }
+
+    //__ASSERT_DEBUG(*this == aValue, Panic(EPanicPostCond_CopyL));
+    __TEST_INVARIANT;
+    }
+
+void TLiwVariant::Destroy()
+    {
+    __TEST_INVARIANT;
+
+    if (iTypeId == EVariantTypeDesC)
+        {
+        // Delete any owned buffer
+        delete iData.iBufC;
+        iData.iBufC = NULL;
+        }
+    else if (iTypeId == EVariantTypeDesC8)
+        {
+        delete iData.iBufC8;
+        iData.iBufC8 = NULL;
+        }
+    else if (iTypeId == EVariantTypeList)
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iList->DecRef();
+            iData.iList = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }
+    else if (iTypeId == EVariantTypeMap) 
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iMap->DecRef();
+            iData.iMap = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }
+    else if (iTypeId == EVariantTypeIterable)  
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iIterable->DecRef();
+            iData.iIterable = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }
+    else if (iTypeId == EVariantTypeBuffer)  
+        {
+        if (iPtrC8.Compare(KDummy) == 0)
+            {
+            iData.iBuffer->DecRef();
+            iData.iBuffer = NULL;
+            iPtrC8.Set(TPtrC8());
+            }
+        }
+    }
+
+void TLiwVariant::InternalizeL(RReadStream& aStream)
+    {
+    __TEST_INVARIANT;
+        
+    aStream.ReadInt8L(); // version
+    // if older version adapt to changes (who knows if
+    // parameters would be also persistent...)
+
+    const TUint8 typeId = aStream.ReadUint8L();
+    switch (typeId)
+        {
+        case EVariantTypeNull:
+            {
+            Reset();
+            break;
+            }
+        case EVariantTypeTInt32:  // FALLTHROUGH
+        case EVariantTypeTUid:
+        case EVariantTypeTBool:
+        case EVariantTypeTUint:
+            {
+            TInt32 value = aStream.ReadInt32L();
+            Reset();
+            iTypeId = typeId;
+            iData.iInt32 = value;
+            break;
+            }
+        case EVariantTypeTInt64:
+            {
+            TInt64 value = aStream.ReadReal64L();
+            Reset();
+            iTypeId = typeId;
+            iData.iLong = value;
+            break;
+            }
+        case EVariantTypeFileHandle: // FALLTHROUGH
+        case EVariantTypeTTime:
+        case EVariantTypeTReal:
+            {
+            SInt64 value;
+            value.InternalizeL(aStream);
+            Reset();
+            iTypeId = typeId;
+            iData.iInt64 = value;
+            break;
+            }
+        case EVariantTypeDesC:
+            {
+            const TInt len = aStream.ReadInt32L();
+            HBufC* buf = HBufC::NewL(aStream,len);
+            Reset();
+            iTypeId = typeId;
+            iData.iBufC = buf;
+            iPtrC.Set(*iData.iBufC);
+            break;
+            }
+        case EVariantTypeDesC8:
+            {
+            const TInt len = aStream.ReadInt32L();
+            HBufC8* buf = HBufC8::NewL(aStream,len);
+            Reset();
+            iTypeId = typeId;
+            iData.iBufC8 = buf;
+            iPtrC8.Set(*iData.iBufC8);
+            break;
+            }
+        case EVariantTypeList:  
+            {
+            CLiwList* list = CLiwDefaultList::NewLC(aStream);
+            Reset();
+            iTypeId = EVariantTypeList;
+            iData.iList = list;
+            iPtrC8.Set(KDummy);  // hack: mark owned
+            CleanupStack::Pop(list); // list
+            break;
+            }
+        case EVariantTypeMap:  
+            {
+            CLiwMap* map = CLiwDefaultMap::NewLC(aStream);
+            Reset();
+            iTypeId = EVariantTypeMap;
+            iData.iMap = map;
+            iPtrC8.Set(KDummy);  // hack: mark owned
+            CleanupStack::Pop(map); // map
+            break;
+            }
+        default:
+            {
+             // Corrupted data stream.
+#ifdef _DEBUG
+            RDebug::Print(_L("***ERROR TLiwVariant::InternalizeL"));
+#endif
+            User::Leave(KErrCorrupt);
+            return;
+            }
+        }
+
+    __TEST_INVARIANT;
+    }
+    
+void TLiwVariant::ExternalizeL(RWriteStream& aStream) const
+    {
+    __TEST_INVARIANT;
+
+    aStream.WriteInt8L(KVersion);
+    // if older version adapt to changes (who knows if parameters would be also persistent...)
+
+    aStream.WriteUint8L(iTypeId);
+    switch (iTypeId)
+        {
+        case EVariantTypeTInt32: // FALLTHROUGH
+        case EVariantTypeTUid:
+        case EVariantTypeTBool:
+        case EVariantTypeTUint:
+            {
+            aStream.WriteInt32L(iData.iInt32);
+            break;
+            }
+        case EVariantTypeTInt64:
+            {
+            aStream.WriteReal64L(iData.iLong);
+            break;
+            }
+        case EVariantTypeFileHandle: // FALLTHROUGH
+        case EVariantTypeTTime:
+        case EVariantTypeTReal:
+            {
+            iData.iInt64.ExternalizeL(aStream);
+            break;
+            }
+        case EVariantTypeDesC:
+            {
+            aStream.WriteInt32L(iPtrC.Length());
+            aStream << iPtrC;
+            break;
+            }
+        case EVariantTypeDesC8:
+            {
+            aStream.WriteInt32L(iPtrC8.Length());
+            aStream << iPtrC8;
+            break;
+            }
+        case EVariantTypeList:  
+            {
+            iData.iList->ExternalizeL(aStream);
+            break;
+            }
+        case EVariantTypeMap:  
+            {
+            iData.iMap->ExternalizeL(aStream);
+            break;
+            }
+        case EVariantTypeInterface:  
+            {
+            _LIT(KMsg, "TLiwVariant: type Interface not externizable");
+            User::Panic(KMsg, 1);
+            break;
+            }
+        default:
+            break;
+        }
+
+    __TEST_INVARIANT;
+    }
+
+TInt TLiwVariant::Size() const
+    {
+    __TEST_INVARIANT;
+
+    TInt size = sizeof (TInt8); // version
+    size += sizeof (TUint8);    // iTypeId
+    switch (iTypeId)
+        {
+        case EVariantTypeTInt32:    // FALLTHROUGH
+        case EVariantTypeTUid:
+        case EVariantTypeTBool:
+        case EVariantTypeTUint:
+            {
+            size += sizeof (TInt32);
+            break;
+            }
+        case EVariantTypeFileHandle: // FALLTHROUGH
+        case EVariantTypeTTime:
+        case EVariantTypeTReal:
+        case EVariantTypeTInt64:
+            {
+            size += sizeof (TInt64);
+            break;
+            }
+        case EVariantTypeDesC:
+            {
+            size += sizeof (TInt32); // length
+            //size += 1;              // the externalization method used adds a header byte
+            if(iPtrC.Size() >= KBufSizeLarge)
+            	{
+            	size += 4;
+            	}
+            else if(iPtrC.Size() >= KBufSizeSmall)
+            	{
+            	size += 2;
+            	}
+            else
+            	{
+            	size += 1;	
+            	}
+            size += iPtrC.Size();
+            break;
+            }
+        case EVariantTypeDesC8:
+            {
+            size += sizeof (TInt32); // length
+            //size += 1;              // the externalization method used adds a header byte
+            if(iPtrC8.Size() >= KBufSizeLarge)
+            	{
+            	size += 4;
+            	}
+                      	
+            else if(iPtrC8.Size() >= KBufSizeSmall)
+            	{
+            	size += 2;
+            	}
+            else
+            	{
+            	size += 1;
+            	}
+            size += iPtrC8.Size();
+            break;
+            }
+        case EVariantTypeList:  
+            {
+            size += iData.iList->Size();
+            break;
+            }
+        case EVariantTypeMap:  
+            {
+            size += iData.iMap->Size();
+            break;
+            }
+        default:
+            break;
+        }
+    return size;
+    }
+
+// ============================ EXTERNAL FUNCTIONS ===============================
+
+EXPORT_C TBool operator==(const TLiwVariant& aLhs, const TLiwVariant& aRhs)
+    {
+    if (aLhs.iTypeId == aRhs.iTypeId)
+        {
+        switch (aLhs.iTypeId)
+            {
+            case EVariantTypeNull:
+                {
+                // Null equals Null
+                return ETrue;
+                }
+            case EVariantTypeTInt32:  // FALLTHROUGH
+            case EVariantTypeTUid:
+            case EVariantTypeTBool:
+            case EVariantTypeTUint:
+                {
+                return (aLhs.iData.iInt32 == aRhs.iData.iInt32);
+                }
+            case EVariantTypeTInt64:
+                {
+                return (aLhs.iData.iLong == aRhs.iData.iLong);
+                }
+            case EVariantTypeDesC:
+                {
+                return (aLhs.iPtrC == aRhs.iPtrC);
+                }
+            case EVariantTypeDesC8:
+                {
+                return (aLhs.iPtrC8 == aRhs.iPtrC8);
+                }
+            case EVariantTypeFileHandle: // FALLTHROUGH
+            case EVariantTypeTTime:
+            case EVariantTypeTReal:
+                {
+                return (aLhs.iData.iInt64 == aRhs.iData.iInt64);
+                }
+            case EVariantTypeList:
+                {
+                return (*(aLhs.iData.iList) == *(aRhs.iData.iList));
+                }
+            case EVariantTypeMap:
+                {
+                return (*(aLhs.iData.iMap) == *(aRhs.iData.iMap));
+                }
+            case EVariantTypeInterface:
+                {
+                return (aLhs.iData.iSession == aRhs.iData.iSession);
+                }
+            case EVariantTypeIterable:
+                {
+                return (*(aLhs.iData.iIterable) == *(aRhs.iData.iIterable));
+                }
+            case EVariantTypeBuffer:
+                {
+                return (aLhs.iData.iBuffer == aRhs.iData.iBuffer);
+                }                
+            default:
+                {
+                break;
+                }
+            }
+        }
+    return EFalse;
+    }
+
+#ifdef _DEBUG
+EXPORT_C void Dump(const TLiwVariant& aVariant)
+    {
+    switch (aVariant.TypeId())
+        {
+        case EVariantTypeNull:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump = Null"));
+            break;
+            }
+        case EVariantTypeTInt32:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(TInt32) = %d"), aVariant.AsTInt32());
+            break;
+            }
+        case EVariantTypeTInt64:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(TInt64) = %d"), aVariant.AsTInt64());
+            break;
+            }
+        case EVariantTypeTReal:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(TReal) = %d"), aVariant.AsTReal());
+            break;
+            }
+        case EVariantTypeTBool:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(TBool) = %d"), aVariant.AsTBool());
+            break;
+            }
+        case EVariantTypeTUint:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(TUint) = %d"), aVariant.AsTUint());
+            break;
+            }
+
+        case EVariantTypeTUid:
+            {
+            const TUidName& uidName = aVariant.AsTUid().Name();
+            RDebug::Print(_L("   TLiwVariant::Dump(TUid) = %S"), &uidName);
+            break;
+            }
+        case EVariantTypeDesC:
+            {
+            TPtrC des = aVariant.AsDes();
+            RDebug::Print(_L("   TLiwVariant::Dump(TBufC) = %S"), &des);
+            break;
+            }
+        case EVariantTypeDesC8:
+            {
+            TPtrC8 des = aVariant.AsData();
+            RDebug::Print(_L("   TLiwVariant::Dump(TBufC8) = %S"), &des);
+            break;
+            }
+        case EVariantTypeTTime:
+            {
+            TDateTime dt = aVariant.AsTTime().DateTime();
+            RDebug::Print(_L("   TLiwVariant::Dump(TTime): day=%d,mon=%d,year=%d,hh=%d,mm=%d,ss=%d"),
+                          dt.Day()+1, dt.Month()+1, dt.Year(),
+                          dt.Hour(),dt.Minute(), dt.Second());
+            break;          
+            }
+        case EVariantTypeFileHandle:
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(RFile): Value is file handle."));
+            break;
+            }            
+        case EVariantTypeList:  
+            {
+            const CLiwList* tempList = aVariant.AsList();
+            TInt count = tempList->Count();
+            TLiwVariant tempVariant;
+            tempVariant.PushL();
+            RDebug::Print(_L("   TLiwVariant::Dump(List[%d]):"), count);
+            for (TInt index = 0; index < count; index++)
+                {
+                TRAPD(error, {tempList->AtL(index, tempVariant);});
+                if(error != KErrNone)
+                    RDebug::Print(_L("TLiwVariant::Dump ERROR: %d"), error);
+                Dump(tempVariant);
+                }
+            CleanupStack::Pop(&tempVariant);
+    		tempVariant.Reset();
+            RDebug::Print(_L("   TLiwVariant::Dump List END"));
+            break;
+            }
+        case EVariantTypeIterable:  
+          {
+            CLiwIterable* tempItr = aVariant.AsIterable();
+            TLiwVariant tempVariant;
+            RDebug::Print(_L("   TLiwVariant::Dump(Iterable):"));
+            tempItr->Reset();
+            TRAPD(errno, {
+              while (tempItr->NextL(tempVariant)) {
+                Dump(tempVariant);
+              }
+            });
+            if(errno != KErrNone)
+                RDebug::Print(_L("TLiwVariant::Dump ERROR: %d"), errno);
+            tempVariant.Reset();
+            RDebug::Print(_L("   TLiwVariant::Dump Iterable END"));
+            break;
+          }
+        case EVariantTypeMap:  
+          {
+            const CLiwMap* tempMap = aVariant.AsMap();
+            TInt count = tempMap->Count();
+            TLiwVariant tempVariant;
+            RDebug::Print(_L("   TLiwVariant::Dump(Map):"));
+            for (TInt index = 0; index < count; index++) {
+              TBuf8<KBufSizeMid> key;
+              TRAPD(error, {tempMap->AtL(index, key);});
+              RDebug::Print(_L("    key=%S, value= "), &key);
+              TRAP(error, {tempMap->FindL(key, tempVariant);});
+              Dump(tempVariant);
+            }
+            tempVariant.Reset();
+            RDebug::Print(_L("   TLiwVariant::Dump Map END"));
+            break;
+          }
+        case EVariantTypeInterface:  
+            {
+            RDebug::Print(_L("   TLiwVariant::Dump(Interface): Value is interface pointer."));
+            break;
+            }
+        default:
+            {
+            RDebug::Print(_L("  *** TLiwVariant::Dump(Unknown) ***"));
+            break;
+            }
+        }
+    }
+#else
+EXPORT_C void Dump(const TLiwVariant& /*aVariant*/)
+    {
+    }
+    
+#endif // ifdef _DEBUG
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/languageinterworkingfw/servicehandler/src/liwxmlhandler.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Wrapper to XML parser interface. Loads the inline and external XML metadata
+*				 and populates the service provider metadata information. This class
+*				 uses Symbian SAX parser to load the metadata information.
+*
+*/
+
+
+
+
+
+
+
+#include "LiwXmlHandler.h"
+#include <f32file.h>
+#include "data_caging_path_literals.hrh"
+#include <e32capability.h>
+
+#include "LiwServiceData.h"
+#include <LiwVariant.h>
+
+_LIT8(KMetaDataName, "meta");
+
+
+/*
+ * Creates and returns an instance of \c CLiwXmlHandler
+ */
+CLiwXmlHandler* CLiwXmlHandler::NewL()
+{
+	CLiwXmlHandler* ptrToThis = CLiwXmlHandler::NewLC();
+	CleanupStack::Pop(ptrToThis);
+	
+	return ptrToThis;
+}
+
+/*
+ * Creates and returns an instance of \c CLiwXmlHandler
+ * Leaves the created instance in the cleanupstack.
+ *
+ * @return an instance of \c CLiwXmlHandler
+ */
+CLiwXmlHandler* CLiwXmlHandler::NewLC()
+{
+	CLiwXmlHandler* ptrToThis = new (ELeave) CLiwXmlHandler();
+	CleanupStack::PushL(ptrToThis);
+	
+	ptrToThis->ConstructL();
+	
+	return ptrToThis;
+}
+
+
+/*
+ * Destructor. Deletes the handler to XML parser
+ */	
+CLiwXmlHandler::~CLiwXmlHandler()
+{
+	if(iXmlHandler)
+		delete iXmlHandler;
+	
+	if(iBuffer)
+		delete iBuffer;
+}
+
+/*
+ * Default constructor.
+ */	
+CLiwXmlHandler::CLiwXmlHandler()
+{
+	
+}
+
+/*
+ * Instantiates the SAX parser instance and registers itself
+ * as the callback to handle SAX events.
+ */
+void CLiwXmlHandler::ConstructL()
+{
+	TInt parserFeature = EErrorOnUnrecognisedTags | EXmlVersion_1_1;
+	iXmlHandler = CSenXmlReader::NewL(parserFeature);
+	iXmlHandler->SetContentHandler(*this);
+}
+
+/*
+ * Parses the inline XML content passed in the buffer. The parser
+ * is kick started to recevie SAX events. This method also accepts the
+ * reference to \c CLiwServiceData to store the parsed metadata name-value
+ * pairs.
+ */
+TInt CLiwXmlHandler::LoadServiceData(const TDesC8& aXmlBuffer,CLiwServiceData* aServiceData)
+{
+	iServiceData = aServiceData;
+	
+	TRAPD(err,iXmlHandler->ParseL(aXmlBuffer));
+	
+	TInt retVal = ESrvDataLoadFailed;
+		
+	if(!err)
+	{
+		retVal = ESrvDataLoadSuccess;
+	}
+	
+	return retVal;
+}
+
+/*
+ * Parses the XML content present in an external file. The parser
+ * is kick started to recevie SAX events. This method also accepts the
+ * reference to \c CLiwServiceData to store the parsed metadata name-value
+ * pairs.
+ */
+ #include <bautils.h>
+TInt CLiwXmlHandler::LoadServiceData(const TDesC& aFileToParse,CLiwServiceData* aServiceData)
+{
+	TInt retVal = ESrvDataLoadFailed;
+	
+	iServiceData = aServiceData;
+	
+	RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    
+    TFileName resFile;
+    resFile.Append(aFileToParse);
+    
+    if(!BaflUtils::FileExists(fsSession,resFile))
+    {
+    	fsSession.Close();
+    	return ESrvDataFileNotFnd;
+    }
+    	
+    
+	TRAPD(err,iXmlHandler->ParseL(fsSession,resFile));
+	
+	fsSession.Close();
+	if(!err)
+	{
+		retVal = ESrvDataLoadSuccess;
+	}
+	
+	return retVal;	
+}
+
+/**
+* Receive notification of the beginning of a document.
+* @return KErrNone or some of the system-wide Symbian error codes.
+*/		
+TInt CLiwXmlHandler::StartDocument()
+{
+	return KErrNone;
+}
+
+/**
+* Receive notification of the end of a document.
+* @return KErrNone or some of the system-wide Symbian error codes.
+*/
+TInt CLiwXmlHandler::EndDocument()
+{
+	return KErrNone;
+}
+
+/**
+* The important parsed elements are <metadata/> and its sub-element
+* <capability/>.
+* The other sub-elements (other than <capability/>) are considered
+* as service provider specific metadata name-value pairs.
+*
+* @return KErrNone or some of the system-wide Symbian error codes.
+*/
+TInt CLiwXmlHandler::StartElement(	const TDesC8& /*aURI*/, 
+									const TDesC8& aLocalName, 
+									const TDesC8& /*aName*/, 
+									const RAttributeArray& /* apAttrs */)
+{
+	if(iBuffer)
+	{
+		delete iBuffer;
+		iBuffer=NULL;
+	}
+		
+	startBuf = aLocalName;
+	return KErrNone;
+}
+
+
+/**
+* The end of the elements such as <metadata/> and its sub-element
+* <capability/> are processed. The flags set for the processing of
+* <metadata> and it sub-elements like <capability/> are toggled off.
+*
+* @return KErrNone or some of the system-wide Symbian error codes.
+*/
+TInt CLiwXmlHandler::EndElement(	const TDesC8& /*aURI*/, 
+								const TDesC8& aLocalName, 
+								const TDesC8& /*aName*/)
+{
+	if(0!=aLocalName.CompareF(KMetaDataName) && 0==aLocalName.CompareF(startBuf))
+		iServiceData->AddMetaDataL(aLocalName,*iBuffer);
+	
+	delete iBuffer;
+	iBuffer = NULL;
+
+	return KErrNone;
+}
+
+/**
+* The metadata can be defined in the following XML format:
+*
+*
+* <metadata>
+*	<metadata_keyname1>metadata_keyvalue1</metadata_keyname1>
+*	<metadata_keyname2>metadata_keyvalue2</metadata_keyname2>
+* </metadata>
+*
+* A realistic example below
+*
+*
+* <metadata>
+* 	<capability>CapabilityReadDeviceData</capability>
+* 	<capability>CapabilityWriteDeviceData</capability>
+* 	<capability>CapabilityLocation</capability>
+* </metadata>
+*
+* This function obtains the character data defined within the
+* child elements of <metadata>. The child element name under <metadata>
+* is taken as metadata key and the character data under it as metadata
+* value and added to the internal metadata key-value pair entries.
+*
+* There could be multiple metadata keys having different values as
+* shown above
+*
+* Right now it supports only capability metadata information
+*
+*/										
+TInt CLiwXmlHandler::Characters(const TDesC8& aBuf, 
+		   							   const TInt /* aStart */, 
+									   const TInt /* aLength */)
+{
+	if(iBuffer)
+	{		
+		delete iBuffer;
+		iBuffer=NULL;
+	}
+		
+	
+	iBuffer = aBuf.Alloc();
+	
+	return KErrNone;
+}
+
+/**
+* In case of parsing errors due to non-well formed XML content,
+* file not being present etc are handled here. In case of XML content
+* error, the metadata stored so far will be cleaned up.
+*
+* @return KErrNone or some of the system-wide Symbian error codes.
+*/
+
+TInt CLiwXmlHandler::Error(TInt /*aErrorCode*/)
+{
+	return ESrvDataLoadFailed;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0"?><!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [  
+<!ENTITY layer_real_source_path "sf/mw/serviceapifw" >
+]>
+<SystemDefinition name="serviceapifw" schema="1.4.0">  
+<systemModel> 
+<!-- Common file for prebuild layers-->          
+<layer name="mw_layer">                        
+<module name="serviceapifw">                             
+<unit name="serviceapifw" unitID="sapido.serviceapifw" bldFile="&layer_real_source_path;/group" mrp="" />
+<unit name="serviceapifw_test" unitID="sapido.serviceapifw.internal" bldFile="&layer_real_source_path;/internal/group" mrp="" />
+</module>    
+</layer>        
+</systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "../rtsecuritymanagerutil/group/bld.inf"
+#include "../rtsecuritymanagerserver/group/bld.inf"
+#include "../rtsecuritymanagerclient/group/bld.inf"
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+// ../install/rtsecuritymanagerstub.sis      /epoc32/data/z/system/install/rtsecuritymanagerstub.sis
+../install/backup_registration.xml				/epoc32/data/Z/private/2000F847/backup_registration.xml
+
+// Export IBY  and LOC files as per CP50 build improvements.
+// ../rom/rtsecuritymanager.iby  						CORE_MW_LAYER_IBY_EXPORT_PATH(rtsecuritymanager.iby)
+// ../rom/rtsecmgrresource.iby  						LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(rtsecmgrresource.iby)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/inc/rtsecmgrdef.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Common definitions of client and server
+ *
+*/
+
+
+
+
+
+
+#ifndef _RTSECMGRDEF_H
+#define _RTSECMGRDEF_H
+
+#include <e32base.h>
+
+/*
+ * Enumerations for client-server message argument indices
+ */
+enum TSecMgrMsgSlot
+	{
+	EMsgArgZero = 0,
+	EMsgArgOne,
+	EMsgArgTwo,
+	EMsgArgThree,
+	EMsgArgFour
+	};
+
+//opcodes used in message passing between client and server
+enum TRTSecServRqst
+	{
+	ESecServCloseSession = 1,
+	ESetPolicy,
+	EUpdatePolicy,
+	EUnsetPolicy,
+	ERegisterScript,
+	ERegisterScriptWithHash,
+	EUnRegisterScript,
+	EGetScriptSession,
+	EGetTrustedUnRegScriptSession,
+	ECloseScriptSession,
+	ECheckPermission,
+	EUpdatePermanentGrant,
+	EGetScriptFile,
+	ESecMgrSrvReqEnd
+	};
+
+const TInt KSecurityServerUid2Int(0x1020507E);
+const TUid KSecMgrServerUid2 =
+	{
+			KSecurityServerUid2Int
+	};
+
+//the server version. A version must be specifyed when creating a session with the server
+const TUint KRTSecMgrServMajorVersionNumber=0;
+const TUint KRTSecMgrServMinorVersionNumber=1;
+const TUint KRTSecMgrServBuildVersionNumber=1;
+
+// number of message slots.
+const TUint KDefaultMessageSlots= 16;
+const TUint KSecSrvClientTryCount=2;
+const TInt KCapabilitySize = 20;
+
+_LIT(KSecMgrServerExeName, "RTSecMgrServer.exe");
+_LIT(KZDrive, "z:");
+_LIT(KSecServerProcessName, "SecurityManagerServer");
+_LIT(KSecSrvMainThreadName, "SecSrvMain");
+
+#endif //_RTSECMGRDEF_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/inc/rtsecmgrmsg.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+
+
+#ifndef _RTSECMGRMSG_H
+#define _RTSECMGRMSG_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <s32strm.h>
+#include <s32mem.h>
+#include <rtsecmgrcommondef.h>
+
+// Maximum size expected for iHashMarker in CRTSecMgrRegisterScriptMsg
+const TInt KMaxHashValueDesLen = 255;
+
+// Maximum total size expected for a CRTSecMgrRegisterScriptMsg object
+const TInt KMaxMsgLength = 520;
+
+// CLASS DECLARATION
+
+/**
+ *  Message type to pass script object across
+ *  client server boundary
+ * 
+ */
+NONSHARABLE_CLASS(CRTSecMgrRegisterScriptMsg) : public CBase
+	{
+public:
+
+	/**
+	 * Destructor.
+	 */
+	IMPORT_C ~CRTSecMgrRegisterScriptMsg();
+
+	/**
+	 * Two-phased constructor.
+	 * 
+	 * Creates an instance of CRTSecMgrRegisterScriptMsg.
+	 * 
+	 * 
+	 * @param aPolicyID policy identifier of script
+	 * @param aHashValue hash value of script
+	 * 
+	 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg
+	 * 
+	 */
+	IMPORT_C static CRTSecMgrRegisterScriptMsg* NewL(TPolicyID aPolicyID, const TDesC& aHashValue);
+
+	/**
+	 * Two-phased constructor. 
+	 * 
+	 * Creates an instance of CRTSecMgrRegisterScriptMsg
+	 * and leaves it on cleanupstack
+	 * 
+	 * @param aPolicyID policy identifier of script
+	 * @param aHashValue hash value of script
+	 * 
+	 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg
+	 * 
+	 */
+	IMPORT_C static CRTSecMgrRegisterScriptMsg* NewLC(TPolicyID aPolicyID, const TDesC& aHashValue);
+
+	/**
+	 * Two-phased constructor. 
+	 * 
+	 * Creates an instance of CRTSecMgrRegisterScriptMsg
+	 * from the input source
+	 * 
+	 * @param aStreamData input source data
+	 * 
+	 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg 
+	 * 
+	 */
+	IMPORT_C static CRTSecMgrRegisterScriptMsg* NewLC(const TDesC8& aStreamData);
+
+	/*
+	 * Creates an HBufC8 representation of CRTSecMgrRegisterScriptMsg
+	 * 
+	 * @return HBufC8* buffer representation of CRTSecMgrRegisterScriptMsg
+	 */
+	IMPORT_C HBufC8* PackMsgL() const;
+
+	/*
+	 * Gets the hash value of the script
+	 * 
+	 * @return const TDesC8& hash value of script
+	 */
+	inline const TDesC& HashValue() const
+		{
+		if(iHashMarker)
+		return *iHashMarker;
+		else
+		return KNullDesC;
+		}
+
+	/*
+	 * Gets the policy identifier
+	 * 
+	 * @return TPolicyID policy identifier
+	 */
+	inline TPolicyID PolicyID() const
+		{
+		return iPolicyID;
+		}
+
+protected:
+	// Writes ’this’ to the stream
+	void ExternalizeL(RWriteStream& aStream) const;
+	// Initializes ’this’ from stream
+	void InternalizeL(RReadStream& aStream);
+
+private:
+
+	/**
+	 * Constructor for performing 1st stage construction
+	 */
+	CRTSecMgrRegisterScriptMsg()
+		{}
+
+	/**
+	 * Constructor for performing 1st stage construction
+	 */
+	CRTSecMgrRegisterScriptMsg(TPolicyID aPolicyID);
+
+	/**
+	 * Second stage construction
+	 */
+	void ConstructL(const TDesC& aHashValue);
+
+private:
+	/*
+	 * Policy identifier
+	 * 
+	 */
+	TPolicyID iPolicyID;
+
+	/*
+	 * Hash value of the script
+	 * 
+	 */
+	HBufC* iHashMarker;
+	};
+
+#endif // RTSECMGRMSG_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/inc/rtsecmgrtracer.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+
+#ifndef _RTSECMGRTRACE_H
+#define _RTSECMGRTRACE_H
+ 
+#include <e32base.h>
+
+
+// Define tracer logging method if defined RTSECMGR_TRACE
+// 
+// Emulator    = Log to RDebug
+// Device      = Log to file (RFileLogger)
+ 
+// ============================================================================
+ 
+
+#ifndef RTSECMGR_TRACE  // Logging off
+ 
+    #define RTSecMgrTraceFunction(func)    
+    #define RTSecMgrTraceFunctionRet(func,format)
+    #define RTSecMgrCreateTraceFile()
+    #define RTSecMgrTracePrintRet(a)
+#else   // Logging on
+ 		 
+       
+    // Macro to print function entry, exit and leave. 
+    // Example: RTSecMgrTraceFunction("CMyClass::MyFunction");
+    #define RTSecMgrTraceFunction(func) TTracer function_tracer( _S(func), _S("") );
+ 
+    // Macro to print function return value in addition to entry, exit 
+    // and leave conditions Second parameter is a formatting string used 
+    // to print the return value Example to print an integer return value:
+    // RTSecMgrTraceFunctionRet("CMyclass::MyFunction", "%d");
+    #define RTSecMgrTraceFunctionRet(func,format) TTracer func_tracer( _S(func), _S(format) );
+    
+	#define RTSecMgrTracePrintRet(a)   RFileLogger::WriteFormat(KLogDir, \
+                            KLogFile,EFileLoggingModeAppend,a);
+     
+ /*	#if (defined(__WINS__) || defined(__WINSCW__))  // Print to RDebug
+       
+        #include <e32debug.h>
+        
+        #define TRACER_PRINT(a)         RDebug::Print(a,&iFunc);
+        #define TRACER_PRINT_RET(a,b)   RDebug::Print(a,&iFunc,b);
+  		#define RTSecMgrCreateTraceFile()
+ 	
+ 	 #else      //Print to file 	  
+   */ 
+  		#include <f32file.h>
+  		#include <flogger.h>
+        
+        _LIT( KLogDir,  "rtsecmgrtracelogs" );     // Log directory: C:\logs\rtsecmgrtracelogs
+        _LIT( KLogFile, "rtsecmgrtracelogs.txt" ); // Log file: c:\logs\tracer\rtsecmgrtracelogs.txt
+        _LIT( KFullPath, "c:\\logs\\rtsecmgrtracelogs\\" );  
+    	_LIT(KFullLogFileName , "c:\\logs\\rtsecmgrtracelogs\\rtsecmgrtracelogs.txt") ;
+       
+        LOCAL_C void CreateLogFile()  // Local function for creating Logdirectory and LogFile
+        {
+        RFs fs;
+        RFile fileHandle ;
+        if( fs.Connect() == KErrNone )
+            {
+            fs.MkDirAll( KFullPath );
+            if(fileHandle.Open(fs ,KFullLogFileName , EFileWrite | EFileShareAny )  == KErrNotFound)
+				{
+				fileHandle.Create(fs ,KFullLogFileName , EFileWrite | EFileShareAny ) ;
+				}
+            fileHandle.Close() ;
+            fs.Close();
+            }
+        }
+     
+    	#define RTSecMgrCreateTraceFile() CreateLogFile();
+        
+        #define TRACER_PRINT(a)         RFileLogger::WriteFormat(KLogDir, \
+                            KLogFile,EFileLoggingModeAppend,a,&iFunc);
+        #define TRACER_PRINT_RET(a,b)   RFileLogger::WriteFormat(KLogDir, \
+                            KLogFile,EFileLoggingModeAppend,a,&iFunc,b);
+ 
+ //   #endif
+ 
+    _LIT( KLogEnter,    "%S: ENTER" );
+    _LIT( KLogExit,     "%S: EXIT" );
+    _LIT( KLogLeave,    "%S: LEAVE!" );
+    _LIT( KLogExitRet,  "%S: EXIT, Returning " );
+ 
+    /**
+     * Simple tracer class that logs function enter, exit or leave
+     */
+    class TTracer
+        {
+    public:
+ 
+        /**
+         * inline constructor to write log of entering a function
+         */
+        TTracer( const TText* aFunc, const TText* aRetFormat )
+            : iFunc( aFunc )
+            , iRetFormat( aRetFormat )
+            {
+            TRACER_PRINT( KLogEnter );
+            }
+ 
+        /**
+         * inline destructor to write log of exiting a function 
+         * normally or with a leave
+         */
+        ~TTracer()
+            {
+            if ( std::uncaught_exception() ) // Leave is an exception
+                {
+                // The function exited with a leave
+                TRACER_PRINT( KLogLeave );
+                }
+            else
+                {
+                // The function exited normally
+                if ( iRetFormat.Length() == 0 )
+                    {
+                    TRACER_PRINT( KLogExit );
+                    }
+                else
+                    {
+                    // Log the return value
+                    #ifdef __WINS__
+                        TInt32 retVal = 0;
+ 
+                        // The assembly bit. This needs to be reimplemented
+                        // for every target. 
+                        _asm( mov retVal, ebx );
+ 
+                        TBuf<100> format( KLogExitRet );
+                        format.Append( iRetFormat );
+                        TRACER_PRINT_RET( format, retVal );
+                    #else
+                        TRACER_PRINT( KLogExit );
+                   
+                    #endif
+                    }
+                }
+            }
+ 
+    private:
+ 
+        /** 
+         * Pointer descriptor to function signature that is to be logged.
+         */
+        TPtrC iFunc;
+        
+ 
+        /**
+         * Formatting string used to print the function return value
+         */
+        TPtrC iRetFormat;
+ 
+        };
+ 
+#endif // RTSECMGR_TRACE
+ 
+#endif // _RTSECMGRTRACE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/install/backup_registration.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="yes"?>
+<!-- Backup registration file for runtime security manager server -->
+	<backup_registration>
+		<passive_backup>
+    	<include_directory name = "\policy"/>
+    	<include_directory name = "\script"/>
+    	<include_file name = "\config.dat"/>
+  	</passive_backup>
+		<system_backup/>
+  		<restore requires_reboot = "no"/>
+	</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/install/rtsecuritymanager.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+
+; standard SIS file header
+#{"RTSecMgrServer"},(0x2000F847),1,0,0
+
+;Supports Series 60 v 3.0
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+;Localized Vendor Name
+%{"Nokia EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+; Files to copy
+
+"\epoc32\release\armv5\urel\RTSecMgrServer.exe"          -"!:\sys\bin\RTSecMgrServer.exe"
+"\epoc32\release\armv5\urel\RTSecMgrUtil.dll"          -"!:\sys\bin\RTSecMgrUtil.dll"
+"\epoc32\release\armv5\urel\RTSecMgrClient.dll"          -"!:\sys\bin\RTSecMgrClient.dll"
+"\epoc32\data\Z\resource\apps\RTSecManager.rsc"     -"!:\resource\apps\RTSecManager.rsc"
+"\epoc32\data\Z\private\2000F847\backup_registration.xml"	-"!:\private\2000F847\backup_registration.xml"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/install/rtsecuritymanager_PU.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+
+; standard SIS file header
+#{"RTSecMgrServer"},(0x2000F847),1,0,0, TYPE = PU
+
+;Supports Series 60 v 3.0
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+;Localized Vendor Name
+%{"Nokia EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+; Files to copy
+
+"\epoc32\release\armv5\urel\RTSecMgrServer.exe"          -"!:\sys\bin\RTSecMgrServer.exe"
+"\epoc32\release\armv5\urel\RTSecMgrUtil.dll"          -"!:\sys\bin\RTSecMgrUtil.dll"
+"\epoc32\release\armv5\urel\RTSecMgrClient.dll"          -"!:\sys\bin\RTSecMgrClient.dll"
+"\epoc32\data\Z\resource\apps\RTSecManager.rsc"     -"!:\resource\apps\RTSecManager.rsc"
+;"\epoc32\data\Z\private\2000F847\backup_registration.xml"	-"!:\private\2000F847\backup_registration.xml"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/install/rtsecuritymanagerstub.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,31 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+
+; standard SIS file header
+#{"Runtime Security Manager"},(0x2000F847),1,0,0,TYPE=SA
+
+;Localized Vendor Name
+%{"Nokia-EN"}
+
+;Unique Vendor name
+:"Nokia"
+
+; Files to copy
+""-"z:\sys\bin\RTSecMgrServer.exe"
+""-"z:\sys\bin\RTSecMgrUtil.dll"
+""-"z:\sys\bin\RTSecMgrClient.dll"
+""-"z:\resource\apps\RTSecManager.r*"
\ No newline at end of file
Binary file rtsecuritymanager/install/rtsecuritymanagerstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/BWINS/RTSecMgrClientU.DEF	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,21 @@
+EXPORTS
+	??1CRTSecManager@@UAE@XZ @ 1 NONAME ; CRTSecManager::~CRTSecManager(void)
+	??1CRTSecMgrScriptSession@@UAE@XZ @ 2 NONAME ; CRTSecMgrScriptSession::~CRTSecMgrScriptSession(void)
+	??1CTrustInfo@@UAE@XZ @ 3 NONAME ; CTrustInfo::~CTrustInfo(void)
+	?GetScriptSessionL@CRTSecManager@@QAEPAVCRTSecMgrScriptSession@@HABVCTrustInfo@@PAVMSecMgrPromptHandler@@@Z @ 4 NONAME ; class CRTSecMgrScriptSession * CRTSecManager::GetScriptSessionL(int, class CTrustInfo const &, class MSecMgrPromptHandler *)
+	?GetScriptSessionL@CRTSecManager@@QAEPAVCRTSecMgrScriptSession@@HHPAVMSecMgrPromptHandler@@ABVTDesC16@@@Z @ 5 NONAME ; class CRTSecMgrScriptSession * CRTSecManager::GetScriptSessionL(int, int, class MSecMgrPromptHandler *, class TDesC16 const &)
+	?IsAllowed@CRTSecMgrScriptSession@@QAEHABV?$RArray@W4TCapability@@@@@Z @ 6 NONAME ; int CRTSecMgrScriptSession::IsAllowed(class RArray<enum TCapability> const &)
+	?IsAllowed@CRTSecMgrScriptSession@@QAEHABV?$RArray@W4TCapability@@@@AAV2@@Z @ 7 NONAME ; int CRTSecMgrScriptSession::IsAllowed(class RArray<enum TCapability> const &, class RArray<enum TCapability> &)
+	?NewL@CRTSecManager@@SAPAV1@XZ @ 8 NONAME ; class CRTSecManager * CRTSecManager::NewL(void)
+	?NewL@CTrustInfo@@SAPAV1@XZ @ 9 NONAME ; class CTrustInfo * CTrustInfo::NewL(void)
+	?NewLC@CRTSecManager@@SAPAV1@XZ @ 10 NONAME ; class CRTSecManager * CRTSecManager::NewLC(void)
+	?NewLC@CTrustInfo@@SAPAV1@XZ @ 11 NONAME ; class CTrustInfo * CTrustInfo::NewLC(void)
+	?RegisterScript@CRTSecManager@@QAEHHABVCTrustInfo@@@Z @ 12 NONAME ; int CRTSecManager::RegisterScript(int, class CTrustInfo const &)
+	?RegisterScript@CRTSecManager@@QAEHHABVTDesC16@@ABVCTrustInfo@@@Z @ 13 NONAME ; int CRTSecManager::RegisterScript(int, class TDesC16 const &, class CTrustInfo const &)
+	?SetPolicy@CRTSecManager@@QAEHABVRFile@@@Z @ 14 NONAME ; int CRTSecManager::SetPolicy(class RFile const &)
+	?SetPolicy@CRTSecManager@@QAEHABVTDesC8@@@Z @ 15 NONAME ; int CRTSecManager::SetPolicy(class TDesC8 const &)
+	?UnRegisterScript@CRTSecManager@@QAEHHH@Z @ 16 NONAME ; int CRTSecManager::UnRegisterScript(int, int)
+	?UnSetPolicy@CRTSecManager@@QAEHH@Z @ 17 NONAME ; int CRTSecManager::UnSetPolicy(int)
+	?UpdatePolicy@CRTSecManager@@QAEHHABVRFile@@@Z @ 18 NONAME ; int CRTSecManager::UpdatePolicy(int, class RFile const &)
+	?UpdatePolicy@CRTSecManager@@QAEHHABVTDesC8@@@Z @ 19 NONAME ; int CRTSecManager::UpdatePolicy(int, class TDesC8 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/EABI/RTSecMgrClientU.DEF	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,27 @@
+EXPORTS
+	_ZN10CTrustInfo4NewLEv @ 1 NONAME
+	_ZN10CTrustInfo5NewLCEv @ 2 NONAME
+	_ZN10CTrustInfoD0Ev @ 3 NONAME
+	_ZN10CTrustInfoD1Ev @ 4 NONAME
+	_ZN10CTrustInfoD2Ev @ 5 NONAME
+	_ZN13CRTSecManager11UnSetPolicyEi @ 6 NONAME
+	_ZN13CRTSecManager12UpdatePolicyEiRK5RFile @ 7 NONAME
+	_ZN13CRTSecManager12UpdatePolicyEiRK6TDesC8 @ 8 NONAME
+	_ZN13CRTSecManager14RegisterScriptEiRK10CTrustInfo @ 9 NONAME
+	_ZN13CRTSecManager14RegisterScriptEiRK7TDesC16RK10CTrustInfo @ 10 NONAME
+	_ZN13CRTSecManager16UnRegisterScriptEii @ 11 NONAME
+	_ZN13CRTSecManager17GetScriptSessionLEiRK10CTrustInfoP20MSecMgrPromptHandler @ 12 NONAME
+	_ZN13CRTSecManager17GetScriptSessionLEiiP20MSecMgrPromptHandlerRK7TDesC16 @ 13 NONAME
+	_ZN13CRTSecManager4NewLEv @ 14 NONAME
+	_ZN13CRTSecManager5NewLCEv @ 15 NONAME
+	_ZN13CRTSecManager9SetPolicyERK5RFile @ 16 NONAME
+	_ZN13CRTSecManager9SetPolicyERK6TDesC8 @ 17 NONAME
+	_ZN13CRTSecManagerD0Ev @ 18 NONAME
+	_ZN13CRTSecManagerD1Ev @ 19 NONAME
+	_ZN13CRTSecManagerD2Ev @ 20 NONAME
+	_ZN22CRTSecMgrScriptSession9IsAllowedERK6RArrayI11TCapabilityE @ 21 NONAME
+	_ZN22CRTSecMgrScriptSession9IsAllowedERK6RArrayI11TCapabilityERS2_ @ 22 NONAME
+	_ZN22CRTSecMgrScriptSessionD0Ev @ 23 NONAME
+	_ZN22CRTSecMgrScriptSessionD1Ev @ 24 NONAME
+	_ZN22CRTSecMgrScriptSessionD2Ev @ 25 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/data/rtsecmanager.rss	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+// rtsecmanager.RSS
+//
+NAME Sec
+
+#include <eikon.rh>
+#include <eikcore.rsg>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <appinfo.rh>
+#include <rtsecmanager.loc>
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF r_rtsecmgr_prompt_query_header { buf=qtn_rtsecmgr_prompt_query_header; }
+RESOURCE TBUF r_rtsecmgr_commDD { buf=qtn_rtsecmgr_prompt_query_commdd; } //ECapabilityCommDD
+RESOURCE TBUF r_rtsecmgr_powermgmt { buf=qtn_rtsecmgr_prompt_query_powermgmt; } //ECapabilityPowerMgmt
+RESOURCE TBUF r_rtsecmgr_mmediaDD { buf=qtn_rtsecmgr_prompt_query_mmediadd; } //ECapabilityMultimediaDD
+RESOURCE TBUF r_rtsecmgr_readdevicedata { buf=qtn_rtsecmgr_prompt_query_read_devicedata; } //ECapabilityReadDeviceData
+RESOURCE TBUF r_rtsecmgr_writedevicedata { buf=qtn_rtsecmgr_prompt_query_write_devicedata; } //ECapabilityWriteDeviceData
+RESOURCE TBUF r_rtsecmgr_drm { buf=qtn_rtsecmgr_prompt_query_drm; } //ECapabilityDRM
+RESOURCE TBUF r_rtsecmgr_trustedUI { buf=qtn_rtsecmgr_prompt_query_trustedui; } //ECapabilityTrustedUI
+RESOURCE TBUF r_rtsecmgr_protserv { buf=qtn_rtsecmgr_prompt_query_protserv; } //ECapabilityProtServ
+RESOURCE TBUF r_rtsecmgr_diskadmin { buf=qtn_rtsecmgr_prompt_query_diskadmin; } //ECapabilityDiskAdmin
+RESOURCE TBUF r_rtsecmgr_nwcontrol { buf=qtn_rtsecmgr_prompt_query_nwcontrol; } //ECapabilityNetworkControl
+
+RESOURCE TBUF r_rtsecmgr_userdata_group { buf=qtn_rtsecmgr_prompt_query_userdata; }
+RESOURCE TBUF r_rtsecmgr_deviceresources_group { buf=qtn_rtsecmgr_prompt_query_deviceresources; }
+RESOURCE TBUF r_rtsecmgr_network_group { buf=qtn_rtsecmgr_prompt_query_network; }
+RESOURCE TBUF r_rtsecmgr_cost_network { buf=qtn_rtsecmgr_prompt_cost_network; }
+RESOURCE TBUF r_rtsecmgr_group_info { buf=qtn_rtsecmgr_info_about_group; }
+
+
+RESOURCE TBUF r_rtsecmgr_allfiles { buf=qtn_rtsecmgr_prompt_query_allfiles; } //ECapabilityAllFiles
+RESOURCE TBUF r_rtsecmgr_swevent { buf=qtn_rtsecmgr_prompt_query_swevent; } //ECapabilitySwEvent
+RESOURCE TBUF r_rtsecmgr_nwservices { buf=qtn_rtsecmgr_prompt_query_nwservices; } //ECapabilityNetworkServices
+RESOURCE TBUF r_rtsecmgr_localservices { buf=qtn_rtsecmgr_prompt_query_localservices; } //ECapabilityLocalServices
+RESOURCE TBUF r_rtsecmgr_readuserdata { buf=qtn_rtsecmgr_prompt_query_read_userdata; } 
+RESOURCE TBUF r_rtsecmgr_writeuserdata { buf=qtn_rtsecmgr_prompt_query_write_userdata; } //ECapabilityWriteUserData
+RESOURCE TBUF r_rtsecmgr_location { buf=qtn_rtsecmgr_prompt_query_location; } //ECapabilityLocation
+RESOURCE TBUF r_rtsecmgr_surrDD { buf=qtn_rtsecmgr_prompt_query_surrdd; } //ECapabilitySurroundingsDD
+RESOURCE TBUF r_rtsecmgr_userenv { buf=qtn_rtsecmgr_prompt_query_userenv; } //ECapabilityUserEnvironment
+
+
+RESOURCE TBUF r_rtsecmgr_more_info_header_userdata { buf=qtn_rtsecmgr_more_info_header_userdata; }
+RESOURCE TBUF r_rtsecmgr_more_info_header_deviceresources { buf=qtn_rtsecmgr_more_info_header_deviceresources; }
+RESOURCE TBUF r_rtsecmgr_more_info_header_network { buf=qtn_rtsecmgr_more_info_header_network; }
+
+RESOURCE TBUF r_rtsecmgr_more_info_commDD { buf=qtn_rtsecmgr_more_info_commdd; } //ECapabilityCommDD
+RESOURCE TBUF r_rtsecmgr_more_info_mmediaDD { buf=qtn_rtsecmgr_more_info_mmediadd; } //ECapabilityMultimediaDD
+RESOURCE TBUF r_rtsecmgr_more_info_readdevicedata { buf=qtn_rtsecmgr_more_info_read_devicedata; } //ECapabilityReadDeviceData
+RESOURCE TBUF r_rtsecmgr_more_info_writedevicedata { buf=qtn_rtsecmgr_more_info_write_devicedata; } //ECapabilityWriteDeviceData
+RESOURCE TBUF r_rtsecmgr_more_info_nwcontrol { buf=qtn_rtsecmgr_more_info_nwcontrol; } //ECapabilityNetworkControl
+RESOURCE TBUF r_rtsecmgr_more_info_swevent { buf=qtn_rtsecmgr_more_info_swevent; } //ECapabilitySwEvent
+RESOURCE TBUF r_rtsecmgr_more_info_nwservices { buf=qtn_rtsecmgr_more_info_nwservices; } //ECapabilityNetworkServices
+RESOURCE TBUF r_rtsecmgr_more_info_localservices { buf=qtn_rtsecmgr_more_info_localservices; } //ECapabilityLocalServices
+RESOURCE TBUF r_rtsecmgr_more_info_read_userdata { buf=qtn_rtsecmgr_more_info_read_userdata; }
+RESOURCE TBUF r_rtsecmgr_more_info_write_userdata { buf=qtn_rtsecmgr_more_info_write_userdata; }
+RESOURCE TBUF r_rtsecmgr_more_info_location { buf=qtn_rtsecmgr_more_info_location; }
+RESOURCE TBUF r_rtsecmgr_more_info_surrDD { buf=qtn_rtsecmgr_more_info_surrdd; } //ECapabilitySurroundingsDD
+RESOURCE TBUF r_rtsecmgr_more_info_userenv { buf=qtn_rtsecmgr_more_info_userenv; }
+
+RESOURCE TBUF r_rtsecmgr_more_info_individual_prompt_udg { buf=qtn_rtsecmgr_more_info_individual_prompt_udg; }
+RESOURCE TBUF r_rtsecmgr_more_info_individual_prompt_drg { buf=qtn_rtsecmgr_more_info_individual_prompt_drg; }
+RESOURCE TBUF r_rtsecmgr_more_info_individual_prompt_ng { buf=qtn_rtsecmgr_more_info_individual_prompt_ng; }
+
+//one-shot yes
+RESOURCE TBUF r_rtsecmgr_prompt_oneshot_yes { buf=qtn_rtsecmgr_prompt_oneshot_yes; }
+//one-shot no
+RESOURCE TBUF r_rtsecmgr_prompt_oneshot_no { buf=qtn_rtsecmgr_prompt_oneshot_no; }
+
+//session yes
+RESOURCE TBUF r_rtsecmgr_prompt_session_yes { buf=qtn_rtsecmgr_prompt_session_yes; }
+//session no
+RESOURCE TBUF r_rtsecmgr_prompt_session_no { buf=qtn_rtsecmgr_prompt_oneshot_no; }
+
+//permanent yes
+RESOURCE TBUF r_rtsecmgr_prompt_perm_yes { buf=qtn_rtsecmgr_prompt_perm_yes; }
+//permanent no
+RESOURCE TBUF r_rtsecmgr_prompt_perm_no { buf=qtn_rtsecmgr_prompt_oneshot_no; }
+
+RESOURCE TBUF r_rtsecmgr_prompt_allow_oneshot { buf=qtn_rtsecmgr_prompt_allow_oneshot; }
+
+RESOURCE TBUF r_rtsecmgr_prompt_allow_session { buf=qtn_rtsecmgr_prompt_session_yes; }
+
+RESOURCE TBUF r_rtsecmgr_prompt_allow_permanent { buf=qtn_rtsecmgr_prompt_perm_yes; }
+
+RESOURCE TBUF r_rtsecmgr_link_more_info { buf=qtn_rtsecmgr_link_more_info; }
+RESOURCE TBUF r_rtsecmgr_item_more_info { buf=qtn_rtsecmgr_item_more_info; }
+RESOURCE TBUF r_rtsecmgr_more_info_query { buf=qtn_rtsecmgr_info_about_group; }
+RESOURCE TBUF r_rtsecmgr_cost_info { buf=qtn_rtsecmgr_prompt_cost_network; }
+RESOURCE LISTBOX r_setting_app_listbox
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_rtsecmgr_prompt_setting_dialog
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+	label = r_rtsecmgr_prompt_setting_dialog_label;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_EMPTY;
+    type =  EAknSetListBox;
+    editor_resource_id= r_setting_app_listbox;
+    }
+
+RESOURCE AVKON_LIST_QUERY r_list_query_msgbox
+{
+items =
+{
+AVKON_LIST_QUERY_DLG_LINE
+    {
+    control = AVKON_LIST_QUERY_CONTROL_WITH_MSGBOX
+    {
+    message = " ";
+    listtype = EAknListQueryWithMsgBox; 
+    actuallisttype = EAknCtSinglePopupMenuListBox;
+    listbox = AVKON_LIST_QUERY_LIST
+        {
+
+        };
+    heading = r_rtsecmgr_prompt_query_header;
+    };
+    }
+};
+}
+
+RESOURCE DIALOG r_advprompt_message_query {
+flags = EGeneralQueryFlags;
+buttons = R_AVKON_SOFTKEYS_YES_NO;
+items = {
+   DLG_LINE {
+      type = EAknCtPopupHeadingPane;
+      id = EAknMessageQueryHeaderId;
+      control = AVKON_HEADING {};
+   },
+   DLG_LINE {
+       type = EAknCtMessageQuery;
+       id = EAknMessageQueryContentId;
+       control = AVKON_MESSAGE_QUERY { message = " "; };
+   }
+};
+}
+
+RESOURCE DIALOG r_moreinfo_message_query {
+flags = EGeneralQueryFlags;
+buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+items = {
+   DLG_LINE {
+      type = EAknCtPopupHeadingPane;
+      id = EAknMessageQueryHeaderId;
+      control = AVKON_HEADING {};
+   },
+   DLG_LINE {
+       type = EAknCtMessageQuery;
+       id = EAknMessageQueryContentId;
+       control = AVKON_MESSAGE_QUERY { message = " "; };
+   }
+};
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <platform_paths.hrh>
+PRJ_EXPORTS
+../loc/rtsecmanager.loc        MW_LAYER_LOC_EXPORT_PATH(rtsecmanager.loc)
+
+PRJ_MMPFILES
+RTSecMgrClient.mmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/group/rtsecmgrclient.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          RTSecMgrClient.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x2000F848
+
+CAPABILITY      CAP_CLIENT_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 10.1
+paged
+
+MW_LAYER_SYSTEMINCLUDE 
+
+USERINCLUDE     . 
+USERINCLUDE     ../inc/
+USERINCLUDE     ../../inc/
+
+SOURCEPATH      ../src/
+SOURCE          RTSecMgrClient.cpp
+SOURCE          RTSecManager.cpp
+SOURCE          RTSecMgrScriptSession.cpp
+SOURCE          RTSecMgrTrustInfo.cpp
+
+START RESOURCE ../data/rtsecmanager.rss
+		TARGETPATH      APP_RESOURCE_DIR
+		HEADER
+		LANGUAGE_IDS
+END
+
+//MACRO          RTSECMGR_TRACE
+
+LIBRARY       avkon.lib 
+LIBRARY       aknskins.lib 
+LIBRARY       aknskinsrv.lib
+LIBRARY       bafl.lib
+LIBRARY       cone.lib
+LIBRARY       euser.lib 
+LIBRARY		  	efsrv.lib 
+LIBRARY       estor.lib 
+LIBRARY       eikcore.lib
+LIBRARY       gdi.lib
+LIBRARY       platformEnv.lib
+LIBRARY       flogger.lib
+LIBRARY       rtsecmgrutil.lib 
+LIBRARY		  	eikcoctl.lib
+LIBRARY		   	commonengine.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/inc/rtsecmgrclient.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Security Manager Client Side sub-Session Class
+ *
+*/
+
+
+
+
+
+
+#ifndef _R_RSECMGRSESSION_H_
+#define _R_RSECMGRSESSION_H_
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+
+#include <rtsecmgrcommondef.h>
+#include <rtsecmgrtrustinfo.h>
+#include <rtsecmgrutility.h>
+
+class CTrustInfo;
+class CScript;
+class CEikonEnv;
+
+/**
+ *
+ * RSecMgrSession represents the client side session handle. 
+ * 
+ * This class mainly communicates with the corresponding server side session object. 
+ * The main reponsibility of this class is to package the input parameters,
+ * invoke a server request and unpack the server response appropriately.
+ *
+ * @lib rtsecmgrclient.lib
+ */
+NONSHARABLE_CLASS(RSecMgrSession) : public RSessionBase
+	{
+public:
+
+	/**
+	 * Default constructor
+	 * 
+	 */
+	RSecMgrSession();
+
+	/**
+	 * Connects to the runtime security manager server resulting in the creation
+	 * of peer server side session object
+	 * 
+	 * @return TInt KErrNone if successful; In case of failure, one of system-wide
+	 * error codes
+	 * 
+	 */
+	TInt Connect();
+
+	/**
+	 * Gets the version of runtime security manager component
+	 * 
+	 * @return TVersion version of runtime security manager
+	 * 
+	 */
+	TVersion Version() const;
+
+	/**
+	 * Closes the session with the runtime security manager server
+	 * 
+	 */
+	void Close();
+
+	/**
+	 * Registers the runtime security policy with security manager. This method
+	 * packs the message parameters required for registering the policy. 
+	 * 
+	 * The various parameters required for SetPolicy operation are :
+	 * 	
+	 *  Operation Code  : ESetPolicy
+	 * 	IPC Argument[0] : Policy Identifier (as inOut parameter)
+	 *  IPC Argument[1] : SecurityPolicy FileHandle
+	 *  IPC Argument[2] : SecurityPolicy FileSession object
+	 *  IPC Argument[3] : none
+	 * 
+	 * @param aSecPolicy RFile Handle to security policy file
+	 * 
+	 * @return TPolicyID generated policy identifier if successul; Otherwise one of
+	 *					 system wide error codes
+	 * 
+	 */
+	TPolicyID SetPolicy(const RFile& aSecPolicy);
+	
+	/**
+	 * Registers the runtime security policy with security manager. This method
+	 * packs the message parameters required for registering the policy. 
+	 * 
+	 * The various parameters required for SetPolicy operation are :
+	 * 	
+	 *  Operation Code  : ESetPolicy
+	 * 	IPC Argument[0] : Policy Identifier (as inOut parameter)
+	 *  IPC Argument[1] : PolicyBuffer
+	 *  IPC Argument[2] : SecurityPolicy FileSession object
+	 *  IPC Argument[3] : none
+	 * 
+	 * @param aSecPolicy RFile Handle to security policy file
+	 * 
+	 * @return TPolicyID generated policy identifier if successul; Otherwise one of
+	 *					 system wide error codes
+	 * 
+	 */
+	TPolicyID SetPolicy(const TDesC8& aPolicyBuffer);
+
+	/**
+	 * UnRegisters a registered security policy. Runtimes should call this function
+	 * to de-register the already registered security policy.
+	 * 
+	 * The various parameters required for UnSetPolicy operation are :
+	 * 	
+	 *  Operation Code  : EUnsetPolicy
+	 * 	IPC Argument[0] : Policy Identifier to un-register
+	 *  IPC Argument[1] : Successcode (as inOut parameter)
+	 *  IPC Argument[2] : none
+	 *  IPC Argument[3] : none
+	 * 
+	 * @param aPolicyID TPolicyID Policy identifier previously generated with SetPolicy
+	 *
+	 * @return TInt One of sytem wide error codes in case of failure; Otherwise KErrNone
+	 * 
+	 */
+	TInt UnSetPolicy(TPolicyID aPolicyID);
+
+	/**
+	 * Updates an already registered security policy. Runtimes should call this function
+	 * to update their policy.
+	 *
+	 * The various parameters required for UpdatePolicy operation are :
+	 * 	
+	 *  Operation Code  : EUpdatePolicy
+	 * 	IPC Argument[0] : Policy Identifier
+	 *  IPC Argument[1] : SecurityPolicy FileHandle
+	 *  IPC Argument[2] : SecurityPolicy FileSession object
+	 *  IPC Argument[3] : none
+	 * 
+	 * @param aPolicyID TPolicyID Policy identifier previously generated with SetPolicy
+	 * @param aSecPolicy RFile Handle to security policy file
+	 *
+	 * @see SetPolicy for file session pre-conditions
+	 *
+	 * @return TPolicyID One of sytem wide error codes in case of failure; Otherwise the passed policyID
+	 *
+	 */
+	TPolicyID UpdatePolicy(TPolicyID aPolicyID, const RFile& aSecPolicy);
+	
+	/**
+	 * Updates an already registered security policy. Runtimes should call this function
+	 * to update their policy.
+	 *
+	 * The various parameters required for UpdatePolicy operation are :
+	 * 	
+	 *  Operation Code  : EUpdatePolicy
+	 * 	IPC Argument[0] : Policy Identifier
+	 *  IPC Argument[1] : SecurityPolicy FileBuffer
+	 *  IPC Argument[2] : SecurityPolicy FileSession object
+	 *  IPC Argument[3] : none
+	 * 
+	 * @param aPolicyID TPolicyID Policy identifier previously generated with SetPolicy
+	 * @param aSecPolicy RFile Handle to security policy file
+	 *
+	 * @see SetPolicy for file session pre-conditions
+	 *
+	 * @return TPolicyID One of sytem wide error codes in case of failure; Otherwise the passed policyID
+	 *
+	 */
+	TPolicyID UpdatePolicy(TPolicyID aPolicyID, const TDesC8& aPolicyBuffer);
+
+	/**
+	 * Registers a script/executable. Runtimes should specify the trust information
+	 * of the script to be registered. 
+	 *
+	 *  Operation Code  : ERegisterScript
+	 * 	IPC Argument[0] : Policy Identifier
+	 *  IPC Argument[1] : Script Identifier (as inOut Parameter)
+	 *  IPC Argument[2] : none
+	 *  IPC Argument[3] : none 
+	 * 
+	 * @param aPolicyID TPolicyID   Runtime's registered policy identifier
+	 * @param aTrustInfo CTrustInfo a valid instance of CTrustInfo object
+	 *
+	 * @return TExecutableID generated executable identifier if successul; Otherwise one of
+	 *					 	 system wide error codes
+	 *
+	 */
+	TExecutableID RegisterScript(TPolicyID aPolicyID,
+			const CTrustInfo& aTrustInfo);
+
+	/**
+	 * Registers a script/executable. Runtimes should specify the trust information
+	 * of the script to be registered. 
+	 *
+	 *  Operation Code  : ERegisterScript
+	 * 	IPC Argument[0] : Policy Identifier
+	 *  IPC Argument[1] : Script Identifier (as inOut Parameter)
+	 *  IPC Argument[2] : hash value of script
+	 *  IPC Argument[3] : none 
+	 * 
+	 * 
+	 * @param aPolicyID TPolicyID   Runtime's registered policy identifier
+	 * @param aHashMarker const TDesC& Hash value to identify script when starting script session
+	 * @param aTrustInfo CTrustInfo a valid instance of CTrustInfo object
+	 *
+	 * @return TExecutableID generated executable identifier if successul; Otherwise one of
+	 *					 	 system wide error codes
+	 *
+	 */
+	TExecutableID RegisterScript(TPolicyID aPolicyID, const TDesC& aHashMarker,
+			const CTrustInfo& aTrustInfo);
+
+	/**
+	 * De-Registers a script/executable. Runtimes should pass the previously registered
+	 * script identifier corresponding to the script to be de-registered.
+	 *
+	 *  Operation Code  : EUnRegisterScript
+	 * 	IPC Argument[0] : Script Identifier
+	 *  IPC Argument[1] : Policy Identifier
+	 *  IPC Argument[2] : Success code (as inOut parameter)
+	 *  IPC Argument[3] : none 
+	 * 
+	 * 
+	 * @param aExeID TExecutableID   A valid script identifier
+	 *
+	 * @return TInt One of sytem wide error codes in case of failure; Otherwise KErrNone
+	 *     
+	 */
+	TInt UnRegisterScript(TExecutableID aExeID, TPolicyID aPolicyID);
+
+
+private:
+
+	/**
+	 * Starts security manager server if it is not already started
+	 *
+	 * @return TInt One of sytem wide error codes in case of failure; Otherwise KErrNone
+	 *     
+	 */
+	TInt StartSecManagerServer() const;
+
+	/**
+	 * Returns security manager server location
+	 *
+	 * @return TFullName Server location path
+	 *     
+	 */
+	TFullName ServerLocation() const;
+	};
+
+/**
+ *
+ * Represents the client side sub-session handle. This class mainly
+ * communicates with the corresponding server side sub-session handle. 
+ * 
+ * The main reponsibilities of this class are :
+ * 
+ * 	- to store the pre-computed capability set of the script associated with the session object
+ *	- to invoke the prompt handler
+ *	- to notify the server sub-session object in case of permanent grant change
+ *
+ * @lib rtsecmgrclient.lib
+ */
+NONSHARABLE_CLASS(RSecMgrSubSession) : public RSubSessionBase
+	{
+public:
+	
+	RSecMgrSubSession();
+
+	/**
+	 * Opens client-side sub-session. The script session is modelled as a
+	 * client side sub-session with a peer server side sub-session.
+	 * 
+	 * @param aSession RSessionBase handle to client side session
+	 * @param aScriptInfo CScript	the underlying script object
+	 * @param aPolicyID TPolicyID	policy identifier of the runtime security policy associated with the
+	 * 								script
+	 * 
+	 * @return KErrNone if creation of sub-session is successful; In case of failure,
+	 * 		one of system-wide error codes
+	 */
+	TInt Open(const RSessionBase& aSession, CScript& aScriptInfo,
+			TPolicyID aPolicyID, const TDesC& aHashValue = KNullDesC());	
+	
+	/**
+	 * Opens client-side sub-session for an un-registered trusted script. The script session is modelled as a
+	 * client side sub-session with a peer server side sub-session.
+	 * 
+	 * @param aSession RSessionBase handle to client side session
+	 * @param aScriptInfo CScript	the underlying script object
+	 * @param aPolicyID TPolicyID	policy identifier of the runtime security policy associated with the
+	 * 								script
+	 * @param aTrustInfo CTrustInfo trust data structure
+	 * 
+	 * @return KErrNone if creation of sub-session is successful; In case of failure,
+	 * 		one of system-wide error codes
+	 */
+	TInt Open(const RSessionBase& aServer, CScript& aScriptInfo,
+			TPolicyID aPolicyID,const CTrustInfo& aTrustInfo);
+
+	/**
+	 * Closes the script session, inturn closing the sub-session on
+	 * either side of client and server
+	 * 
+	 */
+	void Close();
+
+	/**
+	 * Updates the blanket permission data of the script
+	 * 
+	 * @param aScriptID TExecutableID Identifier of the scipt
+	 * @param aPermGrant TPermGrant   Blanket allowed data
+	 * @param aPermDenied TPermGrant  Blanket denied data
+	 * 
+	 * @return KErrNone if update of blanket permission successul; Otherwise one of
+	 *					 system wide error codes
+	 * 
+	 */
+	TInt UpdatePermGrant(TExecutableID aScriptID, TPermGrant aPermGrant,
+			TPermGrant aPermDenied) const;
+
+	
+private:
+	
+	//CEikonEnv* iEnv;	
+	
+	RFs iFs;
+	};
+
+#endif //_R_RSECMGRSESSION_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/loc/rtsecmanager.loc	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,390 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Localisation file for RuntimeSecurityManager Client
+*
+*/
+
+
+
+
+
+
+
+
+// LOCALISATION STRINGS
+
+//d: Runtime security manager prompt header
+//l: heading_pane_t1
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_header  "Security Warning"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_commdd  "Application will need access to communications device. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_powermgmt  "Application needs to use Power Management functions. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_mmediadd  "Application needs access to camera, video player or audio features. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_read_devicedata  "Application needs to read device data. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_write_devicedata  "Application needs access to modify device data. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_drm  "Application needs to access DRM protected content. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_trustedui  "Application needs to create a secure session. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_protserv  "Application needs to access protected server. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_diskadmin  "Application needs to access, modify or format device memory. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_nwcontrol  "Application needs to access and modify network connection. Allow?"
+
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_allfiles  "Application needs to access and write to File System. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_swevent  "Application needs to capture key presses and joystick movement. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_nwservices  "Application needs to use network and send or receive data. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_localservices  "Application needs access to local connectivity. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_read_userdata  "Application needs to read user data. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_write_userdata  "Application needs to write user data.Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_location  "Application needs to access location information. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_surrdd  "Application needs to access a connected device. Allow?"
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_userenv  "Application needs to access user environment. Allow?"
+
+//d: Runtime security manager prompt dialog label
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_oneshot_yes "Once"
+
+//d: Runtime security manager prompt dialog label
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_oneshot_no "No"
+
+//d: Runtime security manager prompt dialog label
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_session_yes "For this session"
+
+
+//d: Runtime security manager prompt dialog label
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_perm_yes "Always"
+
+
+//d: Runtime security manager prompt dialog label
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_allow_oneshot "Yes"
+
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_userdata "Application needs to access user related data. Allow?"
+
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_deviceresources "Application needs to access device resources. Allow?"
+
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_query_network "Application needs to access network. Allow?"
+
+
+//d: Runtime security manager prompt text
+//l: popup_snote_single_text_window/opt1
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_prompt_cost_network "Use of the application may involve data transfer charges.  For further information contact your service provider."
+
+
+//d: Runtime security manager prompt dialog label
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_item_more_info "More Info"
+
+
+//d: Runtime security manager prompt dialog label
+//l: popup_info_list_pane_t1 
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_link_more_info "More Info"
+
+
+//d: Runtime security manager More Info prompt header
+//l: heading_pane_t1
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_header_userdata "User Data Group"
+
+
+//d: Runtime security manager More Info prompt header
+//l: heading_pane_t1
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_header_deviceresources "Device Resource Group"
+
+
+//d: Runtime security manager More Info prompt header
+//l: heading_pane_t1
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_header_network "Network Group"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_commdd "Communication Resources"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_mmediadd "Multimedia Recording"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_read_devicedata "Reading Device Data"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_write_devicedata "Writing Device Data"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_nwcontrol "Network Control"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_swevent "Software Events"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_nwservices "Network Services"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_localservices "Local Connectivity"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_read_userdata "Reading User Data"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_write_userdata "Writing User Data"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_location "Location/Landmark"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_surrdd "Surrounding Devices"
+
+
+//d: Runtime security manager prompt text
+//l: list_single_pane_t1_cp2
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_more_info_userenv "Accessories"
+
+
+//d: Runtime security manager prompt text
+//l: loc_type_pane 
+//w:
+//r:5.0
+//
+#define qtn_rtsecmgr_info_about_group  "Application needs following permissions from the group"
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmanager.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines CRTSecManager and CRTSecMgrClientProxy classes
+ *
+*/
+
+
+
+
+
+
+#include <coemain.h>
+#include <rtsecmanager.h>
+#include <rtsecmgrscriptsession.h>
+#include "rtsecmgrclient.h"
+#include "rtsecmgrtracer.h"
+
+/**
+ * Proxy delegate class for runtime security manager client-side
+ * session handle.
+ * 
+ * @lib rtsecmgrclient.lib
+ */
+class CRTSecMgrClientProxy : public CBase
+	{
+public:
+	CRTSecMgrClientProxy()
+		{
+		}
+
+	void ConstructL()
+		{
+		User::LeaveIfError (iSecSession.Connect ());
+		}
+
+	static CRTSecMgrClientProxy* NewL()
+		{
+		CRTSecMgrClientProxy* self = CRTSecMgrClientProxy::NewLC ();
+		CleanupStack::Pop (self);
+		return self;
+		}
+
+	static CRTSecMgrClientProxy* NewLC()
+		{
+		CRTSecMgrClientProxy* self = new (ELeave) CRTSecMgrClientProxy();
+		CleanupStack::PushL (self);
+		self->ConstructL ();
+		return self;
+		}
+
+	virtual ~CRTSecMgrClientProxy()
+		{
+		iSecSession.Close ();
+		}
+
+	RSecMgrSession& Session()
+		{
+		return iSecSession;
+		}
+	RSecMgrSession* operator ->()
+	{
+		return &iSecSession;
+	}
+private:
+	RSecMgrSession iSecSession;
+	};
+
+// ---------------------------------------------------------------------------
+// Defintiion of default private constructor
+// ---------------------------------------------------------------------------
+//
+CRTSecManager::CRTSecManager()
+	{
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of second phase constructor
+//
+// Instantiates client proxy object, in turn creating a client-side
+// session
+// ---------------------------------------------------------------------------
+//
+void CRTSecManager::ConstructL()
+	{
+	iClientProxy = CRTSecMgrClientProxy::NewL ();
+
+#ifdef _DEBUG
+	if(CCoeEnv::Static())
+	{
+	CCoeEnv::Static()->DisableExitChecks(ETrue); 
+	}	
+#endif
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of second phase constructor
+//
+// Constructs a CRTSecManager instance
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRTSecManager* CRTSecManager::NewL()
+	{
+	RTSecMgrCreateTraceFile() ;
+	CRTSecManager* self = CRTSecManager::NewLC();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of second phase constructor
+//
+// Constructs a CRTSecManager instance and leaves the created instance
+// on the cleanupstack
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRTSecManager* CRTSecManager::NewLC()
+	{
+	CRTSecManager* self = new (ELeave) CRTSecManager();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Destructor
+//
+// Closes client-side session in turn closing the peer server
+// side session
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRTSecManager::~CRTSecManager()
+	{
+	delete iClientProxy;
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of SetPolicy
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TPolicyID CRTSecManager::SetPolicy(const RFile& aSecPolicy)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::SetPolicy(const RFile& aSecPolicy)") ;
+	return (*iClientProxy)->SetPolicy(aSecPolicy);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of SetPolicy
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TPolicyID CRTSecManager::SetPolicy(const TDesC8& aPolicyBuffer)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::SetPolicy(const TDesC8& aPolicyBuffer)") ;
+	return (*iClientProxy)->SetPolicy(aPolicyBuffer);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of UnSetPolicy
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CRTSecManager::UnSetPolicy(TPolicyID aPolicyID)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::UnSetPolicy(TPolicyID aPolicyID)") ;
+	return (*iClientProxy)->UnSetPolicy(aPolicyID);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of UpdatePolicy
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TPolicyID CRTSecManager::UpdatePolicy(TPolicyID aPolicyID,const RFile& aSecPolicy)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::UpdatePolicy(TPolicyID aPolicyID,const RFile& aSecPolicy)") ;
+	return (*iClientProxy)->UpdatePolicy(aPolicyID,aSecPolicy);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of UpdatePolicy
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TPolicyID CRTSecManager::UpdatePolicy(TPolicyID aPolicyID,const TDesC8& aPolicyBuffer)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::UpdatePolicy(TPolicyID aPolicyID,const TDesC8& aPolicyBuffer)") ;
+	return (*iClientProxy)->UpdatePolicy(aPolicyID,aPolicyBuffer);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of RegisterScript
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TExecutableID CRTSecManager::RegisterScript(TPolicyID aPolicyID, const CTrustInfo& aTrustInfo)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::RegisterScript(TPolicyID aPolicyID, const CTrustInfo& aTrustInfo)") ;
+	return (*iClientProxy)->RegisterScript(aPolicyID,aTrustInfo);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of RegisterScript with script having hash value
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TExecutableID CRTSecManager::RegisterScript(TPolicyID aPolicyID, const TDesC& aHashMarker, const CTrustInfo& aTrustInfo)
+	{
+    RTSecMgrTraceFunction("CRTSecManager::RegisterScript(TPolicyID aPolicyID, const TDesC& aHashMarker, const CTrustInfo& aTrustInfo)") ;
+	return (*iClientProxy)->RegisterScript(aPolicyID,aHashMarker,aTrustInfo);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of UnRegisterScript
+//
+// This method delegates the actual handling to the client-side session
+// handle class
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CRTSecManager::UnRegisterScript(TExecutableID aExeID, TPolicyID aPolicyID)
+	{
+    RTSecMgrTraceFunction("CRTSecManager::UnRegisterScript(TExecutableID aExeID, TPolicyID aPolicyID)") ;
+	return (*iClientProxy)->UnRegisterScript(aExeID,aPolicyID);
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of GetScriptSession
+//
+// This method starts a client-side sub-session handle, modelling script
+// session. This in turn creates a server-side peer sub-session handle
+// ---------------------------------------------------------------------------
+/*EXPORT_C CRTSecMgrScriptSession* CRTSecManager::GetScriptSession(TPolicyID aPolicyID,
+		TExecutableID aExecID,
+		MSecMgrPromptHandler* aPromptHdlr,const TDesC& aHashValue)
+	{
+	if(aExecID<=KAnonymousScript)
+		return NULL;
+
+	CRTSecMgrScriptSession* scriptSession = CRTSecMgrScriptSession::NewLC(aPromptHdlr);
+
+	if(KErrNone==scriptSession->Open(iClientProxy->Session(),aPolicyID,aExecID))
+		{
+		CleanupStack::Pop(scriptSession);
+		return scriptSession;
+		}
+
+	if(scriptSession)
+		CleanupStack::PopAndDestroy(scriptSession);
+
+	return NULL;
+	}*/
+
+
+// ---------------------------------------------------------------------------
+// Definition of GetScriptSession
+//
+// This method starts a client-side sub-session handle, modelling script
+// session. This in turn creates a server-side peer sub-session handle
+// ---------------------------------------------------------------------------
+EXPORT_C CRTSecMgrScriptSession* CRTSecManager::GetScriptSessionL(TPolicyID aPolicyID,
+		const CTrustInfo& aTrustInfo,
+		MSecMgrPromptHandler* aPromptHdlr)
+	{
+    RTSecMgrTraceFunction("CRTSecManager::GetScriptSession(TPolicyID aPolicyID,\
+		                   const CTrustInfo& aTrustInfo,\
+		                   MSecMgrPromptHandler* aPromptHdlr)") ;
+	CRTSecMgrScriptSession* scriptSession = CRTSecMgrScriptSession::NewLC(aPromptHdlr);
+
+	if(KErrNone==scriptSession->Open(iClientProxy->Session(),aPolicyID,KAnonymousScript,aTrustInfo))
+		{
+		CleanupStack::Pop(scriptSession);
+		return scriptSession;
+		}
+
+	if(scriptSession)
+		CleanupStack::PopAndDestroy(scriptSession);
+
+	return NULL;
+	}
+
+// ---------------------------------------------------------------------------
+// Definition of GetScriptSession
+//
+// This method starts a client-side sub-session handle, modelling script
+// session. This in turn creates a server-side peer sub-session handle
+// ---------------------------------------------------------------------------
+EXPORT_C CRTSecMgrScriptSession* CRTSecManager::GetScriptSessionL(TPolicyID aPolicyID,
+		TExecutableID aExecID,
+		MSecMgrPromptHandler* aPromptHdlr,
+		const TDesC& aHashValue)
+	{
+	RTSecMgrTraceFunction("CRTSecManager::GetScriptSession(TPolicyID aPolicyID,\
+		                   TExecutableID aExecID,MSecMgrPromptHandler* aPromptHdlr,\
+		                   const TDesC& aHashValue)") ;
+	if(aExecID<=KAnonymousScript)
+		return NULL;
+	
+	CRTSecMgrScriptSession* scriptSession = CRTSecMgrScriptSession::NewLC(aPromptHdlr);
+
+	if(KErrNone==scriptSession->Open(iClientProxy->Session(),aPolicyID,aExecID,aHashValue))
+		{
+		CleanupStack::Pop(scriptSession);
+		return scriptSession;
+		}
+
+	if(scriptSession)
+		CleanupStack::PopAndDestroy(scriptSession);
+
+	return NULL;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmgrclient.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,591 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines security manager client side session and sub-session classes
+ *
+*/
+
+
+
+
+
+
+
+#include <coemain.h>
+#include <bautils.h>
+#include <s32file.h>
+#include <eikenv.h>
+#include <rtsecmgrscript.h>
+#include "rtsecmgrmsg.h"
+#include "rtsecmgrdef.h"
+#include "rtsecmgrclient.h"
+#include "rtsecmgrtracer.h"
+
+#ifdef _DEBUG
+_LIT(KServerStartFailed, "Security manager server starting failed");
+#endif
+
+// ---------------------------------------------------------------------------
+// Defintiion of default private constructor
+// ---------------------------------------------------------------------------
+//
+RSecMgrSession::RSecMgrSession()
+	{	
+	}
+
+// ---------------------------------------------------------------------------
+// Connects to the runtime security manager server
+//
+// This function attemtps to kick start security manager server if
+// it is not running already. The number of attempts is currently 2.
+// The number of message slot is defaulted to 4.
+// ---------------------------------------------------------------------------
+//
+TInt RSecMgrSession::Connect()
+	{
+	RTSecMgrTraceFunction("RSecMgrSession::Connect()") ;
+	TInt retry(KSecSrvClientTryCount); // Try this twice
+	TInt err(KErrNone);
+	while (retry>KErrNone)
+		{
+		// Try to create a Server session
+		err = CreateSession ( KSecServerProcessName, Version (),
+				KDefaultMessageSlots);
+
+		if ( err != KErrNotFound && err != KErrServerTerminated)
+			{
+			// KErrNone or unrecoverable error
+			if ( err != KErrNone)
+				{
+#ifdef _DEBUG
+				RDebug::Print(KServerStartFailed);
+#endif
+				}
+			retry = 0;
+			}
+		else
+			{
+			// Return code was KErrNotFound or KErrServerTerminated.
+			// Try to start a new security manager server instance
+			err = StartSecManagerServer ();
+			if ( err != KErrNone && err != KErrAlreadyExists)
+				{
+				// Unrecoverable error
+#ifdef _DEBUG
+				RDebug::Print(KServerStartFailed);
+#endif
+				retry = 0;
+				}
+			}
+
+		retry--;
+		}
+	return (err);
+	}
+
+// ---------------------------------------------------------------------------
+// Starts runtime security manager server
+//
+// ---------------------------------------------------------------------------
+//
+TInt RSecMgrSession::StartSecManagerServer() const
+	{
+	RTSecMgrTraceFunction("RSecMgrSession::StartSecManagerServer()") ;
+	RProcess server;
+	const TUidType serverUid( KNullUid, KSecMgrServerUid2, KNullUid);
+	TInt err = server.Create ( ServerLocation (), 
+			KNullDesC, 
+			serverUid, 
+			EOwnerProcess);
+
+	// Return error code if we the process couldn't be created
+	if ( KErrNone == err)
+		{
+		// Rendezvous is used to detect server start
+		TRequestStatus status;
+		server.Rendezvous ( status);
+		if ( status != KRequestPending)
+			{
+			// Log Abort Error
+#ifdef _DEBUG
+			RDebug::Print(KServerStartFailed);
+#endif			
+			server.Kill ( 0); // Abort startup
+			}
+		else
+			{
+			server.Resume (); // Logon OK - start the server
+			}
+		User::WaitForRequest (status); // Wait for start or death
+
+		if ( server.ExitType ()== EExitPanic)
+			{
+#ifdef _DEBUG
+			RDebug::Print(KServerStartFailed);
+#endif
+			err = KErrGeneral;
+			}
+		else
+			{
+			err = status.Int ();
+			}
+
+		// We can close the handle now
+		server.Close ();
+		}
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns runtime security manager server location
+//
+// ---------------------------------------------------------------------------
+//
+TFullName RSecMgrSession::ServerLocation() const
+	{
+	TFullName fullPathAndName;
+	fullPathAndName.Append ( KSecMgrServerExeName);
+	return fullPathAndName;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns the earliest version number of the security manager server
+//
+// ---------------------------------------------------------------------------
+//
+TVersion RSecMgrSession::Version(void) const
+	{
+	return (TVersion(KRTSecMgrServMajorVersionNumber,KRTSecMgrServMinorVersionNumber,KRTSecMgrServBuildVersionNumber));
+	}
+
+// ---------------------------------------------------------------------------
+// A request to close the session.
+//
+// It makes a call to the server, which deletes the object container and object index
+// for this session, before calling Close() on the base class.
+// ---------------------------------------------------------------------------
+//
+void RSecMgrSession::Close()
+	{
+	if(iHandle)
+		{		
+		SendReceive (ESecServCloseSession);
+		RSessionBase::Close();
+		}
+	}
+
+//
+// Registers the runtime security policy with security manager. This method
+// packs the message parameters required for registering the policy. 
+// 
+// The various parameters required for SetPolicy operation are :
+// 	
+//  Operation Code  : ESetPolicy
+// 	IPC Argument[0] : Policy Identifier (as inOut parameter)
+//  IPC Argument[1] : SecurityPolicy FileHandle
+//  IPC Argument[2] : SecurityPolicy FileSession object
+//  IPC Argument[3] : none
+// 
+TInt RSecMgrSession::SetPolicy(const RFile& aSecPolicy)
+	{
+	TPckgBuf<TInt> pckgPId;
+	TIpcArgs args(&pckgPId);
+
+	TInt ret = aSecPolicy.TransferToServer (args, EMsgArgOne,
+			EMsgArgTwo);
+
+	if ( KErrNone==ret)
+		{
+		ret = SendReceive (ESetPolicy, args);
+
+		if ( KErrNone==ret)
+			return pckgPId (); // Extract the policyID returned from the server. 
+		}
+
+	return ret;
+	}
+
+TPolicyID RSecMgrSession::SetPolicy(const TDesC8& aPolicyBuffer)
+	{	
+	TInt ret(ErrInvalidParameters);
+	if(0==aPolicyBuffer.CompareC(KNullDesC8))
+		{
+		return ret;
+		}
+		
+		TFileName tempDirPath;
+		TFileName tempPath;
+	
+		{
+		RFs fileSession;
+		if ( KErrNone==fileSession.Connect ())
+			{
+			fileSession.PrivatePath (tempDirPath);
+			BaflUtils::EnsurePathExistsL (fileSession, tempDirPath);
+
+			RFile secPolicyFile;
+			secPolicyFile.Temp (fileSession, tempDirPath, tempPath, EFileWrite);
+			secPolicyFile.Write(aPolicyBuffer);
+			secPolicyFile.Close();			
+			}		
+		fileSession.Close();
+		}
+		
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if ( KErrNone==fileSession.ShareProtected ())
+			{
+			RFile secPolicyFile;
+					
+			if(KErrNone == secPolicyFile.Open(fileSession,tempPath,EFileRead))
+				{
+				ret = SetPolicy (secPolicyFile);
+			
+				secPolicyFile.Close();
+					
+				}
+			
+			fileSession.Delete (tempPath);
+			}
+		
+		CleanupStack::PopAndDestroy (&fileSession);//fileSession
+		}
+
+	fileSession.Close();
+	
+	return ret;
+	}
+
+//
+// UnRegisters a registered security policy. Runtimes should call this function
+// to de-register the already registered security policy.
+// 
+// The various parameters required for UnSetPolicy operation are :
+// 	
+// Operation Code  : EUnsetPolicy
+// IPC Argument[0] : Policy Identifier to un-register
+// IPC Argument[1] : Successcode (as inOut parameter)
+// IPC Argument[2] : none
+// IPC Argument[3] : none
+// 
+TInt RSecMgrSession::UnSetPolicy(TPolicyID aPolicyID)
+	{
+	if ( aPolicyID<=KErrNone)
+		return ErrInvalidPolicyID;
+
+	TPckgBuf<TInt> sucess(KErrNone);
+	TIpcArgs args(aPolicyID, &sucess);
+
+	TInt ret = SendReceive (EUnsetPolicy, args);
+
+	if ( KErrNone==ret)
+		return sucess (); // Extract the value returned from the server. 
+
+	return ret;
+	}
+
+//
+// Updates an already registered security policy. Runtimes should call this function
+// to update their policy.
+// 
+// The various parameters required for UpdatePolicy operation are :
+// 	
+// Operation Code  : EUpdatePolicy
+// IPC Argument[0] : Policy Identifier
+// IPC Argument[1] : SecurityPolicy FileHandle
+// IPC Argument[2] : SecurityPolicy FileSession object
+// IPC Argument[3] : none
+// 
+TPolicyID RSecMgrSession::UpdatePolicy(TPolicyID aPolicyID,
+		const RFile& aSecPolicy)
+	{
+	if ( aPolicyID<=KErrNone)
+		{
+		return ErrInvalidPolicyID;
+		}
+
+	TPckgBuf<TInt> pckgPID(aPolicyID);
+	TIpcArgs args(&pckgPID);
+
+	TInt ret = aSecPolicy.TransferToServer (args, EMsgArgOne,
+			EMsgArgTwo);
+
+	if ( KErrNone==ret)
+		{
+		ret = SendReceive (EUpdatePolicy, args);
+
+		if ( KErrNone==ret)
+			ret = pckgPID ();
+		}
+
+	return ret;
+	}
+
+TPolicyID RSecMgrSession::UpdatePolicy(TPolicyID aPolicyID,
+		const TDesC8& aPolicyBuffer)
+	{
+	TInt ret(ErrInvalidParameters);
+	if(0==aPolicyBuffer.CompareC(KNullDesC8))
+		{
+		return ret;
+		}
+		
+		TFileName tempDirPath;
+		TFileName tempPath;
+	
+		{
+		RFs fileSession;
+		if ( KErrNone==fileSession.Connect ())
+			{
+			fileSession.PrivatePath (tempDirPath);
+			BaflUtils::EnsurePathExistsL (fileSession, tempDirPath);
+
+			RFile secPolicyFile;
+			secPolicyFile.Temp (fileSession, tempDirPath, tempPath, EFileWrite);
+			secPolicyFile.Write(aPolicyBuffer);
+			secPolicyFile.Close();			
+			}		
+		fileSession.Close();
+		}
+		
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if ( KErrNone==fileSession.ShareProtected ())
+			{
+			RFile secPolicyFile;
+					
+			if(KErrNone == secPolicyFile.Open(fileSession,tempPath,EFileRead))
+				{
+				
+				ret = UpdatePolicy (aPolicyID, secPolicyFile);
+			
+				secPolicyFile.Close();
+			
+				}
+
+			fileSession.Delete (tempPath);
+			}
+		
+		CleanupStack::PopAndDestroy (&fileSession);//fileSession
+		}
+
+	fileSession.Close();
+	
+	return ret;
+	}
+
+//
+// Registers a script/executable. Runtimes should specify the trust information
+// of the script to be registered. 
+// 
+// Operation Code  : ERegisterScript
+// IPC Argument[0] : Policy Identifier
+// IPC Argument[1] : Script Identifier (as inOut Parameter)
+// IPC Argument[2] : none
+// IPC Argument[3] : none 
+// 
+TExecutableID RSecMgrSession::RegisterScript(TPolicyID aPolicyID, const CTrustInfo& /*aTrustInfo*/)
+	{
+	if ( aPolicyID<KErrNone)
+		return ErrInvalidPolicyID;
+
+	TPckgBuf<TInt> scriptID(KAnonymousScript);
+	TIpcArgs args(aPolicyID, &scriptID);
+
+	TInt result = SendReceive (ERegisterScript, args);
+
+	if ( KErrNone==result)
+		result=scriptID ();
+
+	return result;
+	}
+
+//
+// Registers a script/executable. Runtimes should specify the trust information
+// of the script to be registered. 
+// 
+// Operation Code  : ERegisterScript
+// IPC Argument[0] : Policy Identifier
+// IPC Argument[1] : Script Identifier (as inOut Parameter)
+// IPC Argument[2] : Hash value of script
+// IPC Argument[3] : none
+// 
+TExecutableID RSecMgrSession::RegisterScript(TPolicyID aPolicyID,
+		const TDesC& aHashMarker, const CTrustInfo& /*aTrustInfo*/)
+	{
+	__UHEAP_MARK;
+
+	if(!(aHashMarker.Compare(KNullDesC)))
+		return ErrInvalidParameters;
+	CRTSecMgrRegisterScriptMsg* scriptMsg = CRTSecMgrRegisterScriptMsg::NewL (
+			aPolicyID, aHashMarker);
+ 
+	HBufC8* dataDes(NULL);
+	TRAPD(ret, dataDes = scriptMsg->PackMsgL());
+	if ( dataDes)
+		{
+		TExecutableID scriptID(KAnonymousScript);
+		TPckgBuf<TInt> scriptIDBuf(scriptID);
+		TIpcArgs args(dataDes, &scriptIDBuf);
+		
+		ret = SendReceive (ERegisterScriptWithHash, args);
+		delete dataDes;
+		
+		if(KErrNone==ret)
+			ret = scriptIDBuf();
+		}
+
+	delete scriptMsg;
+
+	__UHEAP_MARKEND;
+
+	return ret;
+	}
+
+//
+// De-Registers a script/executable. Runtimes should pass the previously registered
+// script identifier corresponding to the script to be de-registered.
+// 
+// Operation Code  : EUnRegisterScript
+// IPC Argument[0] : Script Identifier
+// IPC Argument[1] : Policy Identifier
+// IPC Argument[2] : Success code (as inOut parameter)
+// IPC Argument[3] : none 
+//  
+TInt RSecMgrSession::UnRegisterScript(TExecutableID aExeID, TPolicyID aPolicyID)
+	{
+	if (aExeID<=KErrNone) 
+		return ErrInvalidScriptID;
+	if (aPolicyID<=KErrNone)
+		return ErrInvalidPolicyID;
+
+	TPckgBuf<TInt> errCode(KErrNone);
+	TIpcArgs args(aExeID, aPolicyID, &errCode);
+
+	TInt result = SendReceive (EUnRegisterScript, args);
+
+	if ( KErrNone==result)
+		return errCode ();
+
+	return result;
+	}
+
+RSecMgrSubSession::RSecMgrSubSession()
+	{	
+	
+	}
+//
+// Opens client-side sub-session for a registered script. The script session is modelled as a
+// client side sub-session with a peer server side sub-session.
+// 
+TInt RSecMgrSubSession::Open(const RSessionBase& aSession,
+		CScript& aScriptInfo, TPolicyID aPolicyID, const TDesC& aHashValue)
+	{
+	TIpcArgs args(aScriptInfo.ScriptID (), aPolicyID);
+
+	TInt errCode(KErrNone);
+	errCode = iFs.Connect();
+	if(errCode == KErrNone)
+    	{
+    	if ( KAnonymousScript==aScriptInfo.ScriptID ())
+    		errCode = CreateSubSession (aSession, EGetTrustedUnRegScriptSession,
+    				args);
+    	else
+    		errCode = CreateSubSession (aSession, EGetScriptSession, args);
+    
+    	if ( errCode==KErrNone)
+    		{
+    		// Retrieve the RFs and RFile handles from the server
+    		TPckgBuf<TInt> fh; // sub-session (RFile) handle
+    		TIpcArgs args(&fh);
+    
+    		RFile file;
+    		CleanupClosePushL(file);
+    
+    		if ( KErrNone==errCode)
+    			{
+    			iFs.ShareProtected ();
+    
+    			TFileName tempDirPath;
+    			TFileName tempPath;
+    
+    			iFs.PrivatePath (tempDirPath);
+    			BaflUtils::EnsurePathExistsL (iFs, tempDirPath);
+    
+    			errCode = file.Temp (iFs, tempDirPath, tempPath, EFileWrite);
+    
+    			if ( KErrNone==errCode)
+    				{
+    				file.TransferToServer (args, EMsgArgOne, EMsgArgTwo);
+    				errCode = SendReceive (EGetScriptFile, args);
+    
+    				if ( KErrNone==errCode)
+    					{
+    					RFileReadStream rfs(file);
+    					CleanupClosePushL(rfs);
+    					aScriptInfo.InternalizeL (rfs);
+    					TBufC<KMaxPath> hashValue(aScriptInfo.Hash());
+    					if(0 != hashValue.Compare(KNullDesC))
+    						{
+    						if(!aScriptInfo.HashMatch(aHashValue))
+    							{
+    							//hash check failed
+    							errCode = KErrNotFound;
+    							}						
+    						}
+    					
+    					CleanupStack::PopAndDestroy(&rfs);
+    					}
+    				}
+    			iFs.Delete (tempPath);
+    			}
+    
+    		CleanupStack::PopAndDestroy(&file);
+    		}
+    	}
+	return errCode;
+	}
+
+//
+// Opens client-side sub-session for an un-registered trusted script. The script session is modelled as a
+// client side sub-session with a peer server side sub-session.
+// 
+TInt RSecMgrSubSession::Open(const RSessionBase& aSession,
+		CScript& aScriptInfo, TPolicyID aPolicyID, const CTrustInfo& /*aTrustInfo*/)
+	{	
+	return Open (aSession, aScriptInfo, aPolicyID);
+	}
+
+//
+// Updates the blanket permission data of the script
+// 
+TInt RSecMgrSubSession::UpdatePermGrant(TExecutableID aScriptID,
+		TPermGrant aPermGrant, TPermGrant aPermDenied) const
+	{
+	TIpcArgs args(aScriptID, (TInt)aPermGrant, (TInt)aPermDenied);
+	return SendReceive (EUpdatePermanentGrant, args);
+	}
+
+//
+// Close the subsession.
+//
+void RSecMgrSubSession::Close()
+	{
+	iFs.Close();
+	RSubSessionBase::CloseSubSession (ECloseScriptSession);
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmgrscriptsession.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,1215 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines runtime security manager script session class
+ *
+*/
+
+
+
+
+
+
+#include <aknlistquerydialog.h>
+#include <aknquerydialog.h>
+#include <aknmessagequerycontrol.h>
+#include <aknmessagequerydialog.h> 
+#include <badesca.h>
+#include <bautils.h>
+#include <coemain.h>
+#include <data_caging_path_literals.hrh>
+#include <eikenv.h>
+#include <eikfrlb.h>
+#include <eikfrlbd.h>
+#include <pathinfo.h> 
+#include <stringloader.h>
+
+#include <rtsecmanager.h>
+#include <rtsecmgrscriptsession.h>
+#include <rtsecmgrscript.h>
+#include "rtsecmgrclient.h"
+#include "rtsecmgrdef.h"
+
+//security manager resource file literal
+_LIT(KSecMgrResourceFile, "RTSecManager.RSC");
+
+//constant for descriptor array granularity
+const TInt KDescArrayInit = 6;
+const TInt KMaxBuf=256;
+
+//typedef of selection index array
+typedef RArray<TInt> RSelIdxArray;
+
+//static resource IDs for capability text display in default prompt
+static const TInt CAPABILITY_RESOURCEID[KCapabilitySize] =
+	{
+	0, //ECapabilityTCB (0) 
+	R_RTSECMGR_COMMDD, //ECapabilityCommDD (1)
+	R_RTSECMGR_POWERMGMT, //ECapabilityPowerMgmt (2)
+	R_RTSECMGR_MMEDIADD, //ECapabilityMultimediaDD (3)
+	R_RTSECMGR_READDEVICEDATA, //ECapabilityReadDeviceData (4)
+	R_RTSECMGR_WRITEDEVICEDATA, //ECapabilityWriteDeviceData (5)
+	R_RTSECMGR_DRM, //ECapabilityDRM (6)
+	R_RTSECMGR_TRUSTEDUI, //ECapabilityTrustedUI (7)
+	R_RTSECMGR_PROTSERV, //ECapabilityProtServ (8)
+	R_RTSECMGR_DISKADMIN, //ECapabilityDiskAdmin (9)
+	R_RTSECMGR_NWCONTROL, //ECapabilityNetworkControl (10)
+	R_RTSECMGR_ALLFILES, //ECapabilityAllFiles (11)
+	R_RTSECMGR_SWEVENT, //ECapabilitySwEvent (12)
+	R_RTSECMGR_NWSERVICES, //ECapabilityNetworkServices (13)
+	R_RTSECMGR_LOCALSERVICES, //ECapabilityLocalServices (14)
+	R_RTSECMGR_READUSERDATA, //ECapabilityReadUserData (15)
+	R_RTSECMGR_WRITEUSERDATA, //ECapabilityWriteUserData (16)
+	R_RTSECMGR_LOCATION, //ECapabilityLocation (17)
+	R_RTSECMGR_SURRDD, //ECapabilitySurroundingsDD (18)
+	R_RTSECMGR_USERENV	//ECapabilityUserEnvironment (19)					
+		};
+
+static const TInt MOREINFO_CAP_RESOURCEID[KCapabilitySize] = 
+	{
+	0, //ECapabilityTCB (0) 
+	R_RTSECMGR_MORE_INFO_COMMDD, //ECapabilityCommDD (1)
+	R_RTSECMGR_POWERMGMT, //ECapabilityPowerMgmt (2)
+	R_RTSECMGR_MORE_INFO_MMEDIADD, //ECapabilityMultimediaDD (3)
+	R_RTSECMGR_MORE_INFO_READDEVICEDATA, //ECapabilityReadDeviceData (4)
+	R_RTSECMGR_MORE_INFO_WRITEDEVICEDATA, //ECapabilityWriteDeviceData (5)
+	0, //ECapabilityDRM (6)
+	0, //ECapabilityTrustedUI (7)
+	0, //ECapabilityProtServ (8)
+	0, //ECapabilityDiskAdmin (9)
+	R_RTSECMGR_MORE_INFO_NWCONTROL, //ECapabilityNetworkControl (10)
+	0, //ECapabilityAllFiles (11)
+	R_RTSECMGR_MORE_INFO_SWEVENT, //ECapabilitySwEvent (12)
+	R_RTSECMGR_MORE_INFO_NWSERVICES, //ECapabilityNetworkServices (13)
+	R_RTSECMGR_MORE_INFO_LOCALSERVICES, //ECapabilityLocalServices (14)
+	R_RTSECMGR_MORE_INFO_READ_USERDATA, //ECapabilityReadUserData
+	R_RTSECMGR_MORE_INFO_WRITE_USERDATA,//ECapabilityWriteUserData
+	R_RTSECMGR_MORE_INFO_LOCATION,//ECapabilityLocation
+	R_RTSECMGR_MORE_INFO_SURRDD, //ECapabilitySurroundingsDD
+	R_RTSECMGR_MORE_INFO_USERENV //ECapabilityUserEnvironment
+	};
+
+struct TCallbackParam
+{
+	CRTSecMgrScriptSession* iRTSecMgrScriptSession;
+	CPromptData *iPromptData;	
+};
+
+/**
+ * Proxy delegate class for runtime security manager client-side
+ * sub-session handle.
+ * 
+ * @lib rtsecmgrclient.lib
+ */
+class CRTSecMgrSubSessionProxy : public CBase
+	{
+public:
+
+	static CRTSecMgrSubSessionProxy* NewL()
+		{
+		CRTSecMgrSubSessionProxy* self = CRTSecMgrSubSessionProxy::NewLC ();
+		CleanupStack::Pop (self);
+		return self;
+		}
+
+	static CRTSecMgrSubSessionProxy* NewLC()
+		{
+		CRTSecMgrSubSessionProxy* self = new (ELeave) CRTSecMgrSubSessionProxy();
+		CleanupStack::PushL (self);
+		self->ConstructL ();
+		return self;
+		}
+
+	virtual ~CRTSecMgrSubSessionProxy()
+		{
+		iSubSession.Close ();
+		}
+
+	inline RSecMgrSubSession& SubSession()
+		{
+		return iSubSession;
+		}
+	RSecMgrSubSession* operator ->()
+	{
+	return &iSubSession;
+	}
+private:
+	inline CRTSecMgrSubSessionProxy()
+		{
+		}
+	void ConstructL()
+		{
+		}
+
+	RSecMgrSubSession iSubSession;
+	};
+
+// ---------------------------------------------------------------------------
+// Defintiion of default private constructor
+// ---------------------------------------------------------------------------
+//
+CRTSecMgrScriptSession::CRTSecMgrScriptSession(MSecMgrPromptHandler* aPromptHdlr) :
+	iPermBits(KDefaultNullBit), iDeniedBits(KDefaultNullBit),
+			iPromptHdlr(aPromptHdlr), iUIPromptOption(RTPROMPTUI_DEFAULT), isCustomPrompt(EFalse)
+	{
+	_sessionInfo.AllowedCaps = KDefaultNullBit;
+	_sessionInfo.DeniedCaps = KDefaultNullBit;
+}
+
+// ---------------------------------------------------------------------------
+// Defintiion of second-phase constructor
+// ---------------------------------------------------------------------------
+//
+CRTSecMgrScriptSession* CRTSecMgrScriptSession::NewL(
+		MSecMgrPromptHandler* aPromptHdlr)
+	{
+	CRTSecMgrScriptSession* self = CRTSecMgrScriptSession::NewLC (aPromptHdlr);
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Defintiion of second-phase constructor
+// ---------------------------------------------------------------------------
+//
+CRTSecMgrScriptSession* CRTSecMgrScriptSession::NewLC(
+		MSecMgrPromptHandler* aPromptHdlr)
+	{
+	CRTSecMgrScriptSession* self = new (ELeave) CRTSecMgrScriptSession(aPromptHdlr);
+	CleanupStack::PushL (self);
+	self->ConstructL ();
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Defintiion of second-phase constructor
+// This method instantiates client side sub-session proxy instance.
+// In addition, this method loads the security manager resource
+// ---------------------------------------------------------------------------
+//
+void CRTSecMgrScriptSession::ConstructL()
+	{
+	iCoeEnv = CCoeEnv::Static ();
+	if ( !iCoeEnv && !iPromptHdlr)
+		User::Leave (KErrNotSupported);
+
+	iSubSessionProxy = CRTSecMgrSubSessionProxy::NewL ();
+
+	if ( !iPromptHdlr)
+	    {
+	    iPromptHdlr = this; //default prompt handler	
+	    isCustomPrompt = ETrue ;
+	    }
+				
+
+	}
+
+void CRTSecMgrScriptSession::AddResourceFiles()
+    {
+        if(iCoeEnv)
+        {
+            
+        CDesCArray* diskList = new (ELeave) CDesCArrayFlat(KDescArrayInit);
+        CleanupStack::PushL (diskList);
+
+        BaflUtils::GetDiskListL (iCoeEnv->FsSession (), *diskList);
+        for (TInt idx(0); idx<diskList->Count ();++idx)
+            {
+            TInt intDrive;
+            TChar ch = ((*diskList)[idx])[0];
+            RFs::CharToDrive (ch, intDrive);
+            TDriveUnit curDrive(intDrive);
+
+            TFileName resFile(curDrive.Name ());
+            resFile.Append (KDC_APP_RESOURCE_DIR);
+            resFile.Append (KSecMgrResourceFile);
+            BaflUtils::NearestLanguageFile (iCoeEnv->FsSession (), resFile);
+            if ( BaflUtils::FileExists (iCoeEnv->FsSession (), resFile))
+                {
+                TRAPD (err, iResourceOffset = iCoeEnv->AddResourceFileL (resFile));
+                User::LeaveIfError (err);
+                break;
+                }
+            }
+
+        CleanupStack::PopAndDestroy (diskList);
+        }        
+    }
+
+void CRTSecMgrScriptSession::CloseResourceFiles()
+    {
+    if ( iResourceOffset && iCoeEnv)
+            iCoeEnv->DeleteResourceFile (iResourceOffset);
+	iResourceOffset = 0;
+    }
+// ---------------------------------------------------------------------------
+// Destructor
+// Closes script sub-session handle
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CRTSecMgrScriptSession::~CRTSecMgrScriptSession()
+	{
+	Close ();
+	}
+
+// ---------------------------------------------------------------------------
+// Opens script session, in turn opening client-side sub-session handle
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::Open(const RSessionBase& aParentSession,
+		TPolicyID aPolicyID, TExecutableID aExecID)
+	{
+	if (iScript)
+		{
+		delete iScript;
+		iScript = NULL;
+		}
+	
+	iScript = CScript::NewL (aPolicyID, aExecID);
+
+	TInt ret((*iSubSessionProxy)->Open (aParentSession, *iScript, aPolicyID));
+	if ( KErrNone==ret)
+		{
+		iPermBits = iScript->PermGranted ();
+		iDeniedBits = iScript->PermDenied ();
+		}
+
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Opens script session, in turn opening client-side sub-session handle
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::Open(const RSessionBase& aParentSession,
+		TPolicyID aPolicyID, TExecutableID aExecID, const TDesC& aHashValue)
+	{
+	if (iScript)
+		{
+		delete iScript;
+		iScript = NULL;
+		}
+	
+	iScript = CScript::NewL (aPolicyID, aExecID);
+	TInt ret((*iSubSessionProxy)->Open (aParentSession, *iScript, aPolicyID, aHashValue));
+	if ( KErrNone==ret)
+		{
+		iPermBits = iScript->PermGranted ();
+		iDeniedBits = iScript->PermDenied ();
+		}
+
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Opens script session, in turn opening client-side sub-session handle
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::Open(const RSessionBase& aParentSession,
+		TPolicyID aPolicyID, TExecutableID aExecID, const CTrustInfo& aTrustInfo)
+	{
+	if (iScript)
+		{
+		delete iScript;
+		iScript = NULL;
+		}
+	
+	iScript = CScript::NewL (aPolicyID, aExecID);
+	TInt ret((*iSubSessionProxy)->Open (aParentSession, *iScript, aPolicyID, aTrustInfo));
+
+	if ( KErrNone==ret)
+		{
+		iPermBits = iScript->PermGranted ();
+		iDeniedBits = iScript->PermDenied ();
+		}
+
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Performs access permission check, returns unmatched capabilities if any
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRTSecMgrScriptSession::IsAllowed(const RCapabilityArray& aCapabilitiesToCheck,RCapabilityArray& aUnMatchedCapabilities)
+	{
+	RPromptDataList promptDataList;
+	TCapabilityBitSet unMatchedCapBits(KDefaultNullBit);
+	TInt ret(IsAllowed(aCapabilitiesToCheck,promptDataList,unMatchedCapBits));
+	
+	promptDataList.ResetAndDestroy();
+
+	if(KDefaultNullBit!=unMatchedCapBits)
+	BuildCapsL(unMatchedCapBits,aUnMatchedCapabilities);
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Performs access permission check
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CRTSecMgrScriptSession::IsAllowed(const RCapabilityArray& aCapabilitiesToCheck)
+ 	{
+ 	RPromptDataList promptDataList;
+	TCapabilityBitSet unMatchedCapBits(KDefaultNullBit);
+	TInt ret(IsAllowed(aCapabilitiesToCheck,promptDataList,unMatchedCapBits));
+	promptDataList.ResetAndDestroy();
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Private implementation to perform access perform access check.
+// This function is the real task master
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::IsAllowed(
+		const RCapabilityArray& aCapabilitiesToCheck,
+		RPromptDataList& aPromptDataList, TCapabilityBitSet& aUnMatchedCaps)
+	{
+	if ( aCapabilitiesToCheck.Count ()<=0)
+		{
+		return EAccessOk; //if no capabilities are required, safely return
+		}
+	if ( aCapabilitiesToCheck.Find(ECapabilityTCB) != KErrNotFound)
+		return EAccessNok;
+	aPromptDataList.Reset ();
+
+	TCapabilityBitSet capToCheck(KDefaultNullBit);
+	TCapabilityBitSet finalCaps(KDefaultNullBit);
+	for (TInt i(0); i!=aCapabilitiesToCheck.Count (); ++i)
+		AddCapability (capToCheck, aCapabilitiesToCheck[i]);
+
+	capToCheck &= ~(iScript->PermissionSet().UnconditionalCaps());
+	
+	/* Check if a;ready denied. No point in going forward */
+	if(capToCheck & _sessionInfo.DeniedCaps || capToCheck & iDeniedBits)
+	        return EAccessNok;
+	
+	TCapabilityBitSet allowedCaps(KDefaultNullBit);
+	allowedCaps |= _sessionInfo.AllowedCaps; //for session allowed
+	allowedCaps &= ~iDeniedBits;
+	allowedCaps |= iPermBits; //for permanently allowed
+	
+	//In case if all the capabilities required by the service provider
+	//are allowed without prompting
+	TCapabilityBitSet original_capToCheck = capToCheck;
+	capToCheck &= allowedCaps;
+	if(original_capToCheck == capToCheck)
+		return EAccessOk;
+
+	capToCheck ^= original_capToCheck ;
+	TBool isPermGrantModified(EFalse);
+
+	RPermissions perms = iScript->PermissionSet().Permissions ();
+	
+	for (TInt i(0); (i!=perms.Count ())&& capToCheck ;++i)
+		{
+		CPermission* perm = CPermission::NewLC(*perms[i]);
+
+		TCapabilityBitSet tempCapToCheck(KDefaultNullBit);
+
+		RCapabilityArray capabilities;
+		perm->Capabilitilites (capabilities);
+
+		for (TInt capsIdx(0); capsIdx!=capabilities.Count();++capsIdx)
+			{
+			TCapability cap(capabilities[capsIdx]);
+			tempCapToCheck |= LOWBIT << cap;
+			}
+		capToCheck &= tempCapToCheck;
+		if ( capToCheck )
+			{
+			if ( capToCheck & iDeniedBits) //check if permanently disabled
+				{
+				allowedCaps &= ~tempCapToCheck; //just in case...
+				_sessionInfo.DeniedCaps &= ~tempCapToCheck; //just in case...
+				}
+			else
+				if ( capToCheck & _sessionInfo.DeniedCaps) //not necessary to do this check...
+					{
+					allowedCaps &= ~tempCapToCheck; //just in case...	
+					}
+				else
+					if ((capToCheck & allowedCaps) != capToCheck) //check if it's already allowed
+						{
+						//capToCheck &= allowedCaps;
+						TCapabilityBitSet temp = capToCheck;
+						temp &= allowedCaps;
+						temp ^= capToCheck;
+						capToCheck = temp;
+						if ( (perm->Condition() & RTUserPrompt_OneShot) ||(perm->Condition() & RTUserPrompt_Session) ||((perm->Condition() & RTUserPrompt_Permanent) &&
+								(iScript->ScriptID()!=KAnonymousScript)))
+							{
+							if ( !(_sessionInfo.AllowedCaps & capToCheck))
+								{
+								//check if it's denied for this session
+								if ( !(_sessionInfo.DeniedCaps & capToCheck))
+									{
+									CPromptData* promptData = CPromptData::NewL();//should write NewL Function
+									promptData->SetPermissions(*perm);
+									promptData->SetUserSelection(perm->Default ()) ;
+									aPromptDataList.Append (promptData);
+									}
+								
+								}
+							else
+								{
+								allowedCaps |= tempCapToCheck; //enable in allowed
+								}
+							}
+						}
+			}
+		capToCheck ^= original_capToCheck;
+		capabilities.Close ();
+		CleanupStack::PopAndDestroy(perm);
+		}//for loop
+
+	if ( aPromptDataList.Count ()>0)
+		{
+		//TInt ret = EPromptOk;
+		TInt ret = iPromptHdlr->Prompt (aPromptDataList , iScript->ScriptID());
+		
+		//Iterate over promptDataList and check the user selection
+			RCapabilityArray capArray;
+			for (TInt i(0); i!=aPromptDataList.Count ();++i)
+				{
+				CPermission *perm = (aPromptDataList[i])->iPermission;
+				perm->Capabilitilites(capArray);
+				TCapabilityBitSet tempCapToCheck(KDefaultEnableBit);
+				TCapabilityBitSet userSelectedCaps = 0;
+				for(TInt idx(0); idx != capArray.Count(); idx++)
+					userSelectedCaps |= tempCapToCheck <<capArray[idx];	
+								
+				capArray.Close();
+				HandleGrantChosen (aPromptDataList[i], userSelectedCaps, allowedCaps, isPermGrantModified);
+				finalCaps |= allowedCaps ;
+				}
+		
+		if ( EPromptOk!=ret)
+			{
+			return EAccessNok;
+			}
+
+		if ( (iScript->ScriptID()!=KAnonymousScript)&&(isPermGrantModified))
+			UpdatePermGrant ();//commit perm grant change 
+
+		finalCaps |= iPermBits ;
+		
+		if((finalCaps & NetworkServices_CAP) && isCustomPrompt)
+		    PromptCostL() ;
+		
+		finalCaps |= _sessionInfo.AllowedCaps ;
+		
+	
+		if ( KErrNone == ((finalCaps & original_capToCheck) ^ original_capToCheck))
+			return EAccessOk;
+		else
+			{
+			aUnMatchedCaps = (finalCaps & original_capToCheck) ^ original_capToCheck;
+			return EAccessNok;
+			}
+		}
+	else
+		{
+		return EAccessNok;
+		}
+
+	}
+
+// ---------------------------------------------------------------------------
+// Default prompt handler implementation
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::Prompt(RPromptDataList& aPromptDataList,TExecutableID /*aExecID*/)
+	{
+	AddResourceFiles();
+	TInt ret(EPromptOk);
+    TInt promptCount = aPromptDataList.Count ();
+	
+	for (TInt i(0); i<promptCount; ++i)
+		{
+		ret = Prompt (aPromptDataList[i]);
+		if ( EPromptOk!=ret)
+			{
+			for(TInt inLoopCnt(promptCount-1); inLoopCnt>=i; --inLoopCnt)
+				{
+				TUserPromptOption selected = aPromptDataList[inLoopCnt]->iUserSelection;
+				if(!(selected == RTUserPrompt_Denied || selected == RTUserPrompt_SessionDenied || selected == RTUserPrompt_PermDenied))
+				    {
+    				delete aPromptDataList[inLoopCnt];
+    				aPromptDataList.Remove(inLoopCnt);
+				    }
+				}
+			break;
+			}
+		
+		
+		}
+	CloseResourceFiles();
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Private default prompt handler implementation
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::Prompt(CPromptData* aPromptData)
+	{
+	if ( RTPROMPTUI_DEFAULT!=iUIPromptOption)
+		return PromptAdvanced (aPromptData);
+
+	TInt ret(EPromptOk);
+	TInt stackResCnt(0);
+
+	CDesCArray* settingPageText = new(ELeave) CDesCArrayFlat(KDescArrayInit);
+	CleanupStack::PushL(settingPageText);
+		
+	HBufC* oneShotOptionText=   NULL;
+	HBufC* oneShotDenyText=   NULL;
+	HBufC* sessionOptionText=   NULL;
+	HBufC* sessionDenyOption=   NULL;
+	HBufC* permGrantOptionText=   NULL;
+	HBufC* permDenyOption=   NULL;
+
+	TInt selIndex(PROMPT_SELIDX_ZERO);
+	RSelIdxArray selIdxArray;
+	CleanupClosePushL (selIdxArray);
+	
+	if ( (RTUserPrompt_Permanent & (aPromptData->iPermission->Default ())) || (RTUserPrompt_Permanent & (aPromptData->iPermission->Condition ())))
+		{
+		permGrantOptionText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_PERM_YES);
+		settingPageText->AppendL (permGrantOptionText->Des ());
+		++stackResCnt;
+
+		selIdxArray.Append (R_RTSECMGR_PROMPT_PERM_YES);
+
+		if ( RTUserPrompt_Permanent&aPromptData->iPermission->Default ())
+			selIndex = selIdxArray.Count ()-1;
+
+	/*		permDenyOption = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_PERM_NO);
+			++stackResCnt;
+	*/		
+		}
+	
+	if ( (RTUserPrompt_Session & (aPromptData->iPermission->Default ())) || (RTUserPrompt_Session & (aPromptData->iPermission->Condition ())))
+		{
+		sessionOptionText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_SESSION_YES);
+		settingPageText->AppendL (sessionOptionText->Des());
+		++stackResCnt;
+
+		selIdxArray.Append (R_RTSECMGR_PROMPT_SESSION_YES);
+
+		TUserPromptOption def = aPromptData->iPermission->Default ();
+		if ( RTUserPrompt_Session&def)
+			selIndex = selIdxArray.Count()-1;
+
+	/*	if ( !permDenyOption)
+			{
+			sessionDenyOption = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_SESSION_NO);
+			++stackResCnt;
+			}*/
+		}
+
+	if ( (RTUserPrompt_OneShot & aPromptData->iPermission->Default ()) || (RTUserPrompt_OneShot & aPromptData->iPermission->Condition ()))
+		{
+		oneShotOptionText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_ONESHOT_YES);
+		settingPageText->AppendL (oneShotOptionText->Des ());
+		++stackResCnt;
+
+		selIdxArray.Append (R_RTSECMGR_PROMPT_ONESHOT_YES);
+
+		TUserPromptOption def = aPromptData->iPermission->Default ();
+		if ( RTUserPrompt_OneShot&def)
+			selIndex = selIdxArray.Count()-1;
+	/*	if ( !permDenyOption && !sessionDenyOption)
+			{
+			oneShotDenyText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_ONESHOT_NO);
+			++stackResCnt;
+			}*/
+		}
+		
+	
+	if ( (RTUserPrompt_OneShot & (aPromptData->iPermission->Default ())) || (RTUserPrompt_OneShot & (aPromptData->iPermission->Condition ())))
+	        {
+	        oneShotDenyText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_ONESHOT_NO);
+	        ++stackResCnt;
+	            
+	        }
+	    
+    if ( (RTUserPrompt_Session & (aPromptData->iPermission->Default ())) || (RTUserPrompt_Session & (aPromptData->iPermission->Condition ())))
+        {
+        if ( !oneShotDenyText)
+            {
+            sessionDenyOption = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_SESSION_NO);
+            ++stackResCnt;
+            }
+        }
+
+    if ( (RTUserPrompt_Permanent & aPromptData->iPermission->Default ()) || (RTUserPrompt_Permanent & aPromptData->iPermission->Condition ()))
+        {
+        if ( !oneShotDenyText && !sessionDenyOption)
+            {
+            permDenyOption = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_PERM_NO);
+            ++stackResCnt;
+            }
+        }
+
+	if ( oneShotDenyText)
+		{
+		settingPageText->AppendL (oneShotDenyText->Des ());
+		selIdxArray.Append (R_RTSECMGR_PROMPT_ONESHOT_NO);
+		}
+
+	if ( sessionDenyOption)
+		{
+		settingPageText->AppendL (sessionDenyOption->Des ());
+		selIdxArray.Append (R_RTSECMGR_PROMPT_SESSION_NO);
+		}
+
+	if ( permDenyOption)
+		{
+		settingPageText->AppendL (permDenyOption->Des ());
+		selIdxArray.Append (R_RTSECMGR_PROMPT_PERM_NO);
+		}
+	
+	HBufC* body(NULL);
+	HBufC *moreInfo(NULL);
+	
+	if(((aPromptData->iPermission->PermName()).Compare(KNullDesC)) != KErrNone)
+		{
+		if(((aPromptData->iPermission->PermName()).Compare(_L("UserDataGroup"))) == KErrNone )
+			{
+			body = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_USERDATA_GROUP);
+			++stackResCnt;	
+			}
+		else if(((aPromptData->iPermission->PermName()).Compare(_L("DeviceResourcesGroup"))) == KErrNone )
+			{
+			body = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_DEVICERESOURCES_GROUP);
+			++stackResCnt;	
+			}
+		else if(((aPromptData->iPermission->PermName()).Compare(_L("NetworkGroup"))) == KErrNone )
+			{
+			body = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_NETWORK_GROUP);
+			++stackResCnt;	
+			}
+		}
+	else if ( (aPromptData->iPermission->Capability()<KCapabilitySize) && (aPromptData->iPermission->Capability()>ECapabilityTCB))
+		{
+		TInt textResID(CAPABILITY_RESOURCEID[aPromptData->iPermission->Capability()]);
+		if(KErrNone!=textResID)
+			{
+			body = iCoeEnv->AllocReadResourceLC (textResID);
+			++stackResCnt;			
+			}
+		}
+	
+	if(((aPromptData->iPermission->PermName()).Compare(KNullDesC)) != KErrNone)
+		{
+		moreInfo = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_ITEM_MORE_INFO);
+		++stackResCnt;
+		if( moreInfo )
+			{
+			settingPageText->AppendL (moreInfo->Des ());
+			selIdxArray.Append (R_RTSECMGR_ITEM_MORE_INFO);
+			}
+		}
+	
+	CAknListQueryDialog* queryDialog = new (ELeave) CAknListQueryDialog(&selIndex);
+	CleanupStack::PushL (queryDialog);
+	++stackResCnt;
+
+	queryDialog->PrepareLC (R_LIST_QUERY_MSGBOX);
+		
+	queryDialog->SetItemTextArray (settingPageText); 
+	queryDialog->SetOwnershipType(ELbmDoesNotOwnItemArray);
+
+	CAknMessageQueryControl* msgBox = queryDialog->MessageBox ();
+	if ( msgBox && body )
+		msgBox->SetMessageTextL (body);
+
+	CAknPopupHeadingPane* heading = queryDialog->QueryHeading ();
+	HBufC* headerText(NULL);
+	if ( heading)
+		{
+		heading->SetLayout (CAknPopupHeadingPane::EMessageQueryHeadingPane);
+		headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_QUERY_HEADER);
+		heading->SetTextL (headerText->Des ());
+		++stackResCnt;
+		}
+		
+	if(moreInfo)
+	    {
+    	TListItemProperties moreInfoProperties;
+    	moreInfoProperties.SetUnderlined(ETrue);
+    	queryDialog->ListControl()->Listbox()->ItemDrawer()->SetPropertiesL(settingPageText->Count()-1,moreInfoProperties);
+	    }
+	
+	CleanupStack::Pop (stackResCnt);
+	
+	queryDialog->ListBox()->SetCurrentItemIndex(selIndex);
+	
+	TInt queryOk = queryDialog->RunLD ();
+	if ( queryOk == EAknSoftkeyOk)
+		{
+		if ( (selIndex>=0) && (selIndex<selIdxArray.Count()))
+			{
+			if ( R_RTSECMGR_PROMPT_ONESHOT_YES==selIdxArray[selIndex])
+				aPromptData->iUserSelection = RTUserPrompt_OneShot;
+			
+			else if ( R_RTSECMGR_PROMPT_ONESHOT_NO==selIdxArray[selIndex])
+				{
+				aPromptData->iUserSelection = RTUserPrompt_Denied;
+				ret = EPromptCancel;
+				}
+			
+			else if ( R_RTSECMGR_PROMPT_SESSION_YES==selIdxArray[selIndex])
+				aPromptData->iUserSelection = RTUserPrompt_Session;
+			
+			else if ( R_RTSECMGR_PROMPT_SESSION_NO==selIdxArray[selIndex])
+				{
+				aPromptData->iUserSelection = RTUserPrompt_SessionDenied;
+				ret = EPromptCancel;
+				}
+				
+			else if ( R_RTSECMGR_PROMPT_PERM_YES==selIdxArray[selIndex])
+				aPromptData->iUserSelection = RTUserPrompt_Permanent;
+			
+			else if ( R_RTSECMGR_PROMPT_PERM_NO==selIdxArray[selIndex])
+				{
+				aPromptData->iUserSelection = RTUserPrompt_PermDenied;
+				ret = EPromptCancel;
+				}
+				
+			else if ( R_RTSECMGR_ITEM_MORE_INFO == selIdxArray[selIndex])
+				{
+				ret = MoreInfoL(*aPromptData);
+				}
+			}
+		}
+	else
+		{
+		ret = EPromptCancel;
+		}
+	
+	if ( headerText)
+		delete headerText;
+	
+	if ( body)
+		delete body;
+
+	if ( oneShotOptionText)
+		delete oneShotOptionText;
+
+	if ( sessionOptionText)
+		delete sessionOptionText;
+
+	if ( permGrantOptionText)
+		delete permGrantOptionText;
+
+	if ( oneShotDenyText)
+		delete oneShotDenyText;
+
+	if ( sessionDenyOption)
+		delete sessionDenyOption;
+
+	if ( permDenyOption)
+		delete permDenyOption;
+	
+	if (moreInfo)
+		delete moreInfo;
+
+	CleanupStack::PopAndDestroy ();//settingPageText
+	CleanupStack::PopAndDestroy ();//selIdxArray
+	return ret;
+	}
+
+
+
+// ---------------------------------------------------------------------------
+// Private default prompt handler implementation for advanced prompt UI
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::PromptAdvanced(CPromptData* aPromptData)
+	{
+	TInt ret(EPromptOk);
+	TInt selIndex(PROMPT_SELIDX_ZERO); //R_RTSECMGR_PROMPT_ONESHOT_YES
+	TInt stackResCnt(0);
+
+	HBufC* msgText(NULL);
+	HBufC* moreInfo(NULL);
+	TBuf<256> LinkText;
+	
+	if(((aPromptData->iPermission->PermName()).Compare(KNullDesC)) != KErrNone)
+		{
+		if(((aPromptData->iPermission->PermName()).Compare(_L("UserDataGroup"))) == KErrNone )
+			{
+			msgText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_USERDATA_GROUP);
+			LinkText.Append(msgText->Des());
+			++stackResCnt;	
+			}
+		else if(((aPromptData->iPermission->PermName()).Compare(_L("DeviceResourcesGroup"))) == KErrNone )
+			{
+			msgText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_DEVICERESOURCES_GROUP);
+			LinkText.Append(msgText->Des());
+			++stackResCnt;	
+			}
+		else if(((aPromptData->iPermission->PermName()).Compare(_L("NetworkGroup"))) == KErrNone )
+			{
+			msgText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_NETWORK_GROUP);
+			LinkText.Append(msgText->Des());
+			++stackResCnt;	
+			}
+		}
+	else if ((aPromptData->iPermission->Capability()<KCapabilitySize) && (aPromptData->iPermission->Capability()>ECapabilityTCB))
+		{
+		TInt textResID(CAPABILITY_RESOURCEID[aPromptData->iPermission->Capability()]);
+		if(KErrNone!=textResID)
+			{
+			msgText = iCoeEnv->AllocReadResourceLC (textResID);
+			++stackResCnt;
+			LinkText.Append(msgText->Des());
+			}
+		}
+	
+	if(((aPromptData->iPermission->PermName()).Compare(KNullDesC)) != KErrNone)
+		{
+		moreInfo = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_LINK_MORE_INFO);
+		++stackResCnt;
+		
+		LinkText.Append(_L("\n\n"));
+		LinkText.Append(_L("<AknMessageQuery Link>"));
+		LinkText.Append(moreInfo->Des());
+		LinkText.Append(_L("</AknMessageQuery Link>"));
+		}
+		
+	CAknMessageQueryDialog* queryDialog = new(ELeave) CAknMessageQueryDialog();
+	CleanupStack::PushL (queryDialog);
+	++stackResCnt;
+
+	queryDialog->PrepareLC (R_ADVPROMPT_MESSAGE_QUERY);
+	
+	queryDialog->SetMessageTextL(LinkText);
+	HBufC* headerText(NULL);
+	CAknPopupHeadingPane* heading = queryDialog->QueryHeading ();
+	if ( heading)
+		{
+		heading->SetLayout (CAknPopupHeadingPane::EMessageQueryHeadingPane);
+		headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_QUERY_HEADER);
+		heading->SetTextL (headerText->Des ());
+		++stackResCnt;
+		}
+
+	if(moreInfo)
+		{
+		TCallBack callback;
+		TCallbackParam callbackParam;
+				
+		callbackParam.iPromptData = aPromptData;
+		callbackParam.iRTSecMgrScriptSession = this;
+		callback.iFunction = LinkCallback;
+		callback.iPtr = &callbackParam;
+		
+		queryDialog->SetLink(callback);
+		}
+	
+	CleanupStack::Pop (stackResCnt);
+	TInt queryOk = queryDialog->RunLD ();
+	if ( queryOk == EAknSoftkeyYes)
+		{
+		if ( selIndex==0)
+			{
+			if ( aPromptData->iPermission->Default ()& RTUserPrompt_OneShot)
+				{
+				aPromptData->SetUserSelection(RTUserPrompt_OneShot);
+				}
+			else
+				if ( aPromptData->iPermission->Default ()& RTUserPrompt_Session)
+					{
+					aPromptData->SetUserSelection(RTUserPrompt_Session);
+					}
+				else
+					if ( aPromptData->iPermission->Default ()& RTUserPrompt_Permanent)
+						{
+						aPromptData->SetUserSelection(RTUserPrompt_Permanent);
+						}
+			}
+		else
+			{
+			aPromptData->SetUserSelection(RTUserPrompt_Denied);
+			}
+		}
+	else
+		{
+		ret = EPromptCancel;
+		}
+	
+	if ( headerText)
+		delete headerText;
+
+	if ( msgText)
+		delete msgText;
+	
+	if ( moreInfo)
+	    delete moreInfo;
+	
+	return ret;
+	}
+// ---------------------------------------------------------------------------
+// Pops up a new query dialog when the user clicks on more info.
+// ---------------------------------------------------------------------------
+//
+TInt CRTSecMgrScriptSession::MoreInfoL(CPromptData& aPromptData)
+	{
+	TInt ret(EPromptOk);
+	TInt stackResCnt = 0;
+	HBufC *msgText = NULL;
+	HBufC *body = NULL;
+	TBuf<KMaxBuf> message;
+	RCapabilityArray Caps;
+	
+	msgText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_MORE_INFO_QUERY);
+	++stackResCnt;
+	message.Append(msgText->Des());
+	
+	aPromptData.Permission()->Capabilitilites(Caps);
+	for(TInt i = 0; i != Caps.Count(); ++i)
+        {
+        TInt textResID(MOREINFO_CAP_RESOURCEID[Caps[i]]);
+        body = iCoeEnv->AllocReadResourceLC (textResID);
+        message.Append(_L("\n"));
+        message.Append(body->Des());
+        if(body)
+            CleanupStack :: PopAndDestroy(body);
+        }
+	Caps.Close();
+	
+	CAknMessageQueryDialog* queryDialog = new(ELeave) CAknMessageQueryDialog();
+	CleanupStack::PushL (queryDialog);
+	++stackResCnt;
+
+	queryDialog->PrepareLC (R_MOREINFO_MESSAGE_QUERY);
+	
+	queryDialog->SetMessageTextL(message);
+	
+	HBufC* headerText(NULL);
+	CAknPopupHeadingPane* heading = queryDialog->QueryHeading ();
+	if ( heading)
+		{
+		heading->SetLayout (CAknPopupHeadingPane::EMessageQueryHeadingPane);
+		
+		if(((aPromptData.iPermission->PermName()).Compare(_L("UserDataGroup"))) == KErrNone )
+	    	{
+		    headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_MORE_INFO_HEADER_USERDATA);
+    		}
+    	else if(((aPromptData.iPermission->PermName()).Compare(_L("DeviceResourcesGroup"))) == KErrNone )
+    		{
+    		headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_MORE_INFO_HEADER_DEVICERESOURCES);
+    		}
+    	else if(((aPromptData.iPermission->PermName()).Compare(_L("NetworkGroup"))) == KErrNone )
+    		{
+    		headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_MORE_INFO_HEADER_NETWORK);
+    		}
+		
+	//	headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_QUERY_HEADER);
+		heading->SetTextL (headerText->Des ());
+		++stackResCnt;
+		}
+		
+	CleanupStack::Pop(stackResCnt);
+	
+	TInt queryOk = queryDialog->RunLD ();
+	
+	if(headerText)
+		delete headerText;
+	
+	if(msgText)
+	    delete msgText;
+	
+	if(iUIPromptOption!=RTPROMPTUI_ADVANCED)
+		ret = Prompt(&aPromptData);
+	
+	return ret;
+	}
+
+
+// ---------------------------------------------------------------------------
+// Pops up a new query dialog when the user clicks on more info.
+// ---------------------------------------------------------------------------
+//
+void CRTSecMgrScriptSession::PromptCostL()
+	{
+	AddResourceFiles();
+	TInt stackResCnt = 0;
+	HBufC *msgText = NULL;
+	TBuf<KMaxBuf> message;
+	RCapabilityArray Caps;
+	
+	
+	msgText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_COST_INFO);
+	++stackResCnt;
+	message.Append(msgText->Des());
+	
+	CAknMessageQueryDialog* queryDialog = new(ELeave) CAknMessageQueryDialog();
+	CleanupStack::PushL (queryDialog);
+	++stackResCnt;
+
+	queryDialog->PrepareLC (R_MOREINFO_MESSAGE_QUERY);
+	
+	queryDialog->SetMessageTextL(message);
+	
+	HBufC* headerText(NULL);
+	CAknPopupHeadingPane* heading = queryDialog->QueryHeading ();
+	if ( heading)
+		{
+		heading->SetLayout (CAknPopupHeadingPane::EMessageQueryHeadingPane);
+		headerText = iCoeEnv->AllocReadResourceLC (R_RTSECMGR_PROMPT_QUERY_HEADER);
+		heading->SetTextL (headerText->Des ());
+		++stackResCnt;
+		}
+		
+	CleanupStack::Pop(stackResCnt);
+	
+	TInt queryOk = queryDialog->RunLD ();
+	
+	if(headerText)
+		delete headerText;
+	
+	if(msgText)
+	    delete msgText;
+	CloseResourceFiles();
+	}
+// ---------------------------------------------------------------------------
+// Handles the prompt option chosen by the user through default prompt UI
+// ---------------------------------------------------------------------------
+//
+void CRTSecMgrScriptSession::HandleGrantChosen(CPromptData* aPromptData,
+		TCapabilityBitSet aCapBitSet, TCapabilityBitSet& aAllowedCaps,
+		TBool& aIsPermGrantModified)
+	{
+	TUserPromptOption optionChosen = aPromptData->iUserSelection;
+	
+	if ( RTUserPrompt_OneShot==optionChosen)
+		{
+		_sessionInfo.AllowedCaps &= ~aCapBitSet;
+		aAllowedCaps = aCapBitSet;
+		}
+	else
+		if ( RTUserPrompt_Denied==optionChosen) //one-shot denied
+			{
+			aAllowedCaps &= ~aCapBitSet;
+			_sessionInfo.AllowedCaps &= ~aCapBitSet; //disable in session pattern too...	
+			}
+		else
+			if ( RTUserPrompt_Session==optionChosen)
+				{
+				_sessionInfo.AllowedCaps |= aCapBitSet;//Enable in _sessionInfo.Allowed & allowed
+				aAllowedCaps = aCapBitSet;
+				}
+			else
+				if ( RTUserPrompt_SessionDenied==optionChosen) //session denied
+					{
+					aAllowedCaps &= ~aCapBitSet;
+					_sessionInfo.AllowedCaps &= ~aCapBitSet; //disable in session pattern too...
+					_sessionInfo.DeniedCaps |= aCapBitSet; //enable denied in session bit
+					}
+				else
+					if ( RTUserPrompt_Permanent==optionChosen)
+						{
+						aIsPermGrantModified = ETrue; //to commit the change to persistent store
+						_sessionInfo.AllowedCaps |= aCapBitSet;
+						aAllowedCaps = aCapBitSet;
+						iPermBits |= aCapBitSet;
+						iDeniedBits &= ~aCapBitSet; //just in case....
+						}
+					else
+						if ( RTUserPrompt_PermDenied==optionChosen) //permanent denied
+							{
+							aIsPermGrantModified = ETrue;
+							aAllowedCaps &= ~aCapBitSet;
+							_sessionInfo.AllowedCaps &= ~aCapBitSet; //disable in session pattern too...
+							_sessionInfo.DeniedCaps |= aCapBitSet; //enable denied in session bit 
+							iPermBits &= ~aCapBitSet; //disable in perm bits
+							iDeniedBits |= aCapBitSet; //enable in perm denied bit pattern
+							//Commit the change to persistent store...
+							}
+	}
+
+// ---------------------------------------------------------------------------
+// Updates blanket permission data
+// ---------------------------------------------------------------------------
+//
+void CRTSecMgrScriptSession::UpdatePermGrant()
+	{
+	(*iSubSessionProxy)->UpdatePermGrant (iScript->ScriptID (), iPermBits,
+			iDeniedBits);
+	}
+
+//
+// Conversion utility to convert a single 32-bit value to the list of
+// capabilities (RArray<TCapability>)
+// 
+void CRTSecMgrScriptSession::BuildCapsL(TCapabilityBitSet aCapBitSet,
+		RCapabilityArray& aInOutTCapList)
+	{
+	TInt idx(KErrNotFound);
+
+	while (++idx!=KCapabilitySize)
+		{
+		TCapabilityBitSet temp(KDefaultEnableBit);
+		temp = temp << idx;
+		if ( aCapBitSet & temp)
+			aInOutTCapList.AppendL ((TCapability)(idx+1));
+		}
+	}
+
+//
+// Conversion utility to generate a single 32-bit value from a list of
+// capabilities (RArray<TCapability>)
+//
+void CRTSecMgrScriptSession::AddCapability(TCapabilityBitSet& aInOutCapBitSet,
+		TCapability aCapToSet)
+	{
+	if ( aCapToSet>=0)
+		aInOutCapBitSet = aInOutCapBitSet | (LOWBIT << aCapToSet);
+	}
+
+/*
+ * Closes the script sub-session
+ * 
+ */
+void CRTSecMgrScriptSession::Close()
+	{
+	if ( iResourceOffset && iCoeEnv)
+		iCoeEnv->DeleteResourceFile (iResourceOffset);
+
+	if ( iScript)
+		{
+		delete iScript;
+		iScript = NULL;
+		}
+
+	if ( iSubSessionProxy)
+		{
+		delete iSubSessionProxy;
+		iSubSessionProxy = NULL;
+		}
+	}
+
+//--------------------------------------------------------------------------- 
+// Callback function called from moreinfo link in advanced prompt
+//---------------------------------------------------------------------------
+TInt CRTSecMgrScriptSession::LinkCallback(TAny * aCallbackParam)
+	{
+	TCallbackParam *cb = (TCallbackParam*)aCallbackParam;
+	(cb->iRTSecMgrScriptSession)->MoreInfoL(*(cb->iPromptData));
+	return KErrNone;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerclient/src/rtsecmgrtrustinfo.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines CTrustInfo class
+ *
+*/
+
+
+
+
+
+
+#include <rtsecmgrtrustinfo.h>
+
+// ---------------------------------------------------------------------------
+// Defintiion of default private constructor
+// ---------------------------------------------------------------------------
+//
+CTrustInfo::CTrustInfo()
+{	
+}
+
+// ---------------------------------------------------------------------------
+// Definition of second phase constructor
+//
+// Constructs a CTrustInfo instance
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CTrustInfo* CTrustInfo::NewL()
+{
+	CTrustInfo* self = CTrustInfo::NewLC();
+	CleanupStack::Pop(self);
+	return self;
+}
+
+// ---------------------------------------------------------------------------
+// Definition of second phase constructor
+//
+// Constructs a CTrustInfo instance and leaves the created instance
+// on the cleanupstack
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CTrustInfo* CTrustInfo::NewLC()
+{
+	CTrustInfo* self = new (ELeave) CTrustInfo();
+	CleanupStack::PushL(self);
+	return self;	
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CTrustInfo::~CTrustInfo()
+{
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/group/RTSecMgrServer.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <platform_paths.hrh>
+
+TARGET          rtsecmgrserver.exe
+TARGETTYPE      exe
+
+TARGETPATH      sys/bin
+// Since this is an exe with no alternate implementations, 
+// just use same UID for both UID2 and UID3
+UID             0x1020507E 0x2000F847
+VENDORID        VID_DEFAULT
+
+CAPABILITY      CAP_SERVER
+
+VERSION 10.1
+paged
+
+SOURCEPATH      ../src
+SOURCE         rtsecmgrserver.cpp
+SOURCE         rtsecmgrserverstartUp.cpp
+SOURCE         rtsecmgrserversession.cpp
+SOURCE         rtsecmgrpolicyparser.cpp
+SOURCE         rtsecmgrclientapi.cpp
+SOURCE		   rtsecmgrprotectiondomain.cpp
+SOURCE		   rtsecmgrpolicy.cpp
+SOURCE		   rtsecmgrpolicymanager.cpp
+SOURCE		   rtsecmgrscriptmanager.cpp
+SOURCE		   rtsecmgrstore.cpp
+
+USERINCLUDE     ../inc/
+USERINCLUDE     ../../inc/
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+
+//MACRO          RTSECMGR_TRACE
+
+LIBRARY 	euser.lib 
+LIBRARY 	efsrv.lib 
+LIBRARY 	xmlparser.lib 
+LIBRARY 	CharConv.lib 
+LIBRARY 	xmldom.lib 
+LIBRARY 	inetprotutil.lib 
+LIBRARY 	estor.lib  
+LIBRARY 	Flogger.lib
+LIBRARY     rtsecmgrutil.lib
+LIBRARY     edbms.lib
+LIBRARY     bafl.lib
+//LIBRARY 	centralrepository.lib 
+LIBRARY 	PlatformEnv.lib
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <platform_paths.hrh>
+PRJ_EXPORTS
+//../data/backup_registration.xml /epoc32/data/z/private/2000F847/backup_registration.xml
+
+PRJ_MMPFILES
+rtsecmgrserver.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrdata.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines security manager server side data strucutures
+ *
+*/
+
+
+
+
+
+
+#ifndef _RTSECMGRDATA_H
+#define _RTSECMGRDATA_H
+
+#include "rtsecmgrprotectiondomain.h"
+#include "rtsecmgrpolicy.h"
+#include <rtsecmgrtrustinfo.h>
+
+typedef RPointerArray<CProtectionDomain> RProtectionDomains;
+typedef RPointerArray<CTrustInfo> RTrustArray;
+typedef RPointerArray<CPolicy> RPolicies;
+
+#endif  //_RTSECMGRDATA_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicy.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines security policy data structure 
+ *
+*/
+
+
+
+
+
+
+#ifndef C_RTSECMGRPOLICY_H
+#define C_RTSECMGRPOLICY_H
+
+#include <e32capability.h>
+#include <rtsecmgrutility.h>
+#include <rtsecmgrscript.h>
+#include "rtsecmgrdef.h"
+#include "rtsecmgrprotectiondomain.h"
+
+class CProtectionDomain;
+
+typedef RPointerArray<CProtectionDomain> RProtectionDomains;
+typedef RPointerArray<CPermission> RAliasGroup;
+
+/*
+ * Represents a security and trust policy mapping. This class maps
+ * the policyID and its associated security and trust policies.
+ *
+ * A CPolicy instance has list of protection domains specified
+ * in the security access policy and list of trust information. The 
+ * security access policy and trust policy are associated with a policy
+ * identifier
+ * 
+ * @see CProtectionDomain
+ * @see CPermission
+ * 
+ * @exe rtsecmgrserver.exe 
+ */
+NONSHARABLE_CLASS(CPolicy) : public CBase
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicy instance from an input serialization
+	 * source
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aSource 	RStoreReadStream& input source
+	 * 
+	 * @return CPolicy * pointer to an instance of CPolicy
+	 */
+	static CPolicy* NewL(TPolicyID aPolicyID, RStoreReadStream& aSource);
+	
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicy instance from an input serialization
+	 * source and leaves the created instance on the cleanupstack
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aSource 	RStoreReadStream& input source
+	 * 
+	 * @return CPolicy * pointer to an instance of CPolicy
+	 */
+	static CPolicy* NewLC(TPolicyID aPolicyID, RStoreReadStream& aSource);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicy instance and initializes the policy identifier
+	 * and the security access policy domain data
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aProtectionDomains RProtectionDomains& input security protection domains
+	 * @param aAliasGroup RAliasGroup& input capability grouping
+	 * 
+	 * @return CPolicy * pointer to an instance of CPolicy
+	 */
+	static CPolicy* NewL(TPolicyID aPolicyID, const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicy instance and initializes the policy identifier
+	 * and the security access policy domain data. This method leaves the
+	 * created instance on the cleanupstack.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aProtectionDomains RProtectionDomains& input security protection domains
+	 * @param aAliasGroup RAliasGroup& input capability grouping
+	 * 
+	 * @return CPolicy * pointer to an instance of CPolicy
+	 */
+	static CPolicy* NewLC(TPolicyID aPolicyID, const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup);
+
+	/**
+	 * Internalizes CPolicy data members from the input readable source
+	 * 
+	 * @param aSource RStoreReadStream& Input readable source
+	 * 
+	 */
+	void InternalizeL(RStoreReadStream& aSource);
+
+	/**
+	 * Gets a protection domain instance when a valid domain 
+	 * name is passed.
+	 * 
+	 * @param aDomainName const TDesC& name of the protection domain
+	 * 
+	 * @return CProtectionDomain* valid protection domain instance; NULL if
+	 * domain name is invalid or does not exist
+	 * 
+	 */
+	CProtectionDomain* ProtectionDomain(const TDesC& aDomainName) const;		
+
+	/**
+	 * Gets policy identifier of the security and trust policy
+	 * data
+	 * 
+	 * @return TPolicyID policy identifier
+	 * 
+	 */
+	inline TPolicyID PolicyID() const;
+	
+	/**
+	 * Gets the list of protection domains associated with
+	 * the policy identifier
+	 *
+	 * @return const RProtectionDomains& protection domain list
+	 * 
+	 */
+	inline const RProtectionDomains& ProtectionDomain() const;
+
+	/**
+	 * virtual destructor
+	 *  
+	 */
+	inline ~CPolicy();
+	
+	/**
+	 * Gets a alias group instance when a valid alias group
+	 * name is passed.
+	 * 
+	 * @param aAliasName const TDesC& name of the alias group
+	 * 
+	 * @return CPermission* valid alias group instance; NULL if
+	 * alias group name is invalid or does not exist
+	 * 
+	 */
+	CPermission* AliasGroup(const TDesC& aAliasName) const;		
+
+	/**
+	 * Gets the list of alias groups associated with
+	 * the policy identifier
+	 *
+	 * @return const RAliasGroup& alias group list
+	 * 
+	 */
+	inline const RAliasGroup& AliasGroup() const;
+
+private:
+	/*
+	 * private default constructor
+	 */
+	CPolicy();
+	
+	/*
+	 * Overloaded constructor to initialise policy identifier
+	 * 
+	 */
+	CPolicy(TPolicyID aPolicyID);
+	
+	/*
+	 * Two-phase constructor
+	 * 
+	 * Initializes policy identifier, security protection domains and alias groupings
+	 * 
+	 */
+	void ConstructL(const RProtectionDomains& aAccessPolicy, RAliasGroup& aAliasGroup);
+
+private:	
+	/*
+	 * Policy identifier
+	 */
+	TPolicyID iPolicyID;
+	
+	/*
+	 * Array of protection domains
+	 * 
+	 * Own.
+	 */
+	RProtectionDomains iAccessPolicy;
+	
+	/*
+	 * Array of alias groupings
+	 * 
+	 * Own.
+	 */
+	RAliasGroup iAliasGroup;
+	};
+
+#include "rtsecmgrpolicy.inl"
+	
+#endif //C_RTSECMGRPOLICY_H
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicy.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines security policy data structure inline functions
+ *
+*/
+
+
+
+
+
+
+/**
+ * Gets policy identifier of the security and trust policy
+ * data
+ * 
+ * @return TPolicyID policy identifier
+ * 
+ */
+inline TPolicyID CPolicy::PolicyID() const
+	{
+	return iPolicyID;
+	}
+
+/**
+ * Gets the list of protection domains associated with
+ * the policy identifier
+ *
+ * @return const RProtectionDomains& protection domain list
+ * 
+ */
+inline const RProtectionDomains& CPolicy::ProtectionDomain() const
+	{
+	return iAccessPolicy;
+	}
+
+/**
+ * virtual destructor
+ *  
+ */
+inline CPolicy::~CPolicy()
+	{
+	iAccessPolicy.ResetAndDestroy ();
+	iAliasGroup.ResetAndDestroy();
+	}
+
+/**
+ * Gets the list of alias group associated with
+ * the policy identifier
+ *
+ * @return const RAliasGroup& alias group list
+ * 
+ */
+inline const RAliasGroup& CPolicy::AliasGroup() const
+	{
+	return iAliasGroup;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicymanager.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of policy manager class
+ *
+*/
+
+
+
+
+
+
+#ifndef C_RTSECMGRPOLICYMANAGER_H
+#define C_RTSECMGRPOLICYMANAGER_H
+
+#include <e32capability.h>
+#include <rtsecmgrutility.h>
+#include <rtsecmgrscript.h>
+#include "rtsecmgrdef.h"
+#include "rtsecmgrpolicy.h"
+#include "rtsecmgrdata.h"
+#include "rtsecmgrstore.h"
+
+/*
+ * Manages set of security and trust policies. 
+ * 
+ * CPolicyManager provides management functionalities to
+ *  - register a policy
+ *  - un-register a policy
+ *  - restore policies from the persistent storage
+ *
+ * CPolicyManager interacts with CSecMgrStore which abstracts the
+ * underlying persistent storage from policy users
+ * 
+ * @see CSecMgrStore
+ * @see CPolicy
+ * 
+ * @exe rtsecmgrserver.exe
+ */
+NONSHARABLE_CLASS(CPolicyManager) : public CBase
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicyManager instance
+	 * 
+	 * @param aSecMgrDB CSecMgrStore* pointer to security manager storage type
+	 * 
+	 * @return CPolicyManager* pointer to an instance of CPolicyManager
+	 */
+	static CPolicyManager* NewL(CSecMgrStore* aSecMgrDB);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicyManager instance and leaves the created
+	 * instance on the cleanupstack
+	 * 
+	 * @param aSecMgrDB CSecMgrStore* pointer to security manager storage type
+	 * 
+	 * @return CPolicyManager* pointer to an instance of CPolicyManager
+	 */
+	static CPolicyManager* NewLC(CSecMgrStore* aSecMgrDB);
+
+	/**
+	 * Destructor
+	 * 
+	 * Cleanups the internal cache for policy data
+	 */
+	inline ~CPolicyManager();
+
+	/**
+	 * Registers a new policy data. 
+	 * 
+	 * This method in turn updates the security manager
+	 * persistent store with new policy data
+	 * 
+	 * @param aPolicy const CPolicy& Reference to policy data
+	 * 
+	 */
+	void RegisterPolicyL(const CPolicy& aPolicy);
+
+	/**
+	 * Un-registers an existing policy data 
+	 * 
+	 * This method in turn removes the policy data from the 
+	 * security manager persistent store
+	 * 
+	 * @param aPolicyID TPolicyID Policy identifier
+	 * 
+	 * @return KErrNone if unregistration is successful; Otherwise one of
+	 * system wide error codes
+	 */
+	TInt UnRegisterPolicy(TPolicyID aPolicyID);
+
+	/**
+	 * Restores policy data from security manager persistent store.
+	 * 
+	 * The internal cache of policy data maintained by this class
+	 * gets updated
+	 * 
+	 */
+	inline void RestorePoliciesL();
+
+	/**
+	 * Gets the policy data associated with the policy
+	 * identifier
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * 
+	 * @return CPolicy * pointer to an instance of CPolicy associated
+	 * with policy identifier; Returns NULL if policy identifier is not valid
+	 */
+	CPolicy* Policy(TPolicyID aPolicyID) const;
+
+	/**
+	 * Checks if a policy data is stored with a policy identifier
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * 
+	 * @return TBool ETrue if policy associated with policy identifier
+	 * exists; Otherwise EFalse
+	 * 
+	 */
+	TBool HasPolicy(TPolicyID aPolicyID) const;
+
+	/**
+	 * Gets the number of registered policy data
+	 * 
+	 * @return TInt number of registered policy data
+	 */
+	inline TInt Count() const;
+private:
+
+	/**
+	 * Overloaded constructor
+	 * 
+	 */
+	inline CPolicyManager(CSecMgrStore* aSecMgrDB);
+private:
+
+	//Array of policy data
+	RPolicies iPolicies;
+
+	//Reference to security manager persistent storage
+	CSecMgrStore* iSecMgrDB;
+	};
+
+#include "rtsecmgrpolicymanager.inl"
+
+#endif //C_RTSECMGRPOLICYMANAGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicymanager.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of policy manager inline functions
+ *
+*/
+
+
+
+
+
+
+
+inline CPolicyManager::CPolicyManager(CSecMgrStore* aSecMgrDB) :
+	iSecMgrDB(aSecMgrDB)
+	{
+	}
+
+inline CPolicyManager::~CPolicyManager()
+	{
+	iPolicies.ResetAndDestroy ();
+	}
+
+inline void CPolicyManager::RestorePoliciesL()
+	{
+	if ( iSecMgrDB)
+		iSecMgrDB->RestorePoliciesL (iPolicies);
+	}
+
+inline TInt CPolicyManager::Count() const
+	{
+	return iPolicies.Count ();
+	}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicyparser.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Utility XML parser to parse trust and access policy files
+ *
+*/
+
+
+
+
+
+
+#ifndef C_RTSECMGRPOLICYPARSER_H
+#define C_RTSECMGRPOLICYPARSER_H
+
+#include <e32base.h>
+#include <GMXMLParser.h>
+#include <GMXMLNode.h>
+#include <EscapeUtils.h>
+#include "rtsecmgrdata.h"
+#include "rtsecmgrcommondef.h"
+
+/*
+ * Enumerations for policy parsing status codes
+ * 
+ */
+enum TParserErrCode
+{
+	EErrNone = 0, //zero for success , equivalent to KErrNone of symbian
+	EErrInvalidDocNode = KErrXMLBase,
+	EErrInvalidRootNode = EErrInvalidDocNode - 1,
+	EErrNoPolicyInfo   = EErrInvalidRootNode - 1,
+	EErrInvalidDomainName = EErrNoPolicyInfo - 1,
+	EErrRepeatedDomainTag = EErrInvalidDomainName - 1,
+	EErrJunkContent = EErrRepeatedDomainTag - 1,
+	EErrNoDefaultCondition = EErrJunkContent - 1,
+	EErrInvalidFormat = EErrNoDefaultCondition - 1,
+	EErrInvalidCapability = EErrInvalidFormat - 1,
+	EErrInvalidPermission = EErrInvalidCapability - 1,
+	EErrRepeatedCaps = EErrInvalidPermission - 1,
+	EErrRepeatedAliasTag = EErrRepeatedCaps - 1,
+	EErrInvalidAliasName = EErrRepeatedAliasTag - 1,
+	EErrMisplacedAlias = EErrInvalidAliasName
+};
+
+/*
+ * Abstracts policy parsing logic.
+ * 
+ * Security access policy and trust policy are represented in
+ * XML format. CPolicyParser uses native XML parser to parse
+ * the policy files.
+ * 
+ *  
+ * @see MMDXMLParserObserver
+ * @see CMDXMLParser
+ * @see CMDXMLElement
+ * @see CProtectionDomain
+ * @see CTrustInfo
+ * @see TUserPromptOption
+ * 
+ * @exe rtsecmgrserver.exe
+ */
+NONSHARABLE_CLASS(CPolicyParser) : public CBase, public MMDXMLParserObserver
+{
+public:
+	
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicyParser instance
+	 * 
+	 * @return CPolicyParser* pointer to an instance of CPolicyParser
+	 */
+	static CPolicyParser* NewL();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPolicyParser instance and leaves the created instance
+	 * on the cleanupstack
+	 * 
+	 * @return CPolicyParser* pointer to an instance of CPolicyParser
+	 */
+	static CPolicyParser* NewLC();	
+
+
+	/**
+	 * Destructor
+	 * 
+	 */
+	~CPolicyParser();
+	
+	/**
+	 * Parses the security access policy file and populates
+	 * the input protection domain array
+	 * 
+	 * @param aSecPolicy RFile& Handle to security policy file
+	 * @param aPolicyInfo RProtectionDomains& input array of protection domains
+	 * 
+	 * @return EErrSuccess if there is no parsing error; Otherwise one of
+	 * error codes defined in TParserErrCode
+	 * 
+	 * @see TParserErrCode
+	 */
+	TInt GetPolicyInfo(RFile& aSecPolicy, RProtectionDomains& aPolicyInfo, RAliasGroup& aAliasGroup);	
+	
+	/**
+	 * Callback offered by MMDXMLParserObserver to notify the calling client that the XML 
+	 * parsing is completed and DOM data structure is available for 
+	 * navigation
+	 * 
+	 * @see MMDXMLParserObserver
+	 * 
+	 * This identifies whether the policy file is in the proper format
+	 * if not in proper format, parsing errors as defined in TParserErrCode are thrown
+	 * @see TParserErrCode
+	 */
+	void ParseFileCompleteL();	
+private:	
+	
+	//private default constructor
+	inline CPolicyParser();	
+	
+	/**
+	 * Gets the list of capability nodes provided the parent domain
+	 * node
+	 * 
+	 */
+	TInt GetCapsNode(CMDXMLElement* aParentDomainNode, 
+					 RPointerArray<CMDXMLElement>& aCapNodes, 
+					 const TDesC& aNodeName);
+	
+	/**
+	 * Overloaded version to get the list of capability nodes provided the parent domain
+	 * node
+	 * 
+	 */
+	CMDXMLElement* GetCapsNode(CMDXMLElement* aParentDomainNode, const TDesC& aNodeName);
+	
+
+	/**
+	 * Populates the permission set data structure with capability
+	 * information provided the parent capability node
+	 * 
+	 * @return EErrSuccess if there is no parsing error; Otherwise one of these error codes 
+	 * @return EErrRepeatedCaps if there are capabilities specified more than once in same domain
+	 * @return EErrInvalidCapability if the capability string is invalid
+	 * 
+	 * @see TParserErrCode
+	 * 
+	 */
+	TInt GetCapabilities(CMDXMLElement* aParentNode, 
+						 CPermissionSet& aCapInfo,
+				   	 	 TUserPromptOption aUpOpt=RTUserPrompt_UnDefined,
+				   	 	 TBool aUGCaps=EFalse,
+						 TUserPromptOption aDefUpOpt=RTUserPrompt_UnDefined);
+						 
+	/**
+	 * Gets the user prompt option provided the parent user node
+	 * 
+	 * @return EErrSuccess if there is no parsing error; Otherwise one of these error codes 
+	 * @return EErrInvalidPermission if prompt sessions specified are invalid
+	 */
+	TInt GetConditions(CMDXMLElement* aParentNode, TUserPromptOption& aUserPromptOpt);
+	
+	/**
+	 * Gets the default user prompt option provided the parent user node
+	 * 
+	 */
+	TUserPromptOption GetDefaultCondition(CMDXMLElement* aParentNode);
+	
+	/**
+	 * Utility to convert the stringified user prompt option text to
+	 * TCapability enumeration
+	 * 
+	 * @see TCapability
+	 * 
+	 */
+	TCapability GetCapability(const TDesC& aUserPromptOpt);
+	
+	/**
+	 * Utility to convert the stringified user prompt option to
+	 * TUserPromptOption structure
+	 * 
+	 */
+	TUserPromptOption GetUserPromptOption(const TDesC& aUserPromptOpt);		
+	
+	/**
+	 * Finds out if a domain node is present with the passed domain name
+	 * 
+	 */
+	TBool isDomainPresent(const TDesC& aDomainName);
+	
+	/**
+	 * Utility method to check if a capability is already part of 
+	 * unconditional permissions
+	 * 
+	 */
+	TBool IsPresent(const CPermissionSet& aCapInfo, TCapability aCap);
+	
+	/**
+	 * Utility method to check if a capability is already part of user
+	 * grantable permissions
+	 * 
+	 */
+	TBool IsUserGrantPresent(const CPermissionSet& aCapInfo, TCapability aCap);
+
+	
+	/**
+	 * Populates the permission set data structure with capability
+	 * information provided the parent capability node
+	 * 
+	 * @return EErrSuccess if there is no parsing error; Otherwise one of these error codes 
+	 * @return EErrRepeatedCaps if there are capabilities specified more than once in same domain
+	 * @return EErrInvalidCapability if the capability string is invalid
+	 * 
+	 * @see TParserErrCode
+	 * 
+	 * This is similar to GetCapabilities method except that this retrives the capability information for the Group
+	 */
+	TInt GetCapabilitiesForGroup(CMDXMLElement* aParentNode, 
+						 CPermissionSet& aCapInfo,
+						 CPermission& aAliasInfo,
+				   	 	 TUserPromptOption aUpOpt=RTUserPrompt_UnDefined,
+				   	 	 TBool aUGCaps=EFalse,
+						 TUserPromptOption aDefUpOpt=RTUserPrompt_UnDefined);
+						 
+	/**
+	 * Finds out if the passed capability is present in alias group
+	 * 
+	 */
+	TBool IsCapsAliasPresent(const CPermission& aAliasInfo, TCapability aCap);
+	
+	/**
+	 * Finds out if a domain node is present with the passed domain name
+	 * 
+	 */
+	TBool isAliasPresent(const TDesC& aAliasName);
+	
+		
+private:	
+	
+	//reference to undelying native symbian XML parser
+	CMDXMLParser* iDomParser;	
+	
+	//Completion status of parsing request made to XML parser.
+	TRequestStatus* iStatus;
+	CActiveSchedulerWait iWaitScheduler;
+	
+	//list of domains declared in the security access policy
+	RProtectionDomains iPolicyInfo;
+	
+	//list of trust information specified in the trust policy file
+	RTrustArray iTrustInfo;
+
+	//variable to initiate parsing for trust policy file
+	TBool isTrustInfo;
+	
+	//status code to store last parsing error
+	TInt iLastError;
+
+	
+	//Array of TPermissions - used for Capability Grouping
+	RAliasGroup iAliasGroup;
+
+};
+
+#endif  //C_RTSECMGRPOLICYPARSER_H
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrprotectiondomain.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of security protection domain
+ *
+*/
+
+
+
+
+
+
+#ifndef C_RTSECMGRPROTECTIONDOMAIN_H
+#define C_RTSECMGRPROTECTIONDOMAIN_H
+
+#include <e32capability.h>
+#include <rtsecmgrutility.h>
+#include <rtsecmgrscript.h>
+#include "rtsecmgrdef.h"
+
+/* 
+ * Models a protection domain. A protection domain is part of a security policy.
+ * A security policy could have more than one protection domain.
+ *
+ * Every protection domain has a name, list of unconditionally allowed permissions
+ * and set of user grantable permissions.
+ *
+ * @see CPermissionSet
+ * 
+ * @exe rtsecmgrserver.exe
+ * 
+ */
+NONSHARABLE_CLASS(CProtectionDomain) : public CBase
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CProtectionDomain instance
+	 * 
+	 * @return CProtectionDomain* pointer to an instance of CProtectionDomain
+	 */
+	static CProtectionDomain* NewL();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CProtectionDomain instance and leaves the created instance
+	 * on the cleanupstack
+	 * 
+	 * @return CProtectionDomain* pointer to an instance of CProtectionDomain
+	 */
+	static CProtectionDomain* NewLC();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CProtectionDomain instance from the input
+	 * read source
+	 * 
+	 * @param aSource RStoreReadStream& Input readable source
+	 * 
+	 * @return CProtectionDomain* pointer to an instance of CProtectionDomain
+	 */
+	static CProtectionDomain* NewL(RStoreReadStream& aSource);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CProtectionDomain instance from the input
+	 * read source and leaves the created instance on the cleanup
+	 * stack
+	 *  
+	 * @param aSource RStoreReadStream& Input readable source
+	 * 
+	 * @return CProtectionDomain* pointer to an instance of CProtectionDomain
+	 */
+	static CProtectionDomain* NewLC(RStoreReadStream& aSource);
+	
+	/**
+	 * Destructor
+	 * 
+	 * Performs clean-up of domain name descriptor and
+	 * permission set
+	 * 
+	 */
+	~CProtectionDomain();
+
+	/**
+	 * Gets underlying permission set instance
+	 * 
+	 * @return const CPermissionSet& permission set instance
+	 * 
+	 */
+	inline const CPermissionSet& PermSet() const;
+
+	/**
+	 * Gets domain name
+	 * 
+	 * @return const TDesC& domain name
+	 * 
+	 */
+	inline const TDesC& DomainName() const;
+
+	/**
+	 * Sets domain name
+	 * 
+	 * @param aDomainName const TDesC& input domain name string
+	 */
+	inline void SetDomainName(const TDesC& aDomainName);
+
+	/**
+	 * Sets permission set
+	 * 
+	 * @param aPermissionSet CPermissionSet* input permission set
+	 */
+	inline void SetCapInfo(CPermissionSet* aPermissionSet);
+
+	/**
+	 * Externalises CProtectionDomain data to writable output stream
+	 * 
+	 * @param aSink RStoreWriteStream& writable output stream
+	 */
+	void ExternalizeL(RStoreWriteStream& aSink) const;
+
+	/**
+	 * Internalises CProtectionDomain data from readble input stream
+	 * 
+	 * @param aSource RStoreReadStream& readble input stream
+	 */
+	void InternalizeL(RStoreReadStream& aSource);
+
+private:
+	/**
+	 * Default private constructor
+	 * 
+	 */
+	inline CProtectionDomain();
+
+	/**
+	 * Two phased constructor
+	 * 
+	 */
+	inline void ConstructL();
+
+private:
+	/*
+	 * Domain name
+	 * 
+	 * Own.
+	 */
+	HBufC* iDomain;
+	
+	/*
+	 * Permissionset instance
+	 * 
+	 * Own.
+	 */
+	CPermissionSet* iPermSet;
+	};
+
+#include "rtsecmgrprotectiondomain.inl"
+	
+#endif //C_RTSECMGRPROTECTIONDOMAIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrprotectiondomain.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of security protection domain inline functions
+ *
+*/
+
+
+
+
+
+
+
+/**
+ * Default private constructor
+ * 
+ */
+inline CProtectionDomain::CProtectionDomain() :
+	iDomain(NULL)
+	{
+	}
+
+/**
+ * Two phased constructor
+ * 
+ */
+inline void CProtectionDomain::ConstructL()
+	{
+	iPermSet = CPermissionSet::NewL ();
+	}
+
+/**
+ * Gets underlying permission set instance
+ * 
+ * @return const CPermissionSet& permission set instance
+ * 
+ */
+inline const CPermissionSet& CProtectionDomain::PermSet() const
+	{
+	return *iPermSet;
+	}
+
+/**
+ * Gets domain name
+ * 
+ * @return const TDesC& domain name
+ * 
+ */
+inline const TDesC& CProtectionDomain::DomainName() const
+	{
+	if ( iDomain)
+		return *iDomain;
+	else
+		return KNullDesC ();
+	}
+
+/**
+ * Sets domain name
+ * 
+ * @param aDomainName const TDesC& input domain name string
+ */
+inline void CProtectionDomain::SetDomainName(const TDesC& aDomain)
+	{
+	if ( iDomain)
+		{
+		delete iDomain;
+		iDomain = NULL;
+		}
+
+	iDomain = aDomain.AllocL ();
+	}
+
+/**
+ * Sets permission set
+ * 
+ * @param aPermissionSet CPermissionSet* input permission set
+ */
+inline void CProtectionDomain::SetCapInfo(CPermissionSet* aPermissionSet)
+	{
+	if ( iPermSet)
+		{
+		delete iPermSet;
+		}
+
+	iPermSet = aPermissionSet;
+	}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrscriptmanager.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of script manager class
+ *
+*/
+
+
+
+
+
+
+#ifndef C_RTSECMGRSCRIPTMANAGER_H
+#define C_RTSECMGRSCRIPTMANAGER_H
+
+#include <e32capability.h>
+#include <rtsecmgrutility.h>
+#include <rtsecmgrscript.h>
+#include "rtsecmgrdef.h"
+#include "rtsecmgrstore.h"
+
+//Forward declarations
+class CSecMgrStore;
+class CPolicyManager;
+
+typedef RPointerArray<CScript> RScripts;
+
+/*
+ * Models the cache to maintain the list of registered script
+ * data. Provides operations to register script, de-register 
+ * script, query script related information.
+ *
+ * This class abstracts the underlying persistent storage to
+ * store script related data.
+ *
+ * @see CSecMgrStore
+ * @see CPolicyManager
+ * @see CScript
+ * 
+ * @exe rtsecmgrserver.exe
+ */
+class CScriptManager : public CBase
+	{
+public:
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CScriptManager instance
+	 * 
+	 * @param aSecMgrDB CSecMgrStore* reference to security manager store
+	 * @param aPolicyMgr CPolicyManager* reference to policymanager instance
+	 * 
+	 * @return CScriptManager* pointer to an instance of CScriptManager
+	 */
+	static CScriptManager* NewL(CSecMgrStore* aSecMgrDB,
+			CPolicyManager* aPolicyMgr);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CScriptManager instance and leaves the created instance
+	 * on the cleanupstack
+	 * 
+	 * @param aSecMgrDB CSecMgrStore* reference to security manager store
+	 * @param aPolicyMgr CPolicyManager* reference to policymanager instance
+	 * 
+	 * @return CScriptManager* pointer to an instance of CScriptManager
+	 */
+	static CScriptManager* NewLC(CSecMgrStore* aSecMgrDB,
+			CPolicyManager* aPolicyMgr);
+
+	/**
+	 * Destructor
+	 * 
+	 * Performs clean-up of transient script store cache
+	 * 
+	 */
+	virtual ~CScriptManager();
+
+	/**
+	 * Registers a script based on a policy identified by
+	 * input policy identifier with security manager
+	 * 
+	 * @param aPolicyID TPolicyID input policy identifier of the script
+	 * 
+	 * @return TExecutableID script identifier of the registered script
+	 */
+	TExecutableID
+			RegisterScript(TPolicyID aPolicyID);
+
+	/**
+	 * Registers a script with hashvalue based on a policy identified by
+	 * input policy identifier with security manager. 
+	 * 
+	 * @param aPolicyID TPolicyID input policy identifier of the script
+	 * @param aHashValue const TDesC& hashValue of the script
+	 * 
+	 * @return TExecutableID script identifier of the registered script
+	 */
+	TExecutableID
+			RegisterScript(TPolicyID aPolicyID, const TDesC& aHashValue);
+
+	/**
+	 * Un-Registers a script
+	 * 
+	 * @param aExecID script identifier of the registered script
+	 * @param aPolicyID policy identifier passed while registering script
+	 * 
+	 */
+	void UnRegisterScriptL(TExecutableID aExecID, TPolicyID aPolicyID);
+
+	/**
+	 * Gets underlying script data
+	 * 
+	 * @param aScriptInfo CScript& output script data
+	 * 
+	 * @return KErrNone if script data could be returned; Otherwise one of
+	 * system error codes
+	 * 
+	 */
+	TInt ScriptInfo(CScript& aScriptInfo);
+
+	/**
+	 * Updates permanently granted or denied permission data
+	 * of the script
+	 * 
+	 * @param aExecID 	 TExecutableID script identifier
+	 * @param aPermGrant TPermGrant permanently allowed permission
+	 * @param aPermDenied TPermGrant permanently denied permission
+	 * 
+	 */
+	void UpdatePermGrantL(TExecutableID aExecID, TPermGrant aPermGrant,
+			TPermGrant aPermDenied);
+
+	/**
+	 * Gets the script file name
+	 * 
+	 * @param aExecID 	 TExecutableID script identifier
+	 * @param TDes& Output file name
+	 * 
+	 * @return KErrNone if operation is successful; Otherwise one of
+	 * system wide error codes
+	 * 
+	 */
+	TInt GetScriptFile(TExecutableID aExecID, TDes& aScriptFile);
+
+private:
+
+	/**
+	 * Overloaded constructor to initialise internal
+	 * state of CScriptManager
+	 * 
+	 */
+	inline CScriptManager(CSecMgrStore* aSecMgrDB, CPolicyManager* aPolicyMgr) :
+		iSecMgrDB(aSecMgrDB), iPolicyMgr(aPolicyMgr)
+		{
+		}
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 */
+	void ConstructL();
+
+	/**
+	 * Generates a new script identifier
+	 * 
+	 */
+	inline TExecutableID GetID()
+		{
+		if ( --iID > 0)
+			return iID;
+
+		return (TExecutableID)KSecurityServerUid2Int;
+		}
+
+private:
+	
+	//list of script data structure
+	RScripts iScripts;
+	
+	//reference to security manager store
+	CSecMgrStore* iSecMgrDB;
+	
+	//reference to policymanager instance	
+	CPolicyManager* iPolicyMgr;
+	
+	//Last generated script identifier
+	TExecutableID iID;
+	};
+
+#endif  //C_RTSECMGRSCRIPTMANAGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserver.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,386 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Core Runtime Security Manager Server Class
+ *
+*/
+
+
+
+
+
+
+
+#ifndef C_CRTSECMGRSERVER_H
+#define C_CRTSECMGRSERVER_H
+
+#include <rtsecmgrcommondef.h>
+#include "rtsecmgrserverdef.h"
+#include "rtsecmgrpolicy.h"
+#include "rtsecmgrstore.h"
+#include "rtsecmgrpolicymanager.h"
+#include "rtsecmgrscriptmanager.h"
+
+class CPolicyManager;
+class CScriptManager;
+class CSecMgrStore;
+
+//needed for creating server thread.
+const TUint KDefaultHeapSize=0x10000;
+const TUint KShutDownDelay = 200000; // Aprox 2 sec
+
+/*
+ * Shutdown timer class
+ *
+ * @exe rtsecmgrserver.exe 
+ */
+class CShutDown : public CTimer
+	{
+public:
+	inline CShutDown();
+	inline void ConstructL();
+	inline void Start();
+	inline virtual ~CShutDown();
+	
+private:
+	inline void RunL();
+	};
+
+#include "rtsecmgrshutdown.inl"
+	
+#include "rtsecmgrserverpolicy.inl"	
+	
+/*
+ CRTSecMgrServer class
+
+ Represents the server.
+ 
+ The server starts with the first client connect call.
+ Start includes setting up active scheduler, the server active object,
+ and the object container index which produces object object containers for each session.
+ */
+class CRTSecMgrServer : public CPolicyServer //CServer2 //CPolicyServer
+	{
+public:
+	/* 
+	 * Creates a new session with the server; 
+	 * 
+	 * @param aVersion const TVersion& version information of security manager server
+	 * @param aMessage const RMessage2& server's current message
+	 * 
+	 * @return CSession2* pointer to base instance of created server session
+	 */
+	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
+
+	/* 
+	 * Two-phased constructor. Creates a new server object.
+	 * 
+	 * @param aActiveObjectPriority TPriority priorty of the server process
+	 * 
+	 * @return CRTSecMgrServer* pointer to new instance of CRTSecMgrServer
+	 */
+	static CRTSecMgrServer* NewL(CActive::TPriority aActiveObjectPriority);
+	
+	/* 
+	 * Two-phased constructor. Creates a new server object and leaves
+	 * the created instance on the cleanupstack.
+	 * 
+	 * @param aActiveObjectPriority TPriority priorty of the server process
+	 * 
+	 * @return CRTSecMgrServer* pointer to new instance of CRTSecMgrServer
+	 */
+	static CRTSecMgrServer* NewLC(CActive::TPriority aActiveObjectPriority);
+
+	/* 
+	 * Utility method to panic the server
+	 * 
+	 * @param aPanic TSecMgrServPanic Panic error code
+	 * 
+	 */
+	inline static void PanicServer(TSecMgrServPanic aPanic);
+
+	/* 
+	 * Returns an object container, and guaranteed
+	 * to produce object containers with unique ids
+	 * within the server
+	 * 
+	 * This method is called by a new session to create 
+	 * a container 
+	 * 
+	 * 
+	 * @return CObjectCon* a new object container
+	 */
+	CObjectCon* NewContainerL();
+
+	/* 
+	 * Adds a new server side session
+	 * 
+	 */
+	inline void AddSession();
+	
+	/* 
+	 * Removes a server side session by decrementing
+	 * the session count.
+	 * 
+	 * If the session count reaches zero, this method
+	 * initiates server shut down timer
+	 * 
+	 */
+	inline void RemoveSession();
+	
+	/*
+	 * Removes a container object from the container
+	 * index
+	 * 
+	 * @param aContainer CObjectCon* pointer to containter object
+	 * to be removed
+	 */
+	inline void RemoveFromContainerIx(CObjectCon* aContainer);
+
+	/*
+	 * Generates a new script identifier
+	 * 
+	 * @param aExecID TExecutableID& output generated script identifier
+	 *
+	 * @return KErrNone if generation of script identifier successful
+	 */
+	inline TInt ReadCounter(TExecutableID& aExecID);
+
+	/*
+	 * Registers a new policy. The actual task is performed by
+	 * server side session.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aDomains const RProtectionDomains& domains to be added
+	 *
+	 * @return KErrNone if generation of script identifier successful
+	 */	
+	inline void AddPolicyL(TPolicyID aPolicyID, const RProtectionDomains& aDomains, RAliasGroup& aAliasGroup);
+	
+	/*
+	 * Checks whether policy with the passed policy identifier exists.
+	 * The actual task is performed by server side session.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * 
+	 * @return EFalse if policy identifier does not exist; Otherwise ETrue
+	 */
+	inline TBool IsValidPolicy(TPolicyID aPolicyID) const;
+	
+	/*
+	 * Removes an existing policy with the passed policy identifier.
+	 * The actual task is performed by server side session.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * 
+	 * @return KErrNone if removal of policy is successful; Otherwise one
+	 * of system wide error codes
+	 */
+	inline TInt RemovePolicy(TPolicyID aPolicyID);
+
+	/*
+	 * Register a runtime script with security manager.
+	 * The actual task is performed by server side session.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aHashValue const TDesC& hashvalue of script
+	 * 
+	 * @return TExecutableID valid script identifier is registration
+	 * is successful; otherwise one of system wide error codes
+	 * 
+	 */
+	inline TExecutableID
+			RegisterScript(TPolicyID aPolicyID, const TDesC& aHashValue);
+	
+	/*
+	 * Register a runtime script with security manager.
+	 * The actual task is performed by server side session.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * 
+	 * @return TExecutableID valid script identifier is registration
+	 * is successful; otherwise one of system wide error codes
+	 * 
+	 */
+	inline TExecutableID
+			RegisterScript(TPolicyID aPolicyID);
+	
+	/*
+	 * UnRegisters a runtime script from security manager.
+	 * The actual task is performed by server side session.
+	 * 
+	 * @param aExecID TExecutableID script identifier
+	 * @param aPolicyID TPolicyID policy identifier
+	 * 
+	 * 
+	 */
+	inline void UnRegisterScriptL(TExecutableID aExecID, TPolicyID aPolicyID);
+	
+	/*
+	 * Gets script data structure. The script identifier
+	 * is specified in the input script object
+	 * 
+	 * @param aScript CScript& Input output script object
+	 * 
+	 * @return KErrNone if script object is successsfully internalized
+	 * 
+	 */
+	inline TInt GetCapabilityInfo(CScript& aScript);
+	
+	/*
+	 * Gets script data structure. The script identifier
+	 * is specified in the input script object
+	 * 
+	 * @param aPolicyID TPolicyID  policy identifier
+	 * @param aExecID TExecutableID script identifier
+	 * @param aScript CScript& Input output script object
+	 * 
+	 * @return KErrNone if script object is successsfully internalized
+	 * 
+	 */
+	TInt GetCapabilityInfo(TPolicyID aPolicyID, TExecutableID aExecID,
+			CScript& aScript);
+	
+	/*
+	 * Utility method to get the name of the script file
+	 * 
+	 * @param aPolicyID TPolicyID  policy identifier
+	 * @param aScriptFile TFileName& input output name of script file
+	 * 
+	 * @return KErrNone if script filename is successsfully fetched
+	 * 
+	 */
+	inline TInt GetScriptFile(TExecutableID aExecID, TDes& aScriptFile);
+
+	/*
+	 * Utility method to update the permanently allowed or denied
+	 * permissions for the script object
+	 * 
+	 * @param aExecID TExecutableID script identifier of script object whose
+	 * permanent permissions are modified
+	 * @param aPermGrant TPermGrant  permanently allowed permissions
+	 * @param aPermDenied TPermGrant permanently denied permissions
+	 * 
+	 */
+	void UpdatePermGrantL(TExecutableID aExecID, TPermGrant aPermGrant,
+			TPermGrant aPermDenied);
+	
+	/*
+	 * Utility method to create a backup for the policy file
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * getting backed up
+	 * @return KErrNone if backupfile is successsfully created
+	 *
+	 */
+	inline TInt BackupFile(TPolicyID aPolicyID);
+	
+	/*
+	 * Utility method to remove the backup file created
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * whose backup is getting removed
+	 * @return KErrNone if backup file is successsfully removed
+	 *
+	 */
+	inline TInt RemoveTempPolicy(TPolicyID aPolicyID);
+	
+	/*
+	 * Utility method to restore the backup file created if update fails
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * which is restored back
+	 * @return KErrNone if backup file is successsfully restored
+	 *
+	 */
+	inline TInt RestoreTempPolicy(TPolicyID aPolicyID);
+	
+	/*
+	 * Utility method to get the policy file information
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * which is restored back
+	 * @return CPolicy* pointer to instance of Cpolicy stored in CPolicyManager 
+	 *
+	 */
+	inline CPolicy* ReturnPolicyInfo(TPolicyID aPolicyID);
+	
+	/*
+	 * Utility method to store the policy file information
+	 * 
+	 * @param aPolicy CPolicy policy information from parser
+	 * 
+	 */
+	inline void StorePolicyL(const CPolicy& aPolicy);
+
+	
+private:
+	/*
+	 *  Constructor
+	 */
+	inline CRTSecMgrServer(CActive::TPriority aActiveObjectPriority);
+
+	/*
+	 *  Second phase constructor
+	 * 
+	 */
+	void ConstructL();
+
+	/*
+	 *  Server destructor
+	 * 
+	 */
+	~CRTSecMgrServer();
+
+private:
+
+	/*
+	 *  shutdown timer object
+	 * 
+	 */
+	CShutDown iShutDown;
+	
+	/*
+	 *  Session counter
+	 * 
+	 */
+	TInt iSessionCount;
+	
+	/*
+	 *  Session container index
+	 * 
+	 */
+	CObjectConIx* iContainerIndex;
+
+	/*
+	 *  Reference to policy manager
+	 * 
+	 */
+	CPolicyManager* iPolicyMgr;
+	
+	/*
+	 *  Reference to script manager
+	 * 
+	 */
+	CScriptManager* iScriptMgr;
+	
+	/*
+	 *  Reference to security manager store
+	 * 
+	 */
+	CSecMgrStore* iSecMgrDb;
+	};
+
+#include "rtsecmgrserver.inl"
+	
+#endif //C_CRTSECMGRSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserver.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+/*
+ *  Constructor
+ */
+inline CRTSecMgrServer::CRTSecMgrServer(CActive::TPriority aActiveObjectPriority) :
+  	//CServer2(aActiveObjectPriority)
+	CPolicyServer( aActiveObjectPriority, KSecMgrSrvPolicy)
+	{
+	iSessionCount = 0;
+	}
+
+/**
+ A utility function to panic the server.
+ */
+inline void CRTSecMgrServer::PanicServer(TSecMgrServPanic aPanic)
+	{
+	_LIT (KTxtSecMgrServer, "SecurityMgrServer");
+	User::Panic (KTxtSecMgrServer, aPanic);
+	}
+
+inline CObjectCon* CRTSecMgrServer::NewContainerL()
+	{
+	return iContainerIndex->CreateL ();
+	}
+
+inline void CRTSecMgrServer::AddSession()
+    {
+    iShutDown.Cancel();
+    ++iSessionCount;
+    }
+
+inline void CRTSecMgrServer::RemoveSession()
+    {
+    if (--iSessionCount == 0)
+    	if(!iShutDown.IsActive())
+        iShutDown.Start();    
+    }
+
+inline void CRTSecMgrServer::RemoveFromContainerIx(CObjectCon *aContainer)
+    {
+    iContainerIndex->Remove(aContainer);   
+    }
+
+inline TInt CRTSecMgrServer::GetScriptFile(TExecutableID aExecID,
+		TDes& aScriptFile)
+	{
+	return iScriptMgr->GetScriptFile (aExecID, aScriptFile);
+	}
+
+inline TInt CRTSecMgrServer::GetCapabilityInfo(CScript& aScriptInfo)
+	{
+	return iScriptMgr->ScriptInfo (aScriptInfo);
+	}
+
+inline void CRTSecMgrServer::UpdatePermGrantL(TExecutableID aExecID,
+		TPermGrant aPermGrant, TPermGrant aPermDenied)
+	{
+	iScriptMgr->UpdatePermGrantL (aExecID, aPermGrant, aPermDenied);
+	}
+
+inline TInt CRTSecMgrServer::ReadCounter(TExecutableID& aExecID)
+	{
+	return iSecMgrDb->ReadCounter (aExecID);
+	}
+
+inline void CRTSecMgrServer::AddPolicyL(TPolicyID aPolicyID,
+		const RProtectionDomains& aPolicyInfo, RAliasGroup& aAliasInfo)
+	{
+	CPolicy* policy = CPolicy::NewLC (aPolicyID, aPolicyInfo, aAliasInfo/*,RTrustArray()*/);
+	iPolicyMgr->RegisterPolicyL (*policy);
+	CleanupStack::Pop (policy);
+	}
+
+inline TInt CRTSecMgrServer::RemovePolicy(TPolicyID aPolicyID)
+	{
+	return iPolicyMgr->UnRegisterPolicy (aPolicyID);
+	}
+
+inline TExecutableID CRTSecMgrServer::RegisterScript(TPolicyID aPolicyID/*,const CTrustInfo& aTrustInfo*/)
+	{
+	return iScriptMgr->RegisterScript (aPolicyID);
+	}
+
+inline TExecutableID CRTSecMgrServer::RegisterScript(TPolicyID aPolicyID, const  TDesC& aHashValue)
+	{
+	return iScriptMgr->RegisterScript (aPolicyID, aHashValue);
+	}
+
+inline void CRTSecMgrServer::UnRegisterScriptL(TExecutableID aExecID,
+		TPolicyID aPolicyID)
+	{
+	iScriptMgr->UnRegisterScriptL (aExecID, aPolicyID);
+	}
+
+inline TBool CRTSecMgrServer::IsValidPolicy(TPolicyID aPolicyID) const
+	{
+	return iPolicyMgr->HasPolicy (aPolicyID);
+	}
+
+inline TInt CRTSecMgrServer::BackupFile(TPolicyID aPolicyID)
+	{
+	return iSecMgrDb->BackupFile(aPolicyID);
+	}
+	
+inline TInt CRTSecMgrServer::RemoveTempPolicy(TPolicyID aPolicyID)
+	{	
+	return iSecMgrDb->RemoveTempPolicy(aPolicyID);
+	}
+	
+inline TInt CRTSecMgrServer::RestoreTempPolicy(TPolicyID aPolicyID)
+	{	
+	return iSecMgrDb->RestoreTempPolicy(aPolicyID);
+	}
+
+inline CPolicy* CRTSecMgrServer::ReturnPolicyInfo(TPolicyID aPolicyID)
+	{	
+	return iPolicyMgr->Policy(aPolicyID);
+	}
+	
+inline void CRTSecMgrServer::StorePolicyL(const CPolicy& aPolicy)
+	{	
+	return iSecMgrDb->StorePolicyL(aPolicy);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserverdef.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Common server specific definitions
+ *
+*/
+
+
+
+
+
+
+#ifndef _RTSECMGRSERVERDEF_H
+#define _RTSECMGRSERVERDEF_H
+
+#include <e32base.h>
+
+#define KMaxName 256
+enum TFileType
+	{
+	EPolicy = 1,
+	EScript
+	};
+
+/** panic codes */
+enum TSecMgrServPanic
+	{
+	EBadRequest = 1,
+	EBadDescriptor,
+	EDescriptorNonNumeric,
+	EMainSchedulerError,
+	ESvrCreateServer,
+	ESvrStartServer,
+	ECreateTrapCleanup,
+	EBadCounterRemove,
+	EBadSubsessionHandle
+	};
+
+const TUid KCRUIdSecMgr =
+	{
+			0x2000F847
+	};
+
+const TUint32 KSecMgrScriptID = 0x2000F847;
+
+//Pre-defined capability strings that may be defined
+//as part of metadata information
+_LIT(KCapabilityTCB, "TCB");
+_LIT(KCapabilityCommDD, "CommDD");
+_LIT(KCapabilityPowerMgmt, "PowerMgmt");
+_LIT(KCapabilityMultimediaDD, "MultimediaDD");
+_LIT(KCapabilityReadDeviceData, "ReadDeviceData");
+_LIT(KCapabilityWriteDeviceData, "WriteDeviceData");
+_LIT(KCapabilityDRM, "DRM");
+_LIT(KCapabilityTrustedUI, "TrustedUI");
+_LIT(KCapabilityProtServ, "ProtServ");
+_LIT(KCapabilityDiskAdmin, "DiskAdmin");
+_LIT(KCapabilityNetworkControl, "NetworkControl");
+_LIT(KCapabilityAllFiles, "AllFiles");
+_LIT(KCapabilitySwEvent, "SwEvent");
+_LIT(KCapabilityNetworkServices, "NetworkServices");
+_LIT(KCapabilityLocalServices, "LocalServices");
+_LIT(KCapabilityReadUserData, "ReadUserData");
+_LIT(KCapabilityWriteUserData, "WriteUserData");
+_LIT(KCapabilityLocation, "Location");
+_LIT(KCapabilitySurroundingsDD, "SurroundingsDD");
+_LIT(KCapabilityUserEnvironment, "UserEnvironment");
+
+//pre-defined UserPromptOption strings
+_LIT(KUserPromptOneShot, "oneshot");
+_LIT(KUserPromptSession, "session");
+_LIT(KUserPromptBlanket, "blanket");
+_LIT(KNo, "no");
+
+_LIT(KPolicyDir, "policy");
+_LIT(KScriptDir, "script");
+_LIT(KDirSeparator, "\\");
+_LIT(KDatExtn, ".dat");
+_LIT(KCDrive, "c:");
+_LIT(KConfigFile, "config.dat");
+
+#endif    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrserverpolicy.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+/*
+ * Security Manager Server's policy
+ *
+ */
+
+/*
+ * Total number of ranges 
+ */
+const TUint KSecMgrSrvPolicyRangeCount = 1;
+
+// Definition of the ranges of IPC numbers
+const TInt KSecMgrSrvRanges[KSecMgrSrvPolicyRangeCount] =
+    {
+    0
+    //,   
+    //ESecMgrSrvReqEnd             // 2nd range, non implemented function end of range check; ENotSupported
+    };
+
+// Policy to implement for each of the above ranges
+const TUint8 KSecMgrSrvElementsIndex[KSecMgrSrvPolicyRangeCount] =
+    {
+    0
+    //,                           // Applies to 0th range
+    //CPolicyServer::ENotSupported // Applies to 1st range
+    };
+
+// Specific capability checks
+const CPolicyServer::TPolicyElement KSecMgrSrvElements[] =
+    {
+    { _INIT_SECURITY_POLICY_C1( ECapabilityReadUserData ),  CPolicyServer::EFailClient },  // Policy "0"
+    //{ _INIT_SECURITY_POLICY_C1( ECapabilityWriteDeviceData ), CPolicyServer::EFailClient },  // Policy "1"
+    //{ _INIT_SECURITY_POLICY_S0( KSensrvTestFrameworkUid ),    CPolicyServer::EPanicClient }, // Policy "2", i.e. access is allowed only for test framework
+    };
+
+// Package all the above together into a policy
+const CPolicyServer::TPolicy KSecMgrSrvPolicy =
+    {
+    CPolicyServer::EAlwaysPass, 	// All connect attempts to Security Manager Server pass
+    KSecMgrSrvPolicyRangeCount,    // Number of ranges
+    KSecMgrSrvRanges,              // Ranges array
+    KSecMgrSrvElementsIndex,       // Elements <-> ranges index
+    KSecMgrSrvElements,            // Array of elements
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsession.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Security Manager Server Session Class
+ *
+*/
+
+
+
+
+
+
+#ifndef C_CRTSECMGRSESSION_H
+#define C_CRTSECMGRSESSION_H
+
+#include "rtsecmgrcommondef.h"
+#include "rtsecmgrdata.h"
+
+class CSecMgrStore;
+class CRepository;
+class CRTSecMgrSubSession;
+
+/*
+ * Server side session class
+ * 
+ * @exe rtsecmgrserver.exe
+ * 
+ */
+class CRTSecMgrSession : public CSession2
+	{
+public:
+
+	/*
+	 * Destructor
+	 * 
+	 */
+	inline ~CRTSecMgrSession();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CRTSecMgrSession instance
+	 * 
+	 * @return CRTSecMgrSession* pointer to an instance of CRTSecMgrSession
+	 */
+	inline static CRTSecMgrSession* NewL();
+
+	/*
+	 * Called by client/server framework after 
+	 * session has been successfully created
+	 * 
+	 */
+	virtual void CreateL();
+
+	/*
+	 * Treats incoming service requests
+	 * and disatches accordingly
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 */
+	inline void ServiceL(const RMessage2& aMessage);
+
+	/*
+	 * Dispatches message to sub-session if the message
+	 * is to be handled by server sub-session. Server
+	 * session related messages are treated locally
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 */
+	void DispatchMessageL(const RMessage2& aMessage);
+
+	/*
+	 * Creates new subsession
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 */
+	void NewSubSessionL(const RMessage2& aMessage);
+
+	/*
+	 * Closes the subsession
+	 * 
+	 */
+	void CloseSession();
+
+	/*
+	 * Delete the subsession object through its handle.
+	 * 
+	 * @param aHandle TInt Subsession handle
+	 */
+	inline void DeleteSubSession(TInt aHandle);
+
+	/*
+	 * Gets The SubSession from Hnadle
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * @param aHandle TInt Subsession handle
+	 * 
+	 * @return CRTSecMgrSubSession* pointer to subsession object
+	 */
+	CRTSecMgrSubSession* SubSessionFromHandle(const RMessage2& aMessage,
+			TInt aHandle);
+
+	/*
+	 * Utility method to panic client
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * @param aPanic TInt Panic error code
+	 * 
+	 */
+	inline void PanicClient(const RMessage2& aMessage, TInt aPanic) const;
+
+	/*
+	 * Message handler method to set policy
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * @param aIsUpdate TBool Toggle to identify whether the incoming
+	 * message is for setting policy or updating policy
+	 * 
+	 */
+	void SetPolicy(const RMessage2& aMessage, TBool aIsUpdate=EFalse);
+
+	/*
+	 * Message handler method to update policy
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * 
+	 */
+	void UpdatePolicy(const RMessage2& aMessage);
+
+	/*
+	 * Message handler method to unset policy
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * 
+	 */
+	void UnsetPolicy(const RMessage2& aMessage);
+
+	/*
+	 * Message handler method to register script
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * @param aHashValue Toggle to indicate if script has hash value
+	 * 
+	 */
+	void RegisterScript(const RMessage2& aMessage, TBool aHashValue=EFalse);
+
+	/*
+	 * Message handler method to un-register script
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * 
+	 */
+	void UnregisterScript(const RMessage2& aMessage);
+
+	/*
+	 * Message handler method to create script sub-session
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * 
+	 */
+	void GetScriptSessionL(const RMessage2& aMessage);
+
+	/*
+	 * Message handler method to create script sub-session
+	 * for trusted unregistered scripts
+	 * 
+	 * @param aMessage const RMessage2& Incoming message
+	 * 
+	 */
+	void GetTrustedUnRegScriptSessionL(const RMessage2& aMessage);
+
+	/*
+	 * Utility method to find out if a script sub-session is open
+	 * with the script having the assocaited policy identifier 
+	 * specified in the input argument
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier to be checked
+	 * 
+	 * @return TBool EFalse if no parallel script sub-sessions are open; ETrue 
+	 * otherwise ETrue
+	 * 
+	 */
+	TBool IsScriptOpenWithPolicy(TPolicyID aPolicyID);
+
+	/*
+	 * Utility method to find out if a script sub-session is open
+	 * with the script having the script identifier 
+	 * specified in the input argument
+	 * 
+	 * @param aScriptID TExecutableID script identifier to be checked
+	 * 
+	 * @return TBool EFalse if no parallel script sub-sessions are open; ETrue 
+	 * otherwise ETrue
+	 * 
+	 */
+	TBool IsScriptSessionOpen(TExecutableID aScriptID,CRTSecMgrSubSession* aCurrentSession=NULL);
+
+private:
+
+	/*
+	 * Default private constructor
+	 * 
+	 * 
+	 */
+	inline CRTSecMgrSession();
+
+private:
+	/*
+	 *  Object container for this session.
+	 * 
+	 */
+	CObjectCon *iContainer;
+
+	/*
+	 *  Object index which stores objects
+	 * 
+	 */
+	CObjectIx* iSubSessionObjectIndex;
+
+	/*
+	 * subsession counter
+	 * 
+	 */
+	TInt iSubSessionCount;
+	/*
+	 * Security manager server instance
+	 * 
+	 * Stored as member variable for convenient
+	 * access
+	 */
+	CRTSecMgrServer* iSecMgrServer;
+	};
+
+#include "rtsecmgrsession.inl"
+
+#endif //C_CRTSECMGRSESSION_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsession.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+inline CRTSecMgrSession::CRTSecMgrSession()
+	{
+	iSecMgrServer = dynamic_cast<CRTSecMgrServer*> (const_cast<CServer2*> (Server()));
+	}
+inline CRTSecMgrSession::~CRTSecMgrSession()
+	{
+	}
+
+inline CRTSecMgrSession* CRTSecMgrSession::NewL()
+	{
+	return new (ELeave) CRTSecMgrSession();
+	}
+
+/**
+ * First line servicing of a client request.
+
+ * This function dispatches requests to the appropriate handler.
+ * Some messages are handled by the session itself, and are
+ * implemented as CRTSecMgrSession member functions, while 
+ * other messages are handled by the subsession, and are
+ * implemented as CRTSecMgrSubSession member functions.
+ */
+inline void CRTSecMgrSession::ServiceL(const RMessage2& aMessage)
+	{
+	TRAPD(err,DispatchMessageL(aMessage));
+	aMessage.Complete (err);
+	}
+
+/**
+ * Delete a subsession object through its handle.
+ * 
+ */
+inline void CRTSecMgrSession::DeleteSubSession(TInt aHandle)
+	{
+	// This will delete the SubSession object; the object is
+	// reference counted, and removing the handle causes the object to be closed
+	// [closing reduces the access count - the object is deleted if the access
+	//  count reaches zero etc].
+	iSubSessionObjectIndex->Remove (aHandle);
+	// decrement resource count
+	iSubSessionCount--;
+	}
+
+inline void CRTSecMgrSession::PanicClient(const RMessage2& aMessage, TInt aPanic) const
+	{
+	_LIT(KTxtServer,"SecurityMgr server");
+	aMessage.Panic (KTxtServer, aPanic);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrshutdown.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+
+inline CShutDown::CShutDown() :
+	CTimer(-1)
+	{
+	CActiveScheduler::Add (this);
+	}
+inline void CShutDown::ConstructL()
+	{
+	CTimer::ConstructL ();
+	}
+inline void CShutDown::Start()
+	{
+	After (KShutDownDelay);
+	}
+
+inline CShutDown::~CShutDown()
+	{
+	}
+
+inline void CShutDown::RunL()
+	{
+	CActiveScheduler::Stop ();
+	CActiveScheduler::Install (NULL);
+	}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrstore.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,292 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of security manager persistent store class
+ *
+*/
+
+
+
+
+
+
+#ifndef C_RTSECMGRSTORE_H
+#define C_RTSECMGRSTORE_H
+
+#include <e32std.h>
+#include <badesca.h>
+#include <d32dbms.h>
+#include <f32file.h>
+#include <s32file.h>
+#include "rtsecmgrcommondef.h"
+#include "rtsecmgrserverdef.h"
+#include "rtsecmgrdata.h"
+
+/*
+ * Abstracts the underlying security manager persistent storage
+ * type.
+ * 
+ * Provides methods to store and retrieve security policy data
+ * and script related data.
+ *
+ * @see CProtectionDomain
+ * @see CScript
+ * 
+ * @exe rtsecmgrserver.exe
+ */
+NONSHARABLE_CLASS(CSecMgrStore) : public CBase
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CSecMgrStore instance
+	 * 
+	 * @return CSecMgrStore* pointer to an instance of CSecMgrStore
+	 */
+	static CSecMgrStore* NewL();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CSecMgrStore instance and leaves the created
+	 * instance on the cleanupstack
+	 * 
+	 * @return CSecMgrStore* pointer to an instance of CSecMgrStore
+	 */
+	static CSecMgrStore* NewLC();
+
+	/**
+	 * Destructor
+	 * 
+	 * Closes file session connection
+	 * 
+	 */
+	inline ~CSecMgrStore();
+
+	/**
+	 * Updates policy data to the stream.
+	 * 
+	 * This method creates a new policy file with the name equivalent to
+	 * policy identifier under security manager servers private directory.
+	 * 
+	 * The policy data are serialized to the newly created policy file.
+	 * 
+	 * If policy file already exists, the content will be overwritten.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier
+	 * @param aPolicies const RProtectionDomains& list of domains to serialize
+	 * 
+	 */
+	void StorePolicyL(const CPolicy& aPolicy);
+
+	/**
+	 * Removes policy file from the persistent storage.
+	 * 
+	 * This method looks for an existing policy file with the name equivalent to
+	 * policy identifier under security manager servers private directory. If policy
+	 * file is found, the file will be deleted from file system.
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier of the policy to be removed
+	 *
+	 * @return KErrNone if policy file removal corresponding to policy identifier passed is successful;
+	 *                  Otherwise, one of system wide error codes
+	 * 
+	 */
+	TInt RemovePolicy(TPolicyID aPolicyID);
+
+	/**
+	 * Restores policy data from the stream.
+	 * 
+	 * This method internalizes the policy data from the persistent
+	 * storage.
+	 * 
+	 * @param aPolicies RPolicies& Input policy data to be internalized
+	 * 
+	 */
+	void RestorePoliciesL(RPolicies& aPolicies);
+
+	/**
+	 * Registers a script with security manager persistent store.
+	 * 
+	 * This method creates a new script file externalizing the script
+	 * data to the persistent stream.
+	 * 
+	 * @param aExecID TExecutableID script identifier
+	 * @param aPolicyID TPolicyID policy identifier of the script
+	 * @param aScript const CScript& script data to be serialized
+	 * 
+	 */
+	void RegisterScriptL(TExecutableID aExecID, const CScript& aScript);
+
+	/**
+	 * UnRegisters a script with security manager persistent store. 
+	 * 
+	 * This method removes an existing script file from the persistent stream.
+	 * 
+	 * @param aExecID TExecutableID script identifier to be removed
+	 * 
+	 */
+	void UnRegisterScriptL(TExecutableID aExecID);
+
+	/**
+	 * Internalizes the script data structure with script
+	 * information read from the persistent store
+	 * 
+	 * @param aExecID TExecutableID script identifier
+	 * @param aScriptInfo CScript& script data to be internalized
+	 * 
+	 */
+	TInt ReadScriptInfo(TExecutableID aExecID, CScript& aScriptInfo);
+
+	/**
+	 * Utility method to get the script file name given the script identifier.
+	 * 
+	 * @param aExecID TExecutableID script identifier
+	 * @param aScriptFile TDes& output file name to be returned
+	 * 
+	 * @return KErrNone if script file name is found; Otherwise one of
+	 * system wide error codes
+	 * 
+	 */
+	TInt GetScriptFile(TExecutableID aExecID,TDes& aScriptFile);
+
+	/**
+	 * Externalizes the script data structure with script
+	 * information read to the persistent store
+	 * 
+	 * @param aExecID TExecutableID script identifier
+	 * @param aScriptInfo CScript& script data to be externalized
+	 * 
+	 */
+	void WriteScriptInfoL(TExecutableID aExecID, CScript& aScriptInfo);
+
+	/**
+	 * Reads the script identifier from security manager configuration
+	 * repository
+	 * 
+	 * @param aExecID TExecutableID& output script identifier
+	 * 
+	 * @return KErrNone if reading of identifier is successful; Otherwise
+	 * one of system wide error codes
+	 */
+	TInt ReadCounter(TExecutableID& aExecID);
+
+	/**
+	 * Writes the script identifier to security manager configuration
+	 * repository
+	 * 
+	 * @param aExecID TExecutableID script identifier to be externalized
+	 * 
+	 * @return KErrNone if writing of identifier is successful; Otherwise
+	 * one of system wide error codes
+	 */
+	TInt WriteCounter(TExecutableID aExecID);
+
+	/*
+	 * Utility method to create a backup for the policy file
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * getting backed up
+	 * @return KErrNone if backupfile is successsfully created
+	 *
+	 */
+		
+	TInt BackupFile(TPolicyID aPolicyID);
+	
+	/*
+	 * Utility method to remove the backup file created
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * whose backup is getting removed
+	 * @return KErrNone if backup file is successsfully removed
+	 *
+	 */
+	TInt RemoveTempPolicy(TPolicyID aPolicyID);
+	
+	/*
+	 * Utility method to restore the backup file created if update fails
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier for the file
+	 * which is restored back
+	 * @return KErrNone if backup file is successsfully restored
+	 *
+	 */
+	TInt RestoreTempPolicy(TPolicyID aPolicyID);
+	
+private:
+
+	/*
+	 * Default private constructor
+	 */
+	inline CSecMgrStore();
+
+	/*
+	 * Two-phased constructor
+	 * 
+	 */
+	inline void ConstructL();
+
+	/*
+	 * Utility method to get security manager's private path
+	 * 
+	 */
+	TInt GetPrivatePath(TDes& aPrivatePath);
+
+	/*
+	 * Utility method to get security manager's configuration file
+	 * 
+	 */
+	TInt GetConfigFile(TDes& aPrivatePath);
+
+	/*
+	 * Utility method to get security manager's policy file
+	 * name
+	 * 
+	 */
+	TInt GetPolicyPath(TDes& aFile);
+	
+	/*
+	 * Utility method to get security manager's script file
+	 * storage path
+	 * 
+	 */
+	TInt GetScriptPath(TDes& aFile);
+
+	/*
+	 * Utility method to get security manager's script file
+	 * name given a script identifier
+	 * 
+	 */
+	TInt GetScriptFile(TDes& aFile,TExecutableID aExecID);
+
+
+
+	/*
+	 * Utility method to get security manager's policy file
+	 * name given the policy identifier
+	 * 
+	 */
+	TInt GetPolicyFile(TDes& aFile,TPolicyID aPolicyID);
+	
+
+private:
+
+	//underlying file session 
+	RFs iFsSession;
+	};
+
+#include "rtsecmgrstore.inl"
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrstore.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+/*
+ * Default private constructor
+ */
+inline CSecMgrStore::CSecMgrStore()
+	{
+	}
+
+/*
+ * Two-phased constructor
+ * 
+ */
+inline void CSecMgrStore::ConstructL()
+	{
+	User::LeaveIfError (iFsSession.Connect ());
+	}
+
+/**
+ * Destructor
+ * 
+ * Closes file session connection
+ * 
+ */
+inline CSecMgrStore::~CSecMgrStore()
+	{
+	iFsSession.Close ();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsubsession.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Security Manager Server Script Sub-Session Class
+ *
+*/
+
+
+
+
+
+
+#ifndef C_CRTSECMGRSUBSESSION_H
+#define C_CRTSECMGRSUBSESSION_H
+
+#include "rtsecmgrcommondef.h"
+#include "rtsecmgrdata.h"
+#include "rtsecmgrserver.h"
+
+class CRTSecMgrSession;
+
+/*
+ * Server side script sub-session class
+ * 
+ * @exe rtsecmgrserver.exe
+ * 
+ */
+class CRTSecMgrSubSession : public CObject
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CRTSecMgrSubSession instance
+	 * 
+	 * @return CRTSecMgrSubSession* pointer to an instance of CRTSecMgrSession
+	 */
+	inline static CRTSecMgrSubSession* NewL(CRTSecMgrSession* aSession,
+			CScript* aScript,CRTSecMgrServer* aSecMgrServer);
+
+	/**
+	 * Destructor
+	 * 
+	 */
+	inline ~CRTSecMgrSubSession();
+
+	/**
+	 * Handles get script file service
+	 * 
+	 * @param aMessage const RMessage2& Input message
+	 * 
+	 */
+	void GetScriptFile(const RMessage2& aMessage);
+
+	/**
+	 * Handles update permanent permission service
+	 * 
+	 * @param aMessage const RMessage2& Input message
+	 * 
+	 */
+	void UpdatePermGrantL(const RMessage2& aMessage);
+
+	/**
+	 * Gets script identifier of the underlying script object
+	 * 
+	 * @return TExecutableID script identifier of script object
+	 * 
+	 */
+	inline TExecutableID ScriptID() const;
+
+	/**
+	 * Gets the underlying script object
+	 * 
+	 * @return const CScript& the script object
+	 * 
+	 */
+	inline const CScript& Script() const;
+private:
+
+	/**
+	 * Constructor
+	 * 
+	 */
+	inline CRTSecMgrSubSession(CRTSecMgrSession* aSession, CScript* aScript,CRTSecMgrServer* aSecMgrServer);
+
+private:
+
+	/*
+	 * 
+	 * Reference to parent session object
+	 */
+	CRTSecMgrSession* iSession; // The session that owns this CRTSecMgrSession object.
+
+	/*
+	 * script identifier
+	 * 
+	 */
+	TExecutableID iScriptID;
+
+	/*
+	 * 
+	 * pointer to script object
+	 */
+	CScript* iScript;
+	/*
+	 * Security manager server instance
+	 * 
+	 * Stored as member variable for convenient
+	 * access
+	 */
+	CRTSecMgrServer* iSecMgrServer;
+	};
+
+#include "rtsecmgrsubsession.inl"
+
+#endif //C_CRTSECMGRSUBSESSION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrsubsession.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+
+inline CRTSecMgrSubSession::CRTSecMgrSubSession(CRTSecMgrSession* aSession,
+		CScript* aScriptInfo, CRTSecMgrServer* aSecMgrServer) :
+	iSession(aSession), iScript(aScriptInfo),iSecMgrServer(aSecMgrServer)
+	{
+	}
+
+inline CRTSecMgrSubSession* CRTSecMgrSubSession::NewL(CRTSecMgrSession* aSession,
+		CScript* aScript,CRTSecMgrServer* aSecMgrServer)
+	{
+	return new (ELeave) CRTSecMgrSubSession(aSession,aScript,aSecMgrServer);
+	}
+
+inline CRTSecMgrSubSession::~CRTSecMgrSubSession()
+	{
+	delete iScript;
+	}
+
+inline TExecutableID CRTSecMgrSubSession::ScriptID() const
+	{
+	if ( iScript)
+		{
+		return iScript->ScriptID ();
+		}
+
+	return KAnonymousScript;
+	}
+
+inline const CScript& CRTSecMgrSubSession::Script() const
+	{
+	return *iScript;
+	}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrclientapi.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,402 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Implementation file for security manager server, session and 
+ * 				  sub-session classes 
+ *
+*/
+
+
+
+
+
+
+#include <f32file.h>
+#include <e32debug.h>
+#include <rtsecmgrcommondef.h>
+#include "rtsecmgrserver.h"
+#include "rtsecmgrsession.h"
+#include "rtsecmgrsubsession.h"
+#include "rtsecmgrpolicyparser.h"
+#include "rtsecmgrstore.h"
+#include "rtsecmgrprotectiondomain.h"
+#include "rtsecmgrpolicymanager.h"
+#include "rtsecmgrscriptmanager.h"
+#include "rtsecmgrmsg.h"
+
+_LIT(KUntrusted, "UnTrusted");
+
+TInt CRTSecMgrServer::GetCapabilityInfo(TPolicyID aPolicyID,
+		TExecutableID aExecID, CScript& aScript)
+	{
+	if ( KAnonymousScript==aExecID)
+		{
+		CPolicy* policy = iPolicyMgr->Policy (aPolicyID);
+		if ( policy)
+			{
+			CProtectionDomain* domain = policy->ProtectionDomain (KUntrusted);
+
+			if ( domain)
+				{
+				const CPermissionSet& permissionSet = domain->PermSet ();
+				aScript.SetPermissionSet (permissionSet);
+				return KErrNone;
+				}
+			}
+		}
+
+	return KErrNotFound;
+	}
+
+void CRTSecMgrSession::SetPolicy(const RMessage2& aMessage, TBool aIsUpdate)
+	{
+	if(!aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+	    {
+	    TPckgBuf<TInt> pkg(ErrAccessDenied);
+	    aMessage.Write(EMsgArgZero , pkg);
+	    return;
+	    }
+	RFile secPolicyFile;
+	TPolicyID pID(ErrInvalidPolicyID);
+
+	if ( KErrNone==secPolicyFile.AdoptFromClient (aMessage, EMsgArgOne,
+			EMsgArgTwo))
+		{
+		CPolicyParser* policyParser = CPolicyParser::NewLC ();
+		TInt ret(KErrNone);
+
+		RProtectionDomains policyInfo;
+		RAliasGroup aliasInfo;
+		ret=policyParser->GetPolicyInfo (secPolicyFile, policyInfo, aliasInfo);
+
+		if (KErrNone==ret)
+			{
+			if(aIsUpdate)
+				{
+				TPckgBuf<TInt> pIDPckg;
+				aMessage.Read(0, pIDPckg);
+				pID = pIDPckg();
+				}
+			else
+				{
+				if ( KErrNone==iSecMgrServer->ReadCounter (pID))
+					{
+					while (iSecMgrServer->IsValidPolicy(pID))
+						{
+						--pID ;
+						}
+					}
+				else
+					{
+					pID = ErrServerReadConfig;
+					}
+				}
+			TRAPD (err, iSecMgrServer->AddPolicyL (pID, policyInfo, aliasInfo));
+			
+			if ( KErrNone!=err)
+				{
+				pID = ErrSetPolicyFailed;
+				}						
+				
+			}
+		else
+			{
+			pID = ErrInvalidPolicyFormat;
+			policyInfo.ResetAndDestroy ();
+			}
+		CleanupStack::PopAndDestroy (policyParser);
+		}
+	else
+		{
+		pID = ErrFileSessionNotShared;
+		}
+
+	secPolicyFile.Close();
+	
+	TPckgBuf<TInt> pkg(pID);
+	aMessage.Write (EMsgArgZero, pkg);
+	}
+
+void CRTSecMgrSession::UpdatePolicy(const RMessage2& aMessage)
+	{
+	if(!aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+        {
+        TPckgBuf<TInt> pkg(ErrAccessDenied);
+        aMessage.Write(EMsgArgZero , pkg);
+        return;
+        }
+	TPckgBuf<TInt> pIDPckg;
+	aMessage.Read (0, pIDPckg);
+
+	TPolicyID pID(pIDPckg ());
+
+		//Check if this ID already exists
+	if ( !iSecMgrServer->IsValidPolicy(pID))
+		{
+		TPckgBuf<TInt> pkg(ErrUpdatePolicyFailed);
+		aMessage.Write (EMsgArgZero, pkg);
+		RFile secPolicyFile;
+		//just to close the secPolicyFile. Else the temmporary file cannot be deleted
+		secPolicyFile.AdoptFromClient (aMessage, EMsgArgOne,EMsgArgTwo);
+		secPolicyFile.Close();
+		return;
+		}
+	else
+		{
+		if ( IsScriptOpenWithPolicy (pID))
+			{
+			TPckgBuf<TInt> pkg(ErrUpdatePolicyFailed);
+			aMessage.Write (EMsgArgZero, pkg);
+			return;
+			}
+		}
+
+	//back up the file before update (file with this policy Id)
+	TInt backupResult = iSecMgrServer->BackupFile(pID);
+	
+	if(KErrNone == backupResult)
+		{
+			SetPolicy (aMessage, ETrue);
+			
+			aMessage.Read(0, pIDPckg);
+			TInt resultSetPolicy = pIDPckg();		
+			
+			if(resultSetPolicy < KErrNone)
+				{
+					//means that the policy updation is NOT successful due to invalid policy file
+					//Hence retain the previous file by restoring the temp file
+					TInt restoreResult = iSecMgrServer->RestoreTempPolicy(pID);
+					
+					if(KErrNone != restoreResult)
+					{
+						// file backup not created due to errors
+						TPckgBuf<TInt> pkg(ErrRestoreTempFailed);
+						aMessage.Write (EMsgArgZero, pkg);
+						return;
+					}
+				}
+
+			//Backup file is no longer useful. 
+			//Hence removing this temporary file using the method below
+			TInt rmTempResult = iSecMgrServer->RemoveTempPolicy(pID);	
+			if(KErrNone != rmTempResult)
+			{
+				//temporary file not removed
+				
+			}	
+	}
+	else
+	{
+		// file backup not created due to errors
+		TPckgBuf<TInt> pkg(ErrBackupNotCreated);
+		aMessage.Write (EMsgArgZero, pkg);
+		return;
+		
+	}	
+	
+	}
+
+void CRTSecMgrSession::UnsetPolicy(const RMessage2& aMessage)
+	{
+	if(!aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+        {
+        TPckgBuf<TInt> pkg(ErrAccessDenied);
+        aMessage.Write(EMsgArgZero , pkg);
+        return;
+        }
+	TPolicyID pID = aMessage.Int0 ();
+
+	TInt result = ErrUnSetPolicyFailed;
+
+	if ( !IsScriptOpenWithPolicy(pID))
+		{
+		result = iSecMgrServer->RemovePolicy (pID);
+		}
+	if( KErrNone>result )
+		result = ErrUnSetPolicyFailed;
+	
+	TPckgBuf<TInt> retVal(result);
+	aMessage.Write (EMsgArgOne, retVal);
+	}
+
+void CRTSecMgrSession::RegisterScript(const RMessage2& aMessage, TBool aIsHashed)
+	{
+	if( !aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+        {
+        TPckgBuf<TInt> pkg(ErrAccessDenied);
+        aMessage.Write(EMsgArgZero , pkg);
+        return;
+        }
+	if ( aIsHashed)
+		{
+		HBufC8* desData = HBufC8::NewLC (KMaxMsgLength);
+		TPtr8 readPtr(desData->Des ());
+		aMessage.ReadL (0, readPtr);
+		CRTSecMgrRegisterScriptMsg
+				* scriptMsg = CRTSecMgrRegisterScriptMsg::NewLC (*desData);
+
+		TExecutableID scriptID = iSecMgrServer->RegisterScript (scriptMsg->PolicyID(),scriptMsg->HashValue());
+		
+		TPckgBuf<TInt> exeIDPkg(scriptID);
+		aMessage.Write (EMsgArgOne, exeIDPkg);
+
+		CleanupStack::PopAndDestroy (scriptMsg);
+		CleanupStack::PopAndDestroy (desData);		
+		}
+	else
+		{
+		TPolicyID policyID = aMessage.Int0 ();
+
+		TExecutableID scriptID = iSecMgrServer->RegisterScript (policyID);
+
+		if ( KErrNone>scriptID)
+			scriptID = ErrRegisterScriptFailed;
+
+		TPckgBuf<TInt> exeIDPkg(scriptID);
+		aMessage.Write (EMsgArgOne, exeIDPkg);
+		}
+
+	}
+
+void CRTSecMgrSession::UnregisterScript(const RMessage2& aMessage)
+	{
+	if(!aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+        {
+        TPckgBuf<TInt> pkg(ErrAccessDenied);
+        aMessage.Write(EMsgArgZero , pkg);
+        return;
+        }
+	TExecutableID scriptID(aMessage.Int0 ());
+	TPolicyID policyID(aMessage.Int1 ());
+
+	TInt result = KErrNone;
+
+	if ( !IsScriptSessionOpen(scriptID))
+		{
+		TRAP (result, iSecMgrServer->UnRegisterScriptL (scriptID, policyID));
+		if(KErrNone>result)
+				result = ErrUnRegisterScriptFailed;	
+		}
+	else
+		{
+		result = ErrUnRegisterScriptFailed;
+		}
+
+	TPckgBuf<TInt> errCode(result);
+	aMessage.Write (EMsgArgTwo, errCode);
+	}
+
+void CRTSecMgrSession::GetScriptSessionL(const RMessage2& aMessage)
+	{
+	if(!aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+        {
+        User::Leave(ErrAccessDenied);
+        }
+	TExecutableID scriptID = (TExecutableID)aMessage.Int0();
+	TPolicyID policyID = (TPolicyID)aMessage.Int1();
+
+	CScript* script = CScript::NewLC (policyID, scriptID);
+
+	User::LeaveIfError (iSecMgrServer->GetCapabilityInfo (*script));
+
+	if(script->PolicyID() != policyID || !iSecMgrServer->IsValidPolicy(policyID))
+	{
+		User::Leave(ErrInvalidPolicyID);
+	}
+	
+	CleanupStack::Pop (script);
+
+	CRTSecMgrSubSession* counter = CRTSecMgrSubSession::NewL (this, script, iSecMgrServer);
+	CleanupStack::PushL (counter);
+
+	// add the CCountSubSession object to 
+	// this subsession's object container
+	// to gererate a unique id
+	iContainer->AddL (counter);
+
+	// Add the object to object index; this returns
+	// a unique handle so that we can find the object
+	// again laterit later.
+	TInt handle=iSubSessionObjectIndex->AddL (counter);
+
+	// Write the handle value back to the client.
+	// NB It's not obvious but the handle value must be passed
+	// back as the 4th parameter (i.e. parameter number 3 on
+	// a scale of 0 to 3). 
+	// The arguments that are passed across are actually
+	// set up by RSubSessionBase::DoCreateSubSession().
+	// If you pass your own arguments into a call
+	// to RSubSessionBase::CreateSubSession(), which calls DoCreateSubSession, 
+	// then only the first three are picked up - the 4th is reserved for the
+	// the subsession handle.
+	TPckgBuf<TInt> handlePckg(handle);
+	aMessage.Write (EMsgArgThree, handlePckg);
+
+	CleanupStack::Pop (counter);
+	}
+
+void CRTSecMgrSession::GetTrustedUnRegScriptSessionL(const RMessage2& aMessage)
+	{
+	if(!aMessage.HasCapability(ECapabilityWriteDeviceData , ""))
+        {
+        User::Leave(ErrAccessDenied);
+        }
+	//0th parameter - ScriptID
+	//1st parameter - PolicyID	
+	TExecutableID scriptID = (TExecutableID)aMessage.Int0(); //typically this is KAnonymousScript
+	TPolicyID policyID = (TExecutableID)aMessage.Int1();
+
+	CScript* script = CScript::NewLC (policyID, scriptID);
+
+	User::LeaveIfError (iSecMgrServer->GetCapabilityInfo(policyID, scriptID, *script));
+
+	CleanupStack::Pop (script);
+
+	CRTSecMgrSubSession* counter = CRTSecMgrSubSession::NewL (this, script, iSecMgrServer);
+	CleanupStack::PushL (counter);
+
+	iContainer->AddL (counter);
+	TInt handle=iSubSessionObjectIndex->AddL (counter);
+	TPckgBuf<TInt> handlePckg(handle);
+	aMessage.Write (EMsgArgThree, handlePckg);
+
+	CleanupStack::Pop (counter);
+	}
+
+void CRTSecMgrSubSession::GetScriptFile(const RMessage2& aMessage)
+	{
+	RFile scriptFile;
+
+	if ( KErrNone==scriptFile.AdoptFromClient (aMessage, EMsgArgOne,
+			EMsgArgTwo))
+		{
+		RFileWriteStream rfws(scriptFile);
+		iScript->ExternalizeL (rfws);
+		rfws.Close ();
+		scriptFile.Close ();
+		}
+	}
+
+void CRTSecMgrSubSession::UpdatePermGrantL(const RMessage2& aMessage)
+	{
+	if ( !iSession->IsScriptSessionOpen(aMessage.Int0(),this))
+		{
+		iSecMgrServer->UpdatePermGrantL (aMessage.Int0 (), aMessage.Int1 (),
+				aMessage.Int2 ());
+		}
+	else
+		{
+		TPckgBuf<TInt> pkg((TInt)ErrUpdatePermGrantFailed);
+		aMessage.Write (EMsgArgZero, pkg);
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrpolicy.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines security policy data structure 
+ *
+*/
+
+
+
+
+
+
+#include <e32debug.h>
+#include "rtsecmgrpolicy.h"
+#include "rtsecmgrserverdef.h"
+
+CPolicy::CPolicy(TPolicyID aPolicyID) :
+	iPolicyID(aPolicyID)
+	{
+	}
+
+void CPolicy::ConstructL(const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup)
+	{
+	iAccessPolicy.Reset();
+	iAliasGroup.Reset();
+	iAccessPolicy = aProtectionDomains;
+	iAliasGroup = aAliasGroup;
+	}
+
+CPolicy* CPolicy::NewL(TPolicyID aPolicyID,
+		const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup)
+	{
+	CPolicy* self = CPolicy::NewLC (aPolicyID, aProtectionDomains, aAliasGroup);
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+CPolicy* CPolicy::NewLC(TPolicyID aPolicyID,
+		const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup)
+	{
+	CPolicy* self = new (ELeave) CPolicy(aPolicyID);
+	CleanupStack::PushL (self);
+	self->ConstructL (aProtectionDomains, aAliasGroup);
+	return self;
+	}
+
+CPolicy* CPolicy::NewL(TPolicyID aPolicyID, RStoreReadStream& aSource)
+	{
+	CPolicy* self = CPolicy::NewLC (aPolicyID, aSource);
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+CPolicy* CPolicy::NewLC(TPolicyID aPolicyID, RStoreReadStream& aSource)
+	{
+	CPolicy* self = new (ELeave) CPolicy(aPolicyID);
+	CleanupStack::PushL (self);
+	self->InternalizeL (aSource);
+	return self;
+	}
+
+void CPolicy::InternalizeL(RStoreReadStream& aSource)
+	{
+	//Read version of the policy
+	TReal version(aSource.ReadReal32L());
+	TInt aliasCnt(aSource.ReadInt32L());
+	
+	for (TInt i(0); i<aliasCnt;++i)
+		{
+		CPermission* alias = CPermission::NewL ();
+		alias->InternalizeL(aSource);
+		iAliasGroup.Append (alias);
+		}
+		
+	TInt domainCnt(aSource.ReadInt32L ());
+	for (TInt i(0); i<domainCnt;++i)
+		{
+		CProtectionDomain* domain = CProtectionDomain::NewL (aSource);
+		iAccessPolicy.Append (domain);
+		}
+	}
+
+CProtectionDomain* CPolicy::ProtectionDomain(const TDesC& aDomainName) const
+	{
+	for (TInt idx(0); idx<iAccessPolicy.Count ();++idx)
+		{
+		if ( KErrNone ==iAccessPolicy[idx]->DomainName().CompareF (aDomainName))
+			{
+			return iAccessPolicy[idx];
+			}
+		}
+
+	return NULL;
+	}
+
+CPermission* CPolicy::AliasGroup(const TDesC& aAliasName) const
+	{
+	for (TInt idx(0); idx<iAliasGroup.Count ();++idx)
+		{
+		if ( KErrNone ==iAliasGroup[idx]->PermName().CompareF (aAliasName))
+			{
+			return iAliasGroup[idx];
+			}
+		}
+
+	return NULL;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrpolicymanager.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of policy manager class
+ *
+*/
+
+
+
+
+
+
+#include <e32debug.h>
+#include "rtsecmgrpolicymanager.h"
+#include "rtsecmgrserverdef.h"
+
+CPolicyManager* CPolicyManager::NewL(CSecMgrStore* aSecMgrDB)
+	{
+	CPolicyManager* self = CPolicyManager::NewLC(aSecMgrDB);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CPolicyManager* CPolicyManager::NewLC(CSecMgrStore* aSecMgrDB)
+	{
+	CPolicyManager* self = new (ELeave) CPolicyManager(aSecMgrDB);
+	CleanupStack::PushL (self);
+	return self;
+	}
+
+void CPolicyManager::RegisterPolicyL(const CPolicy& aPolicy)
+	{
+	//Remove the policy if it already exists
+	for (TInt idx(0); idx!=iPolicies.Count ();++idx)
+		{
+		if ( aPolicy.PolicyID ()==iPolicies[idx]->PolicyID ())
+			{
+			delete iPolicies[idx];
+			iPolicies.Remove (idx);
+			break;
+			}
+		}
+
+	//update the cache
+	iPolicies.AppendL (&aPolicy);
+
+	iSecMgrDB->StorePolicyL (aPolicy);
+	}
+
+TInt CPolicyManager::UnRegisterPolicy(TPolicyID aPolicyID)
+	{
+	TBool exists(EFalse);
+	TInt ret(KErrNone);
+	
+	for(TInt idx(0);idx<iPolicies.Count();++idx)
+		{
+		if(aPolicyID==iPolicies[idx]->PolicyID())
+			{
+			if(KErrNone==iSecMgrDB->RemovePolicy(aPolicyID))
+			{
+			delete iPolicies[idx];
+			iPolicies.Remove(idx);
+			exists=ETrue;
+			}
+			}
+		}
+
+		//In case if policyID does not exist in the cache...
+		if(!exists)
+			ret = iSecMgrDB->RemovePolicy(aPolicyID);
+	
+
+	return ret;
+	}
+
+CPolicy* CPolicyManager::Policy(TPolicyID aPolicyID) const
+	{
+	for (TInt idx(0); idx!=iPolicies.Count ();++idx)
+		{
+		if ( aPolicyID==iPolicies[idx]->PolicyID ())
+			{
+			return iPolicies[idx];
+			}
+		}
+
+	return NULL;
+	}
+
+TBool CPolicyManager::HasPolicy(TPolicyID aPolicyID) const
+	{
+	for (TInt idx(0); idx!=iPolicies.Count ();++idx)
+		{
+		if ( aPolicyID==iPolicies[idx]->PolicyID ())
+			{
+			return ETrue;
+			}
+		}
+
+	return EFalse;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrpolicyparser.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,1158 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Utility XML parser to parse trust and access policy files
+ *
+*/
+
+
+
+
+
+
+#include <e32std.h>
+#include <w32std.h>
+#include <f32file.h>
+
+#include "rtsecmgrpolicyparser.h"
+#include "rtsecmgrdata.h"
+#include "rtsecmgrserverdef.h"
+
+#include <gmxmldocument.h>
+#include <gmxmlelement.h>
+#include <gmxmlcharacterdata.h>
+#include <gmxmltext.h>
+#include <gmxmlnode.h>
+
+_LIT (KPolicy, "policy");
+_LIT (KAllow, "allow");
+_LIT (KUser, "user");
+_LIT (KDomain, "domain");
+_LIT (KNameAttr, "name");
+_LIT (KCondition, "condition");
+_LIT (KCapabilities, "capabilities");
+_LIT (KDefCondition, "defaultCondition");
+_LIT (KText, "#TEXT");
+_LIT (KComment, "comment");
+_LIT (KAlias, "alias");
+
+CPolicyParser::CPolicyParser()
+	{
+	}
+
+CPolicyParser* CPolicyParser::NewL()
+	{
+	CPolicyParser* self = CPolicyParser::NewLC ();
+	//nothing to construct as of now
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+CPolicyParser* CPolicyParser::NewLC()
+	{
+	CPolicyParser* self = new (ELeave) CPolicyParser();
+	CleanupStack::PushL (self);
+	//nothing to construct as of now
+	return self;
+	}
+
+CPolicyParser::~CPolicyParser()
+	{
+	if ( iDomParser)
+		{
+		delete iDomParser;
+		iDomParser = NULL;
+		}
+	}
+
+TInt CPolicyParser::GetPolicyInfo(RFile& aSecPolicy,
+		RProtectionDomains& aPolicyInfo, RAliasGroup& aAliasGroup)
+	{
+	isTrustInfo = EFalse;
+
+	if ( iDomParser)
+		{
+		delete iDomParser;
+		iDomParser = NULL;
+		}
+
+	iDomParser = CMDXMLParser::NewL (this);
+	iLastError = KErrNone;
+	
+	RFile parseHandle;
+	User::LeaveIfError ( parseHandle.Duplicate ( aSecPolicy));
+
+	iPolicyInfo.Reset (); //cleans-up the array, but doesn't delete the entries..
+	iAliasGroup.Reset ();
+
+	iLastError = iDomParser->ParseFile (parseHandle); //xml file read operation
+	
+	if ( KErrNone == iLastError)
+		iWaitScheduler.Start (); //actual parsing starts here asynchronously
+
+	if ( KErrNone==iLastError)   //parsing is successful
+	{
+		aPolicyInfo = iPolicyInfo;
+		aAliasGroup = iAliasGroup;
+	}
+
+	return iLastError;
+	}
+
+// Call back function called when a parsing operation completes.
+void CPolicyParser::ParseFileCompleteL()
+	{
+	iLastError = iDomParser->Error();
+	
+	if(iLastError == KErrXMLMissingDocTypeTag)
+	    iLastError = KErrNone;
+	
+	iWaitScheduler.AsyncStop ();
+	    	
+	if(iLastError!=KErrNone)
+		{
+		    return;
+		}
+	else
+	    {
+          	if ( iDomParser && !isTrustInfo) //pre-requisite that the DOM instance is intact
+        		{
+        		CMDXMLDocument* documentNode = iDomParser->DetachXMLDoc ();
+        
+        		if ( documentNode)
+        			{
+        			CleanupStack::PushL(documentNode);
+        			//Gets the root element of the DOM tree.
+        			CMDXMLElement* rootElemNode = documentNode->DocumentElement ();
+        
+        			CMDXMLNode* rootNode = rootElemNode->FirstChild ();
+        
+        			if ( !rootNode)
+        				{
+        				iLastError = EErrInvalidRootNode;
+        				CleanupStack::PopAndDestroy(documentNode);
+        				return;
+        				}
+        
+        			TBool isValid = EFalse;
+        
+        			for (; rootNode;rootNode=rootNode->NextSibling ())
+        				{
+        				if ( rootNode->NodeType ()==CMDXMLNode::EElementNode)
+        					{
+        					if ( 0==rootNode->NodeName().CompareF (KPolicy ()))
+        						{
+        						isValid = ETrue;
+        						break;
+        						}
+        					else
+        						continue;
+        					}
+        				else
+        					{
+        					 if(KErrNone == rootNode->NodeName().CompareF(KText))
+        						{
+        						iLastError = EErrJunkContent;
+        						iPolicyInfo.ResetAndDestroy ();
+        						iAliasGroup.ResetAndDestroy ();
+        						CleanupStack::PopAndDestroy(documentNode);
+        						return;										
+        						}
+        					}
+        				}
+        
+        			if ( !isValid)
+        				{
+        				iLastError = EErrInvalidRootNode;
+        				iPolicyInfo.ResetAndDestroy ();
+        				iAliasGroup.ResetAndDestroy ();
+        				CleanupStack::PopAndDestroy(documentNode);
+        				return;
+        				}
+        
+        			TPtrC attrVal;
+        
+        			if ( rootNode->HasChildNodes ())
+        				{
+        				CMDXMLNode* childNode = rootNode->FirstChild ();
+        
+        				//Now get the list of <alias> nodes
+        				while ( childNode)
+        					{
+        					TPtrC nodeName = childNode->NodeName ();
+        
+        					//ALIAS PARSING
+        					if ( nodeName.CompareF (KAlias)== 0)
+        						{
+        						CMDXMLElement
+        								* aliasNode = dynamic_cast<CMDXMLElement*>(childNode);
+        					
+        						//store alias information in object
+        						CPermission* aliasObj = NULL;
+        																					
+        							{//Get the attribute "name" to get the alias name		    								    		
+        							aliasNode->GetAttribute(KNameAttr, attrVal);
+        
+        							if ( attrVal.Length ()>0)
+        								{
+        									if ( isAliasPresent (attrVal))
+        									{
+        									//invalid xml file
+        									if(aliasObj)
+        										delete aliasObj;
+        									iPolicyInfo.ResetAndDestroy ();
+        									iAliasGroup.ResetAndDestroy ();
+        									iLastError = EErrRepeatedAliasTag;
+        									CleanupStack::PopAndDestroy(documentNode);
+        									return;
+        									}
+        									
+        									aliasObj = CPermission::NewL();
+        									aliasObj->SetPermName(attrVal);
+        								}
+        							else
+        								{
+        								//alias name is invalid
+        								//check whether TPerm / alias name should be deleted
+        								if(aliasObj)
+        									delete aliasObj;
+        								iPolicyInfo.ResetAndDestroy ();
+        								iAliasGroup.ResetAndDestroy ();
+        								iLastError = EErrInvalidAliasName;
+        								CleanupStack::PopAndDestroy(documentNode);
+        								return;
+        								}
+        							
+        							if ( aliasNode->HasChildNodes ())
+        								{
+        									CPermissionSet *aliasCaps = CPermissionSet::NewL();
+        						
+        									TBool result = GetCapabilitiesForGroup(
+        														(CMDXMLElement*)aliasNode,
+        														*aliasCaps, *aliasObj); //get list of uncond caps
+        									
+        									if(result < 0)
+        									{
+        										//Invalid capability string in policy file
+        										if(aliasObj)
+        											delete aliasObj;
+        										if(aliasCaps)
+        											delete aliasCaps;
+        										iPolicyInfo.ResetAndDestroy ();
+        										iAliasGroup.ResetAndDestroy ();
+        										iLastError = result;  //EErrInvalidCapability or EErrRepeatedCaps
+        										CleanupStack::PopAndDestroy(documentNode);
+        										return;
+        									}
+        									if(aliasCaps)
+        										delete aliasCaps;
+        									
+        								}
+        							}
+        							
+        							if(aliasObj)
+        								iAliasGroup.AppendL(aliasObj); 
+        						}
+        						
+        					//check if the domain name is already present..
+        					//need to check to avoid repeated domain tags..
+        					if ( nodeName.CompareF (KDomain)== 0)
+        						{
+        						CMDXMLElement
+        								* domainNode = dynamic_cast<CMDXMLElement*>(childNode);
+        						CProtectionDomain* pPolicy=  NULL;
+        
+        							{//Get the attribute "name" to get the domain name		    								    		
+        							domainNode->GetAttribute (KNameAttr, attrVal);
+        
+        							if ( attrVal.Length ()>0)
+        								{
+        								if ( isDomainPresent (attrVal))
+        									{
+        									//invalid xml file
+        									//delete pPolicy;
+        									iPolicyInfo.ResetAndDestroy ();
+        									iAliasGroup.ResetAndDestroy ();
+        									iLastError = EErrRepeatedDomainTag;
+        									CleanupStack::PopAndDestroy(documentNode);
+        									return;
+        									}
+        
+        								pPolicy = CProtectionDomain::NewL ();
+        								pPolicy->SetDomainName (attrVal);
+        								}
+        							else
+        								{
+        								//domain name is invalid
+        								if ( pPolicy)
+        									delete pPolicy;
+        								iPolicyInfo.ResetAndDestroy ();
+        								iAliasGroup.ResetAndDestroy ();
+        								iLastError = EErrInvalidDomainName;
+        								CleanupStack::PopAndDestroy(documentNode);
+        								return;
+        								}
+        
+        							if ( domainNode->HasChildNodes ())
+        								{
+        								CPermissionSet* caps = CPermissionSet::NewL ();
+        
+        								CMDXMLNode
+        										* domainChildNode = domainNode->FirstChild ();
+        								for (; domainChildNode;domainChildNode=domainChildNode->NextSibling ())
+        									{
+        									if ( domainChildNode->NodeType ()==CMDXMLNode::EElementNode)
+        										{
+        										if ( 0==domainChildNode->NodeName().CompareF (KAllow))//<Allow> unconditional node
+        											{
+        												TBool result = GetCapabilities(
+        														(CMDXMLElement*)domainChildNode,
+        														*caps); //get list of uncond caps
+        														
+        												if(result < 0)
+        												{
+        													//Invalid capability string in policy file
+        													if ( pPolicy)
+        														delete pPolicy;
+        													if(caps)
+        														delete caps;
+        													iPolicyInfo.ResetAndDestroy ();
+        													iAliasGroup.ResetAndDestroy ();
+        													iLastError = result;  //EErrInvalidCapability or EErrRepeatedCaps
+        													CleanupStack::PopAndDestroy(documentNode);
+        													return;
+        												}
+        											}	
+        										else if ( 0==domainChildNode->NodeName().CompareF (KUser))//<User> Conditional node
+        											{
+        												//Get UGCaps
+        												TUserPromptOption upOption(RTUserPrompt_UnDefined);
+        												
+        												TInt error = GetConditions ((CMDXMLElement*)domainChildNode, upOption);//Get conditions
+        												
+        												if(EErrInvalidPermission == error)
+        												{
+        													// invalid permission is specified
+        													if ( pPolicy)
+        														delete pPolicy;
+        													if(caps)
+        														delete caps;
+        													iLastError = EErrInvalidPermission;
+        													iPolicyInfo.ResetAndDestroy ();
+        													iAliasGroup.ResetAndDestroy ();
+        													CleanupStack::PopAndDestroy(documentNode);
+        													return;
+        												}
+        													
+        												TUserPromptOption
+        														defCond = GetDefaultCondition ((CMDXMLElement*)domainChildNode);
+        
+        												if(RTUserPrompt_UnDefined == defCond)
+        													{
+        													//default condition is not specified
+        													if ( pPolicy)
+        														delete pPolicy;
+        													if(caps)
+        														delete caps;
+        													iLastError = EErrNoDefaultCondition;
+        													iPolicyInfo.ResetAndDestroy ();
+        													iAliasGroup.ResetAndDestroy ();
+        													CleanupStack::PopAndDestroy(documentNode);
+        													return;
+        													}
+        													
+        												//default condition is specified
+        												error = GetCapabilities (
+        															(CMDXMLElement*)domainChildNode,
+        															*caps,
+        															upOption,
+        															ETrue, defCond); //get list of ug caps	
+        												if(error < 0)
+        												{
+        													//Invalid capability string in policy file
+        													if ( pPolicy)
+        														delete pPolicy;
+        													if(caps)
+        														delete caps;
+        													iPolicyInfo.ResetAndDestroy ();
+        													iAliasGroup.ResetAndDestroy ();
+        													iLastError = error;  //EErrInvalidCapability or EErrRepeatedCaps
+        													CleanupStack::PopAndDestroy(documentNode);
+        													return;
+        												}
+        											}
+        											else  	// neither USER nor ALLOW node
+        											{
+        												//checking for misplaced alias tag
+        												if((KErrNone == domainChildNode->NodeName().CompareF(KAlias)))
+        												{
+        													if ( pPolicy)
+        														delete pPolicy;
+        													if(caps)
+        														delete caps;
+        													iLastError = EErrMisplacedAlias;
+        													iAliasGroup.ResetAndDestroy ();
+        													iPolicyInfo.ResetAndDestroy ();
+        													CleanupStack::PopAndDestroy(documentNode);
+        													return;										
+        												}
+        											}
+        										}
+        										else
+        										{
+        											//the node is not an element node
+        											//hence it should be comment / junk content
+        											if((KErrNone == domainChildNode->NodeName().CompareF(KText)))
+        											{
+        												if ( pPolicy)
+        													delete pPolicy;
+        												if (caps)
+        													delete caps;
+        												iLastError = EErrJunkContent;
+        												iPolicyInfo.ResetAndDestroy ();
+        												iAliasGroup.ResetAndDestroy ();
+        												CleanupStack::PopAndDestroy(documentNode);
+        												return;										
+        											}
+        											else if(KErrNone == domainChildNode->NodeName().CompareF(KComment))
+        												continue;
+        										}
+        									}									
+        								if ( pPolicy)
+        									pPolicy->SetCapInfo (caps);
+        
+        								}
+        							}
+        
+        						if ( pPolicy)
+        							iPolicyInfo.AppendL (pPolicy);
+        						}
+        						else if((KErrNone == nodeName.CompareF(KText)))
+        						{
+        							iLastError = EErrJunkContent;
+        							iPolicyInfo.ResetAndDestroy ();
+        							iAliasGroup.ResetAndDestroy ();
+        							CleanupStack::PopAndDestroy(documentNode);
+        							return;										
+        						}
+        						
+        					childNode = childNode->NextSibling (); //traverse to the next sibling node			    			
+        
+        					}
+        				} //rootNode->HasChildNodes()
+        			else
+        				{
+        				//No policy information in the xml file
+        				//Treat this as an error
+        				iLastError = EErrNoPolicyInfo;
+        				iPolicyInfo.ResetAndDestroy ();
+        				iAliasGroup.ResetAndDestroy ();
+        				CleanupStack::PopAndDestroy(documentNode);
+        				return;
+        				}
+        
+        			CleanupStack::PopAndDestroy(documentNode);
+        			}
+        		else
+        			{
+        			iLastError = EErrInvalidDocNode;
+        			return;
+        			}
+        		}
+	    }
+	}
+
+TInt CPolicyParser::GetCapsNode(CMDXMLElement* aParentDomainNode,
+		RPointerArray<CMDXMLElement>& aCapNodes, const TDesC& aNodeName)
+	{
+	if ( aParentDomainNode->HasChildNodes ())
+		{
+		CMDXMLNode* childNode = aParentDomainNode->FirstChild ();
+
+		do
+			{
+			if ( childNode)
+				{
+				if ( 0==childNode->NodeName().Compare (aNodeName))
+					{
+					CMDXMLElement* pAllowNode = dynamic_cast<CMDXMLElement*>(childNode);
+					aCapNodes.AppendL (pAllowNode);
+					}
+
+				childNode = childNode->NextSibling ();
+				}
+
+			}
+		while (NULL != childNode);
+		}
+
+	return EErrNone; //No other possible return err code...
+	}
+
+CMDXMLElement* CPolicyParser::GetCapsNode(CMDXMLElement* aParentDomainNode,
+		const TDesC& aNodeName)
+	{
+	if ( aParentDomainNode->HasChildNodes ())
+		{
+		CMDXMLNode* childNode = aParentDomainNode->FirstChild ();
+
+		do
+			{
+			if ( childNode)
+				{
+				if ( 0==childNode->NodeName().Compare (aNodeName))
+					{
+					CMDXMLElement* pAllowNode = dynamic_cast<CMDXMLElement*>(childNode);
+					return pAllowNode;
+					}
+
+				childNode = childNode->NextSibling ();
+				}
+
+			}
+		while (NULL != childNode);
+		}
+	return NULL;
+	}
+
+TInt CPolicyParser::GetCapabilities(CMDXMLElement* aParentNode,
+		CPermissionSet& aCapInfo, TUserPromptOption aUpOpt, TBool aUGCaps,
+		TUserPromptOption aDefUpOpt)
+	{
+	if ( aParentNode->HasChildNodes ())
+		{
+		CMDXMLNode* childNode = aParentNode->FirstChild ();
+
+		do
+			{
+			if ( childNode)
+				{
+				CMDXMLNode* capabilitiesNode=  NULL;
+				if ( 0==childNode->NodeName().CompareF (KCapabilities))
+					{
+					capabilitiesNode = dynamic_cast<CMDXMLElement*>(childNode);
+
+					//traverse <capability/> nodes under <capabilities/>
+					if ( capabilitiesNode->HasChildNodes ())
+						{
+						RCapabilityArray capabilities;
+						
+						for (CMDXMLNode
+								* capabilityNode=capabilitiesNode->FirstChild (); capabilityNode;capabilityNode=capabilityNode->NextSibling ())
+							{
+							//Get the textnode under <capability/>
+							if ( capabilityNode)
+								{
+								for (CMDXMLNode
+										* capChildNode=capabilityNode->FirstChild (); capChildNode;capChildNode=capChildNode->NextSibling ())
+									{
+									//Get the textnode under <capability/>
+									if ( CMDXMLNode::ETextNode==capChildNode->NodeType ())
+										{
+										CMDXMLText
+												* capTextNode = dynamic_cast<CMDXMLText*>(capChildNode);
+										//Extract text out of this node
+										TCapability
+												cap = GetCapability (capTextNode->Data ());
+
+										if ((ECapability_None!=cap))
+											{
+											
+											// Get LOGIC for the storage of Group capability
+											
+											if ( aUGCaps)
+												{
+												if ( (!IsPresent(aCapInfo,cap)) && (!IsUserGrantPresent(aCapInfo,cap)))
+													{
+														capabilities.Append(cap);
+														
+														if ( RTUserPrompt_UnDefined==aUpOpt)								
+															{
+																CPermission* perm = CPermission::NewL(capabilities, aDefUpOpt,aDefUpOpt);
+																aCapInfo.AppendPermission (*perm);
+															}
+																
+															else
+															{
+																CPermission* perm = CPermission::NewL(capabilities, aDefUpOpt,aUpOpt);
+																aCapInfo.AppendPermission (*perm);
+															}
+													}
+													else
+													{
+														return EErrRepeatedCaps;	
+													}
+												}
+											else
+												{
+													//Check before appending unconditional capability that
+													//whether the capability is already added or not...
+													if ( (!IsPresent(aCapInfo,cap)) && (!IsUserGrantPresent(aCapInfo,cap)))
+													{
+														aCapInfo.AppendUncondCap (cap);	
+													}
+													else
+													{
+														//capability string given more than once.. hence invalid
+														return EErrRepeatedCaps;		
+													}
+												}
+											}
+										else
+											{
+												TBool invalidCaps = ETrue;
+												
+												for(TInt idx = 0; idx < iAliasGroup.Count(); idx++)
+												{
+													CPermission *tempObj = iAliasGroup[idx];
+													TPtrC name = tempObj->PermName();
+													
+													if ((KErrNone == capTextNode->Data().CompareF(name)))
+													{
+													//it is not a text node. so is an alias group
+													
+													//alias group name is found. so obtain the caps
+													TUint32 capAlias = tempObj->PermissionData();
+													invalidCaps = EFalse;
+													if( aUGCaps)
+														{
+															for(TInt idx1 = 0; idx1 < 20; idx1++)
+															{
+																TUint32 tempCapToCheck(KDefaultEnableBit);
+																tempCapToCheck = tempCapToCheck << (idx1);
+																
+																if(capAlias & tempCapToCheck)
+																	capabilities.Append((TCapability)idx1);
+																
+															}
+															if ( RTUserPrompt_UnDefined==aUpOpt)								
+															{
+																CPermission* perm = CPermission::NewL(capabilities, aDefUpOpt,aDefUpOpt);
+																perm->SetPermName(name);
+																aCapInfo.AppendPermission (*perm);
+															}
+																
+															else
+															{
+																CPermission* perm = CPermission::NewL(capabilities, aDefUpOpt,aUpOpt);
+																perm->SetPermName(name);
+																aCapInfo.AppendPermission (*perm);
+															}
+														}
+													else
+														{
+														TUint32 capPresent = aCapInfo.UnconditionalCaps();
+														TUint32 capAfter = capAlias | capPresent;
+														TUint32 capRep = capAlias ^ capPresent;
+														TUint32 errChk = capRep & capAfter; //error if capAfter and error are different
+														
+														if(!(errChk & capAfter))
+															{
+															//capability string given more than once.. hence invalid
+															return EErrRepeatedCaps;
+															}
+															
+														aCapInfo.AppendUncondCapabilities(capAfter);	
+														}
+													}
+												}
+
+												if (invalidCaps)
+												{
+												//just log the error message
+												RDebug::Print (_L ("CPolicyParser::GetCapabilities : Invalid capability string"));
+												return EErrInvalidCapability;
+												}
+											}
+
+										}
+									}
+								}
+								capabilities.Close();						
+							}
+						}
+					else
+						{
+						RDebug::Print (_L ("CPolicyParser::GetCapabilities : No <capability> under <capabilities/>"));
+						}
+
+					}
+
+				childNode = childNode->NextSibling ();
+				}
+			else
+				{
+				RDebug::Print (_L ("CPolicyParser::GetCapabilities : Childnode NULL"));
+				}
+			}
+		while (NULL != childNode);
+		}
+		
+	return EErrNone;
+	}
+
+TInt CPolicyParser::GetCapabilitiesForGroup(CMDXMLElement* aParentNode,
+		CPermissionSet& aCapInfo, CPermission& aAliasInfo, TUserPromptOption aUpOpt, TBool aUGCaps,
+		TUserPromptOption aDefUpOpt)
+	{
+	if ( aParentNode->HasChildNodes ())
+		{
+		CMDXMLNode* childNode = aParentNode->FirstChild ();
+
+		do
+			{
+			if ( childNode)
+				{
+				CMDXMLNode* capabilitiesNode=  NULL;
+				if ( 0==childNode->NodeName().CompareF (KCapabilities))
+					{
+					capabilitiesNode = dynamic_cast<CMDXMLElement*>(childNode);
+
+					//traverse <capability/> nodes under <capabilities/>
+					if ( capabilitiesNode->HasChildNodes ())
+						{
+						RCapabilityArray capabilities;
+						
+						for (CMDXMLNode
+								* capabilityNode=capabilitiesNode->FirstChild (); capabilityNode;capabilityNode=capabilityNode->NextSibling ())
+							{
+							//Get the textnode under <capability/>
+							if ( capabilityNode)
+								{
+								for (CMDXMLNode
+										* capChildNode=capabilityNode->FirstChild (); capChildNode;capChildNode=capChildNode->NextSibling ())
+									{
+									//Get the textnode under <capability/>
+									if ( CMDXMLNode::ETextNode==capChildNode->NodeType ())
+										{
+										CMDXMLText
+												* capTextNode = dynamic_cast<CMDXMLText*>(capChildNode);
+										//Extract text out of this node
+										TCapability
+												cap = GetCapability (capTextNode->Data ());
+
+										
+										if ((ECapability_None!=cap))
+											{
+											
+											// Get LOGIC for the storage of Group capability
+											
+											if ( aUGCaps)
+												{
+												//For ALIAS GROUP this condition is not true and foll stm are not executed
+												if ( (!IsPresent(aCapInfo,cap)) && (!IsUserGrantPresent(aCapInfo,cap)))
+													{
+													capabilities.Append(cap);
+													
+													if ( RTUserPrompt_UnDefined==aUpOpt)								
+															{
+																CPermission* perm = CPermission::NewL(capabilities, aDefUpOpt,aDefUpOpt);
+																
+																aCapInfo.AppendPermission (*perm);
+															}
+																
+															else
+															{
+																CPermission* perm = CPermission::NewL(capabilities, aDefUpOpt,aUpOpt);
+																
+																aCapInfo.AppendPermission (*perm);
+															}
+													}
+													else
+													{
+													return EErrRepeatedCaps;	
+													}
+												}
+											else
+												{
+													//Check before appending unconditional capability that
+													//whether the capability is already added or not...
+													if ( (!IsPresent(aCapInfo,cap) && (!IsUserGrantPresent(aCapInfo,cap))) && (!IsCapsAliasPresent(aAliasInfo,cap)))
+													{
+														aCapInfo.AppendUncondCap (cap);	
+														aAliasInfo.AppendCapPermData(cap);
+													}
+													else
+													{
+														//capability string given more than once.. hence invalid
+														return EErrRepeatedCaps;		
+													}
+												}
+											}
+										else
+											{
+												TBool invalidCaps = ETrue;
+												for(TInt idx = 0; idx < iAliasGroup.Count(); idx++)
+												{
+													CPermission *tempObj = iAliasGroup[idx];
+													TPtrC name = tempObj->PermName();
+													
+													if ((KErrNone == capTextNode->Data().CompareF(name)))
+													{
+													invalidCaps = EFalse;
+													//it is not a text node. so is an alias group
+													
+													//alias group name is found. so obtain the caps
+													TUint32 capAlias = tempObj->PermissionData();
+													TUint32 capPresent = aCapInfo.UnconditionalCaps();
+													TUint32 capAfter = capAlias | capPresent;
+													TUint32 capRep = capAlias ^ capPresent;
+													TUint32 errChk = capRep & capAfter; //error if capAfter and error are different
+													
+													if(!(errChk & capAfter))
+														{
+														//capability string given more than once.. hence invalid
+														return EErrRepeatedCaps;
+														}
+														
+													aCapInfo.AppendUncondCapabilities(capAfter);
+													aAliasInfo.SetPermissionData(capAfter);
+													}
+												}
+
+												if (invalidCaps)
+												{
+												//just log the error message
+												RDebug::Print (_L ("CPolicyParser::GetCapabilities : Invalid capability string"));
+												return EErrInvalidCapability;
+												}
+											}
+
+										}										
+									}
+								}
+						
+							
+							capabilities.Close();						
+							}
+						}
+					else
+						{
+						RDebug::Print (_L ("CPolicyParser::GetCapabilities : No <capability> under <capabilities/>"));
+						}
+
+					}
+
+				childNode = childNode->NextSibling ();
+				}
+			else
+				{
+				RDebug::Print (_L ("CPolicyParser::GetCapabilities : Childnode NULL"));
+				}
+
+			}
+		while (NULL != childNode);
+		}
+		
+		return EErrNone;
+	}
+
+TInt CPolicyParser::GetConditions(CMDXMLElement* aParentNode, TUserPromptOption& aUserPromptOpt)
+	{
+	TUint32 ret(RTUserPrompt_UnDefined);
+	
+	if ( aParentNode->HasChildNodes ())
+		{
+		CMDXMLNode* childNode = aParentNode->FirstChild ();
+
+		do
+			{
+			if ( childNode)
+				{
+				CMDXMLNode* condNode=  NULL;
+				if ( 0==childNode->NodeName().CompareF (KCondition))
+					{
+					condNode = dynamic_cast<CMDXMLElement*>(childNode);
+
+					if ( condNode->HasChildNodes ())
+						{
+						for (CMDXMLNode* condChildNode=condNode->FirstChild (); condChildNode;condChildNode=condChildNode->NextSibling ())
+							{
+							//Get the textnode under <condition/>
+							if ( CMDXMLNode::ETextNode==condChildNode->NodeType ())
+								{
+								CMDXMLText
+										* condition = dynamic_cast<CMDXMLText*>(condChildNode);
+
+								if ( condition)
+									{
+									TInt32 returnVal = GetUserPromptOption (condition->Data ());
+									
+										if(RTUserPrompt_UnDefined == returnVal)
+										{
+										  aUserPromptOpt = (TUserPromptOption)returnVal;
+										  return EErrInvalidPermission;						
+										}
+									
+									ret |= returnVal;
+									}
+								}
+							}
+						}
+					}
+				childNode = childNode->NextSibling ();
+				}
+
+			}
+		while (NULL != childNode);
+		}
+
+	aUserPromptOpt = (TUserPromptOption)ret;
+	return EErrNone;
+	}
+
+TBool CPolicyParser::isDomainPresent(const TDesC& aDomainName)
+	{
+	TBool isPresent(EFalse);
+
+	for (TInt i(0); i!=iPolicyInfo.Count ();++i)
+		{
+		if ( 0==iPolicyInfo[i]->DomainName().CompareF (aDomainName))
+			{
+			isPresent=ETrue;
+			break;
+			}
+		}
+
+	return isPresent;
+	}
+	
+TBool CPolicyParser::IsPresent(const CPermissionSet& aCapInfo, TCapability aCap)
+	{
+	TUint32 uncondCaps = aCapInfo.UnconditionalCaps ();
+
+	TUint32 tempCapToCheck(KDefaultEnableBit);
+	tempCapToCheck = tempCapToCheck << (aCap);
+
+	return (uncondCaps & tempCapToCheck);
+	}
+
+TBool CPolicyParser::IsCapsAliasPresent(const CPermission& aAliasInfo, TCapability aCap)
+	{
+	TUint32 uncondCaps = aAliasInfo.PermissionData ();
+
+	TUint32 tempCapToCheck(KDefaultEnableBit);
+	tempCapToCheck = tempCapToCheck << (aCap);
+
+	return (uncondCaps & tempCapToCheck);
+	}
+
+TBool CPolicyParser::IsUserGrantPresent(const CPermissionSet& aCapInfo,
+		TCapability aCap)
+	{
+	TUint32 perms(KDefaultNullBit);
+	//RPermissions tempPerms = aCapInfo.Permissions();
+	for (TInt i(0); i!=(aCapInfo.Permissions()).Count ();++i)
+		{
+		TUint32 temp(KDefaultEnableBit);
+		RCapabilityArray capabilities;
+		(aCapInfo.Permissions())[i]->Capabilitilites(capabilities);
+		for(TInt capIdx(0);capIdx!=capabilities.Count();++capIdx)
+			{
+			temp = temp << (capabilities[capIdx]);
+			perms |= temp;
+			}		
+		capabilities.Close();
+		}
+
+	TUint32 temp(KDefaultEnableBit);
+	temp = temp << (aCap);
+	return (perms & temp);
+	}
+
+TUserPromptOption CPolicyParser::GetDefaultCondition(CMDXMLElement* aParentNode)
+	{
+	if ( aParentNode->HasChildNodes ())
+		{
+		CMDXMLNode* childNode = aParentNode->FirstChild ();
+
+		do
+			{
+			if ( childNode)
+				{
+				CMDXMLNode* condNode=  NULL;
+				if ( 0==childNode->NodeName().CompareF (KDefCondition))
+					{
+					condNode = dynamic_cast<CMDXMLElement*>(childNode);
+
+					if ( condNode->HasChildNodes ())
+						{
+						for (CMDXMLNode* condChildNode=condNode->FirstChild (); condChildNode;condChildNode=condChildNode->NextSibling ())
+							{
+							if ( CMDXMLNode::ETextNode==condChildNode->NodeType ())
+								{
+								CMDXMLText
+										* condition = dynamic_cast<CMDXMLText*>(condChildNode);
+
+								if ( condition)
+									{
+									return GetUserPromptOption (condition->Data ());
+									}
+								}
+							}
+						}
+					}
+
+				childNode = childNode->NextSibling ();
+				}
+
+			}
+		while (NULL != childNode);
+		}
+
+	return RTUserPrompt_UnDefined;
+	}
+
+TCapability CPolicyParser::GetCapability(const TDesC& aUserPromptOpt)
+	{
+	TCapability cap(ECapability_None);
+
+	if ( 0==aUserPromptOpt.CompareF (KCapabilityTCB))
+		{
+		cap=ECapabilityTCB;
+		}
+	else
+		if ( 0==aUserPromptOpt.CompareF (KCapabilityCommDD))
+			{
+			cap=ECapabilityCommDD;
+			}
+		else
+			if ( 0==aUserPromptOpt.CompareF (KCapabilityPowerMgmt))
+				{
+				cap=ECapabilityPowerMgmt;
+				}
+			else
+				if ( 0==aUserPromptOpt.CompareF (KCapabilityMultimediaDD))
+					{
+					cap=ECapabilityMultimediaDD;
+					}
+				else
+					if ( 0==aUserPromptOpt.CompareF (KCapabilityReadDeviceData))
+						{
+						cap=ECapabilityReadDeviceData;
+						}
+					else
+						if ( 0==aUserPromptOpt.CompareF (KCapabilityWriteDeviceData))
+							{
+							cap=ECapabilityWriteDeviceData;
+							}
+						else
+							if ( 0==aUserPromptOpt.CompareF (KCapabilityDRM))
+								{
+								cap=ECapabilityDRM;
+								}
+							else
+								if ( 0==aUserPromptOpt.CompareF (KCapabilityTrustedUI))
+									{
+									cap=ECapabilityTrustedUI;
+									}
+								else
+									if ( 0==aUserPromptOpt.CompareF (KCapabilityProtServ))
+										{
+										cap=ECapabilityProtServ;
+										}
+									else
+										if ( 0==aUserPromptOpt.CompareF (KCapabilityDiskAdmin))
+											{
+											cap=ECapabilityDiskAdmin;
+											}
+										else
+											if ( 0==aUserPromptOpt.CompareF (KCapabilityNetworkControl))
+												{
+												cap=ECapabilityNetworkControl;
+												}
+											else
+												if ( 0==aUserPromptOpt.CompareF (KCapabilityAllFiles))
+													{
+													cap=ECapabilityAllFiles;
+													}
+												else
+													if ( 0==aUserPromptOpt.CompareF (KCapabilitySwEvent))
+														{
+														cap=ECapabilitySwEvent;
+														}
+													else
+														if ( 0==aUserPromptOpt.CompareF (KCapabilityNetworkServices))
+															{
+															cap=ECapabilityNetworkServices;
+															}
+														else
+															if ( 0==aUserPromptOpt.CompareF (KCapabilityLocalServices))
+																{
+																cap=ECapabilityLocalServices;
+																}
+															else
+																if ( 0==aUserPromptOpt.CompareF (KCapabilityReadUserData))
+																	{
+																	cap=ECapabilityReadUserData;
+																	}
+																else
+																	if ( 0==aUserPromptOpt.CompareF (KCapabilityWriteUserData))
+																		{
+																		cap=ECapabilityWriteUserData;
+																		}
+																	else
+																		if ( 0==aUserPromptOpt.CompareF (KCapabilityLocation))
+																			{
+																			cap=ECapabilityLocation;
+																			}
+																		else
+																			if ( 0==aUserPromptOpt.CompareF (KCapabilitySurroundingsDD))
+																				{
+																				cap=ECapabilitySurroundingsDD;
+																				}
+																			else
+																				if ( 0==aUserPromptOpt.CompareF (KCapabilityUserEnvironment))
+																					{
+																					cap=ECapabilityUserEnvironment;
+																					}
+	return cap;
+	}
+
+TUserPromptOption CPolicyParser::GetUserPromptOption(const TDesC& aUserPromptOpt)
+	{
+	TUserPromptOption userPromptOpt = RTUserPrompt_UnDefined;
+
+	if ( 0==aUserPromptOpt.CompareF (KUserPromptOneShot))
+		{
+		userPromptOpt=RTUserPrompt_OneShot;
+		}
+	else
+		if ( 0==aUserPromptOpt.CompareF (KUserPromptSession))
+			{
+			userPromptOpt=RTUserPrompt_Session;
+			}
+		else
+			if ( 0==aUserPromptOpt.CompareF (KUserPromptBlanket))
+				{
+				userPromptOpt=RTUserPrompt_Permanent;
+				}
+	return userPromptOpt;
+	}
+
+TBool CPolicyParser::isAliasPresent(const TDesC& aAliasName)
+	{
+		TBool isPresent(EFalse);
+
+		for(TInt idx = 0; idx < iAliasGroup.Count(); idx++)
+		{
+			if( KErrNone == iAliasGroup[idx]->PermName().CompareF(aAliasName))
+			{
+				isPresent = ETrue;
+				break;
+			}
+			
+		}
+		
+		return isPresent;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrprotectiondomain.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "rtsecmgrprotectiondomain.h"
+#include "rtsecmgrserverdef.h"
+
+#include <e32debug.h>
+#include <centralrepository.h>
+
+CProtectionDomain* CProtectionDomain::NewL()
+	{
+	CProtectionDomain* self = CProtectionDomain::NewLC ();
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+CProtectionDomain* CProtectionDomain::NewLC()
+	{
+	CProtectionDomain* self = new (ELeave) CProtectionDomain();
+	CleanupStack::PushL (self);
+	self->ConstructL ();
+	return self;
+	}
+
+CProtectionDomain* CProtectionDomain::NewL(RStoreReadStream& aSource)
+	{
+	CProtectionDomain* self = CProtectionDomain::NewLC (aSource);
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+CProtectionDomain* CProtectionDomain::NewLC(RStoreReadStream& aSource)
+	{
+	CProtectionDomain* self = CProtectionDomain::NewLC ();
+	self->InternalizeL (aSource);
+	return self;
+	}
+
+CProtectionDomain::~CProtectionDomain()
+	{
+	if ( iDomain)
+		{
+		delete iDomain;
+		iDomain = NULL;
+		}
+
+	if ( iPermSet)
+		{
+		delete iPermSet;
+		iPermSet = NULL;
+		}
+	}
+
+void CProtectionDomain::ExternalizeL(RStoreWriteStream& aSink) const
+	{
+	//externalise policy info data
+	aSink.WriteInt32L (iDomain->Des().MaxLength ());
+	aSink << *iDomain;
+	iPermSet->ExternalizeL (aSink);
+	}
+
+void CProtectionDomain::InternalizeL(RStoreReadStream& aSource)
+	{
+	TInt32 len = aSource.ReadInt32L ();
+	if ( iDomain)
+		{
+		delete iDomain;
+		iDomain = NULL;
+		}
+
+	iDomain = HBufC::NewL (aSource, len);
+
+	if ( iPermSet)
+		{
+		delete iPermSet;
+		iPermSet = NULL;
+		}
+
+	iPermSet = CPermissionSet::NewL ();
+	iPermSet->InternalizeL (aSource);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrscriptmanager.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "rtsecmgrscriptmanager.h"
+#include "rtsecmgrserverdef.h"
+
+#include "rtsecmgrstore.h"
+#include "rtsecmgrpolicy.h"
+#include "rtsecmgrpolicymanager.h"
+#include "rtsecmgrscriptmanager.h"
+
+#include <e32debug.h>
+//#include <centralrepository.h>
+
+_LIT(KDefaultTrustPolicy,"UnTrusted");
+
+CScriptManager* CScriptManager::NewL(CSecMgrStore* aSecMgrDB,CPolicyManager* aPolicyMgr)
+{	
+	CScriptManager* pThis = CScriptManager::NewLC(aSecMgrDB,aPolicyMgr);
+	CleanupStack::Pop(pThis);
+	return pThis;
+}
+
+CScriptManager* CScriptManager::NewLC(CSecMgrStore* aSecMgrDB,CPolicyManager* aPolicyMgr)
+{	
+	CScriptManager* pThis = new (ELeave) CScriptManager(aSecMgrDB,aPolicyMgr);
+	CleanupStack::PushL(pThis);
+	pThis->ConstructL();
+	return pThis;
+}
+
+CScriptManager::~CScriptManager()
+{
+	if(iSecMgrDB)
+	{
+		iSecMgrDB->WriteCounter(iID);	
+	}
+	
+	iScripts.ResetAndDestroy();
+}
+void CScriptManager::ConstructL()	
+{
+	iSecMgrDB->ReadCounter(iID);
+}
+
+TExecutableID CScriptManager::RegisterScript(TPolicyID aPolicyID/*,const CTrustInfo& aTrustPolicy*/)
+{	
+	TInt ret(ErrPolicyIDDoesNotExist);
+	
+	CPolicy* policy = iPolicyMgr->Policy(aPolicyID);
+	
+	if(policy)
+		{
+		CProtectionDomain* domain = policy->ProtectionDomain(KDefaultTrustPolicy);
+		
+		if(domain)
+			{
+				TExecutableID execID(GetID());
+				CScript* script = CScript::NewL(aPolicyID,execID);
+				script->SetPermissionSet(domain->PermSet());
+				iScripts.Append(script);
+				
+				TRAPD(err,iSecMgrDB->RegisterScriptL(execID,*script));
+				
+				if(KErrNone==err)
+				{
+					return execID;
+				}
+				else
+				{
+					return ret;
+				}
+			}			
+		
+		}
+	return ret;	
+	
+}
+
+TExecutableID CScriptManager::RegisterScript(TPolicyID aPolicyID,const TDesC& aHashValue/*,const CTrustInfo& aTrustPolicy*/)
+	{	
+		TInt ret(ErrPolicyIDDoesNotExist);
+		
+		CPolicy* policy = iPolicyMgr->Policy(aPolicyID);
+		
+		if(policy)
+			{
+			CProtectionDomain* domain = policy->ProtectionDomain(KDefaultTrustPolicy);
+			
+			if(domain)
+				{
+					TExecutableID execID(GetID());
+					CScript* script = CScript::NewLC(aPolicyID,execID);
+					script->SetHashMarkL(aHashValue);
+					script->SetPermissionSet(domain->PermSet());
+					iScripts.Append(script);
+					
+					TRAPD(err,iSecMgrDB->RegisterScriptL(execID, *script));
+					
+					if(KErrNone==err)
+					{
+					ret=execID;
+					}
+					CleanupStack::Pop(script);
+				}			
+			
+			}
+		return ret;	
+		
+	}
+
+
+void CScriptManager::UnRegisterScriptL(TExecutableID aExecID,TPolicyID aPolicyID)
+{	
+	TInt ret;
+	CScript *scriptInfo = CScript::NewL(KInvalidPolicyID ,aExecID);
+	ret = ScriptInfo(*scriptInfo);
+	
+	
+	if( (KErrNone<=ret) && (scriptInfo->PolicyID() != aPolicyID))
+	{
+		ret = ErrInvalidPolicyID;	
+	}
+	
+	delete scriptInfo;
+	scriptInfo = NULL;
+	
+	if(ret == KErrNone)
+	{
+		for(TInt i=0; i!=iScripts.Count();++i)
+		{
+			if(iScripts[i]->ScriptID()==aExecID)
+			{
+				delete iScripts[i];
+				iScripts.Remove(i);	//remove from the cache first		
+				break;
+			}		 
+		}		
+		iSecMgrDB->UnRegisterScriptL(aExecID);
+	}
+	else
+		User::Leave(ret);
+}
+
+TInt CScriptManager::ScriptInfo(CScript& aScriptInfo)
+{	
+	//Check if script info is already present in the cache (iScriptStore)
+	//If yes, 	
+	for(TInt i=0; i!=iScripts.Count();++i)
+		{
+		if(iScripts[i]->ScriptID()==aScriptInfo.ScriptID())
+			{
+				{
+				aScriptInfo = *iScripts[i];				
+				return KErrNone;	
+				}	
+			}
+		}
+	
+	//Read the script file
+	TInt ret = iSecMgrDB->ReadScriptInfo(aScriptInfo.ScriptID(),aScriptInfo);
+	
+	if(KErrNone==ret)
+	{
+		iScripts.AppendL(&aScriptInfo);		
+	}
+	
+	return ret;
+}
+
+TInt CScriptManager::GetScriptFile(TExecutableID aExecID,TDes& aScriptFile)
+{
+	return iSecMgrDB->GetScriptFile(aExecID,aScriptFile);
+}
+
+void CScriptManager::UpdatePermGrantL(TExecutableID aExecID,TPermGrant aPermGrant,TPermGrant aPermDenied)
+{	
+	for(TInt i(0);i!=iScripts.Count();++i)
+	{
+	if(iScripts[i]->ScriptID()==aExecID)
+		{
+			iScripts[i]->SetPermGranted(aPermGrant);
+			iScripts[i]->SetPermDenied(aPermDenied);
+			iSecMgrDB->WriteScriptInfoL(aExecID,*iScripts[i]);			
+			return;
+		}	
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserver.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <e32svr.h>
+#include <e32uid.h>
+
+#include "rtsecmgrserver.h"
+#include "rtsecmgrsession.h"
+#include "rtsecmgrsubSession.h"
+#include "rtsecmgrcommonDef.h"
+#include "rtsecmgrstore.h"
+#include "rtsecmgrpolicymanager.h"
+#include "rtsecmgrscriptmanager.h"
+
+CRTSecMgrServer* CRTSecMgrServer::NewL(CActive::TPriority aActiveObjectPriority)
+	{
+	CRTSecMgrServer* self=new (ELeave) CRTSecMgrServer(aActiveObjectPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CRTSecMgrServer* CRTSecMgrServer::NewLC(CActive::TPriority aActiveObjectPriority)
+	{
+	CRTSecMgrServer* self=new (ELeave) CRTSecMgrServer(aActiveObjectPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+void CRTSecMgrServer::ConstructL()
+	{
+	StartL(KSecServerProcessName);
+	iContainerIndex = CObjectConIx::NewL();
+	
+	iSecMgrDb = CSecMgrStore::NewL();	
+	iPolicyMgr = CPolicyManager::NewL(iSecMgrDb);
+	iPolicyMgr->RestorePoliciesL();
+	
+	iScriptMgr = CScriptManager::NewL(iSecMgrDb,iPolicyMgr);
+	
+	// Start the shutDown timer
+	iShutDown.ConstructL();
+
+	iShutDown.Start ();
+	}
+
+CRTSecMgrServer::~CRTSecMgrServer()
+	{
+	if(iPolicyMgr)
+	{
+		delete iPolicyMgr;			
+	}
+	
+	if(iScriptMgr)
+	{
+		delete iScriptMgr;
+	}
+	
+	if(iSecMgrDb)
+	{
+		delete iSecMgrDb;
+	}
+			
+	Delete(iContainerIndex); 
+	
+	iShutDown.Cancel();
+	}
+
+CSession2* CRTSecMgrServer::NewSessionL(const TVersion &aVersion,const RMessage2& /*aMessage*/) const
+	{
+	  // Check that the version is OK
+	TVersion v(KRTSecMgrServMajorVersionNumber,KRTSecMgrServMinorVersionNumber,KRTSecMgrServBuildVersionNumber);
+	if (!User::QueryVersionSupported(v,aVersion))
+		User::Leave(KErrNotSupported);
+	
+	return CRTSecMgrSession::NewL();
+	}
+	
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserversession.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <e32svr.h>
+#include <e32uid.h>
+
+#include "rtsecmgrserver.h"
+#include "rtsecmgrdata.h"
+#include "rtsecmgrpolicyparser.h"
+#include "rtsecmgrsession.h"
+#include "rtsecmgrsubsession.h"
+
+/**
+ * Called by client/server framework after 
+ * session has been successfully created.
+ * In effect, a second-phase constructor.
+ * creates:
+ * 
+ *  1. the object index
+ *  2. the object container for this session.
+ *
+ */
+void CRTSecMgrSession::CreateL()
+	{
+	if(!iSecMgrServer)
+		iSecMgrServer = dynamic_cast<CRTSecMgrServer*> (const_cast<CServer2*> (Server()));
+		
+	iSecMgrServer->AddSession ();
+
+	iSubSessionObjectIndex = CObjectIx::NewL ();
+	iContainer = iSecMgrServer->NewContainerL ();
+	}
+
+void CRTSecMgrSession::CloseSession()
+	{
+	//delete the object index (this stores the objects for this session)
+	Delete (iSubSessionObjectIndex);
+	//delete the object container (this provides unique ids for the objects of this session )
+
+	iSecMgrServer->RemoveFromContainerIx (iContainer);
+	iSecMgrServer->RemoveSession ();
+	}
+
+/**
+ * A simple utility function to return the appropriate 
+ * CRTSecMgrSubSession object given a client's subsession handle.
+ */
+CRTSecMgrSubSession* CRTSecMgrSession::SubSessionFromHandle(
+		const RMessage2& aMessage, TInt aHandle)
+	{
+	CRTSecMgrSubSession* subSession = (CRTSecMgrSubSession*)iSubSessionObjectIndex->At(aHandle);
+
+	if ( !subSession)
+		{
+		PanicClient (aMessage, EBadSubsessionHandle);
+		}
+	return subSession;
+	}
+
+void CRTSecMgrSession::DispatchMessageL(const RMessage2& aMessage)
+	{
+	// First check for session-relative requests
+	switch (aMessage.Function ())
+		{
+		case ESetPolicy:
+			SetPolicy (aMessage);
+			return;
+		case EUpdatePolicy:
+			UpdatePolicy (aMessage);
+			return;
+		case EUnsetPolicy:
+			UnsetPolicy (aMessage);
+			return;
+		case ERegisterScript:
+			RegisterScript (aMessage);
+			return;
+		case ERegisterScriptWithHash:
+			RegisterScript (aMessage, ETrue);
+			return;
+		case EUnRegisterScript:
+			UnregisterScript (aMessage);
+			return;
+		case EGetScriptSession:
+			GetScriptSessionL (aMessage);
+			return;
+		case EGetTrustedUnRegScriptSession:
+			GetTrustedUnRegScriptSessionL (aMessage);
+			return;
+		case ESecServCloseSession:
+			CloseSession ();
+			return;
+			}
+
+	// All other function codes must be subsession relative.
+	// We need to find the appropriate server side subsession
+	// i.e. the CRTSecMgrSubSession object. 
+	// The handle value is passed as the 4th aregument.
+	CRTSecMgrSubSession* subSession = SubSessionFromHandle (aMessage,
+			aMessage.Int3 ());
+	switch (aMessage.Function ())
+		{
+		case ECloseScriptSession:
+			DeleteSubSession (aMessage.Int3 ());
+			return;
+		case EUpdatePermanentGrant:
+			subSession->UpdatePermGrantL (aMessage);
+			return;
+		case EGetScriptFile:
+			subSession->GetScriptFile (aMessage);
+			return;
+		default:
+			PanicClient (aMessage, EBadRequest);
+			return;
+		}
+	}
+TBool CRTSecMgrSession::IsScriptOpenWithPolicy(TPolicyID aPolicyID)
+	{
+	for (TInt i(0); i!=iSubSessionObjectIndex->Count ();++i)
+		{
+		CRTSecMgrSubSession
+				* subsession = ((CRTSecMgrSubSession*)iSubSessionObjectIndex->operator[](i));
+		if ( subsession)
+			{
+			if ( aPolicyID==subsession->Script().PolicyID ())
+				{
+				return ETrue;
+				}
+			}
+		else
+			{
+			continue;
+			}
+
+		}
+	return EFalse;
+	}
+
+TBool CRTSecMgrSession::IsScriptSessionOpen(TExecutableID aScriptID,CRTSecMgrSubSession* aCurrentSession)
+	{
+	for (TInt i(0); i!=iSubSessionObjectIndex->Count ();++i)
+		{
+		CRTSecMgrSubSession
+				* subsession = ((CRTSecMgrSubSession*)iSubSessionObjectIndex->operator[](i));
+		if ( subsession && ( subsession != aCurrentSession))
+			{
+			if ( aScriptID==subsession->ScriptID ())
+				{
+				return ETrue;
+				}
+			}
+		else
+			{
+			continue;
+			}
+
+		}
+	return EFalse;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrserverstartUp.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <e32base.h>
+#include "rtsecmgrserver.h"
+#include "rtsecmgrserverdef.h"
+
+TInt E32Main(); // Process entry point
+
+static void RunServerL()
+	{
+	// Naming the server process and thread after the startup helps to debug panics
+	// No error checking as names are not critical for operation
+	User::RenameProcess (KSecServerProcessName);
+	User::RenameThread (KSecSrvMainThreadName);
+
+	// Set process priority
+	RProcess svrProcess;
+	svrProcess.SetPriority (EPriorityHigh);
+	svrProcess.Close ();
+
+	// Create and install the active scheduler we need
+	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+	CleanupStack::PushL (scheduler);
+
+	CActiveScheduler::Install ( scheduler);
+	CRTSecMgrServer* server=  NULL;
+	server = CRTSecMgrServer::NewLC (CActive::EPriorityStandard);
+
+	// Initialisation complete, now signal the client
+	RProcess::Rendezvous (KErrNone);
+	CActiveScheduler::Start ();
+	// Cleanup
+	CleanupStack::PopAndDestroy (server);
+	CleanupStack::PopAndDestroy (scheduler);
+	}
+
+/*
+ * Process main function
+ * 
+ */
+TInt E32Main()
+	{
+	__UHEAP_MARK;
+	TInt i = User::CountAllocCells();
+	TInt err(KErrNone);
+
+	// Start server.
+	CTrapCleanup* cleanup = CTrapCleanup::New ();
+	err = KErrNoMemory;
+
+	if ( cleanup)
+		{
+		TRAP(err, RunServerL());
+		
+		delete cleanup;
+		cleanup = NULL;
+		}
+	i = User::CountAllocCells();
+	__UHEAP_MARKEND;
+
+	return err;
+	}
+
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerserver/src/rtsecmgrstore.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,593 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Definition of security manager store class
+ *
+*/
+
+
+
+
+
+
+#include <s32file.h>
+#include <bautils.h>
+#include <eikenv.h>
+#include <f32file.h>
+#include <pathinfo.h>
+#include "rtsecmgrstore.h"
+#include "rtsecmgrdata.h"
+
+const TReal DEFAULT_VERSION(1.0);
+CSecMgrStore* CSecMgrStore::NewL()
+	{
+	CSecMgrStore* self = CSecMgrStore::NewLC ();
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+CSecMgrStore* CSecMgrStore::NewLC()
+	{
+	CSecMgrStore* self = new (ELeave)CSecMgrStore();
+	CleanupStack::PushL (self);
+	self->ConstructL ();
+	return self;
+	}
+
+void CSecMgrStore::StorePolicyL(const CPolicy& aPolicy)
+	{
+	__UHEAP_MARK;
+
+	HBufC *policyFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(policyFile->Des());
+	GetPolicyFile (ptr, aPolicy.PolicyID ());
+
+	CFileStore* store = CPermanentFileStore::ReplaceLC (iFsSession, ptr,
+			EFileWrite);
+	store->SetTypeL (KPermanentFileStoreLayoutUid);
+
+	// Construct the output stream.
+	RStoreWriteStream outstream;
+	TStreamId id = outstream.CreateLC (*store);
+	//Write version of the policy
+	outstream.WriteReal32L (TReal(DEFAULT_VERSION));
+
+	TInt aliasCnt(aPolicy.AliasGroup().Count());
+	outstream.WriteInt32L (aliasCnt);
+	RAliasGroup aliasGroups = aPolicy.AliasGroup();
+	for (TInt i(0); i!=aliasCnt;++i)
+		{
+		CPermission* alias = aliasGroups[i];
+		alias->ExternalizeL (outstream);
+		}
+	
+	TInt domainCnt(aPolicy.ProtectionDomain().Count ());
+	outstream.WriteInt32L (domainCnt);
+	RProtectionDomains domains = aPolicy.ProtectionDomain ();
+	for (TInt i(0); i!=domainCnt;++i)
+		{
+		CProtectionDomain* domain = domains[i];
+		domain->ExternalizeL (outstream);
+		}
+
+	// Commit changes to the stream
+	outstream.CommitL ();
+
+	CleanupStack::PopAndDestroy (&outstream);
+
+	// Set this stream id as the root
+	store->SetRootL (id);
+
+	// Commit changes to the store
+	store->CommitL ();
+
+	CleanupStack::PopAndDestroy (store);
+	CleanupStack::PopAndDestroy (policyFile);
+	__UHEAP_MARKEND;
+	}
+
+
+TInt CSecMgrStore::RemovePolicy(TPolicyID aPolicyID)
+	{
+	HBufC *policyFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(policyFile->Des());
+	TInt ret(KErrNone);
+	
+	ret = GetPolicyFile(ptr, aPolicyID);
+	
+	if(KErrNone==ret)
+		ret  = iFsSession.Delete (ptr);
+	CleanupStack::PopAndDestroy(policyFile);
+	return ret;
+	}
+
+void CSecMgrStore::RestorePoliciesL(RPolicies& aPolicy)
+	{
+	//Fetch all the individual policy files from "epoc32\winscw\c\private\<SECMGR_UID>\policy" directory
+	//Iteratively internalise the policy files, with the policyID (PolicyID is = to filename)
+	HBufC *privateDir = HBufC::NewLC(KMaxName);
+	TPtr privateDirptr(privateDir->Des());
+	GetPolicyPath (privateDirptr);
+
+	// create search string
+	HBufC* searchBuf = privateDirptr.AllocLC ();
+	TPtr searchPtr(searchBuf->Des());
+
+	CDir* dir=  NULL;
+	iFsSession.GetDir (searchPtr, KEntryAttNormal,
+			ESortByName | EAscending, dir);
+
+	if ( dir)
+		{
+		CleanupStack::PushL (dir);
+		for (TInt i=0; i!=dir->Count ();++i)
+			{
+			TEntry entry = dir->operator[] (i);
+			HBufC *fileName = HBufC::NewLC(KMaxName);
+			TPtr ptr(fileName->Des());
+			ptr = entry.iName;
+
+			HBufC *policyFile = HBufC::NewLC(KMaxName);
+			TPtr policyFileptr(policyFile->Des());
+			policyFileptr.Copy(privateDirptr) ;
+			policyFileptr.Append (ptr);
+
+			CFileStore* store = CPermanentFileStore::OpenLC (iFsSession,
+					policyFileptr, EFileShareAny);
+
+			RStoreReadStream instream;
+			instream.OpenLC (*store, store->Root ());
+
+			TLex16 lexer(ptr);
+			TPolicyID pID;
+			lexer.Val (pID);
+
+			CPolicy* policy = CPolicy::NewL (pID, instream);
+			aPolicy.Append (policy);
+
+			CleanupStack::PopAndDestroy (&instream); //instream
+			CleanupStack::PopAndDestroy (store); //store
+			CleanupStack::PopAndDestroy (policyFile);
+			CleanupStack::PopAndDestroy (fileName);
+			}
+
+		CleanupStack::PopAndDestroy (dir);
+		}
+
+	CleanupStack::PopAndDestroy (searchBuf);
+	CleanupStack::PopAndDestroy (privateDir);
+	}
+
+void CSecMgrStore::RegisterScriptL(TExecutableID aExecID, const CScript& aScript)
+	{
+	HBufC *scriptFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(scriptFile->Des());
+	User::LeaveIfError(GetScriptFile(ptr,aExecID));
+
+	CFileStore* store = CPermanentFileStore::ReplaceLC (iFsSession, ptr,
+			EFileWrite);
+
+	// Must say what kind of file store.
+	store->SetTypeL (KPermanentFileStoreLayoutUid);
+
+	// Construct the output stream.
+	RStoreWriteStream outstream;
+	TStreamId id = outstream.CreateLC (*store);
+
+	aScript.ExternalizeL (outstream);
+
+	// Commit changes to the stream
+	outstream.CommitL ();
+
+	// Cleanup the stream object
+	CleanupStack::PopAndDestroy (&outstream);
+
+	// Set this stream id as the root
+	store->SetRootL (id);
+
+	// Commit changes to the store
+	store->CommitL ();
+
+	CleanupStack::PopAndDestroy (store);
+	CleanupStack::PopAndDestroy (scriptFile);
+
+	}
+
+void CSecMgrStore::UnRegisterScriptL(TExecutableID aExecID)
+	{
+	HBufC *scriptFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(scriptFile->Des());
+	User::LeaveIfError (GetScriptFile (ptr,aExecID));
+
+	if ( BaflUtils::FileExists (iFsSession, ptr))
+		iFsSession.Delete (ptr);
+	else
+		{
+		User::Leave(ErrInvalidScriptID);
+		}
+	CleanupStack::PopAndDestroy (scriptFile);
+	}
+
+TInt CSecMgrStore::ReadScriptInfo(TExecutableID aExecID, CScript& aScriptInfo)
+	{
+	__UHEAP_MARK;
+
+	HBufC *scriptFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(scriptFile->Des());
+	TInt ret(GetScriptFile (ptr, aExecID));
+
+	if ( KErrNone==ret)
+		{
+		if ( !BaflUtils::FileExists(iFsSession, ptr))
+			{
+			return ErrInvalidScriptID;
+			}
+
+		CFileStore* store=  NULL;
+		store=CPermanentFileStore::OpenLC (iFsSession, ptr,
+				EFileShareAny);
+
+		if ( KErrNone==ret)
+			{
+			RStoreReadStream instream;
+			instream.OpenLC (*store, store->Root ());
+
+			aScriptInfo.InternalizeL (instream);
+
+			CleanupStack::PopAndDestroy (&instream);
+			CleanupStack::PopAndDestroy (store);
+			}
+		return ret;
+		}
+	CleanupStack::PopAndDestroy (scriptFile);
+	__UHEAP_MARKEND;
+
+	return ret;
+	}
+
+TInt CSecMgrStore::GetScriptFile(TExecutableID aExecID, TDes& aScriptFile)
+	{
+	TInt ret(GetScriptFile (aScriptFile,aExecID));
+
+	if ( KErrNone==ret)
+		{
+		if ( !BaflUtils::FileExists(iFsSession, aScriptFile))
+			{
+			return ErrInvalidScriptID;
+			}
+		}
+
+	return ret;
+	}
+
+void CSecMgrStore::WriteScriptInfoL(TExecutableID aExecID, CScript& aScriptInfo)
+	{
+	__UHEAP_MARK;
+
+	HBufC *scriptFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(scriptFile->Des());
+	User::LeaveIfError (GetScriptFile (ptr,aExecID));
+
+	CFileStore* store = CPermanentFileStore::ReplaceLC (iFsSession, ptr,
+			EFileWrite);
+
+	// Must say what kind of file store.
+	store->SetTypeL (KPermanentFileStoreLayoutUid);
+
+	// Construct the output stream.
+	RStoreWriteStream outstream;
+	TStreamId id = outstream.CreateLC (*store);
+
+	aScriptInfo.ExternalizeL (outstream);
+
+	// Commit changes to the stream
+	outstream.CommitL ();
+
+	// Cleanup the stream object
+	CleanupStack::PopAndDestroy (&outstream);
+
+	// Set this stream id as the root
+	store->SetRootL (id);
+
+	// Commit changes to the store
+	store->CommitL ();
+
+	CleanupStack::PopAndDestroy (store);
+	CleanupStack::PopAndDestroy (scriptFile);
+	__UHEAP_MARKEND;
+	}
+
+TInt CSecMgrStore::ReadCounter(TExecutableID& aExecID)
+	{
+	HBufC *configFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(configFile->Des());
+	TInt ret(GetConfigFile (ptr));
+
+	if ( KErrNone==ret)
+		{
+		if ( !BaflUtils::FileExists(iFsSession,*configFile))
+			{
+			aExecID = (TExecutableID)KCRUIdSecMgr.iUid;
+			BaflUtils::EnsurePathExistsL (iFsSession, *configFile);
+			CleanupStack::PopAndDestroy (configFile);
+			return WriteCounter (aExecID);
+			}
+
+		CFileStore* store = CPermanentFileStore::OpenLC (iFsSession,
+				*configFile, EFileRead);
+
+		RStoreReadStream instream;
+		instream.OpenLC (*store, store->Root ());
+
+		aExecID = instream.ReadInt32L ();
+
+		CleanupStack::PopAndDestroy (&instream);
+		CleanupStack::PopAndDestroy (store);
+		}
+	CleanupStack::PopAndDestroy (configFile);
+	return ret;
+	}
+
+TInt CSecMgrStore::WriteCounter(TExecutableID aExecID)
+	{
+	HBufC *configFile = HBufC::NewLC(KMaxName);
+	TPtr ptr(configFile->Des());
+	TInt ret(GetConfigFile (ptr));
+
+	if ( KErrNone==ret)
+		{
+		CFileStore* store = CPermanentFileStore::ReplaceLC (iFsSession,
+				*configFile, EFileWrite);
+
+		// Must say what kind of file store.
+		store->SetTypeL (KPermanentFileStoreLayoutUid);
+
+		// Construct the output stream.
+		RStoreWriteStream outstream;
+		TStreamId id = outstream.CreateLC (*store);
+
+		outstream.WriteInt32L (aExecID);
+
+		// Commit changes to the stream
+		outstream.CommitL ();
+
+		// Cleanup the stream object
+		CleanupStack::PopAndDestroy (&outstream);
+
+		// Set this stream id as the root
+		store->SetRootL (id);
+
+		// Commit changes to the store
+		store->CommitL ();
+
+		CleanupStack::PopAndDestroy (store);
+		}
+	CleanupStack::PopAndDestroy (configFile);
+	return ret;
+	}
+
+TInt CSecMgrStore::GetPrivatePath(TDes& aPrivatePath)
+	{
+	TInt ret(KErrNone);
+	aPrivatePath.Append (KCDrive);
+
+	HBufC *privateDir = HBufC::NewLC(KMaxName);
+	TPtr ptr(privateDir->Des());
+	ret = iFsSession.PrivatePath (ptr);
+
+	if ( KErrNone==ret)
+		{
+		aPrivatePath.Append (ptr);
+		}
+	CleanupStack::PopAndDestroy (privateDir);
+	return ret;
+	}
+
+TInt CSecMgrStore::GetConfigFile(TDes& aConfigFile)
+	{
+	TInt ret(KErrNone);
+
+	aConfigFile.Append (KCDrive);
+
+	HBufC *privateDir = HBufC::NewLC(KMaxName);
+	TPtr ptr(privateDir->Des());
+	ret = iFsSession.PrivatePath (ptr);
+
+	if ( KErrNone==ret)
+		{
+		aConfigFile.Append (ptr);
+
+		ret = iFsSession.MkDirAll (ptr);
+
+		if ( KErrAlreadyExists==ret)
+			ret=KErrNone;
+
+		aConfigFile.Append (KConfigFile);
+		}
+	CleanupStack::PopAndDestroy (privateDir);
+	return ret;
+	}
+
+TInt CSecMgrStore::GetPolicyPath(TDes& aFile)
+	{
+	TInt ret(GetPrivatePath (aFile));
+
+	if ( KErrNone==ret)
+		{
+		aFile.Append (KPolicyDir);
+		aFile.Append (KDirSeparator);
+
+		TRAP (ret, BaflUtils::EnsurePathExistsL (iFsSession, aFile));
+		}
+
+	return ret;
+	}
+
+TInt CSecMgrStore::GetScriptPath(TDes& aFile)
+	{
+	TInt ret(GetPrivatePath (aFile));
+
+	if ( KErrNone==ret)
+		{
+		aFile.Append (KScriptDir);
+		aFile.Append (KDirSeparator);
+
+		TRAP (ret, BaflUtils::EnsurePathExistsL (iFsSession, aFile));
+
+		if ( KErrAlreadyExists==ret)
+			ret = KErrNone;
+		}
+
+	return ret;
+	}
+
+TInt CSecMgrStore::GetScriptFile(TDes& aFile, TExecutableID aExecID)
+	{
+	TInt ret(GetScriptPath (aFile));
+
+	if ( (KErrNone==ret) || (KErrAlreadyExists==ret))
+		{
+		if ( KAnonymousScript!=aExecID)
+			{
+			HBufC *fSuffix = HBufC::NewLC(KMaxName);
+			TPtr fSuffixPtr(fSuffix->Des());
+			fSuffixPtr.Num (aExecID);
+
+			aFile.Append (fSuffixPtr);
+			aFile.Append (KDatExtn);
+			CleanupStack::PopAndDestroy (fSuffix);
+			}
+		}
+
+	if ( KErrAlreadyExists==ret)
+		ret=KErrNone;
+
+	return ret;
+	}
+
+TInt CSecMgrStore::GetPolicyFile(TDes& aFile, TPolicyID aPolicyID)
+	{
+	TInt ret(GetPolicyPath (aFile));
+
+	if ( (KErrNone==ret) || (KErrAlreadyExists==ret))
+		{
+		HBufC *fPolicyName = HBufC::NewLC(KMaxName);
+		TPtr policyNamePtr(fPolicyName->Des());
+		policyNamePtr.Num (aPolicyID);
+
+		aFile.Append (policyNamePtr);
+		aFile.Append (KDatExtn);
+		CleanupStack::PopAndDestroy (fPolicyName);
+		}
+
+	return ret;
+	}
+
+
+TInt CSecMgrStore::BackupFile(TPolicyID aPolicyID)
+{
+	HBufC *policyFile = HBufC::NewLC(KMaxName);
+	TPtr policyFilePtr(policyFile->Des());
+	
+	HBufC *tempPolicyFile = HBufC::NewLC(KMaxName);
+	TPtr tempPolicyFilePtr(tempPolicyFile->Des());
+	
+	TInt ret(GetPolicyFile(policyFilePtr, aPolicyID));
+
+	ret= GetPolicyPath (tempPolicyFilePtr);
+
+	if ( (KErrNone==ret) || (KErrAlreadyExists==ret))
+	{
+		HBufC *fPolicyName = HBufC::NewLC(KMaxName);
+		TPtr policyNamePtr(fPolicyName->Des());
+		policyNamePtr.Num (aPolicyID);
+
+		tempPolicyFilePtr.Append (policyNamePtr);
+		tempPolicyFilePtr.Append (_L("_temp"));
+		tempPolicyFilePtr.Append (KDatExtn);
+		
+		CleanupStack::PopAndDestroy(fPolicyName);
+	}
+	
+	CFileMan *fm = CFileMan::NewL(iFsSession);
+	TInt backupResult = fm->Copy(policyFilePtr, tempPolicyFilePtr, CFileMan::EOverWrite);
+	delete fm;
+	
+	CleanupStack::PopAndDestroy(tempPolicyFile);
+	CleanupStack::PopAndDestroy(policyFile);
+	
+	return backupResult;	
+}
+
+TInt CSecMgrStore::RemoveTempPolicy(TPolicyID aPolicyID)
+{
+	HBufC *tempPolicyFile = HBufC::NewLC(KMaxName);
+	TPtr tempPolicyFilePtr(tempPolicyFile->Des());
+	
+	TInt ret= GetPolicyPath (tempPolicyFilePtr);
+
+	if ( (KErrNone==ret) || (KErrAlreadyExists==ret))
+	{
+		HBufC *fPolicyName = HBufC::NewLC(KMaxName);
+		TPtr policyNamePtr(fPolicyName->Des());
+		policyNamePtr.Num (aPolicyID);
+
+		tempPolicyFilePtr.Append (policyNamePtr);
+		tempPolicyFilePtr.Append (_L("_temp"));
+		tempPolicyFilePtr.Append (KDatExtn);
+		
+		CleanupStack::PopAndDestroy(fPolicyName);
+	}
+	
+	CFileMan *fm = CFileMan::NewL(iFsSession);
+	TInt rmTempResult = fm->Delete(tempPolicyFilePtr);
+	delete fm;
+	
+	CleanupStack::PopAndDestroy(tempPolicyFile);
+		
+	return rmTempResult;	
+}
+
+TInt CSecMgrStore::RestoreTempPolicy(TPolicyID aPolicyID)
+{
+	HBufC *policyFile = HBufC::NewLC(KMaxName);
+	TPtr policyFilePtr(policyFile->Des());
+	
+	HBufC *tempPolicyFile = HBufC::NewLC(KMaxName);
+	TPtr tempPolicyFilePtr(tempPolicyFile->Des());
+	
+	TInt ret(GetPolicyFile(policyFilePtr, aPolicyID));
+
+	ret= GetPolicyPath (tempPolicyFilePtr);
+
+	if ( (KErrNone==ret) || (KErrAlreadyExists==ret))
+	{
+		HBufC *fPolicyName = HBufC::NewLC(KMaxName);
+		TPtr policyNamePtr(fPolicyName->Des());
+		policyNamePtr.Num (aPolicyID);
+
+		tempPolicyFilePtr.Append (policyNamePtr);
+		tempPolicyFilePtr.Append (_L("_temp"));
+		tempPolicyFilePtr.Append (KDatExtn);
+		
+		CleanupStack::PopAndDestroy(fPolicyName);
+	}
+	
+	CFileMan *fm = CFileMan::NewL(iFsSession);
+	TInt restoreResult = fm->Copy(tempPolicyFilePtr, policyFilePtr, CFileMan::EOverWrite);
+	delete fm;
+	
+	CleanupStack::PopAndDestroy(tempPolicyFile);
+	CleanupStack::PopAndDestroy(policyFile);
+	return restoreResult;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/BWINS/RTSecMgrUtilU.DEF	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,60 @@
+EXPORTS
+	??1CPermission@@UAE@XZ @ 1 NONAME ; CPermission::~CPermission(void)
+	??1CPermissionSet@@UAE@XZ @ 2 NONAME ; CPermissionSet::~CPermissionSet(void)
+	??1CRTSecMgrRegisterScriptMsg@@UAE@XZ @ 3 NONAME ; CRTSecMgrRegisterScriptMsg::~CRTSecMgrRegisterScriptMsg(void)
+	??1CScript@@UAE@XZ @ 4 NONAME ; CScript::~CScript(void)
+	??4CScript@@QAEABV0@ABV0@@Z @ 5 NONAME ; class CScript const & CScript::operator=(class CScript const &)
+	?AppendCapPermData@CPermission@@QAEXW4TCapability@@@Z @ 6 NONAME ; void CPermission::AppendCapPermData(enum TCapability)
+	?AppendPermission@CPermissionSet@@QAEXAAVCPermission@@@Z @ 7 NONAME ; void CPermissionSet::AppendPermission(class CPermission &)
+	?AppendUncondCap@CPermissionSet@@QAEXW4TCapability@@@Z @ 8 NONAME ; void CPermissionSet::AppendUncondCap(enum TCapability)
+	?AppendUncondCapabilities@CPermissionSet@@QAEXK@Z @ 9 NONAME ; void CPermissionSet::AppendUncondCapabilities(unsigned long)
+	?Capabilitilites@CPermission@@QBEXAAV?$RArray@W4TCapability@@@@@Z @ 10 NONAME ; void CPermission::Capabilitilites(class RArray<enum TCapability> &) const
+	?Capability@CPermission@@QBE?AW4TCapability@@XZ @ 11 NONAME ; enum TCapability CPermission::Capability(void) const
+	?Condition@CPermission@@QBE?AW4TUserPromptOption@@XZ @ 12 NONAME ; enum TUserPromptOption CPermission::Condition(void) const
+	?Default@CPermission@@QBE?AW4TUserPromptOption@@XZ @ 13 NONAME ; enum TUserPromptOption CPermission::Default(void) const
+	?ExternalizeL@CPermission@@QBEXAAVRWriteStream@@@Z @ 14 NONAME ; void CPermission::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CPermissionSet@@QBEXAAVRWriteStream@@@Z @ 15 NONAME ; void CPermissionSet::ExternalizeL(class RWriteStream &) const
+	?ExternalizeL@CScript@@QBEXAAVRWriteStream@@@Z @ 16 NONAME ; void CScript::ExternalizeL(class RWriteStream &) const
+	?InternalizeL@CPermission@@QAEXAAVRReadStream@@@Z @ 17 NONAME ; void CPermission::InternalizeL(class RReadStream &)
+	?InternalizeL@CPermissionSet@@QAEXAAVRReadStream@@@Z @ 18 NONAME ; void CPermissionSet::InternalizeL(class RReadStream &)
+	?InternalizeL@CScript@@QAEXAAVRReadStream@@@Z @ 19 NONAME ; void CScript::InternalizeL(class RReadStream &)
+	?NewL@CPermission@@SAPAV1@ABV1@@Z @ 20 NONAME ; class CPermission * CPermission::NewL(class CPermission const &)
+	?NewL@CPermission@@SAPAV1@ABV?$RArray@W4TCapability@@@@@Z @ 21 NONAME ; class CPermission * CPermission::NewL(class RArray<enum TCapability> const &)
+	?NewL@CPermission@@SAPAV1@ABV?$RArray@W4TCapability@@@@W4TUserPromptOption@@1@Z @ 22 NONAME ; class CPermission * CPermission::NewL(class RArray<enum TCapability> const &, enum TUserPromptOption, enum TUserPromptOption)
+	?NewL@CPermission@@SAPAV1@ABV?$RArray@W4TCapability@@@@W4TUserPromptOption@@@Z @ 23 NONAME ; class CPermission * CPermission::NewL(class RArray<enum TCapability> const &, enum TUserPromptOption)
+	?NewL@CPermission@@SAPAV1@XZ @ 24 NONAME ; class CPermission * CPermission::NewL(void)
+	?NewL@CPermissionSet@@SAPAV1@ABV1@@Z @ 25 NONAME ; class CPermissionSet * CPermissionSet::NewL(class CPermissionSet const &)
+	?NewL@CPermissionSet@@SAPAV1@XZ @ 26 NONAME ; class CPermissionSet * CPermissionSet::NewL(void)
+	?NewL@CRTSecMgrRegisterScriptMsg@@SAPAV1@HABVTDesC16@@@Z @ 27 NONAME ; class CRTSecMgrRegisterScriptMsg * CRTSecMgrRegisterScriptMsg::NewL(int, class TDesC16 const &)
+	?NewL@CScript@@SAPAV1@HH@Z @ 28 NONAME ; class CScript * CScript::NewL(int, int)
+	?NewLC@CPermission@@SAPAV1@ABV1@@Z @ 29 NONAME ; class CPermission * CPermission::NewLC(class CPermission const &)
+	?NewLC@CPermission@@SAPAV1@ABV?$RArray@W4TCapability@@@@@Z @ 30 NONAME ; class CPermission * CPermission::NewLC(class RArray<enum TCapability> const &)
+	?NewLC@CPermission@@SAPAV1@ABV?$RArray@W4TCapability@@@@W4TUserPromptOption@@1@Z @ 31 NONAME ; class CPermission * CPermission::NewLC(class RArray<enum TCapability> const &, enum TUserPromptOption, enum TUserPromptOption)
+	?NewLC@CPermission@@SAPAV1@ABV?$RArray@W4TCapability@@@@W4TUserPromptOption@@@Z @ 32 NONAME ; class CPermission * CPermission::NewLC(class RArray<enum TCapability> const &, enum TUserPromptOption)
+	?NewLC@CPermission@@SAPAV1@XZ @ 33 NONAME ; class CPermission * CPermission::NewLC(void)
+	?NewLC@CPermissionSet@@SAPAV1@ABV1@@Z @ 34 NONAME ; class CPermissionSet * CPermissionSet::NewLC(class CPermissionSet const &)
+	?NewLC@CPermissionSet@@SAPAV1@XZ @ 35 NONAME ; class CPermissionSet * CPermissionSet::NewLC(void)
+	?NewLC@CRTSecMgrRegisterScriptMsg@@SAPAV1@ABVTDesC8@@@Z @ 36 NONAME ; class CRTSecMgrRegisterScriptMsg * CRTSecMgrRegisterScriptMsg::NewLC(class TDesC8 const &)
+	?NewLC@CRTSecMgrRegisterScriptMsg@@SAPAV1@HABVTDesC16@@@Z @ 37 NONAME ; class CRTSecMgrRegisterScriptMsg * CRTSecMgrRegisterScriptMsg::NewLC(int, class TDesC16 const &)
+	?NewLC@CScript@@SAPAV1@HH@Z @ 38 NONAME ; class CScript * CScript::NewLC(int, int)
+	?PackMsgL@CRTSecMgrRegisterScriptMsg@@QBEPAVHBufC8@@XZ @ 39 NONAME ; class HBufC8 * CRTSecMgrRegisterScriptMsg::PackMsgL(void) const
+	?PermDenied@CScript@@QBEKXZ @ 40 NONAME ; unsigned long CScript::PermDenied(void) const
+	?PermGranted@CScript@@QBEKXZ @ 41 NONAME ; unsigned long CScript::PermGranted(void) const
+	?PermName@CPermission@@QBEABVTDesC16@@XZ @ 42 NONAME ; class TDesC16 const & CPermission::PermName(void) const
+	?PermissionData@CPermission@@QBEKXZ @ 43 NONAME ; unsigned long CPermission::PermissionData(void) const
+	?PermissionSet@CScript@@QAEAAVCPermissionSet@@XZ @ 44 NONAME ; class CPermissionSet & CScript::PermissionSet(void)
+	?PermissionSet@CScript@@QBEABVCPermissionSet@@XZ @ 45 NONAME ; class CPermissionSet const & CScript::PermissionSet(void) const
+	?Permissions@CPermissionSet@@QAEAAV?$RPointerArray@VCPermission@@@@XZ @ 46 NONAME ; class RPointerArray<class CPermission> & CPermissionSet::Permissions(void)
+	?Permissions@CPermissionSet@@QBEABV?$RPointerArray@VCPermission@@@@XZ @ 47 NONAME ; class RPointerArray<class CPermission> const & CPermissionSet::Permissions(void) const
+	?PolicyID@CScript@@QBEHXZ @ 48 NONAME ; int CScript::PolicyID(void) const
+	?ScriptID@CScript@@QBEHXZ @ 49 NONAME ; int CScript::ScriptID(void) const
+	?SetCondition@CPermission@@QAEXW4TUserPromptOption@@@Z @ 50 NONAME ; void CPermission::SetCondition(enum TUserPromptOption)
+	?SetDefault@CPermission@@QAEXW4TUserPromptOption@@@Z @ 51 NONAME ; void CPermission::SetDefault(enum TUserPromptOption)
+	?SetPermDenied@CScript@@QAEXK@Z @ 52 NONAME ; void CScript::SetPermDenied(unsigned long)
+	?SetPermGranted@CScript@@QAEXK@Z @ 53 NONAME ; void CScript::SetPermGranted(unsigned long)
+	?SetPermName@CPermission@@QAEXABVTDesC16@@@Z @ 54 NONAME ; void CPermission::SetPermName(class TDesC16 const &)
+	?SetPermissionData@CPermission@@QAEXK@Z @ 55 NONAME ; void CPermission::SetPermissionData(unsigned long)
+	?SetPermissionSet@CScript@@QAEXABVCPermissionSet@@@Z @ 56 NONAME ; void CScript::SetPermissionSet(class CPermissionSet const &)
+	?UnconditionalCaps@CPermissionSet@@QBEKXZ @ 57 NONAME ; unsigned long CPermissionSet::UnconditionalCaps(void) const
+	?UnconditionalCaps@CPermissionSet@@QBEXAAV?$RArray@W4TCapability@@@@@Z @ 58 NONAME ; void CPermissionSet::UnconditionalCaps(class RArray<enum TCapability> &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/EABI/RTSecMgrUtilU.DEF	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,68 @@
+EXPORTS
+	_ZN11CPermission10SetDefaultE17TUserPromptOption @ 1 NONAME
+	_ZN11CPermission11SetPermNameERK7TDesC16 @ 2 NONAME
+	_ZN11CPermission12InternalizeLER11RReadStream @ 3 NONAME
+	_ZN11CPermission12SetConditionE17TUserPromptOption @ 4 NONAME
+	_ZN11CPermission17AppendCapPermDataE11TCapability @ 5 NONAME
+	_ZN11CPermission17SetPermissionDataEm @ 6 NONAME
+	_ZN11CPermission4NewLERK6RArrayI11TCapabilityE @ 7 NONAME
+	_ZN11CPermission4NewLERK6RArrayI11TCapabilityE17TUserPromptOption @ 8 NONAME
+	_ZN11CPermission4NewLERK6RArrayI11TCapabilityE17TUserPromptOptionS5_ @ 9 NONAME
+	_ZN11CPermission4NewLERKS_ @ 10 NONAME
+	_ZN11CPermission4NewLEv @ 11 NONAME
+	_ZN11CPermission5NewLCERK6RArrayI11TCapabilityE @ 12 NONAME
+	_ZN11CPermission5NewLCERK6RArrayI11TCapabilityE17TUserPromptOption @ 13 NONAME
+	_ZN11CPermission5NewLCERK6RArrayI11TCapabilityE17TUserPromptOptionS5_ @ 14 NONAME
+	_ZN11CPermission5NewLCERKS_ @ 15 NONAME
+	_ZN11CPermission5NewLCEv @ 16 NONAME
+	_ZN11CPermissionD0Ev @ 17 NONAME
+	_ZN11CPermissionD1Ev @ 18 NONAME
+	_ZN11CPermissionD2Ev @ 19 NONAME
+	_ZN14CPermissionSet11PermissionsEv @ 20 NONAME
+	_ZN14CPermissionSet12InternalizeLER11RReadStream @ 21 NONAME
+	_ZN14CPermissionSet15AppendUncondCapE11TCapability @ 22 NONAME
+	_ZN14CPermissionSet16AppendPermissionER11CPermission @ 23 NONAME
+	_ZN14CPermissionSet24AppendUncondCapabilitiesEm @ 24 NONAME
+	_ZN14CPermissionSet4NewLERKS_ @ 25 NONAME
+	_ZN14CPermissionSet4NewLEv @ 26 NONAME
+	_ZN14CPermissionSet5NewLCERKS_ @ 27 NONAME
+	_ZN14CPermissionSet5NewLCEv @ 28 NONAME
+	_ZN14CPermissionSetD0Ev @ 29 NONAME
+	_ZN14CPermissionSetD1Ev @ 30 NONAME
+	_ZN14CPermissionSetD2Ev @ 31 NONAME
+	_ZN26CRTSecMgrRegisterScriptMsg4NewLEiRK7TDesC16 @ 32 NONAME
+	_ZN26CRTSecMgrRegisterScriptMsg5NewLCERK6TDesC8 @ 33 NONAME
+	_ZN26CRTSecMgrRegisterScriptMsg5NewLCEiRK7TDesC16 @ 34 NONAME
+	_ZN26CRTSecMgrRegisterScriptMsgD0Ev @ 35 NONAME
+	_ZN26CRTSecMgrRegisterScriptMsgD1Ev @ 36 NONAME
+	_ZN26CRTSecMgrRegisterScriptMsgD2Ev @ 37 NONAME
+	_ZN7CScript12InternalizeLER11RReadStream @ 38 NONAME
+	_ZN7CScript13PermissionSetEv @ 39 NONAME
+	_ZN7CScript13SetPermDeniedEm @ 40 NONAME
+	_ZN7CScript14SetPermGrantedEm @ 41 NONAME
+	_ZN7CScript16SetPermissionSetERK14CPermissionSet @ 42 NONAME
+	_ZN7CScript4NewLEii @ 43 NONAME
+	_ZN7CScript5NewLCEii @ 44 NONAME
+	_ZN7CScriptD0Ev @ 45 NONAME
+	_ZN7CScriptD1Ev @ 46 NONAME
+	_ZN7CScriptD2Ev @ 47 NONAME
+	_ZN7CScriptaSERKS_ @ 48 NONAME
+	_ZNK11CPermission10CapabilityEv @ 49 NONAME
+	_ZNK11CPermission12ExternalizeLER12RWriteStream @ 50 NONAME
+	_ZNK11CPermission14PermissionDataEv @ 51 NONAME
+	_ZNK11CPermission15CapabilitilitesER6RArrayI11TCapabilityE @ 52 NONAME
+	_ZNK11CPermission7DefaultEv @ 53 NONAME
+	_ZNK11CPermission8PermNameEv @ 54 NONAME
+	_ZNK11CPermission9ConditionEv @ 55 NONAME
+	_ZNK14CPermissionSet11PermissionsEv @ 56 NONAME
+	_ZNK14CPermissionSet12ExternalizeLER12RWriteStream @ 57 NONAME
+	_ZNK14CPermissionSet17UnconditionalCapsER6RArrayI11TCapabilityE @ 58 NONAME
+	_ZNK14CPermissionSet17UnconditionalCapsEv @ 59 NONAME
+	_ZNK26CRTSecMgrRegisterScriptMsg8PackMsgLEv @ 60 NONAME
+	_ZNK7CScript10PermDeniedEv @ 61 NONAME
+	_ZNK7CScript11PermGrantedEv @ 62 NONAME
+	_ZNK7CScript12ExternalizeLER12RWriteStream @ 63 NONAME
+	_ZNK7CScript13PermissionSetEv @ 64 NONAME
+	_ZNK7CScript8PolicyIDEv @ 65 NONAME
+	_ZNK7CScript8ScriptIDEv @ 66 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/group/RTSecMgrUtil.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Project definition file for project
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+TARGET                  RTSecMgrUtil.dll
+TARGETTYPE              dll
+UID                     0x1000008D 0x2000F849
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION 10.1
+paged
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     		../inc/
+USERINCLUDE     		../../inc/
+
+SOURCEPATH     			../src/
+SOURCE       			rtsecmgrpermission.cpp
+SOURCE       			rtsecmgrscript.cpp
+SOURCE					rtsecmgrmsg.cpp
+
+//MACRO          RTSECMGR_TRACE
+
+LIBRARY         		euser.lib 
+LIBRARY					efsrv.lib 
+LIBRARY					estor.lib 
+LIBRARY					flogger.lib
+
+#if defined(ARMCC)
+deffile ../EABI/ 
+#elif defined(WINSCW)
+deffile ../BWINS/ 
+#elif defined(WINS)
+deffile ../BWINS/ 
+#else
+deffile ../bmarm/ 
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <platform_paths.hrh>
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+RTSecMgrUtil.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrmsg.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines rtsecmgr common client server message types
+ *
+*/
+
+
+
+
+
+
+
+#include "rtsecmgrmsg.h"
+
+CRTSecMgrRegisterScriptMsg::CRTSecMgrRegisterScriptMsg(TPolicyID aPolicyID) :
+	iPolicyID(aPolicyID)
+	{
+	// No implementation required
+	}
+
+EXPORT_C CRTSecMgrRegisterScriptMsg::~CRTSecMgrRegisterScriptMsg()
+	{
+	if ( iHashMarker)
+		{
+		delete iHashMarker;
+		}
+	}
+
+EXPORT_C CRTSecMgrRegisterScriptMsg* CRTSecMgrRegisterScriptMsg::NewLC(
+		TPolicyID aPolicyID, const TDesC& aHashValue)
+	{
+	CRTSecMgrRegisterScriptMsg* self = new (ELeave)CRTSecMgrRegisterScriptMsg(aPolicyID);
+	CleanupStack::PushL (self);
+	self->ConstructL (aHashValue);
+	return self;
+	}
+
+EXPORT_C CRTSecMgrRegisterScriptMsg* CRTSecMgrRegisterScriptMsg::NewL(
+		TPolicyID aPolicyID, const TDesC& aHashValue)
+	{
+	CRTSecMgrRegisterScriptMsg* self=CRTSecMgrRegisterScriptMsg::NewLC (
+			aPolicyID, aHashValue);
+	CleanupStack::Pop (self); // self;
+	return self;
+	}
+
+// Creates a CRTSecMgrRegisterScriptMsg initialized with the contents of the
+// descriptor parameter
+EXPORT_C CRTSecMgrRegisterScriptMsg* CRTSecMgrRegisterScriptMsg::NewLC(const TDesC8& aStreamData)
+	{
+	// Reads descriptor data from a stream
+	// and creates a new CRTSecMgrRegisterScriptMsg object
+	CRTSecMgrRegisterScriptMsg* self = new (ELeave) CRTSecMgrRegisterScriptMsg();
+	CleanupStack::PushL (self);
+	
+	// Open a read stream for the descriptor
+	RDesReadStream stream(aStreamData);
+	CleanupClosePushL (stream);
+	self->InternalizeL (stream);
+	CleanupStack::PopAndDestroy (&stream); // finished with the stream
+	return (self);
+	}
+
+void CRTSecMgrRegisterScriptMsg::ConstructL(const TDesC& aHashValue)
+	{
+	if ( iHashMarker)
+		{
+		delete iHashMarker;
+		iHashMarker = NULL;
+		}
+
+	iHashMarker = aHashValue.AllocL ();
+	}
+
+// Creates and returns a heap descriptor which holds contents of ’this’
+EXPORT_C HBufC8* CRTSecMgrRegisterScriptMsg::PackMsgL() const
+	{
+	// Dynamic data buffer
+	CBufFlat* buf = CBufFlat::NewL(KMaxMsgLength);
+	CleanupStack::PushL(buf);
+	RBufWriteStream stream(*buf); // Stream over the buffer
+	CleanupClosePushL(stream);
+	ExternalizeL(stream);
+	CleanupStack::PopAndDestroy(&stream);
+	// Create a heap descriptor from the buffer
+	HBufC8* des = HBufC8::NewL(buf->Size());
+	TPtr8 ptr(des->Des());
+	buf->Read(0, ptr, buf->Size());
+	CleanupStack::PopAndDestroy(buf); // Finished with the buffer
+	return (des);
+	}
+
+// Writes ’this’ to aStream
+void CRTSecMgrRegisterScriptMsg::ExternalizeL(RWriteStream& aStream) const
+	{
+	if ( iHashMarker)
+		aStream << *iHashMarker;
+	else
+		aStream << KNullDesC8;
+	
+	aStream.WriteInt32L (iPolicyID); // Write iPolicyID to the stream
+	}
+
+// Initializes ’this’ with the contents of aStream
+void CRTSecMgrRegisterScriptMsg::InternalizeL(RReadStream& aStream)
+	{
+	iHashMarker = HBufC::NewL (aStream, KMaxHashValueDesLen);
+	iPolicyID = aStream.ReadInt32L (); // Read iPolicyID
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrpermission.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,585 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines permission data structure
+ *
+*/
+
+
+
+
+
+
+#include <s32mem.h>
+#include <rtsecmgrutility.h>
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewL()
+	{
+	CPermission* self = CPermission::NewLC();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewLC()
+	{
+	CPermission* self = new (ELeave) CPermission();
+	CleanupStack::PushL(self);
+	return self;
+	}
+
+CPermission::CPermission(const CPermission& aPermission)
+	{
+	if ( iPermName)
+		{
+		delete iPermName;
+		iPermName = NULL;
+		}
+
+	iPermName = aPermission.PermName().Alloc();
+	iPermissionData = aPermission.PermissionData();
+	}
+CPermission::CPermission(const RCapabilityArray& aCapabilities) :iPermName(NULL)
+	{
+	for(TInt i(0);i!=aCapabilities.Count();++i)
+		{
+		TUint32 capBit = LOWBIT << (aCapabilities[i]);
+		iPermissionData = KDefaultNullBit;
+		iPermissionData |= capBit;
+		}	
+	}
+
+CPermission::CPermission(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt) :iPermName(NULL)
+	{
+	iPermissionData = KDefaultNullBit;
+	for(TInt i(0);i!=aCapabilities.Count();++i)
+		{
+		TUint32 capBit = LOWBIT << (aCapabilities[i]);
+		iPermissionData |= capBit;
+
+		if ( aDefOpt&RTUserPrompt_OneShot)
+			iPermissionData |= DEFAULT_ONESHOT;
+		else
+			if ( aDefOpt&RTUserPrompt_Session)
+				iPermissionData |= DEFAULT_SESSION;
+			else
+				if ( aDefOpt&RTUserPrompt_Permanent)
+					iPermissionData |= DEFAULT_BLANKET;
+		}
+	}
+
+CPermission::CPermission(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt,TUserPromptOption aCondition) :iPermName(NULL)
+	{
+	iPermissionData = KDefaultNullBit;
+	for(TInt i(0);i!=aCapabilities.Count();++i)
+		{
+		TUint32 capBit = LOWBIT << (aCapabilities[i]);
+		iPermissionData |= capBit;
+		iPermissionData |= aCondition;
+
+		if ( aDefOpt&RTUserPrompt_OneShot)
+			iPermissionData |= DEFAULT_ONESHOT;
+		else
+			if ( aDefOpt&RTUserPrompt_Session)
+				iPermissionData |= DEFAULT_SESSION;
+			else
+				if ( aDefOpt&RTUserPrompt_Permanent)
+					iPermissionData |= DEFAULT_BLANKET;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission::~CPermission()
+	{
+	if(iPermName)
+		{
+		delete iPermName;
+		iPermName = NULL;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewL(const CPermission& aPermission)
+	{
+	CPermission* self = CPermission::NewLC(aPermission);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+EXPORT_C CPermission* CPermission::NewLC(const CPermission& aPermission)
+	{
+	CPermission* self = new (ELeave) CPermission(aPermission);
+	CleanupStack::PushL(self);
+	return self;
+	}
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewL(const RCapabilityArray& aCapabilities)
+	{
+	CPermission* self = CPermission::NewLC(aCapabilities);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewLC(const RCapabilityArray& aCapabilities)
+	{
+	CPermission* self = new (ELeave) CPermission(aCapabilities);
+	CleanupStack::PushL(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewL(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt)
+	{
+	CPermission* self = CPermission::NewLC(aCapabilities, aDefOpt);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewLC(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt)
+	{
+	CPermission* self = new (ELeave) CPermission(aCapabilities ,aDefOpt);
+	CleanupStack::PushL(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewL(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt,
+		TUserPromptOption aCondition)
+	{
+	CPermission* self = CPermission::NewLC(aCapabilities, aDefOpt, aCondition);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermission* CPermission::NewLC(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt,
+		TUserPromptOption aCondition)
+	{
+	CPermission* self = new (ELeave) CPermission(aCapabilities, aDefOpt, aCondition);
+	CleanupStack::PushL(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns default condition
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUserPromptOption CPermission::Default() const
+	{
+	TUint32 ret(iPermissionData & DEFAULT_ALL);
+	if(DEFAULT_ONESHOT&ret)
+		{
+		return RTUserPrompt_OneShot;
+		}
+	else if(DEFAULT_SESSION&ret)
+		{
+		return RTUserPrompt_Session;
+		}
+	else if(DEFAULT_BLANKET&ret)
+		{
+		return RTUserPrompt_Permanent;
+		}
+	return (TUserPromptOption)ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns condition set of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUserPromptOption CPermission::Condition() const
+	{
+	return (TUserPromptOption)(iPermissionData & CONDITION_ALL);
+	}
+
+// ---------------------------------------------------------------------------
+// Returns capability of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TCapability CPermission::Capability() const
+	{
+	TCapability retValue = (TCapability)(iPermissionData & CAPABILITY_ALL);
+
+	for(TInt i(ECapabilityTCB);i<=ECapabilityUserEnvironment;++i)
+		{
+		TUint32 temp = LOWBIT << i;
+		if(retValue & temp)
+			{
+			return (TCapability)i;
+			}
+		}
+	return ECapability_None;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns capability of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::Capabilitilites(RCapabilityArray& aCapabilities) const
+	{
+	TCapability retValue = (TCapability)(iPermissionData & CAPABILITY_ALL);
+
+	for(TInt i(ECapabilityTCB) ;i <= ECapabilityUserEnvironment ;i++)
+		{
+		TUint32 temp = LOWBIT << i;
+		if(retValue & temp)
+			{
+			aCapabilities.Append((TCapability)i);
+			}
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Sets default condition of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::SetDefault(TUserPromptOption aDefOpt)
+	{
+	if ( RTUserPrompt_OneShot==aDefOpt)
+		{
+		iPermissionData |= DEFAULT_ONESHOT;
+		iPermissionData |= CONDITION_ONESHOT;
+		}
+	else
+		if ( RTUserPrompt_Session==aDefOpt)
+			{
+			iPermissionData |= DEFAULT_SESSION;
+			iPermissionData |= CONDITION_SESSION;
+			}
+		else
+			if ( RTUserPrompt_Permanent==aDefOpt)
+				{
+				iPermissionData |= DEFAULT_BLANKET;
+				iPermissionData |= CONDITION_BLANKET;
+				}
+	}
+
+// ---------------------------------------------------------------------------
+// Sets condition of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::SetCondition(TUserPromptOption aCondition)
+	{
+	iPermissionData |= aCondition;
+	}
+
+// ---------------------------------------------------------------------------
+// Sets name of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::SetPermName(const TDesC& aPermName)
+	{
+	if ( iPermName)
+		{
+		delete iPermName;
+		iPermName = NULL;
+		}
+
+	iPermName = aPermName.AllocL ();
+	}
+	
+// ---------------------------------------------------------------------------
+// Returns name of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CPermission::PermName() const
+	{
+	if ( iPermName)
+		return *iPermName;
+	else
+		return KNullDesC ();
+	}
+
+// ---------------------------------------------------------------------------
+// Adds an unconditional capability
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::AppendCapPermData(TCapability aCap)
+	{
+	if ( (aCap>=ECapabilityTCB)&&(aCap<=ECapabilityUserEnvironment))
+		{
+		iPermissionData = iPermissionData | (LOWBIT << aCap);
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Sets the permission data
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::SetPermissionData(TPermissionData aPermData)
+	{
+		iPermissionData = aPermData;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns PermissionData of the permission
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPermissionData CPermission::PermissionData() const
+	{
+	return iPermissionData;
+	}
+
+// ---------------------------------------------------------------------------
+// Internalizes permission data from stream
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::InternalizeL(RReadStream& aInStream)
+	{
+	TInt32 len = aInStream.ReadInt32L ();
+	if ( iPermName)
+		{
+		delete iPermName;
+		iPermName = NULL;
+		}
+
+	iPermName = HBufC::NewL (aInStream, len);
+
+	iPermissionData = aInStream.ReadUint32L ();
+	}
+
+// ---------------------------------------------------------------------------
+// ExternalizeLs permission data to stream
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermission::ExternalizeL(RWriteStream& aOutStream) const
+	{
+	if(iPermName)
+		{
+		aOutStream.WriteInt32L (iPermName->Des().MaxLength ());
+		aOutStream << *iPermName;
+		}
+	else
+		{
+		aOutStream.WriteInt32L (0);
+		aOutStream << KNullDesC;
+		}	
+	
+	aOutStream.WriteUint32L (iPermissionData);
+	}
+
+// ---------------------------------------------------------------------------
+// Copy constructor
+// ---------------------------------------------------------------------------
+//
+CPermissionSet::CPermissionSet(const CPermissionSet& aPermSet)
+	{
+	iUncondCapSet = aPermSet.iUncondCapSet;
+	}
+
+void CPermissionSet::ConstructL(const CPermissionSet& aPermSet)
+	{
+	iPermissions.ResetAndDestroy ();
+	//iPermissions.Close();
+
+	for (TInt idx(0); idx!=aPermSet.iPermissions.Count ();++idx)
+		{
+		CPermission *temp = CPermission::NewL(*(aPermSet.iPermissions[idx]));
+		iPermissions.Append (temp);
+		}
+
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermissionSet* CPermissionSet::NewL()
+	{
+	CPermissionSet* self = CPermissionSet::NewLC();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermissionSet* CPermissionSet::NewLC()
+	{
+	CPermissionSet* self = new (ELeave) CPermissionSet();
+	CleanupStack::PushL(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermissionSet* CPermissionSet::NewL(const CPermissionSet& aPermSet)
+	{
+	CPermissionSet* self = CPermissionSet::NewLC(aPermSet);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermissionSet* CPermissionSet::NewLC(const CPermissionSet& aPermSet)
+	{
+	CPermissionSet* self = new (ELeave) CPermissionSet(aPermSet);
+	CleanupStack::PushL(self);
+	self->ConstructL(aPermSet);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermissionSet::~CPermissionSet()
+{
+	iPermissions.ResetAndDestroy();
+}
+
+// ---------------------------------------------------------------------------
+// Adds an unconditional capability
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermissionSet::AppendUncondCap(TCapability aCap)
+	{
+	if ( (aCap>=ECapabilityTCB)&&(aCap<=ECapabilityUserEnvironment))
+		{
+		iUncondCapSet = iUncondCapSet | (LOWBIT << aCap);
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Adds an unconditional capability
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermissionSet::AppendUncondCapabilities(TUnConditionalPermission aUnConditionals)
+	{
+		iUncondCapSet = aUnConditionals;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns unconditional capabilities of thhe permissionset
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUnConditionalPermission CPermissionSet::UnconditionalCaps() const
+	{
+	return iUncondCapSet;
+	}
+// ---------------------------------------------------------------------------
+// Returns unconditional capabilities of thhe permissionset
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermissionSet::UnconditionalCaps(RUnConditionals& aUnConditionals) const
+	{
+	for (TInt i(ECapabilityTCB); i!=ECapability_Limit;++i)
+		{
+		TUint32 capBitToCheck(KDefaultEnableBit);
+		capBitToCheck = capBitToCheck << i;
+
+		if ( capBitToCheck&iUncondCapSet)
+			{
+			aUnConditionals.Append ((TCapability)i);
+			}
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// ExternalizeLs permissionset data to stream
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermissionSet::ExternalizeL(RWriteStream& aSink) const
+	{
+	aSink.WriteInt32L (iPermissions.Count ());
+	for (TInt idx(0); idx!=iPermissions.Count ();++idx)
+		{
+		iPermissions[idx]->ExternalizeL (aSink);
+		}
+
+	aSink.WriteUint32L (iUncondCapSet);
+	}
+
+// ---------------------------------------------------------------------------
+// InternalizeL permissionset data from stream
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermissionSet::InternalizeL(RReadStream& aSource)
+	{
+	iPermissions.Reset ();
+	TInt cnt(aSource.ReadInt32L ());
+
+	for (TInt idx(0); idx!=cnt;++idx)
+		{
+		CPermission* permission = CPermission::NewL();
+		permission->InternalizeL (aSource);
+		iPermissions.Append (permission);
+		}
+
+	iUncondCapSet = aSource.ReadUint32L ();
+	}
+
+// ---------------------------------------------------------------------------
+// Adds a permission data to the permissionset
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPermissionSet::AppendPermission(CPermission& aPermission)
+	{
+	iPermissions.Append (&aPermission);
+	}
+
+// ---------------------------------------------------------------------------
+// Returns permission data
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const RPermissions& CPermissionSet::Permissions() const
+	{
+	return iPermissions;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns permission data
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RPermissions& CPermissionSet::Permissions()
+	{
+	return iPermissions;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rtsecuritymanager/rtsecuritymanagerutil/src/rtsecmgrscript.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,240 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 <rtsecmgrutility.h>
+#include <rtsecmgrscript.h>
+#include <s32mem.H>
+
+const TReal DEFAULT_VERSION(1.0);
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CScript::~CScript()
+	{
+	delete iPermissionSet;
+	if(iHashMark)
+		delete iHashMark;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CScript* CScript::NewL(TPolicyID aPolicyID,TExecutableID aScriptID)
+	{
+	CScript* self = CScript::NewLC(aPolicyID,aScriptID);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CScript* CScript::NewLC(TPolicyID aPolicyID,TExecutableID aScriptID)
+	{
+	CScript* self = new (ELeave) CScript(aPolicyID,aScriptID);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+void CScript::ConstructL()
+	{
+	iPermissionSet = CPermissionSet::NewL ();
+	}
+
+// ---------------------------------------------------------------------------
+// Overloaded assignment operator
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CScript& CScript::operator=(const CScript& aRhs)
+	{
+	if(iPermissionSet )
+		{
+		delete iPermissionSet;
+		iPermissionSet = NULL;
+		}
+
+	iPermissionSet = CPermissionSet::NewL(*aRhs.iPermissionSet);
+	iScriptID = aRhs.iScriptID;
+	iPolicyID = aRhs.iPolicyID;
+	iPermGrant = aRhs.iPermGrant;
+	iPermDenied = aRhs.iPermDenied;
+
+	if(iHashMark)
+		{
+			delete iHashMark;
+			iHashMark = NULL;
+		}
+	
+	if(aRhs.iHashMark)
+		{
+		iHashMark = aRhs.iHashMark->AllocLC();
+		CleanupStack::Pop(iHashMark);
+		}
+	return *this;
+	}
+
+// ---------------------------------------------------------------------------
+// Gets script identifier
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TExecutableID CScript::ScriptID() const
+	{
+	return iScriptID;
+	}
+
+// ---------------------------------------------------------------------------
+// Gets policy identifier
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPolicyID CScript::PolicyID() const
+	{
+	return iPolicyID;
+	}
+
+// ---------------------------------------------------------------------------
+// Sets permission set data of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::SetPermissionSet(const CPermissionSet& aPermSet)
+	{
+	if ( iPermissionSet)
+		{
+		delete iPermissionSet;
+		iPermissionSet=NULL;
+		}
+
+	iPermissionSet = CPermissionSet::NewL (aPermSet);
+	}
+
+// ---------------------------------------------------------------------------
+// Gets permission set data of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CPermissionSet& CScript::PermissionSet() const
+	{
+	return *iPermissionSet;
+	}
+// ---------------------------------------------------------------------------
+// Gets permission set data of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPermissionSet& CScript::PermissionSet()
+	{
+	return *iPermissionSet;
+	}
+
+// ---------------------------------------------------------------------------
+// Gets permanently granted permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPermGrant CScript::PermGranted() const
+	{
+	return iPermGrant;
+	}
+
+// ---------------------------------------------------------------------------
+// Gets permanently denied permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TPermGrant CScript::PermDenied() const
+	{
+	return iPermDenied;
+	}
+
+// ---------------------------------------------------------------------------
+// ExternalizeLs script data to stream
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::ExternalizeL(RWriteStream& aSink) const
+	{
+	aSink.WriteReal32L(DEFAULT_VERSION);
+	iPermissionSet->ExternalizeL (aSink);
+	aSink.WriteInt32L (iScriptID);
+	aSink.WriteInt32L (iPolicyID);
+	aSink.WriteUint32L (iPermGrant);
+	aSink.WriteUint32L (iPermDenied);
+	if(iHashMark)
+		{
+			aSink.WriteUint32L(iHashMark->Length());
+			aSink.WriteL(*iHashMark,iHashMark->Length());
+		}
+	else
+		aSink.WriteInt32L(0);
+	}
+
+// ---------------------------------------------------------------------------
+// InternalizeLs script data from stream
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::InternalizeL(RReadStream& aSource)
+	{
+	if ( iPermissionSet)
+		{
+		delete iPermissionSet;
+		iPermissionSet=NULL;
+		iPermissionSet = CPermissionSet::NewL ();
+		}
+	TReal version(aSource.ReadReal32L());
+	iPermissionSet->InternalizeL (aSource);
+	iScriptID = aSource.ReadInt32L ();
+	iPolicyID = aSource.ReadInt32L ();
+	iPermGrant = aSource.ReadUint32L ();
+	iPermDenied = aSource.ReadUint32L ();
+	TInt hashMarkLen(aSource.ReadUint32L());
+	if(iHashMark)
+		{
+			delete iHashMark;
+			iHashMark = NULL;
+		}
+		
+	if(hashMarkLen)	
+		{
+		iHashMark = HBufC::NewL(hashMarkLen);
+		TPtr ptr(iHashMark->Des());
+		aSource.ReadL(ptr,hashMarkLen);
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Sets permanently granted permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::SetPermGranted(TPermGrant aPermGrant)
+	{
+	iPermGrant = aPermGrant;
+	}
+
+// ---------------------------------------------------------------------------
+// Sets permanently denied permissions of the script
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CScript::SetPermDenied(TPermGrant aPermDenied)
+	{
+	iPermDenied = aPermDenied;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "../rtsecuritymanager_common_api/group/bld.inf"
+#include "../rtsecuritymanager_utility_api/group/bld.inf"
+#include "../rtsecuritymanager_client_api/group/bld.inf"
+#include "../liw_provider_utility_api/group/bld.inf"
+#include "../liw_service_interface_base_api/group/bld.inf"
+#include "../liw_service_interface_menu_api/group/bld.inf"
+#include "../liw_criteria_api/group/bld.inf"
+#include "../liw_generic_parameter_api/group/bld.inf"
+#include "../liw_service_handler_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       File that exports the files belonging to 
+:                LIW Criteria API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/LiwCommon.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(LiwCommon.hrh)
+../inc/LiwCommon.rh     MW_LAYER_PLATFORM_EXPORT_PATH(LiwCommon.rh)
+../inc/LiwCommon.h     MW_LAYER_PLATFORM_EXPORT_PATH(LiwCommon.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/inc/liwcommon.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,368 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares common constants, types, classes etc. to be used both
+*                consumer and provider side.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_COMMON_H
+#define LIW_COMMON_H
+
+// INCLUDES
+#include <liwcommon.hrh>
+#include <barsread.h> 
+#include <liwgenericparam.h>
+
+// CONSTANTS
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEikMenuPane;
+class CLiwGenericParamList;
+
+// CLASS DECLARATION
+
+/**
+ * Criteria item data.
+ * This class encapsulates an LIW criteria item. Criteria items are building 
+ * blocks for LIW interests, i.e. an interest is a list of criteria items. 
+ * A criteria item can be defined dynamically (by using this class) or 
+ * in a resource file.
+ *
+ * @lib ServiceHandler.lib
+ * @since Series 60 2.6
+ */
+class CLiwCriteriaItem : public CBase
+    {
+    public:   // Constructors and destructor
+        /** 
+        * Constructs a criteria item instance with null items.
+        *
+        * @return A pointer to the new object.
+        */
+        IMPORT_C static CLiwCriteriaItem* NewL();
+
+        /** 
+        * Constructs a criteria item instance with null items. Leaves the 
+        * pointer to the cleanup stack.
+        *
+        * @return A pointer to the new object.
+        */
+        IMPORT_C static CLiwCriteriaItem* NewLC();
+
+        /** 
+        * Constructs a criteria item instance.
+        *
+        * @param aCriteriaId The criteria ID.
+        * @param aServiceCmd The service command.
+        * @param aContentType The content type.
+        * @return A pointer to the new object.
+        */
+        IMPORT_C static CLiwCriteriaItem* NewL(
+            TInt aCriteriaId,
+            TInt aServiceCmd,
+            const TDesC8& aContentType);
+
+        /** 
+        * Constructs a criteria item instance. Leaves the pointer to the 
+        * cleanup stack.
+        *
+        * @param aCriteriaId The criteria ID.
+        * @param aServiceCmd The service command.
+        * @param aContentType The content type.
+        * @return A pointer to the new object.
+        */
+        IMPORT_C static CLiwCriteriaItem* NewLC(
+            TInt aCriteriaId,
+            TInt aServiceCmd,
+            const TDesC8& aContentType);
+
+        /** 
+        * Constructs a criteria item instance.
+        *
+        * @param aCriteriaId The criteria ID.
+        * @param aServiceCmd The service command.
+        * @param aContentType Content type.
+        * @return A pointer to the new object.
+        */
+        IMPORT_C static CLiwCriteriaItem* NewL(
+            TInt aCriteriaId,
+            const TDesC8& aServiceCmd,
+            const TDesC8& aContentType);
+
+        /** 
+        * Constructs a criteria item instance.
+        *
+        * @param aCriteriaId The criteria ID.
+        * @param aServiceCmd The service command.
+        * @param aContentType Content type.
+        * @return A pointer to the new object.
+        */
+        IMPORT_C static CLiwCriteriaItem* NewLC(
+            TInt aCriteriaId,
+            const TDesC8& aServiceCmd,
+            const TDesC8& aContentType);
+
+        /** 
+        * Destructor.
+        */        
+        IMPORT_C virtual ~CLiwCriteriaItem();
+
+    public: // New functions
+        /** 
+        * Sets the criteria ID.
+        *
+        * @param aId The criteria ID.
+        */
+        IMPORT_C void SetId(TInt aId);
+
+        /** 
+        * Sets the service class.
+        *
+        * @param aServiceUid The service class, see TLiwServiceClass.
+        */
+        IMPORT_C void SetServiceClass(const TUid& aServiceUid);
+        
+        /** 
+        * Sets the service command UID.
+        *
+        * @param aServiceCmd The LIW service command, see TLiwServiceCommands.
+        */
+        IMPORT_C void SetServiceCmd(TInt aServiceCmd);
+
+        /** 
+        * Sets the service command name.
+        *
+        * @param aServiceCmd The LIW service command.
+        */
+        IMPORT_C void SetServiceCmdL(const TDesC8& aServiceCmd);
+
+        /** 
+        * Sets the content type. Makes a copy of the string data.
+        *
+        * @param aContentType Content MIME type, event type or any agreed one.
+        */
+        IMPORT_C void SetContentTypeL(const TDesC8& aContentType);
+
+        /** 
+        * Gets the criteria ID, 0 if not defined.
+        *
+        * @return The criteria ID.
+        */
+        IMPORT_C TInt Id() const;
+
+        /** 
+        * Gets the service class UID.
+        *
+        * @return The service class UID, see TLiwServiceClass.
+        */
+        IMPORT_C const TUid& ServiceClass() const;
+        
+        /** 
+        * Gets the service command UID. KNullUid, if not defined.
+        *
+        * @return The service command UID, see TLiwServiceCommands.
+        */
+        IMPORT_C TInt ServiceCmd() const;
+
+        /** 
+        * Gets the service command name.
+        *
+        * @return The service command name.  
+        */
+        IMPORT_C const TDesC8& ServiceCmdStr() const;
+
+        /** 
+        * Gets the content type.
+        *
+        * @return The content type.
+        */
+        IMPORT_C const TDesC8& ContentType() const;
+
+        /** 
+        * Sets the options.
+        *
+        * @param aOptions Options.
+        */
+        IMPORT_C void SetOptions(TUint aOptions);
+
+        /** 
+        * Gets the options.
+        * 
+        * @return Options.
+        */
+        IMPORT_C TUint Options() const;
+
+        /** 
+        * Maximum number of providers allowed for this criteria item. 
+        * 
+        * @return Maximum number of providers allowed for this criteria item.
+        */
+        IMPORT_C TInt MaxProviders() const;
+
+        /** 
+        * Reads a criteria item from a resource.  
+        *
+        * @param aReader A resource reader pointing to a criteria item.
+        */
+        IMPORT_C void ReadFromResoureL(TResourceReader& aReader);
+
+        /** 
+        * Returns the default provider.
+        * 
+        * @return The default provider UID.        
+        */
+        IMPORT_C TUid DefaultProvider() const;
+
+        /** 
+        * Sets the default provider.
+        *
+        * @param aDefault The UID of a default provider.
+        */
+        IMPORT_C void SetDefaultProvider(TInt aDefault);
+
+        /** 
+        * Equality operator. Two criteria items are considered equal only if all
+        * parameters match. The parameters are: criteria id, service command, 
+        * content type, service class, default provider, max providers and options). 
+        *
+        * @param aItem Criteria item to compare.
+        * @return ETrue if criteria items are equal, EFalse otherwise.
+        */
+        IMPORT_C TBool operator==(const CLiwCriteriaItem& aItem);
+
+        /** 
+        * Sets the maximum number of providers.
+        *
+        * @param aMaxProviders The maximum number of providers.
+        */
+        IMPORT_C void SetMaxProviders(TInt aMaxProviders);
+
+    public:
+        /** 
+        * If set, only ROM based providers can be attached to this criteria.
+        *
+        * @return ETrue if LIW_OPTIONS_ROM_ONLY bit is set, EFalse otherwise.
+        */    
+        inline TBool RomOnly() const;
+        
+        IMPORT_C void SetMetaDataOptions(const TLiwVariant& aMetaDataOptions);
+
+        IMPORT_C void GetMetaDataOptions(TLiwVariant& aMetaDataOptions) const;
+        
+	private:
+        /**
+        * C++ default constructor.
+        */
+        CLiwCriteriaItem();    
+    
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(
+            TInt aCriteriaId,
+            TInt aServiceCmd,
+            const TDesC8& aContentType);
+
+        void ConstructL( 
+            TInt aCriteriaId,
+            const TDesC8& aServiceCmd,
+            const TDesC8& aContentType);
+
+    private:
+        // Criteria ID.
+        TInt iCriteriaId;
+        // Service class UID
+        TUid iServiceClass;
+        // Service command UID
+        TInt iServiceCmd;
+        // Content type (MIME type). 
+        HBufC8* iContentType;
+        // Additional options for ROM
+        TLiwVariant iOptions;        
+        //Default provider implementation uid
+        TUid iDefaultProvider;
+        // Reserved member
+        TLiwVariant iReserved;
+        // Max providers
+        TInt iMaxProviders;        
+        // Metadata Options
+        TLiwVariant iMetadataOptions;
+    };
+
+
+inline TBool CLiwCriteriaItem::RomOnly() const
+    {
+    return (Options() & LIW_OPTIONS_ROM_ONLY) != 0;
+    }
+
+
+/**
+* Interest is an array of criteria items.
+*/
+typedef RPointerArray<CLiwCriteriaItem> RCriteriaArray;
+
+/**
+* Abstact callback interface to handle callbacks or events
+* from providers. This callback is needed when
+* - Consumer wants to pre-check output parameters before returning
+*   synchronous Handle*Cmd.
+* - Asynchronous Handle*Cmd is used.
+* - An asynchronous event occurs in the system.
+* 
+*  @lib ServiceHandler.lib
+*  @since Series 60 2.6
+*/ 
+class MLiwNotifyCallback                                  // needs to handle this as well?
+    {
+    public:
+        /**
+        * Handles notifications caused by an asynchronous Execute*CmdL call
+        * or an event.
+        *
+        * @param aCmdId The service command associated to the event.
+        * @param aEventId Occured event, see LiwCommon.hrh.
+        * @param aEventParamList Event parameters, if any, as defined per
+        *        each event.
+        * @param aInParamList Input parameters, if any, given in the
+        *        related HandleCommmandL.
+        * @return Error code for the callback.
+        */
+        virtual TInt HandleNotifyL(
+            TInt aCmdId,
+            TInt aEventId,
+            CLiwGenericParamList& aEventParamList,
+            const CLiwGenericParamList& aInParamList) = 0;
+    	IMPORT_C static TInt32 GetTransactionID();
+    };
+
+#endif // LIW_COMMON_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/inc/liwcommon.hrh	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,418 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares common constants to be used in both resources and
+*                C++ code of consumers and providers.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_COMMON_HRH
+#define LIW_COMMON_HRH
+
+// DATA TYPES
+
+// CONSTANTS
+
+/**
+* Predefined service commands (UIDs).
+*/
+enum TLiwServiceCommands
+    {
+    /** Null value. */
+    KLiwCmdNone = 0,
+
+    /** String Based command */
+    KLiwCmdAsStr = 1,
+
+    /** Create new content. */
+    KLiwCmdNew = 0x101F864C,
+        
+    /** Edit existing content. */
+    KLiwCmdEdit = 0x101F864D,
+        
+    /** Select content. */
+    KLiwCmdSelect = 0x101F864E,
+    
+    /** View content. */
+    KLiwCmdView = 0x101F864F,
+
+    /** Create call. */
+    KLiwCmdCall = 0x101F86B0,
+
+    /** Send content. */
+    KLiwCmdSend = 0x101F86B3,
+
+    /** Print content. */
+    KLiwCmdPrint = 0x101F8666,
+
+    /** Assign content. */
+    KLiwCmdAssign = 0x101F8716,
+
+    /** Share content. */
+    KLiwCmdShare = 0x101F871E,
+
+    /** Synchronize content. */
+    KLiwCmdSynchronize = 0x101F8724,
+
+    /** Synchronize selected. */
+    KLiwCmdSynchronizeSelected = 0x1020720C,
+
+    /** Search content. */
+    KLiwCmdSearch = 0x101F87DF,
+
+    /** Copy content. */
+    KLiwCmdCopy = 0x101F87DE,
+
+    /** Show print preview. */
+    KLiwCmdPrintPreview = 0x101FD656,
+    
+    /** Push to talk. */
+    KLiwCmdPoC = 0x101FD657,
+    
+    /** View content in online store. */
+    KLiwCmdViewOnline = 0x102072EA,
+    
+    /** Upload content. */
+    KLiwCmdUpload = 0x102072EB,
+    
+    /** Transfer a range of media files to a remote storage device. */
+    KLiwCmdXpressTransfer = 0x10207430,
+    
+    /** UPnP copy content. */
+    KLiwCmdUPnPCopy = 0x10207431,
+           
+    /** UPnP move content. */          
+    KLiwCmdUPnPMove = 0x10207432,
+
+    /** UPnP play content. */
+    KLiwCmdUPnPPlay = 0x10207433,
+
+    /** UPnP open content. */
+    KLiwCmdUPnPOpen = 0x10207434,
+    
+    /** UPnP enable external. */
+    KLiwCmdUPnPEnableExternal = 0x10207435,
+    
+    /** Show help content. */
+    KLiwCmdHelp = 0x10275075,
+    
+    /** Add or remove items from intent. (Should be used as a menu service command). */
+    KLiwCmdIntent = 0x10275114,
+    
+    /** Add items to intent. (Should be used as a base service command). */
+    KLiwCmdAddToIntent = 0x10275115,
+    
+    /** Remove items from intent. (Should be used as a base service command). */
+    KLiwCmdRemoveFromIntent = 0x10275116,
+    
+    /** Client can request that map should be displayed on screen. */ 
+    KLiwCmdMnShowMap = 0x10206904,
+    
+    /** Allows to start navigation to desired destination. */
+    KLiwCmdMnNavigateTo = 0x10206905,
+    
+    /** Starts reverse geocoding request: finding address for given coordinate. */
+    KLiwCmdMnAddrByCoord = 0x10206906,
+    
+    /** Starts geocoding request: finding coordinate by given address. */
+    KLiwCmdMnCoordByAddr = 0x10206907,    
+    
+    /** Allows client to request that user shall select a location from map. */
+    KLiwCmdMnSelectFromMap = 0x10206908,
+    
+    /** Send via Bluetooth. */
+    KLiwCmdSendViaBT = 0x10281894,   
+	
+    /** Send via Irda. */
+    KLiwCmdSendViaIR = 0x10281895,
+    
+    /** Enterprise telephony. */
+    KLiwCmdEnterpriseTel = 0x20001FC6,  
+
+    /** Rotate image etc. */
+    KLiwCmdRotate = 0x10281F96,
+    
+    /** Rotate device screen. */
+    KLiwCmdRotateScreen = 0x10281F97,
+    
+    /** Set call image. */
+    KLiwCmdCallImage = 0x1028245E,
+    
+    /** Give different objects to another device using Near Field Communications. */
+    KLiwCmdNFCGive = 0x1028245F,
+    
+    /** SettingWizard Email view activation. */
+    KLiwCmdSettingWizardEmailView = 0x10281C95,
+    
+    /** In-device search. */
+    KLiwCmdContentSearch = 0x10282844,
+    
+	/** A special service command enabling consumer to attach for all relevant 
+	LIW services for a certain object. */
+	KLiwCmdAnyCmdForObject = 0x102823F1,
+	
+	/** To support VoIP settings provisioning with plugins **/
+	KLiwCmdEasyVoIPProvisioning = 0x10283099,
+	
+	/** Assign Screensaver*/
+    KLiwCmdAssignScreenSaver = 0x1028309A,
+
+	/** Converged service plugin and UI extension plugin*/
+	KLiwCmdCSCServicePlugins = 0x1020E56F,
+	KLiwCmdCSCUiExtensionPlugins = 0x10282EF7 
+    };
+
+enum TLiwBufferType
+{
+	KLiwBufferNone = 0,
+	KLiwBufferBitmap = 1,
+	KLiwBufferFile = 2
+};
+
+
+// Service command strings. These strings are used in service provider's
+// opaque data field to specify what service command(s) the provider implements.
+
+#define KLiwCmdNoneStr                    "00000000"
+#define KLiwCmdAsStrStr               "00000001" 
+#define KLiwCmdNewStr                     "101F864C"
+#define KLiwCmdEditStr                    "101F864D"
+#define KLiwCmdSelectStr                  "101F864E"
+#define KLiwCmdViewStr                    "101F864F"
+#define KLiwCmdPrintStr                   "101F8666"
+#define KLiwCmdCallStr                    "101F86B0"
+#define KLiwCmdSendStr                    "101F86B3"
+#define KLiwCmdAssignStr                  "101F8716"
+#define KLiwCmdShareStr                   "101F871E"
+#define KLiwCmdSynchronizeStr             "101F8724"
+#define KLiwCmdSearchStr                  "101F87DF"
+#define KLiwCmdCopy                       "101F87DE"
+#define KLiwCmdPrintPreviewStr            "101FD656"
+#define KLiwCmdPoCStr                     "101FD657" 
+#define KLiwCmdSynchronizeSelectedStr     "1020720C"
+#define KLiwCmdViewOnlineStr              "102072EA" 
+#define KLiwCmdUploadStr                  "102072EB"
+#define KLiwCmdXpressTransferStr          "10207430"
+#define KLiwCmdUPnPCopyStr                "10207431"
+#define KLiwCmdUPnPMoveStr                "10207432"
+#define KLiwCmdUPnPPlayStr                "10207433"
+#define KLiwCmdUPnPOpenStr                "10207434"
+#define KLiwCmdUPnPEnableExternalStr      "10207435"
+#define KLiwCmdHelpStr                    "10275075"
+#define KLiwCmdIntentStr                  "10275114"
+#define KLiwCmdAddToIntentStr             "10275115"
+#define KLiwCmdRemoveFromIntentStr        "10275116"
+#define KLiwCmdMnShowMapStr               "10206904"
+#define KLiwCmdMnNavigateToStr            "10206905"
+#define KLiwCmdMnAddrByCoordStr           "10206906"
+#define KLiwCmdMnCoordByAddrStr           "10206907"
+#define KLiwCmdMnSelectFromMapStr         "10206908"
+#define KLiwCmdSendViaBTStr               "10281894"
+#define KLiwCmdSendViaIRStr               "10281895"
+#define KLiwCmdEnterpriseTelStr           "20001FC6"
+#define KLiwCmdRotateStr                  "10281F96"
+#define KLiwCmdRotateScreenStr            "10281F97"
+#define KLiwCmdCallImageStr               "1028245E"
+#define KLiwCmdNFCGiveStr                 "1028245F"
+#define KLiwCmdSettingWizardEmailViewStr  "10281C95"
+#define KLiwCmdContentSearchStr           "10282844"
+#define KLiwCmdAnyCmdForObjectStr         "102823F1"
+#define KLiwCmdEasyVoIPProvisioningStr    "10283099"
+#define KLiwCmdAssignScreenSaverStr       "1028309A"
+#define	KLiwCmdCSCServicePluginsStr  	  "1020E56F"
+#define	KLiwCmdCSCUiExtensionPluginsStr   "10282EF7" 
+
+/**
+* Service command options (bits) to alter command handling behaviour.
+*/
+enum TLiwServiceCmdOptions
+    {
+    /**
+    * Consumer wants asynchronous command handling.
+    * The default is synchronous command handling.
+    * In asynchronous case consumer needs to pass a callback to provider.
+    */
+    KLiwOptASyncronous = 0x0001,
+
+    /**
+    * Consumer wants provider to make a callback to check coming output
+    * parameters prior returning from service command handling.
+    * Consumer needs to pass a callback to provider.
+    */
+    KLiwOptOutParamCheck = 0x0002,
+
+    /**
+    * Consumer tells provider that it is prepared to handle
+    * callback events for possibly incomplete/wrong parameter list. 
+    */
+    KLiwOptInParamCheck = 0x0004,
+    
+    /**
+    * Consumer wants to cancel an asynchronous LIW service. 
+    * When a consumer wants to cancel the asynchronous service that a provider
+    * is executing, it should call ExecuteMenuCmdL() or ExecuteServiceCmdL() 
+    * with the same parameters as when requesting the service, but set this 
+    * cancel bit on. The cancel operation itself is synchronous, i.e. the 
+    * provider must call the consumer's callback with KLiwEventCanceled before 
+    * the Execute*CmdL() returns.
+    */
+    KLiwOptCancel = 0x0008
+    };
+
+
+/**
+* Service classes (UID). Technically these are same as service interface UIDs.
+*/
+enum TLiwServiceClass
+    {
+    /** 
+    * None. 
+    */
+    KLiwClassNone = 0x0,
+
+    /**
+    * Base service (no UI expected). 
+    * Every other class must implement this always!
+    */
+    KLiwClassBase = 0x200159f5,
+
+    /** 
+    * Filter service class. 
+    */
+    KLiwClassFilter = 0x101F8651,
+
+    /** 
+    * Menu service class (offers menu based services).
+    */
+    KLiwClassMenu = 0x101F8652,
+
+    /** 
+    * Stub service class.
+    */
+    KLiwClassStub = 0x101F8653,
+       
+    /** 
+    * View service class (offers view based services).
+    */
+    KLiwClassView = 0x101F8654,
+
+    /** 
+    * This class is for R&D purposes.  
+    */
+    KLiwClassDebug = 0x101F866B
+    };
+
+
+/**
+* Event codes. To be used with HandleNotifyL method.
+*/
+enum
+    {
+    /**
+    * Asynchronous service informs consumer to prepare itself for 
+    * action. 
+    */
+    KLiwEventStarted = 1,
+
+    /**
+    * Asynchronous service request completed.
+    */
+    KLiwEventCompleted = 2,
+
+    /**
+    * Asynchronous service request canceled.
+    */
+    KLiwEventCanceled = 3,
+    
+    /**
+    * Error during asynchronous service request.
+    */
+    KLiwEventError = 4,
+    
+    /**
+    * Relates to KLiwOptOutParamCheck.
+    */
+    KLiwEventOutParamCheck = 5,
+    
+    /**
+    * Relates to KLiwOptInParamCheck.
+    */
+    KLiwEventInParamCheck = 6,
+    
+    /**
+    * Provider informs consumer that service is no longer available or 
+    * has stopped.
+    */
+    KLiwEventStopped = 7,
+    
+    /**
+    * Provider asks consumer whether Exit can be done (needed at least in 
+    * embedded use cases where server application offers Exit possibility 
+    * to end user, but consumer can not allow Exit due to fact that for
+    * example network connections owned by consumer are open and they need 
+    * to be kept alive).    
+    */
+    KLiwEventQueryExit = 8,
+    
+    /**
+    * Provider informs consumer about the ongoing asynchronous
+    * service execution. 
+    */
+    KLiwEventInProgress = 9
+    };
+    
+// ============================================================================
+// Menu item flags for LIW consumers.   
+// ============================================================================ 
+/** 
+ * Always keep the provider menu items in a submenu. 
+ */
+#define LIW_CASCADE_ID               0x01010001
+
+/** 
+ * Menu item is placed intelligently either to the main level or a submenu. 
+ */
+#define LIW_INTELLIGENT_CASCADE_ID   0x01010010
+
+/** 
+ * Consumer defines the menu title. 
+ */
+#define LIW_LOCK_SUBMENU_TITLE       0x00000020
+
+// ============================================================================
+// Criteria item flags for LIW consumers.    
+// ============================================================================
+/** 
+ * Criteria item loadOptions bit, only providers in ROM are accepted. 
+ */
+#define LIW_OPTIONS_ROM_ONLY         0x01
+
+// ============================================================================
+// Menu item flags for LIW providers.
+// ============================================================================
+/** 
+ * For providers only: Provider suggests the submenu title. 
+ */
+#define LIW_SUBMENU_TITLE            0x0ff11012
+
+#endif // LIW_COMMON_HRH
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/inc/liwcommon.rh	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Contains common resource declarations for the LIWFW.
+*
+*/
+
+
+
+
+
+
+
+//  INCLUDES
+#include <liwcommon.hrh>
+
+//  MACROS  
+
+//  STRUCTURE DEFINITIONS
+
+// -----------------------------------------------------------------------------
+// Option item for a criteria.
+// -----------------------------------------------------------------------------
+STRUCT LIW_CRITERIA_OPTION
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Criteria item.
+// Resource structure to define criteria item consumer.
+// -----------------------------------------------------------------------------
+//
+// Criteria item
+//
+STRUCT LIW_CRITERIA_ITEM
+    {
+    // Criteria ID to be used in UI elements referring to this criteria
+    // By default the ID should be same as the serviceCmd, but it can be
+    // different as well e.g. for mapping old menu items to use LIW
+    // This can be consumer defined or predefined, if common interest
+    // is allocated.
+    LONG id;
+
+    // --------------------------------------------------------------
+    // Actual criteria data used when resolving providers from which
+    // a consumer is interested in.
+    // --------------------------------------------------------------
+
+    // Command ID for service command, mandatory.
+    LONG serviceCmd = KLiwCmdNone;
+
+    // Content MIME type, event type or any agreed one.
+    LTEXT8 contentType = "";
+
+    // Services class tells what kind of service is expected from
+    // provider. See TLiwServiceClass enum for allowed values.
+    // Optional, if not defined the default (KLiwClassMenu) is used.
+    LONG serviceClass = KLiwClassMenu;
+
+    // --------------------------------------------------------------
+    // Additional options, if any.
+    // --------------------------------------------------------------
+
+    // Defines UID for default provider. If provider for this
+    // UID exists, all the setup calls will be forwarded to it
+    // first (eg. if default provider implements 'menu' service class, it will
+    // be the first provider to insert its menu items to the consumer menu).
+    LONG defaultProvider = 0;
+
+    // The maximum number of providers allowed for the criteria item.
+    // There might be cases to limit the number of providers, e.g. for
+    // limiting the number of menu items. Maximum is 255 providers per interest.
+    BYTE maxProviders = 0xff;
+
+    // Other options bits (8 bits reserved).
+    BYTE loadOptions=0;
+
+    // Reserved for extensions.
+    LLINK reserved = 0; 
+    }
+
+//
+// Criteria item with command name as string
+//
+STRUCT LIW_CRITERIA_ITEM_2
+    {
+    LONG id;
+    LONG serviceCmd = KLiwCmdAsStr;
+    // Service name.
+    LTEXT8 serviceName = "";
+    LTEXT8 contentType = "";
+    LONG serviceClass = KLiwClassMenu;
+
+    LONG defaultProvider = 0;
+    BYTE maxProviders = 0xff;
+    BYTE loadOptions=0;
+    
+    LLINK reserved = 0;    
+    }
+
+//
+// Interest is an array of criteria items.
+//
+STRUCT LIW_INTEREST
+    {
+    STRUCT items[]; // LIW_CRITERIA_ITEM's
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/liw_criteria_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="632ce9a07247d9bc295ac3cbcf13fce5" dataversion="1.0">
+<name>liw_criteria_api</name>
+<description>Criteria API offers access to a criteria element, which contains command ID, MIME type etc. of data items.</description>
+<type>c++</type>
+<subsystem>languageinterworkingfw</subsystem>
+<libs><lib name="liwservicehandler.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/bmarm/liwtestcasesu.def	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/bwins/liwtestcasesu.def	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/conf/tliwtestcases.cfg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,379 @@
+[Test]
+title LIW_DATA_TYPES_001
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_001
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_002
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_002
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_003
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_003
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_004
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_004
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_005
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_005
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_006
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_006
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_007
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_007
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_008
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_008
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_009
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_009
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_Map_AtLNew
+create liwtestcases foobar
+foobar LIW_Map_AtL_New
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_DATA_TYPES_0010
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_010
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_011
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_011
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_012
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_012
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_013
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_013
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_014
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_014
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_016
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_016
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_017
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_017
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_018
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_018
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_020
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_020
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_DATA_TYPES_021
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_021
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_022
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_022
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_023
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_023
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_024
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_024
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_025
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_025
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_026
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_026
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_029
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_029
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_030
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_030
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_033
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_033
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_034
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_034
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_037
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_037
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_038
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_038
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_039
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_039
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_041
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_041
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_042
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_042
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_043
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_043
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_045
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_045
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_046
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_046
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_047
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_047
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_048
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_048
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_DATA_TYPES_049
+create liwtestcases foobar
+foobar LIW_DATA_TYPES_049
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_MDAT_VER1
+create liwtestcases foobar
+foobar LIW_MDAT_VER1
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_MDAT_VER2
+create liwtestcases foobar
+foobar LIW_MDAT_VER2
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_MDAT_VER3
+create liwtestcases foobar
+foobar LIW_MDAT_VER3
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_MDAT_VER4
+create liwtestcases foobar
+foobar LIW_MDAT_VER4
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_MDAT_VER5
+create liwtestcases foobar
+foobar LIW_MDAT_VER5
+delete foobar
+[Endtest] 
+
+[Test]
+title LIW_MDAT_CAP1
+create liwtestcases foobar
+foobar LIW_MDAT_CAP1
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_ContainerCleanup
+create liwtestcases foobar
+foobar LIW_ContainerCleanup
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_ParamCleanup
+create liwtestcases foobar
+foobar LIW_ParamCleanup
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_VariantCleanup
+create liwtestcases foobar
+foobar LIW_VariantCleanup
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_ASYNC_001
+create liwtestcases foobar
+foobar LIW_ASYNC_001
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_ASYNC_002
+create liwtestcases foobar
+foobar LIW_ASYNC_002
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_ASYNC_003
+create liwtestcases foobar
+foobar LIW_ASYNC_003
+delete foobar
+[Endtest] 
+
+
+[Test]
+title LIW_ASYNC_004
+create liwtestcases foobar
+foobar LIW_ASYNC_004
+delete foobar
+[Endtest] 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/data/liwaccesspolicy.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<policy>
+		<!-- specify a protection domain -->
+		<domain name="UnTrusted">				
+				<!-- always allowed capabilities for this domain -->
+				<!-- there can be only one "allow" node under "domain" node -->
+				<allow>
+						<capabilities>
+								<capability>ReadUserData</capability>
+								<capability>WriteUserData</capability>
+						</capabilities>
+				</allow>
+				
+				<!-- user-grantable capabilities for this domain -->
+				<user>
+						<condition>oneshot</condition>
+						<defaultCondition>oneshot</defaultCondition>
+						<capabilities>
+								<capability>DRM</capability>								
+						</capabilities>
+				</user>
+				
+				<user>
+						<condition>session</condition>
+						<defaultCondition>session</defaultCondition>
+						<capabilities>
+								<capability>ReadDeviceData</capability>
+								<capability>WriteDeviceData</capability>
+								<capability>Location</capability>
+						</capabilities>
+				</user>
+				
+				<!-- could extend this to other types of conditional capabilities -->
+		</domain>
+		
+		<domain name="Nokia">
+				<!-- always allowed capabilities for this domain -->
+				<allow>
+						<capabilities>
+								<capability>ReadUserData</capability>
+						</capabilities>
+				</allow>
+				
+				<!-- user-grantable capabilities for this domain -->
+				<user>
+						<condition>session</condition>
+						<defaultCondition>session</defaultCondition>
+						<capabilities>
+								<capability>WriteUserData</capability>
+						</capabilities>
+				</user>
+		</domain>
+		
+</policy>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/eabi/liwtestcasesu.def	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI12CLiw_AsyncTC @ 2 NONAME ; #<TI>#
+	_ZTV12CLiw_AsyncTC @ 3 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       ?Description
+*
+*/
+
+
+
+
+
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+PRJ_EXPORTS
+../data/liwaccesspolicy.xml      	/epoc32/winscw/c/data/others/liwaccesspolicy.xml
+//../init/testframework.ini      /epoc32/WINSCW/C/TestFramework/testframework.ini 
+../conf/tliwtestcases.cfg      /epoc32/WINSCW/C/TestFramework/tliwtestcases.cfg
+
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+liwtestcases.mmp
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/group/liwtestcases.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:     
+*
+*/
+
+
+
+
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:  ?Description
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          liwtestcases.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+VENDORID        VID_DEFAULT
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         liwtestcases.def
+
+USERINCLUDE     ../inc 
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+SOURCE          liwtestcases.cpp
+SOURCE          liwtestcasesBlocks.cpp 
+SOURCE 					liwtestcasesasync.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         liwServiceHandler.lib
+LIBRARY         RTSecMgrClient.lib 
+LIBRARY 				RTSecMgrUtil.lib
+LIBRARY         estor.lib  
+LIBRARY         efsrv.lib
+
+EPOCALLOWDLLDATA
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/inc/liw_async_testcase.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       
+*
+*/
+
+
+
+
+
+
+#ifndef LIWTC_ASYNC_H
+#define LIWTC_ASYNC_H
+
+// INCLUDES
+#include <liwcommon.h>
+#include <e32base.h>
+#include <LiwGenericParam.h>
+
+// FORWARD DECLARATIONS
+class CLiwServiceHandler;
+
+// CLASS DECLARATION
+
+/**
+*  CLiwTC2 class.
+* 
+*/
+class CLiw_AsyncTC : public CActive, public MLiwNotifyCallback/*, public MLiwTest*/
+    {
+    public:
+        enum TRequestType {ECount, EStop=1000} ;
+    
+    public: // Constructors and destructor
+        /**
+        * Symbian default constructor.
+        */
+       // void ConstructL(CLiwTestLogHandler& aLogger, CLiwTestAppContainer& aContainer);
+
+        /**
+        * Constructor.
+        */
+        CLiw_AsyncTC( CLiwServiceHandler *iServiceHandler, TRequestType aRequest = ECount, TInt aPriority = EPriorityStandard);
+                 
+        /**
+        * Destructor.
+        */
+        ~CLiw_AsyncTC();
+        
+        TUid Id() const;
+
+    public:
+         void DoCancel();
+         void RunL();
+         void RequestFunction( TRequestType aRequest );
+         void ReadyToGo();
+         void SetIncrementCounter( TInt aCount = 1 );
+         TUint CountValue () const;
+         TRequestType iRequest;
+         TInt iCmdID;
+         
+    	TInt HandleNotifyL(
+            TInt aCmdId,
+            TInt aEventId,
+            CLiwGenericParamList& aEventParamList,
+            const CLiwGenericParamList& aInParamList);
+
+    public: // MLiwTest
+        TInt AsyncCase(TInt aTcNo);
+        
+		/*Test Items*/ 
+        void LIW_ASYNC_001();
+        void LIW_ASYNC_002();
+        void LIW_ASYNC_003(TInt aEventState=0);
+        void LIW_ASYNC_004();
+       
+    private: // Data
+        CLiwServiceHandler* iServiceHandler;
+        TInt iTransID;
+        TInt iAsyncCount;
+        TInt tcNo;
+        TInt iResult;
+        TUint iCount;
+        TUint iIncrementCount;
+       
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/inc/liwtestapplit.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       This file contains literal macros of TestCases in LiwTestApp.
+*                The file can be included in C++ or resource file.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIWTESTAPPLIT_H
+#define LIWTESTAPPLIT_H
+
+_LIT8(KContentTypeTxt, "text/str");
+_LIT8(KWild, "*");
+
+_LIT8(KTestCommandTC1,"S60.Messaging");
+_LIT8(KContact,"Contact %d");
+_LIT8(KTestPARAMNanmeTC1,"TestResult");
+_LIT8(KTestCommandTC2,"S60.Messaging");
+_LIT8(KContentTypeTxt2, "text/str");
+
+_LIT8(KTestParamKey, "Testi");
+_LIT8(KTestParamName, "hello_name");
+_LIT8(KTestParamValue, "hello_val");
+
+_LIT8(KLIW_DATA_TYPES_001,"LIW_DATA_TYPES_001");
+_LIT8(KLIW_DATA_TYPES_002,"LIW_DATA_TYPES_002");
+_LIT8(KLIW_DATA_TYPES_003,"LIW_DATA_TYPES_003");
+_LIT8(KLIW_DATA_TYPES_004,"LIW_DATA_TYPES_004");
+_LIT8(KLIW_DATA_TYPES_005,"LIW_DATA_TYPES_005");
+_LIT8(KLIW_DATA_TYPES_006,"LIW_DATA_TYPES_006");
+_LIT8(KLIW_DATA_TYPES_007,"LIW_DATA_TYPES_007");
+_LIT8(KLIW_DATA_TYPES_008,"LIW_DATA_TYPES_008");
+_LIT8(KLIW_DATA_TYPES_009,"LIW_DATA_TYPES_009");
+_LIT8(KLIW_DATA_TYPES_010,"LIW_DATA_TYPES_010");
+_LIT8(KLIW_DATA_TYPES_011,"LIW_DATA_TYPES_011");
+_LIT8(KLIW_DATA_TYPES_012,"LIW_DATA_TYPES_012");
+_LIT8(KLIW_DATA_TYPES_013,"LIW_DATA_TYPES_013");
+_LIT8(KLIW_DATA_TYPES_014,"LIW_DATA_TYPES_014");
+
+_LIT8(KLIW_DATA_TYPES_019,"LIW_DATA_TYPES_019");
+_LIT8(KLIW_DATA_TYPES_023,"LIW_DATA_TYPES_023");
+
+_LIT8(KLIW_MDAT_VER1,"LIW_MDAT_VER1");
+_LIT8(KLIW_MDAT_VER2,"LIW_MDAT_VER2");
+_LIT8(KLIW_MDAT_VER3,"LIW_MDAT_VER3");
+_LIT8(KLIW_MDAT_VER4,"LIW_MDAT_VER4");
+_LIT8(KLIW_MDAT_VER5,"LIW_MDAT_VER5");
+
+#endif // LIWTESTAPPLIT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/inc/liwtestcases.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,358 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       ?Description
+*
+*/
+
+
+
+
+
+
+
+
+#ifndef LIWTESTCASES_H
+#define LIWTESTCASES_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+#include <liwservicehandler.h>
+#include <RTSecMgrScriptSession.h>
+
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <e32std.h>
+#include <coeccntx.h>
+#include <aknviewappui.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include <akntabobserver.h>
+
+#include  "liw_async_testcase.h"
+
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( KliwtestcasesLogPath, "\\logs\\testframework\\liwtestcases\\" ); 
+// Log file
+_LIT( KliwtestcasesLogFile, "liwtestcases.txt" ); 
+_LIT( KliwtestcasesLogFileWithTitle, "liwtestcases_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class Cliwtestcases;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  Cliwtestcases test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cliwtestcases) : public CScriptBase, public MLiwNotifyCallback, public MSecMgrPromptHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cliwtestcases* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cliwtestcases();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+        
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+        
+    public: // Functions from base classes
+
+        TInt Prompt(const RCapabilityArray& /*aCapsToCheck*/,CScript& /*aScript*/)
+        {
+            return EAccessNok;
+        }
+    
+        TInt Prompt(const RCapabilityArray& /*aCapsToCheck*/,RCapabilityArray& /*aCapsNotMatching*/, CScript& /*aScript*/)
+        {
+            return EAccessNok;
+        }
+        
+        TInt Prompt(RPromptDataList& aPromptDataList , TExecutableID /*aExecID = KAnonymousScript*/)
+        {
+           // CEikonEnv::Static()->InfoMsg(_L("Custom Prompt"));
+            
+            for(TInt i(0);i!=aPromptDataList.Count();++i)
+            {
+                aPromptDataList[i]->SetUserSelection(RTUserPrompt_OneShot);
+                //aPromptDataList[i]->iUserSelection = RTUserPrompt_OneShot;
+            }
+            
+            return EAccessOk;
+        }
+       
+       void SetPromptOption(TSecMgrPromptUIOption)
+        {
+            
+        }
+       
+       TSecMgrPromptUIOption PromptOption() const
+        {
+            return RTPROMPTUI_DEFAULT;
+        }
+        
+       TInt HandleNotifyL(
+           TInt aCmdId,
+           TInt aEventId,
+           CLiwGenericParamList& aEventParamList,
+           const CLiwGenericParamList& aInParamList);
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cliwtestcases( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );
+		virtual TBool LIW_DATA_TYPES_001();
+		virtual TBool LIW_DATA_TYPES_002();
+		virtual TBool LIW_DATA_TYPES_003();
+		virtual TBool LIW_DATA_TYPES_004();
+		virtual TBool LIW_DATA_TYPES_005();
+		virtual TBool LIW_DATA_TYPES_006();
+        virtual TBool LIW_DATA_TYPES_007();
+        virtual TBool LIW_DATA_TYPES_008();
+        virtual TBool LIW_DATA_TYPES_009();
+        virtual TBool LIW_DATA_TYPES_010();
+		
+        virtual TBool LIW_DATA_TYPES_011();
+       virtual TBool LIW_DATA_TYPES_012();
+       
+       //List comparision
+       virtual TBool LIW_DATA_TYPES_013();
+       
+       //Map comparison
+       virtual TBool LIW_DATA_TYPES_014();
+       
+       //Negative case for TLiwVariant::Get
+       virtual TBool LIW_DATA_TYPES_015();
+       
+       //Negative case for TLiwVariant::AsXYZ interfaces
+       virtual TBool LIW_DATA_TYPES_016();
+       
+       //ServiceCmdStr on integeral service commmand ID
+       virtual TBool LIW_DATA_TYPES_017();
+       virtual TBool LIW_DATA_TYPES_018();
+       
+       //HasCriteria check
+       virtual TBool LIW_DATA_TYPES_019();
+       
+       //TLiwVariant::operator == check
+       virtual TBool LIW_DATA_TYPES_020();
+       
+       //CLiwGenericParamList::FindFirst and FindNext
+       virtual TBool LIW_DATA_TYPES_021();
+       
+       //CLiwGenericParamList::FindFirst and FindNext and AppendL(CLiwGenericParamList&)
+       virtual TBool LIW_DATA_TYPES_022();
+       
+       //CLiwContainer::ExternalizeL
+       virtual TBool LIW_DATA_TYPES_023();
+       
+       //TLiwVariant::Dump // only for debug version
+       virtual TBool LIW_DATA_TYPES_024();
+       
+       //Should be called as the last case
+       virtual TBool LIW_CLEANUP_LIW_001();
+       
+       //for conversion utilities
+       virtual TBool LIW_DATA_TYPES_025();
+       virtual TBool LIW_DATA_TYPES_026();
+       //virtual TBool LIW_DATA_TYPES_027();
+       //virtual TBool LIW_DATA_TYPES_028();
+       virtual TBool LIW_DATA_TYPES_029();
+       virtual TBool LIW_DATA_TYPES_030();
+       //virtual TBool LIW_DATA_TYPES_031();
+       //virtual TBool LIW_DATA_TYPES_032();
+       virtual TBool LIW_DATA_TYPES_033();
+       virtual TBool LIW_DATA_TYPES_034();
+       //virtual TBool LIW_DATA_TYPES_035();
+       //virtual TBool LIW_DATA_TYPES_036();
+       virtual TBool LIW_DATA_TYPES_037();
+       virtual TBool LIW_DATA_TYPES_038();
+       virtual TBool LIW_DATA_TYPES_039();
+       //virtual TBool LIW_DATA_TYPES_040();
+       virtual TBool LIW_DATA_TYPES_041();
+       virtual TBool LIW_DATA_TYPES_042();
+       virtual TBool LIW_DATA_TYPES_043();
+       //virtual TBool LIW_DATA_TYPES_044();
+       
+       //QueryImplementation TestCases
+       virtual TBool LIW_DATA_TYPES_045();
+       virtual TBool LIW_DATA_TYPES_046();
+       virtual TBool LIW_DATA_TYPES_047();
+       virtual TBool LIW_DATA_TYPES_048();
+       virtual TBool LIW_DATA_TYPES_049();
+       
+       //Versioning TestCases
+       virtual TBool LIW_MDAT_VER1();
+       virtual TBool LIW_MDAT_VER2();
+       virtual TBool LIW_MDAT_VER3();
+       virtual TBool LIW_MDAT_VER4();
+       virtual TBool LIW_MDAT_VER5();
+       
+       //Generic Metadata TestCases
+       virtual TBool LIW_MDAT_CAP1();
+       virtual TBool LIW_MDAT_CAP2();
+       
+       //Test case for Data Type - Map AtL returning const TDesC8&
+       virtual TBool LIW_Map_AtL_New();
+       
+       //Test case for Data Type - Cleanup check
+       virtual TBool LIW_ContainerCleanup();
+       virtual TBool LIW_ParamCleanup();
+       virtual TBool LIW_VariantCleanup();
+       
+        //Checking TInt64 datatype & conversion utilities
+        virtual TBool LIW_DATA_TYPES_050();
+       
+        virtual void TestL(CLiwMap *map);
+        virtual void TestParamL(CLiwGenericParamList *param);
+        virtual void TestVariantL(CLiwMap* map);
+	        
+        virtual TInt LIW_ASYNC_001();
+        virtual TInt LIW_ASYNC_002();
+        virtual TInt LIW_ASYNC_003();
+        virtual TInt LIW_ASYNC_004();
+                
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+        TInt LoadL();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+        
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        CLiwServiceHandler *iServiceHandler;
+        CLiw_AsyncTC *asyObj;
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+        
+    };
+
+#endif      // LIWTESTCASES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/init/testframework.ini	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,181 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#                             
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if 
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module. 
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+#[New_Module]
+#ModuleName= demomodule
+#[End_Module]
+
+
+UITestingSupport= YES
+SeparateProcesses= YES
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+[New_Module]
+ModuleName= testscripter
+
+#TestModuleXXX used initialization file
+IniFile= c:\testframework\Testframework.ini
+
+ 
+ 
+TestCaseFile= c:\testframework\tliwtestcases.cfg 
+
+
+[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIFTestFramework logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number 
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' 
+
+#CreateLogDirectories= YES		# Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML			# Possible values: TXT or HTML
+#EmulatorOutput= FILE			# Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML			# Possible values: TXT or HTML
+#HardwareOutput= FILE			# Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE		# Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES			# Possible values: YES or NO
+#WithTimeStamp= YES			# Possible values: YES or NO
+#WithLineBreak= YES			# Possible values: YES or NO
+#WithEventRanking= YES			# Possible values: YES or NO
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/liwtestcases.pkg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,40 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "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:      
+;
+&EN
+;
+; UID is the app's UID
+;
+#{"Liwtestcases"},(0x2000B5D4),1,0,0
+
+;
+; List of localised vendor names
+%{"Vendor-EN"}
+
+; The non-localised, globally unique vendor name (mandatory)
+:"Nokia OY"
+;Supports Series 60 v 3.x
+;This line indicates that this installation is for the Series 60 platform v3.x
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v3.x platforms
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+;
+; Two files to install
+;
+"\epoc32\release\armv5\urel\liwtestcases.dll"     	-"!:\sys\bin\liwtestcases.dll"
+"\epoc32\winscw\c\data\others\liwaccesspolicy.xml"	-"!:\data\others\liwaccesspolicy.xml"
+"\epoc32\WINSCW\C\TestFramework\testframework.ini"	-"!:\TestFramework\testframework.ini"
+"\epoc32\WINSCW\C\TestFramework\tliwtestcases.cfg"	-"!:\TestFramework\tliwtestcases.cfg"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcases.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       ?Description
+*
+*/
+
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "liwtestcases.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cliwtestcases::Cliwtestcases
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cliwtestcases::Cliwtestcases( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cliwtestcases::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void Cliwtestcases::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KliwtestcasesLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KliwtestcasesLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KliwtestcasesLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    iServiceHandler = CLiwServiceHandler::NewL();
+
+    asyObj = new (ELeave) CLiw_AsyncTC(iServiceHandler);
+    
+    LoadL();
+        
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// Cliwtestcases::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cliwtestcases* Cliwtestcases::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cliwtestcases* self = new (ELeave) Cliwtestcases( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cliwtestcases::~Cliwtestcases()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// Cliwtestcases::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void Cliwtestcases::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("liwtestcases.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+    
+    return ( CScriptBase* ) Cliwtestcases::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcasesasync.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,649 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 FILES
+#include  <aknviewappui.h>
+#include  <liwservicehandler.h>
+#include  "liw_async_testcase.h"
+//#include  "liwtestapp.hrh"
+//#include  <liwtestapp.rsg>
+
+TInt success;
+
+using namespace LIW;
+
+//_LIT8(KAsyncService,"S60.MultiMetaData");
+//_LIT8(KSyncService,"S60.SyncServices");
+//_LIT8(KInvalidService,"S60.InvalidService");
+//_LIT8(KSecurityService,"S60.SecurityServices");
+//_LIT8(KInvalidSecurityService,"S60.InvalidSecurityServices");
+
+_LIT8(KAsyncSrv,"Test.AsyncServices");
+_LIT8(KAsyncContent,"Test/Data");
+
+//_LIT8(KTestPARAMNanmeTC2,"TestResult");
+//_LIT8(KSecurityParameter,"SecurityParam");
+
+//_LIT8(KResult_Pass, "Test Provider replied with <tt>EGenericParamError = KErrorNone</tt>");
+//_LIT8(KResult_Fail,"Test Provider replied with Error : <tt>KErrNotFound</tt>");
+
+//_LIT8(KAsyn_TestCmt, "These Test cases are designed to test LIW support for Asynchronous Invocation.\
+                          <br><br><b>Test:-<b></br>\
+                          <li>Attaching and Detaching service providers through string based service command</li>\
+                          <li>Execute the service with callback</li>\
+                          <li>After checking the event state, next Test Case is invoked</li>\
+                          <br><b>Check - </b></br> \
+                          Appropriate State of the event in the HandleNotify Method");
+       
+TInt IncomingEventCmdID=1000;
+TInt XmlDataReaderCmdID=2000;
+
+const TInt32 LIWASYNC001=100;
+//const TInt32 LIWASYNC002=200;
+const TInt32 LIWASYNC003=300;
+const TInt32 LIWASYNC004=400;
+//const TInt32 LIWASYNC005=500;
+//const TInt32 LIWASYNC006=600;
+
+const TInt32 KAsyncMaxCount=10;
+
+const TUid KViewId4 = {4};
+
+// ---------------------------------------------------------
+// TUid CLiwtcbase::Id()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+TUid CLiw_AsyncTC::Id() const
+    {
+    return KViewId4;
+    }
+
+//Async event states. New state could be added
+enum TAsyncState
+{
+	eAsyncStarted=0,
+	eAsyncStopped
+};
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CLiw_AsyncTC::CLiw_AsyncTC
+// Description: CLiw_AsyncTC constructer
+// -----------------------------------------------------------------------------
+//
+CLiw_AsyncTC::CLiw_AsyncTC( CLiwServiceHandler *aServiceHandler, TRequestType aRequest, TInt aPriority): CActive(aPriority)
+    {
+    iCount = 0;
+    iResult = 1;
+    iIncrementCount = 1; 
+    iRequest = aRequest;
+    iServiceHandler = aServiceHandler;
+    iAsyncCount = 0;
+    tcNo = -1;
+    CActiveScheduler::Add( this );
+    }
+
+TInt CLiw_AsyncTC::AsyncCase(TInt aTcNo)
+{
+    tcNo = aTcNo;
+    //setactive, user::requestcomplete
+        
+     SetActive();
+    
+     iStatus=KRequestPending;
+     TRequestStatus* temp=&iStatus;
+     User::RequestComplete(temp,KErrNone);
+     
+     //wait
+     CActiveScheduler::Start();
+     
+     return iResult;
+}
+
+//
+//-----------------------------------------------------------------------------
+// CLiw_AsyncTC::RequestFunction
+// Description: Request Function for CLiw_AsyncTC
+// ----------------------------------------------------------------------------
+//
+void CLiw_AsyncTC::RequestFunction( TRequestType aRequest )
+{
+ iRequest = aRequest;
+ iStatus = KRequestPending;
+ if( !IsActive() )
+    SetActive();
+}
+
+//
+//-----------------------------------------------------------------------------
+// CLiw_AsyncTC::ReadyToGo
+// Description: This calls CLiw_AsyncTC's RunL
+//-----------------------------------------------------------------------------
+//
+void CLiw_AsyncTC::ReadyToGo()
+{
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+}
+
+
+//
+//-----------------------------------------------------------------------------
+// CLiw_AsyncTC::DoCancel
+// Description: This calls CActive's Cancel
+//-----------------------------------------------------------------------------
+//
+void CLiw_AsyncTC::DoCancel()
+{
+}
+
+//
+//-----------------------------------------------------------------------------
+// CLiw_AsyncTC::SetIncrementCounter
+// Description: Sets Increment Counter of CLiw_AsyncTC
+//-----------------------------------------------------------------------------
+//
+void CLiw_AsyncTC::SetIncrementCounter( TInt aCount)
+{
+iIncrementCount = aCount;
+}
+
+//
+//-----------------------------------------------------------------------------
+// CLiw_AsyncTC::CountValue
+// Description: Returns Count Value of CLiw_AsyncTC
+//-----------------------------------------------------------------------------
+//
+TUint CLiw_AsyncTC::CountValue () const
+{
+return iCount;
+}
+
+// ---------------------------------------------------------
+// CLiw_AsyncTC::ConstructL(const TRect& aRect)
+// EPOC two-phased constructor
+// ---------------------------------------------------------
+//
+/*void CLiw_AsyncTC::ConstructL(CLiwTestLogHandler& aLogger, CLiwTestAppContainer& aContainer)
+    {
+     iLogger = &aLogger;
+    iContainer = &aContainer;
+    
+    // Create service handler instance.   
+    CLiwServiceHandler* serviceHandler = CLiwServiceHandler::NewLC(); 
+    iServiceHandler = serviceHandler;    
+    CleanupStack::Pop(serviceHandler);
+    }
+*/
+
+// ---------------------------------------------------------
+// CLiw_AsyncTC::~CLiw_AsyncTC()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+CLiw_AsyncTC::~CLiw_AsyncTC()
+    {
+    delete iServiceHandler;
+    iServiceHandler = NULL;
+    
+    Cancel();
+    }
+
+void CLiw_AsyncTC::RunL()
+    {
+        switch(tcNo)
+        {
+        case 1:
+            LIW_ASYNC_001();
+            break;
+        case 2:
+            LIW_ASYNC_002();
+            break;
+        case 3:
+            LIW_ASYNC_003();
+            break;
+        case 4:
+            LIW_ASYNC_004();
+            break;
+        default:
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CLiw_AsyncTC::HandleCommandL
+// From MLiwNotifyCallback
+// ---------------------------------------------------------
+//   
+TInt CLiw_AsyncTC::HandleNotifyL(
+    TInt aCmdId,
+    TInt aEventId,
+    CLiwGenericParamList& /*aEventParamList*/,
+    const CLiwGenericParamList& /*aInParamList*/)
+    {
+    
+    if(LIWASYNC001==aCmdId)
+    {
+    	if( (KLiwEventCompleted==aEventId) || 
+    		(KLiwEventCanceled==aEventId) || 
+    		(KLiwEventStopped==aEventId) ||
+    		(KLiwEventError==aEventId) )
+    	{
+	    	//_LIT8(testCmt,"<b>LIW_ASYNC_001:</b> <br> Create a CLiwCriteriaItem with string command \
+	    	    The provider with the same command must be attached with LIW FW.\
+	            and call <tt>ExecuteServiceCmdL</tt>.</br>\
+	            <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
+	            <br><b>Check - </b></br> Provider returns asynchronously : <tt>LiwEventCompleted</tt>");
+	
+			if(KLiwEventCompleted==aEventId)
+			{
+			    iResult = 0;
+	            //iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);
+			    //Venkat : return true as testcase passed
+	        }
+			else
+            {
+                iResult = 1;
+                //iLogger->AddTestItem(testCmt,KResult_Fail,ETrue, EFalse);
+                //Venkat : Test fails
+    		}
+
+            CActiveScheduler::Stop();
+			//LIW_ASYNC_002();
+    	}
+    }
+    else if(LIWASYNC003==aCmdId)
+    {
+    	//if the counter reaches 
+    	//event notification should be cancelled
+    	++iAsyncCount;
+    	
+    	if( (KLiwEventCompleted==aEventId) || 
+    		(KLiwEventCanceled==aEventId) || 
+    		(KLiwEventStopped==aEventId) ||
+    		(KLiwEventError==aEventId) )
+    	{
+    		//_LIT8(testCmt,"<b>LIW_ASYNC_003:</b> <br> Create a CLiwCriteriaItem with string command \
+                The provider with the same command must be attached with LIW FW.\
+                and call <tt>ExecuteServiceCmdL</tt>.</br>\
+                <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
+                <br><b>Check - </b></br> Provider returns asynchronously : <tt>LiwEventStopped</tt>");
+  
+    		if(KLiwEventStopped==aEventId)
+    		{
+    		    iResult = 0;
+                //iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);
+            }
+            else
+            {
+                iResult = 1;
+                //iLogger->AddTestItem(testCmt,KResult_Fail,EFalse, EFalse);
+    		}
+    			
+    		//LIW_ASYNC_003((TInt32)eAsyncStopped);
+    		iAsyncCount=0;    		
+    		iTransID=0;
+    		
+    		return KErrNone;
+    	}
+    	    	
+    	if(iAsyncCount >= KAsyncMaxCount)
+    	{
+    		LIW_ASYNC_003((TInt32)eAsyncStopped);
+    		iAsyncCount=0;
+    		iTransID=0;
+    		//LIW_ASYNC_004();
+
+            CActiveScheduler::Stop();
+    	}
+    }
+    else if(LIWASYNC004==aCmdId)
+    {
+    	if( (KLiwEventCanceled==aEventId) || 
+    		(KLiwEventStopped==aEventId) ||
+    		(KLiwEventError==aEventId) )
+    	{
+	    	//_LIT8(testCmt,"<b>LIW_ASYNC_004:</b> <br> Create a CLiwCriteriaItem with string command \
+	            The provider with the same command must be attached with LIW FW.\
+	            and call <tt>ExecuteServiceCmdL</tt>.</br>\
+	            <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
+	            <br><b>Check - </b></br> Provider returns asynchronously : <tt>LiwEventError</tt>");
+	    	
+	    	if(KLiwEventError==aEventId)
+			{
+			    iResult = 0;
+				//iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);
+			}
+	    	else
+	    	{
+	    	    iResult = 1;
+		        //iLogger->AddTestItem(testCmt,KResult_Fail,EFalse, EFalse);
+	    	}
+
+            CActiveScheduler::Stop();
+    	}
+    }
+    return KErrNone;    
+    }
+
+// ---------------------------------------------------------
+/*LIW Asynchronous service Test Cases are Defined here*/
+// ---------------------------------------------------------
+
+void CLiw_AsyncTC::LIW_ASYNC_004()
+{
+
+	/*Detached all the service provider and reset all the Entries of previous test case*/
+    iServiceHandler->Reset();
+    
+    RCriteriaArray interest;
+    CleanupClosePushL(interest);
+    
+    const TDesC8* cmd = &KAsyncSrv;
+    
+    //Define Criteria Item Dynamically with string based command 
+    CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
+    criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
+    interest.AppendL(criteria1);
+   
+    /*Attach the base provider*/
+	iServiceHandler->AttachL(interest);
+	CleanupStack::PopAndDestroy(criteria1);
+    CleanupStack::PopAndDestroy(&interest);
+
+	TLiwGenericParam asyncSrvCmdIDParam;
+	TLiwGenericParam asyncStateParam;
+	TLiwGenericParam asyncTransIDParam;
+	TLiwGenericParam testCaseIDParam;
+
+	_LIT8(KAsyncCmdID, "AsyncCmdID");
+//	_LIT8(KAsyncCmdName, "IncomingEvents");
+	_LIT8(KAsyncEventState, "AsyncEventState");
+	//_LIT8(KAsyncTransID, "TransactionID");
+	_LIT8(KTestCaseID, "TestCaseID");
+	
+	//_LIT8(KLIW_ASYNC_001, "LIW_ASYNC_001");
+	TInt32 testCaseID=LIWASYNC004;
+
+	CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+	inps->Reset();
+
+	asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)XmlDataReaderCmdID));
+	asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)eAsyncStarted));
+	testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
+		
+	inps->AppendL(asyncSrvCmdIDParam);
+	inps->AppendL(asyncStateParam);	            		  		
+	inps->AppendL(testCaseIDParam);
+	      		
+	CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
+	crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+	CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+
+	iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous,this); 
+	
+	asyncSrvCmdIDParam.Reset();
+	asyncStateParam.Reset();
+	asyncTransIDParam.Reset();
+	testCaseIDParam.Reset();
+	CleanupStack::PopAndDestroy(crit); // crit
+}
+
+void CLiw_AsyncTC::LIW_ASYNC_003(TInt aEventState)
+{
+
+	const TDesC8* cmd = &KAsyncSrv;
+
+	if(eAsyncStarted==aEventState)
+	{
+		/*Detached all the service provider and reset all the Entries of previous test case*/
+	    iServiceHandler->Reset();
+	    
+	    RCriteriaArray interest;
+	    CleanupClosePushL(interest);
+	    
+	    
+	    
+	    //Define Criteria Item Dynamically with string based command 
+	    CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
+	    criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
+	    interest.AppendL(criteria1);
+	   
+	    /*Attach the base provider*/
+		iServiceHandler->AttachL(interest);
+		CleanupStack::PopAndDestroy(criteria1);
+	    CleanupStack::PopAndDestroy(&interest);
+	}
+	
+
+	TLiwGenericParam asyncSrvCmdIDParam;
+	TLiwGenericParam asyncStateParam;
+	TLiwGenericParam asyncTransIDParam;
+	TLiwGenericParam testCaseIDParam;
+
+	_LIT8(KAsyncCmdID, "AsyncCmdID");
+//	_LIT8(KAsyncCmdName, "IncomingEvents");
+	_LIT8(KAsyncEventState, "AsyncEventState");
+	//_LIT8(KAsyncTransID, "TransactionID");
+	_LIT8(KTestCaseID, "TestCaseID");
+	
+	TInt32 testCaseID=LIWASYNC003;
+
+	CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+	inps->Reset();
+
+	asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)IncomingEventCmdID));
+	asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)aEventState));
+	testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
+		
+	inps->AppendL(asyncSrvCmdIDParam);
+	inps->AppendL(asyncStateParam);	            		  		
+	inps->AppendL(testCaseIDParam);
+
+	if(eAsyncStopped==aEventState)
+	{
+		TLiwGenericParam asyncTransIDParam;					
+		_LIT8(KAsyncTransID, "TransactionID");
+		asyncTransIDParam.SetNameAndValueL(KAsyncTransID, TLiwVariant((TInt32)iTransID));					
+		inps->AppendL(asyncTransIDParam);
+		asyncTransIDParam.Reset();
+	}
+	      		
+	CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
+	crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+	CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+
+	iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous,this); 
+	
+	asyncSrvCmdIDParam.Reset();
+	asyncStateParam.Reset();
+	asyncTransIDParam.Reset();
+	testCaseIDParam.Reset();
+	CleanupStack::PopAndDestroy(crit); // crit
+	
+	if(eAsyncStarted==aEventState)
+	{
+		TInt pos = 0;
+		_LIT8(KAsyncTransID, "TransactionID");
+		outps->FindFirst(pos, KAsyncTransID);
+
+		TLiwGenericParam transIDParam = outps->operator[](pos);
+		iTransID = transIDParam.Value().AsTInt32();
+	}
+
+	//LIW_ASYNC_004();
+}
+
+void CLiw_AsyncTC::LIW_ASYNC_002()
+{
+
+	/*Detached all the service provider and reset all the Entries of previous test case*/
+    iServiceHandler->Reset();
+    
+    RCriteriaArray interest;
+    CleanupClosePushL(interest);
+    
+    const TDesC8* cmd = &KAsyncSrv;
+    
+    //Define Criteria Item Dynamically with string based command 
+    CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
+    criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
+    interest.AppendL(criteria1);
+   
+    /*Attach the base provider*/
+	iServiceHandler->AttachL(interest);
+	CleanupStack::PopAndDestroy(criteria1);
+    CleanupStack::PopAndDestroy(&interest);
+
+	TLiwGenericParam asyncSrvCmdIDParam;
+	TLiwGenericParam asyncStateParam;
+	TLiwGenericParam asyncTransIDParam;
+	TLiwGenericParam testCaseIDParam;
+
+	_LIT8(KAsyncCmdID, "AsyncCmdID");
+//	_LIT8(KAsyncCmdName, "IncomingEvents");
+	_LIT8(KAsyncEventState, "AsyncEventState");
+	//_LIT8(KAsyncTransID, "TransactionID");
+	_LIT8(KTestCaseID, "TestCaseID");
+	
+	//_LIT8(KLIW_ASYNC_001, "LIW_ASYNC_001");
+	TInt32 testCaseID=LIWASYNC001;
+
+	CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+	inps->Reset();
+
+	asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)XmlDataReaderCmdID));
+	asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)eAsyncStarted));
+	testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
+		
+	inps->AppendL(asyncSrvCmdIDParam);
+	inps->AppendL(asyncStateParam);	            		  		
+	inps->AppendL(testCaseIDParam);
+	      		
+	CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
+	crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+	CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+
+	iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous); 
+	
+	//Since there is no callback, the control returns here
+	//Checking for the success of this testcase
+	
+	TInt pos=0;
+	
+	outps->FindFirst(pos, EGenericParamError);
+	    
+    if(pos != KErrNotFound)
+    {
+		//_LIT8(testCmt,"<b>LIW_ASYNC_001:</b> <br> Create a CLiwCriteriaItem with string command \
+	    The provider with the same command must be attached with LIW FW.\
+        and call <tt>ExecuteServiceCmdL</tt>.</br>\
+        <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
+        <li>No CallBack is mentioned</li><br><b>Check - </b></br>\
+        Provider returns control immediately (Synchronous) <tt>EGenericParamError = KErrCancel</tt>");
+
+		if ((*outps)[pos].Value().AsTInt32() == KErrCancel)
+		{
+		    iResult = 0;
+		    //iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);	            
+        }
+		else
+        {
+            iResult = 1;
+            //iLogger->AddTestItem(testCmt,KResult_Fail,ETrue, EFalse);
+		}	
+	}	
+	asyncSrvCmdIDParam.Reset();
+	asyncStateParam.Reset();
+	asyncTransIDParam.Reset();
+	testCaseIDParam.Reset();
+	CleanupStack::PopAndDestroy(crit); // crit
+	
+	CActiveScheduler::Stop();
+	//LIW_ASYNC_003();
+}
+
+
+void CLiw_AsyncTC::LIW_ASYNC_001()
+{
+    /*Detached all the service provider and reset all the Entries of previous test case*/
+    iServiceHandler->Reset();
+    
+    RCriteriaArray interest;
+    CleanupClosePushL(interest);
+    
+    //Define Criteria Item Dynamically with string based command 
+    CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, KAsyncSrv, KAsyncContent);
+    criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
+    interest.AppendL(criteria1);
+    
+    /*Attach the base provider*/
+    TInt status = iServiceHandler->AttachL(interest);
+    CleanupStack::PopAndDestroy(criteria1);
+    CleanupStack::PopAndDestroy(&interest);
+    
+    TLiwGenericParam asyncSrvCmdIDParam;
+    TLiwGenericParam asyncStateParam;
+    TLiwGenericParam asyncTransIDParam;
+    TLiwGenericParam testCaseIDParam;
+    
+    _LIT8(KAsyncCmdID, "AsyncCmdID");
+    //_LIT8(KAsyncCmdName, "IncomingEvents");
+    _LIT8(KAsyncEventState, "AsyncEventState");
+    //_LIT8(KAsyncTransID, "TransactionID");
+    _LIT8(KTestCaseID, "TestCaseID");
+    
+    //_LIT8(KLIW_ASYNC_001, "LIW_ASYNC_001");
+    TInt32 testCaseID=LIWASYNC001;
+    
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    inps->Reset();
+    
+    asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)XmlDataReaderCmdID));
+    asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)eAsyncStarted));
+    testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
+        
+    inps->AppendL(asyncSrvCmdIDParam);
+    inps->AppendL(asyncStateParam);                             
+    inps->AppendL(testCaseIDParam);
+                
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KAsyncSrv, KAsyncContent);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous,this); 
+    
+    asyncSrvCmdIDParam.Reset();
+    asyncStateParam.Reset();
+    asyncTransIDParam.Reset();
+    testCaseIDParam.Reset();
+    
+    CleanupStack::PopAndDestroy(crit); // crit
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcasesblocks.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,2992 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       ?Description
+*
+*/
+
+
+
+
+
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "liwtestcases.h"
+
+#include  <aknviewappui.h>
+#include  <liwservicehandler.h>
+//#include  "liwTC1.h"
+//#include  "liwtestapp.hrh"
+//#include  <liwtestapp.rsg>
+#include  <s32mem.h> // for read write stream
+
+#include <RTSecManager.h>
+#include <RTSecMgrUtility.h>
+#include <RTSecMgrScriptSession.h>
+#include <RTSecMgrCommonDef.h>
+#include "liwtestapplit.h"
+
+#include  "liw_async_testcase.h"
+
+using namespace LIW;
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cliwtestcases::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void Cliwtestcases::Delete() 
+    {
+		if(iServiceHandler)
+		{
+    	iServiceHandler->Reset();
+    	delete iServiceHandler;	
+    	iServiceHandler = NULL;
+		}
+    
+    }
+
+// ---------------------------------------------------------
+// CLiwtcbase::HandleNotifyL
+// From - MLiwNotifyCallback
+// ---------------------------------------------------------
+TInt Cliwtestcases::HandleNotifyL
+    (
+    TInt /*aCmdId*/,
+    TInt /*aEventId*/,
+    CLiwGenericParamList& /*aEventParamList*/,
+    const CLiwGenericParamList& /*aInParamList*/)
+    {
+    return KErrNone;    
+    }
+    
+
+TInt Cliwtestcases::LoadL( )
+    {
+    RCriteriaArray interest;
+    CleanupClosePushL(interest);
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    interest.AppendL(criteria);
+    
+    // Attach the MyServiceName provider to the LIW framework.
+    TInt status = iServiceHandler->AttachL(interest);
+
+    // Detach The MyServiceName Provider
+    //iServiceHandler->DetachL(interest);    
+    CleanupStack::PopAndDestroy(criteria);
+    CleanupStack::PopAndDestroy(&interest);   
+    return status;
+    }   
+        
+// -----------------------------------------------------------------------------
+// Cliwtestcases::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt Cliwtestcases::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+        TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );
+        
+        static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "LIW_DATA_TYPES_001", Cliwtestcases::LIW_DATA_TYPES_001 ),
+        ENTRY( "LIW_DATA_TYPES_002", Cliwtestcases::LIW_DATA_TYPES_002 ),
+        ENTRY( "LIW_DATA_TYPES_003", Cliwtestcases::LIW_DATA_TYPES_003 ),
+        ENTRY( "LIW_DATA_TYPES_004", Cliwtestcases::LIW_DATA_TYPES_004 ),
+        ENTRY( "LIW_DATA_TYPES_005", Cliwtestcases::LIW_DATA_TYPES_005 ),
+        ENTRY( "LIW_DATA_TYPES_006", Cliwtestcases::LIW_DATA_TYPES_006 ),
+        ENTRY( "LIW_DATA_TYPES_007", Cliwtestcases::LIW_DATA_TYPES_007 ),
+        ENTRY( "LIW_DATA_TYPES_008", Cliwtestcases::LIW_DATA_TYPES_008 ),
+        ENTRY( "LIW_DATA_TYPES_009", Cliwtestcases::LIW_DATA_TYPES_009 ),
+        ENTRY( "LIW_Map_AtL_New", Cliwtestcases::LIW_Map_AtL_New ),
+        ENTRY( "LIW_DATA_TYPES_010", Cliwtestcases::LIW_DATA_TYPES_010 ),
+        ENTRY( "LIW_DATA_TYPES_011", Cliwtestcases::LIW_DATA_TYPES_011 ),
+        ENTRY( "LIW_DATA_TYPES_012", Cliwtestcases::LIW_DATA_TYPES_012 ),
+        ENTRY( "LIW_DATA_TYPES_013", Cliwtestcases::LIW_DATA_TYPES_013 ),
+        ENTRY( "LIW_DATA_TYPES_014", Cliwtestcases::LIW_DATA_TYPES_014 ),
+        ENTRY( "LIW_DATA_TYPES_016", Cliwtestcases::LIW_DATA_TYPES_016 ),
+        ENTRY( "LIW_DATA_TYPES_017", Cliwtestcases::LIW_DATA_TYPES_017 ),
+        ENTRY( "LIW_DATA_TYPES_018", Cliwtestcases::LIW_DATA_TYPES_018 ),
+        ENTRY( "LIW_DATA_TYPES_020", Cliwtestcases::LIW_DATA_TYPES_020 ),
+        ENTRY( "LIW_DATA_TYPES_021", Cliwtestcases::LIW_DATA_TYPES_021 ),
+        ENTRY( "LIW_DATA_TYPES_022", Cliwtestcases::LIW_DATA_TYPES_022 ),
+        ENTRY( "LIW_DATA_TYPES_023", Cliwtestcases::LIW_DATA_TYPES_023 ),
+        ENTRY( "LIW_DATA_TYPES_024", Cliwtestcases::LIW_DATA_TYPES_024 ),
+        ENTRY( "LIW_DATA_TYPES_025", Cliwtestcases::LIW_DATA_TYPES_025 ),
+        ENTRY( "LIW_DATA_TYPES_026", Cliwtestcases::LIW_DATA_TYPES_026 ),
+        ENTRY( "LIW_DATA_TYPES_029", Cliwtestcases::LIW_DATA_TYPES_029 ),
+        ENTRY( "LIW_DATA_TYPES_030", Cliwtestcases::LIW_DATA_TYPES_030 ),
+        ENTRY( "LIW_DATA_TYPES_033", Cliwtestcases::LIW_DATA_TYPES_033 ),
+        ENTRY( "LIW_DATA_TYPES_034", Cliwtestcases::LIW_DATA_TYPES_034 ),
+        ENTRY( "LIW_DATA_TYPES_037", Cliwtestcases::LIW_DATA_TYPES_037 ),
+        ENTRY( "LIW_DATA_TYPES_038", Cliwtestcases::LIW_DATA_TYPES_038 ),
+        ENTRY( "LIW_DATA_TYPES_039", Cliwtestcases::LIW_DATA_TYPES_039 ),
+        ENTRY( "LIW_DATA_TYPES_041", Cliwtestcases::LIW_DATA_TYPES_041 ),
+        ENTRY( "LIW_DATA_TYPES_042", Cliwtestcases::LIW_DATA_TYPES_042 ),
+        ENTRY( "LIW_DATA_TYPES_043", Cliwtestcases::LIW_DATA_TYPES_043 ),
+        ENTRY( "LIW_DATA_TYPES_045", Cliwtestcases::LIW_DATA_TYPES_045 ),
+        ENTRY( "LIW_DATA_TYPES_046", Cliwtestcases::LIW_DATA_TYPES_046 ),
+        ENTRY( "LIW_DATA_TYPES_047", Cliwtestcases::LIW_DATA_TYPES_047 ),
+        ENTRY( "LIW_DATA_TYPES_048", Cliwtestcases::LIW_DATA_TYPES_048 ),
+        ENTRY( "LIW_DATA_TYPES_049", Cliwtestcases::LIW_DATA_TYPES_049 ),
+        ENTRY( "LIW_MDAT_VER1", Cliwtestcases::LIW_MDAT_VER1 ),
+        ENTRY( "LIW_MDAT_VER2", Cliwtestcases::LIW_MDAT_VER2 ),
+        ENTRY( "LIW_MDAT_VER3", Cliwtestcases::LIW_MDAT_VER3 ),
+        ENTRY( "LIW_MDAT_VER4", Cliwtestcases::LIW_MDAT_VER4 ),
+        ENTRY( "LIW_MDAT_VER5", Cliwtestcases::LIW_MDAT_VER5 ),
+        ENTRY( "LIW_MDAT_CAP1", Cliwtestcases::LIW_MDAT_CAP1 ),
+        ENTRY( "LIW_ContainerCleanup", Cliwtestcases::LIW_ContainerCleanup ),
+        ENTRY( "LIW_ParamCleanup", Cliwtestcases::LIW_ParamCleanup ),
+        ENTRY( "LIW_VariantCleanup", Cliwtestcases::LIW_VariantCleanup ),
+        ENTRY( "LIW_ASYNC_001", Cliwtestcases::LIW_ASYNC_001 ),
+        ENTRY( "LIW_ASYNC_002", Cliwtestcases::LIW_ASYNC_002 ),
+        ENTRY( "LIW_ASYNC_003", Cliwtestcases::LIW_ASYNC_003 ),
+        ENTRY( "LIW_ASYNC_004", Cliwtestcases::LIW_ASYNC_004 ),
+                        
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cliwtestcases::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cliwtestcases::ExampleL( CStifItemParser& aItem )
+    {
+
+    // Print to UI
+    _LIT( Kliwtestcases, "liwtestcases" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, Kliwtestcases, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, Kliwtestcases, 
+                                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+// ---------------------------------------------------------
+// Test Case Deffinition for LIW Data Types
+// 
+// ---------------------------------------------------------
+TBool Cliwtestcases::LIW_DATA_TYPES_001()
+    {
+	    TBool flag = 0;
+	    /*Testing String Based Command*/
+	    //LoadL();
+	    TLiwGenericParam param;
+	    param.Value().Set(KLIW_DATA_TYPES_001);
+	    param.SetNameL(KTestPARAMNanmeTC1);
+	    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+	    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+	    inps->AppendL(param);
+	    param.Reset();
+	    
+	    // Get the Test result from MyServiceName provider "ExecuteServiceCmdL"
+	    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+	    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+	    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
+	    CleanupStack::PopAndDestroy(crit); // crit
+	    
+	    TInt pos = 0;
+	    outps->FindFirst(pos, EGenericParamError);
+	    if(pos != KErrNotFound)
+	        if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+	        {
+	            flag = 1;
+	        }
+	        else
+	        {
+	            flag = 0;
+	        }
+		else
+		{
+	        flag = 0;
+		}
+		
+        // Detach The MyServiceName Provider
+	    //iServiceHandler->DetachL(interest);    
+    	//CleanupStack::PopAndDestroy(criteria);
+    	//CleanupStack::PopAndDestroy(&interest);   
+		return !flag;
+    }
+   
+TBool Cliwtestcases::LIW_DATA_TYPES_002()
+    {
+        TBool flag = 0;
+        /*Testing Boolean data Type*/
+        
+        //LoadL();
+        
+        TLiwGenericParam param;
+        param.Value().Set(KLIW_DATA_TYPES_002);
+        param.SetNameL(KTestPARAMNanmeTC1);
+        CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+        CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+        inps->AppendL(param);
+        param.Reset();
+        
+        // Set up Tbool varient and append TBool parameter (EGenericParamError).
+        // One Argument constructer 
+        TLiwVariant boolVarient(ETrue);
+        // Test TLiwVariant::SetL(TLiwVariant&)
+        TLiwGenericParam boolParam(EGenericParamError);
+        boolParam.Value().SetL(boolVarient);
+        
+        inps->AppendL(boolParam);
+        
+        boolVarient.Reset();
+        boolParam.Reset();
+        
+        // Call ExecuteServiceCmdL TO GET THE RESULT
+        CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+        crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+        iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
+        CleanupStack::PopAndDestroy(crit); // crit
+        
+        // CHECK RESULT 
+        TInt pos = 0;
+        outps->FindFirst(pos, EGenericParamError);
+        
+        if(pos != KErrNotFound)
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+                flag = 1;
+            else
+                flag = 0;
+         else
+            flag = 0;
+         
+        return !flag;
+    }
+
+TBool Cliwtestcases::LIW_DATA_TYPES_003( )
+    {
+        TBool flag = 0;
+        CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+        CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+        
+        //LoadL();
+        
+        /*Testing List Data Type for TLiwVariant interface and container interface*/
+        TLiwGenericParam param;
+        param.Value().Set(KLIW_DATA_TYPES_003);
+        param.SetNameL(KTestPARAMNanmeTC1);
+        inps->AppendL(param);
+        param.Reset();
+        /*Checks Default constructer "CLiwDefaultList" Creation*/
+        CLiwList* listType = CLiwDefaultList::NewL();
+        
+        /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
+        TLiwVariant intVairent;
+        for (TInt32 index = 100; index < 110; index++)
+            {
+            intVairent.Set(index);
+            listType->AppendL(intVairent);    
+            }
+            
+        /*Checks CLiwList::TLiwVariant.Set(CLiwList*)*/  
+        param.Value().Set(listType);
+        param.SetNameL(_L8("IntegerList"));
+        inps->AppendL(param);
+        
+        intVairent.Reset();
+        param.Reset();
+        
+        CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+        crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+        iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
+        CleanupStack::PopAndDestroy(crit); // crit
+
+        TInt pos = 0;
+        TBool result = FALSE;
+        listType->Remove(listType->Count() - 1);
+        outps->FindFirst(pos, _L8("IntegerList"));
+        if(pos != KErrNotFound)
+            {
+               const CLiwList* resultList = (*outps)[pos].Value().AsList();
+               if(resultList != NULL )
+               {
+               if(resultList->Count() == listType->Count() && listType->Size() == resultList->Size())
+                   {
+                   result = TRUE;
+                   } 
+               }
+            }
+        /*Decrement count to delete the instance of list its self managed memory allocation*/      
+        if (listType) listType->DecRef();
+        pos = 0;
+        outps->FindFirst(pos, EGenericParamError);
+        
+        if(pos != KErrNotFound)
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone && result)
+                flag = 1;
+            else
+                flag = 0;
+        else
+            flag = 0;
+        
+        // Detach The MyServiceName Provider
+        //iServiceHandler->DetachL(interest);    
+        //CleanupStack::PopAndDestroy(criteria);
+        //CleanupStack::PopAndDestroy(&interest);   
+        
+        return !flag;
+    }
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_004( )
+    {
+        TBool flag = 0;
+        CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+        CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+        
+        /*Testing List Data Type for TLiwVariant interface and container interface*/
+        TLiwGenericParam param;
+        param.Value().Set(KLIW_DATA_TYPES_004);
+        param.SetNameL(KTestPARAMNanmeTC1);
+        inps->AppendL(param);
+        param.Reset();
+        /*Checks Default constructer "CLiwDefaultMap" Creation*/
+        CLiwMap* mapType = CLiwDefaultMap::NewL();
+        
+        /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
+        TLiwVariant contactNbr;
+        TBuf8<32> contactName;
+        for (TInt32 index = 100; index < 110; index++)
+            {
+            contactName.Format(KContact, index - 99);
+            contactNbr.Set(index);
+            mapType->InsertL(contactName, contactNbr);    
+            }
+            
+        /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
+        param.Value().Set(mapType);
+        param.SetNameL(_L8("ContactNumbers"));
+        inps->AppendL(param);
+        
+        contactNbr.Reset();
+        param.Reset();
+        
+        CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+        crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+        iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
+        CleanupStack::PopAndDestroy(crit); // crit
+
+        TInt pos = 0;
+        TBool result = FALSE;
+        mapType->Remove(_L8("Contact 10"));
+        outps->FindFirst(pos, _L8("ContactNumbers"));
+        if(pos != KErrNotFound)
+            {
+               const CLiwMap* resultMap = (*outps)[pos].Value().AsMap();
+               if(resultMap != NULL )
+                   {
+                   if( resultMap->Count() == mapType->Count() && mapType->Size() == resultMap->Size())
+                       {
+                       result = TRUE;
+                       } 
+                   }
+            }
+        /*Decrement count to delete the instance of Map its self managed memory allocation*/      
+        if (mapType) mapType->DecRef();
+        
+        pos = 0;
+        outps->FindFirst(pos, EGenericParamError);
+        
+        if(pos != KErrNotFound)
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone && result)
+                flag = 1;
+            else
+                flag = 0;
+        else
+            flag = 0;
+        
+        return !flag;
+    }
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_005( )
+    {
+    TBool flag = 0;
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    
+    /*Testing List Data Type for TLiwVariant interface and container interface*/
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_005);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    inps->AppendL(param);
+    param.Reset();
+    
+    /*Checks Default constructer "CLiwDefaultMap" and "CLiwDefaultMap" Creation*/
+    CLiwMap* mapType = CLiwDefaultMap::NewL();
+    CLiwList* listType = CLiwDefaultList::NewL();
+    
+    /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
+    TLiwVariant intVairent;
+    for (TInt32 index2 = 100; index2 < 110; index2++)
+        {
+        intVairent.Set(index2);
+        listType->AppendL(intVairent);    
+        }
+        
+    TBuf8<32> listName;
+    TLiwVariant listVarient;
+    listVarient.Set(listType);
+    
+    for (TInt32 index = 1; index < 11; index++)
+        {
+        listName.Format(KContact, index);
+        mapType->InsertL(listName, listVarient);
+        }
+        
+    listVarient.Reset();    
+    /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
+    param.Value().Set(mapType);
+    param.SetNameL(_L8("MapOfLists"));
+    
+    inps->AppendL(param);
+    
+    param.Reset();
+        
+    
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
+    CleanupStack::PopAndDestroy(crit); // crit
+
+    //remove the last list (10) and remove the last entry (9)in first List (0)
+    mapType->Remove(_L8("Contact 10"));
+    mapType->FindL(_L8("Contact 1"), listVarient);
+    listVarient.Get(*listType);
+    listType->Remove(9);
+    
+    listVarient.Reset();
+    
+    TInt pos = 0;
+    TBool result = FALSE;
+    outps->FindFirst(pos, _L8("MapOfLists"));
+    if(pos != KErrNotFound)
+        {
+           const CLiwMap* resultMap = (*outps)[pos].Value().AsMap();
+           if(resultMap != NULL && resultMap->Count() == mapType->Count() && mapType->Size() == resultMap->Size())
+           {
+           TBuf8<32> mapKey;
+           resultMap->AtL(0, mapKey);
+           resultMap->FindL(mapKey, listVarient);
+           if(listVarient.AsList() != NULL )
+               {
+               if (listVarient.AsList()->Count() == listType->Count() && listType->Size() == listVarient.AsList()->Size())
+                   {
+                   result = TRUE; 
+                   }
+               }
+           }
+           listVarient.Reset();
+        }
+    
+    
+    pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        if ((*outps)[pos].Value().AsTInt32() == KErrNone && result)
+            flag = 1;
+        else
+            flag = 0;
+    else
+        flag = 0;
+    
+    //Decrement count to delete the instance of Map its self managed memory allocation
+    inps->Reset();
+    outps->Reset();
+    if (mapType) mapType->DecRef();
+    if (listType) listType->DecRef();
+    
+    return !flag;
+    }
+
+TBool Cliwtestcases::LIW_DATA_TYPES_006( )
+    {
+    TBool flag = 0;    
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_006);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    inps->AppendL(param);
+    param.Reset();
+      
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
+    CleanupStack::PopAndDestroy(crit); // crit
+    
+    TInt pos = 0;
+    MLiwInterface* ifp = NULL;
+    outps->FindFirst(pos, KLIW_DATA_TYPES_006);
+    if(pos != KErrNotFound)
+        {
+        ifp = (*outps)[pos].Value().AsInterface();
+        outps->Reset();
+        ifp->ExecuteCmdL(KLIW_DATA_TYPES_006, *inps, *outps);      
+        }
+    else
+        {
+        flag = 0;
+        }
+    pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    if(pos != KErrNotFound)
+        if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+            flag = 1;
+        else
+            flag = 0;
+    else
+        flag = 0;
+    
+    if(ifp) ifp->Close();
+    inps->Reset();
+    outps->Reset();
+    return !flag;
+    }
+
+TBool Cliwtestcases::LIW_DATA_TYPES_007( )
+    {
+    TBool flag = 0;
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    TLiwGenericParam param;
+    CLiwList* listType = CLiwDefaultList::NewL();
+    CLiwMap* mapType = CLiwDefaultMap::NewL();
+    listType->AppendL(TLiwVariant(_L8("Testing Stream Operations")));  
+    mapType->InsertL(KLIW_DATA_TYPES_007, TLiwVariant(listType));
+    param.Value().Set(mapType);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    inps->AppendL(param);
+    
+    param.Reset();
+    if (listType) listType->DecRef();
+    if (mapType) mapType->DecRef();
+    
+    TInt sz = inps->Size();
+    TAny* buf = User::AllocL(sz);
+    RMemWriteStream ws(buf, sz);
+    inps->ExternalizeL(ws);
+    RMemReadStream rs(buf, sz);
+    CLiwGenericParamList* ltmp = &(iServiceHandler->OutParamListL());
+    ltmp->InternalizeL(rs);
+    if ((ltmp->Count() == inps->Count()) && ((*inps)[0] == (*ltmp)[0]))
+        flag = 1;
+    else
+        flag = 0;
+    User::Free(buf);
+    return !flag;
+    }
+
+TBool Cliwtestcases::LIW_DATA_TYPES_008( )
+    {
+    TBool flag = 0;
+    /*Checks Default constructer "CLiwDefaultList" Creation*/
+    CLiwList* listType = CLiwDefaultList::NewL();
+    CLiwList* resultList;
+    
+    /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
+    TLiwVariant intVairent;
+    for (TInt32 index = 100; index < 110; index++)
+        {
+        intVairent.Set(index);
+        listType->AppendL(intVairent);    
+        }
+    
+    intVairent.Reset();    
+    TBool result = TRUE;
+    
+    // Checking Bound conditions
+    resultList = listType;
+    resultList->Remove(listType->Count() + 1);
+    resultList->Remove(-1);
+    if (resultList != listType)
+        result = FALSE;
+    result ? result = !(listType->AtL(listType->Count() + 1, intVairent)): result = FALSE;
+    result ? result = !(listType->AtL(-1, intVairent)) : result = FALSE;      
+    
+    if(result == TRUE)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    /*Decrement count to delete the instance of list its self managed memory allocation*/      
+    if (listType) listType->DecRef(); 
+    return !flag;
+    }
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_009( )
+    {
+    TBool flag = 0;
+    /*Checks Default constructer "CLiwDefaultMap" Creation*/
+    CLiwMap* mapType = CLiwDefaultMap::NewL();
+    CLiwMap* resultMap;
+    
+    /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
+    TLiwVariant contactNbr;
+    TBuf8<32> contactName;
+    for (TInt32 index = 100; index < 110; index++)
+        {
+        contactName.Format(KContact, index - 99);
+        contactNbr.Set(index);
+        mapType->InsertL(contactName, contactNbr);    
+        }
+        
+    /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
+       
+    contactNbr.Reset();
+    contactName.FillZ();
+    contactName.Zero();
+    TBool result = TRUE;
+        
+    // Checking Bound conditions
+    resultMap = mapType;
+    resultMap->Remove(_L8("Contact 11"));
+    if (resultMap != mapType)
+        result = FALSE;
+    result ? result = !(mapType->AtL(mapType->Count() + 1, contactName)) : result = FALSE;
+    result ? result = !(mapType->AtL(-1, contactName) ): result = FALSE;
+    
+    
+    if(result == TRUE)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    /*Decrement count to delete the instance of list its self managed memory allocation*/      
+    if (mapType) mapType->DecRef();
+    return !flag;
+    }
+    
+TBool Cliwtestcases::LIW_Map_AtL_New( )
+    {
+    TBool flag = 0;
+    /*Checks Default constructer "CLiwDefaultMap" Creation*/
+    CLiwDefaultMap* mapType = CLiwDefaultMap::NewL();
+    CLiwDefaultMap* resultMap;
+    
+    /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
+    TLiwVariant contactNbr;
+    TBuf8<32> contactName;
+    for (TInt32 index = 100; index < 110; index++)
+        {
+        contactName.Format(KContact, index - 99);
+        contactNbr.Set(index);
+        mapType->InsertL(contactName, contactNbr);    
+        }
+        
+    /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
+       
+    contactNbr.Reset();
+    contactName.FillZ();
+    contactName.Zero();
+    TBool result = TRUE;
+        
+    // Checking Bound conditions
+    resultMap = mapType;
+    resultMap->Remove(_L8("Contact 11"));
+    if (resultMap != mapType)
+        result = FALSE;
+    
+    TRAPD(err1, contactName = mapType->AtL(mapType->Count() + 1));
+    
+    //result ? result = !(contactName.operator==(KNullDesC8)) : result = FALSE;
+    
+    TRAPD(err2, contactName = mapType->AtL(-1));
+    
+    //result ? result = !(contactName.operator==(KNullDesC8)): result = FALSE;
+    
+    if(err1 && err2)
+        flag = 1;
+    else
+        flag = 0;
+    
+    
+    /*
+    if(err)
+        flag = 0;
+    
+    if(result == TRUE)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    */
+    
+    //Decrement count to delete the instance of list its self managed memory allocation
+    if (mapType) mapType->DecRef();
+    return !flag;
+    }
+
+TBool Cliwtestcases::LIW_DATA_TYPES_010()
+    {
+    TBool flag = 0;
+    /*Testing Unsigned Integer data Type*/
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_010);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    inps->AppendL(param);
+    param.Reset();
+    
+    // Set up Tbool varient and append Unsigned Integer parameter (EGenericParamError).
+    // One Argument constructer
+    TUint arg = 10; 
+    TLiwVariant uIntVarient(arg);
+    // Test TLiwVariant::SetL(TLiwVariant&)
+    TLiwGenericParam uIntParam(EGenericParamError);
+    uIntParam.Value().SetL(uIntVarient);
+    
+    inps->AppendL(uIntParam);
+    
+    uIntVarient.Reset();
+    uIntParam.Reset();
+    
+    // Call ExecuteServiceCmdL TO GET THE RESULT
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
+    CleanupStack::PopAndDestroy(crit); // crit
+    
+    // CHECK RESULT 
+    TInt pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        {
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+                {
+                flag = 1;
+                }
+            else
+                {
+                
+                flag = 0;
+                }
+        }
+     else
+        {
+        
+        flag = 0;
+        }
+    return !flag;
+    }   
+ 
+//CHECK FROM HERE
+
+TBool Cliwtestcases::LIW_DATA_TYPES_011()
+    {
+    TBool flag = 0;
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_011);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    inps->AppendL(param);
+    param.Reset();
+    
+    // Call ExecuteServiceCmdL TO GET THE RESULT
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
+    CleanupStack::PopAndDestroy(crit); // crit
+    
+    // CHECK RESULT 
+    TInt pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        {
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+                {
+                
+                _LIT8(KIter,"Iterator");
+                TInt iterPos=0;
+                outps->FindFirst(iterPos, KIter);
+                if(pos != KErrNotFound)
+                {
+                    CLiwIterable* pIter=(*outps)[iterPos].Value().AsIterable();
+                    
+                    //Iterate over the list
+                    TLiwVariant var;
+                    
+                    while(EFalse != pIter->NextL(var))
+                    {       
+                        TPtrC8 entry;
+                        var.Get(entry);
+                        
+                        if(0==entry.Length())
+                        {
+                            flag = 0;                               
+                        }                       
+                    }
+                    
+                    var.Reset();
+                    
+                }
+                else
+                {
+                    flag = 0;
+                }
+                
+                flag = 1;
+                }
+            else
+                {
+                flag = 0;
+                }
+        }
+     else
+        {
+        
+        flag = 0;
+        }
+    return !flag;
+    }   
+    
+ TBool Cliwtestcases::LIW_DATA_TYPES_012()
+    {
+    TBool flag = 0;
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_012);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    inps->AppendL(param);
+    param.Reset();
+    
+    // Call ExecuteServiceCmdL TO GET THE RESULT
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
+    CleanupStack::PopAndDestroy(crit); // crit
+    
+    // CHECK RESULT 
+    TInt pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        {
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+                {                
+                flag = 1;
+                }
+            else
+                {
+                flag = 0;
+                }
+        }
+     else
+        {
+        
+        flag = 0;
+        }
+    return !flag;
+    }   
+    
+    
+ TBool Cliwtestcases::LIW_DATA_TYPES_013()
+    {
+        TBool flag = 0;    
+        CLiwList* pList = CLiwDefaultList::NewL();
+        
+        {
+            TLiwVariant intVairent;
+            for (TInt32 index = 100; index < 110; index++)
+                {
+                intVairent.Set(index);
+                pList->AppendL(intVairent);    
+                }   
+        }
+        
+        if(EFalse == (pList->operator==(*pList)))
+        {   
+            flag = 0;
+        }
+        
+        CLiwList* pAnotherList = CLiwDefaultList::NewL();
+        
+        {
+            TLiwVariant intVairent;
+            for (TInt32 index = 100; index < 110; index++)
+                {
+                intVairent.Set(index);
+                pAnotherList->AppendL(intVairent);    
+                }
+        }
+        
+        
+        if(EFalse == (pList->operator==(*pAnotherList)))
+        {
+             flag = 0;
+        }
+                
+        pAnotherList->Remove(0);
+        
+        if(EFalse == (pList->operator==(*pAnotherList)))
+        {
+            flag = 1;
+        }
+        else
+        {
+            flag = 0;
+        }   
+    if(pList) pList->DecRef();
+    if(pAnotherList) pAnotherList->DecRef();
+    return !flag;
+   }
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_014()
+    {
+        TBool flag = 0; 
+        CLiwMap* pMap = CLiwDefaultMap::NewL();
+        
+        {
+            /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
+            TLiwVariant contactNbr;
+            TBuf8<32> contactName;
+            for (TInt32 index = 100; index < 110; index++)
+                {
+                contactName.Format(KContact, index - 99);
+                contactNbr.Set(index);
+                pMap->InsertL(contactName, contactNbr);    
+                }
+        }
+        
+        if(EFalse == (pMap->operator==(*pMap)))
+        {   
+            flag = 0;
+        }
+        
+        CLiwMap* pAnotherMap = CLiwDefaultMap::NewL();
+        TBuf8<32> keyToRem;
+        
+        {
+            /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
+            TLiwVariant contactNbr;
+            TBuf8<32> contactName;
+            for (TInt32 index = 100; index < 110; index++)
+                {
+                contactName.Format(KContact, index - 99);
+                contactNbr.Set(index);
+                pAnotherMap->InsertL(contactName, contactNbr);  
+                
+                if(100==index)
+                    keyToRem.Copy(contactName);
+                }
+        }
+        
+        if(EFalse == (pMap->operator==(*pAnotherMap)))
+        {
+             flag = 0;
+        }
+        
+        pAnotherMap->Remove(keyToRem);
+        
+        if(EFalse == (pMap->operator==(*pAnotherMap)))
+        {
+            flag = 1;
+        }
+        else
+        {
+            flag = 0;
+        }   
+        if(pMap) pMap->DecRef();
+        if(pAnotherMap) pAnotherMap->DecRef();
+        return !flag;
+    }
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_015()
+    {
+         
+         TBool flag = 1;
+         TInt32 intVal=10;
+         TLiwVariant intVar((TInt32)intVal);
+         
+         {//integer check
+            TInt32 intRet;
+            intVar.Get(intRet);
+            
+            Dump(intVar);
+            
+            if(intRet!=intVal)
+            {
+                flag = 0;
+            }       
+            
+         }
+         
+         {//RFile check
+            RFile fileRet;
+            if(EFalse!=intVar.Get(fileRet))
+            {
+                flag = 0;
+            }           
+            fileRet.Close();            
+         }
+         
+         {//Uid check
+            TUid uidRet;
+            if(EFalse!=intVar.Get(uidRet))
+            {
+                flag = 0;
+            }           
+         }
+         
+         {//TUint check
+            TUint uintRet;
+            if(EFalse!=intVar.Get(uintRet))
+            {
+                flag = 0;
+            }           
+         }
+         
+         {//TBool check
+            TBool boolRet=EFalse;
+            if(EFalse!=intVar.Get(boolRet))
+            {
+                flag = 0;
+            }           
+         }
+         
+         {//TPtrC check
+            TPtrC ptrcRet;
+            if(EFalse!=intVar.Get(ptrcRet))
+            {
+                flag = 0;
+            }           
+         }
+         
+         {//TTime check
+            TTime timeRet;
+            if(EFalse!=intVar.Get(timeRet))
+            {
+                flag = 0;
+            }           
+         }
+         
+         {//TPtrC8 check
+            TPtrC8 ptrcRet;
+            if(EFalse!=intVar.Get(ptrcRet))
+            {
+                flag = 0;
+            }           
+         }
+         
+         {
+            TLiwVariant boolVar((TBool)EFalse);
+            
+            /*TInt32 intRet;
+            if(EFalse!=boolVar.Get((TInt32)intRet))
+            {
+                flag = 0;
+            }*/
+         }
+         
+         return !flag;           
+    }
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_016()
+{
+     TBool flag = 1;
+     TInt32 intVal=10;
+     TLiwVariant intVar((TInt32)intVal);
+     
+     {//AsList check
+        const CLiwList* pRetList=intVar.AsList();
+        
+        if(NULL!=pRetList)
+        {
+            flag = 0;
+        }
+     }
+     
+     {//AsMap check
+        const CLiwMap* pRetMap=intVar.AsMap();
+        
+        if(NULL!=pRetMap)
+        {
+            flag = 0;
+        }
+     }
+     
+     {//AsIterable check
+        CLiwIterable* pRet=intVar.AsIterable();
+        
+        if(NULL!=pRet)
+        {
+            flag = 0;
+        }
+     }
+     
+     {//AsInterface check
+        MLiwInterface* pRet=intVar.AsInterface();
+        
+        if(NULL!=pRet)
+        {
+            flag = 0;
+        }
+     }
+     
+     {//AsFileHandle check
+        RFile pRet=intVar.AsFileHandle();
+        
+        //Don't check pRet for RFile
+     }
+     return !flag;           
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_017()
+{
+    TBool flag = 0;
+    TInt intServiceCmd=100;
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, intServiceCmd, KContentTypeTxt);
+    
+    TBuf8<8> retStr=criteria->ServiceCmdStr();
+    if(0!=retStr.Length())
+    {
+        CleanupStack::PopAndDestroy(criteria);
+        flag = 0;
+    }
+    
+    if(intServiceCmd==criteria->ServiceCmd())
+    {
+        CleanupStack::PopAndDestroy(criteria);
+        flag = 1;
+    }
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_018()
+{
+    TBool flag = 1;
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL();
+    CleanupStack::PushL(criteria);
+    
+    
+    TBuf8<8> retStr=criteria->ServiceCmdStr();
+    if(0!=retStr.Length())
+    {
+        flag = 0;
+    }
+    
+    if(0!=criteria->ServiceCmd())
+    {
+        flag = 0;
+    }
+    
+    CleanupStack::PopAndDestroy(criteria);
+    
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_019()
+{
+    TBool flag = 0;
+    /*Testing String Based Command*/
+    RCriteriaArray interest;
+    CleanupClosePushL(interest);
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+    interest.AppendL(criteria);
+    
+   // Attach the MyServiceName provider to the LIW framework.
+    TInt status = iServiceHandler->AttachL(interest);
+        
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_019);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    inps->AppendL(param);
+    param.Reset();
+    
+    // Get the Test result from MyServiceName provider "ExecuteServiceCmdL"
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
+    CleanupStack::PopAndDestroy(crit); // crit
+ 
+    
+    TInt pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        {
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+                {
+                flag = 1;
+                }
+            else
+                {
+                
+                flag = 0;
+                }
+        }
+     else
+        {
+        flag = 0;
+        }
+
+    // Detach The MyServiceName Provider
+    iServiceHandler->DetachL(interest);    
+    
+    CleanupStack::PopAndDestroy(criteria);
+    CleanupStack::PopAndDestroy(&interest);   
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_020()
+{
+    TBool flag = 1;
+    TLiwVariant lhsVar;
+    TLiwVariant rhsVar;
+    
+    if(EFalse == (lhsVar==rhsVar))
+    {
+        //Not matching - test case fails        
+        flag = 0;        
+    }
+    
+    
+    {//For TUint check
+        lhsVar.Set(TUint(10));
+        rhsVar.Set(TUint(0));
+        
+        if(EFalse != (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+        
+        rhsVar.Set(TUint(10));
+        
+        //should match this time
+        if(EFalse == (lhsVar==rhsVar))
+        {
+            flag = 0;        
+        }
+    
+    }
+    
+    {//For TInt32 check
+        lhsVar.Set(TInt32(10));
+        rhsVar.Set(TInt32(0));
+        
+        if(EFalse != (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+        
+        rhsVar.Set(TInt32(10));
+        
+        //should match this time
+        if(EFalse == (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+    
+    }
+    
+    {//For  TBool check
+        lhsVar.Set(TBool(EFalse));
+        rhsVar.Set(TBool(ETrue));
+        
+        if(EFalse != (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+        
+        rhsVar.Set(TBool(EFalse));
+        
+        //should match this time
+        if(EFalse == (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+    
+    }
+    
+    {//For  TTime check
+        lhsVar.Set(TTime(100));
+        rhsVar.Set(TTime(200));
+        
+        if(EFalse != (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+        
+        rhsVar.Set(TTime(100));
+        
+        //should match this time
+        if(EFalse == (lhsVar==rhsVar))
+        {
+            //Not matching - test case fails        
+            flag = 0;        
+        }
+    
+    }
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_021()
+{
+    TBool flag = 1;
+    /*
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_001);
+    param.SetNameL(KTestPARAMNanmeTC1);
+    */
+    
+    //CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    
+    //inps->AppendL(param);
+    //param.Reset();
+    
+    TInt pos = -1;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    
+    if(pos != KErrNotFound)
+        {
+            flag = 0;            
+        }
+
+    pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    if(pos != KErrNotFound)
+        {
+            flag = 0;            
+        }  
+        
+    pos = -1;
+    outps->FindNext(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        {
+            flag = 0;            
+        }
+
+    pos = 0;
+    outps->FindNext(pos, EGenericParamError);
+    if(pos != KErrNotFound)
+        {
+            flag = 0;            
+        }               
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_022()
+{
+    TBool flag = 0; 
+    TLiwGenericParam param;
+    param.Value().Set(TInt32(100));
+    
+    Dump(param.Value());
+    
+    param.SetNameL(KTestPARAMNanmeTC1);
+    
+    CLiwGenericParamList* pParamList = CLiwGenericParamList::NewLC();
+    pParamList->AppendL(param);
+    
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    
+    inps->AppendL(*pParamList);
+    
+    TInt cnt = inps->Count();
+
+    if(cnt != 0)
+        {            
+            flag = 1;                        
+        }
+        else
+        {
+            flag = 0;
+        }
+    
+    param.Reset();
+    inps->Reset();
+    CleanupStack::PopAndDestroy(pParamList);
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_023()
+{
+    TBool flag = 0;
+    //Reusing LIW_DATA_TYPES_011 test case
+    TLiwGenericParam param;
+    param.Value().Set(KLIW_DATA_TYPES_011);
+    
+    Dump(param.Value());
+    
+    param.SetNameL(KTestPARAMNanmeTC1);
+    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
+    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
+    inps->AppendL(param);
+    param.Reset();
+    
+    // Call ExecuteServiceCmdL TO GET THE RESULT
+    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
+    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
+    CleanupStack::PopAndDestroy(crit); // crit
+    
+    // CHECK RESULT 
+    TInt pos = 0;
+    outps->FindFirst(pos, EGenericParamError);
+    
+    if(pos != KErrNotFound)
+        {
+            if ((*outps)[pos].Value().AsTInt32() == KErrNone)
+                {
+                
+                _LIT8(KIter,"Iterator");
+                TInt iterPos=0;
+                outps->FindFirst(iterPos, KIter);
+                if(pos != KErrNotFound)
+                {
+                    CLiwIterable* pIter=(*outps)[iterPos].Value().AsIterable();
+                    
+                    RWriteStream wstream;
+                    TRAPD(err,pIter->ExternalizeL(wstream));
+                    
+                    if(KErrNotSupported!=err)
+                    {
+                        flag = 0;   
+                    }
+                    else
+                    {
+                        flag = 1;
+                    }
+                }
+                else
+                {
+                    flag = 0;
+                }
+                }
+            else
+                {
+                flag = 0;
+                }
+        }
+     else
+        {
+        flag = 0;
+        }
+     return !flag;        
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_024()
+{
+    TBool flag = 1;
+    TLiwVariant intVar(TInt32(100));    
+    Dump(intVar);
+    
+    TLiwVariant nullVar;    
+    Dump(nullVar);
+    
+    Dump(TLiwVariant(TBool(ETrue)));    
+    
+    TLiwVariant uintVar(TUint(200));    
+    Dump(uintVar);
+    
+    Dump(TLiwVariant(TUid::Uid(0x00)));    
+    
+    TLiwVariant timeVar(TTime(100));    
+    Dump(timeVar);    
+
+    RFile fHdl;
+    TLiwVariant fHdlVar;
+    fHdlVar.Set(fHdl);
+    
+    Dump(fHdlVar);  
+    
+    TBuf8<16> buff(_L8("Hello"));
+    TLiwVariant bufVar(buff);
+    
+    Dump(bufVar);
+    
+    CLiwList* listType = CLiwDefaultList::NewL();
+    
+    /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
+    TLiwVariant intVairent;
+    for (TInt32 index = 100; index < 110; index++)
+        {
+        intVairent.Set(index);
+        listType->AppendL(intVairent);    
+        }
+        
+    Dump(TLiwVariant(listType));
+    
+    listType->DecRef();
+    
+    CLiwMap* mapType = CLiwDefaultMap::NewL();
+    
+    /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
+    TLiwVariant contactNbr;
+    TBuf8<32> contactName;
+    for (TInt32 index = 100; index < 110; index++)
+        {
+        contactName.Format(KContact, index - 99);
+        contactNbr.Set(index);
+        mapType->InsertL(contactName, contactNbr);    
+        }
+        
+    Dump(TLiwVariant(mapType));
+    mapType->DecRef();
+    return !flag;     
+}
+
+TBool Cliwtestcases::LIW_CLEANUP_LIW_001()
+{
+    TBool flag = 1;
+    iServiceHandler->Reset();
+    delete iServiceHandler;
+    iServiceHandler=NULL;
+    return !flag;
+}
+
+//for conversion utils
+TBool Cliwtestcases::LIW_DATA_TYPES_025()
+{
+    TLiwVariant a1;
+    TUint varUint;
+    TInt32 varInt;
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varUint = 45;
+    a1.Set(varUint);    //set TUint
+        
+    varInt = a1.AsTInt32();
+    
+    if(varUint == varInt)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_026()
+{
+    TLiwVariant a1;
+    TUint varUint;
+    TReal varReal;
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varUint = 45;
+    a1.Set(varUint);    //set TUint
+        
+    varReal = a1.AsTReal();
+    
+    if(varUint == varReal)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+/*TBool Cliwtestcases::LIW_DATA_TYPES_027()
+{
+    TLiwVariant a1;
+    TUint varUint;
+    TBuf<255> varBuf;
+    _LIT(KResult, "45");
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varUint = 45;
+    a1.Set(varUint);    //set TUint
+        
+    //varBuf = a1.AsDes();  //Does not work. Use Get method   
+    a1.Get(varBuf);   
+    
+    if(0 == varBuf.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_028()
+{
+    TLiwVariant a1;
+    TUint varUint;
+    TBuf8<255> varBuf8;
+    _LIT8(KResult, "45");
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varUint = 45;
+    a1.Set(varUint);    //set TUint
+        
+    //varBuf8 = a1.AsData();
+    a1.Get(varBuf8 );
+    
+    if(0 == varBuf8.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+*/
+
+TBool Cliwtestcases::LIW_DATA_TYPES_029()
+{
+    TLiwVariant a1;
+    TBool flag = 0;
+    TUint varUint;
+    TInt32 varInt;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varInt = 55;
+    a1.Set(varInt);     //set TInt
+        
+    varUint = a1.AsTUint();
+    
+    if(varUint == varInt)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_030()
+{
+    TLiwVariant a1;
+    TInt32 varInt;
+    TReal varReal;
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varInt = 55;
+    a1.Set(varInt);     //set TInt
+    varReal = a1.AsTReal();
+    
+    if(varInt == varReal)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+/*
+TBool Cliwtestcases::LIW_DATA_TYPES_031()
+{
+    TLiwVariant a1;
+    TInt32 varInt;
+    TBuf<255> varBuf;
+    
+    _LIT(KResult, "55");
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varInt = 55;
+    a1.Set(varInt);     //set TInt
+    
+    //varBuf = a1.AsDes();  //Does not work. Use Get method
+    a1.Get(varBuf);
+    
+    if(0 == varBuf.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_032()
+{
+    TLiwVariant a1;
+    TInt32 varInt;
+    TBuf8<255> varBuf8;
+    _LIT8(KResult, "55");
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varInt = 55;
+    a1.Set(varInt);     //set TInt
+        
+    //varBuf8 = a1.AsData();
+    a1.Get(varBuf8 );  a1.Get(varBuf8 );
+    
+    if(0 == varBuf8.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+*/
+
+TBool Cliwtestcases::LIW_DATA_TYPES_033()
+{
+    TLiwVariant a1;
+    TUint varUint;
+    TReal varReal;
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varReal = 65.2345;
+    a1.Set(varReal);    //set TReal     
+    varUint = a1.AsTUint();
+    
+    if(65 == varUint)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_034()
+{
+    TLiwVariant a1;
+    TInt32 varInt;
+    TReal varReal;
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varReal = 65.2345;
+    a1.Set(varReal);    //set TReal
+    varInt = a1.AsTInt32();
+    
+    if(65 == varInt)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+/*
+TBool Cliwtestcases::LIW_DATA_TYPES_035()
+{
+    TLiwVariant a1;
+    TReal varReal;
+    TBuf<255> varBuf;
+    _LIT(KResult, "65.2345");
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varReal = 65.2345;
+    a1.Set(varReal);    //set TReal
+    
+    //varBuf = a1.AsDes();  //Does not work. Use Get method 
+    a1.Get(varBuf);
+    
+    if(0 == varBuf.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_036()
+{
+    TLiwVariant a1;
+    TReal varReal;
+    TBuf8<255> varBuf8;
+    _LIT8(KResult, "65.2345");
+    TBool flag = 0;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    varReal = 65.2345;
+    a1.Set(varReal);    //set TReal
+    //varBuf8 = a1.AsData();
+    a1.Get(varBuf8 );
+    
+    if(0 == varBuf8.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+*/
+
+TBool Cliwtestcases::LIW_DATA_TYPES_037()
+{
+    TLiwVariant a1;
+    TReal varUint;
+    TBuf8<255> varBuf8;
+    _LIT8(KTest, "75");
+    TBool flag = 0;
+    varBuf8 = KTest;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf8);    //set TDes8
+    varUint = a1.AsTUint();
+    
+    if(75 == varUint)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_038()
+{
+    TLiwVariant a1;
+    TInt32 varInt;
+    TBuf8<255> varBuf8;
+    _LIT8(KTest, "75");
+    TBool flag = 0;
+    varBuf8 = KTest;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf8);    //set TDes8
+    varInt = a1.AsTInt32();
+    
+    if(75 == varInt)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_039()
+{
+    TLiwVariant a1;
+    TReal varReal;
+    TBuf8<255> varBuf8;
+    _LIT8(KTest, "75.897");
+    TBool flag = 0;
+    varBuf8 = KTest;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf8);    //set TDes8
+    varReal = a1.AsTReal();
+    
+    if(75.897 == varReal)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+/*
+TBool Cliwtestcases::LIW_DATA_TYPES_040()
+{
+    TLiwVariant a1;
+    TBuf<255> varBuf;
+    TBuf8<255> varBuf8;
+    _LIT8(KTest, "test");
+    _LIT(KResult, "test");
+    TBool flag = 0;
+    
+    varBuf8 = KTest;
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf8);    //set TDes8
+    //varBuf = a1.AsDes();  //Does not work. Use Get method
+    a1.Get(varBuf);
+    
+    if(0 == varBuf.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+*/
+
+TBool Cliwtestcases::LIW_DATA_TYPES_041()
+{
+    TLiwVariant a1;
+    TReal varUint;
+    TBuf<255> varBuf;
+    _LIT(KTest, "75");
+    TBool flag = 0;
+    varBuf = KTest;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf);     //set TDes
+    varUint = a1.AsTUint();
+    
+    if(75 == varUint)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_042()
+{
+    TLiwVariant a1;
+    TInt32 varInt;
+    TBuf<255> varBuf;
+    _LIT(KTest, "75");
+    TBool flag = 0;
+    varBuf = KTest;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf);     //set TDes
+    varInt = a1.AsTInt32();
+    
+    if(75 == varInt)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_043()
+{
+    TLiwVariant a1;
+    TReal varReal;
+    TBuf<255> varBuf;
+    _LIT(KTest, "75.897");
+    TBool flag = 0;
+    varBuf = KTest;
+    
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf);     //set TDes
+    varReal = a1.AsTReal();
+    
+    if(75.897 == varReal)
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+
+/*
+TBool Cliwtestcases::LIW_DATA_TYPES_044()
+{
+    TLiwVariant a1;
+    TBuf<255> varBuf;
+    TBuf8<255> varBuf8;
+    _LIT(KTest, "test");
+    _LIT8(KResult, "test");
+    TBool flag = 0;
+    varBuf = KTest;
+
+    //conversion check
+    //set variant for one type and get it in other types 
+    a1.Set(varBuf);     //set TDes
+    //varBuf8 = a1.AsData();
+    a1.Get(varBuf8 );
+    
+    if(0 == varBuf8.Compare(KResult))
+        flag = 1;
+    
+    a1.Reset(); return !flag;    
+}
+*/
+
+TBool Cliwtestcases::LIW_DATA_TYPES_045()
+{
+    TBool flag = 0;
+    /*Testing String Based Command*/
+    RCriteriaArray interest, providerList;
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KTestCommandTC1, KContentTypeTxt);
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    interest.AppendL(criteria);
+    
+    iServiceHandler->QueryImplementationL(interest, providerList);
+
+    if(providerList.Count())
+    {
+        if(0 == ((*(providerList[0])).ServiceCmdStr().Compare((*criteria).ServiceCmdStr())))
+        {
+            if(0 == ((*(providerList[0])).ContentType().Compare((*criteria).ContentType())))
+            {
+                providerList.ResetAndDestroy();
+                interest.ResetAndDestroy();   
+                flag = 1;       
+            }
+            
+        }         
+    }
+    else
+    {
+        providerList.ResetAndDestroy();
+        interest.ResetAndDestroy();   
+        flag = 0;
+    }
+    
+    return !flag;
+}
+    
+TBool Cliwtestcases::LIW_DATA_TYPES_046()
+{
+    TBool flag = 0;
+    /*Testing String Based Command*/
+    RCriteriaArray interest, providerList;
+    _LIT8(KJunkContentTypeTxt, "text");
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KTestCommandTC1, KJunkContentTypeTxt);
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+    interest.AppendL(criteria);
+    
+    iServiceHandler->QueryImplementationL(interest, providerList);
+    
+    
+     
+     
+    if(!providerList.Count())
+    {
+         flag = 1;
+    }
+    else
+    {
+        flag = 0;
+    }
+
+    providerList.ResetAndDestroy();
+    interest.ResetAndDestroy();   
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_047()
+{
+    TBool flag = 0;
+    /*Testing String Based Command*/
+    RCriteriaArray interest, providerList;
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KWild, KContentTypeTxt);
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+    interest.AppendL(criteria);
+    
+    iServiceHandler->QueryImplementationL(interest, providerList);
+    
+    
+     
+     
+    if(providerList.Count())
+    {
+        if(0 == ((*(providerList[0])).ContentType().Compare((*criteria).ContentType())))
+        {
+            providerList.ResetAndDestroy();
+            interest.ResetAndDestroy();   
+            flag = 1;       
+        }       
+    }
+    else
+    {
+        providerList.ResetAndDestroy();
+        interest.ResetAndDestroy();   
+        flag = 0;
+    }
+    
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_048()
+{
+    TBool flag = 0;
+    /*Testing String Based Command*/
+    RCriteriaArray interest, providerList;
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KTestCommandTC1, KWild);
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
+
+    interest.AppendL(criteria);
+    
+    iServiceHandler->QueryImplementationL(interest, providerList);
+    
+    
+     
+     
+    if(providerList.Count())
+    {
+        if(0 == ((*(providerList[0])).ServiceCmdStr().Compare((*criteria).ServiceCmdStr())))
+        {
+            providerList.ResetAndDestroy();
+            interest.ResetAndDestroy();
+            flag = 1;       
+        }         
+    }
+    else
+    {
+        providerList.ResetAndDestroy();
+        interest.ResetAndDestroy();
+        flag = 0;
+    }
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_DATA_TYPES_049()
+{
+    TBool flag = 0;
+    /*Testing String Based Command*/
+    RCriteriaArray interest, providerList;
+    
+    CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KWild, KWild);     //Queries for a list of all the LIW providers present
+    criteria->SetServiceClass(TUid::Uid(KLiwClassBase));          //Presently this value is changed to differentiate LIW Providers from other Ecom plug-ins
+    
+    TReal mini = 2.0;
+    TReal maxi = 3.0;
+    TLiwVariant mdOption;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption.Set(pMetaDataMap);
+    criteria->SetMetaDataOptions(mdOption);
+
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption.Reset();
+    
+    interest.AppendL(criteria);
+    
+    iServiceHandler->QueryImplementationL(interest, providerList);      //providerList contains the list of all the LIW providers with metadata information being loaded for each
+    
+    RCriteriaArray loadCritArray;                        
+      
+    for(TInt idx = 0; idx < providerList.Count(); ++idx)         // for each provider
+    {
+      CLiwCriteriaItem* provInfo = providerList[idx];      
+      
+      TUid interfaceId = provInfo->ServiceClass();      //retrieving the service class (interface Id) of the provider
+      TPtrC8 intfName = provInfo->ServiceCmdStr();      //retrieving the content type or the interface name of the provider (e.g IDataSource)
+      TPtrC8 servName = provInfo->ContentType();        //retrieving the service command name of the provider (e.g s60.Messaging)
+      TReal provVersion = 1.0;                          //since Default version is 1.0 for all the providers
+      
+      //Creating a criteria using the above extracted information
+      CLiwCriteriaItem* item = CLiwCriteriaItem::NewL(1, intfName, servName);
+      item->SetServiceClass(interfaceId);
+                         
+      TLiwVariant provMetadata;
+      provInfo->GetMetaDataOptions(provMetadata);      //getting metadata from the provider (contains version information)
+      
+      const CLiwMap* metaDataMap = provMetadata.AsMap(); 
+            
+      if(metaDataMap)
+      {
+         _LIT8(KVersionKey,"ver");         //Key name in the metadata map is "ver" (as specified in the provider RSS File)
+         TLiwVariant versionVar;
+         
+         if(metaDataMap->FindL(KVersionKey, versionVar))    //This should be true. If false this means that there is no version information in the provider metadata
+         {
+         /*   ------------------------------------
+            |   key   |        value      |
+            |         |                   |
+            |   ver   |      (List) 2.2   |
+            -------------------------------------
+
+         */ 
+            const CLiwList* pVersionList = versionVar.AsList();
+            if(pVersionList)
+            {
+               TLiwVariant verCheck;
+               for(TInt idx=0; idx < pVersionList->Count(); ++idx)         //the count is always ZERO. But to be on safer side, I have given the loop
+               {
+                  if(pVersionList->AtL(idx,verCheck))      //Ideally the index should only be Zero. But the version, if exists in any index will be returned now
+                  {
+                     provVersion = verCheck.AsTReal();   //The provider version is retrieved from the metadata
+                     
+                     //using switch case or if stmts further. This implementation is left to the Consumer's logic. But just a sample is shown below
+                     if(2.5 == provVersion || 2.4 == provVersion)         
+                     {
+                        TLiwVariant mdOption1;      //Setting the metadata option with the version information. 
+                        CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+                        CLiwList* pRangeList = CLiwDefaultList::NewL();
+                        _LIT8(KVersion,"ver");      //Key in metadata for version is "version"
+                        _LIT8(KRange,"range");      //Since this is an exact version match done in AttachL, hence the key "exact"
+                        
+                        pRangeList->AppendL(TLiwVariant(KVersion));
+                        pRangeList->AppendL(TLiwVariant(provVersion));
+                        pRangeList->AppendL(TLiwVariant(provVersion));
+                        
+                        pMetaDataMap->InsertL(KRange,pRangeList);
+                        mdOption1.Set(pMetaDataMap);
+                        item->SetMetaDataOptions(mdOption1); //metadata is set with the version information
+
+                        pRangeList->DecRef();
+                        pMetaDataMap->DecRef();
+                        mdOption1.Reset();
+                        
+                        loadCritArray.AppendL(item);
+                        
+                        iServiceHandler->DetachL(loadCritArray);
+                        
+                        TInt retVal = iServiceHandler->AttachL(loadCritArray); // This just loads the provider sent as input. No version range is to be sent here,
+                        
+                        if(retVal >= 0)
+                        {
+                            flag = 1;
+                        }
+        
+                        iServiceHandler->DetachL(loadCritArray);
+                     }
+                     else if(2.6 == provVersion)
+                     {
+                        // statements
+                     }
+                  }
+                  
+                  verCheck.Reset();
+               }
+            }
+         }
+         versionVar.Reset();
+      }
+      provMetadata.Reset();
+   }
+   
+    loadCritArray.ResetAndDestroy(); 
+    providerList.ResetAndDestroy();
+    interest.ResetAndDestroy();
+
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_MDAT_VER1()
+{
+    TBool flag = 0;
+    CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    item1->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 2.0;
+    TReal maxi = 3.0;
+    TLiwVariant mdOption1;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item1->SetMetaDataOptions(mdOption1);
+
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+    
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item1);
+    
+    iServiceHandler->QueryImplementationL(critArray, providerList);
+    
+    TInt status = iServiceHandler->AttachL(providerList);
+    
+    
+    if(status > 0)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    
+    CleanupStack::Pop();
+    iServiceHandler->DetachL(providerList);
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+
+TBool Cliwtestcases::LIW_MDAT_VER2()
+{
+    TBool flag = 0;
+    CLiwCriteriaItem* item2 = CLiwCriteriaItem::NewLC(2, KTestCommandTC1, KContentTypeTxt);
+    item2->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 0.0;
+    TReal maxi = 3.0;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    TLiwVariant mdOption1;
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item2->SetMetaDataOptions(mdOption1);
+    
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+        
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item2);
+    
+    iServiceHandler->QueryImplementationL(critArray, providerList);
+    
+    iServiceHandler->AttachL(providerList);
+    
+    
+    if(providerList.Count() >= 0)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    
+    CleanupStack::Pop();
+    iServiceHandler->DetachL(providerList);
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+
+TBool Cliwtestcases::LIW_MDAT_VER3()
+{
+    TBool flag = 0;
+    CLiwCriteriaItem* item3 = CLiwCriteriaItem::NewLC(3, KTestCommandTC1, KContentTypeTxt);
+    item3->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 2.0;
+    TReal maxi = 0.0;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    TLiwVariant mdOption1;
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item3->SetMetaDataOptions(mdOption1);
+    
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+        
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item3);
+    
+    iServiceHandler->QueryImplementationL(critArray, providerList);
+    
+    iServiceHandler->AttachL(providerList);
+    
+    if(providerList.Count() >= 0)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+
+    CleanupStack::Pop();
+    iServiceHandler->DetachL(providerList);
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+
+TBool Cliwtestcases::LIW_MDAT_VER4()
+{   
+    TBool flag = 0;
+   CLiwCriteriaItem* item4 = CLiwCriteriaItem::NewLC(4, KTestCommandTC1, KContentTypeTxt);
+    item4->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 0.0;
+    TReal maxi = 0.0;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    TLiwVariant mdOption1;
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item4->SetMetaDataOptions(mdOption1);
+    
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+        
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item4);
+    
+    iServiceHandler->QueryImplementationL(critArray, providerList);
+    
+    iServiceHandler->AttachL(providerList);
+    
+    
+    if(providerList.Count() >= 0)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    
+    CleanupStack::Pop();
+    iServiceHandler->DetachL(providerList);
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_MDAT_VER5()
+{
+    TBool flag = 0;
+    CLiwCriteriaItem* item5 = CLiwCriteriaItem::NewL();
+    item5->SetId(5);
+    item5->SetServiceCmdL(KTestCommandTC1);
+    item5->SetContentTypeL(KContentTypeTxt);
+    item5->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 3.0;
+    TReal maxi = 2.0;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    TLiwVariant mdOption1;
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item5->SetMetaDataOptions(mdOption1);
+    
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+        
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item5);
+    
+    iServiceHandler->QueryImplementationL(critArray, providerList);
+    
+    iServiceHandler->AttachL(providerList);
+    
+    if(providerList.Count() >= 0) 
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+    
+    iServiceHandler->DetachL(providerList);
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_MDAT_CAP1()
+{
+    TBool flag = 1;
+    //TInt status = 0;
+    iServiceHandler->Reset();
+    CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    item1->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 2.0;
+    TReal maxi = 5.0;
+    TLiwVariant mdOption1;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item1->SetMetaDataOptions(mdOption1);
+
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+    
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item1);
+    iServiceHandler->QueryImplementationL(critArray, providerList);
+                        
+    
+    // beginning of securitymanager code
+    
+    CRTSecManager* iSession = CRTSecManager::NewL();
+    CTrustInfo* iTrust = CTrustInfo::NewL();
+    
+    RFs fileSession;
+    if(KErrNone==fileSession.Connect())
+    {
+        CleanupClosePushL(fileSession);
+        if(KErrNone==fileSession.ShareProtected())
+        {
+            RFile secPolicyFile;    
+            if(KErrNone == secPolicyFile.Open(fileSession, _L("c:\\data\\others\\liwaccesspolicy.xml"), EFileShareAny ))
+            {
+                CleanupClosePushL(secPolicyFile);
+                TPolicyID iPolicyId = iSession->SetPolicy(secPolicyFile);
+                
+                if(iPolicyId>KErrNone)
+                {
+                    TInt32 exId = iSession->RegisterScript(iPolicyId, *iTrust);
+                    
+                    CRTSecMgrScriptSession* scriptSession = NULL;
+                    
+                    //#ifdef  AUTO_TESTING
+                                        scriptSession = iSession->GetScriptSessionL(iPolicyId, exId, this);
+                    //#else
+                      //                  scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+                    //#endif
+
+                    //CRTSecMgrScriptSession* scriptSession = iSession->GetScriptSession(iPolicyId,exId);
+
+                    TInt status = iServiceHandler->AttachL(critArray,*scriptSession);
+                    
+                    delete scriptSession;
+                    
+                }
+                
+                CleanupStack::PopAndDestroy();//secPolicyFile
+            }       
+        }
+        
+        CleanupStack::PopAndDestroy();//fileSession
+        
+    }
+
+    delete iTrust;
+    delete iSession;
+    // end of securitymanager code
+    
+     
+    if(providerList.Count())
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+
+    CleanupStack::Pop(item1); 
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_MDAT_CAP2()
+{
+    TBool flag = 0;
+    TInt status = 0;
+    iServiceHandler->Reset();
+    CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
+    item1->SetServiceClass(TUid::Uid(KLiwClassBase));
+    
+    TReal mini = 5.0;
+    TReal maxi = 7.0;
+    TLiwVariant mdOption1;
+    CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
+    CLiwList* pRangeList = CLiwDefaultList::NewL();
+    _LIT8(KVersion,"ver");
+    _LIT8(KRange,"range");
+    
+    pRangeList->AppendL(TLiwVariant(KVersion));
+    pRangeList->AppendL(TLiwVariant(TReal(mini)));
+    pRangeList->AppendL(TLiwVariant(TReal(maxi)));
+    
+    pMetaDataMap->InsertL(KRange,pRangeList);
+    mdOption1.Set(pMetaDataMap);
+    item1->SetMetaDataOptions(mdOption1);
+
+    pRangeList->DecRef();
+    pMetaDataMap->DecRef();
+    mdOption1.Reset();
+    
+    RCriteriaArray critArray, providerList;
+    
+    critArray.AppendL(item1);
+    
+    // beginning of securitymanager code
+    
+    CRTSecManager* iSession = CRTSecManager::NewL();
+    CTrustInfo* iTrust = CTrustInfo::NewL();
+    
+    RFs fileSession;
+    if(KErrNone==fileSession.Connect())
+    {
+        CleanupClosePushL(fileSession);
+        if(KErrNone==fileSession.ShareProtected())
+        {
+            RFile secPolicyFile;    
+            if(KErrNone == secPolicyFile.Open(fileSession, _L("c:\\data\\Others\\AccessPolicy_V1.xml"), EFileShareAny ))
+            {
+                CleanupClosePushL(secPolicyFile);
+                TPolicyID iPolicyId = iSession->SetPolicy(secPolicyFile);
+                
+                if(iPolicyId>KErrNone)
+                {
+                    TInt32 exId = iSession->RegisterScript(iPolicyId, *iTrust);
+                    CRTSecMgrScriptSession* scriptSession = iSession->GetScriptSessionL(iPolicyId,exId);
+
+                    iServiceHandler->QueryImplementationL(critArray, providerList);
+                    
+                    status = iServiceHandler->AttachL(critArray,*scriptSession);
+                    
+                    delete scriptSession;
+                }
+                
+                CleanupStack::PopAndDestroy();//secPolicyFile
+            }       
+        }
+        
+        CleanupStack::PopAndDestroy();//fileSession
+    }
+
+    delete iTrust;
+    delete iSession;
+    // end of securitymanager code
+
+    if(!status > 0)
+        {
+        flag = 1;
+        }
+    else
+        {
+        flag = 0;
+        }
+
+    CleanupStack::Pop(item1); 
+    critArray.ResetAndDestroy();
+    providerList.ResetAndDestroy();
+    return !flag;
+}
+
+TBool Cliwtestcases::LIW_ContainerCleanup()
+{
+   
+    __UHEAP_MARK;
+    _LIT(KName,"Name");
+    TLiwVariant variant(KName());
+    CLiwMap* map = CLiwDefaultMap::NewL();
+    CLiwList *listTemp = CLiwDefaultList::NewL(); 
+    map->PushL();
+    listTemp->PushL();    
+    //CleanupClosePushL(*map);
+    //CleanupClosePushL(*listTemp);
+    map->InsertL(KNullDesC8,variant);
+    TRAP_IGNORE(TestL(map));
+    CleanupStack::PopAndDestroy(listTemp);
+    CleanupStack::PopAndDestroy(map);
+    __UHEAP_MARKEND;
+    
+    return KErrNone;   
+}
+
+void Cliwtestcases::TestL(CLiwMap *map)
+{
+    CLiwGenericParamList* param = CLiwGenericParamList::NewLC();
+    param->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(map)));
+    User::Leave(KErrGeneral);
+    param->Reset();
+    CleanupStack::Pop(param);
+}
+
+TBool Cliwtestcases::LIW_ParamCleanup()
+{
+    __UHEAP_MARK;
+    CLiwGenericParamList* param = CLiwGenericParamList::NewLC();
+    //CLiwMap* map = CLiwDefaultMap::NewL();
+    //CleanupClosePushL(*map);
+    //map->InsertL(KNullDesC8,variant);
+    TLiwGenericParam par;
+    TLiwVariant var;
+    par.SetNameAndValueL(KNullDesC8, var);
+    //param->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(map)));
+    param->AppendL(par);
+    //CleanupStack::PopAndDestroy(map);
+    
+    TRAP_IGNORE(TestParamL(param));
+    
+    par.Reset();
+    CleanupStack::PopAndDestroy(param);
+    __UHEAP_MARKEND;
+    
+    return KErrNone;
+}
+
+void Cliwtestcases::TestParamL(CLiwGenericParamList *param)
+{
+    TLiwGenericParam outParam;
+    outParam.PushL();
+    //Pushing the TLiwGenericParam into the CleanupStack
+    //CleanupStack::PushL( TCleanupItem( TLiwGenericParam::ParamCleanup , &outParam ) ); 
+    
+    param->AtL(0,outParam);
+    const CLiwMap* outMap = outParam.Value().AsMap();
+    
+    //Leaves before CleanupStack::Pop and reset is called
+    User::Leave(KErrGeneral);
+    
+    //CleanupStack::Pop(&outParam);
+    outParam.Reset();
+}
+
+TBool Cliwtestcases::LIW_VariantCleanup()
+{
+    
+    __UHEAP_MARK;
+    _LIT(KName,"Name");
+    TLiwVariant variant(KName());
+    CLiwMap* map = CLiwDefaultMap::NewL();
+    map->PushL();
+    //CleanupClosePushL(*map);
+    //map->InsertL(KNullDesC8,variant);
+    
+    TRAP_IGNORE(TestVariantL(map));
+    
+    CleanupStack::Pop(map);                 
+    map->DecRef();                      //map is destroyed
+    __UHEAP_MARKEND;            //There is no memory Leak since the TLiwVariant "var" is destroyed by the CleanupStack during User::Leave
+
+    
+    return KErrNone;               
+} 
+
+void Cliwtestcases::TestVariantL(CLiwMap* map)
+{
+  
+    TLiwVariant var;
+    var.PushL();
+    //CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &var) );
+    
+    map->FindL(KNullDesC8,var);         //This makes a copy of TLiwVariant "variant" to "var"
+    User::Leave(KErrNoMemory);          //The TLiwVariant "var" is popped from the CleanupStack and VariantCleanup method is called
+    
+    CleanupStack::Pop(&var);        //These statements are not executed
+    var.Reset();                                            //This statement is not executed resulting in memory leak
+}
+
+
+TBool Cliwtestcases::LIW_DATA_TYPES_050()
+{
+    TLiwVariant a1;
+    TInt32 varInt32;
+    TInt64 varInt64 = 0xaaaaaaa;
+    TBool flag = 0;
+    
+    //First checking the TInt64 datatype
+    a1.Set(varInt64);
+    
+    Dump(a1);
+    //conversion check
+    //set variant for TInt64 and get it in TInt32
+    varInt32 = a1.AsTInt32();   //get TInt32
+    
+    if(varInt32 == varInt64)
+        flag = 0;
+    
+    TUint varUint;
+    varUint = a1.AsTUint();     //get TUint
+    
+    if(varUint == varInt64)
+        flag = 0;
+    
+    TReal varReal;
+    varReal = a1.AsTReal();     //get TReal
+    
+    if(varReal == varInt64)
+        flag = 0;
+    
+    TBuf<20> varBuf;
+    //varBuf = a1.AsDes();  //Does not work. Use Get method    
+    a1.Get(varBuf);     //get TDes
+    
+    TBuf8<20> varBuf8;
+    //varBuf8 = a1.AsData();
+    a1.Get(varBuf8 );   //get TDes8
+        
+    a1.Reset(); 
+    
+    flag = 1;
+    return !flag;    
+}
+
+TInt Cliwtestcases::LIW_ASYNC_001()
+    {
+    return asyObj->AsyncCase(1);
+    }
+
+TInt Cliwtestcases::LIW_ASYNC_002()
+    {
+    return asyObj->AsyncCase(2);
+    }
+
+TInt Cliwtestcases::LIW_ASYNC_003()
+    {
+    return asyObj->AsyncCase(3);
+    }
+
+TInt Cliwtestcases::LIW_ASYNC_004()
+    {
+    return asyObj->AsyncCase(4);
+    }
+
+// -----------------------------------------------------------------------------
+// Cliwtestcases::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt Cliwtestcases::?member_function(
+   CItemParser& aItem )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       File that exports the files belonging to 
+:                LIW Generic Parameter API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/LiwGenericParam.h     		MW_LAYER_PLATFORM_EXPORT_PATH(LiwGenericParam.h)
+../inc/LiwVariantType.hrh     	MW_LAYER_PLATFORM_EXPORT_PATH(LiwVariantType.hrh)
+../inc/LiwVariant.h     				MW_LAYER_PLATFORM_EXPORT_PATH(LiwVariant.h)
+../inc/LiwGenericParam.inl     	MW_LAYER_PLATFORM_EXPORT_PATH(LiwGenericParam.inl)
+../inc/LiwGenericParam.hrh     	MW_LAYER_PLATFORM_EXPORT_PATH(LiwGenericParam.hrh)
+../inc/LiwVariant.inl    				MW_LAYER_PLATFORM_EXPORT_PATH(LiwVariant.inl)
+../inc/LiwBufferExtension.h			MW_LAYER_PLATFORM_EXPORT_PATH(LiwBufferExtension.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwbufferextension.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,58 @@
+#ifndef LIW_BUFFEREXTENSION_H
+#define LIW_BUFFEREXTENSION_H/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Abstract bitmap buffer representation.
+*
+*/
+
+
+
+
+
+
+
+#include <fbs.h>
+
+#include "LiwVariant.h"
+class CFbsBitmap;
+
+class CLiwBitmapBuffer : public CLiwBuffer
+	{
+	public:
+		/*
+		 * The concrete implementation of buffer types should perform equality operation
+		 * check. This is a platform specifc extension class to support bitmap
+		 * buffer to abstract CFbsBitmap type.
+		 
+		 *
+		 * @return platform specific bitmap representation. By default, this method
+		 * returns NULL
+		 */
+		virtual CFbsBitmap* AsBitmap()
+			{
+			return NULL;	// return NULL by default
+			} 
+	};
+
+/**
+ 	* Abstract file buffer representation.
+	*
+**/
+class CLiwFileBuffer : public CLiwBuffer
+{
+	public:
+		virtual RFile& AsFile() = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwgenericparam.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       A generic parameter class.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_GENERIC_PARAM_H
+#define LIW_GENERIC_PARAM_H
+
+// INCLUDES
+#include <e32base.h>
+#include "liwgenericparam.hrh"
+#include "liwvariant.h"
+
+namespace LIW
+{
+ /*
+ * LIW generic parameter id. This data type should always be used when dealing 
+ * with LIW generic parameters. UIDs can be used as LIW generic parameter IDs. 
+ * However, values from 0 to 131071 are reserved.
+ * @see TLiwGenericParam 
+ * @see TGenericParamIdValue
+ */ 
+typedef TInt TGenericParamId;
+}
+// CLASS DECLARATION
+
+/**
+* Generic parameter class for passing data between applications.
+* A generic parameter is a pair of semantic ID and
+* variant value. The semantic ID tells the purpose of the parameter,
+* for example a file name, URL or phone number. The variant value contains
+* the data format and actual value. This class does not implement any
+* consistency checks between the semantic ID and value's data format.
+* So one semantic ID can be expressed as alternative data formats.
+*
+* @lib ServiceHandler.lib
+* @since Series 60 2.6
+* @see TLiwVariant
+* @see CLiwGenericParamList
+*/
+class TLiwGenericParam
+    {
+    public:  // Constructors and destructor
+        /**
+        * Constructs a generic parameter.
+        */
+        inline TLiwGenericParam();
+        
+        /**
+        * Constructs a generic parameter.
+        *
+        * @param aSemanticId The semantic ID of the parameter, one of TGenericParamId values.
+        */        
+        inline TLiwGenericParam(LIW::TGenericParamId aSemanticId);
+        
+        /**
+        * Constructs a generic parameter.
+        *
+        * @param aSemanticId The semantic ID of the parameter, one of TGenericParamId values.
+        * @param aValue The parameter value.
+        */        
+        inline TLiwGenericParam(LIW::TGenericParamId aSemanticId, const TLiwVariant& aValue);
+
+        /**
+        * Constructs a generic parameter.
+        *
+        * @param aName Name of the generic parameter
+        * @param aValue The parameter value.
+        */ 
+        inline TLiwGenericParam(const TDesC8& aName, const TLiwVariant& aValue);
+
+    public:  // Interface
+        /**
+        * Sets the semantic ID. Possibly set previous ID is overwritten.
+        *
+        * @param aSemanticId The semantic ID of the parameter.
+        */
+        inline void SetSemanticId(LIW::TGenericParamId aSemanticId);
+
+        /**
+        * Set name. Possibly set previous name is overwritten.
+        *
+        * @param aName Parameter name.
+        */
+        inline void SetNameL(const TDesC8& aName);
+
+        /**
+        * Set name and value. Possibly set previous name and value is overwritten.
+        *
+        * @param aName the parameter name.
+        *
+        * @param aValue the parameter value
+        */
+        inline void SetNameAndValueL(const TDesC8& aName, const TLiwVariant& aValue);
+
+        /**
+        * Returns the semantic ID of this parameter.
+        *
+        * @return The semantic ID.
+        */
+        inline LIW::TGenericParamId SemanticId() const;
+
+        /**
+        * Returns the name of this parameter.
+        *
+        * @return The name of the parameter.
+        */
+        inline const TDesC8& Name() const;
+
+        /**
+        * Returns the value of this parameter.
+        *
+        * @return The value of the parameter.        
+        */
+        inline TLiwVariant& Value();
+
+        /**
+        * Returns the const value of this parameter.
+        *
+        * @return The const value of the parameter.        
+        */
+        inline const TLiwVariant& Value() const;
+
+        /**
+        * Resets the semantic ID and the value of this parameter.
+        */
+        inline void Reset();
+		
+		/**
+        * TLiwGenericParam cleanup method
+        *
+        * !!!!!!!!!!!!!!!!!!!!!!!!!!!! 		IMPORTANT NOTE  	!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+        *
+        * Parameters can be pushed into the CleanupStack using this method
+        * along with TCleanupItem
+        *
+        * @ param aObj - TLiwGenericParam Object but of type TAny* for usage with TCleanupItem
+        * 
+        * Example 1: Here the client explicitly pushes the parameter into the CleanupStack using TCleanupItem
+        *
+        * @code
+	    *	TLiwGenericParam param;
+    	*	CleanupStack::PushL( TCleanupItem( TLiwGenericParam::ParamCleanup , &param ) ); 
+    	*	User::Leave(KErrGeneral);  //This calls the ParamCleanup method which cleans up TLiwGenericParam 
+    	*   CleanupStack::Pop(&param);
+    	*	param.Reset();
+    	* @endcode 
+    	* 
+    	* Example 2: Here the client calls the PushL method of TLiwGenericParam which pushes the object into 
+    	* the CleanupStack using TCleanupItem
+        *
+        * @code
+        *	TLiwGenericParam param;
+    	*	param.PushL();				
+    	*	User::Leave(KErrGeneral);  //This calls the ParamCleanup method which cleans up TLiwGenericParam 
+    	*   CleanupStack::Pop(&param);
+    	*	param.Reset();
+    	* @endcode
+    	*
+    	* The clients can use the convenient PushL method which is recommended (as shown in e.g 2) rather than 
+	    *  explicitly pushing the parameter object into the CleanupStack using TCleanupItem and ParamCleanup.
+    	* 
+	    * @ see PushL() method
+        */
+        IMPORT_C static void ParamCleanup(TAny* aObj);
+        
+        /**
+        * A friendly and convenient method to push the TLiwGenericParam Object into the CleanupStack
+        *
+        * !!!!!!!!!!!!!!!!!!!!!!!!!!!! 		IMPORTANT NOTE  	!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+        *
+        * This method informs the CleanupStack that ParamCleanup method should be called incase of any Leave
+        *
+        * Example: 
+        *
+        * @code
+        *	TLiwGenericParam param;
+    	*	param.PushL();				//This pushes the parameter object "param" into the CleanupStack using TCleanupItem and ParamCleanup.
+    	*	User::Leave(KErrGeneral);  	//This calls the ParamCleanup method which cleans up TLiwGenericParam
+    	*   CleanupStack::Pop(&param);	//These statements are not executed
+    	*	param.Reset();
+    	* @endcode
+    	* 
+    	* This method is recommended than explicitly pushing the parameter object into the CleanupStack 
+    	*  using TCleanupItem and ParamCleanup.
+    	*
+    	* @see ParamCleanup() method
+        */
+        IMPORT_C void PushL();
+
+    private:  // Interface for friend classes
+        void Destroy();
+        void CopyLC(const TLiwGenericParam& aParam);
+        static void CleanupDestroy(TAny* aObj);
+        operator TCleanupItem();
+        void InternalizeL(RReadStream& aStream);
+        void ExternalizeL(RWriteStream& aStream) const;
+        TInt Size() const; 
+
+    private:  // Data
+        /// Own: semantic ID of this parameter
+        LIW::TGenericParamId iSemanticId;
+        /// Own: value of this parameter
+        TLiwVariant iValue;
+        /// Reserved member
+        TAny* iReserved;
+
+    private:  // friend declarations
+        friend class CLiwGenericParamList;
+        friend class CLiwDefaultList; 
+        friend class CLiwDefaultMap;  
+    };
+
+
+// FUNCTIONS
+
+/**
+* Returns ETrue if two generic params are equal.
+*
+* @param aLhs Left hand side.
+* @param aRhs Right hand side.
+* @return ETrue if equal, EFalse otherwise.
+*/ 
+IMPORT_C TBool operator==(const TLiwGenericParam& aLhs, const TLiwGenericParam& aRhs);
+
+/**
+* Returns ETrue if two generic params are not equal.
+*
+* @param aLhs Left hand side.
+* @param aRhs Right hand side.
+* @return ETrue if not equal, EFalse otherwise.
+*/
+inline TBool operator!=(const TLiwGenericParam& aLhs, const TLiwGenericParam& aRhs);
+        
+
+/**
+ * Generic parameter list.
+ * A list containing TLiwGenericParam objects. Used for passing parameters 
+ * between consumers and providers.
+ *
+ * @lib ServiceHandler.lib
+ * @since Series 60 2.6
+ */
+NONSHARABLE_CLASS(CLiwGenericParamList): public CBase
+    {
+    public:   // Constructors and destructor
+        /**
+        * Creates an instance of this class.
+        *
+        * @return A pointer to the new instance.
+        */
+        IMPORT_C static CLiwGenericParamList* NewL();
+        
+        /**
+        * Creates an instance of this class.
+        *
+        * @param aReadStream A stream to initialize this parameter list from.
+        * @return A pointer to the new instance.
+        */        
+        IMPORT_C static CLiwGenericParamList* NewL(RReadStream& aReadStream);
+
+        /**
+        * Creates an instance of this class. Leaves the created instance on the
+        * cleanup stack.
+        *
+        * @return A pointer to the new instance.
+        */
+        IMPORT_C static CLiwGenericParamList* NewLC();
+        
+        /**
+        * Creates an instance of this class. Leaves the created instance on the
+        * cleanup stack.
+        *
+        * @param aReadStream A stream to initialize this parameter list from.
+        * @return A pointer to the new instance.
+        */        
+        IMPORT_C static CLiwGenericParamList* NewLC(RReadStream& aReadStream);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CLiwGenericParamList();
+        
+    public:  // Interface
+        /**
+        * Returns the number of parameters in the list. 
+        *
+        * @return The number of parameters in the list. 
+        */
+        IMPORT_C TInt Count() const;
+        
+        /**
+        * Returns the number of the parameters in the list by semantic id and datatype.
+        *
+        * @param aSemanticId The semantic ID of the parameter.
+        * @param aDataType The type id of data. Default is any type.
+        * @return The number of parameters in the list by semantic id and datatype.
+        */
+        IMPORT_C TInt Count(LIW::TGenericParamId aSemanticId, 
+                LIW::TVariantTypeId aDataType = LIW::EVariantTypeAny) const;  
+            
+        /**
+        * Returns a parameter from this list.
+        *
+        * @param aIndex Index of the parameter.
+        * @return The parameter at the aIndex position.
+        * @pre aIndex>=0 && aIndex<Count()
+        */
+        IMPORT_C const TLiwGenericParam& operator[](TInt aIndex) const;
+        
+        /**
+	    * Gets an entry from the collection based on an integeral index.
+	    * Note ! This method allocates memory. To ensure proper cleanup you shall call PushL method beforehand.
+	    *  
+	    * @param aIndex an index to get an entry from the collection
+	    * @param aEntry the returned element from the collection.  
+	    *
+	    * !!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+	    *
+	    * This is a copy of TLiwGenericParam present in the list at the particular index. To ensure proper cleanup 
+	    * TLiwGenericParam::PushL method should be called beforehand.
+	    *
+	    * @code
+	    * CLiwGenericParamList* param = CLiwGenericParamList::NewLC();
+		* //... param is filled with some semantic Id and TLiwVariant value ...
+		*
+		* TLiwGenericParam outParam;
+ 	    * outParam.PushL();			
+ 	    * //This pushes the parameter object "outParam" into the CleanupStack using TCleanupItem and ParamCleanup.
+		*
+		* param->AtL(0,outParam);	
+		* //This fills the "outParam" with the parameter value present in the 0th position of parameter list, but
+		* //if there is any Leave in AtL, then ParamCleanup method is called for proper cleanup
+		*
+		* CleanupStack::Pop(&outParam);	
+		* outParam.Reset();
+		* CleanupStack::PopAndDestroy(param);
+		* @endcode
+		*
+	    * @return false if no element is found at the passed index;
+	    * true if an element is found 
+	    * 
+	    * @see CLiwDefaultList::AtL
+	    * @see TLiwGenericParam::PushL
+	    */
+		IMPORT_C void AtL(TInt aIndex, TLiwGenericParam& aParam) const;
+
+        /**
+        * Appends a parameter to this list.
+        *
+        * @param aParam The parameter to append to this list. This object takes
+        *               an own copy of the data in aParam.
+        */
+        IMPORT_C void AppendL(const TLiwGenericParam& aParam);
+
+        /**
+        * Copies the given list and appends it to end of this list.
+        *
+        * @since Series 60 2.8        
+        * @param aList A list to be copied and appended.
+        */
+        IMPORT_C void AppendL(const CLiwGenericParamList& aList);
+        
+        /**
+        * Removes the first found item with given semantic id from the list.
+        * 
+        * @param aSemanticId Semantic id for the item to be removed.
+        * @return  ETrue  if an item for the given semantic id was found and removed.
+        *          EFalse otherwise.
+        */
+        IMPORT_C TBool Remove(TInt aSemanticId);
+        
+        /**
+        * Removes the first found item with given string based semantic id from the list.
+        * 
+        * @param aSemanticId Semantic id for the item to be removed.
+        * @return  ETrue  if an item for the given semantic id was found and removed.
+        *          EFalse otherwise.
+        */
+        IMPORT_C void Remove(const TDesC8& aName);
+
+        /**
+        * Deletes all parameters in the list and resets the list.
+        */
+        IMPORT_C void Reset();
+
+        /**
+        * Returns the first item matching the given semantic ID.
+        *
+        * @param aIndex Position in which to start searching. On return it contains 
+        *               the position of the found parameter. It is set to KErrNotFound, 
+        *               if no matching items were found.
+        * @param aSemanticId The semantic ID of the parameter.
+        * @param aDataType The type id of data. Default is any type.
+        * @return The first matching item.
+        */
+        IMPORT_C const TLiwGenericParam* FindFirst(
+            TInt& aIndex, 
+            LIW::TGenericParamId aSemanticId,
+            LIW::TVariantTypeId aDataType = LIW::EVariantTypeAny) const;
+        /**
+        * Returns the next item matching the given semantic ID.
+        * 
+        * @param aIndex Position after which to start searching. On return it contains 
+        *               the position of the found parameter. It is set to KErrNotFound, 
+        *               if no matching items were found.
+        * @param aSemanticId The semantic ID of the parameter.
+        * @param aDataType The type id of data. Default is any type. 
+        * @return The next matching item.       
+        */
+        IMPORT_C const TLiwGenericParam* FindNext(
+            TInt& aIndex, 
+            LIW::TGenericParamId aSemanticId,
+            LIW::TVariantTypeId aDataType = LIW::EVariantTypeAny) const;
+        
+        /**
+		* Returns item matching the given name.
+        *
+        * @param aIndex Position in which to start searching, on return contains 
+        *               position of the found parameter. Is set to KErrNotFound, 
+        *               if no matching items were found.
+        * @param aName Parameter name.
+        * @param aDataType The type id of data. Default is any type.
+        * @return The first matching item.
+        */
+        IMPORT_C const TLiwGenericParam* FindFirst(
+            TInt& aIndex, 
+            const TDesC8& aName,
+            LIW::TVariantTypeId aDataType = LIW::EVariantTypeAny) const;
+            
+        /**
+        * Returns item matching the given name.
+        *
+        * @param aIndex Position in which to start searching, on return contains 
+        *               position of the found parameter. Is set to KErrNotFound, 
+        *               if no matching items were found.
+        * @param aName Parameter name.
+        * @param aDataType The type id of data. Default is any type.
+        * @return The first matching item.
+        */
+        IMPORT_C const TLiwGenericParam* FindNext(
+            TInt& aIndex, 
+            const TDesC8& aName,
+            LIW::TVariantTypeId aDataType = LIW::EVariantTypeAny) const;
+
+        /**
+        * Externalizes this parameter list to a stream.
+        *
+        * @param aStream The stream. 
+        * @see NewL(RReadStream& aStream)
+        * @see NewLC(RReadStream& aStream)
+        */
+        IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
+
+        /**
+        * Returns the externalized size of the parameter list in bytes.
+        *
+        * @return The size.
+        */
+        IMPORT_C TInt Size() const;
+
+        /**
+        * Internalizes the parameter list from a stream.
+        *
+        * @since Series60 2.8
+        * @param aStream The stream.
+        */
+        IMPORT_C void InternalizeL(RReadStream& aStream);
+
+        /**
+        * Packs the parameter list to TIpcArgs structure for
+        * passing the generic param list to server over process boundary.
+        * Only one RFile handle parameter can be passed over process boundary.
+        *
+        * @since Series60 3.0
+        * @param aArgs Inter process call arguments.
+        * @return Packed parameter list.
+        */
+        IMPORT_C HBufC8* PackForServerL(TIpcArgs& aArgs);
+
+        /**
+        * Unpacks the list from client message structure.
+        *
+        * @since Series60 3.0
+        * @param aArgs The list to be unpacked. 
+        */
+        IMPORT_C void UnpackFromClientL(const RMessage2& aArgs);
+        
+    private:  // Implementation
+        CLiwGenericParamList();
+        void ConstructL();
+        void AppendL(RReadStream& aReadStream);
+        
+    private:  // Data
+        /// Own: the parameter list
+        RArray<TLiwGenericParam> iParameters;
+        friend class CLiwDefaultList;  
+        friend class CLiwDefaultMap;   
+     };
+
+
+// INLINE FUNCTIONS
+#include "liwgenericparam.inl"
+
+#endif // LIW_GENERIC_PARAM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwgenericparam.hrh	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,303 @@
+/*
+* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       LIW generic parameter definitions.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_GENERIC_PARAM_HRH
+#define LIW_GENERIC_PARAM_HRH
+namespace LIW
+{
+
+/**
+ * Pre-defined sematic IDs for generic parameters (TLiwGenericParam).
+ * The data type of the parameter specifies the representation of the parameter.
+ * Use TGenericParamId instead of using TGenericParamIdValue directly.
+ * Additional generic param definitions are possible besides this list.
+ * @see TLiwGenericParam.
+ */   
+enum TGenericParamIdValue 
+    {
+    EGenericParamUnspecified = 0,
+
+    // General parameters
+    EGenericParamError          = 1,  // Any error parameter
+    EGenericParamDir            = 2,  // Any directory  
+    EGenericParamFile           = 3,  // Any file
+    EGenericParamURL            = 4,  // Any URL
+    EGenericParamApplication    = 5,  // Application
+    EGenericParamInstallPackage = 6,  // Install package
+    EGenericParamDRMFile        = 7,
+    EGenericParamMIMEType       = 8,
+    EGenericParamCharSet        = 9,
+
+    // NOTE: Next id is a special semantic id reserved for LIW framework. 
+    // A consumer application should never add it to parameter list.
+    EGenericParamServiceCommand = 10,
+
+    // NOTE: Next id is to be used only internally by DocumentHandler.
+    // Do not not use it for anything else.
+    EGenericParamInternalFile = 11, 
+
+
+    EGenericParamNameAsString = 12,
+    EGenericParamNameAsStringTransient = 13,
+
+    // Application services
+    EGenericParamContactItem   = 20,
+    EGenericParamCalendarItem  = 21,
+    EGenericParamMessageItem   = 22,  
+    EGenericParamNoteItem      = 23,
+    EGenericParamHelpItem      = 24,
+    EGenericParamAlarmItem     = 25,
+    EGenericParamLogItem       = 26,
+    EGenericParamPhoneNumber   = 27,
+    EGenericParamAccessPoint   = 28,
+    EGenericParamSIPAddress    = 29,
+
+    EGenericParamMessageItemSMS   = 30,
+    EGenericParamMessageItemEMail = 31,
+    EGenericParamMessageItemMMS   = 32,
+    
+    EGenericParamEmailAddress = 33, 
+    EGenericParamWVID         = 34,
+    EGenericParamDateTime     = 35,
+    
+    EGenericParamMessageItemMbox = 36,  
+
+    // SIM items
+    EGenericParamSIMContactItem  = 40,
+    EGenericParamSIMAppItem      = 41,
+
+    // Browser items
+    EGenericParamReferringURI = 50,    
+
+    // Music Player items
+    EGenericParamPlayerInitMode = 60,
+    EGenericParamAlbumItems     = 61,
+    EGenericParamAlbumName      = 62,
+
+    // Print parameters
+    EGenericParamPrintXMLFile = 70,
+
+    // Call parameters
+	//EGenericParamCallDialDataV1 = 80,  //    CR JKON-6ZNGMS
+    EGenericParamCallDialData   = 81,
+
+    // Sprint media gallery provider specific
+    EGenricParamMGItemType                 = 90, 
+    EGeneriParamMGMediaType                = 91,
+    EGeneriParamMGViewType                 = 92,
+    EGenericParamMGSubviewtype             = 93,
+    EGenericParamMGMarked                  = 94,
+    EGenericParamCdmaExtendedAMSData       = 95,
+    EGenericParamCdmaExtendedLightSurfData = 96,
+
+    EGenericParamSilentDownload  = 110,
+    EGenericParamSuppressLaunch  = 111,
+    EGenericParamSuppressNextUrl = 112,
+
+    EGenericParamPoCData       = 120,
+    EGenericParamPoCLaunchView = 121,
+
+    EGenericParamAllowMove = 130,
+    EGenericParamAllowSave = 131, 
+    
+    EGenericParamFileSaved = 140,
+    
+    EGenericParamLocation = 150,
+    
+    EGenericParamFotaPkgId = 160,
+    
+    EGenericParamMMSSizeLimit = 170,
+    EGenericParamResolution   = 171,
+    
+    EGenericParamSuppressDownloadConfirmation = 180,
+    EGenericParamDownloadId                   = 181,
+    
+    EGenericParamPassword     = 190,
+    EGenericParamUserName     = 191,
+    EGenericParamBookmarkName = 192,
+    
+    EGenericParamContactSelectionData = 200,
+    EGenericParamContactLinkArray     = 201,
+    EGenericParamContactStoreUriArray = 202,
+    EGenericParamSelectedCount        = 203,
+    EGenericParamContactAssignData    = 204,
+    
+    EGenericParamLandmark             = 210,
+    EGenericParamLandmarkDatabase     = 211,
+    EGenericParamLandmarkId           = 212,
+    EGenericParamLandmarkIdList       = 213,
+    EGenericParamMnCommonOptions      = 214,
+    EGenericParamMnMapViewOptions     = 215,
+    EGenericParamMnGeocodingOptions   = 216,
+    EGenericParamRequestText          = 217,
+    
+    // Enterprise telephony parameters
+    EGenericParamModeActivation       = 220,
+    EGenericParamDisplayString        = 221,
+    
+    EGenericParamSpeedDialIndex       = 230,
+    
+    // In-device search parameters
+    EGenericParamKeywords             = 240,
+    EGenericParamCallAppLocName       = 241,
+    EGenericParamStartOption          = 242,
+    EGenericParamSearchContent        = 243,
+    
+    EGenericParamTerminate            = 250,
+    
+    //For Image viewer slideshow support
+    EGenericParamSlideshow			  = 251,
+    
+    //For Search functionality
+    EGenericParamSearchDomain		  = 260,
+    EGenericParamSearchSubject		  = 261,
+    EGenericParamSearchProvider		  = 262,
+    EGenericParamSearchOptions		  = 263,   
+    EGenericParamTransactionID		  = 264
+
+    };
+
+
+// String constants for above sematic ids to be used in content matching.
+
+#define EGenericParamUnspecifiedStr    "0"
+#define EGenericParamErrorStr          "1"
+#define EGenericParamDirStr            "2"
+#define EGenericParamFileStr           "3"
+#define EGenericParamURLStr            "4"
+#define EGenericParamApplicationStr    "5"
+#define EGenericParamInstallPackageStr "6"
+#define EGenericParamDRMFileStr        "7"
+#define EGenericParamMIMETypeStr       "8"
+#define EGenericParamCharSetStr        "9"
+#define EGenericParamServiceCommandStr "10"
+#define EGenericParamInternalFileStr   "11"
+#define EGenericParamNameAsStringStr   "12" 
+
+#define EGenericParamContactItemStr    "20"
+#define EGenericParamCalendarItemStr   "21"
+#define EGenericParamMessageItemStr    "22"
+#define EGenericParamNoteItemStr       "23"
+#define EGenericParamHelpItemStr       "24"
+#define EGenericParamAlarmItemStr      "25"
+#define EGenericParamLogItemStr        "26"
+#define EGenericParamPhoneNumberStr    "27"
+#define EGenericParamAccessPointStr    "28"
+#define EGenericParamSIPAddressStr     "29"
+
+#define EGenericParamMessageItemSMSStr   "30"
+#define EGenericParamMessageItemEMailStr "31"
+#define EGenericParamMessageItemMMSStr   "32"
+
+#define EGenericParamEmailAddressStr    "33"
+#define EGenericParamWVIDStr            "34"
+#define EGenericParamDateTimeStr        "35"
+
+#define EGenericParamMessageItemMboxStr "36"
+
+#define EGenericParamSIMContactItemStr "40"
+#define EGenericParamSIMAppItemStr     "41"
+
+#define EGenericParamReferringURIStr   "50"    
+
+#define EGenericParamPlayerInitModeStr "60"
+#define EGenericParamAlbumItemsStr     "61"
+#define EGenericParamAlbumNameStr      "62"
+
+#define EGenericParamPrintXMLFileStr   "70"
+
+#define EGenericParamCallDialDataV1Str "80"
+#define EGenericParamCallDialDataStr   "81"
+
+#define EGenricParamMGItemTypeStr                 "90" 
+#define EGeneriParamMGMediaTypeStr                "91"
+#define EGeneriParamMGViewTypeStr                 "92"
+#define EGenericParamMGSubviewtypeStr             "93"
+#define EGenericParamMGMarkedStr                  "94"
+#define EGenericParamCdmaExtendedAMSDataStr       "95"
+#define EGenericParamCdmaExtendedLightSurfDataStr "96"
+
+#define EGenericParamSilentDownloadStr  "110"
+#define EGenericParamSuppressLaunchStr  "111"
+#define EGenericParamSuppressNextUrlStr "112"
+
+#define EGenericParamPoCDataStr       "120"
+#define EGenericParamPoCLaunchViewStr "121"    
+
+#define EGenericParamAllowMoveStr      "130"
+#define EGenericParamAllowSaveStr      "131"
+
+#define EGenericParamFileSavedStr      "140"
+
+#define EGenericParamLocationStr       "150"
+
+#define EGenericParamFotaPkgIdStr      "160"
+
+#define EGenericParamMMSSizeLimitStr   "170"
+#define EGenericParamResolutionStr     "171"
+
+#define EGenericParamSuppressDownloadConfirmationStr "180"
+#define EGenericParamDownloadIdStr                   "181" 
+     
+#define EGenericParamPasswordStr       "190"
+#define EGenericParamUserNameStr       "191"
+#define EGenericParamBookmarkNameStr   "192"    
+
+#define EGenericParamContactSelectionDataStr    "200"
+#define EGenericParamContactLinkArrayStr        "201"
+#define EGenericParamContactStoreUriArrayStr    "202"
+#define EGenericParamSelectedCountStr           "203"
+#define EGenericParamContactAssignDataStr       "204"
+
+#define EGenericParamLandmarkStr                "210"
+#define EGenericParamLandmarkDatabaseStr        "211"
+#define EGenericParamLandmarkIdStr              "212"
+#define EGenericParamLandmarkIdListStr          "213"
+#define EGenericParamMnCommonOptionsStr         "214"
+#define EGenericParamMnMapViewOptionsStr        "215"
+#define EGenericParamMnGeocodingOptionsStr      "216"
+#define EGenericParamRequestTextStr             "217"
+
+#define EGenericParamModeActivationStr          "220"
+#define EGenericParamDisplayStringStr           "221"
+
+#define EGenericParamSpeedDialIndexStr          "230"
+
+#define EGenericParamKeywordsStr                "240"
+#define EGenericParamCallAppLocNameStr          "241"
+#define EGenericParamStartOptionStr             "242"
+#define EGenericParamSearchContentStr           "243"
+
+#define EGenericParamTerminateStr               "250"
+#define EGenericParamSlideshowStr               "251"
+
+#define EGenericParamSearchDomainStr            "260"
+#define EGenericParamSearchSubjectStr			"261"
+#define EGenericParamSearchProviderStr			"262"
+#define EGenericParamSearchOptionsStr			"263"
+#define EGenericParamTransactionIDStr           "264"
+}        
+#endif // LIW_GENERIC_PARAM_HRH
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwgenericparam.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Inline function implementations of class TLiwGenericParam.
+*
+*/
+
+
+
+
+
+
+
+inline TLiwGenericParam::TLiwGenericParam() :
+    iSemanticId(LIW::EGenericParamUnspecified), iValue(), iReserved(NULL)
+    {
+    }
+
+inline TLiwGenericParam::TLiwGenericParam(LIW::TGenericParamId aSemanticId) :
+    iSemanticId(aSemanticId), iValue(), iReserved(NULL)
+    {
+    }
+
+inline TLiwGenericParam::TLiwGenericParam(LIW::TGenericParamId aSemanticId, 
+    const TLiwVariant& aValue) : 
+    iSemanticId(aSemanticId), iValue(aValue), iReserved(NULL)
+    {
+    }
+
+
+inline TLiwGenericParam::TLiwGenericParam(const TDesC8& aName, const TLiwVariant& aValue)
+    {
+    iSemanticId = LIW::EGenericParamNameAsStringTransient;
+    iReserved = (TAny*)&aName;
+    iValue = aValue;
+    }
+
+inline void TLiwGenericParam::SetSemanticId(LIW::TGenericParamId aSemanticId)
+    {
+    iSemanticId = aSemanticId;
+    }
+
+inline void TLiwGenericParam::SetNameL(const TDesC8& aName)
+    {
+    iSemanticId = LIW::EGenericParamNameAsString;
+    delete iReserved;
+    iReserved = (TAny*)aName.AllocL();
+    }
+
+inline void TLiwGenericParam::SetNameAndValueL(const TDesC8& aName, const TLiwVariant& aValue)
+    {
+    delete iReserved;
+    iValue.Reset();
+    iSemanticId = LIW::EGenericParamNameAsString;
+    iReserved = (TAny*)aName.AllocL();
+    iValue = aValue;
+    }
+
+inline LIW::TGenericParamId TLiwGenericParam::SemanticId() const
+    {
+    return iSemanticId;
+    }
+
+inline const TDesC8& TLiwGenericParam::Name() const
+    {
+    if (iSemanticId == LIW::EGenericParamNameAsStringTransient)
+       return *((TDesC8*)iReserved);
+    else
+       return ((iReserved) ? *((HBufC8*)iReserved) : KNullDesC8());
+    }
+
+inline TLiwVariant& TLiwGenericParam::Value()
+    {
+    return iValue;
+    }
+
+inline const TLiwVariant& TLiwGenericParam::Value() const
+    {
+    return iValue;
+    }
+
+inline void TLiwGenericParam::Reset()
+    {
+    if (iSemanticId != LIW::EGenericParamNameAsStringTransient) delete iReserved;
+    iReserved = NULL;
+    iSemanticId = LIW::EGenericParamUnspecified;
+    iValue.Reset();
+    }
+
+inline TBool operator!=(const TLiwGenericParam& aLhs, 
+    const TLiwGenericParam& aRhs)
+    {
+    return !(aLhs == aRhs);
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwvariant.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,2029 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Variant data type for LIW generic parameters.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_VARIANT_H
+#define LIW_VARIANT_H
+
+// INCLUDES
+#include <e32std.h>
+#include <s32strm.h>
+#include <f32file.h>
+#include "liwvarianttype.hrh"
+
+// FORWARD DECLARATIONS
+
+class CLiwGenericParamList;
+class MLiwNotifyCallback;
+
+// New variant types
+class CLiwContainer;
+class CLiwIterable;
+class CLiwList;
+class CLiwMap;
+class MLiwInterface;
+class CLiwBuffer;
+
+
+// CLASS DECLARATION
+
+/**
+* Variant data class to hold a value of a TLiwGenericParam instance.
+* The variant contains a data type and a value. This class is attached to
+* TLiwGenericParam instance which holds the semantic type of the value.
+*
+* @lib ServiceHandler.lib
+* @since Series 60 2.6
+* @see TLiwGenericParam
+*/
+class TLiwVariant
+    {
+    public:  // Constructors
+        /**
+        * Default constructor. Initializes this variant to be empty.
+        *
+        * @post IsEmpty()
+        */
+        inline TLiwVariant();
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */
+        inline TLiwVariant(TInt32 aValue);
+        
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */
+        inline TLiwVariant(TInt64 aValue);
+        
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */
+        inline TLiwVariant(TUint aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */
+        inline TLiwVariant(TBool aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const TUid& aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const TTime& aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const TDesC& aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const HBufC* aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const TDesC8& aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const RFile& aValue);
+
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const CLiwList* aValue);
+
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const CLiwMap* aValue);
+
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const MLiwInterface* aValue);
+
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */        
+        inline TLiwVariant(const CLiwIterable* aValue);
+
+		/**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */
+        inline TLiwVariant(TReal aValue);
+        
+        /**
+        * Constructor from a value.
+        *
+        * @param aValue The value to set for this variant object.
+        */
+        inline TLiwVariant(const CLiwBuffer* aValue);
+        
+        /**
+        * Copy constructor. Does not take ownership of data.
+        *
+        * @param aSrc The source object.
+        */
+        IMPORT_C TLiwVariant(const TLiwVariant& aSrc);
+                
+        /**
+        * Assignment operator. Does not take ownership of data.
+        *
+        * @param aValue The source object.
+        */
+        IMPORT_C TLiwVariant& TLiwVariant::operator=(const TLiwVariant& aValue);
+
+        // This class does not need a destructor because memory allocation
+        // policy for variant class has been implemented by TLiwGenericParam
+        // class.
+
+    public:  // Interface
+        /**
+        * Returns the type id of data this variant object is holding.
+        */
+        inline LIW::TVariantTypeId TypeId() const;
+
+        /**
+        * Returns ETrue if this variant is empty (it does not hold any value).
+        */
+        inline TBool IsEmpty() const;
+
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */
+        IMPORT_C TBool Get(TInt32& aValue) const;
+        
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */
+        IMPORT_C TBool Get(TInt64& aValue) const;
+        
+		/**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(TUid& aValue)   const;
+
+        /**
+        * Retrieves the boolean value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */
+        
+        IMPORT_C TBool Get(TUint& aValue) const;
+        /**
+        * Retrieves the boolean value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */
+        IMPORT_C TBool Get(TBool& aValue) const;
+        
+        
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(TPtrC& aValue)  const;
+
+        //needed at least temporarily for data binding integration...
+        //inline TBool Get(const TPtrC** aValue)  const;
+          
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(TTime& aValue)  const;
+        
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(TPtrC8& aValue) const;
+        
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(RFile& aValue) const;
+
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(CLiwList& aValue) const;
+        
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */        
+        IMPORT_C TBool Get(CLiwMap& aValue) const;
+
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */
+        IMPORT_C TInt32 AsTInt32() const;
+
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */
+        IMPORT_C TInt64 AsTInt64() const;
+
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */
+        IMPORT_C TBool AsTBool() const;
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */
+        IMPORT_C TBool AsTUint() const;
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */        
+        IMPORT_C TUid AsTUid() const;
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */        
+        IMPORT_C TPtrC AsDes() const;
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */        
+        IMPORT_C TTime AsTTime() const;
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */        
+        IMPORT_C TPtrC8 AsData() const; 
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */        
+        IMPORT_C RFile AsFileHandle() const;
+
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function default initialized data is returned.
+        */        
+        IMPORT_C const CLiwList* AsList() const;
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function default initialized data is returned.
+        */        
+        IMPORT_C const CLiwMap* AsMap() const;
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function default initialized data is returned.
+        */        
+        IMPORT_C MLiwInterface* AsInterface() const;
+        
+        /**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function default initialized data is returned.
+        */        
+        IMPORT_C CLiwIterable* AsIterable() const;
+
+        /**
+        * Deletes possibly set value and resets this variant to empty.
+        *
+        * @post IsEmpty()
+        */
+        IMPORT_C void Reset();
+
+        /**
+        * Sets integer value to this variant. The previous value is overwritten.
+        *
+        * @param aValue Value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(TInt32 aValue);
+        
+        /**
+        * Sets integer value to this variant. The previous value is overwritten.
+        *
+        * @param aValue Value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(TInt64 aValue);
+        
+        /**
+        * Sets Boolean value to this variant. The previous value is overwritten.
+        *
+        * @param aValue Value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(TBool aValue);
+        
+        /**
+        * Sets Boolean value to this variant. The previous value is overwritten.
+        *
+        * @param aValue Value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(TUint aValue);
+        /**
+        * Sets unique ID value to this variant. The previous value is overwritten.
+        *
+        * @param aValue Value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(const TUid& aValue);
+        
+        /**
+        * Sets date and time value to this variant. The previous value is overwritten.
+        *
+        * @param aValue Value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(const TTime& aValue);
+
+        /**
+        * Sets constant text reference to this variant. 
+        *
+        * @param aValue Text value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(const TDesC& aValue);
+
+        /**
+        * Sets constant text reference to this variant. 
+        *
+        * @param aValue Text value for this variant object to hold. 
+        *               Ownership is not taken.
+        */
+        inline void Set(const HBufC* aValue);
+
+        /**
+        * Sets constant 8-bit text reference to this variant.
+        * 
+        * @param aValue Text value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(const TDesC8& aValue);
+
+        /**
+        * Sets RFile file handle to this variant.
+        *
+        * @param aValue File handle for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void Set(const RFile& aValue);
+
+        /**
+        * Sets list of variants to this variant.
+        *
+        * @param aValue Array of variants for this variant object to hold.
+        * @postcond *this == aValue
+        */
+        IMPORT_C void Set(const CLiwList* aValue);
+
+        /**
+        * Sets map of variants to this variant.
+        *
+        * @param aValue Dictionary of variants for this variant object to hold.
+        * @postcond *this == aValue
+        */
+        IMPORT_C void Set(const CLiwMap* aValue);
+
+        /**
+        * Sets interface pointer to this variant.
+        *
+        * @param aValue Interface pointer for this variant object to hold.
+        * @postcond *this == aValue
+        */
+        IMPORT_C void Set(const MLiwInterface* aValue);
+
+        /**
+        * Sets list of variants to this variant.
+        *
+        * @param aValue Sequence of variants for this variant object to hold.
+        * @postcond *this == aValue
+        */
+        IMPORT_C void Set(const CLiwIterable* aValue);
+
+	    /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */ 
+		IMPORT_C TBool Get(TDes& aValue)  const;
+        
+        /**
+        * Sets the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */ 
+		IMPORT_C TBool Get(TDes8& aValue)  const;
+	    /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */
+        inline TLiwVariant& operator=(const TTime& aValue);
+
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(const TUid& aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(TInt32 aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(TInt64 aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(TBool aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(TUint aValue);
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(const TDesC& aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(const HBufC* aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(const TDesC8& aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source object.
+        */        
+        inline TLiwVariant& operator=(const RFile& aValue);
+
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source.
+        */        
+        inline TLiwVariant& operator=(const CLiwList* aValue);
+
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source.
+        */        
+        inline TLiwVariant& operator=(const CLiwMap* aValue);
+
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source.
+        */        
+        inline TLiwVariant& operator=(const MLiwInterface* aValue);
+        
+        /**
+        * Assignment operator for the variant.
+        *
+        * @param aValue The source.
+        */        
+        inline TLiwVariant& operator=(const CLiwIterable* aValue);
+        
+    public:
+        /**
+        * Data copying support for TLiwGenericParam.
+        * Sets the copy of given variant value to this variant
+        * @param aValue variant value for this variant object to hold.
+        * @post *this == aValue
+        */
+        IMPORT_C void SetL(const TLiwVariant& aValue);
+        /**
+        * Retrieves the value held by this variant.
+        *
+        * @param aValue If this variant's type does not match the
+        *               parameter type, the parameter will not be modified.
+        * @return ETrue if aValue was set, EFalse if types did not match.
+        */
+        IMPORT_C TBool Get(TReal& aValue) const;
+        
+        /**
+		* Sets integer value to this variant. The previous value is overwritten.
+		*
+		* @param aValue Value for this variant object to hold.
+		* @post *this == aValue
+		*/
+		IMPORT_C void Set(TReal aValue);	
+	
+		/**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */
+        IMPORT_C TReal AsTReal() const;
+
+		 /**
+		 * Assignment operator for the variant.
+		 *
+		 * @param aValue The source object.
+		 */        
+		 inline TLiwVariant& operator=(TReal aValue);
+		 
+		 /**
+		* Sets integer value to this variant. The previous value is overwritten.
+		*
+		* @param aValue Value for this variant object to hold.
+		* @post *this == aValue
+		*/
+		IMPORT_C void Set(const CLiwBuffer* aValue);	
+	
+		/**
+        * Returns the value held by this variant.
+        *
+        * @return The value held by this variant. If the data type does not
+        *         match the function, the default initialized data is returned.
+        */
+        IMPORT_C  CLiwBuffer* AsBuffer() const;
+
+		/**
+		* Assignment operator for the variant.
+		*
+		* @param aValue The source object.
+		*/        
+		inline TLiwVariant& operator=(const CLiwBuffer* aValue);
+		
+		/**
+        * TLiwVariant cleanup method
+        *
+        * !!!!!!!!!!!!!!!!!!!!!!!!!!!! 		IMPORTANT NOTE  	!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+	    * 
+	    * Variants can be pushed into the CleanupStack using this method
+	    * along with TCleanupItem
+	    *
+	    * @ param aObj - TLiwVariant Object but of type TAny* for usage with TCleanupItem
+	    * 
+	    * Example 1: Here the client explicitly pushes the variant into the CleanupStack using 
+	    *  TCleanupItem
+	    *
+	    * @code
+	    * 	 TLiwVariant var;
+		*    
+		*    //The below statement pushes the variant object "var" into the CleanupStack using TCleanupItem and VariantCleanup.
+		*    CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &var ) ); 
+    	* 	  
+		*    User::Leave(KErrGeneral);  //This calls the VariantCleanup method which cleans up TLiwVariant
+		*    CleanupStack::Pop(&var);	//These statements are not executed due to "Leave"
+		*    var.Reset(); 
+	    * @endcode 
+    	*  
+	    *  
+	    * Example 2: Here the client calls the PushL method of TLiwVariant which pushes the object into 
+	    *  the CleanupStack using TCleanupItem
+	    * 
+	    * @code
+	    *    TLiwVariant var;
+		*    var.PushL();				//This pushes the variant object "var" into the CleanupStack using TCleanupItem and VariantCleanup.
+		*    User::Leave(KErrGeneral);  //This calls the VariantCleanup method which cleans up TLiwVariant
+		*    CleanupStack::Pop(&var);	//These statements are not executed due to "Leave"
+		*    var.Reset(); 
+	    * @endcode 
+	    *
+	    * The clients can use the convenient PushL method which is recommended (as shown in e.g 2) rather than 
+	    *  explicitly pushing the variant object into the CleanupStack using TCleanupItem and VariantCleanup.
+    	* 
+	    * @ see PushL() method
+	    */
+        IMPORT_C static void VariantCleanup( TAny* aObj );
+		 
+		  
+		/**
+	    * A friendly and convenient method to push the TLiwVariant Object into the CleanupStack
+	    * 
+	    * !!!!!!!!!!!!!!!!!!!!!!!!!!!! 		IMPORTANT NOTE  	!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+	    *
+	    * This method informs the CleanupStack that VariantCleanup method should be called incase of 
+	    *  any Leave
+	    *
+	    * @code
+	    * 	 TLiwVariant var;
+		*    var.PushL();				//This pushes the variant object "var" into the CleanupStack using TCleanupItem and VariantCleanup.
+		*    User::Leave(KErrGeneral);  //This calls the VariantCleanup method which cleans up TLiwVariant
+		*    CleanupStack::Pop(&var);	//These statements are not executed
+		*    var.Reset(); 		
+	    * @endcode 
+    	*  
+	    * This method is recommended than explicitly pushing the parameter object into the CleanupStack 
+    	*  using TCleanupItem and VariantCleanup.
+    	*
+    	* @see VariantCleanup() method
+	    */
+	    IMPORT_C void PushL();
+        
+    private:
+        /**
+        * Streaming support for TLiwGenericParam.
+        * Internalizes this variant from a stream.
+        */
+        void InternalizeL(RReadStream& aStream);
+
+        /**
+        * Streaming support for TLiwGenericParam.
+        * Externalizes this variant to a stream.
+        */
+        void ExternalizeL(RWriteStream& aStream) const;
+
+        /**
+        * Streaming support for TLiwGenericParam.
+        * Returns the maximum externalized size of this variant in bytes.
+        */
+        TInt Size() const; 
+
+        /**
+        * Destroys any dynamic resource owned by this variant.
+        */
+        void Destroy();
+
+        /// Debug invariant
+        void __DbgTestInvariant() const;
+        
+        static void CleanupDestroy(TAny* aObj);
+        
+        operator TCleanupItem();
+        
+    private:  // Data
+        /// Type of the data this variant is holding
+        TUint8 iTypeId;
+
+        /// POD storage for a 64-bit integer
+        struct SInt64
+            {
+            TInt32 iLow;
+            TInt32 iHigh;
+            void InternalizeL(RReadStream& aStream);
+            void ExternalizeL(RWriteStream& aStream) const;
+            void Set(const TInt64& aTInt64);
+            operator TInt64() const;
+            TBool operator==(const SInt64& aRhs) const;
+            };
+
+        // Data value stored in this variant.
+        // One of these are effective at a time depending on the iTypeId
+        //
+        union UData
+            {
+            TInt32 iInt32;      // 32-bit integer
+			TInt64 iLong;      // 64-bit integer
+            SInt64 iInt64;      // 64-bit integer
+            HBufC* iBufC;       // owned string pointer 
+            HBufC8* iBufC8;     // owned 8-bit data pointer 
+            CLiwList* iList;    // List
+            CLiwMap* iMap;      // Map
+            MLiwInterface* iSession;     // Interface Type
+            CLiwIterable* iIterable;    // Iterator
+            CLiwBuffer* iBuffer;
+            TBool  iBool;      //boolean
+            TUint  iUint;      //Unsinged Integer
+            TReal  iReal;
+            };
+
+        UData  iData;  // Data union
+        TPtrC  iPtrC;  // Pointer to string
+        TPtrC8 iPtrC8; // Pointer to 8-bit data 
+
+    private:  // friend declarations
+        friend IMPORT_C TBool operator==(const TLiwVariant& aLhs, const TLiwVariant& aRhs);
+        /// TLiwGenericParam needs access to private streaming and copying methods.
+        friend class TLiwGenericParam;
+        friend class CLiwCriteriaItem;
+        
+    };
+
+//definitions of new variant types
+
+// CLASS DECLARATION
+/**
+* A type of variant class to execute a set of service command operations
+* on an interface. The service provider should implement MLiwInterface to group
+* set of related operations and offer them as service commands to the consumers.
+*
+* To maintain its internal state across the execution of service commands and 
+* enable invocation of operations directly on the interface, service providers
+* may offer an interface.
+*
+* @lib ServiceHandler.lib
+*
+* @see TLiwVariant
+*/
+class MLiwInterface
+{
+ public:
+ 
+  /**
+    * The consumer application should call this method to execute a service 
+    * command directly on the interface. The service provider should
+    * provide a concrete implementation for the supported service
+    * command aCmdName. The consumer application should fill in the necessary
+    * parameters in \em aInParamList. 
+    *
+    * @param aCmdName the name of the service command which the consumer wants to invoke
+    * @param aInParamList the input parameter list, can be empty list
+    * @param [in,out] aOutParamList the output parameter list, can be empty lis. The
+    * service provider can use the output parameter list to fill in necessary return values
+    * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
+    * @param aCallback callback to be registered by consumer application
+    *               
+    * 
+    *
+    * @see TLiwServiceCmdOptions
+    * @see CLiwGenericParamList
+    * @see MLiwNotifyCallback
+    *
+   */
+  virtual void ExecuteCmdL(const TDesC8& aCmdName,
+                           const CLiwGenericParamList& aInParamList,
+                           CLiwGenericParamList& aOutParamList,
+                           TUint aCmdOptions = 0,
+                           MLiwNotifyCallback* aCallback = 0) = 0;
+  
+  
+  /**
+    * The service provider should provide a concrete implementation
+    * for this method. The internal state of the service provider
+    * implemeting \c MLiwInterface can be reset within this method.
+    * The consumer application should call this method if there 
+    * are no more service commands to be executed on the interface.
+    * 
+    * 
+    *               
+    * <p align="center"></p>
+    *
+   */
+  virtual void Close() = 0;
+};
+
+/**
+* Base class for the framework supported container types.
+* \c CLiwContainer is a self managing, reference counted container.
+* This class offers minimal interface to manage the reference counter
+* and to serialize the container data into the stream.
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects
+*
+* All the container data types supported by the framework are
+* derived from \c CLiwContainer.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+* @see CLiwList
+* @see CLiwMap
+* @see CLiwIterable
+*/
+class CLiwContainer : public CBase
+{
+ public:
+ 
+  /**
+    * Serializes the collection entries to an output stream.
+    * The derving container types from \c CLiwContainer
+    * should provide a concrete implementation to serialize the collection
+    * data. The default implementation of this method just leaves with
+    * an error code \c KErrNotSupported.
+    * 
+    * @param aOutputStream the output stream to which the data will be streamed
+    *               
+    * @leave KErrNotSupported whenever this method is called instead
+    * of a dervied class implementation of this method
+    *
+    * @see RWiteStream
+    *
+   */
+  IMPORT_C virtual void ExternalizeL(RWriteStream& aOutputStream) const;
+  
+  /**
+    * Returns the size of collection data values. This default implementation of 
+    * this method leaves with an error code \c KErrNotSupported. Typically, the size
+    * is calculated based on the size of data type(s) the container holds and the total
+    * number of entries present in the collection.
+    *
+    * @return the size of collection data values
+    *               
+    * @leave KErrNotSupported whenever this method is called instead
+    * of derived class implementation of this method
+   */
+  IMPORT_C virtual TInt Size() const;
+  
+  /**
+    * Increments the container reference count by one. The reference
+    * count gets incremented whenever a copy of the data values
+    * is made.
+    *
+    */
+  inline void IncRef();
+  
+  /**
+    * Decrements the container reference count by one. If there
+    * are no more references to the container type, this container
+    * instance will be deleted.
+    *
+    */
+  inline void DecRef();
+  
+  /**
+    * !!!!!!!!!!!!!!!!!!!!!!!!!!!! 		IMPORTANT NOTE  	!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+	*
+    * Since reference counting does not work with CleanupStack directly, 
+    * CleanupStack::PushL cannot be used for container objects which are reference counted
+    * 
+    * So CleanupClosePushL method is used for container objects. Hence the need for this method
+    * 
+    * This method informs the CleanupStack that Close method should be called incase of any Leave
+    * 
+    * Close() inturn calls DecRef which ensures proper cleanup of container objects
+    *
+    *
+    * Example 1: //Using PushL to push the container object into the CleanupStack using CleanupClosePushL
+    * 
+    * @code
+    *	CLiwMap* map = CLiwDefaultMap::NewL();
+    * 	map->PushL();
+    * 	map->InsertL(KNullDesC8,variant);	//incase of any leave, CLiwContainer::Close is called
+    * 	CleanupStack::PopAndDestroy(map);	//CLiwContainer::Close() is called
+    * @endcode 
+    *
+    * Example 2: //Using NewLC to push the container object into the CleanupStack using CleanupClosePushL
+    * 
+    * @code
+    *	CLiwMap* map = CLiwDefaultMap::NewLC();
+    * 	map->InsertL(KNullDesC8,variant);	//incase of any leave, CLiwContainer::Close is called
+    * 	CleanupStack::PopAndDestroy(map);   //CLiwContainer::Close() is called
+    * @endcode
+    *
+    * @ see CLiwContainer::NewLC (pushes the container object using CleanupClosePushL)
+    * @ see CLiwContainer::PushL (pushes the container object using CleanupClosePushL)
+    */
+  IMPORT_C void Close(); 
+  
+  /**
+    * !!!!!!!!!!!!!!!!!!!!!!!!!!!! 		IMPORTANT NOTE  	!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
+	*
+	* A Friendly method to push the CLiwContainer Object into the CleanupStack using CleanupClosePushL
+    * 
+    * This method informs the CleanupStack that Close method should be called incase of any Leave
+    *
+    * @code
+    * 	CLiwMap* map = CLiwDefaultMap::NewL();
+    * 	map->PushL();
+    * 	map->InsertL(KNullDesC8,variant);	//incase of any leave, CLiwContainer::Close is called
+    * 	CleanupStack::PopAndDestroy(map);	//CLiwContainer::Close() is called
+    * @endcode
+    *
+    * @ see CLiwContainer::Close
+    */
+  IMPORT_C void PushL();
+  
+ protected:
+   
+   /**
+    * Protected default constructor. This method is available
+    * only for the derived container types. The reference
+    * count is set to its default vale.
+    * 
+    */
+  CLiwContainer() : iRefCount(1) {}
+  
+  /**
+    * Destructor.
+    *
+    */
+  IMPORT_C virtual ~CLiwContainer();
+
+ private:
+ 
+  /* Reference counter of the container datatype.
+   * During the construction, the counter is set to its
+   * default value of 1. When the counter reaches the value
+   * of zero (meaning that there are no more references to
+   * the container data type), the container instance is deleted.   
+   */
+  TInt iRefCount;
+};
+
+/**
+* Abstract interface to iterate over the collection entries.
+* The service provider should provide a concrete implementation 
+* for the iterator.
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects
+*
+* This implies that the object of this concrete implementation class being created should be pushed into the 
+* CleanupStack using CLiwContainer::PushL.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer
+* 
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+*/
+class CLiwIterable : public CLiwContainer
+{
+ public:
+ 
+ /**
+    * Resets the iterator. The service provider should provide a concrete
+    * implementation to reset the iterator.
+    *
+   */
+  virtual void Reset() = 0;
+  
+  /**
+    * Iterates over the collection entries to fetch the next data element.
+    * The service provider should provide a concrete implementation
+    * for this method.
+    *
+    * @param aEntry contains the next data element and its corresponding data type
+    *
+    * @return false if there are no more data elements to be fetched;
+    * true otherwise
+    * 
+   */
+  virtual TBool NextL(TLiwVariant& aEntry) = 0;
+  
+  /**
+    * Default equality operator implementation
+    * 
+    * @param aIterable the iterator instance to be compared
+    * 
+   */
+  IMPORT_C virtual TBool operator==(CLiwIterable& aIterable);
+};
+
+/**
+* Abstract interface for an ordered collection or sequence. Typically, 
+* the collection entries are of type \c TLiwVariant instances. 
+* \c CLiwList offers abstract methods to:
+*  <ul>
+*     <li>access elements based on an index</li>
+*     <li>remove an element from the collection</li>
+*     <li>append to an element to the collection</li>
+*     <li>remove a key-value pair based on a key</li>
+*		 <li>get the total number of stored key-value pairs</li>
+*   </ul>
+* A default concrete implementation is provided in the form of specialized class 
+* \c CLiwDefaultList
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects.
+* 
+* This implies that the object of this concrete implementation class being created should be pushed into the 
+* CleanupStack using CLiwContainer::PushL.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer
+* 
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+* @see CLiwDefaultList
+*
+*/
+class CLiwList : public CLiwContainer
+{
+ public:
+ 
+   /**
+    * Appends an entry to the end of the collection. This is an abstract
+    * method.
+    *  
+    * @param aEntry an Element to be added to the end of the collection
+    *
+    * @see CLiwDefaultList::AppendL
+   */
+  virtual void AppendL(const TLiwVariant& aEntry) = 0;
+  
+  /**
+    * Gets an entry from the collection based on an integeral index.
+    *  
+    * @param aIndex an index to get an entry from the collection
+    * @param aEntry the returned element from the collection
+    *
+    * !!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    *
+    * This is a copy of the value present in the list at the particular index. To ensure proper cleanup 
+    * TLiwVariant::PushL method should be called beforehand.
+	*
+    * @return false if no element is found at the passed index;
+    * true if an element is found 
+    * 
+    * @see CLiwDefaultList::AtL
+    * @see TLiwVariant::PushL
+   */
+  virtual TBool AtL(TInt aIndex, TLiwVariant& aEntry) const = 0;
+  
+  /**
+    * Returns the number of elements present in the collection. This
+    * is an abstract method.
+    *  
+    * @return the number of elements; Zero if there are no elements stored
+    * 
+    * @see CLiwDefaultList::Count
+   */
+  virtual TInt Count() const = 0;
+  
+  /**
+    * Removes an element located at the passed index from the collection. This
+    * is an abstract method.
+    *  
+    * @param aIndex the index of the element to be removed from the collection
+    *
+    * @see CLiwDefaultList::Remove
+   */
+  virtual void Remove(TInt aIndex) = 0;
+  
+  /**
+    * Equality operator implementation for collection container.
+    *  
+    * @param aList the list container to be compared
+    *
+    * @return true if the compared list collections are the same; false otherwise
+    * 
+    * @see CLiwDefaultList::operator==
+   */
+  IMPORT_C virtual TBool operator==(const CLiwList& aList) const;
+};
+
+/**
+* Abstract interface for an associative array. The collection
+* key entries are of type string (Descriptor type) and their  
+* associated values can be an variant type (\c TLiwVariant). 
+*
+*  \c CLiwMap offers abstract methods to:
+*  <ul>
+*     <li>insert a key-value pair</li>
+*     <li>find a stored value based on a key</li>
+*     <li>get a key based on an index</li>
+*     <li>remove a key-value pair based on a key</li>
+*		 <li>get the total number of stored key-value pairs</li>
+*   </ul>
+* 
+* A default concrete implementation is provided in the form of specialized class 
+* \c CLiwDefaultMap
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects.
+* 
+* This implies that the object of this concrete implementation class being created should be pushed into the 
+* CleanupStack using CLiwContainer::PushL.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer
+* 
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+* @see TLiwVariant
+* @see CLiwDefaultMap
+*
+*/
+class CLiwMap : public CLiwContainer
+{
+ public:
+ 
+ /**
+    * Inserts a key-value pair element to the map collection. A default
+    * implementation is provided in \c CLiwDefaultMap.
+    *  
+    * @param aKey the key to be stored
+    * @param aValue the value associated with the key to be stored
+    *
+    * @see CLiwDefaultMap::InsertL
+   */
+  virtual void InsertL(const TDesC8& aKey, const TLiwVariant& aValue) = 0;
+ 
+  /**
+    * Finds a value stored in the map collection based on the key. A default
+    * implementation is provided in \c CLiwDefaultMap.
+    *  
+    * @param aKey the key to be searched
+    * @param aFndValue the value associated with the found key
+    *
+    * !!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    *
+    * This is a copy of the value present in the map for the particular key. To ensure proper cleanup 
+    * TLiwVariant::PushL method should be called beforehand.
+	*
+    * @return false if there is no key stored; true otherwise
+    *
+    * @see CLiwDefaultMap::FindL
+    * @see TLiwVariant::PushL
+   */
+  virtual TBool FindL(const TDesC8& aKey, TLiwVariant& aFndValue) const = 0;
+  
+  /**
+    * Returns the number of key-value pair stored in the map collection. A default
+    * implementation is provided in \c CLiwDefaultMap.
+    *  
+    * @return the number of key-value pair stored in the map collection
+    *
+    * @see CLiwDefaultMap::Count
+   */
+  virtual TInt Count() const = 0;
+  
+  /**
+    * Returns the key stored at the passed index. A default
+    * implementation is provided in \c CLiwDefaultMap.
+    *  
+    * @param aIndex the index of the key to be found
+    * @param aFndKey the key found at the passed index
+    *
+    * @return true if a key-value entry is found at the passed index;
+    * false otherwise
+    *
+    * @see CLiwDefaultMap::AtL
+    * 
+   */
+  virtual TBool AtL(TInt aIndex, TDes8& aFndKey) const = 0;
+  
+  /**
+    * Returns the key stored at the passed index. A default
+    * implementation is provided in \c CLiwDefaultMap.
+    *  
+    * @param aIndex the index of the key to be found
+    *
+    * @return the key if a key-value entry is found at the passed index;
+    * Leaves otherwise
+    *
+    * @see CLiwDefaultMap::AtL
+    * 
+   */
+  // virtual const TDesC8& AtL(TInt aIndex) const = 0;
+  
+  /**
+    * Removes a key from the map collection. A default
+    * implementation is provided in \c CLiwDefaultMap.
+    *  
+    * @param aKey the key to be removed from the map
+    *
+    * @see CLiwDefaultMap::Remove
+   */
+  virtual void Remove(const TDesC8& aKey) = 0;
+  
+  /**
+    * Default implementation of equality operator.
+    *  
+    * @param aMap the map to be compared
+    *
+    * @see CLiwDefaultMap::operator==
+    * 
+   */
+  IMPORT_C virtual TBool operator==(const CLiwMap& aMap) const;
+};
+
+/**
+* An ordered collection or sequence. \c CLiwDefaultList providers
+* a default implementation for \c CLiwList. The collection entries are typically 
+* of type \c TLiwVarian. 
+*
+*  This class provides concrete implementation to:
+*  <ul>
+*     <li>access elements based on index</li>
+*     <li>remove an element</li>
+*     <li>append an element to the end of the list collection</li>
+*		 <li>get the total number of elements stored in the list collection</li>
+*   </ul>
+*
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects.
+* 
+* This implies that the object of this concrete implementation class being created should be pushed into the 
+* CleanupStack using CLiwContainer::PushL.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer
+* 
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+* @see CLiwList
+* @see TLiwVariant
+*
+*/
+class CLiwDefaultList : public CLiwList
+{
+ public:
+  
+  /**
+    * Creates and returns a new instace of \c CLiwDefaultList
+    *
+  	* @code
+    * void CreateListL()
+    * {
+    * 	CLiwDefaultList* pList = CLiwDefaultList::NewL();
+    *   pList->PushL();	//pushes the List into cleanupstack using CleanupClosePushL
+	* 	
+	*	CleanupStack::Pop(pList);
+	*	pList->DecRef();
+	* }			
+    *
+    * @endcode 
+    *
+   	* @return an instance of \c CLiwDefaultMap
+   	* 
+   	* @ see PushL
+   	* @ see Close
+   	*/
+  	IMPORT_C static CLiwDefaultList* NewL();
+  
+  /**
+    * Creates and returns a new instace of \c CLiwDefaultList
+    *
+  	* @code
+    * void CreateListL()
+    * {
+    * 	CLiwDefaultList* pList = CLiwDefaultList::NewLC(); //pushes the List into cleanupstack using CleanupClosePushL
+    *   
+	*	CleanupStack::Pop(pList);
+	*	pList->DecRef();
+	* }			
+    *
+    * @endcode 
+    *
+   	* @return an instance of \c CLiwDefaultMap
+   	* 
+   	* @ see PushL
+   	* @ see Close
+   	*/
+  	IMPORT_C static CLiwDefaultList* NewLC();
+  
+  /**
+    * Creates and returns a new instace of \c CLiwDefaultList. The
+    * collection elements will be generated from the data
+    * values read from the input stream. This method leaves 
+    * the created instance in the cleanup stack.
+    *
+    * @param aInputStream the input stream containing the data
+    * values to append to the list collection
+    *
+    * @return an instance of \c CLiwDefaultList     
+   */
+  static CLiwDefaultList* NewLC(RReadStream& aInputStream);
+  
+  /**
+    * Appends an entry to the end of the collection. The entry to be
+    * added is of type \c TLiwVariant.
+    *  
+    * @param aEntry an Element to be added to the end of the collection
+    *
+    * 
+    * A string content being added to the end of the collection
+    *
+    * @code
+    * _LIT8(KLitPbkService,"PhoneBookService");
+    * CLiwDefaultList* pList = CLiwDefaultList::NewL();
+    * pList->PushL();
+    * pList->AppendL(TLiwVariant(KLitPbkService));
+    * CleanupStack::Pop(pList);
+    * pList->DecRef();
+    * @endcode
+    *
+    * An integer value being added to the end of the collection
+    *
+    * @code
+    * CLiwDefaultList* pList = CLiwDefaultList::NewL();
+    * pList->PushL();
+    * TInt intVal=0; 
+    * pList->AppendL(TLiwVariant(intVal));
+    * CleanupStack::Pop(pList);
+    * pList->DecRef();
+    * @endcode
+    * 
+    */
+  IMPORT_C void AppendL(const TLiwVariant& aEntry);
+  
+  /**
+    * Gets an entry from the collection based on an integeral index.
+    *  
+    * @param aIndex to get an entry from the collection
+    * @param aEntry the returned element from the collection
+    *
+    * @return false if no element is found at the passed index;
+    * true if an element is found 
+    *     
+    * !!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    *
+    * This is a copy of the value present in the list at the particular index. To ensure proper cleanup 
+    * TLiwVariant::PushL method should be called beforehand.
+	*
+    *  
+    * An integral value being retrieved from the collection
+    * 
+    * @code
+    * CLiwDefaultList* pList = CLiwDefaultList::NewL();
+    * pList->PushL();
+    * TInt intVal=1100; //some magic number
+    * pList->AppendL(TLiwVariant(intVal));
+    *
+    * TInt nIndex=0; //only one entry is stored..
+    * TLiwVariant valFnd;
+    * valFnd.PushL(); //Pushes the TLiwVariant into the CleanupStack using TCleanupItem
+    * if(EFalse!=pList->AtL(nIndex,valFnd))
+    * {
+    * 	TInt intValFnd=-1;
+    *   valFnd.Get(intValFnd);
+    * }
+    * 
+    * CleanupStack::PopAndDestroy(valFnd); //Pops and Destroys the TLiwVariant object
+    * CleanupStack::Pop(pList);
+    * pList->DecRef();
+    * @endcode
+    *
+    * @see TLiwVariant::PushL
+    */
+  IMPORT_C TBool AtL(TInt aIndex, TLiwVariant& aEntry) const;
+  
+  /**
+    * Returns the number of elements present in the collection.
+    *  
+    * @return the number of elements; Zero if there are no elements stored
+    *
+   */
+  IMPORT_C TInt Count() const;
+  
+  /**
+    * Removes an element located at the passed index from the collection.
+    *  
+    * @param aIndex the index of the element to be removed from the collection
+    *
+    * 
+    * An element being removed from the collection
+    * 
+    * @code
+    * CLiwDefaultList* pList = CLiwDefaultList::NewL();
+    * pList->PushL();
+    * TInt intVal=1100; //some magic number
+    * pList->AppendL(TLiwVariant(intVal));
+    *
+    * TInt nIndex=0; //only one entry is stored..
+    * pList->Remove(nIndex);
+    *
+    * if(0==pList->Count())
+    * {
+    * 	//should be zero
+    * }
+    *  
+    * CleanupStack::Pop(pList);
+    * pList->DecRef();
+    * @endcode
+    * 
+   */
+  IMPORT_C void Remove(TInt aIndex);
+  
+  /**
+    * Serializes the collection data entries to an output stream. 
+    * 
+    * @param aOutputStream the output stream to which the data will be streamed
+    *               
+    * @see RWiteStream
+    */
+  IMPORT_C void ExternalizeL(RWriteStream& aOutputStream) const;
+  
+  /**
+    * Returns the size of the collection. The size is 
+    * calculated based on the total numer of elements
+    * and the size of each element in the collection
+    *  
+    * @return the size of the collection
+   */
+  IMPORT_C TInt Size() const;
+
+ private:
+ 
+  /*
+   * Constructor
+   */
+  CLiwDefaultList(CLiwGenericParamList* aList) : iList(aList) {}
+  
+  /*
+   * Destructor
+   */
+  IMPORT_C virtual ~CLiwDefaultList();
+  
+  /*
+   * the underlying generic parameter list
+   */
+  CLiwGenericParamList* iList;
+};
+
+/**
+* An associative array or dictionary class. The collection
+* key entries are of type string (Descriptor type) and their  
+* associated values can be an variant type.
+* 
+*  \c CLiwDefaultMap provides default map implementation to
+*  <ul>
+*     <li>insert a key-value pair</li>
+*     <li>find a stored value based on a key</li>
+*     <li>get a key based on an index</li>
+*     <li>remove a key-value pair based on a key</li>
+*		 <li>get the total number of stored key-value pairs</li>
+*   </ul>
+* 
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects.
+* 
+* This implies that the object of this concrete implementation class being created should be pushed into the 
+* CleanupStack using CLiwContainer::PushL.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer
+* 
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+* @see TLiwVariant
+* @see CLiwMap
+*
+*/
+class CLiwDefaultMap : public CLiwMap
+{
+ public:
+  
+   /*
+   	* Creates an instance of \c CLiwDefaultMap
+   	* 
+   	* Instance of the map created, can be pushed into the CleanupStack using PushL()
+   	* to ensure proper cleanup of this container object
+   	*
+   	* @code
+    * void CreateMapL()
+    * {
+    * 	CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
+    *   pMap->PushL();	//pushes the map into cleanupstack using CleanupClosePushL
+	* 	
+	*	CleanupStack::Pop(pMap);
+	*	pMap->DecRef();
+	* }			
+    *
+    * @endcode 
+    *
+   	* @return an instance of \c CLiwDefaultMap
+   	* 
+   	* @ see PushL
+   	* @ see Close
+   	*/
+    IMPORT_C static CLiwDefaultMap* NewL();
+   
+   /*
+   	* Creates an instance of \c CLiwDefaultMap
+   	*
+   	* Pushes the map into the CleanupStack using CleanupClosePushL
+   	* 
+   	* @code
+    * void CreateMapL()
+    * {
+    * 	CLiwDefaultMap* pMap = CLiwDefaultMap::NewLC(); //pushes the map into cleanupstack using CleanupClosePushL
+    * 	
+	*	CleanupStack::Pop(pMap);
+	*	pMap->DecRef();
+	* }			
+    *
+    * @endcode 
+    * @return an instance of \c CLiwDefaultMap
+    *
+    * @ see Close
+   	*/
+    IMPORT_C static CLiwDefaultMap* NewLC();
+  
+   /*
+   	* Creates an instance of \c CLiwDefaultMap and 
+   	* fills up the collection entries from the input stream.
+   	* The created instance is left in the cleanupstack.
+   	*
+   	* @return an instance of \c CLiwDefaultMap   
+   	*/
+    static CLiwDefaultMap* NewLC(RReadStream& aInputStream);
+  
+  /**
+    * Inserts a key-value pair element to the map collection. If
+    * the specified key already exists, it will be removed from
+    * the collection and the new key-value pair will be added to the
+    * map.
+    *  
+    * @param aKey the key to be stored
+    * @param aValue the value associated with the key to be stored
+    *
+    * 
+    * @code
+    * void AddMapEntryL(const TDesC* ptrFirstNameVal)
+    * {
+    * 	_LIT8(KKey,"firstName");
+    * 	TBuf8<128> pbkFieldKey(KKey);
+    *
+    *	CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
+    *   pMap->PushL();	//pushes the map into cleanupstack using CleanupClosePushL
+	* 	pMap->InsertL(pbkFieldKey, TLiwVariant(*ptrFirstNameVal));  
+	*   CleanupStack::Pop(pMap);
+	*	pMap->DecRef();
+	* }			
+    *@endcode 
+    *
+    */
+  IMPORT_C void InsertL(const TDesC8& aKey, const TLiwVariant& aValue);
+  
+  /**
+    * Finds a value stored in the map collection based on the key.
+    *  
+    * @param aKey the key to be searched
+    * @param aFndValue the value associated with the found key
+    *
+    * !!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    *
+    * This is a copy of the value present in the map for the particular key. To ensure proper cleanup 
+    * TLiwVariant::PushL method should be called beforehand.
+	*
+    * @return false if there is no key stored; true otherwise
+    *
+    * 
+    *
+    * @code
+    * void FindAnEntryL()
+    * {
+    * 	_LIT8(KKey,"firstName");
+    * 	TBuf8<128> pbkFieldKey(KKey);
+    *   TLiwVariant firstNameVal;
+    *	firstNameVal.PushL();
+    *
+    *	CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
+	*	pMap->PushL();
+	* 	if(EFalse!=pMap->FindL(pbkFieldKey, firstNameVal))
+	*   {
+	*			//key value has been found
+	*   }  
+	*	
+	*	CleanupStack::PopAndDestroy(pMap);
+	*	CleanupStack::PopAndDestroy(firstNameVal);
+	* }			
+    * @endcode 
+    *
+    * @see TLiwVariant::PushL 
+   */
+  IMPORT_C TBool FindL(const TDesC8& aKey, TLiwVariant& aValue) const;
+  
+  /**
+    * Returns the number of key-value pair stored in the map collection.
+    *  
+    * @return the number of key-value pair stored in the map collection
+   */
+  IMPORT_C TInt Count() const;
+  
+  /**
+    * Returns the key stored at a specified index. 
+    *  
+    * @param aIndex the index of the key to be found
+    * @param aFndKey the key found at the passed index
+    *
+    * @return true if a key-value entry is found at the passed index;
+    * false otherwise
+    *
+    * 
+    *
+    * @code
+    * void FindAnEntryL()
+    * {
+    * 	_LIT8(KKey,"firstName");
+    * 	TBuf8<128> pbkFieldKeyVal(KKey);
+    *   
+	* 	TInt nIndex=0;
+	*	CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
+	*	pMap->PushL();
+	*
+	*	if(EFalse!=pMap->AtL(nIndex, pbkFieldKeyVal))
+	*   {
+	*			//key value has been found
+	*   }
+	*
+	*	CleanupStack::Pop(pMap); 
+	*	pMap->DecRef(); 
+	* }			
+    * @endcode 
+    * 
+   */
+  IMPORT_C TBool AtL(TInt aIndex, TDes8& aFndKey) const;
+  
+   /**
+    * Returns the key stored at a specified index. 
+    *  
+    * @param aIndex the index of the key to be found
+    * @param aFndKey the key found at the passed index
+    *
+    *
+    * @return the key if a key-value entry is found at the passed index;
+    * Leaves otherwise
+    *
+    * 
+    *
+    * @code
+    * void FindAnEntryL()
+    * {
+    * 	_LIT8(KKey,"firstName");
+    * 	TBuf8<128> pbkFieldKeyVal(KKey);
+    *   
+	* 	TInt nIndex=0;
+	*	CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
+	*	pMap->PushL();
+	*
+	*	pbkFieldKeyVal = pMap->AtL(nIndex);
+	*	if(pbkFieldKeyVal)			
+	*   {
+	*		//key value has been found
+	*  	}
+	*
+	*	CleanupStack::Pop(pMap); 
+	*	pMap->DecRef(); 
+	* }			
+    * @endcode 
+    * 
+   */
+   IMPORT_C const TDesC8& AtL(TInt aIndex) const;
+  
+  /**
+    * Removes a key from the map collection.
+    *  
+    * @param aKey the key to be removed from the map
+    *
+    * 
+    *
+    * @code
+    * void RemoveMapEntryL(const TDesC* ptrFirstNameVal)
+    * {
+    * 	_LIT8(KKey,"firstName");
+    * 	TBuf8<128> pbkFieldKey(KKey);
+    *	CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();
+	*	pMap->PushL();
+	*
+	* 	pMap->InsertL(pbkFieldKey, TLiwVariant(*ptrFirstNameVal));  
+	*	pMap->Remove(pbkFieldKey);
+	*
+	*	if(0==pMap->Count())
+	*	{
+	*		//no entries stored; removal successful
+	*	}
+	*	
+	*	CleanupStack::Pop(pMap);
+	*	pMap->DecRef();
+	* }			
+    * @endcode 
+    * 
+   */
+  IMPORT_C void Remove(const TDesC8& aKey);
+  
+  /**
+    * The container managed data values can be serialized to an output
+    * stream. 
+    * 
+    * @param aOutputStream the output stream to which the data will be streamed
+    *               
+    * 
+    *
+    * @see RWiteStream
+    *
+   */
+  void ExternalizeL(RWriteStream& aOutputStream) const;
+  
+  /**
+    * Returns the size of the collection. The size is 
+    * calculated based on the total numer of key-value elements
+    * and the size of each pair in the collection
+    *  
+    * @return the size of the collection
+   */
+   IMPORT_C TInt Size() const;
+
+ private:
+ 
+ 	/*
+ 	 * Constructor
+ 	 */
+  CLiwDefaultMap(CLiwGenericParamList* aMap) : iMap(aMap) {}
+  
+  /*
+ 	 * Destructor
+ 	 */
+ 	 IMPORT_C virtual ~CLiwDefaultMap();
+  
+  /*
+   * the underlying generic parameter list
+   */
+  CLiwGenericParamList* iMap;
+};
+
+/**
+* Abstract generic buffer representation. Class used for passing generic buffer data between 
+* service provider and the consumers.
+
+* The class offers APIs for the consumers to access the buffer data in a generic manner. Depending on 
+* the data agreement between the service provider and its consumers, one 
+* or more of the API operations may be inappropriate e.g. a service provider may not 
+* support write operation on the buffer
+*
+* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+* Since container objects are reference counted, they cannot go with CleanupStack::PushL.
+* The issue is solved by using CleanupClosePushL for pushing the container objects into the CleanupStack.
+* Hence CLiwContainer::Close method is introduced common to all container objects.
+* 
+* This implies that the object of this concrete implementation class being created should be pushed into the 
+* CleanupStack using CLiwContainer::PushL.
+*
+* @lib ServiceHandler.lib
+*
+* @see CLiwContainer
+* 
+* @see CLiwContainer::Close
+* @see CLiwContainer::PushL
+*
+*/
+class CLiwBuffer : public CLiwContainer
+{
+	public:		
+		enum TLiwBufferAccess
+		{
+			KLiwBufferNonReadable = 0,
+			KLiwBufferReadOnly = 1
+		};
+
+
+		/*
+		 * Returns the pointer to the underlying buffer
+		 *
+		 * @return the pointer to the underlying buffer
+		 */
+		virtual TUint8* Buf() const =0;
+		
+		/*
+		 * Returns the length of the buffer data
+		 *
+		 * @return the length of the buffer data
+		 */
+		virtual TInt Len() =0;
+		
+		/*
+		 * Reads the specified number of bytes of buffer data 
+		 * 
+		 * @param aPtr the pointer to the area into which buffer data is read
+		 * @param aLength the number of bytes to be read from the buffer
+		 *
+		 * @return KErrNone if the operation is successful; Otherwise
+		 *		   TLiwBufferAccess::KLiwBufferNonReadable
+		 *        
+		 */
+		inline virtual TInt Read(TUint8* /*aPtr*/,TInt /*aLength*/)
+		{
+			return KLiwBufferNonReadable;
+		}
+		
+		/*
+		 * Writes the specified number of bytes into the buffer 
+		 * 
+		 * @param aPtr the pointer to the data to be written into buffer
+		 * @param aLength the number of bytes to be written into buffer
+		 *
+		 * @return KErrNone if the operation is successful; Otherwise
+		 *		   TLiwBufferAccess::KLiwBufferReadOnly if writing is not supported
+		 *        
+		 */
+		inline virtual TInt Write(const TUint8 * /*aPtr*/, TInt /*aLength*/)
+		{
+			return KLiwBufferReadOnly;
+		}
+			
+		/*
+		 * Releases the buffer. The service provider implementing concrete buffer
+		 * type should provide appropriate implementation
+		 */
+		virtual void Release() =0;
+		
+		/*
+		 * Returns the appropriate type of buffer.
+		 */
+		virtual TInt TypeID()=0;
+		
+		/*
+		 * The concrete implementation of buffer types should perform equality operation
+		 * check
+		 */
+		virtual TBool operator==(CLiwBuffer& aBuffer) =0;
+};
+
+/**
+* Returns ETrue if two variants are equal.
+*
+* @param aLhs Left hand side.
+* @param aRhs Right hand side.
+* @return ETrue if equal, EFalse otherwise.
+*/
+IMPORT_C TBool operator==(const TLiwVariant& aLhs, const TLiwVariant& aRhs);
+
+/**
+* Returns ETrue if two variants are not equal.
+*
+* @param aLhs Left hand side.
+* @param aRhs Right hand side.
+* @return ETrue if not equal, EFalse otherwise.
+*/
+inline TBool operator!=(const TLiwVariant& aLhs, const TLiwVariant& aRhs);
+
+/**
+* Dumps the contents of aVariant to debug output. Available only in debug builds.
+*
+* @param aVariant The object to be dumped.
+*/
+IMPORT_C void Dump(const TLiwVariant& aVariant);
+
+
+// INLINE FUNCTIONS
+#include "liwvariant.inl"
+
+#endif // LIW_VARIANT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwvariant.inl	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Inline function implementations of class TLiwVariant.
+*
+*/
+
+
+
+
+
+
+
+
+inline TLiwVariant::TLiwVariant() : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    iData.iBufC = NULL;
+    iData.iBufC8 = NULL;
+    Reset();
+    }
+
+inline TLiwVariant::TLiwVariant(TInt32 aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {   
+    Set(aValue);
+    }
+
+inline TLiwVariant::TLiwVariant(TInt64 aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {   
+    Set(aValue);
+    }
+
+inline TLiwVariant::TLiwVariant(TBool aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {   
+    Set(aValue);
+    }
+    
+inline TLiwVariant::TLiwVariant(TUint aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {   
+    Set(aValue);
+    }
+inline TLiwVariant::TLiwVariant(TReal aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {   
+    Set(aValue);
+    }
+inline TLiwVariant::TLiwVariant(const CLiwBuffer* aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {   
+    Set(aValue);
+    }
+        
+inline TLiwVariant::TLiwVariant(const TUid& aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);
+    }
+
+inline TLiwVariant::TLiwVariant(const TDesC& aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    iData.iBufC = NULL;
+    Set(aValue);
+    }
+
+inline TLiwVariant::TLiwVariant(const HBufC* aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    iData.iBufC = NULL;
+    if(aValue)
+        Set(*aValue);
+    else
+        Reset();    
+    }
+
+inline TLiwVariant::TLiwVariant(const TTime& aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);
+    }
+
+inline TLiwVariant::TLiwVariant(const TDesC8& aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    iData.iBufC8 = NULL;
+    Set(aValue);
+    }
+
+
+inline TLiwVariant::TLiwVariant(const RFile& aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);
+    }
+
+
+inline TLiwVariant::TLiwVariant(const CLiwList* aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);        
+    }                   
+
+inline TLiwVariant::TLiwVariant(const CLiwMap* aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);        
+    }
+                   
+inline TLiwVariant::TLiwVariant(const MLiwInterface* aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);        
+    }
+
+inline TLiwVariant::TLiwVariant(const CLiwIterable* aValue) : iTypeId(LIW::EVariantTypeNull), iPtrC(), iPtrC8()
+    {
+    Set(aValue);        
+    }                   
+
+inline LIW::TVariantTypeId TLiwVariant::TypeId() const
+    {
+    return static_cast<LIW::TVariantTypeId>(iTypeId);
+    }
+
+inline TBool TLiwVariant::IsEmpty() const
+    {
+    return (iTypeId == LIW::EVariantTypeNull);
+    }
+
+inline void TLiwVariant::Set(const HBufC* aValue)
+    {
+    Set(*aValue);
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(TInt32 aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(TInt64 aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+    
+inline TLiwVariant& TLiwVariant::operator=(TReal aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+inline TLiwVariant& TLiwVariant::operator=(const CLiwBuffer* aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+    
+inline TLiwVariant& TLiwVariant::operator=(TBool aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(TUint aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const TUid& aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const TDesC& aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const HBufC* aValue)
+    {
+    Set(*aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const TTime& aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+
+inline TLiwVariant& TLiwVariant::operator=(const TDesC8& aValue)
+    {
+    Set(aValue);    
+    return *this;
+    }
+
+
+inline TLiwVariant& TLiwVariant::operator=(const RFile& aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+
+inline TLiwVariant& TLiwVariant::operator=(const CLiwList* aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const CLiwMap* aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const MLiwInterface* aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TLiwVariant& TLiwVariant::operator=(const CLiwIterable* aValue)
+    {
+    Set(aValue);
+    return *this;
+    }
+
+inline TBool operator!=(const TLiwVariant& aLhs, const TLiwVariant& aRhs)
+    {
+    return !(aLhs == aRhs);
+    }
+
+
+inline void CLiwContainer::IncRef()
+    {
+    iRefCount++;
+    }
+    
+inline void CLiwContainer::DecRef()
+    {
+    if (--iRefCount == 0)
+        delete this;
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/inc/liwvarianttype.hrh	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Variant data type for Generic Parameters library.
+*
+*/
+
+
+
+
+
+
+
+#include "LiwCommon.hrh"
+#ifndef LIW_VARIANT_TYPE_HRH
+#define LIW_VARIANT_TYPE_HRH
+
+namespace LIW {
+
+/**
+* Data formats supported by TLiwVariant class.
+*/
+enum TVariantTypeId
+    {
+    EVariantTypeAny        = -1,  ///< Used only in searching
+    EVariantTypeNull       = 0,   ///< Null (empty) type
+
+    EVariantTypeTInt32     = 1,   ///< 32 bit Integer
+    EVariantTypeTUid       = 2,   ///< Globally unique UID
+    EVariantTypeDesC       = 3,   ///< Constant text literal
+    EVariantTypeTTime      = 4,   ///< Date and time
+    EVariantTypeDesC8      = 5,   ///< 8-bit data buffer
+    EVariantTypeFileHandle = 6,   ///< File handle
+    EVariantTypeList       = 7,   ///< List
+    EVariantTypeMap        = 8,   ///< Map
+    EVariantTypeInterface  = 9,   ///< Interface
+    EVariantTypeIterable   = 10,   ///< Iterable
+    EVariantTypeTBool      = 11,   ///< Bool Data Type 
+    EVariantTypeTUint      = 12,    ///< Unsigned Integer Data Type 
+    EVariantTypeTReal      = 13,    ///< Float type
+    EVariantTypeBuffer     = 14,    ///< Buffer type
+    EVariantTypeTInt64     = 15   ///< 64 bit Integer
+    };
+}
+#endif // LIW_VARIANT_TYPE_HRH
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_generic_parameter_api/liw_generic_parameter_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="071ad9643b986c7f19e4342924c3544a" dataversion="1.0">
+<name>liw_generic_parameter_api</name>
+<description>Generic parameter API supports the creation of generic parameters and passing them from a consumer to provider(s) (input parameters) and vice versa (output parameters).</description>
+<type>c++</type>
+<subsystem>languageinterworkingfw</subsystem>
+<libs><lib name="liwservicehandler.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_provider_utility_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       File that exports the files belonging to 
+:                LIW Provider Utility API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/LiwMenu.h     MW_LAYER_PLATFORM_EXPORT_PATH(LiwMenu.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_provider_utility_api/inc/liwmenu.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,277 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares LIW Menu utilities for providers to access consumer menu.
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_MENU_H
+#define LIW_MENU_H
+
+// INCLUDES
+#include <eikmenup.h>
+#include <liwserviceifbase.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* CLiwMenuPane for providers to have limited access to consumer menu.
+*
+* LIW provider can get a reference to CLiwMenuPane in its InitializeMenuPaneL()
+* method, which is derived from CLiwServiceIfMenu. With this reference,
+* the provider can e.g. insert menu items to the consumer application's menu.
+*
+* @lib ServiceHandler.lib
+* @since Series 60 2.6
+*/
+class CLiwMenuPane: public CBase
+    {
+    public:
+        /**
+        * Constructor.
+        *
+        * @param aMenuPane Consumer's menu pane handle.
+        * @param aBaseCmdId Base command ID for new menu items, specified by consumer.
+        */
+        IMPORT_C CLiwMenuPane(CEikMenuPane& aMenuPane, TInt aBaseCmdId);
+
+        /**
+        * Destructor.
+        */        
+        IMPORT_C virtual ~CLiwMenuPane();   
+       
+    public:
+        /**
+        * Adds a menu item to consumer menu. For each addition a mapping element 
+        * is created. This method should normally be called from provider's 
+        * InitializeMenuPaneL().
+        *
+        * @param aServiceCmd The LIW service command the provider implements.
+        * @param aMenuItem The menu item data.
+        * @param aIndex Position of item where to add menu items.
+        */
+        IMPORT_C void AddMenuItemL(
+            TInt aServiceCmd,
+            CEikMenuPaneItem::SData& aMenuItem, 
+            TInt aIndex);
+            
+        /**
+        * Adds a menu item to consumer menu. For each addition a mapping element 
+        * is created. This method should normally be called from provider's 
+        * InitializeMenuPaneL().
+        *
+        * @param aServiceCmd The LIW service command the provider implements.
+        * @param aMenuItem The menu item data.
+        * @param aIndex Position of item where to add menu items.
+        * @param aExtraText Altenative menu item text, if it is placed to a submenu.
+        */
+        IMPORT_C void AddMenuItemL(
+            TInt aServiceCmd,
+            CEikMenuPaneItem::SData& aMenuItem, 
+            TInt aIndex,
+            const TDesC& aExtraText);            
+        
+        /**
+        * Adds a menu item(s) to consumer menu from provider resource. This method 
+        * should normally be called from provider's InitializeMenuPaneL().
+        *
+        * @param aReader Resource reader pointing to the menu resource.
+        * @param aServiceCmd The LIW service command the provider implements.
+        * @param aIndex Position of item where to add menu items.
+        * @param aAddSeparator Currently not in use.
+        */
+        IMPORT_C void AddMenuItemsL(
+            TResourceReader& aReader,
+            TInt aServiceCmd,
+            TInt aIndex,
+            TBool aAddSeperator = EFalse);
+
+        /**
+        * Adds a menu item(s) to consumer menu from provider resource. This method 
+        * should normally be called from provider's InitializeMenuPaneL().
+        *
+        * @param aFileName The provider's resource where menu item(s) are defined.
+        * @param aResId Resource id of a MENU_PANE.
+        * @param aServiceCmd The LIW service command the provider implements.
+        * @param aIndex Position of item where to add menu items.
+        * @param aAddSeperator Currently not in use.
+        */
+        IMPORT_C void AddMenuItemsL(
+            TFileName& aFileName,
+            TInt aResId,
+            TInt aServiceCmd,
+            TInt aIndex,
+            TBool aAddSeperator = EFalse);
+
+    public:
+        /**
+        * Gets the provider's original menu command ID from the dynamic menu command 
+        * ID (generated by the LIW framework).
+        *
+        * @param aDynCmdId Dynamic menu command ID.
+        * @return Found provider's original menu command ID, KErrNotFound if not found.
+        */
+        IMPORT_C TInt MenuCmdId(TInt aDynCmdId) const;
+        
+        /**
+        * Gets the dynamic menu command ID (generated by the LIW framework) from the 
+        * provider's original menu command ID. There are usually multiple matching 
+        * dynamic menu command IDs, so this method returns the first item found.
+        *
+        * @param aMenuCmdId Provider's original menu command ID.
+        * @return Found dynamic menu command ID, KErrNotFound if not found.
+        */
+        IMPORT_C TInt DynCmdId(TInt aMenuCmdId) const;
+
+        /**
+        * Gets the LIW service command ID from the dynamic menu command ID (generated 
+        * by the LIW framework).
+        *
+        * @param aDynCmdId Dynamic menu command ID.
+        * @return Found LIW service command ID, KErrNotFound if not found.
+        */
+        IMPORT_C TInt ServiceCmdId(TInt aDynCmdId) const;
+
+        /**
+        * Add sub menu title item. This item will not be visible in menus,
+        * but will be used as title for comsumer's LIW submenu (if consumer
+        * requests that).
+        *
+        * @param aTitle Title text
+        * @param aIndex Position of title item in menu (can be anything, but
+        *               if there is several title item definitions in menu,
+        *               then the last one will be used).
+        * @since 2.8        
+        */
+        IMPORT_C void AddTitleItemL(const TDesC& aTitle, TInt aIndex);  
+
+    friend class CLiwServiceHandlerImpl;
+
+    private: 
+        struct SMenuIdMap
+            {
+            TInt serviceCmdId;          // LIW service command ID.
+            TInt origCmdId;             // Original menu ID used by provider SW
+            TInt dynMenuCmdId;          // The dynamic command ID generated by LIWFW
+            CLiwServiceIfBase* owner;   // A pointer to the provider object.
+            RBuf extraText;             // Alternative submenu text is stored here.
+            };
+
+    private:    
+        TInt FindCmdId(TInt aIndex);
+        inline CEikMenuPane& MenuPane();
+        inline void SetResourceSlotId(TInt aSlot);
+        inline TInt ResourceSlotId() const;
+        inline void SetPaneOffset(TInt aOffset);
+        inline TInt PaneOffset() const;
+        inline TInt MenuResourceId() const;
+        inline void SetMenuResourceId(TInt aMenuResourceId);
+        TBool IsCmdInRange(TInt aCmdSpaceSize, TInt aCmd);
+        CLiwServiceIfBase* CommandOwner(TInt aDynId) const;
+        inline CLiwServiceIfBase* InitializingOwner() const;
+        inline void SetInitializingOwner(CLiwServiceIfBase* aOwner);
+        const TDesC& ExtraText(TInt aDynMenuCmdId);
+
+    private:
+        // Original menu pane.
+        CEikMenuPane* iMenuPane;
+        
+        // Base ID to generate menu IDs for placeholders. From constructor.
+        TInt iBaseCmdId;     
+        
+        // Map needed to map provider cmd IDs to dynamic command Ids
+        RArray<SMenuIdMap> iIdMap;
+           
+        TInt iNextCmdId;    // The next free command ID to use
+        TInt iResourceSlotId;
+        TInt iPaneOffset;
+        TInt iMenuResourceId;
+        CLiwServiceIfBase* iInitializingOwner;  // Owner that is currently initializing.
+
+        TInt iReserved_1;
+        void *iExtension; // reserved for future use
+    };
+
+
+inline CEikMenuPane& CLiwMenuPane::MenuPane()
+    {
+    return *iMenuPane;  
+    }
+
+
+inline void CLiwMenuPane::SetResourceSlotId(TInt aSlot)
+    {
+    iResourceSlotId = aSlot;
+    }
+
+
+inline TInt CLiwMenuPane::ResourceSlotId() const
+    {
+    return iResourceSlotId;
+    }
+
+
+inline void CLiwMenuPane::SetPaneOffset(TInt aOffset)
+    {
+    iPaneOffset = aOffset;
+    }
+
+
+inline TInt CLiwMenuPane::PaneOffset() const
+    {
+    return iPaneOffset; 
+    }
+
+
+inline CLiwServiceIfBase* CLiwMenuPane::InitializingOwner() const
+    {
+    return iInitializingOwner;
+    }
+
+
+inline void CLiwMenuPane::SetInitializingOwner(CLiwServiceIfBase* aOwner)
+    {
+    iInitializingOwner = aOwner;
+    }
+
+
+inline TInt CLiwMenuPane::MenuResourceId() const
+    {
+    return iMenuResourceId;
+    }
+
+
+inline void CLiwMenuPane::SetMenuResourceId(TInt aMenuResourceId)
+    {
+    iMenuResourceId = aMenuResourceId;
+    }
+
+#endif  // LIW_MENU_H
+
+// END of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_provider_utility_api/liw_provider_utility_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="730be64774621b57a419389b18668ccd" dataversion="1.0">
+<name>liw_provider_utility_api</name>
+<description>Utilities that help implementing LIW providers.</description>
+<type>c++</type>
+<subsystem>languageinterworkingfw</subsystem>
+<libs><lib name="liwservicehandler.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_handler_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       File that exports the files belonging to 
+:                LIW Service Handler API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/LiwServiceHandler.h     MW_LAYER_PLATFORM_EXPORT_PATH(LiwServiceHandler.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_handler_api/inc/liwservicehandler.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,457 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares an API for the consumer applications to access the 
+*                Language Interworking Framework. 
+*
+*/
+
+
+
+
+
+
+
+#ifndef LIW_SERVICE_HANDLER_H
+#define LIW_SERVICE_HANDLER_H
+
+// INCLUDES
+#include <barsread.h> 
+#include <liwcommon.h>
+#include <e32capability.h>
+
+// CONSTANTS
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CLiwServiceHandlerImpl;
+
+class CRTSecMgrScriptSession;
+
+
+enum TLiwLoadStatus
+{
+	KLiwUnknown = -5,
+	KLiwMetaDataInvalidFormat, 			//-4
+	KLiwInvalidVersionSpecification,	//-3
+	KLiwVersionOutOfRange,				//-2
+	KLiwSecurityAccessCheckFailed,		//-1
+	KLiwServiceLoadSuccess,				//0
+	KLiwServiceAlreadyLoaded			//1
+	
+	//..Other possible error codes	
+};
+
+
+// CLASS DECLARATION
+
+/**
+* CLiwServiceHandler is the main class of the Language Interworking
+* Framework. The Service Handler implements support for dynamically
+* loadable service providers which offer services to consumer applications. 
+* The Service Handler maps consumers and service providers together via 
+* interests and data agreements and hides the consumers from the providers. 
+*
+* SERVICE is any command or functionality offered by a provider to 
+* consumer. The service includes typically menu item UI elements,
+* but it can also just an engine type of command which executes specific 
+* functionality and reports status back to the consumer.
+*
+* CONSUMER application accesses interesting services offered by
+* service provider(s). The consumer uses only those services in which
+* it is interested in. The interest is expressed using a set of criteria
+* items.
+*
+* INTEREST is a list of criteria items.
+*
+* CRITERIA consists of set of attributes which guide the LIW Framework to use
+* only those providers in which the consumer is interested in.
+* The criteria consists of following attributes:
+*   - Criteria UID (we can allocate pre-defined criteria items).
+*   - Service command UID (we can allocate pre-defined commands).
+*   - Content MIME type (string).
+*   - Additional options (variant data type just in case).
+*
+* PROVIDER produces those services for a consumer that match the given criteria 
+* specified by the consumer. A provider can offer menu items and their command
+* handling logic to the consumer applications. A provider can also offer base
+* services that don't require any UI elements.
+*
+* DATA AGREEMENT is an agreement between consumer and provider about parameters 
+* needed to be passed in a use case.
+*
+* @lib ServiceHandler.lib
+* @since Series 60 2.6
+*/
+NONSHARABLE_CLASS(CLiwServiceHandler) : public CBase
+    {
+    public:  // Construction & destruction
+
+        /**
+        * Constructs a Service Handler instance.
+        */
+        IMPORT_C static CLiwServiceHandler* NewL();
+        
+        /**
+        * Constructs a Service Handler instance.
+        */
+        IMPORT_C static CLiwServiceHandler* NewLC();  
+
+        /** 
+        * Destructor.
+        */
+        IMPORT_C virtual ~CLiwServiceHandler();
+        
+    public:  // Management
+
+        /**
+        * Resets the Service Handler, discards existing interest and unloads 
+        * corresponding service providers.
+        */
+        IMPORT_C void Reset();
+
+        /**
+        * Returns the amount of providers that fulfil the given criteria.
+        *
+        * @param aCriteria Criteria to match.
+        * @return Number of providers matching the criteria.
+        */
+        IMPORT_C TInt NbrOfProviders(const CLiwCriteriaItem* aCriteria);
+        
+    public:  // Interest handling
+        
+        /**
+        * Adds the given interest to the Service Handler from a resource and updates 
+        * possibly existing old interest. Corresponding service providers are loaded.
+        * If a provider leaves during initialization, it is trapped by the Service Handler.
+        *
+        * @param aInterestResourceId ID of the resource containing criteria items.
+        * @leave KErrNotSupported CCoeEnv is not accessible.
+        * @see Reset
+        */
+        IMPORT_C void AttachL(TInt aInterestResourceId);
+
+        /**
+        * Adds given interest to the Service Handler from an array of criteria items.
+        * If a provider leaves during initialization, it is trapped by the Service Handler.
+        *
+        * @param aInterest Array of criteria items. Ownership is not transferred.
+        */
+        IMPORT_C TInt AttachL(const RCriteriaArray& aInterest);
+
+        /**
+        * Gets the currently valid interest in use by the Service Handler.
+        *
+        * @param aInterest An array of returned criteria items, may be empty.
+        *                  Ownership is not transferred, i.e. the objects in the 
+        *                  array must not be deleted.
+        */
+        IMPORT_C void GetInterest(RCriteriaArray& aInterest);
+
+        /**
+        * Removes given interest from the Service Handler. Corresponding service 
+        * providers are unloaded.
+        * 
+        * @param aInterest Array of returned criteria items, may be empty.
+        */
+        IMPORT_C void DetachL(const RCriteriaArray& aInterest);
+
+        /**
+        * Removes given interest from the Service Handler. Corresponding service 
+        * providers are unloaded.
+        * 
+        * @param aInterestResourceId ID of the resource containing criteria items.
+        * @leave KErrNotSupported CCoeEnv is not accessible.
+        */
+        IMPORT_C void DetachL(TInt aInterestResourceId);
+        
+        /**
+        * Returns criteria by ID.
+        *
+        * @param aId Criteria ID.
+        * @return Criteria item pointer matching the ID. Ownership is not transferred.
+        */
+        IMPORT_C const CLiwCriteriaItem* GetCriteria(TInt aId);
+
+        /**
+        * Returns an empty instance of CLiwGenericParamList class. It can be
+        * used for example as an input parameter list for the Service Handler's
+        * API methods. This is just a convenience method and doesn't have
+        * to be used. If consumer wants to create input list by itself
+        * it is ok. If this method is used, the Service Handler takes care
+        * of deleting returned generic parameter list.
+        *
+        * @return  An empty instance of CLiwGenericParameter list.
+        */
+        IMPORT_C CLiwGenericParamList& InParamListL();
+
+        /**
+        * Returns an empty instance of CLiwGenericParamList class. The instance can be
+        * used for example as an output parameter list for Service Handler
+        * API methods. This is just a convenience method and doesn't have
+        * to be used. If consumer wants to create output list by itself
+        * it is ok. If this method is used, Service Handler takes care
+        * of deleting returned generic parameter list.
+        *
+        * @return  An empty instance of CLiwGenericParameter list.
+        */
+        IMPORT_C CLiwGenericParamList& OutParamListL();
+        
+    public:  // Menu handling
+
+        /**
+        * Initialises menu pane with service commands from a provider.
+        * This method must be called upon DynInitMenuPaneL of consumer
+        * application in order to let the provider to hook its menu items.
+        *
+        * @param aMenuPane Handle of the menu pane to initialise.
+        * @param aMenuResourceId The menu to be attached.
+        * @param aBaseMenuCmdId Base ID for the Service Handler to generate 
+        *                       menu IDs for placeholders.
+        * @param aInParamList Input parameter list for provider's parameters checking.
+        * @leave KErrNotSupported CCoeEnv is not accessible.
+        * @leave KErrOverflow Consumer application has too many LIW placeholders in its menu. 
+        *                     Currently, maximum 16 is supported.
+        */
+        IMPORT_C void InitializeMenuPaneL(
+            CEikMenuPane& aMenuPane,
+            TInt aMenuResourceId,
+            TInt aBaseMenuCmdId,
+            const CLiwGenericParamList& aInParamList);
+        /**
+        * Initialises menu pane with service commands from a provider.
+        * This method must be called upon DynInitMenuPaneL of consumer
+        * application in order to let the provider to hook its menu items.
+        * In normal circumstances, the other variant of this method should be used.
+        *
+        * @param aMenuPane Handle of the menu pane to initialise.
+        * @param aMenuResourceId The menu to be attached.
+        * @param aBaseMenuCmdId Base ID for the Service Handler to generate 
+        *                       menu IDs for placeholders.
+        * @param aInParamList Input parameter list for provider's parameters checking.
+        * @param aUseSubmenuTextsIfAvailable If the provider has specified alternative submenu
+        *                       texts for its menu items, those can be taken into use if this 
+        *                       parameter is set to ETrue. This should be used only for manually 
+        *                       created submenus. If using LIW_CASCADE_ID or 
+        *                       LIW_INTELLIGENT_CASCADE_ID, the LIW framework can automatically 
+        *                       decide whether to use the submenu texts or not, and this parameter 
+        *                       has no effect.
+        * @leave KErrNotSupported CCoeEnv is not accessible.
+        * @leave KErrOverflow Consumer application has too many LIW placeholders in its menu. 
+        *                     Currently, maximum 16 is supported.
+        */
+        IMPORT_C void InitializeMenuPaneL(
+            CEikMenuPane& aMenuPane,
+            TInt aMenuResourceId,
+            TInt aBaseMenuCmdId,
+            const CLiwGenericParamList& aInParamList,
+            TBool aUseSubmenuTextsIfAvailable);            
+        
+        /**
+        * Returns the service command ID associated to the menu command. If found, it means 
+        * that there is a provider which can handle the menu command. Thus the command 
+        * handling needs to be routed to the provider via ExecuteMenuCmdL.
+        *
+        * @param aMenuCmdId Menu command ID to be mapped to service cmd,
+        *                   KNullServiceCmd is returned if no service command exists.
+        * @return Service command ID, KLiwCmdNone if no ID is found.
+        * @see ExecuteMenuCmdL
+        */
+        IMPORT_C TInt ServiceCmdByMenuCmd(TInt aMenuCmdId) const;
+
+        /**
+        * Tells the provider to execute a menu command invoked by the consumer.
+        * Not supported if calling outside UI framework. Use ServiceCmdByMenuCmd to 
+        * check if there is any provider for the menu command.
+        *
+        * @param aMenuCmdId The menu command to be executed.
+        * @param aInParamList Input data parameters, can be an empty list.
+        * @param aOutParamList Output data parameters, can be an empty list.
+        * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
+        * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
+        * @leave KErrArgument Callback is missing when required.
+        * @leave KErrNotSupported No cmd matches given menu command or CCoeEnv is not accessible.
+        * @see ServiceCmdByMenuCmd
+        */
+        IMPORT_C void ExecuteMenuCmdL(
+            TInt aMenuCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            MLiwNotifyCallback* aCallback= NULL);
+
+        /**
+        * Attach menu related criteria items to the given menu.
+        * If a provider leaves during initialization, it is trapped by the Service Handler. 
+        *
+        * @param aMenuResourceId      Menu to be attached.
+        * @param aInterestResourceId  Resource id for the interest list.
+        * @leave KErrNotSupported     CCoeEnv is not accessible.
+        */
+        IMPORT_C void AttachMenuL(TInt aMenuResourceId, TInt aInterestResourceId);
+
+        /**
+        * Attach menu related criteria items to the given menu.
+        * If a provider leaves during initialization, it is trapped by the Service Handler. 
+        *
+        * @param aMenuResourceId  Menu to be attached.
+        * @param aReader          Resource reader for the interest list.
+        * @leave KErrNotSupported CCoeEnv is not accessible.
+        */
+        IMPORT_C void AttachMenuL(TInt aMenuResourceId, TResourceReader& aReader);
+         /**
+        * Attach menu related criteria items to the given menu. 
+        *
+        * @param aMenuResourceId  Menu to be attached.
+        * @param aInterest        Array of criteria items. Ownership is not transferred.
+        * @leave KErrNotSupported CCoeEnv is not accessible.
+        */
+        IMPORT_C void AttachMenuL(TInt aMenuResourceId, const RCriteriaArray& aInterest);
+
+        /**
+        * Attach menu related criteria items to the given menu. 
+        *
+        * @param aMenuEntries     List of menu command ids, ids not related to interests may be set to 0.
+        * @param aMenuResourceId  Menu to be attached.
+        * @param aInterest        Interest list.
+        */
+        IMPORT_C void AttachMenuL(RArray<TInt>& aMenuEntries, TInt aMenuResourceId, RCriteriaArray& aInterest);
+
+        /**
+        * Detach menu related criteria items from the given menu.
+        * In following cases this method just returns without doing anything:
+        *   1. If interest resource id is non-zero and CCoeEnv is not accessible.
+        *   2. If interest resource id is non-zero and there occurs an error when reading
+        *      the interest (e.g. not enough memory). 
+        * 
+        * @param aMenuResourceId      Menu to be detached.
+        * @param aInterestResourceId  Resource id for the interest list. If NULL, all 
+        *                             criteria items are detached from the given menu.
+        */
+        IMPORT_C void DetachMenu(TInt aMenuResourceId, TInt aInterestResourceId);
+
+        /**
+        * Checks if there are menu providers attached to given menu id. Consumer 
+        * application can use this information to decide whether a sub menu 
+        * containing only LIW items should be hidden or not.
+        *
+        * @param  aSubMenuId The menu id to be checked.
+        * @return ETrue  if there isn't any menu providers attached to this menu.
+        *         EFalse otherwise. 
+        */
+        IMPORT_C TBool IsSubMenuEmpty(TInt aSubMenuId);
+
+        /**
+        * Returns boolean value indicating whether the given menu contains
+        * currently attached placeholders.
+        *
+        * @param   aMenuResourceId  Resource id of the menu to be queried.
+        * @return  ETrue  if aMenuResource contains currently attached placeholders.
+        *          EFalse otherwise. 
+        */
+        IMPORT_C TBool IsLiwMenu(TInt aMenuResourceId);
+
+        /**
+        * Handles LIW submenus. This method should be called from consumer application's 
+        * DynInitMenuPaneL.
+        *
+        * @param  aPane  Menu pane to be handled.
+        * @return ETrue  if aPane was an LIW submenu and it was handled. 
+        *                Consumer's DynInitMenuPaneL pane may now return.
+        *         EFalse if aPane was not an LIW submenu and DynInitMenuPaneL should
+        *                continue normally.
+        */
+        IMPORT_C TBool HandleSubmenuL(CEikMenuPane& aPane);
+
+        /**
+        * CEikMenuPane uses this method to inform AIF framework that a menu is launched.
+        * This method does not need to be called by any other component.
+        *
+        * @since Series 60 3.0
+        */
+        IMPORT_C static void ReportMenuLaunch();
+
+    public:  // Generic Service Command handling
+        
+        /**
+        * Executes a service command for all providers. Otherwise similar to ExecuteMenuCmdL.
+        *
+        * @param aCmdId The command to be executed.
+        * @param aInParamList Input data parameters, can be an empty list.
+        * @param aOutParamList Output data parameters, can be an empty list.
+        * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.    
+        * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
+        * @leave KErrArgument Callback is missing when required.
+        * @leave KErrNotSupported No provider supports the service.
+        */
+        IMPORT_C void ExecuteServiceCmdL(
+            const TInt& aCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            MLiwNotifyCallback* aCallback = 0);
+
+        /**
+        * Executes a service command.
+        *
+        * @param aCmd The criteria item containing the service command and content type
+        * @param aInParamList Input data parameters, can be an empty list.
+        * @param aOutParamList Output data parameters, can be an empty list.
+        * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.    
+        * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
+        * @leave KErrArgument Callback is missing when required.
+        * @leave KErrNotSupported No provider supports the service.
+        */
+        IMPORT_C void ExecuteServiceCmdL(                     
+            const CLiwCriteriaItem& aCmd,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            MLiwNotifyCallback* aCallback = 0);
+              
+        /**
+        * Gets provider command ID by dynamic command ID.
+        * 
+        * @since Series 60 3.0
+        * @param aMenuCmdId The consumer's menu command ID generated by LIW framework. 
+        *                   This can be get e.g. from consumer's HandleCommandL().
+        * @return Found provider menu command ID, KErrNotFound if not found.
+        */
+        IMPORT_C TInt MenuCmdId(TInt aMenuCmdId) const;
+        
+        IMPORT_C TInt AttachL(const RCriteriaArray& aInterest,CRTSecMgrScriptSession& aSecMgrScriptSession);
+                
+ 	  /**
+        * Lists available service implementations
+        * 
+        * @param aFilterItem 
+        * @param aProviderList 
+        *              
+        * @return none
+        */
+        IMPORT_C void QueryImplementationL(RCriteriaArray& aFilterItem, RCriteriaArray& aProviderList);
+        
+    private:
+        void ConstructL();
+        CLiwServiceHandler();
+
+    private:
+        CLiwServiceHandlerImpl* iImpl;
+    };
+
+#endif // LIW_SERVICE_HANDLER_H
+
+// END of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_handler_api/liw_service_handler_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="6852aedac409c2513ef9b8922d163f44" dataversion="1.0">
+<name>liw_service_handler_api</name>
+<description>API for consumer applications to use the LIW framework, referred also as Consumer API. Hides the implementation details, e.g. ECom usage. In addition to this a consumer uses Generic Parameter API and Criteria API.</description>
+<type>c++</type>
+<subsystem>languageinterworkingfw</subsystem>
+<libs><lib name="liwservicehandler.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_interface_base_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       File that exports the files belonging to 
+:                LIW Service Interface Base API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/LiwServiceIfBase.h     MW_LAYER_PLATFORM_EXPORT_PATH(LiwServiceIfBase.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_interface_base_api/inc/liwserviceifbase.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares Base service API for all providers to implement in 
+*                order to offer services to Language Interworking Framework.
+*
+*/
+
+
+
+
+
+
+#ifndef LIW_SERVICE_IF_BASE_H
+#define LIW_SERVICE_IF_BASE_H
+
+// INCLUDES
+#include <liwgenericparam.h>
+#include <liwcommon.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+/**
+* Extension interface UIDs.
+*/
+enum TLiwExtendedIf
+{
+	/*
+	 *  Extension interface UID to get service data interface
+	 *
+	 * @see CLiwServiceData
+	 */
+	KLiwGetServiceDataIf = 0x102830B2
+};
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MLiwNotifyCallback;
+class CLiwCriteriaItem;
+//typedef RPointerArray<CLiwCriteriaItem> RCriteriaArray;
+class CLiwServiceData;
+// CLASS DECLARATION
+
+/**
+* This is the base service interface to access providers that offer base services.
+*
+* This interface needs to be implemented by all the LIW providers. Base service
+* providers should inherit from this class directly. Menu service providers 
+* should inherit from CLiwServiceIfMenu.
+*
+* @lib ServiceHandler.lib
+* @since Series 60 2.6
+* @see CLiwServiceIfMenu
+**/
+class CLiwServiceIfBase : public CBase
+    {
+    public:
+        /** 
+        * Destructor.
+        */
+        IMPORT_C virtual ~CLiwServiceIfBase();
+
+        /**
+        * Called by the LIW framework to initialise provider with necessary information 
+        * from the Service Handler. This method is called when the consumer makes 
+        * the attach operation.
+        *
+        * @param aFrameworkCallback Framework provided callback for provider to send 
+        *                           events to framework.
+        * @param aInterest List of criteria items which invoked the provider.
+        */
+        virtual void InitialiseL(
+            MLiwNotifyCallback& aFrameworkCallback,
+            const RCriteriaArray& aInterest) = 0;
+        
+        /**
+        * Executes generic service commands included in criteria.
+        *
+        * @param aCmdId Command to be executed.
+        * @param aInParamList Input parameters, can be an empty list.
+        * @param aOutParamList Output parameters, can be an empty list.
+        * @param aCmdOptions Options for the command, see KLiwOpt* in LiwCommon.hrh.
+        * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
+        * @leave KErrArgument Callback is missing when required.
+        * @leave KErrNotSupported No provider supports service.
+        */
+        virtual void HandleServiceCmdL(
+            const TInt& aCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            const MLiwNotifyCallback* aCallback = NULL) = 0;
+
+        /**
+        * Executes generic service command
+        *
+        * @param aCmdName The service command to be executed.
+        * @param aInParamList Input parameters, can be an empty list.
+        * @param aOutParamList Output parameters, can be an empty list.
+        * @param aCmdOptions Options for the command, see KLiwOpt* in LiwCommon.hrh.
+        * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
+        * @leave KErrArgument Callback is missing when required.
+        * @leave KErrNotSupported No provider supports service.
+        */
+        void HandleServiceCmdL(                         
+            const TDesC8& aCmdName,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            const MLiwNotifyCallback* aCallback = NULL)
+          {
+            _LIT8(KGenericParamID,"cmd");
+          
+            ((CLiwGenericParamList&)aInParamList).AppendL(
+              TLiwGenericParam(KGenericParamID, TLiwVariant(aCmdName)));
+            
+            HandleServiceCmdL(KLiwCmdAsStr, aInParamList,
+                              aOutParamList, aCmdOptions, aCallback);
+          }
+
+		
+
+        // Rest of the class is for LIW's internal use and doesn't consern 
+        // service providers.
+        friend class CLiwServiceHandlerImpl;
+        friend class CLiwBinding;
+        friend class CLiwEcomMonitor;
+
+    protected:
+        IMPORT_C virtual void* ExtensionInterface(TUid aInterface);
+
+		private:
+        void SetDtorKeyId(TUid aDtorKeyId);
+        TBool Match(CLiwCriteriaItem* aItem);   
+        void AddCriteria(CLiwCriteriaItem* aItem);
+        TUid ImplementationUid() const;
+        void SetImplementationUid(TUid aUid);
+        TBool HasCriteria(CLiwCriteriaItem& aItem) const;
+
+    private:
+        TUid iDtorKeyId;
+        RCriteriaArray iCriterias;
+        TUid iImplUid;
+
+        // Reserved member        
+        TAny* iReserved;        
+    };
+
+
+#endif  // LIW_SERVICE_IF_BASE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_interface_base_api/liw_service_interface_base_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="ac14fe06672420dff3cfe6b40ffb20b8" dataversion="1.0">
+<name>liw_service_interface_base_api</name>
+<description>Base service interface, which needs to be implemented by all the providers.  Contains initialization services for the LIW Framework and service command execution.</description>
+<type>c++</type>
+<subsystem>languageinterworkingfw</subsystem>
+<libs><lib name="liwservicehandler.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_interface_menu_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       File that exports the files belonging to 
+:                LIW Service Interface Menu API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/LiwServiceIfMenu.h     MW_LAYER_PLATFORM_EXPORT_PATH(LiwServiceIfMenu.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_interface_menu_api/inc/liwserviceifmenu.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Declares service API for providers offering menu services for 
+*                consumers.
+*
+*/
+
+
+
+
+
+
+#ifndef LIW_SERVICE_IF_MENU_H
+#define LIW_SERVICE_IF_MENU_H
+
+// INCLUDES
+#include <liwserviceifbase.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CLiwMenuPane;
+
+// CLASS DECLARATION
+
+/**
+* This is the menu service interface to access providers that offer menu services.
+*
+* Menu service providers should inherit this class. Providers offering 
+* only base services should inherit CLiwServiceIfBase instead.
+*
+* @lib ServiceHandler.lib
+* @since Series 60 2.6
+* @see CLiwServiceIfBase
+**/
+class CLiwServiceIfMenu: public CLiwServiceIfBase
+    {
+    public:
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CLiwServiceIfMenu();
+
+        /**
+        * Provider should implement this method to initialise a menu pane by adding 
+        * provider specific menu items. The LIW framework gives the parameters to be 
+        * used in the addition process.
+        *
+        * @param aMenuPane Menu pane handle.
+        * @param aIndex The position of the item where to add menu items.
+        * @param aCascadeId ID of cascade menu item.
+        * @param aInParamList Input parameter list for provider's parameter checking.
+        */
+        virtual void InitializeMenuPaneL(
+            CLiwMenuPane& aMenuPane,
+            TInt aIndex,
+            TInt aCascadeId,
+            const CLiwGenericParamList& aInParamList) = 0;
+
+        /**
+        * Provider should implement this method to handle a menu command. Called by the 
+        * Service Handler when a consumer calls ExecuteMenuCmdL().
+        *
+        * @param aMenuCmdId Original provider specific ommand ID for the menu command.
+        *                   Defined in the provider's menu item resource.
+        * @param aInParamList Input parameters, can be an empty list.
+        * @param aOutParamList Output parameters, can be an empty list.
+        * @param aCmdOptions Options for the command, see KLiwCmdOpt* in LiwCommon.hrh.
+        * @param aCallback Callback if asynchronous command handling is wanted by consumer.
+        *                  The provider may or may not support this. A provider should 
+        *                  leave with KErrNotSupported, if not.
+        * @leave KErrNotSupported Callback is not supported.
+        */
+        virtual void HandleMenuCmdL(
+            TInt aMenuCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            const MLiwNotifyCallback* aCallback = NULL) = 0;
+
+        /**
+        * Returns current LIW menu pane for this menu service provider.
+        *
+        * @return Pointer to the current LIW menu pane object. 
+        */
+        IMPORT_C const CLiwMenuPane* MenuPane() const;
+        
+    protected:
+        IMPORT_C virtual void* ExtensionInterface(TUid aInterface);        
+        
+    private:
+        // Rest of the class is for LIW's internal use and doesn't consern 
+        // service providers.    
+        friend class CLiwServiceHandlerImpl;
+
+        void InitializeMenuPaneHookL(
+            CLiwMenuPane* aMenuPane,
+            TInt aIndex,
+            TInt aCascadeId,
+            const CLiwGenericParamList& aInParamList);
+
+        void HandleMenuCmdHookL(
+            CLiwMenuPane* aMenuPane,
+            TInt aMenuCmdId,
+            const CLiwGenericParamList& aInParamList,
+            CLiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            const MLiwNotifyCallback* aCallback = NULL);
+        
+    private:
+        CLiwMenuPane* iMenuPane; // Not owned.
+        
+        // Reserved member        
+        TAny* iSpare;         
+    };
+
+
+#endif // LIW_SERVICE_IF_MENU_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/liw_service_interface_menu_api/liw_service_interface_menu_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="6ffeead58bc28380a25b2d2fa6b2a07f" dataversion="1.0">
+<name>liw_service_interface_menu_api</name>
+<description>Menu interface, which need to be implemented by those providers hooking into menu items of consumer applications. Contains initialization and command handling methods that relate to menu UI element.</description>
+<type>c++</type>
+<subsystem>languageinterworkingfw</subsystem>
+<libs><lib name="liwservicehandler.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>yes</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Build file for rtsecurity manager client API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/rtsecmanager.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmanager.h)
+../inc/rtsecmgrscriptsession.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrscriptsession.h)
+../inc/rtsecmgrtrustinfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrtrustinfo.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/inc/rtsecmanager.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines Runtime security manager's core class. Defines
+ * 				  APIs for runtime bindings and clients to access security
+ * 				  management functionalities
+ *
+*/
+
+
+
+
+
+
+#ifndef _CRTSECMANAGER_H
+#define _CRTSECMANAGER_H
+
+#include <e32base.h>
+
+#include <rtsecmgrcommondef.h>
+#include <rtsecmgrtrustinfo.h>
+
+class CRTSecMgrScriptSession;
+class MSecMgrPromptHandler;
+class CRTSecMgrClientProxy;
+class CTrustInfo;
+class CPermission;
+
+/**
+ * Core class of the runtime recurity manager component.
+ * 
+ * Runtime security manager broadly offers 
+ *
+ *  - Policy management functions
+ *	- Script management functions
+ *  - Access permission check
+ *
+ * CRTSecManager offers methods to perform policy management functionalities
+ * such as 
+ * 	- Registering runtime security access policy
+ * 	- Updating the registered security access policy
+ * 	- Un-registering the registered security access policy 
+ * 
+ * Similarly, CRTSecManager offers methods for script management such as
+ * 	- Registering a runtime script with security manager
+ * 	- Un-registering the registered script
+ * 	- Obtaining scipt session associated with the registered script
+ * 
+ * The main functionality of CRTSecManager is to perform access permission
+ * check using script session functions
+ * 
+ * @lib rtsecmgrclient.lib
+ */
+NONSHARABLE_CLASS(CRTSecManager) : public CBase
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CRTSecManager instance
+	 *
+	 * Initializes client side security manager session. Starts the security
+	 * manager server, if it is not already running.
+	 * 
+	 * @return pointer to an instance of CRTSecManager
+	 */
+	IMPORT_C static CRTSecManager* NewL();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CRTSecManager instance and leaves the created instance
+	 * onto the cleanupstack.
+	 *
+	 * Initializes client side security manager session. Starts the security
+	 * manager server, if it is not already running.
+	 * 
+	 * @return pointer to an instance of CRTSecManager
+	 */
+	IMPORT_C static CRTSecManager* NewLC();
+
+	/**
+	 * Destructor
+	 * 
+	 * Closes client side security manager session
+	 */
+	IMPORT_C ~CRTSecManager();
+
+	/**
+	 * Registers a runtime security policy. Runtimes should call this function
+	 * to register their security access and trust policies.
+	 *
+	 * @param aSecPolicy RFile Handle to security policy file
+	 *
+	 * @return TPolicyID generated policy identifier if successul; Otherwise one of
+	 *					 system wide error codes
+	 *
+	 * \note
+	 * Clients should call ShareProtected on the file session object as shown below.
+	 * 
+	 * @code	 * 
+	 * 	RFs fileSession;
+	 * 	fileSession.Connect();
+	 * 	fileSession.ShareProtected(); //Mandatorily call before invoking SetPolicy
+	 * 
+	 * 	RFile secPolicyFile;
+	 * 	secPolicyFile.Open(fileSession, _L("AccessPolicy.xml"), EFileShareAny );
+	 * 	TPolicyID policyID = secMgr->SetPolicy(secPolicyFile);
+	 *
+	 *  if(policyID <= KErrNone)
+	 *  {
+	 *		//error..
+	 *	}
+	 * 
+	 * @endcode
+	 * 
+	 */
+	IMPORT_C TPolicyID SetPolicy(const RFile& aSecPolicy);
+	
+	/**
+	 * Registers a runtime security policy. Runtimes should call this function
+	 * to register their security access and trust policies.
+	 *
+	 * @param aPolicyBuffer const TDesC& security policy file buffer
+	 *
+	 * @return TPolicyID generated policy identifier if successul; Otherwise one of
+	 *					 system wide error codes
+	 *
+	 * \note
+	 * Clients should call ShareProtected on the file session object as shown below.
+	 * 
+	 * @code	 * 
+	 * 	RFs fileSession;
+	 * 	fileSession.Connect();
+	 * 	fileSession.ShareProtected(); //Mandatorily call before invoking SetPolicy
+	 * 
+	 * 	RFile secPolicyFile;
+	 * 	secPolicyFile.Open(fileSession, _L("AccessPolicy.xml"), EFileShareAny );	 
+	 *  HBufC8* fileBuffer = HBufC8::NewL(KFileBufferMaxLen);
+	 *  secPolicyFile.Read(*fileBuffer);
+	 *   
+	 * 	TPolicyID policyID = secMgr->SetPolicy(*fileBuffer);
+	 *
+	 *  if(policyID <= KErrNone)
+	 *  {
+	 *		//error..
+	 *	}
+	 * 
+	 * @endcode
+	 * 
+	 */
+	IMPORT_C TPolicyID SetPolicy(const TDesC8& aPolicyBuffer);
+
+	/**
+	 * UnRegisters a registered security policy. Runtimes should call this function
+	 * to de-register the already registered security policy.
+	 *
+	 * @param aPolicyID TPolicyID Policy identifier previously generated with SetPolicy
+	 *
+	 * @return TInt One of sytem wide error codes in case of failure; Otherwise KErrNone
+	 *    
+	 */
+	IMPORT_C TInt UnSetPolicy(TPolicyID aPolicyID);
+
+	/**
+	 * Updates an already registered security policy. Runtimes should call this function
+	 * to update their policy.
+	 *
+	 * @param aPolicyID TPolicyID Policy identifier previously generated with SetPolicy
+	 * @param aSecPolicy RFile Handle to security policy file
+	 *
+	 * @see SetPolicy for file session pre-conditions
+	 *
+	 * @return TPolicyID One of sytem wide error codes in case of failure; Otherwise the passed policyID
+	 *
+	 */
+	IMPORT_C TPolicyID UpdatePolicy(TPolicyID aPolicyID,const RFile& aSecPolicy);
+
+	/**
+	 * Updates an already registered security policy. Runtimes should call this function
+	 * to update their policy.
+	 *
+	 * @param aPolicyID TPolicyID Policy identifier previously generated with SetPolicy
+	 * @param aPolicyBuffer const TDesC& security policy file buffer
+	 *
+	 * @see SetPolicy for file session pre-conditions
+	 *
+	 * @return TPolicyID One of sytem wide error codes in case of failure; Otherwise the passed policyID
+	 *
+	 */
+	IMPORT_C TPolicyID UpdatePolicy(TPolicyID aPolicyID,const TDesC8& aPolicyBuffer);
+	
+	/**
+	 * Registers a script/executable. Runtimes should specify the trust information
+	 * of the script to be registered. 
+	 *
+	 * @param aPolicyID TPolicyID   Runtime's registered policy identifier
+	 * @param aTrustInfo CTrustInfo a valid instance of CTrustInfo object
+	 *
+	 * @return TExecutableID generated executable identifier if successul; Otherwise one of
+	 *					 	 system wide error codes
+	 *
+	 */
+	IMPORT_C TExecutableID RegisterScript(TPolicyID aPolicyID, const CTrustInfo& aTrustInfo);
+
+	/**
+	 * Registers a script/executable. Runtimes should specify the trust information
+	 * of the script to be registered. 
+	 *
+	 * @param aPolicyID TPolicyID   Runtime's registered policy identifier
+	 * @param aHashMarker const TDesC& Hash value to identify script when starting script session
+	 * @param aTrustInfo CTrustInfo a valid instance of CTrustInfo object
+	 *
+	 * @return TExecutableID generated executable identifier if successul; Otherwise one of
+	 *					 	 system wide error codes
+	 *
+	 */
+	IMPORT_C TExecutableID RegisterScript(TPolicyID aPolicyID, const TDesC& aHashMarker, const CTrustInfo& aTrustInfo);
+
+	/**
+	 * De-Registers a script/executable. Runtimes should pass the previously registered
+	 * script identifier corresponding to the script to be de-registered.
+	 *
+	 * @param aExeID TExecutableID   A valid script identifier
+	 *
+	 * @return TInt One of sytem wide error codes in case of failure; Otherwise KErrNone
+	 *     
+	 */
+	IMPORT_C TInt UnRegisterScript(TExecutableID aExeID, TPolicyID aPolicyID);
+
+	/**
+	 * Creates a script session instance. CRTSecMgrScriptSession performs access permission
+	 * check for native platform service invocation. A CRTSecMgrScriptSession instance needs to
+	 * be created for every instance of scripts which could potentially invoke platform service.
+	 *
+	 * @param aPolicyID TPolicyID    Valid registered policy identifier
+	 * @param aExeID TExecutableID   Script identifier, KAnonymousScript in case of anonymous script session
+	 * @param aPromptHdlr MSecMgrPromptHandler An optional prompt handler. If not provided, Security manager
+	 *							     will supply a default prompt handler
+	 *
+	 * @return CRTSecMgrScriptSession* A pointer to the created instance of CRTSecMgrScriptSession if the executableID is valid;
+	 * Otherwise NULL
+	 */
+	IMPORT_C CRTSecMgrScriptSession* GetScriptSessionL(TPolicyID aPolicyID, TExecutableID aExecID, MSecMgrPromptHandler* aPromptHdlr=NULL , const TDesC& aHashValue = KNullDesC);
+
+	/**
+	 * Creates a script session instance for an unregisterd trusted script. CRTSecMgrScriptSession performs access permission
+	 * check for native platform service invocation. 
+	 *
+	 * @param aPolicyID TPolicyID    Valid registered policy identifier
+	 * @param aTrustInfo CTrustInfo a valid instance of CTrustInfo object
+	 * @param aPromptHdlr MSecMgrPromptHandler An optional prompt handler. If not provided, Security manager
+	 *							     will supply a default prompt handler
+	 *
+	 * @return CRTSecMgrScriptSession* A pointer to the created instance of CRTSecMgrScriptSession;
+	 * 								  NULL in case of invalid policy identifier
+	 *           
+	 *     
+	 */
+	IMPORT_C CRTSecMgrScriptSession* GetScriptSessionL(TPolicyID aPolicyID, const CTrustInfo& aTrustInfo, MSecMgrPromptHandler* aPromptHdlr=NULL);
+
+	/**
+	 * Creates a script session instance. CRTSecMgrScriptSession performs access permission
+	 * check for native platform service invocation. A CRTSecMgrScriptSession instance needs to
+	 * be created for every instance of scripts which could potentially invoke platform service.
+	 *
+	 * @param aPolicyID TPolicyID    Valid registered policy identifier
+	 * @param aExeID TExecutableID   Script identifier, KAnonymousScript in case of anonymous script session
+	 * @param aHashValue TDesC		 hash value passed while registering the script
+	 * @param aPromptHdlr MSecMgrPromptHandler An optional prompt handler. If not provided, Security manager
+	 *							     will supply a default prompt handler
+	 *
+	 * @return CRTSecMgrScriptSession* A pointer to the created instance of CRTSecMgrScriptSession if the executableID is valid;
+	 * Otherwise NULL
+	 
+	IMPORT_C CRTSecMgrScriptSession* GetScriptSession(TPolicyID aPolicyID, TExecutableID aExecID, const TDesC& aHashValue, MSecMgrPromptHandler* aPromptHdlr=NULL);*/
+private:
+	//Private default constructor
+	CRTSecManager();
+
+	//Part of second-phase constructor
+	void ConstructL();
+
+private:
+	//Proxy to client side session object
+	CRTSecMgrClientProxy* iClientProxy;
+	};
+#endif //_CRTSECMANAGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/inc/rtsecmgrscriptsession.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,593 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Client side proxy class representing script session
+ *
+*/
+
+
+
+
+
+
+
+#ifndef _CRTSECMGRSCRIPTSESSION_H_
+#define	_CRTSECMGRSCRIPTSESSION_H_
+
+#include <rtsecmanager.rsg>
+#include <rtsecmgrcommondef.h>
+#include <rtsecmgrpermission.h>
+#include <rtsecmgrscript.h>
+#include <rtsecmgrtrustinfo.h>
+
+class CCoeEnv;
+class CRTSecMgrSubSessionProxy;
+
+/**
+ * Type holding data to be used while prompting. 
+ * 
+ * The default or custom (runtime over-ridden) prompt handler requires the permission
+ * type to prompt and the user-selection to be returned to security 
+ * manager for access permission check
+ * 
+ * @lib rtsecmgrclient.lib
+ */
+class CPromptData : public CBase
+	{
+public:
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPromptData instance
+	 *
+	 * @return pointer to an instance of CPromptData
+	 */
+	static CPromptData* NewL()
+		{
+		CPromptData* self = CPromptData::NewLC ();
+		CleanupStack::Pop (self);
+		return self;
+		}
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPromptData instance and leaves the created instance
+	 * onto the cleanupstack.
+	 *
+	 * @return pointer to an instance of CPromptData
+	 */
+	
+	static CPromptData* NewLC()
+		{
+		CPromptData* self = new (ELeave) CPromptData();
+		CleanupStack::PushL (self);
+		self->ConstructL ();
+		return self;
+		}
+		
+
+	/**
+	 * Destructor
+	 * 
+	 */
+	~CPromptData()
+		{
+		if(iPermission)
+			delete iPermission;
+		
+		}
+
+	
+	/*
+	 *
+	 *
+	 */
+	void ConstructL()
+	{
+		
+	}
+	
+	/**
+	 * Returns permission data
+	 * 
+	 * @return an object containing the permission data
+	 */
+	inline CPermission* Permission() const
+		{
+		return iPermission;
+		}
+
+	/**
+	 * Sets the user-selection data
+	 * 
+	 * @param aUserSelection TUserPromptOption user-selected data value
+	 */
+	inline void SetUserSelection(TUserPromptOption aUserSelection)
+		{
+		iUserSelection = aUserSelection;
+		}
+		
+	/**
+	 * Sets the permission value of the domain
+	 * 
+	 * @param aPermission CPermission permission value of the domain
+	 */
+	 
+	inline void SetPermissions(CPermission& aPermission)
+		{	
+		 if(iPermission)
+		 {
+		 	delete iPermission;
+		 	iPermission = NULL;
+		 }
+		 
+		 iPermission = CPermission::NewL(aPermission);
+ 		//iPermission = &aPermission;
+		}
+private:
+	//private default constructor
+	CPromptData::CPromptData() :
+		iUserSelection(RTUserPrompt_UnDefined)
+		{
+		}
+
+	//private permission data
+	CPermission* iPermission;
+
+	//private user-selection
+	TUserPromptOption iUserSelection;
+
+	friend class CRTSecMgrScriptSession;
+	};
+
+//typdef to model list of prompt data structure
+typedef RPointerArray<CPromptData> RPromptDataList;
+
+/* 
+ * Prompt callback handler class. 
+ * 
+ * Runtimes should implement the prompt handler function to prompt the user 
+ * and to obtain the user option chosen. The prompt data are used by
+ * runtime security manager for further access permission check. 
+ * 
+ * If runtimes do not override prompt handling, security manager component 
+ * would then provide default prompt handler functionality.
+ *
+ * @lib rtsecmgrclient.lib
+ */
+class MSecMgrPromptHandler
+	{
+public:
+	/**
+	 * Prompts the user.
+	 * 
+	 * @param aPromptDataList RPromptDataList list of prompt data used by
+	 * prompt callback handler to show to the user
+	 * 
+	 * @return KErrNone if prompting successful; In case of failure, one of
+	 * system wide error codes
+	 */
+	virtual TInt Prompt(RPromptDataList& aPromptDataList , TExecutableID aExecID  = KAnonymousScript) =0;
+
+	/**
+	 * Sets the user chosen prompt selection.
+	 * 
+	 * @param aPromptUiOption TSecMgrPromptUIOption prompt selection
+	 */
+	virtual void SetPromptOption(TSecMgrPromptUIOption aPromptUiOption) =0;
+	/**
+	 * Returns the prompt selection
+	 * 
+	 * @return TSecMgrPromptUIOption the prompt selection
+	 */
+	virtual TSecMgrPromptUIOption PromptOption() const =0;
+	};
+
+/**
+ *
+ * Thin proxy to the client side sub-session handle. 
+ * 
+ * This class implements the default prompt handling functionality. In addition, the main
+ * functionality of native platform access check is performed by CRTSecMgrScriptSession.
+ *
+ * @lib rtsecmgrclient.lib
+ * 
+ */
+NONSHARABLE_CLASS(CRTSecMgrScriptSession) : public CBase, MSecMgrPromptHandler
+	{
+public:
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CRTSecMgrScriptSession instance
+	 *
+	 * Initializes client side script sub-session. 
+	 * 
+	 * @param MSecMgrPromptHandler pointer to a prompt handler callback
+	 * 
+	 * @return pointer to an instance of CRTSecMgrScriptSession if succesful; 
+	 * Otherwise NULL
+	 */
+	static CRTSecMgrScriptSession* NewL(MSecMgrPromptHandler* aPromptHdlr=0);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CRTSecMgrScriptSession instance and leaves the created instance
+	 * on the cleanupstack
+	 *
+	 * Initializes client side script sub-session. 
+	 * 
+	 * @param MSecMgrPromptHandler pointer to a prompt handler callback
+	 * 
+	 * @return pointer to an instance of CRTSecMgrScriptSession if succesful; 
+	 * Otherwise NULL
+	 */
+	static CRTSecMgrScriptSession* NewLC(MSecMgrPromptHandler* aPromptHdlr=0);
+	
+	/**
+	 * Callback funciton for moreinfo link in advanced prompt
+	 * 
+	 * Calls the moreinfo function for indivudual capability or for a alias group
+	 * 
+	 * @param aCallbackParam TAny* pointer to TCallbackParam
+	 * 
+	 */
+  static TInt LinkCallback(TAny *aCallbackParam);
+
+	/**
+	 * Destructor
+	 * 
+	 * Closes the sub-session
+	 *
+	 */
+	IMPORT_C ~CRTSecMgrScriptSession();
+
+	/**
+	 * Opens security manager script sub-session. This method in turn opens a
+	 * sub-session on the server side, by bringing script related data onto the cache. 
+	 * 
+	 * @param aParentSession RSessionBase handle to parent security manager session
+	 * @param aPolicyID TPolicyID policy identifier of the script associated with this script session
+	 * @param aExecID TExecutableID identifier of the script associated with this script session
+	 * 
+	 * @return KErrNone if successful; In case of failure, one of system wide error cods
+	 */
+	TInt Open(const RSessionBase& aParentSession,TPolicyID aPolicyID,TExecutableID aExecID);
+
+	/**
+	 * Opens security manager script sub-session. This method in turn opens a
+	 * sub-session on the server side, by bringing script related data onto the cache. 
+	 * 
+	 * @param aParentSession RSessionBase handle to parent security manager session
+	 * @param aPolicyID TPolicyID policy identifier of the script associated with this script session
+	 * @param aExecID TExecutableID identifier of the script associated with this script session
+	 * @param aHashValue TDesC		hash value of the scrpt passed while registering the script
+	 * 
+	 * @return KErrNone if successful; In case of failure, one of system wide error cods
+	 */
+	TInt Open(const RSessionBase& aParentSession,TPolicyID aPolicyID,TExecutableID aExecID,const TDesC& aHashValue);
+
+	/**
+	 * Opens security manager script sub-session. This method in turn opens a
+	 * sub-session on the server side, by bringing script related data onto the cache. 
+	 * 
+	 * @param aParentSession RSessionBase handle to parent security manager session
+	 * @param aPolicyID TPolicyID policy identifier of the script associated with this script session
+	 * @param aExecID TExecutableID identifier of the script associated with this script session
+	 * @param aTrustInfo CTrustInfo trust data structure
+	 * 
+	 * @return KErrNone if successful; In case of failure, one of system wide error cods
+	 */
+	TInt Open(const RSessionBase& aParentSession,TPolicyID aPolicyID,TExecutableID aExecID,const CTrustInfo& aTrustInfo);
+
+	/**
+	 * Performs access permission check
+	 * 
+	 * This method evaluates access permission by comparing the expected capabilities
+	 * to perform service invocation with the capabilities of the script. The
+	 * capabilities of the script is computed as sum of :
+	 * 	
+	 * 	-	default allowed capabilities as specified in security access policy
+	 * 	-	user-granted capabilities, allowed by user while prompting
+	 *
+	 * The capabilities allowed by the user could be of various durations, like
+	 * session-based, blanket/permanent and the one valid for the current invocation only 
+	 * (one-shot)
+	 * 
+	 * @param aCapabilitiesToCheck RCapabilityArray list of capabilities to be checked against
+	 * script's capbilities
+	 * 
+	 * @return EAccessOk if the access permission check is successful; Else, EAccessNOk
+	 */
+	IMPORT_C TInt IsAllowed(const RCapabilityArray& aCapabilitiesToCheck);
+
+	/**
+	 * Performs access permission check
+	 * 
+	 * This overloaded method evaluates access permission by comparing the expected capabilities
+	 * to perform service invocation with the capabilities of the script. The
+	 * capabilities of the script is computed as sum of :
+	 * 	
+	 * 	-	default allowed capabilities as specified in security access policy
+	 * 	-	user-granted capabilities, allowed by user while prompting
+	 *
+	 * The capabilities allowed by the user could be of various durations, like
+	 * session-based, blanket/permanent and the one valid for the current invocation only 
+	 * (one-shot)
+	 * 
+	 * This overloaded version returns the list of capabilities that do not match after
+	 * access permission check. This can be used by the client to display to the user the
+	 * list of unmatched capabilities
+	 * 
+	 * @param aCapabilitiesToCheck RCapabilityArray list of capabilities to be checked against
+	 * script's capbilities
+	 * @param aUnMatchedCapabilities RCapabilityArray list of unmatched capabilities
+	 * 
+	 * @return EAccessOk if the access permission check is successful; Else, EAccessNOk
+	 */
+	IMPORT_C TInt IsAllowed(const RCapabilityArray& aCapabilitiesToCheck,RCapabilityArray& aUnMatchedCapabilities);
+
+	/**
+	 * Definition of default prompt handler.
+	 * 
+	 * @param aPromptDataList RPromptDataList list of prompt data used by
+	 * prompt callback handler to show to the user
+	 * 
+	 * @return KErrNone if prompting successful; In case of failure, one of
+	 * system wide error codes
+	 *
+	 */
+	TInt Prompt(RPromptDataList& aPromptDataList , TExecutableID aExecID = KAnonymousScript);
+    
+    /**
+	 * Definition of cost notification.
+	 * 
+	 */
+    void PromptCostL() ; 
+    
+	/**
+	 * Gets the underlying script object
+	 * 
+	 * This method is to be used by components, such as application manager,
+	 * that are interested in displaying script related information to the user.
+	 * 
+	 * Following are the script related information:
+	 * 
+	 * 	- Capabilities allowed by default
+	 * 	- User-grantable capabilities
+	 * 	- Currently allowed or denied blanket permissions
+	 *
+	 * Note that this method should not be used by runtimes unless and until there is
+	 * a strong design justification
+	 * 
+	 * @return a reference to underlying script object
+	 */
+	inline CScript& CRTSecMgrScriptSession::Script()
+		{
+		return *iScript;
+		}
+
+	/**
+	 * Returns prompt handler reference
+	 * 
+	 * @return reference to prompt handler
+	 */
+	inline MSecMgrPromptHandler* PromptHandler() const
+		{
+		return iPromptHdlr;
+		}
+
+	/**
+	 * Sets prompt UI option. The supported prompt options are :
+	 * 
+	 * 	-	Basic/Default
+	 * 	- 	Advanced
+	 * 
+	 * The difference between the basic and advanced prompt option
+	 * reisdes in the fact the number of prompt options and the corresponding
+	 * prompt texts displayed would be different.
+	 * 
+	 * If not explictly, the default prompt UI option is set to basic/default prompt UI.
+	 * 
+	 * @param aUIPromptOption TSecMgrPromptUIOption basic/advanced prompt UI option
+	 */
+	inline void SetPromptOption(TSecMgrPromptUIOption aUIPromptOption)
+		{
+		iUIPromptOption = aUIPromptOption;
+		}
+
+	/**
+	 * Gets prompt UI option. The supported prompt options are :
+	 * 
+	 * 	-	Basic/Default
+	 * 	- 	Advanced
+	 * 
+	 * The difference between the basic and advanced prompt option
+	 * reisdes in the fact the number of prompt options and the corresponding
+	 * prompt texts displayed would be different.
+	 * 
+	 * @return aUIPromptOption TSecMgrPromptUIOption basic/advanced prompt UI option
+	 */
+	inline TSecMgrPromptUIOption PromptOption() const
+		{
+		return iUIPromptOption;
+		}
+
+private:
+	/*
+	 * Default private constructor
+	 * 
+	 */
+	CRTSecMgrScriptSession(MSecMgrPromptHandler* aPromptHdlr=0);
+
+	/*
+	 * Two phased constructor
+	 * 
+	 */
+	void ConstructL();
+
+	/*
+	 * Contains prompt logic
+	 * 
+	 */
+	TInt Prompt(CPromptData* aPromptData);
+	
+	/*
+	 * Private default implementation for advanced prompt UI option
+	 * 
+	 */
+	TInt PromptAdvanced(CPromptData* aPromptData);
+
+	/* 
+	 * Logic for displaying more inormation when the user selects more info
+	 * 
+	 */
+	TInt MoreInfoL(CPromptData& aPromptData);
+	
+	/*
+	 * Logic identifying the user-selection of prompt
+	 * duration
+	 * 
+	 */
+	void HandleGrantChosen(CPromptData* aPromptData,
+		TCapabilityBitSet aCapBitSet, TCapabilityBitSet& aAllowedCaps,
+		TBool& aIsPermGrantModified);
+
+	/*
+	 * Private implementation to update blanket permission data
+	 * 
+	 */
+	void UpdatePermGrant();
+	
+	/*
+	 * Conversion utility to convert a single 32-bit value to the list of
+	 * capabilities (RArray<TCapability>)
+	 * 
+	 */
+	void BuildCapsL(TCapabilityBitSet aCapBitSet, RCapabilityArray& aInOutTCapList);
+
+	/*
+	 * Private implementation to evaluate access permission check
+	 * 
+	 */
+	TInt IsAllowed(const RCapabilityArray& aCapsToCheck,RPromptDataList& aPromptDataList,TCapabilityBitSet& aUnMatchedCapBits);
+
+	/*
+	 * Private implementation to evaluate access permission check. This
+	 * overloaded version additionally returns the unmatched capabilities
+	 * 
+	 */
+	TInt IsAllowed(const RCapabilityArray& aCapsToCheck,TCapabilityBitSet& aUnMatchedCapBits);
+
+	/*
+	 * Conversion utility to generate an unsigned 32-bit value toggling the individual bits
+	 * to the corresponding TCapability value
+	 * 
+	 */
+	void AddCapability(TCapabilityBitSet& aInOutCapBitSet, TCapability aCapToSet);
+
+	/*
+	 * Attempts to close the script sub-session
+	 * 
+	 */
+	void Close();
+
+	void AddResourceFiles();
+	void CloseResourceFiles();
+
+private:
+	/*
+	 * permissions allowed or denied for the current session
+	 * The lifetime of this data structure is associated
+	 * with this script session
+	 * 
+	 */
+	struct
+		{
+		TCapabilityBitSet AllowedCaps; //caps allowed for this session (caps allowed for this session & perm allowed)
+		TCapabilityBitSet DeniedCaps; //caps denied for this sesion (caps denied for this session & perm denied)
+		}_sessionInfo;
+
+	/*
+	 * anonymous enumerations for selection index
+	 * 
+	 */
+	enum
+		{
+		PROMPT_SELIDX_ZERO = 0,
+		PROMPT_SELIDX_ONE = PROMPT_SELIDX_ZERO + 1,
+		PROMPT_SELIDX_TWO = PROMPT_SELIDX_ZERO + 2,
+		PROMPT_SELIDX_THREE = PROMPT_SELIDX_ZERO + 3,
+		PROMPT_SELIDX_FOUR = PROMPT_SELIDX_ZERO + 4,
+		PROMPT_SELIDX_FIVE = PROMPT_SELIDX_ZERO + 5
+		};
+
+	/*
+	 * private script reference
+	 * 
+	 */
+	CScript* iScript;
+
+	/*
+	 * permanently allowed capability bits
+	 * 
+	 */
+	TPermGrant iPermBits; //perm allowed caps, persistently stored for this script
+
+	/*
+	 * permanently denied capability bits
+	 * 
+	 */
+	TPermGrant iDeniedBits; //perm denied caps, persistently stored for this script
+
+	/*
+	 * reference to prompt handler instance
+	 * 
+	 */
+	MSecMgrPromptHandler* iPromptHdlr;
+
+	/*
+	 * sub-session proxy pointer
+	 * 
+	 */
+	CRTSecMgrSubSessionProxy* iSubSessionProxy;
+
+	/*
+	 * pointer to Coe environment
+	 */
+	CCoeEnv* iCoeEnv;
+
+	/*
+	 * security manager resource file offset value
+	 * 
+	 */
+	TInt iResourceOffset;
+
+	/*
+	 * Prompt UI option
+	 * 
+	 */
+	TSecMgrPromptUIOption iUIPromptOption;
+	
+	/*
+	 * Custom prompt flag
+	 * 
+	 */
+	TBool isCustomPrompt;
+	};
+
+#endif //_CRTSECMGRSCRIPTSESSION_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/inc/rtsecmgrtrustInfo.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Models trust information
+ *
+*/
+
+
+
+
+
+
+
+#ifndef _CTRUSTINFO_H_
+#define _CTRUSTINFO_H_
+
+#include <rtsecmgrcommondef.h>
+
+/**
+ * CTrustInfo models trust data structure.
+ * 
+ * The runtime security manager evaluates trustedness of a 
+ * runtime content/script/executable based on the trust information
+ * passed by runtimes. The definition of this type is currently
+ * incomplete, with state information such as
+ *  
+ * 	- Origin of the script
+ * 	- Certificate chain of the signed trusted contents
+ *  
+ * @lib rtsecmgrclient.lib
+ */
+NONSHARABLE_CLASS(CTrustInfo) : public CBase
+	{
+public:
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CTrustInfo instance
+	 *
+	 * @return pointer to an instance of CTrustInfo
+	 */
+	IMPORT_C static CTrustInfo* NewL();
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CTrustInfo instance and leaves the created instance
+	 * on the cleanupstack
+	 *
+	 * @return pointer to an instance of CTrustInfo
+	 */
+	IMPORT_C static CTrustInfo* NewLC();
+
+	/**
+	 * Destructor
+	 * 
+	 */
+	IMPORT_C ~CTrustInfo();
+private:
+	/*
+	 * Default private constructor 
+	 */
+	CTrustInfo();
+	};
+
+#endif //_CTRUSTINFO_H_
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/rtsecuritymanager_client_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="d1675f0eec9be17120c61a78d0b35b56" dataversion="1.0">
+<name>rtsecuritymanager client api</name>
+<description>rtsecuritymanager client API</description>
+<type>c++</type>
+<subsystem>rtsecuritymanager</subsystem>
+<libs><lib name="RTSecMgrClient.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/bwins/ui_tsecuritymanageru.def	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/conf/ui_tsecuritymanager.cfg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,373 @@
+//1
+[Test]
+title Simulate KeyDown event
+pause 1000
+presskey global EKeyDownArrow
+pause 1000
+presskey global EKeyDevice0
+[Endtest]
+
+//2
+[Test]
+title secclient1 setpolicy buffer nohash buffer1000
+bringtoforeground
+create ui_tsecuritymanager  foobar
+foobar secclient1   buffer1000  Buffer  nohash
+delete foobar
+sendtobackground
+[Endtest] 
+
+//3
+[Test]
+title secclient1 setpolicy file nohash buffer1000
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient1    buffer1000  File    nohash
+//foobar secclient1
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+
+//4
+[Test]
+title secclient1 setpolicy buffer hash buffer1000
+bringtoforeground
+create ui_tsecuritymanager  foobar
+foobar secclient1  buffer1000 Buffer  hash
+delete foobar
+sendtobackground
+[Endtest] 
+
+//5
+[Test]
+title secclient1 setpolicy file hash buffer1000
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient1  buffer1000  File    hash
+delete foobar
+sendtobackground
+[Endtest] 
+
+//6
+[Test]
+title secclient2 2 crtsecmanager sessions
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient2 pa ra me ters
+delete foobar
+sendtobackground
+[Endtest] 
+
+//7
+[Test]
+title secclient3 using unsetpolicy id
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient3 pa ra me ters
+delete foobar
+sendtobackground
+[Endtest] 
+
+//8
+[Test]
+title secclient4 using unregister sript
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient4 pa ra me ters
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+//9
+[Test]
+title secclient5 creating instance 1000 times
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient5 pa ra me ters
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+//10
+[Test]
+title secclient6  unregister twice
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient6 pa ra me ters
+delete foobar
+sendtobackground
+[Endtest] 
+
+//11
+[Test]
+title secclient7 updatepolicy with setpolicy gsswithtrust
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient7 gsswithtrust
+delete foobar
+sendtobackground
+[Endtest] 
+
+//12
+[Test]
+title secclient7 updatepolicy with setpolicy gsswithouttrust
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient7 gsswithouttrust
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+ //13
+[Test]
+title secclient8 update policy buffer registerscript 
+bringtoforeground
+create ui_tsecuritymanager  foobar
+foobar secclient8 Buffer  registerscript
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+
+//14
+[Test]
+title secclient8 update policy buffer file   noregisterscript
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient8  File    noregisterscript
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+//15
+[Test]
+title secclient8 update policy buffer noregisterscript 
+bringtoforeground
+create ui_tsecuritymanager  foobar
+foobar secclient8 Buffer  noregisterscript
+delete foobar
+sendtobackground
+[Endtest] 
+
+//16
+[Test]
+title secclient8 update policy buffer file   registerscript
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient8  File    registerscript
+delete foobar
+sendtobackground
+[Endtest] 
+
+//17
+[Test]
+title serverstart1 testcase
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar serverstart1 pa ra me ters
+delete foobar
+sendtobackground
+[Endtest] 
+
+//18
+[Test]
+title secclient9  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient9   hash
+delete foobar
+sendtobackground
+[Endtest] 
+
+
+//19
+[Test]
+title secclient9_2  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient9   nohash
+delete foobar
+sendtobackground
+[Endtest]
+
+
+
+
+//20
+[Test]
+title Simulate KeyDown event
+pause 1000
+presskey global EKeyUpArrow
+pause 1000
+presskey global EKeyDevice0
+[Endtest]
+
+
+//21
+[Test]
+title Simulate KeyDown event
+pause 1000
+presskey global EKeyDownArrow
+pause 1000
+presskey global EKeyDownArrow
+pause 3000
+presskey global EKeyDownArrow
+pause 3000
+presskey global EKeyDevice0
+ 
+[Endtest]
+
+//22
+[Test]
+title Simulate KeyDown event
+bringtoforeground
+pause 2000
+presskey global EKeyDevice0
+pause 2000
+presskey global EKeyDevice0
+sendtobackground
+[Endtest]
+
+
+ //23
+[Test]
+title secclient8 update policy buffer file   registerscript advancedprompt
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient8  File    registerscript advancedprompt
+delete foobar
+sendtobackground
+[Endtest]
+
+
+//24
+[Test]
+title Simulate KeyDown event
+pause 2000
+presskey  global EKeyEnter
+pause 2000
+presskey global EKeyEnter
+[Endtest]
+
+
+//25
+[Test]
+title secclient10 update policy buffer file   registerscript
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient10  File    registerscript
+delete foobar
+sendtobackground
+[Endtest]
+
+
+//26
+[Test]
+title Simulate KeyDown event
+pause 2000
+presskey global EKeyDownArrow
+pause 2000
+presskey global EKeyDevice0
+pause 2000
+presskey global EKeyDevice0
+//pause 2000
+//presskey global EKeyDownArrow
+pause 2000
+presskey global EKeyDevice0
+ 
+[Endtest]
+
+
+//27
+[Test]
+title secclient11  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient11  buffer1000  Buffer  nohash 
+delete foobar
+sendtobackground
+[Endtest]
+
+//28
+[Test]
+title secclient11  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient11  buffer1000  File  hash       
+delete foobar
+sendtobackground
+[Endtest]
+
+
+//29
+[Test]
+title Simulate KeyDown event
+presskey global EKeyDevice0
+bringtoforeground
+presskey global EKeyDevice0
+sendtobackground
+[Endtest]
+
+
+//30
+[Test]
+title Simulate KeyDown event
+bringtoforeground
+pause 2000
+presskey global EKeyDevice0
+sendtobackground 
+[Endtest]
+
+
+//31
+[Test]
+title secclient12  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient12         
+delete foobar
+sendtobackground
+[Endtest]
+
+
+//32
+[Test]
+title secclient13_1  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient13  1       
+delete foobar
+sendtobackground
+[Endtest]
+
+
+//33
+[Test]
+title secclient13_2  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient13   2      
+delete foobar
+sendtobackground
+[Endtest]
+
+
+//34
+[Test]
+title secclient13_3  
+bringtoforeground
+create ui_tsecuritymanager foobar
+foobar secclient13  3      
+delete foobar
+sendtobackground
+[Endtest]
+
+
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/conf/ui_tsecuritymanager_comb.cfg	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,373 @@
+//1
+[Test]
+
+title secclient1 setpolicy buffer nohash buffer1000
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 2
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//2
+[Test]
+
+title secclient1 setpolicy alwaysallow_buffer_nohash_buffer1000
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 2
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 20
+
+[Endtest]
+
+
+//3
+[Test]
+
+title secclient1 setpolicy moreinfo_buffer_nohash_buffer1000
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 2
+
+// Press Key
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 21
+
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 22
+
+[Endtest]
+
+
+
+//4
+[Test]
+
+title secclient1 setpolicy file nohash buffer1000
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 3 
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+//5
+
+[Test]
+
+title secclient1 setpolicy buffer hash buffer1000
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 4 
+
+// Press Key
+
+//run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+//4
+
+[Test]
+
+title secclient1 setpolicy file hash buffer1000
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 5
+
+// Press Key
+
+//run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//5
+
+[Test]
+
+title secclient2 2 crtsecmanager sessions
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 6
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//6
+
+[Test]
+
+title secclient3 using unsetpolicy id
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 7
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+//7
+
+[Test]
+
+title secclient4 using unregister sript
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 8
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+//8
+
+[Test]
+title secclient5 creating instance 1000 times
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 9
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//9
+
+[Test]
+title secclient6  unregister twice
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 10
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+//10
+
+[Test]
+title secclient7 updatepolicy with setpolicy gsswithtrust
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 11
+
+// Press Key
+
+//run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+
+//11
+
+[Test]
+title secclient7 updatepolicy with setpolicy gsswithouttrust
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 12
+
+// Press Key
+
+//run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+//12
+
+[Test]
+title secclient8 update policy buffer registerscript 
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 13
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//13
+
+[Test]
+title secclient8 update policy buffer file   noregisterscript
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 14
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+
+
+//14
+
+[Test]
+title secclient8 update policy buffer noregisterscript 
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 15
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+//15
+
+[Test]
+title secclient8 update policy buffer file   registerscript 
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 16
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//16
+
+[Test]
+title serverstart1 testcase 
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 17
+
+// Press Key
+
+//run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//17
+
+[Test]
+title secclient9  
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 18
+
+// Press Key
+
+//run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+//18
+
+[Test]
+title secclient9_2 
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 19
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 1
+
+[Endtest]
+
+
+
+//19
+
+[Test]
+title secclient8 update policy buffer file   registerscript advancedprompt
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 23
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 26
+
+[Endtest]
+
+
+//20
+
+[Test]
+title secclient10 update policy buffer file   registerscript
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 25
+
+// Press Key
+
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 22
+
+[Endtest]
+
+
+
+
+//21
+
+[Test]
+title secclient12 test valid policy file
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 31
+
+ 
+
+[Endtest]
+
+
+
+//22
+
+[Test]
+title secclient13_1 test  valid policy file
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 32
+
+[Endtest]
+
+//22
+
+[Test]
+title secclient13_2 test  valid policy file
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 33
+
+[Endtest]
+
+
+//23
+
+[Test]
+title secclient13_3 test  valid policy file
+// Show avkonlist
+run testscripter c:\testframework\ui_tsecuritymanager.cfg 34
+
+[Endtest]
+
+
+ 
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<policy>
+		<!-- an alias groups a set of capabilities under one name -->
+		<alias name="UserDataGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>ReadUserData</capability>
+					<capability>WriteUserData</capability>
+					<capability>Location</capability>
+					<capability>UserEnvironment</capability>
+				</capabilities>
+		</alias>
+		
+		<alias name="DeviceResourcesGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>MultimediaDD</capability>
+					<capability>ReadDeviceData</capability>
+					<capability>WriteDeviceData</capability>
+					<capability>CommDD</capability>
+					<capability>SurroundingsDD</capability>
+					<capability>NetworkControl</capability>
+					<!--capability>SwEvent</capability-->
+				</capabilities>
+		</alias>
+		
+		<alias name="NetworkGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>NetworkServices</capability>
+					<capability>LocalServices</capability>
+				</capabilities>
+		</alias>
+			
+					
+		<!-- specify a protection domain -->
+		<domain name="UnTrusted">				
+				<allow>
+						<capabilities>
+								<capability>SwEvent</capability>
+								 
+								
+						</capabilities>
+				</allow>
+				
+				<!-- user-grantable capabilities for this domain -->
+				<user>
+						<condition>oneshot</condition>
+						<condition>session</condition>
+						<condition>blanket</condition>
+						<defaultCondition>session</defaultCondition>
+						<capabilities>
+								<capability>NetworkGroup</capability>
+							    <capability>UserDataGroup</capability>
+								<capability>DeviceResourcesGroup</capability>
+								<!--capability>ReadUserData</capability>
+								<capability>WriteUserData</capability>
+								<capability>Location</capability-->					
+						</capabilities>
+				</user>
+		</domain>
+		
+			
+</policy>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy_1.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE policy>
+<policy>
+		<!-- an alias groups a set of capabilities under one name -->
+		<alias name="UserDataGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>ReadUserData</capability>
+					<capability>WriteUserData</capability>
+					<capability>Location</capability>
+					<capability>UserEnvironment</capability>
+				</capabilities>
+		</alias>
+		
+		<alias name="DeviceResourcesGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>MultimediaDD</capability>
+					<capability>ReadDeviceData</capability>
+					<capability>WriteDeviceData</capability>
+					<capability>CommDD</capability>
+					<capability>SurroundingsDD</capability>
+					<capability>NetworkControl</capability>
+					<!--capability>SwEvent</capability-->
+				</capabilities>
+		</alias>
+		
+		<alias name="NetworkGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>NetworkServices</capability>
+					<capability>LocalServices</capability>
+				</capabilities>
+		</alias>
+			
+					
+		<!-- specify a protection domain -->
+		<domain name="UnTrusted">				
+				<allow>
+						<capabilities>
+								<capability>SwEvent</capability>
+								 
+								
+						</capabilities>
+				</allow>
+				
+				<!-- user-grantable capabilities for this domain -->
+				<user>
+						<condition>oneshot</condition>
+						<condition>session</condition>
+						<condition>blanket</condition>
+						<defaultCondition>session</defaultCondition>
+						<capabilities>
+								<capability>NetworkGroup</capability>
+							    <capability>UserDataGroup</capability>
+								<capability>DeviceResourcesGroup</capability>
+								<!--capability>ReadUserData</capability>
+								<capability>WriteUserData</capability>
+								<capability>Location</capability-->					
+						</capabilities>
+				</user>
+		</domain>
+		
+			
+<policy>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy_2.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE policy>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/data/accesspolicy_3.xml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE policy>
+<policy>
+		<!-- an alias groups a set of capabilities under one name -->
+		<alias name="UserDataGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>ReadUserData</capability>
+					<capability>WriteUserData</capability>
+					<capability>Location</capability>
+					<capability>UserEnvironment</capability>
+				</capabilities>
+		</alias>
+		
+		<alias name="DeviceResourcesGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>MultimediaDD</capability>
+					<capability>ReadDeviceData</capability>
+					<capability>WriteDeviceData</capability>
+					<capability>CommDD</capability>
+					<capability>SurroundingsDD</capability>
+					<capability>NetworkControl</capability>
+					<!--capability>SwEvent</capability-->
+				</capabilities>
+		</alias>
+		
+		<alias name="NetworkGroup">
+				<info>This can contain info which can be displayed with capabilities while prompting</info>				
+				<capabilities>
+					<capability>NetworkServices</capability>
+					<capability>LocalServices</capability>
+				</capabilities>
+		</alias>
+			
+					
+		<!-- specify a protection domain -->
+		<domain name="UnTrusted">				
+				<allow>
+						<capabilities>
+								<capability>SwEvent</capability>
+								 
+								
+						</capabilities>
+				</allow>
+				
+				<!-- user-grantable capabilities for this domain -->
+				<user>
+						<condition>oneshot</condition>
+						<condition>session</condition>
+						<condition>blanket</condition>
+						<defaultCondition>session</defaultCondition>
+						<capabilities>
+								<capability>NetworkGroup</capability>
+							    <capability>UserDataGroup</capability>
+								<capability>DeviceResourcesGroup</capability>
+								<!--capability>ReadUserData</capability>
+								<capability>WriteUserData</capability>
+								<capability>Location</capability-->					
+						</capabilities>
+				</user>
+		</domain>
+		
+			
+</Policy>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/eabi/ui_tsecuritymanageru.def	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:        ?Description
+*
+*/
+
+
+
+
+
+
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+//../init/testframework.ini      /epoc32/WINSCW/C/TestFramework/testframework.ini 
+../conf/ui_tsecuritymanager.cfg      /epoc32/WINSCW/C/TestFramework/ui_tsecuritymanager.cfg
+../conf/ui_tsecuritymanager_comb.cfg      /epoc32/WINSCW/C/TestFramework/ui_tsecuritymanager_comb.cfg
+../data/accesspolicy.xml           /epoc32/WINSCW/C/data/others/accesspolicy.xml  
+../data/accesspolicy_1.xml           /epoc32/WINSCW/C/data/others/accesspolicy_1.xml 
+../data/accesspolicy_2.xml           /epoc32/WINSCW/C/data/others/accesspolicy_2.xml 
+../data/accesspolicy_3.xml           /epoc32/WINSCW/C/data/others/accesspolicy_3.xml 
+
+
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+ui_tsecuritymanager.mmp
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/group/ui_tsecuritymanager.mmp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:      
+*
+*/
+
+
+
+
+
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:  ?Description
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the OS_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          ui_tsecuritymanager.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         ui_tsecuritymanager.def
+
+SOURCEPATH      ../src
+SOURCE          ui_tsecuritymanager.cpp
+SOURCE          ui_tsecuritymanagerBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+USERINCLUDE     ../inc 
+
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+ 
+LIBRARY           apparc.lib
+LIBRARY           cone.lib 
+LIBRARY           eikcore.lib  
+LIBRARY           avkon.lib  
+LIBRARY           gdi.lib  
+LIBRARY			  		RTSecMgrClient.lib  
+LIBRARY 					efsrv.lib 
+LIBRARY			RTSecMgrUtil.lib bafl.lib AknSkins.lib Flogger.lib
+LIBRARY         ws32.lib eikcoctl.lib eikctl.lib  apgrfx.lib aknskins.lib aknskinsrv.lib aknswallpaperutils.lib 
+
+LANG            SC
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/inc/ui_tsecuritymanager.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:        ?Description
+*
+*/
+
+
+
+
+
+
+
+
+
+#ifndef UI_TSECURITYMANAGER_H
+#define UI_TSECURITYMANAGER_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <RTSecMgrScriptSession.h>
+#include <rtsecmgrcommondef.h>
+
+// Forward reference
+ class CRTSecManager;
+class CTrustInfo;
+class RSecMgrSession;
+class RSecMgrSubSession;
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( Kui_tsecuritymanagerLogPath, "\\logs\\testframework\\ui_tsecuritymanager\\" ); 
+// Log file
+_LIT( Kui_tsecuritymanagerLogFile, "ui_tsecuritymanager.txt" ); 
+_LIT( Kui_tsecuritymanagerLogFileWithTitle, "ui_tsecuritymanager_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class Cui_tsecuritymanager;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  Cui_tsecuritymanager test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(Cui_tsecuritymanager) : public CScriptBase,public RSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Cui_tsecuritymanager* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~Cui_tsecuritymanager();
+
+    public: // New functions
+	TVersion Version() const;
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        Cui_tsecuritymanager( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt serverstart1( CStifItemParser& aItem );
+         virtual TInt serverstart2( CStifItemParser& aItem );
+        virtual TInt secclient1( CStifItemParser& aItem );
+         virtual TInt secclient2( CStifItemParser& aItem );
+   virtual TInt secclient3(CStifItemParser& aItem ); 
+    virtual TInt secclient4(CStifItemParser& aItem );          
+     virtual TInt secclient5(CStifItemParser& aItem );
+       virtual TInt secclient6(CStifItemParser& aItem );
+       virtual TInt secclient7(CStifItemParser& aItem );
+        virtual TInt secclient8(CStifItemParser& aItem );
+         virtual TInt secclient9(CStifItemParser& aItem );
+         virtual TInt secclient10(CStifItemParser& aItem );
+          virtual TInt secclient11(CStifItemParser& aItem );
+          virtual TInt secclient12(CStifItemParser& aItem );
+          virtual TInt secclient13(CStifItemParser& aItem );
+          
+          
+       // void SendTestClassVersion();
+        
+        
+        TInt StartSecManagerServer() const;
+        
+        TFullName ServerLocation() const;
+        TInt ExecuteThreadOne(TAny *aPtr);
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+   CTrustInfo* iTrust;
+    //CLogHandler*      iLogger;
+    CRTSecManager* iSession;
+    CRTSecManager*   iSession2; 
+    CRTSecMgrScriptSession* scriptSession;
+    TInt iPolicyId;
+    
+     RThread iThread1;
+      
+    };
+    
+    
+    const TInt KSecurityServerUid2Int(0x1020507E);
+const TUid KSecMgrServerUid2 =
+	{
+			KSecurityServerUid2Int
+	};
+
+#endif      // UI_TSECURITYMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/init/testframework.ini	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,181 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#                             
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if 
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module. 
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+UITestingSupport= YES
+SeparateProcesses= YES
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+#[New_Module]
+#ModuleName= demomodule
+#[End_Module]
+
+
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+[New_Module]
+ModuleName= testcombiner
+
+#TestModuleXXX used initialization file
+IniFile= c:\testframework\Testframework.ini
+
+ 
+ 
+TestCaseFile= c:\testframework\ui_tsecuritymanager_comb.cfg 
+
+
+[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIFTestFramework logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number 
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' 
+
+#CreateLogDirectories= YES		# Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML			# Possible values: TXT or HTML
+#EmulatorOutput= FILE			# Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML			# Possible values: TXT or HTML
+#HardwareOutput= FILE			# Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE		# Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES			# Possible values: YES or NO
+#WithTimeStamp= YES			# Possible values: YES or NO
+#WithLineBreak= YES			# Possible values: YES or NO
+#WithEventRanking= YES			# Possible values: YES or NO
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/src/ui_tsecuritymanager.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:        ?Description
+*
+*/
+
+
+
+
+
+
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "ui_tsecuritymanager.h"
+#include <SettingServerClient.h>
+
+ 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::Cui_tsecuritymanager
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+Cui_tsecuritymanager::Cui_tsecuritymanager( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void Cui_tsecuritymanager::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(Kui_tsecuritymanagerLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(Kui_tsecuritymanagerLogFile);
+        }
+
+    iLog = CStifLogger::NewL( Kui_tsecuritymanagerLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+   // SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Cui_tsecuritymanager* Cui_tsecuritymanager::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cui_tsecuritymanager* self = new (ELeave) Cui_tsecuritymanager( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+Cui_tsecuritymanager::~Cui_tsecuritymanager()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// Cui_tsecuritymanager::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+/*void Cui_tsecuritymanager::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("ui_tsecuritymanager.dll");
+
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName);
+	}*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) Cui_tsecuritymanager::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_client_api/tsrc/src/ui_tsecuritymanagerblocks.cpp	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,1889 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:        ?Description
+*
+*/
+
+
+
+
+
+
+
+
+#include <badesca.h>
+#include <bautils.h>
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "ui_tsecuritymanager.h"
+#include<coemain.h>
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <RTSecManager.h>
+#include <RTSecMgrUtility.h>
+#include <RTSecMgrScriptSession.h>
+#include <rtsecmgrcommondef.h>
+//#include <rtsecmgrclient.h>
+#include<w32std.h>
+_LIT(KSecMgrServerExeName, "RTSecMgrServer.exe");
+_LIT(KServerStartFailed, "Security manager server starting failed");
+_LIT(KSecServerProcessName, "SecurityManagerServer");
+const TUint KDefaultMessageSlots= 16;
+const TUint KRTSecMgrServMajorVersionNumber=0;
+const TUint KRTSecMgrServMinorVersionNumber=1;
+const TUint KRTSecMgrServBuildVersionNumber=1;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void Cui_tsecuritymanager::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "serverstart1", Cui_tsecuritymanager::serverstart1 ),
+         ENTRY( "serverstart2", Cui_tsecuritymanager::serverstart2 ),
+         ENTRY( "secclient1", Cui_tsecuritymanager::secclient1 ),
+          ENTRY( "secclient2", Cui_tsecuritymanager::secclient2 ),
+		 ENTRY( "secclient3",Cui_tsecuritymanager::secclient3),  
+ 		 ENTRY( "secclient4",Cui_tsecuritymanager::secclient4), 
+   			ENTRY( "secclient5",Cui_tsecuritymanager::secclient5),
+   		 ENTRY( "secclient6",Cui_tsecuritymanager::secclient6),
+   		  ENTRY( "secclient7",Cui_tsecuritymanager::secclient7), 
+   		   ENTRY( "secclient8",Cui_tsecuritymanager::secclient8),
+   		          ENTRY( "secclient9",Cui_tsecuritymanager::secclient9), 
+   		     ENTRY( "secclient10",Cui_tsecuritymanager::secclient10), 
+   		 ENTRY( "secclient11",Cui_tsecuritymanager::secclient11),   
+   		 	 ENTRY( "secclient12",Cui_tsecuritymanager::secclient12),   
+   		 	 ENTRY( "secclient13",Cui_tsecuritymanager::secclient13), 
+  
+        // [test cases entries] - Do not remove
+
+        };
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::serverstart1
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::serverstart1( CStifItemParser& aItem )
+    {
+    __UHEAP_MARK;
+
+    	TInt retry(2); // Try this twice
+	TInt err(KErrNone);
+ 
+ 	while (retry>KErrNone)
+		{
+		// Try to create a Server session
+		err = CreateSession ( KSecServerProcessName, Version (),
+				KDefaultMessageSlots);
+
+		if ( err != KErrNotFound && err != KErrServerTerminated)
+			{
+			// KErrNone or unrecoverable error
+			if ( err != KErrNone)
+				{
+			}
+			retry = 0;
+			}
+		else
+			{
+			// Return code was KErrNotFound or KErrServerTerminated.
+			// Try to start a new security manager server instance
+		
+			err = StartSecManagerServer ();
+			
+			
+ 
+			if ( err != KErrNone && err != KErrAlreadyExists)
+				{
+				// Unrecoverable error
+
+				retry = 0;
+				}
+			}
+
+		retry--;
+		}
+		
+		
+//	__UHEAP_MARKEND;	
+	 
+	
+   
+    return KErrNone;
+
+    }
+    
+    
+   TVersion Cui_tsecuritymanager::Version(void) const
+	{
+	return (TVersion(KRTSecMgrServMajorVersionNumber,KRTSecMgrServMinorVersionNumber,KRTSecMgrServBuildVersionNumber));
+	}
+ 
+ 
+ 
+ TInt Cui_tsecuritymanager::StartSecManagerServer() const
+	{
+	
+	RProcess server ,server1;
+	const TUidType serverUid( KNullUid, KSecMgrServerUid2, KNullUid);
+	TInt err = server.Create ( ServerLocation (), 
+			KNullDesC, 
+			serverUid, 
+			EOwnerProcess);
+			
+		TInt err1 = server1.Create ( ServerLocation (), 
+			KNullDesC, 
+			serverUid, 
+			EOwnerProcess);
+
+	// Return error code if we the process couldn't be created
+	if ( KErrNone == err)
+		{
+		// Rendezvous is used to detect server start
+		TRequestStatus status;
+		server.Rendezvous ( status);
+	
+		if ( status != KRequestPending)
+			{
+ 			
+			server.Kill ( 0); // Abort startup
+			}
+		else
+			{
+			server.Resume (); // Logon OK - start the server
+			}
+		User::WaitForRequest (status); // Wait for start or death
+
+		if ( server.ExitType ()== EExitPanic)
+			{
+ 
+			err = KErrGeneral;
+			}
+		else
+			{
+			err = status.Int ();
+			}
+
+		// We can close the handle now
+		server.Close ();
+		
+		}
+	return err;
+	}
+  
+  
+  TFullName Cui_tsecuritymanager::ServerLocation() const
+	{
+	TFullName fullPathAndName;
+	fullPathAndName.Append ( KSecMgrServerExeName);
+	return fullPathAndName;
+	}  
+	
+	
+	
+	
+	
+	
+	
+	
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::serverstart1
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::serverstart2( CStifItemParser& aItem )
+    {
+    __UHEAP_MARK;
+CRTSecMgrClientProxy  *proxy;
+    RSecMgrSession *isecmgrsession;
+   // Connect();
+	//	proxy->ConstructL();
+		
+//	__UHEAP_MARKEND;	
+	 
+	
+   
+    return KErrNone;
+
+    }
+	
+	
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient1
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient1( CStifItemParser& aItem )
+    {
+    
+    
+    TInt cnt = User::CountAllocCells();
+   // __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    	
+    	 aItem.GetNextString(sptr);
+    	 
+    	iSession = CRTSecManager::NewL ();
+    //		iSession2 = CRTSecManager::NewL ();
+	iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	  
+		  	TBuf8<5000>  aFilebuffer ;
+				 
+				 
+				 
+			 
+				 
+				 aItem.GetNextString(sptr);
+				 
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+					
+				 if(!sptr.Compare(_L("File")))
+				 {
+				 	
+				  
+				
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				 }
+				 if(!sptr.Compare(_L("Buffer")))
+				 {
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+				}
+				 }
+				 
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+		 aItem.GetNextString(sptr);
+		 
+		 if(!sptr.Compare(_L("nohash")))
+			{
+	
+	
+	 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+			}
+			
+			if(!sptr.Compare(_L("hash")))
+			{
+	
+		_LIT(KHash,"sdsds");
+		TBuf<10> aHash;
+		aHash.Copy(_L("sdsds"));
+		  exId = iSession->RegisterScript(iPolicyId,aHash,*iTrust);
+ 
+			}
+			
+			
+	
+	CRTSecMgrScriptSession* scriptSession;
+ 
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+
+  cnt = User::CountAllocCells();
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+	
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient2
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient2( CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    
+    	iSession = CRTSecManager::NewL ();
+    		iSession2 = CRTSecManager::NewL (); // 2nd session
+				iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				CleanupClosePushL (secPolicyFile);
+			
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	TInt32 exId = iSession2->RegisterScript (iPolicyId, *iTrust);
+	
+	CRTSecMgrScriptSession* scriptSession;
+
+//#ifdef AUTO_TESTING
+//	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId, *iTrust, this);
+//#else
+	
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+		RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close();
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 		TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+	
+	
+	
+	
+	
+		
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient3
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient3( CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    
+    	iSession = CRTSecManager::NewL ();
+    		iSession2 = CRTSecManager::NewL (); // 2nd session
+				iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				CleanupClosePushL (secPolicyFile);
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	TInt32 exId = iSession2->RegisterScript (iPolicyId, *iTrust);
+	
+	CRTSecMgrScriptSession* scriptSession;
+
+
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+		RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close();
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 		TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+		TExecutableID exId2 = iSession2->RegisterScript (iPolicyId, *iTrust);
+ 	
+  
+//  TInt32 x = -108;
+ 	if(exId2 != ErrRegisterScriptFailed) 
+ 	{
+ 	delete iSession;
+delete iSession2;
+delete iTrust;
+ 	return exId2;
+ 		
+ 	}
+ 
+
+ 
+//delete scriptSession1;
+delete iSession;
+delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+		
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient4
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient4(CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    
+    	iSession = CRTSecManager::NewL ();
+    		iSession2 = CRTSecManager::NewL (); // 2nd session
+				iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				CleanupClosePushL (secPolicyFile);
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	TInt32 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+	
+	CRTSecMgrScriptSession* scriptSession;
+
+
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+		RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close();
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 		TInt result = iSession->UnRegisterScript (exId, iPolicyId);
+ 
+ 		scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+  
+ 		if(scriptSession)
+ 		
+ 		{
+ 			return KErrGeneral;
+ 		}
+
+ 
+//delete scriptSession1;
+delete iSession;
+delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+	
+	
+	
+			
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient5
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient5(CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+   
+   
+   int i= 0;
+   
+   
+  CRTSecManager  *iSession[10];
+   
+  while(i<10)
+  {
+  	
+   
+   iSession[i] =  CRTSecManager::NewL ();
+   i++;
+  }
+   
+    		
+    		
+  iTrust = CTrustInfo::NewL ();
+    
+  		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				CleanupClosePushL (secPolicyFile);
+				iPolicyId = iSession[0]->SetPolicy (secPolicyFile);
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	TInt32 exId = iSession[1]->RegisterScript (iPolicyId, *iTrust);
+	
+	CRTSecMgrScriptSession* scriptSession;
+
+
+	scriptSession = iSession[2]->GetScriptSessionL(iPolicyId, exId);
+			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+		RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close();
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+  
+ 
+ int j = 0;	 
+
+  while(j<10)
+  {
+     
+   delete iSession[j] ;
+   j++;
+  }
+
+ 
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+	
+	
+	
+	
+				
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient6
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient6(CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    
+    	iSession = CRTSecManager::NewL ();
+    		iSession2 = CRTSecManager::NewL (); // 2nd session
+				iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileReadDirectIO))
+				{
+				CleanupClosePushL (secPolicyFile);
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	TInt32 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+	
+	CRTSecMgrScriptSession* scriptSession;
+
+
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+		RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close();
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 		TInt result = iSession->UnRegisterScript (exId, iPolicyId);
+ 		
+ 		TInt result1 = iSession->UnRegisterScript (exId, iPolicyId);
+ 
+ 		 
+if(result1 != ErrUnRegisterScriptFailed )
+{
+	
+delete iSession;
+delete iSession2;
+delete iTrust;
+return result1;
+    }
+ 
+//delete scriptSession1;
+delete iSession;
+delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+
+
+
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient7
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient7(CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+      TPtrC sptr;
+    	TInt32 exId;
+    	 aItem.GetNextString(sptr);
+    	 
+    	iSession = CRTSecManager::NewL ();
+    		iSession2 = CRTSecManager::NewL (); // 2nd session
+				iTrust = CTrustInfo::NewL ();
+    	RFile secPolicyFile;
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+		
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				CleanupClosePushL (secPolicyFile);
+			//	iPolicyId = iSession->SetPolicy (secPolicyFile);
+				iPolicyId = iSession->UpdatePolicy(iPolicyId,secPolicyFile);
+			
+			
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+ 
+	
+ 
+
+ if(iPolicyId!= ErrInvalidPolicyID)
+ return KErrGeneral;
+ 
+ 		if(!sptr.Compare(_L("gsswithtrust")))
+ 		{
+ 			
+ 		 
+ 		scriptSession = iSession->GetScriptSessionL(iPolicyId,*iTrust );	 
+if(scriptSession != NULL)
+return KErrGeneral;
+ 		}
+ 		
+ 		if(!sptr.Compare(_L("gsswithouttrust")))
+ 		{
+exId = iSession->RegisterScript(iPolicyId, *iTrust);
+	 	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+
+if(scriptSession != NULL)
+return KErrGeneral;
+ 		}
+
+
+
+ 
+//delete scriptSession1;
+delete iSession;
+delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+
+
+
+	
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient8
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient8( CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    	
+    	 aItem.GetNextString(sptr);
+    	 	 	CRTSecMgrScriptSession* scriptSession;
+    	iSession = CRTSecManager::NewL ();
+    //		iSession2 = CRTSecManager::NewL ();
+	iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	TBuf8<5000>  aFilebuffer ;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+					
+				 if(!sptr.Compare(_L("File")))
+				 {
+				 	
+				  
+				
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				
+					iPolicyId = iSession->UpdatePolicy(iPolicyId,secPolicyFile);
+				 
+				 
+				 
+				 }
+				 
+				 if(!sptr.Compare(_L("Buffer")))
+				 {
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+					iPolicyId = iSession->UpdatePolicy(iPolicyId,aFilebuffer);
+			
+			
+				}
+				 }
+				 
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	 	 aItem.GetNextString(sptr);
+	 	 
+	if(!sptr.Compare(_L("registerscript")))
+	{
+		
+
+	 exId = iSession->RegisterScript(iPolicyId, *iTrust);
+	 	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+	}
+	
+	if(!sptr.Compare(_L("noregisterscript")))
+	{
+	//no implementaion
+	
+		scriptSession = iSession->GetScriptSessionL(iPolicyId,*iTrust );
+	}
+		 
+			
+			
+	
+
+ 
+	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps ;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					 aItem.GetNextString(sptr);			
+ 	if(!sptr.Compare(_L("advancedprompt")))
+			{
+			
+				scriptSession->PromptHandler()->SetPromptOption(RTPROMPTUI_ADVANCED);
+			}
+					
+ 
+ 	RCapabilityArray unMatchedCapabilities;
+		TInt isAllowed(scriptSession->IsAllowed (caps,unMatchedCapabilities));
+   
+ //	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+	
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+
+
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient1
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient9( CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    	
+    	 
+    	 
+    	iSession = CRTSecManager::NewL ();
+    //		iSession2 = CRTSecManager::NewL ();
+	iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	  
+		  	TBuf8<5000>  aFilebuffer ;
+				 
+				 
+				 
+			 
+				 
+			 
+				 
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+				}
+				 
+				 
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+		 aItem.GetNextString(sptr);
+		 
+		 if(!sptr.Compare(_L("nohash")))
+			{
+	
+	
+	 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+	 	scriptSession = iSession->GetScriptSessionL(iPolicyId,*iTrust );
+			}
+			
+			if(!sptr.Compare(_L("hash")))
+			{
+	
+		_LIT(KHash,"sdsds");
+		TBuf<10> aHash;
+		aHash.Copy(_L("sdsds"));
+		  exId = iSession->RegisterScript(iPolicyId,aHash,*iTrust);
+ 	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+			}
+			
+			
+	
+//	CRTSecMgrScriptSession* scriptSession;
+ 
+	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+	
+			
+ 	//	RCapabilityArray caps;
+		RCapabilityArray unMatchedCapabilities;
+		TInt isAllowed(scriptSession->IsAllowed (caps,unMatchedCapabilities));
+   
+ //	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+ 
+ 
+ 
+ 
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient10
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient10( CStifItemParser& aItem )
+    {
+    
+    __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    	
+    	 aItem.GetNextString(sptr);
+    	 	 	CRTSecMgrScriptSession* scriptSession;
+    	iSession = CRTSecManager::NewL ();
+    //		iSession2 = CRTSecManager::NewL ();
+	iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	TBuf8<5000>  aFilebuffer ;
+			
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+					
+				 if(!sptr.Compare(_L("File")))
+				 {
+				 	
+				  
+				
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				
+					iPolicyId = iSession->UpdatePolicy(iPolicyId,secPolicyFile);
+				 
+				 
+				 
+				 }
+				 
+				 if(!sptr.Compare(_L("Buffer")))
+				 {
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+					iPolicyId = iSession->UpdatePolicy(iPolicyId,aFilebuffer);
+			
+			
+				}
+				 }
+				 
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	 	 aItem.GetNextString(sptr);
+	 	 
+	if(!sptr.Compare(_L("registerscript")))
+	{
+		
+
+	 exId = iSession->RegisterScript(iPolicyId, *iTrust);
+	 	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
+	}
+	
+	if(!sptr.Compare(_L("noregisterscript")))
+	{
+	//no implementaion
+	
+		scriptSession = iSession->GetScriptSessionL(iPolicyId,*iTrust );
+	}
+		 
+			
+			
+	
+
+ 
+	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps ;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+		//	caps.Append(ECapabilitySurroundingsDD);
+					 aItem.GetNextString(sptr);			
+ 	if(!sptr.Compare(_L("advancedprompt")))
+			{
+			
+				scriptSession->PromptHandler()->SetPromptOption(RTPROMPTUI_ADVANCED);
+			}
+					
+ 
+ 	RCapabilityArray unMatchedCapabilities;
+ 	unMatchedCapabilities.Append (ECapabilitySurroundingsDD);
+		TInt isAllowed(scriptSession->IsAllowed (caps,unMatchedCapabilities));
+   
+ //	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+	
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+
+
+
+
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient1
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient11( CStifItemParser& aItem )
+    {
+    
+    
+    TInt cnt = User::CountAllocCells();
+   // __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    	
+    	 aItem.GetNextString(sptr);
+    	 
+    	iSession = CRTSecManager::NewL ();
+    //		iSession2 = CRTSecManager::NewL ();
+	iTrust = CTrustInfo::NewL ();
+    
+   // isubsession = RSecMgrSubSession::NewL();
+ 	// SubSessionHandle();
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	  
+		  	TBuf8<5000>  aFilebuffer ;
+				 
+				 
+				 
+			 
+				 
+				 aItem.GetNextString(sptr);
+				 
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+					
+				 if(!sptr.Compare(_L("File")))
+				 {
+				 	
+				  
+				
+				iPolicyId = iSession->SetPolicy (secPolicyFile);
+				 }
+				 if(!sptr.Compare(_L("Buffer")))
+				 {
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+				}
+				 }
+				 
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+		 aItem.GetNextString(sptr);
+		 
+		 if(!sptr.Compare(_L("nohash")))
+			{
+	
+	
+	 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+			}
+			
+			if(!sptr.Compare(_L("hash")))
+			{
+	
+		_LIT(KHash,"sdsds");
+		TBuf<10> aHash;
+		aHash.Copy(_L("sdsds"));
+		  exId = iSession->RegisterScript(iPolicyId,aHash,*iTrust);
+ 
+			}
+			
+			
+	
+	CRTSecMgrScriptSession* scriptSession;
+ 
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps;
+	//	caps.Append (ECapabilityWriteUserData);
+	//	caps.Append (ECapabilityReadUserData);
+	//	caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityNetworkServices);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+
+  cnt = User::CountAllocCells();
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient12
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient12( CStifItemParser& aItem )
+    {
+    
+    
+    TInt cnt = User::CountAllocCells();
+   // __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    	
+    	 aItem.GetNextString(sptr);
+    	 
+    	iSession = CRTSecManager::NewL ();
+    //		iSession2 = CRTSecManager::NewL ();
+	iTrust = CTrustInfo::NewL ();
+    
+ 		
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	  
+		  	TBuf8<500>  aFilebuffer ;
+				 
+				 
+				 
+			 
+				 
+				 aItem.GetNextString(sptr);
+				 
+			if ( KErrNone == secPolicyFile.Open (fileSession, _L("c:\\data\\Others\\accesspolicy.xml"),
+					EFileShareAny))
+				{
+				
+				
+				
+				
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+			
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+				}
+				 
+				 if(iPolicyId!=ErrInvalidPolicyFormat )
+				 return KErrGeneral;
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	 
+	
+	
+	 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+		 
+			if(exId!=ErrInvalidPolicyID)
+	return KErrGeneral;
+			
+	
+	CRTSecMgrScriptSession* scriptSession;
+ 
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+	}
+	
+
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+
+  cnt = User::CountAllocCells();
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+
+
+
+	// -----------------------------------------------------------------------------
+// Cui_tsecuritymanager::secclient13
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Cui_tsecuritymanager::secclient13( CStifItemParser& aItem )
+    {
+    
+    
+    TInt cnt = User::CountAllocCells();
+   // __UHEAP_MARK;
+    TInt32 exId;
+    TPtrC sptr;
+    
+    	TBuf<50> path;
+    	 aItem.GetNextString(sptr);
+    	 
+    	 
+    	 
+    	   // _LIT(path,"c:\\data\\Others\\accesspolicy_1.xml");
+    	 
+    	 	 if(!sptr.Compare(_L("1")))
+				 {			 
+				   	path.Copy(_L("c:\\data\\Others\\accesspolicy_1.xml")) ;
+ 				 }
+				 
+				 	 if(!sptr.Compare(_L("2")))
+				 {
+    	 
+			     path.Copy(_L("c:\\data\\Others\\accesspolicy_2.xml")) ;
+				 }
+				 	 if(!sptr.Compare(_L("3")))
+				 {
+    	 
+				   path.Copy(_L("c:\\data\\Others\\accesspolicy_3.xml")) ;
+				 }
+    
+    
+    	
+     
+    	 
+    	iSession = CRTSecManager::NewL ();
+ 	iTrust = CTrustInfo::NewL ();
+    
+    
+    
+	RFs fileSession;
+	if ( KErrNone==fileSession.Connect ())
+		{
+		CleanupClosePushL (fileSession);
+		if(KErrNone==fileSession.ShareProtected())
+			{
+			RFile secPolicyFile;
+		  
+		  	  
+		  	TBuf8<5000>  aFilebuffer ;
+				 
+				 
+				 
+			 
+		 
+				 
+			if ( KErrNone == secPolicyFile.Open (fileSession,path,
+					EFileShareAny))
+				{
+				
+				
+				
+				CleanupClosePushL (secPolicyFile);
+				
+			
+			
+				if(KErrNone == secPolicyFile.Read(aFilebuffer))
+				{
+							
+				iPolicyId = iSession->SetPolicy (aFilebuffer);
+				}
+				 
+				 if(iPolicyId!=ErrInvalidPolicyFormat )
+				 return KErrGeneral;
+				
+				
+				CleanupStack::PopAndDestroy ();//secPolicyFile
+				}
+			}
+			CleanupStack::PopAndDestroy ();//fileSession
+		}
+	
+	
+	 
+	
+	
+	 exId = iSession->RegisterScript (iPolicyId, *iTrust);
+		 
+	if(exId!=ErrInvalidPolicyID)
+	return KErrGeneral;
+			
+	
+	CRTSecMgrScriptSession* scriptSession;
+ 
+	scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);	
+
+
+
+//#endif			
+
+  
+
+	if(scriptSession)
+	{
+		CleanupStack::PushL (scriptSession);
+ 	RCapabilityArray caps;
+		caps.Append (ECapabilityWriteUserData);
+		caps.Append (ECapabilityReadUserData);
+		caps.Append (ECapabilityLocation);
+		caps.Append (ECapabilityUserEnvironment);
+					
+ 
+ 
+   
+ 	TInt IsAllowed(scriptSession->IsAllowed(caps));
+ 		
+		
+
+	
+		caps.Close(); 
+
+		CleanupStack::PopAndDestroy ();//scriptSession
+		
+		return KErrGeneral;
+	}
+	
+ 	
+ 	
+ 	//	TInt result = iSession->UnSetPolicy (iPolicyId);		
+
+ 
+	
+ 	
+ 
+
+ 
+
+//delete scriptSession1;
+delete iSession;
+//delete iSession2;
+delete iTrust;
+
+  cnt = User::CountAllocCells();
+//__UHEAP_MARKEND;
+return KErrNone;
+}
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_common_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Build file for rtsecuritymanager common API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/rtsecmgrcommondef.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrcommondef.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_common_api/inc/rtsecmgrcommondef.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Security Manager common header
+ *
+*/
+
+
+
+
+
+
+#ifndef _RTSECMGR_COMMON_DEF_H_
+#define _RTSECMGR_COMMON_DEF_H_
+
+#include <e32base.h>
+#include <avkon.hrh>
+
+typedef TInt TPolicyID;
+typedef TInt TExecutableID;
+typedef TUint32 TPermGrant;
+typedef RArray<TCapability> RCapabilityArray;
+
+typedef TUint32 TCapabilityBitSet;
+
+//constant for default NULL capability bitset
+const TCapabilityBitSet KDefaultNullBit = 0x0000;
+
+//constant for default capability bitset with LSB enabled
+const TCapabilityBitSet KDefaultEnableBit = 0x0001;
+
+enum TAccessCheckCode
+	{
+	EAccessNok = -1,
+	EAccessOk
+	};
+
+enum       
+    {
+     EPromptOk = EAknSoftkeyOk,
+     EPromptCancel = EAknSoftkeyCancel
+    };
+
+/*
+ * Enumerations for various duration option
+ */
+const TUint32 DEFAULT_ONESHOT = 0x80000000;
+const TUint32 DEFAULT_SESSION = 0x40000000;
+const TUint32 DEFAULT_BLANKET = 0x20000000;
+
+const TUint32 CONDITION_ONESHOT = 0x8000000;
+const TUint32 CONDITION_SESSION = 0x4000000;
+const TUint32 CONDITION_BLANKET = 0x2000000;
+
+const TUint32 ONESHOT_DENIED = 0x88000000;
+const TUint32 SESSION_DENIED = 0x44000000;
+const TUint32 BLANKET_DENIED = 0x22000000;
+
+const TUint32 DEFAULT_ALL = 0xE0000000;
+const TUint32 CONDITION_ALL = 0xE000000;
+const TUint32 CAPABILITY_ALL = 0xFFFFF;
+
+const TUint32 NetworkServices_CAP = 0x00002000;
+
+enum TUserPromptOption
+	{
+	RTUserPrompt_UnDefined = 0, //can be used for permisssions denied by default
+	RTUserPrompt_OneShot = CONDITION_ONESHOT,
+	RTUserPrompt_Session = CONDITION_SESSION,
+	RTUserPrompt_Permanent = CONDITION_BLANKET,
+	RTUserPrompt_Denied = ONESHOT_DENIED,
+	RTUserPrompt_SessionDenied = SESSION_DENIED,
+	RTUserPrompt_PermDenied = BLANKET_DENIED
+	};
+
+enum TSecMgrPromptUIOption
+	{
+	RTPROMPTUI_DEFAULT = 0,
+	RTPROMPTUI_ADVANCED
+	};
+
+//error code used btn server and client
+//error code starts with -101 as predefined symbian codes
+//range upto -48
+enum TSecMgrErrCode
+	{
+	ErrInvalidParameters = -101,
+	ErrFileSessionNotShared = ErrInvalidParameters -1,
+	ErrInvalidPolicyFormat = ErrFileSessionNotShared -1,
+	ErrFatalDBError = ErrInvalidPolicyFormat -1,
+	ErrSetPolicyFailed = ErrFatalDBError -1,
+	ErrUpdatePolicyFailed = ErrSetPolicyFailed -1,
+	ErrInvalidPolicyID = ErrUpdatePolicyFailed -1,
+	ErrPolicyIDDoesNotExist = ErrInvalidPolicyID -1,
+	ErrInvalidScriptID = ErrPolicyIDDoesNotExist -1,
+	ErrRegisterScriptFailed = ErrInvalidScriptID -1,
+	ErrUpdateGrantFailed = ErrRegisterScriptFailed -1,
+	ErrServerReadConfig = ErrUpdateGrantFailed -1,
+	ErrUnRegisterScriptFailed = ErrServerReadConfig -1,
+	ErrUnSetPolicyFailed = ErrUnRegisterScriptFailed -1,
+	ErrUpdatePermGrantFailed = ErrUnSetPolicyFailed -1,
+	ErrBackupNotCreated = ErrUpdatePermGrantFailed - 1,
+	ErrRestoreTempFailed = ErrBackupNotCreated - 1,
+	ErrAccessDenied = ErrRestoreTempFailed - 1
+	};
+
+const TInt KAnonymousScript = -1;
+const TInt KInvalidPolicyID = -1;
+const TInt KMaxTrustInfoLen = 512; //magic number - half of 1 KB
+
+#endif  //_RTSECMGR_COMMON_DEF_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_common_api/rtsecuritymanager_common_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="c62a6b6d0eb50466eed58c4869f98a56" dataversion="1.0">
+<name>rtsecuritymanager_common_api</name>
+<description>rtsecuritymanager_common_api</description>
+<type>c++</type>
+<subsystem>rtsecuritymanager</subsystem>
+<libs></libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_common_api/tsrc/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       ?Description
+*
+*/
+
+
+
+
+
+
+
+#include   "../../../rtsecuritymanager_client_api/tsrc/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Build file for rtsecuritymanager utility API
+*
+*/
+
+
+
+
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/rtsecmgrpermission.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrpermission.h)
+../inc/rtsecmgrpermissionset.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrpermissionset.h)
+../inc/rtsecmgrscript.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrscript.h)
+../inc/rtsecmgrutility.h     MW_LAYER_PLATFORM_EXPORT_PATH(rtsecmgrutility.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrpermission.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines permission data structure
+ *
+*/
+
+
+
+
+
+
+
+#ifndef _C_PERMISSION_H_
+#define _C_PERMISSION_H_
+
+#include <e32debug.h>
+#include <s32strm.h>
+#include <s32mem.h>
+#include <rtsecmgrcommondef.h>
+
+typedef TUint32 TPermissionData;
+const TPermissionData LOWBIT = 0x0001;
+
+/**
+ * Represents permission data structure.
+ * 
+ * A permission data is modelled as 32 bit unsigned integer type
+ * with the following layout :
+ * 
+ * - With leftmost 20 bits representing one of symbian native capability value
+ * - Bits 25 to 28 represent various user prompt conditions like oneshot, 
+ * 	 session or blanket
+ * - Bits 29-32 represent default condition value
+ * - Bits 21-24 are reserved
+ * 
+ * Various accessor and modifier methods are provided to access underlying
+ * native capability value, the default condition and the conditions set
+ * for this permission data.
+ * 
+ * @lib rtsecmgrutil.lib
+ */
+NONSHARABLE_CLASS(CPermission) : public CBase
+	{
+public:
+	/**
+	 * Default constructor
+	 * 
+	 */
+	IMPORT_C static CPermission* NewL();
+	
+	/**
+	 * destructor
+	 * 
+	 */
+	IMPORT_C ~CPermission();
+	
+	/**
+	 * Default constructor
+	 * 
+	 */
+	IMPORT_C static CPermission* NewLC();
+	
+	
+	/**
+	 * Copy constructor
+	 * 
+	 * @param aPermission TPermission permission source from which copy is made
+	 */
+	IMPORT_C static CPermission* NewL(const CPermission& aPermission);
+	
+	/**
+	 * Copy constructor
+	 * 
+	 * @param aPermission TPermission permission source from which copy is made
+	 */
+	IMPORT_C static CPermission* NewLC(const CPermission& aPermission);
+	
+	/**
+	 * Overloaded constructor taking capability
+	 * 
+	 * @param aCapability TCapability capability to be set
+	 */
+	IMPORT_C static CPermission* NewL(const RCapabilityArray& aCapabilities);
+	
+	/**
+	 * Overloaded constructor taking capability
+	 * 
+	 * @param aCapability TCapability capability to be set
+	 */
+	IMPORT_C static CPermission* NewLC(const RCapabilityArray& aCapabilities);
+	
+	/**
+	 * Overloaded constructor taking capability and default condition
+	 * 
+	 * @param aCapability TCapability capability to be set
+	 * @param aDefaultOption TUserPromptOption Default user prompt option to be set
+	 */
+	IMPORT_C static CPermission* NewL(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt);
+	
+	/**
+	 * Overloaded constructor taking capability and default condition
+	 * 
+	 * @param aCapability TCapability capability to be set
+	 * @param aDefaultOption TUserPromptOption Default user prompt option to be set
+	 */
+	IMPORT_C static CPermission* NewLC(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt);
+	
+	/**
+	 * Overloaded constructor taking capability, default condition and conditions of
+	 * permission
+	 * 
+	 * @param aCapability TCapability capability to be set
+	 * @param aDefaultOption TUserPromptOption Default user prompt option to be set
+	 * @param aCondition TUserPromptOption Conditions to be set
+	 */
+	IMPORT_C static CPermission* NewL(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt,
+			TUserPromptOption aCondition);
+
+	/**
+	 * Overloaded constructor taking capability, default condition and conditions of
+	 * permission
+	 * 
+	 * @param aCapability TCapability capability to be set
+	 * @param aDefaultOption TUserPromptOption Default user prompt option to be set
+	 * @param aCondition TUserPromptOption Conditions to be set
+	 */
+	IMPORT_C static CPermission* NewLC(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt,
+			TUserPromptOption aCondition);
+
+	/**
+	 * Returns default prompt option
+	 * 
+	 * @return TUserPromptOption default condition
+	 */
+	IMPORT_C TUserPromptOption Default() const;
+	
+	/**
+	 * Returns condition
+	 * 
+	 * @return TUserPromptOption condition
+	 */
+	IMPORT_C TUserPromptOption Condition() const;
+	
+	/**
+	 * Returns capability value
+	 * 
+	 * @return TCapability capability value
+	 */
+	IMPORT_C TCapability Capability() const;
+
+	/**
+	 * Returns capability of the permission
+	 * 
+	 * @param aCapabilities RCapabilityArray& contains the capabilities
+	 */
+	IMPORT_C void Capabilitilites(RCapabilityArray& aCapabilities) const;
+	
+	/**
+	 * Sets default condition value
+	 * 
+	 * @param aDefaultOption TUserPromptOption default condition value
+	 */
+	IMPORT_C void SetDefault(TUserPromptOption aDefaultOption);
+	
+	/**
+	 * Sets condition value
+	 * 
+	 * @param aCondition TUserPromptOption condition value
+	 */
+	IMPORT_C void SetCondition(TUserPromptOption aCondition);
+
+	/**
+	 * Sets the name of the permission
+	 *
+	 * @param aName const TDesC& value
+	 */
+	IMPORT_C void SetPermName(const TDesC& aName);
+	
+	/**
+	 * Returns Name of the permission
+	 *
+	 * @return const TDesC&
+	 */
+	IMPORT_C const TDesC& PermName() const; 
+	
+	/**
+	 * Returns iPermissionData of the permission
+	 *
+	 * @return TPermission iPermissionData value
+	 */
+	IMPORT_C TPermissionData PermissionData() const; 
+	
+	// ---------------------------------------------------------------------------
+	// Adds a capability to permission data
+	// ---------------------------------------------------------------------------
+	//
+	IMPORT_C void AppendCapPermData(TCapability aCap);
+	
+	// ---------------------------------------------------------------------------
+	// Adds an unconditional capability
+	// ---------------------------------------------------------------------------
+	//
+	IMPORT_C void SetPermissionData(TPermissionData aPermData);
+
+	/**
+	 * Internalizes permission data from stream
+	 * 
+	 * @param aInStream RReadStream input source stream
+	 */
+	IMPORT_C void InternalizeL(RReadStream& aInStream);
+	
+	/**
+	 * Externalizes permission data to stream
+	 * 
+	 * @param aOutStream RWriteStream output stream
+	 */
+	IMPORT_C void ExternalizeL(RWriteStream& aOutStream) const;
+ 
+private:
+	/*
+	 * Default private constructor
+	 */
+	inline CPermission() : iPermName(NULL), iPermissionData(0)
+		{}
+	
+	/*
+	 * private copy constructor
+	 */
+	CPermission(const CPermission& aPermission);
+	
+
+	CPermission(const RCapabilityArray& aCapabilities);
+
+	CPermission(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt);
+
+	CPermission(const RCapabilityArray& aCapabilities, TUserPromptOption aDefOpt,TUserPromptOption aCondition);
+
+private:
+	//layout of TPermissionData
+	//__________________________________________________________________________
+	//|                 |              |               |       		            |
+	//|   Default       | Condition	   | RESERVED      |   CAPABILITY BITS      |
+	//|_________________|______________|_______________|________________________|
+	//
+	//  32,31,30,29,      28,27,26,25,    24,23,22,21,    20,19,18,...4,3,2,1
+	//
+	//underlying permission data structure
+	
+		
+	TPermissionData iPermissionData;
+	
+		
+	/*
+	 * alias group name
+	 */
+	HBufC* iPermName;
+	
+	};
+
+#endif //_T_PERMISSION_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrpermissionset.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Defines permission set class
+ *
+*/
+
+
+
+
+
+
+
+#ifndef _CPERMISSIONSET_H_
+#define _CPERMISSIONSET_H_
+
+#include <e32debug.h>
+#include <s32strm.h>
+#include <s32mem.h>
+#include <rtsecmgrcommondef.h>
+#include <rtsecmgrpermission.h>
+
+//Forward declaration
+class CPermissionSet;
+
+typedef RPointerArray<CPermission> RPermissions;
+typedef TUint32 TUnConditionalPermission;
+typedef RArray<TCapability> RUnConditionals;
+typedef RPointerArray<CPermissionSet> RPermissionSet;
+
+/**
+ * CPermissionSet represents list of user grantable permissions
+ * and list of unconditional permissions.
+ * 
+ * CPermissionSet provides accessor and modifier methods to access
+ * and modify CPermissionSet object state
+ * 
+ * @lib rtsecmgrutil.lib
+ */
+NONSHARABLE_CLASS(CPermissionSet) : public CBase
+	{
+public:
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPermissionSet instance
+	 *
+	 * @return pointer to an instance of CPermissionSet
+	 */
+	IMPORT_C static CPermissionSet* NewL();
+	
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPermissionSet instance and leaves the created instance
+	 * on the cleanupstack
+	 *
+	 * @return pointer to an instance of CPermissionSet
+	 */
+	IMPORT_C static CPermissionSet* NewLC();
+	
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPermissionSet instance from another permissionset
+	 * object
+	 *
+	 * @param aPermSet CPermissionSet source permissionset object
+	 * 
+	 * @return pointer to an instance of CPermissionSet
+	 */
+	IMPORT_C static CPermissionSet* NewL(const CPermissionSet& aPermSet);
+	
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CPermissionSet instance from another permissionset
+	 * object and leaves the created instance on the cleanupstack
+	 *
+	 * @param aPermSet CPermissionSet source permissionset object
+	 * 
+	 * @return pointer to an instance of CPermissionSet
+	 */
+	IMPORT_C static CPermissionSet* NewLC(const CPermissionSet& aPermSet);
+	
+	/**
+	 * Destructor
+	 * 
+	 */
+	IMPORT_C ~CPermissionSet();
+	
+	/**
+	 * Externalizes permissionset data to stream
+	 * 
+	 * @param aOutStream RWriteStream output stream
+	 */
+	IMPORT_C void ExternalizeL(RWriteStream& aSink) const;
+	
+	/**
+	 * Internalizes permissionset data from stream
+	 * 
+	 * @param aInStream RReadStream input source stream
+	 */
+	IMPORT_C void InternalizeL(RReadStream& aSource);
+
+	/*
+	 * Adds an unconditional capability to the permissionset
+	 * 
+	 * @param aCapability TCapability unconditional capability to be added
+	 */
+	IMPORT_C void AppendUncondCap(TCapability aCapability);
+	
+	/*
+	 * Adds a list of unconditional capabilities to the permissionset
+	 * 
+	 * @param TUnConditionalPermission aUnConditionals - list of TCapability that are to be added
+	 */
+	IMPORT_C void AppendUncondCapabilities(TUnConditionalPermission aUnConditionals);
+	
+	/*
+	 * Adds a permission to the permissionset
+	 * 
+	 * @param aPermission CPermission permission data to be added
+	 * 
+	 */
+	IMPORT_C void AppendPermission(CPermission& aPermission);
+
+	/*
+	 * Gets the list of user-grantable permissions
+	 * 
+	 * @return RPermissions non-modifiable reference to the list of user-grantable permissions
+	 * 
+	 */
+	IMPORT_C const RPermissions& Permissions() const;
+	
+	/*
+	 * Gets the list of unconditional permissions
+	 * 
+	 * @return TUnConditionalPermission unconditional permission
+	 *  
+	 */
+	IMPORT_C TUnConditionalPermission UnconditionalCaps() const;
+	
+	/*
+	 * Gets the list of unconditional permissions as array of
+	 * TCapability
+	 * 
+	 * @return RUnConditionals list of unconditional capabilities
+	 * 
+	 * @see TCapability
+	 * 
+	 */
+	IMPORT_C void UnconditionalCaps(RUnConditionals& aUnConditionals) const;
+	
+	/*
+	 * Gets list of user-grantable permissions. This overloaded version
+	 * returns modifiable list of user-grantable permissions
+	 * 
+	 * @return RPermissions list of user-grantable permissions
+	 *  
+	 */
+	IMPORT_C RPermissions& Permissions();
+
+private:
+	/*
+	 * Default private constructor
+	 */
+	inline CPermissionSet()
+		{}
+	
+	/*
+	 * private copy constructor
+	 */
+	CPermissionSet(const CPermissionSet& aPermSet);
+	
+	/* 
+	 * Private second phase constructor
+	 */
+	 void ConstructL(const CPermissionSet& aPermSet);
+	 
+private:
+	
+	//unconditional permissions
+	TUnConditionalPermission iUncondCapSet;
+	
+	//user-grantable permissions
+	RPermissions iPermissions;
+	};
+#endif //_CPERMISSIONSET_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrscript.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Models script data structure
+ *
+*/
+
+
+
+
+
+
+#ifndef _CSCRIPT_H_
+#define _CSCRIPT_H_
+
+#include <rtsecmgrcommondef.h>
+#include <rtsecmgrutility.h>
+
+/**
+ * Type holding data to be used while prompting. 
+ * 
+ * The default or custom (runtime over-ridden) prompt handler requires the permission
+ * type to prompt and the user-selection to be returned to security 
+ * manager for access permission check
+ * 
+ * @lib rtsecmgrclient.lib
+ */
+NONSHARABLE_CLASS(CScript) : public CBase
+	{
+public:
+	
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CScript instance 
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier of the script
+	 * @param aScriptID TExecutableID script identifier
+	 * 
+	 * @return pointer to an instance of CScript
+	 */
+	IMPORT_C static CScript* NewL(TPolicyID aPolicyID,TExecutableID aScriptID);
+
+	/**
+	 * Two-phased constructor
+	 * 
+	 * Constructs a CScript instance and leaves the created instance
+	 * on cleanupstack 
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier of the script
+	 * @param aScriptID TExecutableID script identifier
+	 * 
+	 * @return pointer to an instance of CScript
+	 */
+	IMPORT_C static CScript* NewLC(TPolicyID aPolicyID,TExecutableID aScriptID);
+
+	/*
+	 * Destructor
+	 */
+	IMPORT_C ~CScript();
+	
+	/*
+	 * overloaded assignment operator
+	 * 
+	 * @param aRhs CScript source script object specified on the right
+	 * hand side of the assignment operator
+	 * 
+	 * @return CScript returns the reference of this script object
+	 */
+	IMPORT_C const CScript& operator=(const CScript& aRhs);
+
+	/*
+	 * Gets the policy identifier of the script
+	 * 
+	 * @return TPolicyID policy identifier of the script
+	 */
+	IMPORT_C TPolicyID PolicyID() const;
+	
+	/*
+	 * Gets the script identifier
+	 * 
+	 * @return TExecutableID identifier of the script
+	 */
+	IMPORT_C TExecutableID ScriptID() const;
+	
+	/*
+	 * Gets the permissionset of the script. The permissionset
+	 * contains the list of user-grantable permissions and the list
+	 * of unconditional permissions
+	 * 
+	 * @return CPermissionSet permissionset of the script
+	 */
+	IMPORT_C const CPermissionSet& PermissionSet() const;
+
+	/*
+	 * Gets the permissionset of the script. The permissionset
+	 * contains the list of user-grantable permissions and the list
+	 * of unconditional permissions. This overloaded version returns
+	 * a modifiable reference to permissionset object.
+	 * 
+	 * @return CPermissionSet modifiable reference to permissionset of the script
+	 */
+	IMPORT_C CPermissionSet& PermissionSet();
+	
+	/*
+	 * Gets the permanently granted permissions
+	 * 
+	 * @return TPermGrant permanently granted permission
+	 * 
+	 */
+	IMPORT_C TPermGrant PermGranted() const;
+	
+	/*
+	 * Gets the permanently denied permissions
+	 * 
+	 * @return TPermGrant permanently denied permission
+	 * 
+	 */
+	IMPORT_C TPermGrant PermDenied() const;
+
+	/*
+	 * Sets the permissionset of the script
+	 * 
+	 * @param aPermissionSet CPermissionSet source permissionset to be set
+	 */
+	IMPORT_C void SetPermissionSet(const CPermissionSet& aPermissionSet);
+
+	/**
+	 * Externalizes script data to stream
+	 * 
+	 * @param aOutStream RWriteStream output stream
+	 */
+	IMPORT_C void ExternalizeL(RWriteStream& aSink) const;
+	
+	/**
+	 * Internalizes script data from stream
+	 * 
+	 * @param aInStream RReadStream input source stream
+	 */
+	IMPORT_C void InternalizeL(RReadStream& aSource);
+
+	/*
+	 * Sets permanently granted permission
+	 * 
+	 * @param aPermGrant TPermGrant permanently granted permission to be set
+	 * 
+	 */
+	IMPORT_C void SetPermGranted(TPermGrant aPermGrant);
+	
+	/*
+	 * Sets permanently denied permission
+	 * 
+	 * @param aPermDenied TPermGrant permanently denied permission to be set
+	 * 
+	 */
+	IMPORT_C void SetPermDenied(TPermGrant aPermDenied);
+	
+	/*
+	 * Sets hash value of the script
+	 * 
+	 * @param aHashMark TDesC hash value of the script
+	 * 
+	 */
+	inline void SetHashMarkL(const TDesC& aHashMark);
+	
+	/*
+	 * Compares the HashValue of the script with the one passed as argument.
+	 * 
+	 * @return TBool hash values match or not.
+	 * 
+	 */
+	inline TBool HashMatch(const TDesC& aHashValue = KNullDesC) const;
+
+	/*
+	 * returns hash value of the script
+	 * 
+	 * @return TDesC hash value of the script
+	 * 
+	 */
+	inline TDesC Hash();
+	
+private:
+	/*
+	 * default private constructor
+	 * 
+	 */
+	inline CScript():iPermGrant(KDefaultNullBit),iPermDenied(KDefaultNullBit)
+		{}
+
+	/*
+	 * overloaded constructor
+	 * 
+	 * @param aPolicyID TPolicyID policy identifier of the script
+	 * @param aScriptID TExecutableID script identifier
+	 * 
+	 */
+	inline CScript(TPolicyID aPolicyID,TExecutableID aScriptID):iPolicyID(aPolicyID),iPermGrant(KDefaultNullBit),iPermDenied(KDefaultNullBit),iScriptID(aScriptID)
+		{}
+
+	/*
+	 * copy constructor
+	 * 
+	 * @param aRhs source script object
+	 */
+	CScript(const CScript& aRhs);
+
+	/*
+	 * Two-phased constructor
+	 * 
+	 */
+	void ConstructL();
+ 
+
+private:
+	//permission set 
+	CPermissionSet* iPermissionSet;
+	
+	//script identifier
+	TExecutableID iScriptID;
+	
+	//policy identifier of the script
+	TPolicyID iPolicyID;
+	
+	//permanently granted permission	
+	TPermGrant iPermGrant;
+	
+	//permanently denied permission
+	TPermGrant iPermDenied; //separate bit-patterns for permanently allowed & denied
+	
+	//hash value of the script
+	HBufC* iHashMark;	
+	};
+
+/*
+ * Sets hash value of the script
+ * 
+ * @param aHashMark TDesC hash value of the script
+ * 
+ */
+inline void CScript::SetHashMarkL(const TDesC& aHashMark)
+	{
+	if ( iHashMark)
+		{
+		delete iHashMark;
+		}
+	iHashMark = aHashMark.AllocLC ();
+	CleanupStack::Pop ();
+	}
+
+/*
+ * 
+ * 
+ * @return TBool Etrue
+ * 
+ */
+inline TBool CScript::HashMatch(const TDesC& aHashValue) const
+	{
+	TBool matches(EFalse);
+	if(iHashMark)
+		{
+		if(0==aHashValue.CompareF(*iHashMark))	
+			{
+			return !matches;
+			}
+		}
+	return matches;
+	}
+
+/*
+ *
+ * @return TDesC hash value of the script.
+ *
+ */
+
+inline TDesC CScript::Hash()
+	{
+	if(iHashMark)
+		return *iHashMark;
+	else
+		return KNullDesC;
+	}
+
+#endif //_CSCRIPT_H_
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/inc/rtsecmgrutility.h	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       Security Manager utility header
+ *
+*/
+
+
+
+
+
+
+
+#ifndef _RTSECURITYMGRUTILITY_H_
+#define _RTSECURITYMGRUTILITY_H_
+
+#include <e32debug.h>
+#include <s32strm.h>
+#include <s32mem.h>
+#include <rtsecmgrcommondef.h>
+#include <rtsecmgrpermission.h>
+#include <rtsecmgrpermissionset.h>
+
+#endif //_RTSECURITYMGRUTILITY_H_
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/rtsecuritymanager_utility_api.metaxml	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="e11a4612a8905eb046e1e8e5b21600d7" dataversion="1.0">
+<name>rtsecuritymanager_utility_api</name>
+<description>rtsecuritymanager_utility_api</description>
+<type>c++</type>
+<subsystem>rtsecuritymanager</subsystem>
+<libs><lib name="RTSecMgrUtil.lib"/>
+</libs>
+<release category="domain" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_plat/rtsecuritymanager_utility_api/tsrc/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       ?Description
+*
+*/
+
+
+
+
+
+
+
+#include   "../../../rtsecuritymanager_client_api/tsrc/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceapifw_pub/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:       
+*
+*/
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/group/bld.inf	Mon Mar 30 12:51:20 2009 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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 "../../serviceapifw_plat/rtsecuritymanager_client_api/tsrc/group/bld.inf"
+#include "../../serviceapifw_plat/liw_criteria_api/tsrc/group/bld.inf"