WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2016-Dec-05 10:58:44

dang2327
Member
Registered: 2010-Jul-06
Posts: 28

Parsing Custom MAC Header in wlan_exp Python framework

Hi WARP team,

For our project we have created a custom directional MAC, with a custom MAC header which is different from the standard 802.11 MAC header and consists of the following fields:

1. Frame type (1B)
2. srcAddr (1B)
3. destAddr (1B)
4. Send direction (1B)
5. Control fields (2B)
6. MAC-level payload

Next we set up a standard 802.11 Ref. Des. node (using STA + NoMAC) to listen in on the send packets and record them in its log. Using the experimental framework, we would like to parse this header and group/filter packets by sender address. But since the MAC header is customized, we are stumped on how to parse the header when converting log entries to numpy structured arrays in Python. Could you advise how to do this?

Thank you for your support.

Best,
Danh

Offline

 

#2 2016-Dec-05 11:58:10

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Parsing Custom MAC Header in wlan_exp Python framework

But since the MAC header is customized, we are stumped on how to parse the header when converting log entries to numpy structured arrays in Python. Could you advise how to do this?

By default the TX_LOW and RX_OFDM log entries have a 'mac_payload' field that contains the first 24 bytes of the packet. We chose 24 bytes to capture the full 802.11 MAC header for most packets.

If you're operating on a numpy structured array of log data (i.e. after calling log_data_to_np_arrays()) the mac_payload field in each log entry is represented as a 1x24 array of ints. You can access this array like any other numpy array. You can also filter the overall log entry array using boolean arrays computed over the contents of the mac_payload fields. For example:

Code:

log_np = log_util.log_data_to_np_arrays(log_data, log_index)
rx = log_np['RX_OFDM']
rx_pylds = rx['mac_payload']

# Extract the first byte of every mac_payload
x = rx_pylds[:, 0]

# Filter the Rx array for packets where bytes[0:1] == [0x8, 0x42]
filt_idx = (rx_pylds[:, 0] == 0x8) & (rx_pylds[:, 1] == 0x42)
x = rx[filt_idx]

Offline

 

#3 2016-Dec-05 12:29:07

dang2327
Member
Registered: 2010-Jul-06
Posts: 28

Re: Parsing Custom MAC Header in wlan_exp Python framework

Thank you pmurphpo. Now if I want to also record in the log entry data the (directional) antenna mode that was used on the STA node to receive these packets, what would be a good way to do this? I can come up with two options:

1. Add `EXP_INFO` conveying current Rx antenna direction sporadically at the beginning of each configuration change (in C code), then keep recording the logs as normal. All Tx/Rx entries *between EXP_INFO* will belong to that directional Rx mode.
2. Extend the "ant_mode" field in "mpdu_info" to record Rx antenna direction instead of the chosen antenna.

Do any of this seem feasible to you?

Offline

 

#4 2016-Dec-05 12:36:47

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Parsing Custom MAC Header in wlan_exp Python framework

I think either approach would work. The 'ant_mode' option would make log processing easier (i.e. each log entry would be meaningful on its own vs. grouping entries between EXP_INFO timestamps).

Offline

 

#5 2016-Dec-05 14:49:54

dang2327
Member
Registered: 2010-Jul-06
Posts: 28

Re: Parsing Custom MAC Header in wlan_exp Python framework

Thanks again. What would the process be if I want to run experiment on WiFi Channel 14 using the experiments framework? The C code seems to respond with `ERROR_CONFIG_BSS_CHANNEL_INVALID` when I try to force channel 14 in Python.

Appreciate your help.

Last edited by dang2327 (2016-Dec-05 14:50:12)

Offline

 

#6 2016-Dec-06 09:59:31

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: Parsing Custom MAC Header in wlan_exp Python framework

The list of valid channels is enforced in a three places. All of these places must agree on a channel before you can tune to it with wlan_exp:

- In C, the wlan_verify_channel() function, which returns a boolean signaling whether or not tuning to a channel is allowed.
- Also in C, the wlan_mac_low_wlan_chan_to_rc_chan() function converts a WLAN channel number into an appropriate argument for radio_controller_setCenterFrequency to tune to the desired frequency.
- In Python, both the wlan_channels and channel_info variables.

Offline

 

Board footer