Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update the Unix code (including tests) to the new Cstruct interface

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
  • Loading branch information...
commit 1abfb8af55afc092602a3a5d4876bc9b85daf30b 1 parent 711d398
@djs55 djs55 authored
Showing with 3 additions and 1 deletion.
  1. +2 −1  lib_test/test.ml
  2. +1 −0  print/print.ml
View
3  lib_test/test.ml
@@ -24,7 +24,8 @@ let example_file = "lib_test/dhcp.pcap"
let open_file filename =
let fd = Unix.(openfile filename [O_RDONLY] 0) in
- Bigarray.(Array1.map_file fd Bigarray.char c_layout false (-1))
+ let ba = Bigarray.(Array1.map_file fd Bigarray.char c_layout false (-1)) in
+ Cstruct.of_bigarray ba
let read_header filename =
let buf = open_file filename in
View
1  print/print.ml
@@ -119,6 +119,7 @@ let parse filename =
printf "filename: %s\n" filename;
let fd = Unix.(openfile filename [O_RDONLY] 0) in
let buf = Bigarray.(Array1.map_file fd Bigarray.char c_layout false (-1)) in
+ let buf = Cstruct.of_bigarray buf in
printf "total pcap file length %d\n" (Cstruct.len buf);
let header, body = Cstruct.split buf sizeof_pcap_header in
Please sign in to comment.
Something went wrong with that request. Please try again.