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

Converts between PppTrailer and binary (network byte order) Ppp trailer. More...

#include <PppHeaderSerializer.h>

Inheritance diagram for inet::PppTrailerSerializer:
inet::FieldsChunkSerializer inet::ChunkSerializer

Public Member Functions

 PppTrailerSerializer ()
 
- 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 PppTrailer and binary (network byte order) Ppp trailer.

Constructor & Destructor Documentation

◆ PppTrailerSerializer()

inet::PppTrailerSerializer::PppTrailerSerializer ( )
inline
38 : FieldsChunkSerializer() {}

Member Function Documentation

◆ deserialize()

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

45 {
46  auto pppTrailer = makeShared<PppTrailer>();
47  pppTrailer->setFcs(stream.readUint16Be());
48 // pppTrailer->setFlag(stream.readUint8()); //KLUDGE length is currently 2 bytes instead of 3 bytes
49  return pppTrailer;
50 }

◆ serialize()

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

38 {
39  const auto& pppTrailer = staticPtrCast<const PppTrailer>(chunk);
40  stream.writeUint16Be(pppTrailer->getFcs());
41 // stream.writeUint8(pppTrailer->getFlag()); //KLUDGE length is currently 2 bytes instead of 3 bytes
42 }

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