cstruct

AuthorAnil Madhavapeddy
LicenseISC
Homepagehttps://github.com/mirage/ocaml-cstruct
Tagsorg:mirage and org:xapi-project
Maintaineranil@recoil.org
Dependencies
&camlp4
ocamlbuild
ocamlfind
ocplib-endian
Optional dependencies
|async
lwt
Availableocaml-version < "4.06.0"
PublishedOct 14, 2013
Source [http] https://github.com/mirage/ocaml-cstruct/archive/v0.8.0.tar.gz
c8b57db67fb69ddef2cebbf443353ece
StatisticsNot installed in the last month.
Edithttps://github.com/ocaml/opam-repository/tree/master/packages/cstruct/cstruct.0.8.0/opam

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 is:

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