A Discrete-Event Network Simulator
API
lr-wpan-mac-pl-headers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Ritsumeikan University, Shiga, Japan.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Alberto Gallegos Ramonet <ramonet@fc.ritsumei.ac.jp>
18  */
19 
20 #ifndef LR_WPAN_MAC_PL_HEADERS_H
21 #define LR_WPAN_MAC_PL_HEADERS_H
22 
23 #include "lr-wpan-fields.h"
24 
25 #include <ns3/header.h>
26 #include <ns3/mac16-address.h>
27 #include <ns3/mac64-address.h>
28 
29 namespace ns3
30 {
31 
38 {
39  public:
45  static TypeId GetTypeId();
46  TypeId GetInstanceTypeId() const override;
47  uint32_t GetSerializedSize() const override;
48  void Serialize(Buffer::Iterator start) const override;
49  uint32_t Deserialize(Buffer::Iterator start) override;
50  void Print(std::ostream& os) const override;
55  void SetSuperframeSpecField(uint16_t sfrmField);
60  void SetGtsFields(GtsFields gtsFields);
65  void SetPndAddrFields(PendingAddrFields pndAddrFields);
70  uint16_t GetSuperframeSpecField() const;
75  GtsFields GetGtsFields() const;
81 
82  private:
95 };
96 
106 {
107  public:
113  {
117  DATA_REQ = 0x04,
118  PANID_CONFLICT = 0x05,
119  ORPHAN_NOTIF = 0x06,
120  BEACON_REQ = 0x07,
121  COOR_REALIGN = 0x08,
122  GTS_REQ = 0x09,
123  CMD_RESERVED = 0xff
124  };
125 
136  static TypeId GetTypeId();
137  TypeId GetInstanceTypeId() const override;
138  uint32_t GetSerializedSize() const override;
139  void Serialize(Buffer::Iterator start) const override;
140  uint32_t Deserialize(Buffer::Iterator start) override;
141  void Print(std::ostream& os) const override;
142 
147  void SetCommandFrameType(MacCommand macCmd);
153  void SetCapabilityField(uint8_t cap);
158  void SetCoordShortAddr(Mac16Address addr);
163  void SetChannel(uint8_t channel);
168  void SetPage(uint8_t page);
173  void SetPanId(uint16_t id);
179  void SetShortAddr(Mac16Address shortAddr);
184  void SetAssociationStatus(uint8_t status);
190  Mac16Address GetShortAddr() const;
195  uint8_t GetAssociationStatus() const;
206  uint8_t GetCapabilityField() const;
216  uint8_t GetChannel() const;
221  uint8_t GetPage() const;
226  uint16_t GetPanId() const;
227 
228  private:
236  uint16_t m_panid;
237  uint8_t m_logCh;
238  uint8_t m_logChPage;
239  uint8_t m_assocStatus;
240 };
241 
242 } // namespace ns3
243 
244 #endif /* LR_WPAN_MAC_PL_HEADERS_H */
Implements the header for the MAC payload beacon frame according to the IEEE 802.15....
GtsFields GetGtsFields() const
Get the Guaranteed Time Slots (GTS) fields from the beacon payload header.
GtsFields m_gtsFields
GTS Fields.
PendingAddrFields m_pndAddrFields
Pending Address Fields.
PendingAddrFields GetPndAddrFields() const
Get the pending address fields from the beacon payload header.
uint16_t GetSuperframeSpecField() const
Get the superframe specification field from the beacon payload header.
void SetSuperframeSpecField(uint16_t sfrmField)
Set the superframe specification field to the beacon payload header.
uint16_t m_superframeField
Superframe Specification Field.
void Print(std::ostream &os) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
static TypeId GetTypeId()
Get the type ID.
void Serialize(Buffer::Iterator start) const override
uint32_t GetSerializedSize() const override
void SetGtsFields(GtsFields gtsFields)
Set the superframe Guaranteed Time Slot (GTS) fields to the beacon payload header.
void SetPndAddrFields(PendingAddrFields pndAddrFields)
Set the superframe Pending Address fields to the beacon payload header.
iterator in a Buffer instance
Definition: buffer.h:100
Implements the header for the MAC payload command frame according to the IEEE 802....
uint8_t m_assocStatus
Association Status (Association Response Command)
void SetPage(uint8_t page)
Set the logical channel page number.
void SetPanId(uint16_t id)
Get the PAN identifier.
Mac16Address GetShortAddr() const
Get the Short address assigned by the coordinator (Association Response and Coordinator Realigment co...
uint8_t GetChannel() const
Get the logical channel number.
uint16_t m_panid
The PAN identifier (Coordinator realigment command)
MacCommand m_cmdFrameId
The command Frame Identifier (Used by all commands)
uint8_t m_capabilityInfo
Capability Information Field (Association Request Command)
MacCommand GetCommandFrameType() const
Get the command frame type ID.
MacCommand
The MAC command frames.
@ ASSOCIATION_RESP
Association response (RFD true: Rx)
@ BEACON_REQ
Beacon Request (RFD true: none )
@ DATA_REQ
Data Request (RFD true: Tx)
@ ORPHAN_NOTIF
Orphan Notification (RFD true: Tx)
@ ASSOCIATION_REQ
Association request (RFD true: Tx)
@ DISASSOCIATION_NOTIF
Disassociation notification (RFD true: TX, Rx)
@ COOR_REALIGN
Coordinator Realignment (RFD true: Rx)
@ PANID_CONFLICT
Pan ID conflict notification (RFD true: Tx)
@ GTS_REQ
GTS Request (RFD true: none)
Mac16Address GetCoordShortAddr() const
Get the coordinator short address.
void Serialize(Buffer::Iterator start) const override
uint16_t GetPanId() const
Get the PAN identifier.
void SetCommandFrameType(MacCommand macCmd)
Set the command frame type.
void SetCoordShortAddr(Mac16Address addr)
Set the coordinator short address (16 bit address).
uint8_t GetCapabilityField() const
Get the Capability Information Field from the command payload header.
static TypeId GetTypeId()
Get the type ID.
void SetAssociationStatus(uint8_t status)
Set status resulting from the association attempt (Association Response Command).
Mac16Address m_coordShortAddr
The coordinator short address (Coordinator realigment command)
void SetCapabilityField(uint8_t cap)
Set the Capability Information Field to the command payload header (Association Request Command).
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t m_logCh
The channel number (Coordinator realigment command)
uint8_t GetAssociationStatus() const
Get the status resulting from an association request (Association Response Command).
uint8_t m_logChPage
The channel page number (Coordinator realigment command)
Mac16Address m_shortAddr
Contains the short address assigned by the coordinator (Association Response and Coordinator Realiagm...
void SetShortAddr(Mac16Address shortAddr)
Set the Short Address Assigned by the coordinator (Association Response and Coordinator Realigment Co...
uint32_t GetSerializedSize() const override
void Print(std::ostream &os) const override
void SetChannel(uint8_t channel)
Set the logical channel number.
uint8_t GetPage() const
Get the logical channel page number.
Represent the GTS information fields.
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
This class can contain 16 bit addresses.
Definition: mac16-address.h:44
Represent the Pending Address Specification field.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:88