diff --git a/sys/include/net/ieee802154/radio.h b/sys/include/net/ieee802154/radio.h index 7db130c7ab..741f7e9e5c 100644 --- a/sys/include/net/ieee802154/radio.h +++ b/sys/include/net/ieee802154/radio.h @@ -338,6 +338,36 @@ typedef enum { IEEE802154_SRC_MATCH_EXT_CLEAR, } ieee802154_src_match_t; +/** + * @brief Frame Filter mode + */ +typedef enum { + /** + * @brief accept all valid frames that match address filter configuration + */ + IEEE802154_FILTER_ACCEPT, + /** + * @brief accept only ACK frames + * + * @note This mode should only be implemented if the transceiver doesn't + * handle ACK frame reception (when @ref IEEE802154_CAP_FRAME_RETRANS and + * @ref IEEE802154_CAP_IRQ_ACK_TIMEOUT are not present). + */ + IEEE802154_FILTER_ACK_ONLY, + /** + * @brief accept all valid frames + * + * @note This mode is optional + */ + IEEE802154_FILTER_PROMISC, + /** + * @brief accept all frames, regardless of FCS + * + * @note This mode is optional + */ + IEEE802154_FILTER_SNIFFER, +} ieee802154_filter_mode_t; + /** * @brief CSMA-CA exponential backoff parameters. */ @@ -618,6 +648,7 @@ struct ieee802154_radio_ops { * - @ref set_csma_params * - @ref set_rx_mode * - @ref set_hw_addr_filter + * - @ref set_frame_filter_mode * - @ref config_src_addr_match * - @ref set_frame_retrans (if available) * @@ -817,6 +848,19 @@ struct ieee802154_radio_ops { */ int (*set_rx_mode)(ieee802154_dev_t *dev, ieee802154_rx_mode_t mode); + /** + * @brief Set the frame filter moder. + * + * @pre the device is on + * + * @param[in] dev IEEE802.15.4 device descriptor + * @param[in] mode address filter mode + * + * @return 0 on success + * @return negative errno on error + */ + int (*set_frame_filter_mode)(ieee802154_dev_t *dev, ieee802154_filter_mode_t mode); + /** * @brief Set the source address match configuration. * @@ -1007,6 +1051,22 @@ static inline int ieee802154_radio_set_hw_addr_filter(ieee802154_dev_t *dev, return dev->driver->set_hw_addr_filter(dev, short_addr, ext_addr, pan_id); } +/** + * @brief Shortcut to @ref ieee802154_radio_ops::set_frame_filter_mode + * + * @pre the device is on + * + * @param[in] dev IEEE802.15.4 device descriptor + * @param[in] mode frame filter mode + * + * @return result of @ref ieee802154_radio_ops::set_frame_filter_mode + */ +static inline int ieee802154_radio_set_frame_filter_mode(ieee802154_dev_t *dev, + ieee802154_filter_mode_t mode) +{ + return dev->driver->set_frame_filter_mode(dev, mode); +} + /** * @brief Shortcut to @ref ieee802154_radio_ops::set_frame_retrans *