eapol/eapol_framework/eapol_symbian/am/type/mschapv2/symbian/plugin/src/EapMsChapV2UiConnection.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
       
     1 /*
       
     2 * Copyright (c) 2001-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 the License "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:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 10.1.2 %
       
    20 */
       
    21 
       
    22 // This is enumeration of EAPOL source code.
       
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    24 	#undef EAP_FILE_NUMBER_ENUM
       
    25 	#define EAP_FILE_NUMBER_ENUM 298 
       
    26 	#undef EAP_FILE_NUMBER_DATE 
       
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    29 
       
    30 #include "EapMsChapV2DbUtils.h"
       
    31 #include <EapMsChapV2UiConnection.h>
       
    32 #include <EapMsChapV2UiDataConnection.h>
       
    33 
       
    34 CEapMsChapV2UiConnection::CEapMsChapV2UiConnection(
       
    35     const TIndexType aIndexType,
       
    36     const TInt aIndex,
       
    37     const TInt aTunnelingType,
       
    38     const TInt aEAPType)
       
    39     : iIndexType(aIndexType)
       
    40     , iIndex(aIndex)
       
    41     , iTunnelingType(aTunnelingType)
       
    42     , iIsConnected(EFalse)
       
    43     , iDataConn(NULL)
       
    44     , iEAPType(aEAPType)
       
    45 {
       
    46 }
       
    47 
       
    48 
       
    49 CEapMsChapV2UiConnection::~CEapMsChapV2UiConnection()
       
    50 {
       
    51 }
       
    52 
       
    53 
       
    54 TInt CEapMsChapV2UiConnection::Connect()
       
    55 {
       
    56 #ifdef USE_EAP_EXPANDED_TYPES
       
    57 
       
    58 	eap_type_value_e tunnelingType(static_cast<eap_type_ietf_values_e>(iTunnelingType));
       
    59 
       
    60 #else
       
    61 
       
    62 	eap_type_value_e tunnelingType = static_cast<eap_type_value_e>(iTunnelingType);
       
    63 
       
    64 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
    65 
       
    66 	TRAPD(err, EapMsChapV2DbUtils::OpenDatabaseL(
       
    67 		iDbNamedDatabase, 
       
    68 		iDbs, 
       
    69 		iIndexType, 
       
    70 		iIndex, 
       
    71 		tunnelingType));
       
    72     if (err == KErrNone)
       
    73     {
       
    74         iIsConnected = ETrue;
       
    75     }
       
    76 
       
    77     return err;
       
    78 }
       
    79 
       
    80 
       
    81 TInt CEapMsChapV2UiConnection::Close()
       
    82 {
       
    83     if (iIsConnected)
       
    84     {
       
    85         iDbNamedDatabase.Close();
       
    86         iDbs.Close();
       
    87     }
       
    88     iIsConnected = EFalse;
       
    89 
       
    90     return KErrNone;
       
    91 }
       
    92 
       
    93 
       
    94 CEapMsChapV2UiDataConnection * CEapMsChapV2UiConnection::GetDataConnection()
       
    95 {
       
    96     if (!iDataConn)
       
    97     {
       
    98         iDataConn = new CEapMsChapV2UiDataConnection(this);
       
    99     }
       
   100 
       
   101     return iDataConn;
       
   102 }
       
   103 
       
   104 TInt CEapMsChapV2UiConnection::GetDatabase(RDbNamedDatabase & aDatabase)
       
   105 {
       
   106     if (iIsConnected == EFalse)
       
   107     {
       
   108         return KErrSessionClosed;
       
   109     }
       
   110 
       
   111     aDatabase = iDbNamedDatabase;
       
   112     return KErrNone;
       
   113 }
       
   114 
       
   115 
       
   116 TIndexType CEapMsChapV2UiConnection::GetIndexType()
       
   117 {
       
   118     return iIndexType;
       
   119 }
       
   120 
       
   121 
       
   122 TInt CEapMsChapV2UiConnection::GetIndex()
       
   123 {
       
   124     return iIndex;
       
   125 }
       
   126 
       
   127 
       
   128 TInt CEapMsChapV2UiConnection::GetTunnelingType()
       
   129 {
       
   130     return iTunnelingType;
       
   131 }
       
   132 
       
   133 TInt CEapMsChapV2UiConnection::GetBearerEAPType()
       
   134 {
       
   135 	return iEAPType;
       
   136 }
       
   137 
       
   138 // End of file
       
   139 
       
   140