]> git.saurik.com Git - apple/libinfo.git/blobdiff - gen.subproj/getifaddrs.3
Libinfo-330.9.tar.gz
[apple/libinfo.git] / gen.subproj / getifaddrs.3
index 7409e90737fd168aa55b383fdce4b14f12ed0fdf..201db109625c4d302f1417b1e443e58911b30d70 100644 (file)
@@ -1,4 +1,3 @@
-.\"    $FreeBSD: src/lib/libc/net/getifaddrs.3,v 1.1.2.4 2001/08/31 10:15:14 ru Exp $
 .\"    $KAME: getifaddrs.3,v 1.4 2000/05/17 14:13:14 itojun Exp $
 .\"    BSDI    getifaddrs.3,v 2.5 2000/02/23 14:51:59 dab Exp
 .\"
@@ -22,6 +21,9 @@
 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libc/net/getifaddrs.3,v 1.10 2005/02/09 18:03:13 ru Exp $
+.\"
 .Dd October 12, 1995
 .Dt GETIFADDRS 3
 .Os
@@ -29,9 +31,9 @@
 .Nm getifaddrs
 .Nd get interface addresses
 .Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/socket.h>
-.Fd #include <ifaddrs.h>
+.In sys/types.h
+.In sys/socket.h
+.In ifaddrs.h
 .Ft int
 .Fn getifaddrs "struct ifaddrs **ifap"
 .Ft void
@@ -45,7 +47,7 @@ on the local machine in the memory referenced by
 The list consists of
 .Nm ifaddrs
 structures, as defined in the include file
-.Aq Pa ifaddrs.h .
+.In ifaddrs.h .
 The
 .Nm ifaddrs
 structure contains at least the following entries:
@@ -55,7 +57,7 @@ structure contains at least the following entries:
     u_int             ifa_flags;        /* Interface flags */
     struct sockaddr  *ifa_addr;         /* Interface address */
     struct sockaddr  *ifa_netmask;      /* Interface netmask */
-    struct sockaddr  *ifa_broadaddr;    /* Interface broadcast address */
+.\"    struct sockaddr  *ifa_broadaddr;    /* Interface broadcast address */
     struct sockaddr  *ifa_dstaddr;      /* P2P interface destination */
     void             *ifa_data;                /* Address specific data */
 .Ed
@@ -96,31 +98,31 @@ field references the netmask associated with
 if one is set, otherwise it is NULL.
 .Pp
 The
-.Li ifa_broadaddr
-field,
-which should only be referenced for non-P2P interfaces,
-references the broadcast address associated with
-.Li ifa_addr ,
-if one exists, otherwise it is NULL.
-.Pp
-The
 .Li ifa_dstaddr
 field references the destination address on a P2P interface,
-if one exists, otherwise it is NULL.
+if one exists, otherwise it contains the broadcast address.
+.Pp
+Note that as a convenience,
+.Li ifa_broadaddr
+is defined by a compiler
+.Li #define
+directive to be the same as
+.Li ifa_dstaddr .
 .Pp
 The
 .Li ifa_data
-field references address family specific data.  For
+field references address family specific data.
+For
 .Dv AF_LINK
 addresses it contains a pointer to the
 .Fa struct if_data
 (as defined in include file
-.Aq Pa net/if.h )
+.In net/if.h )
 which contains various interface attributes and statistics.
 For all other address families, it contains a pointer to the
 .Fa struct ifa_data
 (as defined in include file
-.Aq Pa net/if.h )
+.In net/if.h )
 which contains per-address interface statistics.
 .Pp
 The data returned by
@@ -141,16 +143,6 @@ for any of the errors specified for the library routines
 .Xr malloc 3
 or
 .Xr sysctl 3 .
-.Sh BUGS
-If both
-.Aq Pa net/if.h
-and
-.Aq Pa ifaddrs.h
-are being included,
-.Aq Pa net/if.h
-.Em must
-be included before
-.Aq Pa ifaddrs.h .
 .Sh SEE ALSO
 .Xr ioctl 2 ,
 .Xr socket 2 ,
@@ -162,3 +154,13 @@ The
 .Nm
 implementation first appeared in BSDi
 .Bsx .
+.Sh BUGS
+If both
+.In net/if.h
+and
+.In ifaddrs.h
+are being included,
+.In net/if.h
+.Em must
+be included before
+.In ifaddrs.h .