4 * Copyright (C) 2007, 2008 Siemens AG
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <linux/kernel.h>
18 #include <net/netlink.h>
19 #include <linux/nl802154.h>
21 #define NLA_HW_ADDR NLA_U64
23 const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = {
24 [IEEE802154_ATTR_DEV_NAME] = { .type = NLA_STRING, },
25 [IEEE802154_ATTR_DEV_INDEX] = { .type = NLA_U32, },
26 [IEEE802154_ATTR_PHY_NAME] = { .type = NLA_STRING, },
28 [IEEE802154_ATTR_STATUS] = { .type = NLA_U8, },
29 [IEEE802154_ATTR_SHORT_ADDR] = { .type = NLA_U16, },
30 [IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, },
31 [IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, },
32 [IEEE802154_ATTR_CHANNEL] = { .type = NLA_U8, },
33 [IEEE802154_ATTR_BCN_ORD] = { .type = NLA_U8, },
34 [IEEE802154_ATTR_SF_ORD] = { .type = NLA_U8, },
35 [IEEE802154_ATTR_PAN_COORD] = { .type = NLA_U8, },
36 [IEEE802154_ATTR_BAT_EXT] = { .type = NLA_U8, },
37 [IEEE802154_ATTR_COORD_REALIGN] = { .type = NLA_U8, },
38 [IEEE802154_ATTR_PAGE] = { .type = NLA_U8, },
39 [IEEE802154_ATTR_DEV_TYPE] = { .type = NLA_U8, },
40 [IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, },
41 [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, },
42 [IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, },
43 [IEEE802154_ATTR_SRC_SHORT_ADDR] = { .type = NLA_U16, },
44 [IEEE802154_ATTR_SRC_HW_ADDR] = { .type = NLA_HW_ADDR, },
45 [IEEE802154_ATTR_SRC_PAN_ID] = { .type = NLA_U16, },
46 [IEEE802154_ATTR_DEST_SHORT_ADDR] = { .type = NLA_U16, },
47 [IEEE802154_ATTR_DEST_HW_ADDR] = { .type = NLA_HW_ADDR, },
48 [IEEE802154_ATTR_DEST_PAN_ID] = { .type = NLA_U16, },
50 [IEEE802154_ATTR_CAPABILITY] = { .type = NLA_U8, },
51 [IEEE802154_ATTR_REASON] = { .type = NLA_U8, },
52 [IEEE802154_ATTR_SCAN_TYPE] = { .type = NLA_U8, },
53 [IEEE802154_ATTR_CHANNELS] = { .type = NLA_U32, },
54 [IEEE802154_ATTR_DURATION] = { .type = NLA_U8, },
55 [IEEE802154_ATTR_ED_LIST] = { .len = 27 },
56 [IEEE802154_ATTR_CHANNEL_PAGE_LIST] = { .len = 32 * 4, },
58 [IEEE802154_ATTR_TXPOWER] = { .type = NLA_S8, },
59 [IEEE802154_ATTR_LBT_ENABLED] = { .type = NLA_U8, },
60 [IEEE802154_ATTR_CCA_MODE] = { .type = NLA_U8, },
61 [IEEE802154_ATTR_CCA_ED_LEVEL] = { .type = NLA_S32, },
62 [IEEE802154_ATTR_CSMA_RETRIES] = { .type = NLA_U8, },
63 [IEEE802154_ATTR_CSMA_MIN_BE] = { .type = NLA_U8, },
64 [IEEE802154_ATTR_CSMA_MAX_BE] = { .type = NLA_U8, },
66 [IEEE802154_ATTR_FRAME_RETRIES] = { .type = NLA_S8, },
68 [IEEE802154_ATTR_LLSEC_ENABLED] = { .type = NLA_U8, },
69 [IEEE802154_ATTR_LLSEC_SECLEVEL] = { .type = NLA_U8, },
70 [IEEE802154_ATTR_LLSEC_KEY_MODE] = { .type = NLA_U8, },
71 [IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT] = { .type = NLA_U32, },
72 [IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED] = { .type = NLA_HW_ADDR, },
73 [IEEE802154_ATTR_LLSEC_KEY_ID] = { .type = NLA_U8, },
74 [IEEE802154_ATTR_LLSEC_FRAME_COUNTER] = { .type = NLA_U32 },
75 [IEEE802154_ATTR_LLSEC_KEY_BYTES] = { .len = 16, },
76 [IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES] = { .type = NLA_U8, },
77 [IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS] = { .len = 258 / 8 },
78 [IEEE802154_ATTR_LLSEC_FRAME_TYPE] = { .type = NLA_U8, },
79 [IEEE802154_ATTR_LLSEC_CMD_FRAME_ID] = { .type = NLA_U8, },
80 [IEEE802154_ATTR_LLSEC_SECLEVELS] = { .type = NLA_U8, },
81 [IEEE802154_ATTR_LLSEC_DEV_OVERRIDE] = { .type = NLA_U8, },
82 [IEEE802154_ATTR_LLSEC_DEV_KEY_MODE] = { .type = NLA_U8, },