Polymorphic wire packet: opcode + payload hook.
More...
#include <StormByte/network/transport/packet.hxx>
|
| using | OpcodeType = unsigned short |
| | Opcode storage type.
|
| |
|
| static constexpr unsigned short | PROCESS_THRESHOLD = 10 |
| | Opcodes at or above this value run payload through Buffer pipelines when framing.
|
| |
|
| constexpr | Packet (const OpcodeType &opcode) noexcept |
| | Construct with an opcode.
|
| |
| virtual Buffer::DataType | DoSerialize () const noexcept=0 |
| | Payload-only serialization (no opcode).
|
| |
Polymorphic wire packet: opcode + payload hook.
Derive and override DoSerialize() for the payload (excluding opcode). Serialize() writes opcode then payload.
Opcodes must fit OpcodeType (unsigned short).
◆ OpcodeType
◆ Packet() [1/3]
| StormByte::Network::Transport::Packet::Packet |
( |
const Packet & |
other | ) |
|
|
default |
◆ Packet() [2/3]
| StormByte::Network::Transport::Packet::Packet |
( |
Packet && |
other | ) |
|
|
defaultnoexcept |
◆ ~Packet()
| virtual StormByte::Network::Transport::Packet::~Packet |
( |
| ) |
|
|
virtualdefaultnoexcept |
◆ Packet() [3/3]
| constexpr StormByte::Network::Transport::Packet::Packet |
( |
const OpcodeType & |
opcode | ) |
|
|
inlineconstexprprotectednoexcept |
Construct with an opcode.
- Parameters
-
◆ DoSerialize()
| virtual Buffer::DataType StormByte::Network::Transport::Packet::DoSerialize |
( |
| ) |
const |
|
protectedpure virtualnoexcept |
Payload-only serialization (no opcode).
- Returns
- Payload bytes (may be empty).
◆ Opcode()
| const OpcodeType & StormByte::Network::Transport::Packet::Opcode |
( |
| ) |
const |
|
inlinenoexcept |
Stored opcode.
- Returns
- Opcode.
◆ operator=() [1/2]
| Packet & StormByte::Network::Transport::Packet::operator= |
( |
const Packet & |
other | ) |
|
|
default |
◆ operator=() [2/2]
| Packet & StormByte::Network::Transport::Packet::operator= |
( |
Packet && |
other | ) |
|
|
defaultnoexcept |
◆ Serialize()
| Buffer::FIFO StormByte::Network::Transport::Packet::Serialize |
( |
| ) |
const |
|
noexcept |
Serialize opcode followed by DoSerialize() payload.
- Returns
- Complete on-wire buffer.
◆ m_opcode
| OpcodeType StormByte::Network::Transport::Packet::m_opcode |
|
protected |
◆ PROCESS_THRESHOLD
| constexpr unsigned short StormByte::Network::Transport::Packet::PROCESS_THRESHOLD = 10 |
|
staticconstexpr |
Opcodes at or above this value run payload through Buffer pipelines when framing.
The documentation for this class was generated from the following file: