|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Class for parsing 802.11e QBSS Load IE. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "core_frame_qbss_load_ie.h" |
|
20 #include "core_tools.h" |
|
21 #include "core_tools_parser.h" |
|
22 #include "am_debug.h" |
|
23 |
|
24 const u8_t CORE_FRAME_QBSS_LOAD_IE_LENGTH = 7; |
|
25 const u8_t CORE_FRAME_QBSS_LOAD_IE_STATION_COUNT_OFFSET = 2; |
|
26 const u8_t CORE_FRAME_QBSS_LOAD_IE_CHANNEL_UTILIZATION_OFFSET = 4; |
|
27 const u8_t CORE_FRAME_QBSS_LOAD_IE_ADMISSION_CAPACITY_OFFSET = 5; |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 core_frame_qbss_load_ie_c* core_frame_qbss_load_ie_c::instance( |
|
33 const core_frame_dot11_ie_c& ie ) |
|
34 { |
|
35 if ( ie.data_length() != CORE_FRAME_QBSS_LOAD_IE_LENGTH ) |
|
36 { |
|
37 DEBUG( "core_frame_qbss_load_ie_c::instance() - not a valid IE, invalid length" ); |
|
38 |
|
39 return NULL; |
|
40 } |
|
41 |
|
42 core_frame_qbss_load_ie_c* instance = new core_frame_qbss_load_ie_c( |
|
43 ie.data_length(), |
|
44 ie.data(), |
|
45 0 ); |
|
46 if ( !instance ) |
|
47 { |
|
48 DEBUG( "core_frame_qbss_load_ie_c::instance() - unable to create an instance" ); |
|
49 |
|
50 return NULL; |
|
51 } |
|
52 |
|
53 return instance; |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 core_frame_qbss_load_ie_c::~core_frame_qbss_load_ie_c() |
|
60 { |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 u16_t core_frame_qbss_load_ie_c::station_count() const |
|
67 { |
|
68 return core_tools_c::get_u16( |
|
69 data_m, |
|
70 CORE_FRAME_QBSS_LOAD_IE_STATION_COUNT_OFFSET ); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 u8_t core_frame_qbss_load_ie_c::channel_utilitization() const |
|
77 { |
|
78 return data_m[CORE_FRAME_QBSS_LOAD_IE_CHANNEL_UTILIZATION_OFFSET]; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 u16_t core_frame_qbss_load_ie_c::admission_capacity() const |
|
85 { |
|
86 return core_tools_c::get_u16( |
|
87 data_m, |
|
88 CORE_FRAME_QBSS_LOAD_IE_ADMISSION_CAPACITY_OFFSET ); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 core_frame_qbss_load_ie_c::core_frame_qbss_load_ie_c( |
|
95 u16_t data_length, |
|
96 const u8_t* data, |
|
97 u16_t max_data_length ) : |
|
98 core_frame_dot11_ie_c( data_length, data, max_data_length ) |
|
99 { |
|
100 } |