[RFC] if_nameindex.3: New page documenting if_nameindex(3) and if_freenameindex(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please review.
TODO: Check VERSIONS and HISTORY sections.

References:
	RFC 3542

	POSIX Man Page Set
		http://www.unix.com/man-page/POSIX/3posix/if_indexname
		http://www.unix.com/man-page/POSIX/3posix/if_freeindexname

	OS X Deverloper Tools Manual Page
		http://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man3/if_nameindex.3.html

	Source: sysdeps/unix/sysv/linux/{if_index.c,ifaddrs.c}

YOSHIFUJI Hideaki <yoshfuji@xxxxxxxxxxxxxx>
---
 man3/if_nameindex.3 |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 man3/if_nameindex.3

diff --git a/man3/if_nameindex.3 b/man3/if_nameindex.3
new file mode 100644
index 0000000..60bfd39
--- /dev/null
+++ b/man3/if_nameindex.3
@@ -0,0 +1,110 @@
+.\" Copyright (c) 2012 YOSHIFUJI Hideaki <yoshfuji@xxxxxxxxxxxxxx>
+.\" 
+.\" Permission is granted to make and distribute verbatim copies of this
+.\" manual provided the copyright notice and this permission notice are
+.\" preserved on all copies.
+.\"
+.\" Permission is granted to copy and distribute modified versions of
+.\" this manual under the conditions for verbatim copying, provided that
+.\" the entire resulting derived work is distributed under the terms of
+.\" a permission notice identical to this one.
+.\"
+.\" Since the Linux kernel and libraries are constantly changing, this
+.\" manual page may be incorrect or out-of-date.  The author(s) assume.
+.\" no responsibility for errors or omissions, or for damages resulting.
+.\" from the use of the information contained herein.  The author(s) may.
+.\" not have taken the same level of care in the production of this.
+.\" manual, which is licensed free of charge, as they might when working.
+.\" professionally.
+.\"
+.\" Formatted or processed versions of this manual, if unaccompanied by
+.\" the source, must acknowledge the copyright and authors of this work.
+.\"
+.TH IF_NAMEINDEX 3 2012-11-16 "GNU" "Linux Programmer's Manual"
+.SH NAME
+if_nameindex, if_freenameindex \- get network interface names and indexes
+.SH SYNOPSIS
+.nf
+.B #include <net/if.h>
+.sp
+.BI "struct if_nameindex *if_nameindex(void);
+.BI "void if_freenameindex(struct if_nameindex *" "ptr" );
+.fi
+.SH DESCRIPTION
+The
+.BR if_nameindex ()
+function creates an array of structures, one structure per
+interface, each describing network interface name and
+corresponding network index of the local system.
+
+The
+.I if_nameindex
+structure contains at least the following entries:
+.sp
+.in +4n
+.nf
+    unsigned int if_index;  /* 1, 2, ... */
+    char *if_name;          /* null terminated name: "eth0", ... */
+.fi
+.in
+.PP
+The
+.I if_index
+field contains the interface index,
+or zero if this is the last item of the array.
+.PP
+The
+.I ifa_name
+field points to the null-terminated interface name,
+or NULL pointer if this is the last item of the array.
+.PP
+The data returned by
+.BR if_nameindex ()
+is dynamically allocated and should be freed using
+.BR if_freenameindex ()
+when no longer needed.
+.SH RETURN VALUE
+On success,
+.BR if_nameindex ()
+returns pointer to the array;
+on error, A NULL pointer is returned, and
+.I errno
+is set appropriately.
+.SH ERRORS
+.BR if_nameindex ()
+may fail and set
+.I errno
+if:
+.TP
+.B ENOBUFS
+Sufficient resources unavailable.
+.PP
+.BR if_nameindex ()
+may also fail for any of the errors specified for
+.BR socket (2),
+.BR bind (2),
+.BR ioctl (2),
+.BR getsockname (2),
+.BR recvmsg (2),
+.BR sendto (2),
+or
+.BR malloc (3).
+.SH VERSIONS
+The
+.BR if_nameindex ()
+function first appeared in glibc 2.3, but before glibc 2.3.3,
+the implementation only supported interfaces with IPv4 addresses.
+Support of interfaces without IPv4 addresses is only available
+on kernels that support netlink.
+.SH CONFORMING TO
+RFC\ 3493, POSIX.1-2001.
+.SH HISTORY
+This function first appeared in BSDi.
+.SH SEE ALSO
+.BR getsockopt (2),
+.BR setsockopt (2),
+.BR getifaddrs (3),
+.BR if_indextoname (3),
+.BR if_nameindex (3),
+.BR if_nametoindex (3),
+.BR ifconfig (8)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux