Skip to content

Commit

Permalink
extend documentation with primary source
Browse files Browse the repository at this point in the history
Includes references to the IEEE 802.11 Chapter that defines the Information Element

Signed-off-by: Lukas Raffelt <[email protected]>
  • Loading branch information
lukas-mbag committed Feb 7, 2024
1 parent 4ac0888 commit 40d9f30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions client_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,13 @@ func decodeSSID(b []byte) string {

// decodeBSSLoad Decodes the BSSLoad IE. Supports Version 1 and Version 2
// values according to https://raw.githubusercontent.com/wireshark/wireshark/master/epan/dissectors/packet-ieee80211.c
// See also source code of iw (v5.19) scan.c Line 1634ff
// BSS Load ELement (with length 5) is defined by chapter 9.4.2.27 (page 1066) of the current IEEE 802.11-2020
func decodeBSSLoad(b []byte) (*BSSLoad, error) {
var load BSSLoad
if len(b) == 5 {
// Wireshark calls this "802.11e CCA Version"
// This is the version defined in IEEE 802.11 (Versions 2007, 2012, 2016 and 2020)
load.Version = 2
load.StationCount = binary.LittleEndian.Uint16(b[0:2]) // first 2 bytes
load.ChannelUtilization = b[2] // next 1 byte
Expand Down
6 changes: 3 additions & 3 deletions wifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ type BSSLoad struct {
// Version of the BSS Load Element. Can be 1 or 2.
Version int

// Station Count on this BSS.
// Station Count: total number of STA currently associated with this BSS.
StationCount uint16

// Channel Utilization from 0 to 255
// Channel Utilization: Percentage of time (linearly scaled 0 to 255) that the AP sensed the medium was busy. Calculated only for the primary channel.
ChannelUtilization uint8

// Available Admission Capacity in unit [32 us/s]
// Available Admission Capacity: remaining amount of medium time availible via explicit admission controll in units of 32 us/s.
AvailableAdmissionCapacity uint16
}

Expand Down

0 comments on commit 40d9f30

Please sign in to comment.