STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
Data Structures | Macros | Functions | Variables
makefsdata.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <dir.h>
#include <dos.h>
#include <string.h>
#include "../httpd_structs.h"
#include "../core/inet_chksum.c"
#include "../core/def.c"

Go to the source code of this file.

Data Structures

struct  file_entry
 

Macros

#define FIND_T   struct ffblk
 
#define FIND_T_FILENAME(fInfo)    (fInfo.ff_name)
 
#define FIND_T_IS_DIR(fInfo)    ((fInfo.ff_attrib & FA_DIREC) == FA_DIREC)
 
#define FIND_T_IS_FILE(fInfo)    (1)
 
#define FIND_RET_T   int
 
#define FINDFIRST_FILE(path, result)   findfirst(path, result, FA_ARCH)
 
#define FINDFIRST_DIR(path, result)    findfirst(path, result, FA_DIREC)
 
#define FINDNEXT(ff_res, result)    FindNextFileA(ff_res, result)
 
#define FINDFIRST_SUCCEEDED(ret)    (ret == 0)
 
#define FINDNEXT_SUCCEEDED(ret)    (ret == 0)
 
#define GETCWD(path, len)    getcwd(path, len)
 
#define CHDIR(path)    chdir(path)
 
#define CHDIR_SUCCEEDED(ret)    (ret == 0)
 
#define NEWLINE   "\r\n"
 
#define NEWLINE_LEN   2
 
#define LWIP_HTTPD_DYNAMIC_HEADERS   1
 
#define LWIP_HTTPD_SSI   1
 
#define PAYLOAD_ALIGNMENT   4
 
#define ALIGN_PAYLOAD   1
 
#define PAYLOAD_ALIGN_TYPE   "unsigned int"
 
#define HEX_BYTES_PER_LINE   16
 
#define MAX_PATH_LEN   256
 
#define COPY_BUFSIZE   10240
 

Functions

int process_sub (FILE *data_file, FILE *struct_file)
 
int process_file (FILE *data_file, FILE *struct_file, const char *filename)
 
int file_write_http_header (FILE *data_file, const char *filename, int file_size, u16_t *http_hdr_len, u16_t *http_hdr_chksum)
 
int file_put_ascii (FILE *file, const char *ascii_string, int len, int *i)
 
int s_put_ascii (char *buf, const char *ascii_string, int len, int *i)
 
void concat_files (const char *file1, const char *file2, const char *targetfile)
 
int check_path (char *path, size_t size)
 
int main (int argc, char *argv[])
 
int get_file_size (const char *filename)
 
void process_file_data (const char *filename, FILE *data_file)
 
int write_checksums (FILE *struct_file, const char *filename, const char *varname, u16_t hdr_len, u16_t hdr_chksum)
 

Variables

const char * serverID = "Server: "HTTPD_SERVER_AGENT"\r\n"
 
char curSubdir [MAX_PATH_LEN]
 
char lastFileVar [MAX_PATH_LEN]
 
char hdr_buf [4096]
 
unsigned char processSubs = 1
 
unsigned char includeHttpHeader = 1
 
unsigned char useHttp11 = 0
 
unsigned char supportSsi = 1
 
unsigned char precalcChksum = 0
 
struct file_entryfirst_file = NULL
 
struct file_entrylast_file = NULL
 

Macro Definition Documentation

#define ALIGN_PAYLOAD   1

Definition at line 79 of file makefsdata.c.

#define CHDIR (   path)    chdir(path)

Definition at line 57 of file makefsdata.c.

#define CHDIR_SUCCEEDED (   ret)    (ret == 0)

Definition at line 58 of file makefsdata.c.

#define COPY_BUFSIZE   10240

Definition at line 88 of file makefsdata.c.

#define FIND_RET_T   int

Definition at line 49 of file makefsdata.c.

#define FIND_T   struct ffblk

makefsdata: Converts a directory structure for use with the lwIP httpd.

This file is part of the lwIP TCP/IP stack.

Author: Jim Pettinato Simon Goldschmidt

Todo:
:
  • take TCP_MSS, LWIP_TCP_TIMESTAMPS and PAYLOAD_ALIGN_TYPE/PAYLOAD_ALIGNMENT as arguments

Definition at line 45 of file makefsdata.c.

#define FIND_T_FILENAME (   fInfo)    (fInfo.ff_name)

Definition at line 46 of file makefsdata.c.

#define FIND_T_IS_DIR (   fInfo)    ((fInfo.ff_attrib & FA_DIREC) == FA_DIREC)

Definition at line 47 of file makefsdata.c.

#define FIND_T_IS_FILE (   fInfo)    (1)

Definition at line 48 of file makefsdata.c.

#define FINDFIRST_DIR (   path,
  result 
)    findfirst(path, result, FA_DIREC)

Definition at line 51 of file makefsdata.c.

#define FINDFIRST_FILE (   path,
  result 
)    findfirst(path, result, FA_ARCH)

Definition at line 50 of file makefsdata.c.

#define FINDFIRST_SUCCEEDED (   ret)    (ret == 0)

Definition at line 53 of file makefsdata.c.

#define FINDNEXT (   ff_res,
  result 
)    FindNextFileA(ff_res, result)

Definition at line 52 of file makefsdata.c.

#define FINDNEXT_SUCCEEDED (   ret)    (ret == 0)

Definition at line 54 of file makefsdata.c.

#define GETCWD (   path,
  len 
)    getcwd(path, len)

Definition at line 56 of file makefsdata.c.

#define HEX_BYTES_PER_LINE   16

Definition at line 84 of file makefsdata.c.

#define LWIP_HTTPD_DYNAMIC_HEADERS   1

Definition at line 66 of file makefsdata.c.

#define LWIP_HTTPD_SSI   1

Definition at line 67 of file makefsdata.c.

#define MAX_PATH_LEN   256

Definition at line 86 of file makefsdata.c.

#define NEWLINE   "\r\n"

Definition at line 62 of file makefsdata.c.

#define NEWLINE_LEN   2

Definition at line 63 of file makefsdata.c.

#define PAYLOAD_ALIGN_TYPE   "unsigned int"

Definition at line 81 of file makefsdata.c.

#define PAYLOAD_ALIGNMENT   4

Definition at line 77 of file makefsdata.c.

Function Documentation

int check_path ( char *  path,
size_t  size 
)

Definition at line 271 of file makefsdata.c.

void concat_files ( const char *  file1,
const char *  file2,
const char *  targetfile 
)

Definition at line 311 of file makefsdata.c.

int file_put_ascii ( FILE *  file,
const char *  ascii_string,
int  len,
int *  i 
)

Definition at line 751 of file makefsdata.c.

int file_write_http_header ( FILE *  data_file,
const char *  filename,
int  file_size,
u16_t http_hdr_len,
u16_t http_hdr_chksum 
)

Definition at line 596 of file makefsdata.c.

int get_file_size ( const char *  filename)

Definition at line 379 of file makefsdata.c.

int main ( int  argc,
char *  argv[] 
)

Definition at line 136 of file makefsdata.c.

int process_file ( FILE *  data_file,
FILE *  struct_file,
const char *  filename 
)

Definition at line 530 of file makefsdata.c.

void process_file_data ( const char *  filename,
FILE *  data_file 
)

Definition at line 394 of file makefsdata.c.

int process_sub ( FILE *  data_file,
FILE *  struct_file 
)

Definition at line 324 of file makefsdata.c.

int s_put_ascii ( char *  buf,
const char *  ascii_string,
int  len,
int *  i 
)

Definition at line 764 of file makefsdata.c.

int write_checksums ( FILE *  struct_file,
const char *  filename,
const char *  varname,
u16_t  hdr_len,
u16_t  hdr_chksum 
)

Definition at line 423 of file makefsdata.c.

Variable Documentation

char curSubdir[MAX_PATH_LEN]

Definition at line 109 of file makefsdata.c.

struct file_entry* first_file = NULL

Definition at line 119 of file makefsdata.c.

char hdr_buf[4096]

Definition at line 111 of file makefsdata.c.

unsigned char includeHttpHeader = 1

Definition at line 114 of file makefsdata.c.

struct file_entry* last_file = NULL

Definition at line 120 of file makefsdata.c.

char lastFileVar[MAX_PATH_LEN]

Definition at line 110 of file makefsdata.c.

unsigned char precalcChksum = 0

Definition at line 117 of file makefsdata.c.

unsigned char processSubs = 1

Definition at line 113 of file makefsdata.c.

const char* serverID = "Server: "HTTPD_SERVER_AGENT"\r\n"

(Your server name here)

Definition at line 74 of file makefsdata.c.

unsigned char supportSsi = 1

Definition at line 116 of file makefsdata.c.

unsigned char useHttp11 = 0

Definition at line 115 of file makefsdata.c.