mal-packet-weaver
C++20 packet serialization/deserialization library.
|
This is the main namespace for the Mal Packet Weaver library. More...
Namespaces | |
namespace | _await_future_impl |
namespace | crypto |
Classes | |
class | DerivedPacket |
A templated class representing a derived packet from the base Packet class. More... | |
class | DispatcherSession |
Represents a session with packet dispatching functionality. More... | |
class | future_failed |
class | Packet |
Base class for all packets. More... | |
class | PacketDispatcher |
The PacketDispatcher class is responsible for managing packet dispatching and handling. More... | |
class | PacketFactory |
A class responsible for registering and creating packet deserializers. More... | |
struct | PacketTypeRegistrationHelper |
Helper class for registering a packet type with the PacketFactory. More... | |
struct | PacketTypeRegistrationHelperNoexcept |
class | Session |
Represents a network session for sending and receiving packets. More... | |
class | SignalHandler |
class | timeout_exception |
Concepts | |
concept | IsPacket |
Concept to check if a given type satisfies the requirements of being a packet. | |
Typedefs | |
template<typename DerivedPacket , typename... Args> | |
using | PacketHandlerFunc = std::function<void(Args..., std::unique_ptr<DerivedPacket>)> |
Callback function type to handle packets asynchronously. | |
template<typename DerivedPacket , typename... Args> | |
using | PacketFilterFunc = std::function<bool(Args..., DerivedPacket const &)> |
Predicate function type to filter packets. | |
using | PacketSubsystemID = uint16_t |
Type alias for packet subsystem IDs. | |
using | PacketID = uint16_t |
Type alias for packet IDs. | |
using | UniquePacketID = uint32_t |
Unique identifier for a packet, combining subsystem and packet IDs. | |
using | PacketDeserializeFunc = std::function<std::unique_ptr<Packet>(const ByteView)> |
Type alias for packet deserialization function. | |
using | PacketReceiverFn = std::function<void(std::unique_ptr<Packet> &&)> |
Functions | |
template<typename T , typename Executor > | |
boost::asio::awaitable< T > | await_future (Executor &executor, std::future< T > &fut) |
template<typename T , typename ChronoType , typename Executor > | |
boost::asio::awaitable< T > | await_future (Executor &executor, std::future< T > &fut, ChronoType timeout) |
constexpr uint32_t | PacketSubsystemIDToUint32 (PacketSubsystemID subsystem_type) noexcept |
Convert a PacketSubsystemID to a uint32_t value. | |
constexpr PacketSubsystemID | UniquePacketIDToPacketSubsystemID (UniquePacketID subsystem_type) noexcept |
Extract PacketSubsystemID from a UniquePacketID. | |
constexpr PacketID | UniquePacketIDToPacketID (UniquePacketID subsystem_type) noexcept |
Extract PacketID from a UniquePacketID. | |
constexpr UniquePacketID | CreatePacketID (PacketSubsystemID subsystem_id, PacketID packet_id) noexcept |
Create a UniquePacketID from subsystem and packet IDs. | |
This is the main namespace for the Mal Packet Weaver library.
This namespace encapsulates the functionality of the Mal Packet Weaver library, which includes tools for working with packets and networking.
using mal_packet_weaver::PacketDeserializeFunc = std::function<std::unique_ptr<Packet>(const ByteView)> |
Type alias for packet deserialization function.
Definition at line 19 of file packet.hpp.
using mal_packet_weaver::PacketFilterFunc = std::function<bool(Args..., DerivedPacket const &)> |
Predicate function type to filter packets.
This function type defines the signature for packet filter functions that accept a set of arguments followed by a const reference to a derived packet type and return a boolean indicating whether the packet should be filtered or not.
DerivedPacket | The derived packet type. |
Args | Additional argument types. |
Definition at line 30 of file packet-dispatcher.hpp.
using mal_packet_weaver::PacketHandlerFunc = std::function<void(Args..., std::unique_ptr<DerivedPacket>)> |
Callback function type to handle packets asynchronously.
This function type defines the signature for packet handler functions that accept a set of arguments followed by a unique pointer to a derived packet type and return an awaitable boost::asio task.
DerivedPacket | The derived packet type. |
Args | Additional argument types. |
Definition at line 17 of file packet-dispatcher.hpp.
using mal_packet_weaver::PacketID = uint16_t |
Type alias for packet IDs.
Definition at line 13 of file packet.hpp.
using mal_packet_weaver::PacketReceiverFn = std::function<void(std::unique_ptr<Packet> &&)> |
Definition at line 7 of file session.hpp.
using mal_packet_weaver::PacketSubsystemID = uint16_t |
Type alias for packet subsystem IDs.
Definition at line 12 of file packet.hpp.
using mal_packet_weaver::UniquePacketID = uint32_t |
Unique identifier for a packet, combining subsystem and packet IDs.
Definition at line 16 of file packet.hpp.
boost::asio::awaitable< T > mal_packet_weaver::await_future | ( | Executor & | executor, |
std::future< T > & | fut ) |
Definition at line 118 of file common.hpp.
boost::asio::awaitable< T > mal_packet_weaver::await_future | ( | Executor & | executor, |
std::future< T > & | fut, | ||
ChronoType | timeout ) |
|
constexprnoexcept |
Create a UniquePacketID from subsystem and packet IDs.
Definition at line 40 of file packet.hpp.
|
constexprnoexcept |
Convert a PacketSubsystemID to a uint32_t value.
Definition at line 22 of file packet.hpp.
|
constexprnoexcept |
Extract PacketID from a UniquePacketID.
Definition at line 34 of file packet.hpp.
|
constexprnoexcept |
Extract PacketSubsystemID from a UniquePacketID.
Definition at line 28 of file packet.hpp.