1// PDL grammar file for netlink packet format.
2//
3// This only includes definitions necessary for the mac80211_hwsim
4// use case.
5//
6// See
7//   - [RFC 3549](https://datatracker.ietf.org/doc/html/rfc3549)
8//   - netlink.h
9
10
11// Host byte order
12little_endian_packets
13
14// Netlink Message Header
15
16struct NlMsgHdr {
17    nlmsg_len : 32,             // Length of message including header
18    nlmsg_type : 16,            // Message type identifier
19    nlmsg_flags : 16,           // Flags (NLM_F_)
20    nlmsg_seq : 32,             // Sequence number
21    nlmsg_pid : 32,             // Sending process port ID
22}
23
24// Netlink Attribute Header
25
26/*
27 *  <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
28 * +---------------------+- - -+- - - - - - - - - -+- - -+
29 * |        Header       | Pad |     Payload       | Pad |
30 * |   (struct nlattr)   | ing |                   | ing |
31 * +---------------------+- - -+- - - - - - - - - -+- - -+
32 *  <-------------- nlattr->nla_len -------------->
33 */
34
35/*
36 * nla_type (16 bits)
37 * +---+---+-------------------------------+
38 * | N | O | Attribute Type                |
39 * +---+---+-------------------------------+
40 * N := Carries nested attributes
41 * O := Payload stored in network byte order
42 *
43 * Note: The N and O flag are mutually exclusive.
44 */
45
46// Base netlink attribute TLV header.
47
48struct NlAttrHdr {
49    nla_len : 16,
50    nla_type: 14,
51    nla_m : 1,
52    nla_o : 1,
53}
54
55