package binsec

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

Basic stream reader

type byte = int
type t
Constructors
val create : ?endianness:Machine.endianness -> ?at:int -> ('a -> int -> byte) -> 'a -> t
val of_img : ?endianness:Machine.endianness -> ?at:int -> Loader.Img.t -> t
val of_zero_extend_buffer : ?endianness:Machine.endianness -> ?at:int -> Loader_buf.t -> t
val of_nibbles : ?endianness:Machine.endianness -> ?at:int -> string -> t
val of_bytes : ?endianness:Machine.endianness -> ?at:int -> string -> t
val of_binstream : ?endianness:Machine.endianness -> ?at:int -> Binstream.t -> t
Pretty-printer
val pp : Stdlib.Format.formatter -> t -> unit
Generic manipulation functions
val get_pos : t -> int
val rewind : t -> int -> unit

rewind r n moves back the cursor n bytes.

val advance : t -> int -> unit

advance r n moves the cursor the cursor n bytes.

val set_endianness : t -> Machine.endianness -> unit

set_endianness e r sets reader to report value w.r.t to endianness r

Read functions
module type Accessor = sig ... end
module Read : Accessor with type t := t

Accessor functions of module Read read n=1, 2, 4, or 8 bytes and advance n bytes as well.

module Peek : Accessor with type t := t

Peek is like Read but does not advance

val get_slice : t -> lo:int -> hi:int -> bytes

get_slice t ~lo ~hi returns the bytes contained in the interval from [lo, hi].

  • raises Invalid_argument

    if lo > hi

OCaml

Innovation. Community. Security.