lr-wpan: Change SuperframeField to standard bitmap

This commit is contained in:
Alberto Gallegos Ramonet
2023-10-19 15:54:13 +09:00
parent 96d7587845
commit 4bb239b8ce
9 changed files with 39 additions and 63 deletions

View File

@@ -25,6 +25,7 @@ Changes from ns-3.40 to ns-3-dev
* (lte) Struct member `tdbetsFlowPerf_t::lastTtiBytesTrasmitted` in file `tdbet-ff-mac-scheduler.h` was renamed `fdbetsFlowPerf_t::lastTtiBytesTransmitted`.
* (lte) Struct member `pfsFlowPerf_t::lastTtiBytesTrasmitted` in file `pf-ff-mac-scheduler.h` was renamed `fdbetsFlowPerf_t::lastTtiBytesTransmitted`.
* (lr-wpan) Change the CapabilityField parameter in `LrWpanMac::MlmeAssociateRequest` and `LrWpanMac::MlmeAssociateIndication` to a standard bitmap.
* (lr-wpan) Change the MAC SuperframeField usage to a standard bitmap, this change impact parameters in the `BeaconPayloadHeader`.
### Changes to build system

View File

@@ -21,6 +21,7 @@ Release 3-dev
### New user-visible features
- (lr-wpan) !1686 Change CapabilityField to standard bitmap
- (lr-wpan) !1698 Change SuperframeField to standard bitmap
### Bugs fixed

View File

@@ -105,7 +105,8 @@ ScanConfirm(Ptr<LrWpanNetDevice> device, MlmeScanConfirmParams params)
}
// Only request association if the coordinator is permitting association at this moment.
if (params.m_panDescList[panDescIndex].m_superframeSpec.IsAssocPermit())
SuperframeField superframe(params.m_panDescList[panDescIndex].m_superframeSpec);
if (superframe.IsAssocPermit())
{
std::string addressing;
if (params.m_panDescList[panDescIndex].m_coorAddrMode == SHORT_ADDR)

View File

@@ -35,6 +35,11 @@ SuperframeField::SuperframeField()
SetAssocPermit(false);
}
SuperframeField::SuperframeField(uint16_t bitmap)
{
SetSuperframe(bitmap);
}
void
SuperframeField::SetSuperframe(uint16_t superFrmSpec)
{
@@ -156,28 +161,6 @@ SuperframeField::GetSuperframe() const
return superframe;
}
uint32_t
SuperframeField::GetSerializedSize() const
{
return 2; // 2 Octets (superframeSpec)
}
Buffer::Iterator
SuperframeField::Serialize(Buffer::Iterator i) const
{
i.WriteHtolsbU16(GetSuperframe());
return i;
}
Buffer::Iterator
SuperframeField::Deserialize(Buffer::Iterator i)
{
uint16_t superframe = i.ReadLsbtohU16();
SetSuperframe(superframe);
return i;
}
std::ostream&
operator<<(std::ostream& os, const SuperframeField& superframeField)
{

View File

@@ -54,6 +54,14 @@ class SuperframeField
{
public:
SuperframeField();
/**
* Create a superframe Specification Information field with
* the information specified in the bitmap.
*
* \param bitmap The superframe in bitmap form
*/
SuperframeField(uint16_t bitmap);
/**
* Set the whole Superframe Specification Information field.
* \param superFrm The Superframe Specification information field.
@@ -127,24 +135,6 @@ class SuperframeField
* \return the Superframe Specification Information field bits.
*/
uint16_t GetSuperframe() const;
/**
* Get the size of the serialized Superframe specification information field.
* \return the size of the serialized field.
*/
uint32_t GetSerializedSize() const;
/**
* Serialize the entire superframe specification field.
* \param i an iterator which points to where the superframe specification field should be
* written.
* \return an iterator.
*/
Buffer::Iterator Serialize(Buffer::Iterator i) const;
/**
* Deserialize the entire superframe specification field.
* \param i an iterator which points to where the superframe specification field should be read.
* \return an iterator.
*/
Buffer::Iterator Deserialize(Buffer::Iterator i);
private:
// Superframe Specification field

View File

@@ -55,7 +55,7 @@ uint32_t
BeaconPayloadHeader::GetSerializedSize() const
{
uint32_t size = 0;
size += m_superframeField.GetSerializedSize();
size += sizeof(m_superframeField);
size += m_gtsFields.GetSerializedSize();
size += m_pndAddrFields.GetSerializedSize();
@@ -66,7 +66,7 @@ void
BeaconPayloadHeader::Serialize(Buffer::Iterator start) const
{
Buffer::Iterator i = start;
i = m_superframeField.Serialize(i);
i.WriteU16(m_superframeField);
i = m_gtsFields.Serialize(i);
i = m_pndAddrFields.Serialize(i);
}
@@ -75,7 +75,7 @@ uint32_t
BeaconPayloadHeader::Deserialize(Buffer::Iterator start)
{
Buffer::Iterator i = start;
i = m_superframeField.Deserialize(i);
m_superframeField = i.ReadU16();
i = m_gtsFields.Deserialize(i);
i = m_pndAddrFields.Deserialize(i);
@@ -91,7 +91,7 @@ BeaconPayloadHeader::Print(std::ostream& os) const
}
void
BeaconPayloadHeader::SetSuperframeSpecField(SuperframeField sf)
BeaconPayloadHeader::SetSuperframeSpecField(uint16_t sf)
{
m_superframeField = sf;
}
@@ -108,7 +108,7 @@ BeaconPayloadHeader::SetPndAddrFields(PendingAddrFields pndAddrFields)
m_pndAddrFields = pndAddrFields;
}
SuperframeField
uint16_t
BeaconPayloadHeader::GetSuperframeSpecField() const
{
return m_superframeField;

View File

@@ -50,9 +50,9 @@ class BeaconPayloadHeader : public Header
void Print(std::ostream& os) const override;
/**
* Set the superframe specification field to the beacon payload header.
* \param sfrmField The superframe specification field
* \param sfrmField The superframe specification field (bitmap)
*/
void SetSuperframeSpecField(SuperframeField sfrmField);
void SetSuperframeSpecField(uint16_t sfrmField);
/**
* Set the superframe Guaranteed Time Slot (GTS) fields to the beacon payload header.
* \param gtsFields The GTS fields.
@@ -65,9 +65,9 @@ class BeaconPayloadHeader : public Header
void SetPndAddrFields(PendingAddrFields pndAddrFields);
/**
* Get the superframe specification field from the beacon payload header.
* \return The superframe specification field
* \return The superframe specification field (bitmap)
*/
SuperframeField GetSuperframeSpecField() const;
uint16_t GetSuperframeSpecField() const;
/**
* Get the Guaranteed Time Slots (GTS) fields from the beacon payload header.
* \return The GTS fields.
@@ -83,7 +83,7 @@ class BeaconPayloadHeader : public Header
/**
* Superframe Specification Field
*/
SuperframeField m_superframeField;
uint16_t m_superframeField;
/**
* GTS Fields
*/

View File

@@ -1711,7 +1711,7 @@ LrWpanMac::CheckQueue()
}
}
SuperframeField
uint16_t
LrWpanMac::GetSuperframeField()
{
SuperframeField sfrmSpec;
@@ -1736,7 +1736,7 @@ LrWpanMac::GetSuperframeField()
sfrmSpec.SetAssocPermit(true);
}
return sfrmSpec;
return sfrmSpec.GetSuperframe();
}
GtsFields
@@ -2184,8 +2184,8 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
// beginning of an Association).
m_csmaCa->Cancel();
SuperframeField incomingSuperframe;
incomingSuperframe = receivedMacPayload.GetSuperframeSpecField();
SuperframeField incomingSuperframe(
receivedMacPayload.GetSuperframeSpecField());
m_incomingBeaconOrder = incomingSuperframe.GetBeaconOrder();
m_incomingSuperframeOrder = incomingSuperframe.GetFrameOrder();

View File

@@ -384,12 +384,12 @@ struct PanDescriptor
//!< coordinator address mode.
uint8_t m_logCh{11}; //!< The current channel number occupied by the network.
uint8_t m_logChPage{0}; //!< The current channel page occupied by the network.
SuperframeField m_superframeSpec; //!< The superframe specification as specified in the received
//!< beacon frame.
bool m_gtsPermit{false}; //!< TRUE if the beacon is from the PAN coordinator
//!< that is accepting GTS requests.
uint8_t m_linkQuality{0}; //!< The LQI at which the network beacon was received.
//!< Lower values represent lower LQI.
uint16_t m_superframeSpec{0}; //!< The superframe specification as specified in the received
//!< beacon frame.
bool m_gtsPermit{false}; //!< TRUE if the beacon is from the PAN coordinator
//!< that is accepting GTS requests.
uint8_t m_linkQuality{0}; //!< The LQI at which the network beacon was received.
//!< Lower values represent lower LQI.
Time m_timeStamp; //!< Beacon frame reception time. Used as Time data type in ns-3 to avoid
//!< precision problems.
};
@@ -1830,9 +1830,9 @@ class LrWpanMac : public Object
* Constructs a Superframe specification field from the local information,
* the superframe Specification field is necessary to create a beacon frame.
*
* \returns the Superframe specification field
* \returns the Superframe specification field (bitmap)
*/
SuperframeField GetSuperframeField();
uint16_t GetSuperframeField();
/**
* Constructs the Guaranteed Time Slots (GTS) Fields from local information.