cstructversion

access C structures via a camlp4 extension

Cstruct is a library and syntax extension to make it easier to access C-like structures directly from OCaml. It supports both reading and writing to these structures, and they are accessed via the Bigarray module.

An example pcap description using PPX extension points is:

[%%cstruct
type pcap_header = {
  magic_number: uint32_t;   (* magic number *)
  version_major: uint16_t;  (* major version number *)
  version_minor: uint16_t;  (* minor version number *)
  thiszone: uint32_t;       (* GMT to local correction *)
  sigfigs: uint32_t;        (* accuracy of timestamps *)
  snaplen: uint32_t;        (* max length of captured packets, in octets *)
  network: uint32_t;        (* data link type *)
} [@@little_endian]]

For Camlp4 support, please use a version of Cstruct that is <=1.9.0

Tags org:mirage org:ocamllabs org:xapi-project
AuthorsAnil Madhavapeddy, Richard Mortier, Thomas Gazagnaire, Pierre Chambart, David Kaloper, Jeremy Yallop, David Scott and Mindy Preston
LicenseISC
Published
Homepagehttps://github.com/mirage/ocaml-cstruct
Issue Trackerhttps://github.com/mirage/ocaml-cstruct/issues
Maintaineranil@recoil.org
Dependencies
Optional dependencies
Conflicts
Source [http] https://github.com/mirage/ocaml-cstruct/archive/v2.4.1.tar.gz
sha256=f3c1600e85eb93a58c052e2e9575b48d4dd02784d9b2615dadf861860afa1ee7
md5=e058a3db193f5fd4706db62a19ed3b98
Edithttps://github.com/ocaml/opam-repository/tree/master/packages/cstruct/cstruct.2.4.1/opam
Required by
Optionally used by