This class represents the Mac header of a LoRaWAN packet. More...
#include "lorawan-mac-header.h"
Public Types | |
enum | MType { JOIN_REQUEST = 0 , JOIN_ACCEPT = 1 , UNCONFIRMED_DATA_UP = 2 , UNCONFIRMED_DATA_DOWN = 3 , CONFIRMED_DATA_UP = 4 , CONFIRMED_DATA_DOWN = 5 , PROPRIETARY = 7 } |
The message type. More... | |
Public Member Functions | |
LorawanMacHeader () | |
~LorawanMacHeader () | |
virtual uint32_t | Deserialize (Buffer::Iterator start) |
Deserialize the header. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
uint8_t | GetMajor (void) const |
Get the major version from the header. More... | |
uint8_t | GetMType (void) const |
Get the message type from the header. More... | |
virtual uint32_t | GetSerializedSize (void) const |
bool | IsConfirmed (void) const |
bool | IsUplink (void) const |
Check whether this header is for an uplink message. More... | |
virtual void | Print (std::ostream &os) const |
Print the header in a human readable format. More... | |
virtual void | Serialize (Buffer::Iterator start) const |
Serialize the header. More... | |
void | SetMajor (uint8_t major) |
Set the major version of this header. More... | |
void | SetMType (enum MType mtype) |
Set the message type. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Private Attributes | |
uint8_t | m_major |
The major version this header is using. More... | |
uint8_t | m_mtype |
The Message Type. More... | |
This class represents the Mac header of a LoRaWAN packet.
Definition at line 35 of file lorawan-mac-header.h.
The message type.
The enum value corresponds to the value that will be written in the header by the Serialize method.
Enumerator | |
---|---|
JOIN_REQUEST | |
JOIN_ACCEPT | |
UNCONFIRMED_DATA_UP | |
UNCONFIRMED_DATA_DOWN | |
CONFIRMED_DATA_UP | |
CONFIRMED_DATA_DOWN | |
PROPRIETARY |
Definition at line 44 of file lorawan-mac-header.h.
ns3::LorawanMacHeader::LorawanMacHeader | ( | ) |
Definition at line 34 of file lorawan-mac-header.cc.
ns3::LorawanMacHeader::~LorawanMacHeader | ( | ) |
Definition at line 39 of file lorawan-mac-header.cc.
|
virtual |
Deserialize the header.
start | A pointer to the buffer we need to deserialize. |
Definition at line 88 of file lorawan-mac-header.cc.
|
virtual |
Definition at line 52 of file lorawan-mac-header.cc.
References GetTypeId().
uint8_t ns3::LorawanMacHeader::GetMajor | ( | void | ) | const |
Get the major version from the header.
Definition at line 140 of file lorawan-mac-header.cc.
References m_major.
uint8_t ns3::LorawanMacHeader::GetMType | ( | void | ) | const |
Get the message type from the header.
Definition at line 122 of file lorawan-mac-header.cc.
References m_mtype.
Referenced by ns3::LoraConfirmedMessagesComponent::OnReceivedPacket().
|
virtual |
Definition at line 58 of file lorawan-mac-header.cc.
|
static |
Definition at line 44 of file lorawan-mac-header.cc.
Referenced by GetInstanceTypeId().
bool ns3::LorawanMacHeader::IsConfirmed | ( | void | ) | const |
Definition at line 157 of file lorawan-mac-header.cc.
References CONFIRMED_DATA_DOWN, CONFIRMED_DATA_UP, and m_mtype.
bool ns3::LorawanMacHeader::IsUplink | ( | void | ) | const |
Check whether this header is for an uplink message.
Definition at line 148 of file lorawan-mac-header.cc.
References CONFIRMED_DATA_UP, JOIN_REQUEST, m_mtype, and UNCONFIRMED_DATA_UP.
Referenced by ns3::LorawanMacEndDeviceClassA::Receive(), ns3::LorawanGroundMacGateway::Receive(), ns3::LorawanOrbiterMacGateway::Receive(), and ns3::LorawanMacGateway::Receive().
|
virtual |
Print the header in a human readable format.
os | The std::ostream on which to print the header. |
Definition at line 107 of file lorawan-mac-header.cc.
|
virtual |
Serialize the header.
See Page 15 of LoRaWAN specification for a representation of fields.
start | A pointer to the buffer that will be filled with the serialization. |
Definition at line 66 of file lorawan-mac-header.cc.
void ns3::LorawanMacHeader::SetMajor | ( | uint8_t | major | ) |
Set the major version of this header.
major | The uint8_t corresponding to this header's major version. |
Definition at line 130 of file lorawan-mac-header.cc.
References m_major.
Referenced by ns3::LorawanMacEndDevice::ApplyNecessaryOptions().
void ns3::LorawanMacHeader::SetMType | ( | enum MType | mtype | ) |
Set the message type.
mtype | The message type of this header. |
Definition at line 114 of file lorawan-mac-header.cc.
References m_mtype.
Referenced by ns3::LorawanMacEndDevice::ApplyNecessaryOptions(), and ns3::LoraEndDeviceStatus::GetCompleteReplyPacket().
|
private |
The major version this header is using.
Definition at line 136 of file lorawan-mac-header.h.
Referenced by Deserialize(), GetMajor(), Print(), Serialize(), and SetMajor().
|
private |
The Message Type.
Definition at line 131 of file lorawan-mac-header.h.
Referenced by Deserialize(), GetMType(), IsConfirmed(), IsUplink(), Print(), Serialize(), and SetMType().