X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=examples%2Fmake_ipv4_header.ml;h=5b3463d2f4b39ed519988222902e4d4b0b9826d7;hb=0413e3eaa87aba7c3a7dd0c08c69f14ca6766661;hp=329ccd3eb928d49bebe191b5658af07bc361d14e;hpb=6abf6d71e8ae68595acccc97370e125a43b86165;p=ocaml-bitstring.git diff --git a/examples/make_ipv4_header.ml b/examples/make_ipv4_header.ml index 329ccd3..5b3463d 100644 --- a/examples/make_ipv4_header.ml +++ b/examples/make_ipv4_header.ml @@ -1,5 +1,5 @@ (* Create an IPv4 header. - * $Id: make_ipv4_header.ml,v 1.2 2008-04-01 17:31:12 rjones Exp $ + * $Id$ *) open Printf @@ -14,8 +14,8 @@ let fragoffset = 0 let ttl = 255 let protocol = 17 (* UDP *) let checksum = 0 -let source = 0xc0a80202 (* 192.168.2.2 *) -let dest = 0xc0a80201 (* 192.168.2.1 *) +let source = 0xc0a80202_l (* 192.168.2.2 *) +let dest = 0xc0a80201_l (* 192.168.2.1 *) let options = Bitmatch.empty_bitstring let payload_length = (length - hdrlen*4) * 8 let payload = Bitmatch.create_bitstring payload_length @@ -26,9 +26,12 @@ let header = identification : 16; flags : 3; fragoffset : 13; ttl : 8; protocol : 8; checksum : 16; source : 32; - dest : 32; - options : -1, bitstring; - payload : payload_length, bitstring + dest : 32 +(* + Not implemented at the moment XXX + options : -1 : bitstring; + payload : payload_length : bitstring +*) } -let () = Bitmatch.file_of_bitstring header "ipv4_header_out.dat" +let () = Bitmatch.bitstring_to_file header "ipv4_header_out.dat"