📄 https__callbacks_8c-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>/opentcp/http/https_callbacks.c Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center><hr><h1>/opentcp/http/https_callbacks.c</h1><a href="https__callbacks_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> *Copyright (c) 2000-2002 Viola Systems Ltd.</span>00003 <span class="comment"> *All rights reserved.</span>00004 <span class="comment"> *</span>00005 <span class="comment"> *Redistribution and use in source and binary forms, with or without </span>00006 <span class="comment"> *modification, are permitted provided that the following conditions </span>00007 <span class="comment"> *are met:</span>00008 <span class="comment"> *</span>00009 <span class="comment"> *1. Redistributions of source code must retain the above copyright </span>00010 <span class="comment"> *notice, this list of conditions and the following disclaimer.</span>00011 <span class="comment"> *</span>00012 <span class="comment"> *2. Redistributions in binary form must reproduce the above copyright </span>00013 <span class="comment"> *notice, this list of conditions and the following disclaimer in the </span>00014 <span class="comment"> *documentation and/or other materials provided with the distribution.</span>00015 <span class="comment"> *</span>00016 <span class="comment"> *3. The end-user documentation included with the redistribution, if </span>00017 <span class="comment"> *any, must include the following acknowledgment:</span>00018 <span class="comment"> * "This product includes software developed by Viola </span>00019 <span class="comment"> * Systems (http://www.violasystems.com/)."</span>00020 <span class="comment"> *</span>00021 <span class="comment"> *Alternately, this acknowledgment may appear in the software itself, </span>00022 <span class="comment"> *if and wherever such third-party acknowledgments normally appear.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> *4. The names "OpenTCP" and "Viola Systems" must not be used to </span>00025 <span class="comment"> *endorse or promote products derived from this software without prior </span>00026 <span class="comment"> *written permission. For written permission, please contact </span>00027 <span class="comment"> *opentcp@opentcp.org.</span>00028 <span class="comment"> *</span>00029 <span class="comment"> *5. Products derived from this software may not be called "OpenTCP", </span>00030 <span class="comment"> *nor may "OpenTCP" appear in their name, without prior written </span>00031 <span class="comment"> *permission of the Viola Systems Ltd.</span>00032 <span class="comment"> *</span>00033 <span class="comment"> *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED </span>00034 <span class="comment"> *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF </span>00035 <span class="comment"> *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. </span>00036 <span class="comment"> *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE </span>00037 <span class="comment"> *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR </span>00038 <span class="comment"> *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF </span>00039 <span class="comment"> *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR </span>00040 <span class="comment"> *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, </span>00041 <span class="comment"> *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE </span>00042 <span class="comment"> *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, </span>00043 <span class="comment"> *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>00044 <span class="comment"> *====================================================================</span>00045 <span class="comment"> *</span>00046 <span class="comment"> *OpenTCP is the unified open source TCP/IP stack available on a series </span>00047 <span class="comment"> *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.</span>00048 <span class="comment"> *</span>00049 <span class="comment"> *For more information on how to network-enable your devices, or how to </span>00050 <span class="comment"> *obtain commercial technical support for OpenTCP, please see </span>00051 <span class="comment"> *<http://www.violasystems.com/>.</span>00052 <span class="comment"> */</span>00053 00069 <span class="preprocessor">#include<<a class="code" href="datatypes_8h.html">inet/datatypes.h</a>></span>00070 <span class="preprocessor">#include<<a class="code" href="debug_8h.html">inet/debug.h</a>></span>00071 <span class="preprocessor">#include<<a class="code" href="globalvariables_8h.html">inet/globalvariables.h</a>></span>00072 <span class="preprocessor">#include<<a class="code" href="system_8h.html">inet/system.h</a>></span>00073 <span class="preprocessor">#include<<a class="code" href="http__server_8h.html">inet/http/http_server.h</a>></span>00074 00075 <a name="l00081"></a><a class="code" href="https__callbacks_8c.html#a0">00081</a> <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="https__callbacks_8c.html#a0">https_not_found_page</a>[] = <span class="stringliteral">"HTTP/1.0 200 OK\r\n</span>00082 <span class="stringliteral">Last-modified: Fri, 18 Oct 2002 12:04:32 GMT\r\n</span>00083 <span class="stringliteral">Server: ESERV-10/1.0\nContent-type: text/html\r\n</span>00084 <span class="stringliteral">Content-length: 400\r\n</span>00085 <span class="stringliteral">\r\n</span>00086 <span class="stringliteral"><HEAD></span>00087 <span class="stringliteral"><TITLE>Viola Systems Embedded WEB Server</TITLE></HEAD></span>00088 <span class="stringliteral"><BODY></span>00089 <span class="stringliteral"><H2>HTTP 1.0 404 Error. File Not Found</H2></span>00090 <span class="stringliteral">The requested URL was not found on this server.</span>00091 <span class="stringliteral"><HR></span>00092 <span class="stringliteral"><BR></span>00093 <span class="stringliteral"><I></span>00094 <span class="stringliteral">Viola Systems Embedded WEB Server 2.0, 2002</span>00095 <span class="stringliteral"><BR></span>00096 <span class="stringliteral">Web Server for Embedded Applications</span>00097 <span class="stringliteral"></I></span>00098 <span class="stringliteral"><BR></span>00099 <span class="stringliteral"><A HREF=http://www.violasystems.com></span>00100 <span class="stringliteral">www.violasystems.com - Embedding The Internet</A></span>00101 <span class="stringliteral"></BODY>"</span>;00102 <a name="l00124"></a><a class="code" href="https__callbacks_8c.html#a1">00124</a> INT16 <a class="code" href="https__callbacks_8c.html#a1">https_findfile</a> (UINT8 hash, UINT8 ses)00125 {00126 <span class="comment">/* Access the File table on FLASH with given hash key */</span>00127 <span class="comment">/* and modify session File parametera */</span>00128 00129 00130 <span class="comment">/* </span>00131 <span class="comment"> if( file_not_found )</span>00132 <span class="comment"> {</span>00133 <span class="comment"> File not found, initialize return message</span>00134 <span class="comment"> </span>00135 <span class="comment"> https[ses].fstart = 0xFFFFFFFF;</span>00136 <span class="comment"> https[ses].funacked = 0;</span>00137 <span class="comment"> https[ses].flen = strlen(&https_not_found_page[0], 1000);</span>00138 <span class="comment"> https[ses].fpoint = 0;</span>00139 <span class="comment"> </span>00140 <span class="comment"> return(-1);</span>00141 <span class="comment"> }</span>00142 <span class="comment"> */</span>00143 00144 <span class="comment">/* OK, file found. */</span> 00145 <span class="comment">/* Modify structure </span>00146 <span class="comment"> https[ses].fstart = file start address;</span>00147 <span class="comment"> https[ses].flen = file length;</span>00148 <span class="comment"> https[ses].fpoint = current pointer within the file</span>00149 <span class="comment"> https[ses].funacked = 0; no unacked data for now</span>00150 <span class="comment"> */</span>00151 <span class="keywordflow">return</span>(1); 00152 00153 }00154 <a name="l00173"></a><a class="code" href="https__callbacks_8c.html#a2">00173</a> INT16 <a class="code" href="https__callbacks_8c.html#a2">https_loadbuffer</a> (UINT8 ses, UINT8* buf, UINT16 buflen) {00174 UINT16 i;00175 00176 <span class="keywordflow">if</span>( https[ses].fstart == 0xFFFFFFFF )00177 {00178 <span class="comment">/* Error site asked */</span>00179 00180 kick_WD();00181 00182 <span class="keywordflow">for</span>(i=0; i < (https[ses].flen - https[ses].fpoint); i++)00183 {00184 <span class="keywordflow">if</span>(i >= buflen)00185 <span class="keywordflow">break</span>;00186 00187 *buf++ = <a class="code" href="https__callbacks_8c.html#a0">https_not_found_page</a>[https[ses].fpoint + i];00188 00189 }00190 00191 <span class="keywordflow">return</span>(i);00192 00193 }00194 00195 <span class="comment">/* Access some storage media (internal/external flash...)*/</span>00196 00197 <span class="keywordflow">for</span>(i=0; i < (https[ses].flen - https[ses].fpoint); i++)00198 {00199 <span class="keywordflow">if</span>(i >= buflen)00200 <span class="keywordflow">break</span>; 00201 00202 kick_WD();00203 <span class="comment">/*</span>00204 <span class="comment"> </span>00205 <span class="comment"> *buf++ = next_data_byte(...);</span>00206 <span class="comment"> </span>00207 <span class="comment"> */</span>00208 00209 00210 }00211 00212 <span class="keywordflow">return</span>(i);00213 00214 00215 00216 }</pre></div><hr><address style="align: right;"><small>Generated on Sun Aug 3 20:32:59 2003 for OpenTCP by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -