Module Xs_protocol.Parser

Incrementally parse packets.

val allow_oversize_packets : bool Stdlib.ref
type state =
| Unknown_operation of int32

received an unexpected message type

| Parser_failed of string

we failed to parse a header

| Need_more_data of int

we still need 'n' bytes

| 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).