24 #include "ns3/assert.h"
26 #include "ns3/trailer.h"
62 buffer =
new uint8_t[len];
66 return (
m_fcs == crc);
81 buffer =
new uint8_t[len];
113 .SetGroupName(
"Network")
128 os <<
"fcs=" <<
m_fcs;
iterator in a Buffer instance
void WriteU32(uint32_t data)
void Prev()
go backward by one byte
Packet trailer for Ethernet.
uint32_t Deserialize(Buffer::Iterator end) override
void Print(std::ostream &os) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
bool CheckFcs(Ptr< const Packet > p) const
Calculate an FCS on the provided packet and check this value against the FCS found when the trailer w...
uint32_t GetSerializedSize() const override
void Serialize(Buffer::Iterator end) const override
uint32_t GetTrailerSize() const
void EnableFcs(bool enable)
Enable or disable FCS checking and calculations.
EthernetTrailer()
Construct a null ethernet trailer.
bool m_calcFcs
Enabled FCS calculations.
void CalcFcs(Ptr< const Packet > p)
Updates the Fcs Field to the correct FCS.
uint32_t m_fcs
Value of the fcs contained in the trailer.
static TypeId GetTypeId()
Get the type ID.
void SetFcs(uint32_t fcs)
Sets the FCS to a new value.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Protocol trailer serialization and deserialization.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t CRC32Calculate(const uint8_t *data, int length)
Calculates the CRC-32 for a given input.