Deaggregate A-MPDU and extract MPDUs
[
recovers mpduList
,failCRC
,status
] = wlanAMPDUDeaggregate(ampdu
,phyFormat
)mpduList
, a list of medium access control (MAC) protocol data
units (MPDUs), by deaggregating ampdu
, an aggregate MPDU (A-MPDU). The
function deaggregates the A-MPDU by using parameters appropriate for
phyFormat
, the physical layer (PHY) format.
The function also returns failCRC
, the delimiter cyclic redundancy
check (CRC) status for subframes found in ampdu
, and
status
, the status of A-MPDU deaggregation.
[
specifies options using one or more name-value pair arguments in addition to any input
argument combination from previous syntaxes.mpduList
,failCRC
,status
] = wlanAMPDUDeaggregate(___,Name,Value
)
Create a WLAN MAC frame configuration object, specifying the frame type, frame format, and MPDU aggregation.
cfgMAC = wlanMACFrameConfig('FrameType','QoS Data', ... 'FrameFormat','HT-Mixed','MPDUAggregation',1);
Create an HT configuration object, specifying MPDU aggregation.
cfgPHY = wlanHTConfig('AggregatedMPDU',1);
Create a random payload of eight MSDUs, and then use it generate an A-MPDU in bit form.
payload = repmat({randi([0 255],1,40)},1,8); ampdu = wlanMACFrame(payload,cfgMAC,cfgPHY,'OutputFormat','bits');
Return the list of MPDUs by deaggregating the A-MPDU.
phyFormat = 'HT';
[mpduList,failCRC,status] = wlanAMPDUDeaggregate(ampdu,phyFormat);
Confirm successful deaggregation by displaying the result of the delimiter CRC and the decoding status.
disp(failCRC)
0 0 0 0 0 0 0 0
disp(status)
Success
Create a WLAN MAC frame configuration object, specifying the frame type and frame format.
cfgMAC = wlanMACFrameConfig('FrameType','QoS Data','FrameFormat','VHT');
Create a VHT configuration object with default settings.
cfgPHY = wlanVHTConfig;
Create a random payload of eight MSDUs, and then use it to generate an A-MPDU in bit form.
payload = repmat({randi([0 255],1,40)},1,8); ampdu = wlanMACFrame(payload,cfgMAC,cfgPHY,'Outputformat','bits');
Deaggregate the A-MPDU.
[mpduList,failCRC,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY);
Confirm successful deaggregation by displaying the result of the delimiter CRC and the decoding status.
disp(failCRC)
0 0 0 0 0 0 0 0
disp(status)
Success
Deaggregate a VHT A-MPDU and decode the extracted MPDUs.
Create a WLAN MAC frame configuration object for a VHT A-MPDU.
txCfgMAC = wlanMACFrameConfig('FrameType','QoS Data','FrameFormat','VHT');
Create a VHT-format configuration object with default settings.
cfgPHY = wlanVHTConfig;
Generate a random payload of eight MSDUs.
txPayload = repmat({randi([0 255],1,40)},1,8);
Generate the A-MPDU containing eight MPDUs for the specified MAC and PHY configurations.
ampdu = wlanMACFrame(txPayload,txCfgMAC,cfgPHY);
Extract the list of MPDUs by deaggregating the A-MPDU. Display the status of the deaggregation and the delimiter CRC.
[mpduList,failCRC,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY,'DataFormat','octets'); disp(status)
Success
disp(failCRC)
0 0 0 0 0 0 0 0
Decode all of the MPDUs in the extracted. Confirm successful decoding by displaying the status.
if strcmp(status,'Success') for i = 1:numel(mpduList) if ~failCRC(i) [cfgMAC,payload,status(i)] = ... wlanMPDUDecode(mpduList{i},cfgPHY,'DataFormat','octets'); end end end disp(status)
Columns 1 through 7 Success Success Success Success Success Success Success Column 8 Success
ampdu
— A-MPDU to be deaggregatedA-MPDU to be deaggregated, specified as one of these values.
A binary-valued vector representing the A-MPDU in bit format
A vector of integers in the interval [0, 255] representing octets in decimal format
A string scalar representing the A-MPDU as octets in hexadecimal format
A character vector representing the A-MPDU as octets in hexadecimal format
A character array, where each row represents an octet in hexadecimal format
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| string
phyFormat
— PHY format'HE-SU'
| 'HE-EXT-SU'
| 'HE-MU
| 'HE-TB'
| 'VHT'
| 'HT'
PHY format, specified as one of these values.
'HE-SU'
— High-efficiency single-user (HE SU)
format
'HE-EXT-SU'
— HE extended-range SU (HE ER SU)
format
'HE-MU'
— HE multi-user (HE MU) format
'HE-TB'
— HE trigger-based (HE TB) format
'VHT'
— Very-high-throughput (VHT) format
'HT'
— High-throughput (HT) format
Data Types: char
| string
cfgPHY
— PHY format and transmission parameterswlanHESUConfig
object | wlanHEMUConfig
object | wlanHETBConfig
object | wlanHERecoveryConfig
object | wlanVHTConfig
object | wlanHTConfig
objectPHY format and transmission parameters, specified as one of these objects.
wlanHESUConfig
— HE SU or HE ER SU format
wlanHEMUConfig
— HE MU format
wlanHETBConfig
—
HE TB format
wlanHERecoveryConfig
— Recovered HE transmission in HE SU, HE
ER SU, or HE MU format
wlanVHTConfig
— VHT format
wlanHTConfig
— HT format
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'DataFormat','octets'
'DataFormat'
— Format of input A-MPDU'bits'
(default) | 'octets'
Format of input A-MPDU, specified as the comma-separated pair consisting of
'DataFormat'
and one of these values.
'bits'
— Specify the ampdu
input in bit format
'octets'
— Specify the ampdu
input in octet format
Data Types: char
| string
'SuppressWarnings'
— Suppress warning messagesfalse
or 0
(default) | true
or 1
Suppress warning messages, specified as the comma-separated pair consisting of
'SuppressWarnings'
and one of these values.
false
or 0
— Allow warning
messages.
true
or 1
— Suppress warning
messages.
Data Types: logical
mpduList
— List of MPDUsList of MPDUs, returned as a cell array of character arrays, where each character array corresponds to one MPDU. In these character arrays, each row is the hexadecimal representation of an octet.
If no MPDU delimiter is found in the input A-MPDU, the function returns
mpduList
as an empty cell array.
Data Types: cell
failCRC
— Delimiter CRC failure indicatorDelimiter CRC failure indicator, returned as a row vector of logical values. Each element of this vector indicates the delimiter CRC failure status for an A-MPDU subframe.
A value of 1
for the kth element of this
vector indicates that the delimiter CRC failed for the kth A-MPDU
subframe. In this case, the kth element of
mpduList
contains an MPDU that might be
invalid.
A value of 0
for the kth element of this
vector indicates that the delimiter CRC passed for the kth subframe.
In this case, the kth element of mpduList
contains a valid MPDU.
Data Types: logical
status
— Status of A-MPDU deaggregationStatus of A-MPDU deaggregation, returned as a nonpositive integer in the interval
[–20, 0]. Each enumeration value of status
corresponds to a member of
the wlanMACDecodeStatus
enumeration class, which indicates the status of
MAC frame parsing according to this table.
Enumeration value | Member of enumeration class | Decoding Status |
0 | Success | MAC frame successfully decoded |
–1 | FCSFailed | Frame check sequence (FCS) failed |
–2 | InvalidProtocolVersion | Invalid protocol version |
–3 | UnsupportedFrameType | Unsupported frame type |
–4 | UnsupportedFrameSubtype | Unsupported frame subtype |
–5 | NotEnoughData | Insufficient data to decode the frame |
–6 | UnsupportedBAVariant | Unsupported variant of Block Ack frame |
–7 | UnknownBitmapSize | Unknown bitmap size |
–8 | UnknownAddressExtMode | Unknown address extension mode |
–9 | MalformedAMSDULength | Malformed aggregated MAC service data unit (A-MSDU) with invalid length |
–10 | MalformedSSID | Malformed service set identifier (SSID) information element (IE) |
–11 | MalformedSupportedRatesIE | Malformed supported rates IE |
–12 | MalformedIELength | Malformed IE length field |
–13 | MissingMandatoryIEs | Mandatory IEs missing |
–14 | NoMPDUFound | No MPDU found in the A-MPDU |
–15 | CorruptedAMPDU | All the delimiters in the given A-MPDU failed the cyclic redundancy check (CRC) |
–16 | InvalidDelimiterLength | Invalid length field in MPDU delimiter |
–17 | MaxAMSDULenthExceeded | A-MSDU exceeds the maximum length limit |
–18 | MaxMPDULengthExceeded | MPDU exceeds the maximum length limit |
–19 | MaxMMPDULengthExceeded | MAC management frame exceeds the maximum length limit |
–20 | MaxMSDULengthExceeded | MSDU exceeds the maximum length limit |
–21 | UnexpectedProtectedFrame | Invalid value of protected bit for this frame type |
An enumeration value other than 0
means that A-MPDU deaggregation
stopped because the input A-MPDU is corrupt or malformed.
Data Types: int16
You have a modified version of this example. Do you want to open this example with your edits?