omadm/omadmextensions/adapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h
changeset 18 7d11f9a6646f
parent 4 75a71fdb4c92
child 21 c707676bf59f
equal deleted inserted replaced
4:75a71fdb4c92 18:7d11f9a6646f
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    DM Settings adapter header file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __NSMLDMSETTINGSADAPTER12_H__
       
    22 #define __NSMLDMSETTINGSADAPTER12_H__
       
    23 
       
    24 
       
    25 // INCLUDES
       
    26 #include <utf.h>
       
    27 #include <smldmadapter.h>
       
    28 #include <SyncMLClientDM.h>
       
    29 #include "NSmlPrivateAPI.h"
       
    30 
       
    31 // CONSTANTS
       
    32 const TInt KNSmlDMGranularity = 4;
       
    33 const TUint8 KNSmlDMColon = ':';
       
    34 const TUint8 KNSmlDMUriSeparator = '/';
       
    35 const TInt KPortMaxSize = 65535;
       
    36 const TInt KPortMinSize = 0;
       
    37 //Dynamic Node Posn Const --> DMAcc/DMIDxxx
       
    38 const TInt KDynNodePosn = 2;
       
    39 
       
    40 _LIT8( KNSmlTrueVal, "1" );
       
    41 _LIT8( KNSmlFalseVal, "0" );
       
    42 _LIT8( KNSmlHTTPAuth, 		"NSmlHTTPAuth" );
       
    43 _LIT8( KNSmlHTTPUsername,	"NSmlHTTPUsername" );
       
    44 _LIT8( KNSmlHTTPPassword, 	"NSmlHTTPPassword" );
       
    45 
       
    46 
       
    47 //DDF accepted DM-fieldnames
       
    48 _LIT8( KNSmlDdfId,				"Id" );
       
    49 _LIT8( KNSmlDdfAppId,				"AppID" );
       
    50 _LIT8( KNSmlDdfServerId,		"ServerID" );
       
    51 _LIT8( KNSmlDdfName,			"Name" );
       
    52 _LIT8( KNSmlDdfPrefConRef,			"PrefConRef" );
       
    53 _LIT8( KNSmlDdfToConRef,			"ToConRef" );
       
    54 _LIT8( KNSmlDdfConRef,			"ConRef" );
       
    55 _LIT8( KNSmlDdfAppAddr,			"AppAddr" );
       
    56 _LIT8( KNSmlDdfAddr,			"Addr" );
       
    57 _LIT8( KNSmlDdfAddrType,		"AddrType" );
       
    58 _LIT8( KNSmlDdfPort,			"Port" );
       
    59 _LIT8( KNSmlDdfPortNbr,			"PortNbr" );
       
    60 _LIT8( KNSmlDdfAuthScheme,		"AAuthPref" ); 
       
    61 _LIT8( KNSmlDdfAppAuth,		"AppAuth" );
       
    62 _LIT8( KNSmlDdfAAuthLevel,		"AAuthLevel" );
       
    63 _LIT8( KNSmlDdfAAuthType,		"AAuthType" );
       
    64 _LIT8( KNSmlDdfAAuthName,		"AAuthName" );
       
    65 _LIT8( KNSmlDdfAAuthSecret,		"AAuthSecret" );
       
    66 _LIT8( KNSmlDdfAAuthData,		"AAuthData" );
       
    67 _LIT8( KNSmlDdfExt,		"Ext" );
       
    68 _LIT8( KNSmlDdfServerPW,		"ServerPW" );
       
    69 _LIT8( KNSmlDdfServerNonce,		"ServerNonce" );
       
    70 _LIT8( KNSmlDdfClientUserName,	"UserName" );
       
    71 _LIT8( KNSmlDdfClientPW,		"ClientPW" );
       
    72 _LIT8( KNSmlDdfClientNonce,		"ClientNonce" );
       
    73 _LIT8( KNSmlDdfLocked,		"ProfileLock" );
       
    74 
       
    75 
       
    76 
       
    77 _LIT( KNSmlDdfMConRef,			"MConRef" );
       
    78 
       
    79 //Constant strings 
       
    80 
       
    81 
       
    82 _LIT8( KNSmlDdfAppIdValue,				"w7" );
       
    83 
       
    84 
       
    85 //DDF DM-field descriptions
       
    86 _LIT8( KNSmlDdfAppIdDescription,				"AppID of DMSettings " );
       
    87 _LIT8( KNSmlDdfAddrDescription,				"Host address of the SyncML server, IP or URL" );
       
    88 _LIT8( KNSmlDdfAddrTypeDescription,			"The type of address specified in the Addr node" );
       
    89 _LIT8( KNSmlDdfPortNbrDescription,			"SyncML Server port" );
       
    90 _LIT8( KNSmlDdfAuthSchemeDescription,		"Scheme of authentication" );
       
    91 _LIT8( KNSmlDdfServerIdDescription,			"The ServerId value for this server" );
       
    92 _LIT8( KNSmlDdfNameDescription,				"Displayable name for the SyncML setings" );
       
    93 _LIT8( KNSmlDdfConRefDescription,			"Logical reference to a connectivity node" );
       
    94 _LIT8( KNSmlDdfAuthLevelDescription ,       "AuthLevel of the AppAuth node " );
       
    95 _LIT8( KNSmlDdfAuthNameDescription ,       "AuthName of the AppAuth node " );
       
    96 _LIT8( KNSmlDdfAuthSecretDescription ,       "AuthSecret of the AppAuth node " );
       
    97 _LIT8( KNSmlDdfAuthDataDescription ,       "AuthData of the AppAuth node " );
       
    98 _LIT( KNSmlDdfMConRefDescription,			"Parent to Multiple Connection Reference objects" );
       
    99 
       
   100 
       
   101 //Default data values
       
   102 _LIT( KNSmlDefName,				"DMAdapterIns" );
       
   103 _LIT8( KNSmlDefDMAcc,			"DMAcc" );
       
   104 _LIT8( KNSmlDMStart,			"DMAcc/DMId" );
       
   105 _LIT( KNSmlDefDMIAP,			"AP" );
       
   106 _LIT8( KNSmlDMUriDotSlash,      "./");
       
   107 _LIT8( KNSmlDMNullDesc8,        "");
       
   108 _LIT8(KNSmlIAPId,               "NSmlIapId");
       
   109 
       
   110 _LIT8(KNSmlAddrtype,               "URI");
       
   111 
       
   112 
       
   113 // AuthPref text values
       
   114 _LIT8( KNSmlDMAuthPrefNoAuth,"syncml:auth-none");
       
   115 _LIT8( KNSmlDMAuthPrefBasic, "syncml:auth-basic");
       
   116 _LIT8( KNSmlDMAuthPrefMD5,	 "syncml:auth-md5");
       
   117 _LIT8( KNSmlDMAuthPrefTransport,	 "transport");
       
   118 
       
   119 _LIT8( KNSmlDMAuthTypeBasic, "BASIC");
       
   120 _LIT8( KNSmlDMAuthTypeMD5,	 "DIGEST");
       
   121 _LIT8( KNSmlDMAuthTypeTransport,	 "TRANSPORT");
       
   122 _LIT8( KNSmlDMSettingsHTTP,  "http://" );
       
   123 _LIT8( KNSmlDMSettingsHTTPS, "https://" );
       
   124 
       
   125 _LIT8( KIAPid, "IAPid" );
       
   126 _LIT8( KSegmDMAcc,"AppID/ServerID/Name/PrefConRef/AppAddr/AAuthPref/AppAuth/Ext");
       
   127 _LIT8( KSegmDMAccAppAddr,"Addr/AddrType/Port");
       
   128 _LIT8( KSegmDMAccPortRT,"Port001");
       
   129 _LIT8( KSegmDMAccport,"PortNbr");
       
   130 _LIT8( KSegmDMAccAppAuth,"AAuthLevel/AAuthType/AAuthName/AAuthSecret/AAuthData");
       
   131 _LIT8( KSegmDMAccLocked,"ProfileLock");
       
   132 _LIT8( KSmlDmSlash, "/");
       
   133 _LIT8( KVersion,"1.1" );
       
   134 _LIT8( KMimeType, "text/plain" );
       
   135 _LIT8( KSyncMLText, "SyncML" );
       
   136 _LIT8( KNSmlDMadapterDesc, "DM-Settings DDF description" );
       
   137 _LIT8( KNSmlDMadapterTitle,"DM-Settings title" );
       
   138 
       
   139 _LIT8( KDmAccMatch, "DMAcc/*" );
       
   140 _LIT8( KDmAccMatch3, "DMAcc/*/*" );
       
   141 
       
   142 _LIT8( KDmAccMatch2, "DMAcc" );
       
   143 _LIT8 (KDmAccToConRefMatch, "DMAcc/*/ToConRef");
       
   144 _LIT8 (KDmAccToConRefId, "ConRef001");
       
   145 _LIT8 (KDmAccToConRefFullMatch, "DMAcc/*/ToConRef/ConRef001");
       
   146 _LIT8 (KDmAccAppAddrMatch, "DMAcc/*/AppAddr");
       
   147 _LIT8 (KDmAccAppAddrFullMatch, "DMAcc/*/AppAddr/*");
       
   148 _LIT8 (KDmAccPortMatch, "DMAcc/*/AppAddr/*/Port");
       
   149 _LIT8 (KDmAccExtMatch, "DMAcc/*/Ext");
       
   150 //_LIT8 (KDmAccExtFullMatch, "DMAcc/*/Ext/*");
       
   151 _LIT8 (KDmAccPortFullMatch, "DMAcc/*/AppAddr/*/Port/Port001");
       
   152 _LIT8 (KDmAccAppAuthMatch, "DMAcc/*/AppAuth");
       
   153 _LIT8 (KDmAccAppAuthFullMatch, "DMAcc/*/AppAuth/*");
       
   154 _LIT8 (KDmAccAppAuthSrvMatch, "DMAcc/*/AppAuth/AppAuthSrv");
       
   155 _LIT8 (KDmAccAppAuthCliMatch, "DMAcc/*/AppAuth/AppAuthCli");
       
   156 _LIT8 (KDmAccAppAuthObexMatch, "DMAcc/*/AppAuth/AppAuthObex");
       
   157 _LIT8 (KDmAccAppAuthHttpMatch, "DMAcc/*/AppAuth/AppAuthHttp");
       
   158 _LIT8 (KDmAccAppAuthTransMatch, "DMAcc/*/AppAuth/AppAuthTransport");
       
   159 
       
   160 
       
   161 
       
   162 //_LIT8 (KDmAccAppAuthNodes, "AppAuthSrv/AppAuthCli/AppAuthObex/AppAuthHttp");
       
   163 _LIT8 (KDmAccAppAuthNodes, "AppAuthSrv/AppAuthCli/AppAuthTransport");
       
   164 _LIT8 (KDmAccAppAuthDyn1, "AppAuthSrv"); // serv
       
   165 _LIT8 (KDmAccAppAuthDyn2, "AppAuthCli"); //client
       
   166 _LIT8 (KDmAccAppAuthDyn3, "AppAuthObex"); //obex
       
   167 _LIT8 (KDmAccAppAuthDyn4, "AppAuthHttp");
       
   168 
       
   169 _LIT8 (KDmAccAppAuthTransport, "AppAuthTransport");
       
   170 
       
   171 _LIT8 (KDmAccAppAuthDyn1LUid, "SRVCRED");
       
   172 _LIT8 (KDmAccAppAuthDyn2LUid, "CLCRED");
       
   173 _LIT8 (KDmAccAppAuthDyn3LUid, "OBEX");
       
   174 _LIT8 (KDmAccAppAuthDyn4LUid, "HTTP");
       
   175 
       
   176 _LIT8 (KDmAccAppAuthLevelSrv, "SRVCRED");
       
   177 _LIT8 (KDmAccAppAuthLevelCli, "CLCRED");
       
   178 _LIT8 (KDmAccAppAuthLevelObx, "OBEX");
       
   179 _LIT8 (KDmAccAppAuthLevelHttp, "HTTP");
       
   180 _LIT8(KDmProfileLocked, "Locked");
       
   181 _LIT8(KDmProfileUnLocked, "Unlocked");
       
   182 const TInt KHttpUsed  = 1;
       
   183 const TInt KHttpNotUsed  = 0;
       
   184 
       
   185 
       
   186 // temporary
       
   187 
       
   188 _LIT8 (KDmAccAppAddrId, "Addr001");
       
   189 
       
   190 // NOTE: this enum must match with property array described in 
       
   191 // SyncML_Sync_Agent_Client_API_Specification.doc.
       
   192 enum TNSmlSyncTransportProperties
       
   193 	{
       
   194 	EPropertyIntenetAccessPoint = 0,
       
   195 	EPropertyHttpUsed = 5,
       
   196 	EPropertyHttpUserName = 6,
       
   197 	EPropertyHttpPassword = 7
       
   198 	};
       
   199 
       
   200 
       
   201 // DATA TYPES
       
   202 enum TNSmlDMFieldType
       
   203 	{
       
   204 	EStr,
       
   205 	EInt,
       
   206 	EBin,
       
   207 	EWrong
       
   208 	};
       
   209 
       
   210 enum TNSmlDMLeafType
       
   211 	{
       
   212 	EDMUpdate,
       
   213 	EDMDelete,
       
   214 	EDMUnset
       
   215 	};
       
   216 
       
   217 enum TNSmlDMProfileData
       
   218 	{
       
   219 	EProfileId,
       
   220 	EProfileName,
       
   221 	EProfileIAPId,
       
   222 	EProfileMediumType,
       
   223 	EProfileDMServerUsername,
       
   224 	EProfileDMServerPassword,
       
   225 	EServerNonce,
       
   226 	ESharedSecret,
       
   227 	EClientNonce,
       
   228 	EProfileURL,
       
   229 	EProfilePort,
       
   230 	EServerId,
       
   231 	EAuthenticationRequired,
       
   232 	ESyncAccepted,
       
   233 	EProfileAddrType,
       
   234 	EPRofileServerCred,
       
   235 	EPRofileClientCred,
       
   236 	EProfileHttpUsername,
       
   237 	EProfileHttpPassword,
       
   238 	EProfileAAuthType,
       
   239 	EProfileTransport,
       
   240 	EProfileObexUsername,
       
   241 	EProfileObexPassword,
       
   242 	ETransportAuthName,
       
   243 	EProfileTransportPassword,
       
   244 	EProfileTransportAuthData,
       
   245 	EProfileLock
       
   246 	};
       
   247 
       
   248 enum TAuthenticationType
       
   249 	{
       
   250 	ENoAuth,    //"syncml:auth-none"
       
   251 	EBasic,     //"syncml:auth-basic"
       
   252 	EMD5        //"syncml:auth-md5"
       
   253 	};
       
   254 
       
   255 enum TNSmlDMMediumType
       
   256 	{
       
   257 	ENone,
       
   258     EHttp,
       
   259 	EWsp,
       
   260     EObex
       
   261 	};
       
   262 
       
   263 struct TNSmlDMLeafElement
       
   264 	{
       
   265 	HBufC8 *iUri;
       
   266 	HBufC8 *iData;
       
   267 	TInt iStatusRef;
       
   268 	HBufC8* iLuid;
       
   269 	};
       
   270 
       
   271 struct TNSmlDMBufferElement
       
   272 	{
       
   273 	CArrayFixFlat<TNSmlDMLeafElement> *iLeafBuf;
       
   274 	HBufC8* iMappingName; //Holds the Dyn.Node URI       
       
   275 	TBool iExecuted; //Node updated to dB or not       
       
   276 	TInt iDMBuffStatusref; //Statusref for callback       
       
   277 	TBool iAddr;
       
   278 	TBool iServerId; //Bools for Mandatory fields       
       
   279 	TBool iUName;
       
   280 	TBool iServerName;
       
   281 	};
       
   282 
       
   283 // CLASS DECLARATION
       
   284 /**
       
   285 *  CNSmlDMSettingsAdapter12 class 
       
   286 *  Contains the whole implementation of the DM settings adapter.
       
   287 *
       
   288 *  @lib nsmldmsettingsadapter.dll
       
   289 *  @since Series 60 Series60_3.0
       
   290 */
       
   291 class CNSmlDMSettingsAdapter12 : public CSmlDmAdapter
       
   292 	{
       
   293     public: // Constructors and destructor
       
   294         
       
   295         /**
       
   296         * Two-phased constructor.
       
   297         */
       
   298 	    static CNSmlDMSettingsAdapter12* NewL(MSmlDmCallback* aDmCallback );
       
   299 	    static CNSmlDMSettingsAdapter12* NewLC(MSmlDmCallback* aDmCallback );
       
   300 
       
   301 	    void ConstructL();
       
   302 
       
   303         /**
       
   304         * Destructor.
       
   305         */
       
   306 	    virtual ~CNSmlDMSettingsAdapter12();
       
   307 
       
   308     public: // Functions from base classes
       
   309 
       
   310 	    /**
       
   311         * From      CSmlDmAdapter   DDFVersionL returns current version of the DDF.
       
   312         * @since    Series60_3.0
       
   313         * @param    aVersion        DDF version of the adapter.
       
   314         * @return   none
       
   315         */
       
   316 	    void DDFVersionL( CBufBase& aVersion );
       
   317 
       
   318         /**
       
   319         * From      CSmlDmAdapter   DDFStructureL for filling the DDF structure of the adapter.
       
   320         * @since    Series60_3.0
       
   321         * @param    aDDF            Reference to root object.
       
   322         * @return   none
       
   323         */
       
   324 	    void DDFStructureL( MSmlDmDDFObject& aDDF );
       
   325 
       
   326         /**
       
   327         * From      CSmlDmAdapter   UpdateLeafObjectL creates new leaf objects, or replaces 
       
   328         *                           data in existing leaf objects.
       
   329         * @since    Series60_3.0
       
   330         * @param    aURI            URI of the object
       
   331         * @param    aLUID           LUID of the object
       
   332         * @param    aObject         Data of the object
       
   333         * @param    aType           MIME type of the object
       
   334         * @param    aStatusRef      Reference to correct command
       
   335         * @return   none
       
   336         */
       
   337 	    void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   338                             const TDesC8& aObject, const TDesC8& aType, 
       
   339                             TInt aStatusRef );
       
   340         
       
   341         /**
       
   342         * From      CSmlDmAdapter   DeleteObjectL deletes an object and its child objects.
       
   343         * @since    Series60_3.0
       
   344         * @param    aURI            URI of the object
       
   345         * @param    aLUID           LUID of the object
       
   346         * @param    aStatusRef      Reference to correct command
       
   347         * @return   none
       
   348         */
       
   349 	    void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   350                         const TInt aStatusRef );
       
   351         
       
   352         /**
       
   353         * From      CSmlDmAdapter   FetchLeafObjectL fetches data of a leaf object.
       
   354         * @since    Series60_3.0
       
   355         * @param    aURI            URI of the object
       
   356         * @param    aLUID           LUID of the object
       
   357         * @param    aType           MIME type of the object
       
   358         * @param    aResultsRef    	Reference to correct results
       
   359         * @param    aStatusRef      Reference to correct command
       
   360         * @return   none
       
   361         */
       
   362 	    void FetchLeafObjectL(  const TDesC8& aURI, 
       
   363                             const TDesC8& aLUID, 
       
   364                             const TDesC8& aType, 
       
   365                             const TInt aResultsRef, 
       
   366                             const TInt aStatusRef ); 
       
   367         /**
       
   368         * From      CSmlDmAdapter   ChildURIListL fetches URI list.
       
   369         * @since    Series60_3.0
       
   370         * @param    aURI                    URI of the object
       
   371         * @param    aLUID                   LUID of the object
       
   372         * @param    aPreviousURISegmentList URI list with mapping LUID information
       
   373         * @param    aResultsRef    	        Reference to correct results
       
   374         * @param    aStatusRef              Reference to correct command
       
   375         * @return   none
       
   376         */
       
   377 	    void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   378                         const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   379                         const TInt aResultsRef, const TInt aStatusRef );
       
   380         
       
   381         /**
       
   382         * From      CSmlDmAdapter   AddNodeObjectL adds node object.
       
   383         * @since    Series60_3.0
       
   384         * @param    aURI            URI of the object
       
   385         * @param    aParentLUID     LUID of the parent object
       
   386         * @param    aStatusRef      Reference to correct command
       
   387         * @return   none
       
   388         */
       
   389 	    void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, 
       
   390                             const TInt aStatusRef );
       
   391 
       
   392         /**
       
   393         * From      CSmlDmAdapter   UpdateLeafObjectL creates new leaf objects, or replaces 
       
   394         *                           data in existing leaf objects.
       
   395         * @since    Series60_3.0
       
   396         * @param    aURI            URI of the object
       
   397         * @param    aLUID           LUID of the object
       
   398         * @param    aStream         Data of the object
       
   399         * @param    aType           MIME type of the object
       
   400         * @param    aStatusRef      Reference to correct command
       
   401         * @return   none
       
   402         */
       
   403         void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   404                             RWriteStream*& aStream, const TDesC8& aType, 
       
   405                             const TInt aStatusRef );
       
   406         
       
   407         /**
       
   408         * From      CSmlDmAdapter   FetchLeafObjectSizeL fetches the size of a leaf object.
       
   409         * @since    Series60_3.0
       
   410         * @param    aURI            URI of the object
       
   411         * @param    aLUID           LUID of the object
       
   412         * @param    aType           MIME type of the object
       
   413         * @param    aResultsRef    	Reference to correct results
       
   414         * @param    aStatusRef      Reference to correct command
       
   415         * @return   none
       
   416         */
       
   417 	    void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   418                                 const TDesC8& aType, const TInt aResultsRef, 
       
   419                                 const TInt aStatusRef );
       
   420 
       
   421         /**
       
   422         * From      CSmlDmAdapter   The function implements execute command.
       
   423         * @since    Series60_3.0
       
   424         * @param    aURI            URI of the object
       
   425         * @param    aLUID           LUID of the object
       
   426         * @param    aArgument       Argument for the command
       
   427         * @param    aType       	MIME type of the object
       
   428         * @param    aStatusRef      Reference to correct command
       
   429         * @return   none
       
   430         */
       
   431 	    void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   432                             const TDesC8& aArgument, const TDesC8& aType, 
       
   433                             const TInt aStatusRef );
       
   434 
       
   435         /**
       
   436         * From      CSmlDmAdapter   The function implements execute command.
       
   437         * @since    Series60_3.0
       
   438         * @param    aURI            URI of the object
       
   439         * @param    aLUID           LUID of the object
       
   440         * @param    aStream         Argument for the command
       
   441         * @param    aType       	MIME type of the object
       
   442         * @param    aStatusRef      Reference to correct command
       
   443         * @return   none
       
   444         */
       
   445 	    void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   446                             RWriteStream*& aStream, const TDesC8& aType, 
       
   447                             const TInt aStatusRef );
       
   448         
       
   449         /**
       
   450         * From      CSmlDmAdapter   The function implements execute command.
       
   451         * @since    Series60_3.0
       
   452         * @param    aTargetURI      Target URI for the command
       
   453         * @param    aTargetLUID     LUID of the target object
       
   454         * @param    aSourceURI      Source URI for the command
       
   455         * @param    aSourceLUID    	LUID of the source object
       
   456         * @param    aType           MIME type of the object
       
   457         * @param    aStatusRef      Reference to correct command
       
   458         * @return   none
       
   459         */
       
   460 	    void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, 
       
   461                         const TDesC8& aSourceURI, const TDesC8& aSourceLUID, 
       
   462                         const TDesC8& aType, TInt aStatusRef );
       
   463 	
       
   464         /**
       
   465         * From      CSmlDmAdapter   The function indicates start of Atomic command.
       
   466         * @since    Series60_3.0
       
   467         * @param    none
       
   468         * @return   none
       
   469         */
       
   470         void StartAtomicL();
       
   471 
       
   472         /**
       
   473         * From      CSmlDmAdapter   The function indicates successful end of Atomic command.
       
   474         * @since    Series60_3.0
       
   475         * @param    none
       
   476         * @return   none
       
   477         */
       
   478 	    void CommitAtomicL();
       
   479     
       
   480         /**
       
   481         * From      CSmlDmAdapter   The function indicates unsuccessful end of Atomic command.
       
   482         * @since    Series60_3.0
       
   483         * @param    none
       
   484         * @return   none
       
   485         */
       
   486 	    void RollbackAtomicL();
       
   487 
       
   488         /**
       
   489         * From      CSmlDmAdapter   Returns ETrue if adapter supports streaming otherwise EFalse.
       
   490         * @since    Series60_3.0
       
   491         * @param    aItemSize       Size limit for stream usage.
       
   492         * @return   ETrue or EFalse
       
   493         */
       
   494 	    TBool StreamingSupport( TInt& aItemSize );
       
   495         
       
   496         /**
       
   497         * From      CSmlDmAdapter   Called when stream returned from UpdateLeafObjectL or 
       
   498         *                           ExecuteCommandL has been written to and committed.
       
   499         * @since    Series60_3.0
       
   500         * @param    none
       
   501         * @return   none
       
   502         */
       
   503 	    void StreamCommittedL();
       
   504 
       
   505         /**
       
   506         * From      CSmlDmAdapter   The function tells the adapter that all the commands of the message that
       
   507 	    *                           can be passed to the adapter have now been passed.
       
   508         * @since    Series60_3.0
       
   509         * @param    none
       
   510         * @return   none
       
   511         */
       
   512 	    void CompleteOutstandingCmdsL();
       
   513 	    
       
   514 	     /**
       
   515         * From      CSmlDmAdapter   The function to set profile lock
       
   516         * @since    Series60_3.0
       
   517         * @param    profileId  lockvalue
       
   518         * @return   TInt
       
   519         */
       
   520 	    TInt SetProfileLockL(const TInt aPID, TInt aLockValue);
       
   521 	
       
   522     private:
       
   523 	    
       
   524         /**
       
   525         * C++ default constructor.
       
   526         */
       
   527         CNSmlDMSettingsAdapter12();
       
   528         CNSmlDMSettingsAdapter12( TAny* aEcomArguments );
       
   529 	    
       
   530         /**
       
   531         * The function stores integer value to buffer and returns reference to it.
       
   532         * @param    aObject     data to be stored to buffer.
       
   533         * @return   reference to data buffer.
       
   534         */
       
   535         TDesC8& SetIntObjectLC( const TInt& aObject );
       
   536         
       
   537         /**
       
   538         * The function finds out the last element of the uri.
       
   539         * @param    aSource     Uri object that contains all elements.
       
   540         * @return   KErrNone if successful.
       
   541         */
       
   542 	    TInt SetField( const TDesC8& aSource );
       
   543 	    
       
   544 	    /**
       
   545         * The function sets the uri being set ot get
       
   546         * @param    aSource     Uri object that contains all elements.
       
   547         * @return   KErrNone if successful.
       
   548         */
       
   549 	    TInt SetURIInProcessL( const TDesC8& aSource );
       
   550 	    
       
   551 
       
   552         /**
       
   553         * The function converts data to integer and returns it.
       
   554         * @param    aObject     Data object to be converted.
       
   555         * @return   Integer value for an object.
       
   556         */
       
   557 	    TInt GetIntObject( const TDesC8& aObject );
       
   558 
       
   559         /**
       
   560         * The function converts data to integer and returns it.
       
   561         * @param    aObject     Data object to be converted.
       
   562         * @return   16-bit integer value for an object.
       
   563         */
       
   564 	    TInt GetIntObject16( const TDesC& aObject );
       
   565 
       
   566         /**
       
   567         * The function converts LUID to integer.
       
   568         * @param    aLUID     LUID data to be converted.
       
   569         * @return   Integer value for a LUID.
       
   570         */    
       
   571 	    TInt IntLUID( const TDesC8& aLUID );
       
   572 
       
   573         /**
       
   574         * The function sets the IAP value acording the given URI.
       
   575         * @param    aLUID     LUID for a profile.
       
   576         * @param    aObject   Data object containing the URI.
       
   577         * @return   KErrNone if successfull.
       
   578         */    
       
   579 	    TInt  SetConRefL( const TInt aLUID, const TDesC8& aObject );
       
   580     
       
   581         /**
       
   582         * The function gets the URI for profile IAP.
       
   583         * @param    aObject   Object where the result will be stored.
       
   584         * @return   KErrNone if successfull.
       
   585         */    
       
   586 	    TInt GetConRefL( CBufBase& aObject );
       
   587 	
       
   588         /**
       
   589         * The function checks if field to be handled is valid.
       
   590         * @param    none
       
   591         * @return   ETrue if valid field otherwise EFalse.
       
   592         */    
       
   593     	TBool AcceptDMField();
       
   594 
       
   595         /**
       
   596         * The function checks if field type to be handled is valid.
       
   597         * @param    none
       
   598         * @return   enum value for a field type.
       
   599         */ 
       
   600 	    TNSmlDMFieldType   GetDMFieldType() const;
       
   601 
       
   602         /**
       
   603         * The function returns enum value for a field to be handled.
       
   604         * @param    none
       
   605         * @return   enum value for a field to be handled.
       
   606         */ 
       
   607 	    TNSmlDMProfileData GetDMField() ;
       
   608 
       
   609         /**
       
   610         * The function checks if data length is valid.
       
   611         * @param    aProfileItem    Field / Leaf ID to be handled.
       
   612         * @param    aSource         Data to be handled.
       
   613         * @return   ETrue if data length is valid otherwise EFalse.
       
   614         */ 
       
   615 	    TBool NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, 
       
   616                             const TDesC8& aSource );
       
   617         
       
   618         /**
       
   619         * The function converts 16-bit data to 8-bit and returns reference to it.
       
   620         * @param    aSource    Reference data to be converted.
       
   621         * @return   Reference to 8-bit data buffer.
       
   622         */ 
       
   623 	    TDesC8&  ConvertTo8LC( const TDesC& aSource );
       
   624 
       
   625         /**
       
   626         * The function converts 8-bit data to 16-bit and returns reference to it.
       
   627         * @param    aSource    Reference data to be converted.
       
   628         * @return   Reference to 16-bit data buffer.
       
   629         */ 
       
   630 	    TDesC16& ConvertTo16LC( const TDesC8& aSource );
       
   631 
       
   632         /**
       
   633         * The function find out the port number from URL and stores it to aPort.
       
   634         * @param    aRealURI    Reference data to be containing the whole URI.
       
   635         * @param    aPort       Reference variable where port number will be stored.
       
   636         * @return   KErrNone if successful otherwise KErrNotFound.
       
   637         */ 
       
   638 	    TInt ParseUri( const TDesC8& aRealURI, TInt& aPort );
       
   639 
       
   640         /**
       
   641         * The function opens the server session and profile via client API.
       
   642         * @param    aIntLUID    Integer value for a LUID of the profile.
       
   643         * @param    aMode       Read or Read and Write mode for a profile data.
       
   644         * @return   KErrNone if successful otherwise KErrNotFound.
       
   645         */ 
       
   646         TInt OpenSyncSessionAndProfileL( const TInt aIntLUID, TSmlOpenMode aMode );
       
   647 
       
   648         /**
       
   649         * The function checks if requested profile ID exits.
       
   650         * @param    aIntLUID    Integer value for a LUID of the profile.
       
   651         * @return   ETrue if profile exits otherwise EFalse.
       
   652         */ 
       
   653 	    TBool FindProfileIdL( const TInt aIntLUID );
       
   654 
       
   655         /**
       
   656         * The function creates new DM profile.
       
   657         * @param    aPID    Reference to variable where new profile will be stored.
       
   658         * @return   KErrNone if successful otherwise error code.
       
   659         */ 
       
   660         TInt CreateNewProfileL( TInt& aPID );
       
   661 
       
   662         /**
       
   663         * The function stores the server URL for a profile.
       
   664         * @param    aPID    Profile ID.
       
   665         * @param    aObj    Reference to server URL data.
       
   666         * @return   KErrNone if successful otherwise error code.
       
   667         */ 
       
   668         TInt SetProfileServerURIL( const TInt aPID, const TDesC8& aObj );
       
   669 
       
   670         /**
       
   671         * The function stores the display name for a profile.
       
   672         * @param    aPID    Profile ID.
       
   673         * @param    aObj    Reference to data.
       
   674         * @return   KErrNone if successful otherwise error code.
       
   675         */ 
       
   676         TInt SetProfileDisplayNameL( const TInt aPID, const TDesC8& aObj );
       
   677 
       
   678         /**
       
   679         * The function stores the user name for a profile.
       
   680         * @param    aPID    Profile ID.
       
   681         * @param    aObj    Reference to data.
       
   682         * @return   KErrNone if successful otherwise error code.
       
   683         */ 
       
   684         TInt SetProfileUserNameL( const TInt aPID, const TDesC8& aObj );
       
   685         
       
   686         /**
       
   687         * The function stores the profile http user name for a profile.
       
   688         * @param    aPID    Profile ID.
       
   689         * @param    aObj    Reference to data.
       
   690         * @return   KErrNone if successful otherwise error code.
       
   691         */ 
       
   692         TInt SetProfileHttpUserNameL( const TInt aPID, const TDesC8& aObj );
       
   693         
       
   694 
       
   695         /**
       
   696         * The function stores the protocol version for a profile.
       
   697         * @param    aPID    Profile ID.
       
   698         * @param    aObj    Reference to data.
       
   699         * @return   KErrNone if successful otherwise error code.
       
   700         */ 
       
   701         TInt SetProfileProtocolVersionL( const TInt aPID, const TDesC8& aObj );
       
   702 
       
   703         /**
       
   704         * The function stores the ServerId value for a profile.
       
   705         * @param    aPID    Profile ID.
       
   706         * @param    aObj    Reference to data.
       
   707         * @return   KErrNone if successful otherwise error code.
       
   708         */ 
       
   709         TInt SetProfileServerIdL( const TInt aPID, const TDesC8& aObj );
       
   710 
       
   711         /**
       
   712         * The function stores the Server password for a profile.
       
   713         * @param    aPID    Profile ID.
       
   714         * @param    aObj    Reference to data.
       
   715         * @return   KErrNone if successful otherwise error code.
       
   716         */ 
       
   717         TInt SetProfileServerPasswordL( const TInt aPID, const TDesC8& aObj );
       
   718         
       
   719         /**
       
   720         * The function stores the network/http password for a profile.
       
   721         * @param    aPID    Profile ID.
       
   722         * @param    aObj    Reference to data.
       
   723         * @return   KErrNone if successful otherwise error code.
       
   724         */ 
       
   725         TInt SetProfileHttpPasswordL( const TInt aPID, const TDesC8& aObj );
       
   726         
       
   727 
       
   728         /**
       
   729         * The function stores the password value for a profile.
       
   730         * @param    aPID    Profile ID.
       
   731         * @param    aObj    Reference to data.
       
   732         * @return   KErrNone if successful otherwise error code.
       
   733         */ 
       
   734         TInt SetProfilePasswordL( const TInt aPID, const TDesC8& aObj );
       
   735 
       
   736         /**
       
   737         * The function stores the IAP id value for a profile.
       
   738         * @param    aLUID   Profile ID.
       
   739         * @param    aIAPid  Reference to data.
       
   740         * @return   KErrNone if successful otherwise error code.
       
   741         */ 
       
   742         TInt SetProfileConnectionPropertyL( const TInt aLUID, const TInt aIAPid );
       
   743 
       
   744         /**
       
   745         * The function deleted the profile data.
       
   746         * @param    aPID    Profile ID.
       
   747         * @return   KErrNone if successful otherwise error code.
       
   748         */ 
       
   749         TInt DeleteProfileL( const TInt aPID );
       
   750         
       
   751         /**
       
   752         * The function to tell whether the profile is locked.
       
   753         * @param    aPID   
       
   754         * @return   1 if locked otherwise 0
       
   755         */ 
       
   756         TBool IsProfileLockedL(const TInt aPID);
       
   757         
       
   758         /**
       
   759         * The function gets the profile data acoeding to aDMField.
       
   760         * @param    aLUID       Profile ID.
       
   761         * @param    aDMField    Data field ID to be handled.
       
   762         * @param    aObject     Reference where fetched data to be stored.
       
   763         * @return   KErrNone if successful otherwise error code.
       
   764         */ 
       
   765         TInt GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, 
       
   766                         CBufBase& aObject );
       
   767 
       
   768         /**
       
   769         * The function adds port number to address URL.
       
   770         * @param    aLUID       Profile ID.
       
   771         * @param    aPort       Reference to port number data.
       
   772         * @return   KErrNone if successful otherwise error code.
       
   773         */ 
       
   774         TInt SetProfileConnectionPortNrL( const TInt aLUID, const TDesC8& aPort );
       
   775         
       
   776         /**
       
   777         * The function adds port number to address URL.
       
   778         * @param    aSrvURI     Original address URI.
       
   779         * @param    aNewURI     New URI when port number has been added or deleted.
       
   780         * @param    aPort       Reference to port number data.
       
   781         * @return   KErrNone if successful otherwise error code.
       
   782         */ 
       
   783         void SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, 
       
   784                                 const TDesC8& aPort );
       
   785 
       
   786         /**
       
   787         * General function which selects which leaf to be handled.
       
   788         * @param    aLUID       Profile LUID.
       
   789         * @param    aObject     Data to be stored.
       
   790         * @param    aField      Leaf of field ID to be handled.
       
   791         * @return   KErrNone if successful otherwise error code.
       
   792         */ 
       
   793         TInt SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, 
       
   794                             const TNSmlDMProfileData aField );
       
   795         /**
       
   796         * The function fills the node info.
       
   797         * @param    aNode           Reference to node or leaf which info to be filled.
       
   798         * @param    aAccTypes       Access rights for a leaf / node.
       
   799         * @param    aOccurrence     Occurance of the node / leaf.
       
   800         * @param    aScope          Scope (dynamic / permanent) of the leaf / node.
       
   801         * @param    aFormat         Data format of the leaf / node.
       
   802         * @param    aDescription    Description of the node / leaf.
       
   803         * @param    aDefaultValue   Default value for a leaf or node.
       
   804         * @param    aMimeType       MIME type for a leaf / node.
       
   805         * @return   none
       
   806         */ 
       
   807         void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, 
       
   808                         MSmlDmDDFObject::TOccurence aOccurrence, 
       
   809                         MSmlDmDDFObject::TScope aScope, 
       
   810                         MSmlDmDDFObject::TDFFormat aFormat, 
       
   811                         const TDesC8& aDescription, 
       
   812                         const TDesC8& aDefaultValue, const TDesC8& aMimeType );
       
   813         
       
   814         /**
       
   815         * The function reads the authentication data via private API.
       
   816         * @param    aLUID       LUID for a profile.
       
   817         * @param    aField      Leaf id to be handled.
       
   818         * @param    aObject     Reference where to store the data.
       
   819         * @return   KErrNone if successful otherwise error code.
       
   820         */ 
       
   821         TInt GetDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, 
       
   822                             CBufBase& aObject );
       
   823 
       
   824         /**
       
   825         * The function delete's the authentication data via private API.
       
   826         * @param    aLUID       LUID for a profile.
       
   827         * @param    aField      Leaf id to be handled.
       
   828         * @return   KErrNone if successful otherwise error code.
       
   829         */ 
       
   830         TInt DeleteDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField );
       
   831         
       
   832         /**
       
   833         * The function set's the address type / medium type value for a profile.
       
   834         * @param    aLUID       LUID for a profile.
       
   835         * @param    aIntObj     Address type value.
       
   836         * @return   KErrNone if successful otherwise error code.
       
   837         */ 
       
   838         TInt SetProfileAddrTypeL( const TInt aLUID, const TInt aIntObj );
       
   839 
       
   840         /**
       
   841         * The function gets the profile medium type value.
       
   842         * @param    aObject     Reference where data to be stored.
       
   843         * @return   KErrNone if successful otherwise error code.
       
   844         */ 
       
   845         TInt GetProfileConnectiontypeL( TInt& aMediumTYpe );
       
   846         
       
   847         /**
       
   848         * The function gets the profile http user name of value.
       
   849         * @param    aObject     Reference where data to be stored.
       
   850         * @return   KErrNone if successful otherwise error code.
       
   851         */ 
       
   852         TInt GetHttpUsernameL( CBufBase& aObject );
       
   853         
       
   854        
       
   855         /**
       
   856         * The function gets the profile IAP value.
       
   857         * @param    aIAPid     Reference where data to be stored.
       
   858         * @return   KErrNone if successful otherwise error code.
       
   859         */ 
       
   860         TInt GetProfileIAPIdL( TInt& aIAPid );
       
   861 
       
   862         /**
       
   863         * The function gets the profile Server URL value.
       
   864         * @param    aURL     Reference where data to be stored.
       
   865         * @return   KErrNone if successful otherwise error code.
       
   866         */ 
       
   867         void GetProfileServerURLL( CBufBase& aURL );
       
   868 
       
   869         /**
       
   870         * The function checks the requested medium type if supported.
       
   871         * @param    aIntObj         Medium type.
       
   872         * @param    aMediumType     UID for medium type.
       
   873         * @return   none
       
   874         */         
       
   875         void GetMediumTypeL( const TInt aIntObj, TInt& aMediumType );
       
   876 
       
   877         /**
       
   878         * The function gets the server id value.
       
   879         * @param    aObject     Reference where data to be stored.
       
   880         * @return   none
       
   881         */       
       
   882         void GetServerIdL( CBufBase& aObject );
       
   883 
       
   884         /**
       
   885         * The function gets the profile name value.
       
   886         * @param    aObject     Reference where data to be stored.
       
   887         * @return   none
       
   888         */       
       
   889         void GetProfileNameL( CBufBase& aObject );
       
   890 
       
   891         /**
       
   892         * The function gets the user name value.
       
   893         * @param    aObject     Reference where data to be stored.
       
   894         * @return   none
       
   895         */ 
       
   896         void GetProfileUserNameL( CBufBase& aObject );
       
   897 
       
   898         /**
       
   899         * The function gets the profile port number value.
       
   900         * @param    aObject     Reference where data to be stored.
       
   901         * @return   none
       
   902         */ 
       
   903         void GetProfilePortNumberL( CBufBase& aObject );
       
   904 
       
   905         /**
       
   906         * The function sets the profile authentication info via private API.
       
   907         * @param    aLUID       Profile LUID.
       
   908         * @param    aField      Leaf ID to be handled.
       
   909         * @param    aObject     Data to be stored.
       
   910         * @param    aStatus     Status of the function, KErrNone if successful.
       
   911         * @return   none
       
   912         */         
       
   913         void SetAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, 
       
   914                         const TDesC8& aObject, TInt& aStatus );
       
   915 	//Buffers Node Object <>     
       
   916 	void AddNodeBufferL( const TDesC8& aURI, const TInt aStatusRef);
       
   917 
       
   918 	//Buffers Leaf Object       
       
   919 	void AddLeafBufferL( const TDesC8& aURI, const TDesC8& aObject,
       
   920 			const TInt aStatusRef);
       
   921 	// Executes Buffer       
       
   922 	void ExecuteBufferL();
       
   923 	//Extracts the ParentURI       
       
   924 	TPtrC8 ParentURI(const TDesC8& aURI);
       
   925 	// Clears the elements of the passed in LeafElement Structure
       
   926 	void ClearBuffer( CArrayFixFlat<TNSmlDMLeafElement>* aBuffer);
       
   927 	/**
       
   928         * The function checks if requested ServerID ID exits.
       
   929         * @param    aServerid    ServerID.
       
   930         * @return   ETrue if ServerID exits otherwise EFalse.
       
   931   */ 
       
   932 	TBool IsServerIDExistL( const TDesC8& aServerid );
       
   933 	
       
   934 	/**
       
   935         * The function checks if the URI is of format ./DMAcc/DMId<num>
       
   936         * Example ./DMAcc/DMId000 
       
   937         * @param    aURI       aURI.
       
   938         * @return   true/false
       
   939   */                          
       
   940   TBool IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI);
       
   941         
       
   942   /**
       
   943         * The function constructs ./DMAcc/x nodes and
       
   944         * returns the profile ID matching the aURI.
       
   945         * @param    aURI       aURI.
       
   946         * @return   KErrNotFound/ProfileID
       
   947   */  
       
   948         
       
   949   TInt ConstructTreeL(const TDesC8& aURI);
       
   950   
       
   951     /**
       
   952         * The function extracts DMAcc/x node from aURI		        
       
   953         * @param    aURI     DMAcc aURI.
       
   954         * @return   DMAcc/x node.
       
   955     */ 
       
   956   TPtrC8 GetDynamicDMNodeUri(const TDesC8& aURI);
       
   957 
       
   958     private:    // Data
       
   959 	
       
   960         // Client API session class 
       
   961         RSyncMLSession iSyncSession;
       
   962         // Client API Device Management profile handling
       
   963         RSyncMLDevManProfile iProfile;
       
   964         // Callback interface for returning result or status
       
   965 	    MSmlDmCallback* iCallBack;
       
   966 	    
       
   967 	    TInt iCurrentProfile;
       
   968 	    
       
   969         // Profile LUID
       
   970         TInt iLUID;
       
   971         // Parent LUID
       
   972 	    TInt iParentLUID;
       
   973         // For handling profile medium type 
       
   974 	    TInt iObject;
       
   975                   
       
   976         // Buffer for URI leaf element
       
   977 	    HBufC8* iField;
       
   978 	    
       
   979         HBufC8* iURIField;
       
   980         TBool iNewProfile;
       
   981         // Information about data type
       
   982 	    TNSmlDMFieldType  iFieldType;
       
   983         // Information about leaf command
       
   984 	    TNSmlDMLeafType	  iLeafType;
       
   985         // Status information if session allready opened
       
   986         TBool iSyncSessionOpen;
       
   987 
       
   988         // Buffer for storing port number
       
   989         HBufC8* iPortNbr;
       
   990     
       
   991         // Private API interface for handling authebtication data
       
   992         RNSmlPrivateAPI iPrivateApi;
       
   993         
       
   994         struct TPortBuffer
       
   995             {
       
   996             // buffered data for updating port number
       
   997             TBufC8<5> iPortBuf;
       
   998             TInt iPortBufLUID;
       
   999             TInt iPortBufStatusRef;
       
  1000             };
       
  1001         RArray<TPortBuffer> iPortBuffer;
       
  1002         
       
  1003         struct TLockBuffer
       
  1004             {
       
  1005             // buffered data for profile lock
       
  1006             TInt iProfileLock;
       
  1007             TInt iProfileLockLUID;
       
  1008             TInt iProfileLockStatusRef;
       
  1009             };   
       
  1010         RArray<TLockBuffer> iProfileLockBuffer; 
       
  1011             
       
  1012 	TBool iBufOn;
       
  1013 	TBool iComplete;
       
  1014 	TInt iExecutionIndex;
       
  1015 	CArrayFixFlat<TNSmlDMBufferElement> *iBuffer;
       
  1016     };
       
  1017 
       
  1018 #endif // __NSMLDMSETTINGSADAPTER12_H__
       
  1019 
       
  1020 // End of File
       
  1021