Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: LPC 2124 Webserver new cgi-file

2005-11-23 by FreeRTOS Info

> yes after changing html and cgi i rum makefsdata. but maybe i chose a
> wrong way. i thought cgi calls funktions a(prinz_stats),b
> (file_stats) and c (tcp_stats)form cgi.c. so i included a fuktion
> called "d" for my counting and this is not in folder fs. but Rowley
> CrossStudio compiled and downloaded it to ARM uC.
> So cgi part of new fsdata.c should call my funktion "d"
>
> But the cgi webpage is not found
>

There are two components to the cgi functionality
- the cgi script itself which is built into the file system by use of
makefsdata.
- the function that is called by the cgi script which is compiled as part of
the code.

Here is a basic example.

1) Generate a new cgi script that calls function d.  Lets call this cgi
script test, so it is saved in a file called test (no extension) in the
directory uip/fs/cgi.  This script transmits the text "this text is
transmitted" then calls function d.

script start-----------
t <html><head></head><body>
t this text is transmitted
c d
</body></html>
script end-----------

The line "c d" is where function d is called.

2) Write function d.  The function name is going to be called CGI_tx() and
will just transmit the text "this text is coming from the function".
Write the function in the file uip/cgi.c.

function start--------
#define TX_TEXT "this text is coming from the function"

static u8_t CGI_tx( u8_t next )
{
____uip_send( TX_TEXT, strlen( TX_TEXT) );
}
function end--------


3) Place the function in the CGI function list array as follows:

cgifunction cgitab[] = {
  print_stats,   /* CGI function "a" */
  file_stats,    /* CGI function "b" */
  tcp_stats,      /* CGI function "c" */
  CGI_tx /* CGI function "d" */
};


4) Run makefsdata - this will compile the cgi script generated in step 1
into the file system.

5) Compile your program.

6) Run program and brows to http://aa.bb.cc.dd/cgi/test

Regards,
Richard.


http://www.FreeRTOS.org

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.