A Discrete-Event Network Simulator
API
lr-wpan-fields.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 Ritsumeikan University, Shiga, Japan.
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: Alberto Gallegos Ramonet <ramonet@fc.ritsumei.ac.jp>
19  *
20  * This file implements Information Fields present in IEEE 802.15.4-2011.
21  * Information Fields are in practice similar to the Information Elements(IE)
22  * introduced in later revisions of the standard, however, they lack
23  * descriptors and common format unlike the IEs. To keep this implementation
24  * consistent with the IEEE 802.15.4-2011 std. the present file implements
25  * Information Fields not Information Elements.
26  */
27 #ifndef LR_WPAN_FIELDS_H
28 #define LR_WPAN_FIELDS_H
29 
30 
31 #include <ns3/mac16-address.h>
32 #include <ns3/mac64-address.h>
33 #include "ns3/buffer.h"
34 #include <array>
35 
36 
37 namespace ns3 {
38 
43 {
44  RFD = 0,
45  FFD = 1
46 };
47 
54 {
55 
56 public:
57  SuperframeField ();
62  void SetSuperframe (uint16_t superFrm);
67  void SetBeaconOrder (uint8_t bcnOrder);
72  void SetSuperframeOrder (uint8_t frmOrder);
77  void SetFinalCapSlot (uint8_t capSlot);
82  void SetBattLifeExt (bool battLifeExt);
87  void SetPanCoor (bool panCoor);
92  void SetAssocPermit (bool assocPermit);
96  uint8_t GetBeaconOrder (void) const;
100  uint8_t GetFrameOrder (void) const;
104  uint8_t GetFinalCapSlot (void) const;
108  bool IsBattLifeExt (void) const;
112  bool IsPanCoor (void) const;
116  bool IsAssocPermit (void) const;
121  uint16_t GetSuperframe (void) const;
126  uint32_t GetSerializedSize (void) const;
139 
140 
141 private:
142  // Superframe Specification field
143  // See IEEE 802.14.15-2011 5.2.2.1.2
144  uint8_t m_sspecBcnOrder;
148  bool m_sspecPanCoor;
151 
152 };
153 std::ostream &operator << (std::ostream &os, const SuperframeField &superframeField);
154 
161 {
162 
163 public:
164  GtsFields ();
169  uint8_t GetGtsSpecField (void) const;
174  uint8_t GetGtsDirectionField (void) const;
179  void SetGtsSpecField (uint8_t gtsSpec);
184  void SetGtsDirectionField (uint8_t gtsDir);
189  uint32_t GetSerializedSize (void) const;
202 
203 private:
204  //GTS Descriptor
206  {
209  uint8_t m_gtsDescLength;
210  };
211 
212  //GTS specification field
214  uint8_t m_gtsSpecPermit;
216  //GTS Direction field
217  uint8_t m_gtsDirMask;
218  //GTS List
221 };
222 std::ostream &operator << (std::ostream &os, const GtsFields &gtsFields);
223 
224 
225 
232 {
233 
234 public:
240  void AddAddress (Mac16Address shortAddr);
245  void AddAddress (Mac64Address extAddr);
251  bool SearchAddress (Mac16Address shortAddr);
257  bool SearchAddress (Mac64Address extAddr);
262  uint8_t GetPndAddrSpecField (void) const;
267  uint8_t GetNumShortAddr (void) const;
272  uint8_t GetNumExtAddr (void) const;
273 
279  void SetPndAddrSpecField (uint8_t pndAddrSpecField);
284  uint32_t GetSerializedSize (void) const;
297 
298 private:
299  // Pending Address Specification Field
301  uint8_t m_pndAddrSpecNumExtAddr;
303  // Address List
305  std::array <Mac16Address,7> m_shortAddrList;
306  std::array<Mac64Address,7> m_extAddrList;
307 
308 };
309 std::ostream &operator << (std::ostream &os, const PendingAddrFields &pendingAddrFields);
310 
311 
312 } //end namespace ns3
313 
314 #endif /* LR_WPAN_FIELDS_H */
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize the entire GTS fields.
void SetBeaconOrder(uint8_t bcnOrder)
Set the superframe specification Beacon Order field.
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize the all the Pending Address Fields.
Mac16Address m_gtsDescDevShortAddr
GTS Descriptor Device Short Address (Bit 0-15)
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize the entire Pending Address Fields.
uint32_t GetSerializedSize(void) const
Get the size of the serialized GTS fields.
uint8_t m_gtsDescStartSlot
GTS Descriptor GTS Starting Slot(Bit 16-19)
uint8_t GetFinalCapSlot(void) const
Check if the Final CAP Slot bit is enabled.
DeviceType
The device Capabilities.
uint8_t GetBeaconOrder(void) const
Get the Superframe Specification Beacon Order field.
void SetGtsDirectionField(uint8_t gtsDir)
Set the GTS direction field to the GTS Fields gtsDir The GTS Direction Field to set.
uint8_t GetNumShortAddr(void) const
Get the number of Short Pending Address indicated in the Pending Address Specification Field...
uint8_t m_gtsDescLength
GTS Descriptor GTS Length (Bit 20-23)
std::array< Mac64Address, 7 > m_extAddrList
Pending Extended Address List.
std::array< Mac16Address, 7 > m_shortAddrList
Pending Short Address List.
uint16_t GetSuperframe(void) const
Get the Superframe specification information field.
bool IsBattLifeExt(void) const
Check if the Battery Life Extension bit is enabled.
iterator in a Buffer instance
Definition: buffer.h:98
an EUI-64 address
Definition: mac64-address.h:43
void SetPndAddrSpecField(uint8_t pndAddrSpecField)
Set the whole Pending Address Specification field.
void SetSuperframeOrder(uint8_t frmOrder)
Set the superframe specification Superframe Order field.
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize the entire superframe specification field.
uint32_t GetSerializedSize(void) const
Get the size of the serialized Superframe specification information field.
Reduced Functional Device (RFD)
uint8_t GetGtsSpecField(void) const
Get the GTS Specification Field from the GTS Fields.
bool m_sspecPanCoor
Superframe Specification field PAN Coordinator (Bit 14)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_gtsDirMask
GTS Direction field Directions Mask (Bit 0-6) GTS Direction field Reserved (Not Necessary) (Bit 7) ...
uint8_t GetFrameOrder(void) const
Get the Superframe Specification Frame Order field.
This class can contain 16 bit addresses.
Definition: mac16-address.h:41
Represent the Superframe Specification information field.
uint8_t m_gtsSpecDescCount
GTS specification field Descriptor Count (Bit 0-2) GTS specification field Reserved (Not necessary) (...
uint8_t m_sspecSprFrmOrder
Superframe Specification field Superframe Order (Bit 4-7)
uint8_t m_sspecBcnOrder
Superframe Specification field Beacon Order (Bit 0-3)
void SetSuperframe(uint16_t superFrm)
Set the whole Superframe Specification Information field.
gtsDescriptor m_gtsList[6]
GTS List field (maximum descriptors stored == 7)
void SetFinalCapSlot(uint8_t capSlot)
Set the superframe specification Final CAP slot field.
uint8_t GetPndAddrSpecField(void) const
Get the whole Pending Address Specification Field from the Pending Address Fields.
bool m_sspecBatLifeExt
Superframe Specification field Battery Life Extension (Bit 12) Superframe Specification field Reserve...
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize the entire superframe specification field.
void SetBattLifeExt(bool battLifeExt)
Set the Superframe Specification Battery Life Extension (BLE).
void SetGtsSpecField(uint8_t gtsSpec)
Set the GTS Specification Field to the GTS Fields gtsSpec The GTS Specification Field to set...
uint8_t m_pndAddrSpecNumShortAddr
Pending Address Specification field Number of Short Address (Bits 0-2) Pending Address Specification ...
uint8_t m_gtsSpecPermit
GTS specification field GTS Permit (Bit 7)
uint8_t GetNumExtAddr(void) const
Get the number of Extended Pending Address indicated in the Pending Address Specification Field...
uint8_t m_sspecFnlCapSlot
Superframe Specification field Final CAP slot (Bit 8-11)
bool m_sspecAssocPermit
Superframe Specification field Association Permit (Bit 15)
bool IsAssocPermit(void) const
Check if the Association Permit bit is enabled.
uint8_t GetGtsDirectionField(void) const
Get the GTS Direction Field from the GTS Fields.
void AddAddress(Mac16Address shortAddr)
Add a short Pending Address to the Address List.
uint32_t GetSerializedSize(void) const
Get the size of the serialized Pending Address Fields.
Full Functional Device (FFD)
void SetPanCoor(bool panCoor)
Set the Superframe Specification PAN coordinator field.
void SetAssocPermit(bool assocPermit)
Set the Superframe Specification Association Permit field.
bool SearchAddress(Mac16Address shortAddr)
Search for the short Pending Address in the Address List.
Represent the Pending Address Specification field.
Represent the GTS information fields.
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize the entire GTS fields.
uint8_t m_pndAddrSpecNumExtAddr
Pending Address Specification field Number of Extended Address (Bits 4-6) Pending Address Specificati...
bool IsPanCoor(void) const
Check if the PAN Coordinator bit is enabled.