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

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

?? uip.c

?? avr版本的uip(一個超小型的TCPIP棧,支持tcpudparpicmp.
?? C
?? 第 1 頁 / 共 4 頁
字號:

    len = (BUF->len[0] << 8) + BUF->len[1] - (BUF->vhl & 0x0f) * 4;
    offset = (((BUF->ipoffset[0] & 0x3f) << 8) + BUF->ipoffset[1]) * 8;

    /* If the offset or the offset + fragment length overflows the
       reassembly buffer, we discard the entire packet. */
    if(offset > UIP_REASS_BUFSIZE ||
       offset + len > UIP_REASS_BUFSIZE) {
      uip_reasstmr = 0;
      goto nullreturn;
    }

    /* Copy the fragment into the reassembly buffer, at the right
       offset. */
    memcpy(&uip_reassbuf[IP_HLEN + offset],
	   (char *)BUF + (int)((BUF->vhl & 0x0f) * 4),
	   len);
      
    /* Update the bitmap. */
    if(offset / (8 * 8) == (offset + len) / (8 * 8)) {
      /* If the two endpoints are in the same byte, we only update
	 that byte. */
	     
      uip_reassbitmap[offset / (8 * 8)] |=
	     bitmap_bits[(offset / 8 ) & 7] &
	     ~bitmap_bits[((offset + len) / 8 ) & 7];
    } else {
      /* If the two endpoints are in different bytes, we update the
	 bytes in the endpoints and fill the stuff inbetween with
	 0xff. */
      uip_reassbitmap[offset / (8 * 8)] |=
	bitmap_bits[(offset / 8 ) & 7];
      for(i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) {
	uip_reassbitmap[i] = 0xff;
      }      
      uip_reassbitmap[(offset + len) / (8 * 8)] |=
	~bitmap_bits[((offset + len) / 8 ) & 7];
    }
    
    /* If this fragment has the More Fragments flag set to zero, we
       know that this is the last fragment, so we can calculate the
       size of the entire packet. We also set the
       IP_REASS_FLAG_LASTFRAG flag to indicate that we have received
       the final fragment. */

    if((BUF->ipoffset[0] & IP_MF) == 0) {
      uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
      uip_reasslen = offset + len;
    }
    
    /* Finally, we check if we have a full packet in the buffer. We do
       this by checking if we have the last fragment and if all bits
       in the bitmap are set. */
    if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) {
      /* Check all bytes up to and including all but the last byte in
	 the bitmap. */
      for(i = 0; i < uip_reasslen / (8 * 8) - 1; ++i) {
	if(uip_reassbitmap[i] != 0xff) {
	  goto nullreturn;
	}
      }
      /* Check the last byte in the bitmap. It should contain just the
	 right amount of bits. */
      if(uip_reassbitmap[uip_reasslen / (8 * 8)] !=
	 (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) {
	goto nullreturn;
      }

      /* If we have come this far, we have a full packet in the
	 buffer, so we allocate a pbuf and copy the packet into it. We
	 also reset the timer. */
      uip_reasstmr = 0;
      memcpy(BUF, FBUF, uip_reasslen);

      /* Pretend to be a "normal" (i.e., not fragmented) IP packet
	 from now on. */
      BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
      BUF->len[0] = uip_reasslen >> 8;
      BUF->len[1] = uip_reasslen & 0xff;
      BUF->ipchksum = 0;
      BUF->ipchksum = ~(uip_ipchksum());

      return uip_reasslen;
    }
  }

 nullreturn:
  return 0;
}
#endif /* UIP_REASSEMBL */
/*-----------------------------------------------------------------------------------*/
static void
uip_add_rcv_nxt(u16_t n)
{
  uip_add32(uip_conn->rcv_nxt, n);
  uip_conn->rcv_nxt[0] = uip_acc32[0];
  uip_conn->rcv_nxt[1] = uip_acc32[1];
  uip_conn->rcv_nxt[2] = uip_acc32[2];
  uip_conn->rcv_nxt[3] = uip_acc32[3];
}
/*-----------------------------------------------------------------------------------*/
void
uip_process(u8_t flag)
{
  register struct uip_conn *uip_connr = uip_conn;
  
  uip_appdata = &uip_buf[40 + UIP_LLH_LEN];

  
  /* Check if we were invoked because of the perodic timer fireing. */
  if(flag == UIP_TIMER) {
#if UIP_REASSEMBLY
    if(uip_reasstmr != 0) {
      --uip_reasstmr;
    }
#endif /* UIP_REASSEMBLY */
    /* Increase the initial sequence number. */
    if(++iss[3] == 0) {
      if(++iss[2] == 0) {
	if(++iss[1] == 0) {
	  ++iss[0];
	}
      }
    }    
    uip_len = 0;
    if(uip_connr->tcpstateflags == TIME_WAIT ||
       uip_connr->tcpstateflags == FIN_WAIT_2) {
      ++(uip_connr->timer);
      if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) {
	uip_connr->tcpstateflags = CLOSED;
      }
    } else if(uip_connr->tcpstateflags != CLOSED) {
      /* If the connection has outstanding data, we increase the
	 connection's timer and see if it has reached the RTO value
	 in which case we retransmit. */
      if(uip_outstanding(uip_connr)) {
	if(uip_connr->timer-- == 0) {
	  if(uip_connr->nrtx == UIP_MAXRTX ||
	     ((uip_connr->tcpstateflags == SYN_SENT ||
	       uip_connr->tcpstateflags == SYN_RCVD) &&
	      uip_connr->nrtx == UIP_MAXSYNRTX)) {
	    uip_connr->tcpstateflags = CLOSED;

	    /* We call UIP_APPCALL() with uip_flags set to
	       UIP_TIMEDOUT to inform the application that the
	       connection has timed out. */
	    uip_flags = UIP_TIMEDOUT;
	    UIP_APPCALL();

	    /* We also send a reset packet to the remote host. */
	    BUF->flags = TCP_RST | TCP_ACK;
	    goto tcp_send_nodata;
	  }

	  /* Exponential backoff. */
	  uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4?
					 4:
					 uip_connr->nrtx);
	  ++(uip_connr->nrtx);
	  
	  /* Ok, so we need to retransmit. We do this differently
	     depending on which state we are in. In ESTABLISHED, we
	     call upon the application so that it may prepare the
	     data for the retransmit. In SYN_RCVD, we resend the
	     SYNACK that we sent earlier and in LAST_ACK we have to
	     retransmit our FINACK. */
	  UIP_STAT(++uip_stat.tcp.rexmit);
	  switch(uip_connr->tcpstateflags & TS_MASK) {
	  case SYN_RCVD:
	    /* In the SYN_RCVD state, we should retransmit our
               SYNACK. */
	    goto tcp_send_synack;
	    
#if UIP_ACTIVE_OPEN
	  case SYN_SENT:
	    /* In the SYN_SENT state, we retransmit out SYN. */
	    BUF->flags = 0;
	    goto tcp_send_syn;
#endif /* UIP_ACTIVE_OPEN */
	    
	  case ESTABLISHED:
	    /* In the ESTABLISHED state, we call upon the application
               to do the actual retransmit after which we jump into
               the code for sending out the packet (the apprexmit
               label). */
	    uip_len = 0;
	    uip_slen = 0;
	    uip_flags = UIP_REXMIT;
	    UIP_APPCALL();
	    goto apprexmit;
	    
	  case FIN_WAIT_1:
	  case CLOSING:
	  case LAST_ACK:
	    /* In all these states we should retransmit a FINACK. */
	    goto tcp_send_finack;
	    
	  }
	}
      } else if((uip_connr->tcpstateflags & TS_MASK) == ESTABLISHED) {
	/* If there was no need for a retransmission, we poll the
           application for new data. */
	uip_len = 0;
	uip_slen = 0;
	uip_flags = UIP_POLL;
	UIP_APPCALL();
	goto appsend;
      }
    }
    goto drop;
  }
#if UIP_UDP 
  if(flag == UIP_UDP_TIMER) {
    if(uip_udp_conn->lport != 0) {
      uip_appdata = &uip_buf[UIP_LLH_LEN + 28];
      uip_len = uip_slen = 0;
      uip_flags = UIP_POLL;
      UIP_UDP_APPCALL();
      goto udp_send;
    } else {
      goto drop;
    }
  }
#endif

  /* This is where the input processing starts. */
  UIP_STAT(++uip_stat.ip.recv);


  /* Start of IPv4 input header processing code. */
  
  /* Check validity of the IP header. */  
  if(BUF->vhl != 0x45)  { /* IP version and header length. */
    UIP_STAT(++uip_stat.ip.drop);
    UIP_STAT(++uip_stat.ip.vhlerr);
    UIP_LOG("ip: invalid version or header length.");
    goto drop;
  }
  
  /* Check the size of the packet. If the size reported to us in
     uip_len doesn't match the size reported in the IP header, there
     has been a transmission error and we drop the packet. */
  
  if(BUF->len[0] != (uip_len >> 8)) { /* IP length, high byte. */
    uip_len = (uip_len & 0xff) | (BUF->len[0] << 8);
  }
  if(BUF->len[1] != (uip_len & 0xff)) { /* IP length, low byte. */
    uip_len = (uip_len & 0xff00) | BUF->len[1];
  }

  /* Check the fragment flag. */
  if((BUF->ipoffset[0] & 0x3f) != 0 ||
     BUF->ipoffset[1] != 0) { 
#if UIP_REASSEMBLY
    uip_len = uip_reass();
    if(uip_len == 0) {
      goto drop;
    }
#else
    UIP_STAT(++uip_stat.ip.drop);
    UIP_STAT(++uip_stat.ip.fragerr);
    UIP_LOG("ip: fragment dropped.");    
    goto drop;
#endif /* UIP_REASSEMBLY */
  }

  /* If we are configured to use ping IP address configuration and
     hasn't been assigned an IP address yet, we accept all ICMP
     packets. */
#if UIP_PINGADDRCONF
  if((uip_hostaddr[0] | uip_hostaddr[1]) == 0) {
    if(BUF->proto == UIP_PROTO_ICMP) {
      UIP_LOG("ip: possible ping config packet received.");
      goto icmp_input;
    } else {
      UIP_LOG("ip: packet dropped since no address assigned.");
      goto drop;
    }
  }
#endif /* UIP_PINGADDRCONF */
  
  /* Check if the packet is destined for our IP address. */  
  if(BUF->destipaddr[0] != uip_hostaddr[0]) {
    UIP_STAT(++uip_stat.ip.drop);
    UIP_LOG("ip: packet not for us.");        
    goto drop;
  }
  if(BUF->destipaddr[1] != uip_hostaddr[1]) {
    UIP_STAT(++uip_stat.ip.drop);
    UIP_LOG("ip: packet not for us.");        
    goto drop;
  }

  if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header
				    checksum. */
    UIP_STAT(++uip_stat.ip.drop);
    UIP_STAT(++uip_stat.ip.chkerr);
    UIP_LOG("ip: bad checksum.");    
    goto drop;
  }

  if(BUF->proto == UIP_PROTO_TCP)  /* Check for TCP packet. If so, jump
                                     to the tcp_input label. */
    goto tcp_input;

#if UIP_UDP
  if(BUF->proto == UIP_PROTO_UDP)
    goto udp_input;
#endif /* UIP_UDP */

  if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from
					here. */
    UIP_STAT(++uip_stat.ip.drop);
    UIP_STAT(++uip_stat.ip.protoerr);
    UIP_LOG("ip: neither tcp nor icmp.");        
    goto drop;
  }
  
 icmp_input:
  UIP_STAT(++uip_stat.icmp.recv);
  
  /* ICMP echo (i.e., ping) processing. This is simple, we only change
     the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP
     checksum before we return the packet. */
  if(ICMPBUF->type != ICMP_ECHO) {
    UIP_STAT(++uip_stat.icmp.drop);
    UIP_STAT(++uip_stat.icmp.typeerr);
    UIP_LOG("icmp: not icmp echo.");
    goto drop;
  }

  /* If we are configured to use ping IP address assignment, we use
     the destination IP address of this ping packet and assign it to
     ourself. */
#if UIP_PINGADDRCONF
  if((uip_hostaddr[0] | uip_hostaddr[1]) == 0) {
    uip_hostaddr[0] = BUF->destipaddr[0];
    uip_hostaddr[1] = BUF->destipaddr[1];
  }
#endif /* UIP_PINGADDRCONF */  
  
  ICMPBUF->type = ICMP_ECHO_REPLY;
  
  if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {
    ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;
  } else {
    ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);
  }
  
  /* Swap IP addresses. */
  tmp16 = BUF->destipaddr[0];
  BUF->destipaddr[0] = BUF->srcipaddr[0];
  BUF->srcipaddr[0] = tmp16;
  tmp16 = BUF->destipaddr[1];
  BUF->destipaddr[1] = BUF->srcipaddr[1];
  BUF->srcipaddr[1] = tmp16;

  UIP_STAT(++uip_stat.icmp.sent);
  goto send;

  /* End of IPv4 input header processing code. */
  

#if UIP_UDP
  /* UDP input processing. */
 udp_input:
  /* UDP processing is really just a hack. We don't do anything to the
     UDP/IP headers, but let the UDP application do all the hard
     work. If the application sets uip_slen, it has a packet to
     send. */
#if UIP_UDP_CHECKSUMS
  if(uip_udpchksum() != 0xffff) { 
    UIP_STAT(++uip_stat.udp.drop);
    UIP_STAT(++uip_stat.udp.chkerr);
    UIP_LOG("udp: bad checksum.");    
    goto drop;
  }  

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩av亚洲一区二区图片| 高清日韩电视剧大全免费| 久久久久久久久97黄色工厂| 欧美在线不卡视频| 国产精品一二三四区| 免费成人在线观看| 亚洲精品国产a| 国产精品久久影院| 久久女同精品一区二区| 4hu四虎永久在线影院成人| 成人午夜视频免费看| 国内精品伊人久久久久av影院| 亚洲v日本v欧美v久久精品| 国产精品久久久久久久第一福利 | 国产乱码精品一品二品| 亚洲一区二区三区四区中文字幕| 国产婷婷色一区二区三区| 91精品久久久久久久99蜜桃| 色成人在线视频| 不卡一卡二卡三乱码免费网站| 国产在线视频一区二区| 日韩激情av在线| 亚洲一区免费视频| 亚洲视频每日更新| 国产精品萝li| 国产精品久久一卡二卡| 国产偷v国产偷v亚洲高清| 久久综合九色综合欧美亚洲| 91精品国产综合久久久蜜臀粉嫩| 欧美日韩一区二区三区在线 | 免费国产亚洲视频| 青青草成人在线观看| 日韩在线a电影| 日韩精品每日更新| 青青草国产成人av片免费 | 99re热视频这里只精品 | 91精品国产综合久久久久| 欧美性生活影院| 精品国产免费视频| 日韩欧美国产麻豆| 欧美一区二区精品| 欧美成人精品3d动漫h| 精品久久国产字幕高潮| 精品久久久影院| 久久精品视频在线看| 国产欧美日韩精品一区| 国产精品萝li| 一区二区三区不卡视频在线观看 | 日本免费在线视频不卡一不卡二| 亚洲一区欧美一区| 视频一区二区欧美| 久久99精品国产91久久来源| 国产高清视频一区| 不卡的av中国片| 欧洲色大大久久| 日韩精品中午字幕| 久久精品人人做人人综合| 国产精品白丝在线| 亚洲综合一区二区三区| 强制捆绑调教一区二区| 国产毛片精品视频| 色综合视频在线观看| 欧美色综合影院| 精品国产区一区| 中文字幕一区二区三区蜜月| 亚洲一二三区在线观看| 美女网站视频久久| 高清成人在线观看| 中文字幕在线不卡一区二区三区| 亚洲精品水蜜桃| 日韩高清不卡一区二区| 国产精品99久久久久久久女警 | 午夜精品aaa| 国产乱码精品1区2区3区| 色综合久久中文字幕综合网| 91麻豆精品国产自产在线 | 欧洲另类一二三四区| 欧美一级欧美三级| 国产精品拍天天在线| 亚洲成人午夜电影| 国产成人亚洲综合a∨婷婷| 欧美这里有精品| 欧美videos大乳护士334| 国产精品久久久久国产精品日日| 视频在线观看一区| www..com久久爱| 日韩片之四级片| 中文字幕一区二区三中文字幕| 香蕉成人伊视频在线观看| 国产91精品入口| 91精品国产综合久久久久久漫画 | 麻豆视频一区二区| 99久久国产免费看| 日韩视频不卡中文| 亚洲乱码中文字幕综合| 久久99最新地址| 欧美在线999| 国产亚洲短视频| 奇米综合一区二区三区精品视频| 一本一道久久a久久精品综合蜜臀| 欧美成人综合网站| 亚洲二区在线视频| 91社区在线播放| 亚洲国产电影在线观看| 久久精品噜噜噜成人88aⅴ| 色94色欧美sute亚洲线路一久 | 樱桃国产成人精品视频| 国产91丝袜在线播放| 日韩精品一区二区三区四区| 亚洲免费观看视频| 成人h版在线观看| 久久只精品国产| 久久99热这里只有精品| 欧美日韩成人一区二区| 一区二区三区在线观看动漫| 丁香激情综合五月| 久久久久国产精品麻豆ai换脸| 蜜桃久久久久久| 91精品国产乱码| 日本亚洲最大的色成网站www| 欧美体内she精高潮| 一区二区三区影院| 色一区在线观看| 亚洲免费电影在线| 99久久婷婷国产| 亚洲欧美日韩国产成人精品影院| 成人av在线电影| 亚洲视频每日更新| 色综合天天综合给合国产| 亚洲私人黄色宅男| 91色porny蝌蚪| 一区二区三区四区在线播放| 在线视频欧美精品| 亚洲一区二区三区影院| 欧美日韩国产大片| 日韩av一区二区在线影视| 欧美一级黄色片| 毛片av一区二区| www精品美女久久久tv| 国产毛片精品视频| 中文字幕不卡在线观看| 99国产欧美另类久久久精品| 亚洲免费资源在线播放| 欧美日韩免费观看一区三区| 天天色综合成人网| 日韩欧美国产精品一区| 国产一区二区调教| 国产精品成人网| 色丁香久综合在线久综合在线观看| 亚洲一二三四在线| 3d成人h动漫网站入口| 久久狠狠亚洲综合| 国产欧美精品国产国产专区 | 欧美日韩中文字幕精品| 日韩成人免费看| 久久精品人人做| 色一区在线观看| 蜜臀久久久久久久| 国产日产欧美一区二区视频| 96av麻豆蜜桃一区二区| 同产精品九九九| 国产三级精品在线| 91极品视觉盛宴| 毛片av一区二区| 国产精品美女久久久久久2018 | 成人18精品视频| 亚洲午夜在线电影| 精品精品国产高清一毛片一天堂| 成人久久18免费网站麻豆| 亚洲精品成人精品456| 91精品国产综合久久久蜜臀粉嫩 | 一本一道波多野结衣一区二区| 午夜精品久久久久久久| 久久久99精品久久| 欧美在线视频日韩| 久国产精品韩国三级视频| 一区在线观看免费| 欧美一区二区啪啪| 91网页版在线| 黄页网站大全一区二区| 有坂深雪av一区二区精品| 精品福利一二区| 色女孩综合影院| 国产美女视频91| 亚洲成人av福利| 成人欧美一区二区三区| 日韩欧美一区二区免费| 99麻豆久久久国产精品免费优播| 日韩激情视频在线观看| 亚洲欧美日韩国产一区二区三区| 日韩欧美综合在线| 欧美亚洲免费在线一区| 成人精品国产免费网站| 免费成人在线网站| 一区二区三区欧美激情| 国产午夜精品一区二区| 欧美一区二区三区在线视频| 色综合久久久久综合体桃花网| 国产精品香蕉一区二区三区| 香蕉久久一区二区不卡无毒影院 |