nahttp_fs: HTTP File System Sample Application

This example allows user to download and upload a file to the file system from a browser.

This example should work on all development boards.  

This "nahttp_fs" example requires BSP_INCLUDE_FILESYSTEM_FOR_CLIBRARY to be TRUE in bsp_fs.h. Please see BSP. 

This example starts and creates:
1. A test file in \RAM0 (root directory) with group id 1.
2. "DIR0" directory in \RAM0.
3. "DIR1" directory in \RAM0.
6. "user" username & "password" password for accessing all files and web pages.

APP_USE_NETWORK_TIME_PROTOCOL is defined in appconf.h to include time for file and
directory creation.

When running this application under debugger control, we recommend that you turn on SNTP.
This can be done by ensuring that APP_USE_NETWORK_TIME_PROTOCOL is defined on 
appconf.h and that BSP_INCLUDE_SNTP is defined as TRUE in the bsp_sys.h file for the platform 
on which you are building. Remember to rebuild the bsp and the application to ensure that this 
takes affect.

If running SNTP is not an option, then we recommend the following: set up the file system
to run without the real time clock option. This can be accomplished by having all
NAFSinit_volume_cb calls include the NAFS_NO_RTC option. This is accomplished 
by changing parameter 7 (options) of the function call. There are two files affected
by this operation. File fileinit.c in the sample application's directory, has one call to
NAFSinit_volume_cb. By default, parameter 7 (options), in this instance is 0 (zero). 
Change this parameter to NAFS_NO_RTC. There are two calls to NAFSinit_volume_cb in 
file native_fs_intf.c in the platform directory of the bsp platform on which you are building. 
The two calls represent the two options of an if statement. The first call to NAFSinit_volume_cb 
currently has 7th parameter set to NAFS_INIT_STATUS. In this case, OR NAFS_INIT_STATUS 
with NAFS_NO_RTC (the parameters represent bit patterns). In the second instance, parameter 7 
is currently set to 0 (zero). Replace the 0 (zero) with NAFS_NO_RTC. Remember to rebuild the bsp 
and the application before reruning.

The build file must define APP_FILE_SYSTEM to include the file system in the HTTP Server.

To upload a file:
1. Goto the home page by typing the ip address in the URL. 
2. Click on the upload link and a upload page will be displayed.
3. Select a directory where a file will be created.
4. Click the BROWSE button to select a file from the PC
5. Click the Upload button to start uploading.

To download or view a file:
1. Type http://ip_address/FS/full_path_filename to retrieve a file.
   The HTTP server uses "FS" to identify a file in the file system.

   HTTP server will prompt username and password entries if a file is not accessible by
   the default group id. 

All the HTML pages are generated by Page Builder.

One GNU make file is provided.  Build the target 'image' to
generate an image that can be debugged with gdb, and the file 
image.bin which can be written to flash if the bootloader is used.
Build the target 'rom.bin' to create the file rom.bin which 
can be written to ROM if the bootloader is not used.

The following files are provided with this example:

appconf.h         sets application configuration settings
makefile          Make file for the GNU toolset.
readme            this file
root.c            contains applicationStart() function
fileinit.c		  contains function to initialize the file system and creates a test
				  file and directory.
pbuilder\RpUsrDct.c   		Phrases used in html pages that HTTP server needs.
pbuilder\RpPages.c	  		Contains links of all html pages. 
pbuilder\html\index.c 		Home page generated.
pbuilder\html\errormsg.c	Error Message HTML page
pbuilder\index_v.c 		    Contains functions for index.c
pbuilder\filelist.c 		Contains functions for filelist.c
pbuilder\errormsg_v.c		Contains functions for errormsg.c
security.c					Setup access realm for username & password
..\..\..\src\rphttpd\cgi.c	User defined CGI support
..\..\..\src\rphttpd\file.c Contain interface between the file system and HTTP server.


In addition, the following files in the BSP directory are built as part of this 
example:

reset.s         contains the reset code
appconf_api.c   contains code used to read settings in appconf.h


The build file links in the following libraries:

libbsp.a           	 contains the BSP code
libtcpip.a         	 contains the Net+Works TCP/IP stack
libtx.a            	 contains the ThreadX kernel
libfilesys.a       	 contains the file system libraries
libposix.a         	 contains the POSIX layer libraries
libflash.a         	 contains the Flash driver API library
libtelnsvr.a       	 contains the Telnet server library
libaddp.a		   	 contains the ADDP Library
libssh.a		   	 contains the SSH Library
librphttpd.a       	 contains the NET+Works AWS API library.
libmanapi.a        	 contains the NET+Works Management API library.
libpppintf.a		 contains the PPP Interface Library
libdnsclnt.a         contains the DNS Client library

The application uses the following files located in the
netos\src\linkerScripts directory.

bootldr.dat     bootloader configuration file used to generate the
                file image.bin.  It controls the information placed
                in the bootloader header of the image.

image.ldr       GNU linker script used to build an image that can
                be debugged and used with the bootloader.
                
customize.ldr   Customizable GNU linker script


