BinaryTokenizer.cc
Go to the documentation of this file.
30std::ostream &
82Parser::BinaryTokenizer::got(const Ip::Address &value, uint64_t size, const char *description) const
#define BinaryTokenizer_tail(size, start)
debugging helper that prints a "standard" debugs() trailer
Definition: BinaryTokenizer.cc:39
static std::ostream & operator<<(std::ostream &os, const Parser::BinaryTokenizerContext *context)
Definition: BinaryTokenizer.cc:31
Definition: Address.h:41
enables efficient debugging with concise field names: Hello.version.major
Definition: BinaryTokenizer.h:23
const BinaryTokenizerContext *const parent
enclosing context or nullptr
Definition: BinaryTokenizer.h:36
Definition: BinaryTokenizer.h:47
SBuf area(uint64_t size, const char *description)
parse size consecutive bytes as an opaque blob
Definition: BinaryTokenizer.cc:168
Ip::Address inet4(const char *description)
interpret the next 4 bytes as a raw in_addr structure
Definition: BinaryTokenizer.cc:192
void got(uint64_t size, const char *description) const
debugging helper for parsed multi-field structures
Definition: BinaryTokenizer.cc:56
SBuf pstring8(const char *description)
up to 255 byte-long p-string
Definition: BinaryTokenizer.cc:217
void commit()
make progress: future parsing failures will not rollback beyond this point
Definition: BinaryTokenizer.cc:120
void skip(uint64_t size, const char *description)
ignore the next size bytes
Definition: BinaryTokenizer.cc:204
void reset(const SBuf &data, const bool expectMore)
Definition: BinaryTokenizer.cc:108
uint32_t uint32(const char *description)
parse a four-byte unsigned integer
Definition: BinaryTokenizer.cc:159
uint32_t uint24(const char *description)
parse a three-byte unsigned integer (returned as uint32_t)
Definition: BinaryTokenizer.cc:150
void want(uint64_t size, const char *description) const
logs and throws if fewer than size octets remain; no other side effects
Definition: BinaryTokenizer.cc:45
uint16_t uint16(const char *description)
parse a two-byte unsigned integer
Definition: BinaryTokenizer.cc:141
void rollback()
resume [incremental] parsing from the last commit point
Definition: BinaryTokenizer.cc:114
Ip::Address inet6(const char *description)
interpret the next 16 bytes as a raw in6_addr structure
Definition: BinaryTokenizer.cc:198
uint8_t uint8(const char *description)
parse a single-byte unsigned integer
Definition: BinaryTokenizer.cc:132
void skipped(uint64_t size, const char *description) const
debugging helper for skipped fields
Definition: BinaryTokenizer.cc:90
Ip::Address inetAny(const char *description)
Definition: BinaryTokenizer.cc:179
SBuf pstring24(const char *description)
up to 16 MiB-long p-string!
Definition: BinaryTokenizer.cc:235
thrown by modern "incremental" parsers when they need more data
Definition: forward.h:18