eapol/eapol_framework/eapol_symbian/am/type/securid/symbian/plugin/src/EapGtcUiConnection.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 339 
       
    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 "EapGtcDbUtils.h"
       
    31 #include <EapGtcUiConnection.h>
       
    32 #include <EapGtcUiDataConnection.h>
       
    33 
       
    34 CEapGtcUiConnection::CEapGtcUiConnection(
       
    35     const TIndexType aIndexType,
       
    36     const TInt aIndex,
       
    37     const TInt aTunnelingType)
       
    38     : iIndexType(aIndexType)
       
    39     , iIndex(aIndex)
       
    40     , iTunnelingType(aTunnelingType)
       
    41     , iIsConnected(EFalse)
       
    42     , iDataConn(NULL)
       
    43 {
       
    44 }
       
    45 
       
    46 
       
    47 CEapGtcUiConnection::~CEapGtcUiConnection()
       
    48 {
       
    49 }
       
    50 
       
    51 
       
    52 TInt CEapGtcUiConnection::Connect()
       
    53 {
       
    54 #ifdef USE_EAP_EXPANDED_TYPES
       
    55 
       
    56 	eap_type_value_e tunnelingType(static_cast<eap_type_ietf_values_e>(iTunnelingType));
       
    57 
       
    58 #else
       
    59 
       
    60 	eap_type_value_e tunnelingType = static_cast<eap_type_value_e>(iTunnelingType);
       
    61 
       
    62 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
    63 
       
    64 	TRAPD(err, EapGtcDbUtils::OpenDatabaseL(
       
    65 		iDbNamedDatabase, 
       
    66 		iDbs, 
       
    67 		iIndexType, 
       
    68 		iIndex, 
       
    69 		tunnelingType));
       
    70     if (err == KErrNone)
       
    71     {
       
    72         iIsConnected = ETrue;
       
    73     }
       
    74 
       
    75     return err;
       
    76 }
       
    77 
       
    78 
       
    79 TInt CEapGtcUiConnection::Close()
       
    80 {
       
    81     if (iIsConnected)
       
    82     {
       
    83         iDbNamedDatabase.Close();
       
    84         iDbs.Close();
       
    85     }
       
    86     iIsConnected = EFalse;
       
    87 
       
    88     return KErrNone;
       
    89 }
       
    90 
       
    91 
       
    92 CEapGtcUiDataConnection * CEapGtcUiConnection::GetDataConnection()
       
    93 {
       
    94     if (!iDataConn)
       
    95     {
       
    96         iDataConn = new CEapGtcUiDataConnection(this);
       
    97     }
       
    98 
       
    99     return iDataConn;
       
   100 }
       
   101 
       
   102 TInt CEapGtcUiConnection::GetDatabase(RDbNamedDatabase & aDatabase)
       
   103 {
       
   104     if (iIsConnected == EFalse)
       
   105     {
       
   106         return KErrSessionClosed;
       
   107     }
       
   108 
       
   109     aDatabase = iDbNamedDatabase;
       
   110     return KErrNone;
       
   111 }
       
   112 
       
   113 
       
   114 TIndexType CEapGtcUiConnection::GetIndexType()
       
   115 {
       
   116     return iIndexType;
       
   117 }
       
   118 
       
   119 
       
   120 TInt CEapGtcUiConnection::GetIndex()
       
   121 {
       
   122     return iIndex;
       
   123 }
       
   124 
       
   125 
       
   126 TInt CEapGtcUiConnection::GetTunnelingType()
       
   127 {
       
   128     return iTunnelingType;
       
   129 }
       
   130 
       
   131 // End of File