Package:libmlpcap-ocaml-dev Version 0.9-13 I'm trying to read a trace obtained through wireshark. I use pcap_loop to launch a callback function. The call function is supposed to look like something similar to this: "let callback_process _ pkt_hdr pcap_payload = ...". The type of pkt_hdr is PCAP.struct2. The type of pcap_payload is string.
What is supposed to happen: The field caplen of pkt_hdr is supposed to contain the number of bytes inside the captured packet. This works perfectly. The packet itself is supposed to be contained inside pcap_payload. The size of pcap_payload is supposed to be equal to caplen and the size of the packet captured. What happens instead: The size of pcap_payload is always -1. This means that we can never access to the data inside the packet. I added an archive to this post with a simple example which show the problem. To use this code once compiled with the three lines after, simply give a trace name as the first parameter. ocamlfind ocamlopt -package pcap, -c packet_analyser.ml ocamlfind ocamlopt -package pcap, -c main.ml ocamlfind ocamlopt -package pcap, -linkpkg -cclib -lutil -o main packet_analyser.cmx main.cmx I have no idea of where does this problem comes from. The installed system is Lenny 5.0.3. uname -a gives me : Linux debian-a-johan 2.6.26-2-amd64 #1 SMP Thu Nov 5 02:23:12 UTC 2009 x86_64 GNU/Linux dpkg -s libc6 | grep ^Version gives me: Version: 2.7-18
CodeDemoForBugPayloadSize.tar.gz
Description: GNU Zip compressed data

