LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lwip_fs.h
Go to the documentation of this file.
1 /*
2  * @brief lwIP Filesystem implementation module header
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 #ifndef __LWIP_FS_H_
32 #define __LWIP_FS_H_
33 
34 #include "lwip/err.h"
35 #include "lwip/opt.h"
36 
52 #ifndef LWIP_HTTPD_CUSTOM_FILES
53 #define LWIP_HTTPD_CUSTOM_FILES 0
54 #endif
55 
59 #ifndef LWIP_HTTPD_FILE_STATE
60 #define LWIP_HTTPD_FILE_STATE 0
61 #endif
62 
66 #ifndef HTTPD_PRECALCULATED_CHECKSUM
67 #define HTTPD_PRECALCULATED_CHECKSUM 0
68 #endif
69 
70 #if HTTPD_PRECALCULATED_CHECKSUM
71 struct fsdata_chksum {
72  u32_t offset;
73  u16_t chksum;
74  u16_t len;
75 };
76 #endif /* HTTPD_PRECALCULATED_CHECKSUM */
77 
78 struct fs_file {
79  const char *data;
80  int len;
81  int index;
82  void *pextension;
83 #if HTTPD_PRECALCULATED_CHECKSUM
84  const struct fsdata_chksum *chksum;
85  u16_t chksum_count;
86 #endif /* HTTPD_PRECALCULATED_CHECKSUM */
88 #if LWIP_HTTPD_CUSTOM_FILES
89  u8_t is_custom_file;
90 #endif /* LWIP_HTTPD_CUSTOM_FILES */
91 #if LWIP_HTTPD_FILE_STATE
92  void *state;
93 #endif /* LWIP_HTTPD_FILE_STATE */
94 };
95 
105 int GetHTTP_Header(const char *fName, char *buff);
106 
111 int fs_init(void);
112 
123 struct fs_file *fs_open_default(void);
124 
132 struct fs_file *fs_open(const char *name);
133 
140 void fs_close(struct fs_file *file);
141 
151 int fs_read(struct fs_file *file, char *buffer, int count);
152 
160 int fs_bytes_left(struct fs_file *file);
161 
162 #if LWIP_HTTPD_FILE_STATE
163 
164 void *fs_state_init(struct fs_file *file, const char *name);
166 void fs_state_free(struct fs_file *file, void *state);
167 #endif /* #if LWIP_HTTPD_FILE_STATE */
168 
169 #ifdef LWIP_DEBUG
170 
177 void assert_printf(char *msg, int line, char *file);
178 
184 const char *lwip_strerr(err_t eno);
185 #endif
186 
191 #endif /* __LWIP_FS_H_ */