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

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

?? uip.c

?? avr版本的uip(一個超小型的TCPIP棧,支持tcpudparpicmp.
?? C
?? 第 1 頁 / 共 4 頁
字號:
      if((BUF->tcpoffset & 0xf0) > 0x50) {
	for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {
	  opt = uip_buf[40 + 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 = (uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
	      uip_buf[UIP_TCPIP_HLEN + 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];
	  }      
	}
      }
      uip_connr->tcpstateflags = ESTABLISHED;      
      uip_connr->rcv_nxt[0] = BUF->seqno[0];
      uip_connr->rcv_nxt[1] = BUF->seqno[1];
      uip_connr->rcv_nxt[2] = BUF->seqno[2];
      uip_connr->rcv_nxt[3] = BUF->seqno[3];
      uip_add_rcv_nxt(1);
      uip_flags = UIP_CONNECTED | UIP_NEWDATA;
      uip_connr->len = 0;
      uip_len = 0;
      uip_slen = 0;
      UIP_APPCALL();
      goto appsend;
    }
    goto reset;
#endif /* UIP_ACTIVE_OPEN */
    
  case ESTABLISHED:
    /* In the ESTABLISHED state, we call upon the application to feed
    data into the uip_buf. If the UIP_ACKDATA flag is set, the
    application should put new data into the buffer, otherwise we are
    retransmitting an old segment, and the application should put that
    data into the buffer.

    If the incoming packet is a FIN, we should close the connection on
    this side as well, and we send out a FIN and enter the LAST_ACK
    state. We require that there is no outstanding data; otherwise the
    sequence numbers will be screwed up. */

    if(BUF->flags & TCP_FIN) {
      if(uip_outstanding(uip_connr)) {
	goto drop;
      }
      uip_add_rcv_nxt(1 + uip_len);      
      uip_flags = UIP_CLOSE;
      if(uip_len > 0) {
	uip_flags |= UIP_NEWDATA;
      }
      UIP_APPCALL();
      uip_connr->len = 1;
      uip_connr->tcpstateflags = LAST_ACK;
      uip_connr->nrtx = 0;
    tcp_send_finack:
      BUF->flags = TCP_FIN | TCP_ACK;      
      goto tcp_send_nodata;
    }

    /* Check the URG flag. If this is set, the segment carries urgent
       data that we must pass to the application. */
    if(BUF->flags & TCP_URG) {
#if UIP_URGDATA > 0
      uip_urglen = (BUF->urgp[0] << 8) | BUF->urgp[1];
      if(uip_urglen > uip_len) {
	/* There is more urgent data in the next segment to come. */
	uip_urglen = uip_len;
      }
      uip_add_rcv_nxt(uip_urglen);
      uip_len -= uip_urglen;
      uip_urgdata = uip_appdata;
      uip_appdata += uip_urglen;
    } else {
      uip_urglen = 0;
#endif /* UIP_URGDATA > 0 */
      uip_appdata += (BUF->urgp[0] << 8) | BUF->urgp[1];
      uip_len -= (BUF->urgp[0] << 8) | BUF->urgp[1];
    }
    
    
    /* If uip_len > 0 we have TCP data in the packet, and we flag this
       by setting the UIP_NEWDATA flag and update the sequence number
       we acknowledge. If the application has stopped the dataflow
       using uip_stop(), we must not accept any data packets from the
       remote host. */
    if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) {
      uip_flags |= UIP_NEWDATA;
      uip_add_rcv_nxt(uip_len);
    }

    /* Check if the available buffer space advertised by the other end
       is smaller than the initial MSS for this connection. If so, we
       set the current MSS to the window size to ensure that the
       application does not send more data than the other end can
       handle.

       If the remote host advertises a zero window, we set the MSS to
       the initial MSS so that the application will send an entire MSS
       of data. This data will not be acknowledged by the receiver,
       and the application will retransmit it. This is called the
       "persistent timer" and uses the retransmission mechanim.
    */
    tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1];
    if(tmp16 > uip_connr->initialmss ||
       tmp16 == 0) {
      tmp16 = uip_connr->initialmss;
    }
    uip_connr->mss = tmp16;

    /* If this packet constitutes an ACK for outstanding data (flagged
       by the UIP_ACKDATA flag, we should call the application since it
       might want to send more data. If the incoming packet had data
       from the peer (as flagged by the UIP_NEWDATA flag), the
       application must also be notified.

       When the application is called, the global variable uip_len
       contains the length of the incoming data. The application can
       access the incoming data through the global pointer
       uip_appdata, which usually points 40 bytes into the uip_buf
       array.

       If the application wishes to send any data, this data should be
       put into the uip_appdata and the length of the data should be
       put into uip_len. If the application don't have any data to
       send, uip_len must be set to 0. */
    if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) {
      uip_slen = 0;
      UIP_APPCALL();

    appsend:
      
      if(uip_flags & UIP_ABORT) {
	uip_slen = 0;
	uip_connr->tcpstateflags = CLOSED;
	BUF->flags = TCP_RST | TCP_ACK;
	goto tcp_send_nodata;
      }

      if(uip_flags & UIP_CLOSE) {
	uip_slen = 0;
	uip_connr->len = 1;
	uip_connr->tcpstateflags = FIN_WAIT_1;
	uip_connr->nrtx = 0;
	BUF->flags = TCP_FIN | TCP_ACK;
	goto tcp_send_nodata;	
      }

      /* If uip_slen > 0, the application has data to be sent. */
      if(uip_slen > 0) {

	/* If the connection has acknowledged data, the contents of
	   the ->len variable should be discarded. */ 
	if((uip_flags & UIP_ACKDATA) != 0) {
	  uip_connr->len = 0;
	}

	/* If the ->len variable is non-zero the connection has
	   already data in transit and cannot send anymore right
	   now. */
	if(uip_connr->len == 0) {

	  /* The application cannot send more than what is allowed by
	     the mss (the minumum of the MSS and the available
	     window). */
	  if(uip_slen > uip_connr->mss) {
	    uip_slen = uip_connr->mss;
	  }

	  /* Remember how much data we send out now so that we know
	     when everything has been acknowledged. */
	  uip_connr->len = uip_slen;
	} else {

	  /* If the application already had unacknowledged data, we
	     make sure that the application does not send (i.e.,
	     retransmit) out more than it previously sent out. */
	  uip_slen = uip_connr->len;
	}
      } else {
	uip_connr->len = 0;
      }
      uip_connr->nrtx = 0;
    apprexmit:
      uip_appdata = uip_sappdata;
      
      /* If the application has data to be sent, or if the incoming
         packet had new data in it, we must send out a packet. */
      if(uip_slen > 0 && uip_connr->len > 0) {
	/* Add the length of the IP and TCP headers. */
	uip_len = uip_connr->len + UIP_TCPIP_HLEN;
	/* We always set the ACK flag in response packets. */
	BUF->flags = TCP_ACK | TCP_PSH;
	/* Send the packet. */
	goto tcp_send_noopts;
      }
      /* If there is no data to send, just send out a pure ACK if
	 there is newdata. */
      if(uip_flags & UIP_NEWDATA) {
	uip_len = UIP_TCPIP_HLEN;
	BUF->flags = TCP_ACK;
	goto tcp_send_noopts;
      }
    }
    goto drop;
  case LAST_ACK:
    /* We can close this connection if the peer has acknowledged our
       FIN. This is indicated by the UIP_ACKDATA flag. */     
    if(uip_flags & UIP_ACKDATA) {
      uip_connr->tcpstateflags = CLOSED;
      uip_flags = UIP_CLOSE;
      UIP_APPCALL();
    }
    break;
    
  case FIN_WAIT_1:
    /* The application has closed the connection, but the remote host
       hasn't closed its end yet. Thus we do nothing but wait for a
       FIN from the other side. */
    if(uip_len > 0) {
      uip_add_rcv_nxt(uip_len);
    }
    if(BUF->flags & TCP_FIN) {
      if(uip_flags & UIP_ACKDATA) {
	uip_connr->tcpstateflags = TIME_WAIT;
	uip_connr->timer = 0;
	uip_connr->len = 0;
      } else {
	uip_connr->tcpstateflags = CLOSING;
      }
      uip_add_rcv_nxt(1);
      uip_flags = UIP_CLOSE;
      UIP_APPCALL();
      goto tcp_send_ack;
    } else if(uip_flags & UIP_ACKDATA) {
      uip_connr->tcpstateflags = FIN_WAIT_2;
      uip_connr->len = 0;
      goto drop;
    }
    if(uip_len > 0) {
      goto tcp_send_ack;
    }
    goto drop;
      
  case FIN_WAIT_2:
    if(uip_len > 0) {
      uip_add_rcv_nxt(uip_len);
    }
    if(BUF->flags & TCP_FIN) {
      uip_connr->tcpstateflags = TIME_WAIT;
      uip_connr->timer = 0;
      uip_add_rcv_nxt(1);
      uip_flags = UIP_CLOSE;
      UIP_APPCALL();
      goto tcp_send_ack;
    }
    if(uip_len > 0) {
      goto tcp_send_ack;
    }
    goto drop;

  case TIME_WAIT:
    goto tcp_send_ack;
    
  case CLOSING:
    if(uip_flags & UIP_ACKDATA) {
      uip_connr->tcpstateflags = TIME_WAIT;
      uip_connr->timer = 0;
    }
  }  
  goto drop;
  

  /* We jump here when we are ready to send the packet, and just want
     to set the appropriate TCP sequence numbers in the TCP header. */
 tcp_send_ack:
  BUF->flags = TCP_ACK;
 tcp_send_nodata:
  uip_len = 40;
 tcp_send_noopts:
  BUF->tcpoffset = 5 << 4;
 tcp_send:
  /* We're done with the input processing. We are now ready to send a
     reply. Our job is to fill in all the fields of the TCP and IP
     headers before calculating the checksum and finally send the
     packet. */
  BUF->ackno[0] = uip_connr->rcv_nxt[0];
  BUF->ackno[1] = uip_connr->rcv_nxt[1];
  BUF->ackno[2] = uip_connr->rcv_nxt[2];
  BUF->ackno[3] = uip_connr->rcv_nxt[3];
  
  BUF->seqno[0] = uip_connr->snd_nxt[0];
  BUF->seqno[1] = uip_connr->snd_nxt[1];
  BUF->seqno[2] = uip_connr->snd_nxt[2];
  BUF->seqno[3] = uip_connr->snd_nxt[3];

  BUF->proto = UIP_PROTO_TCP;
  
  BUF->srcport  = uip_connr->lport;
  BUF->destport = uip_connr->rport;

  BUF->srcipaddr[0] = uip_hostaddr[0];
  BUF->srcipaddr[1] = uip_hostaddr[1];
  BUF->destipaddr[0] = uip_connr->ripaddr[0];
  BUF->destipaddr[1] = uip_connr->ripaddr[1];
 

  if(uip_connr->tcpstateflags & UIP_STOPPED) {
    /* If the connection has issued uip_stop(), we advertise a zero
       window so that the remote host will stop sending data. */
    BUF->wnd[0] = BUF->wnd[1] = 0;
  } else {
    BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8);
    BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff); 
  }

 tcp_send_noconn:

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

  /* Calculate TCP checksum. */
  BUF->tcpchksum = 0;
  BUF->tcpchksum = ~(uip_tcpchksum());
  
 ip_send_nolen:

  BUF->vhl = 0x45;
  BUF->tos = 0;
  BUF->ipoffset[0] = BUF->ipoffset[1] = 0;
  BUF->ttl  = UIP_TTL;
  ++ipid;
  BUF->ipid[0] = ipid >> 8;
  BUF->ipid[1] = ipid & 0xff;
  
  /* Calculate IP checksum. */
  BUF->ipchksum = 0;
  BUF->ipchksum = ~(uip_ipchksum());

  UIP_STAT(++uip_stat.tcp.sent);
 send:
  UIP_STAT(++uip_stat.ip.sent);
  /* Return and let the caller do the actual transmission. */
  return;
 drop:
  uip_len = 0;
  return;
}
/*-----------------------------------------------------------------------------------*/
u16_t
htons(u16_t val)
{
  return HTONS(val);
}
/*-----------------------------------------------------------------------------------*/
/** @} */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品女同互慰在线看| 捆绑紧缚一区二区三区视频| 亚洲成人资源网| 国产成人8x视频一区二区| 97久久超碰国产精品电影| 337p亚洲精品色噜噜噜| 中文字幕日韩一区二区| 久草精品在线观看| 欧美在线播放高清精品| 国产精品网曝门| 激情都市一区二区| 制服丝袜av成人在线看| 一区二区三区毛片| 国产成人免费视频网站| 欧美一区二区精品在线| 亚洲欧美日韩国产一区二区三区| 精品中文字幕一区二区小辣椒| 欧美综合在线视频| 亚洲色图欧美偷拍| eeuss鲁片一区二区三区在线观看| 日韩精品一区二区三区swag| 日韩av电影一区| 欧美在线免费观看亚洲| 夜夜嗨av一区二区三区网页| 91影视在线播放| 亚洲天堂av一区| 成人app下载| 国产精品久久久久一区| 成人h版在线观看| 国产精品系列在线| 成人看片黄a免费看在线| 久久久久久久久久电影| 国产在线日韩欧美| 国产午夜精品理论片a级大结局 | 日韩一区二区三区观看| 亚洲成人精品在线观看| 欧美三级韩国三级日本三斤| 亚洲成av人**亚洲成av**| 欧美在线色视频| 五月天视频一区| 91精品国产色综合久久不卡电影| 日韩成人一级片| 精品国产99国产精品| 国产精品资源网| 国产精品视频观看| 91搞黄在线观看| 五月天激情小说综合| 欧美一级日韩免费不卡| 国产尤物一区二区在线| 日本一区二区成人| 色欧美88888久久久久久影院| 亚洲免费毛片网站| 91精品国产色综合久久不卡蜜臀 | 亚洲国产综合色| 91精品国产乱码| 国产精品亚洲第一| 综合欧美亚洲日本| 欧美高清dvd| 国产一区二区三区综合| 综合激情网...| 欧美一级欧美一级在线播放| 成人小视频免费在线观看| 亚洲一区在线观看网站| 精品久久一区二区三区| 成人av网在线| 日本女人一区二区三区| 国产精品久久久久久福利一牛影视| 色综合久久精品| 久久国产精品一区二区| 亚洲色图视频免费播放| 精品奇米国产一区二区三区| av中文字幕一区| 久久电影网电视剧免费观看| 最近中文字幕一区二区三区| 日韩精品一区在线| 欧美专区日韩专区| 国产精品一二三四区| 亚洲一区中文在线| 中文字幕第一区二区| 91.麻豆视频| 91美女在线观看| 国产麻豆精品久久一二三| 亚洲国产精品久久久男人的天堂| 日韩精品中文字幕一区二区三区| 一本久久综合亚洲鲁鲁五月天| 精品午夜久久福利影院| 亚洲一区二区在线播放相泽| 中文字幕免费不卡| 欧美精品一区视频| 欧美伦理视频网站| 日本韩国欧美一区| 丁香婷婷综合色啪| 久久91精品国产91久久小草| 亚洲午夜激情网站| 亚洲精品少妇30p| 国产精品国产a级| 国产欧美一区二区三区在线老狼| 欧美一级夜夜爽| 欧美精品欧美精品系列| 欧美午夜电影一区| 91国偷自产一区二区开放时间 | 久久av中文字幕片| 日韩中文字幕不卡| 一区二区三区成人| 中文字幕一区日韩精品欧美| 久久精品一区二区| 久久久精品综合| 久久久一区二区| 久久久综合精品| 亚洲精品在线电影| 精品国产不卡一区二区三区| 91精品国产综合久久精品app| 欧美私人免费视频| 欧美日韩一区二区三区不卡| 欧美日韩视频一区二区| 欧美丝袜第三区| 在线精品视频免费观看| 在线亚洲一区二区| 欧美三日本三级三级在线播放| 91国产成人在线| 3d动漫精品啪啪一区二区竹菊| 欧美精品v日韩精品v韩国精品v| 欧美丰满高潮xxxx喷水动漫 | av电影天堂一区二区在线| 成年人网站91| 色呦呦一区二区三区| 色婷婷久久综合| 欧美日韩免费在线视频| 欧美一级日韩一级| 欧美激情一区在线观看| 最好看的中文字幕久久| 亚洲gay无套男同| 蜜臀91精品一区二区三区| 国产麻豆精品在线| 99视频热这里只有精品免费| 色999日韩国产欧美一区二区| 欧美理论在线播放| 欧美电影精品一区二区| 国产欧美久久久精品影院| 亚洲美女免费视频| 美国十次综合导航| 福利电影一区二区三区| 欧美性感一区二区三区| 日韩一区二区中文字幕| 国产精品美女久久久久aⅴ| 一区二区三区不卡在线观看| 麻豆久久久久久| 成人精品视频一区| 欧美日韩精品三区| 日本一区二区三区国色天香 | 日韩欧美精品三级| 国产精品视频观看| 日本在线播放一区二区三区| 国产精品中文有码| 日本乱人伦aⅴ精品| 欧美精品一区二区蜜臀亚洲| 亚洲天堂免费在线观看视频| 免费观看30秒视频久久| 91性感美女视频| 精品久久久久av影院| 亚洲精品视频免费观看| 国内精品写真在线观看| 欧美三级视频在线观看| 中文字幕欧美三区| 久久se这里有精品| 欧美日韩五月天| 亚洲免费av观看| 国产一区二区三区免费播放| 欧美久久一区二区| 国产精品久线观看视频| 精品系列免费在线观看| 欧美日韩国产高清一区二区三区| 国产精品亲子乱子伦xxxx裸| 日本亚洲电影天堂| 在线观看免费视频综合| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 色综合久久久久综合99| 久久影院电视剧免费观看| 午夜精品一区二区三区免费视频 | 国产在线不卡一区| 欧洲精品中文字幕| 国产精品美日韩| 国产一区不卡在线| 日韩一级二级三级| 视频在线观看一区| 在线亚洲一区二区| 亚洲欧美电影院| 91在线观看污| 18欧美亚洲精品| www.日本不卡| 国产精品久久久久桃色tv| 国产一区二区三区在线观看免费| 欧美一区二区三区人| 日日夜夜精品视频免费| 精品视频色一区| 亚洲在线视频网站| 在线观看日韩电影| 亚洲超碰精品一区二区| 欧美视频一区在线观看| 天使萌一区二区三区免费观看|