framer-802154: Introduced mnemonic variable

This commit is contained in:
kkrentz 2013-05-24 00:31:14 -07:00
parent c9ad9c04bd
commit be22883724
1 changed files with 8 additions and 7 deletions

View File

@ -207,10 +207,11 @@ static int
parse(void) parse(void)
{ {
frame802154_t frame; frame802154_t frame;
int len; int hdr_len;
len = packetbuf_datalen();
if(frame802154_parse(packetbuf_dataptr(), len, &frame) && hdr_len = frame802154_parse(packetbuf_dataptr(), packetbuf_datalen(), &frame);
packetbuf_hdrreduce(len - frame.payload_len)) {
if(hdr_len && packetbuf_hdrreduce(hdr_len)) {
if(frame.fcf.dest_addr_mode) { if(frame.fcf.dest_addr_mode) {
if(frame.dest_pid != mac_src_pan_id && if(frame.dest_pid != mac_src_pan_id &&
frame.dest_pid != FRAME802154_BROADCASTPANDID) { frame.dest_pid != FRAME802154_BROADCASTPANDID) {
@ -230,9 +231,9 @@ parse(void)
PRINTF("15.4-IN: %2X", frame.fcf.frame_type); PRINTF("15.4-IN: %2X", frame.fcf.frame_type);
PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));
PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
PRINTF("%u (%u)\n", packetbuf_datalen(), len); PRINTF("%d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen());
return len - frame.payload_len; return hdr_len;
} }
return FRAMER_FAILED; return FRAMER_FAILED;
} }