1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef IEEE802154_NETDEVICE_H
28#define IEEE802154_NETDEVICE_H
29
30#include <net/af_ieee802154.h>
31
32
33
34
35
36struct ieee802154_mac_cb {
37 u8 lqi;
38 struct ieee802154_addr sa;
39 struct ieee802154_addr da;
40 u8 flags;
41 u8 seq;
42};
43
44static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
45{
46 return (struct ieee802154_mac_cb *)skb->cb;
47}
48
49#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1)
50
51#define MAC_CB_FLAG_ACKREQ (1 << 3)
52#define MAC_CB_FLAG_SECEN (1 << 4)
53#define MAC_CB_FLAG_INTRAPAN (1 << 5)
54
55static inline int mac_cb_is_ackreq(struct sk_buff *skb)
56{
57 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
58}
59
60static inline int mac_cb_is_secen(struct sk_buff *skb)
61{
62 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
63}
64
65static inline int mac_cb_is_intrapan(struct sk_buff *skb)
66{
67 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
68}
69
70static inline int mac_cb_type(struct sk_buff *skb)
71{
72 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
73}
74
75#define IEEE802154_MAC_SCAN_ED 0
76#define IEEE802154_MAC_SCAN_ACTIVE 1
77#define IEEE802154_MAC_SCAN_PASSIVE 2
78#define IEEE802154_MAC_SCAN_ORPHAN 3
79
80struct wpan_phy;
81
82
83
84
85
86
87struct ieee802154_mlme_ops {
88 int (*assoc_req)(struct net_device *dev,
89 struct ieee802154_addr *addr,
90 u8 channel, u8 page, u8 cap);
91 int (*assoc_resp)(struct net_device *dev,
92 struct ieee802154_addr *addr,
93 u16 short_addr, u8 status);
94 int (*disassoc_req)(struct net_device *dev,
95 struct ieee802154_addr *addr,
96 u8 reason);
97 int (*start_req)(struct net_device *dev,
98 struct ieee802154_addr *addr,
99 u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
100 u8 pan_coord, u8 blx, u8 coord_realign);
101 int (*scan_req)(struct net_device *dev,
102 u8 type, u32 channels, u8 page, u8 duration);
103
104 struct wpan_phy *(*get_phy)(const struct net_device *dev);
105
106
107
108
109
110 u16 (*get_pan_id)(const struct net_device *dev);
111 u16 (*get_short_addr)(const struct net_device *dev);
112 u8 (*get_dsn)(const struct net_device *dev);
113 u8 (*get_bsn)(const struct net_device *dev);
114};
115
116
117
118
119
120
121
122struct ieee802154_reduced_mlme_ops {
123 struct wpan_phy *(*get_phy)(const struct net_device *dev);
124};
125
126static inline struct ieee802154_mlme_ops *
127ieee802154_mlme_ops(const struct net_device *dev)
128{
129 return dev->ml_priv;
130}
131
132static inline struct ieee802154_reduced_mlme_ops *
133ieee802154_reduced_mlme_ops(const struct net_device *dev)
134{
135 return dev->ml_priv;
136}
137
138#endif
139