2 * An interface between IEEE802.15.4 device and rest of the kernel.
4 * Copyright (C) 2007, 2008, 2009 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.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
26 #ifndef IEEE802154_NETDEVICE_H
27 #define IEEE802154_NETDEVICE_H
30 * A control block of skb passed between the ARPHRD_IEEE802154 device
31 * and other stack parts.
33 struct ieee802154_mac_cb
{
35 struct ieee802154_addr sa
;
36 struct ieee802154_addr da
;
41 static inline struct ieee802154_mac_cb
*mac_cb(struct sk_buff
*skb
)
43 return (struct ieee802154_mac_cb
*)skb
->cb
;
46 #define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1)
48 #define MAC_CB_FLAG_ACKREQ (1 << 3)
49 #define MAC_CB_FLAG_SECEN (1 << 4)
50 #define MAC_CB_FLAG_INTRAPAN (1 << 5)
52 static inline int mac_cb_is_ackreq(struct sk_buff
*skb
)
54 return mac_cb(skb
)->flags
& MAC_CB_FLAG_ACKREQ
;
57 static inline int mac_cb_is_secen(struct sk_buff
*skb
)
59 return mac_cb(skb
)->flags
& MAC_CB_FLAG_SECEN
;
62 static inline int mac_cb_is_intrapan(struct sk_buff
*skb
)
64 return mac_cb(skb
)->flags
& MAC_CB_FLAG_INTRAPAN
;
67 static inline int mac_cb_type(struct sk_buff
*skb
)
69 return mac_cb(skb
)->flags
& MAC_CB_FLAG_TYPEMASK
;
72 #define IEEE802154_MAC_SCAN_ED 0
73 #define IEEE802154_MAC_SCAN_ACTIVE 1
74 #define IEEE802154_MAC_SCAN_PASSIVE 2
75 #define IEEE802154_MAC_SCAN_ORPHAN 3
78 * This should be located at net_device->ml_priv
80 struct ieee802154_mlme_ops
{
81 int (*assoc_req
)(struct net_device
*dev
,
82 struct ieee802154_addr
*addr
,
84 int (*assoc_resp
)(struct net_device
*dev
,
85 struct ieee802154_addr
*addr
,
86 u16 short_addr
, u8 status
);
87 int (*disassoc_req
)(struct net_device
*dev
,
88 struct ieee802154_addr
*addr
,
90 int (*start_req
)(struct net_device
*dev
,
91 struct ieee802154_addr
*addr
,
92 u8 channel
, u8 bcn_ord
, u8 sf_ord
,
93 u8 pan_coord
, u8 blx
, u8 coord_realign
);
94 int (*scan_req
)(struct net_device
*dev
,
95 u8 type
, u32 channels
, u8 duration
);
98 * FIXME: these should become the part of PIB/MIB interface.
99 * However we still don't have IB interface of any kind
101 u16 (*get_pan_id
)(struct net_device
*dev
);
102 u16 (*get_short_addr
)(struct net_device
*dev
);
103 u8 (*get_dsn
)(struct net_device
*dev
);
104 u8 (*get_bsn
)(struct net_device
*dev
);
107 static inline struct ieee802154_mlme_ops
*ieee802154_mlme_ops(
108 struct net_device
*dev
)