X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=examples%2Fipv4_header.ml;fp=examples%2Fipv4_header.ml;h=b3cf27e446972f99c5e76823b0aaf472cfe85807;hb=6abf6d71e8ae68595acccc97370e125a43b86165;hp=40e130f023825a6359bb7fc6c896218820223cd1;hpb=b66666612f09bc138486ca159525e6f2e28929be;p=ocaml-bitstring.git diff --git a/examples/ipv4_header.ml b/examples/ipv4_header.ml index 40e130f..b3cf27e 100644 --- a/examples/ipv4_header.ml +++ b/examples/ipv4_header.ml @@ -8,13 +8,13 @@ let header = Bitmatch.bitstring_of_file "ipv4_header.dat" let () = bitmatch header with - | version : 4; hdrlen : 4; tos : 8; length : 16; - identification : 16; flags : 3; fragoffset : 13; - ttl : 8; protocol : 8; checksum : 16; - source : 32; - dest : 32; - options : (hdrlen-5)*32 : bitstring; - payload : -1 : bitstring + | { version : 4; hdrlen : 4; tos : 8; length : 16; + identification : 16; flags : 3; fragoffset : 13; + ttl : 8; protocol : 8; checksum : 16; + source : 32; + dest : 32; + options : (hdrlen-5)*32 : bitstring; + payload : -1 : bitstring } when version = 4 -> printf "IPv%d:\n" version; @@ -33,9 +33,9 @@ let () = printf " packet payload:\n"; Bitmatch.hexdump_bitstring stdout payload - | version : 4 -> + | { version : 4 } -> eprintf "cannot parse IP version %d\n" version - | _ as header -> + | { _ } as header -> eprintf "data is smaller than one nibble:\n"; Bitmatch.hexdump_bitstring stderr header