if_nametoindex

Section: C Library Functions (3)
Updated: 15 décembre 2022
Index Return to Main Contents
 

NOM

if_nametoindex, if_indextoname - Correspondance entre noms d'interfaces réseau et indices  

BIBLIOTHÈQUE

Bibliothèque C standard (libc, -lc)  

SYNOPSIS

#include <net/if.h>

unsigned int if_nametoindex(const char *ifname);
char *if_indextoname(unsigned int ifindex, char *ifname);
 

DESCRIPTION

La fonction if_nametoindex() renvoie l'indice de l'interface réseau correspondant au nom nom_if.

La fonction if_indextoname() renvoie le nom de l'interface réseau correspondant à l'indice d'interface indice_if. Le nom est placé dans le tampon sur lequel pointe nom_if. Le tampon doit autoriser le stockage d'au moins IF_NAMESIZE octets.  

VALEUR RENVOYÉE

On success, if_nametoindex() returns the index number of the network interface; on error, 0 is returned and errno is set to indicate the error.

On success, if_indextoname() returns ifname; on error, NULL is returned and errno is set to indicate the error.  

ERREURS

if_nametoindex() may fail and set errno if:
ENODEV
No interface found with given name.

if_indextoname() peut échouer et remplir errno si :

ENXIO
aucune interface n'est trouvée pour l'indice.

if_nametoindex() et if_indextoname() peuvent aussi échouer pour une des erreurs précisées pour socket(2) ou ioctl(2).  

ATTRIBUTS

Pour une explication des termes utilisés dans cette section, consulter attributes(7).
InterfaceAttributValeur
if_nametoindex(), if_indextoname() Sécurité des threadsMT-Safe

 

STANDARDS

POSIX.1-2001, POSIX.1-2008, RFC 3493.

Cette fonction est d'abord apparue dans BSDi.  

VOIR AUSSI

getifaddrs(3), if_nameindex(3), ifconfig(8)

 

TRADUCTION

La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Cédric Boutillier <cedric.boutillier@gmail.com> et Frédéric Hantrais <fhantrais@gmail.com>

Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à


 

Index

NOM
BIBLIOTHÈQUE
SYNOPSIS
DESCRIPTION
VALEUR RENVOYÉE
ERREURS
ATTRIBUTS
STANDARDS
VOIR AUSSI
TRADUCTION

This document was created by man2html, using the manual pages.
Time: 17:17:37 GMT, May 22, 2024