syncmlfw/dm/provisioningadapter/inc/NSmlDmProvisioningAdapter.h
changeset 0 b497e44ab2fc
child 19 696f5dd11939
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2004 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 Provisioning Adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NSMLDMPROVISIONINGADAPTER_H
       
    20 #define NSMLDMPROVISIONINGADAPTER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <CWPAdapter.h>
       
    24 #include <MWPContextExtension.h>
       
    25 #include <MWPVisitor.h>
       
    26 #include <SyncMLClient.h>
       
    27 #include <SyncMLClientDM.h>
       
    28 #include <nsmldmauthinfo.h>
       
    29 #include <nsmlconstants.h>
       
    30 #include <nsmldmconstants.h>
       
    31 
       
    32 #include "NSmlDmProvisioningAdapterUIDs.h"
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 // DATA TYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CDesC16Array;
       
    40 
       
    41 _LIT8( KNSmlTrueVal, "1" );
       
    42 _LIT8( KNSmlFalseVal, "0" );
       
    43 
       
    44 _LIT( KNSmlDMProvisioningDefName, "Profile" );
       
    45 
       
    46 _LIT( KNSmlDMProvisioningCharacteristic, "CHARACTERISTIC" );
       
    47 _LIT( KNSmlDMProvisioningNapdef, "NAPDEF" );
       
    48 _LIT( KNSmlDMProvisioningApplication, "APPLICATION" );
       
    49 _LIT( KNSmlDMProvisioningDMAppIdVal, "w7" );
       
    50 _LIT( KNSmlDMProvisioningINIT, "INIT" );
       
    51 
       
    52 _LIT( KNSmlDMProvisioningHTTP, "http://" );
       
    53 _LIT( KNSmlDMProvisioningHTTPS, "https://" );
       
    54 
       
    55 _LIT( KNSmlDMProvisioningServerAuth, "APPSRV" );
       
    56 _LIT( KNSmlDMProvisioningClientAuth, "CLIENT" );
       
    57 
       
    58 _LIT( KNSmlDMProvisioningHTTPBasic, "HTTP-BASIC" );
       
    59 _LIT( KNSmlDMProvisioningHTTPDigest, "HTTP-DIGEST" );
       
    60 
       
    61 _LIT( KNSmlDmPovisioningDirAndResource,	"z:NSmlDmProvisioningAdapter.rsc" );
       
    62 
       
    63 _LIT8( KNSmlDMProvisioningNoVal, "" );
       
    64 _LIT( KNSmlDMProvisioningNoVal16, "" );
       
    65 _LIT( KNSmlDmDefaultPort, "80");
       
    66 _LIT8( KNSmlDmStaticAlertMessagePart,	"000000000000000000000" ); //21 characters
       
    67 const TUint8 KNSmlDMColon = ':';
       
    68 const TUint8 KNSmlDMUriSeparator = '/';
       
    69 
       
    70 // CLASS DECLARATION
       
    71 class CNSmlDmProfileElement : public CBase
       
    72 	{
       
    73 	public:
       
    74 		static CNSmlDmProfileElement* NewL();
       
    75 		~CNSmlDmProfileElement();
       
    76 		
       
    77 		HBufC *iServerNonce;
       
    78 		CWPCharacteristic *iVisitParameter;
       
    79 		TPckgBuf<TInt> iProfileId;
       
    80 		HBufC *iHostAddress;
       
    81 		HBufC *iPort;
       
    82 		CNSmlDMAuthInfo iAuthInfo;
       
    83 		HBufC8 *iHTTPUserName;
       
    84 		HBufC8 *iHTTPPassword;
       
    85 		
       
    86 		HBufC* iDisplayName;
       
    87 		TSmlServerAlertedAction iServerAlertedAction;
       
    88 		TSmlProtocolVersion iProtocolVersion;
       
    89 		HBufC8* iServerId;
       
    90 		HBufC8* iUsername;
       
    91 		HBufC8* iPassword;
       
    92 		HBufC8* iServerPassword;
       
    93 	};
       
    94 
       
    95 class CNSmlDmProvisioningAdapter : public CWPAdapter , public MWPContextExtension
       
    96 	{
       
    97 	public:
       
    98 
       
    99 		static CNSmlDmProvisioningAdapter* NewL();
       
   100 		~CNSmlDmProvisioningAdapter();
       
   101 		
       
   102 		//from CWPAdapter
       
   103 		TInt ItemCount() const;
       
   104 		const TDesC16& SummaryTitle( TInt aIndex ) const;
       
   105 		const TDesC16& SummaryText( TInt aIndex ) const;
       
   106 		void SaveL( TInt aItem );
       
   107 		TBool CanSetAsDefault( TInt aItem ) const;
       
   108 		void SetAsDefaultL( TInt aItem );
       
   109 		TInt ContextExtension( MWPContextExtension*& );
       
   110 		
       
   111 		//from MWPContextExtension
       
   112 		const TDesC8& SaveDataL( TInt aIndex ) const;
       
   113 		void DeleteL( const TDesC8& aSaveData );
       
   114         TUint32 Uid() const;
       
   115 
       
   116 	private:
       
   117 		void VisitL( CWPCharacteristic& aElement );
       
   118 		void VisitL( CWPParameter& aElement );
       
   119 		void VisitLinkL( CWPCharacteristic& aCharacteristic );
       
   120 		TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
       
   121 
       
   122 		CNSmlDmProvisioningAdapter();
       
   123 		void ConstructL();
       
   124 		TInt GetDefaultIAPL();
       
   125 		void GetTitleL();
       
   126 		TInt CombineURILC( const TDesC& aAddr, const TDesC& aPort, HBufC*& aRealURI );
       
   127 		
       
   128 		TDesC8& ConvertTo8LC( const TDesC& aSource );
       
   129 		TDesC8& ConvertTo8L( const TDesC& aSource );
       
   130 
       
   131 	private:
       
   132 		TInt Reserved_1();
       
   133 		TInt Reserved_2();
       
   134 		
       
   135 	private:  // Data
       
   136 		enum TDmProvisioningState 
       
   137 			{
       
   138 			EStateNull = 0,
       
   139 			EStateDmSettings,
       
   140 			EStateApplication,
       
   141 			EStateNotInterested
       
   142 			};
       
   143 
       
   144 		enum TDmProvisioningAuthLevel 
       
   145 			{
       
   146 			ENone = 0,
       
   147 			EServer,
       
   148 			EClient,
       
   149 			EHttp
       
   150 			};
       
   151 
       
   152 		enum TDmAuthenticationType
       
   153 			{
       
   154 			ENoAuth,
       
   155 			EBasic,
       
   156 			EMD5
       
   157 			};
       
   158 
       
   159 		CNSmlDmProvisioningAdapter::TDmProvisioningState iState;
       
   160 		CNSmlDmProvisioningAdapter::TDmProvisioningAuthLevel iAuthLevel;
       
   161 
       
   162 		RPointerArray<CNSmlDmProfileElement> iProfiles;
       
   163 		HBufC *iTitle;
       
   164 		RSyncMLSession iSession;
       
   165 		TUint iInitSession;
       
   166 		TUint iAuthSecretLimitIndicator;
       
   167 	};
       
   168 
       
   169 #endif	// NSMLDMPROVISIONINGADAPTER_H
       
   170             
       
   171 // End of File