framer-802154: Support for setting and accessing the frame type
attribute
This commit is contained in:
parent
19c9ef0a95
commit
9dc9e4bd9f
@ -43,7 +43,9 @@
|
||||
*/
|
||||
|
||||
#include "net/llsec/nullsec.h"
|
||||
#include "net/mac/frame802154.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/packetbuf.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
@ -55,6 +57,7 @@ bootstrap(llsec_on_bootstrapped_t on_bootstrapped)
|
||||
static void
|
||||
send(mac_callback_t sent, void *ptr)
|
||||
{
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME);
|
||||
NETSTACK_MAC.send(sent, ptr);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -101,7 +101,7 @@ create_frame(int type, int do_create)
|
||||
}
|
||||
|
||||
/* Build the FCF. */
|
||||
params.fcf.frame_type = FRAME802154_DATAFRAME;
|
||||
params.fcf.frame_type = packetbuf_attr(PACKETBUF_ATTR_FRAME_TYPE);
|
||||
if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL)) {
|
||||
params.fcf.security_enabled = 1;
|
||||
}
|
||||
@ -219,6 +219,8 @@ parse(void)
|
||||
hdr_len = frame802154_parse(packetbuf_dataptr(), packetbuf_datalen(), &frame);
|
||||
|
||||
if(hdr_len && packetbuf_hdrreduce(hdr_len)) {
|
||||
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, frame.fcf.frame_type);
|
||||
|
||||
if(frame.fcf.dest_addr_mode) {
|
||||
if(frame.dest_pid != mac_src_pan_id &&
|
||||
frame.dest_pid != FRAME802154_BROADCASTPANDID) {
|
||||
|
@ -356,6 +356,7 @@ enum {
|
||||
PACKETBUF_ATTR_MAX_REXMIT,
|
||||
PACKETBUF_ATTR_NUM_REXMIT,
|
||||
PACKETBUF_ATTR_PENDING,
|
||||
PACKETBUF_ATTR_FRAME_TYPE,
|
||||
PACKETBUF_ATTR_SECURITY_LEVEL,
|
||||
PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1,
|
||||
PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3,
|
||||
|
Loading…
Reference in New Issue
Block a user