27 #include <ns3/object.h>
28 #include <ns3/traced-callback.h>
29 #include <ns3/mac16-address.h>
30 #include <ns3/mac64-address.h>
31 #include <ns3/sequence-number.h>
32 #include <ns3/lr-wpan-phy.h>
33 #include <ns3/event-id.h>
uint64_t m_aBaseSuperframeDuration
Length of a superframe in symbols.
LrWpanAssociationStatus
table 83 of 802.15.4
void CheckQueue(void)
Check the transmission queue.
Class that implements the LR-WPAN Mac state machine.
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...
void RemoveFirstTxQElement()
Remove the tip of the transmission queue, including clean up related to the last packet transmission...
TracedCallback< Ptr< const Packet > > m_macTxOkTrace
The trace source fired when packets where successfully transmitted, that is an acknowledgment was rec...
LrWpanAssociationStatus GetAssociationStatus(void) const
Get the current association status.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
McpsDataConfirmCallback m_mcpsDataConfirmCallback
This callback is used to report data transmission request status to the upper layers.
std::deque< TxQueueElement * > m_txQueue
The transmit queue used by the MAC.
LrWpanMacState m_lrWpanMacState
The current state of the MAC layer.
LrWpanAssociationStatus m_associationStatus
The current association status of the MAC layer.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
TracedCallback< LrWpanMacState, LrWpanMacState > m_macStateLogger
void SetShortAddress(Mac16Address address)
Set the short address of this MAC.
IEEE802.15.4-2006 PHY PIB Attributes Table 23 in section 6.4.2.
McpsDataIndicationCallback m_mcpsDataIndicationCallback
This callback is used to notify incoming packets to the upper layers.
void SetMcpsDataConfirmCallback(McpsDataConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
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. ...
uint8_t m_numCsmacaRetry
The number of CSMA/CA retries used for sending the current packet.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets are being sent down to L1.
Ptr< Packet > m_txPkt
The packet which is currently being sent by the MAC layer.
Callback< void, McpsDataIndicationParams, Ptr< Packet > > McpsDataIndicationCallback
bool GetRxOnWhenIdle(void)
Check if the receiver will be enabled when the MAC is idle.
void SetLrWpanMacState(LrWpanMacState macState)
CSMA-CA algorithm calls back the MAC after executing channel assessment.
uint64_t m_macBeaconOrder
Specification of how often the coordinator transmits its beacon.
Mac64Address GetExtendedAddress(void) const
Get the extended address of this MAC.
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.
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device...
TracedCallback< Ptr< const Packet > > m_macTxEnqueueTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
uint64_t m_macSyncSymbolOffset
Symbol boundary is same as m_macBeaconTxTime.
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.
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets are dropped due to missing ACKs or because of transmission failur...
EventId m_setMacState
Scheduler event for a deferred MAC state change.
LrWpanAddressMode
table 80 of 802.15.4
Helper structure for managing transmission queue elements.
bool m_macRxOnWhenIdle
Indication of whether the MAC sublayer is to enable its receiver during idle periods.
uint64_t m_macBeaconTxTime
The time that the device transmitted its last beacon frame, in symbol periods.
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_mpduLinkQuality
void SetPhy(Ptr< LrWpanPhy > phy)
Set the underlying PHY for the MAC.
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 ...
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...
LrWpanMcpsDataConfirmStatus m_status
LrWpanAddressMode m_srcAddrMode
uint8_t m_retransmission
The number of already used retransmission for the currently transmitted packet.
Mac64Address m_selfExt
The extended address used by this MAC.
LrWpanAddressMode m_dstAddrMode
uint64_t m_macSuperframeOrder
The length of the active portion of the outgoing superframe, including the beacon frame...
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but dropped before being forwa...
void SetRxOnWhenIdle(bool rxOnWhenIdle)
Set if the receiver should be enabled when the MAC is idle.
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
bool m_macPromiscuousMode
Indicates if MAC sublayer is in receive all mode.
This class can contain 16 bit addresses.
LrWpanMac(void)
Default constructor.
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
void SetExtendedAddress(Mac64Address address)
Set the extended address of this MAC.
uint8_t m_macMaxFrameRetries
The maximum number of retries allowed after a transmission failure.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< LrWpanPhy > m_phy
The PHY associated with this MAC.
SequenceNumber8 m_macDsn
Sequence number added to transmitted data or MAC command frame, 00-ff.
an identifier for simulation events.
uint64_t m_aNumSuperframeSlots
Number of a superframe slots per superframe.
static const uint32_t aMinMPDUOverhead
The minimum number of octets added by the MAC sublayer to the PSDU.
void ChangeMacState(LrWpanMacState newState)
Change the current MAC state to the given new state.
uint8_t GetMacMaxFrameRetries(void) const
Get the macMaxFrameRetries attribute value.
Ptr< LrWpanCsmaCa > m_csmaCa
The CSMA/CA implementation used by this MAC.
Mac16Address GetShortAddress(void) const
Get the short address of this MAC.
Callback< void, McpsDataConfirmParams > McpsDataConfirmCallback
TracedCallback< Ptr< const Packet > > m_macTxDequeueTrace
The trace source fired when packets are dequeued from the L3/l2 transmission queue.
uint16_t m_macPanId
16 bits id of PAN on which this device is operating.
LrWpanMcpsDataConfirmStatus
void PlmeSetTRXStateConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state.
void SendAck(uint8_t seqno)
Send an acknowledgment packet for the given sequence number.
a base class which provides memory management and object aggregation
uint16_t GetPanId(void) const
Get the PAN id used by this MAC.
void AckWaitTimeout(void)
Handle an ACK timeout with a packet retransmission, if there are retransmission left, or a packet drop.
Ptr< LrWpanPhy > GetPhy(void)
Get the underlying PHY of the MAC.
Mac16Address m_shortAddress
The short address used by this MAC.
a unique identifier for an interface.
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaCa)
Set the CSMA/CA implementation to be used by the MAC.
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...
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
uint64_t GetMacAckWaitDuration(void) const
Get the macAckWaitDuration attribute value.
uint64_t m_aBaseSlotDuration
Length of a superframe slot in symbols.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
void SetAssociationStatus(LrWpanAssociationStatus status)
Set the current association status.
LrWpanPibAttributeIdentifier
IEEE802.15.4-2006 PHY PIB Attribute Identifiers Table 23 in section 6.4.2.
void SetMcpsDataIndicationCallback(McpsDataIndicationCallback c)
Set the callback for the indication of an incoming data packet.