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

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

?? uip.c

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

  /* Demultiplex this UDP packet between the UDP "connections". */
  for(uip_udp_conn = &uip_udp_conns[0];
      uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS];
      ++uip_udp_conn) {
    if(uip_udp_conn->lport != 0 &&
       UDPBUF->destport == uip_udp_conn->lport &&
       (uip_udp_conn->rport == 0 ||
        UDPBUF->srcport == uip_udp_conn->rport) &&
       BUF->srcipaddr[0] == uip_udp_conn->ripaddr[0] &&
       BUF->srcipaddr[1] == uip_udp_conn->ripaddr[1]) {
      goto udp_found; 
    }
  }
  goto drop;
  
 udp_found:
  uip_len = uip_len - 28;
  uip_appdata = &uip_buf[UIP_LLH_LEN + 28];
  uip_flags = UIP_NEWDATA;
  uip_slen = 0;
  UIP_UDP_APPCALL();
 udp_send:
  if(uip_slen == 0) {
    goto drop;      
  }
  uip_len = uip_slen + 28;

  BUF->len[0] = (uip_len >> 8);
  BUF->len[1] = (uip_len & 0xff);
  
  BUF->proto = UIP_PROTO_UDP;

  UDPBUF->udplen = HTONS(uip_slen + 8);
  UDPBUF->udpchksum = 0;
#if UIP_UDP_CHECKSUMS 
  /* Calculate UDP checksum. */
  UDPBUF->udpchksum = ~(uip_udpchksum());
  if(UDPBUF->udpchksum == 0) {
    UDPBUF->udpchksum = 0xffff;
  }
#endif /* UIP_UDP_CHECKSUMS */

  BUF->srcport  = uip_udp_conn->lport;
  BUF->destport = uip_udp_conn->rport;

  BUF->srcipaddr[0] = uip_hostaddr[0];
  BUF->srcipaddr[1] = uip_hostaddr[1];
  BUF->destipaddr[0] = uip_udp_conn->ripaddr[0];
  BUF->destipaddr[1] = uip_udp_conn->ripaddr[1];
 
  uip_appdata = &uip_buf[UIP_LLH_LEN + 40];
  goto ip_send_nolen;
#endif /* UIP_UDP */
  
  /* TCP input processing. */  
 tcp_input:
  UIP_STAT(++uip_stat.tcp.recv);

  /* Start of TCP input header processing code. */
  
  if(uip_tcpchksum() != 0xffff) {   /* Compute and check the TCP
				       checksum. */
    UIP_STAT(++uip_stat.tcp.drop);
    UIP_STAT(++uip_stat.tcp.chkerr);
    UIP_LOG("tcp: bad checksum.");    
    goto drop;
  }
  
  /* Demultiplex this segment. */
  /* First check any active connections. */
  for(uip_connr = &uip_conns[0]; uip_connr < &uip_conns[UIP_CONNS]; ++uip_connr) {
    if(uip_connr->tcpstateflags != CLOSED &&
       BUF->destport == uip_connr->lport &&
       BUF->srcport == uip_connr->rport &&
       BUF->srcipaddr[0] == uip_connr->ripaddr[0] &&
       BUF->srcipaddr[1] == uip_connr->ripaddr[1]) {
      goto found;    
    }
  }

  /* If we didn't find and active connection that expected the packet,
     either this packet is an old duplicate, or this is a SYN packet
     destined for a connection in LISTEN. If the SYN flag isn't set,
     it is an old packet and we send a RST. */
  if((BUF->flags & TCP_CTL) != TCP_SYN)
    goto reset;
  
  tmp16 = BUF->destport;
  /* Next, check listening connections. */  
  for(c = 0; c < UIP_LISTENPORTS; ++c) {
    if(tmp16 == uip_listenports[c])
      goto found_listen;
  }
  
  /* No matching connection found, so we send a RST packet. */
  UIP_STAT(++uip_stat.tcp.synrst);
 reset:

  /* We do not send resets in response to resets. */
  if(BUF->flags & TCP_RST) 
    goto drop;

  UIP_STAT(++uip_stat.tcp.rst);
  
  BUF->flags = TCP_RST | TCP_ACK;
  uip_len = 40;
  BUF->tcpoffset = 5 << 4;

  /* Flip the seqno and ackno fields in the TCP header. */
  c = BUF->seqno[3];
  BUF->seqno[3] = BUF->ackno[3];  
  BUF->ackno[3] = c;
  
  c = BUF->seqno[2];
  BUF->seqno[2] = BUF->ackno[2];  
  BUF->ackno[2] = c;
  
  c = BUF->seqno[1];
  BUF->seqno[1] = BUF->ackno[1];
  BUF->ackno[1] = c;
  
  c = BUF->seqno[0];
  BUF->seqno[0] = BUF->ackno[0];  
  BUF->ackno[0] = c;

  /* We also have to increase the sequence number we are
     acknowledging. If the least significant byte overflowed, we need
     to propagate the carry to the other bytes as well. */
  if(++BUF->ackno[3] == 0) {
    if(++BUF->ackno[2] == 0) {
      if(++BUF->ackno[1] == 0) {
	++BUF->ackno[0];
      }
    }
  }
 
  /* Swap port numbers. */
  tmp16 = BUF->srcport;
  BUF->srcport = BUF->destport;
  BUF->destport = tmp16;
  
  /* 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;

  
  /* And send out the RST packet! */
  goto tcp_send_noconn;

  /* This label will be jumped to if we matched the incoming packet
     with a connection in LISTEN. In that case, we should create a new
     connection and send a SYNACK in return. */
 found_listen:
  /* First we check if there are any connections avaliable. Unused
     connections are kept in the same table as used connections, but
     unused ones have the tcpstate set to CLOSED. Also, connections in
     TIME_WAIT are kept track of and we'll use the oldest one if no
     CLOSED connections are found. Thanks to Eddie C. Dost for a very
     nice algorithm for the TIME_WAIT search. */
  uip_connr = 0;
  for(c = 0; c < UIP_CONNS; ++c) {
    if(uip_conns[c].tcpstateflags == CLOSED) {
      uip_connr = &uip_conns[c];
      break;
    }
    if(uip_conns[c].tcpstateflags == TIME_WAIT) {
      if(uip_connr == 0 ||
	 uip_conns[c].timer > uip_connr->timer) {
	uip_connr = &uip_conns[c];
      }
    }
  }

  if(uip_connr == 0) {
    /* All connections are used already, we drop packet and hope that
       the remote end will retransmit the packet at a time when we
       have more spare connections. */
    UIP_STAT(++uip_stat.tcp.syndrop);
    UIP_LOG("tcp: found no unused connections.");
    goto drop;
  }
  uip_conn = uip_connr;
  
  /* Fill in the necessary fields for the new connection. */
  uip_connr->rto = uip_connr->timer = UIP_RTO;
  uip_connr->sa = 0;
  uip_connr->sv = 4;  
  uip_connr->nrtx = 0;
  uip_connr->lport = BUF->destport;
  uip_connr->rport = BUF->srcport;
  uip_connr->ripaddr[0] = BUF->srcipaddr[0];
  uip_connr->ripaddr[1] = BUF->srcipaddr[1];
  uip_connr->tcpstateflags = SYN_RCVD;

  uip_connr->snd_nxt[0] = iss[0];
  uip_connr->snd_nxt[1] = iss[1];
  uip_connr->snd_nxt[2] = iss[2];
  uip_connr->snd_nxt[3] = iss[3];
  uip_connr->len = 1;

  /* rcv_nxt should be the seqno from the incoming packet + 1. */
  uip_connr->rcv_nxt[3] = BUF->seqno[3];
  uip_connr->rcv_nxt[2] = BUF->seqno[2];
  uip_connr->rcv_nxt[1] = BUF->seqno[1];
  uip_connr->rcv_nxt[0] = BUF->seqno[0];
  uip_add_rcv_nxt(1);

  /* Parse the TCP MSS option, if present. */
  if((BUF->tcpoffset & 0xf0) > 0x50) {
    for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {
      opt = uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + c];
      if(opt == 0x00) {
	/* End of options. */	
	break;
      } else if(opt == 0x01) {
	++c;
	/* NOP option. */
      } else if(opt == 0x02 &&
		uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0x04) {
	/* An MSS option with the right option length. */	
	tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
	  (u16_t)uip_buf[40 + UIP_LLH_LEN + 3 + c];
	uip_connr->initialmss = uip_connr->mss =
	  tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
	
	/* And we are done processing options. */
	break;
      } else {
	/* All other options have a length field, so that we easily
	   can skip past them. */
	if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {
	  /* If the length field is zero, the options are malformed
	     and we don't process them further. */
	  break;
	}
	c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];
      }      
    }
  }
  
  /* Our response will be a SYNACK. */
#if UIP_ACTIVE_OPEN
 tcp_send_synack:
  BUF->flags = TCP_ACK;    
  
 tcp_send_syn:
  BUF->flags |= TCP_SYN;    
#else /* UIP_ACTIVE_OPEN */
 tcp_send_synack:
  BUF->flags = TCP_SYN | TCP_ACK;    
#endif /* UIP_ACTIVE_OPEN */
  
  /* We send out the TCP Maximum Segment Size option with our
     SYNACK. */
  BUF->optdata[0] = 2;
  BUF->optdata[1] = 4;
  BUF->optdata[2] = (UIP_TCP_MSS) / 256;
  BUF->optdata[3] = (UIP_TCP_MSS) & 255;
  uip_len = 44;
  BUF->tcpoffset = 6 << 4;
  goto tcp_send;

  /* This label will be jumped to if we found an active connection. */
 found:
  uip_conn = uip_connr;
  uip_flags = 0;

  /* We do a very naive form of TCP reset processing; we just accept
     any RST and kill our connection. We should in fact check if the
     sequence number of this reset is wihtin our advertised window
     before we accept the reset. */
  if(BUF->flags & TCP_RST) {
    uip_connr->tcpstateflags = CLOSED;
    UIP_LOG("tcp: got reset, aborting connection.");
    uip_flags = UIP_ABORT;
    UIP_APPCALL();
    goto drop;
  }      
  /* Calculated the length of the data, if the application has sent
     any data to us. */
  c = (BUF->tcpoffset >> 4) << 2;
  /* uip_len will contain the length of the actual TCP data. This is
     calculated by subtracing the length of the TCP header (in
     c) and the length of the IP header (20 bytes). */
  uip_len = uip_len - c - 20;

  /* First, check if the sequence number of the incoming packet is
     what we're expecting next. If not, we send out an ACK with the
     correct numbers in. */
  if(uip_len > 0 &&
     (BUF->seqno[0] != uip_connr->rcv_nxt[0] ||
      BUF->seqno[1] != uip_connr->rcv_nxt[1] ||
      BUF->seqno[2] != uip_connr->rcv_nxt[2] ||
      BUF->seqno[3] != uip_connr->rcv_nxt[3])) {
    goto tcp_send_ack;
  }

  /* Next, check if the incoming segment acknowledges any outstanding
     data. If so, we update the sequence number, reset the length of
     the outstanding data, calculate RTT estimations, and reset the
     retransmission timer. */
  if((BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) {
    uip_add32(uip_connr->snd_nxt, uip_connr->len);
    if(BUF->ackno[0] == uip_acc32[0] &&
       BUF->ackno[1] == uip_acc32[1] &&
       BUF->ackno[2] == uip_acc32[2] &&
       BUF->ackno[3] == uip_acc32[3]) {
      /* Update sequence number. */
      uip_connr->snd_nxt[0] = uip_acc32[0];
      uip_connr->snd_nxt[1] = uip_acc32[1];
      uip_connr->snd_nxt[2] = uip_acc32[2];
      uip_connr->snd_nxt[3] = uip_acc32[3];
	

      /* Do RTT estimation, unless we have done retransmissions. */
      if(uip_connr->nrtx == 0) {
	signed char m;
	m = uip_connr->rto - uip_connr->timer;
	/* This is taken directly from VJs original code in his paper */
	m = m - (uip_connr->sa >> 3);
	uip_connr->sa += m;
	if(m < 0) {
	  m = -m;
	}
	m = m - (uip_connr->sv >> 2);
	uip_connr->sv += m;
	uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv;

      }
      /* Set the acknowledged flag. */
      uip_flags = UIP_ACKDATA;
      /* Reset the retransmission timer. */
      uip_connr->timer = uip_connr->rto;
    }
    
  }

  /* Do different things depending on in what state the connection is. */
  switch(uip_connr->tcpstateflags & TS_MASK) {
    /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not
	implemented, since we force the application to close when the
	peer sends a FIN (hence the application goes directly from
	ESTABLISHED to LAST_ACK). */
  case SYN_RCVD:
    /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and
       we are waiting for an ACK that acknowledges the data we sent
       out the last time. Therefore, we want to have the UIP_ACKDATA
       flag set. If so, we enter the ESTABLISHED state. */
    if(uip_flags & UIP_ACKDATA) {
      uip_connr->tcpstateflags = ESTABLISHED;
      uip_flags = UIP_CONNECTED;
      uip_connr->len = 0;
      if(uip_len > 0) {
        uip_flags |= UIP_NEWDATA;
        uip_add_rcv_nxt(uip_len);
      }
      uip_slen = 0;
      UIP_APPCALL();
      goto appsend;
    }
    goto drop;
#if UIP_ACTIVE_OPEN
  case SYN_SENT:
    /* In SYN_SENT, we wait for a SYNACK that is sent in response to
       our SYN. The rcv_nxt is set to sequence number in the SYNACK
       plus one, and we send an ACK. We move into the ESTABLISHED
       state. */
    if((uip_flags & UIP_ACKDATA) &&
       BUF->flags == (TCP_SYN | TCP_ACK)) {

      /* Parse the TCP MSS option, if present. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人被黑人高潮完整版| 日韩精品成人一区二区三区| 亚洲日本成人在线观看| 亚洲一区二区视频在线观看| 午夜久久久影院| 精品午夜一区二区三区在线观看| 国产丶欧美丶日本不卡视频| 91成人免费网站| 精品国产乱码久久久久久1区2区| 国产精品福利一区二区三区| 亚洲成人自拍网| 成人高清免费观看| 制服视频三区第一页精品| 中文字幕第一区第二区| 夜夜嗨av一区二区三区四季av| 久久福利资源站| 日本精品裸体写真集在线观看| 欧美日韩一级视频| 国产女同性恋一区二区| 亚洲精品一二三四区| 国产一区 二区| 51精品秘密在线观看| 国产精品剧情在线亚洲| 老司机午夜精品| 欧美午夜精品一区| 日韩一区在线免费观看| 精品一区二区三区欧美| 欧美日韩精品欧美日韩精品 | 天天色天天操综合| 不卡的电视剧免费网站有什么| 777色狠狠一区二区三区| 国产精品乱码一区二区三区软件| 蜜桃视频一区二区三区在线观看| 91成人免费网站| 亚洲特级片在线| 岛国一区二区三区| 国产亚洲短视频| 蜜桃av一区二区三区电影| 在线观看亚洲成人| 亚洲精品一二三区| 国产综合成人久久大片91| 日韩一区二区免费高清| 一区二区三区精品在线| 国产999精品久久久久久绿帽| 日韩欧美成人激情| 麻豆高清免费国产一区| 在线不卡一区二区| 日韩影院精彩在线| 9191成人精品久久| 麻豆国产精品视频| 精品粉嫩aⅴ一区二区三区四区| 日本特黄久久久高潮| 在线不卡免费av| 偷偷要91色婷婷| 欧美疯狂做受xxxx富婆| 亚洲成av人片在线| 日韩三级视频在线看| 麻豆国产精品视频| 久久久久久久久久看片| 成人禁用看黄a在线| 中文字幕中文字幕在线一区 | 亚洲影院在线观看| 色综合网站在线| 亚洲成人自拍网| 日韩欧美一二三| 国产精一区二区三区| 国产精品国产馆在线真实露脸| 94色蜜桃网一区二区三区| 亚洲三级免费电影| 欧美精品第1页| 国产在线精品视频| 亚洲色欲色欲www| 91最新地址在线播放| 一区二区三区**美女毛片| 欧美丝袜丝交足nylons图片| 亚洲国产成人tv| 日韩午夜精品视频| 成人做爰69片免费看网站| 亚洲欧美成aⅴ人在线观看| 欧美性色aⅴ视频一区日韩精品| 免费看日韩a级影片| 国产日产欧美精品一区二区三区| 成人免费观看视频| 偷拍一区二区三区| 欧美国产日韩一二三区| 欧美亚洲综合一区| 国产精品99久久久久久似苏梦涵| 成人欧美一区二区三区白人| 欧美日韩小视频| 成人爱爱电影网址| 日韩高清国产一区在线| 中文字幕一区二区三区乱码在线| 欧美美女直播网站| 成人av集中营| 轻轻草成人在线| 亚洲人快播电影网| 久久婷婷综合激情| 欧美日韩mp4| a4yy欧美一区二区三区| 久久激五月天综合精品| 亚洲乱码国产乱码精品精98午夜 | 成人午夜视频网站| 日韩国产一区二| 亚洲欧洲99久久| 欧美成人精品二区三区99精品| 91尤物视频在线观看| 国产美女精品在线| 日韩高清一区二区| 亚洲国产综合视频在线观看| 国产精品久久毛片a| 精品国产免费一区二区三区香蕉| 欧美午夜一区二区三区| 国产69精品久久久久毛片| 日韩激情一二三区| 夜夜爽夜夜爽精品视频| 国产精品欧美一区二区三区| 久久色在线观看| 日韩亚洲国产中文字幕欧美| 91小视频在线观看| 大胆欧美人体老妇| 国产一区二区三区久久久| 日韩高清不卡一区| 亚洲电影你懂得| 亚洲欧洲av在线| 日韩精品一区二区三区三区免费 | 国产高清久久久久| 国产毛片精品国产一区二区三区| 日本成人在线看| 日韩在线一区二区| 日韩av一二三| 麻豆精品在线播放| 久久精品99国产精品日本| 日本亚洲电影天堂| 久久精品国产999大香线蕉| 人人精品人人爱| 麻豆国产精品777777在线| 日韩成人精品视频| 美女爽到高潮91| 激情图片小说一区| 久久国内精品视频| 国产一区二区免费视频| 国产成人亚洲综合a∨猫咪| 成人性生交大片免费看视频在线 | 国精产品一区一区三区mba桃花 | 国产精品剧情在线亚洲| 久久精品噜噜噜成人88aⅴ| 综合久久国产九一剧情麻豆| 欧美国产精品专区| 国产精品福利影院| 亚洲免费观看高清完整版在线观看熊 | 91免费版在线| 国产综合色视频| 紧缚捆绑精品一区二区| 久久se这里有精品| 国产福利一区二区三区视频| 99麻豆久久久国产精品免费| 91丨porny丨最新| 在线观看91视频| 欧美一区二区三区在线| 久久综合五月天婷婷伊人| 久久久精品免费免费| 1区2区3区国产精品| 亚洲www啪成人一区二区麻豆| 奇米色777欧美一区二区| 久久成人免费电影| 久久99国产精品成人| 国产精品一卡二| 国产精品一区二区无线| 91国偷自产一区二区开放时间| 7799精品视频| 国产精品伦理在线| 视频一区欧美精品| 国产成人综合亚洲91猫咪| 在线精品视频免费播放| 26uuu亚洲| 国内成人精品2018免费看| 麻豆国产精品777777在线| 色婷婷av一区| 亚洲影院免费观看| 成人国产精品免费观看视频| 欧美一区二区三区免费大片| 亚洲综合一二三区| 91亚洲精华国产精华精华液| 久久精品欧美一区二区三区不卡 | 99re热视频精品| 久久久蜜桃精品| 国内精品嫩模私拍在线| 欧美一区二区在线免费观看| 伊人一区二区三区| 99久久99久久久精品齐齐| 中文字幕 久热精品 视频在线| 国产一区高清在线| 精品免费一区二区三区| 婷婷激情综合网| 欧美男女性生活在线直播观看| 亚洲免费观看高清在线观看| 成人激情小说乱人伦| 国产精品国产三级国产普通话99 | 国产综合成人久久大片91| 日韩欧美成人一区二区|