KDK_NC_IS_UP(3) Library Functions Manual KDK_NC_IS_UP(3) NAME kdk_nc_is_up - UP SYNOPSIS #include extern int kdk_nc_is_up(const char *nc); Link with -lkyhw. Detailed Description The main function of the interface is to detect whether the specified NIC nc is in the UP state. The argument nc is the name of the NIC, such as "eno1". RETURN VALUE On success, the Up status returns 1 and the Down status returns 0. On error, return -1. EXAMPLES #include "libkync.h" #include #include int main() { char **cards = kdk_nc_get_cardlist(); size_t index = 0; printf("\n"); while (cards[index]) { char *mac = kdk_nc_get_phymac(cards[index]); char *ipv4 = kdk_nc_get_private_ipv4(cards[index]); char *ipv6 = kdk_nc_get_private_ipv6(cards[index]); char *driver = kdk_nc_get_driver(cards[index]); char vendor[256] = " ", product[256] = " "; kdk_nc_get_vendor_and_product(cards[index], vendor, product); printf("Card %zd: %sStatus: %sMac: %sIPv4: %sIPv6: %s Vendor: %s Product: %s Type: %s driver: %s\n", index + 1, cards[index], kdk_nc_is_up(cards[index]) == 1 ? "Up" : "Down", mac, ipv4, ipv6, vendor, product, kdk_nc_is_wireless(cards[index]) ? "wireless" : "ethernet", driver); char **list4 = kdk_nc_get_ipv4(cards[index]); int i = 0; printf("AllIpV4: "); while (list4 && list4[i]) { printf("%s", list4[i++]); } printf("\n"); char **list6 = kdk_nc_get_ipv6(cards[index]); printf("AllIpV6: "); i = 0; while (list6 && list6[i]) { printf("%s", list6[i++]); } printf("\n"); free(mac); free(ipv4); free(ipv6); free(list4); free(list6); free(driver); index++; } kdk_nc_freeall(cards); char **upcards = kdk_nc_get_upcards(); index = 0; printf("\n"); while (upcards[index]) { printf("Card %zd: %s\n", index + 1, upcards[index]); index++; } kdk_nc_freeall(upcards); return 0; } CONFORMING TO These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_nc_get_cardlist(), kdk_nc_get_upcards(), kdk_nc_get_phymac(), kdk_nc_get_private_ipv4(), kdk_nc_get_ipv4(), kdk_nc_get_private_ipv6(), kdk_nc_get_ipv6(), kdk_nc_is_wireless(), kdk_nc_get_vendor_and_product(), kdk_nc_get_driver(), and kdk_nc_freeall(). SEE ALSO kdk_nc_get_cardlist(3), kdk_nc_get_upcards(3), kdk_nc_get_phymac(3), kdk_nc_get_private_ipv4(3), kdk_nc_get_ipv4(3), kdk_nc_get_private_ipv6(3), kdk_nc_get_ipv6(3), kdk_nc_is_wireless(3), kdk_nc_get_vendor_and_product(3), kdk_nc_get_driver(3), and kdk_nc_freeall(3). Linux Programmer's Manual Fri Aug 25 2023 KDK_NC_IS_UP(3)