A Discrete-Event Network Simulator
API
lr-wpan-mac.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 The Boeing Company
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  * Authors:
19  * Gary Pei <guangyu.pei@boeing.com>
20  * kwong yin <kwong-sang.yin@boeing.com>
21  * Tom Henderson <thomas.r.henderson@boeing.com>
22  * Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
23  * Alberto Gallegos Ramonet <ramonet@fc.ritsumei.ac.jp>
24  */
25 #ifndef LR_WPAN_MAC_H
26 #define LR_WPAN_MAC_H
27 
28 #include <ns3/object.h>
29 #include <ns3/traced-callback.h>
30 #include <ns3/traced-value.h>
31 #include <ns3/mac16-address.h>
32 #include <ns3/mac64-address.h>
33 #include <ns3/sequence-number.h>
34 #include <ns3/lr-wpan-phy.h>
35 #include <ns3/lr-wpan-fields.h>
36 #include <ns3/event-id.h>
37 #include <deque>
38 
39 
40 namespace ns3 {
41 
42 class Packet;
43 class LrWpanCsmaCa;
44 
56 typedef enum
57 {
63 
69 typedef enum
70 {
82 
88 typedef enum
89 {
91  CAP,
92  CFP,
93  INACTIVE
95 
101 typedef enum
102 {
103  OUTGOING = 0,
104  INCOMING = 1
106 
107 
108 namespace TracedValueCallback {
109 
117 typedef void (*LrWpanMacState)(LrWpanMacState oldValue,
118  LrWpanMacState newValue);
119 
127 typedef void (*SuperframeStatus)(SuperframeStatus oldValue,
128  SuperframeStatus newValue);
129 
130 } // namespace TracedValueCallback
131 
137 typedef enum
138 {
142  EXT_ADDR = 3
144 
150 typedef enum
151 {
156  DISASSOCIATED = 0xff
158 
164 typedef enum
165 {
179 
185 typedef enum
186 {
198 
204 typedef enum
205 {
211 
212 
218 typedef enum
219 {
230 
237 {
241  m_dstPanId (0),
242  m_dstAddr (),
243  m_msduHandle (0),
244  m_txOptions (0)
245  {}
248  uint16_t m_dstPanId;
251  uint8_t m_msduHandle;
252  uint8_t m_txOptions;
253 };
254 
261 {
262  uint8_t m_msduHandle;
264 };
271 {
272  uint8_t m_srcAddrMode;
273  uint16_t m_srcPanId;
276  uint8_t m_dstAddrMode;
277  uint16_t m_dstPanId;
281  uint8_t m_dsn;
282 };
289 {
291  : m_PanId (0),
292  m_logCh (11),
293  m_logChPage (0),
294  m_startTime (0),
295  m_bcnOrd (15),
296  m_sfrmOrd (15),
297  m_panCoor (false),
298  m_battLifeExt (false),
299  m_coorRealgn (false)
300  {}
301  uint16_t m_PanId;
302  uint8_t m_logCh;
303  uint32_t m_logChPage;
304  uint32_t m_startTime;
305  uint8_t m_bcnOrd;
306  uint8_t m_sfrmOrd;
307  bool m_panCoor;
310 };
317 {
319  : m_logCh (),
320  m_trackBcn (false)
321  {}
322  uint8_t m_logCh;
323  bool m_trackBcn;
324 };
331 {
334  m_coorPanId (0),
335  m_coorShortAddr (),
336  m_coorExtAddr ()
337  {}
339  uint16_t m_coorPanId;
342 
343 
344 };
351 {
353 };
360 {
361  uint8_t m_bsn;
362  //TODO: Add other params
363  //m_PanDesc;
364  //m_PenAddrSpec
365  //m_sduAddrList
366  //m_sduLength
367  //m_sdu;
368 };
375 {
377  uint16_t m_panId;
378  uint8_t m_logCh;
379 };
386 {
388 };
448 class LrWpanMac : public Object
449 {
450 public:
456  static TypeId GetTypeId (void);
457  //MAC sublayer constants
462  static const uint32_t aMinMPDUOverhead;
468  static const uint32_t aBaseSlotDuration;
473  static const uint32_t aNumSuperframeSlots;
479  static const uint32_t aBaseSuperframeDuration;
486  static const uint32_t aMaxLostBeacons;
492  static const uint32_t aMaxSIFSFrameSize;
496  LrWpanMac (void);
497  virtual ~LrWpanMac (void);
503  bool GetRxOnWhenIdle (void);
509  void SetRxOnWhenIdle (bool rxOnWhenIdle);
510  // XXX these setters will become obsolete if we use the attribute system
522  Mac16Address GetShortAddress (void) const;
534  Mac64Address GetExtendedAddress (void) const;
540  void SetPanId (uint16_t panId);
546  uint16_t GetPanId (void) const;
587  void SetCsmaCa (Ptr<LrWpanCsmaCa> csmaCa);
593  void SetPhy (Ptr<LrWpanPhy> phy);
599  Ptr<LrWpanPhy> GetPhy (void);
648 
649  // interfaces between MAC and PHY
650 
659  void PdDataIndication (uint32_t psduLength, Ptr<Packet> p, uint8_t lqi);
666  void PdDataConfirm (LrWpanPhyEnumeration status);
672  void PlmeCcaConfirm (LrWpanPhyEnumeration status);
679  void PlmeEdConfirm (LrWpanPhyEnumeration status, uint8_t energyLevel);
690  LrWpanPhyPibAttributes* attribute);
712  void SetLrWpanMacState (LrWpanMacState macState);
719 
726 
727 
728  //MAC PIB attributes
729 
790  uint8_t m_fnlCapSlot;
819  uint16_t m_macPanId;
845  uint32_t m_macLIFSPeriod;
850  uint32_t m_macSIFSPeriod;
862  uint32_t m_ifs;
866  bool m_panCoor;
904  uint64_t GetMacAckWaitDuration (void) const;
910  uint8_t GetMacMaxFrameRetries (void) const;
914  void PrintTransmitQueueSize (void);
920  void SetMacMaxFrameRetries (uint8_t retries);
926  bool isCoordDest (void);
944  uint32_t GetIfsSize ();
950  uint64_t GetTxPacketSymbols (void);
956  bool isTxAckReq (void);
964  typedef void (*SentTracedCallback)(Ptr<const Packet> packet, uint8_t retries, uint8_t backoffs);
965 
975  typedef void (*StateTracedCallback)(LrWpanMacState oldState, LrWpanMacState newState);
976 
977 protected:
978  // Inherited from Object.
979  virtual void DoInitialize (void);
980  virtual void DoDispose (void);
981 
982 private:
987  {
988  uint8_t txQMsduHandle;
990 
991  };
996  {
997  uint8_t txQMsduHandle;
1000  };
1004  void SendOneBeacon (void);
1011  void StartCFP (SuperframeType superframeType);
1018  void StartCAP (SuperframeType superframeType);
1025  void StartInactivePeriod (SuperframeType superframeType);
1030  void AwaitBeacon (void);
1034  void BeaconSearchTimeout (void);
1040  void SendAck (uint8_t seqno);
1045  void RemoveFirstTxQElement ();
1051  void ChangeMacState (LrWpanMacState newState);
1056  void AckWaitTimeout (void);
1064  void IfsWaitTimeout (Time ifsTime);
1071  bool PrepareRetransmission (void);
1077  void CheckQueue (void);
1091  GtsFields GetGtsFields (void);
1099 
1193 
1282  Ptr<Packet> m_txPkt; // XXX need packet buffer instead of single packet
1297  std::deque<TxQueueElement*> m_txQueue;
1301  std::deque<IndTxQueueElement*> m_indTxQueue;
1348 };
1349 } // namespace ns3
1350 
1351 #endif /* LR_WPAN_MAC_H */
An identifier for simulation events.
Definition: event-id.h:54
Represent the GTS information fields.
Class that implements the LR-WPAN MAC state machine.
Definition: lr-wpan-mac.h:449
uint32_t m_incomingBeaconInterval
Indication of the interval a node should receive a superframe expressed in symbols.
Definition: lr-wpan-mac.h:881
uint32_t GetIfsSize()
Get the size of the Interframe Space according to MPDU size (m_txPkt).
Ptr< LrWpanCsmaCa > m_csmaCa
The CSMA/CA implementation used by this MAC.
Definition: lr-wpan-mac.h:1229
virtual void DoDispose(void)
Destructor implementation.
Definition: lr-wpan-mac.cc:216
McpsDataConfirmCallback m_mcpsDataConfirmCallback
This callback is used to report data transmission request status to the upper layers.
Definition: lr-wpan-mac.h:1262
static const uint32_t aBaseSlotDuration
Length of a superframe slot in symbols.
Definition: lr-wpan-mac.h:468
Time m_macBeaconRxTime
The time that the device received its last bit of the beacon frame.
Definition: lr-wpan-mac.h:742
Ptr< LrWpanPhy > GetPhy(void)
Get the underlying PHY of the MAC.
Definition: lr-wpan-mac.cc:977
Mac16Address GetShortAddress(void) const
Get the short address of this MAC.
Definition: lr-wpan-mac.cc:280
void PlmeCcaConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.
bool m_macRxOnWhenIdle
Indication of whether the MAC sublayer is to enable its receiver during idle periods.
Definition: lr-wpan-mac.h:840
TracedCallback< Ptr< const Packet > > m_macTxOkTrace
The trace source fired when packets where successfully transmitted, that is an acknowledgment was rec...
Definition: lr-wpan-mac.h:1142
void SetMlmeBeaconNotifyIndicationCallback(MlmeBeaconNotifyIndicationCallback c)
Set the callback for the indication of an incoming beacon packet.
uint64_t m_rxBeaconSymbols
The total size of the received beacon in symbols.
Definition: lr-wpan-mac.h:786
void SetRxOnWhenIdle(bool rxOnWhenIdle)
Set if the receiver should be enabled when the MAC is idle.
Definition: lr-wpan-mac.cc:246
bool m_panCoor
Indication of whether the current device is the PAN coordinator.
Definition: lr-wpan-mac.h:866
void BeaconSearchTimeout(void)
Called if the device is unable to locate a beacon in the time set by MLME-SYNC.request.
Definition: lr-wpan-mac.cc:867
void PlmeSetTRXStateConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state.
uint8_t m_numCsmacaRetry
The number of CSMA/CA retries used for sending the current packet.
Definition: lr-wpan-mac.h:1310
void MlmeSyncRequest(MlmeSyncRequestParams params)
IEEE 802.15.4-2011, section 6.2.13.1 MLME-SYNC.request Request to synchronize with the coordinator by...
Definition: lr-wpan-mac.cc:612
void SendOneBeacon(void)
Called to send a single beacon frame.
Definition: lr-wpan-mac.cc:666
MlmeStartConfirmCallback m_mlmeStartConfirmCallback
This callback is used to report the start of a new PAN or the begin of a new superframe configuration...
Definition: lr-wpan-mac.h:1251
uint64_t GetMacAckWaitDuration(void) const
Get the macAckWaitDuration attribute value.
uint8_t m_deviceCapability
Indication of current device capability (FFD or RFD)
Definition: lr-wpan-mac.h:890
uint8_t GetMacMaxFrameRetries(void) const
Get the macMaxFrameRetries attribute value.
virtual ~LrWpanMac(void)
Definition: lr-wpan-mac.cc:197
EventId m_trackingEvent
Scheduler event to track the incoming beacons.
Definition: lr-wpan-mac.h:1347
void CheckQueue(void)
Check the transmission queue.
Definition: lr-wpan-mac.cc:898
void SetMlmePollConfirmCallback(MlmePollConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
void RemoveFirstTxQElement()
Remove the tip of the transmission queue, including clean up related to the last packet transmission.
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t energyLevel)
IEEE 802.15.4-2006 section 6.2.2.4 PLME-ED.confirm status and energy level.
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: lr-wpan-mac.h:1165
bool GetRxOnWhenIdle(void)
Check if the receiver will be enabled when the MAC is idle.
Definition: lr-wpan-mac.cc:240
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
Definition: lr-wpan-mac.h:1212
void SetExtendedAddress(Mac64Address address)
Set the extended address of this MAC.
Definition: lr-wpan-mac.cc:272
void MlmeStartRequest(MlmeStartRequestParams params)
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
Definition: lr-wpan-mac.cc:516
uint16_t GetPanId(void) const
Get the PAN id used by this MAC.
uint32_t m_macLIFSPeriod
The minimum time forming a Long InterFrame Spacing (LIFS) period.
Definition: lr-wpan-mac.h:845
void StartInactivePeriod(SuperframeType superframeType)
Start the Inactive Period in a beacon-enabled mode.
Definition: lr-wpan-mac.cc:817
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets are dropped due to missing ACKs or because of transmission failur...
Definition: lr-wpan-mac.h:1149
void SetMcpsDataIndicationCallback(McpsDataIndicationCallback c)
Set the callback for the indication of an incoming data packet.
Definition: lr-wpan-mac.cc:983
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lr-wpan-mac.cc:201
void SetMlmeStartConfirmCallback(MlmeStartConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
Definition: lr-wpan-mac.cc:995
EventId m_cfpEvent
Scheduler event for the end of the outgoing superframe CFP.
Definition: lr-wpan-mac.h:1335
static const uint32_t aMinMPDUOverhead
The minimum number of octets added by the MAC sublayer to the PSDU.
Definition: lr-wpan-mac.h:462
void PrintTransmitQueueSize(void)
Print the number of elements in the packet transmit queue.
uint8_t m_macMaxFrameRetries
The maximum number of retries allowed after a transmission failure.
Definition: lr-wpan-mac.h:834
Mac64Address m_macCoordExtendedAddress
The extended address of the coordinator through which the device is associated.
Definition: lr-wpan-mac.h:756
MlmeSyncLossIndicationCallback m_mlmeSyncLossIndicationCallback
This callback is used to indicate the loss of synchronization with a coordinator.
Definition: lr-wpan-mac.h:1239
static TypeId GetTypeId(void)
Get the type ID.
Definition: lr-wpan-mac.cc:58
MlmePollConfirmCallback m_mlmePollConfirmCallback
This callback is used to report the status after a device send data command request to the coordinato...
Definition: lr-wpan-mac.h:1245
SequenceNumber8 m_macBsn
Sequence number added to transmitted beacon frame, 00-ff.
Definition: lr-wpan-mac.h:829
LrWpanAssociationStatus m_associationStatus
The current association status of the MAC layer.
Definition: lr-wpan-mac.h:1278
void SetLrWpanMacState(LrWpanMacState macState)
CSMA-CA algorithm calls back the MAC after executing channel assessment.
Mac16Address m_shortAddress
The short address used by this MAC.
Definition: lr-wpan-mac.h:1288
uint8_t m_macSuperframeOrder
Used by a PAN coordinator or coordinator.
Definition: lr-wpan-mac.h:775
void(* StateTracedCallback)(LrWpanMacState oldState, LrWpanMacState newState)
TracedCallback signature for LrWpanMacState change events.
Definition: lr-wpan-mac.h:975
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaCa)
Set the CSMA/CA implementation to be used by the MAC.
Definition: lr-wpan-mac.cc:965
void PdDataIndication(uint32_t psduLength, Ptr< Packet > p, uint8_t lqi)
IEEE 802.15.4-2006 section 6.2.1.3 PD-DATA.indication Indicates the transfer of an MPDU from PHY to M...
Time m_macBeaconTxTime
The time that the device transmitted its last beacon frame.
Definition: lr-wpan-mac.h:735
SuperframeField GetSuperframeField(void)
Constructs a Superframe specification field from the local information, the superframe Specification ...
Definition: lr-wpan-mac.cc:920
MlmeBeaconNotifyIndicationCallback m_mlmeBeaconNotifyIndicationCallback
This callback is used to notify incoming beacon packets to the upper layers.
Definition: lr-wpan-mac.h:1234
TracedCallback< LrWpanMacState, LrWpanMacState > m_macStateLogger
A trace source that fires when the LrWpanMac changes states.
Definition: lr-wpan-mac.h:1221
EventId m_setMacState
Scheduler event for a deferred MAC state change.
Definition: lr-wpan-mac.h:1319
void StartCFP(SuperframeType superframeType)
Called to begin the Contention Free Period (CFP) in a beacon-enabled mode.
Definition: lr-wpan-mac.cc:771
void SetMcpsDataConfirmCallback(McpsDataConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
Definition: lr-wpan-mac.cc:989
uint16_t m_macTransactionPersistanceTime
The maximum time (in superframe periods) that a transaction is stored by a coordinator and indicated ...
Definition: lr-wpan-mac.h:781
void SetAssociationStatus(LrWpanAssociationStatus status)
Set the current association status.
void SetPanId(uint16_t panId)
Set the PAN id used by this MAC.
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
Definition: lr-wpan-mac.h:1192
uint8_t m_incomingBeaconOrder
The beaconOrder value of the INCOMING frame.
Definition: lr-wpan-mac.h:796
SequenceNumber8 m_macDsn
Sequence number added to transmitted data or MAC command frame, 00-ff.
Definition: lr-wpan-mac.h:824
void SetMlmeSyncLossIndicationCallback(MlmeSyncLossIndicationCallback c)
Set the callback for the loss of synchronization with a coordinator.
uint32_t m_ifs
The value of the necessary InterFrame Space after the transmission of a packet.
Definition: lr-wpan-mac.h:862
std::deque< TxQueueElement * > m_txQueue
The transmit queue used by the MAC.
Definition: lr-wpan-mac.h:1297
std::deque< IndTxQueueElement * > m_indTxQueue
The indirect transmit queue used by the MAC pending messages.
Definition: lr-wpan-mac.h:1301
void ChangeMacState(LrWpanMacState newState)
Change the current MAC state to the given new state.
void(* SentTracedCallback)(Ptr< const Packet > packet, uint8_t retries, uint8_t backoffs)
TracedCallback signature for sent packets.
Definition: lr-wpan-mac.h:964
void PlmeGetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttributeIdentifier id, LrWpanPhyPibAttributes *attribute)
IEEE 802.15.4-2006 section 6.2.2.6 PLME-GET.confirm Get attributes per definition from Table 23 in se...
uint8_t m_macBeaconOrder
Used by a PAN coordinator or coordinator.
Definition: lr-wpan-mac.h:768
TracedCallback< Time > m_macIfsEndTrace
The trace source is fired at the end of any Interframe Space (IFS).
Definition: lr-wpan-mac.h:1103
TracedValue< SuperframeStatus > m_outSuperframeStatus
The current period of the outgoing superframe.
Definition: lr-wpan-mac.h:1274
GtsFields GetGtsFields(void)
Constructs the Guaranteed Time Slots (GTS) Fields from local information.
Definition: lr-wpan-mac.cc:945
void PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttributeIdentifier id)
IEEE 802.15.4-2006 section 6.2.2.10 PLME-SET.confirm Set attributes per definition from Table 23 in s...
static const uint32_t aBaseSuperframeDuration
Length of a superframe in symbols.
Definition: lr-wpan-mac.h:479
EventId m_ackWaitTimeout
Scheduler event for the ACK timeout of the currently transmitted data packet.
Definition: lr-wpan-mac.h:1315
bool m_macPromiscuousMode
Indicates if MAC sublayer is in receive all mode.
Definition: lr-wpan-mac.h:813
uint8_t m_fnlCapSlot
Indication of the Slot where the CAP portion of the OUTGOING Superframe ends.
Definition: lr-wpan-mac.h:790
uint32_t m_macSIFSPeriod
The minimum time forming a Short InterFrame Spacing (SIFS) period.
Definition: lr-wpan-mac.h:850
void IfsWaitTimeout(Time ifsTime)
After a successful transmission of a frame (beacon, data) or an ack frame reception,...
bool PrepareRetransmission(void)
Check for remaining retransmissions for the packet currently being sent.
static const uint32_t aMaxLostBeacons
The number of consecutive lost beacons that will cause the MAC sublayer of a receiving device to decl...
Definition: lr-wpan-mac.h:486
uint32_t m_beaconInterval
Indication of the Interval used by the coordinator to transmit beacon frames expressed in symbols.
Definition: lr-wpan-mac.h:871
TracedValue< LrWpanMacState > m_lrWpanMacState
The current state of the MAC layer.
Definition: lr-wpan-mac.h:1266
TracedCallback< Ptr< const Packet > > m_macTxEnqueueTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
Definition: lr-wpan-mac.h:1121
EventId m_capEvent
Scheduler event for the end of the outgoing superframe CAP.
Definition: lr-wpan-mac.h:1331
Mac64Address GetExtendedAddress(void) const
Get the extended address of this MAC.
Definition: lr-wpan-mac.cc:287
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets are being sent down to L1.
Definition: lr-wpan-mac.h:1134
uint16_t m_macPanId
16 bits id of PAN on which this device is operating.
Definition: lr-wpan-mac.h:819
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but dropped before being forwa...
Definition: lr-wpan-mac.h:1173
bool m_macAutoRequest
Indication of whether a device automatically sends data request command if its address is listed in t...
Definition: lr-wpan-mac.h:858
uint8_t m_incomingSuperframeOrder
Used by all devices that have a parent.
Definition: lr-wpan-mac.h:803
TracedCallback< Ptr< const Packet >, uint8_t, uint8_t > m_sentPktTrace
The trace source fired when packets are considered as successfully sent or the transmission has been ...
Definition: lr-wpan-mac.h:1114
TracedCallback< Ptr< const Packet > > m_macTxDequeueTrace
The trace source fired when packets are dequeued from the L3/l2 transmission queue.
Definition: lr-wpan-mac.h:1128
void PdDataConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.1.2 Confirm the end of transmission of an MPDU to MAC.
uint8_t m_numLostBeacons
The number of consecutive loss beacons in a beacon tracking operation.
Definition: lr-wpan-mac.h:898
Ptr< Packet > m_txPkt
The packet which is currently being sent by the MAC layer.
Definition: lr-wpan-mac.h:1282
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p)
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
Definition: lr-wpan-mac.cc:293
void SetPhy(Ptr< LrWpanPhy > phy)
Set the underlying PHY for the MAC.
Definition: lr-wpan-mac.cc:971
LrWpanAssociationStatus GetAssociationStatus(void) const
Get the current association status.
void AwaitBeacon(void)
Called after the end of an INCOMING superframe to start the moment a device waits for a new incoming ...
Definition: lr-wpan-mac.cc:854
Mac64Address m_selfExt
The extended address used by this MAC.
Definition: lr-wpan-mac.h:1293
EventId m_incCapEvent
Scheduler event for the end of the incoming superframe CAP.
Definition: lr-wpan-mac.h:1339
McpsDataIndicationCallback m_mcpsDataIndicationCallback
This callback is used to notify incoming packets to the upper layers.
Definition: lr-wpan-mac.h:1256
bool m_beaconTrackingOn
Indication of whether the current device is tracking incoming beacons.
Definition: lr-wpan-mac.h:894
uint32_t m_superframeDuration
Indication of the superframe duration in symbols.
Definition: lr-wpan-mac.h:876
Mac16Address m_macCoordShortAddress
The short address of the coordinator through which the device is associated.
Definition: lr-wpan-mac.h:750
void AckWaitTimeout(void)
Handle an ACK timeout with a packet retransmission, if there are retransmission left,...
Ptr< LrWpanPhy > m_phy
The PHY associated with this MAC.
Definition: lr-wpan-mac.h:1225
uint64_t m_macSyncSymbolOffset
Symbol boundary is same as m_macBeaconTxTime.
Definition: lr-wpan-mac.h:761
static const uint32_t aMaxSIFSFrameSize
The maximum size of an MPDU, in octets, that can be followed by a Short InterFrame Spacing (SIFS) per...
Definition: lr-wpan-mac.h:492
LrWpanMac(void)
Default constructor.
Definition: lr-wpan-mac.cc:152
bool isTxAckReq(void)
Check if the packet to transmit requires acknowledgment.
static const uint32_t aNumSuperframeSlots
Number of a superframe slots per superframe.
Definition: lr-wpan-mac.h:473
uint64_t GetTxPacketSymbols(void)
Obtain the number of symbols in the packet which is currently being sent by the MAC layer.
void StartCAP(SuperframeType superframeType)
Called to begin the Contention Access Period (CAP) in a beacon-enabled mode.
Definition: lr-wpan-mac.cc:724
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: lr-wpan-mac.h:1157
void MlmePollRequest(MlmePollRequestParams params)
IEEE 802.15.4-2011, section 6.2.14.2 MLME-POLL.request Prompts the device to request data from the co...
Definition: lr-wpan-mac.cc:652
EventId m_ifsEvent
Scheduler event for Interframe spacing wait time.
Definition: lr-wpan-mac.h:1323
EventId m_beaconEvent
Scheduler event for generation of one beacon.
Definition: lr-wpan-mac.h:1327
uint32_t m_incomingSuperframeDuration
Indication of the superframe duration in symbols (e.g.
Definition: lr-wpan-mac.h:886
void SetShortAddress(Mac16Address address)
Set the short address of this MAC.
Definition: lr-wpan-mac.cc:265
void SetMacMaxFrameRetries(uint8_t retries)
Set the macMaxFrameRetries attribute value.
uint8_t m_retransmission
The number of already used retransmission for the currently transmitted packet.
Definition: lr-wpan-mac.h:1306
PendingAddrFields GetPendingAddrFields(void)
Constructs Pending Address Fields from the local information, the Pending Address Fields are part of ...
Definition: lr-wpan-mac.cc:955
bool isCoordDest(void)
Check if the packet destination is its coordinator.
EventId m_incCfpEvent
Scheduler event for the end of the incoming superframe CFP.
Definition: lr-wpan-mac.h:1343
void SendAck(uint8_t seqno)
Send an acknowledgment packet for the given sequence number.
uint8_t m_incomingFnlCapSlot
Indication of the Slot where the CAP portion of the INCOMING Superframe ends.
Definition: lr-wpan-mac.h:807
TracedValue< SuperframeStatus > m_incSuperframeStatus
The current period of the incoming superframe.
Definition: lr-wpan-mac.h:1270
void SetAssociatedCoor(Mac16Address mac)
Check if the packet destination is its coordinator.
This class can contain 16 bit addresses.
Definition: mac16-address.h:42
an EUI-64 address
Definition: mac64-address.h:44
A base class which provides memory management and object aggregation.
Definition: object.h:88
Represent the Pending Address Specification field.
Represent the Superframe Specification information field.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Callback< void, McpsDataConfirmParams > McpsDataConfirmCallback
This callback is called after a McpsDataRequest has been called from the higher layer.
Definition: lr-wpan-mac.h:396
LrWpanMlmePollConfirmStatus
Table 39 of IEEE 802.15.4-2011.
Definition: lr-wpan-mac.h:219
LrWpanMacState
MAC states.
Definition: lr-wpan-mac.h:70
Callback< void, McpsDataIndicationParams, Ptr< Packet > > McpsDataIndicationCallback
This callback is called after a Mcps has successfully received a frame and wants to deliver it to the...
Definition: lr-wpan-mac.h:406
Callback< void, MlmeStartConfirmParams > MlmeStartConfirmCallback
This callback is called after a MlmeStartRequest has been called from the higher layer.
Definition: lr-wpan-mac.h:414
LrWpanMcpsDataConfirmStatus
Table 42 of 802.15.4-2006.
Definition: lr-wpan-mac.h:165
SuperframeStatus
Superframe status.
Definition: lr-wpan-mac.h:89
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Definition: lr-wpan-phy.h:106
LrWpanTxOption
Tx options.
Definition: lr-wpan-mac.h:57
LrWpanAssociationStatus
table 83 of 802.15.4
Definition: lr-wpan-mac.h:151
Callback< void, MlmePollConfirmParams > MlmePollConfirmCallback
This callback is called after a Mlme-Poll.Request has been called from the higher layer.
Definition: lr-wpan-mac.h:442
LrWpanMlmeStartConfirmStatus
Table 35 of IEEE 802.15.4-2011.
Definition: lr-wpan-mac.h:186
LrWpanAddressMode
table 80 of 802.15.4
Definition: lr-wpan-mac.h:138
SuperframeType
Superframe type.
Definition: lr-wpan-mac.h:102
Callback< void, MlmeBeaconNotifyIndicationParams, Ptr< Packet > > MlmeBeaconNotifyIndicationCallback
This callback is called after a Mlme has successfully received a beacon frame and wants to deliver it...
Definition: lr-wpan-mac.h:424
Callback< void, MlmeSyncLossIndicationParams > MlmeSyncLossIndicationCallback
This callback is called to indicate the loss of synchronization with a coordinator.
Definition: lr-wpan-mac.h:434
LrWpanPibAttributeIdentifier
IEEE802.15.4-2006 PHY PIB Attribute Identifiers Table 23 in section 6.4.2.
Definition: lr-wpan-phy.h:141
LrWpanSyncLossReason
Table 37 of IEEE 802.15.4-2011.
Definition: lr-wpan-mac.h:205
@ MLMEPOLL_UNSUPPORTED_SECURITY
Definition: lr-wpan-mac.h:227
@ MLMEPOLL_SUCCESS
Definition: lr-wpan-mac.h:220
@ MLMEPOLL_NO_DATA
Definition: lr-wpan-mac.h:223
@ MLMEPOLL_FRAME_TOO_LONG
Definition: lr-wpan-mac.h:225
@ MLMEPOLL_COUNTER_ERROR
Definition: lr-wpan-mac.h:224
@ MLMEPOLL_INVALID_PARAMETER
Definition: lr-wpan-mac.h:228
@ MLMEPOLL_NO_ACK
Definition: lr-wpan-mac.h:222
@ MLMEPOLL_CHANNEL_ACCESS_FAILURE
Definition: lr-wpan-mac.h:221
@ MLMEPOLL_UNAVAILABLE_KEY
Definition: lr-wpan-mac.h:226
@ CHANNEL_ACCESS_FAILURE
CHANNEL_ACCESS_FAILURE.
Definition: lr-wpan-mac.h:75
@ MAC_IDLE
MAC_IDLE.
Definition: lr-wpan-mac.h:71
@ MAC_CSMA_DEFERRED
MAC_CSMA_DEFERRED.
Definition: lr-wpan-mac.h:80
@ MAC_CSMA
MAC_CSMA.
Definition: lr-wpan-mac.h:72
@ CHANNEL_IDLE
CHANNEL_IDLE.
Definition: lr-wpan-mac.h:76
@ MAC_GTS
MAC_GTS.
Definition: lr-wpan-mac.h:78
@ SET_PHY_TX_ON
SET_PHY_TX_ON.
Definition: lr-wpan-mac.h:77
@ MAC_INACTIVE
MAC_INACTIVE.
Definition: lr-wpan-mac.h:79
@ MAC_SENDING
MAC_SENDING.
Definition: lr-wpan-mac.h:73
@ MAC_ACK_PENDING
MAC_ACK_PENDING.
Definition: lr-wpan-mac.h:74
@ IEEE_802_15_4_TRANSACTION_OVERFLOW
Definition: lr-wpan-mac.h:167
@ IEEE_802_15_4_INVALID_GTS
Definition: lr-wpan-mac.h:171
@ IEEE_802_15_4_UNSUPPORTED_SECURITY
Definition: lr-wpan-mac.h:176
@ IEEE_802_15_4_NO_ACK
Definition: lr-wpan-mac.h:172
@ IEEE_802_15_4_CHANNEL_ACCESS_FAILURE
Definition: lr-wpan-mac.h:169
@ IEEE_802_15_4_INVALID_ADDRESS
Definition: lr-wpan-mac.h:170
@ IEEE_802_15_4_INVALID_PARAMETER
Definition: lr-wpan-mac.h:177
@ IEEE_802_15_4_COUNTER_ERROR
Definition: lr-wpan-mac.h:173
@ IEEE_802_15_4_SUCCESS
Definition: lr-wpan-mac.h:166
@ IEEE_802_15_4_FRAME_TOO_LONG
Definition: lr-wpan-mac.h:174
@ IEEE_802_15_4_TRANSACTION_EXPIRED
Definition: lr-wpan-mac.h:168
@ IEEE_802_15_4_UNAVAILABLE_KEY
Definition: lr-wpan-mac.h:175
@ CFP
Contention Free Period.
Definition: lr-wpan-mac.h:92
@ INACTIVE
Inactive Period or unslotted CSMA-CA.
Definition: lr-wpan-mac.h:93
@ CAP
Contention Access Period.
Definition: lr-wpan-mac.h:91
@ BEACON
The Beacon transmission or reception Period.
Definition: lr-wpan-mac.h:90
@ TX_OPTION_ACK
TX_OPTION_ACK.
Definition: lr-wpan-mac.h:59
@ TX_OPTION_INDIRECT
TX_OPTION_INDIRECT.
Definition: lr-wpan-mac.h:61
@ TX_OPTION_NONE
TX_OPTION_NONE.
Definition: lr-wpan-mac.h:58
@ TX_OPTION_GTS
TX_OPTION_GTS.
Definition: lr-wpan-mac.h:60
@ ASSOCIATED
Definition: lr-wpan-mac.h:152
@ PAN_ACCESS_DENIED
Definition: lr-wpan-mac.h:154
@ ASSOCIATED_WITHOUT_ADDRESS
Definition: lr-wpan-mac.h:155
@ PAN_AT_CAPACITY
Definition: lr-wpan-mac.h:153
@ DISASSOCIATED
Definition: lr-wpan-mac.h:156
@ MLMESTART_UNSUPPORTED_SECURITY
Definition: lr-wpan-mac.h:195
@ MLMESTART_SUPERFRAME_OVERLAP
Definition: lr-wpan-mac.h:189
@ MLMESTART_INVALID_PARAMETER
Definition: lr-wpan-mac.h:191
@ MLMESTART_TRACKING_OFF
Definition: lr-wpan-mac.h:190
@ MLMESTART_CHANNEL_ACCESS_FAILURE
Definition: lr-wpan-mac.h:196
@ MLMESTART_FRAME_TOO_LONG
Definition: lr-wpan-mac.h:193
@ MLMESTART_UNAVAILABLE_KEY
Definition: lr-wpan-mac.h:194
@ MLMESTART_SUCCESS
Definition: lr-wpan-mac.h:187
@ MLMESTART_COUNTER_ERROR
Definition: lr-wpan-mac.h:192
@ MLMESTART_NO_SHORT_ADDRESS
Definition: lr-wpan-mac.h:188
@ SHORT_ADDR
Definition: lr-wpan-mac.h:141
@ NO_PANID_ADDR
Definition: lr-wpan-mac.h:139
@ EXT_ADDR
Definition: lr-wpan-mac.h:142
@ ADDR_MODE_RESERVED
Definition: lr-wpan-mac.h:140
@ INCOMING
Incoming Superframe.
Definition: lr-wpan-mac.h:104
@ OUTGOING
Outgoing Superframe.
Definition: lr-wpan-mac.h:103
@ MLMESYNCLOSS_SUPERFRAME_OVERLAP
Definition: lr-wpan-mac.h:209
@ MLMESYNCLOSS_PAN_ID_CONFLICT
Definition: lr-wpan-mac.h:206
@ MLMESYNCLOSS_REALIGMENT
Definition: lr-wpan-mac.h:207
@ MLMESYNCLOSS_BEACON_LOST
Definition: lr-wpan-mac.h:208
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mac
Definition: third.py:99
phy
Definition: third.py:93
Helper structure for managing indirect transmission queue elements.
Definition: lr-wpan-mac.h:996
Time expireTime
The expiration time of the packet in the indirect transmission queue.
Definition: lr-wpan-mac.h:999
uint8_t txQMsduHandle
MSDU Handle.
Definition: lr-wpan-mac.h:997
Ptr< Packet > txQPkt
Queued packet.
Definition: lr-wpan-mac.h:998
Helper structure for managing transmission queue elements.
Definition: lr-wpan-mac.h:987
Ptr< Packet > txQPkt
Queued packet.
Definition: lr-wpan-mac.h:989
uint8_t txQMsduHandle
MSDU Handle.
Definition: lr-wpan-mac.h:988
IEEE802.15.4-2006 PHY PIB Attributes Table 23 in section 6.4.2.
Definition: lr-wpan-phy.h:158
MCPS-DATA.confirm params.
Definition: lr-wpan-mac.h:261
LrWpanMcpsDataConfirmStatus m_status
The status of the last MSDU transmission.
Definition: lr-wpan-mac.h:263
uint8_t m_msduHandle
MSDU handle.
Definition: lr-wpan-mac.h:262
MCPS-DATA.indication params.
Definition: lr-wpan-mac.h:271
Mac16Address m_dstAddr
Destination address.
Definition: lr-wpan-mac.h:278
uint8_t m_dstAddrMode
Destination address mode.
Definition: lr-wpan-mac.h:276
uint16_t m_dstPanId
Destination PAN identifier.
Definition: lr-wpan-mac.h:277
uint8_t m_dsn
The DSN of the received data frame.
Definition: lr-wpan-mac.h:281
uint8_t m_mpduLinkQuality
LQI value measured during reception of the MPDU.
Definition: lr-wpan-mac.h:280
uint16_t m_srcPanId
Source PAN identifier.
Definition: lr-wpan-mac.h:273
Mac64Address m_dstExtAddr
Destination extended address.
Definition: lr-wpan-mac.h:279
uint8_t m_srcAddrMode
Source address mode.
Definition: lr-wpan-mac.h:272
Mac64Address m_srcExtAddr
Source extended address.
Definition: lr-wpan-mac.h:275
Mac16Address m_srcAddr
Source address.
Definition: lr-wpan-mac.h:274
MCPS-DATA.request params.
Definition: lr-wpan-mac.h:237
LrWpanAddressMode m_srcAddrMode
Source address mode.
Definition: lr-wpan-mac.h:246
Mac64Address m_dstExtAddr
Destination extended address.
Definition: lr-wpan-mac.h:250
LrWpanAddressMode m_dstAddrMode
Destination address mode.
Definition: lr-wpan-mac.h:247
uint16_t m_dstPanId
Destination PAN identifier.
Definition: lr-wpan-mac.h:248
Mac16Address m_dstAddr
Destination address.
Definition: lr-wpan-mac.h:249
uint8_t m_msduHandle
MSDU handle.
Definition: lr-wpan-mac.h:251
uint8_t m_txOptions
Tx Options (bitfield)
Definition: lr-wpan-mac.h:252
MLME-BEACON-NOTIFY.indication params.
Definition: lr-wpan-mac.h:360
uint8_t m_bsn
The beacon sequence number.
Definition: lr-wpan-mac.h:361
MLME-START.confirm params.
Definition: lr-wpan-mac.h:386
LrWpanMlmePollConfirmStatus m_status
The confirmation status resulting from a MLME-poll.request.
Definition: lr-wpan-mac.h:387
MLME-POLL.request params.
Definition: lr-wpan-mac.h:331
Mac16Address m_coorShortAddr
Coordintator short address.
Definition: lr-wpan-mac.h:340
uint16_t m_coorPanId
The PAN id of the coordinator to which the poll is intended.
Definition: lr-wpan-mac.h:339
Mac64Address m_coorExtAddr
Coordinator extended address.
Definition: lr-wpan-mac.h:341
LrWpanAddressMode m_coorAddrMode
The addressing mode of the coordinator to which the pool is intended.
Definition: lr-wpan-mac.h:338
MLME-START.confirm params.
Definition: lr-wpan-mac.h:351
LrWpanMlmeStartConfirmStatus m_status
The status of a MLME-start.request.
Definition: lr-wpan-mac.h:352
MLME-START.request params.
Definition: lr-wpan-mac.h:289
uint32_t m_logChPage
Logical channel page on which to start using the new superframe configuration.
Definition: lr-wpan-mac.h:303
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
Definition: lr-wpan-mac.h:302
bool m_panCoor
On true this device will become coordinator.
Definition: lr-wpan-mac.h:307
bool m_coorRealgn
True if a realignment request command is to be transmitted prior changing the superframe.
Definition: lr-wpan-mac.h:309
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
Definition: lr-wpan-mac.h:305
uint32_t m_startTime
Time at which to begin transmitting beacons (Used by Coordinator not PAN Coordinators).
Definition: lr-wpan-mac.h:304
uint16_t m_PanId
Pan Identifier used by the device.
Definition: lr-wpan-mac.h:301
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
Definition: lr-wpan-mac.h:306
bool m_battLifeExt
Flag indicating whether or not the Battery life extension (BLE) features are used.
Definition: lr-wpan-mac.h:308
MLME-SYNC-LOSS.indication params.
Definition: lr-wpan-mac.h:375
uint16_t m_panId
The PAN identifier with which the device lost synchronization or to which it was realigned.
Definition: lr-wpan-mac.h:377
uint8_t m_logCh
The channel number on which the device lost synchronization or to which it was realigned.
Definition: lr-wpan-mac.h:378
LrWpanSyncLossReason m_lossReason
The reason for the lost of synchronization.
Definition: lr-wpan-mac.h:376
MLME-SYNC.request params.
Definition: lr-wpan-mac.h:317
bool m_trackBcn
True if the mlme sync with the next beacon and attempts to track future beacons.
Definition: lr-wpan-mac.h:323
uint8_t m_logCh
The channel number on which to attempt coordinator synchronization.
Definition: lr-wpan-mac.h:322