|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Implementation of the WlanPrivacyModeFilterWpa class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 10 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "UmacPrivacyModeFilterWpa.h" |
|
24 |
|
25 // ================= MEMBER FUNCTIONS ======================= |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 TBool WlanPrivacyModeFilterWpa::operator()( |
|
32 const SDataFrameHeader& aFrameheader, |
|
33 TBool aUserDataEnabled, |
|
34 TUint16 aEthernetType, |
|
35 TBool aUnicastKeyExists, |
|
36 TBool aAesOrTkipOrWapiEncrypted ) const |
|
37 { |
|
38 TBool ret( EFalse ); |
|
39 |
|
40 |
|
41 if ( ( // allow all that have WEP bit on |
|
42 aFrameheader.IsWepBitSet() |
|
43 // AND are going to protocol stack |
|
44 && aEthernetType != KEapolType |
|
45 // AND user data is enabled |
|
46 && aUserDataEnabled |
|
47 ) |
|
48 ||// OR |
|
49 ( // are EAPOL frames |
|
50 aEthernetType == KEapolType |
|
51 // AND have WEP bit on |
|
52 && aFrameheader.IsWepBitSet() |
|
53 // AND are AES or TKIP encrypted |
|
54 && aAesOrTkipOrWapiEncrypted |
|
55 ) |
|
56 ||// OR |
|
57 ( // are EAPOL frames |
|
58 aEthernetType == KEapolType |
|
59 // AND have WEP bit off |
|
60 && !( aFrameheader.IsWepBitSet() ) |
|
61 // AND AP <-> client unicast key is NOT set |
|
62 && !aUnicastKeyExists |
|
63 // AND are NOT AES or TKIP encrypted |
|
64 && !aAesOrTkipOrWapiEncrypted |
|
65 ) |
|
66 // OR are our test frames |
|
67 || aEthernetType == KBounceType |
|
68 ) |
|
69 { |
|
70 ret = ETrue; |
|
71 } |
|
72 else |
|
73 { |
|
74 OsTracePrint( KRxFrame, (TUint8*) |
|
75 ("UMAC: WlanPrivacyModeFilterWpa::operator: frame filtered") ); |
|
76 OsTracePrint( KRxFrame, (TUint8*) |
|
77 ("UMAC: WlanPrivacyModeFilterWpa::operator: wep bit: %d"), |
|
78 aFrameheader.IsWepBitSet() ); |
|
79 OsTracePrint( KRxFrame, (TUint8*) |
|
80 ("UMAC: WlanPrivacyModeFilterWpa::operator: ether type: 0x%04x"), |
|
81 aEthernetType ); |
|
82 OsTracePrint( KRxFrame, (TUint8*) |
|
83 ("UMAC: WlanPrivacyModeFilterWpa::operator: UserDataEnabled: %d"), |
|
84 aUserDataEnabled ); |
|
85 OsTracePrint( KRxFrame, (TUint8*) |
|
86 ("UMAC: WlanPrivacyModeFilterWpa::operator: UnicastKeyExists: %d"), |
|
87 aUnicastKeyExists ); |
|
88 OsTracePrint( KRxFrame, (TUint8*) |
|
89 ("UMAC: WlanPrivacyModeFilterWpa::operator: AES, TKIP or WAPI encrypted: %d"), |
|
90 aAesOrTkipOrWapiEncrypted ); |
|
91 } |
|
92 return ret; |
|
93 } |