omadm/omadmextensions/adapters/nsmldinternet/inc/NSmlInternetAdapter.h
changeset 1 4490afcb47b1
child 14 4699373c9af8
equal deleted inserted replaced
0:3ce708148e4d 1:4490afcb47b1
       
     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:   Internet-settings 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __NSMLINTERNETADAPTER_H__
       
    22 #define __NSMLINTERNETADAPTER_H__
       
    23 
       
    24 // SyncML device management LoginScript
       
    25 //#define __SYNCML_DM_LSCRIPT 1
       
    26 //#define __SYNCML_DM_WLAN 1
       
    27 // ------------------------------------------------------------------------------------------------
       
    28 // Includes
       
    29 // ------------------------------------------------------------------------------------------------
       
    30 #include <utf.h>
       
    31 #include <bldvariant.hrh>
       
    32 #include <commdb.h>
       
    33 #include <metadatabase.h>
       
    34 #include "smldmadapter.h"
       
    35 #include "nsmlconstants.h"
       
    36 
       
    37 #include "NSmlWLanAdapter.h"
       
    38 #include "NSmlWlanSettings.h"
       
    39 
       
    40 const TInt  KNSmlInternetAdapterFatMinSize=512;
       
    41 const TInt  KNSmlIncompleteAP=-1;
       
    42 // Buffering Stuff
       
    43 const TInt KNSmlAPGranularity = 4;
       
    44 const TUint8 KNSmlDMUriSeparator = 0x2f;
       
    45 
       
    46 const TUint8 KNSmlDMDot = 0x2e;
       
    47 const TUint8 KNSmlDMAsciiIntStart = 0x30;
       
    48 const TUint8 KNSmlDMAsciiIntEnd = 0x39;
       
    49 // Other constants
       
    50 const TInt KNSmlApDnsLuidUpperBase = 300000;
       
    51 const TInt KNSmlAp3gpppsLowerBase = 50000;
       
    52 const TInt KNSmlApProxyLowerBase = 100000;
       
    53 const TInt KNSmlApProxyUpperBase = 200000;
       
    54 const TInt KNSmlApWapLowerBase = 9200;
       
    55 const TInt KNSmlApWapUpperBase = 9203;
       
    56 
       
    57 //DDF version number
       
    58 _LIT8( KNSmlInternetAdapterDDFversion, "1.1");
       
    59 
       
    60 //DDF accepted AP-fieldnames
       
    61 _LIT8( KNSmlDdfAP,              "AP" );
       
    62 
       
    63 _LIT8( KNSmlDdfPx,              "Px" );
       
    64 _LIT8( KNSmlDdfPxName,          "Name" );
       
    65 _LIT8( KNSmlDdfPxId,            "PxID" );
       
    66 _LIT8( KNSmlDdfPxPW,            "PxPW" );
       
    67 _LIT8( KNSmlDdfPPGAuthTy,       "PPGAuthTy" );
       
    68 _LIT8( KNSmlDdfDomain,          "Domain" );
       
    69 _LIT8( KNSmlDdfDomainL,         "DomainL" );
       
    70 _LIT8( KNSmlDdfPxAddr,          "PxAddr" );
       
    71 _LIT8( KNSmlDdfToNAPID,         "ToNAPID" );
       
    72 _LIT8( KNSmlDdfToNAPIDL,        "ToNAPIDL" );
       
    73 _LIT8( KNSmlDdfStartpg,         "Startpg" );
       
    74 _LIT8( KNSmlDdfBasAuthId,       "BasAuthId" );
       
    75 _LIT8( KNSmlDdfBasAuthPW,       "BasAuthPW" );
       
    76 _LIT8( KNSmlDdfPort,            "Port" );
       
    77 _LIT8( KNSmlDdfPortNbr,         "PortNbr" );
       
    78 _LIT8( KNSmlDdfPxAuthTy,        "PxAuthTy" ); 
       
    79 _LIT8( KNSmlDdfService,         "Service" );
       
    80 _LIT8( KNSmlDdfServiceL,        "ServiceL" );
       
    81 _LIT8( KNSmlDdfUsePTxtLog,      "UsePTxtLog" );
       
    82 
       
    83 _LIT8( KNSmlDdfGPRSPDP,         "GPRSPDP" );
       
    84 _LIT8( KNSmlDdfDefGW,           "DefGW" );
       
    85 _LIT8( KNSmlDdfNetworkMask,     "NetworkMask" );
       
    86 
       
    87 _LIT8( KNSmlDdfPPPComp,         "PPPComp" );
       
    88 
       
    89 _LIT8( KNSmlDdfNAPDef,          "NAPDef" );
       
    90 _LIT8( KNSmlDdfNAPName,         "Name" );
       
    91 _LIT8( KNSmlDdfNAPLinger,         "Linger" );
       
    92 _LIT8( KNSmlDdfNAPID,           "NAPID" );
       
    93 _LIT8( KNSmlDdfBearer,          "Bearer" );
       
    94 _LIT8( KNSmlDdfBearerL,         "BearerL" );
       
    95 _LIT8( KNSmlDdfDirection,       "Direction" );
       
    96 _LIT8( KNSmlDdfInternet,        "Internet" );
       
    97 _LIT8( KNSmlDdfNAPAddr,         "NAPAddr" );
       
    98 _LIT8( KNSmlDdfNAPAddrTy,       "NAPAddrTy" );
       
    99 _LIT8( KNSmlDdfDNSAddr,         "DNSAddr" );
       
   100 _LIT8( KNSmlDdfDNSAddrL,        "DNSAddrL" );
       
   101 _LIT8( KNSmlDdfDNSAddrTy,       "DNSAddrTy" );
       
   102 _LIT8( KNSmlDdfDNSPriority,     "DNSPriority" );
       
   103 _LIT8( KNSmlDdfNAPAuthInf,      "NAPAuthInf" ); 
       
   104 _LIT8( KNSmlDdfAuthName,        "AuthName" ); 
       
   105 _LIT8( KNSmlDdfAuthSecr,        "AuthSecr" );
       
   106 _LIT8( KNSmlDdfPxAuthInf,       "PxAuthInf" );
       
   107 _LIT8( KNSmlDdfPxAuthId,        "PxAuthID" );
       
   108 _LIT8( KNSmlDdfPxAuthPW,        "PxAuthPW" );
       
   109 
       
   110 _LIT8( KNSmlDdfIPAddrFromServer,"IPAddrFromServer" );
       
   111 _LIT8( KNSmlDdfIPAddr,          "IPAddr" );
       
   112 _LIT8( KNSmlDdfDNSAddrFromServer,"IPDNSAddrFromServer" );
       
   113 _LIT8( KNSmlDdfIPv6DNSAddrFromServer,"IPv6DNSAddrFromServer" );
       
   114 _LIT8( KNSmlDdfIfNetworks,      "IfNetworks" );
       
   115 _LIT8( KNSmlDdfIAPService,      "IAPService" );
       
   116 _LIT8( KNSmlDdfLANService,      "LANService" );
       
   117 
       
   118 _LIT8( KNSmlDdfIAPSeamlessness, "Seamlessness" );
       
   119 _LIT8( KNSmlDdfIAPMetaData,     "MetaData" );
       
   120 
       
   121 _LIT8( KNSmlDdfNoPxFor,         "NoPxFor" );
       
   122 _LIT8( KNSmlDdfNoPxForL,        "NoPxForL" );
       
   123 
       
   124 _LIT8( KNSmlDdfNetworks,        "Networks" );
       
   125 _LIT8( KNSmlDdfNetworkName,     "Name" );
       
   126 _LIT8( KNSmlDdfNetworkID,       "ID" );
       
   127 
       
   128 //DDF AP-field descriptions
       
   129 _LIT8( KNSmlDdfAPDesc,           "AP (Access Point) node" );
       
   130 
       
   131 _LIT8( KNSmlDdfPxDesc,          "Px (Proxy) node" );
       
   132 _LIT8( KNSmlDdfPxNameDesc,      "Px name description" );
       
   133 _LIT8( KNSmlDdfNameDesc,        "Displayable name for the Proxy" );
       
   134 _LIT8( KNSmlDdfPxIdDesc,        "Define one Proxy entity" );
       
   135 _LIT8( KNSmlDdfPxPWDesc,        "Password for one Proxy entity" );
       
   136 _LIT8( KNSmlDdfPPGAuthTyDesc,   "Link PxID and PxPW to an authentication method" );
       
   137 _LIT8( KNSmlDdfPxAddrDesc,      "Proxy-Address" );
       
   138 _LIT8( KNSmlDdfToNAPIDDesc,     "Parent to all Network Access Point link objects" );
       
   139 _LIT8( KNSmlDdfToNAPIDLDesc,    "NAPID end" );
       
   140 _LIT8( KNSmlDdfStartpgDesc,     "The WAP homepage or start page" );
       
   141 _LIT8( KNSmlDdfBasAuthIdDesc,   "Basic authentication identifier" );
       
   142 _LIT8( KNSmlDdfBasAuthPWDesc,   "Basic authentication password" );
       
   143 _LIT8( KNSmlDdfPortDesc,        "Port node" );
       
   144 _LIT8( KNSmlDdfPortNbrDesc,     "Value of the port number" );
       
   145 _LIT8( KNSmlDdfServiceDesc,     "Service node" );
       
   146 _LIT8( KNSmlDdfServiceLDesc,    "ServiceL" );
       
   147 _LIT8( KNSmlDdfUsePTxtLogDesc,  "Plain Text Login is used or not" );
       
   148 
       
   149 _LIT8( KNSmlDdfGPRSPDPDesc,     "GPRS PDP-type" );
       
   150 _LIT8( KNSmlDdfDefGWDesc,       "Default Gateway" );
       
   151 _LIT8( KNSmlDdfNetworkMaskDesc, "Network/Subnet mask" );
       
   152 
       
   153 _LIT8( KNSmlDdfPPPCompDesc,     "PPP Compression" );
       
   154 
       
   155 _LIT8( KNSmlDdfNAPDefDesc,      "Network Access Point Definition objects parent" );
       
   156 _LIT8( KNSmlDdfNAPNameDesc,     "Displayable name for the NAP" );
       
   157 _LIT8( KNSmlDdfNAPIDDesc,       "Used by TO-NAPID link of the Proxy" );
       
   158 _LIT8( KNSmlDdfNAPLingerDesc,       "Linger value" );
       
   159 _LIT8( KNSmlDdfBearerDesc,      "Bearer node" );
       
   160 _LIT8( KNSmlDdfBearerLDesc,     "Bearer valid" );
       
   161 _LIT8( KNSmlDdfDirectionDesc,   "Direction for network type" );
       
   162 _LIT8( KNSmlDdfInternetDesc,    "IP-routable network segment" );
       
   163 _LIT8( KNSmlDdfNAPAddrDesc,     "NAP-Address" );
       
   164 _LIT8( KNSmlDdfNAPAddrTyDesc,   "NAP-Address-Type" );
       
   165 _LIT8( KNSmlDdfDNSAddrDesc,     "DNSAddr node" );
       
   166 _LIT8( KNSmlDdfDNSAddrLDesc,    "Address of a DNS server" );
       
   167 _LIT8( KNSmlDdfDNSAddrTyDesc,   "Type of DNS address" );
       
   168 _LIT8( KNSmlDdfDNSPriorityDesc, "Rank of DNS server" );
       
   169 _LIT8( KNSmlDdfNAPAuthInfDesc,  "Authentication Info" );
       
   170 _LIT8( KNSmlDdfAuthNameDesc,    "Loginname" );
       
   171 _LIT8( KNSmlDdfAuthSecrDesc,    "Loginpassword" );
       
   172 _LIT8( KNSmlDdfPxAuthInfDesc,    "Proxy Authentication Info" );
       
   173 _LIT8( KNSmlDdfPxAuthIdDesc,        "Proxy Loginname" );
       
   174 _LIT8( KNSmlDdfPxAuthPWDesc,        "Proxy Loginpassword" );
       
   175 
       
   176 _LIT8( KNSmlDdfIPAddrFromServerDesc,"Get IP addresses from server?" );
       
   177 _LIT8( KNSmlDdfIPAddrDesc,          "IP-address" );
       
   178 _LIT8( KNSmlDdfDNSAddrFromServerDesc,"Get DNS addresses from server?" );
       
   179 _LIT8( KNSmlDdfIPv6DNSAddrFromServerDesc,"Get IPv6 addresses from server?" );
       
   180 _LIT8( KNSmlDdfIfNetworksDesc,      "Comma separated list of network protocols, e.g. PPP" );
       
   181 _LIT8( KNSmlDdfIAPServiceDesc,      "IAP service" );
       
   182 
       
   183 _LIT8( KNSmlDdfIAPSeamlessnessDesc, "IAP seamlessness value" );
       
   184 _LIT8( KNSmlDdfIAPMetaDataDesc,      "IAP meta data value" );
       
   185 
       
   186 _LIT8( KNSmlDdfDomainDesc,          "Domain desc" );
       
   187 _LIT8( KNSmlDdfDomainLDesc,         "Domain, for which the Proxy is responsible" );
       
   188 
       
   189 _LIT8( KNSmlDdfNoPxForDesc,     "No proxy for listed AP:s" );
       
   190 _LIT8( KNSmlDdfNoPxForLDesc,    "No proxy for this AP" );
       
   191 
       
   192 _LIT8( KNSmlDdfNetworksDesc,    "Networks" );
       
   193 _LIT8( KNSmlDdfNetworkNameDesc, "Network Name" );
       
   194 _LIT8( KNSmlDdfNetworkIDDesc,   "Network ID" );
       
   195 
       
   196 //Other 
       
   197 _LIT8( KNSmlDNS1,               "/DNS1" );
       
   198 _LIT8( KNSmlDNS2,               "/DNS2" );
       
   199 _LIT8( KNSmlDNS3,               "/DNS3" );
       
   200 _LIT8( KNSmlDNS4,               "/DNS4" );
       
   201 
       
   202 _LIT8(KNSmlAPnode,      "NAPDef/Px");
       
   203 
       
   204 
       
   205 _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");
       
   206 
       
   207 //_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");
       
   208 
       
   209 //_LIT8(KNSmlNAPDefGPRSnode, "Name/NAPID/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/CallTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/LnkSpeed/DefGW/NetworkMask/PPPComp/UsePTxtLog/GPRSPDP/Networks/IAPService");
       
   210 
       
   211 _LIT8(KNSmlPxnode,      "Name/PxID/PxAddr/Port/ToNAPID/Startpg/Domain/PxAuthInf/NoPxFor");
       
   212 
       
   213 #ifdef __SYNCML_DM_LSCRIPT
       
   214 _LIT8(KNSmlLoginscriptnode, "/LoginTW/LoginScriptData");
       
   215 #endif
       
   216 
       
   217 _LIT8(KNSmlDNSAddrNode, "DNSAddrL/DNSAddrTy/DNSPriority" );
       
   218 
       
   219 _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");
       
   220 
       
   221 //Default data values
       
   222 _LIT( KNSmlDefName,             "APAdapterIns" );
       
   223 _LIT( KNSmlDefAP,               "AP" );
       
   224 _LIT8( KNSmlFirstDNSPri,        "1" );
       
   225 _LIT8( KNSmlSecondDNSPri,       "2" );
       
   226 _LIT8( KNSmlDNSIp,              "IP" );
       
   227 _LIT8( KNSmlDNSIp6,             "IP6" );
       
   228 _LIT8( KNSmlEmptyIpv4Address8,  "0.0.0.0");
       
   229 _LIT( KNSmlEmptyIpv4Address,   "0.0.0.0");
       
   230 _LIT8( KNSmlMimeTypeTextPlain,  "text/plain" );
       
   231 
       
   232 _LIT8( KNSmlDmApValOutgoing, "Outgoing" );
       
   233 _LIT8( KNSmlDmApValIncoming, "Incoming" );
       
   234 _LIT8( KNSmlDmApVal3Gppps, "3GPPPS" );
       
   235 _LIT8( KNSmlDmApValGsmCsd, "GSM-CSD" );
       
   236 _LIT8( KNSmlDmApValGsmGprs, "GSM-GPRS" );
       
   237 _LIT8( KNSmlDmApValGsmHscsd, "GSM-HSCSD" );
       
   238 _LIT8( KNSmlDmApValVpn, "VPN" );
       
   239 _LIT8( KNSmlDmApValWlan, "WLAN" );
       
   240 _LIT8( KNSmlDmApValFSlash, "/" );
       
   241 _LIT8( KNSmlDmApValAnalog, "ANALOG-MODEM" );
       
   242 _LIT8( KNSmlDmApValV110, "V.110" );
       
   243 _LIT8( KNSmlDmApValV120, "V.120" );
       
   244 
       
   245 _LIT8( KNSmlDmApValAuto, "Auto" );
       
   246 _LIT8( KNSmlDmApVal2400, "2400" );
       
   247 _LIT8( KNSmlDmApVal4800, "4800" );
       
   248 _LIT8( KNSmlDmApVal9600, "9600" );
       
   249 _LIT8( KNSmlDmApVal14400, "14400" );
       
   250 _LIT8( KNSmlDmApVal19200, "19200" );
       
   251 _LIT8( KNSmlDmApVal28800, "28800" );
       
   252 _LIT8( KNSmlDmApVal32000, "32000" );
       
   253 _LIT8( KNSmlDmApVal33600, "33600" );
       
   254 _LIT8( KNSmlDmApVal38400, "38400" );
       
   255 _LIT8( KNSmlDmApVal43200, "43200" );
       
   256 _LIT8( KNSmlDmApVal48000, "48000" );
       
   257 _LIT8( KNSmlDmApVal56000, "56000" );
       
   258 _LIT8( KNSmlDmApVal57600, "57600" );
       
   259 _LIT8( KNSmlDmApVal64000, "64000" );
       
   260 _LIT8( KNSmlDmApValExtended, "Extended" );
       
   261 _LIT8( KNSmlDmApValIpv4, "IPv4" );
       
   262 _LIT8( KNSmlDmApValIpv6, "IPv6" );
       
   263 _LIT8( KNSmlDmApValTrue, "True" );
       
   264 _LIT8( KNSmlDmApValFalse, "False" );
       
   265 
       
   266 
       
   267 //class forwards
       
   268 class CNSmlWLanAdapter;
       
   269 
       
   270 struct TNSmlAPAddElement
       
   271     {
       
   272     HBufC8  *iUri;
       
   273     HBufC8 *iData;
       
   274     TInt iStatusRef;
       
   275     HBufC8* iLuid;
       
   276     TBool iLeaf;
       
   277     TBool iDone;
       
   278     };
       
   279 
       
   280 enum TNSmlAPLeafType
       
   281     {
       
   282     EDMUpdate,
       
   283     EDMAdd,
       
   284     EDMDelete,
       
   285     EDMUnset
       
   286     };
       
   287 
       
   288 struct TNSmlAPBufferElement
       
   289     {
       
   290     CArrayFixFlat<TNSmlAPAddElement> *iNodeBuf;
       
   291     CArrayFixFlat<TNSmlAPAddElement> *iWlanNodeBuf;
       
   292     HBufC8* iMappingName;
       
   293     HBufC8* iName;
       
   294     TBool iExecuted;
       
   295     TInt  iLuid;
       
   296     TBool iBearer;
       
   297     TBool iDirection;
       
   298     TBool iNameReceived;
       
   299     TBool iDnsUpdateBuf;
       
   300     };
       
   301 //
       
   302 // ------------------------------------------------------------------------------------------------
       
   303 // CNSmlInternetAdapter 
       
   304 // ------------------------------------------------------------------------------------------------
       
   305 class CNSmlInternetAdapter : public CSmlDmAdapter
       
   306     {
       
   307 public:
       
   308 
       
   309 enum TNSmlAPFieldType
       
   310     {
       
   311     EStr,
       
   312     EInt,
       
   313     EBin,
       
   314     EBool,
       
   315     ESpec,
       
   316     EWap,
       
   317     EWrong
       
   318     };
       
   319     static CNSmlInternetAdapter* NewL(MSmlDmCallback* aDmCallback );
       
   320     static CNSmlInternetAdapter* NewLC(MSmlDmCallback* aDmCallback );
       
   321 
       
   322     virtual ~CNSmlInternetAdapter(); 
       
   323 
       
   324     // Adapter interface
       
   325     void DDFVersionL( CBufBase& aDDFVersion );
       
   326     void DDFStructureL( MSmlDmDDFObject& aDDF );
       
   327     void AddLeafObjectL( const TDesC8& aURI,
       
   328                          const TDesC8& aParentLUID, 
       
   329                          const TDesC8& aObject, 
       
   330                          const TDesC8& aType, 
       
   331                          const TInt aStatusRef );  
       
   332     void UpdateLeafObjectL( const TDesC8& aURI, 
       
   333                             const TDesC8& aLUID, 
       
   334                             const TDesC8& aObject, 
       
   335                             const TDesC8& aType, 
       
   336                             const TInt aStatusRef );
       
   337     void UpdateLeafObjectL( const TDesC8& aURI, 
       
   338                             const TDesC8& aLUID,
       
   339                             RWriteStream*& aStream, 
       
   340                             const TDesC8& aType,
       
   341                             TInt aStatusRef );
       
   342     void DeleteObjectL( const TDesC8& aURI, 
       
   343                         const TDesC8& aLUID, 
       
   344                         const TInt aStatusRef ); 
       
   345     void FetchLeafObjectL( const TDesC8& aURI, 
       
   346                            const TDesC8& aLUID, 
       
   347                            const TDesC8& aType, 
       
   348                            const TInt aResultsRef, 
       
   349                            const TInt aStatusRef );
       
   350     void FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   351                                const TDesC8& aLUID,
       
   352                                const TDesC8& aType, 
       
   353                                TInt aResultsRef,
       
   354                                TInt aStatusRef );
       
   355     void ChildURIListL( const TDesC8& aURI, 
       
   356                         const TDesC8& aLUID, 
       
   357                         const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   358                         const TInt aResultsRef, 
       
   359                         const TInt aStatusRef );  
       
   360     void AddNodeObjectL( const TDesC8& aURI, 
       
   361                          const TDesC8& aParentLUID, 
       
   362                          const TInt aStatusRef );
       
   363     void ExecuteCommandL( const TDesC8& aURI, 
       
   364                           const TDesC8& aLUID,
       
   365                           const TDesC8& aArgument, 
       
   366                           const TDesC8& aType,
       
   367                           TInt aStatusRef );
       
   368     void ExecuteCommandL( const TDesC8& aURI, 
       
   369                           const TDesC8& aLUID,
       
   370                           RWriteStream*& aStream,
       
   371                           const TDesC8& aType, 
       
   372                           TInt aStatusRef );
       
   373     void CopyCommandL( const TDesC8& aTargetURI,
       
   374                        const TDesC8& aTargetLUID, 
       
   375                        const TDesC8& aSourceURI,
       
   376                        const TDesC8& aSourceLUID, 
       
   377                        const TDesC8& aType,
       
   378                        TInt aStatusRef );
       
   379     void StartAtomicL();
       
   380     void CommitAtomicL();
       
   381     void RollbackAtomicL();
       
   382     TBool StreamingSupport( TInt& aItemSize );
       
   383     void StreamCommittedL();                      
       
   384     void CompleteOutstandingCmdsL();
       
   385 
       
   386 private:
       
   387     void ConstructL();
       
   388     CNSmlInternetAdapter( TAny* aEcomArguments );
       
   389     TDesC8& SetIntObjectLC( const TInt& aObject );
       
   390     TInt    SetField( const TDesC8& aSource );
       
   391     TInt GetIntObject8( const TDesC8& aObject );
       
   392     TInt IntLUID( const TDesC8& aLUID );
       
   393 
       
   394     void AddNodeBufferL( const TDesC8& aURI, 
       
   395                          const TDesC8& aParentLUID, 
       
   396                          const TInt aStatusRef,
       
   397                          const TBool aDontAppend,
       
   398                          const TBool aWlan = EFalse );
       
   399     
       
   400     void AddLeafBufferL( const TDesC8& aURI,
       
   401                          const TDesC8& aParentLUID, 
       
   402                          const TDesC8& aObject, 
       
   403                          const TDesC8& aType, 
       
   404                          const TInt aStatusRef,
       
   405                          const TBool aWlan = EFalse );
       
   406     
       
   407     CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, 
       
   408                                             const TDesC8& aLUID,
       
   409                                             const TDesC8& aType,
       
   410                                             CBufBase& aObject); 
       
   411     TPtrC8 LastURISeg(const TDesC8& aURI);
       
   412     TPtrC8 FirstURISeg(const TDesC8& aURI);
       
   413     TPtrC8 GetDynamicAPNodeUri( const TDesC8& aURI );
       
   414     void ExecuteBufferL(const TDesC8& aURI, const TBool aCompleting = EFalse);
       
   415     TPtrC8 GetAddURISeg(const TDesC8& aURI,const TDesC8& aName);
       
   416     
       
   417     CNSmlInternetAdapter::TNSmlAPFieldType   GetAPFieldType( const TDesC8& aURI ) const;
       
   418     TBool GetAPField( TPtrC& aTableName, TPtrC& aColumn ) const;
       
   419     TBool NotValidStrLenght( const TDesC& aSource );
       
   420 
       
   421     TDesC8&  ConvertTo8LC( const TDesC& aSource );
       
   422     TDesC16& ConvertTo16LC( const TDesC8& aSource );
       
   423 
       
   424     TInt InitializeGPRSL( CCommsDbTableView* aTable );
       
   425     TInt InitializeProxyL( CCommsDbTableView* aTable );
       
   426 
       
   427     TInt InitializeWAPIAPL( CCommsDbTableView* aTable, const TDesC8& aName );
       
   428     TInt InitializeWAPL( CCommsDbTableView* aTable );
       
   429     TInt InitializeLANServiceL( CCommsDbTableView* aTable );
       
   430     TInt InitializeVPNServiceL( CCommsDbTableView* aTable );
       
   431     TBool IsValidNameL(const TDesC8& aName);
       
   432     TBool IsValidIPv4AddressL(const TDesC8& aNapAddr);
       
   433     void  NextAPNameL(const TDesC8& aName);
       
   434     
       
   435     TUint32 GetIAPSeamlessnessL(TUint32 aId);
       
   436     TUint32 GetIAPMetaDataL(TUint32 aId);
       
   437     void SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef);
       
   438     void SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef);
       
   439     
       
   440     TBool CheckEnforcementL();
       
   441     TBool CheckWLANEnforcementL();
       
   442     TInt UnprotectWLANAPItemL(TUint32 aId);
       
   443     TInt DoProtectWAPTablesL(TBool aProtect);
       
   444     void DoLockIAPTablesL(TBool aLock);
       
   445 
       
   446     TBool IsIAPRecordLockedL(TUint32 aRecord);
       
   447     TInt DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect);
       
   448     TBool IsProxyRecordLockedL(TUint32 aRecord);
       
   449     TInt DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect);
       
   450     TBool IsServiceRecordLockedL(TUint32 aRecord);
       
   451     TInt DoProtectServiceRecordL(TUint32 aRecord,TBool aProtect);
       
   452 	TBool IsWAPAccessPointRecordLockedL(TUint32 aRecord);
       
   453 	TInt DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect);
       
   454 
       
   455     TBool IsWLANfield( const TDesC8& aURI );
       
   456     TBool IsWlanL( const TDesC8& aURI );
       
   457     TBool GetLanBearerL( TUint32& aId );
       
   458 
       
   459     void SaveIAPDataL(const TDesC8& aURI);
       
   460     TBool GetModemBearerL(TUint32& aId);
       
   461     TBool IsInsertAllowedL();
       
   462     TUint32 GetMaxIdL();
       
   463     TBool GetProxyIdL(const TDesC8& aURI);
       
   464 
       
   465     TBool APExistsL(TUint32 aId);
       
   466     TBool NAPDefExistsL( TUint32 aId );
       
   467     TBool PxExistsL(TUint32 aId);
       
   468     TBool WapAPExistsL(TUint32 aId);
       
   469     TBool NetworkExistsL(TUint32 aId);
       
   470     TBool NetworkNameExistsL(TUint32& aId, const TDesC8& aObject);
       
   471     TBool AddNetworkL(TUint32& aId, const TDesC8& aObject);
       
   472 
       
   473     TBool DeleteAPL(TUint32 aId);
       
   474     TBool DeleteNAPDefL(TUint32 aId);
       
   475     TBool DeleteProxyL(TUint32 aId);
       
   476     TBool DeleteWapAPL(TUint32 aId);
       
   477 
       
   478     TUint32 GetAPIdFromURIL(const TDesC8& aURI);
       
   479     void IsWapPort( const TDesC8& aObject );
       
   480     void FillNodeInfoL( MSmlDmDDFObject& aNode,
       
   481                         TSmlDmAccessTypes aAccTypes,
       
   482                         MSmlDmDDFObject::TOccurence aOccurrence, 
       
   483                         MSmlDmDDFObject::TScope aScope, 
       
   484                         MSmlDmDDFObject::TDFFormat aFormat,
       
   485                         const TDesC8& aDescription);
       
   486 
       
   487     TInt UpdateIAPnameL( TUint32 aId, const TDesC8& aObject );
       
   488     TUint32 GetLocationL();
       
   489 
       
   490     TBool InitializeDNSParamsFromBuffL( const TPtrC8 aParentUri, TInt& aDnsPri );
       
   491     TInt DnsToLuid( const UriUtils::TUriHostType aType, 
       
   492                     const TInt aPriority ) const;
       
   493     TInt LuidToDns( UriUtils::TUriHostType& aType, TInt& aPriority, 
       
   494                     const TInt aLuid ) const;
       
   495     TPtrC8 RemoveLastSeg(const TDesC8& aURI) const;
       
   496     
       
   497     void ClearBuffer( CArrayFixFlat<TNSmlAPAddElement>* aBuffer );
       
   498     void LingerValueL( const TDesC8& aObject );
       
   499     void AddLingerL( const TInt aIapId, const TInt aLingerInterval);
       
   500     void UpdateLingerL( const TInt aIapId, const TInt aLingerInterval );
       
   501     void GetLingerL( const TInt aIapId, TInt& aLingerInterval );
       
   502     void DeleteLingerL( const TInt aIapId );        
       
   503     TBool Notalpha(const TDesC& aValue);  
       
   504     TUint32 ConstructTreeL(const TDesC8& aURI);
       
   505     TBool IsAPUriFormatMatchPredefined(const TDesC8 & aURI);
       
   506 
       
   507     
       
   508 
       
   509 private:
       
   510     MSmlDmCallback* iCallBack;
       
   511 
       
   512     CNSmlWLanAdapter* iWlanAdapter;
       
   513 
       
   514     TInt iLUID;
       
   515     TInt iParentLUID;
       
   516     TInt iObject;
       
   517     TBool iWapPort;
       
   518     TInt iDirection;
       
   519 	TBool iStaleMapUpdate;
       
   520     HBufC8* iField;     
       
   521     TNSmlAPLeafType   iLeafType;
       
   522 
       
   523     TBuf8<KCommsDbSvrMaxFieldLength> iWAPAccessPoint;
       
   524     TUint32 iWapId;
       
   525     TBuf<KCommsDbSvrMaxFieldLength> iWapBearer;
       
   526     TBuf8<KCommsDbSvrMaxFieldLength> iWapName;
       
   527     TBuf8<KCommsDbSvrMaxFieldLength> iWapUserName;
       
   528     TBuf8<KCommsDbSvrMaxFieldLength> iWapPassword;
       
   529 
       
   530     CArrayFixFlat<TNSmlAPBufferElement> *iBuffer;
       
   531     TBool i3GPPPS;
       
   532 
       
   533     private:    // data
       
   534         CCommsDatabase* iDatabase;
       
   535         
       
   536         TBool iIAPExists;
       
   537         
       
   538         TInt iDnsIpv4Pri; // 1 or 2 
       
   539         TInt iDnsIpv6Pri;
       
   540         TInt iExecutionIndex;
       
   541         TBool iExecutingBuffer;
       
   542         TBool iDnsUpdate;
       
   543         
       
   544         TBuf8<KCommsDbSvrMaxFieldLength>        iIAPName;
       
   545         
       
   546         TUint32 iIAPId;
       
   547         
       
   548         TUint32 iISPId;
       
   549 
       
   550         TUint32 iProxyId;
       
   551         TUint32 iProxyISP;
       
   552 
       
   553         TBuf<KCommsDbSvrMaxFieldLength> iProxyServiceType;
       
   554         TBuf8<KCommsDbSvrMaxFieldLength> iProxyServerName;
       
   555         
       
   556         HBufC8* iPrevURI;
       
   557         TInt   iPrevLUID;
       
   558 
       
   559         TBuf<KCommsDbSvrMaxFieldLength> iBearer;
       
   560         
       
   561         TUint32 iBearerType;
       
   562         TInt iNetworkId;
       
   563         TInt iLingerValue;
       
   564         TBool iLingerFlag;
       
   565         TBool iTransactionCommitted;
       
   566         TBool iWAPRelock;
       
   567         RArray<TPtrC> iLockTableList;
       
   568         
       
   569         TBool iWlanSupported;
       
   570     };
       
   571 
       
   572 
       
   573 
       
   574 #endif // __NSMLINTERNETADAPTER_H__
       
   575 // End of File