accesssec_plat/eap_type_api/inc/EapTypePlugin.inl
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
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: 6 %
       
    20 */
       
    21 
       
    22 /* The meaning and bit positions used in "opaque_data" field in ECOM implementation
       
    23 
       
    24  0 0 0 0 0 0 0 0 ---->All 0 means allowed both inside (encapsulated EAP) and outside (Outer EAP)
       
    25  | | | | | | | |
       
    26  | | | | | | | |_____ 1 means NOT_INSIDE_TUNNEL (NOT allowed as encapsulated EAP)
       
    27  | | | | | | |
       
    28  | | | | | | |_______ 1 means NOT_OUTSIDE_TUNNEL (only allowed as encapsulated EAP, NOT as outer EAP)
       
    29  | | | | | |  
       
    30  | | | | | |_________ 1 means NOT_INSIDE_PEAP
       
    31  | | | | |  
       
    32  | | | | |___________ 1 means NOT_OUTSIDE_PEAP  
       
    33  | | | | 
       
    34  | | | |_____________ 1 means NOT_INSIDE_TTLS
       
    35  | | | 
       
    36  | | |_______________ 1 means NOT_OUTSIDE_TTLS
       
    37  | | 
       
    38  | |_________________ 1 means NOT_INSIDE_FAST
       
    39  |
       
    40  |___________________ 1 means NOT_OUTSIDE_FAST
       
    41  
       
    42  
       
    43  // For historical reasons NOT_OUTSIDE_PEAP is used instead of NOT_OUTSIDE_TUNNEL
       
    44  // Both of these convey the same meaning. It means if an EAP is not allowed outside PEAP
       
    45  // (DisallowedOutsidePEAP), it can be used only as an encapsulated EAP.
       
    46  // EAP-MSCHAPv2 is an example for this.
       
    47 
       
    48  // The bits can be ORed. 
       
    49  // "NOT_OUTSIDE|NOT_OUTSIDE_PEAP" is 0x0A (0000 1010).
       
    50  // "NOT_OUTSIDE|NOT_OUTSIDE_PEAP|NOT_INSIDE_PEAP|NOT_INSIDE_FAST" is 0x4E (0100 1110).
       
    51  // "NOT_INSIDE|NOT_INSIDE_PEAP|NOT_INSIDE_TTLS|NOT_INSIDE_FAST" is 0x55 (0101 0101).
       
    52  // "NOT_INSIDE|NOT_INSIDE_PEAP|NOT_INSIDE_TTLS|NOT_INSIDE_FAST|NOT_OUTSIDE_PEAP|NOT_OUTSIDE" is 0x5F (0101 1111).
       
    53  
       
    54 */
       
    55 
       
    56 #include "EapTraceSymbian.h"
       
    57 
       
    58 
       
    59 const TUint8 KNotInsideTunnel = 0x01; // Only the last bit position is 1. 		(0000 0001)
       
    60 const TUint8 KNotOutsideTunnel = 0x02; // Only the 2nd last bit positions is 1. (0000 0010)
       
    61 
       
    62 const TUint8 KNotInsidePEAP = 0x04; // Only the 3rd last bit position is 1. 	(0000 0100)
       
    63 const TUint8 KNotOutsidePEAP = 0x08; // Only the 4th last bit positions is 1. 	(0000 1000)
       
    64 
       
    65 const TUint8 KNotInsideTTLS = 0x10; // Only the 5th last bit position is 1. 	(0001 0000)
       
    66 const TUint8 KNotOutsideTTLS = 0x20; // Only the 6th last bit position is 1. 	(0010 0000)
       
    67 
       
    68 const TUint8 KNotInsideFAST = 0x40; // Only the 7th last bit position is 1. 	(0100 0000)
       
    69 const TUint8 KNotOutsideFAST = 0x80;  // Only the first bit position is 1. 		(1000 0000)
       
    70 
       
    71 // Used By Server
       
    72 inline CEapTypePlugin* CEapTypePlugin::NewL(const TDesC8& aCue, TIndexType aIndexType, TInt aIndex)
       
    73 {
       
    74     EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTypePlugin::NewL(): start")));
       
    75 
       
    76 	// The EAP type id (aCue) is passed to ECom as resolver parameters
       
    77     TEComResolverParams resolverParams;
       
    78     resolverParams.SetDataType(aCue);
       
    79 	
       
    80 	// The arguments are stored to a iapInfo struct.
       
    81 	SIapInfo iapInfo;
       
    82 	iapInfo.indexType = aIndexType;
       
    83 	iapInfo.index = aIndex;
       
    84 	iapInfo.aEapType = aCue;
       
    85 
       
    86 	EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTypePlugin::NewL(): resolverParams.DataType()",
       
    87 		resolverParams.DataType().Ptr(),
       
    88 		resolverParams.DataType().Size()));
       
    89 
       
    90     EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTypePlugin::NewL(): iapInfo.aEapType=0xfe%06x%08x\n"),
       
    91 		iapInfo.aEapType.GetVendorId(),
       
    92 		iapInfo.aEapType.GetVendorType()));
       
    93 
       
    94 	// This call finds and loads the correct DLL and after that calls the
       
    95 	// entry function in the interface implementation in the DLL.
       
    96 	TAny* ptr = 0;
       
    97 
       
    98     TRAPD( err, ptr = REComSession::CreateImplementationL(
       
    99         KEapTypeInterfaceUid,
       
   100         _FOFF(CEapTypePlugin, iDtor_ID_Key), 
       
   101 		&iapInfo,
       
   102         resolverParams));
       
   103 
       
   104     EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTypePlugin::NewL(): ends, err=%d, returns ptr=0x%08x\n"),
       
   105 		err,
       
   106 		ptr));
       
   107 
       
   108 	User::LeaveIfError(err);
       
   109 
       
   110     return (CEapTypePlugin *) ptr;
       
   111 }
       
   112 
       
   113 inline CEapTypePlugin::~CEapTypePlugin()
       
   114 {
       
   115     EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTypePlugin::~CEapTypePlugin(): this=0x%08x"),
       
   116 		this));
       
   117 
       
   118 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTypePlugin::~CEapTypePlugin()"));
       
   119 
       
   120 	// Unload DLL
       
   121     REComSession::DestroyedImplementation(iDtor_ID_Key);
       
   122 }
       
   123 
       
   124 inline TBool CEapTypePlugin::IsDisallowedOutsidePEAP(const CImplementationInformation& aImplInfo)
       
   125 {
       
   126 	
       
   127 	const TUint8 pluginOpaqueData = *(aImplInfo.OpaqueData().Ptr());
       
   128 	
       
   129 	if(pluginOpaqueData & KNotOutsidePEAP)
       
   130 	{
       
   131 		return ETrue;
       
   132 	}
       
   133 	return EFalse;
       
   134 	
       
   135 }
       
   136 
       
   137 inline TBool CEapTypePlugin::IsDisallowedInsidePEAP(const CImplementationInformation& aImplInfo)
       
   138 {
       
   139 	const TUint8 pluginOpaqueData = *(aImplInfo.OpaqueData().Ptr());
       
   140 	
       
   141 	if(pluginOpaqueData & KNotInsidePEAP)
       
   142 	{
       
   143 		return ETrue;
       
   144 	}
       
   145 	return EFalse;
       
   146 
       
   147 }
       
   148 
       
   149 inline TBool CEapTypePlugin::IsDisallowedInsideTTLS(const CImplementationInformation& aImplInfo)
       
   150 {
       
   151 	const TUint8 pluginOpaqueData = *(aImplInfo.OpaqueData().Ptr());
       
   152 	
       
   153 	if(pluginOpaqueData & KNotInsideTTLS)
       
   154 	{
       
   155 		return ETrue;
       
   156 	}
       
   157 	return EFalse;
       
   158 }
       
   159 
       
   160 // End of file