• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2   @file
3   Hello World response page
4 
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
10 
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.
13 
14 **/
15 
16 #include <WebServer.h>
17 
18 
19 /**
20   Respond with the Hello World page
21 
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
25 
26   @retval EFI_SUCCESS       The request was successfully processed
27 
28 **/
29 EFI_STATUS
HelloPage(IN int SocketFD,IN WSDT_PORT * pPort,OUT BOOLEAN * pbDone)30 HelloPage (
31   IN int SocketFD,
32   IN WSDT_PORT * pPort,
33   OUT BOOLEAN * pbDone
34   )
35 {
36   EFI_STATUS Status;
37 
38   DBG_ENTER ( );
39 
40   //
41   //  Send the Hello World page
42   //
43   for ( ; ; ) {
44     //
45     //  Send the page header
46     //
47     Status = HttpPageHeader ( SocketFD, pPort, L"Hello World" );
48     if ( EFI_ERROR ( Status )) {
49       break;
50     }
51 
52     //
53     //  Send the page body
54     //
55     Status = HttpSendAnsiString ( SocketFD,
56                                   pPort,
57                                   "<h1>Hello World</h1>\r\n"
58                                   "<p>\r\n"
59                                   "  This response was generated by the UEFI web server application.\r\n"
60                                   "</p>\r\n" );
61     if ( EFI_ERROR ( Status )) {
62       break;
63     }
64 
65     //
66     //  Send the page trailer
67     //
68     Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
69     break;
70   }
71 
72   //
73   //  Return the operation status
74   //
75   DBG_EXIT_STATUS ( Status );
76   return Status;
77 }
78