INET Framework for OMNeT++/OMNEST
inet::ieee80211::Ieee80211MacTrailerSerializer Class Reference

#include <Ieee80211MacHeaderSerializer.h>

Inheritance diagram for inet::ieee80211::Ieee80211MacTrailerSerializer:
inet::FieldsChunkSerializer inet::ChunkSerializer

Public Member Functions

 Ieee80211MacTrailerSerializer ()
 
- 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)
 

Constructor & Destructor Documentation

◆ Ieee80211MacTrailerSerializer()

inet::ieee80211::Ieee80211MacTrailerSerializer::Ieee80211MacTrailerSerializer ( )
inline
38 : FieldsChunkSerializer() {}

Member Function Documentation

◆ deserialize()

const Ptr< Chunk > inet::ieee80211::Ieee80211MacTrailerSerializer::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.

610 {
611  auto macTrailer = makeShared<Ieee80211MacTrailer>();
612  auto fcs = stream.readUint32Be();
613  macTrailer->setFcs(fcs);
614  macTrailer->setFcsMode(FCS_COMPUTED);
615  return macTrailer;
616 }

◆ serialize()

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

601 {
602  const auto& macTrailer = dynamicPtrCast<const Ieee80211MacTrailer>(chunk);
603  auto fcsMode = macTrailer->getFcsMode();
604  if (fcsMode != FCS_COMPUTED)
605  throw cRuntimeError("Cannot serialize Ieee80211FcsTrailer without properly computed FCS, try changing the value of the fcsMode parameter (e.g. in the Ieee80211Mac module)");
606  stream.writeUint32Be(macTrailer->getFcs());
607 }

The documentation for this class was generated from the following files:
inet::FCS_COMPUTED
@ FCS_COMPUTED
Definition: FcsMode_m.h:59