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 #include <ostream>
27 #include <stdint.h>
28 
29 namespace ns3
30 {
31 
35 class LorawanMacHeader : public Header
36 {
37  public:
44  enum MType
45  {
52  PROPRIETARY = 7
53  };
54 
55  static TypeId GetTypeId(void);
56 
59 
60  // Pure virtual methods from Header that need to be implemented by this class
61  virtual TypeId GetInstanceTypeId(void) const;
62  virtual uint32_t GetSerializedSize(void) const;
63 
72  virtual void Serialize(Buffer::Iterator start) const;
73 
80  virtual uint32_t Deserialize(Buffer::Iterator start);
81 
87  virtual void Print(std::ostream& os) const;
88 
94  void SetMType(enum MType mtype);
95 
101  uint8_t GetMType(void) const;
102 
108  void SetMajor(uint8_t major);
109 
115  uint8_t GetMajor(void) const;
116 
123  bool IsUplink(void) const;
124 
125  bool IsConfirmed(void) const;
126 
127  private:
131  uint8_t m_mtype;
132 
136  uint8_t m_major;
137 };
138 } // namespace ns3
139 
140 #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.