cstruct

AuthorsAnil Madhavapeddy, Richard Mortier, Thomas Gazagnaire, Pierre Chambart, David Kaloper, Jeremy Yallop, David Scott and Mindy Preston
LicenseISC
Homepagehttps://github.com/mirage/ocaml-cstruct
Issue Trackerhttps://github.com/mirage/ocaml-cstruct/issues
Tagsorg:mirage, org:ocamllabs and org:xapi-project
Maintaineranil@recoil.org
Dependencies
&base-bytes
ocaml-migrate-parsetree
ocamlfind
ocplib-endian
ounit
ppx_tools_versioned
sexplib
Optional dependencies
|async
base-unix
lwt
Availableocaml-version >= "4.02.3"
PublishedMar 28, 2017
Source [http] https://github.com/mirage/ocaml-cstruct/archive/v2.3.3.tar.gz
5290fd81b9b4393a6771612b2d8e885a
StatisticsInstalled 103times in last month.
Edithttps://github.com/ocaml/opam-repository/tree/master/packages/cstruct/cstruct.2.3.3/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 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

Necessary for
angstrom
arakoon
&>= 1.8.6
1.8.12
arp
asn1-combinators
>= 0.1.2
channel
charrua-client
charrua-core
>= 0.3
charrua-unix
>= 0.6
cohttp
&>= 0.9.7
0.10.0
conduit
>= 0.6.0
conex
cowabloga
>= 0.0.5
crc
crunch
>= 2.0.0
datakit
datakit-client
datakit-server
decompress
&>= 0.3
0.4
depyt
dns
>= 0.18.0
dns-forward
fat-filesystem
>= 0.11.0
frenetic
|2.0.0
>= 3.2.0
hex
>= 0.2.0
hkdf
hvsock
io-page
io-page-unix
io-page-xen
irmin
>= 0.9.0
irmin-indexeddb
>= 0.3
key-parsers
>= 0.5.0
launchd
mirage
|&>= 0.7.2
0.9.0
&>= 0.10.0
2.4.0
mirage-block
1.0.0
mirage-block-ccm
mirage-block-lwt
mirage-block-ramdisk
mirage-block-solo5
mirage-block-unix
mirage-block-xen
>= 1.4.0
mirage-btrees
mirage-channel-lwt
mirage-clock-unix
1.0.0
mirage-clock-xen
1.0.0
mirage-console-lwt
mirage-console-solo5
>= 0.2.0
mirage-console-unix
>= 2.2.0
mirage-console-xen-cli
mirage-dns
2.6.1
mirage-entropy
mirage-entropy-unix
mirage-entropy-xen
mirage-flow
1.2.0
mirage-flow-lwt
mirage-flow-unix
mirage-fs
&>= 0.4.0
1.0.0
mirage-fs-lwt
mirage-fs-unix
mirage-kv-lwt
mirage-net
&>= 0.5.2
0.9.1
mirage-net-fd
mirage-net-lwt
mirage-net-macosx
mirage-net-solo5
mirage-net-unix
|2.1.0
>= 2.2.1
mirage-net-xen
|1.4.2
>= 1.5.0
mirage-profile
>= 0.7.0
mirage-protocols-lwt
mirage-qubes
mirage-random
mirage-solo5
mirage-stack-lwt
mirage-tc
mirage-tcpip-unix
mirage-tcpip-xen
mirage-types-lwt
mirage-unix
|0.9.4
>= 2.5.0
mirage-vnetif
mirage-www
|0.4.0
>= 1.1.0
mirage-xen
|2.0.0
>= 2.6.0
mstruct
nbd
>= 2.1.0
nocrypto
openflow
0.2.0
otr
>= 0.3.1
ox
1.1.1
pbkdf
pcap-format
>= 0.4.0
protocol-9p
|0.5.1
>= 0.6.0
protocol-9p-unix
qcow
qcow-format
randomconv
rawlink
>= 0.4
rfc6287
>= 1.0.2
salsa20-core
scrypt-kdf
shared-block-ring
shared-memory-ring
>= 1.2.0
tar-format
>= 0.5.0
tcpip
|2.3.0
>= 2.7.0
tls
>= 0.7.1
vchan
>= 2.1.0
vhd-format
>= 0.8.0
vhd-tool
vmnet
>= 1.1.0
x509
xapi-rrd-transport
xe
xen-api-client
>= 0.9.6
xen-block-driver
>= 0.2.5
xen-gnt
xenstore
>= 1.3.0
Optional for
frenetic
&>= 2.0.0
3.2.0
logs-syslog
mirage-types
&>= 1.1.0
3.0.0
stog
&>= 0.13.0
0.15.0