diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-11 05:19:31 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-11 05:19:31 +0200 |
| commit | 30b7800f9ae0a7f26e292dbe55cc67fbe2d1b131 (patch) | |
| tree | c12af936e5c919405deb09623fd9a02929c112df /src/structs.rs | |
| parent | 7ddcacac7bbfaed303dcda7d14ab29cad94fd570 (diff) | |
add event printing, add join but not working yet.
Diffstat (limited to 'src/structs.rs')
| -rw-r--r-- | src/structs.rs | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/src/structs.rs b/src/structs.rs index bce9ab9ff..8a98d5227 100644 --- a/src/structs.rs +++ b/src/structs.rs | |||
| @@ -15,6 +15,7 @@ macro_rules! impl_bytes { | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | #[derive(Clone, Copy)] | 17 | #[derive(Clone, Copy)] |
| 18 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 18 | #[repr(C)] | 19 | #[repr(C)] |
| 19 | pub struct SdpcmHeader { | 20 | pub struct SdpcmHeader { |
| 20 | pub len: u16, | 21 | pub len: u16, |
| @@ -37,6 +38,7 @@ pub struct SdpcmHeader { | |||
| 37 | impl_bytes!(SdpcmHeader); | 38 | impl_bytes!(SdpcmHeader); |
| 38 | 39 | ||
| 39 | #[derive(Clone, Copy)] | 40 | #[derive(Clone, Copy)] |
| 41 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 40 | #[repr(C)] | 42 | #[repr(C)] |
| 41 | pub struct CdcHeader { | 43 | pub struct CdcHeader { |
| 42 | pub cmd: u32, | 44 | pub cmd: u32, |
| @@ -49,8 +51,9 @@ pub struct CdcHeader { | |||
| 49 | impl_bytes!(CdcHeader); | 51 | impl_bytes!(CdcHeader); |
| 50 | 52 | ||
| 51 | #[derive(Clone, Copy)] | 53 | #[derive(Clone, Copy)] |
| 54 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 52 | #[repr(C)] | 55 | #[repr(C)] |
| 53 | pub struct BdcHeader { | 56 | pub struct BcdHeader { |
| 54 | pub flags: u8, | 57 | pub flags: u8, |
| 55 | /// 802.1d Priority (low 3 bits) | 58 | /// 802.1d Priority (low 3 bits) |
| 56 | pub priority: u8, | 59 | pub priority: u8, |
| @@ -58,7 +61,36 @@ pub struct BdcHeader { | |||
| 58 | /// Offset from end of BDC header to packet data, in 4-uint8_t words. Leaves room for optional headers. | 61 | /// Offset from end of BDC header to packet data, in 4-uint8_t words. Leaves room for optional headers. |
| 59 | pub data_offset: u8, | 62 | pub data_offset: u8, |
| 60 | } | 63 | } |
| 61 | impl_bytes!(BdcHeader); | 64 | impl_bytes!(BcdHeader); |
| 65 | |||
| 66 | #[derive(Clone, Copy)] | ||
| 67 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 68 | #[repr(C)] | ||
| 69 | pub struct EventHeader { | ||
| 70 | /// version | ||
| 71 | pub version: u16, | ||
| 72 | /// see flags below | ||
| 73 | pub flags: u16, | ||
| 74 | /// Message (see below) | ||
| 75 | pub event_type: u32, | ||
| 76 | /// Status code (see below) | ||
| 77 | pub status: u32, | ||
| 78 | /// Reason code (if applicable) | ||
| 79 | pub reason: u32, | ||
| 80 | /// WLC_E_AUTH | ||
| 81 | pub auth_type: u32, | ||
| 82 | /// data buf | ||
| 83 | pub datalen: u32, | ||
| 84 | /// Station address (if applicable) | ||
| 85 | pub addr: [u8; 6], | ||
| 86 | /// name of the incoming packet interface | ||
| 87 | pub ifname: [u8; 16], | ||
| 88 | /// destination OS i/f index | ||
| 89 | pub ifidx: u8, | ||
| 90 | /// source bsscfg index | ||
| 91 | pub bsscfgidx: u8, | ||
| 92 | } | ||
| 93 | impl_bytes!(EventHeader); | ||
| 62 | 94 | ||
| 63 | #[derive(Clone, Copy)] | 95 | #[derive(Clone, Copy)] |
| 64 | #[repr(C)] | 96 | #[repr(C)] |
| @@ -78,6 +110,7 @@ pub const DOWNLOAD_FLAG_HANDLER_VER: u16 = 0x1000; | |||
| 78 | pub const DOWNLOAD_TYPE_CLM: u16 = 2; | 110 | pub const DOWNLOAD_TYPE_CLM: u16 = 2; |
| 79 | 111 | ||
| 80 | #[derive(Clone, Copy)] | 112 | #[derive(Clone, Copy)] |
| 113 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 81 | #[repr(C)] | 114 | #[repr(C)] |
| 82 | pub struct CountryInfo { | 115 | pub struct CountryInfo { |
| 83 | pub country_abbrev: [u8; 4], | 116 | pub country_abbrev: [u8; 4], |
| @@ -85,3 +118,21 @@ pub struct CountryInfo { | |||
| 85 | pub country_code: [u8; 4], | 118 | pub country_code: [u8; 4], |
| 86 | } | 119 | } |
| 87 | impl_bytes!(CountryInfo); | 120 | impl_bytes!(CountryInfo); |
| 121 | |||
| 122 | #[derive(Clone, Copy)] | ||
| 123 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 124 | #[repr(C)] | ||
| 125 | pub struct SsidInfo { | ||
| 126 | pub len: u32, | ||
| 127 | pub ssid: [u8; 32], | ||
| 128 | } | ||
| 129 | impl_bytes!(SsidInfo); | ||
| 130 | |||
| 131 | #[derive(Clone, Copy)] | ||
| 132 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 133 | #[repr(C)] | ||
| 134 | pub struct EventMask { | ||
| 135 | pub iface: u32, | ||
| 136 | pub events: [u8; 24], | ||
| 137 | } | ||
| 138 | impl_bytes!(EventMask); | ||
