magpie library

Message layer: the concrete packet classes exchanged on the wire.

Import this facade to build or carry packet objects: MessagePacket is the pure pack implementation, BasePacket is the delegation base that BridgePacket / DirectPacket / ReliablePacket extend, and ReliablePacket adds the 32-byte HMAC-SHA256 attachment plus sign.

All packet classes are read-only and thread-safe to share once built.

Classes

BasePacket
Delegation base shared by all public packet classes.
BridgePacket
BridgePacket (B=1): packets exchanged with the relay server, or forwarded by the server between two clients. These packets carry target/source bids and MAY be signed (HMAC-SHA256) once a secret has been established.
DirectPacket
DirectPacket (B=0): peer-to-peer packets without relay. No target/source bids and no attachment (data integrity is the app's responsibility).
HmacSha256
HMAC-SHA-256 utility (facade for MacGenerator).
MacGenerator
Interface for computing MAC (Message Authentication Code) values, e.g. HMAC with various underlying hash algorithms.
Magpie
Core message interface. Every packet on the wire is a Magpie. All properties are read-only.
MessagePacket
The concrete, pack-only implementation of Packet.
Packet
A Magpie whose header-level flags (A/B/C/D/E) and the two lengths are visible; this is the shape MessagePacket implements.
ReliablePacket
A packet that carries a 32-byte HMAC-SHA256 attachment (verify code).