Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

Web server
[Example applications]


Detailed Description

The uIP web server is a very simplistic implementation of an HTTP server. It can serve web pages and files from a read-only ROM filesystem, and provides a very small scripting language.

The script language is very simple and works as follows. Each script line starts with a command character, either "i", "t", "c", "#" or ".". The "i" command tells the script interpreter to "include" a file from the virtual file system and output it to the web browser. The "t" command should be followed by a line of text that is to be output to the browser. The "c" command is used to call one of the C functions from the httpd-cgi.c file. A line that starts with a "#" is ignored (i.e., the "#" denotes a comment), and the "." denotes the last script line.

The script that produces the file statistics page looks somewhat like this:

i /header.html
t <h1>File statistics</h1><br><table width="100%">
t <tr><td><a href="/index.html">/index.html</a></td><td>
c a /index.html
t </td></tr> <tr><td><a href="/cgi/files">/cgi/files</a></td><td>
c a /cgi/files
t </td></tr> <tr><td><a href="/cgi/tcp">/cgi/tcp</a></td><td>
c a /cgi/tcp
t </td></tr> <tr><td><a href="/404.html">/404.html</a></td><td>
c a /404.html
t </td></tr></table>
i /footer.plain
.


Files

file  cgi.c
 HTTP server script language C functions file.

file  cgi.h
 HTTP script language header file.

file  fs.c
 HTTP server read-only file system code.

file  fs.h
 HTTP server read-only file system header file.

file  httpd.c
 HTTP server.

file  httpd.h
 HTTP server header file.


Data Structures

struct  fs_file
 An open file in the read-only file system. More...


Functions

void httpd_init (void)
 Initialize the web server.

int fs_open (const char *name, struct fs_file *file)
 Open a file in the read-only file system.

void fs_init (void)
 Initialize the read-only file system.


Variables

cgifunction cgitab []
 A table containing pointers to C functions that can be called from a web server script.


Function Documentation

int fs_open const char *  name,
struct fs_file file
 

Open a file in the read-only file system.

Parameters:
name The name of the file.
file The file pointer, which must be allocated by caller and will be filled in by the function.

void httpd_init void   ) 
 

Initialize the web server.

Starts to listen for incoming connection requests on TCP port 80.

Here is the call graph for this function:


Generated on Tue Oct 7 15:51:50 2003 for uIP 0.9 by doxygen 1.3.3