All stuffs realted to web interface (except of httpd and www pages)
are in the router/shared/ folder. The file broadcom.c hadles all the
interactions between user interface and router, but I will not
explain how it is structured here.
Ok suppose you need a function that prints the current uptime in a web
page. We call this command get_uptime().
First of all put the command name in a web page in this way:
Current uptime: <% get_uptime(); %>
Then search in the router/shared/broadcom.c for the struct ej_handlers
( at the end of the file)
You have to add to this structure one element:
{"get_uptime", ej_get_uptime}, (add it before the last {NULL,NULL} )
The first field is the command name, the second field is the function
name that execute it.
BTW, I still does not know the meaning of "ej".
Next, add the the function name in broadcom.h:
extern void ej_get_uptime (webs_t wp, int argc, char_t ** argv);
Now you have 2 choices:
1) Add the function to one of the .c files in the shared/ folder.
2) Create a new c file, and add cfilename.o to the list of objects in
the "httpd:" rule in httpd/Makefile
Finally, write your function:
void ej_get_uptime (webs_t wp, int argc, char_t ** argv)
{
int foo;
....
bar();
...
}
Useful function:
websWrite(wp,...);
use it like sprintf(...);
cheers
marco