AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
ant_message_codec.h File Reference
#include <cstddef>
#include <cstdint>
#include <vector>
#include "anthocnet/core/ant_message.h"

Go to the source code of this file.

Namespaces

namespace  anthocnet
 AntHistoryTracker: (src, seqNum) duplicate detection.
 
namespace  anthocnet::core
 
namespace  anthocnet::core::codec
 

Functions

std::size_t anthocnet::core::codec::serializedSize (const AntMessage &msg)
 Number of bytes serialize() will produce for msg.
 
std::vector< std::uint8_t > anthocnet::core::codec::serialize (const AntMessage &msg)
 Encode msg into a fresh byte buffer.
 
void anthocnet::core::codec::serialize (const AntMessage &msg, std::vector< std::uint8_t > &out)
 Encode msg into out (resized to serializedSize(msg)).
 
bool anthocnet::core::codec::deserialize (const std::uint8_t *bytes, std::size_t len, AntMessage &msg)
 Decode bytes into msg.
 
bool anthocnet::core::codec::deserialize (const std::vector< std::uint8_t > &bytes, AntMessage &msg)
 

Variables

constexpr std::uint8_t anthocnet::core::codec::kWireVersion = 0x03
 On-wire format version, written at offset 0 of every frame and checked before any other field (ADR-0006).
 
constexpr std::uint16_t anthocnet::core::codec::kMaxVisitedOnWire = 100
 Protocol bounds enforced on decode of untrusted input, mirroring the Config defaults so the codec stays standalone (golden rule #5).
 
constexpr std::uint16_t anthocnet::core::codec::kMaxHistoryOnWire = 100
 retraced path ≤ path length
 
constexpr std::uint16_t anthocnet::core::codec::kMaxHelloOnWire = 64
 generous bound on adverts