.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) 2012 YOSHIFUJI Hideaki .\" and Copyright (c) 2012 Michael Kerrisk .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH if_nameindex 3 "15 décembre 2022" "Pages du manuel de Linux 6.03" .SH NOM if_nameindex, if_freenameindex \- Obtenir le nom et l'indice des interfaces réseau .SH BIBLIOTHÈQUE Bibliothèque C standard (\fIlibc\fP, \fI\-lc\fP) .SH SYNOPSIS .nf \fB#include \fP .PP \fBstruct if_nameindex *if_nameindex(\fP\fIvoid\fP\fB);\fP \fBvoid if_freenameindex(struct if_nameindex *\fP\fIptr\fP\fB);\fP .fi .SH DESCRIPTION La fonction \fBif_nameindex\fP() renvoie un tableau de structures \fIif_nameindex\fP, contenant chacune des informations au sujet d'une des interfaces réseau du système local. La structure \fIif_nameindex\fP contient au moins les champs suivants\ : .PP .in +4n .EX unsigned int if_index; /* Index of interface (1, 2, ...) */ char *if_name; /* Null\-terminated name ("eth0", etc.) */ .EE .in .PP The \fIif_index\fP field contains the interface index. The \fIif_name\fP field points to the null\-terminated interface name. The end of the array is indicated by entry with \fIif_index\fP set to zero and \fIif_name\fP set to NULL. .PP La donnée renvoyée par \fBif_nameindex\fP() est dynamiquement allouée et devrait être libérée avec \fBif_freenameindex\fP() lorsqu'elle n'est plus utilisée. .SH "VALEUR RENVOYÉE" On success, \fBif_nameindex\fP() returns pointer to the array; on error, NULL is returned, and \fIerrno\fP is set to indicate the error. .SH ERREURS \fBif_nameindex\fP() peut échouer et remplir \fIerrno\fP si\ : .TP \fBENOBUFS\fP les ressources disponibles sont insuffisantes. .PP \fBgetifaddrs\fP() peut aussi échouer pour les erreurs précisées pour \fBsocket\fP(2), \fBbind\fP(2), \fBgetsockname\fP(2), \fBrecvmsg\fP(2), \fBsendto\fP(2) ou \fBmalloc\fP(3). .SH VERSIONS \fBgetifaddrs\fP() est apparue dans la glibc\ 2.1. Les versions antérieures à la glibc 2.3.4 ne géraient que les interfaces avec des adresses IPv4. La gestion des interfaces qui n'ont pas d'adresse IPv4 n'est disponible que si le noyau gère netlink. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .ad l .nh .TS allbox; lbx lb lb l l l. Interface Attribut Valeur T{ \fBif_nameindex\fP(), \fBif_freenameindex\fP() T} Sécurité des threads MT\-Safe .TE .hy .ad .sp 1 .SH STANDARDS POSIX.1\-2001, POSIX.1\-2008, RFC\ 3493. .PP Cette fonction est d'abord apparue dans BSDi. .SH EXEMPLES Le programme ci\-dessous montre l'utilisation des fonctions décrites dans cette page. Voici un exemple de sortie que ce programme peut produire\ : .PP .in +4n .EX $ \fB./a.out\fP\fI 1: lo 2: wlan0 3: em1\fP .EE .in .SS "Source du programme" .\" SRC BEGIN (if_nameindex.c) .EX #include #include #include #include int main(void) { struct if_nameindex *if_ni, *i; if_ni = if_nameindex(); if (if_ni == NULL) { perror("if_nameindex"); exit(EXIT_FAILURE); } for (i = if_ni; !(i\->if_index == 0 && i\->if_name == NULL); i++) printf("%u: %s\en", i\->if_index, i\->if_name); if_freenameindex(if_ni); exit(EXIT_SUCCESS); } .EE .\" SRC END .SH "VOIR AUSSI" \fBgetsockopt\fP(2), \fBsetsockopt\fP(2), \fBgetifaddrs\fP(3), \fBif_indextoname\fP(3), \fBif_nametoindex\fP(3), \fBifconfig\fP(8) .PP .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot , Cédric Boutillier et Frédéric Hantrais . .PP Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. .PP Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .