]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Sockets/WebServer/Reboot.c
Update the license dates
[mirror_edk2.git] / AppPkg / Applications / Sockets / WebServer / Reboot.c
CommitLineData
9f7f5161 1/**
2 @file
4684b66f 3 Reboot the system
4
9f7f5161 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
4684b66f 14**/
15
16#include <WebServer.h>
17#include <Library/UefiRuntimeServicesTableLib.h>
18
19
20/**
21 Page to reboot the system
22
23 @param [in] SocketFD The socket's file descriptor to add to the list.
24 @param [in] pPort The WSDT_PORT structure address
25 @param [out] pbDone Address to receive the request completion status
26
27 @retval EFI_SUCCESS The request was successfully processed
28
29**/
30EFI_STATUS
31RebootPage (
32 IN int SocketFD,
33 IN WSDT_PORT * pPort,
34 OUT BOOLEAN * pbDone
35 )
36{
37 EFI_STATUS Status;
38
39 DBG_ENTER ( );
40
41 //
9f7f5161 42 // Send the Reboot page
4684b66f 43 //
44 for ( ; ; ) {
45 //
46 // Send the page header
47 //
48 Status = HttpPageHeader ( SocketFD, pPort, L"Reboot" );
49 if ( EFI_ERROR ( Status )) {
50 break;
51 }
52
53 //
54 // Send the page body
55 //
56 Status = HttpSendAnsiString ( SocketFD,
57 pPort,
58 "<h1>Reboot</h1>\r\n"
59 "<p>\r\n"
60 " Ouch! The system is rebooting!\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 if ( EFI_ERROR ( Status )) {
70 break;
71 }
72
73 //
74 // Deliver the data to the remote system by
75 // closing the socket
76 //
77 close ( SocketFD );
78
79 //
80 // Attempt to reboot the system
81 //
82 DEBUG (( DEBUG_REQUEST, "Reseting System\r\n" ));
83 gRT->ResetSystem ( EfiResetCold,
84 EFI_SUCCESS,
85 0,
86 NULL );
87 break;
88 }
89
90 //
91 // Return the operation status
92 //
93 DBG_EXIT_STATUS ( Status );
94 return Status;
95}