https_callbacks.lst

来自「cs8900 c51应用」· LST 代码 · 共 239 行

LST
239
字号
C51 COMPILER V7.06   HTTPS_CALLBACKS                                                       11/26/2004 11:32:47 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE HTTPS_CALLBACKS
OBJECT MODULE PLACED IN .\8052-obj\https_callbacks.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\http\https_callbacks.c LARGE OPTIMIZE(SIZE) BROWSE INTVECTOR(0X2000) INC
                    -DIR(D:\Work\opentcp\1-0-2\src\include\) DEFINE(MONITOR,CS8900) DEBUG OBJECTEXTEND CODE SYMBOLS PRINT(.\8052-lst\https_ca
                    -llbacks.lst) PREPRINT(.\8052-lst\https_callbacks.i) OBJECT(.\8052-obj\https_callbacks.obj)

stmt level    source

   1          /*
   2           *Copyright (c) 2000-2002 Viola Systems Ltd.
   3           *All rights reserved.
   4           *
   5           *Redistribution and use in source and binary forms, with or without 
   6           *modification, are permitted provided that the following conditions 
   7           *are met:
   8           *
   9           *1. Redistributions of source code must retain the above copyright 
  10           *notice, this list of conditions and the following disclaimer.
  11           *
  12           *2. Redistributions in binary form must reproduce the above copyright 
  13           *notice, this list of conditions and the following disclaimer in the 
  14           *documentation and/or other materials provided with the distribution.
  15           *
  16           *3. The end-user documentation included with the redistribution, if 
  17           *any, must include the following acknowledgment:
  18           *      "This product includes software developed by Viola 
  19           *      Systems (http://www.violasystems.com/)."
  20           *
  21           *Alternately, this acknowledgment may appear in the software itself, 
  22           *if and wherever such third-party acknowledgments normally appear.
  23           *
  24           *4. The names "OpenTCP" and "Viola Systems" must not be used to 
  25           *endorse or promote products derived from this software without prior 
  26           *written permission. For written permission, please contact 
  27           *opentcp@opentcp.org.
  28           *
  29           *5. Products derived from this software may not be called "OpenTCP", 
  30           *nor may "OpenTCP" appear in their name, without prior written 
  31           *permission of the Viola Systems Ltd.
  32           *
  33           *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 
  34           *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  35           *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  36           *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE 
  37           *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
  38           *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
  39           *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
  40           *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  41           *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
  42           *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
  43           *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44           *====================================================================
  45           *
  46           *OpenTCP is the unified open source TCP/IP stack available on a series 
  47           *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.
  48           *
  49           *For more information on how to network-enable your devices, or how to 
  50           *obtain commercial technical support for OpenTCP, please see 
  51           *<http://www.violasystems.com/>.
  52           */
  53          
C51 COMPILER V7.06   HTTPS_CALLBACKS                                                       11/26/2004 11:32:47 PAGE 2   

  54          /** \file https_callbacks.c
  55           *      \brief HTTP server callback functions
  56           *      \author 
  57           *              \li Jari Lahti (jari.lahti@violasystems.com)
  58           *      \version 1.0
  59           *      \date 9.10.2002
  60           *  \bug
  61           *      \warning
  62           *      \todo
  63           *
  64           *      This file holds definitions and descriptions of HTTP callback functions
  65           *      that will be overridden by user code. These callback functions are 
  66           *      invoked by HTTP server to get a feedback from the part of HTTP server
  67           *      who's behaviour is defined by the user application.
  68           */ 
  69          #include<inet/datatypes.h>
*** WARNING C318 IN LINE 69 OF ..\http\https_callbacks.c: can't open file 'inet/datatypes.h'
  70          #include<inet/debug.h>
*** WARNING C318 IN LINE 70 OF ..\http\https_callbacks.c: can't open file 'inet/debug.h'
  71          #include<inet/globalvariables.h>
*** WARNING C318 IN LINE 71 OF ..\http\https_callbacks.c: can't open file 'inet/globalvariables.h'
  72          #include<inet/system.h>
*** WARNING C318 IN LINE 72 OF ..\http\https_callbacks.c: can't open file 'inet/system.h'
  73          #include<inet/http/http_server.h>
*** WARNING C318 IN LINE 73 OF ..\http\https_callbacks.c: can't open file 'inet/http/http_server.h'
  74          
  75          
  76          /** \brief File not found message
  77           *
  78           *      Message that will be displayed if a file with appropriate name (hash
  79           *      value) was not found.
  80           */
  81          const char https_not_found_page[] = "HTTP/1.0 200 OK\r\n \
  82          Last-modified: Fri, 18 Oct 2002 12:04:32 GMT\r\n \
  83          Server: ESERV-10/1.0\nContent-type: text/html\r\n \
  84          Content-length: 400\r\n\r\n \
  85          <HEAD><TITLE>Viola Systems Embedded WEB Server</TITLE></HEAD> \
  86          <BODY> \
  87          <H2>HTTP 1.0 404 Error. File Not Found</H2> \
  88          The requested URL was not found on this server. \
  89          <HR><BR><I>Viola Systems Embedded WEB Server 2.0, 2002<BR> \
  90          Web Server for Embedded Applications</I><BR> \
  91          <A HREF=http://www.violasystems.com> \
  92          www.violasystems.com - Embedding The Internet</A> \
  93          </BODY>";
  94          
  95          /** \brief Brief function description here
  96           *      \author 
  97           *              \li Jari Lahti (jari.lahti@violasystems.com)
  98           *      \date 09.10.2002
  99           *      \param hash Calculated file-name hash value. Used so that the whole
 100           *              file name doesn't need to be stored in RAM
 101           *      \param ses HTTP session identifier
 102           *      \return
 103           *              \li -1 - This function should return -1 if no file has been found
 104           *              \li 1 - This function should return 1 if a file with appropriate
 105           *                      hash value has been found.
 106           *      \warning
 107           *              \li This function <b>MUST</b> be implemented by user application
 108           *              to work with local configuration
 109           *
 110           *      This function is invoked by the HTTP server once a hash value of a 
C51 COMPILER V7.06   HTTPS_CALLBACKS                                                       11/26/2004 11:32:47 PAGE 3   

 111           *      requested file name has been calculated. User application uses this
 112           *      hash value to check if appropriate file is available to web server.
 113           *      Appropriate https session entry is then filled accordingly.     
 114           *
 115           */
 116          INT16 https_findfile (UINT8 hash, UINT8 ses)
*** ERROR C129 IN LINE 116 OF ..\HTTP\HTTPS_CALLBACKS.C: missing ';' before 'https_findfile'
 117          {
 118                  /* Access the File table on FLASH with given hash key   */
 119                  /* and modify session File parametera                                   */
 120                  
 121                  UINT8 file_not_found;
 122          
 123                  /* We have no file, so */
 124                  file_not_found = 1;
 125          
 126                  if( file_not_found )
 127                  {
 128                          /*      File not found, initialize return message*/
 129                                                  
 130                          https[ses].fstart = 0xFFFFFFFF;
 131                          https[ses].funacked  = 0;
 132                          https[ses].flen = strlen(&https_not_found_page[0], 1000);
 133                          https[ses].fpoint = 0;
 134                          
 135                          return(-1);
 136                  }
 137                  /*
 138          
 139                  */
 140                  
 141                  /* OK, file found. */   
 142                  /* Modify structure     
 143                  https[ses].fstart = file start address;
 144                  https[ses].flen = file length;
 145                  https[ses].fpoint = current pointer within the file
 146                  https[ses].funacked = 0;        no unacked data for now
 147                  */
 148                  return(1);  
 149                  
 150          }
 151          
 152          /** \brief Fill network transmit buffer with HTTP headers&data
 153           *      \author
 154           *              \li Jari Lahti (jari.lahti@violasystems.com)
 155           *      \date 09.10.2002
 156           *      \param ses HTTP session identifier
 157           *      \param buf Pointer to buffer where data is to be stored
 158           *      \param buflen Length of the buffer in bytes
 159           *      \return
 160           *              \li >=0 - Number of bytes written to buffer
 161           *      \warning 
 162           *              \li This function <b>MUST</b> be implemented by user application
 163           *              to work with local configuration
 164           *
 165           *      This handlers' job is to fill the buffer with the data that web server
 166           *      should return back through the TCP connection. This is accomplished
 167           *      based session identifer and values of variables in appropriate
 168           *      https entry.
 169           */
 170          INT16 https_loadbuffer (UINT8 ses, UINT8* buf, UINT16 buflen) {
 171                  UINT16 i;
C51 COMPILER V7.06   HTTPS_CALLBACKS                                                       11/26/2004 11:32:47 PAGE 4   

 172                  
 173                  if( https[ses].fstart == 0xFFFFFFFF )
 174                  {
 175                          /* Error site asked     */
 176                          
 177                          kick_WD();
 178                          
 179                          for(i=0; i < (https[ses].flen - https[ses].fpoint); i++)
 180                          {
 181                                  if(i >= buflen)
 182                                          break;
 183                          
 184                                  *buf++ = https_not_found_page[https[ses].fpoint + i];
 185                          
 186                          }
 187                          
 188                          return(i);
 189                  
 190                  }
 191                  
 192                  /* Access some storage media (internal/external flash...)*/
 193                  
 194                  for(i=0; i < (https[ses].flen - https[ses].fpoint); i++)
 195                  {
 196                          if(i >= buflen)
 197                                  break;  
 198                          
 199                          kick_WD();
 200                          /*
 201                          
 202                          *buf++ = next_data_byte(...);
 203                          
 204                          */
 205                          
 206                  
 207                  }
 208                  
 209                  return(i);
 210                  
 211          
 212          
 213          }

C51 COMPILATION COMPLETE.  5 WARNING(S),  1 ERROR(S)

⌨️ 快捷键说明

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