Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ARM).Porting the ARM webserver programmer's guide.Ver 1.6.pdf
Скачиваний:
27
Добавлен:
23.08.2013
Размер:
1.19 Mб
Скачать

Porting Step-by-Step

Syntax

int ht_ipaddr(struct vfs_file *vfp, struct httpd *hp, char *args)

where:

 

vfp

Is the VFS file entry for the included file (in this case, "ipaddr"). This

 

might not be needed, but is sometimes useful.

hp

Is the connection on which the files are being sent out.

 

This is required because hp->sock is the socket ID to be used with

 

sys_send().

args

Is the text in quotes in the SSI tag, as in "ipaddr" (see SSI include routines

 

on page 3-16). In more complex applications, this string can be used to

 

pass parameters.

 

For example, a multihomed host can use "ipaddr iface1" and "ipaddr

 

iface2" to return the IP addresses of different interfaces. All calls still go

 

to the routine indicated by the VFS entry for ipaddr, and the routine can

 

use the args parameter to determine the interface whose IP address was

 

being requested.

3.7.6Displaying C variables using #include

A common task for webservers that manage embedded devices is the displaying of dynamic data. In the demonstration program, examples of this are the various counters displayed in the hub status page, such as the number of frames sent, number of errors, and so on. These values can change every time the page is redisplayed. Therefore, you must have access to the value maintained in the device software, format it into HTML, and insert it into the web page.

One technique for accomplishing this is described in SSI include routines on page 3-16. If the values you want to insert into your web pages correspond directly to C variables within your program, you can use cvar files within the VFS, which is an easier technique. This allows the HTML Compiler to generate the necessary code to handle formatting of data and sending it to the browser. See Usage on page 4-3 for details on how to make the HTML Compiler generate cvar SSIs.

ARM DUI 0075D

Copyright © 1999-2001 ARM Limited. All rights reserved.

3-17