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