Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Sep 2001 14:43:37 -0500
From:      Jonathan Lemon <jlemon@flugsvamp.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Bill Fenner <fenner@research.att.com>, arch@FreeBSD.ORG
Subject:   Re: Causing <netinet/in.h> to depend on <sys/socket.h>
Message-ID:  <20010907144337.Z20137@prism.flugsvamp.com>
In-Reply-To: <3B991BF8.5BF2E5E2@mindspring.com>
References:  <200109071748.KAA21991@windsor.research.att.com> <3B991BF8.5BF2E5E2@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 07, 2001 at 12:11:52PM -0700, Terry Lambert wrote:
> Bill Fenner wrote:
> > 
> > Er, I think I take back my own objection.  IEEE Std 1003.1-200x says
> > 
> > SYNOPSIS
> >               #include <netinet/in.h>
> > ...
> >               Inclusion of the <netinet/in.h> header may also make
> >               visible all symbols from <inttypes.h> and <sys/socket.h>.
> 
> ... and it MAY not.
> 
> You should just include both yourself, and be done with it.
> 
> By forcing inclusion of socket.h, you break the layering
> abstraction.

No.  <netinet/in.h> already knows about socket addresses, just in a
slightly different form.  These are called 'struct sockaddr_in'.

 
> If this is done with pointers, rather than instances or
> member references, in the API code, just forward declare
> the structure, and use it as an opaque type, e.g.:
 
Uhm.  Please go look at the definition of sockaddr_storage in 
<sys/socket.h>.  See RFC 2553 for more information.  Not speaking
for Bill, but my guess he needs to use this to allocate storage
in a protocol-independent fashion. 

The other alternative may be to create 'sockaddr_storage46'
in <netinet/in.h>, but that probably is equally yucky.
-- 
Jonathan

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010907144337.Z20137>