@CHIP-RTOS - Web Server Overview
IPC@CHIP® Documentation Index
Web Server Overview
CGI API
The explanations here assume the reader is somewhat familiar with the HTTP protocol.
Web Server / CGI topics:
CGI API Functions
The CGI API uses interrupt 0xAB, enabling the
application programmer to install
their own DOS program CGI functions in the IPC@CHIP® Web server's CGI table.
This makes it possible to visualize and control an application running in the
IPC@CHIP® via an Internet browser, using all features of modern Internet technology. Top of list Index page
CGI in the IPC@CHIP®
The Web server of the IPC@CHIP® uses an internal CGI table.
The CGI table is an array of CGI_Entry
type structures.
Defined for each entry is the URL name, the expected HTTP
method
(Get, Head or Post) and a pointer to a
function which will be
executed if a matching browser request arrives at the IPC@CHIP®.
Top of list Index page
Built-In CGI Functions
There are two pre-installed CGI functions in the IPC@CHIP®,
one of them named "ChipCfg".
The preset entry in the internal CGI table has the name "ChipCfg"
(Note: Since SC12 @CHIP-RTOS V1.10 Beta, SC13 @CHIP V0.92 Beta,
URL names of CGI are no longer case sensitive!).
A CGI callback function for this entry supports the method "Get" by producing a Web "file" in RAM.
This function is executed if a browser makes the following request
to an IPC@CHIP® device with an IP address of 192.168.205.4
:
http://192.168.205.4/ChipCfg
The CGI function then produces a HTML page in memory which contains
specific configuration data, like IP address, subnet mask, serial number, etc..
Top of list Index page
Building a CGI function using a C compiler
A CGI function built with the Borland C compilers must be declared as:
void huge _pascal CGI_Func(rpCgi far *CgiRequest);
Using the Microsoft Visual C compilers the CGI functions are declared as:
void far _saveregs _loadds _pascal
CGI_Func(rpCgi far *CgiRequest);
The Web server calls this function with the address of a rpCgi
type data structure,
which contains all needed information about the browser request. Another part
of this structure is the response fields. These fields must be set by the
CGI function. They hold information needed by the Web server.
Important: The max. length of a web page in RAM produced by a users CGI function
is 65519 characters.
Top of list Index page
File Upload
It is possible to upload a file to the Web server. This feature is not available
with the standard SC1x @CHIP-RTOS variants (Tiny, Small, Medium, Large, ..). If you
want a special SC1x @CHIP-RTOS variant with this feature, you have to request it from us
via email. At SC1x3/SC2x this feature is included at the standard RTOS and available since
SC1x3 @CHIP-RTOS V1.10 Beta and SC2x @CHIP-RTOS V1.00.
The Upload will be handled using a HTML Form. The form has to include the
following field:
DESTINATION-PATH (e.g. "A:\HELLO.EXE")
REDIRECT-PATH (e.g. "A:\WEB\SUCCESS.HTM")
FILE-CONTENT
The DESTINATION-PATH defines the name and the location where the file will be
stored on the IPC@CHIP®'s drive. REDIRECT-PATH links to a file, which will be
returned on a successful upload to the Browser. The file must be located on
an IPC@CHIP®'s drive. The value of the field FILE-CONTENT will be handled from
your Web Browser automatically. It allows the user to choose a local file from
the PC's drive using the browse button (which appears with the type "file").
Password and user name for the File Upload are defined in the
CHIP.INI (standard: web, web).
For example your can use a form like the following one to upload a file to the
IPC@CHIP®'s Web server:
| <html>
<head>
<title>FileUpLoad to the IPC@CHIP® Web Server</title>
</head>
<body>
<form action="http://192.168.201.4" enctype="multipart/form-data" method="POST">
<p>
Choose file from your PC for Upload:<br>
Destination Filename:
<input type="text" name="DESTINATION-PATH" value=""><br>
Linkto:
<input type="text" name="REDIRECT-PATH" value=""><br>
Local File Path:
<input name="FILE-CONTENT" type="file" size="50" ><br>
<input type="submit" value=" Absenden ">
</p>
</form>
</body>
</html>
Comment:
You can also use the Type "hidden" if you want to hard code some value.
e.g: <input type="hidden" name="REDIRECT-PATH" value="success.htm"> |
Supported since or modified in @CHIP-RTOS version-
SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
on request | on request | on request | V1.10 | V1.00 |
Top of list Index page
End of document
|