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.
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 00056 struct fs_file { 00057 const char *data; 00058 int len; 00059 int index; 00060 void *pextension; 00061 #if HTTPD_PRECALCULATED_CHECKSUM 00062 const struct fsdata_chksum *chksum; 00063 u16_t chksum_count; 00064 #endif /* HTTPD_PRECALCULATED_CHECKSUM */ 00065 u8_t flags; 00066 #if LWIP_HTTPD_CUSTOM_FILES 00067 u8_t is_custom_file; 00068 #endif /* LWIP_HTTPD_CUSTOM_FILES */ 00069 #if LWIP_HTTPD_FILE_STATE 00070 void *state; 00071 #endif /* LWIP_HTTPD_FILE_STATE */ 00072 }; 00073 00074 #if LWIP_HTTPD_FS_ASYNC_READ 00075 typedef void (*fs_wait_cb)(void *arg); 00076 #endif /* LWIP_HTTPD_FS_ASYNC_READ */ 00077 00078 err_t fs_open(struct fs_file *file, const char *name); 00079 void fs_close(struct fs_file *file); 00080 #if LWIP_HTTPD_DYNAMIC_FILE_READ 00081 #if LWIP_HTTPD_FS_ASYNC_READ 00082 int fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg); 00083 #else /* LWIP_HTTPD_FS_ASYNC_READ */ 00084 int fs_read(struct fs_file *file, char *buffer, int count); 00085 #endif /* LWIP_HTTPD_FS_ASYNC_READ */ 00086 #endif /* LWIP_HTTPD_DYNAMIC_FILE_READ */ 00087 #if LWIP_HTTPD_FS_ASYNC_READ 00088 int fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg); 00089 #endif /* LWIP_HTTPD_FS_ASYNC_READ */ 00090 int fs_bytes_left(struct fs_file *file); 00091 00092 #if LWIP_HTTPD_FILE_STATE 00093 /** This user-defined function is called when a file is opened. */ 00094 void *fs_state_init(struct fs_file *file, const char *name); 00095 /** This user-defined function is called when a file is closed. */ 00096 void fs_state_free(struct fs_file *file, void *state); 00097 #endif /* #if LWIP_HTTPD_FILE_STATE */ 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #endif /* LWIP_HDR_APPS_FS_H */
Generated on Tue Jul 12 2022 14:23:48 by
