Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
fs.h
00001 /* 00002 * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * 3. The name of the author may not be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00017 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00018 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00019 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00020 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00021 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00023 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00024 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00025 * OF SUCH DAMAGE. 00026 * 00027 * This file is part of the lwIP TCP/IP stack. 00028 * 00029 * Author: Adam Dunkels <adam@sics.se> 00030 * 00031 */ 00032 #ifndef LWIP_HDR_APPS_FS_H 00033 #define LWIP_HDR_APPS_FS_H 00034 00035 #include "httpd_opts.h" 00036 #include "lwip/err.h" 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 #define FS_READ_EOF -1 00043 #define FS_READ_DELAYED -2 00044 00045 #if HTTPD_PRECALCULATED_CHECKSUM 00046 struct fsdata_chksum { 00047 u32_t offset; 00048 u16_t chksum; 00049 u16_t len; 00050 }; 00051 #endif /* HTTPD_PRECALCULATED_CHECKSUM */ 00052 00053 #define FS_FILE_FLAGS_HEADER_INCLUDED 0x01 00054 #define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02 00055 #define FS_FILE_FLAGS_HEADER_HTTPVER_1_1 0x04 00056 #define FS_FILE_FLAGS_SSI 0x08 00057 00058 /** Define FS_FILE_EXTENSION_T_DEFINED if you have typedef'ed to your private 00059 * pointer type (defaults to 'void' so the default usage is 'void*') 00060 */ 00061 #ifndef FS_FILE_EXTENSION_T_DEFINED 00062 typedef void fs_file_extension; 00063 #endif 00064 00065 struct fs_file { 00066 const char *data; 00067 int len; 00068 int index; 00069 /* pextension is free for implementations to hold private (extensional) 00070 arbitrary data, e.g. holding some file state or file system handle */ 00071 fs_file_extension *pextension; 00072 #if HTTPD_PRECALCULATED_CHECKSUM 00073 const struct fsdata_chksum *chksum; 00074 u16_t chksum_count; 00075 #endif /* HTTPD_PRECALCULATED_CHECKSUM */ 00076 u8_t flags; 00077 #if LWIP_HTTPD_CUSTOM_FILES 00078 u8_t is_custom_file; 00079 #endif /* LWIP_HTTPD_CUSTOM_FILES */ 00080 #if LWIP_HTTPD_FILE_STATE 00081 void *state; 00082 #endif /* LWIP_HTTPD_FILE_STATE */ 00083 }; 00084 00085 #if LWIP_HTTPD_FS_ASYNC_READ 00086 typedef void (*fs_wait_cb)(void *arg); 00087 #endif /* LWIP_HTTPD_FS_ASYNC_READ */ 00088 00089 err_t fs_open(struct fs_file *file, const char *name); 00090 void fs_close(struct fs_file *file); 00091 #if LWIP_HTTPD_DYNAMIC_FILE_READ 00092 #if LWIP_HTTPD_FS_ASYNC_READ 00093 int fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg); 00094 #else /* LWIP_HTTPD_FS_ASYNC_READ */ 00095 int fs_read(struct fs_file *file, char *buffer, int count); 00096 #endif /* LWIP_HTTPD_FS_ASYNC_READ */ 00097 #endif /* LWIP_HTTPD_DYNAMIC_FILE_READ */ 00098 #if LWIP_HTTPD_FS_ASYNC_READ 00099 int fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg); 00100 #endif /* LWIP_HTTPD_FS_ASYNC_READ */ 00101 int fs_bytes_left(struct fs_file *file); 00102 00103 #if LWIP_HTTPD_FILE_STATE 00104 /** This user-defined function is called when a file is opened. */ 00105 void *fs_state_init(struct fs_file *file, const char *name); 00106 /** This user-defined function is called when a file is closed. */ 00107 void fs_state_free(struct fs_file *file, void *state); 00108 #endif /* #if LWIP_HTTPD_FILE_STATE */ 00109 00110 struct fsdata_file { 00111 const struct fsdata_file *next; 00112 const unsigned char *name; 00113 const unsigned char *data; 00114 int len; 00115 u8_t flags; 00116 #if HTTPD_PRECALCULATED_CHECKSUM 00117 u16_t chksum_count; 00118 const struct fsdata_chksum *chksum; 00119 #endif /* HTTPD_PRECALCULATED_CHECKSUM */ 00120 }; 00121 00122 #ifdef __cplusplus 00123 } 00124 #endif 00125 00126 #endif /* LWIP_HDR_APPS_FS_H */
Generated on Tue Jul 12 2022 13:54:23 by
