Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jul 2000 22:15:26 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Wilbert de Graaf <wilbertdg@hetnet.nl>
Cc:        FreeBSD-hackers <FreeBSD-hackers@FreeBSD.ORG>
Subject:   Re: #include question: <netinet/in.h> requires <sys/socket.h>
Message-ID:  <20000712221526.L25571@fw.wintelcom.net>
In-Reply-To: <095401bfec6f$495ba110$0a00a8c0@alias>; from wilbertdg@hetnet.nl on Wed, Jul 12, 2000 at 07:08:47PM -0700
References:  <095401bfec6f$495ba110$0a00a8c0@alias>

next in thread | previous in thread | raw e-mail | index | archive | help
* Wilbert de Graaf <wilbertdg@hetnet.nl> [000712 19:11] wrote:
> 
> Maybe obvious to some of you, but I had to define two new structures (as
> described in an ietf draft) in <netinet/in.h>. This in order to be able to
> support igmpv3 / multicast source filters. Anyway, these structures require
> 'struct sockaddr_storage' which is defined in <sys/socket.h>.
> When I compiled the code, it stopped since several source files only include
> <netinet/in.h> and not <sys/socket.h>. To solve this I added these 3 lines
> 
> #ifndef _SYS_SOCKET_H
> #include <sys/socket.h>
> #endif
> 
> somewhere in the top of <netinet/in.h>. I want to verify if this is indeed
> the best way to solve it ?

No, the proper solution is to do a forward struct declaration like so:

struct something;

struct bigger_something {
	struct something foo;
}

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


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




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