All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
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.
 
#define LORAWAN_JA_HDR_OPTNEG_MASK   (0x80)
 OptNeg bit mask.
 
#define LORAWAN_JA_HDR_OPTNEG_POS   (7U)
 OptNeg bit position.
 

Functions

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