caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Raphaël Proust" <raphlalou@gmail.com>
To: "Vincent B." <vb@luminar.eu.org>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] IPv6 zone-id
Date: Fri, 11 Jul 2014 09:03:11 +0100	[thread overview]
Message-ID: <CAAmHUA=Xu741uhzuxL4YgvC3OPxOFFqvOW4K=UVv=sLi0UNkUQ@mail.gmail.com> (raw)
In-Reply-To: <53BD7D68.1090409@luminar.eu.org>

On Wed, Jul 9, 2014 at 6:35 PM, Vincent B. <vb@luminar.eu.org> wrote:
> The Unix module does not make possible to use IPv6 link-local
> addresses.
>
> This is due to the fact that the "sockaddr" type in Unix is not as
> complete as its C counterpart, especially it lacks zone-id information
> that is required to use such addresses.
>
> Since I needed such features, I started writing a library
> (http://github.com/vbmithr/ocaml-sockopt), unfortunately, given that
> every networking piece of code written in OCaml use the primitives of
> the Unix module, I would have to patch all networking code I want to
> use which is not very convenient.

Is it possible to make a new networking module using Cstruct to manage
sockaddr and such?


>
> So I'm in the process of writing a patch for OCaml and I'm taking the
> approach of extending the sockaddr type like this:
>
> type sockaddr_raw (* a real struct sockaddr *)
>
> type sockaddr =
>   ADDR_UNIX of string
> | ADDR_INET of inet_addr * int
> | ADDR_RAW of sockaddr_raw
>
> And then upgrading all the Unix code that uses type sockaddr.
>
> This approach seems to me the most conservative towards existing
> code. Should I continue in this direction or this design is not the
> optimal one ?

Although very conservative towards the existing codebases, I don't
like this approach for the following reasons.

The same sockaddr can be represented in different ways (which means
that equality becomes non-trivial, and the choice of representation is
non-obvious for programmers).

The Unix module is build as abstractions from the underlying system,
adding a sockaddr_raw defeats that. It becomes abstractionless.


Additionally, is sockaddr_raw completely opaque? what
constructors/destructors are available?



Cheers,
-- 
______________
Raphaël Proust

  reply	other threads:[~2014-07-11  8:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 17:35 Vincent B.
2014-07-11  8:03 ` Raphaël Proust [this message]
2014-07-11 14:13   ` Vincent B.
2014-07-11 19:25     ` Vincent B.
2014-07-16 16:04       ` Francis Dupont
2014-07-17  9:48         ` Vincent B.
2014-07-17 10:51           ` David Allsopp

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='CAAmHUA=Xu741uhzuxL4YgvC3OPxOFFqvOW4K=UVv=sLi0UNkUQ@mail.gmail.com' \
    --to=raphlalou@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=vb@luminar.eu.org \
    /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).