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 Ports page
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 socklen_t AddressLength
;
37 struct sockaddr_in6 LocalAddress
;
38 DT_WEB_SERVER
* pWebServer
;
44 // Send the Hello World page
46 pWebServer
= &mWebServer
;
49 // Send the page header
51 Status
= HttpPageHeader ( SocketFD
, pPort
, L
"Ports" );
52 if ( EFI_ERROR ( Status
)) {
59 Status
= HttpSendAnsiString ( SocketFD
,
61 "<h1>Web-Server Ports</h1>\r\n" );
62 if ( EFI_ERROR ( Status
)) {
69 if ( -1 != pWebServer
->HttpListenPort
) {
70 AddressLength
= sizeof ( LocalAddress
);
71 if ( 0 == getsockname ( pWebServer
->HttpListenPort
,
72 (struct sockaddr
*)&LocalAddress
,
74 Status
= HttpSendAnsiString ( SocketFD
,
76 "<a href=\"http://" );
77 if ( EFI_ERROR ( Status
)) {
80 Status
= HttpSendIpAddress ( SocketFD
,
83 if ( EFI_ERROR ( Status
)) {
86 Status
= HttpSendAnsiString ( SocketFD
,
88 "\">Tcp4</a><br>\r\n" );
89 if ( EFI_ERROR ( Status
)) {
98 if ( -1 != pWebServer
->HttpListenPort6
) {
99 AddressLength
= sizeof ( LocalAddress
);
100 if ( 0 == getsockname ( pWebServer
->HttpListenPort6
,
101 (struct sockaddr
*)&LocalAddress
,
103 Status
= HttpSendAnsiString ( SocketFD
,
105 "<a href=\"http://" );
106 if ( EFI_ERROR ( Status
)) {
109 Status
= HttpSendIpAddress ( SocketFD
,
112 if ( EFI_ERROR ( Status
)) {
115 Status
= HttpSendAnsiString ( SocketFD
,
117 "\">Tcp6</a><br>\r\n" );
118 if ( EFI_ERROR ( Status
)) {
125 // Send the page trailer
127 Status
= HttpPageTrailer ( SocketFD
, pPort
, pbDone
);
132 // Return the operation status
134 DBG_EXIT_STATUS ( Status
);