Johan Mazel a écrit : > The size of pcap_payload is always -1. This means that we can never access to > the data inside the packet.
Actually, pcap_payload embeds a pointer outside the ML heap (ML block with unaligned_tag). I guess it is the libpcap receive buffer. As such, it is not marshallable nor usable with regular string functions. However, unsafe_* variants work fine (see pcap_loop.ml example for example). If you want to use it as a regular string, you'll have to unsafe_blit the contents into another OCaml string yourself. I fond this quite inelegant at first. But it allows to use pcap_payload as a bitstring without any string copy from libpcap buffer, with turned out to be interesting, especially in a highly sollicitated application. Best regards, -- Stéphane -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

