cstruct

AuthorsAnil Madhavapeddy, Richard Mortier, Thomas Gazagnaire, Pierre Chambart, David Kaloper, Jeremy Yallop and Hannes Mehnert
LicenseISC
Homepagehttps://github.com/mirage/ocaml-cstruct
Issue Trackerhttps://github.com/mirage/ocaml-cstruct/issues
Tagsorg:mirage and org:xapi-project
Maintaineranil@recoil.org
Dependencies
&base-bytes
conf-time
ocamlfind
ocplib-endian
ounit
sexplib
type_conv
Optional dependencies
|async
base-unix
camlp4
lwt
ppx_tools
Availableocaml-version >= "4.01.0" & ocaml-version < "4.03.0"
PublishedFeb 19, 2016
Source [http] https://github.com/mirage/ocaml-cstruct/archive/v1.9.0.tar.gz
59b512261058e1fe649d10d6ac268285
StatisticsInstalled 52 times last month.
Edithttps://github.com/ocaml/opam-repository/tree/master/packages/cstruct/cstruct.1.9.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 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]]

An example pcap description using Camlp4 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
Necessary for
angstrom
arakoon
&>= 1.8.6
1.8.12
asn1-combinators
>= 0.1.2
channel
charrua-client
0.9
charrua-core
0.8
charrua-unix
|0.3
&>= 0.6
0.9
cohttp
&>= 0.9.7
0.10.0
conduit
&>= 0.6.0
0.15.2
conex
cowabloga
>= 0.0.5
crc
crunch
>= 2.0.0
cstruct-lwt
3.0.0
cstruct-unix
3.0.0
datakit-client
0.9.0
datakit-server
0.9.0
decompress
&>= 0.3
0.4
depyt
dns
&>= 0.15.0
0.19.0
fat-filesystem
0.11.0
frenetic
|2.0.0
>= 3.2.0
github-hooks
>= 0.2.0
hex
>= 0.2.0
hkdf
hvsock
1.0.0
io-page
2.0.0
io-page-unix
2.0.0
io-page-xen
2.0.0
irmin
>= 0.9.0
irmin-indexeddb
>= 0.3
iso-filesystem
key-parsers
>= 0.5.0
launchd
mbr-format
mirage
|&>= 0.7.2
0.9.1
&>= 0.10.0
2.4.0
mirage-block
1.0.0
mirage-block-ccm
mirage-block-ramdisk
mirage-block-solo5
mirage-block-unix
2.8.3
mirage-block-xen
mirage-btrees
mirage-channel-lwt
mirage-clock-unix
1.0.0
mirage-clock-xen
1.0.0
mirage-conduit
&>= 2.3.1
3.0.0
mirage-console-lwt
mirage-console-solo5
>= 0.2.0
mirage-console-unix
2.3.2
mirage-console-xen-cli
mirage-dns
2.6.0
mirage-entropy
mirage-entropy-unix
mirage-entropy-xen
mirage-flow
1.2.0
mirage-fs
&>= 0.4.0
1.0.0
mirage-fs-lwt
mirage-fs-unix
mirage-kv-lwt
mirage-nat
mirage-net
&>= 0.5.2
0.9.1
mirage-net-fd
0.2.1
mirage-net-lwt
mirage-net-macosx
mirage-net-solo5
mirage-net-unix
2.4.1
mirage-net-xen
1.7.0
mirage-profile
0.8.0
mirage-protocols-lwt
mirage-qubes
mirage-qubes-ipv4
mirage-random
mirage-solo5
mirage-stack-lwt
1.1.0
mirage-tc
mirage-tcpip-unix
mirage-tcpip-xen
mirage-types-lwt
mirage-unix
mirage-vnetif
0.4.0
mirage-www
|0.4.0
>= 1.1.0
mirage-xen
|2.0.0
>= 2.3.2
mstruct
1.3.4
nbd
>= 0.9.2
nocrypto
0.5.4
openflow
otr
ox
1.1.1
packet
pbkdf
pcap-format
>= 0.3.3
pcf-format
ppx_cstruct
3.0.0
protocol-9p
0.11.2
protocol-9p-unix
0.11.2
qcow
qcow-format
qcow-tool
randomconv
rawlink
rfc6287
>= 1.0.2
salsa20-core
scrypt-kdf
shared-block-ring
2.3.0
shared-memory-ring
2.0.0
tar
tar-format
>= 0.2.0
tar-mirage
tar-unix
tcpip
3.0.0
tftp
tls
vchan
3.0.0
vhd-format
vhd-tool
vmnet
x509
xapi-rrd-transport
xe
xe-unikernel-upload
xen-api-client
>= 0.9.6
xen-block-driver
>= 0.2.5
xen-gnt
xenstore
&>= 1.2.0
1.3.0
xentropyd
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