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