package binsec

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

Generic representation of loader buffers

Thanks to def-lkb for the general idea: https://github.com/def-lkb/owee

exception Invalid_format of string

Minimal support for error reporting.

val invalid_format : string -> 'a
val assert_format : bool -> string -> unit
module type S = sig ... end
module type Bufferable = sig ... end
module Make (B : Bufferable) : S with type t = B.t
module type W = sig ... end
module type Writable = sig ... end
module Wake (W : Writable) : W with type t = W.t
include W with type t = (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
include S with type t = (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val dim : t -> int

Size of the buffer.

type cursor = private {
  1. buffer : t;
  2. endian : Machine.endianness;
  3. mutable position : int;
}

A mutable cursor, pointing to an arbitrary position of a buffer.

val cursor : ?at:int -> Machine.endianness -> t -> cursor
val seek : cursor -> int -> unit
val ensure : cursor -> int -> string -> unit
val advance : cursor -> int -> unit
val at_end : cursor -> bool
module Peek : sig ... end
module Read : sig ... end
module Write : sig ... end
val sub : cursor -> int -> cursor

sub t len returns a fresh cursor pointing to the beginning of a sub-buffer * of size len starting from t, and advances t by len.

val read : ?signed:bool -> [ `x32 | `x64 ] -> cursor -> int