亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? netif.c

?? 包含lwip這個精簡IP協議棧的ucos源代碼.
?? C
字號:
/**
 * @file
 *
 * lwIP network interface abstraction
 */

/*
 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 * OF SUCH DAMAGE.
 *
 * This file is part of the lwIP TCP/IP stack.
 *
 * Author: Adam Dunkels <adam@sics.se>
 *
 */

#include "lwip/opt.h"

#include "lwip/def.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/tcp.h"

struct netif *netif_list = NULL;
struct netif *netif_default = NULL;

/**
 * Add a network interface to the list of lwIP netifs.
 *
 * @param netif a pre-allocated netif structure
 * @param ipaddr IP address for the new netif
 * @param netmask network mask for the new netif
 * @param gw default gateway IP address for the new netif
 * @param state opaque data passed to the new netif
 * @param init callback function that initializes the interface
 * @param input callback function that is called to pass
 * ingress packets up in the protocol layer stack.
 *
 * @return netif, or NULL if failed.
 */
struct netif *
netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
  struct ip_addr *gw,
  void *state,
  err_t (* init)(struct netif *netif),
  err_t (* input)(struct pbuf *p, struct netif *netif))
{
  static int netifnum = 0;
  
#if LWIP_DHCP
  /* netif not under DHCP control by default */
  netif->dhcp = NULL;
#endif
  /* remember netif specific state information data */
  netif->state = state;
  netif->num = netifnum++;
  netif->input = input;

  netif_set_addr(netif, ipaddr, netmask, gw);

  /* call user specified initialization function for netif */
  if (init(netif) != ERR_OK) {
    return NULL;
  }

  /* add this netif to the list */
  netif->next = netif_list;
  netif_list = netif;
  LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ",
    netif->name[0], netif->name[1]));
  ip_addr_debug_print(NETIF_DEBUG, ipaddr);
  LWIP_DEBUGF(NETIF_DEBUG, (" netmask "));
  ip_addr_debug_print(NETIF_DEBUG, netmask);
  LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
  ip_addr_debug_print(NETIF_DEBUG, gw);
  LWIP_DEBUGF(NETIF_DEBUG, ("\n"));
  return netif;
}

void
netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netmask,
    struct ip_addr *gw)
{
  netif_set_ipaddr(netif, ipaddr);
  netif_set_netmask(netif, netmask);
  netif_set_gw(netif, gw);
}

void netif_remove(struct netif * netif)
{
  if ( netif == NULL ) return;

  /*  is it the first netif? */
  if (netif_list == netif) {
    netif_list = netif->next;
  }
  else {
    /*  look for netif further down the list */
    struct netif * tmpNetif;
    for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) {
      if (tmpNetif->next == netif) {
        tmpNetif->next = netif->next;
        break;
        }
    }
    if (tmpNetif == NULL)
      return; /*  we didn't find any netif today */
  }
  /* this netif is default? */
  if (netif_default == netif)
    /* reset default netif */
    netif_default = NULL;
  LWIP_DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") );
}

struct netif *
netif_find(char *name)
{
  struct netif *netif;
  u8_t num;

  if (name == NULL) {
    return NULL;
  }

  num = name[2] - '0';

  for(netif = netif_list; netif != NULL; netif = netif->next) {
    if (num == netif->num &&
       name[0] == netif->name[0] &&
       name[1] == netif->name[1]) {
      LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1]));
      return netif;
    }
  }
  LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
  return NULL;
}

void
netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
{
  /* TODO: Handling of obsolete pcbs */
  /* See:  http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
#if LWIP_TCP
  struct tcp_pcb *pcb;
  struct tcp_pcb_listen *lpcb;

  /* address is actually being changed? */
  if ((ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0)
  {
    /* extern struct tcp_pcb *tcp_active_pcbs; defined by tcp.h */
    LWIP_DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: netif address being changed\n"));
    pcb = tcp_active_pcbs;
    while (pcb != NULL) {
      /* PCB bound to current local interface address? */
      if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) {
        /* this connection must be aborted */
        struct tcp_pcb *next = pcb->next;
        LWIP_DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: aborting TCP pcb %p\n", (void *)pcb));
        tcp_abort(pcb);
        pcb = next;
      } else {
        pcb = pcb->next;
      }
    }
    for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
      /* PCB bound to current local interface address? */
      if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) {
        /* The PCB is listening to the old ipaddr and
         * is set to listen to the new one instead */
        ip_addr_set(&(lpcb->local_ip), ipaddr);
      }
    }
  }
#endif
  ip_addr_set(&(netif->ip_addr), ipaddr);
#if 0 /* only allowed for Ethernet interfaces TODO: how can we check? */
  /** For Ethernet network interfaces, we would like to send a
   *  "gratuitous ARP"; this is an ARP packet sent by a node in order
   *  to spontaneously cause other nodes to update an entry in their
   *  ARP cache. From RFC 3220 "IP Mobility Support for IPv4" section 4.6.
   */ 
  etharp_query(netif, ipaddr, NULL);
#endif
  LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: IP address of interface %c%c set to %u.%u.%u.%u\n",
    netif->name[0], netif->name[1],
    ip4_addr1(&netif->ip_addr),
    ip4_addr2(&netif->ip_addr),
    ip4_addr3(&netif->ip_addr),
    ip4_addr4(&netif->ip_addr)));
}

void
netif_set_gw(struct netif *netif, struct ip_addr *gw)
{
  ip_addr_set(&(netif->gw), gw);
  LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: GW address of interface %c%c set to %u.%u.%u.%u\n",
    netif->name[0], netif->name[1],
    ip4_addr1(&netif->gw),
    ip4_addr2(&netif->gw),
    ip4_addr3(&netif->gw),
    ip4_addr4(&netif->gw)));
}

void
netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
{
  ip_addr_set(&(netif->netmask), netmask);
  LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: netmask of interface %c%c set to %u.%u.%u.%u\n",
    netif->name[0], netif->name[1],
    ip4_addr1(&netif->netmask),
    ip4_addr2(&netif->netmask),
    ip4_addr3(&netif->netmask),
    ip4_addr4(&netif->netmask)));
}

void
netif_set_default(struct netif *netif)
{
  netif_default = netif;
  LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
           netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
}

/**
 * Bring an interface up, available for processing
 * traffic.
 * 
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_up(struct netif *netif)
{
  netif->flags |= NETIF_FLAG_UP;
}

/**
 * Ask if an interface is up
 */ 
u8_t netif_is_up(struct netif *netif)
{
  return (netif->flags & NETIF_FLAG_UP)?1:0;
}

/**
 * Bring an interface down, disabling any traffic processing.
 *
 * @note: Enabling DHCP on a down interface will make it come
 * up once configured.
 * 
 * @see dhcp_start()
 */ 
void netif_set_down(struct netif *netif)
{
  netif->flags &= ~NETIF_FLAG_UP;
}

void
netif_init(void)
{
  netif_list = netif_default = NULL;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲精品一区二区| 亚洲国产精品成人综合| 国产亚洲精品精华液| ...xxx性欧美| 老汉av免费一区二区三区| 国产91丝袜在线播放| 欧美日韩亚洲综合一区| 国产精品网站一区| 精品一区二区日韩| 欧美三级乱人伦电影| 国产精品午夜电影| 极品少妇一区二区三区精品视频| 91免费观看视频在线| 久久亚洲综合av| 美日韩一区二区三区| 欧美中文字幕久久| 一区在线观看视频| 久久国产精品第一页| 欧美日韩一区二区三区高清 | 麻豆国产精品一区二区三区| 99国产精品视频免费观看| 日韩精品一区二区三区在线| 亚洲1区2区3区视频| 色先锋资源久久综合| 国产精品视频在线看| 国内精品嫩模私拍在线| 正在播放亚洲一区| 婷婷成人激情在线网| 91黄色免费版| 玉米视频成人免费看| 91在线视频在线| 中文字幕在线视频一区| 东方aⅴ免费观看久久av| 久久久久久久精| 精品综合久久久久久8888| 日韩一卡二卡三卡| 精品一区二区影视| 精品1区2区在线观看| 激情伊人五月天久久综合| 2021国产精品久久精品| 国产在线精品免费av| 久久蜜桃一区二区| 成人a免费在线看| 国产精品妹子av| 99v久久综合狠狠综合久久| 亚洲欧洲性图库| 色就色 综合激情| 亚洲第一激情av| 91麻豆精品国产91久久久| 蜜桃在线一区二区三区| 精品粉嫩aⅴ一区二区三区四区| 国内成+人亚洲+欧美+综合在线 | 久久久精品tv| 国产mv日韩mv欧美| 亚洲欧美激情视频在线观看一区二区三区| av激情综合网| 亚洲国产成人tv| 欧美一级理论片| 国产成a人亚洲| 亚洲欧美另类久久久精品2019| 欧美午夜一区二区三区 | 777久久久精品| 久久草av在线| 亚洲欧洲一区二区三区| 欧美日韩免费观看一区三区| 久久er精品视频| 中文字幕一区二区三区精华液 | 国产最新精品免费| 亚洲国产岛国毛片在线| 欧美图片一区二区三区| 久久99国产精品久久| 国产精品美女www爽爽爽| 欧美性猛交xxxx黑人交| 国产高清精品在线| 亚洲国产裸拍裸体视频在线观看乱了 | 久久亚洲综合av| 色婷婷香蕉在线一区二区| 免费人成网站在线观看欧美高清| 久久精品亚洲精品国产欧美 | 欧美另类z0zxhd电影| 国产一本一道久久香蕉| 亚洲午夜视频在线| 久久影院午夜论| 欧美精品xxxxbbbb| 99国产麻豆精品| 国内外成人在线视频| 亚洲与欧洲av电影| 国产精品三级久久久久三级| 91麻豆精品91久久久久同性| 成人av在线电影| 国模冰冰炮一区二区| 亚洲h精品动漫在线观看| 国产欧美日本一区二区三区| 欧美高清视频不卡网| 91免费精品国自产拍在线不卡| 国产资源在线一区| 男女激情视频一区| 亚洲精品成人精品456| 欧美极品另类videosde| 欧美不卡一区二区三区四区| 欧美日韩免费观看一区三区| 色婷婷综合视频在线观看| 国产成人精品午夜视频免费| 六月丁香综合在线视频| 午夜精品福利一区二区蜜股av| 亚洲人亚洲人成电影网站色| 中文av字幕一区| 国产亚洲一区字幕| 亚洲精品在线三区| 日韩美女天天操| 欧美一级理论性理论a| 欧美精品自拍偷拍| 欧美人与性动xxxx| 欧美日本国产一区| 91精品在线一区二区| 制服丝袜亚洲播放| 欧美老人xxxx18| 制服视频三区第一页精品| 91麻豆精品国产91久久久更新时间 | 国产激情偷乱视频一区二区三区| 免费成人在线网站| 激情五月婷婷综合网| 久久99日本精品| 国产在线播放一区三区四| 激情图区综合网| 国产精品综合在线视频| 国产成a人无v码亚洲福利| 粉嫩在线一区二区三区视频| 成人亚洲一区二区一| 不卡电影一区二区三区| 91色乱码一区二区三区| 欧美午夜电影一区| 91麻豆精品91久久久久久清纯| 日韩手机在线导航| 久久婷婷久久一区二区三区| 国产亚洲女人久久久久毛片| 国产精品麻豆一区二区| 亚洲激情在线播放| 亚洲成人在线免费| 另类人妖一区二区av| 国产成人精品免费在线| av资源网一区| 欧美日韩亚洲国产综合| 欧美第一区第二区| 国产精品久久久久久一区二区三区 | 日韩高清国产一区在线| 国产在线国偷精品免费看| 不卡视频一二三四| 欧美精品一卡二卡| 久久精品一区二区三区不卡| 亚洲乱码中文字幕综合| 人人超碰91尤物精品国产| 国产成人午夜片在线观看高清观看| 波多野结衣中文字幕一区| 69精品人人人人| 国产精品乱人伦中文| 日韩福利视频导航| 成人99免费视频| 日韩美女一区二区三区| 亚洲精选视频在线| 久久99精品国产.久久久久久| 91视频.com| 久久一区二区视频| 亚洲大片精品永久免费| 成人高清在线视频| 欧美v国产在线一区二区三区| 1024亚洲合集| 精品一区二区三区香蕉蜜桃| 91电影在线观看| 国产精品私房写真福利视频| 免费人成黄页网站在线一区二区| 成人av电影免费在线播放| 日韩精品最新网址| 亚洲一二三区视频在线观看| 成人av在线资源网站| 精品sm在线观看| 天天免费综合色| 色又黄又爽网站www久久| 亚洲国产激情av| 精品一区二区久久| 538prom精品视频线放| 亚洲精品国产一区二区三区四区在线| 国产麻豆精品95视频| 日韩一区二区三区在线观看| 亚洲一区二区中文在线| 高清日韩电视剧大全免费| 日韩精品中午字幕| 日本中文字幕不卡| 欧美日韩精品一区二区| 亚洲精品亚洲人成人网| bt欧美亚洲午夜电影天堂| 国产欧美日韩综合| 国产剧情一区二区三区| 欧美大黄免费观看| 麻豆成人免费电影| 91精品国产一区二区三区蜜臀| 亚洲第一主播视频| 欧美日本乱大交xxxxx| 五月综合激情网| 欧美丰满嫩嫩电影|