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