template<bool streaming>
aes70::parser_impl class

Template parameters
streaming - If true, the parser supports streaming, i.e. parsing parts of messages instead of waiting for a full message to arrive. Streaming mode can reduce the memory requirements in network buffers.

Contents

This class implemented parsing of AES70 protocol data units. It can be used both in streaming and non-streaming mode.

Public functions

auto operator!() const -> bool
template<typename... Functions>
auto parse(const uint8_t* src, const uint8_t* src_end, Functions && ... continuations) -> const uint8_t*
template<typename... Functions>
auto parse_message(const uint8_t* src, const uint8_t* src_end, Functions && ... continuations) -> const uint8_t*
template<typename... Functions>
auto parse_streaming(bool allow_streaming, const uint8_t* src, const uint8_t* src_end, Functions && ... continuations) -> const uint8_t*

Function documentation

template<boolstreaming>
bool aes70::parser_impl<streaming>::operator!() const

Returns true if the parser is in the error state.

template<boolstreaming> template<typename... Functions>
const uint8_t* aes70::parser_impl<streaming>::parse(const uint8_t* src, const uint8_t* src_end, Functions && ... continuations)

Parameters
src - Pointer to the first byte to parse.
src_end - Pointer to one byte after the last byte to parse.
continuations - Handler functions for the different PDU types as defined above.

Parse a chunk of data. Calls the continuation functions for the different PDU types. The signature of the continuation functions should be equivalent to:

bool handle_command(const aes70::OCP1::Command &pdu, const uint8_t *src, const uint8_t *src_end); bool handle_response(const aes70::OCP1::Response &pdu, const uint8_t *src, const uint8_t *src_end); bool handle_notification(const aes70::OCP1::Notification &pdu, const uint8_t *src, const uint8_t *src_end); bool handle_keepalive(const aes70::OCP1::KeepAlive &pdu);

If a PDU is received for which no continuation function has been given, the parser goes into the error state. If c continuation returns false, the parser does into the error state.

template<boolstreaming> template<typename... Functions>
const uint8_t* aes70::parser_impl<streaming>::parse_message(const uint8_t* src, const uint8_t* src_end, Functions && ... continuations)

Same as parse(), except that streaming is explicitly disabled. If inside of [ src ... src_end ) a truncated message is encountered, the parser will enter the error state.

template<boolstreaming> template<typename... Functions>
const uint8_t* aes70::parser_impl<streaming>::parse_streaming(bool allow_streaming, const uint8_t* src, const uint8_t* src_end, Functions && ... continuations)

Same as parse(), except that streaming is explicitly enabled or disabled based on the first argument.