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;
iterator in a Buffer instance
void WriteU32(uint32_t data)
void Prev(void)
go backward by one byte
Packet trailer for Ethernet.
static TypeId GetTypeId(void)
Get the type ID.
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 GetTrailerSize() const
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator end) const
virtual uint32_t Deserialize(Buffer::Iterator end)
void EnableFcs(bool enable)
Enable or disable FCS checking and calculations.
virtual uint32_t GetSerializedSize(void) const
EthernetTrailer()
Construct a null ethernet trailer.
bool m_calcFcs
Enabled FCS calculations.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
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.
void SetFcs(uint32_t fcs)
Sets the FCS to a new value.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.