4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
31 #include <sys/types.h>
34 * The `getifaddrs' function generates a linked list of these structures.
35 * Each element of the list describes one network interface.
37 #if defined(_INT64_TYPE)
39 struct ifaddrs
*ifa_next
; /* Pointer to the next structure. */
40 char *ifa_name
; /* Name of this network interface. */
41 uint64_t ifa_flags
; /* Flags as from SIOCGLIFFLAGS ioctl. */
42 struct sockaddr
*ifa_addr
; /* Network address of this interface. */
43 struct sockaddr
*ifa_netmask
; /* Netmask of this interface. */
46 * At most one of the following two is valid. If the
47 * IFF_BROADCAST bit is set in `ifa_flags', then
48 * `ifa_broadaddr' is valid. If the IFF_POINTOPOINT bit is
49 * set, then `ifa_dstaddr' is valid. It is never the case that
50 * both these bits are set at once.
52 struct sockaddr
*ifu_broadaddr
;
53 struct sockaddr
*ifu_dstaddr
;
55 void *ifa_data
; /* Address-specific data (may be unused). */
57 * This may have been defined in <net/if.h>.
60 #define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */
63 #define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */
69 * Create a linked list of `struct ifaddrs' structures, one for each
70 * network interface on the host machine. If successful, store the
71 * list in *ifap and return 0. On errors, return -1 and set `errno'.
73 * The storage returned in *ifap is allocated dynamically and can
74 * only be properly freed by passing it to `freeifaddrs'.
76 extern int getifaddrs(struct ifaddrs
**);
78 /* Reclaim the storage allocated by a previous `getifaddrs' call. */
79 extern void freeifaddrs(struct ifaddrs
*);
86 #endif /* _IFADDRS_H */