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/opt.h"
35 
51 #ifndef LWIP_HTTPD_CUSTOM_FILES
52 #define LWIP_HTTPD_CUSTOM_FILES 0
53 #endif
54 
58 #ifndef LWIP_HTTPD_FILE_STATE
59 #define LWIP_HTTPD_FILE_STATE 0
60 #endif
61 
65 #ifndef HTTPD_PRECALCULATED_CHECKSUM
66 #define HTTPD_PRECALCULATED_CHECKSUM 0
67 #endif
68 
69 #if HTTPD_PRECALCULATED_CHECKSUM
70 struct fsdata_chksum {
71  u32_t offset;
72  u16_t chksum;
73  u16_t len;
74 };
75 #endif /* HTTPD_PRECALCULATED_CHECKSUM */
76 
77 struct fs_file {
78  const char *data;
79  int len;
80  int index;
81  void *pextension;
82 #if HTTPD_PRECALCULATED_CHECKSUM
83  const struct fsdata_chksum *chksum;
84  u16_t chksum_count;
85 #endif /* HTTPD_PRECALCULATED_CHECKSUM */
87 #if LWIP_HTTPD_CUSTOM_FILES
88  u8_t is_custom_file;
89 #endif /* LWIP_HTTPD_CUSTOM_FILES */
90 #if LWIP_HTTPD_FILE_STATE
91  void *state;
92 #endif /* LWIP_HTTPD_FILE_STATE */
93 };
94 
103 int GetHTTP_Header(const char *fName, char *buff);
104 
114 struct fs_file *fs_open_default(void);
115 
123 struct fs_file *fs_open(const char *name);
124 
131 void fs_close(struct fs_file *file);
132 
141 int fs_read(struct fs_file *file, char *buffer, int count);
142 
149 int fs_bytes_left(struct fs_file *file);
150 
151 #if LWIP_HTTPD_FILE_STATE
152 
153 void *fs_state_init(struct fs_file *file, const char *name);
155 void fs_state_free(struct fs_file *file, void *state);
156 #endif /* #if LWIP_HTTPD_FILE_STATE */
157 
158 #ifdef LWIP_DEBUG
159 
167 void assert_printf(char *msg, int line, char *file);
168 
174 const char *lwip_strerr(err_t eno);
175 #endif
176 
181 #endif /* __LWIP_FS_H_ */