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

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

?? tcp.c

?? tcpip.rar 是一個(gè)51控制8019的程序,我已用于商用.還很穩(wěn)定,有興趣的可以看一下,對(duì)TCP IP UDP ICMP ARP RARP HTTP均可以實(shí)現(xiàn).
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
   // If i = 5, we are not connected. If it is a SYN then assign
   // 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)
         {
            printf("TCP: New connection ");
            memset(text, 0, 10);
            itoa((UINT)nr, text, 10);
            printf(text);
			   printf("\n");
         }
      }
   }


   // 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) printf("TCP: Error in assigning conxn number\n");
      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) printf("TCP: Rcvd a high sequence number\n");
		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) printf("TCP: Rcvd a reset\n");
      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) printf("TCP: Error, rcvd bogus SYN\n");
			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) printf("TCP: Error, rcvd segment has no ACK\n");
		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) printf("TCP: Entered SYN RCVD state\n");
      }
		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) printf("TCP: Entered CLOSE_WAIT state\n");
               
        	// 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) printf("TCP: Entered LAST ACK state\n");
      }

		// Make sure he is ACKing my SYN
		else if (tcp->ack_number == conxn[nr].my_sequence)
      {
         conxn[nr].state = STATE_ESTABLISHED;
         if (debug) printf("TCP: Entered ESTABLISHED state\n");
         // 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) printf("TCP: Entered CLOSE_WAIT state\n");
               
        	// 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) printf("TCP: Entered LAST ACK state\n");
      }
		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) printf("TCP: Oops! Rcvd unexpected message\n");
      
      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) printf("TCP: Entered TIME_WAIT state\n");
               
         	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) printf("TCP: Entered CLOSING state\n");
			}
		}
      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) printf("TCP: Entered FIN_WAIT_2 state\n");
      }
      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) printf("TCP: Entered TIME_WAIT state\n");
         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) printf("TCP: Oops! In TIME_WAIT state\n");
      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) printf("TCP: Entered TIME_WAIT state\n");
         
         // 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) printf("TCP: Error, no handler\n");
      break;
   }
   
   // This is for debug, to see when conxn closes
   if (just_closed)
   {
      just_closed = FALSE;
      if (debug)
      {
         printf("TCP: Closed connection ");
         memset(text, 0, 10);
         itoa((UINT)nr, text, 10);
		   printf(text);
		   printf("\n");
      }
   }
}



?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人欧美一区二区三区小说 | 亚洲综合色网站| 中文幕一区二区三区久久蜜桃| 精品国产一区二区三区忘忧草| 日韩欧美国产综合一区| 日韩一区二区三区在线观看| 91精品国产91综合久久蜜臀| 日韩一二在线观看| 日韩免费观看2025年上映的电影| 日韩一级免费观看| 精品国产凹凸成av人导航| 久久亚洲综合色| 国产欧美日韩视频在线观看| 国产精品麻豆视频| 亚洲理论在线观看| 亚洲二区在线观看| 首页综合国产亚洲丝袜| 热久久一区二区| 精品一区二区三区免费观看| 国产精品自拍毛片| 成a人片亚洲日本久久| 99精品热视频| 欧美日韩一区二区三区免费看| 91精品国产一区二区三区香蕉| 日韩精品最新网址| 国产精品久久久99| 亚洲777理论| 国内外成人在线| 99精品视频中文字幕| 6080日韩午夜伦伦午夜伦| 精品美女在线播放| 中文字幕在线不卡| 午夜精品一区二区三区免费视频| 另类小说一区二区三区| 国产iv一区二区三区| 欧洲精品中文字幕| 欧美v亚洲v综合ⅴ国产v| 国产精品久久久久影院亚瑟| 亚洲一区影音先锋| 久久电影网电视剧免费观看| av一二三不卡影片| 欧美一区二区免费| 国产日韩欧美精品一区| 亚洲精品视频在线观看免费| 美日韩一级片在线观看| 成人app在线| 欧美肥妇bbw| 中文字幕一区av| 麻豆免费精品视频| 91麻豆国产自产在线观看| 欧美一区二区三区人| 亚洲国产精品成人综合| 偷偷要91色婷婷| 成人激情午夜影院| 91麻豆精品国产自产在线| 亚洲国产精品黑人久久久| 日韩专区在线视频| 99精品热视频| 久久伊99综合婷婷久久伊| 亚洲成人在线网站| 白白色 亚洲乱淫| 欧美va天堂va视频va在线| 亚洲一区二区三区四区的| 国产v综合v亚洲欧| 91麻豆精品久久久久蜜臀| 亚洲欧美视频一区| 国产一区二区视频在线播放| 欧美美女激情18p| 中文字幕中文乱码欧美一区二区| 麻豆国产一区二区| 欧美在线视频全部完| 国产精品免费aⅴ片在线观看| 日韩精品一级中文字幕精品视频免费观看| 高清在线成人网| 欧美成人一区二区| 日韩影院精彩在线| 在线观看免费成人| 国产精品成人在线观看| 狠狠狠色丁香婷婷综合激情| 欧美日韩成人综合| 亚洲精品日日夜夜| 成人h动漫精品一区二| 精品国产乱码久久久久久夜甘婷婷| 亚洲五码中文字幕| 色综合久久中文字幕| 国产精品卡一卡二| 成人黄色av网站在线| 久久精品一二三| 久久99久久久久| 日韩一区二区三区免费观看| 视频一区免费在线观看| 午夜精品福利一区二区蜜股av| 亚洲精品中文在线影院| 成人aaaa免费全部观看| 欧美精品一区二区三区蜜桃| 日本视频一区二区| 欧美色手机在线观看| 夜夜揉揉日日人人青青一国产精品 | 欧美成人三级在线| 奇米色一区二区三区四区| 欧美日韩国产精品成人| 亚洲www啪成人一区二区麻豆| 欧美亚洲一区二区在线| 亚洲一区二区黄色| 欧美这里有精品| 婷婷国产在线综合| 91精品在线一区二区| 免费观看在线综合色| 精品国产伦一区二区三区观看体验 | 国产在线精品一区二区夜色| 欧美电影免费观看高清完整版在线 | 91国在线观看| 亚洲天堂a在线| 91久久精品一区二区三区| 亚洲精品视频在线观看免费 | 国产精品免费aⅴ片在线观看| 不卡大黄网站免费看| 亚洲日本在线观看| 欧美亚一区二区| 青娱乐精品视频| 久久嫩草精品久久久精品| 成人一区二区三区在线观看| 国产精品国产三级国产aⅴ原创| 色噜噜夜夜夜综合网| 婷婷夜色潮精品综合在线| 日韩欧美一区在线| 国产传媒日韩欧美成人| 中文字幕中文字幕一区二区| 91成人免费在线视频| 日韩av一二三| 日韩免费视频一区| 成人美女视频在线看| 亚洲与欧洲av电影| 日韩视频永久免费| 成人午夜碰碰视频| 亚洲国产精品综合小说图片区| 51久久夜色精品国产麻豆| 国产一区在线精品| 亚洲欧美日韩国产手机在线| 欧美剧情电影在线观看完整版免费励志电影| 青青国产91久久久久久| 国产精品私人自拍| 欧美三级中文字幕在线观看| 久久 天天综合| 亚洲精品国产高清久久伦理二区| 91精品国产色综合久久| 成人午夜私人影院| 水蜜桃久久夜色精品一区的特点| 国产欧美一二三区| 欧美视频精品在线观看| 国产精品综合二区| 亚洲二区在线视频| 国产精品女同互慰在线看| 欧美日韩在线直播| 国产91精品入口| 秋霞电影网一区二区| 国产精品灌醉下药二区| 欧美一级理论性理论a| 91小视频在线| 狠狠色伊人亚洲综合成人| 亚洲国产精品久久人人爱| 久久久亚洲欧洲日产国码αv| 欧美色倩网站大全免费| 成人黄色免费短视频| 麻豆视频一区二区| 亚洲韩国一区二区三区| 欧美国产精品一区| 日韩欧美中文字幕精品| 91久久精品一区二区二区| 国产高清视频一区| 青青草一区二区三区| 亚洲精品成人天堂一二三| 久久久天堂av| 日韩一级免费一区| 欧美另类z0zxhd电影| 99riav一区二区三区| 国产999精品久久久久久| 蜜臂av日日欢夜夜爽一区| 亚洲综合一区二区| 中文字幕日本不卡| 国产日产欧美一区二区视频| 日韩一级免费观看| 制服丝袜亚洲色图| 欧美日韩一区二区三区视频| 色综合中文字幕国产 | 一区二区三区中文字幕精品精品| 日本一区二区三区四区在线视频 | 亚洲欧美偷拍另类a∨色屁股| 欧美国产日韩在线观看| 久久综合色8888| 欧美一区二区三区视频免费播放| 欧美午夜不卡在线观看免费| 色哟哟欧美精品| 色综合中文字幕国产| caoporen国产精品视频| 成人精品国产免费网站| 国产a久久麻豆| 国产不卡高清在线观看视频| 国产精品一区二区91| 国产在线一区观看|