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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? tcp.c

?? VB從入門(mén)到精通學(xué)習(xí)教程,寫(xiě)的非常詳細(xì),非常好
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
   // a temporary conection  to it for processing
   if (i == 5)
   {
      if (tcp->flags & FLG_SYN)
      {
         // Find first unused connection (one with IP = 0) 
         for (j=0; j < 5; j++)
         {
            if (conxn[j].ipaddr == 0)
            {
               nr = j;
               // Initialize new connection
               conxn[nr].state = STATE_LISTEN;
               break;
            }
         }
      
         // If all connections are used then drop msg
         if (j == 5) return;
         
         if (debug)
         {
            serial_send("TCP: New connection ");
            memset(text, 0, 10);
            itoa((UINT)nr, text, 10);
            serial_send(text);
			   serial_send("\r");
         }
      }
   }


   // By now we should have a connection number in range of 0-4
   // Do a check to avoid any chance of exceeding size of struct
   if (nr > 4)
   {
      if (debug) serial_send("TCP: Error in assigning conxn number\r");
      return;
   }

   // Eventually put in protection against wrapping sequence
   // numbers, for now make the client start over if his
   // sequence number is close to wrapping
   if (tcp->sequence > 0xFFFFFF00L) 
   {
      if (debug) serial_send("TCP: Rcvd a high sequence number\r");
		conxn[nr].ipaddr = 0;			
		tcp_send(FLG_RST, 20, NO_CONNECTION);
		return;		
   }
           
   // Handle messages whose action is mostly independent of state
   // such as RST, SYN, and segment with no ACK.  That way the
	// state machine below does not need to worry about it.
   if (tcp->flags & FLG_RST)
   {
      // An RST does not depend on state at all.  And it does
      // not count as data so do not send an ACK here.  Close
      // connection
 		if (debug) serial_send("TCP: Rcvd a reset\r");
      conxn[nr].ipaddr = 0;
      return;
   }
	
	else if (tcp->flags & FLG_SYN)
	{
	   // A SYN segment only makes sense if connection is in LISTEN 
	   if ((conxn[nr].state != STATE_LISTEN) &&
          (conxn[nr].state != STATE_CLOSED))
		{
			if (debug) serial_send("TCP: Error, rcvd bogus SYN\r");
			conxn[nr].ipaddr = 0;			
		  	tcp_send(FLG_RST, 20, NO_CONNECTION);
		  	return;		
		}
	}
	
	else if ((tcp->flags & FLG_ACK) == 0)
	{
		// Incoming segments except SYN or RST must have ACK bit set
	 	// See TCP/IP Illustrated, Vol 2, Page 965
      // Drop segment but do not send a reset
		if (debug) serial_send("TCP: Error, rcvd segment has no ACK\r");
		return;
	}
	   
   // Compute length of header including options, and from that
   // compute length of actual data
   header_len =  (tcp->flags & 0xF000) >> 10;
   data_len = len - header_len;


         
   // Handle TCP state machine for this connection
   switch (conxn[nr].state)
   {
      case STATE_CLOSED:
      case STATE_LISTEN:
            
      // If incoming segment contains SYN and no ACK, then handle 
      if ((tcp->flags & FLG_SYN) && ((tcp->flags & FLG_ACK) == 0))
      {
         // Capture his starting sequence number and generate
         // my starting sequence number
         // Fill in connection information
         conxn[nr].ipaddr = ip->source_ipaddr;
         conxn[nr].port = tcp->source_port;
         conxn[nr].state = STATE_LISTEN;
         conxn[nr].his_sequence = 1 + tcp->sequence;
         conxn[nr].his_ack = tcp->ack_number;
         
         // Use system clock for initial sequence number
         EA = 0;
         conxn[nr].my_sequence = initial_sequence_nr;
         initial_sequence_nr += 64000L;
         EA = 1;                  
                  
         // Send header options with the next message
         // Since timestamps are optional and we do not use
         // them, do not have to send them 
         // After sending the SYN ACK the client browser will
         // blast me with 2 messages, an ACK, and a HTTP GET
         tcp_send(FLG_SYN | FLG_ACK, 28, nr);
         
         // My SYN flag increments my sequence number
         // My sequence number is always updated to point to 
         // the next byte to be sent.  So the incoming ack
         // number should equal my sequence number  
         conxn[nr].my_sequence++;
      
         conxn[nr].state = STATE_SYN_RCVD;
         if (debug) serial_send("TCP: Entered SYN RCVD state\r");
      }
		else 
      {
         // Sender is out of sync so send reset
         conxn[nr].ipaddr = 0;
         tcp_send(FLG_RST, 20, NO_CONNECTION);   
      } 
		break;


      case STATE_SYN_RCVD:
      // He may already be sending me data - should process it
		conxn[nr].his_sequence += data_len;
      conxn[nr].his_ack = tcp->ack_number;
            
      if (tcp->flags & FLG_FIN)
		{
		   // His FIN counts as a byte of data
         conxn[nr].his_sequence++;
         tcp_send(FLG_ACK, 20, nr);
         conxn[nr].state = STATE_CLOSE_WAIT;
         if (debug) serial_send("TCP: Entered CLOSE_WAIT state\r");
               
        	// At this point we would normally wait for the	application
         // to close.  For now, send FIN right away.
         tcp_send(FLG_FIN | FLG_ACK, 20, nr);
         conxn[nr].my_sequence++;   // For my FIN
         conxn[nr].state = STATE_LAST_ACK;
         if (debug) serial_send("TCP: Entered LAST ACK state\r");
      }

		// Make sure he is ACKing my SYN
		else if (tcp->ack_number == conxn[nr].my_sequence)
      {
         conxn[nr].state = STATE_ESTABLISHED;
         if (debug) serial_send("TCP: Entered ESTABLISHED state\r");
         // If sender sent data ignore it and he will resend
         // Do not send response because we received no
         // data... wait for client to send something to me 
      }
      break;


      case STATE_ESTABLISHED:
      conxn[nr].his_ack = tcp->ack_number;
           
      if (tcp->flags & FLG_FIN)
		{
		   // His FIN counts as a byte of data
         conxn[nr].his_sequence++;
         tcp_send(FLG_ACK, 20, nr);
         conxn[nr].state = STATE_CLOSE_WAIT;
         if (debug) serial_send("TCP: Entered CLOSE_WAIT state\r");
               
        	// At this point we would normally wait for the	application
         // to close.  For now, send FIN immediately.
         tcp_send(FLG_FIN | FLG_ACK, 20, nr);
         conxn[nr].my_sequence++;   // For my FIN
         conxn[nr].state = STATE_LAST_ACK;
         if (debug) serial_send("TCP: Entered LAST ACK state\r");
      }
		else if (data_len != 0)
      {
			// Received normal TCP segment from sender with data
      	// Send an ACK immediately and pass the data on to
			// the application
			conxn[nr].his_sequence += data_len;
         tcp_send(FLG_ACK, 20, nr); 		// Send ACK
      	  
      	      	      	 									
			// Send pointer to start of TCP payload
			// http_server increments my sequence number when 
         // sending so don't worry about it here
         result = http_server(inbuf, header_len, nr, 0);
								
			// Start timer to close conxn if no activity
			conxn[nr].inactivity = INACTIVITY_TIME;
		}
	   break;


      case STATE_CLOSE_WAIT:
      // With this code, should not get here
      if (debug) serial_send("TCP: Oops! Rcvd unexpected message\r");
      
      break;

      
      case STATE_LAST_ACK:
      conxn[nr].his_ack = tcp->ack_number;
            
      // If he ACK's my FIN then close
      if (tcp->ack_number == conxn[nr].my_sequence)
      {
         conxn[nr].state = STATE_CLOSED;
         conxn[nr].ipaddr = 0;  // Free up struct area
         just_closed = TRUE;
      }
      break;

      
      case STATE_FIN_WAIT_1:
      // He may still be sending me data - should process it
		conxn[nr].his_sequence += data_len;
      conxn[nr].his_ack = tcp->ack_number;
                  
      if (tcp->flags & FLG_FIN)
      {
         // His FIN counts as a byte of data
         conxn[nr].his_sequence++;
         tcp_send(FLG_ACK, 20, nr);
         
         // If he has ACK'd my FIN then we can close connection
         if (tcp->ack_number == conxn[nr].my_sequence)
			{
         	conxn[nr].state = STATE_TIME_WAIT;
         	if (debug) serial_send("TCP: Entered TIME_WAIT state\r");
               
         	conxn[nr].state = STATE_CLOSED;
         	conxn[nr].ipaddr = 0;  // Free up connection
         	just_closed = TRUE;
      	}
			else
			{
				// He has not ACK'd my FIN.  This happens when there is a simultaneous
				// close - I got his FIN but he has not yet ACK'd my FIN
				conxn[nr].state = STATE_CLOSING;
				if (debug) serial_send("TCP: Entered CLOSING state\r");
			}
		}
      else if (tcp->ack_number == conxn[nr].my_sequence)
      {
         // He has ACK'd my FIN but has not sent a FIN yet himself
         conxn[nr].state = STATE_FIN_WAIT_2;
         if (debug) serial_send("TCP: Entered FIN_WAIT_2 state\r");
      }
      break;

      
      case STATE_FIN_WAIT_2:
      // He may still be sending me data - should process it
		conxn[nr].his_sequence += data_len;
      conxn[nr].his_ack = tcp->ack_number;
      
      if (tcp->flags & FLG_FIN)
      {
         conxn[nr].his_sequence++; // For his FIN flag
         tcp_send(FLG_ACK, 20, nr);
         conxn[nr].state = STATE_TIME_WAIT;
         if (debug) serial_send("TCP: Entered TIME_WAIT state\r");
         conxn[nr].state = STATE_CLOSED;
         conxn[nr].ipaddr = 0;  // Free up struct area
         just_closed = TRUE;
      }
      break;
            
            
      case STATE_TIME_WAIT:
      // With this code, should not get here
      if (debug) serial_send("TCP: Oops! In TIME_WAIT state\r");
      break;

      
      case STATE_CLOSING:
      // Simultaneous close has happened. I have received his FIN
      // but he has not yet ACK'd my FIN.  Waiting for ACK.
		// Will not receive data in this state
		conxn[nr].his_ack = tcp->ack_number;
      		
		if (tcp->ack_number == conxn[nr].my_sequence)
      {
		   conxn[nr].state = STATE_TIME_WAIT;
         if (debug) serial_send("TCP: Entered TIME_WAIT state\r");
         
         // Do not send any response to his ACK
         conxn[nr].state = STATE_CLOSED;
         conxn[nr].ipaddr = 0;  // Free up struct area
         just_closed = TRUE;
      }
      break;

      
      default:
      if (debug) serial_send("TCP: Error, no handler\r");
      break;
   }
   
   // This is for debug, to see when conxn closes
   if (just_closed)
   {
      just_closed = FALSE;
      if (debug)
      {
         serial_send("TCP: Closed connection ");
         memset(text, 0, 10);
         itoa((UINT)nr, text, 10);
		   serial_send(text);
		   serial_send("\r");
      }
   }
}



?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲美腿欧美偷拍| 日韩欧美国产午夜精品| 欧美日韩另类国产亚洲欧美一级| 欧美三级日韩三级国产三级| 91精品国产美女浴室洗澡无遮挡| 久久女同互慰一区二区三区| 综合自拍亚洲综合图不卡区| 午夜视频在线观看一区二区三区| 国产福利一区在线| 在线亚洲+欧美+日本专区| 日韩精品一区二区三区三区免费| 国产精品萝li| 免费看欧美女人艹b| 成人av资源在线| 69p69国产精品| 国产精品网站在线观看| 视频一区在线视频| 91丝袜高跟美女视频| 欧美一二三区在线观看| 中文字幕一区在线观看| 免费成人美女在线观看| av中文字幕一区| 欧美电影免费观看高清完整版在线观看| 中文字幕视频一区| 老司机午夜精品| 欧美色区777第一页| 亚洲国产成人一区二区三区| 日韩精品成人一区二区三区| 成人av在线播放网站| 日韩视频一区二区在线观看| 亚洲欧美偷拍卡通变态| 精品一区二区三区影院在线午夜| 在线影院国内精品| 国产精品午夜在线| 久久精品国产精品青草| 欧美伊人久久久久久久久影院| 国产欧美日韩视频一区二区| 日本怡春院一区二区| 日本国产一区二区| 国产精品久久一级| 国产高清精品在线| 精品区一区二区| 午夜欧美电影在线观看| 99久久99久久久精品齐齐| 久久久久9999亚洲精品| 蜜桃一区二区三区四区| 欧美日韩五月天| 亚洲综合激情网| 99国产麻豆精品| 中文字幕乱码亚洲精品一区| 精品在线亚洲视频| 欧美一区二区三区公司| 亚洲一区免费视频| 日本久久电影网| 中文字幕日韩精品一区| 成人精品电影在线观看| 久久久精品免费观看| 精品一区二区三区视频在线观看| 欧美一区二区三区思思人| 亚洲不卡一区二区三区| 欧美视频自拍偷拍| 亚洲午夜电影网| 欧美色区777第一页| 亚洲伊人色欲综合网| 在线观看网站黄不卡| 中文字幕亚洲在| proumb性欧美在线观看| 国产精品每日更新| 成人av资源站| 最近日韩中文字幕| 一本色道久久综合狠狠躁的推荐 | 日本亚洲欧美天堂免费| 欧美日韩在线综合| 五月天激情综合| 欧美高清视频www夜色资源网| 性久久久久久久| 91精品国产入口在线| 麻豆国产一区二区| 久久精品欧美日韩精品| 成人综合婷婷国产精品久久蜜臀| 国产欧美精品一区二区色综合朱莉| 国产成人av电影在线| 国产精品人成在线观看免费 | 亚洲人成网站在线| 91精彩视频在线| 天堂在线一区二区| 日韩一级二级三级精品视频| 韩国三级中文字幕hd久久精品| 久久久精品2019中文字幕之3| 大白屁股一区二区视频| 亚洲色图欧美激情| 欧美日韩日日摸| 极品美女销魂一区二区三区| 国产色一区二区| 91丝袜国产在线播放| 午夜一区二区三区视频| 日韩三级.com| 豆国产96在线|亚洲| 亚洲女人的天堂| 6080日韩午夜伦伦午夜伦| 国精品**一区二区三区在线蜜桃| 国产精品无遮挡| 欧美日韩大陆一区二区| 久久精品999| 亚洲免费在线视频一区 二区| 欧美日韩中字一区| 精品亚洲成a人| 一区在线观看视频| 日韩亚洲欧美在线观看| 成人精品小蝌蚪| 日韩有码一区二区三区| 国产欧美综合色| 欧美日本一区二区在线观看| 国产一二三精品| 亚洲裸体xxx| 欧美成人乱码一区二区三区| 99精品久久99久久久久| 三级成人在线视频| 国产精品天天摸av网| 欧美精品在线视频| 丁香婷婷深情五月亚洲| 午夜精品久久久久久久99水蜜桃 | 成人av第一页| 日韩主播视频在线| 国产精品色在线观看| 在线电影院国产精品| av在线综合网| 久久99精品久久久久婷婷| 一区二区三区久久久| 久久亚洲综合色| 欧美日韩成人在线| bt7086福利一区国产| 美国毛片一区二区| 亚洲最色的网站| 国产日韩欧美一区二区三区乱码 | 日韩电影免费在线| 中文字幕一区二区在线播放| 91精品婷婷国产综合久久性色 | 亚洲另类色综合网站| 欧美电影免费观看高清完整版在线| 91麻豆123| 成人永久aaa| 久久精品国产99久久6| 一区二区欧美视频| 国产精品进线69影院| 精品乱人伦小说| 7777精品伊人久久久大香线蕉最新版| jvid福利写真一区二区三区| 国产主播一区二区| 麻豆精品在线看| 天天亚洲美女在线视频| 一二三四区精品视频| 自拍偷在线精品自拍偷无码专区| 久久午夜色播影院免费高清| 制服.丝袜.亚洲.中文.综合| 色婷婷一区二区| av在线不卡网| 国产99久久久国产精品潘金网站| 久久99久久99小草精品免视看| 亚洲国产精品久久不卡毛片 | 欧美视频一区二区三区四区| 成人在线综合网站| 国产九色精品成人porny | 国产亚洲精品aa午夜观看| 欧美日韩情趣电影| 欧美午夜精品一区二区蜜桃| 一本一道波多野结衣一区二区| 成人免费不卡视频| 国产不卡视频一区| 国产成人精品三级麻豆| 国产乱人伦精品一区二区在线观看| 日本午夜一本久久久综合| 性做久久久久久久久| 亚洲一区视频在线| 亚洲一区二区三区四区五区中文| 亚洲精品精品亚洲| 亚洲色欲色欲www| 亚洲欧美一区二区三区国产精品| 亚洲色图在线播放| 亚洲人成网站精品片在线观看| 国产精品福利电影一区二区三区四区| 国产日本欧洲亚洲| 国产精品久久三| 亚洲柠檬福利资源导航| 一区二区三区欧美日| 亚洲一区在线观看视频| 亚洲一区二区三区在线看| 亚洲chinese男男1069| 天天操天天干天天综合网| 免费美女久久99| 国产一区二区在线观看视频| 国产精品一二三在| www.欧美色图| 欧美性猛交xxxxxxxx| 717成人午夜免费福利电影| 日韩欧美一区中文| 久久综合九色综合97_久久久| 国产女主播视频一区二区| 国产精品精品国产色婷婷| 亚洲精品免费电影|