fullmac_helpers/
config.rs1use test_realm_helpers::constants::DEFAULT_CLIENT_STA_ADDR;
6use wlan_common::ie::fake_ht_capabilities;
7use zerocopy::IntoBytes;
8use {
9 fidl_fuchsia_wlan_common as fidl_common, fidl_fuchsia_wlan_fullmac as fidl_fullmac,
10 fidl_fuchsia_wlan_ieee80211 as fidl_ieee80211, fidl_fuchsia_wlan_sme as fidl_sme,
11};
12
13#[derive(Debug, Clone)]
18pub struct FullmacDriverConfig {
19 pub query_info: fidl_fullmac::WlanFullmacImplQueryResponse,
20 pub mac_sublayer_support: fidl_common::MacSublayerSupport,
21 pub security_support: fidl_common::SecuritySupport,
22 pub spectrum_management_support: fidl_common::SpectrumManagementSupport,
23 pub sme_legacy_privacy_support: fidl_sme::LegacyPrivacySupport,
24}
25
26impl Default for FullmacDriverConfig {
27 fn default() -> Self {
29 Self {
30 query_info: default_fullmac_query_info(),
31 mac_sublayer_support: default_mac_sublayer_support(),
32 security_support: default_security_support(),
33 spectrum_management_support: default_spectrum_management_support(),
34 sme_legacy_privacy_support: default_sme_legacy_privacy_support(),
35 }
36 }
37}
38
39impl FullmacDriverConfig {
40 pub fn default_ap() -> Self {
41 Self {
42 query_info: fidl_fullmac::WlanFullmacImplQueryResponse {
43 role: Some(fidl_common::WlanMacRole::Ap),
44 ..default_fullmac_query_info()
45 },
46 ..Default::default()
47 }
48 }
49}
50
51pub fn default_fullmac_query_info() -> fidl_fullmac::WlanFullmacImplQueryResponse {
52 fidl_fullmac::WlanFullmacImplQueryResponse {
53 sta_addr: Some(DEFAULT_CLIENT_STA_ADDR),
54 role: Some(fidl_common::WlanMacRole::Client),
55 band_caps: Some(vec![default_fullmac_band_capability()]),
56 ..Default::default()
57 }
58}
59
60pub fn default_mac_sublayer_support() -> fidl_common::MacSublayerSupport {
61 fidl_common::MacSublayerSupport {
62 rate_selection_offload: fidl_common::RateSelectionOffloadExtension { supported: false },
63 data_plane: fidl_common::DataPlaneExtension {
64 data_plane_type: fidl_common::DataPlaneType::GenericNetworkDevice,
65 },
66 device: fidl_common::DeviceExtension {
67 is_synthetic: false,
68 mac_implementation_type: fidl_common::MacImplementationType::Fullmac,
69 tx_status_report_supported: false,
70 },
71 }
72}
73
74pub fn default_security_support() -> fidl_common::SecuritySupport {
75 fidl_common::SecuritySupport {
76 sae: fidl_common::SaeFeature {
77 driver_handler_supported: false,
78 sme_handler_supported: true,
79 },
80 mfp: fidl_common::MfpFeature { supported: true },
81 }
82}
83
84pub fn default_sme_legacy_privacy_support() -> fidl_sme::LegacyPrivacySupport {
85 fidl_sme::LegacyPrivacySupport { wep_supported: false, wpa1_supported: false }
86}
87
88fn default_spectrum_management_support() -> fidl_common::SpectrumManagementSupport {
89 fidl_common::SpectrumManagementSupport { dfs: fidl_common::DfsFeature { supported: false } }
90}
91
92fn default_fullmac_band_capability() -> fidl_fullmac::BandCapability {
93 fidl_fullmac::BandCapability {
94 band: Some(fidl_ieee80211::WlanBand::TwoGhz),
95 basic_rates: Some(vec![2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108]),
96 ht_caps: Some(fidl_ieee80211::HtCapabilities {
97 bytes: fake_ht_capabilities().as_bytes().try_into().unwrap(),
98 }),
99 vht_caps: None,
100 operating_channels: Some((1..11).collect()),
103 ..Default::default()
104 }
105}