#include "libkync.h"
#include <stdio.h>
#include <stdlib.h>

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]);
        printf("Card %zd: %s\tStatus: %s\tMac: %s\tIPv4: %s\tIPv6: %s\n", index + 1, cards[index], kdk_nc_is_up(cards[index]) == 1 ? "Up" : "Down", mac, ipv4,ipv6);
        free(mac);
        free(ipv4);
        free(ipv6);
        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;
}