- filter parameters. This is a byte offset (1 based) into the underlying data structure, a value to match against, and an optional mask to use for matching.
The data structure used for filtering is 12 bytes of [radio header](#the-radio-header), and then the actual frame. The first byte of the frame is therefore numbered 13. The filter
values of 13, 0x80 will just extract beacon frames.
-`mgmt_frame_callback` is a function which is invoked with a single argument which is a `wifi.packet` object which has many methods and attributes.
-`channel` sets the channel number in the range 1 to 15.
#### Returns
nothing.
# wifi.packet object
This object provides access to the raw packet data and also many methods to extract data from the packet in a simple way.
## packet:radio_byte()
This is like the `string.byte` method, except that it gives access to the bytes of the [radio header](#the-radio-header).
#### Syntax
`packet:radio_byte(n)`
#### Parameters
-`n` the byte number (1 based) to get from the [radio header](#the-radio-header) portion of the packet
#### Returns
0-255 as the value of the byte
nothing if the offset is not within the [radio header](#the-radio-header).
## packet:frame_byte()
This is like the `string.byte` method, except that it gives access to the bytes of the received frame.
#### Syntax
`packet:frame_byte(n)`
#### Parameters
-`n` the byte number (1 based) to get from the received frame.
#### Returns
0-255 as the value of the byte
nothing if the offset is not within the received frame.
## packet:radio_sub()
This is like the `string.sub` method, except that it gives access to the bytes of the [radio header](#the-radio-header).
#### Syntax
`packet:radio_sub(start, end)`
#### Parameters
Same rules as for `string.sub` except that it operates on the [radio header](#the-radio-header).
#### Returns
A string according to the `string.sub` rules.
## packet:frame_sub()
This is like the `string.sub` method, except that it gives access to the bytes of the received frame.
#### Syntax
`packet:frame_sub(start, end)`
#### Parameters
Same rules as for `string.sub` except that it operates on the received frame.
#### Returns
A string according to the `string.sub` rules.
## packet:radio_subhex()
This is like the `string.sub` method, except that it gives access to the bytes of the [radio header](#the-radio-header). It also
converts them into hex efficiently.
#### Syntax
`packet:radio_subhex(start, end [, seperator])`
#### Parameters
Same rules as for `string.sub` except that it operates on the [radio header](#the-radio-header).
-`seperator` is an optional sting which is placed between the individual hex pairs returned.
#### Returns
A string according to the `string.sub` rules, converted into hex with possible inserted spacers.
## packet:frame_sub()
This is like the `string.sub` method, except that it gives access to the bytes of the received frame.
#### Syntax
`packet:frame_subhex(start, end [, seperator])`
#### Parameters
Same rules as for `string.sub` except that it operates on the received frame.
-`seperator` is an optional sting which is placed between the individual hex pairs returned.
#### Returns
A string according to the `string.sub` rules, converted into hex with possible inserted spacers.
## packet:ie_table()
This returns a table of the information elements from the management frame. The table keys values are the
information element numbers (0 - 255). Note that IE0 is the SSID. This method is mostly only useful if
you need to determine which information elements were in the management frame.
#### Syntax
`packet:ie_table()`
#### Parameters
None.
#### Returns
A table with all the information elements in it.
#### Example
```
print ("SSID", packet:ie_table()[0])
```
Note that this is possibly the worst way of getting the SSID.
#### Alternative
The `packet` object itself can be indexed to extract the information elements.
#### Example
```
print ("SSID", packet[0])
```
This is more efficient than the above approach, but requires you to remember that IE0 is the SSID.
## packet.<attribute>
The packet object has many attributes on it. These allow easy access to all the fields, though not an easy way to enumerate them. All integers are unsigned
except where noted. Information Elements are only returned if they are completely within the captured frame. This can mean that for some frames, some of the
information elements can be missing.
When a string is returned as the value of a field, it can (and often is) be a binary string with embedded nulls. All information elements are returned as strings
even if they are only one byte long and look like a number in the specification. This is purely to make the interface consistent. Note that even SSIDs can contain
embedded nulls.
| Attribute name | Type |
|:--------------------|:-------:|
| aggregation | Integer |
| ampdu_cnt | Integer |
| association_id | Integer |
| authentication_algorithm | Integer |
| authentication_transaction | Integer |
| beacon_interval | Integer |
| beacon_interval | Integer |
| bssid | String |
| bssid_hex | String |
| bssidmatch0 | Integer |
| bssidmatch1 | Integer |
| capability | Integer |
| channel | Integer |
| current_ap | String |
| cwb | Integer |
| dmatch0 | Integer |
| dmatch1 | Integer |
| dstmac | String |
| dstmac_hex | String |
| duration | Integer |
| fec_coding | Integer |
| frame | String (the entire received frame) |
| frame_hex | String |
| fromds | Integer |
| header | String (the fixed part of the management frame) |