Module Sslconf.Buf

Sslconf buffer.

This implements Openssl's buffer allocation policy in an OCaml runtime.

from Openssl: buffer.hbuffer.c

An Sslconf buffer supports an underlying Bytes.t buffer. empty nbits is the constructor. Max allocated size is 2**nbits-1 bytes. A good default nbits value is 31. length bytes are expected, These bytes are initialized to a null value. Dynamic allocated size is (floor((length + 3) / 3) * 4) bytes.

type t

Buffer type.

val empty : int ‑> t

empty nbits creates an empty buffer.

val data : t ‑> Bytes.t

data buf returns the underlying Bytes.t buffer.

val extend : t ‑> int ‑> (t, string * int * int * int) Rresult.result

extend buf length extends buf to support length bytes. Ok buf or Error (msg length nbits allocation_limit) is returned. New bytes up to Bytes.length (Buf.data buf) are initialized to null. An error occurs, and no allocation is done, if length would cause an allocation greater than buffer max allocated size.