ns3::LorawanMacHeader Class Reference

This class represents the Mac header of a LoRaWAN packet. More...

#include "lorawan-mac-header.h"

+ Inheritance diagram for ns3::LorawanMacHeader:
+ Collaboration diagram for ns3::LorawanMacHeader:

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...
 

Detailed Description

This class represents the Mac header of a LoRaWAN packet.

Definition at line 35 of file lorawan-mac-header.h.

Member Enumeration Documentation

◆ MType

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.

Constructor & Destructor Documentation

◆ LorawanMacHeader()

ns3::LorawanMacHeader::LorawanMacHeader ( )

Definition at line 34 of file lorawan-mac-header.cc.

◆ ~LorawanMacHeader()

ns3::LorawanMacHeader::~LorawanMacHeader ( )

Definition at line 39 of file lorawan-mac-header.cc.

Member Function Documentation

◆ Deserialize()

uint32_t ns3::LorawanMacHeader::Deserialize ( Buffer::Iterator  start)
virtual

Deserialize the header.

Parameters
startA pointer to the buffer we need to deserialize.
Returns
The number of consumed bytes.

Definition at line 88 of file lorawan-mac-header.cc.

References m_major, and m_mtype.

◆ GetInstanceTypeId()

TypeId ns3::LorawanMacHeader::GetInstanceTypeId ( void  ) const
virtual

Definition at line 52 of file lorawan-mac-header.cc.

References GetTypeId().

+ Here is the call graph for this function:

◆ GetMajor()

uint8_t ns3::LorawanMacHeader::GetMajor ( void  ) const

Get the major version from the header.

Returns
The uint8_t corresponding to this header's major version.

Definition at line 140 of file lorawan-mac-header.cc.

References m_major.

◆ GetMType()

uint8_t ns3::LorawanMacHeader::GetMType ( void  ) const

Get the message type from the header.

Returns
The uint8_t corresponding to this header's message type.

Definition at line 122 of file lorawan-mac-header.cc.

References m_mtype.

Referenced by ns3::LoraConfirmedMessagesComponent::OnReceivedPacket().

+ Here is the caller graph for this function:

◆ GetSerializedSize()

uint32_t ns3::LorawanMacHeader::GetSerializedSize ( void  ) const
virtual

Definition at line 58 of file lorawan-mac-header.cc.

◆ GetTypeId()

TypeId ns3::LorawanMacHeader::GetTypeId ( void  )
static

Definition at line 44 of file lorawan-mac-header.cc.

Referenced by GetInstanceTypeId().

+ Here is the caller graph for this function:

◆ IsConfirmed()

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.

◆ IsUplink()

bool ns3::LorawanMacHeader::IsUplink ( void  ) const

Check whether this header is for an uplink message.

Returns
True if the message is meant to be sent from an ED to a GW, false otherwise.

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().

+ Here is the caller graph for this function:

◆ Print()

void ns3::LorawanMacHeader::Print ( std::ostream &  os) const
virtual

Print the header in a human readable format.

Parameters
osThe std::ostream on which to print the header.

Definition at line 107 of file lorawan-mac-header.cc.

References m_major, and m_mtype.

◆ Serialize()

void ns3::LorawanMacHeader::Serialize ( Buffer::Iterator  start) const
virtual

Serialize the header.

See Page 15 of LoRaWAN specification for a representation of fields.

Parameters
startA pointer to the buffer that will be filled with the serialization.

Definition at line 66 of file lorawan-mac-header.cc.

References m_major, and m_mtype.

◆ SetMajor()

void ns3::LorawanMacHeader::SetMajor ( uint8_t  major)

Set the major version of this header.

Parameters
majorThe 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().

+ Here is the caller graph for this function:

◆ SetMType()

void ns3::LorawanMacHeader::SetMType ( enum MType  mtype)

Set the message type.

Parameters
mtypeThe 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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_major

uint8_t ns3::LorawanMacHeader::m_major
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().

◆ m_mtype

uint8_t ns3::LorawanMacHeader::m_mtype
private

The Message Type.

Definition at line 131 of file lorawan-mac-header.h.

Referenced by Deserialize(), GetMType(), IsConfirmed(), IsUplink(), Print(), Serialize(), and SetMType().


The documentation for this class was generated from the following files: