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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? etharp.c

?? 君正早期ucos系統(tǒng)(只有早期的才不沒有打包成庫),MPLAYER,文件系統(tǒng),圖片解碼,瀏覽,電子書,錄音,想學(xué)ucos,識貨的人就下吧 russblock fmradio explore set
?? C
?? 第 1 頁 / 共 2 頁
字號:
/** * @file * Address Resolution Protocol module for IP over Ethernet * * Functionally, ARP is divided into two parts. The first maps an IP address * to a physical address when sending a packet, and the second part answers * requests from other machines for our physical address. * * This implementation complies with RFC 826 (Ethernet ARP). It supports * Gratuitious ARP from RFC3220 (IP Mobility Support for IPv4) section 4.6 * if an interface calls etharp_query(our_netif, its_ip_addr, NULL) upon * address change. *//* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv> * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. * 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. * */#include "lwip/opt.h"#include "lwip/inet.h"#include "netif/etharp.h"#include "lwip/ip.h"#include "lwip/stats.h"/* ARP needs to inform DHCP of any ARP replies? */#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)#  include "lwip/dhcp.h"#endif/** the time an ARP entry stays valid after its last update, * (240 * 5) seconds = 20 minutes. */#define ARP_MAXAGE 240/** the time an ARP entry stays pending after first request, * (2 * 5) seconds = 10 seconds. *  * @internal Keep this number at least 2, otherwise it might * run out instantly if the timeout occurs directly after a request. */#define ARP_MAXPENDING 2#define HWTYPE_ETHERNET 1/** ARP message types */#define ARP_REQUEST 1#define ARP_REPLY 2#define ARPH_HWLEN(hdr) (ntohs((hdr)->_hwlen_protolen) >> 8)#define ARPH_PROTOLEN(hdr) (ntohs((hdr)->_hwlen_protolen) & 0xff)#define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen = htons(ARPH_PROTOLEN(hdr) | ((len) << 8))#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = htons((len) | (ARPH_HWLEN(hdr) << 8))enum etharp_state {  ETHARP_STATE_EMPTY,  ETHARP_STATE_PENDING,  ETHARP_STATE_STABLE,  /** @internal transitional state used in etharp_tmr() for convenience*/  ETHARP_STATE_EXPIRED};struct etharp_entry {#if ARP_QUEUEING  /**    * Pointer to queue of pending outgoing packets on this ARP entry.   */   struct pbuf *p;#endif  struct ip_addr ipaddr;  struct eth_addr ethaddr;  enum etharp_state state;  u8_t ctime;};static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};static struct etharp_entry arp_table[ARP_TABLE_SIZE];/** * Try hard to create a new entry - we want the IP address to appear in * the cache (even if this means removing an active entry or so). */#define ETHARP_TRY_HARD 1static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags);static err_t update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags);/** * Initializes ARP module. */voidetharp_init(void){  u8_t i;  /* clear ARP entries */  for(i = 0; i < ARP_TABLE_SIZE; ++i) {    arp_table[i].state = ETHARP_STATE_EMPTY;#if ARP_QUEUEING    arp_table[i].p = NULL;#endif    arp_table[i].ctime = 0;  }}/** * Clears expired entries in the ARP table. * * This function should be called every ETHARP_TMR_INTERVAL microseconds (5 seconds), * in order to expire entries in the ARP table. */voidetharp_tmr(void){  u8_t i;  LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer\n"));  /* remove expired entries from the ARP table */  for (i = 0; i < ARP_TABLE_SIZE; ++i) {    arp_table[i].ctime++;    /* stable entry? */    if ((arp_table[i].state == ETHARP_STATE_STABLE) &&         /* entry has become old? */        (arp_table[i].ctime >= ARP_MAXAGE)) {      LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired stable entry %"U16_F".\n", (u16_t)i));      arp_table[i].state = ETHARP_STATE_EXPIRED;    /* pending entry? */    } else if (arp_table[i].state == ETHARP_STATE_PENDING) {      /* entry unresolved/pending for too long? */      if (arp_table[i].ctime >= ARP_MAXPENDING) {        LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired pending entry %"U16_F".\n", (u16_t)i));        arp_table[i].state = ETHARP_STATE_EXPIRED;#if ARP_QUEUEING      } else if (arp_table[i].p != NULL) {        /* resend an ARP query here */#endif      }    }    /* clean up entries that have just been expired */    if (arp_table[i].state == ETHARP_STATE_EXPIRED) {#if ARP_QUEUEING      /* and empty packet queue */      if (arp_table[i].p != NULL) {        /* remove all queued packets */        LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: freeing entry %"U16_F", packet queue %p.\n", (u16_t)i, (void *)(arp_table[i].p)));        pbuf_free(arp_table[i].p);        arp_table[i].p = NULL;      }#endif      /* recycle entry for re-use */            arp_table[i].state = ETHARP_STATE_EMPTY;    }  }}/** * Search the ARP table for a matching or new entry. *  * If an IP address is given, return a pending or stable ARP entry that matches * the address. If no match is found, create a new entry with this address set, * but in state ETHARP_EMPTY. The caller must check and possibly change the * state of the returned entry. *  * If ipaddr is NULL, return a initialized new entry in state ETHARP_EMPTY. *  * In all cases, attempt to create new entries from an empty entry. If no * empty entries are available and ETHARP_TRY_HARD flag is set, recycle * old entries. Heuristic choose the least important entry for recycling. * * @param ipaddr IP address to find in ARP cache, or to add if not found. * @param flags * - ETHARP_TRY_HARD: Try hard to create a entry by allowing recycling of * active (stable or pending) entries. *   * @return The ARP entry index that matched or is created, ERR_MEM if no * entry is found or could be recycled. */static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags){  s8_t old_pending = ARP_TABLE_SIZE, old_stable = ARP_TABLE_SIZE;  s8_t empty = ARP_TABLE_SIZE;  u8_t i = 0, age_pending = 0, age_stable = 0;#if ARP_QUEUEING  /* oldest entry with packets on queue */  s8_t old_queue = ARP_TABLE_SIZE;  /* its age */  u8_t age_queue = 0;#endif  /**   * a) do a search through the cache, remember candidates   * b) select candidate entry   * c) create new entry   */  /* a) in a single search sweep, do all of this   * 1) remember the first empty entry (if any)   * 2) remember the oldest stable entry (if any)   * 3) remember the oldest pending entry without queued packets (if any)   * 4) remember the oldest pending entry with queued packets (if any)   * 5) search for a matching IP entry, either pending or stable   *    until 5 matches, or all entries are searched for.   */  for (i = 0; i < ARP_TABLE_SIZE; ++i) {    /* no empty entry found yet and now we do find one? */    if ((empty == ARP_TABLE_SIZE) && (arp_table[i].state == ETHARP_STATE_EMPTY)) {      LWIP_DEBUGF(ETHARP_DEBUG, ("find_entry: found empty entry %"U16_F"\n", (u16_t)i));      /* remember first empty entry */      empty = i;    }    /* pending entry? */    else if (arp_table[i].state == ETHARP_STATE_PENDING) {      /* if given, does IP address match IP address in ARP entry? */      if (ipaddr && ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {        LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: found matching pending entry %"U16_F"\n", (u16_t)i));        /* found exact IP address match, simply bail out */        return i;#if ARP_QUEUEING      /* pending with queued packets? */      } else if (arp_table[i].p != NULL) {        if (arp_table[i].ctime >= age_queue) {          old_queue = i;          age_queue = arp_table[i].ctime;        }#endif      /* pending without queued packets? */      } else {        if (arp_table[i].ctime >= age_pending) {          old_pending = i;          age_pending = arp_table[i].ctime;        }      }            }    /* stable entry? */    else if (arp_table[i].state == ETHARP_STATE_STABLE) {      /* if given, does IP address match IP address in ARP entry? */      if (ipaddr && ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {        LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: found matching stable entry %"U16_F"\n", (u16_t)i));        /* found exact IP address match, simply bail out */        return i;      /* remember entry with oldest stable entry in oldest, its age in maxtime */      } else if (arp_table[i].ctime >= age_stable) {        old_stable = i;        age_stable = arp_table[i].ctime;      }    }  }  /* { we have no match } => try to create a new entry */     /* no empty entry found and not allowed to recycle? */  if ((empty == ARP_TABLE_SIZE) && ((flags & ETHARP_TRY_HARD) == 0))  {  	return (s8_t)ERR_MEM;  }    /* b) choose the least destructive entry to recycle:   * 1) empty entry   * 2) oldest stable entry   * 3) oldest pending entry without queued packets   * 4) oldest pending entry without queued packets   *    * { ETHARP_TRY_HARD is set at this point }   */   /* 1) empty entry available? */  if (empty < ARP_TABLE_SIZE) {    i = empty;    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting empty entry %"U16_F"\n", (u16_t)i));  }  /* 2) found recyclable stable entry? */  else if (old_stable < ARP_TABLE_SIZE) {    /* recycle oldest stable*/    i = old_stable;    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting oldest stable entry %"U16_F"\n", (u16_t)i));#if ARP_QUEUEING    /* no queued packets should exist on stable entries */    LWIP_ASSERT("arp_table[i].p == NULL", arp_table[i].p == NULL);#endif  /* 3) found recyclable pending entry without queued packets? */  } else if (old_pending < ARP_TABLE_SIZE) {    /* recycle oldest pending */    i = old_pending;    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting oldest pending entry %"U16_F" (without queue)\n", (u16_t)i));#if ARP_QUEUEING  /* 4) found recyclable pending entry with queued packets? */  } else if (old_queue < ARP_TABLE_SIZE) {    /* recycle oldest pending */    i = old_queue;    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting oldest pending entry %"U16_F", freeing packet queue %p\n", (u16_t)i, (void *)(arp_table[i].p)));    pbuf_free(arp_table[i].p);    arp_table[i].p = NULL;#endif    /* no empty or recyclable entries found */  } else {    return (s8_t)ERR_MEM;  }  /* { empty or recyclable entry found } */  LWIP_ASSERT("i < ARP_TABLE_SIZE", i < ARP_TABLE_SIZE);  /* recycle entry (no-op for an already empty entry) */  arp_table[i].state = ETHARP_STATE_EMPTY;  /* IP address given? */  if (ipaddr != NULL) {    /* set IP address */    ip_addr_set(&arp_table[i].ipaddr, ipaddr);  }  arp_table[i].ctime = 0;  return (err_t)i;}/** * Update (or insert) a IP/MAC address pair in the ARP cache. * * If a pending entry is resolved, any queued packets will be sent * at this point. *  * @param ipaddr IP address of the inserted ARP entry. * @param ethaddr Ethernet address of the inserted ARP entry. * @param flags Defines behaviour: * - ETHARP_TRY_HARD Allows ARP to insert this as a new item. If not specified, * only existing ARP entries will be updated. * * @return * - ERR_OK Succesfully updated ARP cache. * - ERR_MEM If we could not add a new ARP entry when ETHARP_TRY_HARD was set. * - ERR_ARG Non-unicast address given, those will not appear in ARP cache. * * @see pbuf_free() */static err_tupdate_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags){  s8_t i, k;  LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 3, ("update_arp_entry()\n"));  LWIP_ASSERT("netif->hwaddr_len != 0", netif->hwaddr_len != 0);   LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n",                                        ip4_addr1(ipaddr), ip4_addr2(ipaddr), ip4_addr3(ipaddr), ip4_addr4(ipaddr),                                         ethaddr->addr[0], ethaddr->addr[1], ethaddr->addr[2],                                        ethaddr->addr[3], ethaddr->addr[4], ethaddr->addr[5]));  /* non-unicast address? */  if (ip_addr_isany(ipaddr) ||      ip_addr_isbroadcast(ipaddr, netif) ||      ip_addr_ismulticast(ipaddr)) {    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: will not add non-unicast IP address to ARP cache\n"));    return ERR_ARG;  }  /* find or create ARP entry */  i = find_entry(ipaddr, flags);  /* bail out if no entry could be found */  if (i < 0) return (err_t)i;    /* mark it stable */  arp_table[i].state = ETHARP_STATE_STABLE;  LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: updating stable entry %"S16_F"\n", (s16_t)i));  /* update address */  for (k = 0; k < netif->hwaddr_len; ++k) {    arp_table[i].ethaddr.addr[k] = ethaddr->addr[k];  }  /* reset time stamp */  arp_table[i].ctime = 0;/* this is where we will send out queued packets! */#if ARP_QUEUEING  while (arp_table[i].p != NULL) {    /* get the first packet on the queue */    struct pbuf *p = arp_table[i].p;    /* Ethernet header */    struct eth_hdr *ethhdr = p->payload;    /* remember (and reference) remainder of queue */    /* note: this will also terminate the p pbuf chain */    arp_table[i].p = pbuf_dequeue(p);    /* fill-in Ethernet header */    for (k = 0; k < netif->hwaddr_len; ++k) {      ethhdr->dest.addr[k] = ethaddr->addr[k];      ethhdr->src.addr[k] = netif->hwaddr[k];    }    ethhdr->type = htons(ETHTYPE_IP);    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: sending queued IP packet %p.\n", (void *)p));    /* send the queued IP packet */    netif->linkoutput(netif, p);    /* free the queued IP packet */    pbuf_free(p);  }#endif  return ERR_OK;}/**

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本午夜精品视频在线观看| 亚洲欧美一区二区三区久本道91| 午夜欧美大尺度福利影院在线看| 欧美专区在线观看一区| 亚洲一区二区精品久久av| 欧美理论片在线| 免费看欧美美女黄的网站| 欧美一区二区在线免费观看| 免费看欧美美女黄的网站| 久久九九久久九九| 成人视屏免费看| 亚洲激情图片qvod| 欧美丰满美乳xxx高潮www| 久久av中文字幕片| 中文字幕在线免费不卡| 欧美亚洲免费在线一区| 精品亚洲免费视频| 国产精品免费网站在线观看| 日本韩国欧美国产| 青草国产精品久久久久久| 国产欧美一区视频| 欧美性欧美巨大黑白大战| 免费不卡在线观看| 成人免费视频在线观看| 91精品国产综合久久精品| 国产精品中文字幕一区二区三区| 怡红院av一区二区三区| 欧美精品一区二区蜜臀亚洲| 色综合久久综合中文综合网| 激情综合色综合久久综合| 亚洲日穴在线视频| 日韩欧美区一区二| 91免费小视频| 九九精品视频在线看| 亚洲欧美日韩中文播放| 亚洲精品一区二区三区四区高清 | 欧美日韩国产在线播放网站| 久久99国产乱子伦精品免费| 亚洲男同1069视频| 久久久综合网站| 欧美精品亚洲二区| 99热精品一区二区| 国产在线一区二区| 婷婷一区二区三区| 中文字幕综合网| 国产午夜精品美女毛片视频| 欧美日韩精品免费| 91啦中文在线观看| 国产毛片精品国产一区二区三区| 亚洲综合自拍偷拍| 国产精品看片你懂得 | 2022国产精品视频| 欧美日本国产一区| 色女孩综合影院| 成人免费毛片aaaaa**| 国产在线视频一区二区三区| 日韩高清不卡在线| 亚洲国产日韩a在线播放| 专区另类欧美日韩| 国产精品丝袜久久久久久app| 精品噜噜噜噜久久久久久久久试看 | 日韩精品1区2区3区| 一区二区三区色| 亚洲色图制服诱惑 | www日韩大片| 欧美一区二区三区免费大片| 欧美丝袜丝nylons| 99精品在线免费| 成人99免费视频| 高清在线成人网| 国产成人aaa| 国产精品一区在线| 国产一区二区三区在线看麻豆| 久久精品国产精品亚洲综合| 日韩va欧美va亚洲va久久| 日韩不卡一二三区| 日韩和欧美的一区| 青青草国产成人av片免费 | 精品一区二区三区av| 激情文学综合插| 激情五月婷婷综合| 国产在线精品一区在线观看麻豆| 韩国在线一区二区| 成人性视频免费网站| 97精品久久久午夜一区二区三区| 91蜜桃传媒精品久久久一区二区| 色综合久久久久久久久久久| 91久久免费观看| 欧美丰满少妇xxxbbb| 精品伦理精品一区| 日本一区二区电影| 亚洲欧美二区三区| 亚洲电影激情视频网站| 亚洲成人三级小说| 极品尤物av久久免费看| 国产成人免费9x9x人网站视频| 波多野结衣一区二区三区| 色哟哟日韩精品| 欧美一区二区三区日韩视频| 久久精品视频免费| 亚洲美女少妇撒尿| 免费在线看成人av| 国产91精品入口| 91福利区一区二区三区| 日韩一区二区三区高清免费看看| 日韩免费观看高清完整版在线观看| 久久久精品tv| 一区二区三区美女| 蜜桃av一区二区三区电影| 国产精品中文欧美| 欧美色综合网站| 精品国产sm最大网站| 亚洲欧美在线观看| 琪琪久久久久日韩精品| 国产不卡高清在线观看视频| 在线观看视频欧美| 久久影视一区二区| 亚洲精品久久久蜜桃| 美国毛片一区二区| 色婷婷av一区二区三区软件 | 精品福利视频一区二区三区| 国产精品天干天干在线综合| 亚洲成av人在线观看| 成人亚洲一区二区一| 69堂成人精品免费视频| 中文字幕一区二区三区四区不卡| 日本v片在线高清不卡在线观看| 成人深夜在线观看| 欧美刺激午夜性久久久久久久| 亚洲丝袜美腿综合| 国产精品中文字幕日韩精品| 欧美日韩精品久久久| 国产精品女同互慰在线看| 免费一级片91| 欧美日韩一区久久| 国产精品欧美综合在线| 久久99精品久久久久婷婷| 在线中文字幕不卡| 中文字幕一区二区三中文字幕| 精品亚洲成a人| 91精品国产综合久久香蕉的特点| 亚洲欧美偷拍卡通变态| 国产福利一区二区三区在线视频| 91麻豆精品国产91久久久久久| 一二三四区精品视频| 黑人巨大精品欧美一区| 欧美一区三区二区| 亚洲一区二区不卡免费| 99久久婷婷国产综合精品电影| 久久久久久久久久久久久久久99 | 老色鬼精品视频在线观看播放| 91成人看片片| 中文在线资源观看网站视频免费不卡| 人人超碰91尤物精品国产| 欧美蜜桃一区二区三区| 亚洲国产你懂的| 欧美在线观看一区二区| 亚洲男同1069视频| 色婷婷国产精品综合在线观看| 亚洲欧美日韩国产综合| 91免费视频网址| 亚洲激情中文1区| 在线观看国产一区二区| 亚洲综合久久久| 色综合久久久久综合体桃花网| 欧美美女直播网站| 中文字幕中文在线不卡住| 国产精品88888| 久久久久国产精品厨房| 国产成人免费在线观看不卡| 久久久噜噜噜久久中文字幕色伊伊| 狠狠色狠狠色合久久伊人| 欧美精品一区男女天堂| 黑人巨大精品欧美一区| 国产午夜精品一区二区| 成人黄色在线看| 一区二区三区四区精品在线视频 | 欧美人与z0zoxxxx视频| 日本欧洲一区二区| 日韩免费成人网| 国产成人在线色| 亚洲欧美在线观看| 欧美三级乱人伦电影| 丝袜美腿亚洲一区二区图片| 日韩欧美在线123| 国产在线观看免费一区| 国产精品萝li| 在线看一区二区| 蜜桃91丨九色丨蝌蚪91桃色| 久久蜜桃av一区精品变态类天堂 | 91蝌蚪porny| 亚洲综合在线电影| 日韩欧美在线观看一区二区三区| 国产经典欧美精品| 亚洲精品久久久久久国产精华液| 日韩一区二区三| 白白色 亚洲乱淫| 日韩va亚洲va欧美va久久| 国产日韩欧美麻豆| 欧美日韩一区在线观看|