]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Sockets/WebServer/Index.c
2 This file contains an 'Intel UEFI Application' and is
3 licensed for Intel CPUs and chipsets under the terms of your
4 license agreement with Intel or your vendor. This file may
5 be modified by the user, subject to additional terms of the
10 Copyright (c) 2011 Intel Corporation. All rights reserved
11 This software and associated documentation (if any) is furnished
12 under a license and may only be used or copied in accordance
13 with the terms of the license. Except as permitted by such
14 license, no part of this software or documentation may be
15 reproduced, stored in a retrieval system, or transmitted in any
16 form or by any means without the express written consent of
22 Generate the list of known pages.
26 #include <WebServer.h>
30 Respond with the list of known pages
32 @param [in] SocketFD The socket's file descriptor to add to the list.
33 @param [in] pPort The WSDT_PORT structure address
34 @param [out] pbDone Address to receive the request completion status
36 @retval EFI_SUCCESS The request was successfully processed
46 CONST DT_PAGE
* pPage
;
47 CONST DT_PAGE
* pPageEnd
;
53 // Send the index page
57 // Send the page header
59 Status
= HttpPageHeader ( SocketFD
, pPort
, L
"Index" );
60 if ( EFI_ERROR ( Status
)) {
65 // Build the table header
67 Status
= HttpSendAnsiString ( SocketFD
,
69 "<h1>UEFI Web Server</h1>\r\n"
70 "<table border=\"1\">\r\n"
71 " <tr bgcolor=\"c0c0ff\"><th>Page</th><th>Description</th></tr>\r\n" );
72 if ( EFI_ERROR ( Status
)) {
77 // Walk the list of pages
78 // Skip the first page
80 pPage
= &mPageList
[0];
81 pPageEnd
= &pPage
[mPageCount
];
83 while ( pPageEnd
> pPage
) {
85 // Build the table entry for this page
87 Status
= HttpSendAnsiString ( SocketFD
,
89 "<tr><td><a target=\"_blank\" href=\"" );
90 if ( EFI_ERROR ( Status
)) {
93 Status
= HttpSendUnicodeString ( SocketFD
,
95 &pPage
->pPageName
[1]);
96 if ( EFI_ERROR ( Status
)) {
99 Status
= HttpSendAnsiString ( SocketFD
,
102 if ( EFI_ERROR ( Status
)) {
105 Status
= HttpSendUnicodeString ( SocketFD
,
107 &pPage
->pPageName
[1]);
108 if ( EFI_ERROR ( Status
)) {
111 Status
= HttpSendAnsiString ( SocketFD
,
114 if ( EFI_ERROR ( Status
)) {
117 Status
= HttpSendUnicodeString ( SocketFD
,
119 pPage
->pDescription
);
120 if ( EFI_ERROR ( Status
)) {
123 Status
= HttpSendAnsiString ( SocketFD
,
126 if ( EFI_ERROR ( Status
)) {
135 if ( EFI_ERROR ( Status
)) {
140 // Build the table trailer
142 Status
= HttpSendAnsiString ( SocketFD
,
145 if ( EFI_ERROR ( Status
)) {
150 // Send the page trailer
152 Status
= HttpPageTrailer ( SocketFD
, pPort
, pbDone
);
157 // Return the operation status
159 DBG_EXIT_STATUS ( Status
);