3 * Interface Identification APIs from:
4 * RFC 3493: Basic Socket Interface Extensions for IPv6
5 * Section 4: Interface Identification
9 * Copyright (c) 2017 Joel Cunningham <joel.cunningham@me.com>
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without modificat
14 * are permitted provided that the following conditions are met:
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO E
28 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREM
31 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARIS
35 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
38 * This file is part of the lwIP TCP/IP stack.
40 * Author: Joel Cunningham <joel.cunningham@me.com>
47 #include "lwip/netifapi.h"
50 lwip_if_indextoname(unsigned ifindex, char *ifname)
57 err = netifapi_netif_index_to_name((u8_t)ifindex, ifname);
58 if (!err && ifname[0] != '\0') {
65 lwip_if_nametoindex(const char *ifname)
70 err = netifapi_netif_name_to_index(ifname, &index);
74 return 0; /* invalid index */
77 #endif /* LWIP_SOCKET */