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

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

?? ip.c

?? ucos+lwip在44b0+8019開發板上跑得比較穩定的程序。是ADS的工程
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright (c) 2001-2003 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>
 *
 */


/*-----------------------------------------------------------------------------------*/
/* ip.c
 *
 * This is the code for the IP layer.
 *
 */   
/*-----------------------------------------------------------------------------------*/

#include "lwip/opt.h"


#include "lwip/def.h"
#include "lwip/mem.h"
#include "lwip/ip.h"
#include "lwip/ip_frag.h"
#include "lwip/inet.h"
#include "lwip/netif.h"
#include "lwip/icmp.h"
#include "lwip/udp.h"
#include "lwip/tcp.h"

#include "lwip/stats.h"

#include "arch/perf.h"

#include "lwip/snmp.h"

/*dy's debug*/
//#include "snds.h"
/*dy's debug*/


#if LWIP_DHCP
#  include "lwip/dhcp.h"
#endif /* LWIP_DHCP */

/*-----------------------------------------------------------------------------------*/
/* ip_init:
 *
 * Initializes the IP layer.
 */
/*-----------------------------------------------------------------------------------*/
void
ip_init(void)
{
}
/*-----------------------------------------------------------------------------------*/
/* ip_lookup:
 *
 * An experimental feature that will be changed in future versions. Do
 * not depend on it yet...
 */
/*-----------------------------------------------------------------------------------*/
#ifdef LWIP_DEBUG
u8_t
ip_lookup(void *header, struct netif *inp)
{
  struct ip_hdr *iphdr;

  iphdr = header;

  /* not IP v4? */
  if(IPH_V(iphdr) != 4) {
    return 0;
  }

  /* Immediately accept/decline packets that are fragments or has
     options. */
#if IP_REASSEMBLY == 0
  /*  if((IPH_OFFSET(iphdr) & htons(IP_OFFMASK | IP_MF)) != 0) {
    return 0;
    }*/
#endif /* IP_REASSEMBLY == 0 */

#if IP_OPTIONS == 0
  if(IPH_HL(iphdr) != 5) {
    return 0;
  }
#endif /* IP_OPTIONS == 0 */
  
  switch(IPH_PROTO(iphdr)) {
#if LWIP_UDP > 0
  case IP_PROTO_UDP:
    return udp_lookup(iphdr, inp);
#endif /* LWIP_UDP */
#if LWIP_TCP > 0    
  case IP_PROTO_TCP:
    return 1;
#endif /* LWIP_TCP */
  case IP_PROTO_ICMP:
    return 1;
  default:
    return 0;
  }
}
#endif /* LWIP_DEBUG */
/*-----------------------------------------------------------------------------------*/
/* ip_route:
 *
 * Finds the appropriate network interface for a given IP address. It
 * searches the list of network interfaces linearly. A match is found
 * if the masked IP address of the network interface equals the masked
 * IP address given to the function.
 */
/*-----------------------------------------------------------------------------------*/
struct netif *
ip_route(struct ip_addr *dest)
{
  struct netif *netif;

  /* iterate through netifs */  
  for(netif = netif_list; netif != NULL; netif = netif->next) {
    /* network mask matches? */
    if(ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
      /* return netif on which to forward IP packet */
      return netif;
    }
  }
  /* no matching netif found, use default netif */
  return netif_default;
}
#if IP_FORWARD
/*-----------------------------------------------------------------------------------*/
/* ip_forward:
 *
 * Forwards an IP packet. It finds an appropriate route for the
 * packet, decrements the TTL value of the packet, adjusts the
 * checksum and outputs the packet on the appropriate interface.
 */
/*-----------------------------------------------------------------------------------*/
static void
ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
{
  struct netif *netif;
  
  PERF_START;
  /* Find network interface where to forward this IP packet to. */
  netif = ip_route((struct ip_addr *)&(iphdr->dest));
  if(netif == NULL) {
    DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%lx found\n",
                      iphdr->dest.addr));
    snmp_inc_ipnoroutes();
    return;
  }
  /* Do not forward packets onto the same network interface on which
     they arrived. */
  if(netif == inp) {
    DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));
    snmp_inc_ipnoroutes();
    return;
  }
  
  /* decrement TTL */
  IPH_TTL_SET(iphdr, IPH_TTL(iphdr) - 1);
  /* send ICMP if TTL == 0 */
  if(IPH_TTL(iphdr) == 0) {
    /* Don't send ICMP messages in response to ICMP messages */
    if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
      icmp_time_exceeded(p, ICMP_TE_TTL);
      snmp_inc_icmpouttimeexcds();
    }
    return;       
  }
  
  /* Incrementally update the IP checksum. */
  if(IPH_CHKSUM(iphdr) >= htons(0xffff - 0x100)) {
    IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + htons(0x100) + 1);
  } else {
    IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + htons(0x100));
  }

  DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to 0x%lx\n",
                    iphdr->dest.addr));

#ifdef IP_STATS
  ++lwip_stats.ip.fw;
  ++lwip_stats.ip.xmit;
#endif /* IP_STATS */
    snmp_inc_ipforwdatagrams();

  PERF_STOP("ip_forward");
  /* transmit pbuf on chosen interface */
  netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
}
#endif /* IP_FORWARD */
/*-----------------------------------------------------------------------------------*/
/* ip_input:
 *
 * This function is called by the network interface device driver when
 * an IP packet is received. The function does the basic checks of the
 * IP header such as packet size being at least larger than the header
 * size etc. If the packet was not destined for us, the packet is
 * forwarded (using ip_forward). The IP checksum is always checked.
 *
 * Finally, the packet is sent to the upper layer protocol input function.
 */
/*-----------------------------------------------------------------------------------*/
err_t
ip_input(struct pbuf *p, struct netif *inp) {
  static struct ip_hdr *iphdr;
  static struct netif *netif;
  static u16_t iphdrlen;
  
  

#ifdef IP_STATS
  ++lwip_stats.ip.recv;
#endif /* IP_STATS */
  snmp_inc_ipinreceives();

  /* identify the IP header */
  iphdr = p->payload;
  if(IPH_V(iphdr) != 4) {
    DEBUGF(IP_DEBUG | 1, ("IP packet dropped due to bad version number %d\n", IPH_V(iphdr)));
#if IP_DEBUG
    ip_debug_print(p);
#endif /* IP_DEBUG */
    pbuf_free(p);
#ifdef IP_STATS
    ++lwip_stats.ip.err;
    ++lwip_stats.ip.drop;
#endif /* IP_STATS */
    snmp_inc_ipunknownprotos();
    return ERR_OK;
  }
  /* obtain IP header length in number of 32-bit words */
  iphdrlen = IPH_HL(iphdr);
  /* calculate IP header length in bytes */
  iphdrlen *= 4;

  /* header length exceeds first pbuf length? */  
  if(iphdrlen > p->len) {
    DEBUGF(IP_DEBUG | 2, ("IP header (len %u) does not fit in first pbuf (len %u), IP packet droppped.\n",
      iphdrlen, p->len));
    /* free (drop) packet pbufs */
    pbuf_free(p);
#ifdef IP_STATS
    ++lwip_stats.ip.lenerr;
    ++lwip_stats.ip.drop;
#endif /* IP_STATS */
    snmp_inc_ipindiscards();
    return ERR_OK;
  }



  



  /* verify checksum */
  if(inet_chksum((void*)iphdr, iphdrlen) != 0) {

    DEBUGF(IP_DEBUG | 2, ("Checksum (0x%x) failed, IP packet dropped.\n", inet_chksum(iphdr, iphdrlen)));
#if IP_DEBUG
    ip_debug_print(p);
#endif /* IP_DEBUG */
    pbuf_free(p);
#ifdef IP_STATS
    ++lwip_stats.ip.chkerr;
    ++lwip_stats.ip.drop;
#endif /* IP_STATS */
    snmp_inc_ipindiscards();
    return ERR_OK;
  }
  
  /* Trim pbuf. This should have been done at the netif layer,
     but we'll do it anyway just to be sure that its done. */
  pbuf_realloc(p, ntohs(IPH_LEN(iphdr)));

  /* is this packet for us? */
  for(netif = netif_list; netif != NULL; netif = netif->next) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩午夜小视频| 五月综合激情婷婷六月色窝| 亚洲国产精品av| 中文字幕色av一区二区三区| 一区二区三区蜜桃| 六月丁香婷婷色狠狠久久| 国产精品一区不卡| 欧美综合亚洲图片综合区| 欧美电影免费观看高清完整版在线观看 | 精品视频1区2区| 精品三级av在线| 亚洲欧美日韩在线| 韩国在线一区二区| 在线观看日韩高清av| www精品美女久久久tv| 一区二区在线观看视频| 麻豆精品在线看| 成人av免费观看| 日韩午夜激情视频| 亚洲精品视频在线| 韩国精品一区二区| 欧美丝袜丝交足nylons图片| 久久久久久久精| 婷婷综合久久一区二区三区| 国产suv精品一区二区三区| 欧美另类一区二区三区| 国产精品女上位| 久久99精品久久久久婷婷| 91在线一区二区| 久久亚洲私人国产精品va媚药| 亚洲精品欧美综合四区| 国产电影一区二区三区| 欧美精品少妇一区二区三区| 18成人在线观看| 国产一区二区三区日韩 | 亚洲午夜激情av| 丁香婷婷综合色啪| 日韩精品影音先锋| 亚洲第一成人在线| 99免费精品在线| 久久久久亚洲蜜桃| 麻豆国产一区二区| 欧美欧美午夜aⅴ在线观看| 91久久奴性调教| 精品国产伦一区二区三区观看体验| 日韩美女视频一区| 国产一区二区福利| 欧美一区二区三区的| 一区二区欧美视频| 成人aa视频在线观看| 久久伊人中文字幕| 免费人成黄页网站在线一区二区 | 国产精品第一页第二页第三页| 麻豆视频观看网址久久| 91麻豆精品国产91久久久久久久久| 亚洲女子a中天字幕| 成人国产精品免费网站| 中文字幕欧美日韩一区| 国产一区二区按摩在线观看| 日韩视频一区二区在线观看| 天堂va蜜桃一区二区三区| 欧美在线制服丝袜| 亚洲国产综合色| 欧洲亚洲精品在线| 亚洲精品视频一区| 在线观看日韩高清av| 一区二区三区四区高清精品免费观看| 99久久精品99国产精品 | 久久99精品久久久久久国产越南| 欧美一区二区三区性视频| 亚洲一区二区不卡免费| 97久久精品人人做人人爽| 亚洲国产岛国毛片在线| 国产精品99久久久久久似苏梦涵| 日韩欧美亚洲另类制服综合在线| 石原莉奈在线亚洲三区| 欧美精品v日韩精品v韩国精品v| 亚洲高清久久久| 欧美日韩一区二区不卡| 亚洲电影在线播放| 欧美高清性hdvideosex| 日韩专区一卡二卡| 欧美精品视频www在线观看| 日本在线不卡视频| 欧美大片在线观看| 国产精品1区二区.| 国产精品二三区| 欧美午夜理伦三级在线观看| 天天综合网 天天综合色| 欧美日韩国产123区| 蜜桃视频一区二区三区在线观看| 亚洲精品在线观看网站| 高清在线不卡av| 狠狠狠色丁香婷婷综合激情 | 日韩电影在线观看网站| 欧美一个色资源| 国产一区二区三区不卡在线观看| 国产无遮挡一区二区三区毛片日本| 成人午夜在线播放| 亚洲一区二区三区美女| 欧美一区二区三区的| 国产成人av电影在线| 国产精品久久久久久亚洲毛片| 色噜噜狠狠色综合中国| 日日欢夜夜爽一区| 久久在线观看免费| 色一情一乱一乱一91av| 青青青伊人色综合久久| 久久久91精品国产一区二区三区| 99久久久久久| 日韩高清不卡一区二区三区| 精品粉嫩aⅴ一区二区三区四区| 精品对白一区国产伦| 婷婷开心久久网| 久久久亚洲午夜电影| 欧美在线视频日韩| 国产永久精品大片wwwapp| 亚洲欧美日韩国产一区二区三区 | 日韩不卡一二三区| 中文字幕高清一区| 欧美高清hd18日本| 丰满亚洲少妇av| 三级欧美韩日大片在线看| 国产校园另类小说区| 久久综合九色综合97婷婷| 91亚洲精品久久久蜜桃网站 | 欧美一区二区高清| av一区二区三区四区| 日韩电影免费在线看| 国产精品久久久久久久久免费相片| 欧美美女视频在线观看| 风间由美一区二区av101| 日韩激情中文字幕| 综合久久综合久久| 日韩欧美国产成人一区二区| 99久久精品国产一区| 精品一区二区三区在线观看国产| 亚洲女人****多毛耸耸8| 久久综合久色欧美综合狠狠| 在线一区二区三区| 成人国产精品免费观看动漫| 国产亚洲精品bt天堂精选| 欧美福利视频导航| 色综合亚洲欧洲| 国产成人在线视频播放| 日本成人中文字幕| 亚洲一区二区精品视频| 亚洲国产高清不卡| 久久嫩草精品久久久精品| 欧美日韩成人一区| 在线观看区一区二| www.欧美日韩| 国产成都精品91一区二区三 | 久久免费电影网| 91精品国产入口在线| 91福利视频在线| 91首页免费视频| 国产精品 欧美精品| 精品一区免费av| 亚洲欧美综合另类在线卡通| 欧美sm极限捆绑bd| 欧美一区二区三区婷婷月色| 欧美性xxxxxx少妇| 国内国产精品久久| 麻豆高清免费国产一区| 亚洲bt欧美bt精品777| 一区二区三区鲁丝不卡| 亚洲欧美日韩电影| 亚洲乱码国产乱码精品精98午夜 | 久久精品99国产国产精| 日韩国产精品91| 五月婷婷另类国产| 亚洲图片有声小说| 玉米视频成人免费看| 玉足女爽爽91| 亚洲国产中文字幕在线视频综合| 亚洲欧美视频一区| 一区二区三区免费| 亚洲成在线观看| 亚洲成av人片观看| 视频精品一区二区| 美女网站色91| 韩国三级中文字幕hd久久精品| 久久av资源站| 国内精品伊人久久久久影院对白| 美女视频一区在线观看| 免费看黄色91| 韩国视频一区二区| 粉嫩av一区二区三区在线播放| 风流少妇一区二区| 99re视频精品| 91久久免费观看| 欧美日本免费一区二区三区| 欧美高清视频一二三区| 9191国产精品| 精品久久久久久最新网址| 久久久久久久久久美女| 国产精品免费视频网站| 亚洲色图欧洲色图| 亚洲国产精品天堂|