oa_gateway_owp

Module codec

Source
Expand description

OWP 1.0 text-frame codec. Grammar follows OMSC-SPC-013; no UCI types.

A frame is a keyword plus space-or-tab separated fields. JSON payloads (INIT, INFO, PUB) keep their spaces: the first token is the field, the rest of the line is the payload. This module does not compile a schema or convert XML.

StructsΒ§

EnumsΒ§

  • A parsed client frame.
  • Protocol error name carried on -ERR.
  • Why a frame could not be parsed.
  • A parsed server frame, or one about to be written.

FunctionsΒ§

  • is_delim πŸ”’
    Space or tab. Newlines are not delimiters; a frame is one line.
  • Whether s is an OWP identifier: ^[A-Za-z0-9_\-.]+$.
  • Parses one client text frame (INIT, PUB, SUB, UNSUB).
  • parse_init πŸ”’
  • parse_pub πŸ”’
  • Parses one server text frame (+OK, -ERR, INFO, MSG).
  • parse_sub πŸ”’
  • parse_unsub πŸ”’
  • First non-delimiter run and the remainder, with leading delimiters stripped from the remainder. None if s is only delimiters.
  • tokenize πŸ”’
    Up to max tokens. Leftover text after max is dropped, so the caller must treat len == max as β€œmaybe more” when extra fields are illegal.
  • Returns the single root key of an OMS JSON object.