package bin_prot

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Bin_prot.CommonSource

Common definitions used by binary protocol converters

Buffers

Sourcetype pos = int

Position within buffers

Sourcetype pos_ref = pos ref

Reference to a position within buffers

Sourceval create_buf : int -> buf

create_buf n creates a buffer of size n.

Sourceval buf_len : buf -> int

buf_len buf returns the length of buf.

Sourceval assert_pos : pos -> unit

assert_pos pos

Sourceval check_pos : buf -> pos -> unit

check_pos buf pos

  • raises Buffer_short

    if position pos is past the end of buffer buf.

Sourceval check_next : buf -> pos -> unit

check_next buf pos

  • raises Buffer_short

    if the next position after pos is past the end of buffer buf.

Sourceval safe_get_pos : buf -> pos_ref -> pos

safe_get_pos buf pos_ref

  • returns

    the position referenced by pos_ref within buffer buf.

    @raise Buffer_short

    if the position is past the end of the buffer buf.

Sourceval blit_string_buf : ?src_pos:int -> string -> ?dst_pos:int -> buf -> len:int -> unit

blit_string_buf ?src_pos src ?dst_pos dst ~len blits len bytes of the source string src starting at position src_pos to buffer dst starting at position dst_pos.

Sourceval blit_bytes_buf : ?src_pos:int -> bytes -> ?dst_pos:int -> buf -> len:int -> unit

blit_bytes_buf ?src_pos src ?dst_pos dst ~len blits len bytes of the source byte sequence src starting at position src_pos to buffer dst starting at position dst_pos.

Sourceval blit_buf_string : ?src_pos:int -> buf -> ?dst_pos:int -> bytes -> len:int -> unit

blit_buf_string ?src_pos src ?dst_pos dst ~len blits len bytes of the source buffer src starting at position src_pos to string dst starting at position dst_pos.

Sourceval blit_buf_bytes : ?src_pos:int -> buf -> ?dst_pos:int -> bytes -> len:int -> unit

blit_buf_bytes ?src_pos src ?dst_pos dst ~len blits len bytes of the source buffer src starting at position src_pos to byte sequence dst starting at position dst_pos.

Sourceval blit_buf : ?src_pos:int -> src:buf -> ?dst_pos:int -> dst:buf -> int -> unit

blit_buf ?src_pos ~src ?dst_pos ~dst len blits len bytes of the source buffer src starting at position src_pos to destination buffer dst starting at position dst_pos.

Errors and exceptions

Sourceexception Buffer_short

Buffer too short for read/write operation

Sourceexception No_variant_match

Used internally for backtracking

Sourcemodule ReadError : sig ... end
Sourceexception Read_error of ReadError.t * pos

ReadError (err, err_pos)

Sourceexception Poly_rec_write of string

PolyRecWrite type gets raised when the user attempts to write or estimate the size of a value of a type that is bound through a polymorphic record field in type definition type.

Sourceexception Empty_type of string

EmptyType gets raised when the user attempts to write or estimate the size of a value of an empty type, which would not make sense.

Sourceval raise_read_error : ReadError.t -> pos -> 'a

raise_read_error err pos

Sourceval raise_variant_wrong_type : string -> pos -> 'a

raise_variant_wrong_type name pos

Sourceval raise_concurrent_modification : string -> 'a

raise_concurrent_modification loc

  • raises Failure

    if a binary writer detects a concurrent change to the underlying data structure.

Sourceval array_bound_error : unit -> 'a

array_bound_error ()

Bigarrays

Sourcetype vec = vec64
Sourcetype mat = mat64

Miscellaneous

Sourceval copy_htbl_list : ('a, 'b) Hashtbl.t -> ('a * 'b) list -> ('a, 'b) Hashtbl.t

copy_htbl_list htbl lst adds all (key, value) pairs in lst to hash table htbl.

NOTE: unsafe functions!!!

Sourceval unsafe_blit_buf : src_pos:int -> src:buf -> dst_pos:int -> dst:buf -> len:int -> unit
Sourceval unsafe_blit_string_buf : src_pos:int -> string -> dst_pos:int -> buf -> len:int -> unit
Sourceval unsafe_blit_bytes_buf : src_pos:int -> bytes -> dst_pos:int -> buf -> len:int -> unit
Sourceval unsafe_blit_buf_string : src_pos:int -> buf -> dst_pos:int -> bytes -> len:int -> unit
Sourceval unsafe_blit_buf_bytes : src_pos:int -> buf -> dst_pos:int -> bytes -> len:int -> unit
Sourceval unsafe_blit_float_array_buf : src_pos:int -> float array -> dst_pos:int -> buf -> len:int -> unit
Sourceval unsafe_blit_buf_float_array : src_pos:int -> buf -> dst_pos:int -> float array -> len:int -> unit
Sourceval unsafe_blit_floatarray_buf : src_pos:int -> floatarray -> dst_pos:int -> buf -> len:int -> unit
Sourceval unsafe_blit_buf_floatarray : src_pos:int -> buf -> dst_pos:int -> floatarray -> len:int -> unit
Sourceval (+) : int -> int -> int
OCaml

Innovation. Community. Security.