Converts between EtherMacHeader and binary (network byte order) Ethernet mac header.
More...
#include <EthernetMacHeaderSerializer.h>
Converts between EtherMacHeader and binary (network byte order) Ethernet mac header.
◆ EthernetMacHeaderSerializer()
| inet::EthernetMacHeaderSerializer::EthernetMacHeaderSerializer |
( |
| ) |
|
|
inline |
51 : FieldsChunkSerializer() {}
◆ deserialize()
Deserializes a chunk from a stream by reading the bytes at the current position of the stream.
The current stream position is updated according to the length of the returned chunk.
Implements inet::FieldsChunkSerializer.
66 Ptr<EthernetMacHeader> ethernetMacHeader = makeShared<EthernetMacHeader>();
67 ethernetMacHeader->setDest(stream.readMacAddress());
68 ethernetMacHeader->setSrc(stream.readMacAddress());
69 ethernetMacHeader->setTypeOrLength(stream.readUint16Be());
70 return ethernetMacHeader;
◆ serialize()
| void inet::EthernetMacHeaderSerializer::serialize |
( |
MemoryOutputStream & |
stream, |
|
|
const Ptr< const Chunk > & |
chunk |
|
) |
| const |
|
overrideprotectedvirtual |
Serializes a chunk into a stream by writing all bytes representing the chunk at the end of the stream.
Implements inet::FieldsChunkSerializer.
58 const auto& ethernetMacHeader = staticPtrCast<const EthernetMacHeader>(chunk);
59 stream.writeMacAddress(ethernetMacHeader->getDest());
60 stream.writeMacAddress(ethernetMacHeader->getSrc());
61 stream.writeUint16Be(ethernetMacHeader->getTypeOrLength());
The documentation for this class was generated from the following files: