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

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

?? http.lst

?? c51和8019實現(xiàn)單片機上網(wǎng)
?? LST
?? 第 1 頁 / 共 2 頁
字號:
C51 COMPILER V7.09   HTTP                                                                  07/31/2006 17:30:50 PAGE 1   


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

line level    source

   1          //-----------------------------------------------------------------------------
   2          // Net HTTP.C
   3          //
   4          // This module is the Web Server
   5          // It currently serves a html text page and a jpeg image, or handles
   6          // a POST message to turn an LED on or off.
   7          // The HTTP protocol specification is at http://www.w3.org/Protocols/ 
   8          //-----------------------------------------------------------------------------
   9          #include <string.h>
  10          #include <stdlib.h>
  11          #include <ctype.h>              // toupper
  12          #include "C8051f.h"
  13          #include "net.h"
  14          #include "serial.h"  
  15          #include "cksum.h"
  16          #include "analog.h"
  17          #include "ip.h"
  18          #include "tcp.h"
  19          #include "http.h"
  20          
  21          
  22          // These structures keep track of connection information
  23          extern CONNECTION xdata conxn[];
  24           
  25          extern ULONG code my_ipaddr;
  26          extern char xdata text[];
  27          extern UINT idata cpu_temperature;
  28          extern UINT idata air_temperature;
  29          extern UINT idata cpu_voltage;
  30          extern char code html_header[];
  31          extern char code web_page[];
  32          extern char code jpeg_header[];
  33          extern UCHAR code photo1_jpeg[];
  34          extern UCHAR idata rcve_buf_allocated;
  35          extern UCHAR idata debug;
  36          bit CONTROL_LED;
  37          void LightONOFF(bit b);
  38          
  39          void init_http(void)
  40          {
  41   1        CONTROL_LED = 0;
  42   1        LightONOFF(CONTROL_LED);
  43   1      }
  44          
  45          
  46          
  47          //------------------------------------------------------------------------
  48          // This function is the standard string search. The Keil library
  49          // does not provide it.  It looks for one string in another string
  50          // and returns a pointer to it if found, otherwise returns NULL. 
  51          //------------------------------------------------------------------------
  52          char * strstr(char * haystack, char * needle)
  53          {
  54   1              char *ptr1, *ptr2;
  55   1              
C51 COMPILER V7.09   HTTP                                                                  07/31/2006 17:30:50 PAGE 2   

  56   1              // Protect against NULL pointer
  57   1              if (*needle == 0) return(haystack);
  58   1              for( ; *haystack; haystack++ )
  59   1              {
  60   2                      // Look for needle in haystack.  If there is a
  61   2            // match then this will continue all the way
  62   2            // until ptr1 reaches the NULL at the end of needle 
  63   2                      for(ptr1 = needle, ptr2 = haystack; *ptr1 && (*ptr1 == *ptr2); ++ptr1, ++ptr2);
  64   2                                                              
  65   2                      // If there is a match then return pointer to needle in haystack
  66   2                      if(*ptr1 == 0) return(haystack);        
  67   2              }
  68   1              return NULL;                    // no matching string found
  69   1      }
  70          
  71          
  72          
  73          //------------------------------------------------------------------------
  74          // This sends an TCP segment to the ip layer.  The segment is 
  75          // is normally either a web page or a graphic.
  76          // See "TCP/IP Illustrated, Volume 1" Sect 17.3
  77          //------------------------------------------------------------------------
  78          void http_send(UCHAR xdata * outbuf, UINT len, UCHAR nr)
  79          {
  80   1         TCP_HEADER xdata * tcp;
  81   1         IP_HEADER xdata * ip;
  82   1         ULONG idata sum;
  83   1         UINT idata result;
  84   1                
  85   1         // Fill in TCP segment header
  86   1         tcp = (TCP_HEADER xdata *)(outbuf + 34);
  87   1         ip = (IP_HEADER xdata *)(outbuf + 14);
  88   1      
  89   1         tcp->source_port = HTTP_PORT;
  90   1         tcp->dest_port = conxn[nr].port;
  91   1         tcp->sequence = conxn[nr].my_sequence;
  92   1         tcp->ack_number = conxn[nr].his_sequence;
  93   1            
  94   1              // Header is always 20 bytes long
  95   1         tcp->flags = 0x5000 | FLG_ACK | FLG_PSH;
  96   1         tcp->window = 1024;
  97   1         tcp->checksum = 0;
  98   1         tcp->urgent_ptr = 0;
  99   1         
 100   1         // Compute checksum including 12 bytes of pseudoheader
 101   1              // Must pre-fill 2 items in ip header to do this
 102   1              ip->dest_ipaddr = conxn[nr].ipaddr;
 103   1              ip->source_ipaddr = my_ipaddr;
 104   1                      
 105   1              // Sum source_ipaddr, dest_ipaddr, and entire TCP message 
 106   1              sum = (ULONG)cksum(outbuf + 26, 8 + len);
 107   1                                      
 108   1              // Add in the rest of pseudoheader which is
 109   1              // protocol id and TCP segment length
 110   1              sum += (ULONG)0x0006;
 111   1              sum += (ULONG)len;
 112   1      
 113   1              // In case there was a carry, add it back around
 114   1              result = (UINT)(sum + (sum >> 16));
 115   1              tcp->checksum = ~result;
 116   1         
 117   1         if (debug) serial_send("TCP: Sending msg to IP layer\r");
C51 COMPILER V7.09   HTTP                                                                  07/31/2006 17:30:50 PAGE 3   

 118   1              ip_send(outbuf, conxn[nr].ipaddr, TCP_TYPE, len);
 119   1      
 120   1         // (Re)start TCP retransmit timer
 121   1         conxn[nr].timer = TCP_TIMEOUT;
 122   1      }
 123          
 124          
 125          
 126          //------------------------------------------------------------------------
 127          // This searches a web page looking for a specified tag.  If found,
 128          // it replaces the tag with the text in * sub.  Tags are fixed length -
 129          // The first 4 chars of the tag is always "TAG:" and the rest of it
 130          // is always 4 chars for a total of 8 chars. 
 131          //------------------------------------------------------------------------
 132          void replace_tag(UCHAR xdata * start, char * tag, char * sub) 
 133          { 
 134   1         UCHAR idata i, flg;
 135   1         UCHAR xdata * ptr;
 136   1         
 137   1         // Find tag.  If not found - just return
 138   1         ptr = strstr(start, tag);
 139   1              if (ptr == NULL) return;
 140   1         
 141   1              flg = TRUE;
 142   1      
 143   1         // Replace the 8 char tag with the substitute text
 144   1              // Pad on the right with spaces
 145   1         for (i=0; i < 8; i++)
 146   1              {
 147   2              if (sub[i] == 0) flg = FALSE;
 148   2              if (flg) ptr[i] = sub[i]; else ptr[i] = SPACE;
 149   2              }
 150   1      }
 151          
 152          
 153          
 154          //------------------------------------------------------------------------
 155          //      This serves up either a HTML page, a JPEG image, or controls an 
 156          // LED,  depending what it gets from the browser.  The received header
 157          // must contain the word "GET" or "POST" to be considered a valid request.
 158          // With HTTP 1.1 where the connection is left open, the header I send
 159          // should include content length. With HTTP 1.0 you can just close the
 160          // connection after sending the page and the browser knows its done. 
 161          //
 162          // The HTTP protocol specification is at http://www.w3.org/Protocols/ 
 163          //------------------------------------------------------------------------
 164          UINT http_server(UCHAR xdata * inbuf, UINT header_len, UCHAR nr, UCHAR resend)
 165          {
 166   1              UCHAR i;
 167   1              UINT idata body_len, hhdr_len, jhdr_len, page_len, jpeg_len;
 168   1              UINT idata sent, remaining;
 169   1              UCHAR xdata * outbuf;
 170   1              UCHAR xdata * ptr;
 171   1              UCHAR xdata * tcp_data;
 172   1              UCHAR idata request;
 173   1         static UCHAR idata post_flg = FALSE;
 174   1                              
 175   1              // Make sure this is a valid connection
 176   1              if (nr == NO_CONNECTION) return 0;
 177   1              
 178   1              // Compute start of TCP data
 179   1         
C51 COMPILER V7.09   HTTP                                                                  07/31/2006 17:30:50 PAGE 4   

 180   1         // Save first 20 chars and seq number just in case
 181   1         // we need to re-generate page
 182   1         // TODO: if post, then save switch state infomation
 183   1         if (!resend)
 184   1         {
 185   2            tcp_data = inbuf + 34 + header_len;
 186   2            memcpy(conxn[nr].query, tcp_data, 20);
 187   2            conxn[nr].old_sequence = conxn[nr].my_sequence;
 188   2         }
 189   1         // If this is a resend, set sequence number to what it was
 190   1         // the last time we sent this
 191   1         else
 192   1         {
 193   2            tcp_data = inbuf;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人丝袜18视频在线观看| 亚洲一区二区成人在线观看| 在线观看视频91| 国产精品网友自拍| 91麻豆精品久久久久蜜臀| 成人午夜激情视频| 免费观看在线色综合| 亚洲伦在线观看| 精品乱人伦一区二区三区| 色www精品视频在线观看| 精品一区精品二区高清| 亚洲自拍偷拍av| 国产精品传媒入口麻豆| 2024国产精品| 欧美一区二区三区四区在线观看| 亚洲福利电影网| 精品视频一区三区九区| 成人福利在线看| 国产乱子伦视频一区二区三区| 无码av中文一区二区三区桃花岛| 国产精品久久久久国产精品日日| 精品99久久久久久| 日韩无一区二区| 欧美美女直播网站| 在线中文字幕一区| 在线视频你懂得一区| 成+人+亚洲+综合天堂| 国产精华液一区二区三区| 久久精品99国产精品| 精品久久人人做人人爰| 欧美一区二区视频在线观看2020| 欧美亚洲免费在线一区| 色综合久久久久网| 91丝袜高跟美女视频| www.亚洲色图| 不卡免费追剧大全电视剧网站| 国产一区二区三区av电影| 久久精品国产99久久6| 看电视剧不卡顿的网站| 日本一道高清亚洲日美韩| 日本亚洲欧美天堂免费| 免费久久精品视频| 中文av一区二区| 国产精品蜜臀在线观看| 中文字幕二三区不卡| 国产精品理论片在线观看| 国产精品乱人伦一区二区| 国产欧美日韩卡一| 国产精品毛片无遮挡高清| 国产精品人妖ts系列视频| 国产精品网站导航| 亚洲精品乱码久久久久久久久| 最新国产成人在线观看| 亚洲欧美另类小说视频| 4438亚洲最大| 亚洲精品一区二区三区福利| 久久久影视传媒| 国产精品素人视频| 一区二区在线观看免费| 天堂成人免费av电影一区| 奇米影视一区二区三区小说| 日本麻豆一区二区三区视频| 狠狠色丁香九九婷婷综合五月| 国产一区不卡视频| av在线综合网| 欧美精品自拍偷拍| 精品精品欲导航| 不卡视频免费播放| 欧美日韩国产天堂| 久久免费视频一区| 亚洲欧美国产毛片在线| 五月激情综合网| 国产精品99久久久久久久女警| 91视频国产资源| 欧美精品高清视频| 国产色一区二区| 亚洲影视在线观看| 国产精品亚洲视频| 欧美日韩第一区日日骚| 欧美精品一区二区三| 欧美日韩国产影片| 中文字幕av一区二区三区| 亚洲午夜av在线| 欧美视频日韩视频在线观看| 日韩一二在线观看| 亚洲欧洲日韩综合一区二区| 午夜亚洲福利老司机| 国产精品一区在线观看你懂的| 欧美三级资源在线| 久久日一线二线三线suv| 亚洲综合一二三区| 国产精品12区| 日韩欧美二区三区| 亚洲精品一二三四区| 蜜桃视频免费观看一区| 91美女蜜桃在线| 久久亚洲精品小早川怜子| 亚洲一区在线观看免费 | 麻豆精品精品国产自在97香蕉| 成人福利电影精品一区二区在线观看 | 午夜欧美在线一二页| 国产精品羞羞答答xxdd| 欧美日韩一级二级三级| 中文字幕视频一区二区三区久| 蜜臀91精品一区二区三区| 色综合久久六月婷婷中文字幕| 国产婷婷一区二区| 亚洲3atv精品一区二区三区| 成人av网站免费观看| 精品日韩99亚洲| 亚洲一区二区精品3399| 春色校园综合激情亚洲| 精品国产伦一区二区三区免费| 天堂在线亚洲视频| 91麻豆国产福利在线观看| 久久一区二区三区国产精品| 日本成人在线电影网| 欧美日韩精品三区| 一区二区三区四区乱视频| 成人av在线电影| 国产无人区一区二区三区| 美女爽到高潮91| 欧美一区二区黄色| 日韩福利电影在线| 国产福利不卡视频| 精品国产乱码久久久久久蜜臀 | 波多野结衣中文一区| 久久蜜桃av一区精品变态类天堂| 国产日韩三级在线| 国产一区二区三区免费看| 亚洲精品在线网站| 久久精品国产澳门| 日韩欧美电影在线| 麻豆国产精品777777在线| 欧美一区二区精品在线| 久久精品国产精品亚洲红杏| 欧美一区二区不卡视频| 蜜乳av一区二区三区| www国产成人免费观看视频 深夜成人网| 麻豆精品久久精品色综合| 精品国产乱码久久久久久闺蜜| 国产欧美日韩中文久久| 岛国av在线一区| 亚洲天堂精品视频| 色狠狠一区二区| 亚洲成人动漫在线观看| 欧美日韩一区二区三区不卡| 亚洲大片一区二区三区| 欧美久久久一区| 久久av资源站| 欧美国产一区二区| 91污片在线观看| 亚洲观看高清完整版在线观看 | 国产精品免费网站在线观看| 亚洲成人精品在线观看| 欧美蜜桃一区二区三区| 麻豆精品视频在线观看免费| 国产午夜三级一区二区三| 成人免费毛片嘿嘿连载视频| 最新日韩av在线| 欧美曰成人黄网| 日韩电影一二三区| 久久精品一区蜜桃臀影院| 北条麻妃国产九九精品视频| 亚洲国产婷婷综合在线精品| 日韩午夜av一区| 粗大黑人巨茎大战欧美成人| 一区二区三区四区不卡在线| 欧美一区二区免费| 国产91丝袜在线播放0| 亚洲精品ww久久久久久p站| 日韩欧美亚洲国产另类| 成人一区二区三区中文字幕| 一区二区三区在线免费观看| 3atv一区二区三区| 成人三级伦理片| 午夜成人在线视频| 久久久久99精品一区| 欧美午夜精品免费| 国产一区欧美二区| 亚洲一区二区三区四区中文字幕| 精品奇米国产一区二区三区| 91麻豆123| 久久se这里有精品| 亚洲欧美二区三区| 日韩欧美国产一二三区| 91浏览器在线视频| 国产一区 二区| 视频一区视频二区在线观看| 国产欧美一区二区三区沐欲| 欧美日韩国产乱码电影| 成人av电影免费观看| 九九精品视频在线看| 一区二区三区蜜桃网| 中文字幕av在线一区二区三区| 欧美福利视频一区| 色综合天天综合在线视频| 韩国精品主播一区二区在线观看 | 成人aaaa免费全部观看| 美女网站一区二区|