caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Oliver Bandel <oliver@first.in-berlin.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] RAW-sockets
Date: Fri, 19 May 2006 08:12:41 +0200	[thread overview]
Message-ID: <20060519061241.GC393@first.in-berlin.de> (raw)
In-Reply-To: <ad8cfe7e0605181709y6de7fd24w7e7d51a0cfa8212c@mail.gmail.com>

On Fri, May 19, 2006 at 12:09:31PM +1200, Jonathan Roewen wrote:
> >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.
> >
> >How to use the raw sockets then?
> >
> >Do I have to make a string (for highlevel socket functions)
> >or int's (read/write) and write that string or int-buffer
> >into the socket?
> >So that I write all bytes of the header as if it would be
> >normal data that I would write to a tcp-socket otherwise?
> 
> There are various approaches :-) Extlib has a nice IO module which has
> functions for writing  32-bit ints (using a 31-bit int when that extra
> bit isn't needed or a proper int32). I found that module quite useful
> for writing code that's a bit shorter/simpler for network packet
> generation.
> 
> You can use some other interesting approaches like representing your
> packet to be constructed as a list. I did that for DST's netstack :-)
> Can't say whether it's better or worse -- just different.

Well, I also could use C-functions (externals).

But I don't know HOW OCaml handle's the IP-stuff.

I don't know if - when using protocoll 1 (ICMP) for example,
if the IP-header will be generated automatically by OCaml.
It seems that it will be handled this way, but I have not seen
anything about this in the reference manual.

Do I have to write the IP-header by myself or not?

No documentation about if IP_HDRINCL is used internally or not.

Some more verbosity of the refman could help here.

Ciao,
   Oliver


  parent reply	other threads:[~2006-05-19  6:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 15:27 RAW-sockets Oliver Bandel
2006-05-18 15:50 ` [Caml-list] RAW-sockets Oliver Bandel
2006-05-18 16:08   ` Oliver Bandel
     [not found]   ` <Pine.LNX.4.62.0605181027060.414@camaross.cs.unm.edu>
2006-05-18 21:14     ` Oliver Bandel
2006-05-19  6:14     ` Oliver Bandel
2006-05-19 14:51       ` William D. Neumann
     [not found] ` <ad8cfe7e0605181709y6de7fd24w7e7d51a0cfa8212c@mail.gmail.com>
2006-05-19  6:12   ` Oliver Bandel [this message]
     [not found]     ` <ad8cfe7e0605182316l85124c9s5dd588aa89f9c285@mail.gmail.com>
2006-05-19  6:24       ` Oliver Bandel
     [not found]         ` <ad8cfe7e0605182327p3a0d16c4ub43326343347c60c@mail.gmail.com>
2006-05-20 20:57           ` Oliver Bandel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060519061241.GC393@first.in-berlin.de \
    --to=oliver@first.in-berlin.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).