hdr.h File Reference

LoRaWAN header type and helper function definitions. More...

Detailed Description

LoRaWAN header type and helper function definitions.

Author
Jose Ignacio Alamos jose..nosp@m.alam.nosp@m.os@ha.nosp@m.w-ha.nosp@m.mburg.nosp@m..de

Definition in file hdr.h.

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "byteorder.h"
#include "net/loramac.h"
+ Include dependency graph for hdr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lorawan_hdr_t
 Data type to represent a LoRaWAN packet header. More...
 
struct  lorawan_join_request_t
 Join request packet representation. More...
 
struct  lorawan_join_accept_t
 Join accept packet representation. More...
 

Macros

#define LORAWAN_HDR_MTYPE_MASK   (0xe0)
 MType mask.
 
#define LORAWAN_HDR_MTYPE_POS   (5U)
 MType position.
 
#define LORAWAN_HDR_MAJOR_MASK   (0x03)
 Major version mask.
 
#define LORAWAN_HDR_MAJOR_POS   (0U)
 Major version position.
 
#define LORAWAN_HDR_ADR_MASK   (0x80)
 ADR mask.
 
#define LORAWAN_HDR_ADR_POS   (7U)
 ADR position.
 
#define LORAWAN_HDR_ADR_ACK_MASK   (0x40)
 ADR ACK bit mask.
 
#define LORAWAN_HDR_ADR_ACK_POS   (6U)
 ADR ACK bit position.
 
#define LORAWAN_HDR_ACK_MASK   (0x20)
 ACK bit mask.
 
#define LORAWAN_HDR_ACK_POS   (5U)
 ACK bit position.
 
#define LORAWAN_HDR_FRAME_PENDING_MASK   (0x10)
 Frame pending bit mask.
 
#define LORAWAN_HDR_FRAME_PENDING_POS   (4U)
 Frame pending bit position.
 
#define LORAWAN_HDR_FOPTS_LEN_MASK   (0x0F)
 Frame options mask.
 
#define LORAWAN_HDR_FOPTS_LEN_POS   (0U)
 Frame options position.
 

Functions

static void lorawan_hdr_set_mtype (lorawan_hdr_t *hdr, uint8_t mtype)
 Set LoRaWAN header MType. More...
 
static uint8_t lorawan_hdr_get_mtype (lorawan_hdr_t *hdr)
 Get LoRaWAN header MType. More...
 
static void lorawan_hdr_set_maj (lorawan_hdr_t *hdr, uint8_t maj)
 Set LoRaWAN major version. More...
 
static uint8_t lorawan_hdr_get_maj (lorawan_hdr_t *hdr)
 Get LoRaWAN major version. More...
 
static void lorawan_hdr_set_adr (lorawan_hdr_t *hdr, bool adr)
 Set LoRaWAN header Adaptive Data Rate bit. More...
 
static bool lorawan_hdr_get_adr (lorawan_hdr_t *hdr)
 Get LoRaWAN header Adaptive Data Rate bit. More...
 
static void lorawan_hdr_set_adr_ack_req (lorawan_hdr_t *hdr, bool adr_ack_req)
 Set LoRaWAN header ADR ACK request bit. More...
 
static bool lorawan_hdr_get_adr_ack_req (lorawan_hdr_t *hdr)
 Get LoRaWAN header ADR ACK request bit. More...
 
static void lorawan_hdr_set_ack (lorawan_hdr_t *hdr, bool ack)
 Set LoRaWAN header ACK bit. More...
 
static bool lorawan_hdr_get_ack (lorawan_hdr_t *hdr)
 Get LoRaWAN header ACK bit. More...
 
static void lorawan_hdr_set_frame_pending (lorawan_hdr_t *hdr, bool frame_pending)
 Set LoRaWAN header frame pending bit. More...
 
static bool lorawan_hdr_get_frame_pending (lorawan_hdr_t *hdr)
 Get LoRaWAN header frame pending bit. More...
 
static void lorawan_hdr_set_frame_opts_len (lorawan_hdr_t *hdr, uint8_t len)
 Set LoRaWAN header FOpts length. More...
 
static uint8_t lorawan_hdr_get_frame_opts_len (lorawan_hdr_t *hdr)
 Get LoRaWAN header FOps length. More...