Contiki 2.6

Frame802154

Data Structures

struct  frame802154_fcf_t
 The IEEE 802.15.4 frame has a number of constant/fixed fields that can be counted to make frame construction and max payload calculations easier. More...
struct  frame802154_scf_t
 802.15.4 security control bitfield. More...
struct  frame802154_aux_hdr_t
 802.15.4 Aux security header More...
struct  frame802154_t
 Parameters used by the frame802154_create() function. More...

Files

file  frame802154.c
 

802.15.4 frame creation and parsing functions


file  frame802154.h
 

802.15.4 frame creation and parsing functions


Variables

uint8_t frame802154_fcf_t::security_enabled
 1 bit.
uint8_t frame802154_fcf_t::frame_pending
 1 bit.
uint8_t frame802154_fcf_t::ack_required
 1 bit.
uint8_t frame802154_fcf_t::panid_compression
 1 bit.
uint8_t frame802154_fcf_t::dest_addr_mode
 < 3 bit.
uint8_t frame802154_fcf_t::frame_version
 2 bit.
uint8_t frame802154_fcf_t::src_addr_mode
 2 bit.
uint8_t frame802154_scf_t::key_id_mode
 2 bit.
uint8_t frame802154_scf_t::reserved
 3 bit.
uint32_t frame802154_aux_hdr_t::frame_counter
 Frame counter, used for security.
uint8_t frame802154_aux_hdr_t::key [9]
 The key itself, or an index to the key.
uint8_t frame802154_t::seq
 Sequence number.
uint16_t frame802154_t::dest_pid
 Destination PAN ID.
uint8_t frame802154_t::dest_addr [8]
 Destination address.
uint16_t frame802154_t::src_pid
 Source PAN ID.
uint8_t frame802154_t::src_addr [8]
 Source address.
frame802154_aux_hdr_t frame802154_t::aux_hdr
 Aux security header.
uint8_t * frame802154_t::payload
 Pointer to 802.15.4 frame payload.
uint8_t frame802154_t::payload_len
 Length of payload field.

FCF element values definitions

These are some definitions of values used in the FCF.See the 802.15.4 spec for details.
uint8_t frame802154_hdrlen (frame802154_t *p)
 Calculates the length of the frame header.
uint8_t frame802154_create (frame802154_t *p, uint8_t *buf, uint8_t buf_len)
 Creates a frame for transmission over the air.
uint8_t frame802154_parse (uint8_t *data, uint8_t len, frame802154_t *pf)
 Parses an input frame.
#define FRAME802154_BEACONFRAME   (0x00)
#define FRAME802154_DATAFRAME   (0x01)
#define FRAME802154_ACKFRAME   (0x02)
#define FRAME802154_CMDFRAME   (0x03)
#define FRAME802154_BEACONREQ   (0x07)
#define FRAME802154_IEEERESERVED   (0x00)
#define FRAME802154_NOADDR   (0x00)
 Only valid for ACK or Beacon frames.
#define FRAME802154_SHORTADDRMODE   (0x02)
#define FRAME802154_LONGADDRMODE   (0x03)
#define FRAME802154_NOBEACONS   (0x0F)
#define FRAME802154_BROADCASTADDR   (0xFFFF)
#define FRAME802154_BROADCASTPANDID   (0xFFFF)
#define FRAME802154_IEEE802154_2003   (0x00)
#define FRAME802154_IEEE802154_2006   (0x01)
#define FRAME802154_SECURITY_LEVEL_NONE   (0)
#define FRAME802154_SECURITY_LEVEL_128   (3)

Define Documentation

#define FRAME802154_NOADDR   (0x00)

Only valid for ACK or Beacon frames.

Definition at line 88 of file frame802154.h.


Function Documentation

uint8_t frame802154_create ( frame802154_t p,
uint8_t *  buf,
uint8_t  buf_len 
)

Creates a frame for transmission over the air.

This function is meant to be called by a higher level function, that interfaces to a MAC.

Parameters:
pPointer to frame802154_t struct, which specifies the frame to send.
bufPointer to the buffer to use for the frame.
buf_lenThe length of the buffer to use for the frame.
Returns:
The length of the frame header or 0 if there was insufficient space in the buffer for the frame headers.

Definition at line 181 of file frame802154.c.

References frame802154_fcf_t::ack_required, frame802154_t::dest_addr, frame802154_fcf_t::dest_addr_mode, frame802154_t::dest_pid, frame802154_t::fcf, frame802154_fcf_t::frame_pending, frame802154_fcf_t::frame_type, frame802154_fcf_t::frame_version, frame802154_fcf_t::panid_compression, frame802154_fcf_t::security_enabled, frame802154_t::seq, frame802154_t::src_addr, frame802154_fcf_t::src_addr_mode, and frame802154_t::src_pid.

uint8_t frame802154_hdrlen ( frame802154_t p)

Calculates the length of the frame header.

This function is meant to be called by a higher level function, that interfaces to a MAC.

Parameters:
pPointer to frame802154_t_t struct, which specifies the frame to send.
Returns:
The length of the frame header.

Definition at line 158 of file frame802154.c.

uint8_t frame802154_parse ( uint8_t *  data,
uint8_t  len,
frame802154_t pf 
)

Parses an input frame.

Scans the input frame to find each section, and stores the information of each section in a frame802154_t structure.

Parameters:
dataThe input data from the radio chip.
lenThe size of the input data
pfThe frame802154_t struct to store the parsed frame information.

Definition at line 253 of file frame802154.c.

References frame802154_fcf_t::ack_required, frame802154_t::dest_addr, frame802154_fcf_t::dest_addr_mode, frame802154_t::dest_pid, frame802154_t::fcf, frame802154_fcf_t::frame_pending, frame802154_fcf_t::frame_type, frame802154_fcf_t::frame_version, frame802154_fcf_t::panid_compression, frame802154_t::payload, frame802154_t::payload_len, rimeaddr_copy(), rimeaddr_null, frame802154_fcf_t::security_enabled, frame802154_t::seq, frame802154_t::src_addr, frame802154_fcf_t::src_addr_mode, and frame802154_t::src_pid.


Variable Documentation

uint8_t frame802154_fcf_t::ack_required [inherited]

1 bit.

Is an ack frame required?

Definition at line 124 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().

uint8_t frame802154_fcf_t::dest_addr_mode [inherited]

< 3 bit.

Unused bits 2 bit. Destination address mode, see 802.15.4

Definition at line 127 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().

uint8_t frame802154_fcf_t::frame_pending [inherited]

1 bit.

True if sender has more data to send

Definition at line 123 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().

uint8_t frame802154_fcf_t::frame_version [inherited]

2 bit.

802.15.4 frame version

Definition at line 128 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().

uint8_t frame802154_scf_t::key_id_mode [inherited]

2 bit.

Key identifier mode

Definition at line 135 of file frame802154.h.

1 bit.

Is this a compressed header?

Definition at line 125 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().

uint8_t frame802154_scf_t::reserved [inherited]

3 bit.

Reserved bits

Definition at line 136 of file frame802154.h.

1 bit.

True if security is used in this frame

Definition at line 122 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().

uint8_t frame802154_fcf_t::src_addr_mode [inherited]

2 bit.

Source address mode, see 802.15.4

Definition at line 129 of file frame802154.h.

Referenced by frame802154_create(), and frame802154_parse().