INET Framework for OMNeT++/OMNEST
inet::EthernetMacAddressFieldsSerializer Class Reference

Converts between EthernetMacAddressFields and binary (network byte order) 802.3 MAC addresses header. More...

#include <EthernetMacHeaderSerializer.h>

Inheritance diagram for inet::EthernetMacAddressFieldsSerializer:
inet::FieldsChunkSerializer inet::ChunkSerializer

Public Member Functions

 EthernetMacAddressFieldsSerializer ()
 
- Public Member Functions inherited from inet::FieldsChunkSerializer
virtual void serialize (MemoryOutputStream &stream, const Ptr< const Chunk > &chunk, b offset, b length) const override
 Serializes a chunk into a stream by writing the bytes representing the chunk at the end of the stream. More...
 
virtual const Ptr< Chunkdeserialize (MemoryInputStream &stream, const std::type_info &typeInfo) const override
 Deserializes a chunk from a stream by reading the bytes at the current position of the stream. More...
 

Protected Member Functions

virtual void serialize (MemoryOutputStream &stream, const Ptr< const Chunk > &chunk) const override
 Serializes a chunk into a stream by writing all bytes representing the chunk at the end of the stream. More...
 
virtual const Ptr< Chunkdeserialize (MemoryInputStream &stream) const override
 Deserializes a chunk from a stream by reading the bytes at the current position of the stream. More...
 

Additional Inherited Members

- Static Public Attributes inherited from inet::ChunkSerializer
static b totalSerializedLength = b(0)
 
static b totalDeserializedLength = b(0)
 

Detailed Description

Converts between EthernetMacAddressFields and binary (network byte order) 802.3 MAC addresses header.

Constructor & Destructor Documentation

◆ EthernetMacAddressFieldsSerializer()

inet::EthernetMacAddressFieldsSerializer::EthernetMacAddressFieldsSerializer ( )
inline
25 : FieldsChunkSerializer() {}

Member Function Documentation

◆ deserialize()

const Ptr< Chunk > inet::EthernetMacAddressFieldsSerializer::deserialize ( MemoryInputStream stream) const
overrideprotectedvirtual

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.

36 {
37  auto header = makeShared<EthernetMacAddressFields>();
38  header->setDest(stream.readMacAddress());
39  header->setSrc(stream.readMacAddress());
40  return header;
41 }

◆ serialize()

void inet::EthernetMacAddressFieldsSerializer::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.

29 {
30  const auto& header = staticPtrCast<const EthernetMacAddressFields>(chunk);
31  stream.writeMacAddress(header->getDest());
32  stream.writeMacAddress(header->getSrc());
33 }

The documentation for this class was generated from the following files: