1 /* |
|
2 * Copyright (c) 2001-2010 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-expanded type definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 17 % |
|
20 */ |
|
21 |
|
22 #ifndef _SYMBIAN_EAP_EXPANDED_TYPE_H_ |
|
23 #define _SYMBIAN_EAP_EXPANDED_TYPE_H_ |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 const TUint KEapExpandedTypeLength = 8; |
|
28 |
|
29 //-------------------------------------------------- |
|
30 |
|
31 class TEapExpandedType |
|
32 { |
|
33 public: |
|
34 |
|
35 IMPORT_C TEapExpandedType(); |
|
36 |
|
37 IMPORT_C virtual ~TEapExpandedType(); |
|
38 |
|
39 IMPORT_C TEapExpandedType(const TEapExpandedType * const init); |
|
40 |
|
41 IMPORT_C TEapExpandedType(const TEapExpandedType & init); |
|
42 |
|
43 IMPORT_C TEapExpandedType(const TBufC8<KEapExpandedTypeLength> & init); |
|
44 |
|
45 IMPORT_C TEapExpandedType(const TDesC8 & init); |
|
46 |
|
47 IMPORT_C const TBuf8<KEapExpandedTypeLength> & GetValue() const; |
|
48 |
|
49 IMPORT_C TInt SetValue( |
|
50 const void * const data, |
|
51 const TUint data_length); |
|
52 |
|
53 IMPORT_C TInt SetValue( |
|
54 const TUint vendor_id, |
|
55 const TUint vendor_type); |
|
56 |
|
57 IMPORT_C TEapExpandedType &operator = (const TEapExpandedType & right_type_value); |
|
58 |
|
59 IMPORT_C TEapExpandedType &operator = (const TBufC8<KEapExpandedTypeLength> & right_type_value); |
|
60 |
|
61 IMPORT_C TEapExpandedType &operator = (const TDesC8 &right_type_value); |
|
62 |
|
63 IMPORT_C TInt Compare(const TEapExpandedType &right_type_value) const; |
|
64 |
|
65 IMPORT_C bool operator == (const TEapExpandedType &right_type_value) const; |
|
66 |
|
67 IMPORT_C bool operator != (const TEapExpandedType &right_type_value) const; |
|
68 |
|
69 IMPORT_C TUint GetVendorId() const; |
|
70 |
|
71 IMPORT_C TUint GetVendorType() const; |
|
72 |
|
73 private: |
|
74 |
|
75 TBuf8<KEapExpandedTypeLength> iValue; |
|
76 }; |
|
77 |
|
78 //-------------------------------------------------- |
|
79 |
|
80 /// This template is binary compatible with TEapExpandedType. |
|
81 template <TUint buffer_length> |
|
82 class TConstEapExpandedTypeTemplate |
|
83 { |
|
84 public: |
|
85 |
|
86 /// GetType() casts the constant TConstEapExpandedTypeTemplate<KEapExpandedTypeLength> object to TEapExpandedType *. |
|
87 inline const TBufC8<buffer_length> * GetType() const; |
|
88 |
|
89 // These must be public. |
|
90 TUint m_field_length; |
|
91 TUint8 m_field[buffer_length]; |
|
92 }; |
|
93 |
|
94 template <TUint buffer_length> |
|
95 inline const TBufC8<buffer_length> * TConstEapExpandedTypeTemplate<buffer_length>::GetType() const |
|
96 { |
|
97 return reinterpret_cast<const TBufC8<buffer_length> *>(this); |
|
98 } |
|
99 |
|
100 //-------------------------------------------------- |
|
101 |
|
102 /// Macro initializes const TEapExpandedType object named "name". |
|
103 /// Each value value1 ... value8 initializes 8-bit byte of expanded EAP-type. |
|
104 /// EAP-type field is defined in RFC3748: |
|
105 /// 0 1 2 3 |
|
106 /// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
|
107 /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
108 /// | Type | Vendor-Id | |
|
109 /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
110 /// | Vendor-Type | |
|
111 /// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
112 /// |
|
113 /// Type |
|
114 /// |
|
115 /// 254 for Expanded Type |
|
116 /// |
|
117 /// Vendor-Id |
|
118 /// |
|
119 /// The Vendor-Id is 3 octets and represents the SMI Network |
|
120 /// Management Private Enterprise Code of the Vendor in network byte |
|
121 /// order, as allocated by IANA. A Vendor-Id of zero is reserved for |
|
122 /// use by the IETF in providing an expanded global EAP Type space. |
|
123 /// |
|
124 /// Vendor-Type |
|
125 /// |
|
126 /// The Vendor-Type field is four octets and represents the vendor- |
|
127 /// specific method Type. |
|
128 /// |
|
129 /// If the Vendor-Id is zero, the Vendor-Type field is an extension |
|
130 /// and superset of the existing namespace for EAP Types. The first |
|
131 /// 256 Types are reserved for compatibility with single-octet EAP |
|
132 /// Types that have already been assigned or may be assigned in the |
|
133 /// future. Thus, EAP Types from 0 through 255 are semantically |
|
134 /// identical, whether they appear as single octet EAP Types or as |
|
135 /// Vendor-Types when Vendor-Id is zero. There is one exception to |
|
136 /// this rule: Expanded Nak and Legacy Nak packets share the same |
|
137 /// Type, but must be treated differently because they have a |
|
138 /// different format. |
|
139 /// |
|
140 /// Macro casts initialized TConstEapExpandedTypeTemplate<KEapExpandedTypeLength>. |
|
141 #define EAP_EXPANDED_TYPE_CONST(name, value1, value2, value3, value4, value5, value6, value7, value8) \ |
|
142 static const TConstEapExpandedTypeTemplate<KEapExpandedTypeLength> name \ |
|
143 = {KEapExpandedTypeLength, {value1, value2, value3, value4, value5, value6, value7, value8}} |
|
144 |
|
145 //-------------------------------------------------- |
|
146 |
|
147 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeNone, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); |
|
148 |
|
149 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeGtc, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06); |
|
150 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeTls, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d); |
|
151 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeLeap, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11); |
|
152 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeSim, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12); |
|
153 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeTtls, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15); |
|
154 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeAka, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17); |
|
155 EAP_EXPANDED_TYPE_CONST(EapExpandedTypePeap, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19); |
|
156 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeMsChapv2, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a); |
|
157 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeFast, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b); |
|
158 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeProtectedSetup, 0xfe, 0x00, 0x37, 0x2a, 0x00, 0x00, 0x00, 0x01); |
|
159 |
|
160 EAP_EXPANDED_TYPE_CONST(EapExpandedTypeTtlsPap, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x62); // This is for internal use only. This value is used in configuration of TTLS/PAP. |
|
161 EAP_EXPANDED_TYPE_CONST(EapExpandedPlainMsChapv2, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63); // This is for internal use only. This value is used in configuration of TTLS/plain-MsChapv2. |
|
162 |
|
163 //-------------------------------------------------- |
|
164 |
|
165 #endif // _SYMBIAN_EAP_EXPANDED_TYPE_H_ |
|
166 |
|
167 // End of file |
|