21 #include "ns3/assert.h" 23 #include "ns3/trailer.h" 60 buffer =
new uint8_t[len];
64 return (
m_fcs == crc);
79 buffer =
new uint8_t[len];
111 .SetGroupName(
"Network")
125 os <<
"fcs=" <<
m_fcs;
virtual uint32_t GetSerializedSize(void) const
#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.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void CalcFcs(Ptr< const Packet > p)
Updates the Fcs Field to the correct FCS.
void SetFcs(uint32_t fcs)
Sets the FCS to a new value.
uint32_t CRC32Calculate(const uint8_t *data, int length)
Calculates the CRC-32 for a given input.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetTrailerSize() const
uint32_t m_fcs
Value of the fcs contained in the trailer.
iterator in a Buffer instance
virtual uint32_t Deserialize(Buffer::Iterator end)
void Prev(void)
go backward by one byte
static TypeId GetTypeId(void)
Get the type ID.
EthernetTrailer()
Construct a null ethernet trailer.
bool m_calcFcs
Enabled FCS calculations.
Protocol trailer serialization and deserialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Packet trailer for Ethernet.
void EnableFcs(bool enable)
Enable or disable FCS checking and calculations.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual void Serialize(Buffer::Iterator end) const
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
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...
virtual void Print(std::ostream &os) const
void WriteU32(uint32_t data)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.