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:
Anthony Merlino
2017-11-22 18:22:35 +00:00
committed by Gregory Nutt
parent 827fa6796e
commit cb62580216
3 changed files with 19 additions and 4 deletions
+4 -2
View File
@@ -468,16 +468,18 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
if (ret == 0 && req.attrval.mac.promisc_mode)
{
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);
}
else
{
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],
rx->length);
+7 -1
View File
@@ -123,7 +123,13 @@ int mac802154_req_get(MACHANDLE mac, enum ieee802154_attr_e attr,
{
attrval->mac.resp_waittime = priv->resp_waittime;
}
break;;
break;
case IEEE802154_ATTR_MAC_PROMISCUOUS_MODE:
{
attrval->mac.promisc_mode = priv->promisc;
}
break;
default:
{