package sslconf

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

Sslconf buffer.

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

  • Per-buffer memory allocation is limited to 2**nbits-1.
  • A buffer has a desired length, which is null byte initialized.
  • Buffer memory allocation is 4/3 times desired length.

from Openssl: buffer.h buffer.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.