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,
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 {
144 
150 typedef enum
151 {
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 */
MlmeSyncLossIndicationCallback m_mlmeSyncLossIndicationCallback
This callback is used to indicate the loss of synchronization with a coordinator. ...
Definition: lr-wpan-mac.h:1239
TracedValue< LrWpanMacState > m_lrWpanMacState
The current state of the MAC layer.
Definition: lr-wpan-mac.h:1266
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
uint16_t m_dstPanId
Destination PAN identifier.
Definition: lr-wpan-mac.h:248
TX_OPTION_INDIRECT.
Definition: lr-wpan-mac.h:61
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void CheckQueue(void)
Check the transmission queue.
Definition: lr-wpan-mac.cc:898
LrWpanSyncLossReason m_lossReason
The reason for the lost of synchronization.
Definition: lr-wpan-mac.h:376
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
bool m_beaconTrackingOn
Indication of whether the current device is tracking incoming beacons.
Definition: lr-wpan-mac.h:894
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
bool m_trackBcn
True if the mlme sync with the next beacon and attempts to track future beacons.
Definition: lr-wpan-mac.h:323
Class that implements the LR-WPAN MAC state machine.
Definition: lr-wpan-mac.h:448
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...
Mac16Address m_dstAddr
Destination address.
Definition: lr-wpan-mac.h:249
void RemoveFirstTxQElement()
Remove the tip of the transmission queue, including clean up related to the last packet transmission...
Mac64Address m_srcExtAddr
Source extended address.
Definition: lr-wpan-mac.h:275
virtual ~LrWpanMac(void)
Definition: lr-wpan-mac.cc:197
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
LrWpanPibAttributeIdentifier
IEEE802.15.4-2006 PHY PIB Attribute Identifiers Table 23 in section 6.4.2.
Definition: lr-wpan-phy.h:140
CHANNEL_IDLE.
Definition: lr-wpan-mac.h:76
MAC_GTS.
Definition: lr-wpan-mac.h:78
Forward calls to a chain of Callback.
bool isCoordDest(void)
Check if the packet destination is its coordinator.
McpsDataConfirmCallback m_mcpsDataConfirmCallback
This callback is used to report data transmission request status to the upper layers.
Definition: lr-wpan-mac.h:1262
std::deque< TxQueueElement * > m_txQueue
The transmit queue used by the MAC.
Definition: lr-wpan-mac.h:1297
MAC_CSMA_DEFERRED.
Definition: lr-wpan-mac.h:80
Mac64Address GetExtendedAddress(void) const
Get the extended address of this MAC.
Definition: lr-wpan-mac.cc:287
Mac16Address m_dstAddr
Destination address.
Definition: lr-wpan-mac.h:278
uint8_t m_dstAddrMode
Destination address mode.
Definition: lr-wpan-mac.h:276
Mac64Address m_dstExtAddr
Destination extended address.
Definition: lr-wpan-mac.h:279
LrWpanMlmePollConfirmStatus
Table 39 of IEEE 802.15.4-2011.
Definition: lr-wpan-mac.h:218
uint8_t m_logCh
The channel number on which to attempt coordinator synchronization.
Definition: lr-wpan-mac.h:322
void SetMlmeBeaconNotifyIndicationCallback(MlmeBeaconNotifyIndicationCallback c)
Set the callback for the indication of an incoming beacon packet.
static const uint32_t aNumSuperframeSlots
Number of a superframe slots per superframe.
Definition: lr-wpan-mac.h:473
void SetMlmeStartConfirmCallback(MlmeStartConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
Definition: lr-wpan-mac.cc:995
LrWpanAssociationStatus m_associationStatus
The current association status of the MAC layer.
Definition: lr-wpan-mac.h:1278
bool m_battLifeExt
Flag indicating whether or not the Battery life extension (BLE) features are used.
Definition: lr-wpan-mac.h:308
uint8_t m_incomingFnlCapSlot
Indication of the Slot where the CAP portion of the INCOMING Superframe ends.
Definition: lr-wpan-mac.h:807
Mac64Address m_dstExtAddr
Destination extended address.
Definition: lr-wpan-mac.h:250
Mac64Address m_macCoordExtendedAddress
The extended address of the coordinator through which the device is associated.
Definition: lr-wpan-mac.h:756
virtual void DoDispose(void)
Destructor implementation.
Definition: lr-wpan-mac.cc:216
TracedCallback< LrWpanMacState, LrWpanMacState > m_macStateLogger
A trace source that fires when the LrWpanMac changes states.
Definition: lr-wpan-mac.h:1221
void SetShortAddress(Mac16Address address)
Set the short address of this MAC.
Definition: lr-wpan-mac.cc:265
uint8_t m_incomingBeaconOrder
The beaconOrder value of the INCOMING frame.
Definition: lr-wpan-mac.h:796
uint8_t m_incomingSuperframeOrder
Used by all devices that have a parent.
Definition: lr-wpan-mac.h:803
uint32_t m_superframeDuration
Indication of the superframe duration in symbols.
Definition: lr-wpan-mac.h:876
SuperframeStatus
Superframe status.
Definition: lr-wpan-mac.h:88
IEEE802.15.4-2006 PHY PIB Attributes Table 23 in section 6.4.2.
Definition: lr-wpan-phy.h:157
McpsDataIndicationCallback m_mcpsDataIndicationCallback
This callback is used to notify incoming packets to the upper layers.
Definition: lr-wpan-mac.h:1256
void SetMcpsDataConfirmCallback(McpsDataConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
Definition: lr-wpan-mac.cc:989
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
Incoming Superframe.
Definition: lr-wpan-mac.h:104
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
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
uint8_t m_numCsmacaRetry
The number of CSMA/CA retries used for sending the current packet.
Definition: lr-wpan-mac.h:1310
MLME-START.request params.
Definition: lr-wpan-mac.h:288
void IfsWaitTimeout(Time ifsTime)
After a successful transmission of a frame (beacon, data) or an ack frame reception, the mac layer wait an Interframe Space (IFS) time and triggers this function to continue with the MAC flow.
Mac16Address m_coorShortAddr
Coordintator short address.
Definition: lr-wpan-mac.h:340
uint8_t m_msduHandle
MSDU handle.
Definition: lr-wpan-mac.h:251
uint32_t m_incomingBeaconInterval
Indication of the interval a node should receive a superframe expressed in symbols.
Definition: lr-wpan-mac.h:881
uint8_t m_msduHandle
MSDU handle.
Definition: lr-wpan-mac.h:262
EventId m_incCapEvent
Scheduler event for the end of the incoming superframe CAP.
Definition: lr-wpan-mac.h:1339
uint16_t m_dstPanId
Destination PAN identifier.
Definition: lr-wpan-mac.h:277
Contention Free Period.
Definition: lr-wpan-mac.h:92
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets are being sent down to L1.
Definition: lr-wpan-mac.h:1134
an EUI-64 address
Definition: mac64-address.h:43
phy
Definition: third.py:93
Ptr< Packet > m_txPkt
The packet which is currently being sent by the MAC layer.
Definition: lr-wpan-mac.h:1282
bool GetRxOnWhenIdle(void)
Check if the receiver will be enabled when the MAC is idle.
Definition: lr-wpan-mac.cc:240
The Beacon transmission or reception Period.
Definition: lr-wpan-mac.h:90
MLME-BEACON-NOTIFY.indication params.
Definition: lr-wpan-mac.h:359
LrWpanAssociationStatus GetAssociationStatus(void) const
Get the current association status.
void SetLrWpanMacState(LrWpanMacState macState)
CSMA-CA algorithm calls back the MAC after executing channel assessment.
void SetMacMaxFrameRetries(uint8_t retries)
Set the macMaxFrameRetries attribute value.
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t energyLevel)
IEEE 802.15.4-2006 section 6.2.2.4 PLME-ED.confirm status and energy level.
uint16_t m_coorPanId
The PAN id of the coordinator to which the poll is intended.
Definition: lr-wpan-mac.h:339
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
uint8_t m_macBeaconOrder
Used by a PAN coordinator or coordinator.
Definition: lr-wpan-mac.h:768
TX_OPTION_ACK.
Definition: lr-wpan-mac.h:59
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
uint8_t m_fnlCapSlot
Indication of the Slot where the CAP portion of the OUTGOING Superframe ends.
Definition: lr-wpan-mac.h:790
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
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
bool m_panCoor
Indication of whether the current device is the PAN coordinator.
Definition: lr-wpan-mac.h:866
LrWpanAddressMode m_coorAddrMode
The addressing mode of the coordinator to which the pool is intended.
Definition: lr-wpan-mac.h:338
uint64_t GetTxPacketSymbols(void)
Obtain the number of symbols in the packet which is currently being sent by the MAC layer...
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
Definition: lr-wpan-mac.h:306
bool isTxAckReq(void)
Check if the packet to transmit requires acknowledgment.
MlmeBeaconNotifyIndicationCallback m_mlmeBeaconNotifyIndicationCallback
This callback is used to notify incoming beacon packets to the upper layers.
Definition: lr-wpan-mac.h:1234
SuperframeType
Superframe type.
Definition: lr-wpan-mac.h:101
uint64_t m_macSyncSymbolOffset
Symbol boundary is same as m_macBeaconTxTime.
Definition: lr-wpan-mac.h:761
LrWpanMlmeStartConfirmStatus
Table 35 of IEEE 802.15.4-2011.
Definition: lr-wpan-mac.h:185
Ptr< Packet > txQPkt
Queued packet.
Definition: lr-wpan-mac.h:989
LrWpanSyncLossReason
Table 37 of IEEE 802.15.4-2011.
Definition: lr-wpan-mac.h:204
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
Definition: lr-wpan-mac.h:302
bool PrepareRetransmission(void)
Check for remaining retransmissions for the packet currently being sent.
void PlmeCcaConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.
EventId m_ackWaitTimeout
Scheduler event for the ACK timeout of the currently transmitted data packet.
Definition: lr-wpan-mac.h:1315
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
EventId m_ifsEvent
Scheduler event for Interframe spacing wait time.
Definition: lr-wpan-mac.h:1323
uint16_t GetPanId(void) const
Get the PAN id used by this MAC.
void SetMlmeSyncLossIndicationCallback(MlmeSyncLossIndicationCallback c)
Set the callback for the loss of synchronization with a coordinator.
uint32_t m_startTime
Time at which to begin transmitting beacons (Used by Coordinator not PAN Coordinators).
Definition: lr-wpan-mac.h:304
mac
Definition: third.py:99
EventId m_setMacState
Scheduler event for a deferred MAC state change.
Definition: lr-wpan-mac.h:1319
LrWpanMcpsDataConfirmStatus
Table 42 of 802.15.4-2006.
Definition: lr-wpan-mac.h:164
SuperframeField GetSuperframeField(void)
Constructs a Superframe specification field from the local information, the superframe Specification ...
Definition: lr-wpan-mac.cc:920
PendingAddrFields GetPendingAddrFields(void)
Constructs Pending Address Fields from the local information, the Pending Address Fields are part of ...
Definition: lr-wpan-mac.cc:955
Helper structure for managing transmission queue elements.
Definition: lr-wpan-mac.h:986
bool m_macRxOnWhenIdle
Indication of whether the MAC sublayer is to enable its receiver during idle periods.
Definition: lr-wpan-mac.h:840
Callback< void, MlmeSyncLossIndicationParams > MlmeSyncLossIndicationCallback
This callback is called to indicate the loss of synchronization with a coordinator.
Definition: lr-wpan-mac.h:434
Outgoing Superframe.
Definition: lr-wpan-mac.h:103
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
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
MCPS-DATA.confirm params.
Definition: lr-wpan-mac.h:260
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_txOptions
Tx Options (bitfield)
Definition: lr-wpan-mac.h:252
Ptr< Packet > txQPkt
Queued packet.
Definition: lr-wpan-mac.h:998
void StartInactivePeriod(SuperframeType superframeType)
Start the Inactive Period in a beacon-enabled mode.
Definition: lr-wpan-mac.cc:817
void PrintTransmitQueueSize(void)
Print the number of elements in the packet transmit queue.
SET_PHY_TX_ON.
Definition: lr-wpan-mac.h:77
uint32_t GetIfsSize()
Get the size of the Interframe Space according to MPDU size (m_txPkt).
void SendOneBeacon(void)
Called to send a single beacon frame.
Definition: lr-wpan-mac.cc:666
uint32_t m_macLIFSPeriod
The minimum time forming a Long InterFrame Spacing (LIFS) period.
Definition: lr-wpan-mac.h:845
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
uint8_t m_mpduLinkQuality
LQI value measured during reception of the MPDU.
Definition: lr-wpan-mac.h:280
void SetPhy(Ptr< LrWpanPhy > phy)
Set the underlying PHY for the MAC.
Definition: lr-wpan-mac.cc:971
GtsFields GetGtsFields(void)
Constructs the Guaranteed Time Slots (GTS) Fields from local information.
Definition: lr-wpan-mac.cc:945
Helper structure for managing indirect transmission queue elements.
Definition: lr-wpan-mac.h:995
MLME-START.confirm params.
Definition: lr-wpan-mac.h:385
void SetAssociatedCoor(Mac16Address mac)
Check if the packet destination is its coordinator.
MAC_INACTIVE.
Definition: lr-wpan-mac.h:79
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
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...
uint8_t m_srcAddrMode
Source address mode.
Definition: lr-wpan-mac.h:272
uint16_t m_PanId
Pan Identifier used by the device.
Definition: lr-wpan-mac.h:301
LrWpanMcpsDataConfirmStatus m_status
The status of the last MSDU transmission.
Definition: lr-wpan-mac.h:263
LrWpanAddressMode m_srcAddrMode
Source address mode.
Definition: lr-wpan-mac.h:246
uint8_t m_retransmission
The number of already used retransmission for the currently transmitted packet.
Definition: lr-wpan-mac.h:1306
EventId m_trackingEvent
Scheduler event to track the incoming beacons.
Definition: lr-wpan-mac.h:1347
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
static const uint32_t aBaseSlotDuration
Length of a superframe slot in symbols.
Definition: lr-wpan-mac.h:468
Mac64Address m_selfExt
The extended address used by this MAC.
Definition: lr-wpan-mac.h:1293
uint64_t GetMacAckWaitDuration(void) const
Get the macAckWaitDuration attribute value.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
EventId m_cfpEvent
Scheduler event for the end of the outgoing superframe CFP.
Definition: lr-wpan-mac.h:1335
address
Definition: first.py:44
LrWpanAddressMode m_dstAddrMode
Destination address mode.
Definition: lr-wpan-mac.h:247
LrWpanAddressMode
table 80 of 802.15.4
Definition: lr-wpan-mac.h:137
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
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
void StartCAP(SuperframeType superframeType)
Called to begin the Contention Access Period (CAP) in a beacon-enabled mode.
Definition: lr-wpan-mac.cc:724
TX_OPTION_GTS.
Definition: lr-wpan-mac.h:60
Callback< void, McpsDataConfirmParams > McpsDataConfirmCallback
This callback is called after a McpsDataRequest has been called from the higher layer.
Definition: lr-wpan-mac.h:396
void SetRxOnWhenIdle(bool rxOnWhenIdle)
Set if the receiver should be enabled when the MAC is idle.
Definition: lr-wpan-mac.cc:246
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
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
bool m_macPromiscuousMode
Indicates if MAC sublayer is in receive all mode.
Definition: lr-wpan-mac.h:813
Mac16Address m_srcAddr
Source address.
Definition: lr-wpan-mac.h:274
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
void(* SentTracedCallback)(Ptr< const Packet > packet, uint8_t retries, uint8_t backoffs)
TracedCallback signature for sent packets.
Definition: lr-wpan-mac.h:964
SequenceNumber8 m_macBsn
Sequence number added to transmitted beacon frame, 00-ff.
Definition: lr-wpan-mac.h:829
This class can contain 16 bit addresses.
Definition: mac16-address.h:41
Represent the Superframe Specification information field.
uint8_t m_macSuperframeOrder
Used by a PAN coordinator or coordinator.
Definition: lr-wpan-mac.h:775
EventId m_capEvent
Scheduler event for the end of the outgoing superframe CAP.
Definition: lr-wpan-mac.h:1331
uint8_t m_dsn
The DSN of the received data frame.
Definition: lr-wpan-mac.h:281
std::deque< IndTxQueueElement * > m_indTxQueue
The indirect transmit queue used by the MAC pending messages.
Definition: lr-wpan-mac.h:1301
Mac16Address m_macCoordShortAddress
The short address of the coordinator through which the device is associated.
Definition: lr-wpan-mac.h:750
LrWpanMac(void)
Default constructor.
Definition: lr-wpan-mac.cc:152
uint8_t m_bsn
The beacon sequence number.
Definition: lr-wpan-mac.h:361
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
void SetExtendedAddress(Mac64Address address)
Set the extended address of this MAC.
Definition: lr-wpan-mac.cc:272
uint8_t m_macMaxFrameRetries
The maximum number of retries allowed after a transmission failure.
Definition: lr-wpan-mac.h:834
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 txQMsduHandle
MSDU Handle.
Definition: lr-wpan-mac.h:988
Contention Access Period.
Definition: lr-wpan-mac.h:91
static TypeId GetTypeId(void)
Get the type ID.
Definition: lr-wpan-mac.cc:58
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
The channel number on which the device lost synchronization or to which it was realigned.
Definition: lr-wpan-mac.h:378
uint32_t m_incomingSuperframeDuration
Indication of the superframe duration in symbols (e.g.
Definition: lr-wpan-mac.h:886
Ptr< LrWpanPhy > m_phy
The PHY associated with this MAC.
Definition: lr-wpan-mac.h:1225
EventId m_beaconEvent
Scheduler event for generation of one beacon.
Definition: lr-wpan-mac.h:1327
MLME-POLL.request params.
Definition: lr-wpan-mac.h:330
CHANNEL_ACCESS_FAILURE.
Definition: lr-wpan-mac.h:75
uint32_t m_ifs
The value of the necessary InterFrame Space after the transmission of a packet.
Definition: lr-wpan-mac.h:862
MLME-SYNC.request params.
Definition: lr-wpan-mac.h:316
Time expireTime
The expiration time of the packet in the indirect transmission queue.
Definition: lr-wpan-mac.h:999
MAC_CSMA.
Definition: lr-wpan-mac.h:72
Time m_macBeaconRxTime
The time that the device received its last bit of the beacon frame.
Definition: lr-wpan-mac.h:742
void(* StateTracedCallback)(LrWpanMacState oldState, LrWpanMacState newState)
TracedCallback signature for LrWpanMacState change events.
Definition: lr-wpan-mac.h:975
Mac64Address m_coorExtAddr
Coordinator extended address.
Definition: lr-wpan-mac.h:341
SequenceNumber8 m_macDsn
Sequence number added to transmitted data or MAC command frame, 00-ff.
Definition: lr-wpan-mac.h:824
An identifier for simulation events.
Definition: event-id.h:53
MAC_ACK_PENDING.
Definition: lr-wpan-mac.h:74
uint64_t m_rxBeaconSymbols
The total size of the received beacon in symbols.
Definition: lr-wpan-mac.h:786
static const uint32_t aMinMPDUOverhead
The minimum number of octets added by the MAC sublayer to the PSDU.
Definition: lr-wpan-mac.h:462
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
uint32_t m_macSIFSPeriod
The minimum time forming a Short InterFrame Spacing (SIFS) period.
Definition: lr-wpan-mac.h:850
LrWpanTxOption
Tx options.
Definition: lr-wpan-mac.h:56
void ChangeMacState(LrWpanMacState newState)
Change the current MAC state to the given new state.
MLME-SYNC-LOSS.indication params.
Definition: lr-wpan-mac.h:374
Time m_macBeaconTxTime
The time that the device transmitted its last beacon frame.
Definition: lr-wpan-mac.h:735
uint8_t m_numLostBeacons
The number of consecutive loss beacons in a beacon tracking operation.
Definition: lr-wpan-mac.h:898
TracedCallback< Time > m_macIfsEndTrace
The trace source is fired at the end of any Interframe Space (IFS).
Definition: lr-wpan-mac.h:1103
Ptr< LrWpanCsmaCa > m_csmaCa
The CSMA/CA implementation used by this MAC.
Definition: lr-wpan-mac.h:1229
LrWpanMacState
MAC states.
Definition: lr-wpan-mac.h:69
LrWpanAssociationStatus
table 83 of 802.15.4
Definition: lr-wpan-mac.h:150
uint8_t GetMacMaxFrameRetries(void) const
Get the macMaxFrameRetries attribute value.
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
uint8_t m_deviceCapability
Indication of current device capability (FFD or RFD)
Definition: lr-wpan-mac.h:890
uint16_t m_macPanId
16 bits id of PAN on which this device is operating.
Definition: lr-wpan-mac.h:819
TracedValue< SuperframeStatus > m_incSuperframeStatus
The current period of the incoming superframe.
Definition: lr-wpan-mac.h:1270
void StartCFP(SuperframeType superframeType)
Called to begin the Contention Free Period (CFP) in a beacon-enabled mode.
Definition: lr-wpan-mac.cc:771
bool m_panCoor
On true this device will become coordinator.
Definition: lr-wpan-mac.h:307
void PlmeSetTRXStateConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Definition: lr-wpan-phy.h:105
void SendAck(uint8_t seqno)
Send an acknowledgment packet for the given sequence number.
MCPS-DATA.request params.
Definition: lr-wpan-mac.h:236
A base class which provides memory management and object aggregation.
Definition: object.h:87
LrWpanMlmeStartConfirmStatus m_status
The status of a MLME-start.request.
Definition: lr-wpan-mac.h:352
void AckWaitTimeout(void)
Handle an ACK timeout with a packet retransmission, if there are retransmission left, or a packet drop.
bool m_coorRealgn
True if a realignment request command is to be transmitted prior changing the superframe.
Definition: lr-wpan-mac.h:309
Represent the Pending Address Specification field.
Represent the GTS information fields.
Ptr< LrWpanPhy > GetPhy(void)
Get the underlying PHY of the MAC.
Definition: lr-wpan-mac.cc:977
Mac16Address m_shortAddress
The short address used by this MAC.
Definition: lr-wpan-mac.h:1288
TX_OPTION_NONE.
Definition: lr-wpan-mac.h:58
Mac16Address GetShortAddress(void) const
Get the short address of this MAC.
Definition: lr-wpan-mac.cc:280
a unique identifier for an interface.
Definition: type-id.h:58
Callback< void, MlmeStartConfirmParams > MlmeStartConfirmCallback
This callback is called after a MlmeStartRequest has been called from the higher layer.
Definition: lr-wpan-mac.h:414
LrWpanMlmePollConfirmStatus m_status
The confirmation status resulting from a MLME-poll.request.
Definition: lr-wpan-mac.h:387
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaCa)
Set the CSMA/CA implementation to be used by the MAC.
Definition: lr-wpan-mac.cc:965
void SetPanId(uint16_t panId)
Set the PAN id used by this MAC.
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...
Inactive Period or unslotted CSMA-CA.
Definition: lr-wpan-mac.h:93
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lr-wpan-mac.cc:201
uint8_t txQMsduHandle
MSDU Handle.
Definition: lr-wpan-mac.h:997
static const uint32_t aBaseSuperframeDuration
Length of a superframe in symbols.
Definition: lr-wpan-mac.h:479
TracedValue< SuperframeStatus > m_outSuperframeStatus
The current period of the outgoing superframe.
Definition: lr-wpan-mac.h:1274
MAC_SENDING.
Definition: lr-wpan-mac.h:73
MLME-START.confirm params.
Definition: lr-wpan-mac.h:350
uint16_t m_srcPanId
Source PAN identifier.
Definition: lr-wpan-mac.h:273
MAC_IDLE.
Definition: lr-wpan-mac.h:71
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 SetMlmePollConfirmCallback(MlmePollConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
void SetAssociationStatus(LrWpanAssociationStatus status)
Set the current association status.
MCPS-DATA.indication params.
Definition: lr-wpan-mac.h:270
EventId m_incCfpEvent
Scheduler event for the end of the incoming superframe CFP.
Definition: lr-wpan-mac.h:1343
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
void SetMcpsDataIndicationCallback(McpsDataIndicationCallback c)
Set the callback for the indication of an incoming data packet.
Definition: lr-wpan-mac.cc:983