wlanAMPDUDeaggregate

Deaggregate A-MPDU and extract MPDUs

Description

example

[mpduList,delimiterCRCFail,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY) returns mpduList, a list of medium access control (MAC) protocol data units (MPDUs), by deaggregating ampdu, an aggregate MPDU (A-MPDU), for physical layer (PHY) format configuration cfgPHY. The function also returns delimiterCRCFail, which indicates any delimiter cyclic redundancy check (CRC) failures for subframes found in ampdu, and status, the status of A-MPDU deaggregation.

example

[mpduList,delimiterCRCFail,status] = wlanAMPDUDeaggregate(___,'DataFormat',format) specifies the data format of the ampdu.

Examples

collapse all

Deaggregate a very-high-throughput-format (VHT-format) A-MPDU specified in bit form.

Create a WLAN MAC frame configuration object, specifying the frame type and format.

cfgMAC =  wlanMACFrameConfig('FrameType','QoS Data','FrameFormat','VHT');

Create a VHT-format configuration object with default settings.

cfgPHY = wlanVHTConfig;

Create a random payload of eight MSDUs and use it to generate an A-MPDU in octet form.

payload = repmat({randi([0 255],1,40)},1,8);
ampduOctets = wlanMACFrame(payload,cfgMAC,cfgPHY);

Convert the A-MPDU to bit form.

ampdu = reshape(de2bi(hex2dec(ampduOctets),8)',[],1);

Return the list of MPDUs by deaggregating the A-MPDU.

[mpduList,delimiterCRCFail,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY);

Deaggregate a high-throughput-format (HT-format) A-MPDU, specified in octet form.

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-format configuration object, specifying MPDU aggregation.

cfgPHY = wlanHTConfig('AggregatedMPDU',1);

Create a random payload of eight MSDUs and use it generate an A-MPDU in octet form.

payload = repmat({randi([0 255],1,40)},1,8);
ampdu = wlanMACFrame(payload,cfgMAC,cfgPHY);

Return the list of MPDUs by deaggregating the A-MPDU.

[mpduList,delimiterCRCFail,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY,'DataFormat','octets');

Deaggregate a VHT-format A-MPDU and decode the extracted MPDUs.

Create a WLAN MAC frame configuration object for a VHT-format 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);

Return the list of MPDUs by deaggregating the A-MPDU. Display the status of the deaggregation and the delimiter CRC.

[mpduList, delimiterCRCFail, status] = ... 
    wlanAMPDUDeaggregate(ampdu,cfgPHY,'DataFormat','octets');
disp(status)
    Success
disp(delimiterCRCFail)
   0   0   0   0   0   0   0   0

Decode all the MPDUs in the extracted list.

if strcmp(status,'Success')
    for i = 1:numel(mpduList)
        if ~delimiterCRCFail(i)
            [cfgMAC, payload, decodeStatus] = ...
                wlanMPDUDecode(mpduList{i},cfgPHY,'DataFormat','octets');
        end
    end
end

Input Arguments

collapse all

A-MPDU to be deaggregated, specified as one of these values:

  • a binary vector representing the A-MPDU in bit format;

  • a numeric vector representing octets in decimal format, where each element is an integer in the interval [0, 255];

  • 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: double | char | string

PHY format configuration, specified as an object of type wlanHESUConfig, wlanVHTConfig, or wlanHTConfig. This object defines the PHY format configuration and its applicable properties.

Format of the input A-MPDU, specified as 'bits' or 'octets'.

Data Types: string

Output Arguments

collapse all

List 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

Delimiter CRC failure indicator, returned as a row vector of logical values. Each element of delimiterCRCFail indicates the delimiter CRC failure status for an A-MPDU subframe.

A value of 1 for the kth element of delimiterCRCFail 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 delimiterCRCFail 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 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 valueMember of enumeration classDecoding Status
0SuccessMAC frame successfully decoded
–1FCSFailedFrame check sequence (FCS) failed
–2InvalidProtocolVersionInvalid protocol version
–3UnsupportedFrameTypeUnsupported frame type
–4UnsupportedFrameSubtypeUnsupported frame subtype
–5NotEnoughDataInsufficient data to decode the frame
–6UnsupportedBAVariantUnsupported variant of Block Ack frame
–7UnknownBitmapSizeUnknown bitmap size
–8UnknownAddressExtModeUnknown address extension mode
–9MalformedAMSDULengthMalformed aggregated MAC service data unit (A-MSDU) with invalid length
–10MalformedSSIDMalformed service set identifier (SSID) information element (IE)
–11MalformedSupportedRatesIEMalformed supported rates IE
–12MalformedIELengthMalformed IE length field
–13MissingMandatoryIEsMandatory IEs missing
–14NoMPDUFoundNo MPDU found in the A-MPDU
–15CorruptedAMPDUAll the delimiters in the given A-MPDU failed the cyclic redundancy check (CRC)
–16InvalidDelimiterLengthInvalid length field in MPDU delimiter
–17MaxAMSDULenthExceededA-MSDU exceeded the maximum length limit
–18MaxMPDULengthExceededMPDU exceeded the maximum length limit
–19MaxMMPDULengthExceededMAC management frame exceeded the maximum length limit
–20MaxMSDULengthExceededMSDU exceeded the maximum length limit

An enumeration value other than 0 means that A-MPDU deaggregation stopped because the input A-MPDU is corrupt or malformed.

Data Types: int16

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2019a