From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C94ECBB84 for ; Thu, 18 May 2006 23:14:44 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4ILEioF001934 for ; Thu, 18 May 2006 23:14:44 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA09333 for ; Thu, 18 May 2006 23:14:43 +0200 (MET DST) Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4ILEh7h019716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 18 May 2006 23:14:43 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from first.in-berlin.de (e178025247.adsl.alicedsl.de [85.178.25.247]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id k4ILEekl031833 for ; Thu, 18 May 2006 23:14:40 +0200 Received: by first.in-berlin.de (Postfix, from userid 501) id 540FE286BB9; Thu, 18 May 2006 23:14:49 +0200 (CEST) Date: Thu, 18 May 2006 23:14:48 +0200 From: Oliver Bandel To: caml-list@inria.fr Subject: Re: [Caml-list] RAW-sockets Message-ID: <20060518211448.GA22098@first.in-berlin.de> References: <20060518152745.GA6163@first.in-berlin.de> <20060518155006.GA6748@first.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at concorde with ID 446CE3C4.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 446CE3C3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 bandel:01 sockets:01 ocaml:01 sockets:01 byte:01 ocaml:01 int's:01 unix-module:01 icmp:01 icmp:01 2006:98 wrote:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Thu, May 18, 2006 at 10:36:25AM -0600, William D. Neumann wrote: > On Thu, 18 May 2006, Oliver Bandel wrote: > > >>how to use Eaw sockets from OCaml? > >> > >>As in raw sockets I have to create the IP-header by myself > >>I'm wondering how. > >> > >>IP normally uses 32Bit words, and the parts of it are not > >>necessarily byte or nibble oriented. > >>So I have to be able to set some bits directly. > >>But the OCaml int's is not complete 32 Bits. > >[...] > > > >I have not found in the Unix-module an option for the sockets, > >that is eaquivalent to the IP_HDRINCL option, as described > >by Stevens in the Networking Programming Vol. I. > > > >Isn't it possible in OCaml to create own IP-headers? > >So, do I have to go back to C to e.g. write ICMP packets? > > No. Just create a string in OCaml and use that. Here's a (possibly > awful) hunk of code I wrote for creating ICMP packets. Take a look at it > and see how I did things. [...] OK, thanks for that impression... ...but soooo much code for this? Seems that it's easier to do it in C. :( I will look at your code in more detail later, but at first look, it was a little shock. :( Maybe you have implemented more functionality than I need and so what I was looking for is some lines of code only. But nevertheless it's god to have his, so I can reason about how to do some ICMP-based stuff. Best Regards, Oliver