NetBurner 3.5.7
PDF Version
Display HTML Files (FTPD)

FTPD HTML Expose Application

Overview

This application creates a read-only FTP server that exposes HTML files from an embedded system as a browsable file system. It's designed for embedded systems using a network stack and provides both web server functionality and FTP access to HTML content.

Note
For FTP and SFTP using the EFFS file systesms, refer to examples in the \nburn\examples\EFFS folder

Features

  • FTP Server: Runs on port 21 with read-only access to HTML files
  • Web Server: HTTP server running on port 80
  • Network Integration: Uses DHCP for automatic IP configuration
  • File System Emulation: Creates a virtual directory tree from compiled HTML files
  • Cross-Platform Access: Files accessible via web browsers and FTP clients

Application Components

Core Functionality

The application initializes a network stack and starts two main services:

  1. HTTP Web Server - Provides web-based access and status information
  2. FTP Server - Exposes HTML files as a read-only file system

File System Structure

The application builds a virtual file system from HTML files that are compiled into the application:

  • Creates a tree structure with directories and files
  • Supports nested directory hierarchies
  • File metadata includes size and basic permissions
  • Directory navigation follows standard FTP conventions

Key Functions

Network Services

  • UserMain() - Main application entry point, initializes services
  • webDisplayFtpLink() - Displays FTP access URL on web pages

Directory Tree Management

  • BuildDirTree() - Constructs file system tree from HTML data
  • GetDir() - Locates directories in the virtual file system
  • getDirString() - Formats file/directory information for FTP clients

FTP Server Callbacks

Usage

Accessing Files

  1. Via Web Browser: Navigate to the device's IP address
  2. Via FTP Client: Connect to ftp://[device-ip] using any FTP client
  3. FTP URL: The application displays the FTP URL format as ftp://[ip-address]

Browser Compatibility

Starting in 2020, some web browsers have begun blocking direct FTP access. In such cases:

  • Use dedicated FTP client applications such as FileZilla
  • Access files through the web server interface instead

Authentication

The current implementation accepts all FTP connections without password verification. For production use, implement proper authentication in FTPDSessionStart().

Technical Details

Dependencies

Memory Management

  • Dynamic allocation for directory and file structures
  • Linked list implementation for file system hierarchy
  • Cleanup handled automatically on application termination

Configuration

  • FTP Server Port: 21
  • HTTP Server Port: 80 (default)
  • Task Priority: MAIN_PRIO - 1 (higher than main task)
  • Network Timeout: 5 seconds for DHCP

Read-Only Operations

The following FTP operations are supported:

  • Directory listing (LIST, NLST)
  • File download (RETR)
  • Directory navigation (CWD, PWD)
  • File existence checking

Unsupported Operations

These FTP operations always return failure:

  • File upload (STOR)
  • File deletion (DELE)
  • Directory creation (MKD)
  • Directory deletion (RMD)
  • File renaming (RNFR/RNTO)

System Requirements

  • Embedded system with network capability
  • Network stack supporting TCP/IP
  • Sufficient RAM for file system tree structure
  • HTML files compiled into application data

Development Notes

This is an advanced application requiring knowledge of:

  • FTP protocol implementation
  • Embedded network programming
  • File system navigation concepts
  • HTML file management in embedded systems

The complexity primarily involves managing virtual directory structures and handling FTP client requests for file navigation and display.

Status Output

The application provides diagnostic information via serial port:

  • Network initialization status
  • FTP server startup confirmation
  • IP address assignment
  • Session start/end notifications
  • System diagnostics (should be disabled for production)

Example Output

Started FTP Server
You can use a web browser to view files at URL "ftp://192.168.1.100"
Building the tree...
Ending session 1