File System Configuration

µC/HTTP-server can run with or without a File System.

If you don't have a File System and still need to store files on your HTTP server, the µC/HTTP-server comes with a "Static File System". This pseudo File System allows to store your files in constant C arrays, reads them and navigate inside them. A script allows you to convert your files in constant C arrays that should then be added to your project. Afterwards, the function HTTPs_FS_AddFile() allows you to store those files in the "Static File System".

If a File System is present and must be used (Static or real), the µC/HTTP-server use the Network Generic File System API (NET_FS_API structure) in net_fs.h. Therefore, you must port your File System to those API functions so that the server can use your File System. If the Static File System is used, a port is already available inside the source files. The µC/FS (version 4) has also been port and is available inside the FS folder of the µC/TCP-IP product.

Configuration

Three types of File System can be configured with µC/HTTP-server. Each type has its own File System configuration structure.

In the HTTP server Instance configuration, the FS Type and the Pointer to the associated FS configuration must be passed. See section Parameters Configuration

HTTPs_FS_TYPEConfiguration StructureDescription
HTTPs_FS_TYPE_NONEHTTPs_CFG_FS_NONEUse when to File System is present.
HTTPs_FS_TYPE_STATICHTTPS_CFG_FS_STATICUse when the µC/HTTP-server Static File System is used.
HTTPS_FS_TYPE_DYNHTTPS_CFG_FS_DYNUse when a standard File System is used.

No File System Configuration

const  HTTPs_CFG_FS_NONE  HTTPs_CfgFS_None = {
    256														    /* .PathLenMax */
};


Structure FieldTypeDescriptionPossible Values

PathLenMax

CPU_INT32U

Configure the maximum path length for a web resource supported by the HTTP server.Must be >= 1

HTTP Server Static File System Configuration

const  HTTPs_CFG_FS_STATIC  HTTPs_CfgFS_Static = {
   &HTTPs_FS_API_Static,                                        /* .FS_API_Ptr */
};
Structure FieldTypeDescriptionPossible Values

FS_API_Ptr

const NET_FS_API*

Configure the pointer to the File System Network API object structure.MUST be a valid pointer to a NET_FS_API object.

Dynamic File System Configuration

const  HTTPs_CFG_FS_DYN  HTTPs_CfgFS_Dyn = {

   &NetFS_API_FS_V4,                                            /* .FS_API_Ptr       */

    HTTPs_CFG_INSTANCE_STR_FOLDER_ROOT                          /* .WorkingFolderPtr */
};


Structure FieldTypeDescriptionPossible Values

FS_API_Ptr

const NET_FS_API*

Configure the pointer to the File System Network API object structure.MUST be a valid pointer to a NET_FS_API object.
WorkingFolderPtrCPU_CHAR*

Pointer to the Working Folder name.

Web server instance can uses a working folder where files and subfolder are located.

It can be set as a null pointer (DEF_NULL), if the file system doesn't support 'set working folder' functionality but HTML documents and files must be located in the default path used by the file system.

SHOULD be a string pointer.