caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Raw Sockets
@ 2005-10-06 20:53 Jonathan Bryant
  2005-10-07  3:05 ` [Caml-list] " Taras
  2005-10-07 17:34 ` Nicolas Cannasse
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Bryant @ 2005-10-06 20:53 UTC (permalink / raw)
  To: caml-list

Does anybody have any information on using SOCK_RAW in OCaml?  At this
level, things like byte ordering matter, so I would like to know if
OCaml handles this automatically or not, as well as any other gotchas
involved with using raw sockets in OCaml.  Also, are there any
structures for handling Ethernet/IP/TCP headers already written?  Maybe
in another library?  Or am I going to have to write these myself?

Thanks,
--Jonathan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Raw Sockets
  2005-10-06 20:53 Raw Sockets Jonathan Bryant
@ 2005-10-07  3:05 ` Taras
  2005-10-07  9:56   ` Oliver Bandel
  2005-10-07 17:34 ` Nicolas Cannasse
  1 sibling, 1 reply; 5+ messages in thread
From: Taras @ 2005-10-07  3:05 UTC (permalink / raw)
  To: Jonathan Bryant; +Cc: caml-list

Hi,
I don't think you can use SOCK_RAW in pure ocaml. I spent a few minutes 
on it, but never had time to get very far.
http://glek.net/subversion/packetml/
That contains a simple ocaml program(with a c function to setup the 
socket) that sends a packet out.

That has basic ocaml code needed to send a packet and contains functions 
for making packets too. Code comes from the basic network stack in dst, 
I just never factored out packet parsing functions properly.

Taras

Jonathan Bryant wrote:

>Does anybody have any information on using SOCK_RAW in OCaml?  At this
>level, things like byte ordering matter, so I would like to know if
>OCaml handles this automatically or not, as well as any other gotchas
>involved with using raw sockets in OCaml.  Also, are there any
>structures for handling Ethernet/IP/TCP headers already written?  Maybe
>in another library?  Or am I going to have to write these myself?
>
>Thanks,
>--Jonathan
>
>_______________________________________________
>Caml-list mailing list. Subscription management:
>http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>Archives: http://caml.inria.fr
>Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>Bug reports: http://caml.inria.fr/bin/caml-bugs
>  
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Raw Sockets
  2005-10-07  3:05 ` [Caml-list] " Taras
@ 2005-10-07  9:56   ` Oliver Bandel
  2005-10-07 13:32     ` Jonathan Bryant
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Bandel @ 2005-10-07  9:56 UTC (permalink / raw)
  To: caml-list

On Thu, Oct 06, 2005 at 08:05:47PM -0700, Taras wrote:
> Hi,
> I don't think you can use SOCK_RAW in pure ocaml. I spent a few minutes 

I was astouned that OCaml now has a type for Raw-sockets.
So I think it is possible to use raw sockets with OCaml now.
(I have 3.08.0 here, but didn't rried Raw Sockets.)


Ciao,
  Oliver


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Raw Sockets
  2005-10-07  9:56   ` Oliver Bandel
@ 2005-10-07 13:32     ` Jonathan Bryant
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Bryant @ 2005-10-07 13:32 UTC (permalink / raw)
  To: caml-list


> I was astouned that OCaml now has a type for Raw-sockets.

Yes, I saw.  That's why I asked  :)

> So I think it is possible to use raw sockets with OCaml now.
> (I have 3.08.0 here, but didn't rried Raw Sockets.)

Has anybody?  I have used SOCK_RAW in C before and, with the aid of a
tutorial (it's been a while), I could do the same in OCaml if there
weren't some functions missing.  I don't see anything in the Unix
library like hton(),  structures for IP headers, etc., like there are in
the C standard library.  Is this just a shortcoming in the Unix module,
or is this intentional (i.e., Unix.SOCK_RAW is just really a
placeholder)?


> 
> Ciao,
>   Oliver
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Raw Sockets
  2005-10-06 20:53 Raw Sockets Jonathan Bryant
  2005-10-07  3:05 ` [Caml-list] " Taras
@ 2005-10-07 17:34 ` Nicolas Cannasse
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Cannasse @ 2005-10-07 17:34 UTC (permalink / raw)
  To: Jonathan Bryant, caml-list

> Does anybody have any information on using SOCK_RAW in OCaml?  At this
> level, things like byte ordering matter, so I would like to know if
> OCaml handles this automatically or not, as well as any other gotchas
> involved with using raw sockets in OCaml.  Also, are there any
> structures for handling Ethernet/IP/TCP headers already written?  Maybe
> in another library?  Or am I going to have to write these myself?
>
> Thanks,
> --Jonathan

One possibility to deal with byte ordering would be to wrap your socket
accesses with an ExtLib IO since it has all the APIs for reading and writing
multibyte integers (see http://ocaml-lib.sourceforge.net/doc/IO.html )

Nicolas


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-07 17:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-06 20:53 Raw Sockets Jonathan Bryant
2005-10-07  3:05 ` [Caml-list] " Taras
2005-10-07  9:56   ` Oliver Bandel
2005-10-07 13:32     ` Jonathan Bryant
2005-10-07 17:34 ` Nicolas Cannasse

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).