moldudp.hpp
1#pragma once2#include "itch/feed/itch/event.hpp"3#include <cstddef>4#include <cstdint>5#include <string>6#include <vector>78namespace itch {9/** A structurally validated MoldUDP64 datagram; boundary is exclusive. */10struct MoldDatagram {11 uint64_t sequence;12 uint64_t boundary;13 bool ending;14 std::vector<Bytes> messages;15};1617/** Parse and validate a whole datagram before the caller changes sequence/book state.18 * Heartbeats and end markers carry no payload. ITCH validation uses the existing decoder.19 * Caller must supply length readable bytes; expected_session must contain exactly ten bytes.20 * @throws std::runtime_error for a wrong session, malformed framing, overflow or invalid ITCH.21 */22MoldDatagram parse_moldudp64(const unsigned char* packet, size_t length,23 const std::string& expected_session);24} // namespace itch