From 6abf6d71e8ae68595acccc97370e125a43b86165 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 18 May 2008 18:30:08 +0000 Subject: [PATCH] Fix examples to use the new syntax. --- examples/ipv4_header.ml | 18 +++++++++--------- examples/make_ipv4_header.ml | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) 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 diff --git a/examples/make_ipv4_header.ml b/examples/make_ipv4_header.ml index 9605647..329ccd3 100644 --- a/examples/make_ipv4_header.ml +++ b/examples/make_ipv4_header.ml @@ -21,7 +21,7 @@ let payload_length = (length - hdrlen*4) * 8 let payload = Bitmatch.create_bitstring payload_length let header = - BITSTRING + BITSTRING { version : 4; hdrlen : 4; tos : 8; length : 16; identification : 16; flags : 3; fragoffset : 13; ttl : 8; protocol : 8; checksum : 16; @@ -29,5 +29,6 @@ let header = dest : 32; options : -1, bitstring; payload : payload_length, bitstring + } let () = Bitmatch.file_of_bitstring header "ipv4_header_out.dat" -- 1.8.3.1