24#include <ns3/packet.h>
47 .SetGroupName(
"LrWpan")
61 os <<
" FCS = " <<
m_fcs;
74 start.WriteU16(
m_fcs);
81 m_fcs = start.ReadU16();
97 uint16_t size = p->GetSize();
98 auto serial_packet =
new uint8_t[size];
100 p->CopyData(serial_packet, size);
103 delete[] serial_packet;
119 uint16_t size = p->GetSize();
120 auto serial_packet =
new uint8_t[size];
122 p->CopyData(serial_packet, size);
125 delete[] serial_packet;
126 return (checkFcs ==
GetFcs());
150 uint16_t accumulator = 0;
152 for (i = 0; i < length; ++i)
154 accumulator ^= *
data;
155 accumulator = (accumulator >> 8) | (accumulator << 8);
156 accumulator ^= (accumulator & 0xff00) << 4;
157 accumulator ^= (accumulator >> 8) >> 4;
158 accumulator ^= (accumulator & 0xff00) >> 5;
iterator in a Buffer instance
Introspection did not find any typical Config paths.
Smart pointer class similar to boost::intrusive_ptr.
Protocol trailer serialization and deserialization.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Represent the Mac Trailer with the Frame Check Sequence field.
void Serialize(Buffer::Iterator start) const override
bool IsFcsEnabled() const
Query if FCS calculation is enabled for this trailer.
void EnableFcs(bool enable)
Enable or disable FCS calculation for this trailer.
uint32_t Deserialize(Buffer::Iterator start) override
void SetFcs(Ptr< const Packet > p)
Calculate and set the FCS value based on the given packet.
uint32_t GetSerializedSize() const override
bool CheckFcs(Ptr< const Packet > p)
Check the FCS of a given packet against the FCS value stored in the trailer.
bool m_calcFcs
Only if m_calcFcs is true, FCS values will be calculated and used in the trailer.
uint16_t m_fcs
The FCS value stored in this trailer.
LrWpanMacTrailer()
Default constructor for a MAC trailer with disabled FCS calculation.
uint16_t GetFcs() const
Get this trailers FCS value.
static TypeId GetTypeId()
Get the type ID.
uint16_t GenerateCrc16(uint8_t *data, int length)
Calculate the 16-bit FCS value.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Print(std::ostream &os) const override
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
constexpr uint16_t LR_WPAN_MAC_FCS_LENGTH
The length in octets of the IEEE 802.15.4 MAC FCS field.
Every class exported by the ns3 library is enclosed in the ns3 namespace.