omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 2002-2006 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:     Class stores data for one accesspoint
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CWPAPNAPDEF_H
       
    23 #define CWPAPNAPDEF_H
       
    24 
       
    25 // INCLUDES
       
    26 #include <e32def.h>
       
    27 #include <e32std.h>
       
    28 #include <MWPVisitor.h>
       
    29 #include "CWPAPItemBase.h"
       
    30 #include "WPAPDefs.h"
       
    31 #include <cmconnectionmethodext.h>
       
    32 #include <cmplugindialcommondefs.h>
       
    33 #include <cmmanagerext.h>
       
    34 #include <etelpckt.h>
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CWPAPPhysicalProxy;
       
    38 class CApAccessPointItem;
       
    39 class CWPParameter;
       
    40 class CCommsDatabase;
       
    41 class EAPSettings;
       
    42 class CertificateEntry;
       
    43 class RCmManagerExt;
       
    44 
       
    45 
       
    46 // CLASS DECLARATION
       
    47 
       
    48 /**
       
    49  * CEapTypeElement is arrray element for several EapTypes  
       
    50  */ 
       
    51 class CEapTypeElement: public CBase
       
    52         {
       
    53         public:
       
    54         ~CEapTypeElement();
       
    55         TBuf8<KExpandedEapIdLength> iEapTypeString;
       
    56         TBuf8<KExpandedEapIdLength> iEncapsulatingExpandedEapId;
       
    57         EAPSettings* iEAPSettings;
       
    58         CertificateEntry* iCertificate;
       
    59         };
       
    60 
       
    61 struct SECssID
       
    62 		{
       
    63         CWPParameter* iSSSID;
       
    64         CWPParameter* iSUSSID;
       
    65 		}; 
       
    66 /**
       
    67  * CWPAPNapdef handles NAPDEF characteristics.
       
    68  */ 
       
    69 class CWPAPNapdef : public CWPAPItemBase, private MWPVisitor
       
    70 	{
       
    71 	public:  // Constructors and destructor
       
    72         
       
    73         /**
       
    74         * Two-phased constructor.
       
    75         * @param aFollowingLink ETrue if the NAPDEF was reached
       
    76         *                       via a link.
       
    77         * @param aDefaultName   The default name of an access point
       
    78         * @param aLogicalCharacteristic The PXLOGICAL, if following a link from 
       
    79         *                       there, or NAPDEF, if a direct link to NAPDEF.
       
    80         * @param aLink          The NAPDEF characteristic
       
    81         */
       
    82 		static CWPAPNapdef* NewLC( TBool aFollowingLink,
       
    83                                    const TDesC& aDefaultName, 
       
    84                                    CWPCharacteristic& aLogicalCharacteristic,
       
    85                                    CWPCharacteristic& aLink );
       
    86 
       
    87         /**
       
    88         * Destructor.
       
    89         */
       
    90         virtual ~CWPAPNapdef();
       
    91 
       
    92 	public: // From CWPAPItemBase
       
    93 
       
    94 		/**
       
    95 		* @precondition characteristic must be set otherwise Panics.
       
    96 		*/
       
    97 		TBool ValidateL();
       
    98 		
       
    99         /**
       
   100         * AddDataL
       
   101         */     		
       
   102 		void AddDataL( RCmConnectionMethodExt& aCmItem );
       
   103 		
       
   104         /**
       
   105         * AddItemsL
       
   106         */           
       
   107         TInt AddItemsL( RPointerArray<CWPAPAccesspointItem>& aItems,
       
   108                         CWPAPItemBase* aLogicalProxy,
       
   109                         CWPAPItemBase* aPhysicalProxy );
       
   110         /**
       
   111         * Name
       
   112         */
       
   113         const TDesC& Name();
       
   114     
       
   115         /**
       
   116         * SaveWlanDataL
       
   117         */    
       
   118         void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb );
       
   119 
       
   120         /**
       
   121         * UpdateLingerL from the ItemBase
       
   122         */    
       
   123 
       
   124         void UpdateLingerL(const TUint32 aIapId);
       
   125         
       
   126         /**
       
   127         * Set The Internet Parameter Indicator 
       
   128         */
       
   129         void SetInternetIndicator(TInt value);
       
   130 
       
   131         /**
       
   132         * Get The Internet Parameter Indicator 
       
   133         */
       
   134         TInt GetInternetIndicator();
       
   135 
       
   136 
       
   137 	private: // From MWPVisitor
       
   138 
       
   139         /**
       
   140         * VisitL
       
   141         */   
       
   142 		void VisitL( CWPCharacteristic& aElement );		
       
   143 
       
   144         /**
       
   145         * VisitL
       
   146         */   
       
   147 		void VisitL( CWPParameter& aElement );
       
   148       
       
   149         /**
       
   150         * VisitLinkL
       
   151         */   
       
   152         void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {};
       
   153 
       
   154 	private:  // New functions
       
   155 
       
   156 		/**
       
   157         * C++ default constructor.
       
   158         * @param aFollowingLink ETrue if the NAPDEF was reached
       
   159         *                       via a link.
       
   160         * @param aDefaultName   The default name of an access point
       
   161         * @param aLogicalCharacteristic The PXLOGICAL, if following a link from 
       
   162         *                       there, or NAPDEF, if a direct link to NAPDEF.
       
   163         */
       
   164 		CWPAPNapdef( TBool aFollowingLink,
       
   165                      const TDesC& aDefaultName, 
       
   166                      CWPCharacteristic& aLogicalCharacteristic );
       
   167 
       
   168         /**
       
   169         * By default Symbian 2nd phase constructor is private.
       
   170         */
       
   171 		void ConstructL();
       
   172 
       
   173         /**
       
   174         * Writes a DNS address in either IPv4 or IPv6 format
       
   175         * to an access point item.
       
   176         * @param aAPItem The access point item
       
   177         * @param aValue The DNS address to write
       
   178         */
       
   179         void WriteDNSAddressL( RCmConnectionMethodExt& aCmItem,
       
   180                                const TDesC& aValue );
       
   181                                
       
   182         /**
       
   183         * AddWlanDataL
       
   184         */            
       
   185         void AddWlanDataL( RCmConnectionMethodExt& aCmItem );
       
   186         
       
   187         /**
       
   188         * HandleWLanParameters
       
   189         */            
       
   190         void HandleWLanParametersL( CWPParameter& aParameter );
       
   191         
       
   192         void HandleEAPParametersCCL( CWPParameter& aParameter );
       
   193         
       
   194         /**
       
   195         * ConvertAsciiToHex
       
   196         */            
       
   197         void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest );
       
   198         
       
   199         /**
       
   200         * StrCopy
       
   201         */                    
       
   202         void StrCopy( TDes8& aTarget, const TDesC& aSource );
       
   203         
       
   204         /**
       
   205         * Add linger value
       
   206         */                    
       
   207         void AddLingerL( const TInt , const TInt );
       
   208         
       
   209         /**
       
   210         * Update linger value	
       
   211         */                    
       
   212         void UdateligerValueL(CWPParameter* aLinger);
       
   213         /**
       
   214         * Isalpha	
       
   215         */                    
       
   216         TBool Notalpha(const TDesC& aValue);
       
   217         /**
       
   218         * CheckIPv4values	
       
   219         */  
       
   220         TBool CheckIPv4values(const TDesC& aValue );
       
   221         
       
   222         /**
       
   223         * CheckAddressPart	
       
   224         */  
       
   225         TBool CheckAddressPart( TLex& aLex );
       
   226         
       
   227         /**
       
   228         * ConvertEAPStringToIds
       
   229         */  
       
   230         void ConvertEAPStringToIds(const TDesC& aEAPString, TDes8& aExpandedId, TUint& aId);
       
   231   public: // new function
       
   232   
       
   233         /**
       
   234         * NapId value
       
   235         */  
       
   236         const TDesC& NapId();
       
   237         /**
       
   238         * Bearer value
       
   239         */
       
   240         TUint Bearer();
       
   241         
       
   242         /**
       
   243         * SetCMManager
       
   244         */
       
   245         void SetCMManager( RCmManagerExt* aCm );
       
   246 
       
   247 	private: // Data (Total ownership is assumed unless otherwise stated)
       
   248 
       
   249         enum TAPWEPKeyFormat
       
   250             {
       
   251             EAscii,                 // Ascii format
       
   252             EHexadecimal            // Hex format
       
   253             };
       
   254         /// PXLOGICAL characteristic
       
   255         CWPCharacteristic& iCharacteristic;
       
   256 
       
   257         /// The human-readable name of the connection. Refs.
       
   258 		CWPParameter* iConnectionName; 
       
   259 
       
   260         /// The access point address. Refs.
       
   261 		CWPParameter* iAccesspointName;
       
   262 
       
   263         /// The access point address. Refs.
       
   264 		CWPParameter* iAccesspointNameType;
       
   265 
       
   266         /// The user name. Refs.
       
   267 		CWPParameter* iUserName;
       
   268 
       
   269         /// The password. Refs.
       
   270 		CWPParameter* iPassword;
       
   271 
       
   272         /// The IP address of the phone. Refs.
       
   273 		CWPParameter* iPhoneIPAddress;
       
   274 
       
   275         /// The network type of the access point. Refs.
       
   276         CWPParameter* iIfNetworks;
       
   277 
       
   278         /// Array of name servers. Refs.
       
   279         RPointerArray<CWPParameter> iNameServers;
       
   280 
       
   281         /// Number of IPv4 name servers found so far.
       
   282         TInt iNumIPv4NameServers;
       
   283 
       
   284         /// Number of IPv6 name servers found so far.
       
   285         TInt iNumIPv6NameServers;
       
   286 
       
   287         /// The bearer of the access point.
       
   288         //TApBearerType iBearer;
       
   289         TUint iBearer;
       
   290         
       
   291         // Received bearer was unsupported
       
   292         TBool iBearerUnsupported;
       
   293 
       
   294         /// The PDP type of a GPRS access point.
       
   295         TUint32 iPdpType;
       
   296 
       
   297         /// ETrue of secure authentication must be used.
       
   298 		TBool iSecureAuthentication;
       
   299 
       
   300         /// ETrue if the user must be prompted for password.
       
   301 		TBool iPromptPassword;
       
   302 
       
   303         /// ETrue if we arrived to NAPDEF via a link
       
   304         TBool iFollowingLink;
       
   305         
       
   306 //JMan for WLan        
       
   307 
       
   308 		// Is WLAN supported (queried from Feature Manager)
       
   309         TBool iWlanSupported;
       
   310         
       
   311         // The Network Access Point ID.
       
   312         CWPParameter* iNapID;
       
   313         
       
   314         // WLAN characteristic parameters
       
   315         
       
   316         // The Primary Service Set Identifier name.
       
   317         CWPParameter* iPriSSID;
       
   318         
       
   319         // The Used Primary Service Set Identifier name.
       
   320         CWPParameter* iPriUSSID;
       
   321         
       
   322         // The Hidden Primary Service Set Identifier name.
       
   323         CWPParameter* iPriHSSID;
       
   324         
       
   325         //for secssid 
       
   326         RPointerArray<SECssID> iSecSSID;
       
   327         
       
   328         
       
   329         // The operation mode of the WLAN network.
       
   330         TUint32 iNetMode;
       
   331         
       
   332         // The Security mode of the WLAN network.
       
   333         TUint32 iSecMode;
       
   334         
       
   335         // The ascii formed pre-shared key.
       
   336         CWPParameter* iWpaPresKeyAsc;
       
   337                 
       
   338         // The wep authentication mode
       
   339         CWPParameter* iWepAuthMode;
       
   340         
       
   341         // Indicates the default wepkey
       
   342         TUint iDefaultWepKeyIndex;
       
   343         
       
   344         // WEPKEY characteristic parameters
       
   345         
       
   346         // The lenght of the wepkey
       
   347         CWPParameter* iWepKeyLength;
       
   348 
       
   349         // The index of the wepkey
       
   350         TUint iWepInd;
       
   351         
       
   352         // The wepkey data
       
   353         CWPParameter* iWepKeyData;
       
   354         
       
   355         // Type of authentication (EAuthOpen, EAuthShared)
       
   356         TWEPAuthentication iAuthentication;
       
   357 
       
   358         // Data of the key
       
   359         TBuf8<KMaxLengthOfKeyData> iKeyData[KMaxNumberofKeys];
       
   360         
       
   361         // Format of the key
       
   362         TAPWEPKeyFormat iKeyFormat[KMaxNumberofKeys];
       
   363         
       
   364         RPointerArray<CEapTypeElement> iEapTypeArray;      
       
   365         
       
   366 		// Pointer to Linger value parameter. Refs.
       
   367 		CWPParameter*   iLinger;
       
   368 
       
   369 		//linger value
       
   370 		TUint iLingerValue;
       
   371 		TBool iLingerFlag;
       
   372 		
       
   373 		// Pointer to the used CMManager, needed to save WLAN data
       
   374 		RCmManagerExt* iCm;
       
   375 		
       
   376 		//Internet parameter Indicator
       
   377     TInt iInternetIndicator;
       
   378 
       
   379 	private: // For testing usage.
       
   380 		friend class T_CWPAPNapdef;
       
   381 		friend class T_CWPAPAdapter;
       
   382 		friend class T_WPAPTestUtils;
       
   383 	};
       
   384 
       
   385 #endif	// CWPAPNAPDEF_H
       
   386             
       
   387 // End of File