Possible bug fix and sequence number as SequenceNumber8
This commit is contained in:
@@ -105,7 +105,7 @@ LrWpanMac::LrWpanMac ()
|
||||
|
||||
UniformVariable uniformVar;
|
||||
uniformVar = UniformVariable (0, 255);
|
||||
m_macDsn = SequenceNumber16 (uniformVar.GetValue ());
|
||||
m_macDsn = SequenceNumber8 (uniformVar.GetValue ());
|
||||
m_shortAddress = Mac16Address ("00:00");
|
||||
}
|
||||
|
||||
@@ -215,12 +215,8 @@ LrWpanMac::McpsDataRequest (McpsDataRequestParams params, Ptr<Packet> p)
|
||||
// The current tx drop trace is not suitable, because packets dropped using this trace carry the mac header
|
||||
// and footer, while packets being dropped here do not have them.
|
||||
|
||||
LrWpanMacHeader macHdr (LrWpanMacHeader::LRWPAN_MAC_DATA, (uint8_t)m_macDsn.GetValue ());
|
||||
LrWpanMacHeader macHdr (LrWpanMacHeader::LRWPAN_MAC_DATA, m_macDsn.GetValue ());
|
||||
m_macDsn++;
|
||||
if (m_macDsn > SequenceNumber16 (255))
|
||||
{
|
||||
m_macDsn = m_macDsn - SequenceNumber16 (255);
|
||||
}
|
||||
|
||||
if (p->GetSize () > LrWpanPhy::aMaxPhyPacketSize - aMinMPDUOverhead)
|
||||
{
|
||||
@@ -735,10 +731,6 @@ LrWpanMac::PdDataConfirm (LrWpanPhyEnumeration status)
|
||||
|
||||
NS_LOG_FUNCTION (this << status << m_txQueue.size ());
|
||||
|
||||
// \todo: Temporary assert. This is a bug.
|
||||
NS_ASSERT_MSG (m_txQueue.size () > 0, "TxQsize = 0");
|
||||
TxQueueElement *txQElement = m_txQueue.front ();
|
||||
|
||||
LrWpanMacHeader macHdr;
|
||||
m_txPkt->PeekHeader (macHdr);
|
||||
if (status == IEEE_802_15_4_PHY_SUCCESS)
|
||||
@@ -764,6 +756,8 @@ LrWpanMac::PdDataConfirm (LrWpanPhyEnumeration status)
|
||||
if (!m_mcpsDataConfirmCallback.IsNull ())
|
||||
{
|
||||
McpsDataConfirmParams confirmParams;
|
||||
NS_ASSERT_MSG (m_txQueue.size () > 0, "TxQsize = 0");
|
||||
TxQueueElement *txQElement = m_txQueue.front ();
|
||||
confirmParams.m_msduHandle = txQElement->txQMsduHandle;
|
||||
confirmParams.m_status = IEEE_802_15_4_SUCCESS;
|
||||
m_mcpsDataConfirmCallback (confirmParams);
|
||||
@@ -782,6 +776,8 @@ LrWpanMac::PdDataConfirm (LrWpanPhyEnumeration status)
|
||||
|
||||
if (!macHdr.IsAcknowledgment ())
|
||||
{
|
||||
NS_ASSERT_MSG (m_txQueue.size () > 0, "TxQsize = 0");
|
||||
TxQueueElement *txQElement = m_txQueue.front ();
|
||||
m_macTxDropTrace (txQElement->txQPkt);
|
||||
if (!m_mcpsDataConfirmCallback.IsNull ())
|
||||
{
|
||||
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
uint64_t m_macSuperframeOrder; // 0..14 and 15 means superframe shall not remain active after beacon
|
||||
bool m_macPromiscuousMode; // Indicates if MAC sublayer is in receive all mode. True mean accept all frames from PHY.
|
||||
uint16_t m_macPanId; // 16bits id of PAN on which this device is operating. 0xffff means not asscoiated
|
||||
SequenceNumber16 m_macDsn; // Seq num added to transmitted data or MAC command frame 00-ff
|
||||
SequenceNumber8 m_macDsn; // Seq num added to transmitted data or MAC command frame 00-ff
|
||||
uint8_t m_macMaxFrameRetries; // The maximum number of retries allowed after a transmission failure
|
||||
|
||||
uint64_t GetMacAckWaitDuration (void) const;
|
||||
|
||||
@@ -469,6 +469,7 @@ std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE,
|
||||
typedef SequenceNumber<uint32_t, int32_t> SequenceNumber32;
|
||||
/// 16 bit Sequence number
|
||||
typedef SequenceNumber<uint16_t, int16_t> SequenceNumber16;
|
||||
typedef SequenceNumber<uint8_t, int8_t> SequenceNumber8;
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user