Data Structures | |
struct | field_length_t |
Structure that contains the lengths of the various addressing and security fields in the 802.15.4 header. More... | |
struct | frame802154_aux_hdr_t |
802.15.4 Aux security header More... | |
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_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 | |
Macros | |
#define | IEEE802154_PANID 0xABCD |
Functions | |
static CC_INLINE uint8_t | addr_len (uint8_t mode) |
static void | field_len (frame802154_t *p, field_length_t *flen) |
FCF element values definitions | |
These are some definitions of values used in the FCF. See the 802.15.4 spec for details. | |
int | frame802154_hdrlen (frame802154_t *p) |
Calculates the length of the frame header. More... | |
int | frame802154_create (frame802154_t *p, uint8_t *buf, int buf_len) |
Creates a frame for transmission over the air. More... | |
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_SECURITY_LEVEL_NONE (0) |
#define | FRAME802154_SECURITY_LEVEL_128 (3) |
#define FRAME802154_ACKFRAME (0x02) |
Referenced by packet_input().
#define FRAME802154_BEACONFRAME (0x00) |
#define FRAME802154_BEACONREQ (0x07) |
#define FRAME802154_BROADCASTADDR (0xFFFF) |
#define FRAME802154_BROADCASTPANDID (0xFFFF) |
Referenced by parse().
#define FRAME802154_CMDFRAME (0x03) |
#define FRAME802154_DATAFRAME (0x01) |
Referenced by create(), and packet_input().
#define FRAME802154_IEEE802154_2003 (0x00) |
Referenced by create().
#define FRAME802154_IEEE802154_2006 (0x01) |
#define FRAME802154_IEEERESERVED (0x00) |
#define FRAME802154_LONGADDRMODE (0x03) |
Referenced by addr_len(), create(), and frame802154_parse().
#define FRAME802154_NOADDR (0x00) |
Only valid for ACK or Beacon frames.
#define FRAME802154_NOBEACONS (0x0F) |
#define FRAME802154_SECURITY_LEVEL_128 (3) |
#define FRAME802154_SECURITY_LEVEL_NONE (0) |
#define FRAME802154_SHORTADDRMODE (0x02) |
Referenced by addr_len(), create(), frame802154_parse(), and is_broadcast_addr().
#define IEEE802154_PANID 0xABCD |
|
static |
References FRAME802154_LONGADDRMODE, and FRAME802154_SHORTADDRMODE.
Referenced by field_len().
|
static |
References addr_len(), frame802154_t::aux_hdr, field_length_t::aux_sec_len, field_length_t::dest_addr_len, frame802154_fcf_t::dest_addr_mode, frame802154_t::dest_pid, field_length_t::dest_pid_len, frame802154_t::fcf, frame802154_scf_t::key_id_mode, frame802154_fcf_t::panid_compression, frame802154_aux_hdr_t::security_control, frame802154_fcf_t::security_enabled, field_length_t::src_addr_len, frame802154_fcf_t::src_addr_mode, frame802154_t::src_pid, and field_length_t::src_pid_len.
Referenced by frame802154_create(), and frame802154_hdrlen().
int frame802154_create | ( | frame802154_t * | p, |
uint8_t * | buf, | ||
int | 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.
p | Pointer to frame802154_t struct, which specifies the frame to send. |
buf | Pointer to the buffer to use for the frame. |
buf_len | The length of the buffer to use for the frame. |
References frame802154_fcf_t::ack_required, field_length_t::aux_sec_len, buf, c, frame802154_t::dest_addr, field_length_t::dest_addr_len, frame802154_fcf_t::dest_addr_mode, frame802154_t::dest_pid, field_length_t::dest_pid_len, frame802154_t::fcf, field_len(), 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, field_length_t::src_addr_len, frame802154_fcf_t::src_addr_mode, frame802154_t::src_pid, and field_length_t::src_pid_len.
Referenced by create().
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.
p | Pointer to frame802154_t_t struct, which specifies the frame to send. |
References field_length_t::aux_sec_len, field_length_t::dest_addr_len, field_length_t::dest_pid_len, field_len(), field_length_t::src_addr_len, and field_length_t::src_pid_len.
Referenced by create().
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.
data | The input data from the radio chip. |
len | The size of the input data |
pf | The frame802154_t struct to store the parsed frame information. |
References frame802154_fcf_t::ack_required, c, data, frame802154_t::dest_addr, frame802154_fcf_t::dest_addr_mode, frame802154_t::dest_pid, frame802154_t::fcf, FRAME802154_LONGADDRMODE, FRAME802154_SHORTADDRMODE, frame802154_fcf_t::frame_pending, frame802154_fcf_t::frame_type, frame802154_fcf_t::frame_version, linkaddr_copy(), linkaddr_null, frame802154_fcf_t::panid_compression, frame802154_t::payload, frame802154_t::payload_len, frame802154_fcf_t::security_enabled, frame802154_t::seq, frame802154_t::src_addr, frame802154_fcf_t::src_addr_mode, and frame802154_t::src_pid.
Referenced by packet_input(), and parse().
uint8_t frame802154_fcf_t::ack_required |
1 bit.
Is an ack frame required?
Referenced by create(), frame802154_create(), frame802154_parse(), and packet_input().
frame802154_aux_hdr_t frame802154_t::aux_hdr |
Aux security header.
Referenced by field_len().
uint8_t frame802154_t::dest_addr[8] |
Destination address.
Referenced by create(), frame802154_create(), frame802154_parse(), packet_input(), and parse().
uint8_t frame802154_fcf_t::dest_addr_mode |
< 3 bit.
Unused bits 2 bit. Destination address mode, see 802.15.4
Referenced by create(), field_len(), frame802154_create(), frame802154_parse(), and parse().
uint16_t frame802154_t::dest_pid |
Destination PAN ID.
Referenced by create(), field_len(), frame802154_create(), frame802154_parse(), and parse().
frame802154_fcf_t frame802154_t::fcf |
Frame control field.
Referenced by create(), field_len(), frame802154_create(), frame802154_parse(), packet_input(), and parse().
uint32_t frame802154_aux_hdr_t::frame_counter |
Frame counter, used for security.
uint8_t frame802154_fcf_t::frame_pending |
1 bit.
True if sender has more data to send
Referenced by create(), frame802154_create(), frame802154_parse(), and parse().
uint8_t frame802154_fcf_t::frame_type |
3 bit.
Frame type field, see 802.15.4
Referenced by create(), frame802154_create(), frame802154_parse(), packet_input(), and parse().
uint8_t frame802154_fcf_t::frame_version |
2 bit.
802.15.4 frame version
Referenced by create(), frame802154_create(), and frame802154_parse().
uint8_t frame802154_aux_hdr_t::key[9] |
The key itself, or an index to the key.
uint8_t frame802154_scf_t::key_id_mode |
uint8_t frame802154_fcf_t::panid_compression |
1 bit.
Is this a compressed header?
Referenced by create(), field_len(), frame802154_create(), and frame802154_parse().
uint8_t* frame802154_t::payload |
Pointer to 802.15.4 frame payload.
Referenced by create(), and frame802154_parse().
int frame802154_t::payload_len |
Length of payload field.
Referenced by create(), frame802154_parse(), and parse().
uint8_t frame802154_scf_t::reserved |
3 bit.
Reserved bits
frame802154_scf_t frame802154_aux_hdr_t::security_control |
Security control bitfield.
Referenced by field_len().
uint8_t frame802154_fcf_t::security_enabled |
1 bit.
True if security is used in this frame
Referenced by create(), field_len(), frame802154_create(), and frame802154_parse().
uint8_t frame802154_scf_t::security_level |
3 bit.
security level
uint8_t frame802154_t::seq |
Sequence number.
Referenced by create(), frame802154_create(), frame802154_parse(), packet_input(), and parse().
uint8_t frame802154_t::src_addr[8] |
Source address.
Referenced by create(), frame802154_create(), frame802154_parse(), and parse().
uint8_t frame802154_fcf_t::src_addr_mode |
2 bit.
Source address mode, see 802.15.4
Referenced by create(), field_len(), frame802154_create(), and frame802154_parse().
uint16_t frame802154_t::src_pid |
Source PAN ID.
Referenced by create(), field_len(), frame802154_create(), and frame802154_parse().