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

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

?? tcp.lst

?? C51的tcpip源程序 包含了TCP,IP,ARP,ICMP等協(xié)議的接口
?? LST
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 1   


C51 COMPILER V7.10, COMPILATION OF MODULE TCP
OBJECT MODULE PLACED IN TCP.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE TCP.C OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND

line 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 "C8051f.h"
  18          #include "net.h"
  19          #include "cksum.h"
  20          #include "serial.h"
  21          #include "ip.h"
  22          #include "http.h"
  23          #include "tcp.h"
  24          
  25          
  26          // These structures keep track of connection information
  27          CONNECTION xdata conxn[5];
  28          
  29          ULONG idata initial_sequence_nr;
  30          UINT xdata sender_tcpport;
  31          static ULONG xdata sender_ipaddr;
  32          UCHAR idata just_closed; // Keeps track of when a conxn closed
  33          
  34          extern ULONG code my_ipaddr;
  35          extern UCHAR idata debug;
  36          extern char xdata text[];
  37          
  38          // Options: MSS (4 bytes), NOPS (2 bytes), Selective ACK (2 bytes) 
  39          UCHAR code opt[10] = {
  40          0x02, 0x04, 0x05, 0xB4,
  41          0x01, 0x01,
  42          0x04, 0x02};
  43          
  44          
  45          
  46          //------------------------------------------------------------------------
  47          //  Initialize variables declared in this module
  48          //
  49          //------------------------------------------------------------------------
  50          void init_tcp(void)
  51          {
  52   1         memset(conxn, 0, sizeof(conxn));
  53   1         just_closed = FALSE;
  54   1         initial_sequence_nr = 1;
  55   1      }
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 2   

  56          
  57          
  58          
  59          //------------------------------------------------------------------------
  60          // This sends a TCP segments that do not include any data.
  61          // http_send() in the HTTP module is used to send data.
  62          // See "TCP/IP Illustrated, Volume 1" Sect 17.3
  63          //------------------------------------------------------------------------
  64          void tcp_send(UINT flags, UINT hdr_len, UCHAR nr)
  65          {
  66   1         ULONG idata sum, dest;
  67   1              UINT idata result;
  68   1         UCHAR xdata * outbuf;
  69   1         TCP_HEADER xdata * tcp;
  70   1         IP_HEADER xdata * ip;
  71   1                
  72   1         
  73   1         // Allocate memory for entire outgoing message including
  74   1         // eth & IP headers 
  75   1         outbuf = (UCHAR xdata *)malloc(34 + hdr_len);
  76   1         if (outbuf == NULL)
  77   1         {
  78   2            if (debug) serial_send("TCP: Oops, out of memory\r");
  79   2            return;
  80   2         }
  81   1      
  82   1                 
  83   1         tcp = (TCP_HEADER xdata *)(outbuf + 34);
  84   1         ip = (IP_HEADER xdata *)(outbuf + 14);
  85   1      
  86   1         // If no connection, then message is probably a reset
  87   1         // message which goes back to the sender
  88   1         // Otherwise, use information from the connection.
  89   1         if (nr == NO_CONNECTION)
  90   1         {
  91   2            tcp->source_port = HTTP_PORT;
  92   2            tcp->dest_port = sender_tcpport;
  93   2            tcp->sequence = 0;
  94   2            tcp->ack_number = 0;
  95   2            dest = sender_ipaddr;
  96   2         }
  97   1         else if (nr < 5)
  98   1         {
  99   2            // This message is to connected port
 100   2            tcp->source_port = HTTP_PORT;
 101   2            tcp->dest_port = conxn[nr].port;
 102   2            tcp->sequence = conxn[nr].my_sequence;
 103   2            tcp->ack_number = conxn[nr].his_sequence;
 104   2            dest = conxn[nr].ipaddr;
 105   2         }
 106   1         else
 107   1         {
 108   2              if (debug) serial_send("TCP: Oops, sock nr out of range\r");
 109   2                      free(outbuf);
 110   2                      return;
 111   2              }
 112   1      
 113   1         // Total segment length = header length
 114   1            
 115   1         // Insert header len
 116   1         tcp->flags = (hdr_len << 10) | flags;
 117   1         tcp->window = 1024;
C51 COMPILER V7.10   TCP                                                                   07/24/2008 16:32:11 PAGE 3   

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

 180   4                  // something is amiss so send reset and close connection
 181   4                  if (conxn[nr].state != STATE_ESTABLISHED)
 182   4                  {
 183   5                     // Send reset and close connection
 184   5                     if (debug) serial_send("TCP: Timeout, sending reset\r");
 185   5                     tcp_send(FLG_RST, 20, nr);
 186   5                     conxn[nr].ipaddr = 0;
 187   5                     return;
 188   5                  }
 189   4                  else
 190   4                  {
 191   5                     // Socket is in ESTABLISHED state. First make sure his
 192   5                     // ack number is not bogus.
 193   5                     if (conxn[nr].his_ack > conxn[nr].my_sequence)
 194   5                     {
 195   6                        // Send reset and close connection
 196   6                        if (debug) serial_send("TCP: Timeout, sending reset\r");
 197   6                        tcp_send(FLG_RST, 20, nr);
 198   6                        conxn[nr].ipaddr = 0;
 199   6                        return;
 200   6                     }
 201   5                     
 202   5                     // We always increment our sequence number immediately
 203   5                                              // after sending, so the ack number from the other end
 204   5                                              // should be equal to our sequence number.  If it is less,
 205   5                                              // it means he lost some of our data.
 206   5                     if (conxn[nr].his_ack < conxn[nr].my_sequence)
 207   5                                              {
 208   6                        retries++;
 209   6                                                      if (retries <= 2)
 210   6                                                      {
 211   7                              // The only thing we send is a web page, and it looks
 212   7                              // like other end did not get it, so resend
 213   7                              // but do not increase my sequence number
 214   7                              if (debug) serial_send("TCP: Timeout, resending data\r");
 215   7                              http_server(conxn[nr].query, 0, nr, 1);
 216   7                                          conxn[nr].inactivity = INACTIVITY_TIME;
 217   7                        }
 218   6                                                      else
 219   6                                                      {
 220   7                                                              if (debug) serial_send("TCP: Giving up, sending reset\r");
 221   7                                                              // Send reset and close connection
 222   7                              tcp_send(FLG_RST, 20, nr);
 223   7                              conxn[nr].ipaddr = 0;
 224   7                      }
 225   6                     }

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产电影在线观看| 国产一区二区久久| 亚洲欧美激情在线| 亚洲女与黑人做爰| 亚洲素人一区二区| 亚洲欧美日韩国产综合在线| 欧美精彩视频一区二区三区| 国产亚洲欧美在线| 欧美激情综合网| 国产精品久久久久影院亚瑟| 中文字幕日韩一区| 亚洲另类色综合网站| 亚洲卡通欧美制服中文| 亚洲一区av在线| 五月婷婷激情综合| 日本午夜一本久久久综合| 日韩av电影免费观看高清完整版 | 日韩欧美精品在线视频| 91精品一区二区三区久久久久久| 91精品国产美女浴室洗澡无遮挡| 69av一区二区三区| 精品噜噜噜噜久久久久久久久试看| 日韩精品一区二区在线| 国产拍欧美日韩视频二区 | 国产精品一区二区久久不卡 | 欧美男女性生活在线直播观看| 91精品国产乱| 久久色成人在线| 中文字幕国产一区二区| 一区二区三区免费网站| 日本在线观看不卡视频| 激情综合色播五月| 成人高清av在线| 欧美综合天天夜夜久久| 欧美一级二级三级乱码| 久久综合精品国产一区二区三区| 亚洲国产精品99久久久久久久久| 亚洲男人的天堂av| 男人操女人的视频在线观看欧美| 国产成人精品aa毛片| 在线观看网站黄不卡| 欧美一区二区三区四区视频| 久久亚洲精华国产精华液| 专区另类欧美日韩| 日韩和欧美一区二区| 成人午夜大片免费观看| 欧美日韩1234| 中文字幕制服丝袜一区二区三区| 国产精品久久久久一区二区三区 | 日韩一区二区三区av| 精品免费一区二区三区| 国产精品蜜臀在线观看| 视频一区视频二区在线观看| 国产精品66部| 欧美三级蜜桃2在线观看| 国产片一区二区三区| 亚洲午夜三级在线| 国产成人亚洲精品青草天美| 欧美日韩午夜在线视频| 国产欧美日韩在线| 水野朝阳av一区二区三区| 高清beeg欧美| 日韩午夜av电影| 亚洲精品日韩一| 国产成人免费视频网站高清观看视频| 91黄色免费看| 国产女人水真多18毛片18精品视频| 亚洲国产日韩精品| 久久久久久免费| 欧美日韩免费一区二区三区| 欧美性做爰猛烈叫床潮| 国产欧美日韩综合| 日本vs亚洲vs韩国一区三区二区| 91丝袜呻吟高潮美腿白嫩在线观看| 日韩一区二区电影网| 一卡二卡欧美日韩| 成人免费毛片片v| 亚洲精品在线三区| 视频一区欧美日韩| 欧洲精品一区二区三区在线观看| 国产日韩精品一区| 久久99精品久久久久久久久久久久| 欧美午夜电影网| 欧美经典一区二区三区| 国精产品一区一区三区mba桃花| 欧美日韩高清一区二区三区| 亚洲色图欧美激情| 成人激情小说网站| 国产日本一区二区| 久久精品国产免费看久久精品| 欧美日韩在线免费视频| 一区二区三区不卡视频在线观看| 成人一级片在线观看| 久久伊99综合婷婷久久伊| 美腿丝袜亚洲一区| 69久久99精品久久久久婷婷| 亚洲图片欧美综合| 欧美午夜精品久久久久久孕妇| 午夜精品福利一区二区三区蜜桃| 精品国产一区二区三区不卡| 日韩成人免费电影| 欧美军同video69gay| 午夜精品影院在线观看| 欧美日韩成人在线| 亚洲va天堂va国产va久| 欧美在线一区二区三区| 亚洲国产精品久久久男人的天堂| 欧美中文字幕一区二区三区亚洲| 一区二区三区四区蜜桃| 在线中文字幕一区| 午夜在线电影亚洲一区| 91精品一区二区三区在线观看| 日本免费新一区视频| 日韩欧美国产三级| 精品在线播放午夜| 国产欧美日韩在线| 97久久超碰国产精品| 亚洲精品视频在线看| 欧美理论电影在线| 麻豆91在线看| 国产欧美日韩另类一区| 99久久综合99久久综合网站| 亚洲精品乱码久久久久久| 欧美性大战xxxxx久久久| 午夜在线成人av| 精品久久国产字幕高潮| 国产成人av影院| 中文文精品字幕一区二区| 成人午夜视频福利| 中文av一区二区| 欧美日韩亚洲另类| 日韩在线一二三区| 欧美成人精品1314www| 国内精品视频一区二区三区八戒| 欧美伦理电影网| 国内不卡的二区三区中文字幕| 久久久久久久久久久99999| 国产suv精品一区二区6| ...中文天堂在线一区| 在线观看区一区二| 日韩av不卡在线观看| 2020国产精品| 色婷婷综合久久久中文一区二区| 亚洲成年人网站在线观看| 制服丝袜亚洲播放| 亚洲精品菠萝久久久久久久| 不卡一区二区中文字幕| 亚洲欧美日本韩国| 日韩一级高清毛片| 国产精品正在播放| 亚洲欧美成人一区二区三区| 成人毛片视频在线观看| 亚洲电影一区二区| 精品对白一区国产伦| 成人免费毛片aaaaa**| 亚洲一区二区三区国产| 91精品国产色综合久久ai换脸 | 91成人免费网站| 免费观看在线色综合| 欧美国产丝袜视频| 正在播放一区二区| 国产福利精品一区二区| 91同城在线观看| 日韩欧美综合在线| 精品国产乱码久久久久久久久| 欧美一级淫片007| 26uuu欧美| 亚洲天堂免费在线观看视频| 亚洲精品成人悠悠色影视| 国内外成人在线视频| 97久久人人超碰| 欧美日韩高清一区二区| 99re免费视频精品全部| 在线亚洲一区二区| 成人综合在线观看| 天堂成人免费av电影一区| 久久久噜噜噜久噜久久综合| 欧美主播一区二区三区| www.日韩av| 另类小说一区二区三区| 亚洲精品国久久99热| 日韩亚洲欧美在线观看| 欧美性色欧美a在线播放| 国产乱人伦偷精品视频不卡| 一区二区三区国产| 欧美激情中文字幕一区二区| 精品99久久久久久| 欧美视频一二三区| 精品一区二区在线免费观看| 中文字幕国产一区二区| 亚洲人成在线播放网站岛国| 一区二区三区日韩精品视频| 国产精品18久久久| 欧美另类变人与禽xxxxx| 久久国产麻豆精品| 日本一区二区三区免费乱视频| 欧美电影精品一区二区| 欧美无砖专区一中文字| a亚洲天堂av| 国产精品中文有码|