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

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

?? tcp.lst

?? 單片機控制RTL8019AS的程序,C語言編寫,仿真通過.
?? LST
?? 第 1 頁 / 共 3 頁
字號:
C51 COMPILER V7.06   TCP                                                                   10/09/2006 21:51:55 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE TCP
OBJECT MODULE PLACED IN tcp.OBJ
COMPILER INVOKED BY: D:\Program Files\Keil\C51\BIN\C51.EXE tcp.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //-----------------------------------------------------------------------------
   2          // Net TCP.C
   3          //
   4          // This module handles TCP segments
   5          // Refer to RFC 793, 896, 1122, 1323, 2018, 2581
   6          //
   7          // A "connection" is a unique combination of 4 items:  His IP address,
   8          // his port number, my IP address, and my port number.
   9          //
  10          // Note that a SYN and a FIN count as a byte of data, but a RST does
  11          // not count. Neither do any of the other flags.
  12          // See "TCP/IP Illustrated, Volume 1" Sect 17.3 for info on flags
  13          //-----------------------------------------------------------------------------
  14          #include <string.h>
  15          #include <stdlib.h>
  16          #include <ctype.h>              // toupper
  17          #include <general.h>
  18          
  19          
  20          // These structures keep track of connection information
  21          CONNECTION xdata conxn[5];
  22          
  23          ULONG idata initial_sequence_nr;
  24          UINT xdata sender_tcpport;
  25          static ULONG xdata sender_ipaddr;
  26          
  27          
  28          extern ULONG code my_ipaddr;
  29          extern char xdata text[];
  30          
  31          // Options: MSS (4 bytes), NOPS (2 bytes), Selective ACK (2 bytes) 
  32          UCHAR code opt[10] = {
  33          0x02, 0x04, 0x05, 0xB4,
  34          0x01, 0x01,
  35          0x04, 0x02};
  36          
  37          
  38          
  39          //------------------------------------------------------------------------
  40          //  Initialize variables declared in this module
  41          //
  42          //------------------------------------------------------------------------
  43          void init_tcp(void)
  44          {
  45   1         memset(conxn, 0, sizeof(conxn));
  46   1         initial_sequence_nr = 1;
  47   1      }
  48          
  49          
  50          
  51          //------------------------------------------------------------------------
  52          // This sends a TCP segments that do not include any data.
  53          // http_send() in the HTTP module is used to send data.
  54          // See "TCP/IP Illustrated, Volume 1" Sect 17.3
  55          //------------------------------------------------------------------------
C51 COMPILER V7.06   TCP                                                                   10/09/2006 21:51:55 PAGE 2   

  56          void tcp_send(UINT flags, UINT hdr_len, UCHAR nr)
  57          {
  58   1         ULONG idata sum, dest;
  59   1              UINT idata result;
  60   1         UCHAR xdata * outbuf;
  61   1         TCP_HEADER xdata * tcp;
  62   1         IP_HEADER xdata * ip;
  63   1                
  64   1         
  65   1         // Allocate memory for entire outgoing message including
  66   1         // eth & IP headers 
  67   1         outbuf = (UCHAR xdata *)malloc(34 + hdr_len);
  68   1         if (outbuf == NULL)
  69   1         {
  70   2            return;
  71   2         }
  72   1      
  73   1                 
  74   1         tcp = (TCP_HEADER xdata *)(outbuf + 34);
  75   1         ip = (IP_HEADER xdata *)(outbuf + 14);
  76   1      
  77   1         // If no connection, then message is probably a reset
  78   1         // message which goes back to the sender
  79   1         // Otherwise, use information from the connection.
  80   1         if (nr == NO_CONNECTION)
  81   1         {
  82   2            tcp->source_port = HTTP_PORT;
  83   2            tcp->dest_port = sender_tcpport;
  84   2            tcp->sequence = 0;
  85   2            tcp->ack_number = 0;
  86   2            dest = sender_ipaddr;
  87   2         }
  88   1         else if (nr < 5)
  89   1         {
  90   2            // This message is to connected port
  91   2            tcp->source_port = HTTP_PORT;
  92   2            tcp->dest_port = conxn[nr].port;
  93   2            tcp->sequence = conxn[nr].my_sequence;
  94   2            tcp->ack_number = conxn[nr].his_sequence;
  95   2            dest = conxn[nr].ipaddr;
  96   2         }
  97   1         else
  98   1         {
  99   2                      free(outbuf);
 100   2                      return;
 101   2              }
 102   1      
 103   1         // Total segment length = header length
 104   1            
 105   1         // Insert header len
 106   1         tcp->flags = (hdr_len << 10) | flags;
 107   1         tcp->window = 1024;
 108   1         tcp->checksum = 0;
 109   1         tcp->urgent_ptr = 0;
 110   1         
 111   1         // Sending SYN with header options
 112   1         if (hdr_len == 28)
 113   1         {
 114   2            memcpy(&tcp->options, opt, 8);
 115   2         }   
 116   1         
 117   1         // Compute checksum including 12 bytes of pseudoheader
C51 COMPILER V7.06   TCP                                                                   10/09/2006 21:51:55 PAGE 3   

 118   1              // Must pre-fill 2 items in ip header to do this
 119   1              ip->dest_ipaddr = dest;
 120   1              ip->source_ipaddr = my_ipaddr;
 121   1                      
 122   1              // Sum source_ipaddr, dest_ipaddr, and entire TCP message 
 123   1              sum = (ULONG)cksum(outbuf + 26, 8 + hdr_len);
 124   1                                      
 125   1              // Add in the rest of pseudoheader which is
 126   1              // protocol id and TCP segment length
 127   1              sum += (ULONG)0x0006;
 128   1              sum += (ULONG)hdr_len;
 129   1      
 130   1              // In case there was a carry, add it back around
 131   1              result = (UINT)(sum + (sum >> 16));
 132   1              tcp->checksum = ~result;
 133   1         
 134   1              ip_send(outbuf, dest, TCP_TYPE, hdr_len);
 135   1      
 136   1         // (Re)start TCP retransmit timer
 137   1         if (nr<5) conxn[nr].timer = TCP_TIMEOUT;
 138   1      }
 139          
 140          
 141          
 142          
 143          //------------------------------------------------------------------------
 144          // This runs every 0.5 seconds.  If the other end has not ACK'd
 145          // everyting we have sent, it re-sends it.  To save RAM space, we 
 146          // regenerate a segment rather than keeping a bunch of segments 
 147          // hanging around eating up RAM.  A connection should not be in an
 148          // opening or closing state when this timer expires, so we simply
 149          // send a reset.
 150          //
 151          //      If a connection is in the ESTABLISHED state when the timer expires
 152          // then we have just sent a web page so re-send the page
 153          //------------------------------------------------------------------------
 154          void tcp_retransmit(void)
 155          {
 156   1         static UCHAR idata retries = 0;
 157   1         UCHAR idata nr;
 158   1      
 159   1         // Scan through all active connections 
 160   1         for (nr = 0; nr < 5; nr++)
 161   1         {
 162   2            if ((conxn[nr].ipaddr != 0) && (conxn[nr].timer))
 163   2            {
 164   3               // Decrement the timer and see if it hit 0
 165   3               conxn[nr].timer--;
 166   3               if (conxn[nr].timer == 0)
 167   3               {
 168   4                  // Socket just timed out. If we are not in ESTABLISHED state
 169   4                  // something is amiss so send reset and close connection
 170   4                  if (conxn[nr].state != STATE_ESTABLISHED)
 171   4                  {
 172   5                     // Send reset and close connection
 173   5                     tcp_send(FLG_RST, 20, nr);
 174   5                     conxn[nr].ipaddr = 0;
 175   5                     return;
 176   5                  }
 177   4                  else
 178   4                  {
 179   5                     // Socket is in ESTABLISHED state. First make sure his
C51 COMPILER V7.06   TCP                                                                   10/09/2006 21:51:55 PAGE 4   

 180   5                     // ack number is not bogus.
 181   5                     if (conxn[nr].his_ack > conxn[nr].my_sequence)
 182   5                     {
 183   6                        // Send reset and close connection
 184   6                        tcp_send(FLG_RST, 20, nr);
 185   6                        conxn[nr].ipaddr = 0;
 186   6                        return;
 187   6                     }
 188   5                     
 189   5                     // We always increment our sequence number immediately
 190   5                                      // after sending, so the ack number from the other end
 191   5                                      // should be equal to our sequence number.  If it is less,
 192   5                                      // it means he lost some of our data.
 193   5                     if (conxn[nr].his_ack < conxn[nr].my_sequence)
 194   5                                              {
 195   6                        retries++;
 196   6                                                      if (retries <= 2)
 197   6                                                      {
 198   7                              // The only thing we send is a web page, and it looks
 199   7                              // like other end did not get it, so resend
 200   7                              // but do not increase my sequence number
 201   7                              http_server(conxn[nr].query, 0, nr, 1);
 202   7                                          conxn[nr].inactivity = INACTIVITY_TIME;
 203   7                        }
 204   6                                                      else
 205   6                                                      {
 206   7      

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品亚洲国内自在自线福利| 国产成人夜色高潮福利影视| 国产一区二区三区最好精华液| 91在线国产福利| 91精品国产美女浴室洗澡无遮挡| 国产精品三级av在线播放| 日本不卡一区二区| 色综合一个色综合亚洲| 亚洲女与黑人做爰| 成人黄页毛片网站| 日韩精品中文字幕在线一区| 亚洲一区影音先锋| 91亚洲国产成人精品一区二区三| 久久影院午夜片一区| 午夜激情综合网| 欧美综合欧美视频| 亚洲欧美日韩电影| 一本色道亚洲精品aⅴ| 国产欧美日韩精品在线| 捆绑变态av一区二区三区| 欧美日韩国产系列| 亚洲自拍与偷拍| 91丨九色丨蝌蚪丨老版| 国产精品久久一级| 成人sese在线| 国产精品视频一二三| 国产91精品欧美| 欧美不卡视频一区| 激情亚洲综合在线| 久久久亚洲精品一区二区三区| 精品一区二区在线视频| 欧美丰满少妇xxxxx高潮对白| 亚洲综合在线第一页| 欧美在线啊v一区| 亚洲韩国精品一区| 日韩一卡二卡三卡国产欧美| 午夜一区二区三区在线观看| 51精品秘密在线观看| 蜜桃视频免费观看一区| 久久精品一二三| eeuss鲁片一区二区三区| 亚洲欧美区自拍先锋| 91福利国产成人精品照片| 一区二区三区四区亚洲| 欧美日韩成人在线一区| 国产乱理伦片在线观看夜一区| 欧美国产一区视频在线观看| 91丨九色丨蝌蚪丨老版| 午夜视频一区二区三区| 日韩精品在线一区| 久久亚洲二区三区| 国产亚洲精品福利| 久久精品欧美一区二区三区麻豆| 国产一区二区三区精品视频| 国产精品进线69影院| 国产在线不卡一卡二卡三卡四卡| 欧美大片在线观看| 国产91清纯白嫩初高中在线观看| |精品福利一区二区三区| 欧洲精品在线观看| 综合色天天鬼久久鬼色| 久久久久久99久久久精品网站| 欧美一区二区三区四区高清| 欧美午夜电影网| 色婷婷国产精品综合在线观看| 成人黄动漫网站免费app| 国产一区二区三区四区五区美女| 喷水一区二区三区| 午夜电影久久久| 亚洲成a人v欧美综合天堂下载 | 国产精品资源网站| 久久国产日韩欧美精品| 美女任你摸久久| 青青草成人在线观看| 日韩高清不卡一区二区| 肉色丝袜一区二区| 日本人妖一区二区| 美国一区二区三区在线播放| 日本vs亚洲vs韩国一区三区二区 | 国产精品不卡一区| 中文字幕一区av| 亚洲美女视频在线| 一区二区国产盗摄色噜噜| 亚洲综合一区二区三区| 亚洲一区二区视频| 免费人成在线不卡| 国产一区二区中文字幕| 国产大陆精品国产| 99久久国产综合精品女不卡| 色吧成人激情小说| 欧美日韩国产小视频| 欧美第一区第二区| 国产欧美日韩综合| 一区二区三区四区中文字幕| 视频一区二区不卡| 国产一区二区在线电影| 成人免费毛片app| 91国偷自产一区二区三区成为亚洲经典| 色就色 综合激情| 91精品国产福利| 国产亚洲精品7777| 亚洲宅男天堂在线观看无病毒| 日本免费在线视频不卡一不卡二| 国产真实精品久久二三区| 99精品视频在线播放观看| 欧美色成人综合| 2014亚洲片线观看视频免费| 国产精品毛片久久久久久| 午夜电影网一区| 国产精品456露脸| 欧美中文字幕一二三区视频| 欧美xxxx老人做受| 亚洲图片你懂的| 免费高清视频精品| 99免费精品在线| 欧美一级二级在线观看| 一区二区中文视频| 男人的天堂亚洲一区| 91麻豆精品国产无毒不卡在线观看| 日韩欧美一区中文| 亚洲人成网站精品片在线观看| 免费一级片91| 91在线国产福利| 亚洲精品在线免费播放| 亚洲人精品午夜| 国产精品一区一区| 欧美精品日韩一区| 亚洲天天做日日做天天谢日日欢| 日本欧美一区二区三区乱码| 色综合视频在线观看| 久久精品一区二区三区不卡 | 在线免费亚洲电影| 久久久午夜精品理论片中文字幕| 亚洲午夜精品久久久久久久久| 国产精品影视网| 日韩欧美国产不卡| 亚洲国产成人av好男人在线观看| av一区二区三区| 国产午夜久久久久| 久久精工是国产品牌吗| 欧美性猛交xxxxxxxx| 一区免费观看视频| 顶级嫩模精品视频在线看| 欧美r级在线观看| 日韩av午夜在线观看| 欧美中文字幕一区| 亚洲精品乱码久久久久| av电影在线观看不卡| 久久精品这里都是精品| 韩国精品主播一区二区在线观看| 制服丝袜国产精品| 亚洲高清视频在线| 91精彩视频在线观看| 亚洲欧美日韩中文播放| 99热在这里有精品免费| 国产欧美日韩视频在线观看| 国内不卡的二区三区中文字幕 | 欧美色图在线观看| 亚洲欧洲日韩av| 91日韩精品一区| 国产精品乱码一区二区三区软件 | 日韩精品久久久久久| 欧美日韩在线免费视频| 亚洲久草在线视频| 91美女在线视频| 亚洲美女在线国产| 色欧美片视频在线观看在线视频| 国产精品福利一区二区三区| 99综合影院在线| 18成人在线观看| 日本高清无吗v一区| 一区二区不卡在线播放| 欧美日韩一区二区三区高清| 天天亚洲美女在线视频| 精品污污网站免费看| 免费观看30秒视频久久| 欧美精品一区二区三区很污很色的 | 成人av在线看| 亚洲视频在线一区| 日本高清成人免费播放| 亚洲成在线观看| 日韩午夜小视频| 国产高清成人在线| 综合久久综合久久| 欧美日韩一区小说| 麻豆久久一区二区| 国产日韩欧美一区二区三区综合| 国产91露脸合集magnet| 亚洲精品你懂的| 91麻豆精品国产91| 国产一区二区三区精品欧美日韩一区二区三区 | 日韩精品一卡二卡三卡四卡无卡| 7777精品伊人久久久大香线蕉经典版下载| 日本美女视频一区二区| 久久九九久精品国产免费直播| jlzzjlzz国产精品久久| 亚洲国产日韩精品| 精品三级av在线| 91亚洲国产成人精品一区二三| 日韩国产一二三区|