]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Sockets/WebServer/Index.c
3 Generate the list of known pages.
5 Copyright (c) 2011-2012, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <WebServer.h>
20 Respond with the list of known pages
22 @param [in] SocketFD The socket's file descriptor to add to the list.
23 @param [in] pPort The WSDT_PORT structure address
24 @param [out] pbDone Address to receive the request completion status
26 @retval EFI_SUCCESS The request was successfully processed
36 CONST DT_PAGE
* pPage
;
37 CONST DT_PAGE
* pPageEnd
;
43 // Send the index page
47 // Send the page header
49 Status
= HttpPageHeader ( SocketFD
, pPort
, L
"Index" );
50 if ( EFI_ERROR ( Status
)) {
55 // Build the table header
57 Status
= HttpSendAnsiString ( SocketFD
,
59 "<h1>UEFI Web Server</h1>\r\n"
60 "<table border=\"1\">\r\n"
61 " <tr bgcolor=\"c0c0ff\"><th>Page</th><th>Description</th></tr>\r\n" );
62 if ( EFI_ERROR ( Status
)) {
67 // Walk the list of pages
68 // Skip the first page
70 pPage
= &mPageList
[0];
71 pPageEnd
= &pPage
[mPageCount
];
73 while ( pPageEnd
> pPage
) {
75 // Build the table entry for this page
77 Status
= HttpSendAnsiString ( SocketFD
,
79 "<tr><td><a target=\"_blank\" href=\"" );
80 if ( EFI_ERROR ( Status
)) {
83 Status
= HttpSendUnicodeString ( SocketFD
,
85 &pPage
->pPageName
[1]);
86 if ( EFI_ERROR ( Status
)) {
89 Status
= HttpSendAnsiString ( SocketFD
,
92 if ( EFI_ERROR ( Status
)) {
95 Status
= HttpSendUnicodeString ( SocketFD
,
97 &pPage
->pPageName
[1]);
98 if ( EFI_ERROR ( Status
)) {
101 Status
= HttpSendAnsiString ( SocketFD
,
104 if ( EFI_ERROR ( Status
)) {
107 Status
= HttpSendUnicodeString ( SocketFD
,
109 pPage
->pDescription
);
110 if ( EFI_ERROR ( Status
)) {
113 Status
= HttpSendAnsiString ( SocketFD
,
116 if ( EFI_ERROR ( Status
)) {
125 if ( EFI_ERROR ( Status
)) {
130 // Build the table trailer
132 Status
= HttpSendAnsiString ( SocketFD
,
135 if ( EFI_ERROR ( Status
)) {
140 // Send the page trailer
142 Status
= HttpPageTrailer ( SocketFD
, pPort
, pbDone
);
147 // Return the operation status
149 DBG_EXIT_STATUS ( Status
);