mal-packet-weaver
C++20 packet serialization/deserialization library.
Loading...
Searching...
No Matches
mal_packet_weaver Namespace Reference

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.
 

Detailed Description

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.

Typedef Documentation

◆ PacketDeserializeFunc

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.

◆ PacketFilterFunc

template<typename DerivedPacket , typename... Args>
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.

Template Parameters
DerivedPacketThe derived packet type.
ArgsAdditional argument types.

Definition at line 30 of file packet-dispatcher.hpp.

◆ PacketHandlerFunc

template<typename DerivedPacket , typename... Args>
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.

Template Parameters
DerivedPacketThe derived packet type.
ArgsAdditional argument types.

Definition at line 17 of file packet-dispatcher.hpp.

◆ PacketID

using mal_packet_weaver::PacketID = uint16_t

Type alias for packet IDs.

Definition at line 13 of file packet.hpp.

◆ PacketReceiverFn

using mal_packet_weaver::PacketReceiverFn = std::function<void(std::unique_ptr<Packet> &&)>

Definition at line 7 of file session.hpp.

◆ PacketSubsystemID

Type alias for packet subsystem IDs.

Definition at line 12 of file packet.hpp.

◆ UniquePacketID

Unique identifier for a packet, combining subsystem and packet IDs.

Definition at line 16 of file packet.hpp.

Function Documentation

◆ await_future() [1/2]

template<typename T , typename Executor >
boost::asio::awaitable< T > mal_packet_weaver::await_future ( Executor & executor,
std::future< T > & fut )

Definition at line 118 of file common.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ await_future() [2/2]

template<typename T , typename ChronoType , typename Executor >
boost::asio::awaitable< T > mal_packet_weaver::await_future ( Executor & executor,
std::future< T > & fut,
ChronoType timeout )

Definition at line 124 of file common.hpp.

Here is the call graph for this function:

◆ CreatePacketID()

UniquePacketID mal_packet_weaver::CreatePacketID ( PacketSubsystemID subsystem_id,
PacketID packet_id )
constexprnoexcept

Create a UniquePacketID from subsystem and packet IDs.

Definition at line 40 of file packet.hpp.

◆ PacketSubsystemIDToUint32()

uint32_t mal_packet_weaver::PacketSubsystemIDToUint32 ( PacketSubsystemID subsystem_type)
constexprnoexcept

Convert a PacketSubsystemID to a uint32_t value.

Definition at line 22 of file packet.hpp.

◆ UniquePacketIDToPacketID()

PacketID mal_packet_weaver::UniquePacketIDToPacketID ( UniquePacketID subsystem_type)
constexprnoexcept

Extract PacketID from a UniquePacketID.

Definition at line 34 of file packet.hpp.

◆ UniquePacketIDToPacketSubsystemID()

PacketSubsystemID mal_packet_weaver::UniquePacketIDToPacketSubsystemID ( UniquePacketID subsystem_type)
constexprnoexcept

Extract PacketSubsystemID from a UniquePacketID.

Definition at line 28 of file packet.hpp.

Here is the caller graph for this function: