sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
fs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
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.
15 *
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
25 * OF SUCH DAMAGE.
26 *
27 * This file is part of the lwIP TCP/IP stack.
28 *
29 * Author: Adam Dunkels <adam@sics.se>
30 *
31 */
36#ifndef LWIP_HDR_APPS_FS_H
37#define LWIP_HDR_APPS_FS_H
38
39#include "httpd_opts.h"
40#include "lwip/err.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#define FS_READ_EOF -1
47#define FS_READ_DELAYED -2
48
49#if HTTPD_PRECALCULATED_CHECKSUM
50struct fsdata_chksum {
51 u32_t offset;
52 u16_t chksum;
53 u16_t len;
54};
55#endif /* HTTPD_PRECALCULATED_CHECKSUM */
56
57#define FS_FILE_FLAGS_HEADER_INCLUDED 0x01
58#define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02
59#define FS_FILE_FLAGS_HEADER_HTTPVER_1_1 0x04
60#define FS_FILE_FLAGS_SSI 0x08
61#define FS_FILE_FLAGS_CUSTOM 0x10
62
66#ifndef FS_FILE_EXTENSION_T_DEFINED
67typedef void fs_file_extension;
68#endif
69
70struct fs_file {
71 const char *data;
72 int len;
73 int index;
74#if LWIP_HTTPD_FILE_EXTENSION
75 /* pextension is free for implementations to hold private (extensional)
76 arbitrary data, e.g. holding some file state or file system handle */
77 fs_file_extension *pextension;
78#endif /* LWIP_HTTPD_FILE_EXTENSION */
79#if HTTPD_PRECALCULATED_CHECKSUM
80 const struct fsdata_chksum *chksum;
81 u16_t chksum_count;
82#endif /* HTTPD_PRECALCULATED_CHECKSUM */
83 u8_t flags;
84#if LWIP_HTTPD_FILE_STATE
85 void *state;
86#endif /* LWIP_HTTPD_FILE_STATE */
87};
88
89#if LWIP_HTTPD_FS_ASYNC_READ
90typedef void (*fs_wait_cb)(void *arg);
91#endif /* LWIP_HTTPD_FS_ASYNC_READ */
92
93err_t fs_open(struct fs_file *file, const char *name);
94void fs_close(struct fs_file *file);
95#if LWIP_HTTPD_DYNAMIC_FILE_READ
96#if LWIP_HTTPD_FS_ASYNC_READ
97int fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg);
98#else /* LWIP_HTTPD_FS_ASYNC_READ */
99int fs_read(struct fs_file *file, char *buffer, int count);
100#endif /* LWIP_HTTPD_FS_ASYNC_READ */
101#endif /* LWIP_HTTPD_DYNAMIC_FILE_READ */
102#if LWIP_HTTPD_FS_ASYNC_READ
103int fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg);
104#endif /* LWIP_HTTPD_FS_ASYNC_READ */
105int fs_bytes_left(struct fs_file *file);
106
107#if LWIP_HTTPD_FILE_STATE
109void *fs_state_init(struct fs_file *file, const char *name);
111void fs_state_free(struct fs_file *file, void *state);
112#endif /* #if LWIP_HTTPD_FILE_STATE */
113
115 const struct fsdata_file *next;
116 const unsigned char *name;
117 const unsigned char *data;
118 int len;
119 u8_t flags;
120#if HTTPD_PRECALCULATED_CHECKSUM
121 u16_t chksum_count;
122 const struct fsdata_chksum *chksum;
123#endif /* HTTPD_PRECALCULATED_CHECKSUM */
124};
125
126#if LWIP_HTTPD_CUSTOM_FILES
127/* Prototypes required to implement custom files as fs addon */
128int fs_open_custom(struct fs_file *file, const char *name);
129void fs_close_custom(struct fs_file *file);
130#if LWIP_HTTPD_FS_ASYNC_READ
131u8_t fs_canread_custom(struct fs_file *file);
132u8_t fs_wait_read_custom(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg);
133int fs_read_async_custom(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg);
134#else /* LWIP_HTTPD_FS_ASYNC_READ */
135int fs_read_custom(struct fs_file *file, char *buffer, int count);
136#endif /* LWIP_HTTPD_FS_ASYNC_READ */
137#endif /* LWIP_HTTPD_CUSTOM_FILES */
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* LWIP_HDR_APPS_FS_H */
void fs_file_extension
Definition fs.h:67
Definition fs.h:70
u32 count
start sector of fragmented bd/file