|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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>
108 namespace TracedValueCallback {
a unique identifier for an interface.
MlmeBeaconNotifyIndicationCallback m_mlmeBeaconNotifyIndicationCallback
This callback is used to notify incoming beacon packets to the upper layers.
LrWpanAssociationStatus m_associationStatus
The current association status of the MAC layer.
bool m_panCoor
On true this device will become coordinator.
EventId m_trackingEvent
Scheduler event to track the incoming beacons.
static const uint32_t aNumSuperframeSlots
Number of a superframe slots per superframe.
uint8_t m_dsn
The DSN of the received data frame.
uint8_t m_incomingSuperframeOrder
Used by all devices that have a parent.
Time m_macBeaconRxTime
The time that the device received its last bit of the beacon frame.
LrWpanMlmeStartConfirmStatus
Table 35 of IEEE 802.15.4-2011.
uint8_t txQMsduHandle
MSDU Handle.
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but dropped before being forwa...
@ IEEE_802_15_4_INVALID_PARAMETER
LrWpanTxOption
Tx options.
@ MLMESTART_UNAVAILABLE_KEY
@ MLMEPOLL_INVALID_PARAMETER
IEEE802.15.4-2006 PHY PIB Attributes Table 23 in section 6.4.2.
Mac16Address m_macCoordShortAddress
The short address of the coordinator through which the device is associated.
void AwaitBeacon(void)
Called after the end of an INCOMING superframe to start the moment a device waits for a new incoming ...
virtual void DoDispose(void)
Destructor implementation.
static const uint32_t aBaseSuperframeDuration
Length of a superframe in symbols.
@ IEEE_802_15_4_TRANSACTION_EXPIRED
uint8_t m_mpduLinkQuality
LQI value measured during reception of the MPDU.
@ MLMESTART_INVALID_PARAMETER
virtual void DoInitialize(void)
Initialize() implementation.
void SetMlmeStartConfirmCallback(MlmeStartConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
Mac64Address m_macCoordExtendedAddress
The extended address of the coordinator through which the device is associated.
@ CFP
Contention Free Period.
An identifier for simulation events.
@ IEEE_802_15_4_FRAME_TOO_LONG
@ IEEE_802_15_4_INVALID_ADDRESS
EventId m_incCfpEvent
Scheduler event for the end of the incoming superframe CFP.
Callback< void, MlmePollConfirmParams > MlmePollConfirmCallback
This callback is called after a Mlme-Poll.Request has been called from the higher layer.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void RemoveFirstTxQElement()
Remove the tip of the transmission queue, including clean up related to the last packet transmission.
SuperframeType
Superframe type.
Mac64Address m_dstExtAddr
Destination extended address.
@ TX_OPTION_ACK
TX_OPTION_ACK.
TracedCallback< Time > m_macIfsEndTrace
The trace source is fired at the end of any Interframe Space (IFS).
Represent the Pending Address Specification field.
@ TX_OPTION_NONE
TX_OPTION_NONE.
uint32_t m_superframeDuration
Indication of the superframe duration in symbols.
bool m_coorRealgn
True if a realignment request command is to be transmitted prior changing the superframe.
Ptr< LrWpanPhy > m_phy
The PHY associated with this MAC.
uint8_t GetMacMaxFrameRetries(void) const
Get the macMaxFrameRetries attribute value.
Mac16Address m_coorShortAddr
Coordintator short address.
bool m_macAutoRequest
Indication of whether a device automatically sends data request command if its address is listed in t...
This class can contain 16 bit addresses.
uint16_t m_macTransactionPersistanceTime
The maximum time (in superframe periods) that a transaction is stored by a coordinator and indicated ...
LrWpanAddressMode m_dstAddrMode
Destination address mode.
EventId m_incCapEvent
Scheduler event for the end of the incoming superframe CAP.
uint32_t m_ifs
The value of the necessary InterFrame Space after the transmission of a packet.
uint16_t m_dstPanId
Destination PAN identifier.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets are being sent down to L1.
EventId m_beaconEvent
Scheduler event for generation of one beacon.
Mac16Address GetShortAddress(void) const
Get the short address of this MAC.
Callback< void, MlmeSyncLossIndicationParams > MlmeSyncLossIndicationCallback
This callback is called to indicate the loss of synchronization with a coordinator.
@ MLMESYNCLOSS_SUPERFRAME_OVERLAP
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...
Callback< void, MlmeStartConfirmParams > MlmeStartConfirmCallback
This callback is called after a MlmeStartRequest has been called from the higher layer.
uint32_t m_beaconInterval
Indication of the Interval used by the coordinator to transmit beacon frames expressed in symbols.
MlmePollConfirmCallback m_mlmePollConfirmCallback
This callback is used to report the status after a device send data command request to the coordinato...
@ MLMESTART_UNSUPPORTED_SECURITY
void SetMacMaxFrameRetries(uint8_t retries)
Set the macMaxFrameRetries attribute value.
Represent the Superframe Specification information field.
MLME-START.request params.
bool m_battLifeExt
Flag indicating whether or not the Battery life extension (BLE) features are used.
MLME-BEACON-NOTIFY.indication params.
std::deque< IndTxQueueElement * > m_indTxQueue
The indirect transmit queue used by the MAC pending messages.
uint32_t GetIfsSize()
Get the size of the Interframe Space according to MPDU size (m_txPkt).
bool m_panCoor
Indication of whether the current device is the PAN coordinator.
@ MLMESYNCLOSS_REALIGMENT
uint8_t m_incomingBeaconOrder
The beaconOrder value of the INCOMING frame.
uint8_t m_txOptions
Tx Options (bitfield)
Mac64Address m_dstExtAddr
Destination extended address.
GtsFields GetGtsFields(void)
Constructs the Guaranteed Time Slots (GTS) Fields from local information.
static TypeId GetTypeId(void)
Get the type ID.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
MLME-POLL.request params.
TracedValue< LrWpanMacState > m_lrWpanMacState
The current state of the MAC layer.
static const uint32_t aMinMPDUOverhead
The minimum number of octets added by the MAC sublayer to the PSDU.
void SetMlmeBeaconNotifyIndicationCallback(MlmeBeaconNotifyIndicationCallback c)
Set the callback for the indication of an incoming beacon packet.
void SetPhy(Ptr< LrWpanPhy > phy)
Set the underlying PHY for the MAC.
bool m_macRxOnWhenIdle
Indication of whether the MAC sublayer is to enable its receiver during idle periods.
LrWpanAddressMode
table 80 of 802.15.4
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets are dropped due to missing ACKs or because of transmission failur...
MLME-START.confirm params.
Helper structure for managing indirect transmission queue elements.
@ MLMEPOLL_FRAME_TOO_LONG
bool isTxAckReq(void)
Check if the packet to transmit requires acknowledgment.
LrWpanPibAttributeIdentifier
IEEE802.15.4-2006 PHY PIB Attribute Identifiers Table 23 in section 6.4.2.
Time m_macBeaconTxTime
The time that the device transmitted its last beacon frame.
Ptr< Packet > m_txPkt
The packet which is currently being sent by the MAC layer.
void SetShortAddress(Mac16Address address)
Set the short address of this MAC.
uint16_t m_coorPanId
The PAN id of the coordinator to which the poll is intended.
Mac64Address m_coorExtAddr
Coordinator extended address.
TracedCallback< LrWpanMacState, LrWpanMacState > m_macStateLogger
A trace source that fires when the LrWpanMac changes states.
uint64_t m_macSyncSymbolOffset
Symbol boundary is same as m_macBeaconTxTime.
Ptr< Packet > txQPkt
Queued packet.
@ SET_PHY_TX_ON
SET_PHY_TX_ON.
LrWpanMlmePollConfirmStatus m_status
The confirmation status resulting from a MLME-poll.request.
static const uint32_t aMaxSIFSFrameSize
The maximum size of an MPDU, in octets, that can be followed by a Short InterFrame Spacing (SIFS) per...
MCPS-DATA.confirm params.
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...
Mac16Address m_srcAddr
Source address.
void CheckQueue(void)
Check the transmission queue.
@ TX_OPTION_GTS
TX_OPTION_GTS.
uint32_t m_logChPage
Logical channel page on which to start using the new superframe configuration.
@ MAC_INACTIVE
MAC_INACTIVE.
uint32_t m_startTime
Time at which to begin transmitting beacons (Used by Coordinator not PAN Coordinators).
uint8_t m_msduHandle
MSDU handle.
LrWpanAddressMode m_coorAddrMode
The addressing mode of the coordinator to which the pool is intended.
void PlmeSetTRXStateConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state.
A base class which provides memory management and object aggregation.
uint16_t m_srcPanId
Source PAN identifier.
LrWpanMacState
MAC states.
LrWpanAssociationStatus
table 83 of 802.15.4
@ MLMESYNCLOSS_BEACON_LOST
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
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...
@ MAC_CSMA_DEFERRED
MAC_CSMA_DEFERRED.
uint16_t m_PanId
Pan Identifier used by the device.
@ MLMEPOLL_UNSUPPORTED_SECURITY
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...
Mac64Address GetExtendedAddress(void) const
Get the extended address of this MAC.
EventId m_ifsEvent
Scheduler event for Interframe spacing wait time.
@ MLMESTART_CHANNEL_ACCESS_FAILURE
void SetExtendedAddress(Mac64Address address)
Set the extended address of this MAC.
uint8_t m_bsn
The beacon sequence number.
Helper structure for managing transmission queue elements.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
uint32_t m_incomingSuperframeDuration
Indication of the superframe duration in symbols (e.g.
uint8_t m_macBeaconOrder
Used by a PAN coordinator or coordinator.
uint64_t GetTxPacketSymbols(void)
Obtain the number of symbols in the packet which is currently being sent by the MAC layer.
uint16_t m_macPanId
16 bits id of PAN on which this device is operating.
@ MLMESTART_SUPERFRAME_OVERLAP
void PlmeCcaConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.
std::deque< TxQueueElement * > m_txQueue
The transmit queue used by the MAC.
Mac64Address m_srcExtAddr
Source extended address.
EventId m_setMacState
Scheduler event for a deferred MAC state change.
void(* SentTracedCallback)(Ptr< const Packet > packet, uint8_t retries, uint8_t backoffs)
TracedCallback signature for sent packets.
TracedCallback< Ptr< const Packet > > m_macTxEnqueueTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
@ CHANNEL_ACCESS_FAILURE
CHANNEL_ACCESS_FAILURE.
@ OUTGOING
Outgoing Superframe.
LrWpanMlmePollConfirmStatus
Table 39 of IEEE 802.15.4-2011.
uint8_t m_numLostBeacons
The number of consecutive loss beacons in a beacon tracking operation.
void SetRxOnWhenIdle(bool rxOnWhenIdle)
Set if the receiver should be enabled when the MAC is idle.
Simulation virtual time values and global simulation resolution.
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Represent the GTS information fields.
@ IEEE_802_15_4_UNSUPPORTED_SECURITY
uint64_t m_rxBeaconSymbols
The total size of the received beacon in symbols.
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Ptr< Packet > txQPkt
Queued packet.
bool isCoordDest(void)
Check if the packet destination is its coordinator.
SuperframeField GetSuperframeField(void)
Constructs a Superframe specification field from the local information, the superframe Specification ...
uint8_t m_deviceCapability
Indication of current device capability (FFD or RFD)
@ INCOMING
Incoming Superframe.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
bool m_trackBcn
True if the mlme sync with the next beacon and attempts to track future beacons.
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...
MLME-SYNC-LOSS.indication params.
uint8_t m_macMaxFrameRetries
The maximum number of retries allowed after a transmission failure.
bool PrepareRetransmission(void)
Check for remaining retransmissions for the packet currently being sent.
Time expireTime
The expiration time of the packet in the indirect transmission queue.
Ptr< LrWpanPhy > GetPhy(void)
Get the underlying PHY of the MAC.
@ CAP
Contention Access Period.
uint8_t m_numCsmacaRetry
The number of CSMA/CA retries used for sending the current packet.
@ IEEE_802_15_4_UNAVAILABLE_KEY
void SetMcpsDataConfirmCallback(McpsDataConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
void SetMlmePollConfirmCallback(MlmePollConfirmCallback c)
Set the callback for the confirmation of a data transmission request.
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaCa)
Set the CSMA/CA implementation to be used by the MAC.
MlmeStartConfirmCallback m_mlmeStartConfirmCallback
This callback is used to report the start of a new PAN or the begin of a new superframe configuration...
Mac16Address m_shortAddress
The short address used by this MAC.
uint64_t GetMacAckWaitDuration(void) const
Get the macAckWaitDuration attribute value.
@ BEACON
The Beacon transmission or reception Period.
void IfsWaitTimeout(Time ifsTime)
After a successful transmission of a frame (beacon, data) or an ack frame reception,...
uint8_t txQMsduHandle
MSDU Handle.
void SetPanId(uint16_t panId)
Set the PAN id used by this MAC.
Callback< void, MlmeBeaconNotifyIndicationParams, Ptr< Packet > > MlmeBeaconNotifyIndicationCallback
This callback is called after a Mlme has successfully received a beacon frame and wants to deliver it...
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...
@ MAC_SENDING
MAC_SENDING.
static const uint32_t aMaxLostBeacons
The number of consecutive lost beacons that will cause the MAC sublayer of a receiving device to decl...
void SendAck(uint8_t seqno)
Send an acknowledgment packet for the given sequence number.
Mac64Address m_selfExt
The extended address used by this MAC.
Ptr< LrWpanCsmaCa > m_csmaCa
The CSMA/CA implementation used by this MAC.
void SendOneBeacon(void)
Called to send a single beacon frame.
TracedCallback< Ptr< const Packet > > m_macTxDequeueTrace
The trace source fired when packets are dequeued from the L3/l2 transmission queue.
Mac16Address m_dstAddr
Destination address.
@ MAC_ACK_PENDING
MAC_ACK_PENDING.
@ MLMESTART_NO_SHORT_ADDRESS
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 SetMcpsDataIndicationCallback(McpsDataIndicationCallback c)
Set the callback for the indication of an incoming data packet.
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
void SetLrWpanMacState(LrWpanMacState macState)
CSMA-CA algorithm calls back the MAC after executing channel assessment.
void AckWaitTimeout(void)
Handle an ACK timeout with a packet retransmission, if there are retransmission left,...
MCPS-DATA.indication params.
void(* StateTracedCallback)(LrWpanMacState oldState, LrWpanMacState newState)
TracedCallback signature for LrWpanMacState change events.
void SetAssociationStatus(LrWpanAssociationStatus status)
Set the current association status.
@ IEEE_802_15_4_COUNTER_ERROR
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_panId
The PAN identifier with which the device lost synchronization or to which it was realigned.
@ MLMEPOLL_CHANNEL_ACCESS_FAILURE
LrWpanSyncLossReason
Table 37 of IEEE 802.15.4-2011.
uint8_t m_dstAddrMode
Destination address mode.
uint8_t m_logCh
The channel number on which the device lost synchronization or to which it was realigned.
TracedValue< SuperframeStatus > m_outSuperframeStatus
The current period of the outgoing superframe.
LrWpanMcpsDataConfirmStatus m_status
The status of the last MSDU transmission.
EventId m_cfpEvent
Scheduler event for the end of the outgoing superframe CFP.
@ INACTIVE
Inactive Period or unslotted CSMA-CA.
PendingAddrFields GetPendingAddrFields(void)
Constructs Pending Address Fields from the local information, the Pending Address Fields are part of ...
uint8_t m_srcAddrMode
Source address mode.
LrWpanMac(void)
Default constructor.
void StartCAP(SuperframeType superframeType)
Called to begin the Contention Access Period (CAP) in a beacon-enabled mode.
LrWpanAddressMode m_srcAddrMode
Source address mode.
EventId m_ackWaitTimeout
Scheduler event for the ACK timeout of the currently transmitted data packet.
LrWpanMcpsDataConfirmStatus
Table 42 of 802.15.4-2006.
@ MLMESTART_FRAME_TOO_LONG
McpsDataIndicationCallback m_mcpsDataIndicationCallback
This callback is used to notify incoming packets to the upper layers.
@ MLMESYNCLOSS_PAN_ID_CONFLICT
TracedCallback< Ptr< const Packet > > m_macTxOkTrace
The trace source fired when packets where successfully transmitted, that is an acknowledgment was rec...
@ MLMESTART_COUNTER_ERROR
uint8_t m_fnlCapSlot
Indication of the Slot where the CAP portion of the OUTGOING Superframe ends.
void BeaconSearchTimeout(void)
Called if the device is unable to locate a beacon in the time set by MLME-SYNC.request.
@ TX_OPTION_INDIRECT
TX_OPTION_INDIRECT.
uint16_t GetPanId(void) const
Get the PAN id used by this MAC.
uint8_t m_macSuperframeOrder
Used by a PAN coordinator or coordinator.
@ IEEE_802_15_4_TRANSACTION_OVERFLOW
EventId m_capEvent
Scheduler event for the end of the outgoing superframe CAP.
Mac16Address m_dstAddr
Destination address.
void PdDataConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.1.2 Confirm the end of transmission of an MPDU to MAC.
MlmeSyncLossIndicationCallback m_mlmeSyncLossIndicationCallback
This callback is used to indicate the loss of synchronization with a coordinator.
void StartInactivePeriod(SuperframeType superframeType)
Start the Inactive Period in a beacon-enabled mode.
Forward calls to a chain of Callback.
SequenceNumber8 m_macBsn
Sequence number added to transmitted beacon frame, 00-ff.
void SetMlmeSyncLossIndicationCallback(MlmeSyncLossIndicationCallback c)
Set the callback for the loss of synchronization with a coordinator.
TracedValue< SuperframeStatus > m_incSuperframeStatus
The current period of the incoming superframe.
MLME-SYNC.request params.
Callback< void, McpsDataConfirmParams > McpsDataConfirmCallback
This callback is called after a McpsDataRequest has been called from the higher layer.
uint32_t m_macLIFSPeriod
The minimum time forming a Long InterFrame Spacing (LIFS) period.
@ ASSOCIATED_WITHOUT_ADDRESS
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.
SuperframeStatus
Superframe status.
LrWpanSyncLossReason m_lossReason
The reason for the lost of synchronization.
bool m_macPromiscuousMode
Indicates if MAC sublayer is in receive all mode.
bool GetRxOnWhenIdle(void)
Check if the receiver will be enabled when the MAC is idle.
void PrintTransmitQueueSize(void)
Print the number of elements in the packet transmit queue.
MCPS-DATA.request params.
Class that implements the LR-WPAN MAC state machine.
LrWpanMlmeStartConfirmStatus m_status
The status of a MLME-start.request.
@ IEEE_802_15_4_INVALID_GTS
uint16_t m_dstPanId
Destination PAN identifier.
LrWpanAssociationStatus GetAssociationStatus(void) const
Get the current association status.
@ CHANNEL_IDLE
CHANNEL_IDLE.
uint8_t m_logCh
The channel number on which to attempt coordinator synchronization.
MLME-START.confirm params.
static const uint32_t aBaseSlotDuration
Length of a superframe slot in symbols.
uint8_t m_retransmission
The number of already used retransmission for the currently transmitted packet.
SequenceNumber8 m_macDsn
Sequence number added to transmitted data or MAC command frame, 00-ff.
bool m_beaconTrackingOn
Indication of whether the current device is tracking incoming beacons.
@ MLMEPOLL_UNAVAILABLE_KEY
void ChangeMacState(LrWpanMacState newState)
Change the current MAC state to the given new state.
McpsDataConfirmCallback m_mcpsDataConfirmCallback
This callback is used to report data transmission request status to the upper layers.
@ IEEE_802_15_4_CHANNEL_ACCESS_FAILURE
uint32_t m_macSIFSPeriod
The minimum time forming a Short InterFrame Spacing (SIFS) period.
uint32_t m_incomingBeaconInterval
Indication of the interval a node should receive a superframe expressed in symbols.
void MlmeSyncRequest(MlmeSyncRequestParams params)
IEEE 802.15.4-2011, section 6.2.13.1 MLME-SYNC.request Request to synchronize with the coordinator by...
void StartCFP(SuperframeType superframeType)
Called to begin the Contention Free Period (CFP) in a beacon-enabled mode.
uint8_t m_msduHandle
MSDU handle.
void SetAssociatedCoor(Mac16Address mac)
Check if the packet destination is its coordinator.
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
uint8_t m_incomingFnlCapSlot
Indication of the Slot where the CAP portion of the INCOMING Superframe ends.