Home | History | Annotate | Download | only in WebServer
      1 /**
      2   @file
      3   Exit 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 Exit 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
     30 ExitPage (
     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     //  Tell the web-server to exit
     46     //
     47     mWebServer.bRunning = FALSE;
     48 
     49     //
     50     //  Send the page header
     51     //
     52     Status = HttpPageHeader ( SocketFD, pPort, L"Exit" );
     53     if ( EFI_ERROR ( Status )) {
     54       break;
     55     }
     56 
     57     //
     58     //  Send the page body
     59     //
     60     Status = HttpSendAnsiString ( SocketFD,
     61                                   pPort,
     62                                   "<h1>Exit</h1>\r\n"
     63                                   "<p>\r\n"
     64                                   "  Exiting the web-server application.\r\n"
     65                                   "</p>\r\n" );
     66     if ( EFI_ERROR ( Status )) {
     67       break;
     68     }
     69 
     70     //
     71     //  Send the page trailer
     72     //
     73     Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
     74     break;
     75   }
     76 
     77   //
     78   //  Return the operation status
     79   //
     80   DBG_EXIT_STATUS ( Status );
     81   return Status;
     82 }
     83