28#ifndef MAKEFS_SUPPORT_DEFLATE
29#define MAKEFS_SUPPORT_DEFLATE 0
30#ifndef MAKEFS_SUPPORT_DEFLATE_ZLIB
31#define MAKEFS_SUPPORT_DEFLATE_ZLIB 0
35#define COPY_BUFSIZE (1024*1024)
37#if MAKEFS_SUPPORT_DEFLATE
38#if MAKEFS_SUPPORT_DEFLATE_ZLIB
44typedef unsigned char uint8;
45typedef unsigned short uint16;
46typedef unsigned int uint;
48#define my_max(a,b) (((a) > (b)) ? (a) : (b))
49#define my_min(a,b) (((a) < (b)) ? (a) : (b))
53#define COMP_OUT_BUF_SIZE COPY_BUFSIZE
57#define OUT_BUF_SIZE COPY_BUFSIZE
58static uint8 s_outbuf[OUT_BUF_SIZE];
59static uint8 s_checkbuf[OUT_BUF_SIZE];
61#ifndef MAKEFS_SUPPORT_DEFLATE_ZLIB
64tdefl_compressor g_deflator;
67static int deflate_level;
68#define USAGE_ARG_DEFLATE " [-defl<:compr_level>]"
70#define USAGE_ARG_DEFLATE ""
75#define GETCWD(path, len) GetCurrentDirectoryA(len, path)
76#define GETCWD_SUCCEEDED(ret) (ret != 0)
77#define CHDIR(path) SetCurrentDirectoryA(path)
78#define CHDIR_SUCCEEDED(ret) (ret == TRUE)
82#define GETCWD(path, len) getcwd(path, len)
83#define GETCWD_SUCCEEDED(ret) (ret != NULL)
84#define CHDIR(path) chdir(path)
85#define CHDIR_SUCCEEDED(ret) (ret == 0)
89#error makefsdata not supported on this platform
97#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
98 x, __LINE__, __FILE__); fflush(NULL); abort();} while(0)
101#define LWIP_HTTPD_DYNAMIC_HEADERS 1
102#define LWIP_HTTPD_SSI 1
104#include "../httpd_structs.h"
107#include "../core/inet_chksum.c"
108#include "../core/def.c"
115#define PAYLOAD_ALIGNMENT 4
117#define ALIGN_PAYLOAD 1
119#define PAYLOAD_ALIGN_TYPE "unsigned int"
122#define HEX_BYTES_PER_LINE 16
124#define MAX_PATH_LEN 256
134 u16_t *http_hdr_chksum,
u8_t provide_content_len,
int is_compressed);
137void concat_files(
const char *file1,
const char *file2,
const char *targetfile);
157#if MAKEFS_SUPPORT_DEFLATE
158static unsigned char deflateNonSsiFiles = 0;
159static size_t deflatedBytesReduced = 0;
160static size_t overallDataBytes = 0;
174 printf(
" Usage: htmlgen [targetdir] [-s] [-e] [-11] [-nossi] [-ssi:<filename>] [-c] [-f:<filename>] [-m] [-svr:<name>] [-x:<ext_list>] [-xc:<ext_list>" USAGE_ARG_DEFLATE NEWLINE NEWLINE);
175 printf(
" targetdir: relative or absolute path to files to convert" NEWLINE);
176 printf(
" switch -s: toggle processing of subdirectories (default is on)" NEWLINE);
177 printf(
" switch -e: exclude HTTP header from file (header is created at runtime, default is off)" NEWLINE);
178 printf(
" switch -11: include HTTP 1.1 header (1.0 is default)" NEWLINE);
179 printf(
" switch -nossi: no support for SSI (cannot calculate Content-Length for SSI)" NEWLINE);
180 printf(
" switch -ssi: ssi filename (ssi support controlled by file list, not by extension)" NEWLINE);
181 printf(
" switch -c: precalculate checksums for all pages (default is off)" NEWLINE);
182 printf(
" switch -f: target filename (default is \"fsdata.c\")" NEWLINE);
183 printf(
" switch -m: include \"Last-Modified\" header based on file time" NEWLINE);
184 printf(
" switch -svr: server identifier sent in HTTP response header ('Server' field)" NEWLINE);
185 printf(
" switch -x: comma separated list of extensions of files to exclude (e.g., -x:json,txt)" NEWLINE);
186 printf(
" switch -xc: comma separated list of extensions of files to not compress (e.g., -xc:mp3,jpg)" NEWLINE);
187#if MAKEFS_SUPPORT_DEFLATE
188 printf(
" switch -defl: deflate-compress all non-SSI files (with opt. compr.-level, default=10)" NEWLINE);
189 printf(
" ATTENTION: browser has to support \"Content-Encoding: deflate\"!" NEWLINE);
191 printf(
" if targetdir not specified, htmlgen will attempt to" NEWLINE);
204 strcpy(targetfile,
"fsdata.c");
207 memset(appPath, 0,
sizeof(appPath));
220 if (
argv[
i][0] ==
'-') {
234 const char* ssi_list_filename = &
argv[
i][5];
236 printf(
"Reading list of SSI files from \"%s\"\n", ssi_list_filename);
238 printf(
"Failed to load list of SSI files from \"%s\"\n", ssi_list_filename);
243 strncpy(targetfile, &
argv[
i][3],
sizeof(targetfile) - 1);
244 targetfile[
sizeof(targetfile) - 1] = 0;
245 printf(
"Writing to file \"%s\"\n", targetfile);
249#if MAKEFS_SUPPORT_DEFLATE
250 const char *colon = &
argv[
i][5];
252 int defl_level =
atoi(&colon[1]);
253 if ((colon[1] != 0) && (defl_level >= 0) && (defl_level <= 10)) {
254 deflate_level = defl_level;
263 deflateNonSsiFiles = 1;
264 printf(
"Deflating all non-SSI files with level %d (but only if size is reduced)" NEWLINE, deflate_level);
266 printf(
"WARNING: Deflate support is disabled\n");
278 }
else if ((
argv[
i][0] ==
'/') && (
argv[
i][1] ==
'?') && (
argv[
i][2] == 0)) {
297 if (!CHDIR_SUCCEEDED(CHDIR(
path))) {
303 if(!CHDIR_SUCCEEDED(CHDIR(appPath))) {
313 printf(
" Processing all files in directory %s",
path);
320 data_file =
fopen(
"fsdata.tmp",
"wb");
321 if (data_file ==
NULL) {
322 printf(
"Failed to create file \"fsdata.tmp\"\n");
325 struct_file =
fopen(
"fshdr.tmp",
"wb");
326 if (struct_file ==
NULL) {
327 printf(
"Failed to create file \"fshdr.tmp\"\n");
332 if(!CHDIR_SUCCEEDED(CHDIR(
path))) {
344 fprintf(data_file,
"#ifndef FS_FILE_FLAGS_HEADER_PERSISTENT" NEWLINE "#define FS_FILE_FLAGS_HEADER_PERSISTENT 0" NEWLINE "#endif" NEWLINE);
348 fprintf(data_file,
"/* FSDATA_FILE_ALIGNMENT: 0=off, 1=by variable, 2=by include */" NEWLINE "#ifndef FSDATA_FILE_ALIGNMENT" NEWLINE "#define FSDATA_FILE_ALIGNMENT 0" NEWLINE "#endif" NEWLINE);
358 filesProcessed =
process_sub(data_file, struct_file);
369 if(!CHDIR_SUCCEEDED(CHDIR(appPath))) {
379 if (
remove(
"fsdata.tmp") != 0) {
380 printf(
"Warning: failed to delete fsdata.tmp\n");
382 if (
remove(
"fshdr.tmp") != 0) {
383 printf(
"Warning: failed to delete fshdr.tmp\n");
387#if MAKEFS_SUPPORT_DEFLATE
388 if (deflateNonSsiFiles) {
389 printf(
"(Deflated total byte reduction: %d bytes -> %d bytes (%.02f%%)" NEWLINE,
390 (
int)overallDataBytes, (
int)deflatedBytesReduced, (
float)((deflatedBytesReduced * 100.0) / overallDataBytes));
423 while ((slen > 0) && ((
path[slen] ==
'\\') || (
path[slen] ==
'/'))) {
439 fin =
fopen(filename_in,
"rb");
441 printf(
"Failed to open file \"%s\"\n", filename_in);
452void concat_files(
const char *file1,
const char *file2,
const char *targetfile)
455 fout =
fopen(targetfile,
"wb");
457 printf(
"Failed to open file \"%s\"\n", targetfile);
468 int filesProcessed = 0;
473 size_t freelen =
sizeof(
curSubdir) - sublen - 1;
481 for (
i = 0;
i <
dir.n_files;
i++) {
487#if (defined _MSC_VER || defined __MINGW32__) && (defined _UNICODE)
488 size_t num_char_converted;
490 wcstombs_s(&num_char_converted, currName,
sizeof(currName),
file.
name,
sizeof(currName));
495 if (currName[0] ==
'.') {
502 if(!CHDIR_SUCCEEDED(CHDIR(currName))) {
510 filesProcessed +=
process_sub(data_file, struct_file);
511 if(!CHDIR_SUCCEEDED(CHDIR(
".."))) {
512 printf(
"Unable to get back to parent dir of: \"%s\"." NEWLINE, currName);
517 printf(
"WARNING: cannot process sub due to path length restrictions: \"%s/%s\"\n",
curSubdir, currName);
526 for (
i = 0;
i <
dir.n_files;
i++) {
533#if (defined _MSC_VER || defined __MINGW32__) && (defined _UNICODE)
534 size_t num_char_converted;
536 wcstombs_s(&num_char_converted, curName,
sizeof(curName),
file.
name,
sizeof(curName));
541 if (
strcmp(curName,
"fsdata.tmp") == 0) {
544 if (
strcmp(curName,
"fshdr.tmp") == 0) {
554 if (
process_file(data_file, struct_file, curName) < 0) {
565 return filesProcessed;
577 if (inFile ==
NULL) {
595#if MAKEFS_SUPPORT_DEFLATE
596 overallDataBytes +=
fsize;
597 if (deflateNonSsiFiles) {
598 if (can_be_compressed) {
599 if (
fsize < OUT_BUF_SIZE) {
601#ifndef MAKEFS_SUPPORT_DEFLATE_ZLIB
606 size_t in_bytes =
fsize;
607 size_t out_bytes = OUT_BUF_SIZE;
608 const void *next_in =
buf;
609 void *next_out = s_outbuf;
610 memset(s_outbuf, 0,
sizeof(s_outbuf));
611#ifndef MAKEFS_SUPPORT_DEFLATE_ZLIB
613 mz_uint comp_flags = s_tdefl_num_probes[MZ_MIN(10, deflate_level)] | ((deflate_level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0);
614 if (!deflate_level) {
615 comp_flags |= TDEFL_FORCE_ALL_RAW_BLOCKS;
618 if (
status != TDEFL_STATUS_OKAY) {
619 printf(
"tdefl_init() failed!\n");
622 status = tdefl_compress(&g_deflator, next_in, &in_bytes, next_out, &out_bytes, TDEFL_FINISH);
623 if (
status != TDEFL_STATUS_DONE) {
628 status =
compress2(next_out, &out_bytes, next_in, in_bytes, deflate_level);
634 LWIP_ASSERT(
"out_bytes <= COPY_BUFSIZE", out_bytes <= OUT_BUF_SIZE);
635 if (out_bytes <
fsize) {
638 memcpy(ret_buf, s_outbuf, out_bytes);
641 size_t dec_in_bytes = out_bytes;
642 size_t dec_out_bytes = OUT_BUF_SIZE;
643 next_out = s_checkbuf;
644 memset(s_checkbuf, 0,
sizeof(s_checkbuf));
645#ifndef MAKEFS_SUPPORT_DEFLATE_ZLIB
646 tinfl_status dec_status;
647 tinfl_decompressor inflator;
649 tinfl_init(&inflator);
650 dec_status = tinfl_decompress(&inflator, (
const mz_uint8 *)ret_buf, &dec_in_bytes, s_checkbuf, (mz_uint8 *)next_out, &dec_out_bytes, 0);
651 LWIP_ASSERT(
"tinfl_decompress failed", dec_status == TINFL_STATUS_DONE);
654 dec_status =
uncompress2 (s_checkbuf, &dec_out_bytes, ret_buf, &dec_in_bytes);
664 printf(
" - deflate: %d bytes -> %d bytes (%.02f%%)" NEWLINE, (
int)
fsize, (
int)out_bytes, (
float)((out_bytes * 100.0) /
fsize));
665 deflatedBytesReduced += (
size_t)(
fsize - out_bytes);
668 printf(
" - uncompressed: (would be %d bytes larger using deflate)" NEWLINE, (
int)(out_bytes -
fsize));
671 printf(
" - uncompressed: (file is larger than deflate buffer)" NEWLINE);
686 size_t written,
i, src_off = 0;
715#if LWIP_TCP_TIMESTAMPS
721 fprintf(struct_file,
"const struct fsdata_chksum chksums_%s[] = {" NEWLINE, varname);
725 fprintf(struct_file,
"{%d, 0x%04x, %d}," NEWLINE, 0, hdr_chksum, hdr_len);
730 unsigned short chksum;
731 const void *
data = (
const void *)&file_data[src_offset];
742 fprintf(struct_file,
"#endif /* HTTPD_PRECALCULATED_CHECKSUM */" NEWLINE);
748 if (((
x >=
'A') && (
x <=
'Z')) ||
749 ((
x >=
'a') && (
x <=
'z')) ||
750 ((
x >=
'0') && (
x <=
'9')) ||
761 char *new_name = (
char *)
malloc(
len + 2);
765 if (
len + 3 == max_len) {
766 printf(
"File name too long: \"%s\"\n", qualifiedName);
769 strcpy(new_name, qualifiedName);
770 for (
i = 0;
i <
len;
i++) {
778 if (!
strcmp(
f->filename_c, new_name)) {
786 }
while (!filename_ok && (cnt < 999));
788 printf(
"Failed to get unique file name: \"%s\"\n", qualifiedName);
791 strcpy(qualifiedName, new_name);
814 size_t fsize, readcount;
830 printf(
"failed to allocate ssi file buffer\n");
837 if ((readcount >
fsize) || !readcount) {
838 printf(
"failed to read data from ssi file\n");
845 for (
i = 0;
i < readcount;
i++) {
846 if (
buf[
i] ==
'\n') {
849 }
else if (
buf[
i] ==
'\r') {
856 printf(
"failed to allocate ssi line buffer\n");
863 for (
i = 0;
i < readcount;
i++) {
897 size_t freelen =
sizeof(
curSubdir) - sublen - 1;
910#if LWIP_HTTPD_SSI_BY_FILE_EXTENSION
914 for (loop = 0; loop < NUM_SHTML_EXTENSIONS; loop++) {
928 const char *
ext = ext_list;
929 if (ext_list ==
NULL) {
932 while(*
ext !=
'\0') {
967 u16_t http_hdr_chksum = 0;
968 u16_t http_hdr_len = 0;
969 int chksum_count = 0;
971 u8_t has_content_len;
974 int can_be_compressed;
975 int is_compressed = 0;
981 strncpy(varname, qualifiedName,
sizeof(varname));
991 fprintf(data_file,
"static const unsigned char FSDATA_ALIGN_PRE data_%s[] FSDATA_ALIGN_POST = {" NEWLINE, varname);
998 fprintf(data_file,
"0x%02x,", 0);
1008 has_content_len = !is_ssi;
1014 if (has_content_len) {
1026 fprintf(struct_file,
"const struct fsdata_file file_%s[] = { {" NEWLINE, varname);
1034 fputs(
"FS_FILE_FLAGS_HEADER_INCLUDED", struct_file);
1038 if (flags_printed) {
1039 fputs(
" | ", struct_file);
1041 fputs(
"FS_FILE_FLAGS_HEADER_PERSISTENT", struct_file);
1045 if (flags_printed) {
1046 fputs(
" | ", struct_file);
1048 fputs(
"FS_FILE_FLAGS_HEADER_HTTPVER_1_1", struct_file);
1052 if (flags_printed) {
1053 fputs(
" | ", struct_file);
1055 fputs(
"FS_FILE_FLAGS_SSI", struct_file);
1058 if (!flags_printed) {
1059 fputs(
"0", struct_file);
1063 fprintf(struct_file,
"#if HTTPD_PRECALCULATED_CHECKSUM" NEWLINE);
1064 fprintf(struct_file,
"%d, chksums_%s," NEWLINE, chksum_count, varname);
1065 fprintf(struct_file,
"#endif /* HTTPD_PRECALCULATED_CHECKSUM */" NEWLINE);
1080 u16_t *http_hdr_chksum,
u8_t provide_content_len,
int is_compressed)
1083 int response_type = HTTP_HDR_OK;
1085 const char *cur_string;
1090 const char *file_ext;
1097 response_type = HTTP_HDR_OK_11;
1102 response_type = HTTP_HDR_NOT_FOUND;
1104 response_type = HTTP_HDR_NOT_FOUND_11;
1107 response_type = HTTP_HDR_BAD_REQUEST;
1109 response_type = HTTP_HDR_BAD_REQUEST_11;
1112 response_type = HTTP_HDR_NOT_IMPL;
1114 response_type = HTTP_HDR_NOT_IMPL_11;
1117 cur_string = g_psHTTPHeaderStrings[response_type];
1118 cur_len =
strlen(cur_string);
1128 cur_len =
strlen(cur_string);
1138 if (file_ext !=
NULL) {
1140 file_ext =
strstr(file_ext,
".");
1144 if ((file_ext ==
NULL) || (*file_ext == 0)) {
1145 printf(
"failed to get extension for file \"%s\", using default.\n",
filename);
1149 for (
j = 0;
j < NUM_HTTP_HEADERS;
j++) {
1150 if (!
strcmp(file_ext, g_psHTTPHeaders[
j].extension)) {
1156 printf(
"failed to get file type for extension \"%s\", using default.\n", file_ext);
1164 if (provide_content_len) {
1167 memset(intbuf, 0,
sizeof(intbuf));
1168 cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONTENT_LENGTH];
1169 cur_len =
strlen(cur_string);
1177 lwip_itoa(intbuf,
sizeof(intbuf), content_len);
1179 cur_len =
strlen(intbuf);
1187 if (provide_last_modified) {
1189 struct stat stat_data;
1191 memset(modbuf, 0,
sizeof(modbuf));
1192 memset(&stat_data, 0,
sizeof(stat_data));
1193 cur_string = modbuf;
1194 strcpy(modbuf,
"Last-Modified: ");
1204 strftime(&modbuf[15],
sizeof(modbuf) - 15,
"%a, %d %b %Y %H:%M:%S GMT",
t);
1205 cur_len =
strlen(cur_string);
1215 cur_len =
strlen(modbuf);
1226 if (provide_content_len) {
1227 cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONN_KEEPALIVE];
1231 cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONN_CLOSE];
1233 cur_len =
strlen(cur_string);
1243#if MAKEFS_SUPPORT_DEFLATE
1244 if (is_compressed) {
1247 cur_string =
"Content-Encoding: deflate\r\n";
1248 cur_len =
strlen(cur_string);
1259 cur_len =
strlen(cur_string);
1267 LWIP_ASSERT(
"hdr_len + cur_len <= sizeof(hdr_buf)", hdr_len + cur_len <=
sizeof(
hdr_buf));
1273 *http_hdr_len = (
u16_t)hdr_len;
1274 *http_hdr_chksum = acc;
1283 for (
x = 0;
x <
len;
x++) {
1284 unsigned char cur = ascii_string[
x];
1297 for (
x = 0;
x <
len;
x++) {
1298 unsigned char cur = ascii_string[
x];
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
char * strstr(char *String1, char *String2)
char * strncat(char *DstString, const char *SrcString, ACPI_SIZE Count)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
static const WCHAR *const ext[]
#define FS_FILE_FLAGS_HEADER_HTTPVER_1_1
#define FS_FILE_FLAGS_SSI
#define LWIP_ASSERT(message, assertion)
#define FS_FILE_FLAGS_HEADER_INCLUDED
#define FS_FILE_FLAGS_HEADER_PERSISTENT
GLint GLint GLint GLint GLint x
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define LWIP_UNUSED_ARG(x)
#define HTTPD_SERVER_AGENT
#define LWIP_VERSION_STRING
void lwip_itoa(char *result, size_t bufsize, int number)
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
JSAMPARRAY JDIMENSION num_lines
#define HEX_BYTES_PER_LINE
static char * ssi_file_buffer
int s_put_ascii(char *buf, const char *ascii_string, int len, int *i)
static const char * serverID
static void print_usage(void)
static const char * exclude_list
int check_path(char *path, size_t size)
int process_sub(FILE *data_file, FILE *struct_file)
#define PAYLOAD_ALIGN_TYPE
static int is_ssi_file(const char *filename)
static int checkSsiByFilelist(const char *filename_listfile)
static size_t ssi_file_num_lines
static char ** ssi_file_lines
static unsigned char precalcChksum
#define USAGE_ARG_DEFLATE
static int file_can_be_compressed(const char *filename)
static int write_checksums(FILE *struct_file, const char *varname, u16_t hdr_len, u16_t hdr_chksum, const u8_t *file_data, size_t file_size)
static struct file_entry * first_file
int file_write_http_header(FILE *data_file, const char *filename, int file_size, u16_t *http_hdr_len, u16_t *http_hdr_chksum, u8_t provide_content_len, int is_compressed)
static int ext_in_list(const char *filename, const char *ext_list)
static u8_t * get_file_data(const char *filename, int *file_size, int can_be_compressed, int *is_compressed)
void concat_files(const char *file1, const char *file2, const char *targetfile)
static char lastFileVar[MAX_PATH_LEN]
static unsigned char processSubs
static void process_file_data(FILE *data_file, u8_t *file_data, size_t file_size)
#define PAYLOAD_ALIGNMENT
static char hdr_buf[4096]
static int file_to_exclude(const char *filename)
static char curSubdir[MAX_PATH_LEN-3]
static void register_filename(const char *qualifiedName)
static struct file_entry * last_file
static void copy_file(const char *filename_in, FILE *fout)
static int payload_alingment_dummy_counter
static const char * ncompress_list
static void fix_filename_for_c(char *qualifiedName, size_t max_len)
static unsigned char includeHttpHeader
static char file_buffer_c[COPY_BUFSIZE *5+((COPY_BUFSIZE/HEX_BYTES_PER_LINE) *3)]
static unsigned char includeLastModified
int file_put_ascii(FILE *file, const char *ascii_string, int len, int *i)
static unsigned char useHttp11
int process_file(FILE *data_file, FILE *struct_file, const char *filename)
static int is_valid_char_for_c_var(char x)
static unsigned char supportSsi
static char serverIDBuffer[1024]
#define memcpy(s1, s2, n)
_Check_return_wat_ _CRTIMP errno_t __cdecl wcstombs_s(_Out_opt_ size_t *pcchConverted, _Out_writes_bytes_to_opt_(cjDstSize, *pcchConverted) char *pmbsDst, _In_ size_t cjDstSize, _In_z_ const wchar_t *pwszSrc, _In_ size_t cjMaxCount)
#define sprintf(buf, format,...)
static unsigned int file_size
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
FD_TYPE file_type(FDSC **curr, char *fixed)
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
_TINYDIR_FUNC int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i)
_TINYDIR_FUNC int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path)
#define TINYDIR_STRING(s)
int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong *sourceLen)