lorawan-mac-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017 University of Padova
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Davide Magrin <magrinda@dei.unipd.it>
19  */
20 
21 #ifndef LORAWAN_MAC_HEADER_H
22 #define LORAWAN_MAC_HEADER_H
23 
24 #include <ns3/header.h>
25 
26 namespace ns3
27 {
28 
32 class LorawanMacHeader : public Header
33 {
34  public:
41  enum MType
42  {
49  PROPRIETARY = 7
50  };
51 
52  static TypeId GetTypeId(void);
53 
56 
57  // Pure virtual methods from Header that need to be implemented by this class
58  virtual TypeId GetInstanceTypeId(void) const;
59  virtual uint32_t GetSerializedSize(void) const;
60 
69  virtual void Serialize(Buffer::Iterator start) const;
70 
77  virtual uint32_t Deserialize(Buffer::Iterator start);
78 
84  virtual void Print(std::ostream& os) const;
85 
91  void SetMType(enum MType mtype);
92 
98  uint8_t GetMType(void) const;
99 
105  void SetMajor(uint8_t major);
106 
112  uint8_t GetMajor(void) const;
113 
120  bool IsUplink(void) const;
121 
122  bool IsConfirmed(void) const;
123 
124  private:
128  uint8_t m_mtype;
129 
133  uint8_t m_major;
134 };
135 } // namespace ns3
136 
137 #endif
This class represents the Mac header of a LoRaWAN packet.
void SetMajor(uint8_t major)
Set the major version of this header.
uint8_t m_major
The major version this header is using.
virtual void Serialize(Buffer::Iterator start) const
Serialize the header.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the header.
MType
The message type.
uint8_t GetMajor(void) const
Get the major version from the header.
bool IsConfirmed(void) const
virtual TypeId GetInstanceTypeId(void) const
bool IsUplink(void) const
Check whether this header is for an uplink message.
uint8_t m_mtype
The Message Type.
static TypeId GetTypeId(void)
uint8_t GetMType(void) const
Get the message type from the header.
virtual void Print(std::ostream &os) const
Print the header in a human readable format.
virtual uint32_t GetSerializedSize(void) const
void SetMType(enum MType mtype)
Set the message type.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.