]>
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. All rights reserved.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <WebServer.h>
14 Respond with the list of known pages
16 @param [in] SocketFD The socket's file descriptor to add to the list.
17 @param [in] pPort The WSDT_PORT structure address
18 @param [out] pbDone Address to receive the request completion status
20 @retval EFI_SUCCESS The request was successfully processed
30 CONST DT_PAGE
* pPage
;
31 CONST DT_PAGE
* pPageEnd
;
37 // Send the index page
41 // Send the page header
43 Status
= HttpPageHeader ( SocketFD
, pPort
, L
"Index" );
44 if ( EFI_ERROR ( Status
)) {
49 // Build the table header
51 Status
= HttpSendAnsiString ( SocketFD
,
53 "<h1>UEFI Web Server</h1>\r\n"
54 "<table border=\"1\">\r\n"
55 " <tr bgcolor=\"c0c0ff\"><th>Page</th><th>Description</th></tr>\r\n" );
56 if ( EFI_ERROR ( Status
)) {
61 // Walk the list of pages
62 // Skip the first page
64 pPage
= &mPageList
[0];
65 pPageEnd
= &pPage
[mPageCount
];
67 while ( pPageEnd
> pPage
) {
69 // Build the table entry for this page
71 Status
= HttpSendAnsiString ( SocketFD
,
73 "<tr><td><a target=\"_blank\" href=\"" );
74 if ( EFI_ERROR ( Status
)) {
77 Status
= HttpSendUnicodeString ( SocketFD
,
79 &pPage
->pPageName
[1]);
80 if ( EFI_ERROR ( Status
)) {
83 Status
= HttpSendAnsiString ( SocketFD
,
86 if ( EFI_ERROR ( Status
)) {
89 Status
= HttpSendUnicodeString ( SocketFD
,
91 &pPage
->pPageName
[1]);
92 if ( EFI_ERROR ( Status
)) {
95 Status
= HttpSendAnsiString ( SocketFD
,
98 if ( EFI_ERROR ( Status
)) {
101 Status
= HttpSendUnicodeString ( SocketFD
,
103 pPage
->pDescription
);
104 if ( EFI_ERROR ( Status
)) {
107 Status
= HttpSendAnsiString ( SocketFD
,
110 if ( EFI_ERROR ( Status
)) {
119 if ( EFI_ERROR ( Status
)) {
124 // Build the table trailer
126 Status
= HttpSendAnsiString ( SocketFD
,
129 if ( EFI_ERROR ( Status
)) {
134 // Send the page trailer
136 Status
= HttpPageTrailer ( SocketFD
, pPort
, pbDone
);
141 // Return the operation status
143 DBG_EXIT_STATUS ( Status
);