コード例 #1
0
ファイル: ipnet_wlan.c プロジェクト: rgmabs19357/Huawei-
/*
 *===========================================================================
 *                    ipnet_wlan_if_init
 *===========================================================================
 * Description: WLAN uses the Ethernet interface with a few modifications
 * Parameters:
 * Returns:
 *
 */
IP_PUBLIC int
ipnet_wlan_if_init(Ipnet_netif *netif)
{
    int i;

    ipnet_eth_if_init(netif);

    netif->wlan = ipcom_malloc(sizeof(Ipnet_netif_wlan));
    if (netif->wlan == IP_NULL)
        return -IP_ERRNO_ENOMEM;
    ipcom_memset(netif->wlan, 0, sizeof(Ipnet_netif_wlan));

    i = 0;
    do
    {
        ipcom_sprintf(netif->ipcom.name, "wlan%d", i++);
    } while (ipnet_if_nametonetif(netif->vr_index, netif->ipcom.name) != IP_NULL);


    /* Setup link functions for WLAN use. */
    netif->wlan->eth_link_ioctl = (int (*)(Ipnet_netif *, Ip_u32, void *))netif->link_ioctl;
    netif->link_ioctl = (Ipnet_link_ioctl)ipnet_wlan_ioctl;

    return 0;
}
コード例 #2
0
/*
 *===========================================================================
 *                    ipnet_loopback_get_netif
 *===========================================================================
 * Description: Returns the loopback interface for a specific virtual router.
 * Parameters:  vr - The virtual router for which the interface should be
 *                   returned.
 * Returns:     The pointer to a loopback interface, can only be IP_NULL
 *              if the virtual router does not exists.
 *
 */
IP_GLOBAL Ipnet_netif *
ipnet_loopback_get_netif(Ip_u16 vr)
{
    return ipnet_if_nametonetif(vr, IPNET_IF_LOOPBACK_NAME);
}