package cstruct

  1. Overview
  2. No Docs
access C structures via a camlp4 extension

Install

Dune Dependency

Authors

Maintainers

Sources

v1.9.0.tar.gz
sha256=2d175bf1e2cdc5ca43cb30bd3fa507beee2f18b2cbecae801ab6ffaecde16c9c
md5=59b512261058e1fe649d10d6ac268285

Description

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

Tags

org:mirage org:xapi-project

Published: 19 Feb 2016

Dev Dependencies (1)

  1. ounit with-test

  1. albatross < "1.3.0"
  2. angstrom < "0.7.0"
  3. arakoon >= "1.8.6" & < "1.8.12"
  4. asn1-combinators >= "0.1.2" & != "0.2.0-1" & < "0.2.6"
  5. awa-mirage < "0.0.2"
  6. balancer
  7. buffer-pool
  8. capnp-rpc-net >= "1.1" & < "1.2.1"
  9. channel
  10. charrua-client < "0.9"
  11. charrua-core < "0.8"
  12. charrua-unix < "0.3" | = "0.6"
  13. cohttp >= "0.9.7" & < "0.10.0"
  14. conduit >= "0.6.0" & < "0.15.2"
  15. conduit-async = "3.0.0"
  16. conduit-lwt = "3.0.0"
  17. conex < "0.10.0"
  18. conex-mirage-crypto
  19. conex-nocrypto
  20. cowabloga >= "0.0.5"
  21. crc
  22. crunch >= "2.0.0" & < "3.0.0"
  23. cstruct-lwt < "3.0.0"
  24. cstruct-unix < "3.0.0"
  25. datakit-ci >= "0.10.0" & < "0.12.4"
  26. datakit-client < "0.9.0"
  27. datakit-server < "0.9.0"
  28. depyt
  29. dns >= "0.15.0" & < "0.19.0"
  30. dream < "1.0.0~alpha2"
  31. duff < "0.3"
  32. eqaf >= "0.8" & < "0.10"
  33. eqaf-cstruct
  34. fat-filesystem >= "0.10.0" & < "0.11.0"
  35. frenetic < "2.0.0" | >= "3.2.0" & < "5.0.5"
  36. git >= "1.4.3" & < "1.6.0" | >= "2.0.0" & < "3.0.0"
  37. git-http < "1.11.0"
  38. git-mirage = "1.11.0"
  39. github-hooks >= "0.2.0"
  40. gluten-mirage < "0.3.0"
  41. gpt
  42. h2-mirage
  43. hacl-star >= "0.7.0"
  44. hex >= "0.2.0"
  45. hkdf < "1.0.3"
  46. httpun-mirage
  47. httpun-ws-mirage
  48. hvsock < "1.0.0"
  49. io-page < "2.0.0"
  50. io-page-unix < "2.0.0"
  51. io-page-xen < "2.0.0"
  52. ipaddr-cstruct < "5.2.0"
  53. irmin >= "0.9.0" & < "2.0.0"
  54. irmin-git >= "2.3.0"
  55. irmin-indexeddb >= "0.3"
  56. iso-filesystem
  57. key-parsers >= "0.5.0" & < "1.2.1"
  58. launchd
  59. letsencrypt = "0.2.5"
  60. letsencrypt-app < "0.4.0"
  61. macaddr-cstruct < "5.2.0"
  62. mbr-format < "1.0.0"
  63. metrics-mirage
  64. mirage >= "0.7.2" & < "0.9.1" | >= "0.10.0" & < "2.4.0"
  65. mirage-block < "1.0.0"
  66. mirage-block-ccm < "1.1.0"
  67. mirage-block-ramdisk
  68. mirage-block-solo5 < "0.6.2"
  69. mirage-block-unix < "2.8.3"
  70. mirage-block-xen < "2.1.1"
  71. mirage-btrees
  72. mirage-channel-lwt
  73. mirage-clock-unix < "1.0.0"
  74. mirage-clock-xen < "1.0.0"
  75. mirage-conduit = "2.3.1"
  76. mirage-console-lwt
  77. mirage-console-solo5 >= "0.2.0"
  78. mirage-console-unix < "2.3.2"
  79. mirage-console-xen = "4.0.0"
  80. mirage-console-xen-backend >= "2.3.2" & < "2.3.4" | = "4.0.0"
  81. mirage-console-xen-cli
  82. mirage-dns < "2.6.0"
  83. mirage-entropy < "0.5.0"
  84. mirage-entropy-unix
  85. mirage-entropy-xen
  86. mirage-flow < "1.2.0"
  87. mirage-flow-rawlink >= "1.1.0"
  88. mirage-fs >= "0.4.0" & < "1.0.0"
  89. mirage-fs-lwt
  90. mirage-fs-mem
  91. mirage-fs-unix < "1.4.1"
  92. mirage-kv-lwt
  93. mirage-nat < "2.2.4"
  94. mirage-net = "0.5.2"
  95. mirage-net-fd < "0.2.1"
  96. mirage-net-lwt
  97. mirage-net-macosx
  98. mirage-net-solo5
  99. mirage-net-unix != "2.4.1"
  100. mirage-net-xen < "1.7.0"
  101. mirage-profile < "0.8.0"
  102. mirage-protocols-lwt
  103. mirage-qubes < "0.8.0"
  104. mirage-qubes-ipv4 < "0.9.3"
  105. mirage-random < "2.0.0"
  106. mirage-random-stdlib
  107. mirage-random-test
  108. mirage-solo5
  109. mirage-stack-lwt < "1.1.0"
  110. mirage-tc
  111. mirage-tcpip-unix
  112. mirage-tcpip-xen
  113. mirage-types-lwt < "3.4.0"
  114. mirage-unix < "3.0.8"
  115. mirage-vnetif < "0.4.0"
  116. mirage-www < "0.4.0" | >= "1.1.0"
  117. mirage-xen < "2.0.0" | >= "2.3.2"
  118. monorobot
  119. mrt-format
  120. mstruct < "1.3.4"
  121. nbd >= "0.9.2" & < "4.0.3"
  122. nocrypto < "0.5.4"
  123. noise
  124. openflow
  125. otr < "0.3.9"
  126. ox < "1.1.1"
  127. packet
  128. pbkdf < "0.3.0" | = "1.1.0"
  129. pcap-format >= "0.3.3"
  130. pcf-format
  131. ppx_cstruct < "3.0.1"
  132. protocol-9p < "0.11.2"
  133. protocol-9p-tool = "0.12.0" | >= "2.0.0" & < "2.0.2"
  134. protocol-9p-unix < "0.11.2"
  135. qcow < "0.11.0"
  136. qcow-format
  137. qcow-tool
  138. randomconv < "0.2.0"
  139. rawlink < "0.6"
  140. resp-mirage = "0.10.0"
  141. rfc6287 >= "1.0.2" & < "1.0.4"
  142. salsa20 < "1.1.0"
  143. salsa20-core < "1.0.0"
  144. scrypt-kdf < "1.1.0"
  145. sendmail >= "0.4.1" & < "0.5.0"
  146. shared-block-ring < "2.3.0"
  147. shared-memory-ring < "2.0.0"
  148. slack
  149. ssh-agent
  150. tar < "2.0.0"
  151. tar-format >= "0.2.0"
  152. tar-mirage < "3.0.0"
  153. tar-unix < "2.0.0"
  154. tcpip < "3.0.0"
  155. tftp
  156. tls < "0.9.0"
  157. u2f = "0.1.1"
  158. vchan != "3.0.0" & < "6.0.1"
  159. vchan-unix >= "4.0.0"
  160. vchan-xen >= "4.0.0"
  161. vhd-format
  162. vhd-format-lwt
  163. vhd-tool
  164. vmnet
  165. websocket = "2.2"
  166. x509 < "0.6.3"
  167. xapi-rrd-transport
  168. xe
  169. xe-unikernel-upload
  170. xen-api-client >= "0.9.6"
  171. xen-block-driver >= "0.2.5"
  172. xen-gnt
  173. xenstore >= "1.2.0" & < "1.3.0"
  174. xentropyd

Conflicts

None

OCaml

Innovation. Community. Security.