From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8556A7EE25 for ; Fri, 18 Oct 2013 16:40:27 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.93,523,1378850400"; d="scan'208";a="30893678" Received: from wencory.loria.fr (HELO [152.81.3.42]) ([152.81.3.42]) by mail3-relais-sop.national.inria.fr with ESMTP; 18 Oct 2013 16:40:27 +0200 Message-ID: <5261485A.2090707@glondu.net> Date: Fri, 18 Oct 2013 16:40:26 +0200 From: =?ISO-8859-1?Q?St=E9phane_Glondu?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: caml-list@inria.fr References: <20131018115553.GA28679@ombreroze.happyleptic.org> <20131018115955.GG25839@dark.recoil.org> <20131018121612.GB28679@ombreroze.happyleptic.org> <20131018122018.GJ25839@dark.recoil.org> <1382104327.3040.21.camel@e130> <20131018141324.GD28679@ombreroze.happyleptic.org> In-Reply-To: <20131018141324.GD28679@ombreroze.happyleptic.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] IPv6 packet parsing Le 18/10/2013 16:13, rixed@happyleptic.org a écrit : > Ideally, I'd like to pass const pointers to packet bytes provided by > libpcap to user callbacks up to bitstring through OCaml [...] AFAICT, this is what is done in my earlier link: https://github.com/glondu/netacct-crans/blob/master/netacct-crans.ml rawstring in line 240 is a direct pointer to libpcap's buffer (in particular, it is outside the OCaml heap). Of course, it being typed as string is unsafe but it allows me to wrap it directly into a bitstring (the "dark magic" that comes later) and then bitmatch-ed. Cheers, -- Stéphane