78 uint8_t dest_addr_len;
85 CC_INLINE
static uint8_t
86 addr_len(uint8_t mode)
89 case FRAME802154_SHORTADDRMODE:
91 case FRAME802154_LONGADDRMODE:
98 #if LLSEC802154_USES_EXPLICIT_KEYS
100 get_key_id_len(uint8_t key_id_mode)
102 switch(key_id_mode) {
103 case FRAME802154_1_BYTE_KEY_ID_MODE:
105 case FRAME802154_5_BYTE_KEY_ID_MODE:
107 case FRAME802154_9_BYTE_KEY_ID_MODE:
119 memset(flen, 0,
sizeof(field_length_t));
123 flen->dest_pid_len = 2;
126 flen->src_pid_len = 2;
135 flen->src_pid_len = 0;
144 #if LLSEC802154_SECURITY_LEVEL
147 flen->aux_sec_len = 5
148 #if LLSEC802154_USES_EXPLICIT_KEYS
170 return 3 + flen.dest_pid_len + flen.dest_addr_len +
171 flen.src_pid_len + flen.src_addr_len + flen.aux_sec_len;
191 #if LLSEC802154_USES_EXPLICIT_KEYS
213 if(flen.dest_pid_len == 2) {
215 buf[pos++] = (p->
dest_pid >> 8) & 0xff;
219 for(c = flen.dest_addr_len; c > 0; c--) {
224 if(flen.src_pid_len == 2) {
225 buf[pos++] = p->
src_pid & 0xff;
226 buf[pos++] = (p->
src_pid >> 8) & 0xff;
230 for(c = flen.src_addr_len; c > 0; c--) {
234 #if LLSEC802154_SECURITY_LEVEL
236 if(flen.aux_sec_len) {
238 #if LLSEC802154_USES_EXPLICIT_KEYS
245 #if LLSEC802154_USES_EXPLICIT_KEYS
248 c = (key_id_mode - 1) * 4;
275 #if LLSEC802154_USES_EXPLICIT_KEYS
319 for(c = 0; c < 8; c++) {
333 pf->
src_pid = p[0] + (p[1] << 8);
351 for(c = 0; c < 8; c++) {
361 #if LLSEC802154_SECURITY_LEVEL
364 #if LLSEC802154_USES_EXPLICIT_KEYS
372 #if LLSEC802154_USES_EXPLICIT_KEYS
375 c = (key_id_mode - 1) * 4;
393 return c > len ? 0 : c;
frame802154_frame_counter_t frame_counter
Frame counter, used for security.
The IEEE 802.15.4 frame has a number of constant/fixed fields that can be counted to make frame const...
uint8_t * payload
Pointer to 802.15.4 payload.
802.15.4 frame creation and parsing functions
uint8_t ack_required
1 bit.
frame802154_key_source_t key_source
Key Source subfield.
uint8_t frame_version
2 bit.
const linkaddr_t linkaddr_null
The null Rime address.
int frame802154_hdrlen(frame802154_t *p)
Calculates the length of the frame header.
uint8_t security_enabled
1 bit.
int frame802154_create(frame802154_t *p, uint8_t *buf)
Creates a frame for transmission over the air.
uint8_t src_addr_mode
2 bit.
Default definitions of C compiler quirk work-arounds.
uint8_t panid_compression
1 bit.
uint8_t key_id_mode
2 bit.
Parameters used by the frame802154_create() function.
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
Copy a Rime address.
uint8_t seq
Sequence number.
int payload_len
Length of payload field.
frame802154_scf_t security_control
Security control bitfield.
uint8_t dest_addr[8]
Destination address.
uint8_t key_index
Key Index subfield.
uint16_t dest_pid
Destination PAN ID.
uint16_t src_pid
Source PAN ID.
int frame802154_parse(uint8_t *data, int len, frame802154_t *pf)
Parses an input frame.
Common functionality of 802.15.4-compliant llsec_drivers.
uint8_t frame_pending
1 bit.
frame802154_fcf_t fcf
Frame control field.
uint8_t security_level
3 bit.
uint8_t src_addr[8]
Source address.
frame802154_aux_hdr_t aux_hdr
Aux security header.
uint8_t dest_addr_mode
< 3 bit.
Header file for the Rime address representation