package xenstore

  1. Overview
  2. Docs

Incrementally parse packets.

val allow_oversize_packets : bool Pervasives.ref
type state =
  1. | Unknown_operation of int32
    (*

    received an unexpected message type

    *)
  2. | Parser_failed of string
    (*

    we failed to parse a header

    *)
  3. | Need_more_data of int
    (*

    we still need 'n' bytes

    *)
  4. | Packet of t
    (*

    successfully decoded a packet

    *)
type parse

The internal state of the parser.

val start : unit -> parse

Create a parser set to the initial state.

val state : parse -> state

Query the state of the parser.

val input : parse -> string -> parse

Input some bytes into the parser. Must be no more than needed (see Need_more_data above).

OCaml

Innovation. Community. Security.