2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27 * This file is part of the lwIP TCP/IP stack.
29 * Author: Adam Dunkels <adam@sics.se>
32 #ifndef LWIP_HDR_APPS_FS_H
33 #define LWIP_HDR_APPS_FS_H
35 #include "httpd_opts.h"
42 #define FS_READ_EOF -1
43 #define FS_READ_DELAYED -2
45 #if HTTPD_PRECALCULATED_CHECKSUM
46 struct fsdata_chksum {
51 #endif /* HTTPD_PRECALCULATED_CHECKSUM */
53 #define FS_FILE_FLAGS_HEADER_INCLUDED 0x01
54 #define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02
61 #if HTTPD_PRECALCULATED_CHECKSUM
62 const struct fsdata_chksum *chksum;
64 #endif /* HTTPD_PRECALCULATED_CHECKSUM */
66 #if LWIP_HTTPD_CUSTOM_FILES
68 #endif /* LWIP_HTTPD_CUSTOM_FILES */
69 #if LWIP_HTTPD_FILE_STATE
71 #endif /* LWIP_HTTPD_FILE_STATE */
74 #if LWIP_HTTPD_FS_ASYNC_READ
75 typedef void (*fs_wait_cb)(void *arg);
76 #endif /* LWIP_HTTPD_FS_ASYNC_READ */
78 err_t fs_open(struct fs_file *file, const char *name);
79 void fs_close(struct fs_file *file);
80 #if LWIP_HTTPD_DYNAMIC_FILE_READ
81 #if LWIP_HTTPD_FS_ASYNC_READ
82 int fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg);
83 #else /* LWIP_HTTPD_FS_ASYNC_READ */
84 int fs_read(struct fs_file *file, char *buffer, int count);
85 #endif /* LWIP_HTTPD_FS_ASYNC_READ */
86 #endif /* LWIP_HTTPD_DYNAMIC_FILE_READ */
87 #if LWIP_HTTPD_FS_ASYNC_READ
88 int fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg);
89 #endif /* LWIP_HTTPD_FS_ASYNC_READ */
90 int fs_bytes_left(struct fs_file *file);
92 #if LWIP_HTTPD_FILE_STATE
93 /** This user-defined function is called when a file is opened. */
94 void *fs_state_init(struct fs_file *file, const char *name);
95 /** This user-defined function is called when a file is closed. */
96 void fs_state_free(struct fs_file *file, void *state);
97 #endif /* #if LWIP_HTTPD_FILE_STATE */
103 #endif /* LWIP_HDR_APPS_FS_H */