⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgi.lst

📁 STC51系列的源码
💻 LST
字号:
C51 COMPILER V8.02   CGI                                                                   10/16/2008 20:59:34 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE CGI
OBJECT MODULE PLACED IN .\out\cgi.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE cgi.c LARGE OPTIMIZE(SIZE) BROWSE DEBUG OBJECTEXTEND PRINT(.\out\cgi.lst) O
                    -BJECT(.\out\cgi.obj)

line level    source

   1          
   2          
   3          #include "uip.h"
   4          #include "cgi.h"
   5          #include "httpd.h"
*** WARNING C318 IN LINE 5 OF cgi.c: can't open file 'httpd.h'
   6          #include "fs.h"
*** WARNING C318 IN LINE 6 OF cgi.c: can't open file 'fs.h'
   7          
   8          #include <stdio.h>
   9          #include <string.h>
  10          
  11          u8_t print_stats(u8_t next);
  12          u8_t file_stats(u8_t next);
  13          u8_t tcp_stats(u8_t next);
  14          
  15          //cgifunction code cgitab[] = {
  16          //  print_stats,   /* CGI function "a" */
  17          //  file_stats,    /* CGI function "b" */
  18          //  tcp_stats      /* CGI function "c" */
  19          //};
  20          
  21          static const char code closed[] =   /*  "CLOSED",*/
  22          {0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0};
  23          static const char code syn_rcvd[] = /*  "SYN-RCVD",*/
  24          {0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56, 
  25           0x44,  0};
  26          static const char code syn_sent[] = /*  "SYN-SENT",*/
  27          {0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e, 
  28           0x54,  0};
  29          static const char code established[] = /*  "ESTABLISHED",*/
  30          {0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, 
  31           0x45, 0x44, 0};
  32          static const char code fin_wait_1[] = /*  "FIN-WAIT-1",*/
  33          {0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, 
  34           0x54, 0x2d, 0x31, 0};
  35          static const char code fin_wait_2[] = /*  "FIN-WAIT-2",*/
  36          {0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, 
  37           0x54, 0x2d, 0x32, 0};
  38          static const char code closing[] = /*  "CLOSING",*/
  39          {0x43, 0x4c, 0x4f, 0x53, 0x49, 
  40           0x4e, 0x47, 0};
  41          static const char code time_wait[] = /*  "TIME-WAIT,"*/
  42          {0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41, 
  43           0x49, 0x54, 0};
  44          static const char code last_ack[] = /*  "LAST-ACK"*/
  45          {0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43, 
  46           0x4b, 0};
  47          
  48          static const char code *states[] = {
  49            closed,
  50            syn_rcvd,
  51            syn_sent,
  52            established,
C51 COMPILER V8.02   CGI                                                                   10/16/2008 20:59:34 PAGE 2   

  53            fin_wait_1,
  54            fin_wait_2,
  55            closing,
  56            time_wait,
  57            last_ack};
  58            
  59          
  60          /*-----------------------------------------------------------------------------------*/
  61          /* print_stats:
  62           *
  63           * Prints out a part of the uIP statistics. The statistics data is
  64           * written into the uip_appdata buffer. It overwrites any incoming
  65           * packet.
  66           */
  67          u8_t print_stats(u8_t next)
  68          {
  69   1      #if UIP_STATISTICS
  70   1        u16_t i, j;
  71   1        u8_t *buf;
  72   1        u16_t *databytes;
  73   1        
  74   1        if(next) {
  75   2          /* If our last data has been acknowledged, we move on the next
  76   2             chunk of statistics. */
  77   2          hs->count = hs->count + 4;
*** ERROR C202 IN LINE 77 OF CGI.C: 'hs': undefined identifier
  78   2          if(hs->count >= sizeof(struct uip_stats)/sizeof(u16_t)) {
*** ERROR C202 IN LINE 78 OF CGI.C: 'hs': undefined identifier
  79   3            /* We have printed out all statistics, so we return 1 to
  80   3               indicate that we are done. */
  81   3            return 1;
  82   3          }
  83   2        }
  84   1      
  85   1        /* Write part of the statistics into the uip_appdata buffer. */
  86   1        databytes = (u16_t *)&uip_stat + hs->count;
*** ERROR C202 IN LINE 86 OF CGI.C: 'hs': undefined identifier
  87   1        buf       = (u8_t *)uip_appdata;
  88   1      
  89   1        j = 4 + 1;
  90   1        i = hs->count;
*** ERROR C202 IN LINE 90 OF CGI.C: 'hs': undefined identifier
  91   1        while (i < sizeof(struct uip_stats)/sizeof(u16_t) && --j > 0) {
  92   2          sprintf((char *)buf, "%5u\r\n", *databytes);
  93   2          ++databytes;
  94   2          buf += 6;
  95   2          ++i;
  96   2        }
  97   1      
  98   1        /* Send the data. */
  99   1        uip_send(uip_appdata, buf - uip_appdata);
 100   1        
 101   1        return 0;
 102   1      #else
                return 1;
              #endif /* UIP_STATISTICS */
 105   1      }
 106          /*-----------------------------------------------------------------------------------*/
 107          u8_t file_stats(u8_t next)
 108          {
 109   1        /* We use sprintf() to print the number of file accesses to a
 110   1           particular file (given as an argument to the function in the
C51 COMPILER V8.02   CGI                                                                   10/16/2008 20:59:34 PAGE 3   

 111   1           script). We then use uip_send() to actually send the data. */
 112   1        if(next) {
 113   2          return 1;
 114   2        }
 115   1        uip_send(uip_appdata, sprintf((char *)uip_appdata, "%5u", fs_count(&hs->script[4])));  
*** ERROR C202 IN LINE 115 OF CGI.C: 'hs': undefined identifier
 116   1        return 0;
 117   1      }
 118          /*-----------------------------------------------------------------------------------*/
 119          u8_t  tcp_stats(u8_t next)
 120          {
 121   1        struct uip_conn *conn;  
 122   1        u16_t   chrs_wrtn_to_buf = 0;
 123   1      
 124   1        if(next) {
 125   2          /* If the previously sent data has been acknowledged, we move
 126   2             forward one connection. */
 127   2          if(++hs->count == UIP_CONNS) {
*** ERROR C202 IN LINE 127 OF CGI.C: 'hs': undefined identifier
 128   3            /* If all connections has been printed out, we are done and
 129   3               return 1. */
 130   3            return 1;
 131   3          }
 132   2        }
 133   1        
 134   1        conn = &uip_conns[hs->count];
*** ERROR C202 IN LINE 134 OF CGI.C: 'hs': undefined identifier
 135   1        if((conn->tcpstateflags & TS_MASK) == CLOSED) {
 136   2          uip_send(uip_appdata, sprintf((char *)uip_appdata,
 137   2                                        "<tr align=\"center\"><td>-</td><td>-</td><td>%bu</td><td>%bu</td><td>%c %c</td></tr>\r\n",
 138   2                                        conn->nrtx,
 139   2                                        conn->timer,
 140   2                                        (uip_outstanding(conn))? '*':' ',
 141   2                                        (uip_stopped(conn))? '!':' '));
 142   2        } else {
 143   2              /* In SMALL & COMPACT models Keil C's printf() & sprintf() routines 
 144   2                 can only be passed up to 15 bytes of data, then they fall over. 
 145   2                 We do successive sprintf() calls here to get around this 
 146   2                 limitation. */
 147   2              chrs_wrtn_to_buf = sprintf((char *)uip_appdata,
 148   2                       "<tr align=\"center\"><td>%u.%u.%u.%u:%u</td>",
 149   2                       htons(conn->ripaddr[0]) >> 8,
 150   2                       htons(conn->ripaddr[0]) & 0xff,
 151   2                       htons(conn->ripaddr[1]) >> 8,
 152   2                       htons(conn->ripaddr[1]) & 0xff,
 153   2                       htons(conn->rport));
 154   2              chrs_wrtn_to_buf += sprintf((char *)uip_appdata + chrs_wrtn_to_buf,
 155   2                       "<td>%s</td><td>%bu</td><td>%bu</td><td>%c %c</td></tr>\r\n",
 156   2                       states[conn->tcpstateflags & TS_MASK],
 157   2                       conn->nrtx,
 158   2                       conn->timer,
 159   2                       (uip_outstanding(conn))? '*':' ',
 160   2                       (uip_stopped(conn))? '!':' ');
 161   2              uip_send(uip_appdata, chrs_wrtn_to_buf);
 162   2        }
 163   1        return 0;
 164   1      }
 165          /*-----------------------------------------------------------------------------------*/

C51 COMPILATION COMPLETE.  2 WARNING(S),  7 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -