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

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

?? tcp.lst

?? 包括了cygnal串口調(diào)試程序和工業(yè)以太網(wǎng)的開發(fā)程序web020
?? LST
?? 第 1 頁 / 共 3 頁
字號(hào):
C51 COMPILER V7.07   TCP                                                                   11/25/2003 15:47:51 PAGE 1   


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

stmt level    source

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

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

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

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美精品一区二区色综合 | 久久夜色精品国产噜噜av| 蜜桃久久久久久久| 亚洲欧美一区二区三区极速播放 | 亚洲午夜精品17c| 精品国产髙清在线看国产毛片| 懂色av一区二区三区免费观看| 亚洲精品一卡二卡| 久久久777精品电影网影网 | 国产亚洲欧美一区在线观看| 日本黄色一区二区| 国产精品一区在线| 日韩电影网1区2区| 亚洲大片一区二区三区| 18成人在线观看| 国产精品久久免费看| 日韩一区二区电影网| 91久久人澡人人添人人爽欧美| av电影在线观看完整版一区二区| 亚洲一区二区偷拍精品| ...av二区三区久久精品| 国产亚洲欧美一区在线观看| 日韩欧美一二三四区| 欧美日韩一区二区三区在线看 | 麻豆91在线观看| 蜜桃视频免费观看一区| 奇米888四色在线精品| 午夜精品福利一区二区蜜股av| 亚洲自拍另类综合| 亚洲韩国一区二区三区| 日本女人一区二区三区| 美日韩一区二区| 国产一区二区三区四区五区美女| 六月丁香婷婷久久| 国产精品18久久久久久vr| 国产精品一区二区三区网站| 精品国产不卡一区二区三区| 国产午夜精品理论片a级大结局| 欧美剧情片在线观看| 在线不卡中文字幕| 日韩免费视频一区二区| 亚洲国产精品精华液2区45| 欧美国产日韩一二三区| 亚洲欧洲性图库| 日韩vs国产vs欧美| av资源网一区| 日韩精品中文字幕在线不卡尤物 | 99久久婷婷国产| 在线亚洲精品福利网址导航| 91麻豆精品国产| 亚洲欧美偷拍卡通变态| 蜜桃视频第一区免费观看| 国产美女精品一区二区三区| 北岛玲一区二区三区四区| 欧美理论电影在线| 国产精品污www在线观看| 日韩精品欧美成人高清一区二区| 国产精品一卡二| 91精品国产日韩91久久久久久| 综合自拍亚洲综合图不卡区| 免费精品视频在线| 欧美高清hd18日本| 亚洲欧美一区二区三区极速播放| 国内精品视频666| 欧美日韩国产经典色站一区二区三区 | 国产三级精品三级在线专区| 亚洲一区二区三区美女| 色哟哟国产精品免费观看| www日韩大片| 青青草91视频| 日韩一区二区电影在线| 午夜视频久久久久久| 91精彩视频在线| 亚洲欧洲日韩女同| 99国内精品久久| 久久亚洲精精品中文字幕早川悠里| 亚洲1区2区3区视频| 欧美一二三区精品| 久久精品国产秦先生| 久久久精品综合| 成人午夜在线视频| 国产精品久久久久久久第一福利| 国产高清精品在线| 中文字幕亚洲一区二区va在线| 成人激情文学综合网| 综合自拍亚洲综合图不卡区| 色吊一区二区三区| 婷婷成人激情在线网| 日韩亚洲欧美在线| 精品一区二区免费| 中文字幕一区二区三区av| 91国产成人在线| 午夜a成v人精品| 欧美精品一区二区三区蜜桃视频 | 欧美电视剧免费全集观看| 国产精品中文欧美| 一区二区三区视频在线看| 91精品婷婷国产综合久久性色| 国产一区美女在线| 夜夜精品视频一区二区| 在线视频一区二区三区| 日韩一区二区在线看| 日本亚洲免费观看| 亚洲欧美激情在线| 日韩亚洲欧美成人一区| 99精品久久99久久久久| 日韩和欧美一区二区| 中文字幕一区二区三区不卡在线| 欧美性极品少妇| 国产精品一卡二| 日本欧美加勒比视频| 亚洲同性gay激情无套| 国产亚洲午夜高清国产拍精品 | 成人国产在线观看| 久久99精品视频| 日本亚洲电影天堂| 亚洲伊人伊色伊影伊综合网| 国产视频在线观看一区二区三区| 欧美一区二区三区喷汁尤物| 91色.com| 色88888久久久久久影院按摩| 国产电影一区二区三区| 美国毛片一区二区| 免费视频最近日韩| 久久国产生活片100| 日本网站在线观看一区二区三区| 亚洲一区在线观看免费观看电影高清 | 亚洲人xxxx| 亚洲免费观看高清完整版在线观看 | 日本一区二区电影| 国产欧美一区二区精品久导航| 日韩美女视频在线| 日韩精品专区在线影院重磅| 日韩午夜精品视频| 久久美女高清视频| 国产欧美一区二区三区在线看蜜臀 | 午夜av区久久| 国产麻豆精品theporn| 国产成都精品91一区二区三| 成人18精品视频| 91视视频在线直接观看在线看网页在线看| 久久久另类综合| 亚洲欧美精品午睡沙发| 亚洲一区在线观看免费观看电影高清| 亚洲美女在线国产| 免费日韩伦理电影| aaa亚洲精品| 欧美日韩成人综合| 国产欧美视频在线观看| 亚洲精品免费一二三区| 午夜欧美在线一二页| 丁香婷婷深情五月亚洲| 91福利资源站| 久久综合国产精品| 亚洲一区二区三区免费视频| 久久成人免费日本黄色| 91蝌蚪porny九色| xf在线a精品一区二区视频网站| 中文字幕一区二区三区色视频 | 成人av电影免费在线播放| 欧美丝袜丝nylons| 亚洲欧美偷拍卡通变态| 中文av一区特黄| 亚洲男同性恋视频| 狠狠色丁香久久婷婷综| 欧美做爰猛烈大尺度电影无法无天| 欧美精品一区视频| 视频在线观看一区二区三区| 97se亚洲国产综合自在线观| 在线播放国产精品二区一二区四区| 国产精品乱人伦中文| 国产精品伊人色| 国产午夜亚洲精品午夜鲁丝片| 日韩中文字幕不卡| 欧美片在线播放| 日产国产高清一区二区三区| 欧美自拍偷拍午夜视频| 亚洲另类色综合网站| 99久久国产综合精品女不卡| 中文字幕第一区第二区| 成人一区在线观看| 国产精品国产三级国产普通话三级| 国产aⅴ综合色| 国产精品视频免费看| av电影在线观看完整版一区二区| 国产日韩精品视频一区| 成人激情开心网| 尤物av一区二区| 欧美一区二区三区四区高清| 另类成人小视频在线| 国产无人区一区二区三区| 国产精品亚洲一区二区三区妖精| 国产亚洲成av人在线观看导航| 经典三级视频一区| 国产精品久久久久久亚洲毛片 | 色悠久久久久综合欧美99| 亚洲男女一区二区三区| 日韩一区二区三区高清免费看看| 欧美aⅴ一区二区三区视频| 久久在线免费观看|