mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Merged in antmerlino/nuttx/mac802154dev-header-offset (pull request #538)
Pass header-payload offset to application for use when the MAC layer is in promiscuous mode * mac802154_device: When in promiscuous mode, the char driver sends the entire frame, including the MAC header. This change adds an offset field indicating the header-payload boundary. It is set to 0 when not in promiscuous mode as the header is not passed to the application * mac802154: Adds support for getting promiscuous mode state Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
committed by
Gregory Nutt
parent
827fa6796e
commit
cb62580216
@@ -67,7 +67,14 @@ struct mac802154dev_rxframe_s
|
|||||||
{
|
{
|
||||||
struct ieee802154_data_ind_s meta;
|
struct ieee802154_data_ind_s meta;
|
||||||
uint8_t payload[IEEE802154_MAX_PHY_PACKET_SIZE];
|
uint8_t payload[IEEE802154_MAX_PHY_PACKET_SIZE];
|
||||||
uint16_t length;
|
uint8_t length;
|
||||||
|
|
||||||
|
/* In promiscous mode, the entire frame is passed to the application inside
|
||||||
|
* the payload field. The offset field is used to specify the start of the
|
||||||
|
* actual payload, skipping the 802.15.4 header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint8_t offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_WIRELESS_IEEE802154 */
|
#endif /* CONFIG_WIRELESS_IEEE802154 */
|
||||||
|
|||||||
@@ -468,16 +468,18 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
if (ret == 0 && req.attrval.mac.promisc_mode)
|
if (ret == 0 && req.attrval.mac.promisc_mode)
|
||||||
{
|
{
|
||||||
rx->length = ind->frame->io_len + 2;
|
rx->length = ind->frame->io_len + 2;
|
||||||
|
rx->offset = ind->frame->io_offset;
|
||||||
|
|
||||||
/* Copy the data from the IOB to the user supplied struct */
|
/* Copy the entire frame from the IOB to the user supplied struct */
|
||||||
|
|
||||||
memcpy(&rx->payload[0], &ind->frame->io_data[0], rx->length);
|
memcpy(&rx->payload[0], &ind->frame->io_data[0], rx->length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rx->length = (ind->frame->io_len - ind->frame->io_offset);
|
rx->length = (ind->frame->io_len - ind->frame->io_offset);
|
||||||
|
rx->offset = 0;
|
||||||
|
|
||||||
/* Copy the data from the IOB to the user supplied struct */
|
/* Copy just the payload from the IOB to the user supplied struct */
|
||||||
|
|
||||||
memcpy(&rx->payload[0], &ind->frame->io_data[ind->frame->io_offset],
|
memcpy(&rx->payload[0], &ind->frame->io_data[ind->frame->io_offset],
|
||||||
rx->length);
|
rx->length);
|
||||||
|
|||||||
@@ -123,7 +123,13 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e attr,
|
|||||||
{
|
{
|
||||||
attrval->mac.resp_waittime = priv->resp_waittime;
|
attrval->mac.resp_waittime = priv->resp_waittime;
|
||||||
}
|
}
|
||||||
break;;
|
break;
|
||||||
|
|
||||||
|
case IEEE802154_ATTR_MAC_PROMISCUOUS_MODE:
|
||||||
|
{
|
||||||
|
attrval->mac.promisc_mode = priv->promisc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user