# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1262860755 -7200 # Node ID 4490afcb47b1d1cb93a9f3c795c8c2fc7585c3db # Parent 3ce708148e4d45c50d46394e9cabdd67438a30fd Revision: 200951 Kit: 201001 diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmappui/inc/NSmlDMSyncPrivateCRKeys.h --- a/omadm/omadmappui/inc/NSmlDMSyncPrivateCRKeys.h Thu Dec 17 08:40:12 2009 +0200 +++ b/omadm/omadmappui/inc/NSmlDMSyncPrivateCRKeys.h Thu Jan 07 12:39:15 2010 +0200 @@ -26,7 +26,7 @@ //browser uid const TUid browseruid = {0x10008d39}; //java uid -const TUid javauid = {0x1028289E}; +const TUid javauid = {0x2001FD68}; //flash uid const TUid flashuid = {0x101FD693}; diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmappui/src/NSmlDMProfilesContainer.cpp --- a/omadm/omadmappui/src/NSmlDMProfilesContainer.cpp Thu Dec 17 08:40:12 2009 +0200 +++ b/omadm/omadmappui/src/NSmlDMProfilesContainer.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -345,7 +345,6 @@ TListBoxEvent aEventType ) { FLOG( "[OMADM] CNSmlDMProfilesContainer::HandleListBoxEventL()" ); - iProfilesListBox->SetCurrentItemIndexAndDraw( aListBox->CurrentItemIndex() ); iDocument->SetCurrentIndex( aListBox->CurrentItemIndex() ); if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked ) { diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/bld/bld.inf --- a/omadm/omadmextensions/adapters/bld/bld.inf Thu Dec 17 08:40:12 2009 +0200 +++ b/omadm/omadmextensions/adapters/bld/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -27,6 +27,13 @@ #include "../browseradapter/bld/bld.inf" #include "../streamingadapter/bld/bld.inf" +#include "../globalwlansettings/group/bld.inf" +#include "../nsmldinternet/group/bld.inf" +#include "../nsmldmalwaysonadapter/group/bld.inf" +#include "../nsmldmbmadapter/group/bld.inf" +#include "../wlanctrldcmoadapter/group/bld.inf" +#include "../connmoadapter/group/bld.inf" + #ifdef __SYNCML_DM_DS #include "../syncmlds/bld/bld.inf" #endif diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/group/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,33 @@ +/* +* ============================================================================== +* 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 "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 + +PRJ_PLATFORMS + +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +connmoadapter.mmp + + + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/group/connmoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/group/connmoadapter.mmp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,44 @@ +/* +* ============================================================================== +* 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 "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 + +CAPABILITY CAP_ECOM_PLUGIN +TARGET connmoadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001FE5E +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc +USERINCLUDE ../traces + +START RESOURCE ConnMoAdapter.rss +END + +LANG sc + +LIBRARY charconv.lib ecom.lib euser.lib +LIBRARY sysutil.lib +LIBRARY cmmanager.lib + +SOURCE ConnMoAdapter.cpp BranchBase.cpp NapBranch.cpp ProxyBranch.cpp AddBuffer.cpp Utils.cpp + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/inc/AddBuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/inc/AddBuffer.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,145 @@ +/* +* ============================================================================== +* 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 "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 ADDBUFFER_H_ +#define ADDBUFFER_H_ + +TInt const KMaxFieldLength = 128; + +/** +* CConnMoNodeElement is array element for ConnMo node objects. +*/ +class CConnMoNodeElement : public CBase + { +public: + CConnMoNodeElement(); + ~CConnMoNodeElement(); + + /** Node address */ + TBuf8 iUri; + /** Unique identifier of the parent node */ + TBuf8 iParentLUID; + /** Leaf object's data */ + TBuf8 iObject; + /** Refenrence for giving commands return value to framework */ + TInt iStatusRef; + /** Information whether adapter has processed the node or not */ + TBool iProcessed; + /** Specifies if the node leaf or not */ + TBool iLeaf; +private: + }; + +/** +* CAddBuffer is array for ConnMo nodes to be added in . +* +* CConnMoAdapter uses this class to buffer node and leaf data +* addition DM commands. +*/ +class CAddBuffer : public CBase + { +public: + + /** + * Creates new instance of CAddBuffer + */ + static CAddBuffer* NewL(); + + /** + * Adds node to buffer + * + * @param aUri target node URI + * @param aParentLUID refrence to parent node + * @param aStatusRef Status reference + */ + void AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * Adds leaf node to buffer + * + * @param aUri target node URI + * @param aParentLUID refrence to parent node + * @param aObject Leaf object data + * @param aStatusRef Status reference + */ + void AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aLUID, + const TDesC8& aObject, + const TInt aStatusRef ); + + /** + * Searches buffer for given dynamic node + * + * @param aUri target node URI + */ + CConnMoNodeElement* FindDynamicNode( const TDesC8& aUri ); + + /** + * Gets all unprocessed nodes associated to given root node + * + * Function searches buffer for all unprocessed nodes that + * belong to given group and are under same dynamic node + * + * @param aRoot target group + * @param aGroup Array for result nodes + */ + TInt GetGroup( const TDesC8& aRoot, RPointerArray* aGroup ); + + /** + * Searches buffer for givennode + * + * @param aUri target node URI + */ + CConnMoNodeElement* CacheFind( const TDesC8& aUri ); + + /** + * Searches buffer for given dynamic node + * + * @param aUri target node URI + */ + CConnMoNodeElement* CacheFindDynamicNode( const TDesC8& aUri ); + + /** + * Empties buffer and frees all allocated memory + */ + void Reset(); + + virtual ~CAddBuffer(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + void ConstructL(); + CAddBuffer(); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + /** Contains all nodes to be added */ + RPointerArray iBuffer; + /** Contains group of nodes that user has previously asked */ + RPointerArray iCache; + + }; + +#endif /* ADDBUFFER_H_ */ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/inc/BranchBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/inc/BranchBase.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,186 @@ +/* +* ============================================================================== +* 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 "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 BRANCHBASE_H_ +#define BRANCHBASE_H_ + +#include +#include "smldmadapter.h" + +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +#define KConnMoAdapterUid 0x2001FE5F + +/** + * Abstract base class for all ConnMO branches. + */ +class CBranchBase : public CBase + { +public: + + /** + * Builds DDF structure of DM settings it governs. + * + * Implementations should build their structure using given node + * as the root node. + * + * @param aDDF Root node + */ + virtual void DDFStructureL( MSmlDmDDFObject& aDDF ) = 0; + + /** + * Updates leaf node data. + * + * @param aURI Root node + * @param aLUID refrence to branch LUID + * @param aObject Leaf object data + * @param aType Type of the node + * @param aStatusRef Status reference + */ + virtual void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ) = 0; + /** + * Deletes object pointed by aURI. + * + * @param aURI Root node + * @param aLUID refrence to branch LUID + * @param aStatusRef Status reference + */ + virtual void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ) = 0; + + /** + * Gets node data for leaf nodes and child list for parent nodes. + * + * @param aURI Root node + * @param aLUID refrence to branch LUID + * @param aObject Leaf object data + * @param aType Type of the node + * @param aResultsRef Result reference + * @param aStatusRef Status reference + */ + virtual void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) = 0; + + /** + * Gets the size of the data in leaf node. + */ + virtual void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef) = 0; + + /** + * Gets all childs of the given node. + */ + virtual void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) = 0; + + /** + * Adds node to DM tree. + */ + virtual void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef )=0; + + + virtual ~CBranchBase(); + +protected: + + CBranchBase(); + + CBranchBase( MSmlDmCallback* aDmCallback ); + + /** + * This function gives all Connection Methods from Connection Method Manager. + * + * @param aCmArray Result Array. + * @param aCmManager CM Manager. + */ + void GetAllConnectionMethodsL( RArray& aCmArray, + RCmManagerExt& aCmManager ); + + /** + * This function checks if given CM ID is found from given URI segmentlist. + * + * @param aPreviousURISegmentList Array where to search. + * @param aCmId CM ID to be searched. + * @param aURISeg If match is found, the URI segment matching the CM ID is copied here. + * @return TBool ETrue if CM ID is found from array. + */ + TBool CheckPreviousURIList( const CArrayFix& aPreviousURISegmentList, + const TUint32 aCmId, + TDes8& aURISeg ); + + /** + * This function gets list of dynamic nodes for the specified URI + * + * @param aURI which to get the list for + * @param aLuid refrence to branch LUID + * @param aPreviousURISegmentList previous URI segment list + * @param aResultRef result reference + * @param aStatusRef status reference + * @param aCmManagerExt CM Manager reference + * @param aCurrentURISegmentList current URI segment list + * @param aField branch name + * @param aNodeCount number of dynamic nodes + * @aCallback pointer to DM callback + */ + void GetAllDynamicNodesL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + RCmManagerExt& aCmManagerExt, + CBufBase& aCurrentURISegmentList, + const TDesC8& aField, + const TInt aNodeCount, + MSmlDmCallback* aCallback ); + + /** + * This function gets connection method + * + * @param aCmManagerExt CM Manager + * @param aCm CM Manager + * @param aCmId CM ID + * @return TBool ETrue if connection method found + */ + TBool GetConnectionMethodLC( RCmManagerExt& aCmManagerExt, + RCmConnectionMethodExt& aCm, + TUint32 aCmId ); + +private: + MSmlDmCallback* iCallback; + + }; + +#endif /* BRANCHBASE_H_ */ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/inc/ConnMoAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/inc/ConnMoAdapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,155 @@ +/* +* ============================================================================== +* Name : ConnMoAdapter.h +* Part of : ConnMoAdapter +* Interface : ecom / ConnMOAdapter +* Description : Connection Management Object +* Version : $Revision: 61 $ $Modtime: 29.09.05 8:17 $ +* +* 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 "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 CONNMOADAPTER_H_ +#define CONNMOADAPTER_H_ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include + +class CNapBranch; +class CProxyBranch; +class CAddBuffer; +class CBranchBase; + +_LIT8( KCMDdfNAP, "NAP" ); +_LIT8( KCMDdfProxy, "Proxy" ); + +/** + * Implements ConnMO partition of the DM tree + */ +class CConnMoAdapter : public CSmlDmAdapter + { +public: + + static CConnMoAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CConnMoAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + virtual ~CConnMoAdapter(); + + // Adapter Interface inherited from CSmlDmAdapter + void DDFVersionL( CBufBase& aVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ); + + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef ); + + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ); + + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef ); + + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + void ConstructL(); + CConnMoAdapter( TAny* aEcomArguments ); + + CBranchBase* GetBranch( const TDesC8& aUri ); + + MSmlDmDDFObject& AddBaseUriL( MSmlDmDDFObject& aRootDDF); + + MSmlDmDDFObject& AddBranchL( MSmlDmDDFObject& aRootDDF, + const TDesC8& aNodeName); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + /** Callback to framework */ + MSmlDmCallback* iCallBack; + + /** branches of ConnMo structure */ + CNapBranch* iNapBranch; + CProxyBranch* iProxyBranch; + + /** Buffer for node addition */ + CAddBuffer* iBuffer; + + /** CmMager for manipulating CM settings */ + RCmManagerExt iCmManager; + }; + + +#endif /* CONNMOADAPTER_H_ */ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/inc/NapBranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/inc/NapBranch.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,151 @@ +/* +* ============================================================================== +* 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 "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 NAPBRANCH_H_ +#define NAPBRANCH_H_ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include +#include "BranchBase.h" +#include "AddBuffer.h" + +/** + * Class for handling Network Access Point (NAP) settings in ConnMo DM tree + */ +class CNapBranch : public CBranchBase + { +public: + + static CNapBranch* NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ); + + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ); + + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ); + + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef); + + /** + * Processes all Proxy related nodes from buffer + */ + void ProcessBufferL(); + + virtual ~CNapBranch(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + void ConstructL( CAddBuffer* aBuffer, RCmManagerExt* aCmManagerExt ); + CNapBranch( MSmlDmCallback* aDmCallback ); + + CSmlDmAdapter::TError GetUnmodifiableFieldValueL(const TDesC8& aUri, + CBufBase* aResult ); + + CSmlDmAdapter::TError GetLeafDataL(const TDesC8& aURI, + RCmConnectionMethodExt& aCm, + CBufBase* aResult ); + + CSmlDmAdapter::TError GetUnmodifiableFieldAddResult( const TDesC8& aUri, + const TDesC8& aObject ); + + TUint32 MapUriToCmAttribute( const TDesC8& aUri ); + + void SetLeafDataL( const TDesC8& aURI, + const TDesC8& aObject, + TInt aStatusRef, + RCmConnectionMethodExt& aCm); + + void SetNodeDataL( CConnMoNodeElement* aNode, + RCmConnectionMethodExt& aCm ); + + TBool FindNewCmType( TUint32& aBearerType ); + + TBool AllMandatoryNapFieldsFound(); + + void NapChildURIListL( const TDesC8& aURI, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList ); + + void GetAllDynamicNapNodesL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList, + const TDesC8& aField ); + + void IpBranchDDFStructureL( MSmlDmDDFObject& aIPDDF ); + + CSmlDmAdapter::TError DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID ); + + TPtrC8 GetDynamicNAPNodeUri( const TDesC8& aURI ); + + TBool IsNAPUriFormatMatchPredefined(const TDesC8 & aURI); + + TInt GetCmIdFromURIL(const TDesC8& aURI); + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + CAddBuffer* iBuffer; + MSmlDmCallback* iCallback; + RCmManagerExt* iCmManager; + }; + + + +#endif /* NAPBRANCH_H_ */ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/inc/ProxyBranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/inc/ProxyBranch.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,197 @@ +/* +* ============================================================================== +* 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 "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 PROXYBRANCH_H_ +#define PROXYBRANCH_H_ + + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include "BranchBase.h" +#include "cmmanagerext.h" +#include "AddBuffer.h" + +/** + * Class for handling Proxy settings in ConnMo DM tree + */ +class CProxyBranch : public CBranchBase + { +public: + + static CProxyBranch* NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ); + + // Adapter branch interface from CProxyBranch + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ); + + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ); + + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ); + + /** + * The function processes all proxy nodes from add buffer. + * @param aCmManagerExt Reference to CmManager session. + */ + void ProcessBufferL(); + + virtual ~CProxyBranch(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + CProxyBranch(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ); + + /** + * The function returns URI list of dynamic Proxy nodes. The list is returned by + * calling the SetResultsL function of MSmlCallback callback interface. + * @param aURI URI of the parent object. + * @param aPreviousURISegmentList URI list with mapping LUID information. + * @param aResultsRef Reference to correct results. + * @param aStatusRef Reference to correct command. + * @param aCmManagerExt Reference to CmManager session. + */ + void GetAllDynamicProxyNodesL( const TDesC8& aURI, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList ); + + /** + * The function returns URI list of requested dynamic Proxy node. + * @param aLUID LUID of the parent object. + * @param aResultsRef Reference to correct results. + * @param aStatusRef Reference to correct command. + * @param aCmManagerExt Reference to CmManager session. + */ + void GetURIListForProxyNodeL( const TDesC8& aLUID, + TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function adjust DM operation return values for hardcoded fields. + * @param aURI URI of the object. + * @return CSmlDmAdapter::TError Status value for DM operation. + */ + CSmlDmAdapter::TError CheckForUnmodifiableField( const TDesC8& aUri ); + + /** + * The function returns CMManager's attribute enum that corresponds to uri. + * @param aURI URI of the object. + * @return TUint32 Attribute enum for CM. + */ + TUint32 MapUriToCmAttribute( const TDesC8& aUri ); + + /** + * The function searches for connection method that is referenced from proxy buffered + * in the addbuffer. + * @param aCmManagerExt Reference to CmManager session. + * @return TUint32 CM ID. + */ + TInt32 FindConnectionMethodL(); + + /** + * The function checs that the addbuffer contains all necessary fields + * to create new proxy entry. + * @return TBool True if all mandatory fields found. + */ + TBool AllMandatoryProxyFieldsFound(); + + /** + * The function writes information from the addbuffer to connection method. + * @param aURI URI of the object. + * @param aLUID Local UID of the leaf. + * @param aObject objecto to be written in CM. + * @param aStatusRef Reference to correct command. + * @param aCm Reference to Connection Method. + */ + void SetLeafDataL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + TInt aStatusRef, + RCmConnectionMethodExt& aCm); + + /** + * The function informs framework about new nodes. + * @param aNode Node to be saved. + * @param aCm Reference to Connection Method. + */ + void SetNodeDataL( CConnMoNodeElement* aNode, RCmConnectionMethodExt& aCm ); + + /** + * Fethces leaf object data from connection settings + * @param aURI Target node + * @param aLuid Local UID for target node + * @param buffer for returning object data + * @return CSmlDmAdapter::TError Return value informs completion status of the operation + */ + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aLeafObject ); + + TPtrC8 GetDynamicProxyNodeUri( const TDesC8& aURI ); + + TBool IsProxyUriFormatMatchPredefined(const TDesC8 & aURI); + + TInt GetCmIdFromURIL(const TDesC8& aURI); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + MSmlDmCallback* iCallback; + CAddBuffer* iBuffer; + RCmManagerExt* iCmManager; + }; + +#endif /* PROXYBRANCH_H_ */ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/inc/Utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/inc/Utils.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,156 @@ +/* +* ============================================================================== +* 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 "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 UTILS_H_ +#define UTILS_H_ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include "ConnMoAdapter.h" + +class TLuid; + +/** + * Utilities class for ConnMo adapter needs + * + * Class contains useful helper functions etc. for parsing URI and TLuid + */ +class CUtils : public CBase + { +public: + + virtual ~CUtils(); + + /** + * Returns first segment of URI. + * + * @param aUri URI to be searched. + * @return First segment of URI. + */ + static TPtrC8 GetFirstURISeg( const TDesC8& aURI ); + + /** + * Returns second segment of URI. + * + * @param aUri URI to be searched. + * @return Second segment of URI. + */ + static TPtrC8 GetSecondURISeg( const TDesC8& aURI ); + + /** + * Returns last segment of URI. + * + * @param aUri URI to be searched. + * @return Last segment of URI. + */ + static TPtrC8 GetLastURISeg( const TDesC8& aURI ); + + /** + * Returns the end of URI starting from passed segment. + * + * @param aUri URI to be parsed. + * @param aName Segment to start. + * @return End of URI starting from aName. + */ + static TPtrC8 GetEndOfURIFromSeg( const TDesC8& aURI, const TDesC8& aName ); + + /** + * This function converts string value to 8-bit value. + * + * @param aSource String to convert. + * @return Pointer to 8-bit value. + */ + static TDesC8& ConvertTo8LC( const TDesC& aSource ); + + /** + * This function converts string value to 16-bit value. + * + * @param aSource String to convert. + * @return Pointer to 16-bit value. + */ + static TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + /** + * This function sets given information to given node. + * + * @param aNode Target node. + * @param aAccTypes Node's access types. + * @param aOccurrence Amount of possible nodes of same type. + * @param aScope Describes if node is static or dynamic. + * @param aFormat Node's format. + * @param aDescription String containing description of the node. + * @return Pointer integer value. + */ + static void FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + /** + * This function removes characters that are not allowed in URI from given descriptor. + * + * @param aString String to be modified. + */ + static void RemoveIllegalCharsFromURI( TDes8& aString ); + + /** + * This function returns string as bool value. + * + * @param aSource String to convert. + * @param aBool conversion result. + * @return TInt32 KErrNone if succesful conversion. + */ + static TInt32 DesToBool( const TDesC8& aString, TBool& aBool ); + + /** + * This function convert integer value to string presentation. + * + * @param aObject Int value to convert. + * @return TDesC8& Int as string. + */ + static TDesC8& IntToCharL( const TInt& aObject ); + + /** + * This function takes first segment from uri and adds it to target + * + * @param aURI Contains source uri. + * @param aTarget Target string. + * @return TInt Index of first uri delimiter. + */ + static TInt AppendFirstURISeg( TDes8& aURI, TDes8& aTarget ); + + static TInt IntLUID(const TDesC8& aLUID); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + CUtils(); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + + }; + +#endif /* UTILS_H_ */ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/rom/connmoadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/rom/connmoadapter.iby Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,34 @@ +/* +* ============================================================================ +* 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 "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 + +#ifndef __CONNMOADAPTER_IBY__ +#define __CONNMOADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected +#ifdef FF_DM_CONNMO_ADAPTER // nothing should be installed from this .iby file if this flag is not specified. + // old internet adapter is used in that case for access point provisioning. + +ECOM_PLUGIN(connmoadapter.dll,connmoadapter.rsc) + +#endif FF_DM_CONNMO_ADAPTER +#endif // __SYNCML_DM_WLAN + +#endif //__CONNMOADAPTER_IBY__ \ No newline at end of file diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/AddBuffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/AddBuffer.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,298 @@ +/* + * ============================================================================== + * 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 "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 + +#include "AddBuffer.h" +#include "Utils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "AddBufferTraces.h" +#endif + +_LIT8( KChildNodeWildCardPattern, "/*" ); +_LIT8( KNodeSeparator, "/" ); + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== +//------------------------------------------------------------------------------ +// CConnMoNodeElement::CConnMoNodeElement() +//------------------------------------------------------------------------------ +CConnMoNodeElement::CConnMoNodeElement() + { + OstTraceFunctionEntry0( CCONNMONODEELEMENT_CCONNMONODEELEMENT_ENTRY ); + + OstTraceFunctionExit0( CCONNMONODEELEMENT_CCONNMONODEELEMENT_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::~CAddBuffer() +//------------------------------------------------------------------------------ +CConnMoNodeElement::~CConnMoNodeElement() + { + OstTraceFunctionEntry0( CCONNMONODEELEMENT_DELETE_ENTRY ); + + OstTraceFunctionExit0( CCONNMONODEELEMENT_DELETE_EXIT ); + } + +//----------------------------------------------------------------------------- +// CAddBuffer* CAddBuffer::NewL( ) +//----------------------------------------------------------------------------- +CAddBuffer* CAddBuffer::NewL() + { + OstTraceFunctionEntry0( CADDBUFFER_NEWL_ENTRY ); + + CAddBuffer* self = new ( ELeave ) CAddBuffer(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + CleanupStack::Pop( self ); + + OstTraceFunctionExit1( CADDBUFFER_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CAddBuffer::CAddBuffer() +//------------------------------------------------------------------------------ +CAddBuffer::CAddBuffer() + { + OstTraceFunctionEntry0( CADDBUFFER_CADDBUFFER_ENTRY ); + + OstTraceFunctionExit0( CADDBUFFER_CADDBUFFER_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::~CAddBuffer() +//------------------------------------------------------------------------------ +CAddBuffer::~CAddBuffer() + { + OstTraceFunctionEntry0( CADDBUFFER_DELETE_ENTRY ); + + iBuffer.ResetAndDestroy(); + + OstTraceFunctionExit0( CADDBUFFER_DELETE_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::CAddBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::ConstructL() + { + OstTraceFunctionEntry0( CADDBUFFER_CONSTRUCTL_ENTRY ); + + OstTraceFunctionExit0( CADDBUFFER_CONSTRUCTL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::AddNodeToBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_ENTRY, "ENTRY: CAddBuffer::AddNodeToBufferL;aUri=%s", aUri ); + + CConnMoNodeElement* newNode = new (ELeave) CConnMoNodeElement(); + + newNode->iUri.Copy( aUri ); + newNode->iParentLUID.Copy( aParentLUID ); + newNode->iStatusRef = aStatusRef; + newNode->iProcessed = EFalse; + newNode->iLeaf = EFalse; + + iBuffer.AppendL( newNode ); + OstTrace0( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_EXIT, "EXIT: CAddBuffer::AddNodeToBufferL"); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::AddNodeToBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aLUID, + const TDesC8& aObject, + const TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_LEAF_ENTRY, "ENTRY: CAddBuffer::AddNodeToBufferL;aUri=%s", aUri ); + + CConnMoNodeElement* newNode = new (ELeave) CConnMoNodeElement(); + + newNode->iUri.Copy( aUri ); + newNode->iParentLUID.Copy( aLUID ); + newNode->iObject.Copy( aObject ); + newNode->iStatusRef = aStatusRef; + newNode->iProcessed = EFalse; + newNode->iLeaf = ETrue; + + iBuffer.AppendL( newNode ); + OstTrace0( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_LEAF_EXIT, "EXIT: CAddBuffer::AddNodeToBufferL"); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::FindDynamicNode +//------------------------------------------------------------------------------ +CConnMoNodeElement* CAddBuffer::FindDynamicNode( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_FINDDYNAMICNODE_ENTRY, "ENTRY: CAddBuffer::FindDynamicNode;aUri=%s", aUri ); + + CConnMoNodeElement* resultNode = NULL; + + for ( TInt i = 0; i < iBuffer.Count(); ++i ) + { + if ( iBuffer[i]->iUri.Match(aUri) != KErrNotFound ) + { + // + TBuf8 dynamicNodeChildUri(aUri); + dynamicNodeChildUri.Append( KChildNodeWildCardPattern ); + + if ( iBuffer[i]->iUri.Match( dynamicNodeChildUri ) == KErrNotFound ) + { + // Correct dynamic node found. + OstTrace0( TRACE_NORMAL, + CADDBUFFER_FINDDYNAMICNODE_MATCH_FOUND, + "CAddBuffer::FindDynamicNode;Matching node found."); + resultNode = iBuffer[i]; + break; + } + } + } + OstTraceExt1( TRACE_NORMAL, + CADDBUFFER_FINDDYNAMICNODE_EXIT, + "EXIT: CAddBuffer::FindDynamicNode;resultNode=%s", + resultNode->iUri ); + + return resultNode; + } + +//------------------------------------------------------------------------------ +// CAddBuffer::Find +//------------------------------------------------------------------------------ +CConnMoNodeElement* CAddBuffer::CacheFind( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_CACHEFIND_ENTRY, "ENTRY: CAddBuffer::CacheFind;aUri=%s", aUri ); + + CConnMoNodeElement* resultNode = NULL; + + for ( TInt i = 0; i < iCache.Count(); ++i ) + { + if ( iCache[i]->iUri.Match( aUri ) != KErrNotFound ) + { + OstTrace0( TRACE_NORMAL, CADDBUFFER_CACHEFIND_MATCH_FOUND, "CAddBuffer::CacheFind; Matching URI found."); + resultNode = iCache[i]; + + OstTraceExt1( TRACE_NORMAL, + CADDBUFFER_CACHEFIND_RESULT_NODE, + "CAddBuffer::CacheFind; resultNode=%s", + resultNode->iUri ); + break; + } + } + + OstTrace0( TRACE_NORMAL, CADDBUFFER_CACHEFIND_EXIT, "EXIT: CAddBuffer::CacheFind"); + return resultNode; + } + +//------------------------------------------------------------------------------ +// CAddBuffer::FindDynamicNode +//------------------------------------------------------------------------------ +CConnMoNodeElement* CAddBuffer::CacheFindDynamicNode( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_CACHEFINDDYNAMICNODE_ENTRY, "ENTRY: CAddBuffer::CacheFindDynamicNode;aUri=%s", aUri ); + + CConnMoNodeElement* resultNode = NULL; + + for ( TInt i = 0; i < iCache.Count(); ++i ) + { + if ( iCache[i]->iUri.Match( aUri ) != KErrNotFound ) + { + // + TBuf8 dynamicNodeChildUri( aUri ); + dynamicNodeChildUri.Append( KChildNodeWildCardPattern ); + + if ( iCache[i]->iUri.Match(dynamicNodeChildUri) == KErrNotFound ) + { + // Correct dynamic node found. + OstTrace0( TRACE_NORMAL, + CADDBUFFER_CACHEFINDDYNAMICNODE_MATCH_FOUND, + "CAddBuffer::CacheFindDynamicNode; Matching node found."); + + resultNode = iCache[i]; + break; + } + } + } + if ( resultNode != NULL ) + { + OstTraceExt1( TRACE_NORMAL, + CADDBUFFER_CACHEFINDDYNAMICNODE_EXIT, + "EXIT: CAddBuffer::CacheFindDynamicNode;resultNode=%s", + resultNode->iUri ); + } + + return resultNode; + } +//------------------------------------------------------------------------------ +// CAddBuffer::AddNodeToBuffer() +//------------------------------------------------------------------------------ +TInt CAddBuffer::GetGroup( const TDesC8& aRoot, RPointerArray* aGroup ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_GETGROUP_ENTRY, "ENTRY: CAddBuffer::GetGroup;aRoot=%s", aRoot ); + + iCache.Reset(); + TInt retval( KErrNotFound ); + TBool first = ETrue; + TBuf8 groupTag; + groupTag.Copy( aRoot ); + groupTag.Append( KChildNodeWildCardPattern ); + + for ( TInt i = 0; i < iBuffer.Count(); ++i ) + { + if ( iBuffer[i]->iUri.Match( groupTag ) != KErrNotFound + && !iBuffer[i]->iProcessed ) + { + if ( first ) + { + groupTag.Insert( aRoot.Length(), KNodeSeparator ); + groupTag.Insert( aRoot.Length() + 1, CUtils::GetSecondURISeg( iBuffer[i]->iUri ) ); + first = EFalse; + retval = 0; + } + aGroup->Append(iBuffer[i]); + iCache.Append(iBuffer[i]); + retval++; + } + } + OstTrace1( TRACE_NORMAL, CADDBUFFER_GETGROUP_EXIT, "EXIT: CAddBuffer::GetGroup;retval=%d", retval ); + + return retval; + } +//------------------------------------------------------------------------------ +// CAddBuffer::~CAddBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::Reset() + { + OstTraceFunctionEntry0( CADDBUFFER_Reset_ENTRY ); + + iBuffer.ResetAndDestroy(); + + OstTraceFunctionExit0( CADDBUFFER_Reset_EXIT ); + } + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/BranchBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/BranchBase.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,220 @@ +/* + * ============================================================================== + * 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 "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 +#include +#include +#include "BranchBase.h" + +#include "Utils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "BranchBaseTraces.h" +#endif + +_LIT8( KCMProxyNodeSeparator, "/" ); + + + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== +// ------------------------------------------------------------------------------------- +// CBranchBase::CBranchBase() +// ------------------------------------------------------------------------------------- +CBranchBase::CBranchBase() + { + OstTraceFunctionEntry0( CBRANCHBASE_CBRANCHBASE_ENTRY ); + + OstTraceFunctionExit0( CBRANCHBASE_CBRANCHBASE_EXIT ); + } +// ------------------------------------------------------------------------------------- +// CBranchBase::CBranchBase +// ------------------------------------------------------------------------------------- +CBranchBase::CBranchBase( MSmlDmCallback* aDmCallback ) + + { + OstTraceFunctionEntry0( CBRANCHBASE_CBRANCHBASE_2_ENTRY ); + iCallback = aDmCallback; + OstTraceFunctionExit0( DUP1_CBRANCHBASE_CBRANCHBASE_2_EXIT ); + } +// ------------------------------------------------------------------------------------- +// CBranchBase::~CBranchBase() +// ------------------------------------------------------------------------------------- +CBranchBase::~CBranchBase() + { + OstTraceFunctionEntry0( CBRANCHBASE_DELETE_ENTRY ); + + OstTraceFunctionExit0( CBRANCHBASE_DELETE_EXIT ); + } + +// ------------------------------------------------------------------------------------- +// CBranchBase::GetAllConnectionMethodsL() +// Returns all connection methods +// ------------------------------------------------------------------------------------- +void CBranchBase::GetAllConnectionMethodsL( RArray& aCmArray, + RCmManagerExt& aCmManager ) + { + OstTraceFunctionEntry0( CBRANCHBASE_GETALLCONNECTIONMETHODSL_ENTRY ); + + // Get all connection methods + TBool supportedBearersOnly = EFalse; + TBool legacyCmsOnly = EFalse; + TBool includeEasyWlan = EFalse; + + aCmManager.ConnectionMethodL( aCmArray, + supportedBearersOnly, + legacyCmsOnly, + includeEasyWlan ); + + RCmConnectionMethodExt cm; + + // Loop all connection methods and filter away everything else besides packet data. + // Other bearer types are not supported + for( TInt i = 0; i < aCmArray.Count(); i++ ) + { + if ( GetConnectionMethodLC( aCmManager, cm, aCmArray[i] ) ) + { + TUint bearerType = cm.GetIntAttributeL( CMManager::ECmBearerType ); + + if( bearerType != KUidPacketDataBearerType ) + { + // Non supported bearer type. Remove + aCmArray.Remove( i ); + i--; + } + } + CleanupStack::PopAndDestroy( &cm ); + } + OstTrace1( TRACE_NORMAL, CBRANCHBASE_GETALLCONNECTIONMETHODSL_COUNT, "CBranchBase::GetAllConnectionMethodsL; Found %u connection methods.", aCmArray.Count() ); + + OstTraceFunctionExit0( CBRANCHBASE_GETALLCONNECTIONMETHODSL_EXIT ); + } + +//----------------------------------------------------------------------------- +// TBool CBranchBase::CheckPreviousURIList() +//----------------------------------------------------------------------------- +TBool CBranchBase::CheckPreviousURIList( const CArrayFix& aPreviousURISegmentList, + const TUint32 aCmId, + TDes8& aURISeg ) + { + OstTraceExt2( TRACE_NORMAL, CBRANCHBASE_CHECKPREVIOUSURILIST_ENTRY, "ENTRY: CBranchBase::CheckPreviousURIList;aURISeg=%s;aCmId=%u", aURISeg, aCmId ); + + TBool retval = EFalse; + + for ( TInt i = 0; i < aPreviousURISegmentList.Count(); i++ ) + { + if ( CUtils::IntLUID( aPreviousURISegmentList.At(i).iURISegLUID ) == aCmId ) + { + aURISeg.Copy( aPreviousURISegmentList.At(i).iURISeg ); + retval = ETrue; + break; + } + } + OstTrace1( TRACE_NORMAL, CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT, "EXIT: CBranchBase::CheckPreviousURIList;retval=%d", retval ); + + return retval; + } + + +//----------------------------------------------------------------------------- +// CBranchBase::GetAllDynamicNodesL +//----------------------------------------------------------------------------- +void CBranchBase::GetAllDynamicNodesL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + RCmManagerExt& /*aCmManagerExt*/, + CBufBase& aCurrentURISegmentList, + const TDesC8& aField, + const TInt aNodeCount, + MSmlDmCallback* aCallback ) + { + OstTraceExt3( TRACE_NORMAL, + CBRANCHBASE_GETALLDYNAMICNODESL_ENTRY, + "ENTRY: CBranchBase::GetAllDynamicNodesL;aURI=%s;aField=%s;aNodeCount=%d", + aURI, + aField, + aNodeCount ); + + if ( aPreviousURISegmentList.Count() > 0 ) // Already mapped + { + for ( TInt i = 0; i < aPreviousURISegmentList.Count(); i++ ) + { + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + aPreviousURISegmentList.At(i).iURISeg ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + KCMProxyNodeSeparator ); + } + } + else + { + TBuf8 addNodeName; + + // Generate as many nodes as defined + for ( TInt i = 1; i <= aNodeCount; i++ ) + { + addNodeName.Format( _L8( "%s%d" ), aField.Ptr(), i ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), addNodeName ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + KCMProxyNodeSeparator ); + } + } + + aCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + aCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8); + + OstTrace0( TRACE_NORMAL, + CBRANCHBASE_GETALLDYNAMICNODESL_EXIT, + "EXIT: CBranchBase::GetAllDynamicNodesL" ); + + } + +//------------------------------------------------------------------------------ +// TBool CBranchBase::GetConnectionMethodLC() +//------------------------------------------------------------------------------ +TBool CBranchBase::GetConnectionMethodLC( RCmManagerExt& aCmManagerExt, + RCmConnectionMethodExt& aCm, + TUint32 aCmId ) + { + OstTrace1( TRACE_NORMAL, CBRANCHBASE_GETCONNECTIONMETHODLC_ENTRY, "ENTRY: CBranchBase::GetConnectionMethodLC;aCmId=%d", aCmId ); + TInt error( KErrNone ); + + TRAP( error, aCm = aCmManagerExt.ConnectionMethodL( aCmId ) ); + + CleanupClosePushL( aCm ); + + if ( error != KErrNone ) + { + OstTrace0( TRACE_NORMAL, + CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_NOT_FOUND, + "EXIT: CBranchBase::GetConnectionMethodLC;Connection Method NOT found: EFalse." ); + return EFalse; + } + + OstTrace0( TRACE_NORMAL, + CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_FOUND, + "EXIT: CBranchBase::GetConnectionMethodLC;Connection Method FOUND: ETrue." ); + + return ETrue; + } + +// ======== GLOBAL FUNCTIONS ======== + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/ConnMoAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/ConnMoAdapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,571 @@ +/* + * ============================================================================== + * 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 "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 +#include // For TImplementationProxy definition +#include + +#include "nsmldebug.h" +#include "ConnMoAdapter.h" +#include "Utils.h" +#include "BranchBase.h" +#include "NapBranch.h" +#include "ProxyBranch.h" +#include "AddBuffer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ConnMoAdapterTraces.h" +#endif + +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +// DDF version number +_LIT8( KConnMoAdapterDDFversion, "1.0"); + +// URI base for ConnMo Nodes +_LIT8( KConnMoBase, ""); + +// ======== LOCAL FUNCTIONS ========= + +CBranchBase* CConnMoAdapter::GetBranch( const TDesC8& aUri ) + { + TDesC8 connMoBase( KConnMoBase ); + CBranchBase* retval = NULL; + + TPtrC8 connMoTree = + ( CUtils::GetEndOfURIFromSeg( aUri, KConnMoBase )).Mid( connMoBase.Size() ); + + if ( CUtils::GetFirstURISeg( connMoTree ).Match( KCMDdfNAP )!= KErrNotFound ) + { + retval = iNapBranch; + } + else if ( CUtils::GetFirstURISeg( connMoTree ).Match( KCMDdfProxy )!= KErrNotFound ) + { + retval = iProxyBranch; + } + return retval; + } + +// ------------------------------------------------------------------------------------- +// CConnMoAdapter::AddBaseUriL( ) +// Handles addition of possible base URI to ConnMO DDF structure +// ------------------------------------------------------------------------------------- +MSmlDmDDFObject& CConnMoAdapter::AddBaseUriL( MSmlDmDDFObject& aRootDDF ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_ADDBASEURIL_ENTRY ); + + TDesC8 base(KConnMoBase); + + if ( base.Size() > 0) + { + + // Set rest acceptable operations for data itself + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + MSmlDmDDFObject& ddf = aRootDDF.AddChildObjectL( KConnMoBase ); // CMO + + _LIT8( KDescription, "ConnMo DDF description" ); + _LIT8( KDFTitle, "ConnMo Settings Base Node" ); + + CUtils::FillNodeInfoL( ddf, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KDescription ); + + ddf.SetDFTitleL( KDFTitle ); + ddf.SetDefaultValueL( KNullDesC8 ); + OstTraceFunctionExit0( CCONNMOADAPTER_ADDBASEURIL_EXIT ); + return ddf; + } + else + { + OstTraceFunctionExit0( CCONNMOADAPTER_ADDBASEURIL_EXIT_2 ); + return aRootDDF; + } + + } +// ------------------------------------------------------------------------------------- +// CConnMoAdapter::AddBranchL( ) +// Adds dynamic branch to given root node with given name +// ------------------------------------------------------------------------------------- +MSmlDmDDFObject& CConnMoAdapter::AddBranchL( MSmlDmDDFObject& aRootDDF, + const TDesC8& aNodeName ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_ADDBRANCHL_ENTRY, "ENTRY: CConnMoAdapter::AddBranchL;aNodeName=%s", aNodeName ); + + // Set rest acceptable operations for data itself + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + TSmlDmAccessTypes aclTypesAll; + aclTypesAll.SetGet(); + aclTypesAll.SetReplace(); + aclTypesAll.SetAdd(); + aclTypesAll.SetDelete(); + + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + MSmlDmDDFObject& nChildRootDdf = aRootDDF.AddChildObjectL( aNodeName ); // Node + CUtils::FillNodeInfoL( nChildRootDdf, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nChildDdf = nChildRootDdf.AddChildObjectGroupL(); // Node/ + if ( aNodeName == KCMDdfNAP ) + { + CUtils::FillNodeInfoL( nChildDdf, + aclTypesAll, + MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + } + else + { + CUtils::FillNodeInfoL( nChildDdf, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + } + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_ADDBRANCHL_EXIT, "EXIT: CConnMoAdapter::AddBranchL" ); + return nChildDdf; + } + +// ======== MEMBER FUNCTIONS ======== +//----------------------------------------------------------------------------- +// CConnMoAdapter* CConnMoAdapter::NewL( ) +//----------------------------------------------------------------------------- +CConnMoAdapter* CConnMoAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_NEWL_ENTRY ); + + CConnMoAdapter* self = CConnMoAdapter::NewLC( aDmCallback ); + CleanupStack::Pop(); + + OstTraceFunctionExit1( CCONNMOADAPTER_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//----------------------------------------------------------------------------- +// CConnMoAdapter* CConnMoAdapter::NewLC( ) +//----------------------------------------------------------------------------- +CConnMoAdapter* CConnMoAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_NEWLC_ENTRY ); + + CConnMoAdapter* self = new ( ELeave ) CConnMoAdapter( aDmCallback ); + CleanupStack::PushL( self ); + + self->iCallBack = aDmCallback; + self->ConstructL(); + + OstTraceFunctionExit1( CCONNMOADAPTER_NEWLC_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::CConnMoAdapter() +//------------------------------------------------------------------------------ +CConnMoAdapter::CConnMoAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter( aEcomArguments ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_CCONNMOADAPTER_ENTRY ); + + OstTraceFunctionExit0( CCONNMOADAPTER_CCONNMOADAPTER_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::~CConnMoAdapter() +//------------------------------------------------------------------------------ +CConnMoAdapter::~CConnMoAdapter() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_DELETE_ENTRY ); + + delete iBuffer; + delete iNapBranch; + delete iProxyBranch; + iCmManager.Close(); + + OstTraceFunctionExit0( CCONNMOADAPTER_DELETE_EXIT ); + } + +//============================================= +// CConnMoAdapter::ConstructL() +// Second phase constructor. +//============================================= +void CConnMoAdapter::ConstructL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_CONSTRUCTL_ENTRY ); + + iCmManager.OpenL(); + + iBuffer = CAddBuffer::NewL(); + iNapBranch = CNapBranch::NewL( iCallBack, iBuffer, &iCmManager ); + iProxyBranch = CProxyBranch::NewL( iCallBack, iBuffer, &iCmManager ); + + OstTraceFunctionExit0( CCONNMOADAPTER_CONSTRUCTL_EXIT ); + } + +void CConnMoAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_DDFVERSIONL_ENTRY ); + + aDDFVersion.InsertL( 0, KConnMoAdapterDDFversion ); + + OstTraceFunctionExit0( CCONNMOADAPTER_DDFVERSIONL_EXIT ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::DDFStructureL() +//------------------------------------------------------------------------------ +void CConnMoAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_DDFSTRUCTUREL_ENTRY ); + + // Insert Base URI in the beginning of the tree + MSmlDmDDFObject& ddf = AddBaseUriL( aDDF); + + // NAP Branch + MSmlDmDDFObject& nNapDdf = AddBranchL( ddf, KCMDdfNAP ); + iNapBranch->DDFStructureL( nNapDdf ); + + // Proxy Branch + MSmlDmDDFObject& nProxyDdf = AddBranchL( ddf, KCMDdfProxy ); + iProxyBranch->DDFStructureL( nProxyDdf ); + + OstTraceFunctionExit0( CCONNMOADAPTER_DDFSTRUCTUREL_EXIT ); + } + +void CConnMoAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::UpdateLeafObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->UpdateLeafObjectL( aURI, aLUID, aObject, aType, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT, "EXIT: CConnMoAdapter::UpdateLeafObjectL" ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::UpdateLeafObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::UpdateLeafObjectL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_EXIT ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::DeleteObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_DELETEOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::DeleteObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->DeleteObjectL( aURI, aLUID, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_DELETEOBJECTL_EXIT, "EXIT: CConnMoAdapter::DeleteObjectL" ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::FetchLeafObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::FetchLeafObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->FetchLeafObjectL( aURI, aLUID, aType, aResultsRef, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT, "EXIT: CConnMoAdapter::FetchLeafObjectL" ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::FetchLeafObjectSizeL +//------------------------------------------------------------------------------ +void CConnMoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY, "ENTRY: CConnMoAdapter::FetchLeafObjectSizeL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->FetchLeafObjectSizeL( aURI, + aLUID, + aType, + aResultsRef, + aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT, "EXIT: CConnMoAdapter::FetchLeafObjectSizeL" ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::ChildURIListL +// Return childs of the requested node. +//------------------------------------------------------------------------------ +void CConnMoAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_CHILDURILISTL_ENTRY, "ENTRY: CConnMoAdapter::ChildURIListL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->ChildURIListL( aURI, aLUID, aPreviousURISegmentList, + aResultsRef, aStatusRef ); + + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_CHILDURILISTL_EXIT, "EXIT: CConnMoAdapter::ChildURIListL" ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::AddNodeObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::AddNodeObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->AddNodeObjectL( aURI, aParentLUID, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_ADDNODEOBJECTL_EXIT, "EXIT: CConnMoAdapter::AddNodeObjectL" ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::ExecuteCommandL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_EXECUTECOMMANDL_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::ExecuteCommandL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_EXECUTECOMMANDL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::ExecuteCommandL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::ExecuteCommandL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::CopyCommandL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_COPYCOMMANDL_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::CopyCommandL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_COPYCOMMANDL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::StartAtomicL +// Not supported. +//------------------------------------------------------------------------------ +void CConnMoAdapter::StartAtomicL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_STARTATOMICL_ENTRY ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::StartAtomicL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_STARTATOMICL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::CommitAtomicL +// Not supported. +//------------------------------------------------------------------------------ +void CConnMoAdapter::CommitAtomicL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_COMMITATOMICL_ENTRY ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::CommitAtomicL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_COMMITATOMICL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::RollbackAtomicL +// Not supported. +//------------------------------------------------------------------------------ +void CConnMoAdapter::RollbackAtomicL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_ROLLBACKATOMICL_ENTRY ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::RollbackAtomicL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_ROLLBACKATOMICL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::StreamingSupport +// Not supported. Returns EFalse. +//------------------------------------------------------------------------------ +TBool CConnMoAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_STREAMINGSUPPORT_ENTRY ); + + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_STREAMINGSUPPORT_NOT_SUPPORTED, + "CConnMoAdapter::StreamingSupport;Not supported." ); + + OstTraceFunctionExitExt( CCONNMOADAPTER_STREAMINGSUPPORT_EXIT, this, EFalse ); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::StreamCommittedL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::StreamCommittedL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_STREAMCOMMITTEDL_ENTRY); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::StreamCommittedL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_STREAMCOMMITTEDL_EXIT ); + } + +void CConnMoAdapter::CompleteOutstandingCmdsL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_ENTRY ); + + iNapBranch->ProcessBufferL(); + iProxyBranch->ProcessBufferL(); + + iBuffer->Reset(); + + OstTraceFunctionExit0( CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_EXIT ); + } + +// ======== GLOBAL FUNCTIONS ======== +//------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------ +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KConnMoAdapterUid, CConnMoAdapter::NewL) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + OstTraceFunctionEntry1( CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_ENTRY, aTableCount ); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + OstTraceFunctionExit0( CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_EXIT ); + return ImplementationTable; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/ConnMoAdapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/ConnMoAdapter.rss Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,42 @@ +/** @file +* 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 "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: ConnMO resources +* +*/ + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x2001FE5E; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001FE5F; // DM ConnMO Adapter + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/Luid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/Luid.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,78 @@ +/* + * ============================================================================== + * 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 "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 "Luid.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "LuidTraces.h" +#endif + + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== + +//------------------------------------------------------------------------------ +// TLuid::TLuid() +//------------------------------------------------------------------------------ +TLuid::TLuid() + { + + } + +//------------------------------------------------------------------------------ +// TLuid::TLuid() +//------------------------------------------------------------------------------ +TLuid::TLuid( const TDesC8& aName, const TUint32 aCmId ) + { + OstTraceExt2( TRACE_NORMAL, TLUID_TLUID, "ENTRY: TLuid::TLuid;aName=%s;aCmId=%u", aName, aCmId ); + + iName = aName; + iCmId = aCmId; + } + +//------------------------------------------------------------------------------ +// TLuid::Equals() +//------------------------------------------------------------------------------ +TBool TLuid::Equals( TUint32 aId ) const + { + OstTraceFunctionEntry1( TLUID_EQUALS_ENTRY, this ); + if ( aId == iCmId) + { + OstTraceFunctionExitExt( TLUID_EQUALS_EXIT, this, ETrue ); + return ETrue; + } + else + { + OstTraceFunctionExitExt( DUP1_TLUID_EQUALS_EXIT, this, EFalse ); + return EFalse; + } + } + +//------------------------------------------------------------------------------ +// TLuid::GetCmId() +//------------------------------------------------------------------------------ +TUint32 TLuid::GetCmId() + { + OstTrace1( TRACE_NORMAL, TLUID_GETCMID, "TLuid::GetCmId;iCmId=%u", iCmId ); + + return iCmId; + } + +// ======== GLOBAL FUNCTIONS ======== diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/NapBranch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/NapBranch.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,1337 @@ +/* + * ============================================================================== + * 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 "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 +#include +#include +#include +#include +#include +#include "NapBranch.h" +#include "Utils.h" +#include "AddBuffer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "NapBranchTraces.h" +#endif +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +// NAP Branch +_LIT8( KCMDdfID, "ID" ); +_LIT8( KCMDdfName, "Name" ); +_LIT8( KCMDdfAddrType, "AddrType" ); +_LIT8( KCMDdfAddr, "Addr" ); +_LIT8( KCMDdfIP, "IP" ); +_LIT8( KCMDdfAuthInfo, "AuthInfo" ); +_LIT8( KCMDdfAuthType, "AuthType" ); +_LIT8( KCMDdfBearerType, "BearerType" ); +_LIT8( KCMDdfBearerParams, "BearerParams" ); +_LIT8( KCMDdfIPv4, "IPv4" ); +_LIT8( KCMDdfAutoConfig, "AutoConfig" ); +_LIT8( KCMDdfIPAddr, "IPAddr" ); +_LIT8( KCMDdfNetMask, "NetMask" ); +_LIT8( KCMDdfGateway, "Gateway" ); +_LIT8( KCMDdfAutoDNS, "AutoDNS" ); +_LIT8( KCMDdfDNS, "DNS" ); +_LIT8( KCMDdfServers, "Servers" ); +_LIT8( KCMDdfServer, "Server" ); +_LIT8( KCMDdfAuthName, "AuthName" ); +_LIT8( KCMDdfAuthSecret, "AuthSecret" ); +// NAP Child URI List +_LIT8( KCMNapFields, "ID/Name/AddrType/Addr/IP/AuthInfo/BearerType" ); +_LIT8( KCMNIPFields, "IPv4" ); +_LIT8( KCMNIPv4Fields, "AutoConfig/IPAddr/NetMask/Gateway/AutoDNS/DNS" ); +_LIT8( KCMNDNSFields, "Servers" ); +_LIT8( KCMNAuthInfoFields, "AuthType/AuthName/AuthSecret" ); +_LIT8( KCMNDNSServersFields, "Addr"); +_LIT8( KSlash, "/" ); +_LIT8( KDynamicNapNode, "NAP/*" ); +_LIT8( KDynamicNapNodeChildUri, "NAP/*/*" ); +_LIT8( KDynamicIPNode, "NAP/*/IP" ); +_LIT8( KDynamicIPNodeChildUri, "NAP/*/IP/*" ); +_LIT8( KDynamicIPv4Node, "NAP/*/IP/IPv4" ); +_LIT8( KDynamicIPv4NodeChildUri, "NAP/*/IP/IPv4/*" ); +_LIT8( KDynamicIPv4DnsNode, "NAP/*/IP/IPv4/DNS" ); +_LIT8( KDynamicIPv4DnsNodeChildUri, "NAP/*/IP/IPv4/DNS/*" ); +_LIT8( KDynamicIPv4DnsServersNode, "NAP/*/IP/IPv4/DNS/Servers" ); +_LIT8( KDynamicIPv4DnsServersNodeChildUri, "NAP/*/IP/IPv4/DNS/Servers/*" ); +_LIT8( KDynamicIPv4DnsServersNodeChildUriNodes, "NAP/*/IP/IPv4/DNS/Servers/*/*"); +_LIT8( KDynamicAuthInfoNode, "NAP/*/AuthInfo"); +_LIT8( KDynamicAuthInfoNodeChildUri, "NAP/*/AuthInfo/*"); +_LIT8( KNapBearerTypeUri, "NAP/*/BearerType"); +_LIT8( KNapAddrUri, "NAP/*/Addr"); +_LIT8( KNapDNSAddr1Uri, "NAP/*/Server1/Addr"); +_LIT8( KNapDNSAddr2Uri, "NAP/*/Server2/Addr"); +_LIT8( KNapIPv4AddrUri, "NAP/*/IPv4/*Addr"); +_LIT8( KPacketDataBearerType, "3GPPPS"); +_LIT8( KGPRSAddrType, "APN"); +_LIT8( KGPRSAuthType, "PAP"); + + +TInt const KInvalidBearerType = 0; +TInt const KBufferExpandSize = 128; +TInt const KNumOfNAPNodes = 8; +TInt const KMaxResultSize = 64; +TInt const KMaxDnsAddr = 2; +_LIT8( KFalse, "False"); +_LIT8( KTrue, "True"); + +_LIT8( KDynamicNodePrefix, "NAPId" ); + +// ======== LOCAL FUNCTIONS ========= +//----------------------------------------------------------------------------- +// TUint32 CNapBranch::CheckForUnmodifiableFieldL() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::GetUnmodifiableFieldValueL( + const TDesC8& aUri, CBufBase* aResult) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_ENTRY, + "ENTRY: CNapBranch::GetUnmodifiableFieldValueL;aUri=%s", aUri ); + + CSmlDmAdapter::TError retval( CSmlDmAdapter::ENotFound ); + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + if ( nodeName.Match( KCMDdfAddrType ) != KErrNotFound ) + { + aResult->InsertL( 0, KGPRSAddrType ); + retval = CSmlDmAdapter::EOk; + } + else if ( nodeName.Match( KCMDdfBearerType ) != KErrNotFound ) + { + aResult->InsertL( 0, KPacketDataBearerType ); + retval = CSmlDmAdapter::EOk; + } + else if ( nodeName.Match( KCMDdfAuthType ) != KErrNotFound ) + { + aResult->InsertL( 0, KGPRSAuthType ); + retval = CSmlDmAdapter::EOk; + } + else if ( nodeName.Match( KCMDdfID ) != KErrNotFound ) + { + TPtrC8 dynamicNode = GetDynamicNAPNodeUri( aUri ); + aResult->InsertL( 0, dynamicNode ); + retval = CSmlDmAdapter::EOk; + } + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_EXIT, + "EXIT: CNapBranch::GetUnmodifiableFieldValueL;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// CSmlDmAdapter::TErrorCNapBranch::GetLeafData() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::GetLeafDataL(const TDesC8& aURI, + RCmConnectionMethodExt& aCm, CBufBase* aResult) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETLEAFDATAL_ENTRY, + "ENTRY: CNapBranch::GetLeafDataL;aURI=%s", aURI ); + + TUint32 attributeRef( 0 ); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + HBufC16* resultTmp; + + attributeRef = MapUriToCmAttribute( aURI ); + switch ( attributeRef ) + { + case CMManager::ECmName: + case CMManager::EPacketDataIPNameServer1: + case CMManager::EPacketDataIPNameServer2: + case CMManager::EPacketDataAPName: + case CMManager::EPacketDataIFAuthName: + case CMManager::EPacketDataIPAddr: + case CMManager::EPacketDataIPNetmask: + case CMManager::EPacketDataIPGateway: + resultTmp = aCm.GetStringAttributeL( attributeRef ); + CleanupStack::PushL( resultTmp ); + aResult->InsertL( 0, CUtils::ConvertTo8LC( *resultTmp ) ); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + CleanupStack::PopAndDestroy( resultTmp ); + break; + case CMManager::EPacketDataIPAddrFromServer: + case CMManager::EPacketDataIPDNSAddrFromServer: + if ( aCm.GetBoolAttributeL( attributeRef ) ) + { + aResult->InsertL( 0, KTrue ); + } + else + { + aResult->InsertL( 0, KFalse ); + } + + break; + default: + status = GetUnmodifiableFieldValueL( aURI, aResult ); + break; + } + OstTrace1( TRACE_NORMAL, CNAPBRANCH_GETLEAFDATAL_EXIT, + "EXIT: CNapBranch::GetLeafDataL;status=%{TError}", status ); + + return status; + } + +//----------------------------------------------------------------------------- +// CNapBranch::GetUnmodifiableFieldAddResult() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::GetUnmodifiableFieldAddResult( + const TDesC8& aUri, const TDesC8& aObject) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_ENTRY, + "ENTRY: CNapBranch::GetUnmodifiableFieldAddResult;aUri=%s", aUri ); + + CSmlDmAdapter::TError retval( CSmlDmAdapter::ENotFound ); + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + if ( nodeName.Match( KCMDdfAddrType ) != KErrNotFound ) + { + if ( aObject.Match( KGPRSAddrType ) != KErrNotFound ) + { + retval = CSmlDmAdapter::EOk; + } + else + { + retval = CSmlDmAdapter::EInvalidObject; + } + } + else if ( nodeName.Match( KCMDdfAuthType ) != KErrNotFound ) + { + if ( aObject.Match( KGPRSAuthType ) != KErrNotFound ) + { + retval = CSmlDmAdapter::EOk; + } + else + { + retval = CSmlDmAdapter::EInvalidObject; + } + } + + OstTrace1( TRACE_NORMAL, DUP1_CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_EXIT, + "EXIT: CNapBranch::GetUnmodifiableFieldAddResult;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// CNapBranch::MapUriToCmAttribute(() +//----------------------------------------------------------------------------- +TUint32 CNapBranch::MapUriToCmAttribute(const TDesC8& aUri) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_MAPURITOCMATTRIBUTE_ENTRY, + "ENTRY: CNapBranch::MapUriToCmAttribute;aUri=%s", aUri ); + + TUint32 retval( 0 ); + + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_MAPURITOCMATTRIBUTE_GET_NODE, + "CNapBranch::MapUriToCmAttribute;nodeName=%s", nodeName ); + + if ( nodeName.Match( KCMDdfName ) != KErrNotFound ) + { + retval = CMManager::ECmName; + } + else if ( nodeName.Match( KCMDdfAddr ) != KErrNotFound ) + { + // IP branch and NAP branch have both "Addr" leaf. Select between them. + if ( aUri.Match( KNapAddrUri ) != KErrNotFound && + aUri.Match( KNapIPv4AddrUri ) == KErrNotFound ) + { + retval = CMManager::EPacketDataAPName; + } + else if ( aUri.Match( KNapDNSAddr1Uri ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPNameServer1; + } + else if ( aUri.Match( KNapDNSAddr2Uri ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPNameServer2; + } + } + else if ( nodeName.Match( KCMDdfBearerType ) != KErrNotFound ) + { + retval = CMManager::ECmBearerType; + } + else if ( nodeName.Match( KCMDdfAuthName ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIFAuthName; + } + else if ( nodeName.Match( KCMDdfAuthSecret ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIFAuthPass; + } + else if ( nodeName.Match( KCMDdfAutoConfig ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPAddrFromServer; + } + else if ( nodeName.Match( KCMDdfIPAddr ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPAddr; + } + else if ( nodeName.Match( KCMDdfNetMask ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPNetmask; + } + else if ( nodeName.Match( KCMDdfGateway ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPGateway; + } + else if ( nodeName.Match( KCMDdfAutoDNS )!= KErrNotFound ) + { + retval = CMManager::EPacketDataIPDNSAddrFromServer; + } + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_MAPURITOCMATTRIBUTE_EXIT, + "EXIT: CNapBranch::MapUriToCmAttribute;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// void CNapBranch::SetLeafData() +//----------------------------------------------------------------------------- +void CNapBranch::SetLeafDataL(const TDesC8& aURI, const TDesC8& aObject, + TInt aStatusRef, RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_FLOW, CNAPBRANCH_SETLEAFDATAL_ENTRY, + "ENTRY: CNapBranch::SetLeafDataL;aURI=%s", aURI ); + + TUint32 attributeRef( 0 ); + TBool tmpBool = EFalse; + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + attributeRef = MapUriToCmAttribute( aURI ); + OstTrace1( TRACE_NORMAL, CNAPBRANCH_SETLEAFDATAL_GET_CMATTRIB, + "CNapBranch::SetLeafDataL;CM Attribute:;attributeRef=%{TConnectionMethodCommonAttributes}", + attributeRef ); + + switch ( attributeRef ) + { + case CMManager::ECmName: + case CMManager::EPacketDataIPNameServer1: + case CMManager::EPacketDataIPNameServer2: + case CMManager::EPacketDataAPName: + case CMManager::EPacketDataIFAuthName: + case CMManager::EPacketDataIFAuthPass: + case CMManager::EPacketDataIPAddr: + case CMManager::EPacketDataIPNetmask: + case CMManager::EPacketDataIPGateway: + aCm.SetStringAttributeL( attributeRef, CUtils::ConvertTo16LC( aObject ) ); + CleanupStack::PopAndDestroy(); // ConvertTo16LC + break; + case CMManager::EPacketDataIPAddrFromServer: + case CMManager::EPacketDataIPDNSAddrFromServer: + if ( CUtils::DesToBool( aObject, tmpBool ) == KErrNone ) + { + aCm.SetBoolAttributeL( attributeRef, tmpBool ); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + break; + case CMManager::ECmBearerType: + // BearerType is already set when CM was created. + break; + default: + // Attribute field was not from CM. Check if value is hard coded to CM. + status = GetUnmodifiableFieldAddResult( aURI, aObject ); + break; + } + iCallback->SetStatusL( aStatusRef, status ); + OstTrace1( TRACE_NORMAL, CNAPBRANCH_SETLEAFDATAL_EXIT, + "EXIT: CNapBranch::SetLeafDataL;status=%{TError}", status ); + } + +//----------------------------------------------------------------------------- +// TBool CNapBranch::SetNodeData() +//----------------------------------------------------------------------------- +void CNapBranch::SetNodeDataL(CConnMoNodeElement* aNode, + RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_ENTRY, + "ENTRY: CNapBranch::SetNodeDataL;aNode->iUri=%s", aNode->iUri ); + + if ( aNode->iParentLUID.Length() == 0 ) + { + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, aCm.GetIntAttributeL( CMManager::ECmId ) ); + + iCallback->SetMappingL( aNode->iUri, addLUID ); + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EOk ); + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_OK, + "CNapBranch::SetNodeDataL; CSmlDmAdapter::EOk" ); + } + else + { + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_EXISTS, + "CNapBranch::SetNodeDataL; CSmlDmAdapter::EAlreadyExists" ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_EXIT, + "EXIT: CNapBranch::SetNodeDataL" ); + } + +//----------------------------------------------------------------------------- +// TBool CNapBranch::FindNewCmType +//----------------------------------------------------------------------------- +TBool CNapBranch::FindNewCmType(TUint32& aBearerType) + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FINDNEWCMTYPE_ENTRY, "ENTRY: CNapBranch::FindNewCmType" ); + + TBool retval = EFalse; + // Find bearer type for creating a connection methdod + CConnMoNodeElement* processNode = iBuffer->CacheFind( KNapBearerTypeUri ); + if ( processNode ) + { + if ( processNode->iObject.Match( KPacketDataBearerType ) != KErrNotFound ) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_FINDNEWCMTYPE_3GPP, + "CNapBranch::FindNewCmType;Bearer Type: %s", KPacketDataBearerType ); + + aBearerType = KUidPacketDataBearerType; + retval = ETrue; + } + else + { + aBearerType = KInvalidBearerType; + } + } + OstTrace1( TRACE_NORMAL, CNAPBRANCH_FINDNEWCMTYPE_EXIT, + "EXIT: CNapBranch::FindNewCmType;retval=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CNapBranch::AllMandatoryNapFieldsFound() +//----------------------------------------------------------------------------- +TBool CNapBranch::AllMandatoryNapFieldsFound() + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_ENTRY, + "ENTRY: CNapBranch::AllMandatoryNapFieldsFound" ); + + TBool retval = ETrue; + + // Check that NAP Address addition is found + if ( !iBuffer->CacheFind( KNapAddrUri ) ) + { + retval = EFalse; + } + // Check that dynamic nap node addition is found + if ( !iBuffer->CacheFindDynamicNode( KDynamicNapNode ) ) + { + retval = EFalse; + } + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_EXIT, + "EXIT: CNapBranch::AllMandatoryNapFieldsFound;retval=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CNapBranch::NapChildURIListL +// TBool CNapBranch::NapChildURIList( ) +//----------------------------------------------------------------------------- +void CNapBranch::NapChildURIListL(const TDesC8& aURI, const CArrayFix< + TSmlDmMappingInfo>& aPreviousURISegmentList, TInt aResultsRef, + TInt aStatusRef, CBufBase& aCurrentURISegmentList) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_NAPCHILDURILISTL_ENTRY, + "ENTRY: CNapBranch::NapChildURIListL;aURI=%s", aURI ); + + RArray CmArray; + CleanupClosePushL( CmArray ); + + TPtrC8 napTree = CUtils::GetEndOfURIFromSeg( aURI, KCMDdfNAP ); + + GetAllConnectionMethodsL( CmArray, *iCmManager ); + + for (TInt i = 0; i < CmArray.Count(); i++ ) + { + TBuf8 addURISeg; + if ( !CheckPreviousURIList( aPreviousURISegmentList, CmArray[i], addURISeg ) ) + { + // Connection Method not found in previous URI list + addURISeg.Append( aURI ); + addURISeg.Append( KSlash ); + addURISeg.Append( KDynamicNodePrefix ); + + addURISeg.AppendNumFixedWidth( CmArray[i], EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, CmArray[i] ); + + OstTraceExt1( TRACE_NORMAL, + CNAPBRANCH_NAPCHILDURILISTL_ADDED_TO_LIST, + "CNapBranch::NapChildURIListL;Added to list: URI=%s", addURISeg ); + + iCallback->SetMappingL( addURISeg, addLUID ); + } + + // Child is the last segment in uri + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + CUtils::GetLastURISeg(addURISeg) ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), KSlash ); + } + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8 ); + + CleanupStack::PopAndDestroy( &CmArray ); + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_NAPCHILDURILISTL_EXIT, + "EXIT: CNapBranch::NapChildURIListL" ); + } +//----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CNapBranch::DeleteObjectL +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::DeleteObjectL(const TDesC8& aURI, + const TDesC8& aLUID) + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_PRIVATE_ENTRY, + "ENTRY: CNapBranch::DeleteObjectL" ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + + RCmConnectionMethodExt cm; + + if( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + + // Check, if referred connection method exists + if ( GetConnectionMethodLC( *iCmManager, cm, cmId ) ) + { + cm.DeleteL(); + status = CSmlDmAdapter::EOk; + OstTrace1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_PRIVATE_DELETE, + "CNapBranch::DeleteObjectL; Connection Method=%u deleted.", cmId ); + } + + CleanupStack::PopAndDestroy( &cm ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_PRIVATE_EXIT, + "EXIT: CNapBranch::DeleteObjectL;status=%{TError}", status ); + + return status; + } + +// ======== MEMBER FUNCTIONS ======== +//----------------------------------------------------------------------------- +// CNapBranch* CNapBranch::NewL( ) +//----------------------------------------------------------------------------- +CNapBranch* CNapBranch::NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, RCmManagerExt* aCmManagerExt) + { + OstTraceFunctionEntry1( CNAPBRANCH_NEWL_ENTRY, ( TUint )( aDmCallback ) ); + + CNapBranch* self = new (ELeave) CNapBranch( aDmCallback ); + CleanupStack::PushL(self); + + self->ConstructL( aBuffer, aCmManagerExt ); + + CleanupStack::Pop(self); + + OstTraceFunctionExit1( CNAPBRANCH_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CNapBranch::CNapBranch() +//------------------------------------------------------------------------------ +CNapBranch::CNapBranch(MSmlDmCallback* aDmCallback) : + CBranchBase(aDmCallback) + { + OstTraceFunctionEntry1( CNAPBRANCH_CONSTRUCTOR_ENTRY, this ); + + iCallback = aDmCallback; + + OstTraceFunctionExit1( CNAPBRANCH_CONSTRUCTOR_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// CNapBranch::~CNapBranch() +//------------------------------------------------------------------------------ +CNapBranch::~CNapBranch() + { + OstTraceFunctionEntry1( CNAPBRANCH_DESTRUCTOR_ENTRY, this ); + + OstTraceFunctionExit1( CNAPBRANCH_DESTRUCTOR_EXIT, this ); + } + +//============================================= +// CNapBranch::ConstructL() +// Second phase constructor. +//============================================= +void CNapBranch::ConstructL(CAddBuffer* aBuffer, RCmManagerExt* aCmManagerExt) + { + OstTraceFunctionEntry1( CNAPBRANCH_CONSTRUCTL_ENTRY, this ); + + iBuffer = aBuffer; + iCmManager = aCmManagerExt; + + OstTraceFunctionExit1( CNAPBRANCH_CONSTRUCTL_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// void CNapBranch::DDFStructureL() +//------------------------------------------------------------------------------ +void CNapBranch::DDFStructureL(MSmlDmDDFObject& aDDF) + { + OstTraceFunctionEntry0( CNAPBRANCH_DDFSTRUCTUREL_ENTRY ); + + // + // Set rest acceptable operations for data itself + // + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + MSmlDmDDFObject& nIDDDF = aDDF.AddChildObjectL( KCMDdfID ); // ID + CUtils::FillNodeInfoL( nIDDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nNameDDF = aDDF.AddChildObjectL( KCMDdfName ); // Name + CUtils::FillNodeInfoL( nNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrTypeDDF = aDDF.AddChildObjectL( KCMDdfAddrType ); // AddrType + CUtils::FillNodeInfoL( nAddrTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrDDF = aDDF.AddChildObjectL( KCMDdfAddr ); // Addr + CUtils::FillNodeInfoL( nAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nIPDDF = aDDF.AddChildObjectL( KCMDdfIP ); // IP + CUtils::FillNodeInfoL( nIPDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nIPv4DDF = nIPDDF.AddChildObjectL( KCMDdfIPv4 ); // IPv4 + CUtils::FillNodeInfoL( nIPv4DDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + IpBranchDDFStructureL( nIPv4DDF ); + + MSmlDmDDFObject& nAuthInfoDDF = aDDF.AddChildObjectL( KCMDdfAuthInfo ); // AuthInfo + CUtils::FillNodeInfoL( nAuthInfoDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nAuthNameDDF = nAuthInfoDDF.AddChildObjectL( KCMDdfAuthName ); // AuthName + CUtils::FillNodeInfoL( nAuthNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAuthTypeDDF = nAuthInfoDDF.AddChildObjectL( KCMDdfAuthType ); // AuthType + CUtils::FillNodeInfoL( nAuthTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAuthSecretDDF = nAuthInfoDDF.AddChildObjectL( KCMDdfAuthSecret ); // AuthSecret + CUtils::FillNodeInfoL( nAuthSecretDDF, + aclTypesNoGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nBearerTypeDDF = aDDF.AddChildObjectL( KCMDdfBearerType ); // BearerType + CUtils::FillNodeInfoL( nBearerTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nBearerParamsDDF = aDDF.AddChildObjectL( KCMDdfBearerParams ); // BearerParams + CUtils::FillNodeInfoL( nBearerParamsDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + OstTraceFunctionExit0( CNAPBRANCH_DDFSTRUCTUREL_EXIT ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::IpBranchDDFStructureL +// ------------------------------------------------------------------------------------- +void CNapBranch::IpBranchDDFStructureL(MSmlDmDDFObject& nIPvXDDF) + { + OstTraceFunctionEntry0( CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_ENTRY ); + + // + // Set rest acceptable operations for data itself + // + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + MSmlDmDDFObject& nAutoConfigDDF = nIPvXDDF.AddChildObjectL( KCMDdfAutoConfig ); // AutoConfig + CUtils::FillNodeInfoL( nAutoConfigDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nIPAddrDDF = nIPvXDDF.AddChildObjectL( KCMDdfIPAddr ); // IPAddr + CUtils::FillNodeInfoL( nIPAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nNetMaskDDF = nIPvXDDF.AddChildObjectL( KCMDdfNetMask ); // NetMask + CUtils::FillNodeInfoL( nNetMaskDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nGatewayDDF = nIPvXDDF.AddChildObjectL( KCMDdfGateway ); // Gateway + CUtils::FillNodeInfoL( nGatewayDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAutoDNSDDF = nIPvXDDF.AddChildObjectL( KCMDdfAutoDNS ); // AutoDNS + CUtils::FillNodeInfoL( nAutoDNSDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNullDesC8 ); + + MSmlDmDDFObject& nDNSDDF = nIPvXDDF.AddChildObjectL( KCMDdfDNS ); // DNS + CUtils::FillNodeInfoL( nDNSDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nServersDDF = nDNSDDF.AddChildObjectL( KCMDdfServers ); // Servers + CUtils::FillNodeInfoL( nServersDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nServersRootDDF = nServersDDF.AddChildObjectGroupL(); // Servers/ + CUtils::FillNodeInfoL( nServersRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrDDF = nServersRootDDF.AddChildObjectL( KCMDdfAddr ); // Addr + CUtils::FillNodeInfoL( nAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + OstTraceFunctionExit0( CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_EXIT ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::UpdateLeafObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::UpdateLeafObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& /*aType*/, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_UPDATELEAFOBJECTL_ENTRY, + "ENTRY: CNapBranch::UpdateLeafObjectL;aURI=%s", aURI ); + + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + + if ( aLUID.Length() == 0 && cmId == KErrNotFound ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aLUID, aObject, aStatusRef ); + } + else + { + // Existing node, update data immediately + TInt err( KErrNone ); + RCmConnectionMethodExt cm; + if ( cmId == KErrNotFound ) + { + cmId = CUtils::IntLUID( aLUID ); + } + + TRAP( err, cm = iCmManager->ConnectionMethodL( cmId ) ); + CleanupClosePushL( cm ); + + if ( !err ) + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_UPDATELEAFOBJECTL, "CNapBranch::UpdateLeafObjectL; Update existing node data immediately." ); + SetLeafDataL( aURI, aObject, aStatusRef, cm ); + cm.UpdateL(); + } + else + { + OstTrace0( TRACE_NORMAL, DUP1_CNAPBRANCH_UPDATELEAFOBJECTL, "CNapBranch::UpdateLeafObjectL; Stale LUID - Buffer setting." ); + iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aObject, aStatusRef ); + } + + CleanupStack::PopAndDestroy( &cm ); + } + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_UPDATELEAFOBJECTL_EXIT, + "EXIT: CNapBranch::UpdateLeafObjectL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::DeleteObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::DeleteObjectL(const TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_ENTRY, + "ENTRY: CNapBranch::DeleteObjectL;aURI=%s", aURI ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::EError; + + TPtrC8 napTree = CUtils::GetEndOfURIFromSeg( aURI, KCMDdfNAP ); + + if ( napTree.Match( KDynamicNapNode ) != KErrNotFound && + napTree.Match( KDynamicNapNodeChildUri ) == KErrNotFound ) + { + + status = DeleteObjectL( aURI, aLUID ); + + } + + iCallback->SetStatusL( aStatusRef, status ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_EXIT, + "EXIT: CNapBranch::DeleteObjectL;status=%{TError}", status ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::FetchLeafObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::FetchLeafObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_ENTRY, + "ENTRY: CNapBranch::FetchLeafObjectL;aURI=%s", aURI ); + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + if ( cmId != KErrNotFound ) + { + CBufBase* result = CBufFlat::NewL( KBufferExpandSize ); + CleanupStack::PushL( result ); + + // Open connection method. + RCmConnectionMethodExt cm; + TRAPD(err, cm = iCmManager->ConnectionMethodL( cmId ) ); + if (err != KErrNone ) + { + CleanupStack::PopAndDestroy( result ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_DUP_FETCHLEAFOBJECTL_NOT_FOUND, "CSmlDmAdapter::ENotFound" ); + return; + } + CleanupClosePushL( cm ); + + // Find data from CM + CSmlDmAdapter::TError status = GetLeafDataL( aURI, + cm, + result ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_STATUS, + "CNapBranch::FetchLeafObjectL;status=%{TError}", status ); + + if ( status == CSmlDmAdapter::EOk ) + { + iCallback->SetResultsL( aResultsRef, *result, aType ); + } + iCallback->SetStatusL( aStatusRef, status ); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( result ); + } + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_NOT_FOUND, "CSmlDmAdapter::ENotFound" ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_EXIT, "EXIT: CNapBranch::FetchLeafObjectL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::FetchLeafObjectSizeL +// ------------------------------------------------------------------------------------- +void CNapBranch::FetchLeafObjectSizeL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY, + "ENTRY: CNapBranch::FetchLeafObjectSizeL;aURI=%s", aURI ); + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + if ( cmId != KErrNotFound ) + { + CBufBase* result = CBufFlat::NewL( KBufferExpandSize ); + CleanupStack::PushL(result); + + // Open connection method. + RCmConnectionMethodExt cm; + TRAPD(err, cm = iCmManager->ConnectionMethodL( cmId ) ); + if (err != KErrNone ) + { + CleanupStack::PopAndDestroy( result ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_DUP1_FETCHLEAFOBJECTL_NOT_FOUND, "CSmlDmAdapter::ENotFound" ); + return; + } + CleanupClosePushL( cm ); + + // Find data from CM + CSmlDmAdapter::TError status = GetLeafDataL( aURI, + cm, + result ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_STATUS, + "CNapBranch::FetchLeafObjectSizeL;status=%{TError}", status ); + + if ( status == CSmlDmAdapter::EOk ) + { + TInt size = result->Size(); + TBuf8 sizeStr; + sizeStr.AppendNum( size ); + + result->Reset(); + result->InsertL( 0, sizeStr ); + + iCallback->SetResultsL( aResultsRef, *result, aType); + } + iCallback->SetStatusL( aStatusRef, status ); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( result ); + } + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_NOT_FOUND, + "CNapBranch::FetchLeafObjectSizeL;CSmlDmAdapter::ENotFound" ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT, + "EXIT: CNapBranch::FetchLeafObjectSizeL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::ChildURIListL +// ------------------------------------------------------------------------------------- +void CNapBranch::ChildURIListL(const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_CHILDURILISTL_ENTRY, + "ENTRY: CNapBranch::ChildURIListL;aURI=%s", aURI ); + + + TPtrC8 napTree = CUtils::GetEndOfURIFromSeg( aURI,KCMDdfNAP ); + + CBufBase* currentURISegmentList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( currentURISegmentList ); + + // First handle ./NAP as a special case + if ( napTree.Match( KCMDdfNAP ) != KErrNotFound ) + { + NapChildURIListL( aURI, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *currentURISegmentList ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + return; + } + + // Then check if the CM exists. Use LUID or predefined ID + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + // If after this cmId is still not found then the branch does not exist + if ( cmId == KErrNotFound ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP1_CNAPBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + + RCmConnectionMethodExt cm; + // Check it the method actually can be found + if ( !GetConnectionMethodLC( *iCmManager, cm, cmId ) ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP2_CNAPBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + CleanupStack::PopAndDestroy( &cm ); + + if ( napTree.Match( KDynamicNapNode ) != KErrNotFound && + napTree.Match( KDynamicNapNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNapFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP + + else if ( napTree.Match( KDynamicIPNode ) != KErrNotFound && + napTree.Match( KDynamicIPNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNIPFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP/IPv4 + + else if ( napTree.Match( KDynamicIPv4Node ) != KErrNotFound && + napTree.Match( KDynamicIPv4NodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNIPv4Fields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP/IPv4/DNS + + else if ( napTree.Match( KDynamicIPv4DnsNode ) != KErrNotFound && + napTree.Match( KDynamicIPv4DnsNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNDNSFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP/IPv4/DNS/Servers + + else if ( napTree.Match( KDynamicIPv4DnsServersNode ) != KErrNotFound ) + { + GetAllDynamicNodesL( aURI, + aLUID, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *iCmManager, + *currentURISegmentList, + KCMDdfServer, + KMaxDnsAddr, + iCallback ); + } + // ./NAP/*/IP/IPv4/DNS/Servers* + + else if ( napTree.Match( KDynamicIPv4DnsServersNodeChildUri ) != KErrNotFound && + napTree.Match( KDynamicIPv4DnsServersNodeChildUriNodes ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNDNSServersFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/AuthInfo + + else if ( napTree.Match( KDynamicAuthInfoNode ) != KErrNotFound && + napTree.Match( KDynamicAuthInfoNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNAuthInfoFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_CHILDURILISTL, + "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + } + + CleanupStack::PopAndDestroy( currentURISegmentList ); + + OstTrace0( TRACE_NORMAL, DUP1_CNAPBRANCH_CHILDURILISTL_EXIT, + "EXIT: CNapBranch::ChildURIListL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::AddNodeObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::AddNodeObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_ENTRY, + "ENTRY: CNapBranch::AddNodeObjectL;aURI=%s", aURI ); + + if ( aParentLUID.Length() == 0 ) + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + RCmConnectionMethodExt cm; + // Check if CM exists + if ( cmId != KErrNotFound && GetConnectionMethodLC( *iCmManager, cm, cmId ) ) + { + CleanupStack::PopAndDestroy( &cm ); + // Pre-defined CM already exists for this ID. + // NAPs must be added in one message. If luid is given add is done to existing AP or node + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL, + "CNapBranch::AddNodeObjectL; CSmlDmAdapter::EAlreadyExists because tried to add in predefined node format that exists" ); + return; + } + if ( cmId != KErrNotFound ) + { + CleanupStack::PopAndDestroy( &cm ); + } + + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aParentLUID, aStatusRef ); + //iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE, + "CNapBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // Sanity check: If the dynamic name of the NAP node has is the same as deleted previously and + // DM Framework hasn't updated the tree, it will give the LUID when calling this method. Thus, + // it's needed to check that the connection method really exists. + RCmConnectionMethodExt cm; + + if ( !GetConnectionMethodLC( *iCmManager, cm, CUtils::IntLUID( aParentLUID) ) ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aStatusRef ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE2, + "CNapBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // NAPs must be added in one message. If luid is given add is done to existing AP or node + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_ALLREADY_EXISTS, + "CNapBranch::AddNodeObjectL; CSmlDmAdapter::EAlreadyExists" ); + } + + CleanupStack::PopAndDestroy( &cm ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_EXIT, "EXIT: CNapBranch::AddNodeObjectL" ); + + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::ProcessNodeBufferL() +// ------------------------------------------------------------------------------------- +void CNapBranch::ProcessBufferL() + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_PROCESSBUFFERL_ENTRY, "ENTRY: CNapBranch::ProcessBufferL" ); + + TUint32 bearerType; + + RPointerArray napNodes( KNumOfNAPNodes ); + CleanupClosePushL( napNodes ); + + while ( iBuffer->GetGroup( KCMDdfNAP, &napNodes ) != KErrNotFound ) + { + + if ( FindNewCmType( bearerType ) && AllMandatoryNapFieldsFound() ) + { + // Create new connection method and update nodes + RCmConnectionMethodExt cm = iCmManager->CreateConnectionMethodL( bearerType ); + CleanupClosePushL( cm ); + cm.UpdateL(); + + for ( TInt i = 0; i < napNodes.Count(); ++i ) + { + if ( napNodes[i]->iLeaf ) + { + // Leaf data found + SetLeafDataL( napNodes[i]->iUri, + napNodes[i]->iObject, + napNodes[i]->iStatusRef, cm ); + napNodes[i]->iProcessed = ETrue; + } + else + { + // Node has no leaf data + SetNodeDataL( napNodes[i], cm); + napNodes[i]->iProcessed = ETrue; + } + } + cm.UpdateL(); + CleanupStack::PopAndDestroy( &cm ); + } + else + { + for ( TInt i = 0; i < napNodes.Count(); ++i ) + { + iCallback->SetStatusL( napNodes[i]->iStatusRef, CSmlDmAdapter::EError ); + napNodes[i]->iProcessed = ETrue; + } + } + napNodes.Reset(); + } + CleanupStack::Pop( &napNodes ); + napNodes.Close(); + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_PROCESSBUFFERL_EXIT, "EXIT: CNapBranch::ProcessBufferL" ); + + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetDynamicAPNodeUri( const TDesC8& aURI ) +// returns NAP/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNapBranch::GetDynamicNAPNodeUri(const TDesC8& aURI) + { + + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETDYNAMICNAPNODEURI, "CNapBranch::GetDynamicNAPNodeUri;aURI=%s", aURI ); + + TInt i= 0; + for ( i = aURI.Find( KCMDdfNAP ) + 4; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + OstTraceExt1( TRACE_NORMAL, DUP1_CNAPBRANCH_GETDYNAMICNAPNODEURI, "CNapBranch::GetDynamicNAPNodeUri;return URI=%s", aURI.Left( i ) ); + + return aURI.Left( i ); + } + +//-------------------------------------------------------------------- +//TInt CNapBranch::IsNAPUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CNapBranch::IsNAPUriFormatMatchPredefined(const TDesC8 & aURI) +{ + if( aURI.Match( _L8( "NAP/NAPId*" ) ) != KErrNotFound ) + { + return ETrue; + } + else + { + return EFalse; + } +} +//------------------------------------------------------------------------------ +// TUint32 CNapBranch::GetAPIdFromURIL(const TDesC8& aURI) +// Get NAP id for given aURI +//------------------------------------------------------------------------------ +TInt CNapBranch::GetCmIdFromURIL(const TDesC8& aURI) + { + TInt ret(KErrNotFound); + + if( !IsNAPUriFormatMatchPredefined( aURI ) ) + { + // Cannot get CmIds from any other format URIs than predefined + return ret; + } + + TLex8 lex; + // Find xxx from ./NAP/NAPIdxxx/... + TInt start = aURI.Find( KDynamicNodePrefix ) + KDynamicNodePrefix().Length(); + lex = aURI.Mid( start, 3 ); + lex.Val( ret ); + + return ret; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/ProxyBranch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/ProxyBranch.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,1112 @@ +/* + * ============================================================================== + * 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 "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 +#include +#include + +#include "ProxyBranch.h" +#include "Utils.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ProxyBranchTraces.h" +#endif + +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +_LIT8( KCMProxyDdf, "Proxy" ); +_LIT8( KCMProxyDdfProxyId, "ProxyId" ); +_LIT8( KCMProxyDdfName, "Name" ); +_LIT8( KCMProxyDdfAddr, "Addr" ); +_LIT8( KCMProxyDdfToConRef, "ToConRef" ); +_LIT8( KCMProxyDdfConRef, "ConRef" ); +_LIT8( KCMProxyDdfPorts, "Ports" ); +_LIT8( KCMProxyDdfPortNbr, "PortNbr" ); +_LIT8( KCMProxyDdfProxyParams, "ProxyParams" ); +_LIT8( KCMProxyDdfProxyType, "ProxyType" ); +_LIT8( KCMProxyDdfWap, "WAP" ); +_LIT8( KCMProxyDdfStartpg, "Startpg" ); + +_LIT8( KCMProxyFields, "ProxyId/Addr/ToConRef/Ports/ProxyType/ProxyParams" ); +_LIT8( KCMProxyParamsFields, "WAP" ); +_LIT8( KCMProxyWapFields, "Startpg" ); +_LIT8( KCMProxyNodeSeparator, "/" ); + +_LIT8( KDynamicProxyNodePattern, "Proxy/*" ); +_LIT8( KDynamicProxyNodeChildUri, "Proxy/*/*" ); +_LIT8( KDynamicToConrefNode, "Proxy/*/ToConRef" ); +_LIT8( KDynamicToConrefNodeChildUri, "Proxy/*/ToConRef/*" ); +_LIT8( KDynamicToConrefNodeChildUriNodes, "Proxy/*/ToConRef/*/*" ); +_LIT8( KDynamicPortsNode, "Proxy/*/Ports" ); +_LIT8( KDynamicPortsNodeChildUri, "Proxy/*/Ports/*" ); +_LIT8( KDynamicPortsNodeChildUriNodes, "Proxy/*/Ports/*/*" ); +_LIT8( KDynamicProxyParamsNode, "Proxy/*/ProxyParams" ); +_LIT8( KDynamicProxyParamsNodeChildUri, "Proxy/*/ProxyParams/*" ); +_LIT8( KDynamicProxyParamsWapNode, "Proxy/*/ProxyParams/WAP" ); + +_LIT8( KProxyAddrUri, "Proxy/*/Addr"); +_LIT8( KProxyConrefUri, "Proxy/*/ConRef"); + +_LIT8( KRoot, "./"); + +TInt const KBufferExpandSize = 128; +TInt const KNumOfProxyNodes = 8; + +_LIT8( KDynamicNodePrefix, "ProxyId"); + +// ======== LOCAL FUNCTIONS ========= + +//----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CProxyBranch::FetchLeafObjectL() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CProxyBranch::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aLeafObject ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_ENTRY, + "ENTRY: CProxyBranch::FetchLeafObjectL;aURI=%s", aURI ); + + RCmConnectionMethodExt cm; + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotAllowed; + TPtrC8 leafNode = CUtils::GetLastURISeg( aURI ); + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + + if ( cmId == KErrNotFound || !GetConnectionMethodLC( *iCmManager, cm, cmId ) || + !cm.GetBoolAttributeL(CMManager::ECmProxyUsageEnabled) ) + { + if ( cmId != KErrNotFound ) + { + CleanupStack::PopAndDestroy( &cm ); + } + status = CSmlDmAdapter::ENotFound; + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_NOT_FOUND, + "CProxyBranch::FetchLeafObjectL;status=%{TError}", status ); + + return status; + } + + if ( leafNode.Compare( KCMProxyDdfAddr ) == 0 ) + { + HBufC* serverName = cm.GetStringAttributeL( CMManager::ECmProxyServerName ); + + CleanupStack::PushL( serverName ); + aLeafObject.InsertL( 0, CUtils::ConvertTo8LC( *serverName ) ); + + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo8LC + CleanupStack::PopAndDestroy( serverName ); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfConRef ) == 0 ) + { + TBuf8 conRef; + TBuf8 napChildList; + CBufBase* napChildListBuf = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( napChildListBuf ); + + // Get all NAP node childs + iCallback->FetchLinkL( _L8("./NAP"), *napChildListBuf, status ); + napChildListBuf->Read( 0, napChildList, napChildListBuf->Size() ); + + if ( status == CSmlDmAdapter::EOk) + { + // Reset operation end status + status = CSmlDmAdapter::EError; + + // Find correct Uri + while ( napChildList.Length() > 0 && status != CSmlDmAdapter::EOk ) + { + conRef.Append( _L("NAP/") ); + CUtils::AppendFirstURISeg( napChildList, conRef ); + HBufC8* napLuid = iCallback->GetLuidAllocL( conRef ); + if ( cmId == CUtils::IntLUID( *napLuid ) ) + { + status = CSmlDmAdapter::EOk; + aLeafObject.InsertL( 0, conRef ); + } + delete napLuid; + conRef.Delete( 0, conRef.Length() ); + } + } + + CleanupStack::PopAndDestroy( napChildListBuf ); + } + else if ( leafNode.Compare( KCMProxyDdfPortNbr ) == 0 ) + { + TInt proxyPort = cm.GetIntAttributeL( CMManager::ECmProxyPortNumber ); + + aLeafObject.InsertL( 0, CUtils::IntToCharL( proxyPort ) ); + CleanupStack::PopAndDestroy(); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfStartpg ) == 0 ) + { + HBufC* startPage = cm.GetStringAttributeL( CMManager::ECmStartPage ); + + CleanupStack::PushL( startPage ); + aLeafObject.InsertL( 0, CUtils::ConvertTo8LC( *startPage ) ); + + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo8LC + CleanupStack::PopAndDestroy( startPage ); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfProxyType ) == 0 ) + { + HBufC* protocolName = cm.GetStringAttributeL( CMManager::ECmProxyProtocolName ); + + CleanupStack::PushL( protocolName ); + aLeafObject.InsertL( 0, CUtils::ConvertTo8LC( *protocolName ) ); + + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo8LC + CleanupStack::PopAndDestroy( protocolName ); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfProxyId ) == 0 ) + { + TPtrC8 dynamicNode = GetDynamicProxyNodeUri( aURI ); + aLeafObject.InsertL( 0, dynamicNode ); + status = CSmlDmAdapter::EOk; + } + + CleanupStack::PopAndDestroy( &cm ); + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_EXIT, + "EXIT: CProxyBranch::FetchLeafObjectL;status=%{TError}", status ); + return status; + } + +//----------------------------------------------------------------------------- +// TUint32 CProxyBranch::CheckForUnmodifiableField() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CProxyBranch::CheckForUnmodifiableField(const TDesC8& aUri) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_ENTRY, + "ENTRY: CProxyBranch::CheckForUnmodifiableField;aUri=%s", aUri ); + + CSmlDmAdapter::TError retval(CSmlDmAdapter::ENotFound); + TPtrC8 nodeName = CUtils::GetLastURISeg(aUri); + + if ( nodeName.Match(KCMProxyDdfName) != KErrNotFound || + nodeName.Match(KCMProxyDdfConRef) != KErrNotFound ) + { + retval = CSmlDmAdapter::EOk; + } + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_EXIT, + "EXIT: CProxyBranch::CheckForUnmodifiableField;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::MapUriToCmAttribute() +//----------------------------------------------------------------------------- +TUint32 CProxyBranch::MapUriToCmAttribute( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_MAPURITOCMATTRIBUTE_ENTRY, + "ENTRY: CProxyBranch::MapUriToCmAttribute;aUri=%s", aUri ); + + TUint32 retval(0); + + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + if ( nodeName.Match( KCMProxyDdfAddr )!= KErrNotFound ) + { + retval = CMManager::ECmProxyServerName; + } + else if ( nodeName.Match( KCMProxyDdfPortNbr ) != KErrNotFound ) + { + retval = CMManager::ECmProxyPortNumber; + } + else if ( nodeName.Match( KCMProxyDdfStartpg ) != KErrNotFound ) + { + retval = CMManager::ECmStartPage; + } + else if ( nodeName.Match( KCMProxyDdfProxyType ) != KErrNotFound ) + { + retval = CMManager::ECmProxyProtocolName; + } + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_MAPURITOCMATTRIBUTE_EXIT, + "EXIT: CProxyBranch::MapUriToCmAttribute;retval=%{TConnectionMethodCommonAttributes}", + retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TInt32 CProxyBranch::FindConnectionMethodL() +//----------------------------------------------------------------------------- +TInt32 CProxyBranch::FindConnectionMethodL() + { + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_FINDCONNECTIONMETHODL_ENTRY, + "ENTRY: CProxyBranch::FindConnectionMethod" ); + + TInt32 retval = KErrNotFound; + + CConnMoNodeElement* processNode = iBuffer->CacheFind( KProxyConrefUri ); + + if ( processNode ) + { + + HBufC8* luid; + + // Ignore root part ("./") of the URI if present in the beginning + if ( processNode->iObject.Mid( 0, 2 ).Match( KRoot ) != KErrNotFound ) + { + luid = iCallback->GetLuidAllocL( processNode->iObject.Mid( 2 ) ); + } + else + { + luid = iCallback->GetLuidAllocL( processNode->iObject ); + } + + retval = CUtils::IntLUID( *luid ); + + delete luid; + + } + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FINDCONNECTIONMETHODL_EXIT, + "EXIT: CProxyBranch::FindConnectionMethod;CmId=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::AllMandatoryProxyFieldsFound() +//----------------------------------------------------------------------------- +TBool CProxyBranch::AllMandatoryProxyFieldsFound() + { + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_ENTRY, + "ENTRY: CProxyBranch::AllMandatoryProxyFieldsFound" ); + + TBool retval = ETrue; + + // Check that NAP Address addition is found + if ( !iBuffer->CacheFind(KProxyAddrUri) ) + { + retval = EFalse; + } + if ( !iBuffer->CacheFind(KProxyConrefUri) ) + { + retval = EFalse; + } + // Check that dynamic nap node addition is found + if ( !iBuffer->CacheFindDynamicNode(KDynamicProxyNodePattern) ) + { + retval = EFalse; + } + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_EXIT, + "EXIT: CProxyBranch::AllMandatoryProxyFieldsFound;retval=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::SetLeafData() +//----------------------------------------------------------------------------- +void CProxyBranch::SetLeafDataL(const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aObject, + TInt aStatusRef, + RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_SETLEAFDATAL_ENTRY, + "ENTRY: CProxyBranch::SetLeafDataL;aURI=%s", aURI ); + + TUint32 attributeRef = ( 0 ); + TLex8 lex( aObject ); + TInt value = 0; + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + attributeRef = MapUriToCmAttribute( aURI ); + + switch ( attributeRef ) + { + case CMManager::ECmProxyServerName: + case CMManager::ECmStartPage: + case CMManager::ECmProxyProtocolName: + aCm.SetStringAttributeL( attributeRef, CUtils::ConvertTo16LC( aObject ) ); + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo16LC + break; + case CMManager::ECmProxyPortNumber: + if ( lex.Val( value ) == KErrNone ) + { + aCm.SetIntAttributeL( attributeRef, value ); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + break; + default: + status = CheckForUnmodifiableField( aURI ); + break; + } + iCallback->SetStatusL( aStatusRef, status ); + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_SETLEAFDATAL_EXIT, + "EXIT: CProxyBranch::SetLeafDataL;status=%{TError}", status ); + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::SetNodeData() +//----------------------------------------------------------------------------- +void CProxyBranch::SetNodeDataL(CConnMoNodeElement* aNode, RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_SETNODEDATAL_ENTRY, "ENTRY: CProxyBranch::SetNodeDataL;aNode->iUri=%s", aNode->iUri ); + + if ( aNode->iParentLUID.Length() == 0 ) + { + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, aCm.GetIntAttributeL( CMManager::ECmId ) ); + + iCallback->SetMappingL( aNode->iUri, addLUID ); + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EOk ); + } + else + { + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EAlreadyExists ); + } + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_SETNODEDATAL_EXIT, "EXIT: CProxyBranch::SetNodeDataL" ); + + } +//------------------------------------------------------------------------------ +// void CProxyBranch::GetAllDynamicProxyNodes() +//------------------------------------------------------------------------------ +void CProxyBranch::GetAllDynamicProxyNodesL( const TDesC8& aURI, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_ENTRY, + "ENTRY: CProxyBranch::GetAllDynamicProxyNodesL;aURI=%s", aURI ); + + // Array for connection methods + RArray cmArray; + + CleanupClosePushL( cmArray ); + cmArray.Reset(); + + GetAllConnectionMethodsL( cmArray, *iCmManager ); + + // Loop through all connection methods + for ( TInt i = 0; i < cmArray.Count(); i++ ) + { + RCmConnectionMethodExt cm = iCmManager->ConnectionMethodL( cmArray[i] ); + CleanupClosePushL( cm ); + + // If proxy is enabled for connection method + if ( cm.GetBoolAttributeL( CMManager::ECmProxyUsageEnabled ) ) + { + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_PROXY, + "CProxyBranch::GetAllDynamicProxyNodesL;Proxy enabled for Cm Id=%u", + cmArray[i] ); + + TBuf8addCmName; + // Check if node exists in aPreviousURISegmentList + if ( !CheckPreviousURIList( aPreviousURISegmentList, cmArray[i], addCmName ) ) + { + // Connection Method not found in previous URI list + addCmName.Append( aURI ); + addCmName.Append( KCMProxyNodeSeparator ); + addCmName.Append( KDynamicNodePrefix ); + + addCmName.AppendNumFixedWidth( cmArray[i], EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, cmArray[i] ); + + OstTraceExt1( TRACE_NORMAL, + CPROXYBRANCH_GETALLDYNAMICPROXYNODES_ADDED_TO_LIST, + "CProxyBranch::GetAllDynamicProxyNodesL;Added to list: URI=%s", addCmName ); + + iCallback->SetMappingL( addCmName, addLUID ); + } + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), CUtils::GetLastURISeg( addCmName ) ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), KCMProxyNodeSeparator ); + } + CleanupStack::PopAndDestroy( &cm ); + } + + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8 ); + + CleanupStack::PopAndDestroy( &cmArray ); + + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_EXIT, + "EXI: CProxyBranch::GetAllDynamicProxyNodesLT" ); + } + +// ======== MEMBER FUNCTIONS ======== +//----------------------------------------------------------------------------- +// CProxyBranch* CProxyBranch::NewL( ) +//----------------------------------------------------------------------------- +CProxyBranch* CProxyBranch::NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ) + { + OstTraceFunctionEntry1( CPROXYBRANCH_NEWL_ENTRY, ( TUint )( aDmCallback ) ); + + CProxyBranch* self = new (ELeave) CProxyBranch(aDmCallback, aBuffer, aCmManagerExt ); + + OstTraceFunctionExit1( CPROXYBRANCH_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CProxyBranch::CProxyBranch() +//------------------------------------------------------------------------------ +CProxyBranch::CProxyBranch(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ) + : CBranchBase( aDmCallback ) + { + OstTraceFunctionEntry1( CPROXYBRANCH_CONSTRUCTOR_ENTRY, this ); + + iCallback = aDmCallback; + iBuffer = aBuffer; + iCmManager = aCmManagerExt; + + OstTraceFunctionExit1( CPROXYBRANCH_CONSTRUCTOR_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// CProxyBranch::~CProxyBranch() +//------------------------------------------------------------------------------ +CProxyBranch::~CProxyBranch() + { + OstTraceFunctionEntry1( CPROXYBRANCH_DESTRUCTOR_ENTRY, this ); + + OstTraceFunctionExit1( CPROXYBRANCH_DESTRUCTOR_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::DDFStructureL() +//------------------------------------------------------------------------------ +void CProxyBranch::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + OstTraceFunctionEntry0( CPROXYBRANCH_DDFSTRUCTUREL_ENTRY ); + + // + // Set rest acceptable operations for data itself + // + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + TSmlDmAccessTypes aclTypesAddGet; + aclTypesAddGet.SetGet(); + aclTypesAddGet.SetAdd(); + + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + MSmlDmDDFObject& nProxyIdDDF = aDDF.AddChildObjectL( KCMProxyDdfProxyId ); // ProxyId + CUtils::FillNodeInfoL( nProxyIdDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrDDF = aDDF.AddChildObjectL( KCMProxyDdfAddr ); // Addr + CUtils::FillNodeInfoL( nAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nToConRefDDF = aDDF.AddChildObjectL( KCMProxyDdfToConRef ); // ToConRef + CUtils::FillNodeInfoL( nToConRefDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nToConRefRootDDF = nToConRefDDF.AddChildObjectGroupL(); // ToConRef/ + CUtils::FillNodeInfoL( nToConRefRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nConRefDDF = nToConRefRootDDF.AddChildObjectL( KCMProxyDdfConRef ); // ToConRef//ConRef + CUtils::FillNodeInfoL( nConRefDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nPortsDDF = aDDF.AddChildObjectL( KCMProxyDdfPorts ); // Ports + CUtils::FillNodeInfoL( nPortsDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nPortsRootDDF = nPortsDDF.AddChildObjectGroupL(); // Ports/ + CUtils::FillNodeInfoL( nPortsRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nPortNbrDDF = nPortsRootDDF.AddChildObjectL( KCMProxyDdfPortNbr ); // Ports//PortNbr + CUtils::FillNodeInfoL( nPortNbrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNullDesC8 ); + + MSmlDmDDFObject& nProxyParamsDDF = aDDF.AddChildObjectL( KCMProxyDdfProxyParams ); // ProxyParams + CUtils::FillNodeInfoL( nProxyParamsDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nProxyTypeDDF = aDDF.AddChildObjectL( KCMProxyDdfProxyType ); // ProxyType + CUtils::FillNodeInfoL( nProxyTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + + MSmlDmDDFObject& nWapDDF = nProxyParamsDDF.AddChildObjectL( KCMProxyDdfWap ); // WAP + CUtils::FillNodeInfoL( nWapDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nStartpgDDF = nWapDDF.AddChildObjectL( KCMProxyDdfStartpg ); // Startpg + CUtils::FillNodeInfoL( nStartpgDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + OstTraceFunctionEntry0( CPROXYBRANCH_DDFSTRUCTUREL_EXIT ); + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::UpdateLeafObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_UPDATELEAFOBJECTL_ENTRY, + "ENTRY: CProxyBranch::UpdateLeafObjectL;aURI=%s", aURI ); + + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + + if ( aLUID.Length() == 0 && cmId == KErrNotFound ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aLUID, aObject, aStatusRef); + } + else + { + // Existing node, update data immediately + TInt err( KErrNone ); + RCmConnectionMethodExt cm; + if ( cmId == KErrNotFound ) + { + cmId = CUtils::IntLUID( aLUID ); + } + + TRAP( err, cm = iCmManager->ConnectionMethodL( cmId ) ); + CleanupClosePushL( cm ); + + if ( !err ) + { + OstTrace0( TRACE_NORMAL, DUP1_CPROXYBRANCH_UPDATELEAFOBJECTL, "CProxyBranch::UpdateLeafObjectL; Existing connection method - write value immediately." ); + SetLeafDataL( aURI, aLUID, aObject, aStatusRef, cm ); + cm.UpdateL(); + } + else + { + //iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_UPDATELEAFOBJECTL, "CProxyBranch::UpdateLeafObjectL; Stale LUID - buffer setting." ); + iBuffer->AddNodeToBufferL(aURI,KNullDesC8,aObject,aStatusRef); + } + + CleanupStack::PopAndDestroy( &cm ); + } + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_UPDATELEAFOBJECTL_EXIT, + "EXIT: CProxyBranch::UpdateLeafObjectL" ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::DeleteObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + TInt /*aStatusRef*/ ) + { + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::FetchLeafObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_ENTRY, + "ENTRY: CProxyBranch::FetchLeafObjectL;aURI=%s", aURI ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + CBufBase *leafObject = CBufFlat::NewL( KBufferExpandSize ); + CleanupStack::PushL( leafObject ); + leafObject->Reset(); + + status = FetchLeafObjectL( aURI, aLUID, *leafObject ); + + if ( status == CSmlDmAdapter::EOk ) + { + iCallback->SetResultsL( aResultsRef, *leafObject, aType ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECT_OK, + "CProxyBranch::FetchLeafObjectL; EOk" ); + } + + CleanupStack::PopAndDestroy( leafObject ); + + iCallback->SetStatusL( aStatusRef, status ); + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_EXIT, + "EXIT: CProxyBranch::FetchLeafObjectL;status=%{TError}", status ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::FetchLeafObjectSizeL() +//------------------------------------------------------------------------------ +void CProxyBranch::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY, + "ENTRY: CProxyBranch::FetchLeafObjectSizeL;aURI=%s", aURI ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + CBufBase *leafObject = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( leafObject ); + leafObject->Reset(); + + status = FetchLeafObjectL( aURI, aLUID, *leafObject ); + + if ( status == CSmlDmAdapter::EOk ) + { + leafObject->Compress(); + TBuf8<8> size; + size.Num( leafObject->Size() ); + leafObject->Reset(); + leafObject->InsertL(0, size ); + iCallback->SetResultsL( aResultsRef, *leafObject, aType ); + } + + CleanupStack::PopAndDestroy( leafObject ); + + iCallback->SetStatusL( aStatusRef, status ); + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_EXIT, + "EXIT: CProxyBranch::FetchLeafObjectSizeL;status=%{TError}", status ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::ChildURIListL() +//------------------------------------------------------------------------------ +void CProxyBranch::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_CHILDURILISTL_ENTRY, + "ENTRY: CProxyBranch::ChildURIListL;aURI=%s", aURI ); + + TPtrC8 proxyDdfTree = CUtils::GetEndOfURIFromSeg( aURI, KCMProxyDdf ); + + CBufBase* currentURISegmentList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( currentURISegmentList ); + + // Proxy (handle as special case) + if ( proxyDdfTree.Match( KCMProxyDdf ) != KErrNotFound ) + { + GetAllDynamicProxyNodesL( aURI, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *currentURISegmentList ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + return; + } + // Then check if the CM exists. Use LUID or predefined ID + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + // If after this cmId is still not found then the branch does not exist + if ( cmId == KErrNotFound ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP1_CPROXYBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + + RCmConnectionMethodExt cm; + // Check it the method actually can be found + if ( !GetConnectionMethodLC( *iCmManager, cm, cmId ) || !cm.GetBoolAttributeL(CMManager::ECmProxyUsageEnabled ) ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP2_CPROXYBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + CleanupStack::PopAndDestroy( &cm ); + + + // Proxy/ + if ( proxyDdfTree.Match( KDynamicProxyNodePattern ) != KErrNotFound && + proxyDdfTree.Match( KDynamicProxyNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//ToConRef/ + else if ( proxyDdfTree.Match( KDynamicToConrefNodeChildUri ) != KErrNotFound && + proxyDdfTree.Match( KDynamicToConrefNodeChildUriNodes ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyDdfConRef ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//ToConRef + else if ( proxyDdfTree.Match( KDynamicToConrefNode ) != KErrNotFound ) + { + GetAllDynamicNodesL( aURI, + aLUID, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *iCmManager, + *currentURISegmentList, + KCMProxyDdfToConRef, + 1, + iCallback ); + } + + // Proxy//Ports/ + else if ( proxyDdfTree.Match( KDynamicPortsNodeChildUri ) != KErrNotFound && + proxyDdfTree.Match( KDynamicPortsNodeChildUriNodes ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyDdfPortNbr ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//Ports + else if ( proxyDdfTree.Match( KDynamicPortsNode ) != KErrNotFound ) + { + GetAllDynamicNodesL( aURI, + aLUID, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *iCmManager, + *currentURISegmentList, + KCMProxyDdfPorts, + 1, + iCallback ); + } + + // Proxy//ProxyParams + else if ( proxyDdfTree.Match( KDynamicProxyParamsNode ) != KErrNotFound && + proxyDdfTree.Match( KDynamicProxyParamsNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyParamsFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//ProxyParams/WAP + else if ( proxyDdfTree.Match( KDynamicProxyParamsWapNode ) != KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyWapFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Not found + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_CHILDURILISTL_NOT_FOUND, + "CProxyBranch::ChildURIListL;CSmlDmAdapter::ENotFound" ); + + } + + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_CHILDURILISTL_EXIT, + "EXIT: CProxyBranch::ChildURIListL" ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::AddNodeObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_ENTRY, + "ENTRY: CProxyBranch::AddNodeObjectL;aURI=%s", aURI ); + + if ( aParentLUID.Length() == 0 ) + { + // If this is for pre-defined node then get CM id xxx from URI (Proxy/ProxyIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + RCmConnectionMethodExt cm; + // Check if CM exists + if ( cmId != KErrNotFound && GetConnectionMethodLC( *iCmManager, cm, cmId ) + && cm.GetBoolAttributeL(CMManager::ECmProxyUsageEnabled)) + { + CleanupStack::PopAndDestroy( &cm ); + // Pre-defined CM already exists for this ID. + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + return; + } + if ( cmId != KErrNotFound ) + { + CleanupStack::PopAndDestroy( &cm ); + } + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aParentLUID, aStatusRef ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE, + "CProxyBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // Sanity check: If the dynamic name of the Proxy node has is the same as deleted previously and + // DM Framework hasn't updated the tree, it will give the LUID when calling this method. Thus, + // it's needed to check that the connection method really exists. + RCmConnectionMethodExt cm; + + + if ( !GetConnectionMethodLC( *iCmManager, cm, CUtils::IntLUID( aParentLUID ) ) ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aStatusRef ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE2, + "CProxyBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // Proxies must be added in one message. If luid is given add is done to existing AP or node + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_ALREADY_EXISTS, + "CProxyBranch::AddNodeObjectL;CSmlDmAdapter::EAlreadyExists" ); + } + + CleanupStack::PopAndDestroy( &cm ); + } + + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_EXIT, "EXIT: CProxyBranch::AddNodeObjectL" ); + } + +// ------------------------------------------------------------------------------------- +// CProxyBranch::ProcessNodeBufferL() +// ------------------------------------------------------------------------------------- +void CProxyBranch::ProcessBufferL() + { + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_PROCESSBUFFERL_ENTRY, "ENTRY: CProxyBranch::ProcessBufferL" ); + + RPointerArray proxyNodes( KNumOfProxyNodes ); + CleanupClosePushL( proxyNodes ); + while ( iBuffer->GetGroup( KCMDdfProxy, &proxyNodes ) != KErrNotFound ) + { + TInt32 cmId = FindConnectionMethodL(); + + if ( AllMandatoryProxyFieldsFound() && cmId != KErrNotFound ) + { + // Open connection method, enable proxy and update nodes + RCmConnectionMethodExt cm; + TRAPD( err, cm = iCmManager->ConnectionMethodL( cmId ) ); + CleanupClosePushL( cm ); + + if ( !err ) + { + cm.SetBoolAttributeL( CMManager::ECmProxyUsageEnabled, ETrue ); + + for ( TInt i = 0; i < proxyNodes.Count(); ++i ) + { + if ( proxyNodes[i]->iLeaf ) + { + // Leaf data found + SetLeafDataL( proxyNodes[i]->iUri, + proxyNodes[i]->iParentLUID, + proxyNodes[i]->iObject, + proxyNodes[i]->iStatusRef, cm ); + proxyNodes[i]->iProcessed = ETrue; + } + else + { + // Node has no leaf data + SetNodeDataL( proxyNodes[i], cm ); + proxyNodes[i]->iProcessed = ETrue; + } + } + cm.UpdateL(); + } + else + { + for ( TInt i = 0; i < proxyNodes.Count(); ++i ) + { + iCallback->SetStatusL( proxyNodes[i]->iStatusRef, CSmlDmAdapter::EError ); + proxyNodes[i]->iProcessed = ETrue; + } + } + CleanupStack::PopAndDestroy( &cm ); + } + else + { + for ( TInt i = 0; i < proxyNodes.Count(); ++i ) + { + iCallback->SetStatusL( proxyNodes[i]->iStatusRef, CSmlDmAdapter::EError ); + proxyNodes[i]->iProcessed = ETrue; + } + } + proxyNodes.Reset(); + } + CleanupStack::Pop( &proxyNodes ); + proxyNodes.Close(); + + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_PROCESSBUFFERL_EXIT, "EXIT: CProxyBranch::ProcessBufferL" ); + } + + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetDynamicAPNodeUri( const TDesC8& aURI ) +// returns NAP/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CProxyBranch::GetDynamicProxyNodeUri( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_GETDYNAMICPROXYNODEURI, "CProxyBranch::GetDynamicProxyNodeUri;aURI=%s", aURI ); + TInt i= 0; + for ( i = aURI.Find( KCMDdfProxy ) + 6; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + OstTraceExt1( TRACE_NORMAL, DUP1_CPROXYRANCH_GETDYNAMICPROXYNODEURI, "CProxyBranch::GetDynamicProxyNodeUri;return URI=%s", aURI.Left( i ) ); + return aURI.Left( i ); + } + +//-------------------------------------------------------------------- +//TInt CProxyBranch::IsNAPUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CProxyBranch::IsProxyUriFormatMatchPredefined(const TDesC8 & aURI) +{ + if( aURI.Match( _L8( "Proxy/ProxyId*" ) ) != KErrNotFound ) + { + return ETrue; + } + else + { + return EFalse; + } +} +//------------------------------------------------------------------------------ +// TUint32 CProxyBranch::GetAPIdFromURIL(const TDesC8& aURI) +// Get NAP id for given aURI +//------------------------------------------------------------------------------ +TInt CProxyBranch::GetCmIdFromURIL(const TDesC8& aURI) + { + TInt ret(KErrNotFound); + + if( !IsProxyUriFormatMatchPredefined( aURI ) ) + { + // Cannot get CmIds from any other format URIs than predefined + return ret; + } + + TLex8 lex; + // Find xxx from ./Proxy/ProxyIdxxx/... + TInt start = aURI.Find( KDynamicNodePrefix ) + KDynamicNodePrefix().Length(); + lex = aURI.Mid( start, 3 ); + lex.Val( ret ); + + return ret; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/src/Utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/src/Utils.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,312 @@ +/* + * ============================================================================== + * 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 "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 +#include +#include + +#include "Utils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "UtilsTraces.h" +#endif + +// ======== LOCAL CONSTANTS ========= + +_LIT8( KFalse, "False" ); +_LIT8( KTrue, "True" ); +_LIT8( KWhiteSpace, " " ); + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== +//------------------------------------------------------------------------------ +// CUtils::CUtils() +//------------------------------------------------------------------------------ +CUtils::CUtils() + { + OstTraceFunctionEntry0( CUTILS_CUTILS_ENTRY ); + OstTraceFunctionExit0( CUTILS_CUTILS_EXIT ); + } + +//------------------------------------------------------------------------------ +// CUtils::~CUtils() +//------------------------------------------------------------------------------ +CUtils::~CUtils() + { + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetFirstURISeg(const TDesC8& aURI) +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetFirstURISeg( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETFIRSTURISEG_ENTRY, + "ENTRY: CUtils::GetFirstURISeg;aURI=%s", aURI ); + + TInt i = 0; + TInt j = 0; + + for( i =0; i <= aURI.Length()-1; i++ ) + { + if( aURI[i] == '/' ) + { + if ( i == 0 ) + { + // Skip first slash + j = 1; + continue; + } + break; + } + } + OstTraceExt1( TRACE_NORMAL, CUTILS_GETFIRSTURISEG_EXIT, + "EXIT: CUtils::GetFirstURISeg;retval=%s", aURI.Mid( j,i-j ) ); + + return aURI.Mid( j,i-j ); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetSecondURISeg(const TDesC8& aURI) +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetSecondURISeg( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETSECONDURISEG_ENTRY, + "ENTRY: CUtils::GetSecondURISeg;aURI=%s", aURI ); + + TInt j = 0; + TInt i = 0; + + for( i = 0; i <= aURI.Length() - 1; i++ ) + { + if( aURI[i] == '/' ) + { + for( j = i + 1; j <= aURI.Length() - 1; j++ ) + { + if( aURI[j] == '/' ) // Second slash => AP/xxxx + { + break; + } + } + break; + } + } + OstTraceExt1( TRACE_NORMAL, CUTILS_GETSECONDTURISEG_EXIT, + "EXIT: CUtils::GetSecondURISeg;retval=%s", aURI.Mid( i+1, j-1-i ) ); + + return aURI.Mid( i+1, j-1-i ); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetLastURISeg(const TDesC8& aURI) +// Returns only the last uri segment +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetLastURISeg( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETLASTURISEG_ENTRY, + "ENTRY: CUtils::GetLastURISeg;aURI=%s", aURI ); + + TInt i; + + for( i = aURI.Length() - 1 ; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if( i == 0 ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETLASTURISEG_EXIT, + "EXIT: CUtils::GetLastURISeg;retval=%s", aURI ); + return aURI; + } + else + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETLASTURISEG_EXIT2, + "EXIT: CUtils::GetLastURISeg;retval=%s", aURI.Mid( i+1 ) ); + return aURI.Mid( i+1 ); + } + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetEndOfURIFromSeg(const TDesC8& aURI,const TDesC8 aName) +// Returns the end of aURI starting from aName +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetEndOfURIFromSeg( const TDesC8& aURI, const TDesC8& aName ) + { + OstTraceExt2( TRACE_NORMAL, CUTILS_GETENDOFURIFROMSEG_ENTRY, + "ENTRY: CUtils::GetEndOfURIFromSeg;aURI=%s;aName=%s", aURI, aName ); + + TInt begin = aURI.Find( aName ); + + if ( begin == KErrNotFound ) + { + OstTrace1( TRACE_NORMAL, CUTILS_GETENDOFURIFROMSEG_EXIT, + "EXIT: CUtils::GetEndOfURIFromSeg;%d", KErrNotFound ); + return aURI; + } + OstTraceExt1( TRACE_NORMAL, CUTILS_GETENDOFURIFROMSEG_EXIT2, + "EXIT: CUtils::GetEndOfURIFromSeg;%s", aURI.Mid(begin) ); + return aURI.Mid(begin); + } + +//------------------------------------------------------------------------------ +// CUtils::ConvertTo8LC() +// Converts string value to 8-bit +//------------------------------------------------------------------------------ +TDesC8& CUtils::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return *buf; + } + +//------------------------------------------------------------------------------ +// CUtils::ConvertTo16LC() +// Converts string value to 16-bit +//------------------------------------------------------------------------------ +TDesC16& CUtils::ConvertTo16LC( const TDesC8& aSource ) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); + + return *buf16; + } + +// ------------------------------------------------------------------------------------- +// CUtils::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CUtils::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) + + { + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + if( aFormat != MSmlDmDDFObject::ENode ) + { + // aNode.AddDFTypeMimeTypeL(KNSmlMimeType); + } + if ( aDescription != KNullDesC8 ) + { + aNode.SetDescriptionL( aDescription ); + } + } + +// ------------------------------------------------------------------------------------- +// CUtils::StripWhiteSpaces() +// Removes all white spaces from a string +// ------------------------------------------------------------------------------------- +void CUtils::RemoveIllegalCharsFromURI( TDes8& aString ) + { + TInt delPos; + TInt delLen = 1; + + aString.TrimAll(); + delPos = aString.Find( KWhiteSpace ); + while ( delPos != KErrNotFound ) + { + aString.Delete( delPos,delLen ); + delPos = aString.Find( KWhiteSpace ); + } + } + +// ------------------------------------------------------------------------------------- +// TInt CUtils::DesCToBool +// ------------------------------------------------------------------------------------- +TInt32 CUtils::DesToBool( const TDesC8& aSource, TBool& aBool ) + { + TInt retval( KErrNone ); + + if ( aSource.Match( KTrue ) != KErrNotFound ) + { + aBool = ETrue; + } + else if ( aSource.Match( KFalse ) != KErrNotFound ) + { + aBool = EFalse; + } + else + { + retval = KErrGeneral; + } + + return retval; + } + +// ------------------------------------------------------------------------------------- +// CUtils::IntToCharL() +// ------------------------------------------------------------------------------------- +TDesC8& CUtils::IntToCharL( const TInt& aObject ) + { + HBufC8* buf = HBufC8::NewLC( 8 ); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num( aObject ); + + return *buf; + } +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::AppendFirstURISeg( TDes8& aURI, TDes8& aTarget ) +//------------------------------------------------------------------------------ +TInt CUtils::AppendFirstURISeg( TDes8& aURI, TDes8& aTarget ) + { + + TInt i = aURI.FindC(_L8("/")); + + if ( i != KErrNotFound ) + { + aTarget.Append( aURI.Left( i ) ); + aURI.Copy( aURI.Right( aURI.Length() - i - 1 ) ); + } + else + { + aTarget.Copy( aURI ); + aURI.Copy( aURI.Right( 0 ) ); + } + + return i; + } + +//============================================= +// CUtils::IntLUID() +// Returns IntValue for aLUID +//============================================= +TInt CUtils::IntLUID(const TDesC8& aLUID) + { + TInt ret(0); + + TLex8 lex(aLUID); + + lex.Val( ret ); + + return ret; + } + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/traces/OstTraceDefinitions.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,23 @@ +/* +* 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: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/traces/fixed_id.definitions Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,586 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x7 +[GROUP]TRACE_NORMAL=0x3 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CADDBUFFER_ENTRY=0x1ef +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CADDBUFFER_EXIT=0x1f0 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTL_ENTRY=0x1f3 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTL_EXIT=0x1f4 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DELETE_ENTRY=0x1f7 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DELETE_EXIT=0x1f8 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_ENTRY=0x1ad +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_EXIT=0x1ae +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Reset_ENTRY=0x27b +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Reset_EXIT=0x27c +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CBRANCHBASE_2_ENTRY=0x209 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CBRANCHBASE_ENTRY=0x207 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CBRANCHBASE_EXIT=0x208 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_DELETE_ENTRY=0x20b +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_DELETE_EXIT=0x20c +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODSL_ENTRY=0x277 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODSL_EXIT=0x278 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURIL_ENTRY=0x274 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURIL_EXIT=0x275 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURIL_EXIT_2=0x276 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_ENTRY=0x24f +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_EXIT=0x250 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_ENTRY=0x263 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_EXIT=0x264 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_ENTRY=0x26b +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_EXIT=0x26c +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_ENTRY=0x253 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_EXIT=0x254 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_ENTRY=0x25f +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_EXIT=0x260 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_ENTRY=0x257 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_EXIT=0x258 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_ENTRY=0x255 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_EXIT=0x256 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_ENTRY=0x251 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_EXIT=0x252 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_ENTRY=0x25b +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_EXIT=0x25c +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_ENTRY=0x25d +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_EXIT=0x25e +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_ENTRY=0x24d +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_EXIT=0x24e +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_ENTRY=0x24b +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_EXIT=0x24c +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_ENTRY=0x265 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_EXIT=0x266 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_ENTRY=0x261 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_EXIT=0x262 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_ENTRY=0x269 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_EXIT=0x26a +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_ENTRY=0x267 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_EXIT=0x268 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_ENTRY=0x259 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_EXIT=0x25a +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_ENTRY=0x1eb +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_EXIT=0x1ec +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_DELETE_ENTRY=0x1f5 +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_DELETE_EXIT=0x1f6 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTL_ENTRY=0x7d +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTL_EXIT=0x7e +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTOR_ENTRY=0x79 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTOR_EXIT=0x7a +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DDFSTRUCTUREL_ENTRY=0x7f +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DDFSTRUCTUREL_EXIT=0x80 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DESTRUCTOR_ENTRY=0x7b +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DESTRUCTOR_EXIT=0x7c +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_ENTRY=0x279 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_EXIT=0x27a +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NEWL_ENTRY=0x77 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NEWL_EXIT=0x78 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SETLEAFDATAL_ENTRY=0x247 +[TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_ENTRY=0x26d +[TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_EXIT=0x26e +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CONSTRUCTOR_ENTRY=0x8d +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CONSTRUCTOR_EXIT=0x8e +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DDFSTRUCTUREL_ENTRY=0x91 +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DDFSTRUCTUREL_EXIT=0x92 +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DESTRUCTOR_ENTRY=0x8f +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DESTRUCTOR_EXIT=0x90 +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_NEWL_ENTRY=0x8b +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_NEWL_EXIT=0x8c +[TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_ENTRY=0xe4 +[TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_EXIT=0xe5 +[TRACE]TRACE_FLOW[0x7]_DUP1_CBRANCHBASE_CBRANCHBASE_2_EXIT=0x20a +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_ENTRY=0x1b +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_EXIT=0x1c +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_LEAF_ENTRY=0x1d +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_LEAF_EXIT=0x1e +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFINDDYNAMICNODE_ENTRY=0x49 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFINDDYNAMICNODE_EXIT=0x4b +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFINDDYNAMICNODE_MATCH_FOUND=0x4a +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_ENTRY=0x148 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_EXIT=0x48 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_MATCH_FOUND=0x47 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_RESULT_NODE=0x147 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FINDDYNAMICNODE_ENTRY=0x43 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FINDDYNAMICNODE_EXIT=0x45 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FINDDYNAMICNODE_MATCH_FOUND=0x44 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_GETGROUP_ENTRY=0x4c +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_GETGROUP_EXIT=0x4d +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_CHECKPREVIOUSURILIST_ENTRY=0x61 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT=0x9d +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLCONNECTIONMETHODSL_COUNT=0x16e +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_ENTRY=0x65 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_EXIT=0x67 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODLC_ENTRY=0x173 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_FOUND=0x175 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_NOT_FOUND=0x174 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCHL_ENTRY=0x16c +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCHL_EXIT=0x16d +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY=0x157 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_EXIT=0x158 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_ENTRY=0x155 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_EXIT=0x156 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL=0x15d +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL=0x15b +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_ENTRY=0x14f +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_EXIT=0x150 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL=0x15a +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL=0x159 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY=0x151 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT=0x152 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY=0x153 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT=0x154 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL=0x15e +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL=0x15c +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL=0x160 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMINGSUPPORT_NOT_SUPPORTED=0x15f +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY=0x14c +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT=0x14d +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_UNSUPPORTED_METHOD_CALL=0x14e +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL=0x18a +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_ALLREADY_EXISTS=0x181 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_ENTRY=0xdc +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_EXIT=0xdd +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE=0x165 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE2=0x169 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_ENTRY=0xb8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_EXIT=0xb9 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_CHILDURILISTL=0x6 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_CHILDURILISTL_ENTRY=0xd8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_ENTRY=0xcb +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_EXIT=0xcc +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PRIVATE_DELETE=0x166 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PRIVATE_ENTRY=0xc7 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PRIVATE_EXIT=0xc8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DUP1_FETCHLEAFOBJECTL_NOT_FOUND=0x189 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DUP_FETCHLEAFOBJECTL_NOT_FOUND=0x188 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_ENTRY=0xcf +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_EXIT=0xd3 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_NOT_FOUND=0xd2 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_STATUS=0xd0 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0xd4 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0xd7 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_NOT_FOUND=0xd6 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_STATUS=0xd5 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_3GPP=0xb4 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_ENTRY=0xb2 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_EXIT=0xb3 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETDYNAMICNAPNODEURI=0x17a +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETLEAFDATAL_ENTRY=0xa3 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETLEAFDATAL_EXIT=0x9a +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_ENTRY=0xa4 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_ENTRY=0x16f +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_EXIT=0x170 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_MAPURITOCMATTRIBUTE_ENTRY=0xac +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_MAPURITOCMATTRIBUTE_EXIT=0xa8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_MAPURITOCMATTRIBUTE_GET_NODE=0xa7 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_NAPCHILDURILISTL_ADDED_TO_LIST=0xc1 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_NAPCHILDURILISTL_ENTRY=0xc0 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_NAPCHILDURILISTL_EXIT=0xc2 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_PROCESSBUFFERL_ENTRY=0xdf +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_PROCESSBUFFERL_EXIT=0xe0 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETLEAFDATAL_EXIT=0xae +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETLEAFDATAL_GET_CMATTRIB=0xad +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_ENTRY=0xaf +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_EXISTS=0x163 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_EXIT=0x161 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_OK=0x162 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_UPDATELEAFOBJECTL=0x176 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0xc5 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_UPDATELEAFOBJECTL_EXIT=0xc6 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_ALREADY_EXISTS=0x10b +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_ENTRY=0x109 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_EXIT=0x10c +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE=0x167 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE2=0x168 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_ENTRY=0xf2 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_EXIT=0xf3 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_ENTRY=0xe6 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_EXIT=0xe7 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL_ENTRY=0x106 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL_EXIT=0x108 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL_NOT_FOUND=0x107 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_ENTRY=0xe3 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_EXIT=0xe5 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_NOT_FOUND=0xe4 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_ENTRY=0x102 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_EXIT=0x103 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x104 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x105 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECT_OK=0x18 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHODL_ENTRY=0x171 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHODL_EXIT=0x172 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_ENTRY=0xf8 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_EXIT=0xfa +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_PROXY=0xfb +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODES_ADDED_TO_LIST=0x1 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETDYNAMICPROXYNODEURI=0x17e +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_MAPURITOCMATTRIBUTE_ENTRY=0xea +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_MAPURITOCMATTRIBUTE_EXIT=0xeb +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_PROCESSBUFFERL_ENTRY=0x10d +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_PROCESSBUFFERL_EXIT=0x10f +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETLEAFDATAL_ENTRY=0xf4 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETLEAFDATAL_EXIT=0xf5 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETNODEDATAL_ENTRY=0xf6 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETNODEDATAL_EXIT=0xf7 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_UPDATELEAFOBJECTL=0x179 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_UPDATELEAFOBJECTL_ENTRY=0xfe +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_UPDATELEAFOBJECTL_EXIT=0xff +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETENDOFURIFROMSEG_ENTRY=0x13b +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETENDOFURIFROMSEG_EXIT=0x13c +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETENDOFURIFROMSEG_EXIT2=0x13f +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETFIRSTURISEG_ENTRY=0x110 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETFIRSTURISEG_EXIT=0x13d +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETLASTURISEG_ENTRY=0x123 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETLASTURISEG_EXIT=0x124 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETLASTURISEG_EXIT2=0x141 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSECONDTURISEG_EXIT=0x140 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSECONDURISEG_ENTRY=0x112 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_CHILDURILISTL=0x182 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_CHILDURILISTL_EXIT=0xd9 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_GETDYNAMICNAPNODEURI=0x17b +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_EXIT=0xa5 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_UPDATELEAFOBJECTL=0x177 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CPROXYBRANCH_CHILDURILISTL=0x186 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CPROXYBRANCH_UPDATELEAFOBJECTL=0x178 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CPROXYRANCH_GETDYNAMICPROXYNODEURI=0x17f +[TRACE]TRACE_NORMAL[0x3]_DUP2_CNAPBRANCH_CHILDURILISTL=0x183 +[TRACE]TRACE_NORMAL[0x3]_DUP2_CPROXYBRANCH_CHILDURILISTL=0x187 +[[OBSOLETE]][TRACE]TRACE_DEBUG[0x9]_CUTILS_GETSEGPOSITIONFROMURI=0x1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL_ENTRY=0x1b3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL_EXIT=0x1b4 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL__leaf_EXIT=0x1b6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL_leaf_ENTRY=0x1b5 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTOR_ENTRY=0x1af +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTOR_EXIT=0x1b0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFindDynamicNode_ENTRY=0x1c5 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFindDynamicNode_EXIT=0x1c6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFind_ENTRY=0x1c3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFind_EXIT=0x1c4 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DESTRUCTOR_ENTRY=0x1b1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DESTRUCTOR_EXIT=0x1b2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_FindDynamicNode_ENTRY=0x1b9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_FindDynamicNode_EXIT=0x1ba +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Find_ENTRY=0x1b7 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Find_EXIT=0x1b8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_GetGroup_ENTRY=0x1bb +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_GetGroup_EXIT=0x1bc +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWLC_ENTRY=0x9d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWLC_EXIT=0x9e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_ENTRY=0x9b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_EXIT=0x9c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CALLBACK_ENTRY=0x20d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CALLBACK_EXIT=0x20e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODS_ENTRY=0x20f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODS_EXIT=0x210 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURI_ENTRY=0x248 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURI_EXIT=0x249 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURI_EXIT_2=0x24a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBRANCH_ENTRY=0x165 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBRANCH_EXIT=0x166 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY=0x181 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDNODEOBJECTL_EXIT=0x182 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_ENTRY=0x214 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_EXIT=0x215 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CHILDURILISTL_ENTRY=0x17f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CHILDURILISTL_EXIT=0x180 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_ENTRY=0x18b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_EXIT=0x18c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_ENTRY=0x193 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_EXIT=0x194 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_ENTRY=0x16f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_EXIT=0x170 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTOR_ENTRY=0x16b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTOR_EXIT=0x16c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_ENTRY=0x228 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_EXIT=0x229 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_ENTRY=0x173 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_EXIT=0x174 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_ENTRY=0x171 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_EXIT=0x172 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETEOBJECTL_ENTRY=0x179 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETEOBJECTL_EXIT=0x17a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_ENTRY=0x218 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_EXIT=0x219 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DESTRUCTOR_ENTRY=0x16d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DESTRUCTOR_EXIT=0x16e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_ENTRY=0x224 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_EXIT=0x225 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_ENTRY=0x226 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_EXIT=0x227 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY=0x17b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT=0x17c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY=0x17d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT=0x17e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_ENTRY=0x169 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_EXIT=0x16a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_ENTRY=0x167 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_EXIT=0x168 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_ENTRY=0x18d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_EXIT=0x18e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_ENTRY=0x189 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_EXIT=0x18a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_ENTRY=0x191 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_EXIT=0x192 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_ENTRY=0x18f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_EXIT=0x190 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY=0x175 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT=0x176 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_ENTRY=0x22a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_EXIT=0x237 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_ADDNODEOBJECTL_ENTRY=0x1ab +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_ADDNODEOBJECTL_EXIT=0x1ac +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CHILDURILISTL_ENTRY=0x1a9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CHILDURILISTL_EXIT=0x1aa +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CONSTRUCTOR_ENTRY=0x233 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CONSTRUCTOR_EXIT=0x234 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DDFSTRUCTUREL_ENTRY=0x19d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DDFSTRUCTUREL_EXIT=0x19e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DELETEOBJECTL_ENTRY=0x1a3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DELETEOBJECTL_EXIT=0x1a4 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DESTRUCTOR_ENTRY=0x235 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DESTRUCTOR_EXIT=0x236 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTL_ENTRY=0x1a5 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTL_EXIT=0x1a6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x1a7 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x1a8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_NEWL_ENTRY=0x232 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_NEWL_EXIT=0x22d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0x19f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_UPDATELEAFOBJECTL_EXIT=0x1a0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ADDNODEOBJECTL_ENTRY=0xc2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ADDNODEOBJECTL_EXIT=0xc3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_AllMandatoryNapFieldsFound_ENTRY=0x14b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_AllMandatoryNapFieldsFound_EXIT=0x14c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHECKPREVIOUSURILIST_ENTRY=0xe8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHECKPREVIOUSURILIST_EXIT=0xe9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHILDURILISTL_ENTRY=0xc0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHILDURILISTL_EXIT=0xc1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CheckForUnmodifiableField_ENTRY=0x141 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CheckForUnmodifiableField_EXIT=0x142 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DELETEOBJECTL_ENTRY=0xba +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DELETEOBJECTL_EXIT=0xbb +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTL_ENTRY=0xbc +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTL_EXIT=0xbd +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0xbe +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0xbf +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FindNewCmType_ENTRY=0x149 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FindNewCmType_EXIT=0x14a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GETURILISTFORNAPNODEL_ENTRY=0x127 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GETURILISTFORNAPNODEL_EXIT=0x128 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetLeafDataL_ENTRY=0x1c1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetLeafDataL_EXIT=0x1c2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetUnmodifiableFieldValue_ENTRY=0x1bf +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetUnmodifiableFieldValue_EXIT=0x1c0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTURE_ENTRY=0x81 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTURE_EXIT=0x82 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_MapUriToCmAttribute_ENTRY=0x143 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_MapUriToCmAttribute_EXIT=0x144 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NAPCHILDURILISTL_ENTRY=0x105 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NAPCHILDURILISTL_EXIT=0x106 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ProcessBufferL_ENTRY=0x14d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ProcessBufferL_EXIT=0x14e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetLeafDataL_ENTRY=0x145 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetLeafDataL_EXIT=0x146 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetNodeDataL_ENTRY=0x147 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetNodeDataL_EXIT=0x148 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0xb6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_EXIT=0xb7 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_STREAM_ENTRY=0xb8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_STREAM_EXIT=0xb9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_ENTRY=0x195 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_EXIT=0x196 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ADDNODEOBJECTL_ENTRY=0x121 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ADDNODEOBJECTL_EXIT=0x122 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_AllMandatoryProxyFieldsFound_ENTRY=0x135 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_AllMandatoryProxyFieldsFound_EXIT=0x136 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CHILDURILISTL_ENTRY=0x11f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CHILDURILISTL_EXIT=0x120 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CheckForUnmodifiableField_ENTRY=0x12f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CheckForUnmodifiableField_EXIT=0x130 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DELETEOBJECTL_ENTRY=0x119 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DELETEOBJECTL_EXIT=0x11a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTL_ENTRY=0x11b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTL_EXIT=0x11c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x11d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x11e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FindConnectionMethod_ENTRY=0x133 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FindConnectionMethod_EXIT=0x134 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETALLDYNAMICPROXYNODES_ENTRY=0x113 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETALLDYNAMICPROXYNODES_EXIT=0x114 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETCONNECTIONMETHOD_ENTRY=0x110 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETCONNECTIONMETHOD_EXIT=0x111 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETDYNAMICNODESFORPROXYFIELDL_ENTRY=0x125 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETDYNAMICNODESFORPROXYFIELDL_EXIT=0x126 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETURILISTFORPROXYNODEL_ENTRY=0x123 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETURILISTFORPROXYNODEL_EXIT=0x124 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_MapUriToCmAttribute_ENTRY=0x131 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_MapUriToCmAttribute_EXIT=0x132 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ProcessBufferL_ENTRY=0x13b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ProcessBufferL_EXIT=0x13c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetLeafDataL_ENTRY=0x137 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetLeafDataL_EXIT=0x138 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetNodeDataL_ENTRY=0x139 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetNodeDataL_EXIT=0x13a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_ENTRY=0x115 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_EXIT=0x116 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_STREAM_ENTRY=0x117 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_STREAM_EXIT=0x118 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONSTRUCTL_ENTRY=0x26 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONSTRUCTL_EXIT=0x27 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO16LC_ENTRY=0x1a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO16LC_EXIT=0x1b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO8LC_ENTRY=0x18 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO8LC_EXIT=0x19 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_ENTRY=0x22 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_EXIT=0x23 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DESTOINT_ENTRY=0x1c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DESTOINT_EXIT=0x1d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DesToBool_ENTRY=0x13d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DesToBool_EXIT=0x13e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_ExtractCmId_ENTRY=0x13f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_ExtractCmId_EXIT=0x140 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETALLDYNAMICNODESL_ENTRY=0x1bd +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETALLDYNAMICNODESL_EXIT=0x1be +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETENDOFURIFROMSEG_ENTRY=0x3f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETENDOFURIFROMSEG_EXIT=0x41 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETFIRSTURISEG_ENTRY=0xea +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETFIRSTURISEG_EXIT=0x104 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETLASTURISEG_ENTRY=0x33 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETLASTURISEG_EXIT=0x36 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETLASTURISEG_EXIT2=0x37 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSECONDTURISEG_EXIT=0xec +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSECONDURISEG_ENTRY=0xeb +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGFROMURI_ENTRY=0x3c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGFROMURI_EXIT=0x3d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGPOSITIONFROMURI_ENTRY=0x49 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGPOSITIONFROMURI_EXIT=0x4a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETURILISTFORNODEL_ENTRY=0x12d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETURILISTFORNODEL_EXIT=0x12e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWLC_ENTRY=0xe2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWLC_EXIT=0xe3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWL_ENTRY=0xe0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWL_EXIT=0xe1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEGS_ENTRY=0x39 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEGS_ENTRY_EXIT=0x3b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEGS_EXIT=0xf +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEG_ENTRY=0x38 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_ADDNODEOBJECTL_ENTRY=0x163 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_ADDNODEOBJECTL_EXIT=0x164 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CHILDURILISTL_ENTRY=0x161 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CHILDURILISTL_EXIT=0x162 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CONSTRUCTOR_ENTRY=0x151 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CONSTRUCTOR_EXIT=0x152 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DDFSTRUCTUREL_ENTRY=0x155 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DDFSTRUCTUREL_EXIT=0x156 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DELETEOBJECTL_ENTRY=0x15b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DELETEOBJECTL_EXIT=0x15c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DESTRUCTOR_ENTRY=0x153 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DESTRUCTOR_EXIT=0x154 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTL_ENTRY=0x15d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTL_EXIT=0x15e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x15f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x160 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_NEWL_ENTRY=0x14f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_NEWL_EXIT=0x150 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_ENTRY=0x157 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_EXIT=0x158 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_STREAM_ENTRY=0x159 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_STREAM_EXIT=0x15a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CEAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0x1a1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CEAPBRANCH_UPDATELEAFOBJECTL_EXIT=0x1a2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CPROXYBRANCH_GETCONNECTIONMETHOD_EXIT=0x112 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_CUTILS_ENTRY=0x24 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_CUTILS_EXIT=0x25 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_GETENDOFURIFROMSEG_EXIT=0x40 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_GETSEGFROMURI_EXIT=0x3e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_GETSEGPOSITIONFROMURI_EXIT=0x4b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_TLUID_EQUALS_EXIT=0x273 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP2_CUTILS_GETSEGFROMURI_EXIT=0x42 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_DELETE_ENTRY=0x26f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_DELETE_EXIT=0x270 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_EQUALS_ENTRY=0x271 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_EQUALS_EXIT=0x272 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_GETCMID_EXIT=0x246 +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL=0xe +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL=0xc +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL=0xb +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL=0xa +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL=0xf +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL=0xd +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL=0x10 +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_UPDATELEAFOBJECTL_UNSUPPORTED_METHOD_CALL=0x9 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_ENTRY=0x46 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FIND_ENTRY=0x1f +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FIND_EXIT=0x20 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FIND_MATCH_FOUND=0x42 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT=0x62 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLCONNECTIONMETHODS_COUNT=0xf9 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_ADDED_TO_LIST=0x17 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_NOTFOUND=0x66 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODL_ENTRY=0x68 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODL_EXIT_FOUND=0x6a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODL_EXIT_NOT_FOUND=0x69 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_ENTRY=0x63 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_EXIT=0x185 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_NOTFOUND=0x184 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_OK=0x14 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCH_ENTRY=0x149 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCH_EXIT=0x14a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY=0x7b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_EXIT=0x7c +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_ENTRY=0x85 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_EXIT=0x86 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL=0x81 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL=0x7f +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DDFVERSIONL_VERSION=0x14b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_ENTRY=0x8b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_EXIT=0x8c +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL=0x7e +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL=0x7d +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY=0x89 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT=0x8a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY=0x87 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT=0x88 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL=0x82 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL=0x80 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL=0x84 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMINGSUPPORT_NOT_SUPPORTED=0x83 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY=0x8e +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT=0x8f +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_UNSUPPORTED_METHOD_CALL=0x8d +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_ENTRY_2=0x40 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_EXIT_2=0x41 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL=0x180 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_ALLREADY_EXISTS=0xde +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PUBLIC_ENTRY=0xc3 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PUBLIC_EXIT=0xc4 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_WLAN=0xb5 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETLEAFDATAL=0x99 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUE=0x98 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUE_ENTRY=0x97 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUE_EXIT=0xa2 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETURILISTFORNAPNODEL=0x7 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETURILISTFORNAPNODEL_NOTFOUND=0xf +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETURILISTFORNAPNODEL_OK=0xe +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE=0x164 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL3=0x4 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTSIZE_OK=0x19 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHOD_ENTRY=0xee +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHOD_EXIT=0x10e +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETDYNAMICNODESFORPROXYFIELDL_ADDED_TO_LIST=0x5 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETALLDYNAMICNODESL_ADDED_TO_LIST=0x1a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_ENTRY=0x133 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_EXIT=0x136 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_EXIT2=0x139 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_EXIT3=0x142 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGPOSITIONFROMURI_ENTRY=0x143 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGPOSITIONFROMURI_EXIT=0x144 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGPOSITIONFROMURI_EXIT2=0x145 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETURILISTFORNODEL_NOTFOUND=0x13 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETURILISTFORNODEL_OK=0x16 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_NUMOFURISEGS_ENTRY_EXIT=0x146 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_NUMOFURISEG_ENTRY=0x131 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_DUP2_CPROXYBRANCH_UPDATELEAFOBJECTL=0x17d +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_DUP3_CNAPBRANCH_UPDATELEAFOBJECTL=0x17c +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_GetUriListForProxyNodeL=0x2 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_GetUriListForProxyNodeL2=0x3 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_GETCMID=0x16b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_TLUID=0x16a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_TLUID_ID=0x91 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_TLUID_NAME=0x90 diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/connmoadapter/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/connmoadapter/traces/trace.properties Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,117 @@ + + + +EOk +ENotFound +EInvalidObject +EAlreadyExists +ETooLargeObject +EDiskFull +EError +ERollbackFailed +EObjectInUse +ENoMemory +ECommitOK +ERollbackOK +ECommitFailed +ENotAllowed + + +ECmCoverage +ECmDefaultPriority +ECmDestination +ECmBearerHasUi +ECmIPv6Supported +ECmDefaultUiPriority +ECmBearerIcon +ECmBearerAvailableIcon +ECmBearerAvailableName +ECmBearerSupportedName +ECmBearerAvailableText +ECmBearerNamePopupNote +ECmCommsDBBearerType +ECmBearerSettingName +ECmVirtual +ECmInvalidAttribute +ECmAddToAvailableList +ECmLoadResult +ECmBearerType +ECmName +ECmIapId +ECmStartPage +ECmHidden +ECmProtected +ECmNamingMethod +ECmSeamlessnessLevel +ECmElementID +ECmNetworkId +ECmConnected +ECmId +ECmWapId +ECmIapServiceId +ECmMetaHighlight +ECmMetaHiddenAgent +ECmNextLayerIapId +ECmNextLayerSNAPId +ECmProxyUsageEnabled +ECmProxyServerName +ECmProxyProtocolName +ECmProxyPortNumber +ECmProxyExceptions +ECmProxyRangeMax +ECmChargeCardUsageEnabled +ECmChargeCardAccountNumber +ECmChargeCardPIN +ECmChargeCardLocalRule +ECmChargeCardNatRule +ECmChargeCardIntlRule +ECmChargeCardRangeMax +ECmLocationUsageEnabled +ECmLocationIntlPrefixCode +ECmLocationNatPrefixCode +ECmLocationNatCode +ECmLocationAreaCode +ECmLocationDialOutCode +ECmLocationDisableCallWaitingCode +ECmLocationMobile +ECmLocationUsePulseDial +ECmLocationWaitForDialTone +ECmLocationPauseAfterDialOut +ECmLocationRangeMax +ECmWapIPGatewayAddress +ECmWapIPWSPOption +ECmWapIPSecurity +ECmWapIPProxyPort +ECmWapIPProxyLoginName +ECmWapIPProxyLoginPass +ECmWapRangeMax +ECmCommonAttributesStart +ECmIFName +ECmIFParams +ECmIFNetworks +ECmIFPromptForAuth +ECmIFAuthName +ECmIFAuthPass +ECmIFAuthRetries +ECmIPNetmask +ECmIPGateway +ECmIPAddFromServer +ECmIPAddress +ECmIPDNSAddrFromServer +ECmIPNameServer1 +ECmIPNameServer2 +ECmIP6DNSAddrFromServer +ECmIP6NameServer1 +ECmIP6NameServer2 +ECmIPAddrLeaseValidFrom +ECmIPAddrLeaseValidTo +ECmConfigDaemonManagerName +ECmConfigDaemonName +ECmEnableLPCExtension +ECmDisablePlainTextAuth +ECmCommonAttributesEnd +ECmSpecialAttributes +ECmIsLinked +ECmSpecialAttributesEnd + + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/globalwlansettings/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/globalwlansettings/group/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for globalwlanadapter +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +./globalwlanadapter.mmp + + + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/globalwlansettings/group/globalwlanadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/globalwlansettings/group/globalwlanadapter.mmp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project globalwlanadapter +* +*/ + + + +#include +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET globalwlanadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x1315DBD +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +USERINCLUDE ../inc + +START RESOURCE ../src/globalwlanadapter.rss +END + +SOURCEPATH ../src +SOURCE globalwlanadapter.cpp + +LIBRARY charconv.lib commdb.lib efsrv.lib ecom.lib euser.lib +LIBRARY nsmldebug.lib sysutil.lib +LIBRARY inetprotutil.lib +LIBRARY centralrepository.lib bafl.lib estor.lib edbms.lib FeatMgr.lib diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/globalwlansettings/inc/globalwlanadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/globalwlansettings/inc/globalwlanadapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,392 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Global WLAN settings adapter +* +*/ + + + +#ifndef __GLOBALWLANADAPTER_H__ +#define __GLOBALWLANADAPTER_H__ + + +// ----------------------------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------------------------- +#include +#include +#include +#include +#include + + +// ----------------------------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------------------------- + +// The nodes of the DDF structure +_LIT8( KNSmlWLan, "WLAN" ); +_LIT8( KNSmlWLanInternetConnectivityTest, "InternetConnectivityTest" ); +_LIT8( KNSmlWLanUseDefaultSettings, "UseDefaultSettings" ); +_LIT8( KNSmlWLanLongRetryLimit, "LongRetryLimit" ); +_LIT8( KNSmlWLanShortRetryLimit, "ShortRetryLimit" ); +_LIT8( KNSmlWLanRTSThreshold, "RTSThreshold" ); +_LIT8( KNSmlWLanTXPowerLevel, "TXPowerLevel" ); +_LIT8( KNSmlWLanPowerSaving, "PowerSaving" ); +_LIT8( KNSmlWLanBackgroundScanInterval, "BackgroundScanInterval" ); +_LIT8( KNSmlWLanScanRate, "ScanRate" ); +_LIT8( KNSmlWLanRCPITrigger, "RCPITrigger" ); +_LIT8( KNSmlWLanMinActiveChannelTime, "MinActiveChannelTime" ); +_LIT8( KNSmlWLanMaxActiveChannelTime, "MaxActiveChannelTime" ); +_LIT8( KNSmlWLanMaxTxMSDULifeTime, "MaxTxMSDULifeTime" ); +_LIT8( KNSmlWLanScanExpirationTimer, "ScanExpirationTimer" ); +_LIT8( KNSmlWLanUnloadDriverTimer, "UnloadDriverTimer" ); +_LIT8( KNSmlWLanRoamTimer, "RoamTimer" ); +_LIT8( KNSmlWLanRCPIDifference, "RCPIDifference" ); +_LIT8( KNSmlWLanConnRegainTimer, "ConnRegainTimer" ); +_LIT8( KNSmlWLanMaxTriesToFindNw, "MaxTriesToFindNw" ); +_LIT8( KNSmlWLanDelayBetweenFindNw, "DelayBetweenFindNw" ); +_LIT8( KNSmlWLanAllowRadioMeasurements, "AllowRadioMeasurements" ); +_LIT8( KNSmlWLanMinPassiveChannelTime, "MinPassiveChannelTime" ); +_LIT8( KNSmlWLanMaxPassiveChannelTime, "MaxPassiveChannelTime" ); +_LIT8( KNSmlWLanMaxApFailureCount, "MaxApFailureCount" ); +_LIT8( KNSmlWLanLongBeaconFindCount, "LongBeaconFindCount" ); +_LIT8( KNSmlWLanQosNullFrameInterval, "QosNullFrameInterval" ); +_LIT8( KNSmlWLanQosNullFrameTimeout, "QosNullFrameTimeout" ); +_LIT8( KNSmlWLanMTU, "MTU" ); +_LIT8( KNSmlWLanNode, "InternetConnectivityTest/UseDefaultSettings/LongRetryLimit/ShortRetryLimit/RTSThreshold/TXPowerLevel/PowerSaving/BackgroundScanInterval/ScanRate/RCPITrigger/MinActiveChannelTime/MaxActiveChannelTime/MaxTxMSDULifeTime/ScanExpirationTimer/UnloadDriverTimer/RoamTimer/RCPIDifference/ConnRegainTimer/MaxTriesToFindNw/DelayBetweenFindNw/AllowRadioMeasurements/MinPassiveChannelTime/MaxApFailureCount/LongBeaconFindCount/QosNullFrameInterval/QosNullFrameTimeout" ); + +//DDF version number +_LIT8( KNSmGlobalWlanAdapterDDFversion, "1.0"); +_LIT8( KNSmlMimeType, "text/plain" ); +_LIT8( KNSmlEmpty, ""); + + +const TInt KUriSegListLength = 128; +// Maximum input size for nodes +const TInt KInputMaxLength = 50; +// Max lenght of the DDF type +const TInt KTypeMaxLength = 40; +// Repository id +const TUid KCRUidWlanDeviceSettingsRegistryId = {0x101f8e44}; + + +// WLan engine central repository parameters +const TUint32 KWlanScanRate = 0x00000004; +const TUint32 KWlanRcpiTrigger = 0x00000005; +const TUint32 KWlanMinActiveChannelTime = 0x00000006; +const TUint32 KWlanMaxActiveChannelTime = 0x00000007; +const TUint32 KWlanMaxTxMSDULifeTime = 0x00000008; +const TUint32 KWlanScanExpirationTimer = 0x00000009; +const TUint32 KWlanUnloadDriverTimer = 0x0000000A; +const TUint32 KWlanRoamTimer = 0x0000000B; +const TUint32 KWlanRcpiDifference = 0x0000000C; +const TUint32 KWlanConnRegainTimer = 0x0000000D; +const TUint32 KWlanMaxTriesToFindNw = 0x0000000E; +const TUint32 KWlanDelayBetweenFindNw = 0x0000000F; +const TUint32 KWlanMTU = 0x00000010; +const TUint32 KWlanMinPassiveChannelTime = 0x00000011; +const TUint32 KWlanMaxPassiveChannelTime = 0x00000012; +const TUint32 KWlanMaxApFailureCount = 0x00000013; +const TUint32 KWlanLongBeaconFindCount = 0x00000014; +const TUint32 KWlanQosNullFrameInterval = 0x00000015; +const TUint32 KWlanQosNullFrameTimeout = 0x00000016; + +// ----------------------------------------------------------------------------------------------- +// Structures +// ----------------------------------------------------------------------------------------------- + +// Structure for storing the settings to be stored into cenrep and commsdb +struct TGlobalSettings +{ + TUint32 internetConnectivityTest; + TBool internetConnectivityTestPresent; + TBool useDefaultSettings; + TBool useDefaultSettingsPresent; + TUint32 longRetryLimit; + TBool longRetryLimitPresent; + TUint32 shortRetryLimit; + TBool shortRetryLimitPresent; + TUint32 RTSThreshold; + TBool RTSThresholdPresent; + TUint32 TXPowerLevel; + TBool TXPowerLevelPresent; + TBool powerSaving; + TBool powerSavingPresent; + TUint32 backgroundScanInterval; + TBool backgroundScanIntervalPresent; + TUint32 scanRate; + TBool scanRatePresent; + TUint32 RCPITrigger; + TBool RCPITriggerPresent; + TUint32 minActiveChannelTime; + TBool minActiveChannelTimePresent; + TUint32 maxActiveChannelTime; + TBool maxActiveChannelTimePresent; + TUint32 maxTxMSDULifeTime; + TBool maxTxMSDULifeTimePresent; + TUint32 scanExpirationTimer; + TBool scanExpirationTimerPresent; + TUint32 unloadDriverTimer; + TBool unloadDriverTimerPresent; + TUint32 roamTimer; + TBool roamTimerPresent; + TUint32 RCPIDifference; + TBool RCPIDifferencePresent; + TUint32 connRegainTimer; + TBool connRegainTimerPresent; + TUint32 maxTriesToFindNw; + TBool maxTriesToFindNwPresent; + TUint32 delayBetweenFindNw; + TBool delayBetweenFindNwPresent; + TBool allowRadioMeasurements; + TBool allowRadioMeasurementsPresent; + TUint32 minPassiveChannelTime; + TBool minPassiveChannelTimePresent; + TUint32 maxPassiveChannelTime; + TBool maxPassiveChannelTimePresent; + TUint32 maxApFailureCount; + TBool maxApFailureCountPresent; + TUint32 longBeaconFindCount; + TBool longBeaconFindCountPresent; + TUint32 qosNullFrameInterval; + TBool qosNullFrameIntervalPresent; + TUint32 qosNullFrameTimeout; + TBool qosNullFrameTimeoutPresent; + TUint32 MTU; + TBool MTUPresent; +}; + +// Structure for storing the result and status variables from every addition/fetch command +struct TStatusResult +{ + TInt internetConnectivityTestStatus; + TInt internetConnectivityTestResult; + TInt useDefaultSettingsStatus; + TInt useDefaultSettingsResult; + TInt longRetryLimitStatus; + TInt longRetryLimitResult; + TInt shortRetryLimitStatus; + TInt shortRetryLimitResult; + TInt RTSThresholdStatus; + TInt RTSThresholdResult; + TInt TXPowerLevelStatus; + TInt TXPowerLevelResult; + TInt powerSavingStatus; + TInt powerSavingResult; + TInt backgroundScanIntervalStatus; + TInt backgroundScanIntervalResult; + TInt scanRateStatus; + TInt scanRateResult; + TInt RCPITriggerStatus; + TInt RCPITriggerResult; + TInt minActiveChannelTimeStatus; + TInt minActiveChannelTimeResult; + TInt maxActiveChannelTimeStatus; + TInt maxActiveChannelTimeResult; + TInt maxTxMSDULifeTimeStatus; + TInt maxTxMSDULifeTimeResult; + TInt scanExpirationTimerStatus; + TInt scanExpirationTimerResult; + TInt unloadDriverTimerStatus; + TInt unloadDriverTimerResult; + TInt roamTimerStatus; + TInt roamTimerResult; + TInt RCPIDifferenceStatus; + TInt RCPIDifferenceResult; + TInt connRegainTimerStatus; + TInt connRegainTimerResult; + TInt maxTriesToFindNwStatus; + TInt maxTriesToFindNwResult; + TInt delayBetweenFindNwStatus; + TInt delayBetweenFindNwResult; + TInt allowRadioMeasurementsStatus; + TInt allowRadioMeasurementsResult; + TInt minPassiveChannelTimeStatus; + TInt minPassiveChannelTimeResult; + TInt maxPassiveChannelTimeStatus; + TInt maxPassiveChannelTimeResult; + TInt maxApFailureCountStatus; + TInt maxApFailureCountResult; + TInt longBeaconFindCountStatus; + TInt longBeaconFindCountResult; + TInt qosNullFrameIntervalStatus; + TInt qosNullFrameIntervalResult; + TInt qosNullFrameTimeoutStatus; + TInt qosNullFrameTimeoutResult; + TInt MTUStatus; + TInt MTUResult; +}; + + +// ----------------------------------------------------------------------------------------------- +// Enumerations +// ----------------------------------------------------------------------------------------------- + + +// ------------------------------------------------------------------------------------------------ +// CGlobalWLanAdapter +// ------------------------------------------------------------------------------------------------ +class CGlobalWLANAdapter : public CSmlDmAdapter + { +public: + static CGlobalWLANAdapter* NewL( MSmlDmCallback* aDmCallback ); + static CGlobalWLANAdapter* NewLC( MSmlDmCallback* aDmCallback ); + void ConstructL( ); + virtual ~CGlobalWLANAdapter(); + +// Adapter interface + void DDFVersionL( CBufBase& aDDFVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + + +private: + CGlobalWLANAdapter(TAny* aEcomArguments); + void FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ); + void ExecuteBufferL( TBool aFinal = EFalse ); + + /** + * Stores the central repository parameters + * + * @return + */ + void StoreCenRepParamsL(); + + /** + * Stores the CommsDB parameters + * + * @return + */ + void StoreCommsDBParamsL(); + + /** + * Reads the central repository parameters + * + * @return + */ + void ReadCenRepParamsL(); + + /** + * Returns the central repository parameters and updates statuses + * + * @return + */ + void UpdateStatusAndResultL( TInt aResult, TInt aStatus, TDesC8& aValue, TDesC8& aType, TInt aStoreErr ); + + /** + * Reads the CommsDB parameters + * + * @return + */ + void ReadCommsDBParamsL(); + + /** + * Gets the number of uri segments in the URI + * + * @since S60 ?S60_version + * @param aUri The URI whose segments are counted + * @return The amount of segments + */ + TInt NumOfUriSegs( const TDesC8& aUri ); + + /** + * Gets the last uri segment + * + * @since S60 ?S60_version + * @param aUri The URI whose segments are counted + * @return The last segment + */ + TPtrC8 GetLastUriSeg(const TDesC8& aURI); + + TInt DesToInt( const TDesC8& aLuid ); + void InitMemberVariables(); + + MSmlDmCallback* iCallBack; + + // Variable to store the received parameters + TGlobalSettings* iWriteSettings; + // Variable to store whick parameters are to be fetched + TGlobalSettings* iReadSettings; + // Status and result information related to fetches and additions + TStatusResult* iReadStatuses; + TStatusResult* iWriteStatuses; + + TBool iWlanSupported; + + }; + +#endif __GLOBALWLANADAPTER_H__ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/globalwlansettings/rom/globalwlanadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/globalwlansettings/rom/globalwlanadapter.iby Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project GlobalWLANAdapter +* +*/ + + + +REM SyncML Device Management internet adapter + +#include + +#ifndef __GLOBALWLANADAPTER_IBY__ +#define __GLOBALWLANADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected + +#ifdef __SYNCML_DM_WLAN +ECOM_PLUGIN(globalwlanadapter.dll,globalwlanadapter.rsc) +#endif // __SYNCML_DM_WLAN + +#endif //__SYNCML_DM + +#endif //__GLOBALWLANADAPTER_IBY__ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/globalwlansettings/src/globalwlanadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/globalwlansettings/src/globalwlanadapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,2998 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Global WLAN settings Adapter +* +*/ + + + +#include "globalwlanadapter.h" +#include "nsmldebug.h" +#include // For TImplementationProxy definition +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + + +//------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------ +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x1315DBE, CGlobalWLANAdapter::NewL) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CGlobalWLANAdapter: begin"); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE("ImplementationGroupProxy() for CGlobalWLANAdapter: end"); + return ImplementationTable; + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::NewL( ) +//----------------------------------------------------------------------------- +CGlobalWLANAdapter* CGlobalWLANAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CGlobalWLANAdapter::NewL(): begin"); + + CGlobalWLANAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop( self ); + + _DBG_FILE("CGlobalWLANAdapter::NewL(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::NewLC( ) +//----------------------------------------------------------------------------- +CGlobalWLANAdapter* CGlobalWLANAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CGlobalWLANAdapter::NewLC(): begin"); + + CGlobalWLANAdapter* self = new(ELeave) CGlobalWLANAdapter(aDmCallback); + CleanupStack::PushL( self ); + + self->iCallBack = aDmCallback; + _DBG_FILE("CGlobalWLANAdapter::NewLC(): call constructL"); + self->ConstructL( ); + + _DBG_FILE("CGlobalWLANAdapter::NewLC(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// void CGlobalWLAdapter::ConstructL( ) +// Second phase constructor +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::ConstructL( ) + { + _DBG_FILE("CGlobalWLANAdapter::ConstructL(): begin"); + + // checks if Wlan feature is supported + FeatureManager::InitializeLibL(); + iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + FeatureManager::UnInitializeLib(); + + iWriteSettings = new(ELeave) TGlobalSettings; + iReadSettings = new(ELeave) TGlobalSettings; + iReadStatuses = new(ELeave) TStatusResult; + iWriteStatuses = new(ELeave) TStatusResult; + + // set "present" variables to false, since symbian inits thems as true + InitMemberVariables(); + + _DBG_FILE("CGlobalWLANAdapter::ConstructL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter::CGlobalWLANAdapter( ) +// Constructor +//----------------------------------------------------------------------------- +CGlobalWLANAdapter::CGlobalWLANAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CGlobalWLANAdapter::CGlobalWLANAdapter(): begin"); + _DBG_FILE("CGlobalWLANAdapter::CGlobalWLANAdapter(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter::~CGlobalWLANAdapter( ) +// Destructor +//----------------------------------------------------------------------------- +CGlobalWLANAdapter::~CGlobalWLANAdapter( ) + { + _DBG_FILE("CGlobalWLANAdapter::~CGlobalWLANAdapter(): begin"); + + delete iWriteSettings; + delete iReadSettings; + delete iReadStatuses; + delete iWriteStatuses; + + _DBG_FILE("CGlobalWLANAdapter::~CGlobalWLANAdapter(): end"); + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::DDFVersionL( CBufBase& aDDFVersion ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + _DBG_FILE("CGlobalWLANAdapter::DDFVersionL(): begin"); + + aDDFVersion.InsertL( 0, KNSmGlobalWlanAdapterDDFversion ); + + _DBG_FILE("CGlobalWLANAdapter::DDFVersionL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CGlobalWLANAdapter::DDFStructureL(): begin"); + if( !iWlanSupported ) + { + _DBG_FILE("CGlobalWLANAdapter::DDFStructureL(): WLAN not supported."); + return; + } +// +// Set Get, add and replace as acceptable operations +// + + TSmlDmAccessTypes accessTypesGetAddReplace; + accessTypesGetAddReplace.SetAdd(); + accessTypesGetAddReplace.SetGet(); + accessTypesGetAddReplace.SetReplace(); + + //WLAN + MSmlDmDDFObject& rootWLan = aDDF.AddChildObjectL( KNSmlWLan ); + FillNodeInfoL( rootWLan, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN/InternetConnectivityTest + MSmlDmDDFObject& internetConnectivityTest = rootWLan.AddChildObjectL( KNSmlWLanInternetConnectivityTest ); + FillNodeInfoL( internetConnectivityTest, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/UseDefaultSettings + MSmlDmDDFObject& useDefaultSettings = rootWLan.AddChildObjectL( KNSmlWLanUseDefaultSettings ); + FillNodeInfoL( useDefaultSettings, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN/LongRetryLimit + MSmlDmDDFObject& longRetryLimit = rootWLan.AddChildObjectL( KNSmlWLanLongRetryLimit ); + FillNodeInfoL( longRetryLimit, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ShortRetryLimit + MSmlDmDDFObject& shortRetryLimit = rootWLan.AddChildObjectL( KNSmlWLanShortRetryLimit ); + FillNodeInfoL( shortRetryLimit, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + + //WLAN/RTSThreshold + MSmlDmDDFObject& RTSThreshold = rootWLan.AddChildObjectL( KNSmlWLanRTSThreshold ); + FillNodeInfoL( RTSThreshold, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/TXPowerLevel + MSmlDmDDFObject& TXPowerLevel = rootWLan.AddChildObjectL( KNSmlWLanTXPowerLevel ); + FillNodeInfoL( TXPowerLevel, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/PowerSaving + MSmlDmDDFObject& powerSaving = rootWLan.AddChildObjectL( KNSmlWLanPowerSaving ); + FillNodeInfoL( powerSaving, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN/BackgroundScanInterval + MSmlDmDDFObject& backgroundScanInterval = rootWLan.AddChildObjectL( KNSmlWLanBackgroundScanInterval ); + FillNodeInfoL( backgroundScanInterval, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ScanRate + MSmlDmDDFObject& scanRate = rootWLan.AddChildObjectL( KNSmlWLanScanRate ); + FillNodeInfoL( scanRate, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/RCPITrigger + MSmlDmDDFObject& RCPITrigger = rootWLan.AddChildObjectL( KNSmlWLanRCPITrigger ); + FillNodeInfoL( RCPITrigger, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MinActiveChannelTime + MSmlDmDDFObject& minActiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMinActiveChannelTime ); + FillNodeInfoL( minActiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxActiveChannelTime + MSmlDmDDFObject& maxActiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMaxActiveChannelTime ); + FillNodeInfoL( maxActiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxTxMSDULifeTime + MSmlDmDDFObject& maxTxMSDULifeTime = rootWLan.AddChildObjectL( KNSmlWLanMaxTxMSDULifeTime ); + FillNodeInfoL( maxTxMSDULifeTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ScanExpirationTimer + MSmlDmDDFObject& scanExpirationTimer = rootWLan.AddChildObjectL( KNSmlWLanScanExpirationTimer ); + FillNodeInfoL( scanExpirationTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/UnloadDriverTimer + MSmlDmDDFObject& unloadDriverTimer = rootWLan.AddChildObjectL( KNSmlWLanUnloadDriverTimer ); + FillNodeInfoL( unloadDriverTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/RoamTimer + MSmlDmDDFObject& roamTimer = rootWLan.AddChildObjectL( KNSmlWLanRoamTimer ); + FillNodeInfoL( roamTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/KNSmlWLanRCPIDifference + MSmlDmDDFObject& RCPIDifference = rootWLan.AddChildObjectL( KNSmlWLanRCPIDifference ); + FillNodeInfoL( RCPIDifference, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ConnRegainTimer + MSmlDmDDFObject& connRegainTimer = rootWLan.AddChildObjectL( KNSmlWLanConnRegainTimer ); + FillNodeInfoL( connRegainTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxTriesToFindNw + MSmlDmDDFObject& maxTriesToFindNw = rootWLan.AddChildObjectL( KNSmlWLanMaxTriesToFindNw ); + FillNodeInfoL( maxTriesToFindNw, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/DelayBetweenFindNw + MSmlDmDDFObject& delayBetweenFindNw = rootWLan.AddChildObjectL( KNSmlWLanDelayBetweenFindNw ); + FillNodeInfoL( delayBetweenFindNw, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/AllowRadioMeasurements + MSmlDmDDFObject& allowRadioMeasurements = rootWLan.AddChildObjectL( KNSmlWLanAllowRadioMeasurements ); + FillNodeInfoL( allowRadioMeasurements, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN/MinPassiveChannelTime + MSmlDmDDFObject& minPassiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMinPassiveChannelTime ); + FillNodeInfoL( minPassiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxPassiveChannelTime + MSmlDmDDFObject& maxPassiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMaxPassiveChannelTime ); + FillNodeInfoL( maxPassiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxApFailureCount + MSmlDmDDFObject& maxApFailureCount = rootWLan.AddChildObjectL( KNSmlWLanMaxApFailureCount ); + FillNodeInfoL( maxApFailureCount, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/LongBeaconFindCount + MSmlDmDDFObject& longBeaconFindCount = rootWLan.AddChildObjectL( KNSmlWLanLongBeaconFindCount ); + FillNodeInfoL( longBeaconFindCount, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/QosNullFrameInterval + MSmlDmDDFObject& qosNullFrameInterval = rootWLan.AddChildObjectL( KNSmlWLanQosNullFrameInterval ); + FillNodeInfoL( qosNullFrameInterval, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/QosNullFrameTimeout + MSmlDmDDFObject& qosNullFrameTimeout = rootWLan.AddChildObjectL( KNSmlWLanQosNullFrameTimeout ); + FillNodeInfoL( qosNullFrameTimeout, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MTU + MSmlDmDDFObject& MTU = rootWLan.AddChildObjectL( KNSmlWLanMTU ); + FillNodeInfoL( MTU, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + + _DBG_FILE("CGlobalWLANAdapter::DDFStructureL(): end"); + } + + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::AddLeafObjectL( const TDesC& aURI,const +// TDesC& aParentLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL - <%S> <%S>"), &aURI, &aParentLUID ); + + // Get the last uri segment and the number of uri items in the input + TInt uriSegs = NumOfUriSegs( aURI ); + TInt err(KErrNone); + TPtrC8 lastUriSeg = GetLastUriSeg( aURI ); + + //************************************************************************** + // Check which leaf is in question + //************************************************************************** + if( aURI.Match( _L8("WLAN/*" ) ) != KErrNotFound && uriSegs==2 ) + { + // ***************************************************************** + if( lastUriSeg.Match( KNSmlWLanInternetConnectivityTest ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->internetConnectivityTest = err; + iWriteSettings->internetConnectivityTestPresent = ETrue; + iWriteStatuses->internetConnectivityTestStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUseDefaultSettings ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + if( aObject.MatchF( _L8("True")) != KErrNotFound || + aObject.MatchF( _L8("true")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->useDefaultSettings = ETrue; + iWriteSettings->useDefaultSettingsPresent = ETrue; + iWriteStatuses->useDefaultSettingsStatus = aStatusRef; + } + else if ( aObject.MatchF( _L8("False")) != KErrNotFound || + aObject.MatchF( _L8("false")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->useDefaultSettings = EFalse; + iWriteSettings->useDefaultSettingsPresent = ETrue; + iWriteStatuses->useDefaultSettingsStatus = aStatusRef; + } + else + { + err = KErrArgument; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongRetryLimit ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->longRetryLimit = err; + iWriteSettings->longRetryLimitPresent = ETrue; + iWriteStatuses->longRetryLimitStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanShortRetryLimit ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->shortRetryLimit = err; + iWriteSettings->shortRetryLimitPresent = ETrue; + iWriteStatuses->shortRetryLimitStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRTSThreshold ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->RTSThreshold = err; + iWriteSettings->RTSThresholdPresent = ETrue; + iWriteStatuses->RTSThresholdStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanTXPowerLevel ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + //store the parameter + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->TXPowerLevel = err; + iWriteSettings->TXPowerLevelPresent = ETrue; + iWriteStatuses->TXPowerLevelStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanPowerSaving ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + if( aObject.MatchF( _L8("True")) != KErrNotFound || + aObject.MatchF( _L8("true")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->powerSaving = ETrue; + iWriteSettings->powerSavingPresent = ETrue; + iWriteStatuses->powerSavingStatus = aStatusRef; + } + else if ( aObject.MatchF( _L8("False")) != KErrNotFound || + aObject.MatchF( _L8("false")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->powerSaving = EFalse; + iWriteSettings->powerSavingPresent = ETrue; + iWriteStatuses->powerSavingStatus = aStatusRef; + } + else + { + err = KErrArgument; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanBackgroundScanInterval ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->backgroundScanInterval = err; + iWriteSettings->backgroundScanIntervalPresent = ETrue; + iWriteStatuses->backgroundScanIntervalStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanRate ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->scanRate = err; + iWriteSettings->scanRatePresent = ETrue; + iWriteStatuses->scanRateStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPITrigger ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->RCPITrigger = err; + iWriteSettings->RCPITriggerPresent = ETrue; + iWriteStatuses->RCPITriggerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinActiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->minActiveChannelTime = err; + iWriteSettings->minActiveChannelTimePresent = ETrue; + iWriteStatuses->minActiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxActiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->maxActiveChannelTime = err; + iWriteSettings->maxActiveChannelTimePresent = ETrue; + iWriteStatuses->maxActiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTxMSDULifeTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->maxTxMSDULifeTime = err; + iWriteSettings->maxTxMSDULifeTimePresent = ETrue; + iWriteStatuses->maxTxMSDULifeTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanExpirationTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->scanExpirationTimer = err; + iWriteSettings->scanExpirationTimerPresent = ETrue; + iWriteStatuses->scanExpirationTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUnloadDriverTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->unloadDriverTimer = err; + iWriteSettings->unloadDriverTimerPresent = ETrue; + iWriteStatuses->unloadDriverTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRoamTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->roamTimer = err; + iWriteSettings->roamTimerPresent = ETrue; + iWriteStatuses->roamTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPIDifference ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->RCPIDifference = err; + iWriteSettings->RCPIDifferencePresent = ETrue; + iWriteStatuses->RCPIDifferenceStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanConnRegainTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->connRegainTimer = err; + iWriteSettings->connRegainTimerPresent = ETrue; + iWriteStatuses->connRegainTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTriesToFindNw ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->maxTriesToFindNw = err; + iWriteSettings->maxTriesToFindNwPresent = ETrue; + iWriteStatuses->maxTriesToFindNwStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanDelayBetweenFindNw ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->delayBetweenFindNw = err; + iWriteSettings->delayBetweenFindNwPresent = ETrue; + iWriteStatuses->delayBetweenFindNwStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanAllowRadioMeasurements ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + if( aObject.MatchF( _L8("True")) != KErrNotFound || + aObject.MatchF( _L8("true")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->allowRadioMeasurements = ETrue; + iWriteSettings->allowRadioMeasurementsPresent = ETrue; + iWriteStatuses->allowRadioMeasurementsStatus = aStatusRef; + } + else if ( aObject.MatchF( _L8("False")) != KErrNotFound || + aObject.MatchF( _L8("false")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->allowRadioMeasurements = EFalse; + iWriteSettings->allowRadioMeasurementsPresent = ETrue; + iWriteStatuses->allowRadioMeasurementsStatus = aStatusRef; + } + else + { + err = KErrArgument; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinPassiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->minPassiveChannelTime = err; + iWriteSettings->minPassiveChannelTimePresent = ETrue; + iWriteStatuses->minPassiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxPassiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->maxPassiveChannelTime = err; + iWriteSettings->maxPassiveChannelTimePresent = ETrue; + iWriteStatuses->maxPassiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxApFailureCount ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->maxApFailureCount = err; + iWriteSettings->maxApFailureCountPresent = ETrue; + iWriteStatuses->maxApFailureCountStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongBeaconFindCount ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->longBeaconFindCount = err; + iWriteSettings->longBeaconFindCountPresent = ETrue; + iWriteStatuses->longBeaconFindCountStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameInterval ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->qosNullFrameInterval = err; + iWriteSettings->qosNullFrameIntervalPresent = ETrue; + iWriteStatuses->qosNullFrameIntervalStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameTimeout ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->qosNullFrameTimeout = err; + iWriteSettings->qosNullFrameTimeoutPresent = ETrue; + iWriteStatuses->qosNullFrameTimeoutStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMTU ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->MTU = err; + iWriteSettings->MTUPresent = ETrue; + iWriteStatuses->MTUStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + // The given leaf was not found + else + { + err = KErrNotFound; + } + } + else + { + // Something went wrong + _DBG_FILE("CGlobalWLANAdapter::AddLeafObjectL(): Leaf addition failed"); + err = KErrGeneral; + } + + // Update the possible failure to the status, success is updated when the + // actual writing to db is done + switch ( err ) + { + case KErrTooBig: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + break; + + case KErrNotFound: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + break; + + case KErrGeneral: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + break; + + case KErrArgument: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + break; + + case KErrOverflow: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + break; + } + + _DBG_FILE("CGlobalWLANAdapter::AddLeafObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC& aURI, +// const TDesC& aLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL(): begin"); + DBG_ARGS8(_S8("CGlobalWLANAdapter::UpdateLeafObjectL - <%S> <%S>"), &aURI, &aLUID ); + + AddLeafObjectL( aURI, aLUID, aObject, aType, aStatusRef ); + + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +// Not supported +//------------------------------------------------------------------------------ + +void CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL(): streaming: begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL() streaming: end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::DeleteObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TInt aStatusRef ) +// Not supported +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::DeleteObjectL(): begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::DeleteObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +// not supported +//----------------------------------------------------------------------------- + +void CGlobalWLANAdapter::FetchLeafObjectSizeL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aType*/, + TInt /*aResultsRef*/, + TInt /*aStatusRef*/ ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectSizeL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectSizeL(): end"); + return; + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +// +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aType*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): begin"); + DBG_ARGS8(_S8("Fetch aURI - %S - %S"), &aURI, &aLUID); + + // Store the required parameters into the struct. Actual reading will be done in + // when CompleteOutstandingCommands is called + + // Get the last uri segment + TPtrC8 lastUriSeg = GetLastUriSeg( aURI ); + DBG_ARGS8(_S8("Fetch leaf, lasturiseg - %S"), &lastUriSeg); + + //************************************************************************** + // Check which leaf is in question + //************************************************************************** + if( aURI.Match( _L8("WLAN/*" ) ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): WLAN/* found in uri"); + // ***************************************************************** + if( lastUriSeg.Match( KNSmlWLanInternetConnectivityTest ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->internetConnectivityTestPresent = ETrue; + iReadStatuses->internetConnectivityTestResult = aResultsRef; + iReadStatuses->internetConnectivityTestStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUseDefaultSettings ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->useDefaultSettingsPresent = ETrue; + iReadStatuses->useDefaultSettingsResult = aResultsRef; + iReadStatuses->useDefaultSettingsStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongRetryLimit ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->longRetryLimitPresent = ETrue; + iReadStatuses->longRetryLimitResult = aResultsRef; + iReadStatuses->longRetryLimitStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanShortRetryLimit ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->shortRetryLimitPresent = ETrue; + iReadStatuses->shortRetryLimitResult = aResultsRef; + iReadStatuses->shortRetryLimitStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRTSThreshold ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->RTSThresholdPresent = ETrue; + iReadStatuses->RTSThresholdResult = aResultsRef; + iReadStatuses->RTSThresholdStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanTXPowerLevel ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->TXPowerLevelPresent = ETrue; + iReadStatuses->TXPowerLevelResult = aResultsRef; + iReadStatuses->TXPowerLevelStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanPowerSaving ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->powerSavingPresent = ETrue; + iReadStatuses->powerSavingResult = aResultsRef; + iReadStatuses->powerSavingStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanBackgroundScanInterval ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->backgroundScanIntervalPresent = ETrue; + iReadStatuses->backgroundScanIntervalResult = aResultsRef; + iReadStatuses->backgroundScanIntervalStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanRate ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->scanRatePresent = ETrue; + iReadStatuses->scanRateResult = aResultsRef; + iReadStatuses->scanRateStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPITrigger ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->RCPITriggerPresent = ETrue; + iReadStatuses->RCPITriggerResult = aResultsRef; + iReadStatuses->RCPITriggerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinActiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->minActiveChannelTimePresent = ETrue; + iReadStatuses->minActiveChannelTimeResult = aResultsRef; + iReadStatuses->minActiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxActiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxActiveChannelTimePresent = ETrue; + iReadStatuses->maxActiveChannelTimeResult = aResultsRef; + iReadStatuses->maxActiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTxMSDULifeTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxTxMSDULifeTimePresent = ETrue; + iReadStatuses->maxTxMSDULifeTimeResult = aResultsRef; + iReadStatuses->maxTxMSDULifeTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanExpirationTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->scanExpirationTimerPresent = ETrue; + iReadStatuses->scanExpirationTimerResult = aResultsRef; + iReadStatuses->scanExpirationTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUnloadDriverTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->unloadDriverTimerPresent = ETrue; + iReadStatuses->unloadDriverTimerResult = aResultsRef; + iReadStatuses->unloadDriverTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRoamTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->roamTimerPresent = ETrue; + iReadStatuses->roamTimerResult = aResultsRef; + iReadStatuses->roamTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPIDifference ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->RCPIDifferencePresent = ETrue; + iReadStatuses->RCPIDifferenceResult = aResultsRef; + iReadStatuses->RCPIDifferenceStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanConnRegainTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->connRegainTimerPresent = ETrue; + iReadStatuses->connRegainTimerResult = aResultsRef; + iReadStatuses->connRegainTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTriesToFindNw ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxTriesToFindNwPresent = ETrue; + iReadStatuses->maxTriesToFindNwResult = aResultsRef; + iReadStatuses->maxTriesToFindNwStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanDelayBetweenFindNw ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->delayBetweenFindNwPresent = ETrue; + iReadStatuses->delayBetweenFindNwResult = aResultsRef; + iReadStatuses->delayBetweenFindNwStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanAllowRadioMeasurements ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->allowRadioMeasurementsPresent = ETrue; + iReadStatuses->allowRadioMeasurementsResult = aResultsRef; + iReadStatuses->allowRadioMeasurementsStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinPassiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->minPassiveChannelTimePresent = ETrue; + iReadStatuses->minPassiveChannelTimeResult = aResultsRef; + iReadStatuses->minPassiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxPassiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxPassiveChannelTimePresent = ETrue; + iReadStatuses->maxPassiveChannelTimeResult = aResultsRef; + iReadStatuses->maxPassiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxApFailureCount ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxApFailureCountPresent = ETrue; + iReadStatuses->maxApFailureCountResult = aResultsRef; + iReadStatuses->maxApFailureCountStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongBeaconFindCount ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->longBeaconFindCountPresent = ETrue; + iReadStatuses->longBeaconFindCountResult = aResultsRef; + iReadStatuses->longBeaconFindCountStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameInterval ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->qosNullFrameIntervalPresent = ETrue; + iReadStatuses->qosNullFrameIntervalResult = aResultsRef; + iReadStatuses->qosNullFrameIntervalStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameTimeout ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->qosNullFrameTimeoutPresent = ETrue; + iReadStatuses->qosNullFrameTimeoutResult = aResultsRef; + iReadStatuses->qosNullFrameTimeoutStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMTU ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->MTUPresent = ETrue; + iReadStatuses->MTUResult = aResultsRef; + iReadStatuses->MTUStatus = aStatusRef; + } + + // ***************************************************************** + // The given leaf was not found + else + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): No matchin leaf was found"); + iCallBack->SetStatusL(aStatusRef, ENotFound); + } + } + else + { + // Something went wrong + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): No matchin node was found"); + iCallBack->SetStatusL(aStatusRef, EInvalidObject); + } + + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): end"); + + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::ChildURIListL( const TDesC& aURI, +// const TDesC& aLUID, const CArrayFix& aPreviousURISegmentList, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const CArrayFix& /*aPreviousURISegmentList*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): begin"); + DBG_ARGS8(_S8("globalwlanadapter::ChildUriList - <%S>"), &aURI ); + + CBufBase* currentUriSegmentList = CBufFlat::NewL( KUriSegListLength ); + CleanupStack::PushL( currentUriSegmentList ); + TEntry currentEntry; + TInt uriSegs = NumOfUriSegs( aURI ); + + // Check whether WLAN node in question + if ( aURI.Match(_L8("WLAN" ))!= KErrNotFound && uriSegs == 1 ) + { + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): WLAN"); + currentUriSegmentList->InsertL( 0, KNSmlWLanNode ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): WLAN leafs returned"); + } + + // Some illegal node/leaf in question + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + } + + // delete the list + CleanupStack::PopAndDestroy( currentUriSegmentList ); + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): end"); + } + +//----------------------------------------------------------------------------- +// void CGlobalWLANAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddNodeObjectL - uri: <%S> to aParentLuid: <%S>"), + &aURI, &aParentLUID ); + + TInt uriSegs = NumOfUriSegs( aURI ); + + // The only node is WLAN, lets check if that is in question + if( aURI.Match( _L8("WLAN" ) ) != KErrNotFound && uriSegs==1 ) + { + // No actions needed, the table is created and filled in the + // Execution function. + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + + _DBG_FILE("CGlobalWLANAdapter::AddNodeObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::ExecuteCommandL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::ExecuteCommandL ( .. RWriteStream ..) +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusref ) + { + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): begin"); + + iCallBack->SetStatusL( aStatusref, CSmlDmAdapter::EError ); + + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::CopyCommandL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /* aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::CopyCommandL(): begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::CopyCommandL(): end"); + } +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::StartAtomicL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::StartAtomicL() + { + _DBG_FILE("CGlobalWLANAdapter::StartAtomicL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::StartAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::CommitAtomicL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::CommitAtomicL() + { + _DBG_FILE("CGlobalWLANAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::CommitAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::RollbackAtomicL +// returns EError +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::RollbackAtomicL() + { + _DBG_FILE("CGlobalWLANAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::RollbackAtomicL(): end"); + } + + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::StreamingSupport +// returns ETrue, streaming is supported +//------------------------------------------------------------------------------ + +TBool CGlobalWLANAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CGlobalWLANAdapter::StreamingSupport(): begin"); + _DBG_FILE("CGlobalWLANAdapter::StreamingSupport(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::StreamCommittedL +// not used in this adapter +//------------------------------------------------------------------------------ + +void CGlobalWLANAdapter::StreamCommittedL() + { + _DBG_FILE("CGlobalWLANAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::StreamCommittedL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::CompleteOutstandingCmdsL( ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::CompleteOutstandingCmdsL( ) + { + _DBG_FILE("CGlobalWLANAdapter::CompleteOutStandingCmdsL(): begin"); + + ExecuteBufferL( ETrue ); + + _DBG_FILE("CGlobalWLANAdapter::CompleteOutStandingCmdsL(): end"); + } + + +// ------------------------------------------------------------------------------------- +// CGlobalWLANAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CGlobalWLANAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) + + { + aNode.SetAccessTypesL(aAccTypes); + aNode.SetOccurenceL(aOccurrence); + aNode.SetScopeL(aScope); + aNode.SetDFFormatL(aFormat); + if(aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KNSmlMimeType); + } + aNode.SetDescriptionL(aDescription); + } + + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::ExecuteBufferL( TBool aFinal ) +// Executes buffered commands +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ExecuteBufferL( TBool /*aFinal*/ ) + { + + _DBG_FILE("CGlobalWLANAdapter::ExecuteBuffer(): begin"); + + // Store the given values into cenrep and commsdb and + // read the required parameters from cenrep and commsdb + TRAPD (err1, StoreCenRepParamsL()); + TRAPD (err2, StoreCommsDBParamsL()); + TRAPD (err3, ReadCenRepParamsL()); + TRAPD (err4, ReadCommsDBParamsL()); + + // Init the member variables after updates + InitMemberVariables(); + + // If some of the operations failed, then leave + User::LeaveIfError( err1 ); + User::LeaveIfError( err2 ); + User::LeaveIfError( err3 ); + User::LeaveIfError( err4 ); + + _DBG_FILE("CGlobalWLANAdapter::ExecuteBuffer(): End"); + } + + +// ------------------------------------------------------------------------------------------------ +// TBool CGlobalWLANAdapter::StoreCenRepParamsL( ) +// Stores the parameters to central repository +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::StoreCenRepParamsL() + { + + _DBG_FILE("CGlobalWLANAdapter::StoreCenRepParams(): begin"); + + CRepository* repository = NULL; + CRepository* conSettRep = NULL; + TInt err = KErrNone; + + + // Write KWlanInternetConnectivityTest + if ( iWriteSettings->internetConnectivityTestPresent ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest start " ); + // Open the cenrep for internet connectivity settings. This is the only global wlan parameter + // from this cenrep + conSettRep = CRepository::NewL( KCRUidInternetConnectivitySettings ); + + // There is no pointer to the repository, leave + if ( conSettRep == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + CleanupStack::PushL(conSettRep); + + err = conSettRep->Set( KIctsTestPermission, static_cast( iWriteSettings->internetConnectivityTest ) ); + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest set to cenRep " ); + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest" ); + iCallBack->SetStatusL(iWriteStatuses->internetConnectivityTestStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest failed " ); + iCallBack->SetStatusL(iWriteStatuses->internetConnectivityTestStatus, CSmlDmAdapter::EError); + } + CleanupStack::PopAndDestroy(conSettRep); + } + + + // The rest of the parameters are stored to Wlan device settings cenRep + repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ); + + // There is no pointer to the repository, leave + if ( repository == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + CleanupStack::PushL(repository); + + if ( iWriteSettings->MTUPresent ) + { + err = repository->Set( KWlanMTU, static_cast( iWriteSettings->MTU ) ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::StoreCenRepParams, MTU status - (%d)"), err ); + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() MTU" ); + iCallBack->SetStatusL(iWriteStatuses->MTUStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() MTU failed " ); + iCallBack->SetStatusL(iWriteStatuses->MTUStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanScanRate + if ( iWriteSettings->scanRatePresent ) + { + err = repository->Set( KWlanScanRate, static_cast( iWriteSettings->scanRate ) ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::StoreCenRepParams, scanrate status - (%d)"), err ); + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() WlanScanRate" ); + iCallBack->SetStatusL(iWriteStatuses->scanRateStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() WlanScanRate failed " ); + iCallBack->SetStatusL(iWriteStatuses->scanRateStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanRcpiTrigger + if ( iWriteSettings->RCPITriggerPresent ) + { + err = repository->Set( KWlanRcpiTrigger, static_cast( iWriteSettings->RCPITrigger ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiTrigger" ); + iCallBack->SetStatusL(iWriteStatuses->RCPITriggerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiTrigger failed" ); + iCallBack->SetStatusL(iWriteStatuses->RCPITriggerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMinActiveChannelTime + if ( iWriteSettings->minActiveChannelTimePresent ) + { + err = repository->Set( KWlanMinActiveChannelTime, static_cast( iWriteSettings->minActiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinActiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->minActiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinActiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->minActiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxActiveChannelTime + if ( iWriteSettings->maxActiveChannelTimePresent ) + { + err = repository->Set( KWlanMaxActiveChannelTime, static_cast( iWriteSettings->maxActiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxActiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->maxActiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxActiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxActiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxTxMSDULifeTime + if ( iWriteSettings->maxTxMSDULifeTimePresent ) + { + err = repository->Set( KWlanMaxTxMSDULifeTime, static_cast( iWriteSettings->maxTxMSDULifeTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanMaxTxMSDULifeTime" ); + iCallBack->SetStatusL(iWriteStatuses->maxTxMSDULifeTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanMaxTxMSDULifeTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxTxMSDULifeTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanScanExpirationTimer + if ( iWriteSettings->scanExpirationTimerPresent ) + { + err = repository->Set( KWlanScanExpirationTimer, static_cast( iWriteSettings->scanExpirationTimer ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanScanExpirationTimer" ); + iCallBack->SetStatusL(iWriteStatuses->scanExpirationTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanScanExpirationTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->scanExpirationTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanUnloadDriverTimer + if ( iWriteSettings->unloadDriverTimerPresent ) + { + err = repository->Set( KWlanUnloadDriverTimer, static_cast( iWriteSettings->unloadDriverTimer ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanUnloadDriverTimer" ); + iCallBack->SetStatusL(iWriteStatuses->unloadDriverTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanUnloadDriverTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->unloadDriverTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanRoamTimer + if ( iWriteSettings->roamTimerPresent ) + { + err = repository->Set( KWlanRoamTimer, static_cast( iWriteSettings->roamTimer ) ); + + if( err == KErrNone) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRoamTimer" ); + iCallBack->SetStatusL(iWriteStatuses->roamTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRoamTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->roamTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanRcpiDifference + if ( iWriteSettings->RCPIDifferencePresent ) + { + err = repository->Set( KWlanRcpiDifference, static_cast( iWriteSettings->RCPIDifference ) ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::StoreCenRepParams, rcpidifference status - (%d)"), err ); + if( err == KErrNone) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiDifference" ); + iCallBack->SetStatusL(iWriteStatuses->RCPIDifferenceStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiDifference failed" ); + iCallBack->SetStatusL(iWriteStatuses->RCPIDifferenceStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanConnRegainTimer + if ( iWriteSettings->connRegainTimerPresent ) + { + err = repository->Set( KWlanConnRegainTimer, static_cast( iWriteSettings->connRegainTimer ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanConnRegainTimer" ); + iCallBack->SetStatusL(iWriteStatuses->connRegainTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanConnRegainTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->connRegainTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxTriesToFindNw + if ( iWriteSettings->maxTriesToFindNwPresent ) + { + err = repository->Set( KWlanMaxTriesToFindNw, static_cast( iWriteSettings->maxTriesToFindNw ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxTriesToFindNw "); + iCallBack->SetStatusL(iWriteStatuses->maxTriesToFindNwStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxTriesToFindNw failed"); + iCallBack->SetStatusL(iWriteStatuses->maxTriesToFindNwStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanDelayBetweenFindNw + if ( iWriteSettings->delayBetweenFindNwPresent ) + { + err = repository->Set( KWlanDelayBetweenFindNw, static_cast( iWriteSettings->delayBetweenFindNw ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanDelayBetweenFindNw" ); + iCallBack->SetStatusL(iWriteStatuses->delayBetweenFindNwStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanDelayBetweenFindNw failed" ); + iCallBack->SetStatusL(iWriteStatuses->delayBetweenFindNwStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMinPassiveChannelTime + if ( iWriteSettings->minPassiveChannelTimePresent ) + { + err = repository->Set( KWlanMinPassiveChannelTime, static_cast( iWriteSettings->minPassiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinPassiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->minPassiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinPassiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->minPassiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxPassiveChannelTime + if ( iWriteSettings->maxPassiveChannelTimePresent ) + { + err = repository->Set( KWlanMaxPassiveChannelTime, static_cast( iWriteSettings->maxPassiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxPassiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->maxPassiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxPassiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxPassiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxApFailureCount + if ( iWriteSettings->maxApFailureCountPresent ) + { + err = repository->Set( KWlanMaxApFailureCount, static_cast( iWriteSettings->maxApFailureCount ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxApFailureCount" ); + iCallBack->SetStatusL(iWriteStatuses->maxApFailureCountStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxApFailureCount failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxApFailureCountStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanLongBeaconFindCount + if ( iWriteSettings->longBeaconFindCountPresent ) + { + err = repository->Set( KWlanLongBeaconFindCount, static_cast( iWriteSettings->longBeaconFindCount ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanLongBeaconFindCount" ); + iCallBack->SetStatusL(iWriteStatuses->longBeaconFindCountStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanLongBeaconFindCount failed" ); + iCallBack->SetStatusL(iWriteStatuses->longBeaconFindCountStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanQosNullFrameInterval + if ( iWriteSettings->qosNullFrameIntervalPresent ) + { + err = repository->Set( KWlanQosNullFrameInterval, static_cast( iWriteSettings->qosNullFrameInterval ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameInterval" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameIntervalStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameInterval failed" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameIntervalStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanQosNullFrameTimeout + if ( iWriteSettings->qosNullFrameTimeoutPresent ) + { + err = repository->Set( KWlanQosNullFrameTimeout, static_cast( iWriteSettings->qosNullFrameTimeout ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameTimeout" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameTimeoutStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameTimeout failed" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameTimeoutStatus, CSmlDmAdapter::EError); + } + } + + // Cleanup + CleanupStack::PopAndDestroy(repository); + _DBG_FILE("CGlobalWLANAdapter::StoreCenRepParams(): end"); + return; + } + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::StoreCommsDBParams( ) +// Stores the parameters to central repository +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::StoreCommsDBParamsL() + { + + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): begin"); + + CCommsDatabase* db = CCommsDatabase::NewL(); + CleanupStack::PushL(db); + + // User defined WLAN device settings table from Comms database + CCommsDbTableView* usrTable; + + // Open user settings. + usrTable = db->OpenViewMatchingUintLC( TPtrC(WLAN_DEVICE_SETTINGS), + TPtrC(WLAN_DEVICE_SETTINGS_TYPE), + KWlanUserSettings ); + + // if record did not exist, then it is created. + if ( usrTable->GotoFirstRecord() != KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): Record creation"); + TUint32 id; + User::LeaveIfError( usrTable->InsertRecord( id ) ); + + usrTable->WriteUintL( TPtrC(WLAN_DEVICE_SETTINGS_TYPE), KWlanUserSettings ); + //usrTable->WriteUintL( TPtrC(WLAN_TABLE_VERSION), KWlanDeviceSettingsTableVersion ); + User::LeaveIfError( usrTable->PutRecordChanges() ); // End and save changes. + } + + // Write CommsDat settings + User::LeaveIfError( usrTable->UpdateRecord() ); // Begin changes. + + // Check which parameters are present in the structure, store them into commsdb and + // update the status to OK/Error accordingly + if ( iWriteSettings->backgroundScanIntervalPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KBgScanInterval"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_BG_SCAN_INTERVAL), iWriteSettings->backgroundScanInterval )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->backgroundScanIntervalStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->backgroundScanIntervalStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->useDefaultSettingsPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KUseDefaultSettings"); + TRAPD( err, usrTable->WriteBoolL( TPtrC(WLAN_USE_DEFAULT_SETTINGS), iWriteSettings->useDefaultSettings )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->useDefaultSettingsStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->useDefaultSettingsStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->longRetryLimitPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanLongRetry"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_LONG_RETRY), iWriteSettings->longRetryLimit )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->longRetryLimitStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->longRetryLimitStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->shortRetryLimitPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanShortRetry"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_SHORT_RETRY), iWriteSettings->shortRetryLimit )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->shortRetryLimitStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->shortRetryLimitStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->RTSThresholdPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanRTSThreshold"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_RTS_THRESHOLD), iWriteSettings->RTSThreshold )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->RTSThresholdStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->RTSThresholdStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->TXPowerLevelPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanTxPowerLevel"); + TRAPD( err, usrTable->WriteUintL( TPtrC(NU_WLAN_TX_POWER_LEVEL), iWriteSettings->TXPowerLevel )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->TXPowerLevelStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->TXPowerLevelStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->allowRadioMeasurementsPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanAllowRadioMeasurements"); + TRAPD( err, usrTable->WriteBoolL( TPtrC(WLAN_ALLOW_RADIO_MEASUREMENTS), iWriteSettings->allowRadioMeasurements )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->allowRadioMeasurementsStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->allowRadioMeasurementsStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->powerSavingPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanPowerSaving"); + TRAPD( err, usrTable->WriteBoolL( TPtrC(WLAN_POWER_MODE), iWriteSettings->powerSaving )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->powerSavingStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->powerSavingStatus, CSmlDmAdapter::EError); + } + } + + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): end"); + User::LeaveIfError( usrTable->PutRecordChanges() ); // End and save changes. + CleanupStack::PopAndDestroy( usrTable ); + CleanupStack::PopAndDestroy( db ); + return; + + } + + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::ReadCenRepParams( ) +// Reads parameters from central repository +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ReadCenRepParamsL() + { + + _DBG_FILE("CGlobalWLANAdapter::ReadCenRepParams(): begin"); + + TInt err = KErrNone; + CRepository* repository = NULL; + TBuf8 value; + TBuf8 type; + TInt temp = 0; + + // InternetConnectivityTest parameter is in a different cenRep than the other parameters + // Write KWlanScanRate + if ( iReadSettings->internetConnectivityTestPresent ) + { + // This parameter is in the internet connectivity settings cenRep, open the repository + repository = CRepository::NewL( KCRUidInternetConnectivitySettings ); + CleanupStack::PushL(repository); + + value.Zero(); + type.Zero(); + + // if opening the cenrtral repository failed, then leave this function + if ( repository == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + err = repository->Get( KIctsTestPermission, temp ); + value.Num(temp); + type.Append( KNSmlWLanInternetConnectivityTest ); + UpdateStatusAndResultL( iReadStatuses->internetConnectivityTestResult, iReadStatuses->internetConnectivityTestStatus, + value, type, err ); + + CleanupStack::PopAndDestroy(repository); + } + + // The rest of the parameters are in WlanDeviceSettings cenRep + repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ); + CleanupStack::PushL(repository); + + // if opening the cenrtral repository failed, then leave this function + if ( repository == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + if ( iReadSettings->MTUPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMTU, temp ); + value.Num(temp); + type.Append( KNSmlWLanMTU ); + UpdateStatusAndResultL( iReadStatuses->MTUResult, iReadStatuses->MTUStatus, + value, type, err ); + } + + // Write KWlanScanRate + if ( iReadSettings->scanRatePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanScanRate, temp ); + value.Num(temp); + type.Append( KNSmlWLanScanRate ); + UpdateStatusAndResultL( iReadStatuses->scanRateResult, iReadStatuses->scanRateStatus, + value, type, err ); + } + + // Write KWlanRcpiTrigger + if ( iReadSettings->RCPITriggerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanRcpiTrigger, temp ); + value.Num(temp); + type.Append( KNSmlWLanRCPITrigger ); + UpdateStatusAndResultL( iReadStatuses->RCPITriggerResult, iReadStatuses->RCPITriggerStatus, + value, type, err ); + } + + // Write KWlanMinActiveChannelTime + if ( iReadSettings->minActiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMinActiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMinActiveChannelTime ); + UpdateStatusAndResultL( iReadStatuses->minActiveChannelTimeResult, iReadStatuses->minActiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxActiveChannelTime + if ( iReadSettings->maxActiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxActiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxActiveChannelTime ); + UpdateStatusAndResultL( iReadStatuses->maxActiveChannelTimeResult, iReadStatuses->maxActiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxTxMSDULifeTime + if ( iReadSettings->maxTxMSDULifeTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxTxMSDULifeTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxTxMSDULifeTime ); + UpdateStatusAndResultL( iReadStatuses->maxTxMSDULifeTimeResult, iReadStatuses->maxTxMSDULifeTimeStatus, + value, type, err ); + } + + // Write KWlanScanExpirationTimer + if ( iReadSettings->scanExpirationTimerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanScanExpirationTimer, temp ); + value.Num(temp); + type.Append( KNSmlWLanScanExpirationTimer ); + UpdateStatusAndResultL( iReadStatuses->scanExpirationTimerResult, iReadStatuses->scanExpirationTimerStatus, + value, type, err ); + } + + // Write KWlanUnloadDriverTimer + if ( iReadSettings->unloadDriverTimerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanUnloadDriverTimer, temp ); + value.Num(temp); + type.Append( KNSmlWLanUnloadDriverTimer ); + UpdateStatusAndResultL( iReadStatuses->unloadDriverTimerResult, iReadStatuses->unloadDriverTimerStatus, + value, type, err ); + } + + // Write KWlanRoamTimer + if ( iReadSettings->roamTimerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanRoamTimer, temp ); + value.Num(temp); + type.Append( KNSmlWLanRoamTimer ); + UpdateStatusAndResultL( iReadStatuses->roamTimerResult, iReadStatuses->roamTimerStatus, + value, type, err ); + } + + // Write KWlanRcpiDifference + if ( iReadSettings->RCPIDifferencePresent ) + { + value.Zero(); + type.Zero(); + type.Append( KNSmlWLanRCPIDifference ); + err = repository->Get( KWlanRcpiDifference, temp ); + value.Num(temp); + UpdateStatusAndResultL( iReadStatuses->RCPIDifferenceResult, iReadStatuses->RCPIDifferenceStatus, + value, type, err ); + } + + // Write KWlanConnRegainTimer + if ( iReadSettings->connRegainTimerPresent ) + { + value.Zero(); + type.Zero(); + type.Append( KNSmlWLanConnRegainTimer ); + err = repository->Get( KWlanConnRegainTimer, temp ); + value.Num(temp); + UpdateStatusAndResultL( iReadStatuses->connRegainTimerResult, iReadStatuses->connRegainTimerStatus, + value, type, err ); + } + + // Write KWlanMaxTriesToFindNw + if ( iReadSettings->maxTriesToFindNwPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxTriesToFindNw, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxTriesToFindNw ); + UpdateStatusAndResultL( iReadStatuses->maxTriesToFindNwResult, iReadStatuses->maxTriesToFindNwStatus, + value, type, err ); + } + + // Write KWlanDelayBetweenFindNw + if ( iReadSettings->delayBetweenFindNwPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanDelayBetweenFindNw, temp ); + value.Num(temp); + type.Append( KNSmlWLanDelayBetweenFindNw ); + UpdateStatusAndResultL( iReadStatuses->delayBetweenFindNwResult, iReadStatuses->delayBetweenFindNwStatus, + value, type, err ); + } + + // Write KWlanMinPassiveChannelTime + if ( iReadSettings->minPassiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMinPassiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanRCPITrigger ); + UpdateStatusAndResultL( iReadStatuses->minPassiveChannelTimeResult, iReadStatuses->minPassiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxPassiveChannelTime + if ( iReadSettings->maxPassiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxPassiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMinPassiveChannelTime ); + UpdateStatusAndResultL( iReadStatuses->maxPassiveChannelTimeResult, iReadStatuses->maxPassiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxApFailureCount + if ( iReadSettings->maxApFailureCountPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxApFailureCount, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxApFailureCount ); + UpdateStatusAndResultL( iReadStatuses->maxApFailureCountResult, iReadStatuses->maxApFailureCountStatus, + value, type, err ); + } + + // Write KWlanLongBeaconFindCount + if ( iReadSettings->longBeaconFindCountPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanLongBeaconFindCount, temp ); + value.Num(temp); + type.Append( KNSmlWLanLongBeaconFindCount ); + UpdateStatusAndResultL( iReadStatuses->longBeaconFindCountResult, iReadStatuses->longBeaconFindCountStatus, + value, type, err ); + } + + // Write KWlanQosNullFrameInterval + if ( iReadSettings->qosNullFrameIntervalPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanQosNullFrameInterval, temp ); + value.Num(temp); + type.Append( KNSmlWLanQosNullFrameInterval ); + UpdateStatusAndResultL( iReadStatuses->qosNullFrameIntervalResult, iReadStatuses->qosNullFrameIntervalStatus, + value, type, err ); + } + + // Write KWlanQosNullFrameTimeout + if ( iReadSettings->qosNullFrameTimeoutPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanQosNullFrameTimeout, temp ); + value.Num(temp); + type.Append( KNSmlWLanQosNullFrameTimeout ); + UpdateStatusAndResultL( iReadStatuses->qosNullFrameTimeoutResult, iReadStatuses->qosNullFrameTimeoutStatus, + value, type, err ); + } + + // Cleanup + CleanupStack::PopAndDestroy(repository); + _DBG_FILE("CGlobalWLANAdapter::ReadCenRepParams(): end"); + return; + + } + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::UpdateStatusAndResultL( ) +// Reads parameters from cenrep and updates result/status +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::UpdateStatusAndResultL( TInt aResult, TInt aStatus, TDesC8& aValue, TDesC8& aType, TInt aStoreErr ) + { + + _DBG_FILE("CGlobalWLANAdapter::UpdateStatusAndResultL(): begin"); + + CBufBase *lObject = CBufFlat::NewL(KInputMaxLength); + CleanupStack::PushL(lObject); + + // If reading went ok, then we can set the results and statuses + if ( aStoreErr == KErrNone ) + { + lObject->InsertL(0, aValue); + iCallBack->SetResultsL( aResult,*lObject,aType ); + iCallBack->SetStatusL( aStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL( aStatus, CSmlDmAdapter::EError ); + } + + _DBG_FILE("CGlobalWLANAdapter::UpdateStatusAndResultL(): end"); + CleanupStack::PopAndDestroy(lObject); + return; + } + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::ReadCommsDBParams( ) +// Reads parameters from commsDB +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ReadCommsDBParamsL() + { + _DBG_FILE("CGlobalWLANAdapter::ReadCommsDBParams() begin" ); + + CCommsDatabase* db = CCommsDatabase::NewL(); + CleanupStack::PushL(db); + + // User defined WLAN device settings table from Comms database + CCommsDbTableView* usrTable; + + // Open user settings. + usrTable = db->OpenViewMatchingUintLC( TPtrC(WLAN_DEVICE_SETTINGS), + TPtrC(WLAN_DEVICE_SETTINGS_TYPE), + KWlanUserSettings ); + + TUint32 intVal; + TBool boolVal = EFalse; + TBuf8 value; + TBuf8 type; + TInt err = KErrNone; + TInt readErr = KErrNone; + _LIT8(KTrue,"True"); + _LIT8(KFalse,"False"); + + // if record did not exist, then we don't do anything + if ( usrTable == NULL ) + readErr = KErrGeneral; + else + readErr = usrTable->GotoFirstRecord(); + + // Check whether parameter was requested to be fetched + if ( iReadSettings->backgroundScanIntervalPresent ) + { + // The reading is done if the commdb record was opened successfully, otherwise the err + // is updated so that the ReadAndSetStatus function can update thet status correctly + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_BG_SCAN_INTERVAL), intVal )); + } + else + { + err=readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanBackgroundScanInterval ); + UpdateStatusAndResultL( iReadStatuses->backgroundScanIntervalResult, iReadStatuses->backgroundScanIntervalStatus, + value, type, err ); + } + + if ( iReadSettings->useDefaultSettingsPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadBoolL( TPtrC(WLAN_USE_DEFAULT_SETTINGS), boolVal )); + } + else + { + err=readErr; + } + + value.Zero(); + type.Zero(); + if ( boolVal == 0 ) + value.Copy(KFalse); + else + value.Copy(KTrue); + + type.Append( KNSmlWLanUseDefaultSettings ); + _DBG_FILE("CGlobalWLANAdapter::ReadCommsDBParams() go set status" ); + UpdateStatusAndResultL( iReadStatuses->useDefaultSettingsResult, iReadStatuses->useDefaultSettingsStatus, + value, type, err ); + } + + if ( iReadSettings->longRetryLimitPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_LONG_RETRY), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + value.Num(intVal); + type.Zero(); + type.Append( KNSmlWLanLongRetryLimit ); + UpdateStatusAndResultL( iReadStatuses->longRetryLimitResult, iReadStatuses->longRetryLimitStatus, + value, type, err ); + } + + if ( iReadSettings->shortRetryLimitPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_SHORT_RETRY), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanShortRetryLimit ); + UpdateStatusAndResultL( iReadStatuses->shortRetryLimitResult, iReadStatuses->shortRetryLimitStatus, + value, type, err ); + } + + if ( iReadSettings->RTSThresholdPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_RTS_THRESHOLD), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanRTSThreshold ); + UpdateStatusAndResultL( iReadStatuses->RTSThresholdResult, iReadStatuses->RTSThresholdStatus, + value, type, err ); + } + + if ( iReadSettings->TXPowerLevelPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(NU_WLAN_TX_POWER_LEVEL), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanTXPowerLevel ); + UpdateStatusAndResultL( iReadStatuses->TXPowerLevelResult, iReadStatuses->TXPowerLevelStatus, + value, type, err ); + } + + if ( iReadSettings->allowRadioMeasurementsPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadBoolL( TPtrC(WLAN_ALLOW_RADIO_MEASUREMENTS), boolVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + if ( boolVal ) + value.Copy(_L8("True")); + else + value.Copy(_L8("False")); + + type.Append( KNSmlWLanAllowRadioMeasurements ); + UpdateStatusAndResultL( iReadStatuses->allowRadioMeasurementsResult, iReadStatuses->allowRadioMeasurementsStatus, + value, type, err ); + } + + if ( iReadSettings->powerSavingPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadBoolL( TPtrC(WLAN_POWER_MODE), boolVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + if ( boolVal ) + value.Copy(_L8("True")); + else + value.Copy(_L8("False")); + + type.Append( KNSmlWLanPowerSaving ); + UpdateStatusAndResultL( iReadStatuses->powerSavingResult, iReadStatuses->powerSavingStatus, + value, type, err ); + } + + CleanupStack::PopAndDestroy( usrTable ); + CleanupStack::PopAndDestroy( db ); + _DBG_FILE("CGlobalWLANAdapter::ReadCommsDBParams() end" ); + return; + } + + + +// ------------------------------------------------------------------------------------------------ +// TInt CGlobalWLANAdapter::NumOfUriSegs( const TDesC8& aUri ) +// Return count of URI segments of aUri +// ------------------------------------------------------------------------------------------------ +TInt CGlobalWLANAdapter::NumOfUriSegs( const TDesC8& aUri ) + { + _DBG_FILE("CGlobalWLANAdapter::NumOfUriSegs(): begin"); + + TInt count = 1; + for( TInt i=0; i= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i == 0 ) + { + _DBG_FILE("CGlobalWLANAdapter::GetLastUriSeg(): end"); + return aURI; + } + else + { + _DBG_FILE("CGlobalWLANAdapter::GetLastUriSeg(): end"); + return aURI.Mid( i + 1 ); + } + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::DesToInt( const TDesC8& aNumber ) +// Returns aLuid as integer value +// ------------------------------------------------------------------------------------------------ +TInt CGlobalWLANAdapter::DesToInt( const TDesC8& aNumber ) + { + _DBG_FILE("CGlobalWLANAdapter::DesToInt(): begin"); + + TInt err = KErrNone; + TLex8 lex(aNumber); + TInt value = 0; + err = lex.Val( value ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::DesToInt() - Des: <%S> Int: <%D>"), &aNumber, value ); + _DBG_FILE("CGlobalWLANAdapter::DesToInt(): end"); + + // the input might have been illegal. Return error code if conversion failed. + if ( err == KErrNone ) + return value; + else + return err; + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::InitMemberVariables +// Inits the member variable structures +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::InitMemberVariables() + { + _DBG_FILE("CGlobalWLANAdapter::InitMemberVariables(): begin"); + + iWriteSettings->RCPITriggerPresent=EFalse; + iWriteSettings->internetConnectivityTestPresent=EFalse; + iWriteSettings->useDefaultSettingsPresent=EFalse; + iWriteSettings->longRetryLimitPresent=EFalse; + iWriteSettings->shortRetryLimitPresent=EFalse; + iWriteSettings->RTSThresholdPresent=EFalse; + iWriteSettings->TXPowerLevelPresent=EFalse; + iWriteSettings->powerSavingPresent=EFalse; + iWriteSettings->backgroundScanIntervalPresent=EFalse; + iWriteSettings->scanRatePresent=EFalse; + iWriteSettings->RCPITriggerPresent=EFalse; + iWriteSettings->minActiveChannelTimePresent=EFalse; + iWriteSettings->maxActiveChannelTimePresent=EFalse; + iWriteSettings->maxTxMSDULifeTimePresent=EFalse; + iWriteSettings->scanExpirationTimerPresent=EFalse; + iWriteSettings->unloadDriverTimerPresent=EFalse; + iWriteSettings->roamTimerPresent=EFalse; + iWriteSettings->RCPIDifferencePresent=EFalse; + iWriteSettings->connRegainTimerPresent=EFalse; + iWriteSettings->maxTriesToFindNwPresent=EFalse; + iWriteSettings->delayBetweenFindNwPresent=EFalse; + iWriteSettings->allowRadioMeasurementsPresent=EFalse; + iWriteSettings->minPassiveChannelTimePresent=EFalse; + iWriteSettings->maxPassiveChannelTimePresent=EFalse; + iWriteSettings->maxApFailureCountPresent=EFalse; + iWriteSettings->longBeaconFindCountPresent=EFalse; + iWriteSettings->qosNullFrameIntervalPresent=EFalse; + iWriteSettings->qosNullFrameTimeoutPresent=EFalse; + iWriteSettings->MTUPresent=EFalse; + + iReadSettings->RCPITriggerPresent=EFalse; + iReadSettings->internetConnectivityTestPresent=EFalse; + iReadSettings->useDefaultSettingsPresent=EFalse; + iReadSettings->longRetryLimitPresent=EFalse; + iReadSettings->shortRetryLimitPresent=EFalse; + iReadSettings->RTSThresholdPresent=EFalse; + iReadSettings->TXPowerLevelPresent=EFalse; + iReadSettings->powerSavingPresent=EFalse; + iReadSettings->backgroundScanIntervalPresent=EFalse; + iReadSettings->scanRatePresent=EFalse; + iReadSettings->RCPITriggerPresent=EFalse; + iReadSettings->minActiveChannelTimePresent=EFalse; + iReadSettings->maxActiveChannelTimePresent=EFalse; + iReadSettings->maxTxMSDULifeTimePresent=EFalse; + iReadSettings->scanExpirationTimerPresent=EFalse; + iReadSettings->unloadDriverTimerPresent=EFalse; + iReadSettings->roamTimerPresent=EFalse; + iReadSettings->RCPIDifferencePresent=EFalse; + iReadSettings->connRegainTimerPresent=EFalse; + iReadSettings->maxTriesToFindNwPresent=EFalse; + iReadSettings->delayBetweenFindNwPresent=EFalse; + iReadSettings->allowRadioMeasurementsPresent=EFalse; + iReadSettings->minPassiveChannelTimePresent=EFalse; + iReadSettings->maxPassiveChannelTimePresent=EFalse; + iReadSettings->maxApFailureCountPresent=EFalse; + iReadSettings->longBeaconFindCountPresent=EFalse; + iReadSettings->qosNullFrameIntervalPresent=EFalse; + iReadSettings->qosNullFrameTimeoutPresent=EFalse; + iReadSettings->MTUPresent=EFalse; + + _DBG_FILE("CGlobalWLANAdapter::InitMemberVariables(): begin"); + } + +// end of file diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/globalwlansettings/src/globalwlanadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/globalwlansettings/src/globalwlanadapter.rss Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: glowal wlan-settings adapter resources +* +*/ + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x1315DBD; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x1315DBE; // Global WLAN Adapter + version_no = 1; + display_name = "GlobalWLanAdapter"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/group/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 "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 info file for internet settings adapter +* +*/ + + + +#include + +PRJ_PLATFORMS + +PRJ_EXPORTS + +PRJ_MMPFILES +./nsmlinternetadapter.mmp + + + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/group/nsmlinternetadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/group/nsmlinternetadapter.mmp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: InternetAdapter +* +*/ + + + +#include "defaultcaps.hrh" +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET nsmlinternetadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6DEA +VENDORID VID_DEFAULT + + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc + +SOURCE NSmlInternetAdapter.cpp + +SOURCE NSmlWLanAdapter.cpp +SOURCE NSmlWlanSettings.cpp + +START RESOURCE NSmlInternetAdapter.rss +END + +LANG sc + +LIBRARY charconv.lib commdb.lib efsrv.lib ecom.lib euser.lib nsmldmclientserverutils.lib +LIBRARY nsmldebug.lib sysutil.lib +LIBRARY inetprotutil.lib +LIBRARY commsdat.lib +LIBRARY cmmanager.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY centralrepository.lib FeatMgr.lib +LIBRARY policyengine.lib +LIBRARY nsmldmtreedbclient.lib + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlInternetAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlInternetAdapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,575 @@ +/* +* 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 "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: Internet-settings +* +*/ + + + + +#ifndef __NSMLINTERNETADAPTER_H__ +#define __NSMLINTERNETADAPTER_H__ + +// SyncML device management LoginScript +//#define __SYNCML_DM_LSCRIPT 1 +//#define __SYNCML_DM_WLAN 1 +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include +#include +#include +#include "smldmadapter.h" +#include "nsmlconstants.h" + +#include "NSmlWLanAdapter.h" +#include "NSmlWlanSettings.h" + +const TInt KNSmlInternetAdapterFatMinSize=512; +const TInt KNSmlIncompleteAP=-1; +// Buffering Stuff +const TInt KNSmlAPGranularity = 4; +const TUint8 KNSmlDMUriSeparator = 0x2f; + +const TUint8 KNSmlDMDot = 0x2e; +const TUint8 KNSmlDMAsciiIntStart = 0x30; +const TUint8 KNSmlDMAsciiIntEnd = 0x39; +// Other constants +const TInt KNSmlApDnsLuidUpperBase = 300000; +const TInt KNSmlAp3gpppsLowerBase = 50000; +const TInt KNSmlApProxyLowerBase = 100000; +const TInt KNSmlApProxyUpperBase = 200000; +const TInt KNSmlApWapLowerBase = 9200; +const TInt KNSmlApWapUpperBase = 9203; + +//DDF version number +_LIT8( KNSmlInternetAdapterDDFversion, "1.1"); + +//DDF accepted AP-fieldnames +_LIT8( KNSmlDdfAP, "AP" ); + +_LIT8( KNSmlDdfPx, "Px" ); +_LIT8( KNSmlDdfPxName, "Name" ); +_LIT8( KNSmlDdfPxId, "PxID" ); +_LIT8( KNSmlDdfPxPW, "PxPW" ); +_LIT8( KNSmlDdfPPGAuthTy, "PPGAuthTy" ); +_LIT8( KNSmlDdfDomain, "Domain" ); +_LIT8( KNSmlDdfDomainL, "DomainL" ); +_LIT8( KNSmlDdfPxAddr, "PxAddr" ); +_LIT8( KNSmlDdfToNAPID, "ToNAPID" ); +_LIT8( KNSmlDdfToNAPIDL, "ToNAPIDL" ); +_LIT8( KNSmlDdfStartpg, "Startpg" ); +_LIT8( KNSmlDdfBasAuthId, "BasAuthId" ); +_LIT8( KNSmlDdfBasAuthPW, "BasAuthPW" ); +_LIT8( KNSmlDdfPort, "Port" ); +_LIT8( KNSmlDdfPortNbr, "PortNbr" ); +_LIT8( KNSmlDdfPxAuthTy, "PxAuthTy" ); +_LIT8( KNSmlDdfService, "Service" ); +_LIT8( KNSmlDdfServiceL, "ServiceL" ); +_LIT8( KNSmlDdfUsePTxtLog, "UsePTxtLog" ); + +_LIT8( KNSmlDdfGPRSPDP, "GPRSPDP" ); +_LIT8( KNSmlDdfDefGW, "DefGW" ); +_LIT8( KNSmlDdfNetworkMask, "NetworkMask" ); + +_LIT8( KNSmlDdfPPPComp, "PPPComp" ); + +_LIT8( KNSmlDdfNAPDef, "NAPDef" ); +_LIT8( KNSmlDdfNAPName, "Name" ); +_LIT8( KNSmlDdfNAPLinger, "Linger" ); +_LIT8( KNSmlDdfNAPID, "NAPID" ); +_LIT8( KNSmlDdfBearer, "Bearer" ); +_LIT8( KNSmlDdfBearerL, "BearerL" ); +_LIT8( KNSmlDdfDirection, "Direction" ); +_LIT8( KNSmlDdfInternet, "Internet" ); +_LIT8( KNSmlDdfNAPAddr, "NAPAddr" ); +_LIT8( KNSmlDdfNAPAddrTy, "NAPAddrTy" ); +_LIT8( KNSmlDdfDNSAddr, "DNSAddr" ); +_LIT8( KNSmlDdfDNSAddrL, "DNSAddrL" ); +_LIT8( KNSmlDdfDNSAddrTy, "DNSAddrTy" ); +_LIT8( KNSmlDdfDNSPriority, "DNSPriority" ); +_LIT8( KNSmlDdfNAPAuthInf, "NAPAuthInf" ); +_LIT8( KNSmlDdfAuthName, "AuthName" ); +_LIT8( KNSmlDdfAuthSecr, "AuthSecr" ); +_LIT8( KNSmlDdfPxAuthInf, "PxAuthInf" ); +_LIT8( KNSmlDdfPxAuthId, "PxAuthID" ); +_LIT8( KNSmlDdfPxAuthPW, "PxAuthPW" ); + +_LIT8( KNSmlDdfIPAddrFromServer,"IPAddrFromServer" ); +_LIT8( KNSmlDdfIPAddr, "IPAddr" ); +_LIT8( KNSmlDdfDNSAddrFromServer,"IPDNSAddrFromServer" ); +_LIT8( KNSmlDdfIPv6DNSAddrFromServer,"IPv6DNSAddrFromServer" ); +_LIT8( KNSmlDdfIfNetworks, "IfNetworks" ); +_LIT8( KNSmlDdfIAPService, "IAPService" ); +_LIT8( KNSmlDdfLANService, "LANService" ); + +_LIT8( KNSmlDdfIAPSeamlessness, "Seamlessness" ); +_LIT8( KNSmlDdfIAPMetaData, "MetaData" ); + +_LIT8( KNSmlDdfNoPxFor, "NoPxFor" ); +_LIT8( KNSmlDdfNoPxForL, "NoPxForL" ); + +_LIT8( KNSmlDdfNetworks, "Networks" ); +_LIT8( KNSmlDdfNetworkName, "Name" ); +_LIT8( KNSmlDdfNetworkID, "ID" ); + +//DDF AP-field descriptions +_LIT8( KNSmlDdfAPDesc, "AP (Access Point) node" ); + +_LIT8( KNSmlDdfPxDesc, "Px (Proxy) node" ); +_LIT8( KNSmlDdfPxNameDesc, "Px name description" ); +_LIT8( KNSmlDdfNameDesc, "Displayable name for the Proxy" ); +_LIT8( KNSmlDdfPxIdDesc, "Define one Proxy entity" ); +_LIT8( KNSmlDdfPxPWDesc, "Password for one Proxy entity" ); +_LIT8( KNSmlDdfPPGAuthTyDesc, "Link PxID and PxPW to an authentication method" ); +_LIT8( KNSmlDdfPxAddrDesc, "Proxy-Address" ); +_LIT8( KNSmlDdfToNAPIDDesc, "Parent to all Network Access Point link objects" ); +_LIT8( KNSmlDdfToNAPIDLDesc, "NAPID end" ); +_LIT8( KNSmlDdfStartpgDesc, "The WAP homepage or start page" ); +_LIT8( KNSmlDdfBasAuthIdDesc, "Basic authentication identifier" ); +_LIT8( KNSmlDdfBasAuthPWDesc, "Basic authentication password" ); +_LIT8( KNSmlDdfPortDesc, "Port node" ); +_LIT8( KNSmlDdfPortNbrDesc, "Value of the port number" ); +_LIT8( KNSmlDdfServiceDesc, "Service node" ); +_LIT8( KNSmlDdfServiceLDesc, "ServiceL" ); +_LIT8( KNSmlDdfUsePTxtLogDesc, "Plain Text Login is used or not" ); + +_LIT8( KNSmlDdfGPRSPDPDesc, "GPRS PDP-type" ); +_LIT8( KNSmlDdfDefGWDesc, "Default Gateway" ); +_LIT8( KNSmlDdfNetworkMaskDesc, "Network/Subnet mask" ); + +_LIT8( KNSmlDdfPPPCompDesc, "PPP Compression" ); + +_LIT8( KNSmlDdfNAPDefDesc, "Network Access Point Definition objects parent" ); +_LIT8( KNSmlDdfNAPNameDesc, "Displayable name for the NAP" ); +_LIT8( KNSmlDdfNAPIDDesc, "Used by TO-NAPID link of the Proxy" ); +_LIT8( KNSmlDdfNAPLingerDesc, "Linger value" ); +_LIT8( KNSmlDdfBearerDesc, "Bearer node" ); +_LIT8( KNSmlDdfBearerLDesc, "Bearer valid" ); +_LIT8( KNSmlDdfDirectionDesc, "Direction for network type" ); +_LIT8( KNSmlDdfInternetDesc, "IP-routable network segment" ); +_LIT8( KNSmlDdfNAPAddrDesc, "NAP-Address" ); +_LIT8( KNSmlDdfNAPAddrTyDesc, "NAP-Address-Type" ); +_LIT8( KNSmlDdfDNSAddrDesc, "DNSAddr node" ); +_LIT8( KNSmlDdfDNSAddrLDesc, "Address of a DNS server" ); +_LIT8( KNSmlDdfDNSAddrTyDesc, "Type of DNS address" ); +_LIT8( KNSmlDdfDNSPriorityDesc, "Rank of DNS server" ); +_LIT8( KNSmlDdfNAPAuthInfDesc, "Authentication Info" ); +_LIT8( KNSmlDdfAuthNameDesc, "Loginname" ); +_LIT8( KNSmlDdfAuthSecrDesc, "Loginpassword" ); +_LIT8( KNSmlDdfPxAuthInfDesc, "Proxy Authentication Info" ); +_LIT8( KNSmlDdfPxAuthIdDesc, "Proxy Loginname" ); +_LIT8( KNSmlDdfPxAuthPWDesc, "Proxy Loginpassword" ); + +_LIT8( KNSmlDdfIPAddrFromServerDesc,"Get IP addresses from server?" ); +_LIT8( KNSmlDdfIPAddrDesc, "IP-address" ); +_LIT8( KNSmlDdfDNSAddrFromServerDesc,"Get DNS addresses from server?" ); +_LIT8( KNSmlDdfIPv6DNSAddrFromServerDesc,"Get IPv6 addresses from server?" ); +_LIT8( KNSmlDdfIfNetworksDesc, "Comma separated list of network protocols, e.g. PPP" ); +_LIT8( KNSmlDdfIAPServiceDesc, "IAP service" ); + +_LIT8( KNSmlDdfIAPSeamlessnessDesc, "IAP seamlessness value" ); +_LIT8( KNSmlDdfIAPMetaDataDesc, "IAP meta data value" ); + +_LIT8( KNSmlDdfDomainDesc, "Domain desc" ); +_LIT8( KNSmlDdfDomainLDesc, "Domain, for which the Proxy is responsible" ); + +_LIT8( KNSmlDdfNoPxForDesc, "No proxy for listed AP:s" ); +_LIT8( KNSmlDdfNoPxForLDesc, "No proxy for this AP" ); + +_LIT8( KNSmlDdfNetworksDesc, "Networks" ); +_LIT8( KNSmlDdfNetworkNameDesc, "Network Name" ); +_LIT8( KNSmlDdfNetworkIDDesc, "Network ID" ); + +//Other +_LIT8( KNSmlDNS1, "/DNS1" ); +_LIT8( KNSmlDNS2, "/DNS2" ); +_LIT8( KNSmlDNS3, "/DNS3" ); +_LIT8( KNSmlDNS4, "/DNS4" ); + +_LIT8(KNSmlAPnode, "NAPDef/Px"); + + +_LIT8(KNSmlNAPDefGPRSnode, "Name/NAPID/Startpg/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/DefGW/NetworkMask/PPPComp/UsePTxtLog/GPRSPDP/Networks/IAPService/Seamlessness/MetaData/Linger"); + +//_LIT8(KNSmlNAPDefCSDnode, "Name/NAPID/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/CallTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/LnkSpeed/DefGW/NetworkMask/PPPComp/UseCB/CBTy/CBNbr/UsePTxtLog/ModemInit/Networks/IAPService"); + +//_LIT8(KNSmlNAPDefGPRSnode, "Name/NAPID/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/CallTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/LnkSpeed/DefGW/NetworkMask/PPPComp/UsePTxtLog/GPRSPDP/Networks/IAPService"); + +_LIT8(KNSmlPxnode, "Name/PxID/PxAddr/Port/ToNAPID/Startpg/Domain/PxAuthInf/NoPxFor"); + +#ifdef __SYNCML_DM_LSCRIPT +_LIT8(KNSmlLoginscriptnode, "/LoginTW/LoginScriptData"); +#endif + +_LIT8(KNSmlDNSAddrNode, "DNSAddrL/DNSAddrTy/DNSPriority" ); + +_LIT8(KNSmlWLannode, "/WLAN/SSID/UsedSSID/SSIDHidden/UseWPAPSK/NetworkMode/SecurityMode/WEPAuthMode/WPAPreSharedKey/WLANEAPList/WEPKeyIndex/WEPKey/Data/Length/WEPKeyID/Username/Password/EAPType/Realm/UsePseudonym/Encapsulation/VerifyCertRealm/RequireClientAuthentication/SessionValidityTime/CipherSuite/AllowPEAPv0/AllowPEAPv1/AllowPEAPv2/IssuerName/SubjectName/CertType/SerialNumber/SubjectKeyId/Fingerprint"); + +//Default data values +_LIT( KNSmlDefName, "APAdapterIns" ); +_LIT( KNSmlDefAP, "AP" ); +_LIT8( KNSmlFirstDNSPri, "1" ); +_LIT8( KNSmlSecondDNSPri, "2" ); +_LIT8( KNSmlDNSIp, "IP" ); +_LIT8( KNSmlDNSIp6, "IP6" ); +_LIT8( KNSmlEmptyIpv4Address8, "0.0.0.0"); +_LIT( KNSmlEmptyIpv4Address, "0.0.0.0"); +_LIT8( KNSmlMimeTypeTextPlain, "text/plain" ); + +_LIT8( KNSmlDmApValOutgoing, "Outgoing" ); +_LIT8( KNSmlDmApValIncoming, "Incoming" ); +_LIT8( KNSmlDmApVal3Gppps, "3GPPPS" ); +_LIT8( KNSmlDmApValGsmCsd, "GSM-CSD" ); +_LIT8( KNSmlDmApValGsmGprs, "GSM-GPRS" ); +_LIT8( KNSmlDmApValGsmHscsd, "GSM-HSCSD" ); +_LIT8( KNSmlDmApValVpn, "VPN" ); +_LIT8( KNSmlDmApValWlan, "WLAN" ); +_LIT8( KNSmlDmApValFSlash, "/" ); +_LIT8( KNSmlDmApValAnalog, "ANALOG-MODEM" ); +_LIT8( KNSmlDmApValV110, "V.110" ); +_LIT8( KNSmlDmApValV120, "V.120" ); + +_LIT8( KNSmlDmApValAuto, "Auto" ); +_LIT8( KNSmlDmApVal2400, "2400" ); +_LIT8( KNSmlDmApVal4800, "4800" ); +_LIT8( KNSmlDmApVal9600, "9600" ); +_LIT8( KNSmlDmApVal14400, "14400" ); +_LIT8( KNSmlDmApVal19200, "19200" ); +_LIT8( KNSmlDmApVal28800, "28800" ); +_LIT8( KNSmlDmApVal32000, "32000" ); +_LIT8( KNSmlDmApVal33600, "33600" ); +_LIT8( KNSmlDmApVal38400, "38400" ); +_LIT8( KNSmlDmApVal43200, "43200" ); +_LIT8( KNSmlDmApVal48000, "48000" ); +_LIT8( KNSmlDmApVal56000, "56000" ); +_LIT8( KNSmlDmApVal57600, "57600" ); +_LIT8( KNSmlDmApVal64000, "64000" ); +_LIT8( KNSmlDmApValExtended, "Extended" ); +_LIT8( KNSmlDmApValIpv4, "IPv4" ); +_LIT8( KNSmlDmApValIpv6, "IPv6" ); +_LIT8( KNSmlDmApValTrue, "True" ); +_LIT8( KNSmlDmApValFalse, "False" ); + + +//class forwards +class CNSmlWLanAdapter; + +struct TNSmlAPAddElement + { + HBufC8 *iUri; + HBufC8 *iData; + TInt iStatusRef; + HBufC8* iLuid; + TBool iLeaf; + TBool iDone; + }; + +enum TNSmlAPLeafType + { + EDMUpdate, + EDMAdd, + EDMDelete, + EDMUnset + }; + +struct TNSmlAPBufferElement + { + CArrayFixFlat *iNodeBuf; + CArrayFixFlat *iWlanNodeBuf; + HBufC8* iMappingName; + HBufC8* iName; + TBool iExecuted; + TInt iLuid; + TBool iBearer; + TBool iDirection; + TBool iNameReceived; + TBool iDnsUpdateBuf; + }; +// +// ------------------------------------------------------------------------------------------------ +// CNSmlInternetAdapter +// ------------------------------------------------------------------------------------------------ +class CNSmlInternetAdapter : public CSmlDmAdapter + { +public: + +enum TNSmlAPFieldType + { + EStr, + EInt, + EBin, + EBool, + ESpec, + EWap, + EWrong + }; + static CNSmlInternetAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlInternetAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + virtual ~CNSmlInternetAdapter(); + + // Adapter interface + void DDFVersionL( CBufBase& aDDFVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + +private: + void ConstructL(); + CNSmlInternetAdapter( TAny* aEcomArguments ); + TDesC8& SetIntObjectLC( const TInt& aObject ); + TInt SetField( const TDesC8& aSource ); + TInt GetIntObject8( const TDesC8& aObject ); + TInt IntLUID( const TDesC8& aLUID ); + + void AddNodeBufferL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef, + const TBool aDontAppend, + const TBool aWlan = EFalse ); + + void AddLeafBufferL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef, + const TBool aWlan = EFalse ); + + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + CBufBase& aObject); + TPtrC8 LastURISeg(const TDesC8& aURI); + TPtrC8 FirstURISeg(const TDesC8& aURI); + TPtrC8 GetDynamicAPNodeUri( const TDesC8& aURI ); + void ExecuteBufferL(const TDesC8& aURI, const TBool aCompleting = EFalse); + TPtrC8 GetAddURISeg(const TDesC8& aURI,const TDesC8& aName); + + CNSmlInternetAdapter::TNSmlAPFieldType GetAPFieldType( const TDesC8& aURI ) const; + TBool GetAPField( TPtrC& aTableName, TPtrC& aColumn ) const; + TBool NotValidStrLenght( const TDesC& aSource ); + + TDesC8& ConvertTo8LC( const TDesC& aSource ); + TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + TInt InitializeGPRSL( CCommsDbTableView* aTable ); + TInt InitializeProxyL( CCommsDbTableView* aTable ); + + TInt InitializeWAPIAPL( CCommsDbTableView* aTable, const TDesC8& aName ); + TInt InitializeWAPL( CCommsDbTableView* aTable ); + TInt InitializeLANServiceL( CCommsDbTableView* aTable ); + TInt InitializeVPNServiceL( CCommsDbTableView* aTable ); + TBool IsValidNameL(const TDesC8& aName); + TBool IsValidIPv4AddressL(const TDesC8& aNapAddr); + void NextAPNameL(const TDesC8& aName); + + TUint32 GetIAPSeamlessnessL(TUint32 aId); + TUint32 GetIAPMetaDataL(TUint32 aId); + void SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef); + void SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef); + + TBool CheckEnforcementL(); + TBool CheckWLANEnforcementL(); + TInt UnprotectWLANAPItemL(TUint32 aId); + TInt DoProtectWAPTablesL(TBool aProtect); + void DoLockIAPTablesL(TBool aLock); + + TBool IsIAPRecordLockedL(TUint32 aRecord); + TInt DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect); + TBool IsProxyRecordLockedL(TUint32 aRecord); + TInt DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect); + TBool IsServiceRecordLockedL(TUint32 aRecord); + TInt DoProtectServiceRecordL(TUint32 aRecord,TBool aProtect); + TBool IsWAPAccessPointRecordLockedL(TUint32 aRecord); + TInt DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect); + + TBool IsWLANfield( const TDesC8& aURI ); + TBool IsWlanL( const TDesC8& aURI ); + TBool GetLanBearerL( TUint32& aId ); + + void SaveIAPDataL(const TDesC8& aURI); + TBool GetModemBearerL(TUint32& aId); + TBool IsInsertAllowedL(); + TUint32 GetMaxIdL(); + TBool GetProxyIdL(const TDesC8& aURI); + + TBool APExistsL(TUint32 aId); + TBool NAPDefExistsL( TUint32 aId ); + TBool PxExistsL(TUint32 aId); + TBool WapAPExistsL(TUint32 aId); + TBool NetworkExistsL(TUint32 aId); + TBool NetworkNameExistsL(TUint32& aId, const TDesC8& aObject); + TBool AddNetworkL(TUint32& aId, const TDesC8& aObject); + + TBool DeleteAPL(TUint32 aId); + TBool DeleteNAPDefL(TUint32 aId); + TBool DeleteProxyL(TUint32 aId); + TBool DeleteWapAPL(TUint32 aId); + + TUint32 GetAPIdFromURIL(const TDesC8& aURI); + void IsWapPort( const TDesC8& aObject ); + void FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + TInt UpdateIAPnameL( TUint32 aId, const TDesC8& aObject ); + TUint32 GetLocationL(); + + TBool InitializeDNSParamsFromBuffL( const TPtrC8 aParentUri, TInt& aDnsPri ); + TInt DnsToLuid( const UriUtils::TUriHostType aType, + const TInt aPriority ) const; + TInt LuidToDns( UriUtils::TUriHostType& aType, TInt& aPriority, + const TInt aLuid ) const; + TPtrC8 RemoveLastSeg(const TDesC8& aURI) const; + + void ClearBuffer( CArrayFixFlat* aBuffer ); + void LingerValueL( const TDesC8& aObject ); + void AddLingerL( const TInt aIapId, const TInt aLingerInterval); + void UpdateLingerL( const TInt aIapId, const TInt aLingerInterval ); + void GetLingerL( const TInt aIapId, TInt& aLingerInterval ); + void DeleteLingerL( const TInt aIapId ); + TBool Notalpha(const TDesC& aValue); + TUint32 ConstructTreeL(const TDesC8& aURI); + TBool IsAPUriFormatMatchPredefined(const TDesC8 & aURI); + + + +private: + MSmlDmCallback* iCallBack; + + CNSmlWLanAdapter* iWlanAdapter; + + TInt iLUID; + TInt iParentLUID; + TInt iObject; + TBool iWapPort; + TInt iDirection; + TBool iStaleMapUpdate; + HBufC8* iField; + TNSmlAPLeafType iLeafType; + + TBuf8 iWAPAccessPoint; + TUint32 iWapId; + TBuf iWapBearer; + TBuf8 iWapName; + TBuf8 iWapUserName; + TBuf8 iWapPassword; + + CArrayFixFlat *iBuffer; + TBool i3GPPPS; + + private: // data + CCommsDatabase* iDatabase; + + TBool iIAPExists; + + TInt iDnsIpv4Pri; // 1 or 2 + TInt iDnsIpv6Pri; + TInt iExecutionIndex; + TBool iExecutingBuffer; + TBool iDnsUpdate; + + TBuf8 iIAPName; + + TUint32 iIAPId; + + TUint32 iISPId; + + TUint32 iProxyId; + TUint32 iProxyISP; + + TBuf iProxyServiceType; + TBuf8 iProxyServerName; + + HBufC8* iPrevURI; + TInt iPrevLUID; + + TBuf iBearer; + + TUint32 iBearerType; + TInt iNetworkId; + TInt iLingerValue; + TBool iLingerFlag; + TBool iTransactionCommitted; + TBool iWAPRelock; + RArray iLockTableList; + + TBool iWlanSupported; + }; + + + +#endif // __NSMLINTERNETADAPTER_H__ +// End of File diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlWLanAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlWLanAdapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,365 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wlan adapter +* +*/ + + + +#ifndef __NSMLWLANADAPTER_H__ +#define __NSMLWLANADAPTER_H__ + + +// ----------------------------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------------------------- +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include "smldmadapter.h" +#include "nsmlconstants.h" +#include "NSmlWlanSettings.h" + + +// ----------------------------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------------------------- +const TInt KNSmlWepKeyGranularity = 4; +const TInt KNSmlMaxURISegLen = 32; +const TInt KExpandedEAPIdLength = 8; +const TInt KNsmlSubjectKeyIdLength = 255; + +_LIT8( KNSmlWLanAdapterDDFversion, "1.0" ); +_LIT16( KNSmlWLanServiceTable, "WLANServiceTable" ); +_LIT8( KNSmlWLanId, "Id" ); +_LIT8( KNSmlWLanName, "Name" ); +_LIT8( KNSmlWLanHidden, "Hidden" ); +_LIT8( KNSmlWLanReadOnly, "ReadOnly" ); +_LIT8( KNSmlWLanServiceId, "ServiceID" ); +_LIT8( KNSmlWLanNetworkMode, "NetworkMode" ); +_LIT8( KNSmlWLanConnectionMode, "WlanConnectionMode" ); +_LIT8( KNSmlWLanSsid, "SSID" ); +_LIT8( KNSmlWLanUsedSsid, "UsedSSID" ); +_LIT8( KNSmlWLanSsidHidden, "SSIDHidden" ); +_LIT8( KNSmlWLanUseWPAPSK, "UseWPAPSK" ); +_LIT8( KNSmlWLanEnablePSK, "EnablePSK" ); +_LIT8( KNSmlWLanWepKey1, "WEPKey1InHex" ); +_LIT8( KNSmlWLanWepKey2, "WEPKey2InHex" ); +_LIT8( KNSmlWLanWepKey3, "WEPKey3InHex" ); +_LIT8( KNSmlWLanWepKey4, "WEPKey4InHex" ); +_LIT8( KNSmlWLanWepIndex, "WEPKeyIndex" ); +_LIT8( KNSmlWLanWepKey, "WEPKey" ); +_LIT8( KNSmlWLanSecurityMode, "SecurityMode" ); +_LIT8( KNSmlWLanWpaAuthMode, "WPAAuthMode" ); +_LIT8( KNSmlWLanWpaPreSharedKey, "WPAPreSharedKey" ); +_LIT8( KNSmlWLanEapList, "WLANEAPList" ); +_LIT8( KNSmlWLanAuthMode, "WEPAuthMode" ); +_LIT8( KNSmlWLanWepKeyId, "WEPKeyID" ); +_LIT8( KNSmlWLanWepKeyData, "Data" ); +_LIT8( KNSmlWLanNodeName, "WLAN" ); + +_LIT8( KNSmlEmpty, "" ); +#define KNSmlWLanDefaultSSID _S("Net1") + +_LIT8( KNSmlWLan, "/WLAN" ); +_LIT8( KNSmlNAPDefWlanNode,"Name/NAPID/Bearer/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/IPDNSAddrFromServer/DNSAddr/DefGW/NetworkMask/Networks/IAPService"); + +_LIT8( KNSmlWLanListOfLeafs, "SSID/UsedSSID/SSIDHidden/NetworkMode/SecurityMode/WPAPreSharedKey/UseWPAPSK/WEPKey/WEPKeyIndex/WLANEAPList/WEPAuthMode/EAP/SecondarySSID" ); + +_LIT8( KNSmlWLanListOfSecondaryLeafs, "SSID/UsedSSID" ); +_LIT8( KNSmlWLanListOfWepKeys, "1/2/3/4" ); +_LIT8( KNSmlWLanListOfWepKeyLeafs, "WEPKeyID/Data" ); +_LIT8( KNSmlWLanAllowUnsecure8, "allow unsecure" ); +_LIT8( KNSmlWLanWep8, "WEP" ); +_LIT8( KNSmlWLan8021x8, "802.1X" ); +_LIT8( KNSmlWLanWpa8, "WPA" ); +_LIT8( KNSmlWLanWpa28, "WPA2" ); +_LIT8( KNSmlWLanWpaPreSharedKey8, "WPA pre-shared key" ); +_LIT8( KNSmlWLanAdHoc8, "ADHOC" ); +_LIT8( KNSmlWLanInfrastructure8, "Infrastructure" ); +_LIT8( KNSmlMimeType, "text/plain" ); + + +#ifdef FF_WLAN_EXTENSIONS +_LIT8( KNSmlWLanListOfEAPLeafs, "EAPType/Username/Password/Realm/UsePseudonym/VerifyCertRealm/RequireClientAuthentication/SessionValidityTime/CipherSuite/AllowPEAPv0/AllowPEAPv1/AllowPEAPv2/Certificate/AuthProvMode/UnauthProvMode/PACGroupRef/WarnADHPNoPAC/WarnADHPNoMatchPAC/WarnNotDefaultSrv" ); +#else +_LIT8( KNSmlWLanListOfEAPLeafs, "EAPType/Username/Password/Realm/UsePseudonym/VerifyCertRealm/RequireClientAuthentication/SessionValidityTime/CipherSuite/AllowPEAPv0/AllowPEAPv1/AllowPEAPv2/Certificate" ); +#endif + +_LIT8( KNSmlWLanListOfCertificateLeafs, "IssuerName/SubjectName/CertType/SerialNumber/SubjectKeyId/Fingerprint" ); + +_LIT8( KNSmlWLanSecSsid, "SecondarySSID" ); +_LIT8( KNSmlWLanEap, "EAP" ); +_LIT8( KNSmlWLanEapType, "EAPType" ); +_LIT8( KNSmlWLanUsername, "Username" ); +_LIT8( KNSmlWLanPassword, "Password" ); +_LIT8( KNSmlWLanRealm, "Realm" ); +_LIT8( KNSmlWLanUsePseudonym, "UsePseudonym" ); +_LIT8( KNSmlWLanEncapsulation, "Encapsulation" ); +_LIT8( KNSmlWLanVerifyCertRealm, "VerifyCertRealm" ); +_LIT8( KNSmlWLanRequireClientAuthentication, "RequireClientAuthentication" ); +_LIT8( KNSmlWLanSessionValidityTime, "SessionValidityTime" ); +_LIT8( KNSmlWLanCipherSuite, "CipherSuite" ); +_LIT8( KNSmlWLanAllowPEAPv0, "AllowPEAPv0" ); +_LIT8( KNSmlWLanAllowPEAPv1, "AllowPEAPv1" ); +_LIT8( KNSmlWLanAllowPEAPv2, "AllowPEAPv2" ); +#ifdef FF_WLAN_EXTENSIONS +_LIT8( KNSmlWLanAuthProvMode, "AuthProvMode" ); +_LIT8( KNSmlWLanUnauthProvMode, "UnauthProvMode" ); +_LIT8( KNSmlWLanPACGroupRef, "PACGroupRef" ); +_LIT8( KNSmlWLanWarnADHPNoPAC, "WarnADHPNoPAC" ); +_LIT8( KNSmlWLanWarnADHPNoMatchPAC, "WarnADHPNoMatchPAC" ); +_LIT8( KNSmlWLanWarnNotDefaultSrv, "WarnNotDefaultSrv" ); +#endif +_LIT8( KNSmlWLanCertificate, "Certificate" ); +_LIT8( KNSmlWLanIssuerName, "IssuerName" ); +_LIT8( KNSmlWLanSubjectName, "SubjectName" ); +_LIT8( KNSmlWLanCertType, "CertType" ); +_LIT8( KNSmlWLanSerialNumber, "SerialNumber" ); +_LIT8( KNSmlWLanSubjectKeyId, "SubjectKeyId" ); +_LIT8( KNSmlWLanFingerprint, "Fingerprint" ); + +_LIT8(KTrue, "True"); +_LIT8(KFalse, "False"); +_LIT8(KTtrue, "true"); +_LIT8(KFfalse, "false"); +_LIT8(KSlash, "/"); +_LIT8(KDash, "-"); +_LIT8(KNSmlWLanEapId, "EAPId" ); + +_LIT8(KSuitesDefault, "-010,-022,-019,-047,-050,-051,-004,-005"); + +const TUint RSA_3DES_SHA = 10; +const TUint DHE_RSA_3DES_SHA = 22; +const TUint DHE_DSS_3DES_SHA = 19; +const TUint RSA_AES_SHA = 47; // ? +const TUint DHE_RSA_AES_SHA = 50; // ? +const TUint DHE_DSS_AES_SHA = 51; // ? +const TUint RSA_RC4_MD5 = 4; +const TUint RSA_RC4_SHA = 5; +const TUint NUMBER_OF_CIPHERSUITES = 8; + +_LIT8(KEAPSIM, "EAP-SIM"); +_LIT8(KEAPAKA, "EAP-AKA"); +_LIT8(KEAPTLS, "EAP-TLS"); +_LIT8(KEAPPEAP, "EAP-PEAP"); +_LIT8(KEAPTTLS, "EAP-TTLS"); +_LIT8(KEAPLEAP, "EAP-LEAP"); +_LIT8(KEAPMSCHAPV2, "EAP-MSCHAPV2"); +_LIT8(KMSCHAPV2, "MSCHAPV2"); +_LIT8(KEAPGTC, "EAP-GTC"); +_LIT8(KEAPFAST, "EAP-FAST"); +_LIT8(KEAPTTLSPAP, "EAP-TTLSPAP"); + + +const TUint8 KEapNoneId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +const TUint8 KEapTlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d}; +const TUint8 KEapGtcTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}; +const TUint8 KEapLeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11}; +const TUint8 KEapSimTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12}; +const TUint8 KEapTtlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15}; +const TUint8 KEapAkaTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17}; +const TUint8 KEapPeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19}; +const TUint8 KEapMschapv2TypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A}; +const TUint8 KEapSecuridTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}; +const TUint8 KEapFastTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B}; +const TUint8 KMschapv2TypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63}; +const TUint8 KTtlspapTypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x62}; + + + + +// ----------------------------------------------------------------------------------------------- +// Structures +// ----------------------------------------------------------------------------------------------- +struct TNSmlWepKeyBufferElement + { + HBufC8* iUri; + HBufC8* iData; + TInt iWepKeyId; + TInt iIdStatusRef; + //TInt iUseWPAPSK; + TInt iDataStatusRef; + TInt iNodeStatusRef; + TInt iLengthStatusRef; + TBool iExecuted; + TBool iDataSet; + TInt iLuid; + }; + + struct TNSmlSecondarySSIDBufferElement + { + HBufC8* iUri; + TBuf ScannedId; + TBuf UsedId; + TInt wlanLuid; + TBool iExecuted; + }; + +struct TNSmlEAPBufferElement + { + EAPSettings* iEAPSettings; + EAPSettings::TEapType iEncapsulatingEAPId; + RArray iStatusRefArray; + TInt iWLANServiceId; + }; + +// ----------------------------------------------------------------------------------------------- +// Enumerations +// ----------------------------------------------------------------------------------------------- +enum TConnectionMode + { + EAdhoc = 0, + EInfrastructure = 1 + }; + +enum TWLanSecurityMode + { + EAllowUnsecure = 1, + EWep = 2, + EWlan8021x = 4, + EWpa = 8, + EWpa2 = 16 + }; + +enum TWepAuthenticationMode + { + EOpen = 0, + EShared = 1 + }; + +// ------------------------------------------------------------------------------------------------ +// CNSmlWLanAdapter +// ------------------------------------------------------------------------------------------------ +class CNSmlWLanAdapter : public CSmlDmAdapter + { +public: + static CNSmlWLanAdapter* NewL( MSmlDmCallback* aDmCallback, CCommsDatabase& aDatabase ); + static CNSmlWLanAdapter* NewLC( MSmlDmCallback* aDmCallback, CCommsDatabase& aDatabase ); + void ConstructL( CCommsDatabase& aDatabase ); + virtual ~CNSmlWLanAdapter(); + +// Adapter interface + void DDFVersionL( CBufBase& aDDFVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + CBufBase& aObject ); + +private: + CNSmlWLanAdapter(TAny* aEcomArguments); + void FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ); + HBufC* IntToDesLC(const TInt aLuid); + HBufC8* IntToDes8LC(const TInt aLuid); + TInt DesToInt(const TDesC8& aLuid); + TInt GetIdFromLuid( const TDesC8& aLuid ); + TUint32 GetSecSSIDFromUriL(const TDesC8& aUri ); + TInt GetEAPIdFromUri( const TDesC8& aUri ); + TInt GetCertificateIdFromUri( const TDesC8& aUri ); + TInt GetWepKeyIdFromLuid( const TDesC8& aLuid ); + TInt GetWepKeyIdFromUri( const TDesC8& aUri ); + TInt NumOfUriSegs( const TDesC8& aUri ); + TPtrC8 GetLastUriSeg(const TDesC8& aURI); + TPtrC8 RemoveLastUriSeg(const TDesC8& aURI); + void ExecuteBufferL( TBool aFinal = EFalse ); + TDesC8& ConvertTo8LC( const TDesC& aSource ); + TDesC16& ConvertTo16LC( const TDesC8& aSource ); + void DesToBufferL(CBufBase& aTo, const TDesC& aFrom); + void FillCipherSuiteBufferL(CBufBase& aBuffer); + void FillCipherSuitesL(const TDesC8& aObject, const TInt aLuid); + void ConvertEAPStringToIds( const TDesC8& aEAPString, TDes8& aExpandedId, EAPSettings::TEapType& aId); + TInt GetServiceIdFromUriL( const TDesC8& aURI); + TInt GetEncapsEAPIdFromUri( const TDesC8& aUri ); + void ResetEAPStructL(); + void DeleteEAPStructL(); + + MSmlDmCallback* iCallBack; + CWlanSettings* iWlanSettings; + CArrayFixFlat *iBuffer; + TWlanSettings *iSettings; + EAPSettings* iEAPSettings; + RPointerArray iSecondaryBuffer; + RPointerArray iEAPBuffer; + + }; + +#endif __NSMLWLANADAPTER_H__ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlWlanSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlWlanSettings.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wlan Adapter commsDB handler +* +*/ + + + +#ifndef __NSMLWLANSETTINGS_H__ +#define __NSMLWLANSETTINGS_H__ + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include + +const TInt KMaxPSKLength = 63; +const TInt KMinPSKLength = 8; + +// ========================================================================== +// Class forwards +// ========================================================================== +// +class CWlanSettings; + +class TWlanSettings + { +public: + TBuf Name; + TUint32 Id; + TUint32 ServiceID; + TUint32 ConnectionMode; // Infrastructure / adhoc + TBuf SSID; + TBuf8 WepKey1; + TBuf8 WepKey2; + TBuf8 WepKey3; + TBuf8 WepKey4; + TUint32 WepIndex; + TUint32 SecurityMode; // SecurityMode (Allow unsecure, wep, 802.1xs, wpa) enum EWlanSecurityMode + TUint32 WPAMode; // enum EWpaMode + TUint32 UseWPAPSK; // CR ID: TMVI-5Y49AS + TBuf8 WPAPreSharedKey; + TUint32 AuthMode; + TBuf UsedSSID; + TUint32 ScanSSID; + TBuf EapList; + TBool SecondarySSIDsExisting; +// TBuf SecondarySSID; +// TBuf UsedSecondarySSID; + + }; + +class TSecondarySSID + { +public: + TUint32 Id; + TBuf ScannedId; + TBuf UsedId; + }; + + +// ----------------------------------------------------------------------------------------------- +// Defines +// ----------------------------------------------------------------------------------------------- + +class CWlanSettings : public CBase + { +public: + static CWlanSettings* NewL( CCommsDatabase& aDatabase ); + void ConstructL( ); + ~CWlanSettings( ); + + TInt GetWlanSettings( TUint32 aLuid, TWlanSettings& aWlanSettings ); + TInt DeleteWlanSettings( TUint32 aLuid ); + TInt WriteWlanSettings( TWlanSettings& aWlanSettings ); + void ConnectToDatabaseL( ); + TInt RecordExists( TUint32 aLuid ); + TInt PerformLockWLANTablesL(TBool aProtect); + TBool CheckEnforcementL(); + TBool CheckAPEnforcementL(); + TBool iWLANRelock; + + TInt GetEAPSettings( const TInt aId, const TInt aEapType, const TInt aTunnelingType, EAPSettings& aEapSettings ); + TInt DeleteEAPSettings( TInt aId , TInt aEapType ); + void DeleteWlanEapSettingsL( TInt aWlanId ); + TInt DeleteSecondarySSIDsL( TUint32 aWLANId ); + TInt DeleteOneSecondarySSIDL( TUint32 aWLANId , TUint32 asecId); + TInt WriteEAPSettings( EAPSettings& aEapSettings); + TInt WriteSecondarySSIDL( TUint32 aWlanID, TSecondarySSID& aSettings, TBool aNew ); + void GetSecondarySSIDListL(TUint32 aLuid, RArray& aSecondarySSIDs); + void GetEAPInterfaceL(const TInt aId, const TInt aTunnelingType, const TInt aType); + TInt InstalledEAPsL(CBufBase& aEAPList); + + +private: + + CWlanSettings( CCommsDatabase& aDatabase ); + TInt GoToRecord( TUint32 aId ); + void GetDataFromRecordL( TWlanSettings* aWlanSettings ); + void WriteDataToRecordL( TWlanSettings* aWlanSettings ); + void InitialiseRecordL( ); + void SetSecondaryViewToRecordL( TUint32 aId ); + + TDesC8& ConvertTo8LC( const TDesC& aSource ); + TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + CCommsDatabase& iDatabase; + CCommsDbTableView* iTableView; + CCommsDbTableView* iSecondaryView; + CEapType* iEapType; + TUint32 iServiceID; + TBool iExpandedEAPTypeFieldsUsed; + }; + + +#endif __NSMLWLANSETTINGS_H__ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/rom/nsmlinternetadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/rom/nsmlinternetadapter.iby Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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 "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: Image description file for project InternetAdapter +* +*/ + + + +REM SyncML Device Management internet adapter + +#include + +#ifndef __NSMLINTERNETADAPTER_IBY__ +#define __NSMLINTERNETADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected +#ifndef FF_DM_CONNMO_ADAPTER // nothing should be installed from this .iby file if this flag is specified. + // ConnMO is used in that case for access point provisioning. + +ECOM_PLUGIN(nsmlinternetadapter.dll,nsmlinternetadapter.rsc) + +#endif // FF_DM_CONNMO_ADAPTER +#endif //__SYNCML_DM + +#endif //__NSMLINTERNETADAPTER_IBY__ diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/src/NSmlInternetAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/src/NSmlInternetAdapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,9272 @@ +/* +* 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 "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: Internet-settings + * +*/ + + +#include +#include +#include // CommsDB columname defs +#include // For TImplementationProxy definition +#include +#include // ISP enumerations +#include // GPRS ProtocolType +#include // CallbackType +#include // GPRS enumeration +#include // WAP enumeration +#include // OOD checking +#include // ipv4 + ipv6 checking +#include +#include "NSmlInternetAdapter.h" +#include "NSmlWLanAdapter.h" +#include "nsmldebug.h" +#include "nsmldmtreedbclient.h" +#include +#include + + +#include +#include +#include +#include +#include +#include +#include + +const TUint KNSmlInternetAdapterImplUid = 0x101F6DE2; + +const TUint KIapColumn = 0x00000100; +const TUint KLingerColumn = 0x00000200; +const TUint KColumnMask = 0xFFFFFF00; +const TUint KRowMask = 0x000000FF; + + +#include // VSettingEnforcementInfo + +class CNSmlWLanAdapter; + +_LIT( KDaemonManagerName, "NetCfgExtnDhcp" ); +_LIT( KConfigDaemonName, "!DhcpServ" ); + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + +const TInt KBeginTransRetryDelay = 1000000; // Delay for comms db begintransaction retry (microseconds) +const TInt KBeginTransRetryCount = 7; // Maximum number of retries +//----------------------------------------------------------------------------- +// CSmlInternetAdapter* CSmlInternetAdapter::NewL( ) +//----------------------------------------------------------------------------- + +CNSmlInternetAdapter* CNSmlInternetAdapter::NewL(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlInternetAdapter::NewL(): begin"); + + CNSmlInternetAdapter* self = NewLC(aDmCallback); + CleanupStack::Pop(); + + _DBG_FILE("CNSmlInternetAdapter::NewL(): end"); + return self; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter* CNSmlInternetAdapter::NewLC( ) +//------------------------------------------------------------------------------ +CNSmlInternetAdapter* CNSmlInternetAdapter::NewLC(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlInternetAdapter::NewLC(): begin"); + CNSmlInternetAdapter* self = new (ELeave) CNSmlInternetAdapter(aDmCallback); + CleanupStack::PushL(self); + + self->iCallBack = aDmCallback; + self->ConstructL(); + + _DBG_FILE("CNSmlInternetAdapter::NewLC(): end"); + return self; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CNSmlInternetAdapter() +//------------------------------------------------------------------------------ +CNSmlInternetAdapter::CNSmlInternetAdapter(TAny* aEcomArguments) + : CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlInternetAdapter::CNSmlInternetAdapter(): begin"); + _DBG_FILE("CNSmlInternetAdapter::CNSmlInternetAdapter(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::~CNSmlInternetAdapter(TAny* aEcomArguments) +//------------------------------------------------------------------------------ +CNSmlInternetAdapter::~CNSmlInternetAdapter() + { + _DBG_FILE("CNSmlInternetAdapter::~CNSmlInternetAdapter(): begin"); + + delete iField; + + delete iPrevURI; + + // Command buffer cleaning if leave happend + if (iBuffer) + { + for(TInt i=0;iCount();i++) + { + delete iBuffer->At(i).iMappingName; + delete iBuffer->At(i).iName; + + ClearBuffer( iBuffer->At(iExecutionIndex).iNodeBuf ); + delete iBuffer->At(i).iNodeBuf; + + ClearBuffer( iBuffer->At(iExecutionIndex).iWlanNodeBuf ); + delete iBuffer->At(i).iWlanNodeBuf; + } + + iBuffer->Reset(); + delete iBuffer; + } + + if ( iWlanSupported ) + { + delete iWlanAdapter; + } + + delete iDatabase; + FeatureManager::UnInitializeLib(); + _DBG_FILE("CNSmlInternetAdapter::~CNSmlInternetAdapter(): end"); + } + +//============================================= +// CNSmlInternetAdapter::ConstructL() +// Second phase constructor. +//============================================= +void CNSmlInternetAdapter::ConstructL() + { + FeatureManager::InitializeLibL(); + iField = HBufC8::NewL( KNSmlMaxURLLength ); + + iPrevURI = HBufC8::NewL( KNSmlMaxURLLength ); + + iDatabase = CCommsDatabase::NewL(); + // iDatabase->BeginTransaction(); //+++ + iTransactionCommitted=ETrue; + i3GPPPS = EFalse; + + iLeafType = EDMUnset; // Default for leaf handling + + // Reset identification data + + iDirection = ECommDbConnectionDirectionUnknown; + + // + // Command buffering used for AddNode + AddLeaf + // + iBuffer = new (ELeave) CArrayFixFlat (KNSmlAPGranularity); + + // checks if Wlan feature is supported + iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + + // WlanAdapter + // + if ( iWlanSupported ) + { + iWlanAdapter = CNSmlWLanAdapter::NewL(iCallBack, *iDatabase); + } + + iNetworkId = KErrNotFound; + iLingerValue = NULL; + iLingerFlag = ETrue; + } + +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::DDFVersionL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + aDDFVersion.InsertL(0,KNSmlInternetAdapterDDFversion); + } +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::DDFStructureL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlInternetAdapter::DDFStructureL(): begin"); + + // + // Set rest acceptable operations for data itself + // + + TSmlDmAccessTypes aclTypesAddGetDel; + aclTypesAddGetDel.SetGet(); + aclTypesAddGetDel.SetAdd(); + aclTypesAddGetDel.SetDelete(); + + TSmlDmAccessTypes aclTypesAddGet; + aclTypesAddGet.SetGet(); + aclTypesAddGet.SetAdd(); + + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesAddReplace; + aclTypesAddReplace.SetReplace(); + aclTypesAddReplace.SetAdd(); + + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + TSmlDmAccessTypes aclTypesAll; + aclTypesAll.SetGet(); + aclTypesAll.SetReplace(); + aclTypesAll.SetAdd(); + aclTypesAll.SetDelete(); + + MSmlDmDDFObject* ddfRoot = &aDDF; + MSmlDmDDFObject& ddf = ddfRoot->AddChildObjectL(KNSmlDdfAP); + + _LIT8(KDescription,"AP-Settings DDF description"); + _LIT8(KDFTitle,"AP-settings title"); + + FillNodeInfoL( ddf, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KDescription); + + ddf.SetDFTitleL(KDFTitle); + ddf.SetDefaultValueL(KNullDesC8); + + MSmlDmDDFObject& nApDDF = ddf.AddChildObjectGroupL(); // For AP/ + + FillNodeInfoL( nApDDF, + aclTypesAll, + MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nNAPDefRootDDF = nApDDF.AddChildObjectL(KNSmlDdfNAPDef); // NAPDef + FillNodeInfoL( nNAPDefRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, // EZeroOrMore + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nNAPDefDDF = nNAPDefRootDDF.AddChildObjectGroupL(); // For NAPDef + FillNodeInfoL( nNAPDefDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nPxRootDDF = nApDDF.AddChildObjectL(KNSmlDdfPx); // Px + FillNodeInfoL( nPxRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nPxDDF = nPxRootDDF.AddChildObjectGroupL(); // For Px + FillNodeInfoL( nPxDDF, + aclTypesAddGetDel,//aclTypesAddGet + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); +// +// NAPDef-node fields +// + MSmlDmDDFObject& nNameDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPName); // Name + FillNodeInfoL( nNameDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNAPNameDesc); + + MSmlDmDDFObject& nNAPIDDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPID); // NAPID + FillNodeInfoL( nNAPIDDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNAPIDDesc); + + MSmlDmDDFObject& nNAPLingerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPLinger); // Linger + FillNodeInfoL( nNAPLingerDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlDdfNAPLingerDesc); + + MSmlDmDDFObject& nNAPStartpgDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfStartpg); // Startpg + FillNodeInfoL( nNAPStartpgDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfStartpgDesc); + + MSmlDmDDFObject& nBearerRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfBearer); // Bearer + FillNodeInfoL( nBearerRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nBearerDDF = nBearerRootDDF.AddChildObjectGroupL(); // Bearer/ + FillNodeInfoL( nBearerDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nBearerLDDF = nBearerDDF.AddChildObjectL(KNSmlDdfBearerL); // BearerL + FillNodeInfoL( nBearerLDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfBearerLDesc); + + MSmlDmDDFObject& nDirectionDDF = nBearerDDF.AddChildObjectL(KNSmlDdfDirection); // Direction + FillNodeInfoL( nDirectionDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfDirectionDesc); + + MSmlDmDDFObject& nNAPAddrDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAddr); // NAPAddr + FillNodeInfoL( nNAPAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNAPAddrDesc); + + MSmlDmDDFObject& nNAPAddrTyDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAddrTy); // NAPAddrTy + FillNodeInfoL( nNAPAddrTyDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNAPAddrTyDesc); + + MSmlDmDDFObject& nDNSAddrRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDNSAddr); // DNSAddr + FillNodeInfoL( nDNSAddrRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nDNSAddrDDF = nDNSAddrRootDDF.AddChildObjectGroupL(); // DNSAddr/ + FillNodeInfoL( nDNSAddrDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nDNSAddrLDDF = nDNSAddrDDF.AddChildObjectL(KNSmlDdfDNSAddrL); // DNSAddrL + FillNodeInfoL( nDNSAddrLDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfDNSAddrLDesc); + + MSmlDmDDFObject& nDNSAddrTyDDF = nDNSAddrDDF.AddChildObjectL(KNSmlDdfDNSAddrTy); // DNSAddrTy + FillNodeInfoL( nDNSAddrTyDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfDNSAddrTyDesc); + + MSmlDmDDFObject& nDNSPriorityDDF = nDNSAddrDDF.AddChildObjectL(KNSmlDdfDNSPriority); // DNSAddrPriority + FillNodeInfoL( nDNSPriorityDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfDNSPriorityDesc); + + MSmlDmDDFObject& nNAPAuthInfRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAuthInf); // NAPAuthInf + FillNodeInfoL( nNAPAuthInfRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nNAPAuthInfDDF = nNAPAuthInfRootDDF.AddChildObjectGroupL(); // NAPAuthInf/ + FillNodeInfoL( nNAPAuthInfDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nAuthNameDDF = nNAPAuthInfDDF.AddChildObjectL(KNSmlDdfAuthName); // AuthName + FillNodeInfoL( nAuthNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfAuthNameDesc); + + MSmlDmDDFObject& nAuthSecrDDF = nNAPAuthInfDDF.AddChildObjectL(KNSmlDdfAuthSecr); // AuthSecr + FillNodeInfoL( nAuthSecrDDF, + aclTypesAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfAuthSecrDesc); + + MSmlDmDDFObject& nDefGWDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDefGW); // DefGW + FillNodeInfoL( nDefGWDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfDefGWDesc); + + MSmlDmDDFObject& nNetworkMaskDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNetworkMask); // NetworkMask + FillNodeInfoL( nNetworkMaskDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNetworkMaskDesc); + + MSmlDmDDFObject& nUsePTxtLogDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfUsePTxtLog); // UsePTxtLog + FillNodeInfoL( nUsePTxtLogDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlDdfUsePTxtLogDesc); + + MSmlDmDDFObject& nNetworksRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNetworks); // Networks + FillNodeInfoL( nNetworksRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nNetworksDDF = nNetworksRootDDF.AddChildObjectGroupL(); // Networks/ + FillNodeInfoL( nNetworksDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nNetworkNameDDF = nNetworksDDF.AddChildObjectL(KNSmlDdfNetworkName); // NetworkName + FillNodeInfoL( nNetworkNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNetworkNameDesc); + + MSmlDmDDFObject& nNetworkIDDDF = nNetworksDDF.AddChildObjectL(KNSmlDdfNetworkID); // NetworkID + FillNodeInfoL( nNetworkIDDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlDdfNetworkIDDesc); + + MSmlDmDDFObject& nPPPCompDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfPPPComp); // PPPComp + FillNodeInfoL( nPPPCompDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlDdfPPPCompDesc); + + MSmlDmDDFObject& nGPRSPDPDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfGPRSPDP); // GPRSPDP + FillNodeInfoL( nGPRSPDPDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfGPRSPDPDesc); + + MSmlDmDDFObject& nIPAddrFromServerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPAddrFromServer); // IPAddrFromServer + FillNodeInfoL( nIPAddrFromServerDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlDdfIPAddrFromServerDesc); + + MSmlDmDDFObject& nIPAddrDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPAddr); // IPAddr + FillNodeInfoL( nIPAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfIPAddrDesc); + + MSmlDmDDFObject& nDNSAddrFromServerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDNSAddrFromServer); // DNSAddrFromServer + FillNodeInfoL( nDNSAddrFromServerDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlDdfDNSAddrFromServerDesc); + + MSmlDmDDFObject& nIPv6DNSAddrFromServerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPv6DNSAddrFromServer); // IPv6DNSAddrFromServer + FillNodeInfoL( nIPv6DNSAddrFromServerDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlDdfIPv6DNSAddrFromServerDesc); + + MSmlDmDDFObject& nIfNetworksDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIfNetworks); // IfNetworks + FillNodeInfoL( nIfNetworksDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfIfNetworksDesc); + + MSmlDmDDFObject& nIAPServiceDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIAPService); // IAPService + FillNodeInfoL( nIAPServiceDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfIAPServiceDesc); + + + + MSmlDmDDFObject& nIAPSeamlessnessDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIAPSeamlessness); // IAPService + FillNodeInfoL( nIAPSeamlessnessDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlDdfIAPSeamlessnessDesc); + MSmlDmDDFObject& nIAPMetaDataDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIAPMetaData); // IAPService + FillNodeInfoL( nIAPMetaDataDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlDdfIAPMetaDataDesc); + + if ( iWlanSupported ) + { + iWlanAdapter->DDFStructureL( nNAPDefDDF ); // Adds WLAN fields to DDF + } + +// +// Px-node fields +// + MSmlDmDDFObject& nPxNameDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxName); // Name + FillNodeInfoL( nPxNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfPxDesc); + + MSmlDmDDFObject& nPxIdDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxId); // PxId + FillNodeInfoL( nPxIdDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfPxIdDesc); + + MSmlDmDDFObject& nDomainRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfDomain); // Domain + FillNodeInfoL( nDomainRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDdfDomainDesc); + + MSmlDmDDFObject& nDomainDDF = nDomainRootDDF.AddChildObjectGroupL(); // Domain + FillNodeInfoL( nDomainDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nDomainLDDF = nDomainDDF.AddChildObjectL(KNSmlDdfDomainL); // DomainL (Get) + FillNodeInfoL( nDomainLDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfDomainLDesc); + + MSmlDmDDFObject& nPxPWDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxPW); // PxPW + FillNodeInfoL( nPxPWDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfPxPWDesc); + + MSmlDmDDFObject& nPxAddrDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxAddr); // PxAddr + FillNodeInfoL( nPxAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfPxAddrDesc); + + MSmlDmDDFObject& nPortRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfPort); // Port + FillNodeInfoL( nPortRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDdfPortDesc); + + MSmlDmDDFObject& nPortDDF = nPortRootDDF.AddChildObjectGroupL(); // Port + FillNodeInfoL( nPortDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nPortNbrDDF = nPortDDF.AddChildObjectL(KNSmlDdfPortNbr); // PortNbr (Get) + FillNodeInfoL( nPortNbrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlDdfPortNbrDesc); + + MSmlDmDDFObject& nToNAPIDRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfToNAPID); // ToNAPID + FillNodeInfoL( nToNAPIDRootDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDdfToNAPIDDesc); + + MSmlDmDDFObject& nToNAPIDDDF = nToNAPIDRootDDF.AddChildObjectGroupL(); // ToNAPID + FillNodeInfoL( nToNAPIDDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nToNAPIDLDDF = nToNAPIDDDF.AddChildObjectL(KNSmlDdfToNAPIDL); // ToNAPIDL (Get) + FillNodeInfoL( nToNAPIDLDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfToNAPIDLDesc); + + MSmlDmDDFObject& nPxStartpgDDF = nPxDDF.AddChildObjectL(KNSmlDdfStartpg); // Startpg + FillNodeInfoL( nPxStartpgDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfStartpgDesc); + + MSmlDmDDFObject& nPxAuthInfRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxAuthInf); // PxAuthInf + FillNodeInfoL( nPxAuthInfRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nPxAuthInfDDF = nPxAuthInfRootDDF.AddChildObjectGroupL(); // PxAuthInf/ + FillNodeInfoL( nPxAuthInfDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nPxAuthIdDDF = nPxAuthInfDDF.AddChildObjectL(KNSmlDdfPxAuthId); // PxAuthId + FillNodeInfoL( nPxAuthIdDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfPxAuthIdDesc); + + MSmlDmDDFObject& nPxAuthPWDDF = nPxAuthInfDDF.AddChildObjectL(KNSmlDdfPxAuthPW); // PxAuthPW + FillNodeInfoL( nPxAuthPWDDF, + aclTypesAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfPxAuthPWDesc); + + MSmlDmDDFObject& nNoPxForRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfNoPxFor); // NoPxFor + FillNodeInfoL( nNoPxForRootDDF, + aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDdfNoPxForDesc); + + MSmlDmDDFObject& nNoPxForDDF = nNoPxForRootDDF.AddChildObjectGroupL(); // NoPxFor + FillNodeInfoL( nNoPxForDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8); + + MSmlDmDDFObject& nNoPxForLDDF = nNoPxForDDF.AddChildObjectL(KNSmlDdfNoPxForL); // NoPxForL (Get) + FillNodeInfoL( nNoPxForLDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDdfNoPxForLDesc); + + + _DBG_FILE("CNSmlInternetAdapter::DDFStructureL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::LingerValueL() +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::LingerValueL( const TDesC8& aObject ) +{ + + TBuf<100> desObj; + CnvUtfConverter::ConvertToUnicodeFromUtf8(desObj, aObject); + TInt err(KErrNone); + //const TDesC& value = desObj; + if(!Notalpha(desObj)) + { + TLex lex( desObj ); + TUint Linger = 0; + TInt lingerint; + err = lex.Val( Linger, EDecimal ); + if( err == KErrNone ) + { + lingerint = Linger; + if( lingerint >= 0 ) + { + iLingerValue = lingerint; + iLingerFlag = EFalse; + } + } + } +} + + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::UdateligerValueL +// +// ----------------------------------------------------------------------------- +// +TBool CNSmlInternetAdapter::Notalpha(const TDesC& aValue) +{ + TBool NotAlpha = EFalse; + TChar character; + for(TInt i = 0 ; i < aValue.Length(); i++) + { + character = aValue[i]; + NotAlpha = character.IsAlpha(); + if(NotAlpha) + break; + } + + return NotAlpha; +} +// CNSmlInternetAdapter::AddLeafObjectL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): begin"); + DBG_ARGS8(_S8("AP:add aURI AddLeafObjectL - %S - %S"), &aURI, &aParentLUID); + DBG_ARGS8(_S8("AP:Object %S"), &aObject); + + TInt parentLUID(0); + if(aParentLUID.Length()<=0 ) + { + if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound) + { + if(!GetProxyIdL(aURI)) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return; + } + } + if(!iLUID) + iLUID = IntLUID(aParentLUID); + parentLUID = GetAPIdFromURIL(aURI); + if( parentLUID == 0 ) + { + if( IsAPUriFormatMatchPredefined(aURI) ) + { + iLUID = ConstructTreeL(aURI); + parentLUID = GetAPIdFromURIL(aURI); + } + } + + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): PParentLUID set to parentLUID"); + parentLUID = IntLUID(aParentLUID); + } +// Always buffer DNSAddr//* + if( ( parentLUID ==0 || + aURI.Find(KNSmlDdfDNSPriority ) >= 0 || + aURI.Find(KNSmlDdfDNSAddrL ) >= 0 ) && !iExecutingBuffer ) + // Update as add + { + iLeafType = EDMUnset; // Default for leaf handling + AddLeafBufferL(aURI,aParentLUID,aObject,aType,aStatusRef); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); + return; + } + + if(parentLUID == KNSmlIncompleteAP) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + return; + } + +//check if Stale and add leaf buffer + if (parentLUID > 0 && !iExecutingBuffer ) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): parentLUID > 0 && !iExecutingBuffer"); + TUint32 apID = GetAPIdFromURIL(aURI); + if(!APExistsL(apID)) + { + AddLeafBufferL(aURI,aParentLUID,aObject,aType,aStatusRef); + iStaleMapUpdate=ETrue; + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); + return; + } + } + TInt pushed = 0; +// +// Check which field going to be handled +// + SetField(aURI); + if((iField->Compare(KNSmlDdfNAPLinger) == 0)) + { + TUint32 apID = GetAPIdFromURIL(aURI); + if( aObject.Size()==0 ) + { + DeleteLingerL( apID ); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + return; + } + LingerValueL( aObject ); + + if ( !iLingerFlag ) + { + iLingerFlag = ETrue; + TRAPD (error, AddLingerL( apID , iLingerValue )); + if( error == !KErrNone) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + } + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + return; + } + +// +// On leaf handling and add, must be checked that value not set before +// + if (iLeafType != EDMUpdate && + iLeafType != EDMDelete ) + { + iLeafType = EDMAdd; + } + if (iStaleMapUpdate) + { + iLeafType = EDMAdd; + } + + TPtrC qTable = TPtrC(KNullDesC); + TPtrC qColumn = TPtrC(KNullDesC); + TPtrC qDB = TPtrC(COMMDB_ID); + + if(aURI.Find(KNSmlDdfPortNbr) >= 0) + { + IsWapPort(aObject); + } +// +// Get Database field type +// + + if(parentLUID > 0) + { + // Get IAP nbr for servicetype + TUint32 iapIDs = GetAPIdFromURIL(aURI); + + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): checkluid is %d and iapId %d "),parentLUID, iapIDs ); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapViews = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapIDs); + + TBuf serviceType; + + TInt errorCode = iapViews->GotoFirstRecord(); + + // Read iapService from (IAP) + if ( errorCode == KErrNone ) + { + iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + CleanupStack::PopAndDestroy(); // iapViews + qTable.Set(serviceType); + } + else + { + CleanupStack::PopAndDestroy(); // iapViews + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound 1 end"); + return; + } + } + + if ( iWlanSupported ) + { + TBool wLANfield = IsWLANfield(aURI); + if( wLANfield ) + { + iWlanAdapter->AddLeafObjectL( aURI, aParentLUID, aObject, aType, aStatusRef ); + CleanupStack::PopAndDestroy(pushed); + return; + } + } + + TInt fType = GetAPFieldType( aURI ); + if (fType == EWrong) // Error if leaf not supported + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + return; + } + + TBool fieldOK = GetAPField(qTable,qColumn); + if(!fieldOK ) // OK if column for table not supported + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + return; + } + + iISPId = parentLUID; + if(aURI.Match(_L8("AP/*/Px/*/*" ))!= KErrNotFound) + { + if(iProxyId == 0) + iProxyId = parentLUID; + } + + if (( fType == CNSmlInternetAdapter::EStr ) || + ( fType == CNSmlInternetAdapter::EInt && aURI.Find(KNSmlDdfGPRSPDP) >= 0) || // KNSmlDdfNAPAddrTy + ( fType == CNSmlInternetAdapter::EInt && aURI.Find(KNSmlDdfNAPAddrTy) >= 0)) // KNSmlDdfNAPAddrTy + { // Name + NAPAddr + DNSAddr + Networks/*/Name + + if(aURI.Match(_L8("AP/*/Networks/*/Name"))!= KErrNotFound) + { + TUint32 checkLUID = 0; + TUint32 iapID1 = GetAPIdFromURIL(aURI); + + + // IAP-table NetworkId Update + CCommsDbTableView* iapUpdate = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID),iapID1); + TInt iapExists = iapUpdate->GotoFirstRecord(); + + if (iapExists == KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, Get network id"); + iapUpdate->ReadUintL(TPtrC(IAP_NETWORK),checkLUID); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): networks is %d"),checkLUID); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, IAP exists"); + if( checkLUID >0 ) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, network id > 0"); + //check if network exist in NETWORK TABLE + CCommsDbTableView* checknetView; + checknetView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID),checkLUID); + TInt error = checknetView->GotoFirstRecord(); + if (error == KErrNotFound) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: Network does not exist, create it"); + AddNetworkL(checkLUID,aObject); + if( checkLUID > 0 ) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network generation ok"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): network id is %d"),checkLUID); + //iapUpdate->WriteUintL(TPtrC(IAP_NETWORK),checkLUID); + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): network generation failed"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + return; + } + } + // Network was found, update the name to the given name. + else + { + if(checknetView->UpdateRecord()==KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network found, update name"); + checknetView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network name updated"); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + // writing failed for some reason + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): network generation failed"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + return; + } + } + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network ok"); + CleanupStack::PopAndDestroy(); //checknetView + } + } + // IAP does not exist yet, create network, network id will be updated later using checkLUID + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network does not exist, creation 2"); + AddNetworkL(checkLUID,aObject); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): network id is %d"),checkLUID); + } + CleanupStack::PopAndDestroy(); // iapUpdate + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network addition handled"); + + + // IAP-table NetworkId Update + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapID1); + TInt iapFound = iapView->GotoFirstRecord(); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network id update begin"); + if(iapFound==KErrNone) + { + TBool iapReLock = EFalse; + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce=EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if(eError==KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + ((CCommsDbProtectTableView*)iapView)->UnprotectRecord(); + iWAPRelock = ETrue; + } + } + + if(IsIAPRecordLockedL(iapID1)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)iapView)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + if(iapView->UpdateRecord()==KErrNone) + { + iapView->WriteUintL(TPtrC(IAP_NETWORK), checkLUID); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObject(): checkLUID is %d"),checkLUID); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, IAP_NETWORK set to checkLUID "); + iapView->PutRecordChanges(); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap found, set iNetworkId to checkLUID"); + iNetworkId = checkLUID; + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + ((CCommsDbProtectTableView*)iapView)->ProtectRecord(); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID1,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,Protecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + } + else if (iapFound==KErrNotFound) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap not found, set iNetworkId"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObject(): checkLUID is %d"),checkLUID); + iNetworkId = checkLUID; + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap found"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + CleanupStack::PopAndDestroy(); // iapView + CleanupStack::PopAndDestroy(pushed); + + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): OK end"); + return; + } + + else if(((aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || // ProxyName + aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound || // ProxyAddr + aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) // DomainL (PROXY_PROTOCOL_NAME) + && iLeafType == EDMUpdate) || + ((aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound + || aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) + && iLeafType == EDMAdd)) + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + iProxyId); + TBool proxyReLock = EFalse; + if(IsProxyRecordLockedL(iProxyId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): proxy record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + proxyReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + TInt errorCode = tableView->GotoFirstRecord(); + if ( errorCode == KErrNone ) + { + if (tableView->UpdateRecord() == KErrNone ) + { + if (aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound ) + { + tableView->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), ConvertTo16LC(aObject)); + pushed++; + } + else if (aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) + { + // Accepted values are (http, https, ftp, ftps) + _LIT8(KProxyProtocol,"http, https, ftp, ftps"); + + TInt protocolFound = 0; + if(aObject.Length() > 0) + { + protocolFound = KProxyProtocol().Find(aObject); + } + if( protocolFound == KErrNotFound && aObject.Length() > 0) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + if(aObject.Length() == 0) + { + tableView->SetNullL(TPtrC(PROXY_PROTOCOL_NAME)); + } + else + { + tableView->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), ConvertTo16LC(aObject)); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + } + tableView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + if(proxyReLock) + { + TInt reclockerr = DoProtectProxyRecordL(iProxyId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + proxyReLock = EFalse; + } + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); + return; + } + + if (iLeafType == EDMUpdate || + (iLeafType == EDMAdd && + (aURI.Find(KNSmlDdfNAPName) >= 0 && + aURI.Find(KNSmlDdfNAPDef) >= 0) || + aURI.Find(KNSmlDdfNAPAddr) >= 0 || + aURI.Find(KNSmlDdfGPRSPDP) >= 0 || + aURI.Find(KNSmlDdfDNSAddrL) >= 0 || + aURI.Find(KNSmlDdfAuthSecr) >= 0 || + aURI.Find(KNSmlDdfDefGW) >= 0 || + aURI.Find(KNSmlDdfNetworkMask) >= 0 || + aURI.Find(KNSmlDdfIPAddr) >= 0 || + aURI.Find(KNSmlDdfNAPAddrTy)>= 0 )) + { + // Get IAP nbr for servicetype + + TUint32 iapID2 = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* serviceView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + qDB, + iapID2); + + TBuf serviceType; + + TInt errorCode = serviceView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if ( errorCode == KErrNone ) + { + serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking + + serviceView->ReadUintL(TPtrC(IAP_SERVICE), iISPId); + + CleanupStack::PopAndDestroy(); // serviceView + } + else + { + CleanupStack::PopAndDestroy(); // serviceView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + qTable.Set(serviceType); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + qDB, + iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TBool serviceReLock = EFalse; + if(IsServiceRecordLockedL(iISPId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ( (CCommsDbProtectTableView*) tableView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + serviceReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + if(tableView->UpdateRecord()!=KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + if ( fType == CNSmlInternetAdapter::EInt) + { + TUint32 object32; + if (aURI.Find(KNSmlDdfGPRSPDP) >= 0 || /* GPRSPDP handling */ + aURI.Find(KNSmlDdfNAPAddrTy) >= 0) /* NAPAddrTy handling */ + { + if(aObject.MatchF(KNSmlDmApValIpv4) != KErrNotFound ) + { + object32 = RPacketContext::EPdpTypeIPv4; + } + else if (aObject.MatchF(KNSmlDmApValIpv6) != KErrNotFound ) + { + object32 = RPacketContext::EPdpTypeIPv6; + } + else if (aObject.MatchF(_L8("PPP")) != KErrNotFound ) + { + object32 = RPacketContext::EPdpTypePPP; + } + else + { // NotValid value + tableView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + } + else + { + object32 = GetIntObject8(aObject); + } + + tableView->WriteUintL(qColumn, object32); + } + else + { + // This should be executed only when executing buffered cmds + if(aURI.Find(KNSmlDdfDNSAddrL) >= 0 ) + // DNS address + { + TPtrC8 parentUri = RemoveLastSeg(aURI); + TInt dnsPri = 0; + TBool found = InitializeDNSParamsFromBuffL( parentUri, dnsPri ); + UriUtils::TUriHostType dnsAddrTy = UriUtils::HostType(aObject); + + if (!found ) + { + UriUtils::TUriHostType dnsLuidType; + TInt dnsLuidPriority; + if ( LuidToDns(dnsLuidType, dnsLuidPriority, parentLUID ) != KErrNone ) + { + if ( dnsAddrTy == UriUtils::EIPv4Host ) + { + iDnsIpv4Pri = (iDnsIpv4Pri % 2 ) + 1; + dnsPri = iDnsIpv4Pri; + } + else if ( dnsAddrTy == UriUtils::EIPv6Host ) + { + iDnsIpv6Pri = (iDnsIpv6Pri % 2 ) + 1; + dnsPri = iDnsIpv6Pri; + } + } + else + { + // update + dnsPri = dnsLuidPriority; + } + + } + if ( dnsPri != 0 ) + { + if ( dnsPri == 1) + { + if ( dnsAddrTy == UriUtils::EIPv4Host ) + { + qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER1 )); + } + else + { + qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER1 )); + + } + } + else + { + if ( dnsAddrTy == UriUtils::EIPv4Host ) + { + qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER2 )); + } + else + { + qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER2 )); + + } + } + tableView->WriteTextL(qColumn, ConvertTo16LC(aObject)); + pushed++; + TInt dnsLuid = DnsToLuid( dnsAddrTy, dnsPri); + iCallBack->SetMappingL(parentUri, SetIntObjectLC( dnsLuid )); + pushed++; + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + + } + + else + { + if(( serviceType == TPtrC( LAN_SERVICE ) ) && (iField->Compare(KNSmlDdfNAPAddr) == 0 ) ) + { + if(!IsValidIPv4AddressL(aObject)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EInvalidObject); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EInvalidObject end"); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + return; + } + + } + tableView->WriteTextL(qColumn, ConvertTo16LC(aObject)); + pushed++; + + } + // DNSAddrL <> 0.0.0.0 or empty => + if(aURI.Find(KNSmlDdfDNSAddrL) >= 0 ) /* DNS serviceFlag handling */ + { + if( aObject.Match(_L8("fec0:0:0:ffff::1")) == KErrNotFound || + aObject.Match(_L8("fec0:0:0:ffff::2")) == KErrNotFound ) + { + tableView->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),EFalse); + } + else + { + tableView->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),ETrue); + } + + + } + } + TInt putOk = tableView->PutRecordChanges(); + if ( putOk != KErrNone ) + { + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && putOk == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + putOk = tableView->PutRecordChanges(); + retry--; + } + if(putOk != KErrNone) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + DBG_ARGS(_S16("CNSmlInternetAdapter::AddLeafObjectL(): Update failed with Code %d"),putOk); + return; + } + } + if (aURI.Find(KNSmlDdfNAPName) >= 0 && + aURI.Find(KNSmlDdfAuthName) <= 0 ) /* NAPName */ + { + if(UpdateIAPnameL(iapID2,aObject) != KErrNone ) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + } + if(serviceReLock) + { + TInt reclockerr = DoProtectServiceRecordL(iISPId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + serviceReLock = EFalse; + } + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + + CleanupStack::PopAndDestroy(); // tableView + } + + } + else if (fType == CNSmlInternetAdapter::EBool) + { // UseCB + UseIPSec + TUint32 iapID3 = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* boolView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapID3); + TInt errorCode = boolView->GotoFirstRecord(); + + TBuf serviceType; + + errorCode = boolView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if ( errorCode == KErrNone ) + { + boolView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + boolView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking + boolView->ReadUintL(TPtrC(IAP_SERVICE), iISPId); + } + else + { + CleanupStack::PopAndDestroy(); // boolView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + + CleanupStack::PopAndDestroy(); // boolView + + qTable.Set(serviceType); + TBool ret = GetAPField(qTable,qColumn); + if(!ret) + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EInvalidObject); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EInvalidObject end"); + return; + } + + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + TPtrC(COMMDB_ID), + iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TBool serviceReLock = EFalse; + if(IsServiceRecordLockedL(iISPId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ( (CCommsDbProtectTableView*) tableView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + serviceReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if(tableView->UpdateRecord()!=KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + TBool tObject = EFalse; + + if(aObject.CompareF(KNSmlDmApValTrue) == 0) + { + tObject = ETrue; + } + if(aURI.Right(10).Compare(KNSmlDdfUsePTxtLog)==0) + { + tObject=!tObject; + } + if( qColumn.Match(TPtrC(SERVICE_IP_ADDR_FROM_SERVER)) != KErrNotFound ) + { + if ( serviceType == TPtrC( LAN_SERVICE ) ) // Is WLAN service + { + if( tObject ) + { + tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), + KDaemonManagerName ); + tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), + KConfigDaemonName ); + } + else + { + tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KNullDesC ); + tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), KNullDesC ); + } + } + } // Is WLAN service + + tableView->WriteBoolL(qColumn, tObject ); + tableView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + if(serviceReLock) + { + TInt reclockerr = DoProtectServiceRecordL(iISPId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ServiceRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + serviceReLock = EFalse; + } + } + else + { + tableView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else if (fType == CNSmlInternetAdapter::EInt) + { // UsePTxtLog + PortNbr + seamlessness and metadata + iObject = GetIntObject8(aObject); + + if(aURI.Find(KNSmlDdfIAPSeamlessness) >= 0 ) + { + // TUint32 setSeam = GetIntObject8(aObject); + TUint32 apMetaID = GetAPIdFromURIL(aURI); + SetIAPSeamlessnessL(apMetaID,iObject,aStatusRef); + return; + } + + else if (aURI.Find(KNSmlDdfIAPMetaData) >= 0) + { + // TUint32 setMeta = GetIntObject8(aObject); + TUint32 apMetaID = GetAPIdFromURIL(aURI); + SetIAPMetaDataL(apMetaID,iObject,aStatusRef); + return; + } + + + if (aURI.Find(KNSmlDdfUsePTxtLog) >= 0) + { + TUint32 iapID4 = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapView4 = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapID4); + TInt errorCode = iapView4->GotoFirstRecord(); + + TBuf serviceType; + + errorCode = iapView4->GotoFirstRecord(); + + // Read serviceType from (IAP) + if ( errorCode == KErrNone ) + { + iapView4->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + iapView4->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking + iapView4->ReadUintL(TPtrC(IAP_SERVICE), iISPId); + CleanupStack::PopAndDestroy(); // iapView4 + } + else + { + CleanupStack::PopAndDestroy(); // iapView4 + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + TPtrC(COMMDB_ID), + iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TBool serviceReLock = EFalse; + if(IsServiceRecordLockedL(iISPId)) + { + + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ( (CCommsDbProtectTableView*) tableView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + serviceReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if(tableView->UpdateRecord()!=KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + TBool tObject = EFalse; + if(iObject) + { + tObject = ETrue; // <> 0 + } + tableView->WriteBoolL(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH), tObject ); + tableView->PutRecordChanges(); + if(serviceReLock) + { + DoProtectIAPRecordL(iapID4,ETrue); + TInt reclockerr = DoProtectServiceRecordL(iISPId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ServiceRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + serviceReLock = EFalse; + } + CleanupStack::PopAndDestroy(); // tableView + } + else + { + tableView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else if (aURI.Find(KNSmlDdfPortNbr) >= 0) + { + if(GetProxyIdL(aURI)) + { + iProxyISP = GetAPIdFromURIL(aURI); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + iProxyId); + TInt errorCode = tableView->GotoFirstRecord(); + TBool proxyReLock = EFalse; + // Read all columns needed. + if ( errorCode == KErrNone ) + { + if(IsProxyRecordLockedL(iProxyId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): proxy record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy Record returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + proxyReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if(tableView->UpdateRecord()!=KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + iObject = GetIntObject8(aObject); + + tableView->WriteUintL(TPtrC(PROXY_PORT_NUMBER), iObject); + } + tableView->PutRecordChanges(); + if(proxyReLock) + { + TInt reclockerr = DoProtectProxyRecordL(iProxyId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy Record returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + proxyReLock = EFalse; + } + CleanupStack::PopAndDestroy(); // tableView + } + else + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): PortNbr Error end"); + return; + } + } + else + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): PortNbr Error end"); + return; + } + + } + + else if (fType == CNSmlInternetAdapter::EWap) + { // Startpg + PxAuthId + PxAuthPW (WAP-settings) (BasAuthId + BasAuthPW) + TUint32 iapID5 = GetAPIdFromURIL(aURI); + // + // Without iapID5 no insert possible, set on buffer + // + if(iapID5 < 1) + { + AddLeafBufferL(aURI,aParentLUID,aObject,aType,aStatusRef); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); + return; + } + + GetAPField(qTable,qColumn); + if(WapAPExistsL(iapID5)) + { // Update handled + TBool iapReLock = EFalse; + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce=EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if(eError==KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + if(IsIAPRecordLockedL(iapID5)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = DoProtectIAPRecordL(iapID5,EFalse); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + CCommsDbTableView* wapView; + TBool wapaccesspointTableLocked = EFalse; + + if(qColumn == TPtrC(WAP_START_PAGE)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): record to be added WAP_START_PAGE, check for lock status"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL Get WapAccessPoint record access for ID = %d"),iWapId); + if(IsWAPAccessPointRecordLockedL(iWapId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record is LOCKED"); + TInt reclockerr = DoProtectWAPAccessRecordL(iWapId,EFalse); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + wapaccesspointTableLocked = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record is not write protected"); + } + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + iWapId); + pushed++; + } + else // Other WAP-data + { + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_IP_BEARER), + TPtrC(WAP_ACCESS_POINT_ID), + iWapId); + pushed++; + } + + TInt errorCode = wapView->GotoFirstRecord(); + + // Read all columns needed. + if ( errorCode == KErrNone ) + { + if(wapView->UpdateRecord()!=KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Wapview Update failed end"); + if(wapaccesspointTableLocked) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record to be locked again "); + DoProtectWAPAccessRecordL(iWapId,ETrue); + wapaccesspointTableLocked = EFalse; + } + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + return; + } + + if(qColumn == TPtrC(WAP_PROXY_PORT)) + { + TBool security = EFalse; // => 9200 + 9201, ETrue 9202 + 9203 + TUint32 object32; + TPtrC object16 = ConvertTo16LC(aObject); + pushed++; + if(object16.Match(KWappPort9200) != KErrNotFound ) + { + object32 = KWAPP_PORT_9200; // wappdef.h + } + else if(object16.Match(KWappPort9201) != KErrNotFound ) + { + object32 = KWAPP_PORT_9201; + } + else if(object16.Match(KWappPort9202) != KErrNotFound ) + { + object32 = KWAPP_PORT_9202; + security = ETrue; + } + else if(object16.Match(KWappPort9203) != KErrNotFound ) + { + object32 = KWAPP_PORT_9203; + security = ETrue; + } + else + { + wapView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + return; + } + wapView->WriteUintL(qColumn, object32); + wapView->WriteBoolL(TPtrC(WAP_SECURITY), security ); + } + else + { + wapView->WriteTextL(TPtrC(qColumn),ConvertTo16LC(aObject)); + pushed++; + } + } + wapView->PutRecordChanges(); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record Changes DONE successfully "); + if(wapaccesspointTableLocked) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record to be locked again "); + TInt reclockerr = DoProtectWAPAccessRecordL(iWapId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,Protecting WAPAccessRecord %d , returned code = %d"),iWapId,reclockerr); + wapaccesspointTableLocked = EFalse; + } + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + CleanupStack::PopAndDestroy(pushed); + pushed = 0; + } + else + { // Insert handled + CCommsDbTableView* insView; + TInt wapInitOK = KErrCancel; + TBool iapReLock = EFalse; + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce=EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if(eError==KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + insView = iDatabase->OpenTableLC(TPtrC(WAP_ACCESS_POINT)); + iWapId = 0; + wapInitOK = insView->InsertRecord(iWapId); + if(wapInitOK == KErrNone) + { + iWAPAccessPoint.Zero(); + iWapUserName.Zero(); + iWapPassword.Zero(); + + if(qColumn == TPtrC(WAP_START_PAGE)) + { + iWAPAccessPoint = aObject; + } + else if(qColumn == TPtrC(WAP_PROXY_LOGIN_NAME)) + { + iWapUserName = aObject; + } + else if(qColumn == TPtrC(WAP_PROXY_LOGIN_PASS)) + { + iWapPassword = aObject; + } + + iWapBearer = TPtrC(WAP_IP_BEARER); + iWapName = FirstURISeg(aURI); // Name needed !!! + + wapInitOK = InitializeWAPIAPL( insView, iIAPName ); + if( wapInitOK == KErrNone ) + { + insView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // insView + + CCommsDbTableView* updView; + TUint32 iWapId2 = 0; + iISPId = iapID5; // IAP number set + updView = iDatabase->OpenTableLC(TPtrC(WAP_IP_BEARER)); + if(updView->InsertRecord(iWapId2) == KErrNone ) + { + wapInitOK = InitializeWAPL( updView ); + } + else + { + wapInitOK = KErrGeneral; + } + if( wapInitOK == KErrNone ) + { + if( !PxExistsL(iapID5) ) + { + + // Set mapping-data + + TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfStartpg); + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,iapID5); + iCallBack->SetMappingL(addURI,addLUID); + } + else if( !NAPDefExistsL(iapID5) ) + { + + // Set mapping-data + + TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfStartpg); + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,iapID5); + iCallBack->SetMappingL(addURI,addLUID); + } + + updView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // updView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); + return; + } + else + { + CleanupStack::PopAndDestroy(); // updView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else + { + insView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // insView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else + { + CleanupStack::PopAndDestroy(); // insView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + } + else if ( fType == CNSmlInternetAdapter::ESpec ) + { // BearerL + NoPxForL + IAPService + Direction + if (aURI.Find(KNSmlDdfDirection) >= 0) + { + _LIT8(KDirection,"Outgoing"); + if(KDirection().Find(aObject) != KErrNotFound) + { + iDirection = ECommDbConnectionDirectionOutgoing; + } + else + { + iDirection = ECommDbConnectionDirectionIncoming; + if(iBearer == TPtrC(OUTGOING_GPRS)) + { + iBearer = TPtrC(INCOMING_GPRS); + } + } + } + else if (aURI.Find(KNSmlDdfIAPService) >= 0) + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + else if (aURI.Find(KNSmlDdfNoPxForL) >= 0) /* No proxies used field handling */ + { + TBool proxyFound = GetProxyIdL(aURI); + if(!proxyFound) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + CleanupStack::PopAndDestroy(pushed); + return; + } + + CCommsDbTableView* specView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + iProxyId); + TInt errorCode = specView->GotoFirstRecord(); + + + if ( errorCode == KErrNone ) + { + TBool proxyReLock = EFalse; + if(IsProxyRecordLockedL(iProxyId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)specView)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + proxyReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if(specView->UpdateRecord()==KErrNone) + { + //database not locked + specView->WriteLongTextL(TPtrC(PROXY_EXCEPTIONS), ConvertTo16LC(aObject)); + specView->PutRecordChanges(); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + CleanupStack::PopAndDestroy(); // ConvertTo16LC + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + if(proxyReLock) + { + TInt reclockerr = DoProtectProxyRecordL(iProxyId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + proxyReLock = EFalse; + } + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + CleanupStack::PopAndDestroy(); // specView + + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + else if (aURI.Find(KNSmlDdfBearerL) >= 0) /* Bearer handling */ + { + if (aObject.Match(KNSmlDmApValGsmGprs) != KErrNotFound) + { + if(iDirection == ECommDbConnectionDirectionIncoming) + { + iBearer = TPtrC(INCOMING_GPRS); + } + else + { + iBearer = TPtrC(OUTGOING_GPRS); + } + } + + else if (aObject.Match(KNSmlDmApVal3Gppps) != KErrNotFound) + { + i3GPPPS = ETrue; + if(iDirection == ECommDbConnectionDirectionIncoming) + { + iBearer = TPtrC(INCOMING_GPRS); + } + else + { + iBearer = TPtrC(OUTGOING_GPRS); + } + } + else if (aObject.Match(KNSmlDmApValVpn) != KErrNotFound) + { + iBearer = TPtrC(VPN_SERVICE); + } + else if ( (aObject.Match(KNSmlDmApValWlan) != KErrNotFound ) + && iWlanSupported ) + { + iBearer = TPtrC(LAN_SERVICE); + } + else + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): UNKNOWN Bearer Error end"); + return; + } + } + else if (aURI.Find( KNSmlDdfNAPName ) >= 0) + { + iIAPName.Copy( aObject ); + TUint32 iapID2 = GetAPIdFromURIL(aURI); + if( iapID2 > 0 && UpdateIAPnameL(iapID2,aObject) != KErrNone ) + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + return; + } + } + } + + CleanupStack::PopAndDestroy(pushed); + pushed = 0; + +// Update CommsDB IAP + insert iBearer Table + + if( IsInsertAllowedL() && iLeafType == EDMAdd && fType == CNSmlInternetAdapter::ESpec) //iIAPExists + { + TInt initOK = KErrCancel; + + iISPId = GetMaxIdL() + 1; // For new data + + SaveIAPDataL(aURI); // Level 1 Mapping inside + + CCommsDbTableView* newAPView; + + newAPView = iDatabase->OpenTableLC(iBearer); + // 3GPPPS = OUTGOING/INCOMING_GPRS + if (iBearer == TPtrC(OUTGOING_GPRS) || + iBearer == TPtrC(INCOMING_GPRS)) + { + if(newAPView->InsertRecord(iISPId)==KErrNone) + { + initOK = InitializeGPRSL(newAPView); + } + else + { + initOK = KErrGeneral; + } + } + + else if(iBearer == TPtrC(VPN_SERVICE) ) + { + if(newAPView->InsertRecord(iISPId)==KErrNone) + { + initOK = InitializeVPNServiceL(newAPView); + } + else + { + initOK = KErrGeneral; + } + } + else if( ( iBearer == TPtrC(LAN_SERVICE) ) && iWlanSupported ) + { + if(newAPView->InsertRecord(iISPId)==KErrNone) + { + initOK = InitializeLANServiceL(newAPView); + } + else + { + initOK = KErrGeneral; + } + } + else + { + initOK = KErrCancel; + } + + if ( initOK == KErrNone) + { + TUint32 newId = 0; + newAPView->PutRecordChanges(); + newAPView->ReadUintL(TPtrC(COMMDB_ID), newId); + + // To update right Id + + iISPId = newId; + + SaveIAPDataL(aURI); + + TUint32 iapID2 = GetAPIdFromURIL(aURI); + UpdateIAPnameL( iapID2, iIAPName ); + // + // Set mapping-data (levels 2 and 3 ) + // + TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfNAPDef); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,newId); + + // Also NAPDef (level 2) + iCallBack->SetMappingL(addURI,addLUID); + DBG_ARGS8(_S8("AP:level2 URI - <%S> <%S> <%d>"), &addURI, &addLUID, newId ); + + // Also BearerL (level 3) + TPtrC8 addURI2 = GetAddURISeg(aURI,KNSmlDdfBearer); + if ( i3GPPPS ) + { + newId = KNSmlAp3gpppsLowerBase+newId; + addLUID.Format(KFormat,newId); + i3GPPPS = EFalse; + } + iCallBack->SetMappingL(addURI2,addLUID); + DBG_ARGS8(_S8("AP:level3 URI - <%S> <%S> <%d>"), &addURI2, &addLUID, newId ); + } + else + { + if(initOK==KErrCancel) + { + newAPView->CancelRecordChanges(); + } + CleanupStack::PopAndDestroy(newAPView); + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + + CleanupStack::PopAndDestroy(newAPView); + } + else if(IsInsertAllowedL() && + iLeafType == EDMAdd && + aURI.Find(KNSmlDdfBearerL) >= 0 ) + + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EAlreadyExists BearerL end"); + return; + } + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): OK end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): begin"); + + DBG_ARGS8(_S8("AP:update aURI UpdateLeafObjectL - %S - %S"), &aURI, &aLUID); + DBG_ARGS8(_S8("AP:Object %S"), &aObject); + if( iTransactionCommitted ) + { + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("UpdateLeafObjectL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("UpdateLeafObjectL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + iTransactionCommitted = EFalse; + } + if ( ( aURI.Match(_L8("*/WLAN*" )) != KErrNotFound ) && iWlanSupported ) + { + AddLeafBufferL( aURI, aLUID, aObject, aType, aStatusRef, ETrue ); + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): WLAN end"); + + return; + } +// +// No direct update allowed only update as add +// + if( aLUID.Length() > 0 && + aURI.Find(KNSmlDdfNAPDef) >= 0 ) + /*( aURI.Find(KNSmlDdfBearerL) >= 0 || + aURI.Find(KNSmlDdfDirection) >= 0 || + aURI.Find(KNSmlDdfNAPName) >= 0 ) */ + { + _DBG_FILE("Bearer | direction CNSmlInternetAdapter::UpdatelaefObject ( ): EError end"); + + AddLeafBufferL( aURI, aLUID, aObject, aType, aStatusRef, EFalse ); + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + return; + } + + iLeafType = EDMUpdate; + + TRAP_IGNORE(AddLeafObjectL( aURI, aLUID, aObject, aType , aStatusRef )); + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; +// +// If try to update field that has value which is not default errorvalue should be returned +// + iLeafType = EDMUnset; + + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): end"); + + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(RWriteStream): begin"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(RWriteStream): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::DeleteObjectL( const TDesC& aURI, const TDesC& aLUID, +// const TInt aStatusRef ) +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): begin"); + if( iTransactionCommitted ) + { + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("DeleteObjectL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteObjectL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + iTransactionCommitted = EFalse; + } + + if( ( aURI.Match( _L8( "AP/*/NAPDef/*/WLAN/*" ) ) != KErrNotFound ) && iWlanSupported ) + { + iWlanAdapter->DeleteObjectL( aURI, aLUID, aStatusRef ); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): end"); + return; + } + +// +// Check which field going to be handled +// + SetField(aURI); + + iLUID = IntLUID(aLUID); + + TUint32 checkLUID = IntLUID(aLUID); +// +// Check which kind node to be deleted (Leaf delete not supported) +// + if( aURI.Match(_L8("AP/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/*"))== KErrNotFound ) + { + // Check if AP exists + if(!APExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if(DeleteAPL(checkLUID)) + { + iPrevURI->Des().Format( KNullDesC8 ); + iPrevLUID = 0; + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + else + { + iPrevURI->Des().Format( KNullDesC8 ); + iPrevLUID = 0; + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EError end"); + return; + } + } + + if (aURI.Match(_L8("AP/*/Px/*/Startpg" ))!= KErrNotFound) //Key for WAP-delete + { + // Check if WAPAp exists + if(!WapAPExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if(DeleteWapAPL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EError end"); + return; + } + } + + if (aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NAPDef/*/*"))== KErrNotFound ) + { + // Check if NAPDef exists + if(!NAPDefExistsL(checkLUID )) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if(DeleteNAPDefL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + } + + if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Px/*/*"))== KErrNotFound ) + { + // Check if PX exists + if(!PxExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if(DeleteProxyL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + } + + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::FetchLeafObjectSizeL() +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectSizeL(): begin"); + + DBG_ARGS8(_S8("AP:Fetch aURI - %S - %S"), &aURI, &aLUID); + CBufBase *lObject = CBufFlat::NewL(128); + CleanupStack::PushL(lObject); + + // call to internal fetchleafobj. + CSmlDmAdapter::TError status = FetchLeafObjectL( aURI, aLUID, aType, *lObject ); + + if ( status == CSmlDmAdapter::EOk ) + { + lObject->Compress(); + TBuf8<8> size; + size.Num( lObject->Size() ); + lObject->Reset(); + lObject->InsertL(0, size ); + iCallBack->SetResultsL(aResultsRef, *lObject, aType); + } + iCallBack->SetStatusL(aStatusRef, status); + + CleanupStack::PopAndDestroy(lObject); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectSizeL(): end"); + + return; + } + + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::FetchLeafObjectL() +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(): begin"); + + DBG_ARGS8(_S8("AP:Fetch aURI - %S - %S"), &aURI, &aLUID); + CBufBase *lObject = CBufFlat::NewL(128); + CleanupStack::PushL(lObject); + + // Add call to internal fetchleafobj + CSmlDmAdapter::TError status = FetchLeafObjectL( aURI, aLUID, aType, *lObject ); + if ( status == CSmlDmAdapter::EOk ) + { + iCallBack->SetResultsL(aResultsRef,*lObject,aType); + } + iCallBack->SetStatusL(aStatusRef, status); + + CleanupStack::PopAndDestroy(); //lObject + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(): end"); + return; + } + + + +//------------------------------------------------------------------------------ +// CSmlDmInternetAdapter::FetchLeafObjectL() +//------------------------------------------------------------------------------ + +CSmlDmAdapter::TError CNSmlInternetAdapter::FetchLeafObjectL( + const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + CBufBase& aObject ) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): begin"); + + TInt pushed = 0; + TUint32 iapID = 0; + TBool treeConstructed(EFalse); + // + // If no proxy no fetch allowed + // + if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound) + { + if(!GetProxyIdL(aURI)) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + if(!iLUID) + iLUID = IntLUID(aLUID); + + iapID = GetAPIdFromURIL(aURI); + + if( iapID == 0 ) + { + if( IsAPUriFormatMatchPredefined(aURI) ) + { + iLUID = ConstructTreeL(aURI); + iapID = GetAPIdFromURIL(aURI); + treeConstructed = ETrue; + } + + } + // Check if values for Given LUID + if (!iLUID + && (!IsWLANfield( aURI ) || !iWlanSupported) ) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } +// +// Check which field going to be handled +// + SetField(aURI); + + aObject.Reset(); + +//Linger value + if((iField->Compare(KNSmlDdfNAPLinger) == 0)) + { + TInt lingerInterval; + TRAPD (err, GetLingerL( iapID, lingerInterval )); + if(err == KErrNotFound) + { + + return CSmlDmAdapter::ENotFound; + } + else if( err !=KErrNone) + { + + return CSmlDmAdapter::EError; + + } + else + { + TBuf<10> slinger; + slinger.AppendNum(lingerInterval); + + aObject.InsertL(aObject.Size(),ConvertTo8LC(slinger)); + CleanupStack::PopAndDestroy(); + return CSmlDmAdapter::EOk; + } + } + TPtrC qTable = TPtrC(KNullDesC); + TPtrC qColumn = TPtrC(KNullDesC); + TPtrC qDB = TPtrC(COMMDB_ID); + + if(aURI.Find(KNSmlDdfPortNbr) >= 0) // Check if WAP or PROXY port asked + { + _LIT8( KWap, "/WAP" ); + if(aURI.Find(KWap) >= 0) + { + iWapPort = ETrue; + } + else + { + iWapPort = EFalse; + } + } + + + if ( iWlanSupported ) + { + TBool wLANfield = IsWLANfield(aURI); + if(wLANfield) + { + // + // WLAN-adapter handles all WLAN fields + // + return iWlanAdapter->FetchLeafObjectL(aURI, aLUID, aType, aObject); + } + } + +// +// Get Database field type +// + TInt fType = GetAPFieldType( aURI ); + + if (fType == EWrong) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + } +// + iISPId = iLUID; +// +// IAP-table search serviceType (=Bearer) + + CCommsDbTableView* serviceView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + qDB, + iapID); + + TBuf serviceType; + TUint32 serviceId = 0; + + TInt errorCode = serviceView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if ( errorCode == KErrNone ) + { + serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + serviceView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); + CleanupStack::PopAndDestroy(); // serviceView + } + else + { + CleanupStack::PopAndDestroy(); // serviceView + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + qTable.Set(serviceType); + + TBool allowed = GetAPField(qTable,qColumn); + + if(!allowed) + { + if( aURI.Find(KNSmlDdfNAPAddrTy) >= 0) /* NAPAddrTy handling */ + { + if (serviceType == TPtrC(OUTGOING_GPRS) || + serviceType == TPtrC(INCOMING_GPRS)) + { + _LIT8( KApn, "APN" ); + aObject.InsertL(aObject.Size(), KApn ); + + } + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + + } + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): FieldNot allowed"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EError; + } + + if (fType == CNSmlInternetAdapter::EStr) + { // Name + NAPAddr + DNSAddrL + if(aURI.Match(_L8("AP/*/Networks/*/Name"))!= KErrNotFound ) // Networks-name + { + TUint32 iapID8 = IntLUID(aLUID); + + // IAP-table NetworkId Fetch + CCommsDbTableView* networkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapID8); + networkView->GotoFirstRecord(); + TRAPD(leavecode,networkView->ReadUintL(TPtrC(IAP_NETWORK), iISPId)); + CleanupStack::PopAndDestroy(); // networkView + if(leavecode != 0) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK), + TPtrC(COMMDB_ID), + iISPId); + + errorCode = tableView->GotoFirstRecord(); + + + if ( errorCode == KErrNone ) + { + TBuf columnValue; + + tableView->ReadTextL(qColumn, columnValue); + + aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); + pushed++; + } + else + { + CleanupStack::PopAndDestroy(); // tableView + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + } + else if(aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || // ProxyName + aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound || // ProxyAddr + aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) // DomainL (PROXY_PROTOCOL_NAME) + { + CCommsDbTableView* proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + iProxyId); + + errorCode = proxyView->GotoFirstRecord(); + + + if ( errorCode == KErrNone ) + { + if(aURI.Match(_L8("AP/*/Px/*/DomainL"))!= KErrNotFound) + { + TBuf columnValue; + + proxyView->ReadTextL(TPtrC(PROXY_PROTOCOL_NAME), columnValue); + + aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); + pushed++; + } + + else if(aURI.Match(_L8("AP/*/Px/*/PxAddr"))!= KErrNotFound) + { + HBufC* serverName = proxyView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME)); + pushed++; + + aObject.InsertL(aObject.Size(),ConvertTo8LC(*serverName)); + pushed++; + } + } + else + { + CleanupStack::PopAndDestroy(); // proxyView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + qDB, + serviceId); + + errorCode = tableView->GotoFirstRecord(); + + + if ( errorCode == KErrNone ) + { + if ( aURI.Find(KNSmlDdfDNSPriority) >= 0) /* DNSPriority */ + { + UriUtils::TUriHostType theType; + TInt dnsPri; + + // This resets iLUID to match aLUID, which is needed in this case. + // Otherwise iLUID has a different value + if(!treeConstructed) + iLUID = IntLUID(aLUID); + + if ( LuidToDns( theType, dnsPri, iLUID ) == KErrNone ) + { + if ( dnsPri == 1 ) + { + aObject.InsertL( aObject.Size(), KNSmlFirstDNSPri ); + } + else + { + aObject.InsertL( aObject.Size(), KNSmlSecondDNSPri ); + } + } + else + { + CleanupStack::PopAndDestroy(tableView); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else if ( aURI.Find(KNSmlDdfDNSAddrTy) >= 0) /* DNSAddrTy */ + { + UriUtils::TUriHostType theType; + TInt dnsPri; + // This resets iLUID to match aLUID, which is needed in this case. + // Otherwise iLUID has a different value + if(!treeConstructed) + iLUID = IntLUID(aLUID); + if ( LuidToDns( theType, dnsPri, iLUID ) == KErrNone ) + { + if ( theType == UriUtils::EIPv4Host) + { + aObject.InsertL( aObject.Size(), KNSmlDNSIp ); + } + else + { + aObject.InsertL( aObject.Size(), KNSmlDNSIp6 ); + } + } + else + { + CleanupStack::PopAndDestroy(tableView); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else + { + TBuf columnValue; + if ( aURI.Find(KNSmlDdfDNSAddrL ) >= 0) + { + UriUtils::TUriHostType theType; + TInt dnsPri; + + // This resets iLUID to match aLUID, which is needed in this case. + // Otherwise iLUID has a different value + if(!treeConstructed) + iLUID = IntLUID(aLUID); + if ( LuidToDns( theType, dnsPri, iLUID ) == KErrNone ) + { + if ( dnsPri == 1) + { + if ( theType == UriUtils::EIPv4Host ) + { + qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER1 )); + } + else + { + qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER1 )); + + } + } + else + { + if ( theType == UriUtils::EIPv4Host ) + { + qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER2 )); + } + else + { + qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER2 )); + + } + } + } + else + { + CleanupStack::PopAndDestroy(tableView); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + TRAPD(leavecode,tableView->ReadTextL(qColumn, columnValue)); + if(leavecode != 0) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); + pushed++; + } + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + CleanupStack::PopAndDestroy(); // tableView + } + else if (fType == CNSmlInternetAdapter::EBool) + { // UseCB + CCommsDbTableView* boolView = iDatabase->OpenViewMatchingUintLC(serviceType, + qDB, + serviceId); + + errorCode = boolView->GotoFirstRecord(); + + TBool objectBool = EFalse; + if ( errorCode == KErrNone ) + { + TRAPD(leavecode,boolView->ReadBoolL(qColumn,objectBool )); + if(leavecode == KErrUnknown ) // value is null + { + } + } + else + { + CleanupStack::PopAndDestroy(); // boolView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + } + + if (objectBool) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValTrue); + } + else + { + aObject.InsertL(aObject.Size(),KNSmlDmApValFalse); + } + + CleanupStack::PopAndDestroy(); // boolView + } + else if (fType == CNSmlInternetAdapter::EInt) + { // NAPId +Bearer + NAPAddrTy + PxID + PortNbr + UsePTxtLog + // CBTy + LnkSpeed + + if(aURI.Match(_L8("AP/*/Px/*/PxID"))!= KErrNotFound ) + { + aObject.InsertL(aObject.Size(),SetIntObjectLC(iISPId)); + pushed++; + } + + else if (aURI.Find(KNSmlDdfIAPSeamlessness) >= 0 ) /* Seamlessness handling */ + { + TInt seam = GetIAPSeamlessnessL(iapID); + aObject.InsertL(aObject.Size(),SetIntObjectLC(seam)); + pushed++; + } + else if(aURI.Find(KNSmlDdfIAPMetaData) >= 0) + { + TInt meta = GetIAPMetaDataL(iapID); + aObject.InsertL(aObject.Size(),SetIntObjectLC(meta)); + pushed++; + } + + else if(aURI.Match(_L8("AP/*/Networks/*/ID"))!= KErrNotFound ) + { + + iISPId= IntLUID(aLUID); + + CCommsDbTableView* nwidView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iISPId); + nwidView->GotoFirstRecord(); + nwidView->ReadUintL(TPtrC(IAP_NETWORK), iISPId); + CleanupStack::PopAndDestroy(); // nwidView + + aObject.InsertL(aObject.Size(),SetIntObjectLC(iISPId)); + pushed++; + } + else if(aURI.Match(_L8("AP/*/Px/*/PortNbr"))!= KErrNotFound ) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): PortNbr"); + DBG_ARGS8(_S8("iISPId = %d "), iISPId ); + DBG_ARGS8(_S8("proxyid = %d "), iProxyId ); + CCommsDbTableView* portView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + iProxyId); + + errorCode = portView->GotoFirstRecord(); + + + if ( errorCode == KErrNone ) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): Portview opened"); + TUint32 object32=0; + + TRAPD(leavecode,portView->ReadUintL(qColumn,object32 )); + if(leavecode == KErrNone) + { + aObject.InsertL(aObject.Size(),SetIntObjectLC(object32)); + pushed++; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): db read failed"); + CleanupStack::PopAndDestroy(); // portView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + } + } + else + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): Portview opening failed"); + CleanupStack::PopAndDestroy(); // portView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // portView + } + else if(aURI.Match(_L8("AP/*/NAPID"))!= KErrNotFound || + aURI.Match(_L8("AP/*/ToNAPIDL"))!= KErrNotFound ) + { + iObject = iapID; + TPtrC8 napidUri = FirstURISeg(aURI); + aObject.InsertL(aObject.Size(),napidUri); + + } + else + { + iObject = 0; + + CCommsDbTableView* colView = iDatabase->OpenViewMatchingUintLC(serviceType, + qDB, + serviceId); + + errorCode = colView->GotoFirstRecord(); + + TUint32 object32 = 0; + if ( errorCode == KErrNone ) + { + if(aURI.Find(KNSmlDdfUsePTxtLog) >= 0) + { + TBool objectBool = EFalse; + TRAPD(leavecode,colView->ReadBoolL(qColumn,objectBool )); + errorCode = leavecode; + object32 = objectBool; + } + else + { + TRAPD(leavecode,colView->ReadUintL(qColumn,object32 )); + errorCode = leavecode; + } + } + + if ( errorCode == KErrNone ) + { + + if (aURI.Find(KNSmlDdfNAPAddrTy) >= 0 || /* NAPAddrTy handling */ + aURI.Find(KNSmlDdfGPRSPDP) >= 0) /* NAPAddrTy handling */ + { + if(object32 == RPacketContext::EPdpTypeIPv4) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValIpv4); + } + else if (object32 == RPacketContext::EPdpTypeIPv6) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValIpv6); + } + else if (object32 == RPacketContext::EPdpTypePPP) + { + _LIT8( KPpp, "PPP" ); + aObject.InsertL(aObject.Size(),KPpp); + } + else + { + aObject.InsertL(aObject.Size(),KNullDesC8); + } + } + else + { + aObject.InsertL(aObject.Size(),SetIntObjectLC(object32)); + pushed++; + } + } + else + { + CleanupStack::PopAndDestroy(); // colView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // colView + } + } + + else if (fType == CNSmlInternetAdapter::EWap) + { // Startpg + PxAuthId + PxAuthPW + PortNbr (BasAuthId + BasAuthPW) + CCommsDbTableView* wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_IP_BEARER), + TPtrC(WAP_IAP), + iapID); + + errorCode = wapView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TBuf columnValue; + + if(qColumn == TPtrC(WAP_START_PAGE)) + { + TRAPD(leavecode,wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId)); + CleanupStack::PopAndDestroy(); // wapView + if(leavecode != KErrNone) + { + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + + } + + CCommsDbTableView* wapView2 = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + iWapId); + + errorCode = wapView2->GotoFirstRecord(); + if ( errorCode != KErrNone ) + { + CleanupStack::PopAndDestroy(); // wapView2 + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + + HBufC* tmpVal = wapView2->ReadLongTextLC( qColumn ); + + aObject.InsertL(aObject.Size(),ConvertTo8LC(tmpVal->Des())); + CleanupStack::PopAndDestroy(); // ReadLongTextLC + CleanupStack::PopAndDestroy(); // wapView2 + pushed++; + } + else + { + if(qColumn == TPtrC(WAP_PROXY_PORT)) + { + TUint32 object32; + wapView->ReadUintL(qColumn, object32); + if(object32 == KWAPP_PORT_9200) // wappdef.h + { + aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9200)); + } + else if(object32 == KWAPP_PORT_9201) + { + aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9201)); + } + else if(object32 == KWAPP_PORT_9202) + { + aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9202)); + } + else if(object32 == KWAPP_PORT_9203) + { + aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9203)); + } + else + { + CleanupStack::PopAndDestroy(); // wapView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + + pushed++; + } + else + { + wapView->ReadTextL(qColumn, columnValue); + aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); + pushed++; + } + CleanupStack::PopAndDestroy(); // wapView + } + } + else + { + CleanupStack::PopAndDestroy(); // wapView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else if (fType == CNSmlInternetAdapter::ESpec) + { + // name + if ( aURI.Find( KNSmlDdfNAPName ) >= 0 ) + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + qDB, + serviceId); + + errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TBuf columnValue; + TRAPD(leavecode,tableView->ReadTextL(qColumn, columnValue)); + if(leavecode != 0) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); + pushed++; + } + CleanupStack::PopAndDestroy(); // tableView + } + // BearerL + NoPxForL + IAPService + else if (aURI.Find(KNSmlDdfIAPService) >= 0) + { + aObject.InsertL(aObject.Size(),SetIntObjectLC(serviceId)); + pushed++; + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EOk end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + } + else if (aURI.Find(KNSmlDdfNoPxForL) >= 0) /* No proxies used handling */ + { + TBool proxyFound = GetProxyIdL(aURI); + if(!proxyFound) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + + CCommsDbTableView* exeptionView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + iProxyId); + errorCode = exeptionView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + HBufC* proxyExceptions = exeptionView->ReadLongTextLC(TPtrC(PROXY_EXCEPTIONS)); + pushed++; + + aObject.InsertL(aObject.Size(),ConvertTo8LC(*proxyExceptions)); + pushed++; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // exeptionView + + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EOk end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + } + + if(aURI.Find(KNSmlDdfDirection) >= 0) + { + if (serviceType == TPtrC(OUTGOING_GPRS)) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValOutgoing); + } + else if (serviceType == TPtrC(INCOMING_GPRS)) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValIncoming); + } + else if (serviceType == TPtrC(LAN_SERVICE)) // Wlan ADD + { + aObject.InsertL(aObject.Size(),KNSmlDmApValOutgoing); + } + else if (serviceType == TPtrC(VPN_SERVICE)) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValOutgoing); + } + else + { + _LIT8( KDirectionUnk, "DirectionUnknown"); + aObject.InsertL(aObject.Size(),KDirectionUnk); + } + } + else + { + if (serviceType == TPtrC(OUTGOING_GPRS) || + serviceType == TPtrC(INCOMING_GPRS)) + { + if (i3GPPPS) + { + aObject.InsertL(aObject.Size(),KNSmlDmApVal3Gppps); + i3GPPPS = EFalse; + } + else + { + aObject.InsertL(aObject.Size(),KNSmlDmApValGsmGprs); + } + + } + + else if (serviceType == TPtrC(OUTGOING_GPRS) || + serviceType == TPtrC(INCOMING_GPRS)) + { + if (i3GPPPS) + { + aObject.InsertL(aObject.Size(),KNSmlDmApVal3Gppps); + i3GPPPS = EFalse; + } + else + { + aObject.InsertL(aObject.Size(),KNSmlDmApValGsmGprs); + } + + } + else if (serviceType == TPtrC(VPN_SERVICE)) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValVpn); + } + + else if ( ( serviceType == TPtrC(LAN_SERVICE) && iWlanSupported ) ) + { + aObject.InsertL(aObject.Size(),KNSmlDmApValWlan); + } + else + { + _LIT8( KUnkBearer, "Unknown Bearer"); + aObject.InsertL(aObject.Size(),KUnkBearer); + } + } + } + else + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + + } + +//------------------------------------------------------------------------------ +// CSmlDmAdapter::ChildURIListL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): begin"); + DBG_ARGS8(_S8("AP:ChildURIListL URI - <%S> <%S>"), &aURI, &aLUID ); + + CBufBase* currentURISegmentList = CBufFlat::NewL(128); + CleanupStack::PushL(currentURISegmentList); + + TUint32 checkLUID = IntLUID(aLUID); + + // If this is command to proxy node we'll need to make sure that + // the LUID is for proxy node and not AP node. + // If this command comes to predefined AP node then + // the LUID passed is inherited from that node and is not + // proper proxy node. + if ( aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound ) + { + TLex8 lex(aLUID); + TUint tempLUID; + if ( !((lex.Val( tempLUID ) == KErrNone ) + && ( tempLUID > KNSmlApProxyLowerBase ) + && ( tempLUID < KNSmlApProxyUpperBase )) ) + { + // Non-proxy LUID + checkLUID = 0; + } + } + + // Fetch all data for child + if ( !checkLUID + && ( !IsWLANfield( aURI ) || !iWlanSupported ) ) + { + if(aURI.Match(KNSmlDdfAP)== KErrNotFound) // Not for AP + { + CleanupStack::PopAndDestroy(); // currentURISegmentList + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + } + + TUint32 apId = GetAPIdFromURIL( aURI ); + + if( aURI.Match( _L8("AP/*") ) != KErrNotFound && + !APExistsL( apId ) ) + { + if ( aLUID.Length() > 0 ) + { + // Stale data, remove mapping. + RNSmlDMCallbackSession dMCbSession; + User::LeaveIfError( dMCbSession.Connect() ); + CleanupClosePushL( dMCbSession ); + + dMCbSession.RemoveMappingInfoL( KNSmlInternetAdapterImplUid, GetDynamicAPNodeUri( aURI ), ETrue ); + CleanupStack::PopAndDestroy( &dMCbSession ); + } + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP doesn't exist: ENotFound end"); + return; + } + + if( aURI.Match(_L8("AP/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/*"))== KErrNotFound ) + { + // Check if AP exists + if(!APExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + currentURISegmentList->InsertL( 0, KNSmlAPnode); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); + return; + } + + // Check that queried proxy exists + if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && + !PxExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + + if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Px/*/*"))== KErrNotFound ) + { + // Check if PX exists + if(!PxExistsL(checkLUID)) + { + // Only WAP-data + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + // List all Px + currentURISegmentList->InsertL( 0, KNSmlPxnode ); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): OK end"); + return; + } + + if (aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NAPDef/*/*"))== KErrNotFound ) + { + // Check if IAP has luid mapped + HBufC8* iapIdBuf = iCallBack->GetLuidAllocL(RemoveLastSeg(aURI)); + TInt iapIdInt = GetIntObject8(iapIdBuf->Des()); + + delete iapIdBuf; + iapIdBuf = NULL; + + if ( iapIdInt > 0 ) + { + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP),TPtrC(COMMDB_ID), iapIdInt); + TInt error = iapView->GotoFirstRecord(); + TBuf serviceType; + if (error == KErrNone) + { + iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + } + CleanupStack::PopAndDestroy( iapView ); + + // Check if NAPDef exists + if(!NAPDefExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + // List all NAPDef + if(IsWlanL(aURI) && iWlanSupported ) + { + iWlanAdapter->ChildURIListL(aURI,aLUID,aPreviousURISegmentList,aResultsRef,aStatusRef); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): WLAN end"); + return; + } + _LIT( KGprs, "*GPRS*"); + _LIT( K3gppps, "*3GPPPS*"); + if ( serviceType.Match(KGprs) != KErrNotFound || + serviceType.Match(K3gppps) != KErrNotFound) + { + currentURISegmentList->InsertL( 0 ,KNSmlNAPDefGPRSnode); + } + +#ifdef __SYNCML_DM_LSCRIPT + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlLoginscriptnode); +#endif + + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); + return; + } + + + if ( ( aURI.Match(_L8("AP/*/WLAN")) != KErrNotFound + || aURI.Match(_L8("AP/*/WLAN/*"))!= KErrNotFound ) + && iWlanSupported ) + { + iWlanAdapter->ChildURIListL(aURI,aLUID,aPreviousURISegmentList,aResultsRef,aStatusRef); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): WLAN end"); + return; + } +// +// Get all AP numbers from IAP-table +// + if (aURI.Match(KNSmlDdfAP)!= KErrNotFound) + { + TBool inDatabase = EFalse; + + CCommsDbTableView* apView = iDatabase->OpenTableLC(TPtrC(IAP)); + + TInt errorCode = apView->GotoFirstRecord(); + + while ( errorCode == KErrNone ) + { + TUint32 lValue; + TBool validService = EFalse; + TInt lLine(0); + apView->ReadUintL(TPtrC(COMMDB_ID),lValue); + + TBuf serviceType; + apView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + TUint32 bearerId = 0; + apView->ReadUintL(TPtrC(IAP_BEARER),bearerId); + // + // Skip other service types than GSM outgoing + // + if (serviceType == TPtrC(OUTGOING_GPRS) || + serviceType == TPtrC(INCOMING_GPRS)) + { + validService = ETrue; + } + + else if(serviceType == TPtrC(LAN_SERVICE) && + bearerId > 1) + { + validService = ETrue; + } + else if(serviceType == TPtrC(VPN_SERVICE)) + { + validService = ETrue; + } + else if( ( serviceType == TPtrC(LAN_SERVICE) ) && iWlanSupported ) + { + validService = ETrue; + } + + if(validService) + { + // Skip others + // + // Check if in aPreviousURISegmentList + // + while(!inDatabase && lLine < aPreviousURISegmentList.Count()) + { + TUint32 list = GetIntObject8(aPreviousURISegmentList.At(lLine).iURISegLUID); + if(list == lValue) + { + inDatabase = ETrue; + } + else + { + lLine++; + } + } + + if(inDatabase) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(lLine).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + inDatabase = EFalse; + DBG_ARGS8(_S8("InList: Id = %d Name %S"), lValue, &aPreviousURISegmentList.At(lLine).iURISeg); + + } + else + { + _LIT8(Kprev,"APId"); + TBuf8<9> addNAME(Kprev); // APIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lValue,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + DBG_ARGS8(_S8("NotInList: Id = %d Name %S"), lValue, &addNAME); + + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addURI; // AP/APIdnnn , nnn = profileid + addURI.Append(_L8("AP/APId")); + addURI.AppendNumFixedWidth(lValue,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,lValue); + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + } + } // Skip + errorCode = apView->GotoNextRecord(); + } + + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(2); // apView, currentURISegmentList + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); + return; + } + + iISPId = IntLUID(aLUID); + +// +// Get all NAPDef numbers +// + if (aURI.Match(_L8("AP/*/NAPDef"))!= KErrNotFound) + { + TBool inDatabase = EFalse; + TBuf serviceType; + TUint32 serviceId; + + CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP) + , + TPtrC(COMMDB_ID), + iISPId); + + TInt errorCode = napdefView->GotoFirstRecord(); + + if (errorCode != KErrNone ) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPDef error end"); + CleanupStack::PopAndDestroy(2); // napdefView, currentURISegmentList + return; + } + else + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID + CleanupStack::PopAndDestroy(); // napdefView + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + TPtrC(COMMDB_ID), + serviceId); + + errorCode = tableView->GotoFirstRecord(); + + while ( errorCode == KErrNone ) + { + TUint32 lValue; + TInt lLine(0); + tableView->ReadUintL(TPtrC(COMMDB_ID),lValue); + // + // Check if in aPreviousURISegmentList + // + while(!inDatabase && lLineInsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(lLine).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + inDatabase = EFalse; + } + else + { + _LIT8(Kprev,"NAPId"); + TBuf8<15> addNAME(Kprev); // APIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lValue,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + + + + _LIT8(Kprev2,"/NAPId"); + TBuf8<80> addURI; // AP/xxx/NAPDef/NAPIdnnn , nnn = id nbr + addURI.Append(aURI); + addURI.Append(Kprev2); + addURI.AppendNumFixedWidth(lValue,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,lValue); + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + } + errorCode = tableView->GotoNextRecord(); + } + + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); + return; + } + +// Get all Px numbers +// Check also AP-nbr + serviceType and nbr for Proxy +// To get right data for AP +// + if (aURI.Match(_L8("AP/*/Px"))!= KErrNotFound) + { + TBool inDatabase = EFalse; + TBuf serviceType; + TUint32 ServiceIsp; + + CCommsDbTableView* pxView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iISPId); + + TInt errorCode = pxView->GotoFirstRecord(); + + if (errorCode != KErrNone ) + { + CleanupStack::PopAndDestroy(2); // pxView, currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPDef error end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + return; + } + else + { + pxView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); // Type + pxView->ReadUintL(TPtrC(IAP_SERVICE), ServiceIsp); // ID + CleanupStack::PopAndDestroy(); // pxView + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), + TPtrC(PROXY_SERVICE_TYPE), + serviceType); + + errorCode = tableView->GotoFirstRecord(); + + TBool proxyFound(false); + while ( errorCode == KErrNone ) + { + TUint32 lProxyIspId; + TUint32 lProxyId; + TInt lLine(0); + tableView->ReadUintL(TPtrC(PROXY_ISP),lProxyIspId); + tableView->ReadUintL(TPtrC(COMMDB_ID),lProxyId); + if (lProxyIspId == ServiceIsp) // Right value ISP + { + proxyFound=true; + tableView->ReadUintL(TPtrC(COMMDB_ID),lProxyId); + // + // Check if in aPreviousURISegmentList + // + while(!inDatabase && lLine < aPreviousURISegmentList.Count()) + { + TUint32 list = GetIntObject8(aPreviousURISegmentList.At( + lLine).iURISegLUID) - KNSmlApProxyLowerBase; + if(list == lProxyId) + { + inDatabase = ETrue; + } + else + { + lLine++; + } + } + + if(inDatabase) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(lLine).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + inDatabase = EFalse; + DBG_ARGS8(_S8("InList: Id = %d Name %S"), lProxyId + KNSmlApProxyLowerBase , &aPreviousURISegmentList.At(lLine).iURISeg); + } + else + { + _LIT8(Kprev,"PXId"); + TBuf8<9> addNAME(Kprev); // PXIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lProxyId,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + DBG_ARGS8(_S8("NotInList: Id = %d Name %S"), lProxyId, &addNAME); + TBuf8<80> addURI; // AP/xxx/Px/PXIdnnn , nnn = id nbr + addURI.Append(aURI); + _LIT8( KPxid, "/PXId"); + addURI.Append( KPxid ); + addURI.AppendNumFixedWidth(lProxyId,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat, KNSmlApProxyLowerBase + lProxyId); // 100000 + lProxyId + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + } + } + errorCode = tableView->GotoNextRecord(); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); + if(proxyFound) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + } + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/Bearer/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Bearer/*/*"))== KErrNotFound ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),(_L8("BearerL/Direction"))); // Direction + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): BearerL end"); + return; + } + + if (aURI.Match(_L8("AP/*/Bearer"))!= KErrNotFound) + { + if(aPreviousURISegmentList.Count()>0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + } + else + { + _LIT8(Kprev,"BId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/Bearer/BIdn , n=aLUID + addURI.Append(aURI); + _LIT8( KBid, "/BId"); + addURI.Append( KBid ); + addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,checkLUID); + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Bearer end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/DNSAddr/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/DNSAddr/*/*"))== KErrNotFound ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDNSAddrNode); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddrL end"); + return; + } + + if (aURI.Match(_L8("AP/*/DNSAddr"))!= KErrNotFound) + { + + TBuf ServType; + TUint32 servId; + + CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP) , + TPtrC(COMMDB_ID), + iISPId); + + TInt errorCode = napdefView->GotoFirstRecord(); + + if (errorCode != KErrNone ) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr error end"); + CleanupStack::PopAndDestroy(2); // napdefView, currentURISegmentList + return; + } + else + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), ServType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), servId); // ID + CleanupStack::PopAndDestroy(napdefView); // napdefView + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(ServType, + TPtrC(COMMDB_ID), + servId); + + errorCode = tableView->GotoFirstRecord(); + + if ( errorCode != KErrNone ) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr error end"); + CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList + return; + } + else + { + // Now we can read DNSAddrL values + TInt leavecode; + TBuf columnValue; + TBuf8<16> addLUID; + TBuf8<80> addURI; // AP/xxx/NAPDef/DNSAddr/DNSx + _LIT8(KFormat,"%d"); + TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER1 ), columnValue)); + if ( ( leavecode == KErrNone ) && ( columnValue.Length() > 0 ) ) + { + addURI.Append(aURI); + addURI.Append(KNSmlDNS1); + _LIT8( KDns1, "DNS1"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns1); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 1)); + iCallBack->SetMappingL(addURI,addLUID); + addURI.Zero(); + } + + TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER2 ), columnValue)); + if ( leavecode == KErrNone && ( columnValue.Length() > 0 ) ) + { + if ( currentURISegmentList->Size() > 0 ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), KNSmlDmApValFSlash); + } + addURI.Append(aURI); + addURI.Append(KNSmlDNS2); + _LIT8( KDns2, "DNS2"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns2); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 2)); + iCallBack->SetMappingL(addURI,addLUID); + addURI.Zero(); + } + + TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER1 ), columnValue)); + if ( leavecode == KErrNone && ( columnValue.Length() > 0 ) ) + { + if ( currentURISegmentList->Size() > 0 ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), KNSmlDmApValFSlash); + } + addURI.Append(aURI); + addURI.Append(KNSmlDNS3); + _LIT8( KDns3, "DNS3"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns3); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv6Host, 1)); + iCallBack->SetMappingL(addURI,addLUID); + addURI.Zero(); + } + + TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER2 ), columnValue)); + if ( leavecode == KErrNone && ( columnValue.Length() > 0 ) ) + { + if ( currentURISegmentList->Size() > 0 ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), KNSmlDmApValFSlash); + } + addURI.Append(aURI); + addURI.Append(KNSmlDNS4); + _LIT8(KDns4, "DNS4" ); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns4 ); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv6Host, 2)); + iCallBack->SetMappingL(addURI,addLUID); + } + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, KNullDesC8); + + CleanupStack::PopAndDestroy(tableView); + CleanupStack::PopAndDestroy(currentURISegmentList); // currentURISegmentList + } + return; + } + + + if (aURI.Match(_L8("AP/*/Port/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Port/*/*"))== KErrNotFound ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDdfPortNbr); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Port end"); + return; + } + + if (aURI.Match(_L8("AP/*/Port"))!= KErrNotFound) + { + + TUint32 iapID10 = GetAPIdFromURIL(aURI); + + if(WapAPExistsL(iapID10)) // WapPort + { + TBuf8<80> addURI; // AP/xxx/Px/Port/WAP + addURI.Append(aURI); + _LIT8( KWap, "/WAP"); + addURI.Append( KWap ); + _LIT8( KWap2, "WAP/"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KWap2); + } + + if(PxExistsL(checkLUID)) // ProxyPort + { + TBuf8<80> addURI; // AP/xxx/Px/Port/PROXY + addURI.Append(aURI); + _LIT8( KProxy, "/PROXY"); + addURI.Append( KProxy ); + _LIT8( KProxy2, "PROXY/"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KProxy2); + } + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Port end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/NAPAuthInf/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NAPAuthInf/*/*"))== KErrNotFound ) + { + _LIT8( KAuthFields, "AuthName/AuthSecr"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),(KAuthFields)); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInfL end"); + return; + } + + if (aURI.Match(_L8("AP/*/NAPAuthInf"))!= KErrNotFound) + { + _LIT8(Kprev,"AUId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/NAPAuthInf/AUIdn , n=aLUID + addURI.Append(aURI); + _LIT8( KAuid, "/AUId" ); + addURI.Append( KAuid ); + addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,checkLUID); + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInf end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/PxAuthInf/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/PxAuthInf/*/*"))== KErrNotFound ) + { + _LIT8( KPxAuthFields, "PxAuthId/PxAuthPW"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),(KPxAuthFields)); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInfL end"); + return; + } + + if (aURI.Match(_L8("AP/*/PxAuthInf"))!= KErrNotFound) + { + _LIT8(Kprev,"AUPxId"); + TBuf8<11> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/Px/PxAuthInf/AUPxIdn , n=aLUID + addURI.Append(aURI); + _LIT8( KAupxid, "/AUPxId" ); + addURI.Append( KAupxid ); + addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInf end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/ToNAPID/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/ToNAPID/*/*"))== KErrNotFound ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNSmlDdfToNAPIDL)); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ToNAPIDL end"); + return; + } + + if (aURI.Match(_L8("AP/*/ToNAPID"))!= KErrNotFound) + { + _LIT8(Kprev,"TId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/ToNAPID/TIdn , n=aLUID + addURI.Append(aURI); + _LIT8( KTid, "/TId" ); + addURI.Append( KTid ); + addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ToNAPID end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/Networks/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Networks/*/*"))== KErrNotFound ) + { + _LIT8( KNameId, "Name/ID" ); + currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNameId)); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks end"); + return; + } + + if (aURI.Match(_L8("AP/*/Networks"))!= KErrNotFound) + { + checkLUID = GetAPIdFromURIL(aURI); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + checkLUID); + + TInt errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + TUint32 nwLUID = 0; + tableView->ReadUintL(TPtrC(IAP_NETWORK),nwLUID); // Networks luid + if(!NetworkExistsL(nwLUID)) + { + errorCode = KErrNotFound; + } + } + + CleanupStack::PopAndDestroy(); // tableView + + if(errorCode != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks error end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + CleanupStack::PopAndDestroy(); // currentURISegmentList + return; + } + + if(aPreviousURISegmentList.Count()>0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + } + else + { + _LIT8(Kprev,"NwId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/Networks/NwIdn , n=aLUID + addURI.Append(aURI); + _LIT8( KNwid, "/NwId"); + addURI.Append(KNwid); + addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,checkLUID); + + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/NoPxFor/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NoPxFor/*/*"))== KErrNotFound ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNSmlDdfNoPxForL)); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NoPxFor end"); + return; + } + + if (aURI.Match(_L8("AP/*/NoPxFor"))!= KErrNotFound) + { + if(aPreviousURISegmentList.Count()>0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + } + else + { + _LIT8(KexepPrev,"eXC"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KexepPrev); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NoPxFor end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/Domain/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Domain/*/*"))== KErrNotFound ) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNSmlDdfDomainL)); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Domain end"); + return; + } + + if (aURI.Match(_L8("AP/*/Domain"))!= KErrNotFound) + { + if(aPreviousURISegmentList.Count()>0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); + } + else + { + _LIT8(KexepPrev,"dOM"); + currentURISegmentList->InsertL(currentURISegmentList->Size(),KexepPrev); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Domain end"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::AddNodeBufferL() +// Inserts new AP-data to database +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddNodeBufferL( const TDesC8& aURI, + const TDesC8& /*aParentLUID*/, + const TInt aStatusRef, + const TBool aDnsUpd, + const TBool aWlan ) + { + TInt index = -1; + + for(TInt i = 0; iCount(); i++) + { + TPtrC8 parentUri = FirstURISeg(aURI); + if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) + { + index = i; + break; + } + } + + if(index<0) + { + TNSmlAPBufferElement newNode; + newNode.iMappingName = aURI.AllocLC(); + + NextAPNameL(*LastURISeg(aURI).AllocLC()); + CleanupStack::PopAndDestroy(); + + newNode.iName = iIAPName.AllocLC(); + newNode.iNodeBuf = new (ELeave) CArrayFixFlat (KNSmlAPGranularity); + newNode.iWlanNodeBuf = new (ELeave) CArrayFixFlat (KNSmlAPGranularity); + newNode.iExecuted = EFalse; + newNode.iBearer = EFalse; + newNode.iDirection = EFalse; + newNode.iNameReceived = EFalse; + if ( aDnsUpd ) + { + newNode.iDnsUpdateBuf = ETrue; + } + else + { + newNode.iDnsUpdateBuf = EFalse; + } + newNode.iLuid = 0; + iBuffer->AppendL(newNode); + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + + index = iBuffer->Count() - 1; + } + + if ( !aDnsUpd ) + { + TNSmlAPAddElement newCommand; + newCommand.iUri = aURI.AllocLC(); + newCommand.iData = 0; + newCommand.iStatusRef = aStatusRef; + newCommand.iLeaf = EFalse; + newCommand.iDone = EFalse; + + TPtrC8 parentUri = FirstURISeg(aURI); + newCommand.iLuid = iCallBack->GetLuidAllocL( parentUri ); + + if ( aWlan ) + { + iBuffer->At(index).iWlanNodeBuf->AppendL(newCommand); + } + else + { + iBuffer->At(index).iNodeBuf->AppendL(newCommand); + } + CleanupStack::Pop(); //newCommand.iUri + } + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::AddLeafBufferL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddLeafBufferL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef, + const TBool aWlan ) + { + TInt index = -1; + + for(TInt i = 0; iCount(); i++) + { + TPtrC8 parentUri = FirstURISeg(aURI); + if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) + { + index = i; + break; + } + } + + if( index<0 ) + { + if ( aParentLUID.Length() < 0 ) + { + DBG_ARGS8(_S8("AP:AddLeafBufferL URI - <%S> <%S> NOTFOUND"), &aURI, &aParentLUID ); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + else + { + // this means update to DNSAddr/ + TPtrC8 apURI = FirstURISeg(aURI); + HBufC8* luid = iCallBack->GetLuidAllocL(apURI); + CleanupStack::PushL( luid ); + + AddNodeBufferL( apURI, luid->Des(), -2, ETrue ); + iDnsIpv4Pri = 0; + iDnsIpv6Pri = 0; + + CleanupStack::PopAndDestroy( luid ); + index = 0; + } + } + + TNSmlAPAddElement newCommand; + + newCommand.iUri = aURI.AllocLC(); //aURI.AllocLC(); + newCommand.iData = aObject.AllocLC(); + newCommand.iStatusRef = aStatusRef; + newCommand.iLuid = aParentLUID.AllocLC(); + newCommand.iLeaf = ETrue; + newCommand.iDone = EFalse; + + if ( aWlan ) + { + iBuffer->At(index).iWlanNodeBuf->AppendL(newCommand); + } + else + { + iBuffer->At(index).iNodeBuf->AppendL(newCommand); + } + + CleanupStack::Pop(3); //newCommand.iLastUriSeg, newCommand.iData, newCommand.iLuid + + if (aURI.Find(KNSmlDdfBearerL) >= 0 ) // Bearer added + { + if (aObject.Match(KNSmlDmApValGsmGprs)!= KErrNotFound) + { + iBuffer->At(index).iBearer = ETrue; + } + + else if (aObject.Match(KNSmlDmApVal3Gppps) != KErrNotFound || + aObject.Match(KNSmlDmApValVpn) != KErrNotFound ) + { + iBuffer->At(index).iBearer = ETrue; + } + if ( ( aObject.Match(KNSmlDmApValWlan) != KErrNotFound ) && iWlanSupported ) // Valid Bearer + { + iBuffer->At(index).iBearer = ETrue; + } + } + + if (aURI.Find(KNSmlDdfDirection) >= 0 ) // Direction added + { + iBuffer->At(index).iDirection = ETrue; + } + + if ( aURI.Match(_L8("AP/*/NAPDef/*/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NAPDef/*/*/*"))== KErrNotFound && + LastURISeg(aURI).Compare( KNSmlDdfNAPName ) == 0 ) + { + iIAPExists = EFalse; + iBuffer->At(index).iNameReceived = ETrue; + + delete iBuffer->At(index).iName; + iBuffer->At(index).iName = 0; + + iBuffer->At(index).iName = aObject.AllocLC(); + iIAPName.Copy( aObject ); + CleanupStack::Pop(); + + // Check if Name and LUID match + TPtrC qTable = TPtrC(IAP); // Check if IAP-table free + TPtrC qDB = TPtrC(COMMDB_ID); + TPtrC8 parentUri = FirstURISeg(aURI); + HBufC8* luid = iCallBack->GetLuidAllocL( parentUri ); + CleanupStack::PushL( luid ); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(qTable, + qDB, + IntLUID( *luid ) ); + + + TInt errorCode = tableView->GotoFirstRecord(); + if( errorCode != KErrNotFound ) + { + // Check the name + TBuf8 name; + tableView->ReadTextL( TPtrC(COMMDB_NAME ), name); + if ( name.Compare( aObject ) != 0 ) + { + // Not correct name + RNSmlDMCallbackSession dMCbSession; + User::LeaveIfError( dMCbSession.Connect() ); + CleanupClosePushL( dMCbSession ); + + // Remove all mappings from AP/xxx level + dMCbSession.RemoveMappingInfoL( KNSmlInternetAdapterImplUid, GetDynamicAPNodeUri( aURI ), ETrue ); + CleanupStack::PopAndDestroy( &dMCbSession ); + + iPrevURI->Des().Format( KNullDesC8 ); + iPrevLUID = 0; + } + else + { + iIAPExists = ETrue; + iLeafType = EDMUpdate; + } + } + CleanupStack::PopAndDestroy( tableView ); + CleanupStack::PopAndDestroy( luid ); + } +// + +// If Bearer data + Direction + name => add is possible for AP +// + if (iBuffer->At(index).iDirection && + iBuffer->At(index).iBearer && + iBuffer->At(index).iNameReceived && + !iExecutingBuffer ) + { + iBearer.Zero(); + iDirection = ECommDbConnectionDirectionUnknown; + ExecuteBufferL(aURI); + + } + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::AddNodeObjectL() +// Inserts new AP-data to database +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): begin"); + + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddNodeObjectL(): aURI=<%S>, aParentLUID=<%S>"), &aURI, &aParentLUID); + + if (iLeafType == EDMUpdate && iExecutingBuffer ) + { + // This is an update to an old IAP. All node additions return KErrAlreadyExists. + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); // EError + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); + return; + } + + // Save LUID to local variable to be able to reset the value, if needed. + TBuf8 parentLUID; + parentLUID.Zero(); + parentLUID = aParentLUID; + + TUint32 apId = GetAPIdFromURIL( aURI ); + + if( parentLUID.Length() > 0 && IntLUID(parentLUID) > 0 && + !APExistsL( apId ) ) + { + // AP has been deleted. Handle as new data. + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): parentLUID.Length() > 0 && !APExistsL() -> Remove mapping "); + + RNSmlDMCallbackSession dMCbSession; + User::LeaveIfError( dMCbSession.Connect() ); + CleanupClosePushL( dMCbSession ); + + // Remove all mappings from AP/xxx level + dMCbSession.RemoveMappingInfoL( KNSmlInternetAdapterImplUid, GetDynamicAPNodeUri( aURI ), ETrue ); + CleanupStack::PopAndDestroy( &dMCbSession ); + + parentLUID.Zero(); + iPrevURI->Des().Format( KNullDesC8 ); + iPrevLUID = 0; + } + + if(parentLUID.Length()<=0) + { + // Check OOD before saving new + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + + if (SysUtil::FFSSpaceBelowCriticalLevelL(&fs, KNSmlInternetAdapterFatMinSize)) + { + CleanupStack::PopAndDestroy(); // fs + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EDiskFull); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): DISK FULL end"); + return; + // do not write + } + CleanupStack::PopAndDestroy(); //fs + } +// +// Check if AP-add +// + if(( aURI.Match(_L8("AP/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/*"))== KErrNotFound ) || + ( aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NAPDef/*/*"))== KErrNotFound ) || + aURI.Match(_L8("AP/*/NAPDef" ))!= KErrNotFound || + aURI.Match(_L8("AP/*/NAPDef/*/Bearer"))!= KErrNotFound || + ( aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*/*"))== KErrNotFound ) || + aURI.Match(_L8("*/WLAN*" )) != KErrNotFound) + { + if( ( parentLUID.Length()<=0 ) && ( aURI.Match(_L8("*/WLAN*" )) != KErrNotFound ) ) + { + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse, ETrue); + return; + } + if(parentLUID.Length()<=0) + { + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + return; + } + + if( iTransactionCommitted && !iDatabase->InTransaction() ) + { + + _DBG_FILE("CNSmlInternetAdapter::AddNode object, begin commsdb transaction "); + TInt codeBegin = iDatabase->BeginTransaction(); + TInt retry = KBeginTransRetryCount; + if( codeBegin == KErrNone ) + { + iTransactionCommitted = EFalse; + } + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddNode object iDatabase->Begintransaction start of addobjectL return code = %d"),codeBegin); + if( codeBegin == KErrLocked ) + { + _DBG_FILE("CNSmlInternetAdapter::Addnodeobject Database->Begintransaction has returned KErrLocked"); + while ( retry > 0 && codeBegin == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + codeBegin = iDatabase->BeginTransaction(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddNode object iDatabase->Begintransaction after 2 seconds of wait of addobjectL return code = %d"),codeBegin); + retry--; + } + + if( codeBegin == KErrNone ) + { + iTransactionCommitted = EFalse; + _DBG_FILE("CNSmlInternetAdapter::AddNode object transaction commited is false "); + } + + } + + + } + if ( ( aURI.Match(_L8("*/WLAN*" )) != KErrNotFound ) && iWlanSupported ) + { + DBG_ARGS8(_S8("To WlanAdapter::AddNodeObjectL - uri: <%S> to parentLUID: <%S>"), &aURI, &parentLUID ); + iWlanAdapter->AddNodeObjectL( aURI, parentLUID, aStatusRef ); + return; + } + + TInt pluid = IntLUID(parentLUID); + + if(pluid < 0) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + iIAPId = pluid; + + TPtrC qTable = TPtrC(IAP); // Check if IAP-table free + TPtrC qDB = TPtrC(COMMDB_ID); + + //Check if URI is /AP/*/NAPDef/* then it should be check IAP ID in DB not IAPService + if(( iIAPId > 0 ) && ((aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound) || (aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*" ))!= KErrNotFound))) + { + //Get parent UID and check if that exist if not add + iIAPId = GetAPIdFromURIL(aURI); + + } + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(qTable, + qDB, + iIAPId); + + TInt errorCode = tableView->GotoFirstRecord(); + + CleanupStack::PopAndDestroy(tableView); + + // Node allready exists => No adding possible + if ( errorCode == KErrNone ) + { + if ( !iExecutingBuffer ) + { + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); // EError + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); + } + return; + } + else if ( iIAPId == 0 ) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): ENotFound end"); + return; + } + else if( iIAPId > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data Add to buffer"); + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + iStaleMapUpdate=ETrue; + return; + } + + } + else if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && // How to check if already added + aURI.Match(_L8("AP/*/Px/*/*"))== KErrNotFound ) // dm-tree knows last LUID + { + if(parentLUID.Length()<=0) + { + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + return; + } + + // Check if already exists on database (=> only One possible for AP) + if(GetProxyIdL(aURI)) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); + return; + } + + TUint32 iapID = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapID); + + TInt errorCode = iapView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if ( errorCode == KErrNone ) + { + iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); + iapView->ReadUintL(TPtrC(IAP_SERVICE), iProxyISP); + CleanupStack::PopAndDestroy(); // iapView + } + else if( iapID > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + + CleanupStack::PopAndDestroy(); // iapViewv + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + iStaleMapUpdate=ETrue; + return; + } + else + { + CleanupStack::PopAndDestroy(); // iapView + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): ENotFound end"); + return; + } + + CCommsDbTableView* proxyTable; + + proxyTable = iDatabase->OpenTableLC(TPtrC(PROXIES)); + + TInt initOK = proxyTable->InsertRecord(iapID); + + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && initOK != KErrNone ) + { + User::After( KBeginTransRetryDelay ); + initOK = proxyTable->InsertRecord( iapID ); + retry--; + } + + if( initOK == KErrNone ) + { + iProxyServerName = LastURISeg(aURI); // Name from URI + initOK = InitializeProxyL( proxyTable ); + + User::After( KBeginTransRetryDelay ); + if ( initOK == KErrNone) + { + TUint32 newId = 0; + initOK = proxyTable->PutRecordChanges(); + + retry = KBeginTransRetryCount; + while ( retry > 0 && initOK != KErrNone ) + { + User::After( KBeginTransRetryDelay ); + initOK = proxyTable->PutRecordChanges(); + retry--; + } + + proxyTable->ReadUintL(TPtrC(COMMDB_ID), newId); + // + // Set mapping-data + // + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,KNSmlApProxyLowerBase + newId); // 100000 + lProxyId + + // Also added to mapping + iCallBack->SetMappingL(aURI,addLUID); + } + else + { + proxyTable->CancelRecordChanges(); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError end"); + } + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError end Insert failed"); + } + CleanupStack::PopAndDestroy(); // proxyTable + + } + else if (aURI.Match(_L8("AP/*/Px/*/*"))!= KErrNotFound ) + { + if(parentLUID.Length()<=0) + { + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + + TInt pluid = IntLUID(parentLUID); + + if(pluid < 0) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + else + { + TUint32 apID = GetAPIdFromURIL(aURI); + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + apID); + TInt errorCode = tableView->GotoFirstRecord(); + CleanupStack::PopAndDestroy(tableView); + if( apID > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + iStaleMapUpdate=ETrue; + return; + } + + } + } + + else if (aURI.Match(_L8("AP/*/Px"))!= KErrNotFound ) + { + if(parentLUID.Length()<=0) + { + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + return; + } + + TInt pluid = IntLUID(parentLUID); + + if(pluid < 0) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + else if(pluid == 0) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError"); + return; + } + else + { + TUint32 apID = GetAPIdFromURIL(aURI); + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + apID); + TInt errorCode = tableView->GotoFirstRecord(); + CleanupStack::PopAndDestroy(tableView); + if( apID > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); + AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); + iStaleMapUpdate=ETrue; + return; + } + } + } + + else if (aURI.Match(_L8("AP/*/Networks/*" ))!= KErrNotFound && + aURI.Match(_L8("AP/*/Networks/*/*"))== KErrNotFound ) + { + iIAPId = IntLUID(parentLUID); + } + + + + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::ExecuteCommandL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::ExecuteCommandL( const TDesC8&/* aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::ExecuteCommandL ( .. RWriteStream ..) +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusref ) + { + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusref, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CopyCommandL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlInternetAdapter::CopyCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::CopyCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::StartAtomicL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlInternetAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::StartAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CommitAtomicL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlInternetAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::CommitAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::RollbackAtomicL +// not supported +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlInternetAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::RollbackAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::StreamingSupport +// returns EFalse +//------------------------------------------------------------------------------ + +TBool CNSmlInternetAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CNSmlInternetAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlInternetAdapter::StreamingSupport(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::StreamCommittedL +// not used in this adapter +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlInternetAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::StreamCommittedL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CompleteOutstandingCmdsL +// +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::CompleteOutstandingCmdsL() + { + + _DBG_FILE("CNSmlInternetAdapter::CompleteOutstandingCmdsL(): begin"); +// +// Handle possible unhandled buffered nodes +// + if( !iDatabase->InTransaction() ) + { + _DBG_FILE("CompleteOutstandingCmds: Try first begintransaction."); + TInt err = iDatabase->BeginTransaction(); + if( err == KErrLocked ) + { + _DBG_FILE("CompleteOutstandingCmds: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && err == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("CompleteOutstandingCmds: Slept 1 second. Try again"); + err = iDatabase->BeginTransaction(); + retry--; + } + if(err != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( err ); + } + } + } + _DBG_FILE("CompleteOutstandingCmds: BeginTransaction was successful"); + + iDnsIpv4Pri = 0; + iDnsIpv6Pri = 0; + _LIT8( KDummy, "/Dummy" ); + for(TInt h = iBuffer->Count()-1; h >= 0; h--) // Through buffers + { + TBuf8<80> commandURI; + commandURI.Append(iBuffer->At(h).iMappingName->Des()); + commandURI.Append( KDummy ); // Removed on execution + ExecuteBufferL(commandURI, ETrue); + } + iDnsUpdate = EFalse; + iDnsIpv4Pri = 0; + iDnsIpv6Pri = 0; + iBuffer->Reset(); + + if ( iWlanSupported ) + { + iWlanAdapter->CompleteOutstandingCmdsL(); // Execute possible unhandled WLAN commands + } + + iNetworkId = KErrNotFound; + + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + _DBG_FILE("CNSmlInternetAdapter::CompleteOutstandingCmdsL(): end"); + } + +//============================================= +// CNSmlInternetAdapter::GetAPField() +// Match URI fieldname to +// CommsDb table and column +// +//============================================= +TBool CNSmlInternetAdapter::GetAPField(TPtrC& aTableName,TPtrC& aColumn) const + { + _DBG_FILE("CNSmlInternetAdapter::GetAPField(): Start"); + + TBool fRet = EFalse; + + aColumn.Set(TPtrC(KNullDesC)); + + if (iField->Compare(KNSmlDdfAuthName) == 0) + { + if( aTableName == TPtrC(OUTGOING_GPRS) || + aTableName == TPtrC(INCOMING_GPRS)) + { + aColumn.Set(TPtrC(SERVICE_IF_AUTH_NAME)); + } + else + { + return fRet; + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPName) == 0) + { + aColumn.Set(TPtrC(COMMDB_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfToNAPIDL) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPID) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxId) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxAddr) == 0) + { + aTableName.Set(TPtrC(PROXIES)); + aColumn.Set(TPtrC(PROXY_SERVER_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPAddrTy) == 0) // Is valid + { + return fRet; + } + else if (iField->Compare(KNSmlDdfDNSAddrL) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDNSPriority) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDNSAddrTy) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPAddr) == 0) + { + if( aTableName == TPtrC(OUTGOING_GPRS) || + aTableName == TPtrC(INCOMING_GPRS)) + { + aColumn.Set(TPtrC(GPRS_APN)); // GPRS_PDP_ADDRESS + } + else if(aTableName == TPtrC(LAN_SERVICE)) // Wlan ADD + { + aColumn.Set(TPtrC(ISP_IP_ADDR)); + // Leni: Should this be LAN_IP_ADDR ?? + } + else + { + return fRet; + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfBearerL) == 0) + { + aTableName.Set(TPtrC(IAP)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDirection) == 0) + { + aTableName.Set(TPtrC(IAP)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfAuthSecr) == 0) + { + if( aTableName == TPtrC(OUTGOING_GPRS) || + aTableName == TPtrC(INCOMING_GPRS)) + { + aColumn.Set(TPtrC(SERVICE_IF_AUTH_PASS)); + } + else + { + return fRet; // NotValid + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPortNbr) == 0) + { + if(iWapPort) + { + aTableName.Set(TPtrC(WAP_IP_BEARER)); + aColumn.Set(TPtrC(WAP_PROXY_PORT)); + } + else + { + aTableName.Set(TPtrC(PROXIES)); + aColumn.Set(TPtrC(PROXY_PORT_NUMBER)); + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfStartpg) == 0) + { + aTableName.Set(TPtrC(WAP_ACCESS_POINT)); + aColumn.Set(TPtrC(WAP_START_PAGE)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxAuthId) == 0) // No KNSmlDdfBasAuthId + { + aTableName.Set(TPtrC(WAP_IP_BEARER)); + aColumn.Set(TPtrC(WAP_PROXY_LOGIN_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxAuthPW) == 0) // No KNSmlDdfBasAuthPW + { + aTableName.Set(TPtrC(WAP_IP_BEARER)); + aColumn.Set(TPtrC(WAP_PROXY_LOGIN_PASS)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfUsePTxtLog) == 0) + { + if( aTableName == TPtrC(OUTGOING_GPRS) || + aTableName == TPtrC(INCOMING_GPRS)) + { + aColumn.Set(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH)); + fRet = ETrue; + } + else + { + return fRet; // NotValid + } + } + else if (iField->Compare(KNSmlDdfDefGW) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_GATEWAY)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNetworkMask) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_NETMASK)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNetworkID) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPPPComp) == 0) + { + if( aTableName == TPtrC(OUTGOING_GPRS) || + aTableName == TPtrC(INCOMING_GPRS)) + { + aColumn.Set(TPtrC(GPRS_DATA_COMPRESSION)); + } + else + { + return fRet; // NotValid + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfGPRSPDP) == 0) + { + if( aTableName == TPtrC(OUTGOING_GPRS) || + aTableName == TPtrC(INCOMING_GPRS)) + { + aColumn.Set(TPtrC(GPRS_PDP_TYPE)); + } + else + { + return fRet; // NotValid + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNoPxForL) == 0) + { + aColumn.Set(TPtrC(PROXY_EXCEPTIONS)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDomainL) == 0) + { + aColumn.Set(TPtrC(PROXY_PROTOCOL_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIPAddrFromServer) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_ADDR_FROM_SERVER)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIPAddr) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_ADDR)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDNSAddrFromServer) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIPv6DNSAddrFromServer) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIfNetworks) == 0) + { + aColumn.Set(TPtrC(SERVICE_IF_NETWORKS)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIAPService) == 0) + { + aColumn.Set(TPtrC(IAP_SERVICE)); + fRet = ETrue; + } + + else if (iField->Compare(KNSmlDdfIAPSeamlessness) == 0) + { + fRet= ETrue; + } + else if (iField->Compare(KNSmlDdfIAPMetaData) == 0) + { + fRet= ETrue; + } + + DBG_ARGS(_S16("GetAPField: aURI - %S - %S - %S"),&aTableName, &aColumn, &*iField); + + _DBG_FILE("CNSmlInternetAdapter::GetAPField(): EOk"); + + return fRet; + } + +//============================================= +// CNSmlInternetAdapter::GetAPFieldType() +// Match fieldtype to Commsdb-database +// +//============================================= +CNSmlInternetAdapter::TNSmlAPFieldType CNSmlInternetAdapter::GetAPFieldType( const TDesC8& aURI ) const + { + if (iField->Compare(KNSmlDdfBearerL) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + else if (iField->Compare(KNSmlDdfDirection) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + else if (iField->Compare(KNSmlDdfBearer) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfToNAPIDL) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfNAPID) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfPxId) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfAuthName) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNAPName) == 0 || + iField->Compare(KNSmlDdfPxName) == 0 || + iField->Compare(KNSmlDdfNetworkName) == 0 ) + { + if( aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound + || aURI.Match(_L8("AP/*/Networks/*/Name"))!= KErrNotFound ) + { + return CNSmlInternetAdapter::EStr; + } + else + { + return CNSmlInternetAdapter::ESpec; // For NAPName + } + } + else if (iField->Compare(KNSmlDdfNAPAddrTy) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfNAPAddr) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfStartpg) == 0) + { + return CNSmlInternetAdapter::EWap; + } + else if (iField->Compare(KNSmlDdfPxAuthId) == 0) + { + return CNSmlInternetAdapter::EWap; + } + else if (iField->Compare(KNSmlDdfPxAuthPW) == 0) + { + return CNSmlInternetAdapter::EWap; + } + else if (iField->Compare(KNSmlDdfPxAddr) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfDNSAddrFromServer) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfIPv6DNSAddrFromServer) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfDNSAddrL) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfDNSAddrTy) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfDNSPriority) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfPxName) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfAuthSecr) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfPxId) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfPxPW) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfPortNbr) == 0) + { + if(iWapPort) // Different handlig for WAP and Proxy PortNbr + { + return CNSmlInternetAdapter::EWap; + } + else + { + return CNSmlInternetAdapter::EInt; + } + } + else if (iField->Compare(KNSmlDdfUsePTxtLog) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfDefGW) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNetworkMask) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNetworkID) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfPPPComp) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfGPRSPDP) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfDomainL) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNoPxForL) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + else if (iField->Compare(KNSmlDdfIPAddrFromServer) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfIPAddr) == 0) + { + return EStr; + } + else if (iField->Compare(KNSmlDdfIfNetworks) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfIAPService) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + + else if (iField->Compare(KNSmlDdfIAPSeamlessness) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfIAPMetaData) == 0) + { + return CNSmlInternetAdapter::EInt; + } + + _DBG_FILE("CNSmlInternetAdapter::GetAPFieldType(): Error"); + + return EWrong; + } + +//------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------ +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F6DE2, CNSmlInternetAdapter::NewL) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlInternetAdapter: begin"); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE("ImplementationGroupProxy() for CNSmlInternetAdapter: end"); + return ImplementationTable; + } + +//============================================= +// CNSmlInternetAdapter::IntLUID() +// Returns IntValue for aLUID +//============================================= +TInt CNSmlInternetAdapter::IntLUID(const TDesC8& aLUID) + { + TLex8 lex(aLUID); + + if (lex.Val(iLUID) == KErrNone) + { + if ((iLUID > KNSmlApProxyUpperBase) && + (iLUID < KNSmlApDnsLuidUpperBase )) + { + iLUID = iLUID - KNSmlApProxyUpperBase; + } + else if ((iLUID > KNSmlApProxyLowerBase) && + (iLUID < KNSmlApProxyUpperBase )) + { + iProxyId = iLUID - KNSmlApProxyLowerBase; // Proxy + iLUID = iProxyId; + } + else if ((iLUID > KNSmlAp3gpppsLowerBase ) && + (iLUID <= KNSmlApProxyLowerBase) ) + { + iLUID = iLUID - KNSmlAp3gpppsLowerBase; + i3GPPPS = ETrue; + } + else + { + iProxyId = 0; + } + return iLUID; + } + else + { + return 0; + } + } + +//============================================= +// CNSmlInternetAdapter::GetIntObject8() +// Returns IntValue for aObject +//============================================= +TInt CNSmlInternetAdapter::GetIntObject8(const TDesC8& aObject) + { + TLex8 lex(aObject); + + TInt lValue = 0; + + if (lex.Val(lValue) == KErrNone) + { + return lValue; + } + else + { + return lValue; + } + } +//============================================= +// CNSmlInternetAdapter::SetIntObjectLC() +// Returns IntValue for aObject +//============================================= +TDesC8& CNSmlInternetAdapter::SetIntObjectLC(const TInt& aObject) + { + HBufC8* buf = HBufC8::NewLC(8); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num(aObject); + + return *buf; + } + +//============================================= +// CNSmlInternetAdapter::NotValidStrLenght() +// False if datalength is valid +//============================================= +TBool CNSmlInternetAdapter::NotValidStrLenght(const TDesC& aSource) + { + TInt len = aSource.Length(); + TBool theBool = EFalse; + + if(len > KCommsDbSvrMaxFieldLength) + { + theBool = ETrue; + } + return theBool; + } + +//============================================= +// CNSmlInternetAdapter::SetField() +// String after last '/' is returned +// +//============================================= +TInt CNSmlInternetAdapter::SetField( const TDesC8& aSource ) + { + if (aSource.LocateReverse('/') == KErrNotFound) + { + iField->Des().Format(aSource); + } + else + { + iField->Des().Format(aSource.Mid(aSource.LocateReverse('/')+1)); + } + + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::ConvertTo8LC() +// Converts string value to 8-bit +// +//============================================= +TDesC8& CNSmlInternetAdapter::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length()*2); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return *buf; + } + +//============================================= +// CNSmlInternetAdapter::ConvertTo16LC() +// Converts string value to 16-bit +// +//============================================= +TDesC16& CNSmlInternetAdapter::ConvertTo16LC( const TDesC8& aSource) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8(bufPtr16, aSource); + + return *buf16; + } + + +//============================================= +// CNSmlInternetAdapter::InitializeGPRSL() +// Initialize GPRS-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeGPRSL( CCommsDbTableView* aTable ) + { + TBuf user; + TBuf pass; + + _LIT(Kdns6Address, "0:0:0:0:0:0:0:0"); + _LIT(KgifNetworks,"ip"); + + // COMMON DATA + aTable->WriteBoolL(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH),EFalse); + + aTable->WriteTextL(TPtrC(GPRS_IF_NETWORKS), KgifNetworks); + + aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); // Same as IAP + CleanupStack::PopAndDestroy(); //ConvertTo16LC + + aTable->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse); + aTable->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), user); + aTable->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS), pass); + + aTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue ); + aTable->WriteTextL(TPtrC(GPRS_IP_ADDR), KNSmlEmptyIpv4Address); + + aTable->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue ); + aTable->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2), KNSmlEmptyIpv4Address); + + aTable->WriteBoolL(TPtrC(GPRS_IP6_DNS_ADDR_FROM_SERVER), ETrue ); + aTable->WriteTextL(TPtrC(GPRS_IP6_NAME_SERVER1), Kdns6Address); + aTable->WriteTextL(TPtrC(GPRS_IP6_NAME_SERVER2), Kdns6Address); + // GPRS DATA + + aTable->WriteTextL(TPtrC(GPRS_APN), ConvertTo16LC(iIAPName)); // Same as IAP + CleanupStack::PopAndDestroy(); //ConvertTo16LC + + aTable->WriteUintL(TPtrC(GPRS_REQ_PRECEDENCE), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_DELAY), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_RELIABILITY), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_PEAK_THROUGHPUT), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_MEAN_THROUGHPUT), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_PRECEDENCE), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_DELAY), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_RELIABILITY), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_PEAK_THROUGHPUT), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_MEAN_THROUGHPUT), 0); + + aTable->WriteUintL(TPtrC(GPRS_IF_AUTH_RETRIES), 0); + + aTable->WriteBoolL(TPtrC(GPRS_DATA_COMPRESSION), EFalse ); + aTable->WriteUintL(TPtrC(GPRS_PDP_TYPE), RPacketContext::EPdpTypeIPv4); // IPV4 + + aTable->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), EFalse ); + aTable->WriteBoolL(TPtrC(GPRS_ANONYMOUS_ACCESS), EFalse ); + aTable->WriteBoolL(TPtrC(GPRS_HEADER_COMPRESSION), EFalse ); + + aTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue ); + aTable->WriteTextL(TPtrC(GPRS_IP_GATEWAY), KNSmlEmptyIpv4Address); + + aTable->WriteTextL(TPtrC(GPRS_IP_ADDR), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(GPRS_IF_PARAMS), KNullDesC); + aTable->WriteTextL(TPtrC(GPRS_IP_NETMASK), KNullDesC); + + aTable->WriteUintL(TPtrC(GPRS_QOS_WARNING_TIMEOUT), 0xffffffff); + + aTable->WriteUintL(TPtrC(GPRS_AP_TYPE), (TUint32)EIspTypeInternetAndWAP); + + + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::InitializeProxyL() +// Initialize Proxy-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeProxyL( CCommsDbTableView* aTable ) + { + _LIT(KprotocolName, "http"); // http, https, ftp, ftps + const TUint32 KPortNumber(80); + + aTable->WriteUintL(TPtrC(PROXY_ISP), iProxyISP); // ISP with which these proxies are associated + + aTable->WriteTextL(TPtrC(PROXY_SERVICE_TYPE), iProxyServiceType); // Type ISP/GPRS + aTable->WriteBoolL(TPtrC(PROXY_USE_PROXY_SERVER), ETrue ); + + TPtr proxyName16 = HBufC::NewLC( iProxyServerName.Length() )->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( proxyName16, iProxyServerName ); + + aTable->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), proxyName16); // Name of the proxy server + aTable->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), KprotocolName); // also https + ftps + + aTable->WriteUintL(TPtrC(PROXY_PORT_NUMBER), KPortNumber); + + aTable->WriteLongTextL(TPtrC(PROXY_EXCEPTIONS), KNullDesC); + + CleanupStack::PopAndDestroy(); //proxyName16 + return KErrNone; + } + + +// CNSmlInternetAdapter::IsInsertAllowedL +// Check if possible to Add new AP +// +//============================================= +TBool CNSmlInternetAdapter::IsInsertAllowedL() + { + TBool theBool = EFalse; +// +// Id + Name + Bearer needed for Insert +// + if ( + iIAPName.Length() > 0 && + iBearer.Length() > 0 && + iDirection != ECommDbConnectionDirectionUnknown) + { + theBool = ETrue; + } +// +// Should check also if Name or iISPId in USE !!! +// + if(theBool) + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingTextLC(iBearer, + TPtrC(COMMDB_NAME), + iIAPName); + TInt errorCode = tableView->GotoFirstRecord(); + + // Node allready exists => No adding possible + if ( errorCode == KErrNone ) + { + DBG_ARGS8(_S8("CNSmlInternetAdapter::NODE NAME <%S> ALLREADY(): error"), &iIAPName ); + theBool = EFalse; + } + CleanupStack::PopAndDestroy(tableView); + } + return theBool; + } + +//============================================= +// CNSmlInternetAdapter::SaveIAPDataL +// Saves data to IAP-table +// +//============================================= +void CNSmlInternetAdapter::SaveIAPDataL(const TDesC8& aURI) + { + TInt errorCode; + CCommsDbTableView* tableView; + + TBool apEnforce=EFalse; + TBool iapReLock = EFalse; + + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::SaveIAPDataL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if(eError==KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + if(iIAPExists) + { + tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), iIAPId); + if(IsIAPRecordLockedL(iIAPId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + errorCode = tableView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + // if enforcement is on and rec exists, it needs to be unprotected + if ( apEnforce ) + { + ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); + } + } + errorCode = tableView->UpdateRecord(); + } + } + else + { + tableView = iDatabase->OpenTableLC(TPtrC(IAP)); + + errorCode = tableView->InsertRecord(iIAPId); + } + + if ( errorCode == KErrNone ) + { + TUint32 modemISPId = 1; // Default + TBuf modemBearer = TPtrC(MODEM_BEARER); + if(iBearer == TPtrC(LAN_SERVICE)) + { + modemBearer = TPtrC(LAN_BEARER); + } + else if(iBearer == TPtrC(VPN_SERVICE)) + { + modemBearer = TPtrC(VIRTUAL_BEARER); + } + else + { + modemBearer = TPtrC(MODEM_BEARER); + } + + if(modemBearer == TPtrC(MODEM_BEARER)) + { + GetModemBearerL(modemISPId); + } + else if(modemBearer == TPtrC(VIRTUAL_BEARER)) + { + modemISPId = 1; + } + else if ( iWlanSupported ) + { + GetLanBearerL(modemISPId); + } + tableView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + + // ISP id must be written + tableView->WriteUintL(TPtrC(IAP_SERVICE), iISPId); + tableView->WriteTextL(TPtrC(IAP_SERVICE_TYPE), iBearer); + + tableView->WriteUintL(TPtrC(IAP_BEARER), modemISPId); + tableView->WriteTextL(TPtrC(IAP_BEARER_TYPE), modemBearer); + if( iNetworkId != KErrNotFound ) + { + tableView->WriteUintL(TPtrC(IAP_NETWORK), iNetworkId); // First name on network table + } + tableView->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0); + tableView->WriteUintL(TPtrC(IAP_LOCATION), 2); // Minimum=2 + + + errorCode = tableView->PutRecordChanges(); + } + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + ((CCommsDbProtectTableView*)tableView)->ProtectRecord(); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iIAPId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + + if ( errorCode == KErrNone ) + { + if(!iIAPExists) + { + TUint32 lValue; + tableView->ReadUintL(TPtrC(COMMDB_ID),lValue); + + // Add AP + TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfAP); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,lValue); + + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + DBG_ARGS8(_S8("AP:level1 URI - <%S> <%S> <%d>"), &addURI, &addLUID, lValue ); + } + + iIAPExists = ETrue; + } + + if (apEnforce) + apEnforce=EFalse; // to rget rid of warnings + + CleanupStack::PopAndDestroy(); // tableView + User::LeaveIfError(errorCode); + } + +//============================================= +// CNSmlInternetAdapter::GetMaxIdL +// Get max id from given bearer +// +//============================================= +TUint32 CNSmlInternetAdapter::GetMaxIdL() + { + CCommsDbTableView* checkView; + TUint32 maxGPRS(0); + checkView = iDatabase->OpenTableLC(iBearer); + TInt errorCodem = checkView->GotoFirstRecord(); + while (errorCodem == KErrNone) + { + TUint32 lValue; + checkView->ReadUintL(TPtrC(COMMDB_ID),lValue); + if(lValue > maxGPRS) + { + maxGPRS = lValue; + } + errorCodem = checkView->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(); // checkView + + return (maxGPRS); + } + +//============================================= +// CNSmlInternetAdapter::GetProxyIdL +// Get proxy id for given IAP +// +//============================================= +TBool CNSmlInternetAdapter::GetProxyIdL(const TDesC8& aURI) + { + TBool proxyFound = EFalse; + + CCommsDbTableView* checkView; + + // Get servicetype for IAP nbr + + TUint32 iapID = GetAPIdFromURIL(aURI); + if( iapID == 0 ) + { + if( IsAPUriFormatMatchPredefined(aURI) ) + { + iLUID = ConstructTreeL(aURI); + iapID = GetAPIdFromURIL(aURI); + } + + } + // IAP-table search serviceType + serviceId + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + iapID); + + TBuf serviceType; + TUint32 serviceId; + + TInt errorCode = iapView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if ( errorCode == KErrNone ) + { + iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + iapView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); + CleanupStack::PopAndDestroy(); // iapView + } + else + { + CleanupStack::PopAndDestroy(); // iapView + return proxyFound; + } + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), + TPtrC(PROXY_SERVICE_TYPE), + serviceType); + + TInt errorCodem = checkView->GotoFirstRecord(); + + while (errorCodem == KErrNone) + { + TUint32 lValue; + checkView->ReadUintL(TPtrC(PROXY_ISP),lValue); + if(lValue == serviceId) + { + checkView->ReadUintL(TPtrC(COMMDB_ID),iProxyId); + proxyFound = ETrue; + break; + } + errorCodem = checkView->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(); // checkView + + return proxyFound; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::APExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::APExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // checkView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::NetworkExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::NetworkExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // checkView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::NetworkNameExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::NetworkNameExistsL(TUint32& aId, const TDesC8& aObject) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(NETWORK),TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), aId); + ret = ETrue; + } + + CleanupStack::PopAndDestroy(2); // checkView ConvertTo16LC + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::AddNetworkL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::AddNetworkL(TUint32& aId, const TDesC8& aObject) + { + TBool ret = EFalse; + TUint32 newId; + CCommsDbTableView* networkView = iDatabase->OpenTableLC(TPtrC(NETWORK)); + + if( networkView->InsertRecord(newId) == KErrNone ) + { + networkView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + if(networkView->PutRecordChanges() == KErrNone) + { + networkView->ReadUintL(TPtrC(COMMDB_ID), aId); // New networks Id + ret = ETrue; + } + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + CleanupStack::PopAndDestroy(); // networkView + DBG_ARGS8(_S8("NsmlInternetAdapter: AddNetworkL:networkId %d"), aId); + + return ret; + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::NAPDefExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::NAPDefExistsL(TUint32 aId ) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(IAP_SERVICE), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + TBuf serviceType; + + checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType,TPtrC(COMMDB_ID), aId); + error = tableView->GotoFirstRecord(); + + if (error == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // tableView + } + + CleanupStack::PopAndDestroy(); // checkView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::PxExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::PxExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* pxView; + + pxView = iDatabase->OpenViewMatchingUintLC( TPtrC(PROXIES),TPtrC(COMMDB_ID), aId); + + TInt errorCode = pxView->GotoFirstRecord(); + + if (errorCode == KErrNone ) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // pxView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::WapAPExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::WapAPExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* wapView; + + wapView = iDatabase->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),TPtrC(WAP_IAP), aId); + + TInt errorCode = wapView->GotoFirstRecord(); + + if (errorCode == KErrNone ) + { + wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId); + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // wapView + + return ret; + } + +//------------------------------------------------------------------------------ +// TUint32 CNSmlInternetAdapter::GetAPIdFromURIL(const TDesC8& aURI) +// Get AP luid for given aURI +//------------------------------------------------------------------------------ +TUint32 CNSmlInternetAdapter::GetAPIdFromURIL(const TDesC8& aURI) + { + HBufC8* apURI = HBufC8::NewLC(aURI.Length()); + + _DBG_FILE("CNSmlInternetAdapter::GetAPIdFromURIL(): begin"); + DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL - %S "), &aURI); +// +// Second slash after AP +// + TInt i= 0; + for( i=aURI.Find(KNSmlDdfAP)+3; i < aURI.Length(); i++ ) + { + if(aURI[i]=='/') + { + break; + } + } + DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL i is %d "), i); + if(i>0) + { + apURI->Des().Format(aURI.Left(i)); + } +// +// Same profile as previous +// + if(iPrevURI->Match(*apURI) != KErrNotFound) + { + _DBG_FILE("CNSmlInternetAdapter::GetAPIdFromURIL(): previous uri"); + CleanupStack::PopAndDestroy(); // apURI + return iPrevLUID; + } +// +// Fetch AP-id for URI +// + HBufC8* apLUID = iCallBack->GetLuidAllocL(*apURI); + CleanupStack::PushL(apLUID); + + TUint32 resLUID = IntLUID(*apLUID); + DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL luidallocation is %d "), resLUID); + + if ( resLUID > 0 ) + { + iPrevURI->Des().Format( *apURI ); + iPrevLUID = resLUID; + } + + CleanupStack::PopAndDestroy(2); // apURI, apLUID + + return resLUID; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteProxyL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteProxyL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* pxView; + + pxView = iDatabase->OpenViewMatchingUintLC( TPtrC(PROXIES),TPtrC(COMMDB_ID), aId); + + TInt errorCode = pxView->GotoFirstRecord(); + + if (errorCode == KErrNone ) + { + errorCode = pxView->DeleteRecord(); + if (errorCode == KErrNone ) + { + ret = ETrue; + } + } + + CleanupStack::PopAndDestroy(); // pxView + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteWapAPL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteWapAPL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* wapView; + + TUint32 wapId = 0; + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce=EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteWAPAPL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if(eError==KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + wapView = iDatabase->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),TPtrC(WAP_IAP), aId); + + TInt errorCode = wapView->GotoFirstRecord(); + + if (errorCode == KErrNone ) + { + wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), wapId); // WapIAP id + errorCode = wapView->DeleteRecord(); + if (errorCode == KErrNone ) + { + ret = ETrue; + } + } + + if(ret) + { + CCommsDbTableView* wapApView = iDatabase->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),TPtrC(COMMDB_ID), wapId); + + errorCode = wapApView->GotoFirstRecord(); + + if (errorCode == KErrNone ) + { + errorCode = wapApView->DeleteRecord(); + if (errorCode == KErrNone ) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy(); // wapApView + } + + CleanupStack::PopAndDestroy(); // wapView + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteNAPDefL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteNAPDefL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + TBool apEnforce=EFalse; + TBool iapReLock = EFalse; + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAPD( eError,apEnforce=CheckEnforcementL() ) + DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteNAPDefL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if( eError==KErrNone && apEnforce ) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(IAP_SERVICE), aId); + if(IsIAPRecordLockedL(aId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)checkView)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + TBuf serviceType; + + checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType,TPtrC(COMMDB_ID), aId); + error = tableView->GotoFirstRecord(); + + if (error == KErrNone) + { + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if ( apEnforce ) + { + ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); + } + } + + error = tableView->DeleteRecord(); + if (error == KErrNone ) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy(); // tableView + } + + CleanupStack::PopAndDestroy(); // checkView + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(aId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + if (apEnforce) + apEnforce=EFalse; // to get rid of warnings + + return ret; + } + +// --------------------------------------------------------------------------- +// Removes iapID and linger interval from CentralRepository +// --------------------------------------------------------------------------- +// +void CNSmlInternetAdapter::DeleteLingerL( const TInt aIapId ) + { + TInt err( KErrNone ); + + // Open repository + CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); + + // Find if an entry for "iapId" already exists in CentRep + RArray< TUint32 > foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL( KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys ); // found keys + + if ( err == KErrNone ) + { + if ( foundKeys.Count() > 0 ) + { + TInt arrayCount( 0 ); + + // Get number of iapId&linger entries in Centrep + err = repository->Get( KPdpContextManagerLingerArrayCount, arrayCount ); + + if ( err == KErrNone ) + { + TInt32 row = foundKeys[ 0 ] & KRowMask; + + // Shift existing entries one position left + for ( TInt i=row+1; i <= arrayCount; i++ ) + { + TInt iapId( 0 ); + TInt linger( 0 ); + + err = repository->Get( ( KIapColumn | i ), iapId ); + + if ( err == KErrNone ) + { + err = repository->Get( ( KLingerColumn | i ), linger ); + } + + if ( err == KErrNone ) + { + err = repository->Set( ( KIapColumn | (i-1) ), iapId ); + } + + if ( err == KErrNone ) + { + err = repository->Set( ( KLingerColumn | (i-1) ), linger ); + } + } + + // Remove the last entry on row arrayCount + if ( err == KErrNone ) + { + TUint32 errorKey( 0 ); + + err = repository->Delete( ( KIapColumn | arrayCount ), + 0xFFFFFFFF, + errorKey); + + if ( err == KErrNone ) + { + err = repository->Delete( ( KLingerColumn | arrayCount ), + 0xFFFFFFFF, + errorKey); + arrayCount--; + } + } + + // Update number of iapId&linger entries in Centrep + err = repository->Set( KPdpContextManagerLingerArrayCount, arrayCount ); + } + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy( repository ); + + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteAPL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteAPL(TUint32 aId) + { + TBool ret = EFalse; + + //Check MIP IAP first then go forward + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce=EFalse; + TBool wlanEnforce= EFalse; + TInt wError = KErrNone; + TRAP(wError,wlanEnforce=CheckWLANEnforcementL()); + TRAPD( eError,apEnforce=CheckEnforcementL() ) + if( wlanEnforce) + { + UnprotectWLANAPItemL(aId); + } + DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteAPL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if( eError==KErrNone && apEnforce ) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + + if(iDatabase->InTransaction()) + iDatabase->CommitTransaction(); + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cmConMethodExt ; + TRAPD(err, cmConMethodExt= cmManagerExt.ConnectionMethodL( aId )); + CleanupClosePushL( cmConMethodExt ); + if(err == KErrNone) + { + TRAPD(dError,cmConMethodExt.DeleteL()); + if(dError == KErrNone) + { + DeleteLingerL( aId ); + ret= ETrue; + } + } + + CleanupStack::PopAndDestroy( ); + cmManagerExt.Close(); + if(!iDatabase->InTransaction()) + { + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("DeleteAPL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteAPL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + } + + //The following code is kept under #ifndef , so that it can be removed + //after RD_DM_APPLICATION_LEVEL_ROAMING_SUPPORT becomes stable. + + /* #ifndef RD_DM_APPLICATION_LEVEL_ROAMING_SUPPORT + CCommsDbTableView* checkView; + CCommsDbTableView* proxyView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + // + // Remove possible NAPDef-data first if ONLY IAP + // + TBuf serviceType; + TUint32 serviceId; + + checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + checkView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); + + + CCommsDbTableView* tableView; + tableView= iDatabase->OpenViewMatchingUintLC(serviceType, TPtrC(COMMDB_ID), serviceId); + error = tableView->GotoFirstRecord(); + if (error == KErrNone ) + { + error = tableView->DeleteRecord(); + } + CleanupStack::PopAndDestroy(); // tableView + + // + // Delete Proxies for AP also + // + proxyView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), + TPtrC(PROXY_SERVICE_TYPE), + serviceType); + + TInt errorProxy = proxyView->GotoFirstRecord(); + + while (errorProxy == KErrNone) + { + TUint32 lValue; + proxyView->ReadUintL(TPtrC(PROXY_ISP),lValue); + if(lValue == serviceId) + { + proxyView->ReadUintL(TPtrC(COMMDB_ID),iProxyId); + DBG_ARGS8(_S8("DeleteAPL:Delete ServiceId=%d ProxyId=%d"),lValue, iProxyId); + error = proxyView->DeleteRecord(); + } + errorProxy = proxyView->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(); // proxyView + + error = checkView->DeleteRecord(); + if( error == KErrNone ) + { + ret = ETrue; + } + + // Delete WAP also + if(WapAPExistsL(aId)) + { + DeleteWapAPL(aId); + } + } + + CleanupStack::PopAndDestroy(); // checkView + #endif + */ + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + return ret; + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlInternetAdapter::LastURISeg(const TDesC8& aURI) +// Returns only the last uri segment +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::LastURISeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]=='/') + { + break; + } + } + if(i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlInternetAdapter::FirstURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::FirstURISeg(const TDesC8& aURI) + { + TInt j= 0; + for(TInt i=0;i<=aURI.Length()-1;i++) + { + if(aURI[i]=='/') + { + for(j=i+1;j<=aURI.Length()-1;j++) + { + if(aURI[j]=='/') // Second slash => AP/xxxx + break; + } + break; + } + } + return aURI.Left(j); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlInternetAdapter::GetDynamicAPNodeUri( const TDesC8& aURI ) +// returns AP/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::GetDynamicAPNodeUri( const TDesC8& aURI ) + { + _DBG_FILE("CNSmlInternetAdapter::GetDynamicAPNodeUri(): begin"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::GetDynamicAPNodeUri() - <%S> "), &aURI); + + TInt i= 0; + for ( i = aURI.Find( KNSmlDdfAP ) + 3; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + _DBG_FILE("CNSmlInternetAdapter::GetDynamicAPNodeUri(): end"); + + return aURI.Left( i ); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::ExecuteBufferL(const TDesC8& aURI) +// Executes commands for AP after Bearer-data is set +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::ExecuteBufferL(const TDesC8& aURI, const TBool aCompleting) + { + // + // Choose AP according to aURI + // + iExecutingBuffer = ETrue; + for(TInt i = 0; iCount(); i++) + { + TPtrC8 parentUri = FirstURISeg(aURI); + if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) + { + iExecutionIndex = i; + break; + } + } + + if((iExecutionIndex<0) || (iExecutionIndex >= iBuffer->Count())) + { + return; + } + + iISPId = 0; + // + // Execute all commands for One AP NAPDef + // + if ( iBuffer->At(iExecutionIndex).iDnsUpdateBuf ) + { + iDnsUpdate = ETrue; + } + + for(TInt cmd=iBuffer->At(iExecutionIndex).iNodeBuf->Count()-1;cmd>=0;cmd--) + { + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + + if(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Match(_L8("AP/*/Px*")) != 0) + { + + if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iLeaf) + { + addLUID.Format(KFormat,0); + if(iBuffer->At(iExecutionIndex).iLuid > 0) + { + addLUID.Format(KFormat,-1); // Used for Status return + } + AddNodeObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des(), + addLUID, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iStatusRef); + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + } + else + { + if ( iBuffer->At(iExecutionIndex).iDnsUpdateBuf ) + { + addLUID.Zero(); + addLUID.Append(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iLuid->Des()); + } + else + { + addLUID.Format(KFormat,iBuffer->At(iExecutionIndex).iLuid); + if(!iBuffer->At(iExecutionIndex).iDirection || // The three values has to be set + !iBuffer->At(iExecutionIndex).iBearer || + !iBuffer->At(iExecutionIndex).iNameReceived ) // before new AP set + { + addLUID.Format(KFormat,KNSmlIncompleteAP); // (-1) Used for error + } // Status return + } + //iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); + + AddLeafObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des(), + addLUID, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iData->Des(), + KNSmlMimeTypeTextPlain, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iStatusRef); + + if(iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL + iBuffer->At(iExecutionIndex).iLuid = iISPId; + } + + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iDone = ETrue; + } + + } + // + // Execute all commands for One AP Px + // + for(TInt cmd2=0;cmd2 < iBuffer->At(iExecutionIndex).iNodeBuf->Count();cmd2++) + { + TBuf8<16> addLUID2; + _LIT8(KFormat,"%d"); + if(!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iDone) + { + if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iLeaf) + { + addLUID2.Format(KFormat,0); + if(iBuffer->At(iExecutionIndex).iLuid > 0) + { + addLUID2.Format(KFormat,-1); // Used for Status return + } + AddNodeObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri->Des(), + addLUID2, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iStatusRef); + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + } + else + { + addLUID2.Format(KFormat,iBuffer->At(iExecutionIndex).iLuid); + iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); + if(!iBuffer->At(iExecutionIndex).iDirection || // Allvalues has to be set + !iBuffer->At(iExecutionIndex).iBearer || + !iBuffer->At(iExecutionIndex).iName) // before new AP set + { + addLUID2.Format(KFormat,KNSmlIncompleteAP); // (-1) Used for error + } // Status return + + AddLeafObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri->Des(), + addLUID2, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData->Des(), + KNSmlMimeTypeTextPlain, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iStatusRef); + + if(iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL + iBuffer->At(iExecutionIndex).iLuid = iISPId; + } + } //++ + + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iDone = ETrue; + + delete iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri; + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri = NULL; + + if(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData) + { + delete iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData; + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData = NULL; + } + } + + // Wlan buffer execution only when called from CompleteOutstandingCmdsL (= aCompleting) + for(TInt i = 0; aCompleting && i < iBuffer->At(iExecutionIndex).iWlanNodeBuf->Count(); ++i ) + { + TBuf8<16> addLUID; + _LIT8( KFormat,"%d" ); + + if ( !iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iLeaf ) + { + addLUID.Format( KFormat, 0 ); + + if( iBuffer->At( iExecutionIndex ).iLuid > 0 ) + { + addLUID.Format( KFormat, iBuffer->At(iExecutionIndex).iLuid ); + } + + AddNodeObjectL( iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iUri->Des(), + addLUID, + iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iStatusRef ); + + iBuffer->At( iExecutionIndex ).iExecuted = ETrue; + } + else + { + addLUID.Zero(); + addLUID.Append( iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iLuid->Des() ); + + iIAPName = iBuffer->At( iExecutionIndex ).iName->Des(); + + AddLeafObjectL( iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iUri->Des(), + addLUID, + iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iData->Des(), + KNSmlMimeTypeTextPlain, + iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iStatusRef); + + if( iBuffer->At( iExecutionIndex ).iLuid == 0 ) // After BearerL + { + iBuffer->At( iExecutionIndex ).iLuid = iISPId; + } + + } + + iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iDone = ETrue; + } + +// +// Remove data from handled AP-commands +// + + ClearBuffer( iBuffer->At(iExecutionIndex).iNodeBuf ); + + if ( aCompleting ) + { + delete iBuffer->At(iExecutionIndex).iNodeBuf; + + ClearBuffer( iBuffer->At(iExecutionIndex).iWlanNodeBuf ); + delete iBuffer->At(iExecutionIndex).iWlanNodeBuf; + + if(iBuffer->At(iExecutionIndex).iMappingName) + { + delete iBuffer->At(iExecutionIndex).iMappingName; + iBuffer->At(iExecutionIndex).iMappingName = NULL; + } + + if(iBuffer->At(iExecutionIndex).iName) + { + delete iBuffer->At(iExecutionIndex).iName; + iBuffer->At(iExecutionIndex).iName = NULL; + } + + iBuffer->Delete(iExecutionIndex); + iBuffer->Compress(); + } + + iExecutingBuffer = EFalse; + iStaleMapUpdate = EFalse; + } + +//------------------------------------------------------------------------------ +// TPtrC16 CNSmlInternetAdapter::GetAddURISeg(const TDesC8& aURI,const TDesC8 aName) +// Returns uri segment until the next segment after given aName +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::GetAddURISeg(const TDesC8& aURI,const TDesC8& aName) + { + TInt lStrt = aURI.Find(aName); + if (lStrt == KErrNotFound) + { + return aURI; + } + + lStrt += 1; + TInt i = 0; + for( i=lStrt+aName.Length(); i <= aURI.Length()-1; i++ ) + { + if(aURI[i]=='/') + { + break; + } + } + if(i==0) + { + return aURI; + } + else + { + return aURI.Left(i); + } + } + +//============================================= +// CNSmlInternetAdapter::InitializeWAPAIPL() +// Initialize WAP IAP-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeWAPIAPL( CCommsDbTableView* aTable, + const TDesC8& aName ) + { + aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aName)); // Same as IAP + + + aTable->WriteTextL(TPtrC(WAP_CURRENT_BEARER), iWapBearer); + aTable->WriteLongTextL(TPtrC(WAP_START_PAGE), ConvertTo16LC(iWAPAccessPoint)); + CleanupStack::PopAndDestroy(2); //ConvertTo16LC + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::InitializeWAPL() +// Initialize WAP IP Bearer-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeWAPL( CCommsDbTableView* aTable ) + { + TUint32 wapPortNumber = 0; + + aTable->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId); + aTable->WriteTextL(TPtrC(WAP_GATEWAY_ADDRESS), KNSmlEmptyIpv4Address); + + aTable->WriteUintL(TPtrC(WAP_WSP_OPTION), EWapWspOptionConnectionOriented); // EWapWspOptionConnectionless + aTable->WriteBoolL(TPtrC(WAP_SECURITY), EFalse ); // if 9200 => false + + aTable->WriteUintL(TPtrC(WAP_IAP), iISPId); + aTable->WriteUintL(TPtrC(WAP_PROXY_PORT), wapPortNumber); + + aTable->WriteTextL(TPtrC(WAP_PROXY_LOGIN_NAME), ConvertTo16LC(iWapUserName)); + aTable->WriteTextL(TPtrC(WAP_PROXY_LOGIN_PASS), ConvertTo16LC(iWapPassword)); + + CleanupStack::PopAndDestroy(2); //ConvertTo16LC + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::IsWapPort() +// Check if portnbr for proxy or wap +// +//============================================= +void CNSmlInternetAdapter::IsWapPort( const TDesC8& aObject ) + { + iWapPort = EFalse; + TInt portNbr = GetIntObject8(aObject); + if( portNbr >= KNSmlApWapLowerBase && portNbr <= KNSmlApWapUpperBase ) + { + iWapPort = ETrue; + } + } + +// ------------------------------------------------------------------------------------- +// CNSmlInternetAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CNSmlInternetAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) + + { + aNode.SetAccessTypesL(aAccTypes); + aNode.SetOccurenceL(aOccurrence); + aNode.SetScopeL(aScope); + aNode.SetDFFormatL(aFormat); + if(aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KNSmlMimeType); + } + aNode.SetDescriptionL(aDescription); + } + + +//======================================================= +// CNSmlInternetAdapter::UpdateIAPnameL() +// Update IAP-table name add Network-table if needed +// Add/update WAP-table name also +// +//======================================================= +TInt CNSmlInternetAdapter::UpdateIAPnameL( TUint32 aId, const TDesC8& aObject ) + { + + TUint32 nwId=0; + TInt ret = KErrNone; + TBool iapReLock = EFalse; + + TBool apEnforce=EFalse; + TRAPD( eError,apEnforce=CheckEnforcementL() ) + DBG_ARGS8(_S8("CNSmlInternetAdapter::UpdateIAPNAme(): EError %d , APEnforcement is %d"),eError,apEnforce); + if( eError==KErrNone && apEnforce ) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + + CCommsDbTableView* iapUpdate = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); + if(IsIAPRecordLockedL(aId)) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = ((CCommsDbProtectTableView*)iapUpdate)->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + TInt error = iapUpdate->GotoFirstRecord(); + if (error == KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateIAPName, IAP_NETWORK set"); + TRAPD(err, iapUpdate->ReadUintL(TPtrC(IAP_NETWORK),nwId)); + + if(iapUpdate->UpdateRecord()==KErrNone) + { + iapUpdate->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + + if( err != KErrNone ) // Network entry not yet created + { + AddNetworkL(nwId,aObject); + if( nwId > 0 ) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateIAPName, IAP_NETWORK set"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::UpdateIAPName(): networks is %d"),nwId); + iapUpdate->WriteUintL(TPtrC(IAP_NETWORK),nwId); + } + else + { + ret = KErrGeneral; + } + } + iapUpdate->PutRecordChanges(); + } + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + CleanupStack::PopAndDestroy(); // iapUpdate + + + if(WapAPExistsL(aId)) + { // Update handled + CCommsDbTableView* wapView; + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + iWapId); + TInt errorCode = wapView->GotoFirstRecord(); + + // Read all columns needed. + if ( errorCode == KErrNone ) + { + if(wapView->UpdateRecord()==KErrNone) + { + wapView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + wapView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + } + CleanupStack::PopAndDestroy(); // wapView + } + else + { // Insert handled + CCommsDbTableView* insView; + TInt wapInitOK = KErrCancel; + + insView = iDatabase->OpenTableLC(TPtrC(WAP_ACCESS_POINT)); + iWapId = 0; + wapInitOK = insView->InsertRecord(iWapId); + if(wapInitOK == KErrNone) + { + iWAPAccessPoint.Zero(); + iWapUserName.Zero(); + iWapPassword.Zero(); + iWapBearer = TPtrC(WAP_IP_BEARER); + + wapInitOK = InitializeWAPIAPL( insView, aObject ); + wapInitOK = insView->PutRecordChanges(); + + if( wapInitOK == KErrNone ) + { + CCommsDbTableView* updView; + TUint32 iWapId2 = 0; + iISPId = aId; // IAP number set + updView = iDatabase->OpenTableLC(TPtrC(WAP_IP_BEARER)); + if(updView->InsertRecord(iWapId2) == KErrNone) + { + InitializeWAPL(updView); + updView->PutRecordChanges(); + } + CleanupStack::PopAndDestroy(); // updView + } + } + else + { + ret = KErrGeneral; + } + CleanupStack::PopAndDestroy(); // insView + } + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if(iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(aId,ETrue); + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); + if(reclockerr==KErrNone) + iapReLock = EFalse; + } + return ret; + } + +//============================================= +// CNSmlInternetAdapter::InitializeVPNServiceL() +// Initialize VPNService-data before insert +//============================================= +TInt CNSmlInternetAdapter::InitializeVPNServiceL( CCommsDbTableView* aTable ) + { + _LIT(KdefPolicy, "Home"); + + aTable->WriteTextL(TPtrC(COMMDB_NAME) ,iIAPName); // Same as IAP + + aTable->WriteTextL(TPtrC(VPN_SERVICE_POLICY) ,KdefPolicy); + aTable->WriteUintL(TPtrC(VPN_SERVICE_IAP) ,1); + aTable->WriteUintL(TPtrC(VPN_SERVICE_NETWORKID) ,1); + + return KErrNone; + } + + +//============================================= +// CNSmlInternetAdapter::InitializeLANServiceL() +// Initialize LANService-data before insert +//============================================= +TInt CNSmlInternetAdapter::InitializeLANServiceL( CCommsDbTableView* aTable ) + { + if ( !iWlanSupported ) + { + _DBG_FILE("CNSmlInternetAdapter::InitializeLANServiceL, WLAN not supported."); + return KErrNotSupported; + } + _LIT(KgifNetworks, "ip,ip6"); + _LIT(Kdns6Address, "0:0:0:0:0:0:0:0"); + _LIT(KdefaultNetmask, "255.255.255.0"); + + aTable->WriteTextL(TPtrC(COMMDB_NAME) ,ConvertTo16LC(iIAPName)); // Same as IAP + aTable->WriteTextL(TPtrC(LAN_IF_NETWORKS) ,KgifNetworks); + aTable->WriteBoolL(TPtrC(SERVICE_IP_ADDR_FROM_SERVER),ETrue); // DHCP by default. + aTable->WriteTextL(TPtrC(SERVICE_IP_ADDR) ,KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(SERVICE_IP_NETMASK) ,KdefaultNetmask); + aTable->WriteBoolL(TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER),ETrue); + aTable->WriteTextL(TPtrC(SERVICE_IP_NAME_SERVER1),KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(SERVICE_IP_NAME_SERVER2),KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(SERVICE_IP_GATEWAY) ,KNSmlEmptyIpv4Address); + + aTable->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),ETrue ); + aTable->WriteTextL(TPtrC(SERVICE_IP6_NAME_SERVER1),Kdns6Address); + aTable->WriteTextL(TPtrC(SERVICE_IP6_NAME_SERVER2),Kdns6Address); + aTable->WriteTextL(TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KDaemonManagerName); + aTable->WriteTextL(TPtrC(SERVICE_CONFIG_DAEMON_NAME), KConfigDaemonName ); + + CleanupStack::PopAndDestroy(); //ConvertTo16LC + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::IsWLANfield() +// Check if handled by WLAN-adapter +//============================================= +TBool CNSmlInternetAdapter::IsWLANfield( const TDesC8& aURI ) + { + TBool ret(EFalse); + + SetField(aURI); + + if(KNSmlDdfNetworkID().Match(*iField) == 0) // ID not valid + { + return ret; + } + if(KNSmlDdfAP().Match(*iField) == 0) // AP not valid + { + return ret; + } + if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound) + { + DBG_ARGS8(_S8("AP:IsWLANfield URI - <%S> <%S> FOUND"), &aURI, iField ); + ret = ETrue; + } + + return ret; + } + +//============================================= +// CNSmlInternetAdapter::IsWlanL() +// Check if WLAN accesspoint +//============================================= +TBool CNSmlInternetAdapter::IsWlanL( const TDesC8& aURI ) + { + TBool ret(EFalse); + + if ( !iWlanSupported ) + { + _DBG_FILE("CNSmlInternetAdapter::IsWlanL, WLAN not supported."); + return ret; + } + + TBuf serviceType; + + // Get IAP nbr for servicetype + TUint32 apWlan = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapViews = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + apWlan); + + TInt errorCode = iapViews->GotoFirstRecord(); + + // Read iapService from (IAP) + if ( errorCode == KErrNone ) + { + iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + if(serviceType == TPtrC(LAN_SERVICE)) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy(); // iapViews + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::GetLanBearerL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::GetLanBearerL(TUint32& aId) + { + TBool ret = EFalse; + + if ( !iWlanSupported ) + { + _DBG_FILE("CNSmlInternetAdapter::GetLanBearerL, WLAN not supported."); + return ret; + } + + CCommsDbTableView* checkView; + + HBufC* bName = HBufC::NewLC(15); + TPtr bNamePtr = bName->Des(); + _LIT(KWlanBearer, "WLANBearer" ); + bNamePtr.Format( KWlanBearer ); + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(LAN_BEARER),TPtrC(COMMDB_NAME), bNamePtr); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), aId); + ret = ETrue; + } + else + { + aId = 1; // Default modem + } + DBG_ARGS8(_S8("CNSmlInternetAdapter:GetLanBearerL %d"), aId); + + CleanupStack::PopAndDestroy(2); // checkView bName + + return ret; + } + + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::GetModemBearerL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::GetModemBearerL(TUint32& aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + HBufC* bName = HBufC::NewLC(15); + TPtr bNamePtr = bName->Des(); + + if(iBearer == TPtrC(OUTGOING_GPRS) || + iBearer == TPtrC(INCOMING_GPRS) ) + { + _LIT(KGprsModem, "GPRS Modem" ); + bNamePtr.Format( KGprsModem ); + } + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(MODEM_BEARER),TPtrC(COMMDB_NAME), bNamePtr); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), aId); + ret = ETrue; + } + else + { + aId = 5; // Default modem 1->5 ??? + } + DBG_ARGS8(_S8("CNSmlInternetAdapter:GetModemBearerL %d"), aId); + + CleanupStack::PopAndDestroy(2); // checkView bName + + return ret; + } + + +// --------------------------------------------------------- +// NextAPNameL() +// Generates new AP name. +// --------------------------------------------------------- +void CNSmlInternetAdapter::NextAPNameL(const TDesC8& aName) + { + // generate name candidate + HBufC8* nameCandidate = HBufC8::NewLC(aName.Length()+12); + TPtr8 candidatePtr = nameCandidate->Des(); + + // loop while valid name is found + TBool validName; + + // loop while valid name is found + TInt i=0; + do { + validName = ETrue; + candidatePtr.Format(aName); + if(i>0) + { + _LIT( KLeftBrace, "(" ); + _LIT( KRightBrace, ")" ); + HBufC* buf = HBufC::NewLC(10); //10 = max length of 32bit integer + TPtr ptrBuf = buf->Des(); + ptrBuf.Num(i); + candidatePtr.Append( KLeftBrace ); + candidatePtr.Append(ptrBuf); + candidatePtr.Append( KRightBrace ); + CleanupStack::PopAndDestroy(); //buf + } + i++; + if(!IsValidNameL(candidatePtr)) + { + validName = EFalse; + } + } while( !validName ); + + iIAPName = candidatePtr; + + CleanupStack::PopAndDestroy(); //nameCandidate + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::IsValidNameL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::IsValidNameL(const TDesC8& aName) + { + TBool ret = ETrue; + CCommsDbTableView* nameView; + + nameView = iDatabase->OpenViewMatchingTextLC( TPtrC(IAP),TPtrC(COMMDB_NAME), aName); + + TInt errorCode = nameView->GotoFirstRecord(); + + if (errorCode == KErrNone ) + { + ret = EFalse; // If found error returned + } + + CleanupStack::PopAndDestroy(); // nameView + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::InitializeDNSParamsFromBuffL(const TPtrC8 aParentUri, +// TInt& aDnsPri ) +// Finds parameters needed in updating DNSAddrL from buffer +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::InitializeDNSParamsFromBuffL( const TPtrC8 aParentUri, + TInt& aDnsPri ) + { + TInt cmd(0); + TBool found(EFalse); + + TNSmlAPBufferElement& thisElem = iBuffer->At( 0 ); + + // Parse URI to match + CBufBase* buf = CBufFlat::NewL(150); + CleanupStack::PushL( buf ); + buf->InsertL(0, aParentUri); + buf->InsertL(buf->Size(), KNSmlDmApValFSlash); + buf->InsertL(buf->Size(), KNSmlDdfDNSPriority ); + TBuf8<150> tmp; + buf->Read(0, tmp, buf->Size()); + + cmd = thisElem.iNodeBuf->Count() -1; + // check if the DNSPriority is sent for DNSAddr/ + while( cmd >= 0 ) + { + TNSmlAPAddElement& dbgElem2 = thisElem.iNodeBuf->At(cmd); + if( thisElem.iNodeBuf->At(cmd).iUri->Match( tmp ) != KErrNotFound ) + { + TLex8 lex(thisElem.iNodeBuf->At(cmd).iData->Des()); + lex.Val(aDnsPri); + thisElem.iNodeBuf->At(cmd).iDone = ETrue; + found = ETrue; + } + cmd--; + } + CleanupStack::PopAndDestroy(buf); + return found; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DnsToLuid(const UriUtils::TUriHostType aType,) +// const TInt aPriority ) const +// Encodes special luid for DNSAddr/ +//------------------------------------------------------------------------------ +TInt CNSmlInternetAdapter::DnsToLuid( const UriUtils::TUriHostType aType, + const TInt aPriority ) const + { + return KNSmlApDnsLuidUpperBase + static_cast(aType)*10 + aPriority; + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::LuidToDns(UriUtils::TUriHostType& aType,) +// TInt& aPriority, const TInt aLuid ) const +// Decodes DNAddr/ type from LUID +//------------------------------------------------------------------------------ +TInt CNSmlInternetAdapter::LuidToDns( UriUtils::TUriHostType& aType, + TInt& aPriority, const TInt aLuid ) const + { + TInt err = KErrNone; + if ( aLuid < KNSmlApDnsLuidUpperBase ) + { + err = KErrGeneral; + } + else + { + aPriority = ( aLuid - KNSmlApDnsLuidUpperBase ) % 10; + if ( (aPriority > 0) && (aPriority < 3) ) + { + TInt type = ( aLuid - KNSmlApDnsLuidUpperBase - aPriority ) / 10; + if ( ( type >= 0 ) && ( type < 2 ) ) + { + aType = static_cast(type); + } + else + { + err = KErrGeneral; + } + } + else + { + err = KErrGeneral; + } + } + return err; + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::RemoveLastSeg(const TDesC8& aURI) +// Returns URI without its last segment +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::RemoveLastSeg(const TDesC8& aURI) const + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + break; + } + } + if(i>0) + { + return aURI.Left(i); + } + else + { + return KNullDesC8(); + } + } + +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::ClearBuffer() +// Deletes all dynamically allocated data from given array's each element +// and resets the buffer. +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::ClearBuffer( CArrayFixFlat* aBuffer ) + { + for( TInt i = 0; i < aBuffer->Count(); i++ ) + { + delete aBuffer->At(i).iUri; + aBuffer->At(i).iUri = NULL; + + delete aBuffer->At(i).iData; + aBuffer->At(i).iData = NULL; + + delete aBuffer->At(i).iLuid; + aBuffer->At(i).iLuid = NULL; + } + + aBuffer->Reset(); + } + + + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsValidIPv4AddressL(const TDesC8& aNapAddr) +//Checks if the string is of correct IPV4 address format x.x.x.x and +//numbers are within the range 0-255 +//returns true on sucess and false on failure. +//---------------------------------------------------------------------- +TBool CNSmlInternetAdapter::IsValidIPv4AddressL(const TDesC8& aNapAddr) + { + TInt digitLen(0); + TBool ret = EFalse; + _LIT8( KNSmlDMV4Format, "*.*.*.*" ); + + if( aNapAddr.Match(KNSmlDMV4Format)!= KErrNotFound ) + { + TInt pos = 0; + TInt numDots=0; + TInt maxIP=255; + TInt minIP=0; + for( TInt i=0;i KNSmlDMAsciiIntEnd )) + { + ret = EFalse; + break; + } + if(aNapAddr[i]==KNSmlDMDot) + { + ret = ETrue; + if (i > 0 ) + { + TInt digit; + TPtrC8 ptrOneDigit = aNapAddr.Mid(pos,digitLen-1); + TLex8 lexint(ptrOneDigit); + if( lexint.Val(digit)!=KErrNone || digit >= maxIP || digit < minIP ) + { + ret = EFalse; + break; + } + } // end of if i > 0 + pos = i+1; + numDots++; + digitLen=0; + } // end of if + } //End of for + if( numDots==3 && ret ) + { + ret = ETrue; + } + else + { + ret = EFalse; + } + } // end of outer if, format check + return ret; + } + +TBool CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* wapView; + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL record being checked = %d"),aRecord); + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + aRecord); + + TInt aAccess( 0 ); + if(wapView!=NULL) + { + _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) wapView )->GetRecordAccess( aAccess ) ); + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); + CleanupStack::PopAndDestroy( wapView); + if(aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect wapaccesspoint record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): BEGIN"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectWAPAccessRecordL , record and protect value =%d = %d"),aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* wapView; + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + aRecord); + if( wapView != NULL ) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): wap record exists"); + if( !aProtect ) + { + err = ( (CCommsDbProtectTableView*) wapView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectWAPAccessRecordL ,error code of Unprotectrecord = %d"),err); + } + + else + { + err = ( (CCommsDbProtectTableView*) wapView )->ProtectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectWAPAccessRecordL ,error code of ProtectRecord = %d"),err); + } + + CleanupStack::PopAndDestroy( wapView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): END"); + return err; + } + +//------------------------------------------------------------------------------ +// TUint32 CNSmlInternetAdapter::GetIAPSeamlessnessL(TUint32 aId) +// Gets the seamlessness value from the IAPMetadata table though the cmmanager API +//------------------------------------------------------------------------------ + +TUint32 CNSmlInternetAdapter::GetIAPSeamlessnessL(TUint32 aId) + { + _DBG_FILE("CNSmlInternetAdapter::GetIAPSeamlessnessL(): begin"); + //Deleting iDatabase, Required since CommsDB has one view open for reading and commsdat API would + //return KErrLocked if this is not done + TBool reopenTransaction( EFalse ); + if( iDatabase->InTransaction() ) + { + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + reopenTransaction = ETrue; + } + + + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL( aId ); + CleanupClosePushL( cm ); + TUint32 smless= cm.GetIntAttributeL( CMManager::ECmSeamlessnessLevel ); + CleanupStack::PopAndDestroy( ); + cmManagerExt.Close(); + + //Recreate reference to CommsDB since other tables + //are manipulated with Commsdb + if( reopenTransaction ) + { + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("GetIAPSeamlessnessL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("GetIAPSeamlessnessL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + } + + _DBG_FILE("CNSmlInternetAdapter::GetIAPSeamlessnessL(): End"); + return smless; + + } + +//------------------------------------------------------------------------------ +// TUint32 CNSmlInternetAdapter::GetIAPMetaDataL(TUint32 aId) +// Gets the metadata value from the IAPMetadata table though the cmmanager API +//-------------------------------------------------------------------------- + +TUint32 CNSmlInternetAdapter::GetIAPMetaDataL(TUint32 aId) + { + _DBG_FILE("CNSmlInternetAdapter::GetIAPMetaDataL(): begin"); + //Deleting iDatabase, Required since CommsDB has one view open for reading and commsdat API would + //return KErrLocked if this is not done + TBool reopenTransaction( EFalse ); + if( iDatabase->InTransaction() ) + { + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + reopenTransaction = ETrue; + } + + TUint32 metadata, highlight, hidden; + RCmManagerExt cmManagerExt; + + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL( aId ); + CleanupClosePushL( cm ); + + TBool metaHidden = cm.GetBoolAttributeL( CMManager::ECmMetaHiddenAgent); + TBool metaHL = cm.GetBoolAttributeL( CMManager::ECmMetaHighlight); + highlight = EMetaHighlight & metaHL; + hidden = EMetaHiddenAgent & metaHidden; + metadata = highlight | hidden; + + CleanupStack::PopAndDestroy( ); + cmManagerExt.Close(); + //Recreate reference to CommsDB since other tables + //are manipulated with Commsdb + if( reopenTransaction ) + { + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("GetIAPMetaDataL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("GetIAPMetaDataL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + } + + _DBG_FILE("CNSmlInternetAdapter::GetIAPMetaDataL(): end"); + return metadata; + + } +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef) +// Sets the seamlessness value to the IAPMetadata table though the cmmanager API +//------------------------------------------------------------------------------ + void CNSmlInternetAdapter::SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef) + { + + _DBG_FILE("CNSmlInternetAdapter::SetIAPSeamlessnessL(): begin"); + TBool reopenTransaction( EFalse ); + if( iDatabase->InTransaction() ) + { + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + reopenTransaction = ETrue; + } + + + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm ; + TInt cmerror = KErrNone; + TRAP(cmerror, cm= cmManagerExt.ConnectionMethodL( apMetaID )); + CleanupClosePushL( cm ); + TRAPD(sErr,cm.SetIntAttributeL( CMManager::ECmSeamlessnessLevel,aSeam )) + if(sErr == KErrNone) + { + cm.UpdateL(); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + CleanupStack::PopAndDestroy( ); + + cmManagerExt.Close(); + // iDatabase = CCommsDatabase::NewL(); + if( reopenTransaction ) + { + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("SetIAPSeamlessnessL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("SetIAPSeamlessnessL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + } + + _DBG_FILE("CNSmlInternetAdapter::SetIAPSeamlessnessL(): end"); + } + +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef) +// Sets the metadata value to the IAPMetadata table though the cmmanager API +//------------------------------------------------------------------------------ + + void CNSmlInternetAdapter::SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef) + { + + _DBG_FILE("CNSmlInternetAdapter::SetIAPMetaDataL(): begin"); + TInt hMHLErr = KErrNone; + TInt hMHAErr = KErrNone; + if(iDatabase) + { + iDatabase->CommitTransaction(); + // delete iDatabase; + } + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL( apMetaID ); + CleanupClosePushL( cm ); + + if(aMeta & EMetaHighlight) + { + TRAP(hMHLErr,cm.SetBoolAttributeL( CMManager::ECmMetaHighlight,ETrue)); + } + else + { + TRAP(hMHLErr,cm.SetBoolAttributeL( CMManager::ECmMetaHighlight,EFalse)); + } + + if(aMeta & EMetaHiddenAgent ) + { + TRAP(hMHAErr,cm.SetBoolAttributeL( CMManager::ECmMetaHiddenAgent,ETrue)); + } + else + { + TRAP(hMHAErr,cm.SetBoolAttributeL( CMManager::ECmMetaHiddenAgent,EFalse)); + } + if( (hMHAErr==KErrNone) && (hMHLErr==KErrNone) ) + { + cm.UpdateL(); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + + CleanupStack::PopAndDestroy( ); + + cmManagerExt.Close(); + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("SetIAPMetaDataL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("SetIAPMetaDataL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + + _DBG_FILE("CNSmlInternetAdapter::SetIAPMetaDataL(): end"); + } + + +void CNSmlInternetAdapter::AddLingerL( const TInt aIapId, const TInt aLingerInterval) +{ + TInt err( KErrNone ); + + // Open repository + CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); + + // Find if an entry for "iapId" already exists in CentRep + RArray< TUint32 > foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL( KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys ); // found keys + + if ( err == KErrNone || err == KErrNotFound ) + { + if ( foundKeys.Count() == 0 ) + { + // Add a new entry + TInt arrayCount( 0 ); + + // Get number of iapId&linger entries in Centrep + err = repository->Get( KPdpContextManagerLingerArrayCount, + arrayCount ); + + if ( err == KErrNone ) + { + arrayCount++; + + err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); + + if ( err == KErrNone ) + { + err = repository->Create( ( KLingerColumn | arrayCount ), + aLingerInterval ); + } + + if ( err == KErrNone ) + { + // Update number of iapId&linger entries in Centrep + err = repository->Set( KPdpContextManagerLingerArrayCount, + arrayCount ); + } + } + } + else + { + // Update existing entry on current row + TInt32 row = foundKeys[ 0 ] & KRowMask; + + err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy( repository ); + + User::LeaveIfError( err ); +} + +void CNSmlInternetAdapter::UpdateLingerL( const TInt aIapId, const TInt aLingerInterval ) + { + TInt err( KErrNone ); + + // Open repository + CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); + + // Find if an entry for "iapId" already exists in CentRep + RArray< TUint32 > foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL( KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys ); // found keys + + if ( err == KErrNone || err == KErrNotFound ) + { + + if ( foundKeys.Count() == 0 ) + { + // Add a new entry + TInt arrayCount( 0 ); + + // Get number of iapId&linger entries in Centrep + err = repository->Get( KPdpContextManagerLingerArrayCount, + arrayCount ); + + if ( err == KErrNone ) + { + arrayCount++; + + err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); + + if ( err == KErrNone ) + { + err = repository->Create( ( KLingerColumn | arrayCount ), + aLingerInterval ); + } + + if ( err == KErrNone ) + { + // Update number of iapId&linger entries in Centrep + err = repository->Set( KPdpContextManagerLingerArrayCount, + arrayCount ); + } + } + } + else + { + // Update existing entry on currebt row + TInt32 row = foundKeys[ 0 ] & KRowMask; + + err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy( repository ); + + User::LeaveIfError( err ); + } +void CNSmlInternetAdapter::GetLingerL( const TInt aIapId, TInt& aLingerInterval ) + { + TInt err( KErrNone ); + + // Open repository + CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); + + // Find if an entry for "iapId" already exists in CentRep + RArray< TUint32 > foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL( KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys ); // found keys + + if ( err == KErrNone ) + { + if ( foundKeys.Count() > 0 ) + { + // Find linger interval for the iap id on current row + TInt32 row = foundKeys[ 0 ] & KRowMask; + + err = repository->Get( ( KLingerColumn | row ), aLingerInterval ); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy( repository ); + + User::LeaveIfError( err ); + } + + + + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::CheckEnforcementL() +// If AP policy is enforced true is returned else false +//---------------------------------------------------------------------- +TBool CNSmlInternetAdapter::CheckEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceActive ( EFalse ); + User::LeaveIfError(info->EnforcementActive(EAPEnforcement, enforceActive)); + CleanupStack::PopAndDestroy(info); + return enforceActive; + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::CheckWLANEnforcementL() +// If WLAN AP policy is enforced true is returned else false +//---------------------------------------------------------------------- +TBool CNSmlInternetAdapter::CheckWLANEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceActive ( EFalse ); + User::LeaveIfError(info->EnforcementActive(EWLANEnforcement, enforceActive)); + CleanupStack::PopAndDestroy(info); + return enforceActive; + } + + +//---------------------------------------------------------------------- +//TInt CNSmlInternetAdapter::DoProtectWAPTablesL(TBool aProtect) +// if aProtect is true , tables are locked otherwise tables are unlocked. +//---------------------------------------------------------------------- + +TInt CNSmlInternetAdapter::DoProtectWAPTablesL(TBool aProtect) + { + TInt err = KErrNone; + CCommsDatabaseProtect* dbprotect = CCommsDatabaseProtect::NewL(); + CleanupStack::PushL(dbprotect); + for ( TInt i( 0 ); i < iLockTableList.Count(); i++ ) + { + if(!aProtect) + { + err = dbprotect->UnProtectTable( iLockTableList[ i ] ); + } + else + { + err = dbprotect->ProtectTable( iLockTableList[ i ] ); + } + + } + CleanupStack::PopAndDestroy( dbprotect ); + return err; + } +//---------------------------------------------------------------------- +//void CNSmlInternetAdapter::DoLockIAPTablesL(TBool aProtect) +// if aProtect is true , tables are locked otherwise tables are unlocked. +//---------------------------------------------------------------------- + +void CNSmlInternetAdapter::DoLockIAPTablesL(TBool aLock) + { + TInt protError = KErrNone; + TInt err = KErrNone; + iDatabase->CommitTransaction(); + iLockTableList.AppendL( TPtrC( WAP_ACCESS_POINT ) ); + iLockTableList.AppendL( TPtrC( WAP_IP_BEARER ) ); + iLockTableList.AppendL( TPtrC( IAP ) ); + + TRAP(err, protError = DoProtectWAPTablesL(aLock)); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoLockIAPTablesL(): Table protect error %d , leave error %d " ),protError,err); + + if ( protError != KErrNone ) // To remove the warnings + { + protError = KErrNone; + } + TInt dberr = iDatabase->BeginTransaction(); + if( dberr == KErrLocked ) + { + _DBG_FILE("DoLockIAPTablesL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DoLockIAPTablesL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if(dberr != KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave( dberr ); + } + } + } +//-------------------------------------------------------------------- +//TInt UnprotectWLANAPItemL(TUint32 aId) +//Unprotect the wlan AP if only wlan enforcement is on +//------------------------------------------------------------------- +TInt CNSmlInternetAdapter::UnprotectWLANAPItemL(TUint32 aId) +{ + _DBG_FILE("CNSmlInternetAdapter::UnprotectWLANAPItemL(): BEGIN"); + CCommsDbTableView* wapView; + + TInt errorCode = KErrNone; + TBuf serviceType; + + //check if its WLAN AP being deleted + wapView = iDatabase->OpenViewMatchingUintLC( TPtrC(IAP),TPtrC(COMMDB_ID), aId); + + errorCode = wapView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + wapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + if(serviceType != TPtrC(LAN_SERVICE)) + { + CleanupStack::PopAndDestroy(); // wapView + return KErrNone; + } + } + + ((CCommsDbProtectTableView*)wapView)->UnprotectRecord(); + + CleanupStack::PopAndDestroy(); // wapView + + _DBG_FILE("CNSmlInternetAdapter::UnprotectWLANAPItemL(): END"); + return errorCode; +} + + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsIAPRecordLockedL(TUint32 aRecord) +//check for wap access point record lock status +//---------------------------------------------------------------------- + +TBool CNSmlInternetAdapter::IsIAPRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* apView; + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsIAPRecordLockedL record being checked = %d"),aRecord); + apView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + aRecord); + + TInt aAccess( 0 ); + if(apView!=NULL) + { + _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) apView )->GetRecordAccess( aAccess ) ); + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsIAPRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); + CleanupStack::PopAndDestroy( apView); + if(aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect wapaccesspoint record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): BEGIN"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectIAPRecordL , record and protect value =%d = %d"),aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* apView; + apView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + aRecord); + if( apView != NULL ) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): wap record exists"); + if( !aProtect ) + { + err = ( (CCommsDbProtectTableView*) apView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectIAPAccessRecordL ,error code of Unprotectrecord = %d"),err); + } + + else + { + err = ( (CCommsDbProtectTableView*) apView )->ProtectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectIAPRecordL ,error code of ProtectRecord = %d"),err); + } + + CleanupStack::PopAndDestroy( apView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): END"); + return err; + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsProxyRecordLockedL(TUint32 aRecord) +//check for proxy record lock status +//---------------------------------------------------------------------- + +TBool CNSmlInternetAdapter::IsProxyRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* proxyView; + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL record being checked = %d"),aRecord); + proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + aRecord); + + TInt aAccess( 0 ); + if(proxyView!=NULL) + { + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) proxyView )->GetRecordAccess( aAccess ) ); + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); + CleanupStack::PopAndDestroy( proxyView); + if(aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect proxy record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): BEGIN"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL , record and protect value =%d = %d"),aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* proxyView; + proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), + aRecord); + if( proxyView != NULL ) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): wap record exists"); + if( !aProtect ) + { + err = ( (CCommsDbProtectTableView*) proxyView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of Unprotectrecord = %d"),err); + } + + else + { + err = ( (CCommsDbProtectTableView*) proxyView )->ProtectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of ProtectRecord = %d"),err); + } + + CleanupStack::PopAndDestroy( proxyView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): END"); + return err; + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsServiceRecordLockedL(TUint32 aRecord) +//check for proxy record lock status +//---------------------------------------------------------------------- + +TBool CNSmlInternetAdapter::IsServiceRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* serviceView; + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL record being checked = %d"),aRecord); + serviceView = iDatabase->OpenViewMatchingUintLC(iProxyServiceType, + TPtrC(COMMDB_ID), + aRecord); + + TInt aAccess( 0 ); + if(serviceView!=NULL) + { + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) serviceView )->GetRecordAccess( aAccess ) ); + DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); + CleanupStack::PopAndDestroy( serviceView); + if(aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect proxy record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectServiceRecordL(TUint32 aRecord,TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): BEGIN"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL , record and protect value =%d = %d"),aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* serviceView; + serviceView = iDatabase->OpenViewMatchingUintLC(iProxyServiceType, + TPtrC(COMMDB_ID), + aRecord); + if( serviceView != NULL ) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): wap record exists"); + if( !aProtect ) + { + err = ( (CCommsDbProtectTableView*) serviceView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of Unprotectrecord = %d"),err); + } + + else + { + err = ( (CCommsDbProtectTableView*) serviceView )->ProtectRecord(); + DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of ProtectRecord = %d"),err); + } + + CleanupStack::PopAndDestroy( serviceView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): END"); + return err; + } +//-------------------------------------------------------------------- +//TInt CNSmlInternetAdapter::IsAPUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CNSmlInternetAdapter::IsAPUriFormatMatchPredefined(const TDesC8 & aURI) +{ + if(aURI.Match(_L8("AP/APId*")) != KErrNotFound || + aURI.Match(_L8("AP/APId*/NAPDef/NAPId*")) != KErrNotFound) + { + return ETrue; + } + else + { + return EFalse; + } + + +} +//-------------------------------------------------------------------- +//TInt CNSmlInternetAdapter::ConstructTreeL(const TDesC8& aURI) +// +//------------------------------------------------------------------- + + +TUint32 CNSmlInternetAdapter::ConstructTreeL(const TDesC8& aURI) +{ + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): AP begin"); + TUint32 returnLuid = 0; // IAP doesn't exist + + CCommsDbTableView* apView = iDatabase->OpenTableLC(TPtrC(IAP)); + + TInt errorCode = apView->GotoFirstRecord(); + + while ( errorCode == KErrNone ) + { + TUint32 lValue; + TBool validService = EFalse; + apView->ReadUintL(TPtrC(COMMDB_ID),lValue); + + TBuf serviceType; + apView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + TUint32 bearerId = 0; + apView->ReadUintL(TPtrC(IAP_BEARER),bearerId); + // + // Skip other service types than GSM outgoing + // + if (serviceType == TPtrC(OUTGOING_GPRS) || + serviceType == TPtrC(INCOMING_GPRS)) + { + validService = ETrue; + } + + else if(serviceType == TPtrC(LAN_SERVICE) && + bearerId > 0) + { + validService = ETrue; + } + else if(serviceType == TPtrC(VPN_SERVICE)) + { + validService = ETrue; + } + + if(validService) + { + // Skip others + // + // Check if in aPreviousURISegmentList + // + TBool skipToNextIAP = EFalse; + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addAPURI; // AP/APIdnnn , nnn = profileid + addAPURI.Append(_L8("AP/APId")); + addAPURI.AppendNumFixedWidth(lValue,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,lValue); + + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addAPURI); + CleanupStack::PushL( mapInfo ); + if (mapInfo->Length() == 0) + { + iCallBack->SetMappingL(addAPURI,addLUID); + if( aURI.Find(addAPURI) >= 0 ) + { + returnLuid = lValue; + iPrevLUID = lValue; + } + } + else + { + skipToNextIAP= ETrue; + } + CleanupStack::PopAndDestroy( mapInfo ); + + if( !skipToNextIAP ) + { + // Add the NAPDef also + + TBuf serviceType; + TUint32 serviceId; + + CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), + lValue); + + errorCode = napdefView->GotoFirstRecord(); + if (errorCode == KErrNone ) + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + TPtrC(COMMDB_ID), + serviceId); + + errorCode = tableView->GotoFirstRecord(); + + while( errorCode == KErrNone ) + { + TUint32 lValue; + tableView->ReadUintL(TPtrC(COMMDB_ID),lValue); + // + // Check if in aPreviousURISegmentList + // + + _LIT8(Kprev,"NAPId"); + TBuf8<15> addNAME(Kprev); // APIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lValue,EDecimal,3); + + + _LIT8(Kprev2,"/NAPDef/NAPId"); + TBuf8<80> addURI; // AP/xxx/NAPDef/NAPIdnnn , nnn = id nbr + addURI.Append(addAPURI); + addURI.Append(Kprev2); + addURI.AppendNumFixedWidth(lValue,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,lValue); + + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); + CleanupStack::PushL( mapInfo ); + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + if( aURI.Find(addURI) >= 0 ) + returnLuid = lValue; + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set NAPDef Mapping "); + + TBuf columnValue; + TBuf8<16> addDNSLUID; + TBuf8<80> addDNSURI; // AP/xxx/NAPDef/DNSAddr/DNSx + _LIT8(KFormat,"%d"); + tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER1 ), columnValue); + + if ( ( columnValue.Length() > 0 ) ) + { + _LIT8(Kprev2,"/DNSAddr/DNS1"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 1)); + iCallBack->SetMappingL(addDNSURI,addLUID); + if( aURI.Find(addDNSURI) >= 0 ) + returnLuid = DnsToLuid( UriUtils::EIPv4Host, 1); + addDNSURI.Zero(); + } + + tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER2 ), columnValue); + if ( columnValue.Length() > 0 ) + { + _LIT8(Kprev2,"/DNSAddr/DNS2"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 2)); + iCallBack->SetMappingL(addDNSURI,addLUID); + if( aURI.Find(addDNSURI) >= 0 ) + returnLuid = DnsToLuid( UriUtils::EIPv4Host, 2); + addDNSURI.Zero(); + } + + tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER1 ), columnValue); + if ( columnValue.Length() > 0 ) + { + _LIT8(Kprev2,"/DNSAddr/DNS3"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat,DnsToLuid( UriUtils::EIPv6Host, 1) ); + iCallBack->SetMappingL(addDNSURI,addLUID); + if( aURI.Find(addDNSURI) >= 0 ) + returnLuid = DnsToLuid( UriUtils::EIPv6Host, 1); + addDNSURI.Zero(); + } + tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER2 ), columnValue); + if ( columnValue.Length() > 0 ) + { + _LIT8(Kprev2,"/DNSAddr/DNS4"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv6Host, 2)); + iCallBack->SetMappingL(addDNSURI,addLUID); + if( aURI.Find(addDNSURI) >= 0 ) + returnLuid = DnsToLuid( UriUtils::EIPv6Host, 2); + addDNSURI.Zero(); + } + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set DNS Mapping "); + + TUint32 nwID = 0; + napdefView->ReadUintL(TPtrC(IAP_NETWORK),nwID); // Networks luid + + CCommsDbTableView* nwView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), nwID); + + errorCode = nwView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + _LIT8(Kprev2,"/Networks/NwId"); + TBuf8<80> addNwURI; // AP/xxx/NAPDef/xxx/Networks/NwIdnnn , nnn = id nbr + addNwURI.Append(addURI); + addNwURI.Append(Kprev2); + addNwURI.AppendNumFixedWidth(nwID,EDecimal,3); + TBuf8<16> addNwLUID; + _LIT8(KFormat,"%d"); + addNwLUID.Format(KFormat,nwID); + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addNwURI); + CleanupStack::PushL( mapInfo ); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addNwURI,addNwLUID); + if( aURI.Find(addNwURI) >= 0 ) + returnLuid = nwID; + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set Networks Mapping "); + } + CleanupStack::PopAndDestroy( mapInfo ); + } + CleanupStack::PopAndDestroy(); // nwView + + if ( iWlanSupported ) + { + // Check WLAN node + if(serviceType == TPtrC(LAN_SERVICE)) + { + TUint32 wlanID = serviceId; + _LIT8(Kprev2,"/WLAN/WLId"); + TBuf8<80> addWlanURI; // AP/xxx/NAPDef/xxx/WLAN/WLIdnnn , nnn = id nbr + addWlanURI.Append(addURI); + addWlanURI.Append(Kprev2); + addWlanURI.AppendNumFixedWidth(wlanID,EDecimal,3); + TBuf8<16> addWlanLUID; + _LIT8(KFormat,"%d"); + addWlanLUID.Format(KFormat,wlanID); + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addWlanURI); + CleanupStack::PushL( mapInfo ); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addWlanURI,addWlanLUID); + if( aURI.Find(addWlanURI) >= 0 ) + returnLuid = wlanID; + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set WLAN Mapping "); + + TBuf value; + TBuf8<16> addWkLUID; + TBuf8<80> addWkURI; // AP/xxx/NAPDef/xxx/WLAN/xxx/WEPKey/WKIdn, n = id nbr + + for( TInt value =1; value <=4 ;value++) + { + _LIT8(Kprev2,"/WEPKey/WKId"); + addWkURI.Append(addWlanURI); + addWkURI.Append(Kprev2); + addWkURI.AppendNumFixedWidth(value,EDecimal,1); + _LIT8(KFormat,"%d"); + addWkLUID.Format(KFormat,(1000*value)+value); + iCallBack->SetMappingL(addWkURI,addWkLUID); + if( aURI.Find(addWkURI) >= 0 ) + returnLuid = (1000*value)+value; + addWkURI.Zero(); + } + } + CleanupStack::PopAndDestroy( mapInfo ); + } + } + + //Check Bearer node + + CCommsDbTableView* bView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), lValue); + errorCode = bView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + _LIT8(Kprev2,"/Bearer/BId"); + TBuf8<80> addbURI; // AP/xxx/NAPDef/xxx/Bearer/BIdnnn , nnn = id nbr + addbURI.Append(addURI); + addbURI.Append(Kprev2); + addbURI.AppendNumFixedWidth(lValue,EDecimal,3); + TBuf8<16> addbLUID; + _LIT8(KFormat,"%d"); + addbLUID.Format(KFormat,lValue); + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addbURI); + CleanupStack::PushL( mapInfo ); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addbURI,addbLUID); + if( aURI.Find(addbURI) >= 0 ) + returnLuid = lValue; + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set Bearer Mapping "); + } + CleanupStack::PopAndDestroy( mapInfo ); + } + CleanupStack::PopAndDestroy(); // bView + + //Check NAPAuthInf node NAPAuthInf/AUId + + CCommsDbTableView* authView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), lValue); + + errorCode = authView->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + _LIT8(Kprev2,"/Bearer/BId"); + TBuf8<80> addauthURI; // AP/xxx/NAPDef/xxx/Bearer/BIdnnn , nnn = id nbr + addauthURI.Append(addURI); + addauthURI.Append(Kprev2); + addauthURI.AppendNumFixedWidth(lValue,EDecimal,3); + TBuf8<16> addauthLUID; + _LIT8(KFormat,"%d"); + addauthLUID.Format(KFormat,lValue); + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addauthURI); + CleanupStack::PushL( mapInfo ); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addauthURI,addauthLUID); + if( aURI.Find(addauthURI) >= 0 ) + returnLuid = lValue; + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set NAPAuthInf Mapping "); + } + CleanupStack::PopAndDestroy( mapInfo ); + } + CleanupStack::PopAndDestroy(); // authView + + //Check Proxy node + + CCommsDbTableView* pxView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), + TPtrC(PROXY_SERVICE_TYPE), + serviceType); + + errorCode = pxView->GotoFirstRecord(); + if(errorCode == KErrNone) + { + while ( errorCode == KErrNone ) + { + TUint32 lProxyIspId; + TUint32 lProxyId; + pxView->ReadUintL(TPtrC(PROXY_ISP),lProxyIspId); + if (lProxyIspId == serviceId) //ServiceIsp) // Right value ISP + { + pxView->ReadUintL(TPtrC(COMMDB_ID),lProxyId); + + _LIT8(Kprev2,"/Px/PXId"); + TBuf8<80> addURI; // AP/xxx/Px/PXIdnnn , nnn = id nbr + addURI.Append(addAPURI); + addURI.Append(Kprev2); + addURI.AppendNumFixedWidth(lProxyId,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat, KNSmlApProxyLowerBase + lProxyId); // 100000 + lProxyId + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); + CleanupStack::PushL( mapInfo ); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addURI,addLUID); + if( aURI.Find(addURI) >= 0 ) + returnLuid = KNSmlApProxyLowerBase + lProxyId; + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set Proxy Mapping "); + _LIT8(KProxy,"/Port/PROXY"); + TBuf8<80> addPortURI; // AP/xxx/Px/Port/PROXY + addPortURI.Append(addURI); + addPortURI.Append( KProxy ); + TBuf8<16> addPortLUID; + _LIT8(KFormat,"%d"); + addPortLUID.Format(KFormat, 1); + iCallBack->SetMappingL(addPortURI,addPortLUID); + if( aURI.Find(addPortURI) >= 0 ) + returnLuid = 1; + } + CleanupStack::PopAndDestroy( mapInfo ); + } + errorCode = pxView->GotoNextRecord(); + } + } + CleanupStack::PopAndDestroy() ;//Pxview + } + CleanupStack::PopAndDestroy( mapInfo ); + errorCode = tableView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy() ;//tableview + CleanupStack::PopAndDestroy() ;//napdefview + } + } + errorCode = apView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy(); // apView + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): AP end"); + return returnLuid; +} +// End of File diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/src/NSmlInternetAdapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/src/NSmlInternetAdapter.rss Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* 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 "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: Internet-settings resources +* +*/ + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6DEA; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6DE2; // DM Internet Adapter + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/src/NSmlWLanAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/src/NSmlWLanAdapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,3952 @@ +/* +* 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 "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: Wlan Adapter +* +*/ + + + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "NSmlWLanAdapter.h" +#include "NSmlWlanSettings.h" +#include "nsmldebug.h" +#include +#include +#include +#include +#include +#include + + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::NewL( ) +//----------------------------------------------------------------------------- +CNSmlWLanAdapter* CNSmlWLanAdapter::NewL( MSmlDmCallback* aDmCallback,CCommsDatabase& aDatabase ) + { + _DBG_FILE("CNSmlWLanAdapter::NewL(): begin"); + + CNSmlWLanAdapter* self = NewLC( aDmCallback, aDatabase ); + CleanupStack::Pop( self ); + + _DBG_FILE("CNSmlWLanAdapter::NewL(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::NewLC( ) +//----------------------------------------------------------------------------- +CNSmlWLanAdapter* CNSmlWLanAdapter::NewLC( MSmlDmCallback* aDmCallback, CCommsDatabase& aDatabase ) + { + _DBG_FILE("CNSmlWLanAdapter::NewLC(): begin"); + + CNSmlWLanAdapter* self = new(ELeave) CNSmlWLanAdapter(aDmCallback); + CleanupStack::PushL( self ); + + self->iCallBack = aDmCallback; + self->ConstructL( aDatabase ); + + _DBG_FILE("CNSmlWLanAdapter::NewLC(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// void CNSmlWLanAdapter::ConstructL( ) +// Second phase constructor +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::ConstructL( CCommsDatabase& aDatabase ) + { + _DBG_FILE("CNSmlWLanAdapter::ConstructL(): begin"); + + iWlanSettings = CWlanSettings::NewL( aDatabase ); + iBuffer = new (ELeave) CArrayFixFlat (KNSmlWepKeyGranularity); + iSettings = new (ELeave) TWlanSettings; + iEAPSettings = new (ELeave) EAPSettings; + + _DBG_FILE("CNSmlWLanAdapter::ConstructL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter::CNSmlWLanAdapter( ) +// Constructor +//----------------------------------------------------------------------------- +CNSmlWLanAdapter::CNSmlWLanAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlWLanAdapter::CNSmlWLanAdapter(): begin"); + _DBG_FILE("CNSmlWLanAdapter::CNSmlWLanAdapter(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter::~CNSmlWLanAdapter( ) +// Destructor +//----------------------------------------------------------------------------- +CNSmlWLanAdapter::~CNSmlWLanAdapter( ) + { + _DBG_FILE("CNSmlWLanAdapter::~CNSmlWLanAdapter(): begin"); + + if ( iBuffer ) + { + + for( TInt index=0; indexCount(); index++ ) + { + delete iBuffer->At(index).iUri; + delete iBuffer->At(index).iData; + + iBuffer->Delete(index); + } + + iBuffer->Reset(); + delete iBuffer; + + } + delete iWlanSettings; + delete iSettings; + + TRAP_IGNORE( DeleteEAPStructL() ); + + for ( TInt i = 0 ; i < iEAPBuffer.Count() ; i++ ) + { + iEAPBuffer[i]->iStatusRefArray.Close(); + iEAPBuffer[i]->iEAPSettings->iEncapsulatedEAPTypes.Close(); + iEAPBuffer[i]->iEAPSettings->iCipherSuites.Close(); + delete iEAPBuffer[i]->iEAPSettings; + iEAPBuffer[i]->iEAPSettings = NULL; + } + iEAPBuffer.ResetAndDestroy(); + + TInt count = iSecondaryBuffer.Count(); + for( TInt index=0; indexSetGet(); + aclTypes->SetAdd(); // 041208 Added + aclTypes->SetDelete( ); + aclTypes->SetReplace( ); + + TSmlDmAccessTypes accessTypesAll; + accessTypesAll.SetGet( ); + accessTypesAll.SetDelete( ); + accessTypesAll.SetAdd( ); + accessTypesAll.SetReplace( ); + + TSmlDmAccessTypes accessTypesNoDelete; + accessTypesNoDelete.SetGet( ); + accessTypesNoDelete.SetAdd( ); + accessTypesNoDelete.SetReplace( ); + + TSmlDmAccessTypes accessTypesGetAdd; + accessTypesGetAdd.SetGet( ); + accessTypesGetAdd.SetAdd(); + + TSmlDmAccessTypes accessTypesGetAddDel; + accessTypesGetAddDel.SetGet(); + accessTypesGetAddDel.SetAdd(); + accessTypesGetAddDel.SetDelete(); + //WLAN + MSmlDmDDFObject& rootNode = aDDF.AddChildObjectL( KNSmlWLanNodeName ); + FillNodeInfoL( rootNode, + accessTypesGetAdd, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN/ + MSmlDmDDFObject& wlanNode = rootNode.AddChildObjectGroupL( ); + FillNodeInfoL( wlanNode, + accessTypesGetAddDel, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//SSID + MSmlDmDDFObject& ssid = wlanNode.AddChildObjectL( KNSmlWLanSsid ); + FillNodeInfoL( ssid, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//UsedSSID + MSmlDmDDFObject& usedSsid = wlanNode.AddChildObjectL( KNSmlWLanUsedSsid ); + FillNodeInfoL( usedSsid, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//SSIDHidden + MSmlDmDDFObject& ssidHidden = wlanNode.AddChildObjectL( KNSmlWLanSsidHidden ); + FillNodeInfoL( ssidHidden, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//NetworkMode + MSmlDmDDFObject& networkMode = wlanNode.AddChildObjectL( KNSmlWLanNetworkMode ); + FillNodeInfoL( networkMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//SecurityMode + MSmlDmDDFObject& securityMode = wlanNode.AddChildObjectL( KNSmlWLanSecurityMode ); + FillNodeInfoL( securityMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//UseWPAPSK + MSmlDmDDFObject& useWPAPSK = wlanNode.AddChildObjectL( KNSmlWLanUseWPAPSK ); + FillNodeInfoL( useWPAPSK, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//WPAPreSharedKey + MSmlDmDDFObject& wpaPreSharedKey = wlanNode.AddChildObjectL( KNSmlWLanWpaPreSharedKey ); + FillNodeInfoL( wpaPreSharedKey, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBin, + KNSmlEmpty ); + + //WLAN//WLANEAPList + MSmlDmDDFObject& wlanEapList = wlanNode.AddChildObjectL( KNSmlWLanEapList ); + FillNodeInfoL( wlanEapList, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//WEPKeyIndex + MSmlDmDDFObject& wepKeyIndex = wlanNode.AddChildObjectL( KNSmlWLanWepIndex ); + FillNodeInfoL( wepKeyIndex, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN//WEPAuthMode + MSmlDmDDFObject& wlanWepAuthMode = wlanNode.AddChildObjectL( KNSmlWLanAuthMode ); + FillNodeInfoL( wlanWepAuthMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN//WEPKey/ + MSmlDmDDFObject& wepKeyRoot = wlanNode.AddChildObjectL( KNSmlWLanWepKey ); + FillNodeInfoL( wepKeyRoot, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//WEPKey/ + MSmlDmDDFObject& wepKey = wepKeyRoot.AddChildObjectGroupL( ); + FillNodeInfoL( wepKey, + accessTypesGetAdd, + MSmlDmDDFObject::EOneOrN, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//WEPKey//WEPKeyID + MSmlDmDDFObject& wepKeyId = wepKey.AddChildObjectL( KNSmlWLanWepKeyId ); + FillNodeInfoL( wepKeyId, + accessTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN//WEPKey//Data + MSmlDmDDFObject& data = wepKey.AddChildObjectL( KNSmlWLanWepKeyData ); + FillNodeInfoL( data, + accessTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBin, + KNSmlEmpty ); + + + //WLAN//SecondarySSID/ + MSmlDmDDFObject& secondarySSidRoot = wlanNode.AddChildObjectL( KNSmlWLanSecSsid ); + FillNodeInfoL( secondarySSidRoot, + accessTypesGetAdd, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//SecondarySSID/ + MSmlDmDDFObject& secondarySSid = secondarySSidRoot.AddChildObjectGroupL( ); + FillNodeInfoL( secondarySSid, + accessTypesGetAddDel, + MSmlDmDDFObject::EOneOrN, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//SecondarySSID//SSID + MSmlDmDDFObject& secSsidId = secondarySSid.AddChildObjectL( KNSmlWLanSsid ); + FillNodeInfoL( secSsidId, + accessTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//SecondarySSID//UsedSSID + MSmlDmDDFObject& secUsedSsidId = secondarySSid.AddChildObjectL( KNSmlWLanUsedSsid ); + FillNodeInfoL( secUsedSsidId, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP/ + MSmlDmDDFObject& eapRoot = wlanNode.AddChildObjectL( KNSmlWLanEap ); + FillNodeInfoL( eapRoot, + accessTypesGetAdd, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//EAP/ + MSmlDmDDFObject& eap = eapRoot.AddChildObjectGroupL( ); + FillNodeInfoL( eap, + accessTypesGetAdd, + MSmlDmDDFObject::EOneOrN, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//EAP//EAPType + MSmlDmDDFObject& eapType = eap.AddChildObjectL( KNSmlWLanEapType ); + FillNodeInfoL( eapType, + accessTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Username + MSmlDmDDFObject& eapUsername = eap.AddChildObjectL( KNSmlWLanUsername ); + FillNodeInfoL( eapUsername, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Password + MSmlDmDDFObject& eapPassword = eap.AddChildObjectL( KNSmlWLanPassword ); + FillNodeInfoL( eapPassword, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Realm + MSmlDmDDFObject& eapRealm = eap.AddChildObjectL( KNSmlWLanRealm ); + FillNodeInfoL( eapRealm, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//UsePseudonym + MSmlDmDDFObject& eapPseudo = eap.AddChildObjectL( KNSmlWLanUsePseudonym ); + FillNodeInfoL( eapPseudo, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//Encapsulation + // Encapsulation is not supported using this parameter. It is done + // with */EAP/EAPIdxxx-yyy/* where xxx is the encapsulated and yyy the encapsulating method. + /*MSmlDmDDFObject& eapEncapsulation = eap.AddChildObjectL( KNSmlWLanEncapsulation ); + FillNodeInfoL( eapEncapsulation, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); */ + + //WLAN//EAP//VerifyCertRealm + MSmlDmDDFObject& eapVerifyCertRealm = eap.AddChildObjectL( KNSmlWLanVerifyCertRealm ); + FillNodeInfoL( eapVerifyCertRealm, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//RequireClientAuthentication + MSmlDmDDFObject& eapRequireClientAuthentication = eap.AddChildObjectL( KNSmlWLanRequireClientAuthentication ); + FillNodeInfoL( eapRequireClientAuthentication, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//SessionValidityTime + MSmlDmDDFObject& eapSessionValidityTime = eap.AddChildObjectL( KNSmlWLanSessionValidityTime ); + FillNodeInfoL( eapSessionValidityTime, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//CipherSuite + MSmlDmDDFObject& eapCipherSuite = eap.AddChildObjectL( KNSmlWLanCipherSuite ); + FillNodeInfoL( eapCipherSuite, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//AllowPEAPv0 + MSmlDmDDFObject& eapAllowPEAPv0 = eap.AddChildObjectL( KNSmlWLanAllowPEAPv0 ); + FillNodeInfoL( eapAllowPEAPv0, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//AllowPEAPv1 + MSmlDmDDFObject& eapAllowPEAPv1 = eap.AddChildObjectL( KNSmlWLanAllowPEAPv1 ); + FillNodeInfoL( eapAllowPEAPv1, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//AllowPEAPv2 + MSmlDmDDFObject& eapAllowPEAPv2 = eap.AddChildObjectL( KNSmlWLanAllowPEAPv2 ); + FillNodeInfoL( eapAllowPEAPv2, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + +#ifdef FF_WLAN_EXTENSIONS + + //WLAN//EAP//AuthProvModeAllowed + MSmlDmDDFObject& authProvMode = eap.AddChildObjectL( KNSmlWLanAuthProvMode ); + FillNodeInfoL( authProvMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//UnauthProvModeAllowed + MSmlDmDDFObject& unauthProvMode = eap.AddChildObjectL( KNSmlWLanUnauthProvMode ); + FillNodeInfoL( unauthProvMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//PACGroupReference + MSmlDmDDFObject& pacGroupRef = eap.AddChildObjectL( KNSmlWLanPACGroupRef ); + FillNodeInfoL( pacGroupRef, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//WarnADHPNoPAC + MSmlDmDDFObject& warnADHPNoPAC = eap.AddChildObjectL( KNSmlWLanWarnADHPNoPAC ); + FillNodeInfoL( warnADHPNoPAC, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//WarnADHPNoMatchingPAC + MSmlDmDDFObject& warnADHPNoMatchingPAC = eap.AddChildObjectL( KNSmlWLanWarnADHPNoMatchPAC ); + FillNodeInfoL( warnADHPNoMatchingPAC, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//WarnNotDefaultServer + MSmlDmDDFObject& warnNoDefServ = eap.AddChildObjectL( KNSmlWLanWarnNotDefaultSrv ); + FillNodeInfoL( warnNoDefServ, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + +#endif + + + //WLAN//EAP//Certificate + MSmlDmDDFObject& eapCertificateRoot = eap.AddChildObjectL( KNSmlWLanCertificate ); + FillNodeInfoL( eapCertificateRoot, + accessTypesGetAdd, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//EAP//Certificate/ + MSmlDmDDFObject& eapCertificate = eapCertificateRoot.AddChildObjectGroupL( ); + FillNodeInfoL( eapCertificate, + accessTypesGetAdd, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN//EAP//Certificate//IssuerName + MSmlDmDDFObject& eapIssuerName = eapCertificate.AddChildObjectL( KNSmlWLanIssuerName ); + FillNodeInfoL( eapIssuerName, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Certificate//SubjectName + MSmlDmDDFObject& eapSubjectName = eapCertificate.AddChildObjectL( KNSmlWLanSubjectName ); + FillNodeInfoL( eapSubjectName, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Certificate//CertType + MSmlDmDDFObject& eapCertType = eapCertificate.AddChildObjectL( KNSmlWLanCertType ); + FillNodeInfoL( eapCertType, + accessTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Certificate//SerialNumber + MSmlDmDDFObject& eapSerialNumber = eapCertificate.AddChildObjectL( KNSmlWLanSerialNumber ); + FillNodeInfoL( eapSerialNumber, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Certificate//SubjectKeyId + MSmlDmDDFObject& eapSubjectKeyId = eapCertificate.AddChildObjectL( KNSmlWLanSubjectKeyId ); + FillNodeInfoL( eapSubjectKeyId, + accessTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//Certificate//Fingerprint + MSmlDmDDFObject& eapFingerprint = eapCertificate.AddChildObjectL( KNSmlWLanFingerprint ); + FillNodeInfoL( eapFingerprint, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + CleanupStack::PopAndDestroy(); //aclTypes + + _DBG_FILE("CNSmlWLanAdapter::DDFStructureL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::AddLeafObjectL( const TDesC& aURI,const +// TDesC& aParentLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - <%S> <%S> <%S>"), &aURI, &aParentLUID, &aObject ); + + TInt uriSegs = NumOfUriSegs( aURI ); + TInt luid = GetIdFromLuid( aParentLUID ); + TInt err(KErrNone); + TPtrC8 lastUriSeg = GetLastUriSeg( aURI ); + + TInt eapIndex(0); + + TInt eapId = GetEAPIdFromUri( aURI ); + if (eapId == KErrNotFound) + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): Non-EAP setting."); + err = iWlanSettings->GetWlanSettings( luid, *iSettings ); + } + else + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): EAP setting."); + TInt encapsEapId = GetEncapsEAPIdFromUri( aURI ); + if ( encapsEapId == KErrNotFound ) + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): Does not have encapsulation id xx-xx."); + encapsEapId = EAPSettings::EEapNone; + } + TInt i(0); + // This is EAP addition. Check if the buffer for this EAP already exists + for ( i = 0 ; i < iEAPBuffer.Count() ; i++ ) + { + if ( eapId == iEAPBuffer[i]->iEAPSettings->iEAPType + && encapsEapId == iEAPBuffer[i]->iEncapsulatingEAPId ) + { + // The correct buffer was found. + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): Found existing buffer."); + eapIndex = i; + break; + } + } + if ( i == iEAPBuffer.Count() ) + { + DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL(): No buffer found. Create new: <%d>-<%d>"), eapId, encapsEapId ); + // Buffer was not found. Create new. + TInt WLANServiceId = GetServiceIdFromUriL ( aURI ); + + if ( WLANServiceId == KErrNotFound ) + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): Could not find WLAN service ID from URI."); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + TNSmlEAPBufferElement* buffer = new (ELeave) TNSmlEAPBufferElement; + CleanupStack::PushL( buffer ); + + buffer->iEAPSettings = new (ELeave) EAPSettings; + CleanupStack::PushL( buffer->iEAPSettings ); + + buffer->iEAPSettings->iEAPType = static_cast ( eapId ); + buffer->iWLANServiceId = WLANServiceId; + buffer->iEncapsulatingEAPId = static_cast( encapsEapId ); + iEAPBuffer.AppendL(buffer); + + CleanupStack::Pop( buffer->iEAPSettings ); + CleanupStack::Pop( buffer ); + + eapIndex = iEAPBuffer.Count() - 1; + } + } + if( err != KErrNone ) + { + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"), err ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*/*") ) != KErrNotFound && uriSegs==9 ) + { + TInt wepKeyId = GetWepKeyIdFromLuid( aParentLUID ); + + if( wepKeyId != KErrNotFound ) + { + if( lastUriSeg.Match( KNSmlWLanWepKeyData ) != KErrNotFound ) + { + switch( wepKeyId ) + { + case 1: + iSettings->WepKey1 = aObject; + break; + case 2: + iSettings->WepKey2 = aObject; + break; + case 3: + iSettings->WepKey3 = aObject; + break; + case 4: + iSettings->WepKey4 = aObject; + break; + default: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else if( lastUriSeg.Match( KNSmlWLanWepKeyId ) != KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + + else + { + TInt index = -1; + + for( TInt i=0; iCount(); i++ ) + { + if( aURI.Find( iBuffer->At(i).iUri->Des() ) != KErrNotFound ) + { + index = i; + break; + } + } + if( index < 0 ) + { + wepKeyId = GetWepKeyIdFromUri( aURI ); + + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum( wepKeyId ); + addLUID.AppendNumFixedWidth( luid, EDecimal, 3 ); + + DBG_ARGS8(_S8("WLanAdapter::AddleafObject - mapping uri: <%S> to luid: <%S>"), &aURI, &addLUID ); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID ); + iCallBack->SetMappingL(aURI, addLUID); + if( lastUriSeg.Match( KNSmlWLanWepKeyData ) != KErrNotFound ) + { + switch( wepKeyId ) + { + case 1: + iSettings->WepKey1 = aObject; + break; + case 2: + iSettings->WepKey2 = aObject; + break; + case 3: + iSettings->WepKey3 = aObject; + break; + case 4: + iSettings->WepKey4 = aObject; + break; + default: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else if( lastUriSeg.Match( KNSmlWLanWepKeyId ) != KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else + { + //Add WepKeyId and execute buffer + if( lastUriSeg.Match( KNSmlWLanWepKeyId ) != KErrNotFound ) + { + iBuffer->At(index).iWepKeyId = DesToInt( aObject ); + iBuffer->At(index).iIdStatusRef = aStatusRef; + +// ExecuteBufferL( ); (JPLA-6M29NR caused error in WEPkey Data if buffer is executed here) + return; + } + + else if( lastUriSeg.Match( KNSmlWLanWepKeyData ) != KErrNotFound ) + { + iBuffer->At(index).iData = aObject.AllocLC(); + iBuffer->At(index).iDataSet = ETrue; + CleanupStack::Pop( ); //iBuffer->At(index).iData + iBuffer->At(index).iDataStatusRef = aStatusRef; + return; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + } + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/*") ) != KErrNotFound && uriSegs==7 ) + { + if( lastUriSeg.Compare(KNSmlWLanSsid) == 0 ) + { + TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8( iSettings->SSID, aObject ); + DBG_ARGS(_S16("WLanAdapter::ssid convert: <%D>"), returnValue ); + if (returnValue != KErrNone) + { + // setting the default value to the network name + iSettings->SSID = TPtrC(KNSmlWLanDefaultSSID); + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL SSID - ErrorCode <%D>"), returnValue ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + + else if( lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0 ) + { + TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8( iSettings->UsedSSID, aObject ); + DBG_ARGS(_S16("WLanAdapter::usedSsid convert: <%D>"), returnValue ); + } + + else if( lastUriSeg.Compare(KNSmlWLanSsidHidden) == 0 ) + { + if( aObject.MatchF( _L8("True")) != KErrNotFound ) + { + iSettings->ScanSSID = 1; + } + else + { + iSettings->ScanSSID = 0; + } + } + + else if( lastUriSeg.Compare(KNSmlWLanNetworkMode) == 0 ) + { + if( aObject.MatchF( _L8("ADHOC") ) != KErrNotFound ) + { + iSettings->ConnectionMode = EAdhoc; + } + + else if( aObject.MatchF( _L8("Infrastructure") ) != KErrNotFound ) + { + iSettings->ConnectionMode = EInfrastructure; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + } + + else if( lastUriSeg.Compare(KNSmlWLanSecurityMode) == 0 ) + { + if( aObject.MatchF( _L8("NONE") ) != KErrNotFound ) + { + iSettings->SecurityMode = EAllowUnsecure; + } + else if( aObject.MatchF( _L8("WEP") ) != KErrNotFound ) + { + iSettings->SecurityMode = EWep; + } + else if( aObject.MatchF( _L8("8021X") ) != KErrNotFound ) + { + iSettings->SecurityMode = EWlan8021x; + } + else if( aObject.MatchF( _L8("WPA") ) != KErrNotFound ) + { + iSettings->SecurityMode = EWpa; + } + else if( aObject.MatchF( _L8("WPA2") ) != KErrNotFound ) + { + iSettings->SecurityMode = EWpa2; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + } + + else if( lastUriSeg.Compare( KNSmlWLanUseWPAPSK ) == 0 ) + { + if( aObject.MatchF( _L8("True")) != KErrNotFound ) + { + iSettings->UseWPAPSK = 1; + } + else + { + iSettings->UseWPAPSK = 0; + } + } + + else if( lastUriSeg.Compare(KNSmlWLanWpaPreSharedKey) == 0 ) + { + if(aObject.Length() > KMaxPSKLength) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + return; + } + /*else if(aObject.Length() < KMinPSKLength) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + }*/ + else + { + iSettings->WPAPreSharedKey = aObject; + } + } + + else if( lastUriSeg.Compare( KNSmlWLanEapList ) == 0 ) + { + TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8( iSettings->EapList, aObject ); + DBG_ARGS(_S16("WLanAdapter::EapList convert: <%D>"), returnValue ); + } + + else if( lastUriSeg.Compare( KNSmlWLanAuthMode ) == 0 ) + { + if( aObject.MatchF( _L8("1")) != KErrNotFound ) + { + iSettings->AuthMode = EShared; + } + else + { + iSettings->AuthMode = EOpen; + } + } + + else if( lastUriSeg.Compare(KNSmlWLanWepIndex) == 0 ) + { + TInt32 actualIndex = DesToInt( aObject ); + if( actualIndex < 4 && actualIndex >= 0 ) + { + iSettings->WepIndex = actualIndex ; + } + else + { + if ( actualIndex > 3) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + return; + } + } + + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*/*") ) != KErrNotFound && uriSegs == 9 ) + { + TSecondarySSID ssid; + ssid.Id = 0; + TUint32 id = GetSecSSIDFromUriL(aURI); + RArray secondaryList; + CleanupClosePushL( secondaryList ); + iWlanSettings->GetSecondarySSIDListL(luid, secondaryList); + TInt count = secondaryList.Count(); + for (TInt i=0;iiUri->Des() ) != KErrNotFound ) + { + index = i; + _DBG_FILE("CNSmlWLanAdapter::one indexis matched :-)"); + break; + } + } + if( index < 0 ) + { + _DBG_FILE("CNSmlWLanAdapter::one indexis matched :-)"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + else + { + DBG_ARGS8(_S8("CWlanadaptes::Execute Buffer - copying in buffer instead of giving 404 uri: object id : <%S>"), &aObject); + + if( lastUriSeg.Compare(KNSmlWLanSsid) == 0 ) + { + if ( aObject.Length() <= KMaxTextLength ) + { + iSecondaryBuffer[index]->ScannedId.Copy(aObject); + } + else + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObject - SecondarySSID too long"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + } + else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0 ) + { + iSecondaryBuffer[index]->UsedId.Copy(aObject); + } + + } + + + } + + else + { + + if( lastUriSeg.Compare(KNSmlWLanSsid) == 0 ) + { + ssid.ScannedId.Copy(aObject); + } + else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0 ) + { + ssid.UsedId.Copy(aObject); + } + TInt retval = iWlanSettings->WriteSecondarySSIDL(luid, ssid, EFalse); + if (retval == KErrNone) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + } + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/*") ) != KErrNotFound && uriSegs == 9 ) + { + DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - EAP index: <%d>"), eapIndex ); + + if( lastUriSeg.Compare(KNSmlWLanEapType) == 0 ) + { + // Get EAP ID from URI instead of the value because the server gives the value + // incorrectly as the textual representation of the EAP method instead of the IANA number. + iEAPBuffer[eapIndex]->iEAPSettings->iEAPType = static_cast(GetEAPIdFromUri(aURI)); + } + else if (lastUriSeg.Compare(KNSmlWLanUsername) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( iEAPBuffer[eapIndex]->iEAPSettings->iUsername, aObject ); + if (retval == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iUsernamePresent = ETrue; + } + else + { + iEAPBuffer[eapIndex]->iEAPSettings->iUsername.Zero(); + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL EAP username - ErrorCode <%D>"), retval ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + } + else if (lastUriSeg.Compare(KNSmlWLanPassword) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( iEAPBuffer[eapIndex]->iEAPSettings->iPassword, aObject ); + if (retval == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iPasswordPresent = ETrue; + } + else + { + iEAPBuffer[eapIndex]->iEAPSettings->iPassword.Zero(); + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL EAP password - ErrorCode <%D>"), retval ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + else if (lastUriSeg.Compare(KNSmlWLanRealm) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( iEAPBuffer[eapIndex]->iEAPSettings->iRealm, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iRealmPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanUsePseudonym) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonyms = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonyms = EFalse; + + + iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonymsPresent = ETrue; + } + else if (lastUriSeg.Compare(KNSmlWLanEncapsulation) == 0) + { + TBuf8 dummy; + ConvertEAPStringToIds( aObject, dummy, iEAPBuffer[eapIndex]->iEncapsulatingEAPId ); + } + else if (lastUriSeg.Compare(KNSmlWLanVerifyCertRealm) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealm = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealm = EFalse; + + + iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealmPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanRequireClientAuthentication) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthentication = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthentication = EFalse; + + + iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthenticationPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanSessionValidityTime) == 0) + { + TLex8 lex(aObject); + TUint newVal; + TInt sesValErr = lex.Val(newVal); + // Check whether the conversion went ok + if ( sesValErr == KErrNone ) + { + iEAPBuffer[eapIndex]->iEAPSettings->iSessionValidityTime = newVal; + iEAPBuffer[eapIndex]->iEAPSettings->iSessionValidityTimePresent = ETrue; + } + else + { + // there were errors, let's leave the function and update status + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL SessionValidityTime - ErrorCode <%D>"), sesValErr ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + } + else if (lastUriSeg.Compare(KNSmlWLanCipherSuite) == 0) + { + FillCipherSuitesL( aObject , eapIndex ); + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv0) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv0Allowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv0Allowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue; + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv1) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv1Allowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv1Allowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv2) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv2Allowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv2Allowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue; + } + +#ifdef FF_WLAN_EXTENSIONS + else if (lastUriSeg.Compare(KNSmlWLanAuthProvMode) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowedPresent = ETrue; + } + + + else if (lastUriSeg.Compare(KNSmlWLanUnauthProvMode) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowedPresent = ETrue; + } + + + else if (lastUriSeg.Compare(KNSmlWLanPACGroupRef) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( iEAPBuffer[eapIndex]->iEAPSettings->iPACGroupReference, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iPACGroupReferencePresent = ETrue; + + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoPAC) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPAC = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPAC = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPACPresent = ETrue; + } + + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoMatchPAC) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPAC = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPAC = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPACPresent = ETrue; + } + + + else if (lastUriSeg.Compare(KNSmlWLanWarnNotDefaultSrv) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServer = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServer = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServerPresent = ETrue; + } + + +#endif + + // Save the status reference + iEAPBuffer[eapIndex]->iStatusRefArray.AppendL(aStatusRef); + return; + } + else if (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*/*") ) != KErrNotFound && uriSegs == 11) + { + TPtrC8 ptr = NSmlDmURI::ParentURI( aURI ); + + // Get the LUID from ptr2 + HBufC8* certLuid = iCallBack->GetLuidAllocL( ptr ); + + TInt certIndex = GetIdFromLuid( *certLuid ); + + delete certLuid; + + DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - cert index: <%d>, cert count: <%d>"), + certIndex, iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count()); + + if ( iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count() - 1 < certIndex ) + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObject - Certificate buffer does not exist. Create it."); + // The certificate buffer does not exist. Create a new one + CertificateEntry entry; + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.AppendL(entry); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificatesPresent = ETrue; + + certIndex = iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count() - 1; + + TBuf8<2> newLuid; + newLuid.Num( certIndex ); + + DBG_ARGS8(_S8("WLanAdapter::AddLeafObjectL - mapping uri: <%S> to luid: <%S>"), &aURI, &newLuid ); + iCallBack->SetMappingL( aURI, newLuid); + } + + if (lastUriSeg.Compare(KNSmlWLanIssuerName) == 0) + { + TInt retval = + CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iIssuerName, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iIssuerNamePresent = ETrue; + } + else if (lastUriSeg.Compare(KNSmlWLanSubjectName) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iSubjectName, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iSubjectNamePresent = ETrue; + } + else if (lastUriSeg.Compare(KNSmlWLanCertType) == 0) + { + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iCertType = (CertificateEntry::TCertType)DesToInt(aObject); + } + else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iSerialNumber, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iSerialNumberPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanSubjectKeyId) == 0) + { + + // Define literals to search the subject key for possible 0X/0x beginning + _LIT(KHexIdLC, "0x"); + _LIT(KHexIdUC, "0X"); + TBuf<2> hexIdBuf; + // The lenght of the key given as input + TInt keyLen = aObject.Length(); + + // setting the given key to the key buffer + TBuf8 origKey = aObject; + origKey.SetLength(keyLen); + TBuf key; + TLex8 tmpByte; + TUint16 byte; + + // Remove possible spaces from the beginning + origKey.TrimLeft(); + + // the key should be atleast two chars long + if (origKey.Length() >= 2) + { + // Copy the two left most characters in to the buffer + hexIdBuf.Copy(origKey.Left(2)); + + // If the first characters are 0x or 0X, then thet should be ignored + if (hexIdBuf.Compare(KHexIdLC) == 0 + || hexIdBuf.Compare(KHexIdUC) == 0) + { + // delete two characters + origKey.Delete(0, 2); + } + } + + + // looping the subject key through, removing whitespaces + for (TInt i = 0; i < keyLen; i++) + { + // removing white spaces from the left side of the key + origKey.TrimLeft(); + // check that there are characters left + if (origKey.Length() >= 2) + { + // pick the two left most bytes from the key + tmpByte = origKey.Left(2); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + key.Append(byte); + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 2); + } + else if ( origKey.Length() == 1 ) + { + // pick the left most byte from the key + tmpByte = origKey.Left(1); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + key.Append(byte); + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 1); + } + else { + // leave the loop, no characters are left + break; + } + } + // store key value only if no errors occurred + if (err == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue; + } + else + { + // there were errors, let's leave the function and update status + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"), err ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + else if (lastUriSeg.Compare(KNSmlWLanFingerprint) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iThumbprint, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex].iThumbprintPresent = ETrue; + } + // Save the status reference + iEAPBuffer[eapIndex]->iStatusRefArray.AppendL(aStatusRef); + + return; + } + + if (eapId == KErrNotFound) + { + err = iWlanSettings->WriteWlanSettings( *iSettings ); + } + + if( err != KErrNone ) + { + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"), err ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC& aURI, +// const TDesC& aLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::UpdateLeafObjectL - <%S> <%S> <%S>"), &aURI, &aLUID, &aObject ); + + AddLeafObjectL( aURI, aLUID, aObject, aType, aStatusRef ); + + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +//------------------------------------------------------------------------------ + +void CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): begin"); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::DeleteObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): begin"); + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + if( aLUID.Length() == 0 ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): end"); + return; + } + + TInt luid = GetIdFromLuid( aLUID ); + + + if( ( NumOfUriSegs( aURI ) < 6 ) + || (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 6 ) ) + { + TInt ret = iWlanSettings->DeleteWlanSettings( luid ); + + if( ret == KErrNone ) + { + status = CSmlDmAdapter::EOk; + } + else + { + status = CSmlDmAdapter::EError; + } + + } + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey") ) != KErrNotFound && NumOfUriSegs( aURI ) == 7 ) + { + // Individual WLAN settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))!= KErrNotFound && NumOfUriSegs( aURI ) == 8 ) + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): matching SecondarySSID/*"); + //Check if the secondary SSID is present , if so delete that + TUint32 secid = GetSecSSIDFromUriL(aURI); + TInt retvalue( KErrNone ); + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() before call to DeleteOneSecondarySSIDL "); + TRAPD(ssidError, retvalue = iWlanSettings->DeleteOneSecondarySSIDL(luid,secid)); + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() After call to DeleteOneSecondarySSIDL "); + DBG_ARGS8(_S8("TRAP ERROR ssidError : Id = %d and retvalue eror = %d"), ssidError, retvalue); + + if(ssidError == KErrNone ) + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() SSID trap KERRONONE"); + if(retvalue == KErrNone) + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() retvalue also KERRONONE, so its deleted"); + status = CSmlDmAdapter::EOk; + } + + else if (retvalue == KErrNotFound) + { + status = CSmlDmAdapter::ENotFound; + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() retvalue KErrNotFound :-("); + } + + else + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() retvalue some error :-("); + status = CSmlDmAdapter::EError; + } + + + } + else + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() trap error :-( "); + status = CSmlDmAdapter::EError; + } + + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 7 ) + { + // Individual WLAN settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 8 ) + { + // Individual WEP keys cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*/Data") ) != KErrNotFound && NumOfUriSegs( aURI ) == 9 ) + { + // Individual WEP keys cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 8 ) + { + // Individual EAP settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 9 ) + { + // Individual EAP settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + else if (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 10) + { + // Individual certificates are not allowed to be deleted and this case should never happen + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + + } + else if (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*/*") ) != KErrNotFound && NumOfUriSegs( aURI ) == 11) + { + // Individual certificate fields are not allowed to be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + iCallBack->SetStatusL( aStatusRef, status ); + + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +// not used. +//----------------------------------------------------------------------------- + +void CNSmlWLanAdapter::FetchLeafObjectSizeL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aType*/, + TInt /*aResultsRef*/, + TInt /*aStatusRef*/ ) + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectSizeL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectSizeL(): end"); + return; +} + + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aType*/, + const TInt /*aResultsRef*/, + const TInt /*aStatusRef*/ ) + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): end"); + + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC& aURI, +// const TDesC& aLUID, const TDesC& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + CBufBase& aObject ) + { + + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::FetchLeafObjectL - <%S> <%S> <%S>"), &aURI, &aLUID, &aType); + + if(aLUID.Length()==0) + { + + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): ENotFound"); + return CSmlDmAdapter::ENotFound; + } + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + // This luid is the service table id (Found from EAP node and parents) + TInt luid; + if ( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound ) + { + luid = GetServiceIdFromUriL( aURI ); + } + else + { + // The luid supplied is ok + luid = GetIdFromLuid( aLUID ); + } + + TPtrC8 lastUriSeg = GetLastUriSeg( aURI ); + + TInt err = iWlanSettings->GetWlanSettings( luid, *iSettings ); + + if( err == KErrNotFound ) + { + + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): ENotFound"); + return CSmlDmAdapter::ENotFound; + } + + if( lastUriSeg.Compare( KNSmlWLanSsid ) == 0 ) + { + + if (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) != KErrNotFound) + { + RArray secondarySSIDs; + CleanupClosePushL( secondarySSIDs ); + iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs); + TSecondarySSID ssid; + ssid.Id = 0; + TUint32 id = GetSecSSIDFromUriL(aURI); + TInt count = secondarySSIDs.Count(); + for (TInt i=0;iSize()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL( 0, dataPtr8 ); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy( 2 ); //data, data8 + } + } + else + { + + HBufC* data = iSettings->SSID.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL( 0, dataPtr8 ); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy( 2 ); //data, data8 + + } + + } + + else if( lastUriSeg.Compare( KNSmlWLanUsedSsid ) == 0 ) + { + + if (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) != KErrNotFound) + { + RArray secondarySSIDs; + CleanupClosePushL( secondarySSIDs ); + iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs); + TSecondarySSID ssid; + ssid.Id = 0; + TUint32 id = GetSecSSIDFromUriL(aURI); + TInt count = secondarySSIDs.Count(); + for (TInt i=0;iSize()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL( 0, dataPtr8 ); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy( 2 ); //data, data8 + } + } + else + { + + HBufC* data = iSettings->UsedSSID.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL( 0, dataPtr8 ); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy( 2 ); //data, data8 + + } + + } + + else if( lastUriSeg.Compare( KNSmlWLanSsidHidden ) == 0 ) + { + if ( iSettings->ScanSSID == 1 ) + { + aObject.InsertL( 0, _L8("True" ) ); + } + else + { + aObject.InsertL( 0, _L8("False" ) ); + } + status = CSmlDmAdapter::EOk; + } + + + else if( lastUriSeg.Compare( KNSmlWLanNetworkMode ) == 0 ) + { + status = CSmlDmAdapter::EOk; + + switch( iSettings->ConnectionMode ) + { + case 0: + aObject.InsertL( 0, KNSmlWLanAdHoc8 ); + break; + case 1: + aObject.InsertL( 0, KNSmlWLanInfrastructure8 ); + break; + default: + status = CSmlDmAdapter::ENotFound; + break; + } + } + else if( lastUriSeg.Compare( KNSmlWLanSecurityMode ) == 0 ) + { + status = CSmlDmAdapter::EOk; + + switch( iSettings->SecurityMode ) + { + case EAllowUnsecure: + aObject.InsertL( 0, KNSmlWLanAllowUnsecure8 ); + break; + case EWep: + aObject.InsertL( 0, KNSmlWLanWep8 ); + break; + case EWlan8021x: + aObject.InsertL( 0, KNSmlWLan8021x8 ); + break; + case EWpa: + aObject.InsertL( 0, KNSmlWLanWpa8 ); + break; + case EWpa2: + aObject.InsertL( 0, KNSmlWLanWpa28 ); + break; + default: + status = CSmlDmAdapter::ENotFound; + break; + } + } + + else if( lastUriSeg.Compare( KNSmlWLanWpaPreSharedKey ) == 0 ) + { + aObject.InsertL( 0, iSettings->WPAPreSharedKey ); + status = CSmlDmAdapter::EOk; + } + + else if( lastUriSeg.Compare( KNSmlWLanUseWPAPSK ) == 0 ) + { + if ( iSettings->UseWPAPSK == 1 ) + { + aObject.InsertL( 0, _L8("True" ) ); + } + else + { + aObject.InsertL( 0, _L8("False" ) ); + } + status = CSmlDmAdapter::EOk; + } + + else if( lastUriSeg.Compare( KNSmlWLanWepIndex ) == 0 ) + { + HBufC8* data = IntToDes8LC( iSettings->WepIndex ); + aObject.InsertL( 0, data->Des() ); + + CleanupStack::PopAndDestroy( data ); //data + status = CSmlDmAdapter::EOk; + } + + else if( lastUriSeg.Compare( KNSmlWLanEapList ) == 0 ) + { + HBufC* data = iSettings->EapList.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL( 0, dataPtr8 ); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy( 2 ); //data, data8 + + } + + else if( lastUriSeg.Compare( KNSmlWLanAuthMode ) == 0 ) + { + HBufC8* data = IntToDes8LC( iSettings->AuthMode ); + aObject.InsertL( 0, data->Des() ); + + CleanupStack::PopAndDestroy( data ); //data + status = CSmlDmAdapter::EOk; + } + + else if( lastUriSeg.Compare( KNSmlWLanWepKeyData ) == 0 ) + { + TInt wepKeyIndex = GetWepKeyIdFromLuid( aLUID ); + if(wepKeyIndex == KErrNotFound) + { + wepKeyIndex = GetWepKeyIdFromUri( aURI ); + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum( wepKeyIndex ); + addLUID.AppendNumFixedWidth( luid, EDecimal, 3 ); + DBG_ARGS8(_S8("WLanAdapter::Fetchleaf object, set mapping uri: <%S> to luid: <%S>"), &aURI, &addLUID ); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID ); + iCallBack->SetMappingL(aURI, addLUID); + + } + status = CSmlDmAdapter::EOk; + switch( wepKeyIndex ) + { + case 1: + aObject.InsertL( 0, iSettings->WepKey1 ); + break; + case 2: + aObject.InsertL( 0, iSettings->WepKey2 ); + break; + case 3: + aObject.InsertL( 0, iSettings->WepKey3 ); + break; + case 4: + aObject.InsertL( 0, iSettings->WepKey4 ); + break; + default: + status = CSmlDmAdapter::EError; + } + } + else if( lastUriSeg.Compare( KNSmlWLanWepKeyId ) == 0 ) + { + TInt wepKeyIndex = GetWepKeyIdFromLuid( aLUID ); + if(wepKeyIndex == KErrNotFound) + { + wepKeyIndex = GetWepKeyIdFromUri( aURI ); + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum( wepKeyIndex ); + addLUID.AppendNumFixedWidth( luid, EDecimal, 3 ); + DBG_ARGS8(_S8("WLanAdapter::Fetchleaf object, set mapping uri: <%S> to luid: <%S>"), &aURI, &addLUID ); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID ); + iCallBack->SetMappingL(aURI, addLUID); + } + if( wepKeyIndex > 0 ) + { + HBufC8* data = IntToDes8LC( wepKeyIndex ); + aObject.InsertL( 0, data->Des() ); + CleanupStack::PopAndDestroy( data ); //data + status = CSmlDmAdapter::EOk; + } + else + { + status = CSmlDmAdapter::EError; + } + } + + else if (aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound) + { + TInt eapId = GetEAPIdFromUri(aURI); + + // Check if the id contains encapsulating type as well + TInt encapsEapId = GetEncapsEAPIdFromUri( aURI ); + if ( encapsEapId == KErrNotFound ) + { + encapsEapId = EAPSettings::EEapNone; + } + + ResetEAPStructL(); + + TInt err = iWlanSettings->GetEAPSettings( luid, eapId, encapsEapId, *iEAPSettings ); + if (err != KErrNone || iEAPSettings == NULL) + { + status = CSmlDmAdapter::EError; + } + else if (lastUriSeg.Compare( KNSmlWLanEapType ) == 0 ) + { + aObject.InsertL(0, *IntToDes8LC((TInt)iEAPSettings->iEAPType)); + CleanupStack::PopAndDestroy(); // IntToDes8LC + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanUsername ) == 0 ) + { + if (iEAPSettings->iUsernamePresent) + { + DesToBufferL(aObject, iEAPSettings->iUsername); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanPassword ) == 0 ) + { + if (iEAPSettings->iPasswordPresent) + { + DesToBufferL(aObject, iEAPSettings->iPassword); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanRealm ) == 0 ) + { + if (iEAPSettings->iRealmPresent) + { + DesToBufferL(aObject, iEAPSettings->iRealm); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanUsePseudonym ) == 0 ) + { + if (iEAPSettings->iUsePseudonymsPresent && iEAPSettings->iUsePseudonyms) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanEncapsulation ) == 0 ) + { + if ( encapsEapId == EAPSettings::EEapPeap ) + { + aObject.InsertL( 0, KEAPPEAP); + } + else if ( encapsEapId == EAPSettings::EEapTtls ) + { + aObject.InsertL( 0, KEAPTTLS); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanVerifyCertRealm ) == 0 ) + { + if (iEAPSettings->iVerifyServerRealmPresent && iEAPSettings->iVerifyServerRealm) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanRequireClientAuthentication ) == 0 ) + { + if (iEAPSettings->iRequireClientAuthenticationPresent && iEAPSettings->iRequireClientAuthentication) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanSessionValidityTime ) == 0 ) + { + if (iEAPSettings->iSessionValidityTimePresent) + { + aObject.InsertL(0, *IntToDes8LC((TInt)iEAPSettings->iSessionValidityTime)); + CleanupStack::PopAndDestroy(); // IntToDes8LC + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanCipherSuite ) == 0 ) + { + FillCipherSuiteBufferL(aObject); + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanAllowPEAPv0 ) == 0 ) + { + if (iEAPSettings->iPEAPVersionsPresent && iEAPSettings->iPEAPv0Allowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanAllowPEAPv1 ) == 0 ) + { + if (iEAPSettings->iPEAPVersionsPresent && iEAPSettings->iPEAPv1Allowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare( KNSmlWLanAllowPEAPv2 ) == 0 ) + { + if (iEAPSettings->iPEAPVersionsPresent && iEAPSettings->iPEAPv2Allowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + + +#ifdef FF_WLAN_EXTENSIONS + else if (lastUriSeg.Compare(KNSmlWLanAuthProvMode) == 0) + { + if (iEAPSettings->iAuthProvModeAllowedPresent && iEAPSettings->iAuthProvModeAllowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + + else if (lastUriSeg.Compare(KNSmlWLanUnauthProvMode) == 0) + { + if (iEAPSettings->iUnauthProvModeAllowedPresent && iEAPSettings->iUnauthProvModeAllowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanPACGroupRef) == 0) + { + if (iEAPSettings->iPACGroupReferencePresent) + { + DesToBufferL(aObject, iEAPSettings->iPACGroupReference); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoPAC) == 0) + { + if (iEAPSettings->iWarnADHPNoPACPresent && iEAPSettings->iWarnADHPNoPAC) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoMatchPAC) == 0) + { + if (iEAPSettings->iWarnADHPNoMatchingPACPresent && iEAPSettings->iWarnADHPNoMatchingPAC) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + + + else if (lastUriSeg.Compare(KNSmlWLanWarnNotDefaultSrv) == 0) + { + if (iEAPSettings->iWarnNotDefaultServerPresent && iEAPSettings->iWarnNotDefaultServer) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + +#endif + + + else if (lastUriSeg.Compare( KNSmlWLanIssuerName ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + if (iEAPSettings->iCertificates[certId-1].iIssuerNamePresent) + { + aObject.InsertL(0, ConvertTo8LC(iEAPSettings->iCertificates[certId-1].iIssuerName)); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare( KNSmlWLanSubjectName ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + if (iEAPSettings->iCertificates[certId-1].iSubjectNamePresent) + { + aObject.InsertL(0, ConvertTo8LC(iEAPSettings->iCertificates[certId-1].iSubjectName)); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare( KNSmlWLanCertType ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + aObject.InsertL(0, *IntToDes8LC(iEAPSettings->iCertificates[certId-1].iCertType)); + CleanupStack::PopAndDestroy(); // IntToDes8LC + status = CSmlDmAdapter::EOk; + } + } + else if (lastUriSeg.Compare( KNSmlWLanSerialNumber ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + if (iEAPSettings->iCertificates[certId-1].iSerialNumberPresent) + { + aObject.InsertL(0, ConvertTo8LC(iEAPSettings->iCertificates[certId-1].iSerialNumber)); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare( KNSmlWLanSubjectKeyId ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + if (iEAPSettings->iCertificates[certId-1].iSubjectKeyIDPresent) + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObject - Fetch subject key."); + // check the lenght of the given subjectKeyId, if it is longer that 20, then we + // update the status with error and will not go through the key + if ((iEAPSettings->iCertificates[certId-1].iSubjectKeyID.Length()) > KKeyIdentifierLength) + { + status = CSmlDmAdapter::EError; + } + else + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObject - key is under max lenght"); + TBuf8 binKey = iEAPSettings->iCertificates[certId-1].iSubjectKeyID; + TBuf8<2> idBuf; + TBuf8 key; + TUint8 byte; + + // hexadecimal representation + _LIT8(KFormat, "%02x"); + + // looping the subject key through + for (TInt i = 0; i < binKey.Length(); i++) + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObject - Loop the key through."); + // pick the next value from the buffer + byte = binKey[i]; + // convert the value into hexadecimal format + idBuf.Format(KFormat, byte); + // store the hexa value into the key variable + key.Append(idBuf); + } + // Copy the key to the aObject variable + aObject.InsertL(0, key); + status = CSmlDmAdapter::EOk; + } + } + } + } + else if (lastUriSeg.Compare( KNSmlWLanFingerprint ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + if (iEAPSettings->iCertificates[certId-1].iThumbprintPresent) + { + aObject.InsertL(0, ConvertTo8LC(iEAPSettings->iCertificates[certId-1].iThumbprint)); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare( KNSmlWLanSerialNumber ) == 0 ) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if ( iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound ) + { + if (iEAPSettings->iCertificates[certId-1].iSerialNumberPresent) + { + aObject.InsertL(0, ConvertTo8LC(iEAPSettings->iCertificates[certId-1].iSerialNumber)); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + } + + + DBG_ARGS(_S16("CNSmlWLanAdapter::FetchLeafObjectL - Status <%D>"), status ); + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): end"); + return status; + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::ChildURIListL( const TDesC& aURI, +// const TDesC& aLUID, const CArrayFix& aPreviousURISegmentList, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL - <%S> <%S>"), &aURI, &aLUID ); + CBufBase* currentUriSegmentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentUriSegmentList ); + + TInt uriSegs = NumOfUriSegs( aURI ); + TInt luid = GetIdFromLuid( aLUID ); + + //AP//NAPDef// + if( aURI.Match( _L8("AP/*/NAPDef/*") ) != KErrNotFound && uriSegs==4 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->NAPDef - <%S> <%S>"), &aURI, &aLUID ); + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + currentUriSegmentList->InsertL( 0, KNSmlNAPDefWlanNode ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + else + { + currentUriSegmentList->InsertL( 0, KNSmlNAPDefWlanNode ); + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), KNSmlWLan ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + //AP//NAPDef//WLAN + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN")) != KErrNotFound && uriSegs == 5 ) + { + if( aPreviousURISegmentList.Count() > 0 ) + { + HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 uriSegPtr = uriSeg->Des(); + uriSegPtr = aPreviousURISegmentList.At(0).iURISeg; + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), uriSegPtr ); + CleanupStack::PopAndDestroy( uriSeg ); //uriSeg + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentUriSegmentList,KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + else + { + if( iWlanSettings->RecordExists( luid ) < 0) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status: Not found"); + } + else + { + _LIT8(Kprev,"WLId"); + TBuf8<9> addNAME(Kprev); // WLId + addNAME.AppendNumFixedWidth(luid,EDecimal,3); + + currentUriSegmentList->InsertL(currentUriSegmentList->Size(),addNAME); + currentUriSegmentList->InsertL(currentUriSegmentList->Size(),_L8("/")); + + TBuf8<80> addURI; // AP//NapDef//WLAN/WLIdnnn , n=aLUID + addURI.Append(aURI); + addURI.Append(_L8("/WLId")); + addURI.AppendNumFixedWidth(luid,EDecimal,3); + + TBuf8<16> addLUID; + _LIT8(KFormat,"%d"); + addLUID.Format(KFormat,luid); + + // Also added to mapping + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL - mapping uri: <%S> to luid: <%S>"), &addURI, &addLUID ); + DBG_ARGS8(_S8("Parameters - <%S> <%S>"), &aURI, &aLUID ); + iCallBack->SetMappingL(addURI,addLUID); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef,*currentUriSegmentList,KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + } + + //AP//NAPDef//WLAN/ + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*") ) != KErrNotFound && uriSegs==6 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->NAPDef - <%S> <%S>"), &aURI, &aLUID ); + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), KNSmlWLanListOfLeafs ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + + //AP//NAPDef//WLAN//WEPKey + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey") ) != KErrNotFound && uriSegs==7 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->WEPKey - <%S> <%S> <%D> <%D>"), &aURI, &aLUID, aResultsRef, aStatusRef ); + + for( TInt i=0; i<4; i++ ) + { + if( aPreviousURISegmentList.Count()>i ) + { + HBufC8 *uriSeg = HBufC8::NewLC( KNSmlMaxURISegLen) ; + TPtr8 uriSegPtr = uriSeg->Des(); + uriSegPtr = aPreviousURISegmentList.At(i).iURISeg; + + currentUriSegmentList->InsertL( currentUriSegmentList->Size(),uriSegPtr ); + currentUriSegmentList->InsertL( currentUriSegmentList->Size(),_L8( "/" ) ); + CleanupStack::PopAndDestroy(); //uriSeg + } + else + { + TBuf8<25> addNAME; + addNAME.Append( _L8("WKId") ); + addNAME.AppendNum( i+1 ); + addNAME.Append( _L8("/") ); + + currentUriSegmentList->InsertL( currentUriSegmentList->Size(),addNAME ); + } + } + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + + //AP//NAPDef//WEPKey/ + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*") ) != KErrNotFound && uriSegs==8 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->WEPKey/* - <%S> <%D>"), &aURI, luid ); + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + TInt wepKeyId = GetWepKeyIdFromLuid( aLUID ); + if( wepKeyId == KErrNotFound ) + { + wepKeyId = GetWepKeyIdFromUri( aURI ); + + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum( wepKeyId ); + addLUID.AppendNumFixedWidth( luid, EDecimal, 3 ); + + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL - mapping uri: <%S> to luid: <%S>"), &aURI, &addLUID ); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID ); + iCallBack->SetMappingL(aURI, addLUID); + } + + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), KNSmlWLanListOfWepKeyLeafs ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + //AP//NAPDef//WLAN//SecondarySSID/ + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID") ) != KErrNotFound && uriSegs==7 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP - <%S> <%S> <%D> <%D>"), &aURI, &aLUID, aResultsRef, aStatusRef ); + if( aPreviousURISegmentList.Count() > 0 ) + { + HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 uriSegPtr = uriSeg->Des(); + uriSegPtr = aPreviousURISegmentList.At(0).iURISeg; + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), uriSegPtr ); + CleanupStack::PopAndDestroy( uriSeg ); //uriSeg + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + else + { + if( iWlanSettings->RecordExists( luid ) < 0) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status: Not found"); + } + else + { + RArray secondarySSIDs; + CleanupClosePushL( secondarySSIDs ); + iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs); + TInt count = secondarySSIDs.Count(); + _LIT8(KPrefixSSID,"SecSSID"); + TBuf8<5> addNAME; // number + for (TInt i=0;iInsertL(currentUriSegmentList->Size(),_L8("/")); + } + currentUriSegmentList->InsertL(currentUriSegmentList->Size(),KPrefixSSID); + addNAME.Zero(); + addNAME.AppendNumFixedWidth(secondarySSIDs[i].Id ,EDecimal,3); + currentUriSegmentList->InsertL(currentUriSegmentList->Size(),addNAME); + } + CleanupStack::PopAndDestroy(&secondarySSIDs); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + } + //AP//NAPDef//WLAN//SecondarySSID/* + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*") ) != KErrNotFound && uriSegs==8 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->SecondarySSID/* - <%S> <%D>"), &aURI, luid ); + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), KNSmlWLanListOfSecondaryLeafs ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + //AP//NAPDef//WLAN//EAP + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP") ) != KErrNotFound && uriSegs==7 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP - <%S> <%S> <%D> <%D>"), &aURI, &aLUID, aResultsRef, aStatusRef ); + + // Need to get the service id from parent node + luid = GetServiceIdFromUriL ( aURI ); + + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + iWlanSettings->InstalledEAPsL(*currentUriSegmentList); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + //AP//NAPDef//WLAN//EAP/ + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*") ) != KErrNotFound && uriSegs==8 ) + { + // Need to get the service id from parent node + luid = GetServiceIdFromUriL ( aURI ); + + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP/* - <%S> <%D>"), &aURI, luid ); + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), KNSmlWLanListOfEAPLeafs ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + //AP//NAPDef//WLAN//EAP//Certificate + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate") ) != KErrNotFound && uriSegs== 9 ) + { + luid = GetServiceIdFromUriL ( aURI ); + + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->Certificate - <%S> <%D>"), &aURI, luid ); + if( iWlanSettings->RecordExists( luid ) < 0 ) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + TInt eapId = GetEAPIdFromUri( aURI ); + + // Check if the id contains encapsulating type as well + TInt encapsEapId = GetEncapsEAPIdFromUri( aURI ); + if ( encapsEapId == KErrNotFound ) + { + encapsEapId = EAPSettings::EEapNone; + } + + ResetEAPStructL(); + TInt err = iWlanSettings->GetEAPSettings(luid, eapId, encapsEapId, *iEAPSettings); + if (err != KErrNone || !iEAPSettings->iCertificatesPresent) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + TInt certCount = iEAPSettings->iCertificates.Count(); + HBufC8* pBuf = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 ptrCerts = pBuf->Des(); + for (TInt i=0; iInsertL( currentUriSegmentList->Size(), ptrCerts ); + CleanupStack::PopAndDestroy(pBuf); // pBuf + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + } + //AP//NAPDef//WLAN//EAP//Certificate/ + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*") ) != KErrNotFound && uriSegs==10 ) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP/* - <%S> <%D>"), &aURI, luid ); + TInt eapId = GetEAPIdFromUri(aURI); + // Check if the id contains encapsulating type as well + TInt encapsEapId = GetEncapsEAPIdFromUri( aURI ); + if ( encapsEapId == KErrNotFound ) + { + encapsEapId = EAPSettings::EEapNone; + } + + ResetEAPStructL(); + TInt err = iWlanSettings->GetEAPSettings(luid, eapId, encapsEapId, *iEAPSettings); + if (err != KErrNone || !iEAPSettings->iCertificatesPresent) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL( currentUriSegmentList->Size(), KNSmlWLanListOfCertificateLeafs ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + + CleanupStack::PopAndDestroy( currentUriSegmentList ); + + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): end"); + } + +//----------------------------------------------------------------------------- +// void CNSmlWLanAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::AddNodeObjectL - uri: <%S> to aParentLuid: <%S>"), + &aURI, &aParentLUID ); + + TInt uriSegs = NumOfUriSegs( aURI ); + if( (aURI.Match (_L8( "AP/*/NAPDef/*/WLAN") ) != KErrNotFound && uriSegs == 5 ) + || (aURI.Match (_L8( "AP/*/NAPDef/*/WLAN/*/EAP") ) != KErrNotFound && uriSegs == 7 ) + || (aURI.Match (_L8( "AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate") ) != KErrNotFound && uriSegs == 9 ) ) + { + iCallBack->SetMappingL( aURI, aParentLUID ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + + //Add new wlan settings + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*") ) != + KErrNotFound && NumOfUriSegs( aURI ) == 6 ) + { + iSettings->Id = 0; + iSettings->ServiceID = DesToInt( aParentLUID ); + iSettings->ConnectionMode = 0; + iSettings->SSID = TPtrC(KNSmlWLanDefaultSSID); + iSettings->UsedSSID = _L(""); + iSettings->ScanSSID = 0; + iSettings->WepKey1 = _L8(""); + iSettings->WepKey2 = _L8(""); + iSettings->WepKey3 = _L8(""); + iSettings->WepKey4 = _L8(""); + iSettings->WepIndex = 0; + iSettings->SecurityMode = EAllowUnsecure; + iSettings->WPAPreSharedKey = _L8(""); + iSettings->UseWPAPSK = 0; + iSettings->EapList = _L(""); + iSettings->AuthMode = 0; + + TInt err = iWlanSettings->WriteWlanSettings( *iSettings ); + if( err != KErrNone ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + DBG_ARGS8(_S8("WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"), &aURI, &aParentLUID ); + iCallBack->SetMappingL( aURI, aParentLUID ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey") ) != KErrNotFound && uriSegs == 7 ) + { + if( iWlanSettings->RecordExists( DesToInt( aParentLUID ) ) ) + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + else + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + //Add wep key for existing record + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*") ) != KErrNotFound && uriSegs == 8 ) + { + for( TInt i=0; iCount(); i++ ) + { + if( iBuffer->At(i).iUri->Match( aURI ) != KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): EAlreadyExists"); + return; + } + } + DBG_ARGS8(_S8("WLanAdapter::Bufferiin - uri: <%S> to aParentLuid: <%S>"), &aURI, &aParentLUID ); + + TNSmlWepKeyBufferElement newNode; + newNode.iUri = aURI.AllocLC(); + newNode.iData = 0; + newNode.iWepKeyId = 0; + //newNode.iUseWPAPSK = 0; + newNode.iIdStatusRef = 0; + newNode.iDataStatusRef = 0; + newNode.iLengthStatusRef = 0; + newNode.iNodeStatusRef = aStatusRef; + newNode.iExecuted = EFalse; + newNode.iDataSet = EFalse; + newNode.iLuid = DesToInt( aParentLUID ); + iBuffer->AppendL( newNode ); + + CleanupStack::Pop( ); //newNode.iUri + + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): end"); + return; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*") ) != + KErrNotFound && NumOfUriSegs( aURI ) == 8 ) + { + /* + TSecondarySSID ssid; + ssid.ScannedId = KNullDesC; + ssid.UsedId = KNullDesC; + TInt luid = GetIdFromLuid( aParentLUID ); + TInt retval = iWlanSettings->WriteSecondarySSIDL(luid, ssid, ETrue);*/ + + TNSmlSecondarySSIDBufferElement *newSecNode = new (ELeave) TNSmlSecondarySSIDBufferElement;; + newSecNode->iUri = aURI.AllocLC(); + newSecNode->ScannedId = KNullDesC; + newSecNode->UsedId = KNullDesC; + newSecNode->iExecuted = EFalse; + newSecNode->wlanLuid = GetIdFromLuid( aParentLUID ); + iSecondaryBuffer.AppendL( newSecNode ); + CleanupStack::Pop( ); //newNode.iUri + return; + } + + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*") ) != + KErrNotFound && NumOfUriSegs( aURI ) == 8 ) + { + TInt eapTypeId = GetEAPIdFromUri(aURI); + TInt encapsEapId = GetEncapsEAPIdFromUri( aURI ); + if ( encapsEapId == KErrNotFound ) + { + encapsEapId = EAPSettings::EEapNone; + } + + + TInt WLANServiceId = GetServiceIdFromUriL ( aURI ); + + if ( WLANServiceId == KErrNotFound ) + { + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): Could not find WLAN service ID from URI."); + User::Leave( KErrNotFound ); + } + + TInt i(0); + // Check if the buffer for this EAP already exists + for ( i = 0 ; i < iEAPBuffer.Count() ; i++ ) + { + if ( eapTypeId == iEAPBuffer[i]->iEAPSettings->iEAPType + && encapsEapId == iEAPBuffer[i]->iEncapsulatingEAPId ) + { + // The correct buffer was found. + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): Found existing buffer."); + break; + } + } + // buffer did not exist. Update the existing buffer + if ( i == iEAPBuffer.Count() ) + { + TNSmlEAPBufferElement* buffer = new (ELeave) TNSmlEAPBufferElement; + CleanupStack::PushL( buffer ); + + buffer->iEAPSettings = new (ELeave) EAPSettings; + CleanupStack::PushL( buffer->iEAPSettings ); + + buffer->iEAPSettings->iEAPType = static_cast (eapTypeId); + buffer->iStatusRefArray.AppendL(aStatusRef); + buffer->iWLANServiceId = WLANServiceId; + buffer->iEncapsulatingEAPId = static_cast(encapsEapId); + iEAPBuffer.AppendL(buffer); + + CleanupStack::Pop( buffer->iEAPSettings ); + CleanupStack::Pop( buffer ); + } + + // Set the mapping luid to be the index to the iEAPBuffer + TBuf8<2> luid; + luid.Num( iEAPBuffer.Count() - 1 ); + DBG_ARGS8(_S8("WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"), &aURI, &luid ); + iCallBack->SetMappingL( aURI, luid); + + } + else if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*") ) != + KErrNotFound && NumOfUriSegs( aURI ) == 10 ) + { + TPtrC8 ptr = NSmlDmURI::ParentURI( aURI ); + TPtrC8 ptr2 = NSmlDmURI::ParentURI( ptr ); + + HBufC8* eapLuidBuf = iCallBack->GetLuidAllocL( ptr2 ); + + TInt index = GetIdFromLuid( *eapLuidBuf ); + + delete eapLuidBuf; + + CertificateEntry entry; + iEAPBuffer[index]->iEAPSettings->iCertificates.AppendL(entry); + iEAPBuffer[index]->iEAPSettings->iCertificatesPresent = ETrue; + iEAPBuffer[index]->iStatusRefArray.AppendL(aStatusRef); + + TBuf8<2> luid; + luid.Num( iEAPBuffer[index]->iEAPSettings->iCertificates.Count() - 1 ); + + DBG_ARGS8(_S8("WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"), &aURI, &luid ); + iCallBack->SetMappingL( aURI, luid); + } + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::ExecuteCommandL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::ExecuteCommandL ( .. RWriteStream ..) +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusref ) + { + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusref, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::CopyCommandL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /* aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlWLanAdapter::CopyCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::CopyCommandL(): end"); + } +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::StartAtomicL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlWLanAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::StartAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::CommitAtomicL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlWLanAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::CommitAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::RollbackAtomicL +// returns EError +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlWLanAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::RollbackAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::StreamingSupport +// returns EFalse +//------------------------------------------------------------------------------ + +TBool CNSmlWLanAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CNSmlWLanAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlWLanAdapter::StreamingSupport(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::StreamCommittedL +// not used in this adapter +//------------------------------------------------------------------------------ + +void CNSmlWLanAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlWLanAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::StreamCommittedL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::CompleteOutstandingCmdsL( ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::CompleteOutstandingCmdsL( ) + { + _DBG_FILE("CNSmlWLanAdapter::CompleteOutStandingCmdsL(): begin"); + + ExecuteBufferL( ETrue ); + + _DBG_FILE("CNSmlWLanAdapter::CompleteOutStandingCmdsL(): end"); + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 CNSmlWLanAdapter::GetLastUriSeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlWLanAdapter::GetLastUriSeg( const TDesC8& aURI ) + { + _DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): begin"); + + TInt i; + for( i = aURI.Length()-1; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i==0 ) + { + _DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): end"); + return aURI; + } + else + { + _DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): end"); + return aURI.Mid( i+1 ); + } + } + + +// ------------------------------------------------------------------------------------------------ +// TPtrC16 CNSmlWLanAdapter::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlWLanAdapter::RemoveLastUriSeg(const TDesC8& aURI) + { + _DBG_FILE("CNSmlWLanAdapter::RemoveLastUriSeg(): begin"); + + TInt i; + for( i = aURI.Length()-1; i >= 0; i-- ) + { + if(aURI[i] == '/') + { + break; + } + } + + _DBG_FILE("CNSmlWLanAdapter::RemoveLastUriSeg(): end"); + return aURI.Left(i); + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::DesToInt( const TDesC8& aLuid ) +// Returns aLuid as integer value +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::DesToInt( const TDesC8& aLuid ) + { + _DBG_FILE("CNSmlWLanAdapter::DesToInt(): begin"); + + TLex8 lex(aLuid); + TInt value = 0; + lex.Val( value ); + + DBG_ARGS8(_S8("WLanAdapter::DesToInt() - Des: <%S> Int: <%D>"), &aLuid, value ); + _DBG_FILE("CNSmlWLanAdapter::DesToInt(): end"); + return value; + } + + +// ------------------------------------------------------------------------------------------------ +// HBufC* CNSmlWLanAdapter::IntToDesLC(const TInt aLuid) +// ------------------------------------------------------------------------------------------------ +HBufC* CNSmlWLanAdapter::IntToDesLC(const TInt aLuid) + { + _DBG_FILE("CNSmlWLanAdapter::IntToDesLC(): begin"); + + HBufC* buf = HBufC::NewLC(10); + TPtr ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + + _DBG_FILE("CNSmlWLanAdapter::IntToDesLC(): end"); + return buf; + } + +// ------------------------------------------------------------------------------------------------ +// HBufC8* CNSmlWLanAdapter::IntToDes8LC(const TInt aLuid) +// ------------------------------------------------------------------------------------------------ +HBufC8* CNSmlWLanAdapter::IntToDes8LC(const TInt aLuid) + { + _DBG_FILE("CNSmlWLanAdapter::IntToDes8LC(): begin"); + + HBufC8* buf = HBufC8::NewLC(10); + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + + _DBG_FILE("CNSmlWLanAdapter::IntToDes8LC(): end"); + return buf; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::NumOfUriSegs( const TDesC8& aUri ) +// Return count of URI segments of aUri +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::NumOfUriSegs( const TDesC8& aUri ) + { + _DBG_FILE("CNSmlWLanAdapter::NumOfUriSegs(): begin"); + + TInt count = 1; + for( TInt i=0; i"), &aUri ); + + if( aUri.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*") ) == KErrNotFound ) + { + return KErrNotFound; + } + + TInt begin = aUri.Find(_L8("/EAPId")) + 6; + if ( begin == KErrNotFound ) + { + return KErrNotFound; + } + + TInt eapId = DesToInt( aUri.Mid( begin, 3 ) ); + + return eapId; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEncapsEAPIdFromUri( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetEncapsEAPIdFromUri( const TDesC8& aUri ) + { + DBG_ARGS8(_S8("WLanAdapter::GetEncapsEAPIdFromUri - <%S>"), &aUri ); + + if( aUri.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/EAPId*-*") ) == KErrNotFound ) + { + return KErrNotFound; + } + + TInt begin = aUri.Find(_L8("/EAPId")) + 9; + if ( aUri[begin] != '-' ) + { + return KErrNotFound; + } + begin++; + TInt end = -1; + TInt count; + + for( count=0; count+begin 0 ) + { + TInt eapId = DesToInt( aUri.Mid( begin, count ) ); + return eapId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEAPIdFromUriL( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetServiceIdFromUriL( const TDesC8& aURI) + { + DBG_ARGS8(_S8("WLanAdapter::GetServiceIdFromUriL - <%S>"), &aURI ); + + if( aURI.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP*") ) == KErrNotFound ) + { + return KErrNotFound; + } + + TInt end = aURI.Find(_L8("/EAP")) + 4; + + if( end > 0 ) + { + + HBufC8* luidBuf = iCallBack->GetLuidAllocL( aURI.Left( end ) ); + + TInt serviceId = GetIdFromLuid( *luidBuf ); + + delete luidBuf; + + return serviceId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetSecSSIDFromUriL( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TUint32 CNSmlWLanAdapter::GetSecSSIDFromUriL( const TDesC8& aUri ) + { + DBG_ARGS8(_S8("WLanAdapter::GetSecSSIDFromUriL - <%S>"), &aUri ); + + if( aUri.Match( _L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*") ) == KErrNotFound ) + { + User::Leave(KErrNotFound); + } + _LIT8(KSSIDString, "/SecondarySSID/SecSSID"); + TInt begin = aUri.Find(KSSIDString) + KSSIDString().Length(); + TInt end = -1; + TInt count; + + for( count=0; count+begin 0 ) + { + TLex8 lex(aUri.Mid( begin, count )); + TUint32 value = 0; + lex.Val( value, EDecimal ); + return value; + } + else + { + User::Leave(KErrNotFound); + } + return 0; + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEAPIdFromUri( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetCertificateIdFromUri( const TDesC8& aUri ) + { + DBG_ARGS8(_S8("WLanAdapter::GetCertificateIdFromUri - <%S>"), &aUri ); + + if( aUri.Match( _L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*") ) == KErrNotFound ) + { + return KErrNotFound; + } + _LIT8(KCertString, "/Certificate/CertId"); + + TInt begin = aUri.Find(KCertString); + if ( begin == KErrNotFound ) + { + return KErrNotFound; + } + + begin += KCertString().Length(); + + TInt end = -1; + TInt count; + + for( count=0; count+begin 0 ) + { + TInt certId = DesToInt( aUri.Mid( begin, count ) ); + return certId; + } + return KErrNotFound; + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetWepKeyIdFromUri( const TDesC8& aUri ) +// Returns WepKey ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetWepKeyIdFromUri( const TDesC8& aUri ) + { + if( aUri.Match( _L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*") ) == KErrNotFound ) + { + return KErrNotFound; + } + + TInt begin = aUri.Find(_L8("WEPKey/WKId")) + 11; + TInt end = -1; + TInt count; + + for( count=0; count 0 ) + { + TInt wlanId = DesToInt( aUri.Mid( begin, count ) ); + return wlanId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetWepKeyIdFromLuid( const TDesC8& aLuid ) +// Return id number of wepkey +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetWepKeyIdFromLuid( const TDesC8& aLuid ) + { + TLex8 iLex( aLuid ); + + TInt luid; + if (iLex.Val( luid ) == KErrNone) + { + if( luid > 1000 ) + { + return luid / 1000; + } + else + { + return KErrNotFound; + } + } + else + { + return KErrNotFound; + } + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetIdFromLuid( const TDesC& aLuid ) +// Return luid of wlan node +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetIdFromLuid( const TDesC8& aLuid ) + { + TLex8 iLex( aLuid ); + + TInt luid; + if( iLex.Val(luid) == KErrNone ) + { + if( luid < 1000 ) + { + return luid; + } + else + { + TInt tmp = luid / 1000 * 1000; //First number of luid > 1000 + return luid - tmp; + } + } + else + { + return KErrNotFound; + } + } + +// ------------------------------------------------------------------------------------------------ +// void CNSmlWLanAdapter::ExecuteBufferL( TBool aFinal ) +// Executes buffered commands from iBuffer +// ------------------------------------------------------------------------------------------------ +void CNSmlWLanAdapter::ExecuteBufferL( TBool aFinal ) + { + for( TInt index=0; indexCount(); index++ ) + { + DBG_ARGS8(_S8("WLanAdapter::ExecuteBuffer(): Buf count: <%D> index: <%D>"), iBuffer->Count(), index ); + + if( iBuffer->At(index).iExecuted ) + { + continue; + } + TInt err = 0; + + TInt luid = iBuffer->At(index).iLuid; + TInt wepKeyId = iBuffer->At(index).iWepKeyId; + if( ! wepKeyId && ! aFinal ) + { + continue; + } + + if( wepKeyId > 4 || + ! wepKeyId && aFinal ) + { + if( iBuffer->At(index).iDataStatusRef ) + iCallBack->SetStatusL( iBuffer->At(index).iDataStatusRef, CSmlDmAdapter::EError ); + if( iBuffer->At(index).iNodeStatusRef ) + iCallBack->SetStatusL( iBuffer->At(index).iNodeStatusRef, CSmlDmAdapter::EError ); + if( iBuffer->At(index).iLengthStatusRef ) + iCallBack->SetStatusL( iBuffer->At(index).iLengthStatusRef, CSmlDmAdapter::EError ); + + iBuffer->At(index).iIdStatusRef = 0; + iBuffer->At(index).iNodeStatusRef = 0; + iBuffer->At(index).iDataStatusRef = 0; + iBuffer->At(index).iLengthStatusRef = 0; + iBuffer->At(index).iExecuted = ETrue; + + continue; + } + + if( iBuffer->At(index).iDataSet && + iBuffer->At(index).iWepKeyId > 0 ) + { + iWlanSettings->GetWlanSettings( luid, *iSettings ); + + switch( wepKeyId ) + { + case 1: + iSettings->WepKey1 = iBuffer->At(index).iData->Des(); + break; + case 2: + iSettings->WepKey2 = iBuffer->At(index).iData->Des(); + break; + case 3: + iSettings->WepKey3 = iBuffer->At(index).iData->Des(); + break; + case 4: + iSettings->WepKey4 = iBuffer->At(index).iData->Des(); + break; + default: + continue; + } + + err = iWlanSettings->WriteWlanSettings( *iSettings ); + if( err == KErrNone ) + { + iCallBack->SetStatusL( iBuffer->At(index).iDataStatusRef, CSmlDmAdapter::EOk ); + } + else + { + iCallBack->SetStatusL( iBuffer->At(index).iDataStatusRef, CSmlDmAdapter::EError ); + } + + iBuffer->At(index).iDataStatusRef = 0; + } + + TBuf8<5> addLUID; + addLUID.AppendNum( wepKeyId ); + addLUID.AppendNumFixedWidth( luid, EDecimal, 3 ); + + iCallBack->SetMappingL( iBuffer->At( index).iUri->Des(), addLUID ); + if( iBuffer->At(index).iIdStatusRef ) + iCallBack->SetStatusL( iBuffer->At(index).iIdStatusRef, CSmlDmAdapter::EOk ); + if( iBuffer->At(index).iNodeStatusRef ) + iCallBack->SetStatusL( iBuffer->At(index).iNodeStatusRef, CSmlDmAdapter::EOk ); + if( iBuffer->At(index).iLengthStatusRef ) + iCallBack->SetStatusL( iBuffer->At(index).iLengthStatusRef, CSmlDmAdapter::EOk ); + + iBuffer->At(index).iIdStatusRef = 0; + iBuffer->At(index).iNodeStatusRef = 0; + iBuffer->At(index).iLengthStatusRef = 0; + iBuffer->At(index).iExecuted = ETrue; + } + + //Clean executed command from buffer + for( TInt i=0; iCount(); i++ ) + { + if( iBuffer->At(i).iExecuted ) + { + if( iBuffer->At(i).iUri ) + { + delete iBuffer->At(i).iUri; + iBuffer->At(i).iUri = 0; + } + if( iBuffer->At(i).iData ) + { + delete iBuffer->At(i).iData; + iBuffer->At(i).iData = 0; + } + iBuffer->Delete(i); + iBuffer->Compress(); + } + } +// Secondary SSID Buffer + for( TInt index=0; index index: <%D>"), iBuffer->Count(), index ); + + if( iSecondaryBuffer[index]->iExecuted ) + { + continue; + } + + TSecondarySSID ssid; + ssid.ScannedId = iSecondaryBuffer[index]->ScannedId; + ssid.UsedId = iSecondaryBuffer[index]->UsedId; + + DBG_ARGS8(_S8("CWlanadaptes::Execute Buffer - WLAN_SEC_SSID_SCANNED_SSID uri: <%S> ad WLAN_SEC_SSID_USED_SSID : <%S>"), &iSecondaryBuffer[index]->ScannedId, &iSecondaryBuffer[index]->UsedId ); + + TInt retval = iWlanSettings->WriteSecondarySSIDL(iSecondaryBuffer[index]->wlanLuid, ssid, ETrue); + iSecondaryBuffer[index]->iExecuted=ETrue; + + } + // EAP settings + for( TInt i = 0 ; i < iEAPBuffer.Count() ; i++ ) + { + // Check if this method has encapsulated methods + for ( TInt j = 0; j < iEAPBuffer.Count() ; j++ ) + { + if ( iEAPBuffer[i]->iEAPSettings->iEAPType == iEAPBuffer[j]->iEncapsulatingEAPId ) + { + // j is encapsulated inside i + iEAPBuffer[i]->iEAPSettings->iEncapsulatedEAPTypes.Append( iEAPBuffer[j]->iEAPSettings->iEAPType ); + iEAPBuffer[i]->iEAPSettings->iEncapsulatedEAPTypesPresent = ETrue; + } + } + + TRAPD( err, iWlanSettings->GetEAPInterfaceL(iEAPBuffer[i]->iWLANServiceId, + iEAPBuffer[i]->iEncapsulatingEAPId, + static_cast (iEAPBuffer[i]->iEAPSettings->iEAPType ) ) ); + if ( err == KErrNone ) + { + err = iWlanSettings->WriteEAPSettings( *iEAPBuffer[i]->iEAPSettings ); + } + + MSmlDmAdapter::TError status; + switch ( err ) + { + case KErrNotFound: + { + status = CSmlDmAdapter::ENotFound; + break; + } + case KErrNone: + { + status = CSmlDmAdapter::EOk; + break; + } + default: + { + status = CSmlDmAdapter::EError; + } + } + + for ( TInt j = 0; j < iEAPBuffer[i]->iStatusRefArray.Count() ; j++) + { + iCallBack->SetStatusL( iEAPBuffer[i]->iStatusRefArray[j], status ); + } + } + for ( TInt i = 0 ; i < iEAPBuffer.Count() ; i++ ) + { + iEAPBuffer[i]->iStatusRefArray.Close(); + iEAPBuffer[i]->iEAPSettings->iEncapsulatedEAPTypes.Close(); + iEAPBuffer[i]->iEAPSettings->iCipherSuites.Close(); + delete iEAPBuffer[i]->iEAPSettings; + iEAPBuffer[i]->iEAPSettings = NULL; + } + iEAPBuffer.ResetAndDestroy(); + } + + +//============================================= +// CNSmlWLanAdapter::ConvertTo8LC() +// Converts string value to 8-bit +// +//============================================= +TDesC8& CNSmlWLanAdapter::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length()*2); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return *buf; + } + +//============================================= +// CNSmlWLanAdapter::ConvertTo16LC() +// Converts string value to 16-bit +// +//============================================= +TDesC16& CNSmlWLanAdapter::ConvertTo16LC( const TDesC8& aSource) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8(bufPtr16, aSource); + + return *buf16; + } + +void CNSmlWLanAdapter::ResetEAPStructL() + { + DeleteEAPStructL(); + iEAPSettings = new (ELeave) EAPSettings; + } + + +void CNSmlWLanAdapter::DeleteEAPStructL() + { + if (iEAPSettings != NULL) + { + if (iEAPSettings->iCertificatesPresent) + { + iEAPSettings->iCertificates.Reset(); + } + iEAPSettings->iEncapsulatedEAPTypes.Close(); + iEAPSettings->iCipherSuites.Close(); + + delete iEAPSettings; + iEAPSettings = NULL; + } + } + + +void CNSmlWLanAdapter::DesToBufferL(CBufBase& aTo, const TDesC& aFrom) + { + aTo.InsertL( 0, ConvertTo8LC(aFrom) ); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + } + +void CNSmlWLanAdapter::FillCipherSuiteBufferL(CBufBase& aBuffer) + { + if (iEAPSettings == NULL || !iEAPSettings->iCipherSuitesPresent) + { + return; + } + // 0 5 10 15 20 25 30 35 + _LIT8(KPlus, "+"); + aBuffer.InsertL(0,KSuitesDefault); + TInt count = iEAPSettings->iCipherSuites.Count(); + for (TInt i=count-1; i>=0;--i) + { + switch (iEAPSettings->iCipherSuites[i]) + { + case RSA_3DES_SHA: + { + aBuffer.Write(0, KPlus); + break; + } + case DHE_RSA_3DES_SHA: + { + aBuffer.Write(5, KPlus); + break; + } + case DHE_DSS_3DES_SHA: + { + aBuffer.Write(10, KPlus); + break; + } + case RSA_AES_SHA: + { + aBuffer.Write(15, KPlus); + break; + } + case DHE_RSA_AES_SHA: + { + aBuffer.Write(20, KPlus); + break; + } + case DHE_DSS_AES_SHA: + { + aBuffer.Write(25, KPlus); + break; + } + case RSA_RC4_MD5: + { + aBuffer.Write(30, KPlus); + break; + } + case RSA_RC4_SHA: + { + aBuffer.Write(35, KPlus); + break; + } + default: + { + break; + } + + } + } + + } + + +void CNSmlWLanAdapter::FillCipherSuitesL(const TDesC8& aObject, const TInt aLuid) + { + if (iEAPBuffer[aLuid] == NULL) + { + return; + } + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuites.Reset(); + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuitesPresent = EFalse; // init to EFalse + + TChar plus('+'); + + TInt length = aObject.Length(); + for (TInt i=0; i+3iEAPSettings->iCipherSuites.Append(suite); + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuitesPresent = ETrue; + } + } + } + +void CNSmlWLanAdapter::ConvertEAPStringToIds( const TDesC8& aEAPString, TDes8& aExpandedId, EAPSettings::TEapType& aId) + { + if ( aEAPString == KEAPSIM ) + { + aExpandedId.Copy( KEapSimTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapSim; + } + else if( aEAPString == KEAPAKA ) + { + aExpandedId.Copy( KEapAkaTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapAka; + } + else if( aEAPString == KEAPTLS ) + { + aExpandedId.Copy( KEapTlsTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapTls; + } + else if( aEAPString == KEAPPEAP ) + { + aExpandedId.Copy( KEapPeapTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapPeap; + } + else if( aEAPString == KEAPTTLS ) + { + aExpandedId.Copy( KEapTtlsTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapTtls; + } + else if( aEAPString == KEAPLEAP ) + { + aExpandedId.Copy( KEapLeapTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapLeap; + } + else if( aEAPString == KEAPMSCHAPV2 ) + { + aExpandedId.Copy( KEapMschapv2TypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapMschapv2; + } + else if( aEAPString == KMSCHAPV2 ) + { + aExpandedId.Copy( KMschapv2TypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EPlainMschapv2; + } + else if( aEAPString == KEAPGTC ) + { + aExpandedId.Copy( KEapGtcTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapGtc; + } + else if( aEAPString == KEAPFAST ) + { + aExpandedId.Copy( KEapFastTypeId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapFast; + } + else if( aEAPString == KEAPTTLSPAP ) + { + aExpandedId.Copy( KTtlspapTypeId, KExpandedEAPIdLength ); + aId = static_cast(98); + } + else + { + aExpandedId.Copy( KEapNoneId, KExpandedEAPIdLength ); + aId = EAPSettings::EEapNone; + } + + } + + +// end of file diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldinternet/src/NSmlWlanSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldinternet/src/NSmlWlanSettings.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,1732 @@ +/* +* 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 "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: Wlan Adapter DB handler +* +*/ + + + + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include "NSmlWlanSettings.h" +#include "NSmlWLanAdapter.h" +#include "nsmldebug.h" +#include +#include // vsettingenforcementinfo +#include + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + +const TUint KEAPListBufferSize = 128; +const TUint KLengthOfOldStyleEAPListEntry = 5; // "+xxx," + +const TInt KBeginTransRetryDelay = 1000000; // Delay for comms db begintransaction retry (microseconds) +const TInt KBeginTransRetryCount = 7; // Maximum number of retries +//----------------------------------------------------------------------------- +// CWlanAdapter::CWlanSettings( CCommsDatabase& aDatabase ) +//----------------------------------------------------------------------------- +CWlanSettings::CWlanSettings( CCommsDatabase& aDatabase ) : iDatabase( aDatabase ), iExpandedEAPTypeFieldsUsed( ETrue ) + { + _DBG_FILE("CWlanSettings::CWlanSettings(): begin"); + + iTableView = 0; + iEapType = NULL; + iSecondaryView = NULL; + + + _DBG_FILE("CWlanSettings::CWlanSettings(): end"); + } + +//----------------------------------------------------------------------------- +// CWlanAdapter::~CWlanSettings( ) +//----------------------------------------------------------------------------- +CWlanSettings::~CWlanSettings( ) + { + + delete iEapType; + delete iSecondaryView; + delete iTableView; + } + +//----------------------------------------------------------------------------- +// CWlanSettings* CWlanSettings::NewL( CCommsDatabase& aDatabase ) +//----------------------------------------------------------------------------- +CWlanSettings* CWlanSettings::NewL( CCommsDatabase& aDatabase ) + { + _DBG_FILE("CWlanSettings::NewL(): begin"); + + CWlanSettings* self = new(ELeave) CWlanSettings( aDatabase ); + + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + + _DBG_FILE("CWlanSettings::NewL(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::ConstructL( ) +//----------------------------------------------------------------------------- +void CWlanSettings::ConstructL( ) +{ + _DBG_FILE("CWlanSettings::ConstructL(): begin"); + _DBG_FILE("CWlanSettings::ConstructL(): end"); +} + + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::GetWlanSettings( TUint32 aLuid, TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::GetWlanSettings( TUint32 aLuid, TWlanSettings& aWlanSettings ) + { + _DBG_FILE("CWlanSettings::GetWlanSettings(): begin"); + + TRAPD( err, ConnectToDatabaseL() ); + if( err == KErrNone ) + { + err = GoToRecord( aLuid ); + + if( err == KErrNone ) + { + TRAP( err, GetDataFromRecordL( &aWlanSettings ) ); + } + } + + _DBG_FILE("CWlanSettings::GetWlanSettings(): end"); + return err; + } + + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::GetEapSettings( TInt aId, TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::GetEAPSettings( const TInt aId, const TInt aEapType, const TInt aTunnelingType, EAPSettings& aEapSettings ) + { + _DBG_FILE("CWlanSettings::GetEapSettings(): begin"); + DBG_ARGS(_S16("aId=%d, eEapType=%d"), aId, aEapType); + + TRAPD( err, GetEAPInterfaceL(aId, aTunnelingType, aEapType) ); + DBG_ARGS(_S16("GetEAPInterfaceL leaved with %d"), err); + if( err == KErrNone ) + { + TRAP(err, iEapType->GetConfigurationL(aEapSettings)); + DBG_ARGS(_S16("iEapType->GetConfigurationL leaved with %d"), err); + } + + _DBG_FILE("CWlanSettings::GetEAPSettings(): end"); + return err; + } + + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::DeleteWlanSettings( TUint32 aLuid ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::DeleteWlanSettings( TUint32 aLuid ) + { + _DBG_FILE("CWlanSettings::DeleteWlanSettings(): begin"); + TBool wlanEnforce = EFalse; + TInt tableLockError= KErrNone; + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt enError = KErrNone; + TRAP(enError, wlanEnforce=CheckEnforcementL()); + DBG_ARGS(_S16("CWlanSettings::DeleteWLANSettings, check enforcement failed. error: <%D>"), enError ); + if(wlanEnforce) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): wlan enforce is ON "); + TRAPD(lockError,tableLockError = PerformLockWLANTablesL(EFalse)); + if(lockError == KErrNone && tableLockError == KErrNone) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): Table unlcoked successfully "); + iWLANRelock = ETrue; + } + } + } + + TRAPD( err, ConnectToDatabaseL() ); + if( err == KErrNone ) + { + err = GoToRecord( aLuid ); + if( err == KErrNone ) + { + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(wlanEnforce) + { + ((CCommsDbProtectTableView*)iTableView)->UnprotectRecord(); + } + } + + + TInt err = iTableView->UpdateRecord( ); + if( err == KErrLocked ) + { + _DBG_FILE("DeleteWlanSettings: UpdateRecord was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && err == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteWlanSettings: Slept 1 second. Try again"); + err = iTableView->UpdateRecord(); + retry--; + } + if( err != KErrNone ) + { + _DBG_FILE("DeleteWlanSettings: UpdateRecord was unsuccessful"); + } + else + { + _DBG_FILE("DeleteWlanSettings: UpdateRecord was successful"); + } + } + + if( err == KErrNone ) + { + TRAP( err, iTableView->WriteUintL( TPtrC(WLAN_SERVICE_ID), 0 ) ); + if( err != KErrNone ) + { + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt tableLockError= KErrNone; + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,tableLockError = PerformLockWLANTablesL(ETrue)); + ((CCommsDbProtectTableView*)iTableView)->ProtectRecord(); + DBG_ARGS(_S16("CWlanSettings::DeleteWLANSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,tableLockError ); + iWLANRelock =EFalse; + } + if ( tableLockError != KErrNone ) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + } + err = iTableView->PutRecordChanges( ); + if( err == KErrLocked ) + { + _DBG_FILE("DeleteWlanSettings: PutRecordChanges was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && err == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteWlanSettings: Slept 1 second. Try again"); + err = iTableView->PutRecordChanges(); + retry--; + } + if( err != KErrNone ) + { + _DBG_FILE("DeleteWlanSettings: PutRecordChanges was unsuccessful"); + } + else + { + _DBG_FILE("DeleteWlanSettings: PutRecordChanges was successful"); + } + } + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt tableLockError= KErrNone; + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,tableLockError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS(_S16("CWlanSettings::DeleteWLANSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,tableLockError ); + ((CCommsDbProtectTableView*)iTableView)->ProtectRecord(); + iWLANRelock =EFalse; + } + if ( tableLockError != KErrNone ) // to remove warnings + { + tableLockError = KErrNone; + } + } + + + if ( err == KErrNone ) + { + // Ignore err on purpose + TRAP( err, DeleteSecondarySSIDsL( aLuid ) ); + + TRAP( err, DeleteWlanEapSettingsL( aLuid ) ); + } + } + } + + + _DBG_FILE("CWlanSettings::DeleteWlanSettings(): end"); + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,tableLockError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS(_S16("CWlanSettings::DeleteWLANSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,tableLockError ); + ((CCommsDbProtectTableView*)iTableView)->ProtectRecord(); + iWLANRelock =EFalse; + } + } + + if (wlanEnforce) + wlanEnforce = EFalse; // to get rid of warnings + return err; + } + + + + +TInt CWlanSettings::DeleteOneSecondarySSIDL( TUint32 aWLANId , TUint32 asecId) +{ + + TInt retval = KErrNone; + SetSecondaryViewToRecordL(aWLANId); + retval = iSecondaryView->GotoFirstRecord(); + + while (retval == KErrNone) + { + TSecondarySSID ssid; + TRAP(retval, iSecondaryView->ReadUintL( TPtrC(WLAN_SEC_SSID_ID ), ssid.Id )); + if(ssid.Id == asecId) + { + //retval = iSecondaryView->UpdateRecord(); + //if( retval==KErrNone ) + // { + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool wlanEnforce = EFalse; + TInt enError = KErrNone; + TRAP(enError, wlanEnforce=CheckEnforcementL()); + DBG_ARGS(_S16("CWlanSettings::DeleteWLANSettings, check enforcement failed. error: <%D>"), enError ); + if(wlanEnforce) + { + ((CCommsDbProtectTableView*)iSecondaryView)->UnprotectRecord(); + } + } + + retval = iSecondaryView->DeleteRecord(); + if( retval == KErrLocked ) + { + _DBG_FILE("DeleteOneSecondarySSIDL: DeleteRecord was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && retval == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteOneSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->DeleteRecord(); + retry--; + } + if( retval != KErrNone ) + { + _DBG_FILE("DeleteOneSecondarySSIDL: DeleteRecord was unsuccessful"); + } + else + { + _DBG_FILE("DeleteOneSecondarySSIDL: DeleteRecord was successful"); + } + } + DBG_ARGS(_S16("CWlanSettings::DeleteOneSecondarySSIDL, Secondaryssid delete error: <%D> "), retval ); + + // iTableView->PutRecordChanges( ); + //} + + break; + } + + retval = iSecondaryView->GotoNextRecord(); + } + + return retval; +} + +TInt CWlanSettings::DeleteSecondarySSIDsL( TUint32 aWLANId ) + { + TInt retVal(KErrNone); + if (iSecondaryView == NULL) + { + SetSecondaryViewToRecordL(aWLANId); + } + else + { + retVal = iSecondaryView->GotoFirstRecord(); + TUint32 secId = 0; + if (retVal == KErrNone) + { + iSecondaryView->ReadUintL( TPtrC(WLAN_SEC_SSID_SERVICE_ID), secId ); + } + if (secId != aWLANId) + { + SetSecondaryViewToRecordL(aWLANId); + } + } + + TInt err = iSecondaryView->GotoFirstRecord(); + while (err == KErrNone) + { + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool wlanEnforce = EFalse; + TInt enError = KErrNone; + TRAP(enError, wlanEnforce=CheckEnforcementL()); + DBG_ARGS(_S16("CWlanSettings::DeleteSecondarySSIDsL, check enforcement failed. error: <%D>"), enError ); + if(wlanEnforce) + { + ((CCommsDbProtectTableView*)iSecondaryView)->UnprotectRecord(); + } + } + retVal = iSecondaryView->DeleteRecord(); + if( retVal == KErrLocked ) + { + _DBG_FILE("DeleteSecondarySSIDsL: DeleteRecord was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && retVal == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteSecondarySSIDsL: Slept 1 second. Try again"); + retVal = iSecondaryView->DeleteRecord(); + retry--; + } + if( retVal != KErrNone ) + { + _DBG_FILE("DeleteSecondarySSIDsL: DeleteRecord was unsuccessful"); + } + else + { + _DBG_FILE("DeleteSecondarySSIDsL: DeleteRecord was successful"); + } + } + DBG_ARGS(_S16("CWlanSettings::DeleteSecondarySSIDsL, Secondaryssid delete error: <%D> "), retVal ); + + err = iSecondaryView->GotoNextRecord(); + } + + return retVal; + } +//----------------------------------------------------------------------------- +// TInt CWlanSettings::DeleteEapSettings( TInt aWlanId, TInt aEapType ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::DeleteEAPSettings( TInt aWlanId, TInt aEapType ) + { + _DBG_FILE("CWlanSettings::DeleteEAPSettings(): begin"); + + TRAPD( err, GetEAPInterfaceL(aWlanId, EAPSettings::EEapNone, aEapType) ); + if( err == KErrNone ) + { + TRAP( err, iEapType->DeleteConfigurationL()); + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::DeleteEAPSettings, delete failed, error: <%D> "), err ); + return err; + } + } + + _DBG_FILE("CWlanSettings::DeleteEAPSettings(): end"); + return err; + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::DeleteWlanEapSettings( TInt aWlanId ) +// Deletes all EAPs from a Wlan +//----------------------------------------------------------------------------- +void CWlanSettings::DeleteWlanEapSettingsL( TInt aWlanId ) + { + _DBG_FILE("CWlanSettings::DeleteWlanEapSettings(): begin"); + TInt retVal( KErrNone ); + TInt err( KErrNone ); + + // List EAP implementations and call deletion for those that are not encapsulated + + RImplInfoPtrArray ecomInfoArray; + REComSession::ListImplementationsL( KEapTypeInterfaceUid, ecomInfoArray ); + TUint eapId; + for (TInt i = 0; i < ecomInfoArray.Count(); i++) + { + if ( !CEapType::IsDisallowedOutsidePEAP( *ecomInfoArray[i] ) ) + { + // Not encapsulated method. Settings can be deleted. + if ( ecomInfoArray[i]->DataType().Length() == KExpandedEAPIdLength) + { + // The EAP ID is in expanded type format + eapId = ecomInfoArray[i]->DataType()[7]; + } + else + { + // The EAP ID is in old 8-bit format (as string) + TLex8 lex( ecomInfoArray[i]->DataType() ); + lex.Val( eapId ); + } + err = DeleteEAPSettings( aWlanId, eapId ); + if ( err != KErrNone ) + { + retVal = err; + } + } + } + ecomInfoArray.ResetAndDestroy(); + User::LeaveIfError (retVal); + + _DBG_FILE("CWlanSettings::DeleteWlanEapSettings(): end"); + } + + + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::WriteWlanSettings( TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::WriteWlanSettings( TWlanSettings& aWlanSettings ) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): begin"); + + TInt err = 0; + TInt enError= KErrNone; + iServiceID = aWlanSettings.ServiceID; + TBool wlanEnforce = EFalse; + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAP(enError, wlanEnforce=CheckEnforcementL()); + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings, check enforcement . error: <%D>"), enError ); + if(wlanEnforce) + { + TRAPD(lockError,enError = PerformLockWLANTablesL(EFalse)); + if(lockError == KErrNone && enError == KErrNone) + { + iWLANRelock = ETrue; + } + } + } + + if( RecordExists( aWlanSettings.ServiceID ) <= 0 ) + { + err = iTableView->InsertRecord( aWlanSettings.Id ); + if( err == KErrLocked ) + { + _DBG_FILE("WriteWlanSettings InsertRecord: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && err == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteWlanSettings: Slept 1 second. Try again"); + err = iTableView->InsertRecord( aWlanSettings.Id ); + retry--; + } + } + + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings(): - InsertRecord failed. error: <%D>"), err ); + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt tableLockError= KErrNone; + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,tableLockError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,tableLockError ); + iWLANRelock =EFalse; + } + if ( tableLockError != KErrNone ) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + TRAP( err, InitialiseRecordL() ); + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings(): - InitialiseRecord failed. error: <%D>"), err ); + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt tableLockError= KErrNone; + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,tableLockError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,tableLockError ); + iWLANRelock =EFalse; + } + if ( tableLockError != KErrNone ) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + } + else + { + err = GoToRecord( aWlanSettings.ServiceID ); + if( err == KErrNone ) + { + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if ( wlanEnforce ) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): unprotect wlan"); + ((CCommsDbProtectTableView*)iTableView)->UnprotectRecord(); + } + } + + + err = iTableView->UpdateRecord( ); + if( err == KErrLocked ) + { + _DBG_FILE("WriteWlanSettings: UpdateRecord was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && err == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteWlanSettings: Slept 1 second. Try again"); + err = iTableView->UpdateRecord(); + retry--; + } + if( err != KErrNone ) + { + _DBG_FILE("WriteWlanSettings: UpdateRecord was unsuccessful"); + } + else + { + _DBG_FILE("WriteWlanSettings: UpdateRecord was successful"); + } + } + + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings(): - UpdateRecord failed. error: <%D>"), err ); + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt tableLockError= KErrNone; + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,tableLockError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,tableLockError ); + ((CCommsDbProtectTableView*)iTableView)->ProtectRecord(); + iWLANRelock =EFalse; + } + if ( tableLockError != KErrNone ) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + } + } + + TRAP( err, WriteDataToRecordL( &aWlanSettings ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): PutRecordChanges"); + err = iTableView->PutRecordChanges(); + if( err == KErrLocked ) + { + _DBG_FILE("WriteWlanSettings: PutRecordChanges was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && err == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteWlanSettings: Slept 1 second. Try again"); + err = iTableView->PutRecordChanges(); + retry--; + } + } + if( err != KErrNone ) + { + _DBG_FILE("WriteWlanSettings: PutRecordChanges was unsuccessful"); + } + else + { + _DBG_FILE("WriteWlanSettings: PutRecordChanges was successful"); + } + } + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if(iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError,enError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), lockError,enError ); + iWLANRelock =EFalse; + } + } + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings(): end. err: <%D>"), err ); + return err; + } + + + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::WriteWlanSettings( TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::WriteSecondarySSIDL( TUint32 aWlanID, TSecondarySSID& aSettings, TBool aNew ) + { + + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): begin"); + + TUint32 id = 0; + delete iSecondaryView; + iSecondaryView = NULL; + + TInt retval = KErrNone; + TInt reLock = EFalse; + TBool apEnforce=EFalse; + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::WriteSecondarySSIDL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if(eError==KErrNone && apEnforce) + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): set db protect"); + TInt enError=KErrNone; + TInt lockError = KErrNone; + TRAP(lockError,enError = PerformLockWLANTablesL(EFalse)); + reLock = ETrue; + if ( enError != KErrNone ) // to remove warnings + { + enError = KErrNone; + } + } + } + + + if (aNew) + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): new table inserted"); + iSecondaryView = iDatabase.OpenTableLC( TPtrC( WLAN_SECONDARY_SSID ) ); + CleanupStack::Pop(iSecondaryView); // iSecondaryView + retval = iSecondaryView->InsertRecord(id); + + if( retval == KErrLocked ) + { + _DBG_FILE("WriteSecondarySSIDL: InsertRecord was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && retval == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->InsertRecord(id); + retry--; + } + } + if( retval != KErrNone ) + { + _DBG_FILE("WriteSecondarySSIDL: InsertRecord was unsuccessful"); + } + else + { + _DBG_FILE("WriteSecondarySSIDL: InsertRecord was successful"); + } + + DBG_ARGS8(_S8("CNSmlInternetAdapter::WriteSecondarySSIDL(): Add record, error %d"), retval); + if ( retval == KErrNone ) + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): table insertion went ok"); + iSecondaryView->WriteUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), aWlanID ); + iSecondaryView->WriteUintL(TPtrC(WLAN_SEC_SSID_ID), id ); + } + } + else + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): table exists, find it"); + iSecondaryView = iDatabase.OpenViewMatchingUintLC(TPtrC(WLAN_SECONDARY_SSID), + TPtrC(WLAN_SEC_SSID_ID), + aSettings.Id); + CleanupStack::Pop(iSecondaryView); // iSecondaryView + TInt err = iSecondaryView->GotoFirstRecord(); + if (err != KErrNone) + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): go to first record failed"); + // most likely KErrNotFound, something wrong with the URI parsing probably + return err; + } + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if ( apEnforce ) + { + ((CCommsDbProtectTableView*)iSecondaryView)->UnprotectRecord(); + } + } + retval = iSecondaryView->UpdateRecord(); + if( retval == KErrLocked ) + { + _DBG_FILE("WriteSecondarySSIDL: UpdateRecord was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && retval == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->UpdateRecord(); + retry--; + } + } + if( retval != KErrNone ) + { + _DBG_FILE("WriteSecondarySSIDL: UpdateRecord was unsuccessful"); + } + else + { + _DBG_FILE("WriteSecondarySSIDL: UpdateRecord was successful"); + } + } + if ( retval == KErrNone ) + { + DBG_ARGS8(_S8("CWlanSettings::writesecondaryssids - WLAN_SEC_SSID_SCANNED_SSID uri: <%S> ad WLAN_SEC_SSID_USED_SSID : <%S>"), &aSettings.ScannedId, &aSettings.UsedId ); + iSecondaryView->WriteTextL(TPtrC(WLAN_SEC_SSID_SCANNED_SSID), aSettings.ScannedId); + iSecondaryView->WriteTextL(TPtrC(WLAN_SEC_SSID_USED_SSID), aSettings.UsedId); + + retval = iSecondaryView->PutRecordChanges(); + if( retval == KErrLocked ) + { + _DBG_FILE("WriteSecondarySSIDL: PutRecordChanges was locked."); + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && retval == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->PutRecordChanges(); + retry--; + } + } + if( retval != KErrNone ) + { + _DBG_FILE("WriteSecondarySSIDL: PutRecordChanges was unsuccessful"); + } + else + { + _DBG_FILE("WriteSecondarySSIDL: PutRecordChanges was successful"); + } + } + + if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if ( reLock ) + { + TInt enError=KErrNone; + TInt lockError = KErrNone; + TRAP(lockError,enError = PerformLockWLANTablesL(ETrue)); + if ( iSecondaryView != NULL ) + { + ((CCommsDbProtectTableView*)iSecondaryView)->ProtectRecord(); + } + if ( enError != KErrNone ) // to remove warnings + { + enError = KErrNone; + } + } + } + + + // This makes sure that there will be no calling to GotoFirstRecord() + // before secondaryview is reinitialized, (causes a panic if that would happen) + delete iSecondaryView; + iSecondaryView = NULL; + + if ( reLock&&apEnforce ) + { + reLock = EFalse; // to get rid of warnings + apEnforce = EFalse; + } + + return retval; + + } + +TInt CWlanSettings::WriteEAPSettings( EAPSettings& aEapSettings) + { + TRAPD(err, iEapType->SetConfigurationL(aEapSettings)); + return err; + } + + +//----------------------------------------------------------------------------- +// void CWlanSettings::ConnectToDatabaseL( ) +//----------------------------------------------------------------------------- +void CWlanSettings::ConnectToDatabaseL( ) + { + _DBG_FILE("CWlanSettings::ConnectToDatabaseL(): begin"); + + if( !iTableView ) + { + iTableView = iDatabase.OpenTableLC( TPtrC( WLAN_SERVICE ) ); + + if( iTableView == NULL ) + { + _DBG_FILE("CWlanSettings::ConnectToDatabaseL(): could not open table"); + User::Leave( KErrCouldNotConnect ); + } + + CleanupStack::Pop( iTableView ); //iTableView + } + + _DBG_FILE("CWlanSettings::ConnectToDatabaseL(): end"); + } + + +void CWlanSettings::GetEAPInterfaceL(const TInt aId, const TInt aTunnelingType, const TInt aType) + { + if ( aId < 0 ) + { + // Illegal input + User::Leave( KErrArgument ); + } + + if ( iEapType ) + { + delete iEapType; + iEapType = NULL; + } + + TInt err = KErrNone; + TUint8 expandedEapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + TBuf8 cue; + + // First try loading EAP type using the expanded id and if that fails + // try the 8-bit id. If that succeeds then set the flag so that subsequent + // EAP method loads are always done using the 8-bit id. + if ( iExpandedEAPTypeFieldsUsed ) + { + _DBG_FILE("CWlanSettings::GetEAPInterfaceL(): iExpandedEAPTypeFieldsUsed == True."); + // Set-up 64-bit expanded EAP id + if ( ( aType == KMschapv2TypeId[7] ) || ( aType == KTtlspapTypeId[7] ) ) + { + // This is plain MSCHAPv2. Set vendor ID correctly + expandedEapId[1] = KMschapv2TypeId[1]; + expandedEapId[2] = KMschapv2TypeId[2]; + expandedEapId[3] = KMschapv2TypeId[3]; + } + + expandedEapId[KExpandedEAPIdLength - 1] = static_cast ( aType ); + + cue.Copy( expandedEapId, KExpandedEAPIdLength ); + + // Try loading EAP ECOM module + TRAP( err, iEapType = CEapType::NewL( cue, ELan, aId )); + if ( err != KErrNone ) + { + _DBG_FILE("CWlanSettings::GetEAPInterfaceL(): Expanded EAP type loading failed. Trying old style."); + // It failed. Try old style + cue.Format( _L8("%d"), aType ); + iEapType = CEapType::NewL( cue, ELan, aId ); + _DBG_FILE("CWlanSettings::GetEAPInterfaceL(): Old style loading successful."); + // Succeeded (because didn't leave). Set the flag so that subsequent trys + // are directly using the old format. + iExpandedEAPTypeFieldsUsed = EFalse; + } + } + else + { + // Use the old 8-bit format + _DBG_FILE("CWlanSettings::GetEAPInterfaceL(): iExpandedEAPTypeFieldsUsed == False."); + cue.Format( _L8("%d"), aType ); + iEapType = CEapType::NewL( cue, ELan, aId ); + _DBG_FILE("CWlanSettings::GetEAPInterfaceL(): Old style loading successful."); + } + + // Set tunneling type + if (aTunnelingType != EAPSettings::EEapNone) + { + iEapType->SetTunnelingType(aTunnelingType); + } +} + + + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::GoToRecord( TUint32 aId ) +// Moves iTableView to point record whose id-number equals to aId +//----------------------------------------------------------------------------- +TInt CWlanSettings::GoToRecord( TUint32 aId ) +{ + _DBG_FILE("CWlanSettings::GoToRecord(): begin"); + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): begin Search record id: <%D>"), aId ); + + TInt err = iTableView->GotoFirstRecord( ); + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): end, GotoFirstRecord. err: <%D>"), err ); + return err; + } + + TUint32 id = 0; + TRAP( err, iTableView->ReadUintL( TPtrC(WLAN_SERVICE_ID), id ) ); + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): end, ReadUintL. err: <%D>"), err ); + return err; + } + + while( aId != id ) + { + err = iTableView->GotoNextRecord( ); + if( err != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): end, GotoNextRecord. err: <%D>"), err ); + return err; + } + + TRAP( err, iTableView->ReadUintL( TPtrC(WLAN_SERVICE_ID), id ) ); + + if( err == KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): Found service id: <%D>"), id ); + } + else + { + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): end, ReadUintL next. err: <%D>"), err ); + return err; + } + } + + TRAP(err, SetSecondaryViewToRecordL(aId)); + + + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): end. Final record id: <%D>"), id ); + + return err; + } + + + +void CWlanSettings::SetSecondaryViewToRecordL( TUint32 aId ) + { + // optional secondarySSID + if (iSecondaryView) + { + delete iSecondaryView; + iSecondaryView = NULL; + } + + // first open a view to secondary ssid table, with all the rows with service id + // matching the wlan service id (count can be zero) + iSecondaryView = iDatabase.OpenViewMatchingUintLC( TPtrC(WLAN_SECONDARY_SSID), + TPtrC(WLAN_SEC_SSID_SERVICE_ID), + aId); + if( iSecondaryView == NULL ) + { + // this should not happen in a normal situation + User::Leave( KErrCouldNotConnect ); + } + CleanupStack::Pop( iSecondaryView ); + } + + +//----------------------------------------------------------------------------- +// void CWlanSettings::GetDataFromRecordL( TWlanSettings* aWlanSettings ) +// Read settings from database to aWlanSettings structure +//----------------------------------------------------------------------------- +void CWlanSettings::GetDataFromRecordL( TWlanSettings* aWlanSettings ) + { + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): begin"); + + TInt leavecode = 0; + + aWlanSettings->ServiceID = 0; + aWlanSettings->ConnectionMode = 0; + aWlanSettings->SSID = _L(""); + aWlanSettings->UsedSSID = _L(""); + aWlanSettings->ScanSSID = 0; + aWlanSettings->WepKey1 = _L8(""); + aWlanSettings->WepKey2 = _L8(""); + aWlanSettings->WepKey3 = _L8(""); + aWlanSettings->WepKey4 = _L8(""); + aWlanSettings->WepIndex = 0; + aWlanSettings->SecurityMode = EAllowUnsecure; + aWlanSettings->WPAPreSharedKey = _L8(""); + aWlanSettings->UseWPAPSK = 0; + aWlanSettings->EapList = _L(""); + aWlanSettings->AuthMode = 0; + + TRAP( leavecode, iTableView->ReadUintL( TPtrC( WLAN_SERVICE_ID ), aWlanSettings->ServiceID ) ); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_SERVICE_ID read error: <%D>"), leavecode ); + } + + TRAP( leavecode, iTableView->ReadUintL( TPtrC( WLAN_CONNECTION_MODE ), aWlanSettings->ConnectionMode ) ); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_CONNECTION_MODE read error: <%D>"), leavecode ); + } + + TRAP( leavecode, iTableView->ReadUintL( TPtrC( NU_WLAN_AUTHENTICATION_MODE ), aWlanSettings->AuthMode ) ); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): NU_WLAN_AUTHENTICATION_MODE read error: <%D>"), leavecode ); + } + + TRAP( leavecode, iTableView->ReadUintL( TPtrC( WLAN_WEP_INDEX ), aWlanSettings->WepIndex ) ); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_WEP_INDEX read error: <%D>"), leavecode ); + } + + TRAP( leavecode, iTableView->ReadUintL( TPtrC( WLAN_SECURITY_MODE ), aWlanSettings->SecurityMode ) ); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_SECURITY_MODE read error: <%D>"), leavecode ); + } + + TRAP( leavecode, iTableView->ReadUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), aWlanSettings->UseWPAPSK ) ); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_ENABLE_WPA_PSK read error: <%D>"), leavecode ); + } + + TBuf8 columnValue8; + TRAP(leavecode, iTableView->ReadTextL( TPtrC(NU_WLAN_WEP_KEY1 ), columnValue8 )); + if ( ( leavecode == KErrNone ) && ( columnValue8.Length() > 0 ) ) + { + aWlanSettings->WepKey1 = columnValue8; + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY1 read error: <%D>"), leavecode ); + } + + TRAP(leavecode, iTableView->ReadTextL( TPtrC(NU_WLAN_WEP_KEY2 ), columnValue8 )); + if ( ( leavecode == KErrNone ) && ( columnValue8.Length() > 0 ) ) + { + aWlanSettings->WepKey2 = columnValue8; + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY2 read error: <%D>"), leavecode ); + } + + TRAP(leavecode, iTableView->ReadTextL( TPtrC(NU_WLAN_WEP_KEY3 ), columnValue8 )); + if ( ( leavecode == KErrNone ) && ( columnValue8.Length() > 0 ) ) + { + aWlanSettings->WepKey3 = columnValue8; + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY3 read error: <%D>"), leavecode ); + } + + TRAP(leavecode, iTableView->ReadTextL( TPtrC(NU_WLAN_WEP_KEY4 ), columnValue8 )); + if ( ( leavecode == KErrNone ) && ( columnValue8.Length() > 0 ) ) + { + aWlanSettings->WepKey4 = columnValue8; + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY4 read error: <%D>"), leavecode ); + } + + TBuf8 precolumnValue8; + TBuf columnValue; + + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): Before getting WLAN_WPA_PRE_SHARED_KEY "); + TRAP(leavecode, iTableView->ReadTextL( TPtrC(WLAN_WPA_PRE_SHARED_KEY ), precolumnValue8 )); + DBG_ARGS(_S16("CWlanSettings::ReadTextL( TPtrC(WLAN_WPA_PRE_SHARED_KEY ),length of key: <%D>"), precolumnValue8.Length() ); + if ( ( leavecode == KErrNone ) && ( precolumnValue8.Length() > 0 ) ) + { + aWlanSettings->WPAPreSharedKey = precolumnValue8; + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_WPA_PRE_SHARED_KEY read error: <%D>"), leavecode ); + } + + TRAP(leavecode, iTableView->ReadTextL( TPtrC(NU_WLAN_SSID ), columnValue )); + if ( ( leavecode == KErrNone ) && ( columnValue.Length() > 0 ) ) + { + aWlanSettings->SSID = columnValue; + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): NU_WLAN_SSID read error: <%D>"), leavecode ); + } + + TRAP(leavecode, iTableView->ReadTextL( TPtrC(WLAN_USED_SSID ), columnValue )); + if ( ( leavecode == KErrNone ) && ( columnValue.Length() > 0 ) ) + { + aWlanSettings->UsedSSID = columnValue; + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): WLAN_USED_SSID reading ok"); + } + else + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_USED_SSID read error: <%D>"), leavecode ); + } + + iTableView->ReadTextL( TPtrC(WLAN_USED_SSID), aWlanSettings->UsedSSID ); + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): WLAN_USED_SSID"); + + TRAP(leavecode, iTableView->ReadUintL( TPtrC(WLAN_SCAN_SSID ), aWlanSettings->ScanSSID )); + if ( leavecode != KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::GetDataFromRecordL(): WLAN_SCAN_SSID read error: <%D>"), leavecode ); + } + + TInt retval = iSecondaryView->GotoFirstRecord(); + if (retval == KErrNone) + { + aWlanSettings->SecondarySSIDsExisting = ETrue; + } + else + { + aWlanSettings->SecondarySSIDsExisting = EFalse; + } + + // Try to read the old EAPList field + HBufC* eapList = iTableView->ReadLongTextLC( TPtrC( WLAN_EAPS ) ); + if ( eapList->Length() > 0 ) + { + // The old field was valid and there was content + aWlanSettings->EapList = *eapList; + } + else + { + // Old list was invalid or empty. Try the new fields: + // enabled EAP types + TBuf8 enabledTypes; + TBuf8 disabledTypes; + iTableView->ReadTextL( TPtrC( WLAN_ENABLED_EAPS ), enabledTypes); + iTableView->ReadTextL( TPtrC( WLAN_DISABLED_EAPS ), disabledTypes); + + // Calculate the number of EAP types altogether + TUint numEapTypes = enabledTypes.Length() / KExpandedEAPIdLength; + numEapTypes += disabledTypes.Length() / KExpandedEAPIdLength; + + if (numEapTypes > 0) + { + // One EAP type reserves maximum of 5 bytes: "+xxx," + HBufC* outputBuf = HBufC::NewLC( numEapTypes * KLengthOfOldStyleEAPListEntry ); + + TPtr output = outputBuf->Des(); + _LIT( KFormat, "%03d" ); + for ( TInt i = (KExpandedEAPIdLength - 1) ; i < enabledTypes.Length() ; i += KExpandedEAPIdLength) + { + + output.Append(TChar( '+' )); + output.AppendFormat( KFormat, enabledTypes[i] ); + output.Append(TChar( ',' )); + } + + for ( TInt i = (KExpandedEAPIdLength - 1) ; i < disabledTypes.Length() ; i += KExpandedEAPIdLength) + { + output.Append(TChar( '-' )); + output.AppendFormat( KFormat, disabledTypes[i] ); + output.Append(TChar( ',' )); + } + // Strip the final ',' + output.Delete( output.Length() - 1, 1 ); + + aWlanSettings->EapList = *outputBuf; + CleanupStack::PopAndDestroy( outputBuf ); + } + } + + CleanupStack::PopAndDestroy( eapList ); + + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): WLAN_EAPS"); + + + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): end"); + } + + + +//----------------------------------------------------------------------------- +// void CWlanSettings::GetSecondarySSIDListL(TUint32 aId, RArray& aSecondarySSIDs) +// Fills the array with secondarySSIDs, which are associated with given WLANID +//----------------------------------------------------------------------------- +void CWlanSettings::GetSecondarySSIDListL(TUint32 aWlanId, RArray& aSecondarySSIDs) + { + if (iSecondaryView == NULL) + { + // views haven't been initialized, in case of incorrect usage + User::Leave(KErrNotReady); + } + + // set the view pointer into the first record + TInt retval = iSecondaryView->GotoFirstRecord(); + if (retval != KErrNone) + { + return; + } + + // check that given id matches the current rowset. If not, then reinitialize + TUint32 id; + TInt err(KErrNone); + TRAP(err, iSecondaryView->ReadUintL( TPtrC(WLAN_SEC_SSID_SERVICE_ID ), id )); + if (id != aWlanId) + { + SetSecondaryViewToRecordL(aWlanId); + retval = iSecondaryView->GotoFirstRecord(); + } + + TBuf columnValue; + + while (retval == KErrNone) + { + TSecondarySSID ssid; + TRAP(retval, iSecondaryView->ReadUintL( TPtrC(WLAN_SEC_SSID_ID ), ssid.Id )); + TRAP(retval, iSecondaryView->ReadTextL( TPtrC(WLAN_SEC_SSID_SCANNED_SSID ), ssid.ScannedId )); + TRAP(retval, iSecondaryView->ReadTextL( TPtrC(WLAN_SEC_SSID_USED_SSID ), ssid.UsedId )); + aSecondarySSIDs.Append(ssid); + retval = iSecondaryView->GotoNextRecord(); + } + } + + + + +//----------------------------------------------------------------------------- +// void CWlanSettings::WriteDataToRecordL( TWlanSettings* aWlanSettings ) +// Writes settings to database from aWlanSettings structure +//----------------------------------------------------------------------------- +void CWlanSettings::WriteDataToRecordL( TWlanSettings* aWlanSettings ) + { + _DBG_FILE("CWlanSettings::WriteDataToRecordL(): begin"); + + iTableView->WriteUintL( TPtrC(WLAN_SERVICE_ID), aWlanSettings->ServiceID ); + iTableView->WriteUintL( TPtrC(WLAN_CONNECTION_MODE), aWlanSettings->ConnectionMode ); + iTableView->WriteUintL( TPtrC(WLAN_WEP_INDEX), aWlanSettings->WepIndex ); + iTableView->WriteUintL( TPtrC(WLAN_SECURITY_MODE), aWlanSettings->SecurityMode ); + iTableView->WriteUintL( TPtrC(WLAN_ENABLE_WPA_PSK), aWlanSettings->UseWPAPSK ); + iTableView->WriteUintL( TPtrC(NU_WLAN_AUTHENTICATION_MODE), aWlanSettings->AuthMode ); + iTableView->WriteTextL( TPtrC(NU_WLAN_SSID), aWlanSettings->SSID ); + iTableView->WriteTextL( TPtrC(WLAN_USED_SSID), aWlanSettings->UsedSSID ); + iTableView->WriteUintL( TPtrC(WLAN_SCAN_SSID), aWlanSettings->ScanSSID ); + + iTableView->WriteTextL( TPtrC(NU_WLAN_WEP_KEY1), aWlanSettings->WepKey1 ); + iTableView->WriteTextL( TPtrC(NU_WLAN_WEP_KEY2), aWlanSettings->WepKey2 ); + iTableView->WriteTextL( TPtrC(NU_WLAN_WEP_KEY3), aWlanSettings->WepKey3 ); + iTableView->WriteTextL( TPtrC(NU_WLAN_WEP_KEY4), aWlanSettings->WepKey4 ); + iTableView->WriteUintL( TPtrC(WLAN_WEP_KEY1_FORMAT ), 1 ); // 0 = Eascii, 1 = EHexadecimal + iTableView->WriteUintL( TPtrC(WLAN_WEP_KEY2_FORMAT ), 1 ); + iTableView->WriteUintL( TPtrC(WLAN_WEP_KEY3_FORMAT ), 1 ); + iTableView->WriteUintL( TPtrC(WLAN_WEP_KEY4_FORMAT ), 1 ); + + iTableView->WriteTextL( TPtrC(WLAN_WPA_PRE_SHARED_KEY), aWlanSettings->WPAPreSharedKey ); + iTableView->WriteUintL( TPtrC(WLAN_WPA_KEY_LENGTH), aWlanSettings->WPAPreSharedKey.Length() ); + + // Expanded EAP types in use. Write the eap list to the new columns. + + // generate appropriate entries in the new enabled and disabled list, + // overwriting those values + + // count the + and - signs to determine the size of enabled and + // disabled descriptors + TLex lex( aWlanSettings->EapList ); + + TInt numPlus = 0; + TInt numMinus = 0; + TChar ch; + while ( !lex.Eos() ) + { + ch = lex.Get(); + if ( ch == '+' ) ++numPlus; + else if ( ch == '-' ) ++numMinus; + } + + // each entry consumes 8 bytes in binary format + HBufC8* enabledEAPPlugin = HBufC8::NewL( 8 * numPlus ); + CleanupStack::PushL( enabledEAPPlugin ); + + HBufC8* disabledEAPPlugin = HBufC8::NewL( 8 * numMinus ); + CleanupStack::PushL( disabledEAPPlugin ); + + lex.Assign( aWlanSettings->EapList ); + + while ( !lex.Eos() ) + { + // beginning of implementation UID + TInt16 implUid = 0; + + if ( lex.Val( implUid ) != KErrNone || !implUid ) + { + // if the old string is corrupted, null out both lists + enabledEAPPlugin->Des().Zero(); + disabledEAPPlugin->Des().Zero(); + break; + } + + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8( KPadding, "\xFE\0\0\0\0\0\0" ); + _LIT8( KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + const TInt KTtlspapImplUid = 98; + + // Check whether eap is inluded or not +/- + if ( implUid > 0 ) + { + // check whether plain mschap or ttlspap in question + if ( Abs( implUid ) == KPlainMsChapV2ImplUid || Abs( implUid ) == KTtlspapImplUid ) + { + enabledEAPPlugin->Des().Append( KMsChapV2Padding ); + } + else + { + enabledEAPPlugin->Des().Append( KPadding ); + } + enabledEAPPlugin->Des().Append( Abs( implUid ) ); + } + else if (implUid < 0 ) + { + // check whether plain mschap or ttlspap in question + if ( Abs( implUid ) == KPlainMsChapV2ImplUid || Abs( implUid ) == KTtlspapImplUid ) + { + disabledEAPPlugin->Des().Append( KMsChapV2Padding ); + } + else + { + disabledEAPPlugin->Des().Append( KPadding ); + } + disabledEAPPlugin->Des().Append( Abs( implUid ) ); + } + + // swallow the delimiter (',') + lex.Get(); + } + + + + iTableView->WriteTextL( TPtrC( WLAN_ENABLED_EAPS ), + enabledEAPPlugin? + (const TDesC8&)*enabledEAPPlugin: + (const TDesC8&)KNullDesC8 ); + + iTableView->WriteTextL( TPtrC( WLAN_DISABLED_EAPS ), + disabledEAPPlugin? + (const TDesC8&)*disabledEAPPlugin: + (const TDesC8&)KNullDesC8 ); + CleanupStack::PopAndDestroy( disabledEAPPlugin ); + CleanupStack::PopAndDestroy( enabledEAPPlugin ); + + _DBG_FILE("CWlanSettings::WriteDataToRecordL(): end"); + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::RecordExists( TUint32 aLuid ) +// Returns ETrue if record exists in database +//----------------------------------------------------------------------------- +TInt CWlanSettings::RecordExists( TUint32 aLuid ) + { + _DBG_FILE("CWlanSettings::RecordExists(): begin"); + + TInt err = KErrNone; + TRAP( err, ConnectToDatabaseL() ); + + // If the connection went ok, then we can go to the record + if( err == KErrNone ) + { + err = GoToRecord( aLuid ); + } + + if( err == KErrNone ) + { + DBG_ARGS(_S16("CWlanSettings::RecordExists(): end. GoToRecord OK err: <%D>"), err ); + return ETrue; + } + else + { + DBG_ARGS(_S16("CWlanSettings::RecordExists(): end. GoToRecord error err: <%D>"), err ); + return err; + } + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::InitialiseRecordL( ) +// Inserts mandatory values for commsdb +//----------------------------------------------------------------------------- +void CWlanSettings::InitialiseRecordL( ) + { + _DBG_FILE("CWlanSettings::InitialiseRecordL(): begin"); + + iTableView->WriteUintL( TPtrC(WLAN_WPA_KEY_LENGTH), 0 ); + iTableView->WriteUintL( TPtrC(NU_WLAN_AUTHENTICATION_MODE), 0 ); + + _DBG_FILE("CWlanSettings::InitialiseRecordL(): end"); + } + + +TInt CWlanSettings::InstalledEAPsL(CBufBase& aEAPList) + { + _DBG_FILE("CWlanSettings::InstalledEAPsL(): begin"); + + RImplInfoPtrArray ecomInfoArray; + REComSession::ListImplementationsL(KEapTypeInterfaceUid, ecomInfoArray); + + TUint eapId( 0 ); + + // First sort the EAPIds + for (TInt i = 0; i < ecomInfoArray.Count(); i++) + { + if ( ecomInfoArray[i]->DataType().Length() == KExpandedEAPIdLength) + { + // The EAP ID is in expanded type format + // Only handle the vendor type of 0 + if ( (ecomInfoArray[i]->DataType()[1] != 0 + || ecomInfoArray[i]->DataType()[2] != 0 + || ecomInfoArray[i]->DataType()[3] != 0 ) + && ( ( ecomInfoArray[i]->DataType()[7] != KMschapv2TypeId[7] ) && + ( ecomInfoArray[i]->DataType()[7] != KTtlspapTypeId[7] ) ) ) + { + // This is some other vendor type than IETF + continue; + } + eapId = ecomInfoArray[i]->DataType()[7]; + _DBG_FILE("CWlanSettings::InstalledEAPsL(): Expanded EAP id found."); + } + else + { + // The EAP ID is in old 8-bit format (as string) + TLex8 lex( ecomInfoArray[i]->DataType() ); + if ( lex.Val( eapId ) != KErrNone ) + { + // Unsupported format. Ignore this. + _DBG_FILE("CWlanSettings::InstalledEAPsL(): Unsupported EAP id found."); + continue; + } + _DBG_FILE("CWlanSettings::InstalledEAPsL(): Old style EAP id found."); + } + + if ( !CEapType::IsDisallowedOutsidePEAP( *ecomInfoArray[i] ) ) + { + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + TBuf8<3> cue; // Max EAPId == 255 + cue.AppendNumFixedWidth( eapId, EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); + } + + // Check if the method is allowed inside PEAP + if ( !CEapType::IsDisallowedInsidePEAP( *ecomInfoArray[i] ) ) + { + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + TBuf8<3> cue; // Max EAPId == 255 + cue.AppendNumFixedWidth( eapId, EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KDash); + cue.Zero(); + cue.AppendNumFixedWidth( KEapPeapTypeId[7], EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); + +#ifdef FF_WLAN_EXTENSIONS + // same additions for EAP-FAST + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + cue.Zero(); // Max EAPId == 255 + cue.AppendNumFixedWidth( eapId, EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KDash); + cue.Zero(); + cue.AppendNumFixedWidth( KEapFastTypeId[7], EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); +#endif + } + // Check if the method is allowed inside TTLS + if ( !CEapType::IsDisallowedInsideTTLS( *ecomInfoArray[i] ) ) + { + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + TBuf8<3> cue; // Max EAPId == 255 + cue.AppendNumFixedWidth( eapId, EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KDash); + cue.Zero(); + cue.AppendNumFixedWidth( KEapTtlsTypeId[7], EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); + } + } + // ECOM array is no longer needed. + ecomInfoArray.ResetAndDestroy(); + + // Cut the last slash + aEAPList.ResizeL( aEAPList.Size() -1); + + _DBG_FILE("CWlanSettings::InstalledEAPsL(): end"); + return KErrNone; + } + + + +//----------------------------------------------------------------------------- +// TBool CWlanSettings::CheckEnforcementL( ) +// Checks if wlan enforcement is On or Off +//----------------------------------------------------------------------------- + TBool CWlanSettings::CheckEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceWLANActive ( EFalse ); + User::LeaveIfError(info->EnforcementActive(EWLANEnforcement, enforceWLANActive)); + CleanupStack::PopAndDestroy(info); + return ( enforceWLANActive) ; + } + +//----------------------------------------------------------------------------- +// TBool CWlanSettings::CheckAPEnforcementL( ) +// Checks if AP enforcement is On or Off +//----------------------------------------------------------------------------- + +TBool CWlanSettings::CheckAPEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceAPActive ( EFalse ); + User::LeaveIfError(info->EnforcementActive(EAPEnforcement, enforceAPActive)); + CleanupStack::PopAndDestroy(info); + return ( enforceAPActive) ; + } +//----------------------------------------------------------------------------- +// TInt CWlanSettings::PerformLockWLANTablesL( ) +// Locks or unlocks the wlan tables depending on the +// aProtect value +//----------------------------------------------------------------------------- + TInt CWlanSettings::PerformLockWLANTablesL(TBool aProtect) + { + + _DBG_FILE("CWlanSettings::PerformLockWLANTablesL(): BEGIN "); + CCommsDatabaseProtect* dbprotect = CCommsDatabaseProtect::NewL(); + CleanupStack::PushL(dbprotect); + RArray wlanTableList; + CleanupClosePushL( wlanTableList ); + TBuf serviceType; + TBool apEnforce = EFalse; + TInt err = KErrNone; + + TRAP_IGNORE( apEnforce=CheckAPEnforcementL() ); + if(apEnforce) + { + _DBG_FILE("CWlanSettings::PerformLockWLANTablesL(): AP enforcement is TRUE"); + wlanTableList.AppendL( TPtrC( WAP_ACCESS_POINT ) ); + wlanTableList.AppendL( TPtrC( WAP_IP_BEARER ) ); + wlanTableList.AppendL( TPtrC( IAP ) ); + //condition when only ap is enforced and not wlan then its not + //necessary to add wlanservice table + RDbRowSet::TAccess checkAccessType; + checkAccessType = dbprotect->GetTableAccessL(TPtrC(WLAN_DEVICE_SETTINGS)); + switch(checkAccessType) + { + case RDbRowSet::EReadOnly : + { + wlanTableList.AppendL( TPtrC(WLAN_SERVICE) ); + wlanTableList.AppendL(TPtrC(WLAN_SECONDARY_SSID) ); + } + default : + { + break; + } + } + + } + else + { + _DBG_FILE("CWlanSettings::PerformLockWLANTablesL() Only wlan enforcement is ON"); + wlanTableList.AppendL( TPtrC(WLAN_SERVICE) ); + wlanTableList.AppendL(TPtrC(WLAN_SECONDARY_SSID) ); + } + + iDatabase.CommitTransaction(); + + for ( TInt i( 0 ); i < wlanTableList.Count(); i++ ) + { + if(!aProtect) + { + err = dbprotect->UnProtectTable( wlanTableList[ i ] ); + DBG_ARGS(_S16("CWlanSettings::PerformLockWLANTablesL(): Unprotect error %D"), err); + //Check if current AP is locked , if yes , unprotect + // lock = EFalse; + } + else + { + err = dbprotect->ProtectTable( wlanTableList[ i ] ); + //Check if current ServiceID is not locked , if yes , protect + // lock = ETrue; + } + } //for loop + + CleanupStack::PopAndDestroy(&wlanTableList); + CleanupStack::PopAndDestroy( dbprotect ); + CCommsDatabase* commsDataBase = CCommsDatabase::NewL(); + CleanupStack::PushL( commsDataBase ); + + // Open the IAP from IAP Table and protect + + TUint32 apIAPID = 0; + CCommsDbTableView* iapViews = commsDataBase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(IAP_SERVICE), + iServiceID); + err = iapViews->GotoFirstRecord(); + // Service ID can be same for GPRS or WLAN, hence check service type and get the iAPID + while (err == KErrNone ) + { + iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + if(serviceType == TPtrC(LAN_SERVICE)) + { + iapViews->ReadUintL(TPtrC(COMMDB_ID), apIAPID); + DBG_ARGS(_S16("CWlanSettings::PerformLockWLANTablesL(): IAPId %D"), apIAPID); + break; + } + err = iapViews->GotoNextRecord(); + } + + //iapViews->ReadUintL(TPtrC(COMMDB_ID), apIAPID); + DBG_ARGS(_S16("CWlanSettings::PerformLockWLANTablesL(): end. IAP ID being locked %d "), apIAPID ); + if(err == KErrNone) + { + CCommsDbTableView* iapUpdate = commsDataBase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID),apIAPID); + TInt iapExists = iapUpdate->GotoFirstRecord(); + + if(!aProtect) + { + ((CCommsDbProtectTableView*)iapViews)->UnprotectRecord(); + if (iapExists) + { + ((CCommsDbProtectTableView*)iapUpdate)->UnprotectRecord(); + } + } + else + { + ((CCommsDbProtectTableView*)iapViews)->ProtectRecord(); + if (iapExists) + { + ((CCommsDbProtectTableView*)iapUpdate)->ProtectRecord(); + } + } + CleanupStack::PopAndDestroy(); // iapUpdate + } + + CleanupStack::PopAndDestroy( iapViews ); + CleanupStack::PopAndDestroy( commsDataBase ); + + iDatabase.BeginTransaction(); + return err; + } + + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/group/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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 "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 information file for project nsmldmalwaysonadapter +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + + +PRJ_MMPFILES +nsmldmalwaysonadapter.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/group/nsmldmalwaysonadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/group/nsmldmalwaysonadapter.mmp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,43 @@ +/* +* 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 "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 nsmldmalwaysonadapter +* +*/ + +#include +#include + +TARGET nsmldmalwaysonadapter.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x101f6d36 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE nsmldmalwaysonadapter.cpp +SOURCE nsmldmalwaysonsettingstore.cpp + +START RESOURCE nsmldmalwaysonadapter.rss +END + +USERINCLUDE ../inc + +//Default system include paths for middleware layer modules +MW_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib ecom.lib charconv.lib flogger.lib +LIBRARY centralrepository.lib diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/logger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/logger.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,99 @@ +/* +* 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 "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: Provides logging services. +* +*/ + + +#ifndef ALWAYSONLOGGER_H +#define ALWAYSONLOGGER_H + +#ifdef _DEBUG + // 0 = No logging, +#define LOGGING_METHOD 1 // 1 = Flogger, + // 2 = RDebug +#else + +#define LOGGING_METHOD 0 // No logging in UREL builds + +#endif // _DEBUG + + +#if LOGGING_METHOD == 1 // Flogger + +#include +_LIT(KLOGFolder,"ALWAYSONADAPTER"); +_LIT(KLOGFile,"ALWAYSONADAPTER.txt"); + +#define LOGTEXT(x)\ + {\ + RFileLogger::Write(KLOGFolder(),KLOGFile(),EFileLoggingModeAppend,\ + x);\ + } + +#define LOGSTRING(x)\ + {\ + _LIT8(tempLogDes,x);\ + RFileLogger::Write(KLOGFolder(),KLOGFile(),EFileLoggingModeAppend,\ + tempLogDes());\ + } + +#define LOGSTRING2(x,y)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KLOGFolder(),\ + KLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y);\ + } + +#define LOGSTRING3(x,y,z)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KLOGFolder(),\ + KLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y,z);\ + } + +#define LOGSTRING4(w,x,y,z)\ + { _LIT8(tempLogDes,w);\ + RFileLogger::WriteFormat(KLOGFolder(),\ + KLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),x,y,z);\ + } + + +#elif _LOGGING_METHOD == 2 // RDebug + +#include + +#define LOGSTRING(x) RDebug::Print(x); +#define LOGSTRING(x) RDebug::Print(_L(x)); +#define LOGSTRING2(x,y) RDebug::Print(_L(x),y); +#define LOGSTRING3(x,y,z) RDebug::Print(_L(x),y,z); +#define LOGSTRING4(w,x,y,z) RDebug::Print(_L(w),x,y,z); + +#else // LOGGING_METHOD == 0 or invalid + +#define LOGSTRING(x) +#define LOGSTRING(x) +#define LOGSTRING2(x,y) +#define LOGSTRING3(x,y,z) +#define LOGSTRING4(w,x,y,z) + +#endif // LOGGING_METHOD + +#endif // ALWAYSONLOGGER_H + +// End of File diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,581 @@ +/* +* 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 "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: DM adapter for handling always-on settings. +* +*/ + + +#ifndef NSMLDMALWAYSONADAPTER_H +#define NSMLDMALWAYSONADAPTER_H + +#include + +#include "nsmldmalwaysonsettingstore.h" + +class CSmlDmAOCommandElement; +class CNSmlDmAOSettingStore; + +// The DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) +_LIT8( KNSmlDmAOAdapterDDFVersion, "1.0" ); +_LIT8( KNSmlDmAOAdapterTextPlain, "text/plain" ); + +// Names of the nodes +// When updating KNSmlDmAOAdapterAOURI also update +// KNSmlDmAOAdapterURIMaxLength! */ +_LIT8(KNSmlDmAOAdapterAOURI, "./VENDORCONFIG"); +_LIT8(KNSmlDmAOAdapterAO, "VENDORCONFIG"); +_LIT8(KNSmlDmAOAdapterName, "NAME"); +_LIT8(KNSmlDmAOAdapterAwonPdpc, "AWON-PDPC"); +_LIT8(KNSmlDmAOAdapterTRetry, "T-RETRY"); + + +// Descriptions of the nodes +_LIT8( KNSmlDmAOAdapterAODescription, + "Always-on provides management of connections"); +_LIT8( KNSmlDmAOAdapterNameDescription, + "Name of the VENDORCONFIG"); +_LIT8( KNSmlDmAOAdapterAwonPdpcDescription, + "Always-on setting in home and visited network"); +_LIT8( KNSmlDmAOAdapterTRetryDescription, + "T-Retry timer interval"); + +// Leaf nodes of VENDORCONFIG node +_LIT8( KNSmlDmAOAllLeafNodes, + "NAME/AWON-PDPC/T-RETRY"); + +// URI segment separator +// When updating this literal also update +// KNSmlDmAOAdapterAPURIMaxLength and KNSmlDmAOAdapterURIMaxLength! +_LIT8( KNSmlDmAOSeparator, "/" ); + +// URI segment separator +// When updating KNSmlDmAOAdapterAOURI also update +// KNSmlDmAOAdapterAPURIMaxLength and KNSmlDmAOAdapterURIMaxLength! +_LIT8( KNSmlDmAOUriListSeparator, "," ); + +// Prefix in URIs (removed for LUID mapping) +_LIT8( KNSmlDmAOAdapterURIPrefix, "./" ); + +// Name prefix for unnamed VENDORCONFIG nodes +_LIT8( KNSmlDmAONamePrefix, "VENDORCONFIG" ); + +const TInt KNSmlDmAOGranularity = 4; +const TInt KNSmlDmAOInvalidRef = -1; + +// Maximum length of VENDORCONFIG URI including a separator +// character in URI List. Node is not calculated here. +// KNSmlDmAOAdapterAOURI + KNSmlDmAOSeparator + KNSmlDmAOUriListSeparator +const TInt KNSmlDmAOAdapterURIMaxLength = 16; + +/** + * Always-on device management adapter + * + * Always-on device management adapter manages settings + * related to VENDORCONFIG. + * + * @lib nsmldmalwaysonadapter + * @since S60 v3.2 + */ +class CNSmlDmAOAdapter : public CSmlDmAdapter + { + +public: + +/** Possible command types */ +enum TCommandType + { + EAddCmd, + EGetCmd, + EGetSizeCmd, + EDeleteCmd + }; + + + static CNSmlDmAOAdapter* NewL( MSmlDmCallback* aDmCallback ); + + virtual ~CNSmlDmAOAdapter(); + + +// from base class CSmlDmAdapter + + /** + * The function returns current version of the DDF. + * + * @since S60 v3.2 + * @param aVersion DDF version of the + * adapter. (filled by the adapter) + */ + void DDFVersionL( CBufBase& aDDFVersion ); + + /** + * The function for filling the DDF structure of the adapter + * + * @since S60 v3.2 + * @param aDDFObject Reference to root object. + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * The function creates new leaf objects, or replaces data in existing + * leaf objects. The information about the success of the command is + * returned by calling SetStatusL function of MSmlDmCallback callback + * interface. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aObject Data of the object. + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this reference + * must be used when calling the SetStatusL of this + * command + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + /** + * The function deletes an object and its child objects. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter have earlier + * returned LUID to the DM Module). + * @param aStatusRef Reference to correct command, i.e. this reference + * must be used when calling the SetStatusL of this + * command. + */ + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef ); + + /** + * The function fetches data of a leaf object. The SetStatusL is used + * as described in UpdateLeafObjectL(). The data is returned by using the + * SetResultsL function of MSmlCallback callback interface. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter have + * earlier returned LUID to the DM Module). + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results, i.e. this + * reference must be used when returning the + * result by calling the SetResultsL. + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function fetches the size of the data of a leaf object. The size + * is in bytes, and must reflect the number of bytes that will be + * transferred when the framework calls FetchLeafObjectL. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter have + * earlier returned LUID to the DM Module). + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results, i.e. this + * reference must be used when returning the + * result by calling the SetResultsL. + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function fetches URI list. An adapter returns the list of URI + * segments under the given URI be separated by slash ("/"). The URI + * segment names for new objects must be given by the adapter. + * The list is returned by calling the SetResultsL function of + * MSmlCallback callback interface. + * + * @since S60 v3.2 + * @param aParentURI URI of the parent object + * @param aParentLUID LUID of the parent object (if the + * adapter have earlier returned LUID to + * the DM Module). + * @param aPreviousURISegmentList URI list with mapping LUID + * information, which is known by DM + * engine. + * @param aResultsRef Reference to correct results, i.e. + * this reference must be used when + * returning the result by calling the + * SetResultsL. + * @param aStatusRef Reference to correct command, i.e. + * this reference must be used when + * calling the SetStatusL of this + * command. + */ + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef ); + + /** + * The function adds node object. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aParentLUID LUID of the parent object (if the adapter have + * earlier returned LUID to the DM Module). + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + TInt aStatusRef ); + /** + * The adapter does not support streaming and no implementation is + * provided for this function. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Data of the object. + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this reference + * must be used when calling the SetStatusL of this + * command. + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support execute command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aURI URI of the command + * @param aLUID LUID of the object + * @param aArgument Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support execute command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aURI URI of the command + * @param aLUID LUID of the object + * @param aStream Argument for the command. + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support copy command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aTargetURI Target URI for the command + * @param aSourceLUID LUID of the target object + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object + * @param aType MIME type of the objects + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + /** + * Not supported + * @since S60 v3.2 + */ + void StartAtomicL(); + /** + * Not Supported + * @since S60 v3.2 + * + */ + void CommitAtomicL(); + /** + * Not supported. + * @since S60 v3.2 + */ + void RollbackAtomicL(); + /** + * Returns EFalse as the adapter does not support streaming + * + * @since S60 v3.2 + * @param aItemSize size limit for stream usage + * @return TBool EFalse as streaming is not supported + */ + TBool StreamingSupport( TInt& aItemSize ); + /** + * Not supported + * + * @since S60 v3.2 + */ + void StreamCommittedL(); + /** + * The function tells the adapter that all the commands of the message + * that can be passed to the adapter have now been passed. This + * indciates that the adapter must supply status codes and results to + * any buffered commands. This must be done at latest by the time this + * function returns. This function is used at the end of SyncML messages, + * and during processing of Atomic. + * + * @since S60 v3.2 + */ + void CompleteOutstandingCmdsL(); + + /** + * Converts integer to 8bit descriptor + * + * @since S60 v3.2 + * @param aLuid The integer to be converted + * @return The Integer as a descriptor + */ + HBufC8* IntToDes8L( TInt aLuid) const; + + /** + * Converts 8bit descriptor to integer + * + * @since S60 v3.2 + * @param aLuid The descriptor to be converted + * @return Integer value of the descriptor + */ + TUint DesToIntL(const TDesC8& aLuid) const; + + +private: + + /** + * Constructor + */ + CNSmlDmAOAdapter(); + + /** + * Constructor + * @param aDmCallback Callback object to the framework + */ + CNSmlDmAOAdapter( MSmlDmCallback* aDmCallback ); + + /** + * Second phase constructor + */ + void ConstructL(); + + /** + * Parses the last URI segment from URI + * @param aURI The whole URI + * @return The last URI segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + +private: //data + + /** + * Setting store object, which is called for managing settings + * in CommsDat. Own. + */ + CNSmlDmAOSettingStore * iSettingStore; + + }; + + +/** + * CSmlDmAOCommandElement + * + * Helper class, which stores a single command for a VENDORCONFIG. + * @lib nsmldmalwaysonadapter + * @since S60 v3.2 + */ + +class CSmlDmAOCommandElement : public CBase + { + +public: + + static CSmlDmAOCommandElement* NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ); + + ~CSmlDmAOCommandElement(); + + /** + * Returns the iExecuted member value of the object + * + * @since S60 v3.2 + * @return The iExecuted member value of the object + */ + inline TBool Executed(); + + /** + * Sets the iExecuted member value of the object + * + * @since S60 v3.2 + * @param aExecuted Executed value for the object. + */ + inline void SetExecuted( TBool aExecuted ); + + /** + * Returns the iStatus member value of the object + * + * @since S60 v3.2 + * @return The iStatus value of the object + */ + inline CSmlDmAdapter::TError Status(); + + /** + * Sets the iStatus member value of the object + * + * @since S60 v3.2 + * @param aStatus Status value for the object. + */ + inline void SetStatus( CSmlDmAdapter::TError aStatus ); + + /** + * Returns the iLeaf member value of the object + * + * @since S60 v3.2 + * @return The iLeaf member value of the object + */ + inline TBool Leaf(); + + /** + * Returns the iStatusRef member value of the object + * + * @since S60 v3.2 + * @return The iStatusRef member value of the object + */ + inline TInt StatusRef(); + + /** + * Returns the iResultRef member value of the object + * + * @since S60 v3.2 + * @return The iResultRef member value of the object + */ + inline TInt ResultRef(); + + /** + * Returns the iCmdType member value of the object + * + * @since S60 v3.2 + * @return The iCmdType member value of the object + */ + inline CNSmlDmAOAdapter::TCommandType CmdType(); + + /** + * Returns the iData member value of the object + * + * @since S60 v3.2 + * @return The iData member value of the object + */ + inline const HBufC8* Data(); + + /** + * Returns the iLastUriSeg member value of the object + * + * @since S60 v3.2 + * @return The iLastUriSeg member value of the object + */ + inline const HBufC8* LastUriSeg(); + + /** + * Sets the iData member value of the object + * + * @since S60 v3.2 + * @param aData Data set to the object. The data will be owned by + * the command object. + */ + inline void SetData( HBufC8* aData ); + +private: + + CSmlDmAOCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType ); + + void ConstructL( const TDesC8& aLastUriSeg, const TDesC8& aData ); + + +private: //data + + /** + * Has command been executed. + * Set to ETrue when command is executed. + */ + TBool iExecuted; + + /** + * The execution status of an exeuted command. + * Filled in when command is executed. + */ + CSmlDmAdapter::TError iStatus; + + + /** + * True if commend is for a leaf node, False if it is for a NAPDEF node. + */ + const TBool iLeaf; + + /** + * Reference for returning the status to DM framework. + */ + const TInt iStatusRef; + + /** + * Reference for returning result of Get command to the DM framework. + */ + const TInt iResultRef; + + /** + * Type of command. + */ + const CNSmlDmAOAdapter::TCommandType iCmdType; + + + /** + * Data which is either ment to be stored to setting store + * or which has been fetched from there. + */ + HBufC8* iData; + + /** + * Last segment in the command URI, which indicates the leaf node + * in question. For non leaf command empty string. + */ + HBufC8* iLastUriSeg; + + }; + +#include "nsmldmalwaysonadapter.inl" + +#endif // NSMLDMALWAYSONADAPTER_H diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.inl Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,119 @@ +/* +* 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 "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 implementations of inline functions. +* +*/ + + +// ----------------------------------------------------------------------------- +// Returns the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmAOCommandElement::Executed() + { + return iExecuted; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatus member of the object +// ----------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CSmlDmAOCommandElement::Status() + { + return iStatus; + } + +// ----------------------------------------------------------------------------- +// Returns the iLeaf member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmAOCommandElement::Leaf() + { + return iLeaf; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatusRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmAOCommandElement::StatusRef() + { + return iStatusRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iResultRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmAOCommandElement::ResultRef() + { + return iResultRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iCmdType member of the object +// ----------------------------------------------------------------------------- +// +CNSmlDmAOAdapter::TCommandType CSmlDmAOCommandElement::CmdType() + { + return iCmdType; + } + +// ----------------------------------------------------------------------------- +// Returns the iData member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmAOCommandElement::Data() + { + return iData; + } + +// ----------------------------------------------------------------------------- +// Returns the iLastUriSeg member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmAOCommandElement::LastUriSeg() + { + return iLastUriSeg; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmAOCommandElement::SetExecuted( TBool aExecuted ) + { + iExecuted = aExecuted; + } + +// ----------------------------------------------------------------------------- +// Sets the iStatus member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmAOCommandElement::SetStatus( CSmlDmAdapter::TError aStatus ) + { + iStatus = aStatus; + } + + +// ----------------------------------------------------------------------------- +// Sets the iData member of the object. Ownership of aData argument will be +// transfered to the CSmlDmAOCommandElement +// ----------------------------------------------------------------------------- +// +void CSmlDmAOCommandElement::SetData( HBufC8* aData ) + { + iData = aData; + } + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonsettingstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonsettingstore.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,165 @@ +/* +* 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 "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: Manages always-on settings in Central Repository. +* +*/ + + +#ifndef NSMLDMALWAYSONSETTINGSTORE_H +#define NSMLDMALWAYSONSETTINGSTORE_H + +#include "nsmldmalwaysonadapter.h" + +#include + +const TInt KDefaultLuid = 1; + +class CNSmlDmAOAdapter; +class CSmlDmAOCommandElement; + +/** + * Setting Store is used for managing settings in CentralRepository + * + * The class provides functions for executing commands + * and sets of commands that involve manipulation of + * data in CentralRepository. + * + * @lib nsmldmalwaysonadapter + * @since S60 v3.2 + */ +class CNSmlDmAOSettingStore : public CBase + { + +public: + + static CNSmlDmAOSettingStore * NewL( CNSmlDmAOAdapter* aAdapter ); + + virtual ~CNSmlDmAOSettingStore(); + + /** + * Executes the argument command. + * + * @since S60 v3.2 + * @param aCmd Command to be executed + * @param aLUID LUID of the VENDORCONFIG which command is referring. + */ + void ExecuteCmdL( CSmlDmAOCommandElement& aCmd, TUint aLuid); + + /** + * Fetches all VENDORCONFIGs and inserts id of each VENDORCONFIG + * into the argument array (in practise there is only one VENDORCONFIG) + * + * @since S60 v3.2 + * @param aLUIDArray Array for VENDORCONFIG ids + */ + void GetVendorConfigsL( RArray& aLUIDArray ); + +private: + + CNSmlDmAOSettingStore( CNSmlDmAOAdapter * aAdapter ); + + void ConstructL(); + +//----------- Commands for managing leaf nodes -------------------// + + /** + * Executes VENDORCONFIG commands. The valid commands include + * get. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aLuid The id of the VENDORCONFIG + */ + void ExecuteVendorConfigCmdL( CSmlDmAOCommandElement& aCmd, TUint aLuid ); + + /** + * Executes NAME commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aCenrep Pointer to PdpContextManager2 repository + */ + void ExecuteNameCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ); + + + /** + * Executes AWON-PDPC commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aCenrep Pointer to PdpContextManager2 repository + */ + void ExecuteAwonPdpcCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ); + + + /** + * Executes T-RETRY commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aCenrep Pointer to PdpContextManager2 repository + */ + void ExecuteTRetryCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ); + + /** + * Parses integer from descriptor + * + * @param aPtr Descriptor containing value + * @param aInt Value as integer + */ + void ParseIntegerL( const TDesC& aPtr, TInt& aInt ); + + /** + * Parses settings for home network and visited network + * + * @param aInt Interger containing home & visited network setting + * @param aHplmn "1" when always-on enabled in hplmn, otherwise "0" + * @param aVplmn "1" when always-on enabled in vplmn, otherwise "0" + */ + void ParseAwonPdpcValuesL( const TInt aInt, TInt& aHplmn, TInt& aVplmn ); + +private: //data + + /** + * Pointer to the adapter. This is used for + * querying data from DM framework when necessary + * and using helper functions. Not own. + */ + CNSmlDmAOAdapter* iAdapter; + + }; + + +#endif // NSMLDMALWAYSONSETTINGSTORE_H diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/rom/nsmldmalwaysonadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/rom/nsmldmalwaysonadapter.iby Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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 "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: Image description file for project nsmldmalwaysonadapter +* +*/ + + +#ifndef NSMLDMALWAYSONADAPTER_IBY +#define NSMLDMALWAYSONADAPTER_IBY + +#include + +#ifdef __ALWAYS_ONLINE_PDPCONTEXT2 +#ifdef __SYNCML_DM + +ECOM_PLUGIN( nsmldmalwaysonadapter.dll, nsmldmalwaysonadapter.rsc ) + +#endif // __SYNCML_DM +#endif // __ALWAYS_ONLINE_PDPCONTEXT2 + +#endif // NSMLDMALWAYSONADAPTER_IBY diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,647 @@ +/* +* 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 "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: Provides handling of Always-on settings in Device management. +* +*/ + + +#include + +#include "nsmldmalwaysonadapter.h" +#include "logger.h" + +// ======== MEMBER FUNCTIONS ======== + + +// -------------------------------------------------------------------------- +// Maps plugin UID to its factory function (constructor) +// -------------------------------------------------------------------------- +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101f6d36, + CNSmlDmAOAdapter::NewL) + }; + +// -------------------------------------------------------------------------- +// For ecom plugin implementation +// ------------------------------------------------------------------------- + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::NewL +// -------------------------------------------------------------------------- +CNSmlDmAOAdapter* CNSmlDmAOAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + LOGSTRING("CNSmlDmAOAdapter::NewL: Start"); + + CNSmlDmAOAdapter* self = new (ELeave) CNSmlDmAOAdapter( aDmCallback ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGSTRING("CNSmlDmAOAdapter::NewL: End"); + return self; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CNSmlDmAOAdapter +// -------------------------------------------------------------------------- + +CNSmlDmAOAdapter::CNSmlDmAOAdapter( MSmlDmCallback* aDmCallback ) + : CSmlDmAdapter( aDmCallback ) + { + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::ConstructL +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::ConstructL() + { + LOGSTRING( "CNSmlDmAOAdapter::CNSmlDmAOAdapter: Start" ); + + iSettingStore = CNSmlDmAOSettingStore::NewL( this ); + + LOGSTRING( "CNSmlDmAOAdapter::CNSmlDmAOAdapter: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::~CNSmlDmAOAdapter +// -------------------------------------------------------------------------- +CNSmlDmAOAdapter::~CNSmlDmAOAdapter() + { + LOGSTRING( "CNSmlDmAOAdapter::~CNSmlDmAOAdapter: Start" ); + + //iBuffer.ResetAndDestroy(); + //iBuffer.Close(); + delete iSettingStore; + + LOGSTRING( "CNSmlDmAOAdapter::~CNSmlDmAOAdapter: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DDFVersionL +// Returns ddf version nr +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + LOGSTRING( "CNSmlDmAOAdapter::DDFVersionL: Start" ); + + aDDFVersion.InsertL( 0, KNSmlDmAOAdapterDDFVersion ); + + LOGSTRING( "CNSmlDmAOAdapter::DDFVersionL:End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DDFStructureL +// Constructs the DDF structure +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + LOGSTRING( "CNSmlDmAOAdapter::DDFStructureL: Start" ); + TSmlDmAccessTypes accessTypes; + + // VENDORCONFIG + MSmlDmDDFObject& ao = aDDF.AddChildObjectL( KNSmlDmAOAdapterAO ); + + accessTypes.SetGet(); + + ao.SetAccessTypesL( accessTypes ); + ao.SetOccurenceL( MSmlDmDDFObject::EOne ); + ao.SetScopeL( MSmlDmDDFObject::EPermanent ); + ao.SetDFFormatL( MSmlDmDDFObject::ENode ); + ao.AddDFTypeMimeTypeL( KNSmlDmAOAdapterTextPlain ); + ao.SetDescriptionL( KNSmlDmAOAdapterAODescription ); + accessTypes.Reset(); + + // VENDORCONFIG/Name + MSmlDmDDFObject& name = ao.AddChildObjectL( KNSmlDmAOAdapterName ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + accessTypes.SetAdd(); + + name.SetAccessTypesL( accessTypes ); + name.SetOccurenceL( MSmlDmDDFObject::EOne ); + name.SetScopeL( MSmlDmDDFObject::EDynamic ); + name.SetDFFormatL( MSmlDmDDFObject::EChr ); + name.SetDescriptionL( KNSmlDmAOAdapterNameDescription ); + accessTypes.Reset(); + + // VENDORCONFIG/AWON-PDPC + MSmlDmDDFObject& awonPdpc = + ao.AddChildObjectL( KNSmlDmAOAdapterAwonPdpc ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + accessTypes.SetAdd(); + + awonPdpc.SetAccessTypesL( accessTypes ); + awonPdpc.SetOccurenceL( MSmlDmDDFObject::EOne ); + awonPdpc.SetScopeL( MSmlDmDDFObject::EDynamic ); + awonPdpc.SetDFFormatL( MSmlDmDDFObject::EChr ); + awonPdpc.SetDescriptionL( KNSmlDmAOAdapterAwonPdpcDescription ); + accessTypes.Reset(); + + // VENDORCONFIG/T-RETRY + MSmlDmDDFObject& tRetry = + ao.AddChildObjectL( KNSmlDmAOAdapterTRetry ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + accessTypes.SetAdd(); + + tRetry.SetAccessTypesL( accessTypes ); + tRetry.SetOccurenceL( MSmlDmDDFObject::EOne ); + tRetry.SetScopeL( MSmlDmDDFObject::EDynamic ); + tRetry.SetDFFormatL( MSmlDmDDFObject::EChr ); + tRetry.SetDescriptionL( KNSmlDmAOAdapterTRetryDescription ); + accessTypes.Reset(); + + LOGSTRING( "CNSmlDmAOAdapter::DDFStructureL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::UpdateLeafObjectL +// Adds or updates leaf node value. +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: Start" ); + LOGSTRING4( "\tUpdateLeafObjectL \tURI: %S, \n\tLUID: %S,\ + \tobject: %S ", + &aURI, &aLUID, &aObject ); + + // execute command and return status + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmAOInvalidRef, + CNSmlDmAOAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + + LOGSTRING2( "\tCmd executed with status: %d", + cmd->Status() ); + Callback().SetStatusL( aStatusRef, cmd->Status() ); + CleanupStack::PopAndDestroy( cmd ); + + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: End" ); + } +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DeleteObjectL +// Not supported +// -------------------------------------------------------------------------- + +void CNSmlDmAOAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::DeleteObjectL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::DeleteObjectL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::FetchLeafObjectL +// Fetches leaf object value. +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aType*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + LOGSTRING( "NSmlDmAOAdapter::FetchLeafObjectL: Start" ); + LOGSTRING3( "\tFetchLeafObjectL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ); + + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmAOAdapter::EGetCmd, + LastURISeg( aURI ), + KNullDesC8); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + LOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ); + + // if executed return status + if ( cmd->Executed() ) + { + Callback().SetStatusL( aStatusRef, cmd->Status() ); + // if successful set results + if ( cmd->Status() == CSmlDmAdapter::EOk ) + { + LOGSTRING2( "\tCmd executed with result: %S ", + cmd->Data() ); + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, *result, KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + // failed to execute command + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + CleanupStack::PopAndDestroy( cmd ); + + + LOGSTRING( "NSmlDmAOAdapter::FetchLeafObjectL: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::FetchLeafObjectSizeL +// Fetches leaf object size. +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /* aType */, + TInt aResultsRef, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::FetchLeafObjectSizeL: Start" ); + LOGSTRING3( "\tFetchLeafObjectSizeL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ); + + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmAOAdapter::EGetSizeCmd, + LastURISeg( aURI ), + KNullDesC8); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + + LOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ); + // if executed get status + if ( cmd->Executed() ) + { + Callback().SetStatusL( aStatusRef, cmd->Status() ); + // if successful get results + if ( cmd->Status() == CSmlDmAdapter::EOk ) + { + LOGSTRING2( "\tCmd executed with result: %S ", + cmd->Data() ); + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, *result, KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + // failed to execute command + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + CleanupStack::PopAndDestroy( cmd ); + + LOGSTRING( "CNSmlDmAOAdapter::FetchLeafObjectSizeL: End" ); + } + +// ------------------------------------------------------------------------ +// CNSmlDmAOAdapter::ChildURIListL +// Fetches child nodes of a node. these may be either all VENDORCONFIG +// nodes or leaf nodes under a VENDORCONFIG node. +// ------------------------------------------------------------------------ +void CNSmlDmAOAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& + /*aPreviousURISegmentList*/, + TInt aResultsRef, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::ChildURIListL: Start" ); + LOGSTRING3( "\tChildURIListL URI: %S, LUID: %S ", + &aURI, &aLUID ); + + CBufBase* resultList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( resultList ); + + // get all leaf nodes below VENDORCONFIG node + if ( !aURI.Compare( KNSmlDmAOAdapterAO ) ) + { + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( EFalse, + aStatusRef, + aResultsRef, + CNSmlDmAOAdapter::EGetCmd, + KNullDesC8, + KNullDesC8 ); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + + LOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ); + + Callback().SetStatusL( aStatusRef, cmd->Status() ); + if( cmd->Status() == CSmlDmAdapter::EOk ) + { + resultList->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, + *resultList, + KNullDesC8 ); + } + + CleanupStack::PopAndDestroy( cmd ); + } + + CleanupStack::PopAndDestroy( resultList ); + LOGSTRING( "CNSmlDmAOAdapter::ChildURIListL: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::AddNodeObjectL +// Not supported +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::AddNodeObjectL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::AddNodeObjectL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::UpdateLeafObjectL +// Not supported from stream +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: End" ); + } + + + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + const TDesC8& /* aArgument */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: End" ); + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: Start" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CopyCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::CopyCommandL( const TDesC8& /* aTargetURI */ , + const TDesC8& /* aTargetLUID */ , + const TDesC8& /* aSourceURI */ , + const TDesC8& /* aSourceLUID */, + const TDesC8& /* aType */ , + TInt aStatusRef ) + { + //not supported + LOGSTRING( "CNSmlDmAOAdapter::CopyCommandL: Sart" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + LOGSTRING( "CNSmlDmAOAdapter::CopyCommandL: End" ); + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::StartAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::StartAtomicL() + { + LOGSTRING( "CNSmlDmAOAdapter::StartAtomicL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::StartAtomicL: End" ); + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CommitAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::CommitAtomicL() + { + LOGSTRING( "CNSmlDmAOAdapter::CommitAtomicL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::CommitAtomicL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::RollbackAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::RollbackAtomicL() + { + LOGSTRING( "CNSmlDmAOAdapter::RollbackAtomicL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::RollbackAtomicL: End" ); + } + +TBool CNSmlDmAOAdapter::StreamingSupport( TInt& /* aItemSize */ ) + { + LOGSTRING( "CNSmlDmAOAdapter::StreamingSupport: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::StreamingSupport: End" ); + return EFalse; + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::StreamCommittedL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::StreamCommittedL() + { + LOGSTRING( "CNSmlDmAOAdapter::StreamCommittedL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::StreamCommittedL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CompleteOutstandingCmdsL +// Buffering not needed because nodes can't be added +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::CompleteOutstandingCmdsL() + { + LOGSTRING( "CNSmlDmAOAdapter::CompleteOutstandingCmdsL: Start"); + LOGSTRING( "CNSmlDmAOAdapter::CompleteOutstandingCmdsL: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::IntToDes8L +// Converts integer to 8bit descriptor +// -------------------------------------------------------------------------- +HBufC8* CNSmlDmAOAdapter::IntToDes8L( TInt aLuid ) const + { + HBufC8* buf = HBufC8::NewL( 10 ); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num( aLuid ); + return buf; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DesToIntL +// Converts 8bit descriptor to int +// -------------------------------------------------------------------------- +TUint CNSmlDmAOAdapter::DesToIntL( const TDesC8& aLuid ) const + { + TLex8 lex( aLuid ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value ) ); + return value; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::LastURISeg +// Returns the last uri segemnt of a uri. +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmAOAdapter::LastURISeg( const TDesC8& aURI ) const + { + TInt i; + for ( i=aURI.Length()-1; i >= 0; i-- ) + { + if ( aURI[i]=='/' ) + { + break; + } + } + + if ( i==0 ) + { + return aURI; + } + else + { + return aURI.Mid( i + 1 ); + } + } + + +//---------------------- CSmlDmAOCommandElement -------------------------// + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement* CSmlDmAOCommandElement::NewLC +// -------------------------------------------------------------------------- + +CSmlDmAOCommandElement* CSmlDmAOCommandElement::NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + CSmlDmAOCommandElement* self = new (ELeave) CSmlDmAOCommandElement( aLeaf, + aStatusRef, + aResultRef, + aCmdType ); + CleanupStack::PushL(self); + self->ConstructL( aLastUriSeg, aData ); + return self; + } + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement::~CSmlDmAOCommandElement +// -------------------------------------------------------------------------- +CSmlDmAOCommandElement::~CSmlDmAOCommandElement() + { + delete iLastUriSeg; + delete iData; + } + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement::CSmlDmAOCommandElement +// -------------------------------------------------------------------------- +CSmlDmAOCommandElement::CSmlDmAOCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType ) + : iStatus( CSmlDmAdapter::EError ), + iLeaf( aLeaf ), + iStatusRef( aStatusRef ), + iResultRef( aResultRef ), + iCmdType( aCmdType ), + iData( NULL ) + + { + } + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement::ConstructL +// -------------------------------------------------------------------------- +void CSmlDmAOCommandElement::ConstructL( const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + iLastUriSeg = aLastUriSeg.AllocL(); + iData = aData.AllocL(); + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.rss Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* 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 "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: Resource definitions for project nsmldmalwaysonadapter +* +*/ + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101f6d36; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; //DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101f6d36; // adapter implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmalwaysonadapter/src/nsmldmalwaysonsettingstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmalwaysonadapter/src/nsmldmalwaysonsettingstore.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,396 @@ +/* +* 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 "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: Provides settings management in Central Repository. +* +*/ + + + +#include +#include + +#include "nsmldmalwaysonsettingstore.h" +#include "nsmldmalwaysonadapter.h" +#include "logger.h" + +// AWON-PDPC +// Values are XY, where X is related to 3G flag and Y is related to 2G flag. +// Possible values are: +// "00", AlwaysOn is OFF for both 3G and 2G +// "10", AlwaysOn is ON for 3G, OFF for 2G +// "01", AlwaysOn is OFF for 3G, ON for 2G +// "11", AlwaysOn is ON for 3G, ON for 2G +const TInt KAwonPdpc_Off3G_Off2G = 00; +const TInt KAwonPdpc_Off3G_On2G = 01; +const TInt KAwonPdpc_On3G_Off2G = 10; +const TInt KAwonPdpc_On3G_On2G = 11; + +const TInt KBufSize = 10; + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::NewL +// ----------------------------------------------------------------------------- +CNSmlDmAOSettingStore* CNSmlDmAOSettingStore::NewL( CNSmlDmAOAdapter * aAdapter ) + { + CNSmlDmAOSettingStore* self = new (ELeave) CNSmlDmAOSettingStore( aAdapter ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::CNSmlDmAOSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmAOSettingStore::CNSmlDmAOSettingStore( CNSmlDmAOAdapter * aAdapter ) + : iAdapter( aAdapter ) + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ConstructL +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::~CNSmlDmAOSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmAOSettingStore::~CNSmlDmAOSettingStore() + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteCmdL +// Executes a single command +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::ExecuteCmdL( CSmlDmAOCommandElement& aCmd, TUint aLuid) + { + if( !aCmd.Leaf() ) + { + ExecuteVendorConfigCmdL( aCmd, aLuid ); + } + else + { + CRepository* cenrep = CRepository::NewL( KCRUidPDPContextManager ); + CleanupStack::PushL( cenrep ); + + // name + if ( !aCmd.LastUriSeg()->Compare( KNSmlDmAOAdapterName ) ) + { + ExecuteNameCmdL( aCmd, cenrep ); + } + // awon-pdpc + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmAOAdapterAwonPdpc ) ) + { + ExecuteAwonPdpcCmdL( aCmd, cenrep ); + } + // t-retry + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmAOAdapterTRetry ) ) + { + ExecuteTRetryCmdL( aCmd, cenrep ); + } + else + { + // invalid node + LOGSTRING( "ExecuteCmdL: Error, Invalid node name" ); + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + } + + aCmd.SetExecuted( ETrue ); + + CleanupStack::PopAndDestroy( cenrep ); + } + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::GetVendorConfigsL +// Fetches all VENDORCONFIG ids +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::GetVendorConfigsL( RArray& aLUIDArray ) + { + // Only one VENDORCONFIG node possible at the moment + aLUIDArray.Append( KDefaultLuid ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteVendorConfigCmdL +// Executes a command for VENDORCONFIG node. Either delete or get, adds are handled +// in StoreVendorConfigL +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::ExecuteVendorConfigCmdL( CSmlDmAOCommandElement& aCmd, + TUint /*aLuid*/ ) + { + + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd ) + { + aCmd.SetData( KNSmlDmAOAllLeafNodes().AllocL() ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EDeleteCmd ) + { + // Should not be possible to delete + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + LOGSTRING( "ExecuteVendorConfigCmdL: Error, Invalid cmd type" ); + aCmd.SetStatus( CSmlDmAdapter::EError ); + } + } + + +// --------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteNameCmdL +// Executes NAME command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ExecuteNameCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* /*aCenrep*/ ) + { + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EAddCmd ) + { + HBufC* name = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr namePtr = name->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, *aCmd.Data() ); + + // name is not written to the CentralRepository + // Add write to CR here + + CleanupStack::PopAndDestroy( name ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + // name is not written/read to/from the CentralRepository + // Add read from CR here + + //HBufC* data = ...read name + + //HBufC8* data8 = HBufC8::NewLC( data->Size() ); + //TPtr8 toPtr = data8->Des(); + //CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + //aCmd.SetData( data8 ); + //CleanupStack::Pop( data8 ); + //CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + + //if( aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + // { + // HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + // aCmd.SetData( size ); + // } + + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + LOGSTRING( "ExecuteNameCmdL: Error, Only Add, Get and Get size commands supported" ); + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteAwonPdpcCmdL +// Executes AWON-PDPC command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ExecuteAwonPdpcCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ) + { + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EAddCmd ) + { + HBufC* data = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr dataPtr = data->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( dataPtr, *aCmd.Data() ); + + // write to the CentralRepository + TInt value( 0 ); + TInt hplmn( 0 ); + TInt vplmn( 0 ); + + ParseIntegerL( dataPtr, value ); + ParseAwonPdpcValuesL( value, hplmn, vplmn ); + + User::LeaveIfError( aCenrep->Set( KPDPContextManagerEnableWhenHome, + hplmn ) ); + User::LeaveIfError( aCenrep->Set( KPDPContextManagerEnableWhenRoaming, + vplmn ) ); + + CleanupStack::PopAndDestroy( data ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + // read from CentralRepository + TInt hplmn( 0 ); + TInt vplmn( 0 ); + + User::LeaveIfError( + aCenrep->Get( KPDPContextManagerEnableWhenHome, hplmn ) ); + User::LeaveIfError( + aCenrep->Get( KPDPContextManagerEnableWhenRoaming, vplmn ) ); + + HBufC* data = HBufC::NewLC( KBufSize ); + TPtr dataPtr = data->Des(); + + dataPtr.Zero(); + dataPtr.FillZ(); + dataPtr.AppendNum( hplmn ); + dataPtr.AppendNum( vplmn ); + + HBufC8* data8 = HBufC8::NewLC( data->Size() ); + TPtr8 toPtr = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + aCmd.SetData( data8 ); + CleanupStack::Pop( data8 ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + aCmd.SetData( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + LOGSTRING( "ExecuteNameCmdL: Error, Only Add, Get and Get size commands supported" ); + } + } + + // --------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteTRetryCmdL +// Executes T-RETRY command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ExecuteTRetryCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ) + { + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EAddCmd ) + { + HBufC* data = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr dataPtr = data->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( dataPtr, *aCmd.Data() ); + + // write to the CentralRepository + TInt value( 0 ); + ParseIntegerL( dataPtr, value ); + + User::LeaveIfError( aCenrep->Set( KPDPContextManagerRetryTimer, + value ) ); + + CleanupStack::PopAndDestroy( data ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + // Read from CentralRepository + TInt value( 0 ); + User::LeaveIfError( aCenrep->Get( KPDPContextManagerRetryTimer, + value ) ); + + HBufC* data = HBufC::NewLC( KBufSize ); + TPtr dataPtr = data->Des(); + + dataPtr.Zero(); + dataPtr.FillZ(); + dataPtr.AppendNum( value ); + + HBufC8* data8 = HBufC8::NewLC( data->Size() ); + TPtr8 toPtr = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + aCmd.SetData( data8 ); + CleanupStack::Pop( data8 ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + aCmd.SetData( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + LOGSTRING( "ExecuteNameCmdL: Error, Only Add, Get and Get size commands supported" ); + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ParseIntegerL +// ----------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ParseIntegerL( const TDesC& aPtr, TInt& aInt ) + { + TLex lex( aPtr ); + User::LeaveIfError( lex.Val( aInt ) ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ParseAwonPdpcValuesL +// ----------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ParseAwonPdpcValuesL( const TInt aInt, + TInt& aHplmn, + TInt& aVplmn ) + { + switch( aInt ) + { + case KAwonPdpc_Off3G_Off2G: + aHplmn = 0; + aVplmn = 0; + break; + case KAwonPdpc_Off3G_On2G: + aHplmn = 0; + aVplmn = 1; + break; + case KAwonPdpc_On3G_Off2G: + aHplmn = 1; + aVplmn = 0; + break; + case KAwonPdpc_On3G_On2G: + aHplmn = 1; + aVplmn = 1; + break; + default: + User::Leave( KErrNotSupported ); + break; + } + } + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/group/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project nsmldmbmadapter +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +nsmldmbmadapter.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/group/nsmldmbmadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/group/nsmldmbmadapter.mmp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,45 @@ +/* +* 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 "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 nsmldmbmadapter +* +*/ + + +#include +#include + +TARGET nsmldmbmadapter.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x101f6d2f + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE nsmldmbmadapter.cpp +SOURCE nsmldmbmsettingstore.cpp + +START RESOURCE nsmldmbmadapter.rss +END + +//LANG sc + +USERINCLUDE ../inc + +//Default system include paths for middleware layer modules +MW_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib ecom.lib cmmanagerdatabase.lib cmmanager.lib charconv.lib flogger.lib diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/inc/bmadapterlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/inc/bmadapterlogger.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,103 @@ +/* +* 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 "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: Logging functions for the component. +* +*/ + + + +#ifndef BMADAPTERLOGGER_H +#define BMADAPTERLOGGER_H + +#ifndef _DEBUG + +// UREL BUILD: +#define BMADAPTER_LOGGING_METHOD 0 // No logging in UREL builds + +#else + +// UDEB BUILD: +#define BMADAPTER_LOGGING_METHOD 1 // 0 = No logging, + // 1 = Flogger, + // 2 = RDebug +#endif // _DEBUG + + +#if BMADAPTER_LOGGING_METHOD == 1 // Flogger + +#include +_LIT(KBMADAPTERLOGFolder,"NSMLDMBMADAPTER"); +_LIT(KBMADAPTERLOGFile,"NSMLDMBMADAPTER.txt"); + +#define BMADAPTERLOGTEXT(x)\ + {\ + RFileLogger::Write(KBMADAPTERLOGFolder(),KBMADAPTERLOGFile(),EFileLoggingModeAppend,\ + x);\ + } + +#define BMADAPTERLOGSTRING(x)\ + {\ + _LIT8(tempLogDes,x);\ + RFileLogger::Write(KBMADAPTERLOGFolder(),KBMADAPTERLOGFile(),EFileLoggingModeAppend,\ + tempLogDes());\ + } + +#define BMADAPTERLOGSTRING2(x,y)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KBMADAPTERLOGFolder(),\ + KBMADAPTERLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y);\ + } + +#define BMADAPTERLOGSTRING3(x,y,z)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KBMADAPTERLOGFolder(),\ + KBMADAPTERLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y,z);\ + } + +#define BMADAPTERLOGSTRING4(w,x,y,z)\ + { _LIT8(tempLogDes,w);\ + RFileLogger::WriteFormat(KBMADAPTERLOGFolder(),\ + KBMADAPTERLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),x,y,z);\ + } + + +#elif BMADAPTER_LOGGING_METHOD == 2 // RDebug + +#include + +#define BMADAPTERLOGSTRING(x) RDebug::Print(x); +#define BMADAPTERLOGSTRING(x) RDebug::Print(_L(x)); +#define BMADAPTERLOGSTRING2(x,y) RDebug::Print(_L(x),y); +#define BMADAPTERLOGSTRING3(x,y,z) RDebug::Print(_L(x),y,z); +#define BMADAPTERLOGSTRING4(w,x,y,z) RDebug::Print(_L(w),x,y,z); + +#else // BMADAPTER_LOGGING_METHOD == 0 or invalid + +#define BMADAPTERLOGSTRING(x) +#define BMADAPTERLOGSTRING(x) +#define BMADAPTERLOGSTRING2(x,y) +#define BMADAPTERLOGSTRING3(x,y,z) +#define BMADAPTERLOGSTRING4(w,x,y,z) + +#endif // BMADAPTER_LOGGING_METHOD + +#endif // BMADAPTERLOGGER_H + +// End of File diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/inc/nsmldmbmadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/inc/nsmldmbmadapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,887 @@ +/* +* 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 "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: Device management adapter handling bearer management related settings +* +*/ + + + + +#ifndef NSMLDMBMADAPTER_H +#define NSMLDMBMADAPTER_H + +#include + +#include "nsmldmbmsettingstore.h" + +class CSmlDmBmCommandElement; +class CSmlDmBmSettingsElement; +class CNSmlDmBmSettingStore; + +/** The DDF version must be changed if any changes in DDF structure +( built in DDFStructureL() function ) */ +_LIT8( KNSmlDmBMAdapterDDFVersion, "1.1" ); +_LIT8( KNSmlDmBMAdapterTextPlain, "text/plain" ); + +/** Names of the nodes */ +/** When updating KNSmlDmBMAdapterBMURI also update +KNSmlDmBmAdapterURIMaxLength! */ +_LIT8(KNSmlDmBMAdapterBMURI, "./BearerManagementSNAP"); +_LIT8(KNSmlDmBMAdapterBM, "BearerManagementSNAP"); +_LIT8(KNSmlDmBMAdapterName, "Name"); +_LIT8(KNSmlDmBMAdapterIAPPriorityList, "IAPPriorityList"); +_LIT8(KNSmlDmBMAdapterEmbeddedSNAP, "EmbeddedSNAP"); +_LIT8(KNSmlDmBMAdapterMetadata, "Metadata"); +_LIT8(KNSmlDmBMAdapterProtected, "Protected"); +_LIT8(KNSmlDmBMAdapterHidden, "Hidden"); + +/** Descriptions of the nodes */ +_LIT8( KNSmlDmBMAdapterBMDescription, + "BearerManagement provides management of Access Point groups (SNAPs)"); +_LIT8( KNSmlDmBMAdapterDynamicDescription, + "Node presents a group of Access Points (SNAP)"); +_LIT8( KNSmlDmBMAdapterNameDescription, + "Name of the Access Point group"); +_LIT8( KNSmlDmBMAdapterIAPPriorityListDescription, + "Comma separated list of Access Point URIs in priority order."); +_LIT8( KNSmlDmBMAdapterEmbeddedSNAPDescription, + "URI of embedded Access Point group. All Access points of the Embedded \ + SNAP are seen as also belonging to this SNAP"); +_LIT8( KNSmlDmBMAdapterMetadataDescription, + "32 bit integer representing SNAP metadata. Following bitmasks indicate \ + meaning of the individual bits: \n 0x00000001 \t Internet: The SNAP is \ + the Internet SNAP. This may only be set to one SNAP object.\n \ + 0x00000002\tHighlight: SNAP is highlighted in certain UI dialog.\n \ + 0x00000004\tHidden: SNAP is hidden in certain UI dialog."); +_LIT8( KNSmlDmBMAdapterProtectedDescription, + "SNAP is protected with one of the following protection levels. \ + Protected object can not be modified without NetworkControl capability \n \ + 0 \t No protection \n 1 \t SNAP and related objects \n \ + 2 \t SNAP name is protected."); +_LIT8( KNSmlDmBMAdapterHiddenDescription, + "SNAP is set as hidden in the setting store"); + +/** Leaf nodes of snap node */ +_LIT8( KNSmlDmBMAllLeafNodes, + "Name/IAPPriorityList/Metadata/Protected/Hidden/EmbeddedSNAP"); +_LIT8( KNSmlDmBMAllLeafNodesNoEmbedded, + "Name/IAPPriorityList/Metadata/Protected/Hidden"); + +/** URI of for fetching IAP nodes */ +/** When updating KNSmlDmBMAdapterIAPURI also update +KNSmlDmBmAdapterAPURIMaxLength! */ +_LIT8( KNSmlDmBMAdapterIAPURI, "./AP" ); +/** Node name of AP adapter root */ +_LIT8( KNSmlDmBMAdapterIAPNode, "AP" ); +/** URI segment separator */ +/** When updating this literal also update +KNSmlDmBmAdapterAPURIMaxLength and KNSmlDmBmAdapterURIMaxLength! */ +_LIT8( KNSmlDmBmSeparator, "/" ); +/** URI segment separator */ +/** When updating KNSmlDmBMAdapterBMURI also update +KNSmlDmBmAdapterAPURIMaxLength and KNSmlDmBmAdapterURIMaxLength! */ +_LIT8( KNSmlDmBmUriListSeparator, "," ); +/** Prefix in URIs (removed for LUID mapping) */ +_LIT8( KNSmlDmBmAdapterURIPrefix, "./" ); + +/** Name prefix for unnamed snap nodes */ +_LIT8( KNSmlDmBMSNAPNamePrefix, "SNAP" ); +_LIT8( KNSmlDmBMBooleanTrue, "True" ); +_LIT8( KNSmlDmBMBooleanFalse, "False" ); + + +const TInt KNSmlDmBMGranularity = 4; +const TInt KNsmlDmBmSNAPNodeDepth = 2; +const TInt KNSmlDmBmInvalidRef = -1; + +/** Maximum length of snap URI including a separator character in URI List. +Node is not calculated here. KNSmlDmBMAdapterBMURI + KNSmlDmBmSeparator + +KNSmlDmBmUriListSeparator +*/ +const TInt KNSmlDmBmAdapterURIMaxLength = 24; + +/** Maximum length of AP URI including a separator character in URI List. +Node is not calculated here. KNSmlDmBMAdapterIAPURI + KNSmlDmBmSeparator + +KNSmlDmBmUriListSeparator +*/ +const TInt KNSmlDmBmAdapterAPURIMaxLength = 6; + +/** Maximum length of 32bit integer */ +const TInt KMaxLengthOf32bitInteger = 10; + +/** + * Bearer Management device management adapter + * + * Bearer Management device management adapter manages settings + * related to Service Network Access Points (SNAPs) which are + * used for groupin IAPs + * + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ +class CNSmlDmBmAdapter : public CSmlDmAdapter + { + +public: + +/** Possible command types */ +enum TCommandType + { + EAddCmd, + EGetCmd, + EGetSizeCmd, + EDeleteCmd + }; + + /** + * Two-phased constructor. + */ + static CNSmlDmBmAdapter* NewL( MSmlDmCallback* aDmCallback ); + + /** + * Destructor. + */ + virtual ~CNSmlDmBmAdapter(); + + +// from base class CSmlDmAdapter + + /** + * The function returns current version of the DDF. + * + * @since S60 v3.2 + * @param aDDFVersion DDF version of the + * adapter. (filled by the adapter) + */ + void DDFVersionL( CBufBase& aDDFVersion ); + + /** + * The function for filling the DDF structure of the adapter + * + * @since S60 v3.2 + * @param aDDF Reference to root object. + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * The function creates new leaf objects, or replaces data in existing + * leaf objects. The information about the success of the command is + * returned by calling SetStatusL function of MSmlDmCallback callback + * interface. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aObject Data of the object. + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this reference + * must be used when calling the SetStatusL of this + * command + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + /** + * The function deletes an object and its child objects. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter have earlier + * returned LUID to the DM Module). + * @param aStatusRef Reference to correct command, i.e. this reference + * must be used when calling the SetStatusL of this + * command. + */ + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef ); + + /** + * The function fetches data of a leaf object. The SetStatusL is used + * as described in UpdateLeafObjectL(). The data is returned by using the + * SetResultsL function of MSmlCallback callback interface. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter have + * earlier returned LUID to the DM Module). + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results, i.e. this + * reference must be used when returning the + * result by calling the SetResultsL. + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function fetches the size of the data of a leaf object. The size + * is in bytes, and must reflect the number of bytes that will be + * transferred when the framework calls FetchLeafObjectL. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter have + * earlier returned LUID to the DM Module). + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results, i.e. this + * reference must be used when returning the + * result by calling the SetResultsL. + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function fetches URI list. An adapter returns the list of URI + * segments under the given URI be separated by slash ("/"). The URI + * segment names for new objects must be given by the adapter. + * The list is returned by calling the SetResultsL function of + * MSmlCallback callback interface. + * + * @since S60 v3.2 + * @param aURI URI of the parent object + * @param aLUID LUID of the parent object (if the + * adapter have earlier returned LUID to + * the DM Module). + * @param aPreviousURISegmentList URI list with mapping LUID + * information, which is known by DM + * engine. + * @param aResultsRef Reference to correct results, i.e. + * this reference must be used when + * returning the result by calling the + * SetResultsL. + * @param aStatusRef Reference to correct command, i.e. + * this reference must be used when + * calling the SetStatusL of this + * command. + */ + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef ); + + /** + * The function adds node object. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aParentLUID LUID of the parent object (if the adapter have + * earlier returned LUID to the DM Module). + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + TInt aStatusRef ); + /** + * The adapter does not support streaming and no implementation is + * provided for this function. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Data of the object. + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this reference + * must be used when calling the SetStatusL of this + * command. + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support execute command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aURI URI of the command + * @param aLUID LUID of the object + * @param aArgument Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support execute command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aURI URI of the command + * @param aLUID LUID of the object + * @param aStream Argument for the command. + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support copy command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aTargetURI Target URI for the command + * @param aTargetLUID LUID of the target object + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object + * @param aType MIME type of the objects + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + /** + * Not supported + * @since S60 v3.2 + */ + void StartAtomicL(); + /** + * Not Supported + * @since S60 v3.2 + * + */ + void CommitAtomicL(); + /** + * Not supported. + * @since S60 v3.2 + */ + void RollbackAtomicL(); + /** + * Returns EFalse as the adapter does not support streaming + * + * @since S60 v3.2 + * @param aItemSize size limit for stream usage + * @return TBool EFalse as streaming is not supported + */ + TBool StreamingSupport( TInt& aItemSize ); + /** + * Not supported + * + * @since S60 v3.2 + */ + void StreamCommittedL(); + /** + * The function tells the adapter that all the commands of the message + * that can be passed to the adapter have now been passed. This + * indciates that the adapter must supply status codes and results to + * any buffered commands. This must be done at latest by the time this + * function returns. This function is used at the end of SyncML messages, + * and during processing of Atomic. + * + * @since S60 v3.2 + */ + void CompleteOutstandingCmdsL(); + + /** + * Function checks if a SNAP with the argument URI is buffered for + * later handling. If so, the function calls iSettingStore object + * to store the SNAP. This function is called by the iSettingStore + * object to check whether EmbeddedSNAP node referenced by a command is + * still in the buffer and needs to be stored first. + * + * @since S60 v3.2 + * @param aURI Descriptor containing the SNAP URI + */ + void StoreSnapIfBufferedL( const TDesC8& aURI ); + + + /** + * Function returns a pointer to a HBufC object containing a SNAP URI + * which correcponds to the argument LUID. + * + * @since S60 v3.2 + * @param aSnapId LUID of SNAP object + * @return Descriptor containing the SNAP URI. + */ + HBufC8* GetSnapUriFromLuidL( const TUint aSnapId ); + + + /** + * Function returns a pointer to HBufC object containing a + * comma separated list of IAP URIs according to the IAP LUIDs + * contained in the argument array. + * + * @since S60 v3.2 + * @param aIdArray Array of IAP LUIDs for which the URI list is formed. + * @return HBufC object containing a comma separated list of IAP URIs + */ + HBufC8* GetIapListL( const RArray& aIdArray ); + + + /** + * Function returns an array containing the LUIDs of IAP URIs listed in + * argument descriptor. + * + * @since S60 v3.2 + * @param aIAPList TDesC object containing a comma separated list of IAP + * URIs + * @return Array of IAP LUIDs that correspond to the argument URI list. + */ + RArray GetIdArrayL( const TDesC8& aIAPList); + + + /** + * Converts integer to 8bit descriptor + * + * @since S60 v3.2 + * @param aLuid The integer to be converted + * @return The Integer as a descriptor + */ + HBufC8* IntToDes8L( TInt aLuid) const; + + /** + * Converts 8bit descriptor to integer + * + * @since S60 v3.2 + * @param aLuid The descriptor to be converted + * @return Integer value of the descriptor + */ + TUint DesToIntL(const TDesC8& aLuid) const; + + /** + * Converts 8bit descriptor to a boolean value + * @since S60 v3.2 + * @param aBoolDes The descriptor to be converted + * @param aBool A pointer to a boolean where result is stored + * @return ETrue if conversion was succesful, otherwise EFalse + */ + TBool DesToBool(const TDesC8& aBoolDes, TBool& aBool ) const; + + /** + * Converts boolean value to 8bit descriptor + * @since S60 v3.2 + * @param aBool The boolean value to be converted + * @return The boolean value as a descriptor + */ + HBufC8* BoolToDes8LC( TBool aBool) const; + + + /** + * The function calls the GetLuidAllocL function of the MSmlDmCallback to + * get the LUID which is mapped to aURI. This function LUID is not found, + * the function allocates a null length string, i.e. the function + * allocates memory in every case. + * @since S60 v3.2 + * @param aURI URI of the object. + */ + HBufC8* GetLuidAllocL( const TDesC8& aURI ); + +private: + + /** + * Constructor + */ + CNSmlDmBmAdapter(); + + /** + * Constructor + * @param aDmCallback Callback object to the framework + */ + CNSmlDmBmAdapter( MSmlDmCallback* aDmCallback ); + + /** + * Second phase constructor + */ + void ConstructL(); + + + /** + * Searches the buffer for a SNAP with the parameter mapping name + * @param aMappingName Mapping Name of this SNAP + * @return Pointer to the CSmlDmBmSettingsElement object in buffer. + * The object is owned by the CNSmlDmBmAdapter. + */ + CSmlDmBmSettingsElement* GetSnapIfBuffered( const TDesC8& aMappingName); + + /** + * Returns the first URI from a list of URIs + * @param aURIList Comma separated list of URIs + * @return The first URI + */ + TPtrC8 FirstURI(const TDesC8& aURIList) const; + + /** + * Returns the number of URIs in a list of URIs + * @param aURIList Comma-separated list of URIs + * @return Number of URIs in the list. + */ + TInt NumOfURIs(const TDesC8& aURIList) const; + + + /** + * Removes the first URI from a list of URIs + * @param aURIList Comma separated list of URIs + * @return The first URI + */ + TPtrC8 RemoveFirstURI(const TDesC8& aURI) const; + + /** + * Parses the last URI segment from URI + * @param aURI The whole URI + * @return The last URI segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + /** + * Removes the last URI segment from URI + * @param aURI The whole URI + * @return The aURI without the last URI segment + */ + TPtrC8 RemoveLastURISeg(const TDesC8& aURI) const; + + /** + * Calculates the number of URI segments + * @param aURI The whole URI + * @return The number of URI segments + */ + TInt NumOfURISegs(const TDesC8& aURI) const; + + /** + * Checks if the URI refers to predefined SNAP (of format SNAPx) in which + * case operations should be successful even if passed LUID is empty. + * Maps the URI to found id. + * @param aURI The whole URI + * @param aLUID LUID + * @return The SNAP ID if found + */ + TInt MapPredefinedSnapsL( const TDesC8& aURI, const TDesC8& aLUID ); + + /** + * Tries to find predefined URI string (SNAPx) fronm input + * returns the ID. + * @param aURI The whole URI + * @return The SNAP ID if found + */ + TInt GetPredefinedSnapIdFromUri( const TDesC8& aURI ) const; + +private: //data + + /** + * Buffered commands. Contains a CSmlDmBmSettingsElement object + * for each SNAP. THese in turn contain commands for the SNAP. + */ + RPointerArray iBuffer; + + /** + * Setting store object, which is called for managing settings + * in CommsDat. Own. + */ + CNSmlDmBmSettingStore * iSettingStore; + + /** + * CmManager object for SNAP existence checking for + * direct accesses to pre-defined SNAPs + */ + RCmManagerExt iCmManagerExt; + + }; + + +/** + * CSmlDmBmCommandElement + * + * Helper class, which stores a single buffered command for a SNAP. + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ + +class CSmlDmBmCommandElement : public CBase + { + +public: + + /** + * Two-phased constructor. + */ + static CSmlDmBmCommandElement* NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ); + + /** + * Destructor. + */ + ~CSmlDmBmCommandElement(); + + /** + * Returns the iExecuted member value of the object + * + * @since S60 v3.2 + * @return The iExecuted member value of the object + */ + inline TBool Executed(); + + /** + * Sets the iExecuted member value of the object + * + * @since S60 v3.2 + * @param aExecuted Executed value for the object. + */ + inline void SetExecuted( TBool aExecuted ); + + /** + * Returns the iStatus member value of the object + * + * @since S60 v3.2 + * @return The iStatus value of the object + */ + inline CSmlDmAdapter::TError Status(); + + /** + * Sets the iStatus member value of the object + * + * @since S60 v3.2 + * @param aStatus Status value for the object. + */ + inline void SetStatus( CSmlDmAdapter::TError aStatus ); + + /** + * Returns the iLeaf member value of the object + * + * @since S60 v3.2 + * @return The iLeaf member value of the object + */ + inline TBool Leaf(); + + /** + * Returns the iStatusRef member value of the object + * + * @since S60 v3.2 + * @return The iStatusRef member value of the object + */ + inline TInt StatusRef(); + + /** + * Returns the iResultRef member value of the object + * + * @since S60 v3.2 + * @return The iResultRef member value of the object + */ + inline TInt ResultRef(); + + /** + * Returns the iCmdType member value of the object + * + * @since S60 v3.2 + * @return The iCmdType member value of the object + */ + inline CNSmlDmBmAdapter::TCommandType CmdType(); + + /** + * Returns the iData member value of the object + * + * @since S60 v3.2 + * @return The iData member value of the object + */ + inline const HBufC8* Data(); + + /** + * Returns the iLastUriSeg member value of the object + * + * @since S60 v3.2 + * @return The iLastUriSeg member value of the object + */ + inline const HBufC8* LastUriSeg(); + + /** + * Sets the iData member value of the object + * + * @since S60 v3.2 + * @param aData Data set to the object. The data will be owned by + * the command object. + */ + inline void SetDataL( const TDesC8& aData ); + +private: + + CSmlDmBmCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType ); + + void ConstructL( const TDesC8& aLastUriSeg, const TDesC8& aData ); + + +private: //data + + /** + * Has command been executed. + * Set to ETrue when command is executed. + */ + TBool iExecuted; + + /** + * The execution status of an exeuted command. + * Filled in when command is executed. + */ + CSmlDmAdapter::TError iStatus; + + + /** + * True if commend is for a leaf node, False if it is for a Snap node. + */ + const TBool iLeaf; + + /** + * Reference for returning the status to DM framework. + */ + const TInt iStatusRef; + + /** + * Reference for returning result of Get command to the DM framework. + */ + const TInt iResultRef; + + /** + * Type of command. + */ + const CNSmlDmBmAdapter::TCommandType iCmdType; + + + /** + * Data which is either ment to be stored to setting store + * or which has been fetched from there. + */ + HBufC8* iData; + + /** + * Last segment in the command URI, which indicates the leaf node + * in question. For non leaf command empty string. + */ + HBufC8* iLastUriSeg; + + }; + + +/** + * CSmlDmBmSettingsElement + * + * Helper class which stores information of a single SNAP object + * into buffer. Contains the buffered commands for the + * SNAP as a list of CSmlBmCommandElement objects. + * + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ + +class CSmlDmBmSettingsElement : public CBase + { + +public: + + /** + * Two-phased constructor. + */ + static CSmlDmBmSettingsElement* NewLC( const TDesC8& aMappingName ); + + /** + * Destructor. + */ + ~CSmlDmBmSettingsElement(); + + /** + * Returns a reference to iNodeBuf member. + * @since S60 v3.2 + * @return Reference to iNodeBuf member of the object + */ + inline RPointerArray& NodeBuf(); + + /** + * Returns the iMappingName member value. + * @since S60 v3.2 + * @return The iMappingName member value of the object + */ + inline const HBufC8* MappingName(); + + /** + * Returns the iExecuted member value. + * @since S60 v3.2 + * @return The iExecuted member value of the object + */ + inline TBool Executed(); + + /** + * Sets the iExecuted member value. + * @since S60 v3.2 + * @param aExecuted Value for the iExecuted member of the object + */ + inline void SetExecuted( TBool aExecuted ); + + /** + * Returns the iLuid member value. + * @since S60 v3.2 + * @return The iLuid member value of the object + */ + inline TInt Luid(); + + /** + * Sets the iLuid member value. + * @since S60 v3.2 + * @param aLuid Value for the iLuid member of the object + */ + inline void SetLuid( TInt aLuid ); + + +private: + + CSmlDmBmSettingsElement(); + + void ConstructL( const TDesC8& aMappingName ); + +private: //data + + /** + * Buffer of commands for this SNAP object. Commands + * are added as they come in from the framework and + * executed by the setting store. + */ + RPointerArray iNodeBuf; + + /** + * Indicates whether commands for this SNAP have been executed. + * Set to Erue by CNsmlDmBmSettingStore when object is handled. + */ + TBool iExecuted; + + /** + * LUID (Local UID) is the CommsDat id of the SNAP node. This is + * filled in when SNAP object is created in CommsDat. + */ + TInt iLuid; + + /** + * Mapping name of this SNAP node. This is mapped to the + * iLuid when the Snap is created and has id. + */ + HBufC8* iMappingName; + }; + +#include "nsmldmbmadapter.inl" + +#endif // NSMLDMBMADAPTER_H diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/inc/nsmldmbmadapter.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/inc/nsmldmbmadapter.inl Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,173 @@ +/* +* 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 "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 implementations of inline functions +* +*/ + + + +// ----------------------------------------------------------------------------- +// Returns the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmBmCommandElement::Executed() + { + return iExecuted; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatus member of the object +// ----------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CSmlDmBmCommandElement::Status() + { + return iStatus; + } + +// ----------------------------------------------------------------------------- +// Returns the iLeaf member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmBmCommandElement::Leaf() + { + return iLeaf; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatusRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmBmCommandElement::StatusRef() + { + return iStatusRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iResultRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmBmCommandElement::ResultRef() + { + return iResultRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iCmdType member of the object +// ----------------------------------------------------------------------------- +// +CNSmlDmBmAdapter::TCommandType CSmlDmBmCommandElement::CmdType() + { + return iCmdType; + } + +// ----------------------------------------------------------------------------- +// Returns the iData member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmBmCommandElement::Data() + { + return iData; + } + +// ----------------------------------------------------------------------------- +// Returns the iLastUriSeg member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmBmCommandElement::LastUriSeg() + { + return iLastUriSeg; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmBmCommandElement::SetExecuted( TBool aExecuted ) + { + iExecuted = aExecuted; + } + +// ----------------------------------------------------------------------------- +// Sets the iStatus member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmBmCommandElement::SetStatus( CSmlDmAdapter::TError aStatus ) + { + iStatus = aStatus; + } + + +// ----------------------------------------------------------------------------- +// Sets the iData member of the object. Ownership of aData argument will be +// transfered to the CSmlDmBmCommandElement +// ----------------------------------------------------------------------------- +// +void CSmlDmBmCommandElement::SetDataL( const TDesC8& aData ) + { + if ( aData.Length() > iData->Length() ) + { + iData = iData->ReAllocL( aData.Length() ); + } + *iData = aData; + } + +//Function definitions for CSmlDmBmSettingsElement +// ----------------------------------------------------------------------------- +// Returns reference to iNodeBuf +// ----------------------------------------------------------------------------- +RPointerArray& CSmlDmBmSettingsElement::NodeBuf() + { + return iNodeBuf; + } + +// ----------------------------------------------------------------------------- +// Returns iMappingName +// ----------------------------------------------------------------------------- +const HBufC8* CSmlDmBmSettingsElement::MappingName() + { + return iMappingName; + } + +// ----------------------------------------------------------------------------- +// Returns iExecuted +// ----------------------------------------------------------------------------- +TBool CSmlDmBmSettingsElement::Executed() + { + return iExecuted; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member value +// ----------------------------------------------------------------------------- +void CSmlDmBmSettingsElement::SetExecuted( TBool aExecuted ) + { + iExecuted = aExecuted; + } + + +// ----------------------------------------------------------------------------- +// Returns iLuid +// ----------------------------------------------------------------------------- +TBool CSmlDmBmSettingsElement::Luid() + { + return iLuid; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member value +// ----------------------------------------------------------------------------- +void CSmlDmBmSettingsElement::SetLuid( TInt aLuid ) + { + iLuid = aLuid; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/inc/nsmldmbmsettingstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/inc/nsmldmbmsettingstore.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,218 @@ +/* +* 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 "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: The class manages snap data in Commsdat using CMManager +* +*/ + + + + +#ifndef NSMLDMBMSETTINGSTORE_H +#define NSMLDMBMSETTINGSTORE_H + +#include + +#include "nsmldmbmadapter.h" + +const TInt KShift8 = 8; + +class CNSmlDmBmAdapter; +class CSmlDmBmCommandElement; +class CSmlDmBmSettingsElement; + +/** + * Setting Store is used for managing settings in CommsDat + * + * The class provides functions for executing commands + * and sets of commands that involve manipulation of + * data in CommsDat. + * + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ +class CNSmlDmBmSettingStore : public CBase + { + +public: + + /** + * Two-phased constructor. + */ + static CNSmlDmBmSettingStore * NewL( CNSmlDmBmAdapter* aAdapter ); + + /** + * Destructor. + */ + virtual ~CNSmlDmBmSettingStore(); + + + /** + * Executes all commands for the argument snap object. + * Executed commands are set as executed and status is filled + * in. For Get commands also fetched data is filled in the command. + * + * @since S60 v3.2 + * @param aSettings Settings object for the SNAP, contains all + * commands to be executed for the SNAP + */ + void StoreSnapL( CSmlDmBmSettingsElement& aSettings ); + + + /** + * Executes the argument command. Checks the node from + * for which the command is intended and calls node specific functions. + * + * @since S60 v3.2 + * @param aCmd Command to be executed + * @param aLuid LUID of the SNAP which command is referring. + */ + void ExecuteCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid); + + /** + * Fetches all SNAPs and inserts id of each SNAp into the argument array + * + * @since S60 v3.2 + * @param aLUIDArray Array for SNAP ids + */ + void GetSnapsL( RArray& aLUIDArray ); + +private: + + CNSmlDmBmSettingStore( CNSmlDmBmAdapter * aAdapter ); + + void ConstructL(); + +//----------- Commands for managing leaf nodes -------------------// + + /** + * Executes snap commands. The valid commands include + * get and delete. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aLuid The id of the snap + */ + void ExecuteSnapCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid ); + + /** + * Executes iap list commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aSnap The snap object + */ + void ExecuteIapsCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes protection commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aSnap The snap object + */ + void ExecuteProtectionCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes hidden commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aSnap The snap object + */ + void ExecuteHiddenCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes metadata commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aSnap The snap object + */ + void ExecuteMetadataCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes embedded snap commands. The valid commands include + * update, get and delete. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aLuid The id of the snap + */ + void ExecuteEmbeddedSnapCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + /** + * Executes name commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aSnap The snap object + */ + void ExecuteNameCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + +private: //data + + /** + * CmManager is used for accessing CommsDat. + */ + RCmManagerExt iCmManagerExt; + + /** + * Pointer to the adapter. This is used for + * querying data from DM framework when necessary + * and using helper functions. Not own. + */ + CNSmlDmBmAdapter* iAdapter; + + }; + + +#endif // NSmlDmBmSettingStore_H diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/rom/nsmldmbmadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/rom/nsmldmbmadapter.iby Thu Jan 07 12:39:15 2010 +0200 @@ -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 "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: Image description file for project nsmldmbmadapter +* +*/ + + + +#ifndef NSMLDMBMADAPTER_IBY +#define NSMLDMBMADAPTER_IBY + +#include + +#ifdef __SYNCML_DM + +ECOM_PLUGIN( nsmldmbmadapter.dll, nsmldmbmadapter.rsc ) + +#endif // __SYNCML_DM + +#endif // NSMLDMBMADAPTER_IBY diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/src/nsmldmbmadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/src/nsmldmbmadapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,1675 @@ +/* +* 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 "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: Bearer management DM adapter. Provides handling of + Bearer management related settings in Device management +* +*/ + + + +#include +#include + +#include "nsmldmbmadapter.h" +#include "bmadapterlogger.h" + +// ======== MEMBER FUNCTIONS ======== + + +// -------------------------------------------------------------------------- +// Maps plugin UID to its factory function (constructor) +// -------------------------------------------------------------------------- +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101f6d2f, + CNSmlDmBmAdapter::NewL) + }; + +// -------------------------------------------------------------------------- +// For ecom plugin implementation +// ------------------------------------------------------------------------- + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::NewL +// -------------------------------------------------------------------------- +CNSmlDmBmAdapter* CNSmlDmBmAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + BMADAPTERLOGSTRING("CNSmlDmBmAdapter::NewL: Start") + CNSmlDmBmAdapter* self = new (ELeave) CNSmlDmBmAdapter( aDmCallback ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + BMADAPTERLOGSTRING("CNSmlDmBmAdapter::NewL: End") + return self; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CNSmlDmBmAdapter +// -------------------------------------------------------------------------- + +CNSmlDmBmAdapter::CNSmlDmBmAdapter( MSmlDmCallback* aDmCallback ) + : CSmlDmAdapter( aDmCallback ) + { + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::ConstructL +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::ConstructL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CNSmlDmBmAdapter: Start" ) + iSettingStore = CNSmlDmBmSettingStore::NewL( this ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CNSmlDmBmAdapter: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::~CNSmlDmBmAdapter +// -------------------------------------------------------------------------- +CNSmlDmBmAdapter::~CNSmlDmBmAdapter() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::~CNSmlDmBmAdapter: Start" ) + iBuffer.ResetAndDestroy(); + iBuffer.Close(); + delete iSettingStore; + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::~CNSmlDmBmAdapter: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DDFVersionL +// Returns ddf version nr +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFVersionL: Start" ) + aDDFVersion.InsertL( 0, KNSmlDmBMAdapterDDFVersion ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFVersionL:End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DDFStructureL +// Constructs the DDF structure +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFStructureL: Start" ) + TSmlDmAccessTypes accessTypes; + + // BearerManagementSNAP + MSmlDmDDFObject& bm = aDDF.AddChildObjectL( KNSmlDmBMAdapterBM ); + accessTypes.SetGet(); + accessTypes.SetAdd(); + bm.SetAccessTypesL( accessTypes ); + bm.SetOccurenceL( MSmlDmDDFObject::EOne ); + bm.SetScopeL( MSmlDmDDFObject::EPermanent ); + bm.SetDFFormatL( MSmlDmDDFObject::ENode ); + bm.AddDFTypeMimeTypeL( KNSmlDmBMAdapterTextPlain ); + bm.SetDescriptionL( KNSmlDmBMAdapterBMDescription ); + accessTypes.Reset(); + + + // BearerManagementSNAP/ + MSmlDmDDFObject& dynamic1 = bm.AddChildObjectGroupL(); + accessTypes.SetAdd(); + accessTypes.SetDelete(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + dynamic1.SetAccessTypesL( accessTypes ); + dynamic1.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore ); + dynamic1.SetScopeL( MSmlDmDDFObject::EDynamic ); + dynamic1.SetDFFormatL( MSmlDmDDFObject::ENode ); + dynamic1.AddDFTypeMimeTypeL( KNSmlDmBMAdapterTextPlain ); + dynamic1.SetDescriptionL( KNSmlDmBMAdapterDynamicDescription ); + accessTypes.Reset(); + + + // BearerManagementSNAP//Name + MSmlDmDDFObject& name = dynamic1.AddChildObjectL( KNSmlDmBMAdapterName ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + name.SetAccessTypesL( accessTypes ); + name.SetOccurenceL( MSmlDmDDFObject::EOne ); + name.SetScopeL( MSmlDmDDFObject::EDynamic ); + name.SetDFFormatL( MSmlDmDDFObject::EChr ); + name.SetDescriptionL( KNSmlDmBMAdapterNameDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//IAPPrioityList + MSmlDmDDFObject& iapList = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterIAPPriorityList ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + iapList.SetAccessTypesL( accessTypes ); + iapList.SetOccurenceL( MSmlDmDDFObject::EOne ); + iapList.SetScopeL( MSmlDmDDFObject::EDynamic ); + iapList.SetDFFormatL( MSmlDmDDFObject::EChr ); + iapList.SetDescriptionL( KNSmlDmBMAdapterIAPPriorityListDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//EmbeddedSNAP + MSmlDmDDFObject& embedded = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterEmbeddedSNAP ); + accessTypes.SetAdd(); + accessTypes.SetDelete(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + embedded.SetAccessTypesL( accessTypes ); + embedded.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne ); + embedded.SetScopeL( MSmlDmDDFObject::EDynamic ); + embedded.SetDFFormatL( MSmlDmDDFObject::EChr ); + embedded.SetDescriptionL( KNSmlDmBMAdapterEmbeddedSNAPDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//Metadata + MSmlDmDDFObject& metadata = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterMetadata ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + metadata.SetAccessTypesL( accessTypes ); + metadata.SetOccurenceL( MSmlDmDDFObject::EOne ); + metadata.SetScopeL( MSmlDmDDFObject::EDynamic ); + metadata.SetDFFormatL( MSmlDmDDFObject::EInt ); + metadata.SetDescriptionL( KNSmlDmBMAdapterMetadataDescription ); + accessTypes.Reset(); + + + // BearerManagementSNAP//Protected + MSmlDmDDFObject& protection = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterProtected ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + protection.SetAccessTypesL( accessTypes ); + protection.SetOccurenceL( MSmlDmDDFObject::EOne ); + protection.SetScopeL( MSmlDmDDFObject::EDynamic ); + protection.SetDFFormatL( MSmlDmDDFObject::EInt ); + protection.SetDescriptionL( KNSmlDmBMAdapterProtectedDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//Hidden + MSmlDmDDFObject& hidden = dynamic1.AddChildObjectL( KNSmlDmBMAdapterHidden ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + hidden.SetAccessTypesL( accessTypes ); + hidden.SetOccurenceL( MSmlDmDDFObject::EOne ); + hidden.SetScopeL( MSmlDmDDFObject::EDynamic ); + hidden.SetDFFormatL( MSmlDmDDFObject::EBool ); + hidden.SetDescriptionL( KNSmlDmBMAdapterHiddenDescription ); + accessTypes.Reset(); + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFStructureL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::UpdateLeafObjectL +// Adds or updates leaf node value. If snap object is +// in buffer this command is also buffered. Also if leaf node +// is embedded snap and that snap is buffered, the argument command +// is buffered. +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: Start" ) + BMADAPTERLOGSTRING4( "\tUpdateLeafObjectL \tURI: %S, \n\tLUID: %S,\ + \tobject: %S ", + &aURI, &aLUID, &aObject ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + // Check if parent snap node is found in the buffered settings + CSmlDmBmSettingsElement* snap = + GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + + // data for buffered SNAP -> Store command into buffer + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + snap->NodeBuf().AppendL(cmd); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + + } + // updates for an existing SNAP + else + { + + // If setting embedded SNAP node and the embedded SNAP node is still + // buffered -> Buffer also this command + if( !LastURISeg( aURI ).Compare( KNSmlDmBMAdapterEmbeddedSNAP ) ) + { + snap = GetSnapIfBuffered( aObject ); + + // embedded SNAP is buffered + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + + // buffer this command + CSmlDmBmSettingsElement* setting = + CSmlDmBmSettingsElement::NewLC( RemoveLastURISeg( aURI ) ); + + // Check if SNAP was predefined or not + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + setting->SetLuid( snapId ); + iBuffer.AppendL( setting ); + CleanupStack::Pop( setting ); + setting->NodeBuf().AppendL(cmd); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tEmbedded Snap %S buffered, buffering cmd", + snap->MappingName() ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: End" ) + return; + } + } + // execute command and return status + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d", + cmd->Status() ) + Callback().SetStatusL( aStatusRef, cmd->Status() ); + CleanupStack::PopAndDestroy( cmd ); + + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: End" ) + } +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DeleteObjectL +// Deletes node or leaf object. If the snap this command relates to is +// buffered, also the delete command is buffered. +// -------------------------------------------------------------------------- + +void CNSmlDmBmAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DeleteObjectL: Start" ) + BMADAPTERLOGSTRING3( "\tDeleteObjectL \tURI: %S, \tLUID: %S", + &aURI, &aLUID ) + + CSmlDmBmCommandElement* cmd; + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + // check if node or leaf object and create command accordingly + // when updating, make sure that cmd is constructed + if ( NumOfURISegs( aURI ) == KNsmlDmBmSNAPNodeDepth ) + { + cmd = CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EDeleteCmd, + KNullDesC8, KNullDesC8 ); + } + else if ( ! LastURISeg( aURI ).Compare( KNSmlDmBMAdapterEmbeddedSNAP() ) ) + { + cmd = CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EDeleteCmd, + LastURISeg( aURI ), + KNullDesC8 ); + } + else + { + // unsupported node, framework should check this + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "\tCNSmlDmBmAdapter::DeleteObjectL: \ + Error, unsupported node" ) + return; + } + + // If this SNAP still in buffer -> buffer command for later execution + // Check if SNAP is found in the buffered settings + CSmlDmBmSettingsElement* snap = NULL; + if( cmd->Leaf() ) + { + snap = GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + } + else + { + snap = GetSnapIfBuffered( aURI ); + } + // when updating make sure that cmd is removed from cleanup + // stack and deleted if necessary + + // if cmd for buffered snap append cmd to buffer + if ( snap ) + { + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // if existing node, execute command + else if( aLUID.Length() > 0 || snapId != KErrNotFound ) + { + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ) + Callback().SetStatusL( aStatusRef, cmd->Status() ); + CleanupStack::PopAndDestroy( cmd ); + } + // unknown node + else + { + BMADAPTERLOGSTRING( "\tUnknown node\n" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( cmd ); + } + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DeleteObjectL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::FetchLeafObjectL +// Fetches leaf object value. If the snap is buffered also this command +// will +// be buffered. +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aType*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "NSmlDmBMAdapter::FetchLeafObjectL: Start" ) + BMADAPTERLOGSTRING3( "\tFetchLeafObjectL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + // check if parent snap node is buffered + CSmlDmBmSettingsElement* snap = + GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + + // data for buffered SNAP -> Store command into buffer + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + LastURISeg( aURI ), + KNullDesC8); + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // otherwise execute cmd right away + else + { + + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + LastURISeg( aURI ), + KNullDesC8); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ) + // if executed return status + if ( cmd->Executed() ) + { + Callback().SetStatusL( aStatusRef, cmd->Status() ); + // if successful set results + if ( cmd->Status() == CSmlDmAdapter::EOk ) + { + BMADAPTERLOGSTRING2( "\tCmd executed with result: %S ", + cmd->Data() ) + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, *result, KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + // failed to execute command + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + CleanupStack::PopAndDestroy( cmd ); + } + + BMADAPTERLOGSTRING( "NSmlDmBMAdapter::FetchLeafObjectL: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::FetchLeafObjectSizeL +// Fetches leaf object size. If the snap is buffered also this command will +// be buffered. +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /* aType */, + TInt aResultsRef, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::FetchLeafObjectSizeL: Start" ) + BMADAPTERLOGSTRING3( "\tFetchLeafObjectSizeL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + // check if parent snap node is buffered + CSmlDmBmSettingsElement* snap = + GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + + // data for buffered SNAP -> Store command into buffer + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetSizeCmd, + LastURISeg( aURI ), + KNullDesC8); + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // otherwise execute get size cmd right away + else + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetSizeCmd, + LastURISeg( aURI ), + KNullDesC8); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ) + // if executed get status + if ( cmd->Executed() ) + { + Callback().SetStatusL( aStatusRef, cmd->Status() ); + // if successful get results + if ( cmd->Status() == CSmlDmAdapter::EOk ) + { + BMADAPTERLOGSTRING2( "\tCmd executed with result: %S ", + cmd->Data() ) + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, *result, KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + // failed to execute command + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + CleanupStack::PopAndDestroy( cmd ); + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::FetchLeafObjectSizeL: End" ) + } + +// ------------------------------------------------------------------------ +// CNSmlDmBmAdapter::ChildURIListL +// Fetches child nodes of a node. these may be either all snap nodes +// or leaf nodes under a snap node. +// ------------------------------------------------------------------------ +void CNSmlDmBmAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& + aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ChildURIListL: Start" ) + BMADAPTERLOGSTRING3( "\tChildURIListL URI: %S, LUID: %S ", + &aURI, &aLUID ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + CBufBase* resultList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( resultList ); + // get all snap nodes + if ( !aURI.Compare(KNSmlDmBMAdapterBM) ) + { + RArray snaps = RArray( KNSmlDmBMGranularity ); + CleanupClosePushL( snaps ); + iSettingStore->GetSnapsL( snaps ); + TInt currentSNAP( -1 ); + for ( TInt i( 0 ); i < snaps.Count(); i++) + { + currentSNAP = snaps[i]; + BMADAPTERLOGSTRING2( "\tSnap id: %d, ", currentSNAP ) + + // check that not previously mapped + TBool found = EFalse; + + for ( TInt j( 0 ); j < aPreviousURISegmentList.Count(); j++ ) + { + TSmlDmMappingInfo mapping = aPreviousURISegmentList.At( j ); + // snap already has mapping + if ( currentSNAP == DesToIntL( mapping.iURISegLUID ) ) + { + BMADAPTERLOGSTRING2( " URI: %S exists ", &mapping.iURISeg ) + found = ETrue; + // add to result list + resultList->InsertL( resultList->Size(), + mapping.iURISeg); + break; + } + } + if ( !found ) + { + // This is new snap -> create URI and mapping and add + // node name to result + HBufC8* uri = HBufC8::NewLC( aURI.Length() + + KNSmlDmBmSeparator().Length() + + KSmlMaxURISegLen ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format( aURI ); + uriPtr.Append( KNSmlDmBmSeparator ); + uriPtr.Append( KNSmlDmBMSNAPNamePrefix ); + HBufC8* luidBuf = IntToDes8L( currentSNAP ); + CleanupStack::PushL( luidBuf ); + uriPtr.Append( *luidBuf ); + + Callback().SetMappingL( uriPtr, *luidBuf ); + resultList->InsertL( resultList->Size(), + LastURISeg( uriPtr ) ); + BMADAPTERLOGSTRING2( "Creating mapping for URI %S ", &uriPtr ) + CleanupStack::PopAndDestroy( luidBuf ); + CleanupStack::PopAndDestroy( uri ); + } + // insert separator if not last + if ( i < snaps.Count() - 1 ) + { + resultList->InsertL( resultList->Size(), + KNSmlDmBmSeparator ); + } + } + CleanupStack::PopAndDestroy( &snaps ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + Callback().SetResultsL( aResultsRef, *resultList, KNullDesC8 ); + } + // get child nodes of a snap node + else if ( NumOfURISegs( aURI ) == KNsmlDmBmSNAPNodeDepth ) + { + CSmlDmBmSettingsElement* snap = GetSnapIfBuffered( aURI ); + // if buffered, add this command to buffer + if( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + KNullDesC8, + KNullDesC8 ); + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // existing snap must have luid mapped + else if( aLUID.Length() > 0 || snapId != KErrNotFound ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + KNullDesC8, + KNullDesC8 ); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ) + Callback().SetStatusL( aStatusRef, cmd->Status() ); + if( cmd->Status() == CSmlDmAdapter::EOk ) + { + resultList->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, + *resultList, + KNullDesC8 ); + } + CleanupStack::PopAndDestroy( cmd ); + } + // invalid snap object + else + { + BMADAPTERLOGSTRING( "\tCNSmlDmBmAdapter::ChildURIListL: Error, \ + invalid snap node" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + } + else + { + BMADAPTERLOGSTRING( "\tChildURIListL: Invalid URI" ) + } + CleanupStack::PopAndDestroy( resultList ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ChildURIListL: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::AddNodeObjectL +// Adds a snap node. The node is buffered until all data is received. +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::AddNodeObjectL: Start" ) + BMADAPTERLOGSTRING3( "\tAddNodeObjectL \tURI: %S, \tparent LUID: %S,", + &aURI, &aParentLUID ) + if ( NumOfURISegs( aURI ) == KNsmlDmBmSNAPNodeDepth ) + { + // if same node already exists command fails + CSmlDmBmSettingsElement* setting = GetSnapIfBuffered( aURI ); + if( setting || aParentLUID.Compare( KNullDesC8) ) + { + BMADAPTERLOGSTRING( "\t Snap exists" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + } + else if ( LastURISeg( aURI ).Length() > KSmlMaxURISegLen ) + { + BMADAPTERLOGSTRING( "\t Node name too long" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + else + { + // Store command in buffer for later processing + setting = CSmlDmBmSettingsElement::NewLC( aURI ); + iBuffer.AppendL( setting ); + CleanupStack::Pop( setting ); + + // store the add node command + CSmlDmBmCommandElement* command = + CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + KNullDesC8, + KNullDesC8 ); + TInt index( iBuffer.Count() - 1 ); + iBuffer[index]->NodeBuf().AppendL( command ); + CleanupStack::Pop( command ); + BMADAPTERLOGSTRING( "\t Cmd buffered" ) + } + } + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::AddNodeObjectL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::UpdateLeafObjectL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt /* aStatusRef */ ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: End" ) + } + + + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + const TDesC8& /* aArgument */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: Start" ) + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: Start" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CopyCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::CopyCommandL( const TDesC8& /* aTargetURI */ , + const TDesC8& /* aTargetLUID */ , + const TDesC8& /* aSourceURI */ , + const TDesC8& /* aSourceLUID */, + const TDesC8& /* aType */ , + TInt aStatusRef ) + { + //not supported + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CopyCommandL: Sart" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CopyCommandL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::StartAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::StartAtomicL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StartAtomicL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StartAtomicL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CommitAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::CommitAtomicL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CommitAtomicL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CommitAtomicL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::RollbackAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::RollbackAtomicL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::RollbackAtomicL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::RollbackAtomicL: End" ) + } + +TBool CNSmlDmBmAdapter::StreamingSupport( TInt& /* aItemSize */ ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamingSupport: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamingSupport: End" ) + return EFalse; + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::StreamCommittedL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::StreamCommittedL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamCommittedL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamCommittedL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CompleteOutstandingCmdsL +// CNSmlDmBmAdapter::CompleteOutstandingCmdsL +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::CompleteOutstandingCmdsL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CompleteOutstandingCmdsL: Start" ) + CSmlDmBmSettingsElement* settings( NULL ); + CSmlDmBmCommandElement* cmd( NULL ); + TInt err(0); + // Read through the buffer and execute commands + for ( TInt i(0); i < iBuffer.Count(); ) + { + settings = iBuffer[i]; + if( settings->NodeBuf().Count() ) + { + // the setting may be executed already if it has been an embedded + // snap for another snap + if ( !settings->Executed() ) + { + //execute commands for snap + TRAP( err, iSettingStore->StoreSnapL( *settings )); + } + // if can't recover from error, don't continue processing + // commands + if( err == KErrNoMemory || + err == KErrDiskFull ) + { + BMADAPTERLOGSTRING2( "\tCNSmlDmBmAdapter::\ + CompleteOutstandingCmdsL: Error %d", err ) + User::Leave( err ); + } + // if this is a new snap and created successfully, map luid + if ( !settings->NodeBuf()[0]->Leaf() && + settings->NodeBuf()[0]->CmdType() == CNSmlDmBmAdapter::EAddCmd && + settings->NodeBuf()[0]->Executed() && + settings->NodeBuf()[0]->Status() == CSmlDmAdapter::EOk ) + { + HBufC8* luid = IntToDes8L( settings->Luid() ); + CleanupStack::PushL( luid ); + Callback().SetMappingL( *settings->MappingName(), *luid ); + BMADAPTERLOGSTRING3( "\t Setting mapping %S - %S ", + settings->MappingName(), luid ) + CleanupStack::PopAndDestroy( luid ); + } + // set status for all commands executed and remove the command + for ( TInt j( 0 ); j < settings->NodeBuf().Count(); ) + { + + cmd = settings->NodeBuf()[j]; + + // return status values if executed + if ( cmd->Executed() ) + { + + Callback().SetStatusL( cmd->StatusRef(), + cmd->Status() ); + // for certain errors, don't continue command execution + if( cmd->Status() == CSmlDmAdapter::ENoMemory ) + { + // commands are deleted + iBuffer.ResetAndDestroy(); + BMADAPTERLOGSTRING( "\tCmd failed with CSmlDmAdapter::ENoMemory" ) + User::Leave( KErrNoMemory ); + } + else if( cmd->Status() == CSmlDmAdapter::EDiskFull ) + { + // commands are deleted + iBuffer.ResetAndDestroy(); + BMADAPTERLOGSTRING( "\tCmd failed with CSmlDmAdapter::EDiskFull" ) + User::Leave( KErrDiskFull ); + } + else + { + BMADAPTERLOGSTRING2( + "\tCmd failed with CSmlDmAdapter::%d", + cmd->Status() ) + } + // for get commands, also return the results + if ( cmd->CmdType() == CNSmlDmBmAdapter::EGetCmd || + cmd->CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( cmd->ResultRef(), + *result, + KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + Callback().SetStatusL( cmd->StatusRef(), + CSmlDmAdapter::EError ); + } + settings->NodeBuf().Remove( j ); + delete cmd; + } + } + + // delete settings element and remove it from buffer + delete settings; + iBuffer.Remove( i ); + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CompleteOutstandingCmdsL: End" ) + } + + + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::StoreSnapIfBufferedL +// If argument snap is found in the buffer iSettingStore->StoreSNAPL is +// called +// for it and LUID is mapped. SNAP is set as executed. +// This is called when checking if snap has embedded snap reference to +// another +// snap which is stored further in the command buffer. +// All embedded snap commands of this type are buffered and execution only +// happens with CompleteOutstandingCmdsL call. +// ------------------------------------------------------------------------- + +void CNSmlDmBmAdapter::StoreSnapIfBufferedL( const TDesC8& aURI ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StoreSnapIfBufferedL: Start" ) + CSmlDmBmSettingsElement* snap = GetSnapIfBuffered( aURI ); + // if snap is in buffer and is a new snap + if( snap && !snap->Luid() ) + { + iSettingStore->StoreSnapL( *snap ); + // set mapping if succesfully executed + if ( snap->NodeBuf()[0]->Executed() && + snap->NodeBuf()[0]->Status() == CSmlDmAdapter::EOk ) + { + HBufC8* luid = IntToDes8L( snap->Luid() ); + CleanupStack::PushL( luid ); + Callback().SetMappingL( *snap->MappingName(), *luid); + CleanupStack::PopAndDestroy( luid ); + } + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StoreSnapIfBufferedL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetSnapUriFromLuidL +// Returns heap desciptor holding snap node URI matching the argument LUID +// ------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::GetSnapUriFromLuidL( const TUint aSnapId ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetSnapURIFromLUIDL: Start" ) + HBufC8* uri( NULL ); + MSmlDmAdapter::TError err( MSmlDmAdapter::EOk ); + CBufBase* fetchRes = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( fetchRes ); + // fetch all snap nodes + Callback().FetchLinkL( KNSmlDmBMAdapterBMURI, *fetchRes, err ); + + TPtr8 snapNodes = fetchRes->Ptr( 0 ); + + TInt numSnaps = NumOfURISegs( snapNodes ); + + // get uri-luid mappings for snap nodes + for ( TInt i( 0 ); i < numSnaps; i++ ) + { + TPtrC8 node = LastURISeg( snapNodes ); + + HBufC8* uriSeg = HBufC8::NewLC( KNSmlDmBmAdapterURIMaxLength + + node.Length()); + uriSeg->Des().Append( KNSmlDmBMAdapterBM() ); + uriSeg->Des().Append( KNSmlDmBmSeparator() ); + uriSeg->Des().Append( node ); + + HBufC8* luid = Callback().GetLuidAllocL( *uriSeg ); + CleanupStack::PopAndDestroy( uriSeg ); + CleanupStack::PushL( luid ); + // node may not have luid mapped if it's just created + if( luid->Size() ) + { + TInt id = DesToIntL( *luid ); + CleanupStack::PopAndDestroy( luid ); + if ( aSnapId == id ) + { + uri = HBufC8::NewLC( KNSmlDmBMAdapterBMURI().Size() + + KNSmlDmBmSeparator().Size() + + node.Size() ); + + uri->Des().Append( KNSmlDmBMAdapterBMURI() ); + uri->Des().Append( KNSmlDmBmSeparator() ); + uri->Des().Append( node ); + break; + } + } + else + { + CleanupStack::PopAndDestroy( luid ); + } + snapNodes = RemoveLastURISeg( snapNodes ); + } + + if( uri ) + { + CleanupStack::Pop( uri ); + } + + CleanupStack::PopAndDestroy( fetchRes ); + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::IdArrayToIAPList: End" ) + return uri; + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetIapListL +// Returns heap desciptor holding a comma separated list of AP node URIs +// matching the luids in the argument array. +// ------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::GetIapListL( const RArray& aIdArray ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIapListL: Start" ) + HBufC8* iapList = HBufC8::NewLC( aIdArray.Count() * + ( KNSmlDmBmAdapterAPURIMaxLength + + KSmlMaxURISegLen ) ); + MSmlDmAdapter::TError err; + CBufBase* fetchRes = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( fetchRes ); + // fetch dynamic AP nodes, so that LUID mapping is created + Callback().FetchLinkL( KNSmlDmBMAdapterIAPURI, *fetchRes, err ); + + // list of all nodes has a trailing '/' unlike regular uris, remove that + // for further handling + TPtr8 iapNodes = fetchRes->Ptr( 0 ); + if ( iapNodes.Length() > 0 && iapNodes[iapNodes.Length() - 1] == '/') + { + iapNodes = iapNodes.Left( iapNodes.Length() - 1 ); + } + + TInt numAPs = NumOfURISegs( iapNodes ); + + CArrayFixFlat* mappings = + new (ELeave) CArrayFixFlat( numAPs * + sizeof( TSmlDmMappingInfo ) ); + CleanupStack::PushL( mappings ); + + // get uri-luid mappings for all ap nodes + HBufC8* luid = NULL; + for ( TInt i( 0 ); i < numAPs; i++ ) + { + TSmlDmMappingInfo m; + m.iURISeg = LastURISeg( iapNodes ); + + HBufC8* uriSeg = HBufC8::NewLC( KNSmlDmBmAdapterAPURIMaxLength + + m.iURISeg.Length() ); + uriSeg->Des().Replace( 0, + uriSeg->Length(), + KNSmlDmBMAdapterIAPNode() ); + uriSeg->Des().Append( KNSmlDmBmSeparator() ); + uriSeg->Des().Append( m.iURISeg ); + + luid = Callback().GetLuidAllocL( *uriSeg ); + CleanupStack::PopAndDestroy( uriSeg ); + CleanupStack::PushL( luid ); + m.iURISegLUID.Set( *luid ); + mappings->AppendL( m ); + iapNodes = RemoveLastURISeg( iapNodes ); + } + + // find out URIs matching argument IAP ids + for (TInt i(0); i < aIdArray.Count(); i++) + { + TBool found = EFalse; + + for ( TInt j( 0 ); j < mappings->Count(); j++ ) + { + if ( aIdArray[i] == DesToIntL( mappings->At( j ).iURISegLUID ) ) + { + // add to result + iapList->Des().Append( KNSmlDmBMAdapterIAPURI() ); + iapList->Des().Append( KNSmlDmBmSeparator() ); + iapList->Des().Append( mappings->At(j).iURISeg ); + // not last -> add separator + if ( i < aIdArray.Count() - 1 ) + { + iapList->Des().Append( KNSmlDmBmUriListSeparator ); + } + found = ETrue; + break; + } + } + if ( ! found ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIapListL: \ + Error IAP matching id not found" ) + User::Leave( KErrNotFound ); + } + } + + // cleanup each allocated luid + CleanupStack::PopAndDestroy( numAPs ); + CleanupStack::PopAndDestroy( mappings ); + CleanupStack::PopAndDestroy( fetchRes ); + CleanupStack::Pop( iapList ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIapListL: End" ) + return iapList; + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetIdArrayL +// Returns array holding LUIDs matching the AP node in the argument list. +// ------------------------------------------------------------------------- +RArray CNSmlDmBmAdapter::GetIdArrayL( const TDesC8& aIAPList ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIdArrayL: Start" ) + TPtrC8 uri; + RArray iaps; + CleanupClosePushL( iaps ); + uri.Set( aIAPList ); + // fetch AP nodes so that mappings are created + MSmlDmAdapter::TError err; + CBufBase* fetchRes = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( fetchRes ); + // fetch dynamic AP nodes, so that LUID mappings are created + Callback().FetchLinkL( KNSmlDmBMAdapterIAPURI, *fetchRes, err ); + + for ( TInt i(0), n = NumOfURIs( aIAPList ); i < n; i++ ) + { + TPtrC8 thisURI = FirstURI( uri ); + // remove ./ from beginning + TPtrC8 apUri = thisURI.Mid( KNSmlDmBmAdapterURIPrefix().Length() ); + HBufC8* luid = Callback().GetLuidAllocL( apUri ); + CleanupStack::PushL( luid ); + TInt id = DesToIntL( *luid ); + CleanupStack::PopAndDestroy( luid ); + iaps.Append( id ); + uri.Set( RemoveFirstURI( uri ) ); + } + + CleanupStack::PopAndDestroy( fetchRes ); + CleanupStack::Pop( &iaps ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIdArrayL: End" ) + return iaps; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::IntToDes8L +// Converts integer to 8bit descriptor +// -------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::IntToDes8L( TInt aLuid ) const + { + HBufC8* buf = HBufC8::NewL( KMaxLengthOf32bitInteger ); + TPtr8 ptrBuf = buf->Des(); + + // Unless aLuid is casted as TInt64, PC-Lint reports: + // Significant prototype coercion + // + ptrBuf.Num( TInt64( aLuid ) ); + return buf; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DesToIntL +// Converts 8bit descriptor to int +// -------------------------------------------------------------------------- +TUint CNSmlDmBmAdapter::DesToIntL( const TDesC8& aLuid ) const + { + __UHEAP_MARK; + TLex8 lex( aLuid ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value ) ); + __UHEAP_MARKEND; + return value; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DesToBool +// Converts 8bit descriptor to a boolean value +// -------------------------------------------------------------------------- +TBool CNSmlDmBmAdapter::DesToBool(const TDesC8& aBoolDes, TBool& aBool ) const + { + __UHEAP_MARK; + if ( !aBoolDes.Compare( KNSmlDmBMBooleanTrue ) ) + { + aBool = ETrue; + } + else if ( !aBoolDes.Compare( KNSmlDmBMBooleanFalse ) ) + { + aBool = EFalse; + } + else + { + __UHEAP_MARKEND; + return EFalse; + } + __UHEAP_MARKEND; + return ETrue; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::BoolToDes8LC +// Converts boolean value to 8bit descriptor +// -------------------------------------------------------------------------- + +HBufC8* CNSmlDmBmAdapter::BoolToDes8LC( TBool aBool) const + { + HBufC8* ret; + if( aBool ) + { + ret = HBufC8::NewLC( KNSmlDmBMBooleanTrue().Size() ); + ret->Des().Append( KNSmlDmBMBooleanTrue() ); + } + else + { + ret = HBufC8::NewLC( KNSmlDmBMBooleanFalse().Size() ); + ret->Des().Append( KNSmlDmBMBooleanFalse() ); + } + return ret; + } + + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetLuidAllocL +// The function calls the GetLuidAllocL function of the MSmlDmCallback to get +// the LUID which is mapped to aURI. +// -------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::GetLuidAllocL( const TDesC8& aURI ) + { + return Callback().GetLuidAllocL( aURI ); + } + + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetSnapIfBuffered +// Returns a pointer to the snap CSmlDmBmSettingsElement object if found in +// the buffer +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement* CNSmlDmBmAdapter::GetSnapIfBuffered( const TDesC8& + aMappingName ) + { + CSmlDmBmSettingsElement* settings = NULL; + for ( TInt i( 0 ); iMappingName()->Compare( aMappingName ) ) + { + settings = iBuffer[i]; + break; + } + } + return settings; + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::FirstURI +// Returns the first URI from a list of URIs +// ------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::FirstURI( const TDesC8& aURIList ) const + { + __UHEAP_MARK; + TInt i; + for ( i = 0; i < aURIList.Length(); i++ ) + { + if ( aURIList[i] == ',' ) + { + break; + } + } + if ( i == aURIList.Length() - 1 ) + { + __UHEAP_MARKEND; + return aURIList; + } + else + { + __UHEAP_MARKEND; + return aURIList.Mid( 0, i ); + } + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::NumOfURIs +// Returns the num of uris +// -------------------------------------------------------------------------- +TInt CNSmlDmBmAdapter::NumOfURIs( const TDesC8& aURIList ) const + { + __UHEAP_MARK; + if ( !aURIList.Length() ) + { + return 0; + } + TInt numOfURIs( 1 ); + for ( TInt i(0); i < aURIList.Length(); i++ ) + { + if ( aURIList[i] == ',' ) + { + numOfURIs++; + } + } + __UHEAP_MARKEND; + return numOfURIs; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::RemoveFirstURI +// extracts first uri an returns the remaining part of the uri list +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::RemoveFirstURI( const TDesC8& aURIList ) const + { + __UHEAP_MARK; + TInt i; + for ( i = 0; i < aURIList.Length(); i++ ) + { + if ( aURIList[i] == ',' ) + { + break; + } + } + if ( i < aURIList.Length() ) + { + __UHEAP_MARKEND; + return aURIList.Mid( i + 1 ); + } + else + { + __UHEAP_MARKEND; + return aURIList.Mid( i ); + } + + } +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::LastURISeg +// Returns the last uri segemnt of a uri. +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::LastURISeg( const TDesC8& aURI ) const + { + __UHEAP_MARK; + TInt i; + for ( i=aURI.Length()-1; i >= 0; i-- ) + { + if ( aURI[i]=='/' ) + { + break; + } + } + if ( i==0 ) + { + __UHEAP_MARKEND; + return aURI; + } + else + { + __UHEAP_MARKEND; + return aURI.Mid( i + 1 ); + } + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::RemoveLastURISeg +// returns parent uri, i.e. removes last uri segment +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::RemoveLastURISeg( const TDesC8& aURI ) const + { + __UHEAP_MARK; + TInt i; + for ( i = aURI.Length()-1; i >= 0; i-- ) + { + if ( aURI[i]=='/' ) + { + break; + } + } + if ( i > -1 ) + { + __UHEAP_MARKEND; + return aURI.Left( i ); + } + else + { + __UHEAP_MARKEND; + return aURI; + } + + } + + + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::NumOfURISegs +// Returns the num of uri segs +// -------------------------------------------------------------------------- +TInt CNSmlDmBmAdapter::NumOfURISegs( const TDesC8& aURI ) const + { + __UHEAP_MARK; + TInt numOfURISegs( 1 ); + for ( TInt i(0); i < aURI.Length(); i++ ) + { + if ( aURI[i]=='/' ) + { + numOfURISegs++; + } + } + __UHEAP_MARKEND; + return numOfURISegs; + } + +TInt CNSmlDmBmAdapter::MapPredefinedSnapsL( const TDesC8& aURI, const TDesC8& aLUID ) +{ + TInt snapId( KErrNotFound ); + // If this is an add to pre-defined SNAPs then LUID we get is empty, but we still need + // to handle it. + if( aLUID.Length() == 0 && ( ( snapId = GetPredefinedSnapIdFromUri( aURI ) ) != KErrNotFound ) ) + { + // Check if SNAP with given ID exists (from CmManager) + iCmManagerExt.OpenL(); + TRAPD( err, RCmDestinationExt dest = iCmManagerExt.DestinationL( snapId ) ); + iCmManagerExt.Close(); + + // If exists -> Call SetMapping to set LUID. + if( err == KErrNone ) + { + HBufC8* uri = HBufC8::NewLC( KNSmlDmBMAdapterBM().Length() + + KNSmlDmBmSeparator().Length() + + KSmlMaxURISegLen ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format( KNSmlDmBMAdapterBM ); + uriPtr.Append( KNSmlDmBmSeparator ); + uriPtr.Append( KNSmlDmBMSNAPNamePrefix ); + HBufC8* luidBuf = IntToDes8L( snapId ); + CleanupStack::PushL( luidBuf ); + uriPtr.Append( *luidBuf ); + + Callback().SetMappingL( uriPtr, *luidBuf ); + + BMADAPTERLOGSTRING2( "Creating mapping for URI %S ", &uriPtr ) + CleanupStack::PopAndDestroy( luidBuf ); + CleanupStack::PopAndDestroy( uri ); + } + } + return snapId; +} + +TInt CNSmlDmBmAdapter::GetPredefinedSnapIdFromUri( const TDesC8& aURI ) const + { + TInt ret = KErrNotFound; + + // First check that URI starts with BearerManagementSNAP + TInt startIndex = aURI.Find( KNSmlDmBMAdapterBM ); + + if( startIndex == KErrNotFound ) + { + return KErrNotFound; + } + + // Then assume there is separator + startIndex += KNSmlDmBMAdapterBM().Length() + KNSmlDmBmSeparator().Length(); + + if( startIndex >= aURI.Length() ) + { + // No separator. This was an access to ./BearerManagementSNAP + return KErrNotFound; + } + + TPtrC8 predefinedUriStart = aURI.Mid( startIndex ); + + startIndex = predefinedUriStart.Find( KNSmlDmBMSNAPNamePrefix ); + + // Result should be zero ( = start of string) + if( startIndex != 0 ) + { + return KErrNotFound; + } + + startIndex += KNSmlDmBMSNAPNamePrefix().Length(); + + TInt endIndex = 0; + + endIndex = predefinedUriStart.Find( KNSmlDmBmSeparator ); + + + + if ( endIndex == KErrNotFound ) + { + TPtrC8 snapId = predefinedUriStart.Mid( startIndex ); + TRAPD( err, ret = DesToIntL( snapId ) ); + if( err != KErrNone ) + { + ret = KErrNotFound; + } + } + else + { + TPtrC8 snapId = predefinedUriStart.Mid( startIndex, endIndex - startIndex ); + TRAPD( err, ret = DesToIntL( snapId ) ); + if( err != KErrNone ) + { + ret = KErrNotFound; + } + } + return ret; + } + + + +//---------------------- CSmlDmBmCommandElement -------------------------// + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement* CSmlDmBmCommandElement::NewLC +// -------------------------------------------------------------------------- + +CSmlDmBmCommandElement* CSmlDmBmCommandElement::NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + CSmlDmBmCommandElement* self = new (ELeave) CSmlDmBmCommandElement( aLeaf, + aStatusRef, + aResultRef, + aCmdType ); + CleanupStack::PushL(self); + self->ConstructL( aLastUriSeg, aData ); + return self; + } + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement::~CSmlDmBmCommandElement +// -------------------------------------------------------------------------- +CSmlDmBmCommandElement::~CSmlDmBmCommandElement() + { + delete iLastUriSeg; + delete iData; + } + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement::CSmlDmBmCommandElement +// -------------------------------------------------------------------------- +CSmlDmBmCommandElement::CSmlDmBmCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType ) + : iStatus( CSmlDmAdapter::EError ), + iLeaf( aLeaf ), + iStatusRef( aStatusRef ), + iResultRef( aResultRef ), + iCmdType( aCmdType ), + iData( NULL ) + + { + } + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement::ConstructL +// -------------------------------------------------------------------------- +void CSmlDmBmCommandElement::ConstructL( const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + iLastUriSeg = aLastUriSeg.AllocL(); + iData = aData.AllocL(); + } + +//---------------------- CSmlDmBmSettingsElement -------------------------// + +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement* CSmlDmBmSettingsElement::NewLC +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement* CSmlDmBmSettingsElement::NewLC( const TDesC8& aMappingName ) + { + CSmlDmBmSettingsElement* self = new (ELeave) CSmlDmBmSettingsElement(); + CleanupStack::PushL(self); + self->ConstructL( aMappingName ); + return self; + } +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement::~CSmlDmBmSettingsElement +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement::~CSmlDmBmSettingsElement() + { + // deallocate all elements + iNodeBuf.ResetAndDestroy(); + iNodeBuf.Close(); + delete iMappingName; + } + +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement::CSmlDmBmSettingsElement +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement::CSmlDmBmSettingsElement() + : iExecuted( EFalse ), + iLuid( 0 ), + iMappingName( NULL ) + { + + } +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement::ConstructL +// -------------------------------------------------------------------------- +void CSmlDmBmSettingsElement::ConstructL( const TDesC8& aMappingName ) + { + iMappingName = aMappingName.AllocL(); + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/src/nsmldmbmadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/src/nsmldmbmadapter.rss Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* 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 "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: Resource definitions for project nsmldmbmadapter +* +*/ + + + +#include + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101f6d2f; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x102018B4; //DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101f6d2f; // BM adapter implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/nsmldmbmadapter/src/nsmldmbmsettingstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/nsmldmbmadapter/src/nsmldmbmsettingstore.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,851 @@ +/* +* 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 "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: Provides settings management in CommsDat. +* +*/ + + + + +#include +#include +#include +#include +#include + +#include "nsmldmbmsettingstore.h" +#include "nsmldmbmadapter.h" +#include "bmadapterlogger.h" + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::NewL +// ----------------------------------------------------------------------------- +CNSmlDmBmSettingStore* CNSmlDmBmSettingStore::NewL( CNSmlDmBmAdapter * aAdapter ) + { + CNSmlDmBmSettingStore* self = new (ELeave) CNSmlDmBmSettingStore( aAdapter ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::CNSmlDmBmSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmBmSettingStore::CNSmlDmBmSettingStore( CNSmlDmBmAdapter * aAdapter ) + : iAdapter( aAdapter ) + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ConstructL +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::ConstructL() + { + iCmManagerExt.OpenL(); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::~CNSmlDmBmSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmBmSettingStore::~CNSmlDmBmSettingStore() + { + iCmManagerExt.Close(); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::StoreSnapL +// Stores data related to a snap object. Executes commands for the snap and fills +// in status and for get commands result values. +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::StoreSnapL( CSmlDmBmSettingsElement& aSettings ) + { + // this snap has been handled + aSettings.SetExecuted( ETrue ); + + // error empty settings object + if ( !aSettings.NodeBuf().Count() ) + { + BMADAPTERLOGSTRING( "StoreSnapL: Error, No commands found" ) + return; + } + + TInt nameCmdInd( -1 ); + TInt startInd( 0 ); + RCmDestinationExt snap; + TInt snapId( 0 ); + + // New SNAP to be stored, first command is add node + if( !aSettings.NodeBuf()[0]->Leaf() && + aSettings.NodeBuf()[0]->CmdType() == CNSmlDmBmAdapter::EAddCmd) + { + CSmlDmBmCommandElement* snapCmd( NULL ); + CSmlDmBmCommandElement* nameCmd( NULL ); + + snapCmd = aSettings.NodeBuf()[0]; + startInd = 1; + + // find name command + for ( TInt i( 0 ); i < aSettings.NodeBuf().Count(); i++) + { + if ( aSettings.NodeBuf()[i]->Leaf() && + !aSettings.NodeBuf()[i]->LastUriSeg()->Compare( KNSmlDmBMAdapterName ) ) + { + nameCmd = aSettings.NodeBuf()[i]; + nameCmdInd = i; + break; + } + } + // Snap can be created when name cmd exists + if ( snapCmd && nameCmd ) + { + HBufC* name = HBufC::NewLC( nameCmd->Data()->Size() ); + TPtr namePtr = name->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, *nameCmd->Data() ); + snap = iCmManagerExt.CreateDestinationL( namePtr ); + CleanupStack::PopAndDestroy( name ); + CleanupClosePushL( snap ); + + snap.UpdateL(); + snapCmd->SetStatus( CSmlDmAdapter::EOk ); + nameCmd->SetStatus( CSmlDmAdapter::EOk ); + snapCmd->SetExecuted( ETrue ); + nameCmd->SetExecuted( ETrue ); + aSettings.SetLuid( snap.Id() ); + } + else + { + BMADAPTERLOGSTRING( "StoreSnapL: Error, SNAP doesn't have necessary data and can't be stored" ) + return; + } + } + // existing SNAP + else + { + snap = iCmManagerExt.DestinationL( aSettings.Luid() ); + CleanupClosePushL( snap ); + } + snapId = snap.Id(); + TInt err( KErrNone ); + // execute all remaining commands for the snap + // starting after add node cmd + for ( TInt i( startInd ); i < aSettings.NodeBuf().Count(); i++ ) + { + // name command is already executed -> skipped + if ( i != nameCmdInd ) + { + CSmlDmBmCommandElement* currentCmd = aSettings.NodeBuf()[i]; + // handle leaf commands + // leaves are trapped and if possible + // execution continues with remaining commands + if ( currentCmd->Leaf() ) + { + // name + if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterName() ) ) + { + // name is set more than once within same message + TRAP( err, ExecuteNameCmdL( *currentCmd, snap ) ); + } + // metadata + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterMetadata ) ) + { + TRAP( err, ExecuteMetadataCmdL( *currentCmd, snap ) ); + } + // protected + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterProtected ) ) + { + TRAP( err, ExecuteProtectionCmdL( *currentCmd, snap ) ); + } + // hidden + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterHidden ) ) + { + TRAP( err, ExecuteHiddenCmdL( *currentCmd, snap ) ); + } + // iap list + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterIAPPriorityList ) ) + { + TRAP( err, ExecuteIapsCmdL( *currentCmd, snap ) ); + } + // embedded snap + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterEmbeddedSNAP ) ) + { + TRAP( err, ExecuteEmbeddedSnapCmdL( *currentCmd, snap ) ); + } + else + { + // invalid node + BMADAPTERLOGSTRING( "StoreSnapL: Error, Invalid node name" ) + currentCmd->SetStatus( CSmlDmAdapter::ENotFound ); + err = KErrNone; + } + } + // snap node + else + { + TRAP( err, ExecuteSnapCmdL( *currentCmd, snap.Id() ) ); + // no more commands will be executed + // after snap is deleted + if( currentCmd->CmdType() == CNSmlDmBmAdapter::EDeleteCmd ) + { + break; + } + } + + // handle errors, check if execution may continue + if( err != KErrNone ) + { + // cases where not worth continuing + // attempt to return status codes however + if( err == KErrNoMemory ) + { + currentCmd->SetStatus( CSmlDmAdapter::ENoMemory ); + currentCmd->SetExecuted( ETrue ); + break; + } + else if( err == KErrDiskFull ) + { + currentCmd->SetStatus( CSmlDmAdapter::EDiskFull ); + currentCmd->SetExecuted( ETrue ); + break; + } + // cases where command execution continues + else if( err == KErrNotFound ) + { + currentCmd->SetStatus( CSmlDmAdapter::ENotFound ); + } + else if( err == KErrArgument ) + { + currentCmd->SetStatus( CSmlDmAdapter::EInvalidObject ); + } + else + { + currentCmd->SetStatus( CSmlDmAdapter::EError ); + } + // if error occurred, reopen snap to dismis any changes + // continue with rest of buffered commands + CleanupStack::PopAndDestroy( &snap ); + snap = iCmManagerExt.DestinationL( snapId ); + CleanupClosePushL( snap ); + } + // if leaf cmd execution was successful and data written -> update the snap + else if( currentCmd->Leaf() && + currentCmd->Status() == CSmlDmAdapter::EOk && + currentCmd->CmdType() != CNSmlDmBmAdapter::EGetCmd && + currentCmd->CmdType() != CNSmlDmBmAdapter::EGetSizeCmd ) + { + snap.UpdateL(); + } + else + { + BMADAPTERLOGSTRING( + "StoreSnapL: Leaf cmd execution unsuccessful" ) + } + currentCmd->SetExecuted( ETrue ); + + } + } + CleanupStack::PopAndDestroy( &snap ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteCmdL +// Executes a single command +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::ExecuteCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid) + { + if( !aCmd.Leaf() ) + { + ExecuteSnapCmdL( aCmd, aLuid ); + } + else + { + // snap can be opened + RCmDestinationExt snap = iCmManagerExt.DestinationL( aLuid ); + CleanupClosePushL( snap ); + // name + if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterName ) ) + { + ExecuteNameCmdL( aCmd, snap ); + } + // iap list + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterIAPPriorityList ) ) + { + ExecuteIapsCmdL( aCmd, snap ); + } + // metadata + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterMetadata ) ) + { + ExecuteMetadataCmdL( aCmd, snap ); + } + // protected + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterProtected ) ) + { + ExecuteProtectionCmdL( aCmd, snap ); + } + // hidden + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterHidden ) ) + { + ExecuteHiddenCmdL( aCmd, snap ); + } + // embedded snap + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterEmbeddedSNAP ) ) + { + ExecuteEmbeddedSnapCmdL( aCmd, snap ); + } + else + { + // invalid node + BMADAPTERLOGSTRING( "ExecuteCmdL: Error, Invalid node name" ) + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + } + // update snap if necessary + if( aCmd.Status() == CSmlDmAdapter::EOk && + aCmd.CmdType() != CNSmlDmBmAdapter::EGetCmd && + aCmd.CmdType() != CNSmlDmBmAdapter::EGetSizeCmd) + { + snap.UpdateL(); + } + aCmd.SetExecuted( ETrue ); + CleanupStack::PopAndDestroy( &snap ); + } + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::GetSnapsL +// Fetches all snap ids +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::GetSnapsL( RArray& aLUIDArray ) + { + iCmManagerExt.AllDestinationsL( aLUIDArray); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteSnapCmdL +// Executes a command for snap node. Either delete or get, adds are handled +// in StoreSNAPL +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::ExecuteSnapCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid ) + { + RCmDestinationExt snap = iCmManagerExt.DestinationL( aLuid ); + CleanupClosePushL( snap ); + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd ) + { + TBool found( EFalse ); + // get child node list + + // check if snap has embedded snap + for ( TInt i(0), c = snap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = snap.ConnectionMethodL( i ); + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + found = ETrue; + break; + } + } + if( found ) + { + aCmd.SetDataL( KNSmlDmBMAllLeafNodes ); + } + else + { + aCmd.SetDataL( KNSmlDmBMAllLeafNodesNoEmbedded ); + } + + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + CleanupStack::PopAndDestroy( &snap ); + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EDeleteCmd ) + { + snap.DeleteLD(); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + CleanupStack::Pop( &snap ); + } + else + { + BMADAPTERLOGSTRING( "ExecuteSnapCmdL: Error, Invalid cmd type" ) + aCmd.SetStatus( CSmlDmAdapter::EError ); + CleanupStack::PopAndDestroy( &snap ); + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteIapsCmdL +// Executes an iap list command (add or get). +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteIapsCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + // for add command replace the list of iaps with the new one + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + // remove old iaps + for( TInt i(0); i < aSnap.ConnectionMethodCount(); ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // if iap, remove + if ( !cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + aSnap.RemoveConnectionMethodL( cm ); + } + // otherwise skip the ebedded snap entry + else + { + i++; + } + } + // add new list of iaps + RArray iaps = iAdapter->GetIdArrayL( *aCmd.Data() ); + CleanupClosePushL( iaps ); + TInt wildcard(0); + for ( TInt i( 0 ); i < iaps.Count(); i++ ) + { + RCmConnectionMethodExt cm = iCmManagerExt.ConnectionMethodL( iaps[i] ); + aSnap.AddConnectionMethodL( cm ); + if ( aSnap.PriorityL( cm ) != CMManager::KDataMobilitySelectionPolicyPriorityWildCard ) + { + // set the priority of iap as it's index in the list + // but preceding any iaps with wildcard priority. + aSnap.ModifyPriorityL( cm, i - wildcard ); + } + else + { + wildcard++; + } + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + CleanupStack::PopAndDestroy( &iaps ); + } + // for get command fetch the list of iaps + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + RArray ids; + CleanupClosePushL( ids ); + for ( TInt i(0), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + // if not embedded snap or hidden, insert into iap list + // (hidden iaps not handled by internet adapter, so link won't be found) + if( !aSnap.ConnectionMethodL(i).GetBoolAttributeL( CMManager::ECmDestination ) && + !aSnap.ConnectionMethodL(i).GetBoolAttributeL( CMManager::ECmHidden ) ) + { + ids.Insert( aSnap.ConnectionMethodL(i).GetIntAttributeL( + CMManager::ECmIapId ), i ); + } + } + if ( ids.Count() > 0) + { + HBufC8* iapList = iAdapter->GetIapListL( ids ); + CleanupStack::PushL( iapList ); + aCmd.SetDataL( *iapList ); + CleanupStack::PopAndDestroy( iapList ); + } + else + { + aCmd.SetDataL( KNullDesC8 ); + } + CleanupStack::PopAndDestroy( &ids ); + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteIapsCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteProtectionCmdL +// Executes an protected command (add or get). +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteProtectionCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + __UHEAP_MARK; + TInt data( iAdapter->DesToIntL( *aCmd.Data() ) ); + // is proper protection level + if ( data == CMManager::EProtLevel0 ) + { + aSnap.SetProtectionL( CMManager::EProtLevel0 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( data == CMManager::EProtLevel1 ) + { + aSnap.SetProtectionL( CMManager::EProtLevel1 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( data == CMManager::EProtLevel2 ) + { + aSnap.SetProtectionL( CMManager::EProtLevel2 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else + { + aCmd.SetStatus( CSmlDmAdapter::EInvalidObject ); + } + __UHEAP_MARKEND; + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* data = iAdapter->IntToDes8L( aSnap.ProtectionLevel() ); + CleanupStack::PushL( data ); + aCmd.SetDataL( *data ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteProtectionCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteHiddenCmdL +// Executes hidden command (add or get) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteHiddenCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + __UHEAP_MARK; + TBool data; + if( iAdapter->DesToBool( *aCmd.Data(), data ) ) + { + aSnap.SetHiddenL( data ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else + { + aCmd.SetStatus( CSmlDmAdapter::EInvalidObject ); + } + __UHEAP_MARKEND; + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* data = iAdapter->BoolToDes8LC( aSnap.IsHidden() ); + aCmd.SetDataL( *data ); + CleanupStack::PopAndDestroy( data ); + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteHiddenCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteMetadataCmdL +// Executes metadata command (add or get) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteMetadataCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + __UHEAP_MARK; + + TInt data( iAdapter->DesToIntL( *aCmd.Data() ) ); + // AND with inversed bit masks to check if data + // has bits set that are not defined for metadata + if( ( data & + ~CMManager::ESnapMetadataHighlight & + ~CMManager::ESnapMetadataHiddenAgent & + ~CMManager::ESnapMetadataPurpose ) ) + { + aCmd.SetStatus( CSmlDmAdapter::EError ); + } + // set value for each metadata bit + else + { + aSnap.SetMetadataL( CMManager::ESnapMetadataHighlight, + CMManager::ESnapMetadataHighlight & data ); + aSnap.SetMetadataL( CMManager::ESnapMetadataHiddenAgent, + CMManager::ESnapMetadataHiddenAgent & data ); + aSnap.SetMetadataL( CMManager::ESnapMetadataPurpose, + ( CMManager::ESnapMetadataPurpose & data ) >> KShift8 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + __UHEAP_MARKEND; + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + // get all metadata values + TInt metadata(0); + metadata = aSnap.MetadataL( CMManager::ESnapMetadataHighlight ) + + aSnap.MetadataL( CMManager::ESnapMetadataHiddenAgent ) + + ( aSnap.MetadataL( CMManager::ESnapMetadataPurpose ) << KShift8 ); + HBufC8* data = iAdapter->IntToDes8L( metadata ); + CleanupStack::PushL( data ); + aCmd.SetDataL( *data ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteMetadataCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteEmbeddedSnapCmdL +// Executes embedded snap command (add, get or delete) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteEmbeddedSnapCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + // Remove ./ from beginning of the URI + TPtrC8 embeddedUri = aCmd.Data()->Mid( KNSmlDmBmAdapterURIPrefix().Length() ); + + // if the embedded snap is still in buffer it's stored here + iAdapter->StoreSnapIfBufferedL( embeddedUri ); + // LUID mapping is assumed done by this time + + // get SNAP id for the URI + HBufC8* luid = iAdapter->GetLuidAllocL( embeddedUri ); + CleanupStack::PushL( luid ); + if ( luid->Size() > 0 ) + { + TInt id = iAdapter->DesToIntL( *luid ); + + // open snap with the id + RCmDestinationExt embedded = iCmManagerExt.DestinationL( id ); + CleanupClosePushL( embedded ); + + // check if snap has an existing embedded snap + for ( TInt i(0), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // remove existing embedded snap before adding new one + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + aSnap.DeleteConnectionMethodL( cm ); + break; + } + } + aSnap.AddEmbeddedDestinationL( embedded ); + CleanupStack::PopAndDestroy( &embedded ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else + { + // no luid for the uri + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: No LUID found for embedded snap" ) + aCmd.SetStatus( CSmlDmAdapter::EInvalidObject ); + } + aCmd.SetExecuted( ETrue ); + CleanupStack::PopAndDestroy( luid ); + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + // get destination + TInt embeddedId( -1 ); + for ( TInt i( 0 ), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // check if embedded + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + // get snap id + embeddedId = cm.GetIntAttributeL( CMManager::ECmId ); + + // CMManager::ECmId returns element id, + // GetSnapUriFromLuidL needs record id + embeddedId = ( embeddedId & KCDMaskShowRecordId ) >> KShift8; + + HBufC8* embeddedUri = iAdapter->GetSnapUriFromLuidL( embeddedId ); + CleanupStack::PushL( embeddedUri ); + + if( !embeddedUri ) + { + embeddedId = -1; + break; + } + aCmd.SetDataL( *embeddedUri ); + CleanupStack::PopAndDestroy( embeddedUri ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + break; + } + } + // if no embedded snap exists return not found + if ( embeddedId < 0 ) + { + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Get, No embedded snap found" ) + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + aCmd.SetExecuted( ETrue ); + } + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EDeleteCmd ) + { + TBool found( EFalse); + for ( TInt i( 0 ), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // find embedded snap and delete it + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + found = ETrue; + aSnap.DeleteConnectionMethodL( cm ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + break; + } + } + if ( !found ) + { + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Delete, No embedded snap found" ) + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + aCmd.SetExecuted( ETrue ); + } + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + aCmd.SetExecuted( ETrue ); + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Error, command not supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteNameCmdL +// Executes name command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteNameCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + HBufC* name = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr namePtr = name->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, *aCmd.Data() ); + aSnap.SetNameL( namePtr ); + CleanupStack::PopAndDestroy( name ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC* data = aSnap.NameLC(); + HBufC8* data8 = HBufC8::NewLC( data->Size() ); + TPtr8 toPtr = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + aCmd.SetDataL( *data8 ); + CleanupStack::PopAndDestroy( data8 ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/data/wlanctrldcmoadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/data/wlanctrldcmoadapter.rss Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,49 @@ +/* + * ============================================================================== + * 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 "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 "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x20022FB5; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2001FD40; + implementations = + { + // Info for WlanCtrlDCMOAdapter + IMPLEMENTATION_INFO + { + implementation_uid = 0x20022FB4; + version_no = 1; + display_name = "WlanCtrlDCMOAdapter"; + default_data = "text/wml||Allow/Disallow Wifi."; + opaque_data = "WLAN"; + } + }; + } + }; + } + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/group/bld.inf Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,32 @@ +/* + * ============================================================================== + * 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 "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 + +PRJ_PLATFORMS + +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +wlanctrldcmoadapter.mmp + + diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/group/wlanctrldcmoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/group/wlanctrldcmoadapter.mmp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,43 @@ +/* + * ============================================================================== + * 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 "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 + +//CAPABILITY CAP_ECOM_PLUGIN +CAPABILITY CAP_GENERAL_DLL +TARGET wlanctrldcmoadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20022FB5 +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +USERINCLUDE ../inc + +SOURCEPATH ../data +START RESOURCE wlanctrldcmoadapter.rss +TARGET wlanctrldcmoadapter.rsc +END + +LIBRARY euser.lib ECom.lib featmgr.lib +LIBRARY efsrv.lib commonengine.lib + +SOURCEPATH ../src +SOURCE wlanctrldcmoadapterproxy.cpp wlanctrldcmoadapter.cpp diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/inc/wlanctrldcmoadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/inc/wlanctrldcmoadapter.h Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,60 @@ +// +/* + * ============================================================================== + * 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 "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 _WlanCtrlDCMOAdapter__ +#define _WlanCtrlDCMOAdapter__ + +#include "dcmointerface.h" +#include "dcmoconst.h" + +// An implementation of the CDCMOInterface definition +class CWLanCtrlDCMOAdapter : public CDCMOInterface + { +public: + // Standardised safe construction which leaves nothing the cleanup stack. + static CWLanCtrlDCMOAdapter* NewL(TAny* aInitParams); + + // Destructor + ~CWLanCtrlDCMOAdapter(); + + // Implementation of CDCMOInterface + virtual TDCMOStatus GetDCMOPluginIntAttributeValueL( TDCMONode aId, TInt& aValue); + virtual TDCMOStatus GetDCMOPluginStrAttributeValueL( TDCMONode aId, TDes& aStrValue); + virtual TDCMOStatus SetDCMOPluginIntAttributeValueL( TDCMONode aId, TInt aValue); + virtual TDCMOStatus SetDCMOPluginStrAttributeValueL( TDCMONode aId, const TDes& aStrValue); + virtual void GetLocalizedNameL( HBufC*& aLocName ); + +private: + // Construction + CWLanCtrlDCMOAdapter(TAny* aInitParams); + void ConstructL(); + TDCMOStatus MapFeatureControlError( TInt aErrorCode ); + +private: + // Data to pass back from implementation to client + HBufC* iProperty; + HBufC* iDescription; + // Parameters taken from client + CDCMOInterface::TDCMOInterfaceInitParams* iInitParams; + + + }; + +#endif diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/rom/wlanctrldcmoadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/rom/wlanctrldcmoadapter.iby Thu Jan 07 12:39:15 2010 +0200 @@ -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 "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 + +#ifndef __WLANCTRLDCMOADAPTER_IBY__ +#define __WLANCTRLDCMOADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected + +ECOM_PLUGIN(wlanctrldcmoadapter.dll,wlanctrldcmoadapter.rsc) + +#endif // __SYNCML_DM + +#endif //__WLANCTRLDCMOADAPTER_IBY__ \ No newline at end of file diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/src/wlanctrldcmoadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/src/wlanctrldcmoadapter.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,208 @@ +/* + * ============================================================================== + * 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 "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 +#include +#include +#include +#include + +#include + +#include "wlanctrldcmoadapter.h" + +_LIT( KWlanCtrlProperty, "WLAN" ); +_LIT( KDisableWlanDescription, "Used to enable/disable the WLAN connectivity." ); // Description +_LIT( KRuntimeResourceFileName, "z:dcmo.rsc" ); + +TDCMOStatus CWLanCtrlDCMOAdapter::MapFeatureControlError( TInt aErrorCode ) + { + TDCMOStatus status( EDcmoFail ); + + switch ( aErrorCode ) + { + case KErrNone: + status = EDcmoSuccess; + break; + case KErrPermissionDenied: + case KErrAccessDenied: + status = EDcmoAccessDenied; + break; + case KErrNotFound: + status = EDcmoNotFound; + break; + default: + break; + } + return status; + } + +// Construction and destruction functions + +CWLanCtrlDCMOAdapter* CWLanCtrlDCMOAdapter::NewL( TAny* aParams ) + { + CWLanCtrlDCMOAdapter* self = new ( ELeave ) CWLanCtrlDCMOAdapter( aParams ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CWLanCtrlDCMOAdapter::~CWLanCtrlDCMOAdapter() + { + FeatureManager::UnInitializeLib(); + + delete iProperty; + delete iDescription; + } + +CWLanCtrlDCMOAdapter::CWLanCtrlDCMOAdapter( TAny* aInitParams ) +: iInitParams( ( CDCMOInterface::TDCMOInterfaceInitParams* ) aInitParams ) + { + // See ConstructL() for initialisation completion. + } + +void CWLanCtrlDCMOAdapter::ConstructL() + { + // Set up the data to pass back + iProperty = KWlanCtrlProperty().AllocL(); + iDescription = KDisableWlanDescription().AllocL(); + + FeatureManager::InitializeLibL(); + + } + + +// Implementation of CDCMOInterface +TDCMOStatus CWLanCtrlDCMOAdapter::SetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt aValue) +{ + TDCMOStatus status(EDcmoFail); + TInt err( KErrNone ); + + switch( aId ) + { + case EDenyUserEnable: + status = EDcmoNotSupported; + break; + case ENotifyUser: + status = EDcmoNotSupported; + break; + case EEnable: + { + RFeatureControl featureControl; + TUid wlanUid( TUid::Uid( KFeatureIdProtocolWlan ) ); + err = featureControl.Connect(); + + if ( err == KErrNone ) + { + if( aValue == 0 ) + { + // Disable WLAN + err = featureControl.DisableFeature( wlanUid ); + } + else if ( aValue == 1 ) + { + // Enable WLAN + err = featureControl.EnableFeature( wlanUid ); + } + status = MapFeatureControlError( err ); + featureControl.Close(); + } + + } + break; + default: + break; + } + + return status; +} + +TDCMOStatus CWLanCtrlDCMOAdapter::GetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt& aValue) +{ + TDCMOStatus status( EDcmoSuccess ); + + switch(aId) + { + case EGroup: + aValue = EConnectivity; + break; + case EAttached: + aValue = EFalse; + break; + case EEnabled: + aValue = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + break; + case EDenyUserEnable: + aValue = EFalse; + break; + case ENotifyUser: + aValue = ETrue; + break; + case EEnable: + status = EDcmoAccessDenied; + break; + default: + break; + } + + return status; +} + +TDCMOStatus CWLanCtrlDCMOAdapter::SetDCMOPluginStrAttributeValueL( TDCMONode /* aId */, + const TDes& /* aStrValue */ ) +{ + // Nothing to do + TDCMOStatus status( EDcmoFail ); + + return status; +} + +TDCMOStatus CWLanCtrlDCMOAdapter::GetDCMOPluginStrAttributeValueL( TDCMONode aId, TDes& aStrValue ) +{ + TDCMOStatus status( EDcmoSuccess ); + switch( aId ) + { + case EProperty: + aStrValue = *iProperty; + break; + case EDescription: + aStrValue = *iDescription; + break; + default: + status = EDcmoNotFound; + break; + } + + return status; +} + +void CWLanCtrlDCMOAdapter::GetLocalizedNameL( HBufC*& aLocName ) + { + TFileName myFileName; + TParse* parseObj = new(ELeave) TParse(); + TInt errInt = parseObj->Set( KRuntimeResourceFileName(), &KDC_RESOURCE_FILES_DIR, NULL ); + myFileName = parseObj->FullName(); + delete parseObj; + CStringResourceReader* resReader = CStringResourceReader::NewL( myFileName ); + TPtrC buf; + buf.Set(resReader->ReadResourceString(R_DM_RUN_TIME_VAR_WLAN)); + aLocName = buf.AllocL() ; + delete resReader; + } diff -r 3ce708148e4d -r 4490afcb47b1 omadm/omadmextensions/adapters/wlanctrldcmoadapter/src/wlanctrldcmoadapterproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadm/omadmextensions/adapters/wlanctrldcmoadapter/src/wlanctrldcmoadapterproxy.cpp Thu Jan 07 12:39:15 2010 +0200 @@ -0,0 +1,43 @@ +/* + * ============================================================================== + * 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 "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 +#include + +#include "wlanctrldcmoadapter.h" + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{aUid},(aFuncPtr)} +#endif + + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x20022FB4, CWLanCtrlDCMOAdapter::NewL), + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } +