Contiki-NG
Files | Data Structures | Variables
802.15.4 frame creation and parsing

Files

file  frame802154.h
 802.15.4 frame creation and parsing functions
 

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...
 

Variables

static uint16_t mac_pan_id = IEEE802154_PANID
 The 16-bit identifier of the PAN on which the device is operating. More...
 

FCF element values definitions

These are some definitions of values used in the FCF.

See the 802.15.4 spec for details.

uint16_t frame802154_get_pan_id (void)
 
void frame802154_set_pan_id (uint16_t pan_id)
 
void frame802154_has_panid (frame802154_fcf_t *fcf, int *has_src_pan_id, int *has_dest_pan_id)
 
int frame802154_check_dest_panid (frame802154_t *frame)
 
int frame802154_is_broadcast_addr (uint8_t mode, uint8_t *addr)
 
int frame802154_extract_linkaddr (frame802154_t *frame, linkaddr_t *source_address, linkaddr_t *dest_address)
 
int frame802154_hdrlen (frame802154_t *p)
 Calculates the length of the frame header. More...
 
void frame802154_create_fcf (frame802154_fcf_t *fcf, uint8_t *buf)
 
int frame802154_create (frame802154_t *p, uint8_t *buf)
 Creates a frame for transmission over the air. More...
 
void frame802154_parse_fcf (uint8_t *data, frame802154_fcf_t *pfcf)
 
int frame802154_parse (uint8_t *data, int len, frame802154_t *pf)
 Parses an input frame. More...
 
#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. More...
 
#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_IEEE802154_2015   (0x02)
 
#define FRAME802154_SECURITY_LEVEL_NONE   (0)
 
#define FRAME802154_SECURITY_LEVEL_MIC_32   (1)
 
#define FRAME802154_SECURITY_LEVEL_MIC_64   (2)
 
#define FRAME802154_SECURITY_LEVEL_MIC_128   (3)
 
#define FRAME802154_SECURITY_LEVEL_ENC   (4)
 
#define FRAME802154_SECURITY_LEVEL_ENC_MIC_32   (5)
 
#define FRAME802154_SECURITY_LEVEL_ENC_MIC_64   (6)
 
#define FRAME802154_SECURITY_LEVEL_ENC_MIC_128   (7)
 
#define FRAME802154_IMPLICIT_KEY   (0)
 
#define FRAME802154_1_BYTE_KEY_ID_MODE   (1)
 
#define FRAME802154_5_BYTE_KEY_ID_MODE   (2)
 
#define FRAME802154_9_BYTE_KEY_ID_MODE   (3)
 

Detailed Description

Macro Definition Documentation

◆ FRAME802154_NOADDR

#define FRAME802154_NOADDR   (0x00)

Only valid for ACK or Beacon frames.

Definition at line 109 of file frame802154.h.

Function Documentation

◆ frame802154_create()

int frame802154_create ( frame802154_t p,
uint8_t *  buf 
)

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.
Returns
The length of the frame header

Definition at line 392 of file frame802154.c.

◆ frame802154_hdrlen()

int 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 358 of file frame802154.c.

◆ frame802154_parse()

int frame802154_parse ( uint8_t *  data,
int  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 500 of file frame802154.c.

Variable Documentation

◆ mac_pan_id

uint16_t mac_pan_id = IEEE802154_PANID
static

The 16-bit identifier of the PAN on which the device is operating.

If this value is 0xffff, the device is not associated.

Definition at line 76 of file frame802154.c.