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