Converts between EthernetPhyHeader and binary (network byte order) Ethernet PHY header.
More...
#include <EthernetPhyHeaderSerializer.h>
Converts between EthernetPhyHeader and binary (network byte order) Ethernet PHY header.
◆ EthernetPhyHeaderSerializer()
| inet::physicallayer::EthernetPhyHeaderSerializer::EthernetPhyHeaderSerializer |
( |
| ) |
|
|
inline |
42 : FieldsChunkSerializer() {}
◆ deserialize()
| const Ptr< Chunk > inet::physicallayer::EthernetPhyHeaderSerializer::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.
48 auto header = makeShared<EthernetPhyHeader>();
49 bool preambleReadSuccessfully = stream.readByteRepeatedly(0x55,
B(
PREAMBLE_BYTES).get());
50 uint8_t sfd = stream.readByte();
51 if (!preambleReadSuccessfully || sfd != 0xD5) {
52 header->markIncorrect();
53 header->markImproperlyRepresented();
Referenced by inet::physicallayer::EthernetPhyHeaderBaseSerializer::deserialize().
◆ serialize()
| void inet::physicallayer::EthernetPhyHeaderSerializer::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.
43 stream.writeByte(0xD5);
◆ EthernetPhyHeaderBaseSerializer
| friend inet::physicallayer::EthernetPhyHeaderSerializer::EthernetPhyHeaderBaseSerializer |
|
private |
The documentation for this class was generated from the following files: