System monitor – Comtrol eCos User Manual

Page 638

Advertising
background image

Chapter 48. Embedded HTTP Server

char cyg_html_message[] = "

<

head

><

title

>

Welcome

<

/title

><

/head

>

\n"

"

<

body

><

h2

>

Welcome to my Web Page

<

/h2

><

/body

>

\n"

CYG_HTTPD_TABLE_ENTRY( cyg_html_message_entry,

"/message.html",

cyg_httpd_send_html,

cyg_html_message );

cyg_httpd_send_data()

Sends arbitrary data to the client. The argument is a pointer to a cyg_httpd_data struc-

ture that defines the content type and length of the data, and a pointer to the data itself. The

CYG_HTTPD_DATA()

macro automates the definition of the structure. Here is a typical example of its use:

static cyg_uint8 ecos_logo_gif[] = {

...

};

CYG_HTTPD_DATA( cyg_monitor_ecos_logo_data,

"image/gif",

sizeof(ecos_logo_gif),

ecos_logo_gif );

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_ecos_logo,

"/monitor/ecos.gif",

cyg_httpd_send_data,

&cyg_monitor_ecos_logo_data );

System Monitor

Included in the HTTPD package is a simple System Monitor that is intended to act as a test and an example of how
to produce servers. It is also hoped that it might be of some use in and of itself.

The System Monitor is intended to work in the background of any application. Adding the network stack and
the HTTPD package to any configuration will enable the monitor by default. It may be disabled by disabling the

CYGPKG_HTTPD_MONITOR

option.

The monitor is intended to be simple and self-explanatory in use. It consists of four main pages. The thread monitor
page presents a table of all current threads showing such things as id, state, priority, name and stack dimensions.
Clicking on the thread ID will link to a thread edit page where the thread’s state and priority may be manipulated.
The interrupt monitor just shows a table of the current interrupts and indicates which are active. The memory
monitor shows a 256 byte page of memory, with controls to change the base address and display element size.
The network monitor page shows information extracted from the active network interfaces and protocols. Finally,
if kernel instrumentation is enabled, the instrumentation page provides some controls over the instrumentation
mechanism, and displays the instrumentation buffer.

534

Advertising