1 /*
2  * ifaddrs.h compatibility shim
3  */
4 
5 #ifdef HAVE_IFADDRS_H
6 
7 #include_next <ifaddrs.h>
8 
9 #else
10 
11 #ifndef LIBCOMPAT_IFADDRS_H
12 #define LIBCOMPAT_IFADDRS_H
13 
14 /* The following code was found on the OpenSolaris networking-discuss
15  * mailing list (http://markmail.org/message/t74kvl63savhzrzp) in a post
16  * by James Carlson.
17  */
18 
19 /*
20  * Copyright (c) 2006 WIDE Project. All rights reserved.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions
24  * are met:
25  * 1. Redistributions of source code must retain the above copyright
26  *    notice, this list of conditions and the following disclaimer.
27  * 2. Redistributions in binary form must reproduce the above copyright
28  *    notice, this list of conditions and the following disclaimer in the
29  *    documentation and/or other materials provided with the distribution.
30  * 3. Neither the name of the project nor the names of its contributors
31  *    may be used to endorse or promote products derived from this software
32  *    without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
35  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
38  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
40  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
43  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
44  * SUCH DAMAGE.
45  */
46 
47 #include <sys/types.h>
48 
49 #undef ifa_broadaddr
50 #undef ifa_dstaddr
51 struct ifaddrs {
52 	struct ifaddrs	*ifa_next;	/* Pointer to next struct */
53 	char		*ifa_name;	/* Interface name */
54 	uint64_t	ifa_flags;	/* Interface flags */
55 	struct sockaddr	*ifa_addr;	/* Interface address */
56 	struct sockaddr	*ifa_netmask;	/* Interface netmask */
57 	struct sockaddr	*ifa_dstaddr;	/* P2P interface destination */
58 };
59 #define	ifa_broadaddr	ifa_dstaddr
60 
61 extern int getifaddrs(struct ifaddrs **);
62 extern void freeifaddrs(struct ifaddrs *);
63 
64 #endif
65 
66 #endif
67