xref: /aosp_15_r20/tools/netsim/pdl/ieee80211.pdl (revision cf78ab8cffb8fc9207af348f23af247fb04370a6)
1// PDL grammar file for ieee80211 packet format.
2//
3// This only includes definitions necessary for the mac80211_hwsim
4// use case.
5
6little_endian_packets
7
8custom_field MacAddress : 48 "macaddr/"
9
10// Frame type B3..B2
11enum FrameType : 2 {
12    MGMT = 0,
13    CTL = 1,
14    DATA = 2,
15    EXT = 3,
16}
17
18// Data substypes
19enum DataSubType : 4 {
20    DATA = 0,
21    DATA_CF_ACK = 1,
22    DATA_CF_POLL = 2,
23    DATA_CF_ACPL = 3,
24    NODATA = 4,
25    NODATA_CF_ACK = 5,
26    NODATA_CF_POLL = 6,
27    NODATA_CF_ACPL = 7,
28    QOS = 8,
29    QOS_NULL = 12,
30}
31
32// Management subtypes
33enum ManagementSubType : 4 {
34    ASSOC_REQ = 0,
35    ASSOC_RESP = 1,
36    REASSOC_REQ = 2,
37    REASSOC_RESP = 3,
38    PROBE_REQ = 4,
39    PROBE_RESP = 5,
40    BEACON = 8,
41    ATIM = 9,
42    DISASSOC = 10,
43    AUTH = 11,
44    DEAUTH = 12,
45    ACTION = 13,
46}
47
48group FrameControl {
49    version : 2,                // B1..B0
50    ftype: FrameType,           // B3..B2
51    stype: 4,                   // B7..B4
52    to_ds: 1,                   // B8
53    from_ds: 1,                 // B9
54    more_frags: 1,              // B10
55    retry: 1,                   // B11
56    pm : 1,                     // B12
57    more_data: 1,               // B13
58    protected: 1,               // B14
59    order: 1,                   // B15
60}
61
62
63packet Ieee80211 {
64    FrameControl,
65    duration_id: 16,
66    _payload_,
67}
68
69/*
70 * DS bit usage
71 *
72 * TA = transmitter address
73 * RA = receiver address
74 * DA = destination address
75 * SA = source address
76 *
77 * ToDS    FromDS  A1(RA)  A2(TA)  A3      A4      Use
78 * -----------------------------------------------------------------
79 *  0       0       DA      SA      BSSID   -       IBSS/DLS
80 *  0       1       DA      BSSID   SA      -       AP -> STA
81 *  1       0       BSSID   SA      DA      -       AP <- STA
82 *  1       1       RA      TA      DA      SA      unspecified (WDS)
83 */
84
85packet Ieee80211Ibss : Ieee80211 (to_ds=0, from_ds=0) {
86    destination : MacAddress,
87    source : MacAddress,
88    bssid : MacAddress,
89    seq_ctrl : 16,
90    payload: 8[],
91}
92
93packet Ieee80211FromAp : Ieee80211 (to_ds=0, from_ds=1) {
94    destination : MacAddress,
95    bssid : MacAddress,
96    source : MacAddress,
97    seq_ctrl : 16,
98    payload: 8[],
99}
100
101packet Ieee80211ToAp : Ieee80211 (to_ds=1, from_ds=0) {
102    bssid : MacAddress,
103    source : MacAddress,
104    destination : MacAddress,
105    seq_ctrl : 16,
106    payload: 8[],
107}
108
109packet Ieee80211Wds : Ieee80211 (to_ds=1, from_ds=1) {
110    receiver : MacAddress,
111    transmitter : MacAddress,
112    destination : MacAddress,
113    seq_ctrl : 16,
114    source : MacAddress,
115    payload: 8[],
116}
117