Add Socket Library applications.
Modify AppPkg.dsc file to include StdLib.inc which contains the Boilerplate text for Standard Library based Applications. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12062 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
1918
AppPkg/Applications/Sockets/WebServer/ACPI.c
Normal file
1918
AppPkg/Applications/Sockets/WebServer/ACPI.c
Normal file
File diff suppressed because it is too large
Load Diff
481
AppPkg/Applications/Sockets/WebServer/BootServicesTable.c
Normal file
481
AppPkg/Applications/Sockets/WebServer/BootServicesTable.c
Normal file
@@ -0,0 +1,481 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the boot services table
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
/**
|
||||
Respond with the boot services table
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
BootServicesTablePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the boot services page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page and table header
|
||||
//
|
||||
Status = TableHeader ( SocketFD, pPort, L"Boot Services Table", gBS );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The table header for the EFI Boot Services Table.
|
||||
///
|
||||
Status = EfiTableHeader ( SocketFD,
|
||||
pPort,
|
||||
&gBS->Hdr );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Task Priority Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"RaiseTPL",
|
||||
(CONST VOID *)gBS->RaiseTPL,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"RestoreTPL",
|
||||
(CONST VOID *)gBS->RestoreTPL,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Memory Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"AllocatePages",
|
||||
(CONST VOID *)gBS->AllocatePages,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"FreePages",
|
||||
(CONST VOID *)gBS->FreePages,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetMemoryMap",
|
||||
(CONST VOID *)gBS->GetMemoryMap,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"AllocatePool",
|
||||
(CONST VOID *)gBS->AllocatePool,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"FreePool",
|
||||
(CONST VOID *)gBS->FreePool,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Event & Timer Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CreateEvent",
|
||||
(CONST VOID *)gBS->CreateEvent,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetTimer",
|
||||
(CONST VOID *)gBS->SetTimer,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"WaitForEvent",
|
||||
(CONST VOID *)gBS->WaitForEvent,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SignalEvent",
|
||||
(CONST VOID *)gBS->SignalEvent,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CloseEvent",
|
||||
(CONST VOID *)gBS->CloseEvent,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CheckEvent",
|
||||
(CONST VOID *)gBS->CheckEvent,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Protocol Handler Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"InstallProtocolInterface",
|
||||
(CONST VOID *)gBS->InstallProtocolInterface,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ReinstallProtocolInterface",
|
||||
(CONST VOID *)gBS->ReinstallProtocolInterface,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"UninstallProtocolInterface",
|
||||
(CONST VOID *)gBS->UninstallProtocolInterface,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"HandleProtocol",
|
||||
(CONST VOID *)gBS->HandleProtocol,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"Reserved",
|
||||
(CONST VOID *)gBS->Reserved,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"RegisterProtocolNotify",
|
||||
(CONST VOID *)gBS->RegisterProtocolNotify,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"LocateHandle",
|
||||
(CONST VOID *)gBS->LocateHandle,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"LocateDevicePath",
|
||||
(CONST VOID *)gBS->LocateDevicePath,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"InstallConfigurationTable",
|
||||
(CONST VOID *)gBS->InstallConfigurationTable,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Image Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"LoadImage",
|
||||
(CONST VOID *)gBS->LoadImage,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"StartImage",
|
||||
(CONST VOID *)gBS->StartImage,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"Exit",
|
||||
(CONST VOID *)gBS->Exit,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"UnloadImage",
|
||||
(CONST VOID *)gBS->UnloadImage,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ExitBootServices",
|
||||
(CONST VOID *)gBS->ExitBootServices,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Miscellaneous Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetNextMonotonicCount",
|
||||
(CONST VOID *)gBS->GetNextMonotonicCount,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"Stall",
|
||||
(CONST VOID *)gBS->Stall,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetWatchdogTimer",
|
||||
(CONST VOID *)gBS->SetWatchdogTimer,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// DriverSupport Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConnectController",
|
||||
(CONST VOID *)gBS->ConnectController,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"DisconnectController",
|
||||
(CONST VOID *)gBS->DisconnectController,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Open and Close Protocol Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"OpenProtocol",
|
||||
(CONST VOID *)gBS->OpenProtocol,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CloseProtocol",
|
||||
(CONST VOID *)gBS->CloseProtocol,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"OpenProtocolInformation",
|
||||
(CONST VOID *)gBS->OpenProtocolInformation,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Library Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ProtocolsPerHandle",
|
||||
(CONST VOID *)gBS->ProtocolsPerHandle,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"LocateHandleBuffer",
|
||||
(CONST VOID *)gBS->LocateHandleBuffer,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"LocateProtocol",
|
||||
(CONST VOID *)gBS->LocateProtocol,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"InstallMultipleProtocolInterfaces",
|
||||
(CONST VOID *)gBS->InstallMultipleProtocolInterfaces,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"UninstallMultipleProtocolInterfaces",
|
||||
(CONST VOID *)gBS->UninstallMultipleProtocolInterfaces,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// 32-bit CRC Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CalculateCrc32",
|
||||
(CONST VOID *)gBS->CalculateCrc32,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Miscellaneous Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CopyMem",
|
||||
(CONST VOID *)gBS->CopyMem,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetMem",
|
||||
(CONST VOID *)gBS->SetMem,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"CreateEventEx",
|
||||
(CONST VOID *)gBS->CreateEventEx,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = TableTrailer ( SocketFD,
|
||||
pPort,
|
||||
pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
380
AppPkg/Applications/Sockets/WebServer/ConfigurationTable.c
Normal file
380
AppPkg/Applications/Sockets/WebServer/ConfigurationTable.c
Normal file
@@ -0,0 +1,380 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the configuration table
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
#include <Guid\Acpi.h>
|
||||
#include <Guid\DebugImageInfoTable.h>
|
||||
#include <Guid\DxeServices.h>
|
||||
#include <Guid\HobList.h>
|
||||
#include <Guid\MemoryTypeInformation.h>
|
||||
#include <Guid\LoadModuleAtFixedAddress.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
CHAR16 * GuidName;
|
||||
EFI_GUID * pGuid;
|
||||
CHAR16 * pWebPage;
|
||||
} GUID_NAME;
|
||||
|
||||
CONST GUID_NAME mGuidName [] = {
|
||||
{ L"gEfiAcpi10TableGuid", &gEfiAcpi10TableGuid, PAGE_ACPI_RSDP_10B },
|
||||
{ L"gEfiAcpiTableGuid", &gEfiAcpiTableGuid, PAGE_ACPI_RSDP_30 },
|
||||
{ L"gEfiDebugImageInfoTableGuid", &gEfiDebugImageInfoTableGuid, NULL },
|
||||
{ L"gEfiDxeServicesTableGuid", &gEfiDxeServicesTableGuid, PAGE_DXE_SERVICES_TABLE },
|
||||
{ L"gEfiHobListGuid", &gEfiHobListGuid, NULL },
|
||||
{ L"gEfiMemoryTypeInformationGuid", &gEfiMemoryTypeInformationGuid, NULL },
|
||||
{ L"gLoadFixedAddressConfigurationTableGuid", &gLoadFixedAddressConfigurationTableGuid, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
Display a row containing a GUID value
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] pGuid Address of the GUID to display
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RowGuid (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR8 * pName,
|
||||
IN CONST EFI_GUID * pGuid
|
||||
)
|
||||
{
|
||||
CONST GUID_NAME * pGuidName;
|
||||
CONST GUID_NAME * pGuidNameEnd;
|
||||
EFI_STATUS Status;
|
||||
UINTN Value;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td><td><code>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine if this is a known GUID
|
||||
//
|
||||
pGuidName = &mGuidName[0];
|
||||
pGuidNameEnd = &pGuidName [ sizeof ( mGuidName ) / sizeof ( mGuidName[0])];
|
||||
while ( pGuidNameEnd > pGuidName ) {
|
||||
if ( CompareGuid ( pGuidName->pGuid, pGuid )) {
|
||||
//
|
||||
// Display the web link if available
|
||||
//
|
||||
if ( NULL != pGuidName->pWebPage ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<a target=\"_blank\" href=\"" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pGuidName->pWebPage );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"\">" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Display the GUID name
|
||||
//
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pGuidName->GuidName );
|
||||
|
||||
//
|
||||
// Complete the web link if available
|
||||
//
|
||||
if ( NULL != pGuidName->pWebPage ) {
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</a>" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next GUID name
|
||||
//
|
||||
pGuidName += 1;
|
||||
}
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Only if the entry is not known, display the GUID and type
|
||||
//
|
||||
if ( pGuidNameEnd <= pGuidName ) {
|
||||
//
|
||||
// Display the GUID
|
||||
//
|
||||
Status = HttpSendGuid ( SocketFD,
|
||||
pPort,
|
||||
pGuid );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the GUID type
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<br/><a target=\"_blank\" href=\"http://www.ietf.org/rfc/rfc4122.txt\">Guid Type</a>: " );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Value = pGuid->Data4[1];
|
||||
Value >>= 5;
|
||||
if ( 3 >= Value ) {
|
||||
//
|
||||
// Network type
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Network " );
|
||||
}
|
||||
else if ( 5 >= Value ) {
|
||||
//
|
||||
// Standard type
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Standard " );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Decode the standard type using RFC 4122
|
||||
//
|
||||
Value = pGuid->Data3;
|
||||
Value >>= 12;
|
||||
switch ( Value ) {
|
||||
default:
|
||||
//
|
||||
// Display the MAC address
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Version " );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendValue ( SocketFD,
|
||||
pPort,
|
||||
pGuid->Data3 >> 12 );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"MAC address" );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"DCE Security" );
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"MD5 hash" );
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Random" );
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"SHA-1 hash" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( 6 == Value ) {
|
||||
//
|
||||
// Microsoft's Component Object Model (COM) type
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Microsoft COM" );
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Reserved type
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Reserved" );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Done with this entry
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Respond with the configuration tables
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConfigurationTablePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_CONFIGURATION_TABLE * pEnd;
|
||||
EFI_CONFIGURATION_TABLE * pTable;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the system table page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page and table header
|
||||
//
|
||||
Status = TableHeader ( SocketFD, pPort, L"Configuration Tables", gST );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the table size
|
||||
//
|
||||
Status = RowDecimalValue ( SocketFD,
|
||||
pPort,
|
||||
"Entries",
|
||||
gST->NumberOfTableEntries );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine the location of the configuration tables
|
||||
//
|
||||
pTable = gST->ConfigurationTable;
|
||||
pEnd = &pTable [ gST->NumberOfTableEntries ];
|
||||
while ( pEnd > pTable ) {
|
||||
Status = RowGuid ( SocketFD,
|
||||
pPort,
|
||||
"VendorGuid",
|
||||
&pTable->VendorGuid );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"VendorTable",
|
||||
(VOID *)pTable->VendorTable,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next row
|
||||
//
|
||||
pTable += 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = TableTrailer ( SocketFD,
|
||||
pPort,
|
||||
pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
235
AppPkg/Applications/Sockets/WebServer/DhcpOptions.c
Normal file
235
AppPkg/Applications/Sockets/WebServer/DhcpOptions.c
Normal file
@@ -0,0 +1,235 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the DHCP options
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
#include <Guid/DxeServices.h>
|
||||
#include <pi/PiDxeCis.h>
|
||||
|
||||
#include <protocol/Dhcp4.h>
|
||||
#include <protocol/ServiceBinding.h>
|
||||
|
||||
/**
|
||||
Respond with the DHCP options
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DhcpOptionsPage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
// EFI_HANDLE Dhcp4Handle;
|
||||
EFI_DHCP4_MODE_DATA Dhcp4Mode;
|
||||
UINTN HandleCount;
|
||||
EFI_DHCP4_PROTOCOL * pDhcp4;
|
||||
EFI_DHCP4_PACKET * pDhcp4Packet;
|
||||
EFI_HANDLE * pEnd;
|
||||
EFI_HANDLE * pHandle;
|
||||
// EFI_SERVICE_BINDING_PROTOCOL * pService;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the DHCP options
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page header
|
||||
//
|
||||
Status = HttpPageHeader ( SocketFD, pPort, L"DHCP Options" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the header
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<h1>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
L"DHCP Options" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</h1>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Attempt to locate DHCP clients
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer ( ByProtocol,
|
||||
// &gEfiDhcp4ServiceBindingProtocolGuid,
|
||||
&gEfiDhcp4ProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&pHandle );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"DHCP not in use" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Walk the list of handles
|
||||
//
|
||||
pEnd = &pHandle [ HandleCount ];
|
||||
while ( pEnd > pHandle ) {
|
||||
/*
|
||||
//
|
||||
// Get the DHCP service binding
|
||||
//
|
||||
Status = gBS->OpenProtocol ( *pHandle,
|
||||
&gEfiDhcp4ServiceBindingProtocolGuid,
|
||||
&pService,
|
||||
NULL,
|
||||
gImageHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Failed to open gEfiDhcp4ServiceBindingProtocolGuid" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the DHCP handle
|
||||
//
|
||||
Status = pService->CreateChild ( pService,
|
||||
&Dhcp4Handle );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Failed to create DHCP4 child" );
|
||||
}
|
||||
else {
|
||||
*/
|
||||
//
|
||||
// Get the DHCP protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol ( *pHandle,
|
||||
// Dhcp4Handle,
|
||||
&gEfiDhcp4ProtocolGuid,
|
||||
&pDhcp4,
|
||||
NULL,
|
||||
gImageHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Failed to open gEfiDhcp4ProtocolGuid" );
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Get the DHCP packet
|
||||
//
|
||||
Status = pDhcp4->GetModeData ( pDhcp4,
|
||||
&Dhcp4Mode );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"Failed to get DHCP4 mode" );
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Get the last packet
|
||||
//
|
||||
pDhcp4Packet = Dhcp4Mode.ReplyPacket;
|
||||
if ( NULL == pDhcp4Packet ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"No DHCP reply received!<br/>DHCP Mode:<br/>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the DHCP mode data
|
||||
//
|
||||
Status = HttpSendDump ( SocketFD,
|
||||
pPort,
|
||||
sizeof ( Dhcp4Mode ),
|
||||
(UINT8 *)&Dhcp4Mode );
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Display the DHCP packet
|
||||
//
|
||||
Status = HttpSendDump ( SocketFD,
|
||||
pPort,
|
||||
pDhcp4Packet->Length,
|
||||
(UINT8 *)&pDhcp4Packet->Dhcp4 );
|
||||
}
|
||||
}
|
||||
/*
|
||||
}
|
||||
|
||||
//
|
||||
// Done with the DHCP protocol
|
||||
//
|
||||
pService->DestroyChild ( pService,
|
||||
Dhcp4Handle );
|
||||
*/
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next service binding
|
||||
//
|
||||
pHandle += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page trailer
|
||||
//
|
||||
Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
245
AppPkg/Applications/Sockets/WebServer/DxeServicesTable.c
Normal file
245
AppPkg/Applications/Sockets/WebServer/DxeServicesTable.c
Normal file
@@ -0,0 +1,245 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the DXE services table
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
#include <Guid/DxeServices.h>
|
||||
#include <pi/PiDxeCis.h>
|
||||
|
||||
/**
|
||||
Respond with the DXE services table
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DxeServicesTablePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_DXE_SERVICES * pDS;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the DXE services page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Get the DXE services table
|
||||
//
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &pDS);
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page and table header
|
||||
//
|
||||
Status = TableHeader ( SocketFD, pPort, L"DXE Services Table", pDS );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The table header for the DXE Services Table.
|
||||
/// This header contains the DXE_SERVICES_SIGNATURE and DXE_SERVICES_REVISION values.
|
||||
///
|
||||
Status = EfiTableHeader ( SocketFD,
|
||||
pPort,
|
||||
&pDS->Hdr );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Global Coherency Domain Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"AddMemorySpace",
|
||||
(VOID *)pDS->AddMemorySpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"AllocateMemorySpace",
|
||||
(VOID *)pDS->AllocateMemorySpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"FreeMemorySpace",
|
||||
(VOID *)pDS->FreeMemorySpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"RemoveMemorySpace",
|
||||
(VOID *)pDS->RemoveMemorySpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetMemorySpaceDescriptor",
|
||||
(VOID *)pDS->GetMemorySpaceDescriptor,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetMemorySpaceAttributes",
|
||||
(VOID *)pDS->SetMemorySpaceAttributes,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetMemorySpaceMap",
|
||||
(VOID *)pDS->GetMemorySpaceMap,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"AddIoSpace",
|
||||
(VOID *)pDS->AddIoSpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"AllocateIoSpace",
|
||||
(VOID *)pDS->AllocateIoSpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"FreeIoSpace",
|
||||
(VOID *)pDS->FreeIoSpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"RemoveIoSpace",
|
||||
(VOID *)pDS->RemoveIoSpace,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetIoSpaceDescriptor",
|
||||
(VOID *)pDS->GetIoSpaceDescriptor,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetIoSpaceMap",
|
||||
(VOID *)pDS->GetIoSpaceMap,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Dispatcher Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"Dispatch",
|
||||
(VOID *)pDS->Dispatch,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"Schedule",
|
||||
(VOID *)pDS->Schedule,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"Trust",
|
||||
(VOID *)pDS->Trust,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Service to process a single firmware volume found in a capsule
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ProcessFirmwareVolume",
|
||||
(VOID *)pDS->ProcessFirmwareVolume,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = TableTrailer ( SocketFD,
|
||||
pPort,
|
||||
pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
106
AppPkg/Applications/Sockets/WebServer/Firmware.c
Normal file
106
AppPkg/Applications/Sockets/WebServer/Firmware.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the firmware
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
|
||||
/**
|
||||
Respond with the firmware status
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
FirmwarePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the system table page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page and table header
|
||||
//
|
||||
Status = TableHeader ( SocketFD, pPort, L"Firmware", NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the firmware vendor and revision
|
||||
//
|
||||
Status = RowUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
"Vendor",
|
||||
gST->FirmwareVendor );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
Status = RowRevision ( SocketFD,
|
||||
pPort,
|
||||
"Revision",
|
||||
gST->FirmwareRevision );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the UEFI version
|
||||
//
|
||||
Status = RowRevision ( SocketFD,
|
||||
pPort,
|
||||
"UEFI",
|
||||
gST->Hdr.Revision );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = TableTrailer ( SocketFD,
|
||||
pPort,
|
||||
pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
1570
AppPkg/Applications/Sockets/WebServer/HTTP.c
Normal file
1570
AppPkg/Applications/Sockets/WebServer/HTTP.c
Normal file
File diff suppressed because it is too large
Load Diff
294
AppPkg/Applications/Sockets/WebServer/Handles.c
Normal file
294
AppPkg/Applications/Sockets/WebServer/Handles.c
Normal file
@@ -0,0 +1,294 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the handles in the system
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
|
||||
/**
|
||||
Respond with the handles in the system
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
HandlePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
INTN Digit;
|
||||
INTN Entries;
|
||||
INTN Index;
|
||||
UINTN GuidCount;
|
||||
UINTN LengthInBytes;
|
||||
UINT8 * pDigit;
|
||||
EFI_HANDLE * pHandleArray;
|
||||
EFI_HANDLE * pHandle;
|
||||
EFI_HANDLE * pHandleEnd;
|
||||
EFI_GUID ** ppGuidArray;
|
||||
EFI_GUID ** ppGuid;
|
||||
EFI_GUID ** ppGuidEnd;
|
||||
INTN Shift;
|
||||
EFI_STATUS Status;
|
||||
UINTN Value;
|
||||
CONST UINTN cDigit [] = {
|
||||
3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the handles page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page header
|
||||
//
|
||||
Status = HttpPageHeader ( SocketFD, pPort, L"Handle Database" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table header
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<h1>Handle Database</h1>\r\n"
|
||||
"<table border=\"1\">\r\n"
|
||||
" <tr bgcolor=\"c0c0ff\"><th>Handle</th><th>Protocol Guids</th></tr>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine the number of handles in the database
|
||||
//
|
||||
LengthInBytes = 0;
|
||||
Status = gBS->LocateHandle ( AllHandles,
|
||||
NULL,
|
||||
NULL,
|
||||
&LengthInBytes,
|
||||
NULL );
|
||||
if ( EFI_BUFFER_TOO_SMALL == Status ) {
|
||||
//
|
||||
// Allocate space for the handles
|
||||
//
|
||||
Status = gBS->AllocatePool ( EfiRuntimeServicesData,
|
||||
LengthInBytes,
|
||||
(VOID **) &pHandleArray );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
//
|
||||
// Get the list of handles
|
||||
//
|
||||
Status = gBS->LocateHandle ( AllHandles,
|
||||
NULL,
|
||||
NULL,
|
||||
&LengthInBytes,
|
||||
pHandleArray );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
Entries = LengthInBytes / sizeof ( *pHandleArray );
|
||||
pHandle = pHandleArray;
|
||||
pHandleEnd = &pHandle [ Entries ];
|
||||
while ( pHandleEnd > pHandle ) {
|
||||
//
|
||||
// Build the table entry for this page
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td><code>0x" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Value = (UINTN) *pHandle;
|
||||
for ( Shift = ( sizeof ( Shift ) << 3 ) - 4; 0 <= Shift; Shift -= 4 ) {
|
||||
//
|
||||
// Convert the next address nibble to ANSI hex
|
||||
//
|
||||
Digit = (( Value >> Shift ) & 0xf ) | '0';
|
||||
if ( '9' < Digit ) {
|
||||
Digit += 'a' - '0' - 10;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the address digit
|
||||
//
|
||||
Status = HttpSendByte ( SocketFD,
|
||||
pPort,
|
||||
(UINT8) Digit );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Start the second column
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td><td><code>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine the number of protocols connected to this handle
|
||||
//
|
||||
Status = gBS->ProtocolsPerHandle ( *pHandle,
|
||||
&ppGuidArray,
|
||||
&GuidCount );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
ppGuid = ppGuidArray;
|
||||
ppGuidEnd = &ppGuid [ GuidCount ];
|
||||
while ( ppGuidEnd > ppGuid ) {
|
||||
//
|
||||
// Display the guid
|
||||
//
|
||||
pDigit = (UINT8 *) *ppGuid;
|
||||
for ( Index = 0; 16 > Index; Index++ ) {
|
||||
//
|
||||
// Separate the portions of the GUID
|
||||
// 99E87DCF-6162-40c5-9FA1-32111F5197F7
|
||||
//
|
||||
if (( 4 == Index )
|
||||
|| ( 6 == Index )
|
||||
|| ( 8 == Index )
|
||||
|| ( 10 == Index )) {
|
||||
Status = HttpSendByte ( SocketFD,
|
||||
pPort,
|
||||
'-' );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Display the GUID digits
|
||||
//
|
||||
Value = pDigit [ cDigit [ Index ]];
|
||||
for ( Shift = 4; 0 <= Shift; Shift -= 4 ) {
|
||||
//
|
||||
// Convert the next address nibble to ANSI hex
|
||||
//
|
||||
Digit = (( Value >> Shift ) & 0xf ) | '0';
|
||||
if ( '9' < Digit ) {
|
||||
Digit += 'a' - '0' - 10;
|
||||
}
|
||||
|
||||
//
|
||||
// Display the address digit
|
||||
//
|
||||
Status = HttpSendByte ( SocketFD,
|
||||
pPort,
|
||||
(UINT8) Digit );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Separate each GUID
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<br/>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next protocol
|
||||
//
|
||||
ppGuid+= 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Free the GUID array
|
||||
//
|
||||
gBS->FreePool ( ppGuidArray );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// End the row
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td></tr>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next handle
|
||||
//
|
||||
pHandle += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Done with the handle array
|
||||
//
|
||||
gBS->FreePool ( pHandleArray );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</table>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page trailer
|
||||
//
|
||||
Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
87
AppPkg/Applications/Sockets/WebServer/Hello.c
Normal file
87
AppPkg/Applications/Sockets/WebServer/Hello.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Hello World response page
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
|
||||
/**
|
||||
Respond with the Hello World page
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
HelloPage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the Hello World page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page header
|
||||
//
|
||||
Status = HttpPageHeader ( SocketFD, pPort, L"Hello World" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page body
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<h1>Hello World</h1>\r\n"
|
||||
"<p>\r\n"
|
||||
" This response was generated by the UEFI web server application.\r\n"
|
||||
"</p>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page trailer
|
||||
//
|
||||
Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
161
AppPkg/Applications/Sockets/WebServer/Index.c
Normal file
161
AppPkg/Applications/Sockets/WebServer/Index.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Generate the list of known pages.
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
|
||||
/**
|
||||
Respond with the list of known pages
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IndexPage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
CONST DT_PAGE * pPage;
|
||||
CONST DT_PAGE * pPageEnd;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the index page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page header
|
||||
//
|
||||
Status = HttpPageHeader ( SocketFD, pPort, L"Index" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table header
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<h1>UEFI Web Server</h1>\r\n"
|
||||
"<table border=\"1\">\r\n"
|
||||
" <tr bgcolor=\"c0c0ff\"><th>Page</th><th>Description</th></tr>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Walk the list of pages
|
||||
// Skip the first page
|
||||
//
|
||||
pPage = &mPageList[0];
|
||||
pPageEnd = &pPage[mPageCount];
|
||||
pPage += 1;
|
||||
while ( pPageEnd > pPage ) {
|
||||
//
|
||||
// Build the table entry for this page
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td><a target=\"_blank\" href=\"" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
&pPage->pPageName[1]);
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"\">" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
&pPage->pPageName[1]);
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</a></td><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pPage->pDescription );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td></tr>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next page
|
||||
//
|
||||
pPage += 1;
|
||||
}
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</table>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page trailer
|
||||
//
|
||||
Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
59
AppPkg/Applications/Sockets/WebServer/PageList.c
Normal file
59
AppPkg/Applications/Sockets/WebServer/PageList.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
List of pages to display
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
|
||||
/**
|
||||
List of pages in the system
|
||||
**/
|
||||
CONST DT_PAGE mPageList [] = {
|
||||
|
||||
//
|
||||
// The index page must be first
|
||||
//
|
||||
{ L"/", IndexPage, L"Index of pages" }, ///< List the pages
|
||||
|
||||
//
|
||||
// All other pages follow in alphabetical order
|
||||
//
|
||||
{ PAGE_BOOT_SERVICES_TABLE, BootServicesTablePage, L"Boot Services Table" }, ///< Format boot services table
|
||||
{ PAGE_CONFIGURATION_TABLE, ConfigurationTablePage, L"Configuration Table" }, ///< Format configuration table
|
||||
{ L"/DhcpOptions", DhcpOptionsPage, L"DHCP Options" }, ///< Display the DHCP options
|
||||
{ PAGE_ACPI_DSDT, AcpiDsdtPage, L"DSDT - Differentiated System Description Table" }, ///< Format DSDT
|
||||
{ PAGE_DXE_SERVICES_TABLE, DxeServicesTablePage, L"DXE Services Table" }, ///< Format DXE services table
|
||||
{ PAGE_ACPI_FADT, AcpiFadtPage, L"FADT - Fixed ACPI Description Table" }, ///< Format FADT
|
||||
{ L"/Firmware", FirmwarePage, L"Firmware" }, ///< Firmware status
|
||||
{ L"/Handles", HandlePage, L"Display handles and associated protocol GUIDs" }, ///< Handle database page
|
||||
{ L"/Hello", HelloPage, L"Hello World" }, ///< Hello world page
|
||||
{ L"/Reboot", RebootPage, L"Reboot the sytem" }, ///< Reboot page
|
||||
{ PAGE_ACPI_RSDP_10B, AcpiRsdp10Page, L"RSDP 1.0b - ACPI Root System Description Pointer" }, ///< Format RSDP 1.0b table
|
||||
{ PAGE_ACPI_RSDP_30, AcpiRsdp30Page, L"RSDP 3.0 - ACPI Root System Description Pointer" }, ///< Format RSDP 3.0 table
|
||||
{ PAGE_ACPI_RSDT, AcpiRsdtPage, L"RSDT - ACPI Root System Description Table" }, ///< Format RSDT
|
||||
{ PAGE_RUNTIME_SERVICES_TABLE, RuntimeSservicesTablePage, L"Runtime Services Table" },///< Format runtime services table
|
||||
{ L"/SystemTable", SystemTablePage, L"System Table" } ///< Format system table
|
||||
};
|
||||
|
||||
CONST UINTN mPageCount = DIM ( mPageList );
|
105
AppPkg/Applications/Sockets/WebServer/Reboot.c
Normal file
105
AppPkg/Applications/Sockets/WebServer/Reboot.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Reboot the system
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
|
||||
|
||||
/**
|
||||
Page to reboot the system
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RebootPage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the Hello World page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page header
|
||||
//
|
||||
Status = HttpPageHeader ( SocketFD, pPort, L"Reboot" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page body
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<h1>Reboot</h1>\r\n"
|
||||
"<p>\r\n"
|
||||
" Ouch! The system is rebooting!\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page trailer
|
||||
//
|
||||
Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Deliver the data to the remote system by
|
||||
// closing the socket
|
||||
//
|
||||
close ( SocketFD );
|
||||
|
||||
//
|
||||
// Attempt to reboot the system
|
||||
//
|
||||
DEBUG (( DEBUG_REQUEST, "Reseting System\r\n" ));
|
||||
gRT->ResetSystem ( EfiResetCold,
|
||||
EFI_SUCCESS,
|
||||
0,
|
||||
NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
227
AppPkg/Applications/Sockets/WebServer/RuntimeServicesTable.c
Normal file
227
AppPkg/Applications/Sockets/WebServer/RuntimeServicesTable.c
Normal file
@@ -0,0 +1,227 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the runtime services table
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
|
||||
/**
|
||||
Respond with the runtime services table
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RuntimeSservicesTablePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the runtime services page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page and table header
|
||||
//
|
||||
Status = TableHeader ( SocketFD, pPort, L"Runtime Services Table", gRT );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The table header for the EFI Runtime Services Table.
|
||||
///
|
||||
Status = EfiTableHeader ( SocketFD,
|
||||
pPort,
|
||||
&gRT->Hdr );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Time Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetTime",
|
||||
(VOID *)gRT->GetTime,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetTime",
|
||||
(VOID *)gRT->SetTime,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetWakeupTime",
|
||||
(VOID *)gRT->GetWakeupTime,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetWakeupTime",
|
||||
(VOID *)gRT->SetWakeupTime,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Virtual Memory Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetVirtualAddressMap",
|
||||
(VOID *)gRT->SetVirtualAddressMap,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConvertPointer",
|
||||
(VOID *)gRT->ConvertPointer,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Variable Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetVariable",
|
||||
(VOID *)gRT->GetVariable,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetNextVariableName",
|
||||
(VOID *)gRT->GetNextVariableName,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"SetVariable",
|
||||
(VOID *)gRT->SetVariable,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Miscellaneous Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"GetNextHighNonotonicCount",
|
||||
(VOID *)gRT->GetNextHighMonotonicCount,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ResetSystem",
|
||||
(VOID *)gRT->ResetSystem,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine if the structures supports 2.0 services
|
||||
//
|
||||
if ( 2 <= ( gRT->Hdr.Revision >> 16 )) {
|
||||
//
|
||||
// UEFI 2.0 Capsule Services
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"UpdateCapsule",
|
||||
(VOID *)gRT->UpdateCapsule,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"QueryCapsuleCapabilities",
|
||||
(VOID *)gRT->QueryCapsuleCapabilities,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Miscellaneous UEFI 2.0 Service
|
||||
//
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"QueryVariableInfo",
|
||||
(VOID *)gRT->QueryVariableInfo,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = TableTrailer ( SocketFD,
|
||||
pPort,
|
||||
pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
863
AppPkg/Applications/Sockets/WebServer/SystemTable.c
Normal file
863
AppPkg/Applications/Sockets/WebServer/SystemTable.c
Normal file
@@ -0,0 +1,863 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
Display the system table
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
|
||||
/**
|
||||
Display the EFI Table Header
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pHeader Address of the EFI_TABLE_HEADER structure
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EfiTableHeader (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN EFI_TABLE_HEADER * pHeader
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the handles page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
///
|
||||
/// A 64-bit signature that identifies the type of table that follows.
|
||||
/// Unique signatures have been generated for the EFI System Table,
|
||||
/// the EFI Boot Services Table, and the EFI Runtime Services Table.
|
||||
///
|
||||
Status = RowHexValue ( SocketFD,
|
||||
pPort,
|
||||
"Hdr.Signature",
|
||||
pHeader->Signature,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The revision of the EFI Specification to which this table
|
||||
/// conforms. The upper 16 bits of this field contain the major
|
||||
/// revision value, and the lower 16 bits contain the minor revision
|
||||
/// value. The minor revision values are limited to the range of 00..99.
|
||||
///
|
||||
Status = RowRevision ( SocketFD,
|
||||
pPort,
|
||||
"Hdr.Revision",
|
||||
pHeader->Revision );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
|
||||
///
|
||||
Status = RowDecimalValue ( SocketFD,
|
||||
pPort,
|
||||
"Hdr.HeaderSize",
|
||||
pHeader->HeaderSize );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The 32-bit CRC for the entire table. This value is computed by
|
||||
/// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
|
||||
///
|
||||
Status = RowHexValue ( SocketFD,
|
||||
pPort,
|
||||
"Hdr.CRC",
|
||||
pHeader->CRC32,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// Reserved field that must be set to 0.
|
||||
///
|
||||
Status = RowHexValue ( SocketFD,
|
||||
pPort,
|
||||
"Hdr.Reserved",
|
||||
pHeader->Reserved,
|
||||
NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Display a row containing a decimal value
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] Value The value to display
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RowDecimalValue (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR8 * pName,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td><td><code>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendValue ( SocketFD,
|
||||
pPort,
|
||||
Value );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Display a row containing a hex value
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] Value The value to display
|
||||
@param [in] pWebPage Address of a zero terminated web page name
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RowHexValue (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR8 * pName,
|
||||
IN UINT64 Value,
|
||||
IN CONST CHAR16 * pWebPage
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td><td><code>0x" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
if ( NULL != pWebPage ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<a target=\"_blank\" href=\"" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pWebPage );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"\">" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Status = HttpSendHexValue ( SocketFD,
|
||||
pPort,
|
||||
Value );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
if ( NULL != pWebPage ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</a>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Display a row containing a pointer
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] pAddress The address to display
|
||||
@param [in] pWebPage Address of a zero terminated web page name
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RowPointer (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR8 * pName,
|
||||
IN CONST VOID * pAddress,
|
||||
IN CONST CHAR16 * pWebPage
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td><td><code>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
if ( NULL != pWebPage ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<a target=\"_blank\" href=\"" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pWebPage );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"\">" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"0x" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendHexBits ( SocketFD,
|
||||
pPort,
|
||||
sizeof ( pAddress ) * 8,
|
||||
(UINT64) pAddress );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
if ( NULL != pWebPage ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</a>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Display a row containing a revision
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] Revision The revision to display
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RowRevision (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR8 * pName,
|
||||
IN UINT32 Revision
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td><td><code>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendValue ( SocketFD,
|
||||
pPort,
|
||||
Revision >> 16 );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendByte ( SocketFD,
|
||||
pPort,
|
||||
'.' );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendValue ( SocketFD,
|
||||
pPort,
|
||||
Revision & 0xFFFF );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</code></td></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Display a row containing a unicode string
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] pString Address of a zero terminated unicode string
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RowUnicodeString (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR8 * pName,
|
||||
IN CONST CHAR16 * pString
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<tr><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td><td>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pString );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</td></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Start the table page
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [in] pName Address of a zero terminated name string
|
||||
@param [in] pTable Address of the table
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
TableHeader (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
IN CONST CHAR16 * pName,
|
||||
IN CONST VOID * pTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page header
|
||||
//
|
||||
Status = HttpPageHeader ( SocketFD, pPort, pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table header
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"<h1>" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
pName );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
if ( NULL != pTable ) {
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
": 0x" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
Status = HttpSendHexBits ( SocketFD,
|
||||
pPort,
|
||||
sizeof ( pTable ) * 8,
|
||||
(UINT64)pTable );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</h1>\r\n"
|
||||
"<table border=\"1\">\r\n"
|
||||
" <tr bgcolor=\"c0c0ff\"><th>Field Name</th><th>Value</th></tr>\r\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
End the table page
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
TableTrailer (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN *pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = HttpSendAnsiString ( SocketFD,
|
||||
pPort,
|
||||
"</table>\r\n" );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Send the page trailer
|
||||
//
|
||||
Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Respond with the system table
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
@param [in] pPort The WSDT_PORT structure address
|
||||
@param [out] pbDone Address to receive the request completion status
|
||||
|
||||
@retval EFI_SUCCESS The request was successfully processed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SystemTablePage (
|
||||
IN int SocketFD,
|
||||
IN WSDT_PORT * pPort,
|
||||
OUT BOOLEAN * pbDone
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Send the system table page
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Send the page and table header
|
||||
//
|
||||
Status = TableHeader ( SocketFD, pPort, L"System Table", gST );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The table header for the EFI System Table.
|
||||
///
|
||||
Status = EfiTableHeader ( SocketFD,
|
||||
pPort,
|
||||
&gST->Hdr );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A pointer to a null terminated string that identifies the vendor
|
||||
/// that produces the system firmware for the platform.
|
||||
///
|
||||
Status = RowUnicodeString ( SocketFD,
|
||||
pPort,
|
||||
"FirmwareVendor",
|
||||
gST->FirmwareVendor );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A firmware vendor specific value that identifies the revision
|
||||
/// of the system firmware for the platform.
|
||||
///
|
||||
Status = RowRevision ( SocketFD,
|
||||
pPort,
|
||||
"FirmwareRevision",
|
||||
gST->FirmwareRevision );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The handle for the active console input device. This handle must support
|
||||
/// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConsoleInHandle",
|
||||
(VOID *)gST->ConsoleInHandle,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
|
||||
/// associated with ConsoleInHandle.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConIn",
|
||||
(VOID *)gST->ConIn,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The handle for the active console output device.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConsoleOutHandle",
|
||||
(VOID *)gST->ConsoleOutHandle,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
|
||||
/// that is associated with ConsoleOutHandle.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConOut",
|
||||
(VOID *)gST->ConOut,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The handle for the active standard error console device.
|
||||
/// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"StandardErrorHandle",
|
||||
(VOID *)gST->StandardErrorHandle,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
|
||||
/// that is associated with StandardErrorHandle.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"StdErr",
|
||||
(VOID *)gST->StdErr,
|
||||
NULL );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A pointer to the EFI Runtime Services Table.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"RuntimeServices",
|
||||
(VOID *)gST->RuntimeServices,
|
||||
PAGE_RUNTIME_SERVICES_TABLE );
|
||||
|
||||
///
|
||||
/// A pointer to the EFI Boot Services Table.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"BootServices",
|
||||
(VOID *)gST->BootServices,
|
||||
PAGE_BOOT_SERVICES_TABLE );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// The number of system configuration tables in the buffer ConfigurationTable.
|
||||
///
|
||||
Status = RowDecimalValue ( SocketFD,
|
||||
pPort,
|
||||
"NumberOfTableEntries",
|
||||
gST->NumberOfTableEntries );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
///
|
||||
/// A pointer to the system configuration tables.
|
||||
/// The number of entries in the table is NumberOfTableEntries.
|
||||
///
|
||||
Status = RowPointer ( SocketFD,
|
||||
pPort,
|
||||
"ConfigurationTable",
|
||||
(VOID *)gST->ConfigurationTable,
|
||||
PAGE_CONFIGURATION_TABLE );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Build the table trailer
|
||||
//
|
||||
Status = TableTrailer ( SocketFD,
|
||||
pPort,
|
||||
pbDone );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
853
AppPkg/Applications/Sockets/WebServer/WebServer.c
Normal file
853
AppPkg/Applications/Sockets/WebServer/WebServer.c
Normal file
@@ -0,0 +1,853 @@
|
||||
/*++
|
||||
This file contains an 'Intel UEFI Application' and is
|
||||
licensed for Intel CPUs and chipsets under the terms of your
|
||||
license agreement with Intel or your vendor. This file may
|
||||
be modified by the user, subject to additional terms of the
|
||||
license agreement
|
||||
--*/
|
||||
/*++
|
||||
|
||||
Copyright (c) 2011 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
--*/
|
||||
|
||||
/** @file
|
||||
This is a simple shell application
|
||||
|
||||
This should be executed with "/Param2 Val1" and "/Param1" as the 2 command line options!
|
||||
|
||||
**/
|
||||
|
||||
#include <WebServer.h>
|
||||
|
||||
DT_WEB_SERVER mWebServer; ///< Web server's control structure
|
||||
|
||||
|
||||
/**
|
||||
Add a port to the list of ports to be polled.
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
|
||||
@retval EFI_SUCCESS The port was successfully added
|
||||
@retval EFI_NO_RESOURCES Insufficient memory to add the port
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PortAdd (
|
||||
IN DT_WEB_SERVER * pWebServer,
|
||||
IN int SocketFD
|
||||
)
|
||||
{
|
||||
nfds_t Index;
|
||||
size_t LengthInBytes;
|
||||
nfds_t MaxEntries;
|
||||
nfds_t MaxEntriesNew;
|
||||
struct pollfd * pFdList;
|
||||
struct pollfd * pFdListNew;
|
||||
WSDT_PORT ** ppPortListNew;
|
||||
WSDT_PORT * pPort;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Use for/break instead of goto
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Assume success
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Create a new list if necessary
|
||||
//
|
||||
pFdList = pWebServer->pFdList;
|
||||
MaxEntries = pWebServer->MaxEntries;
|
||||
if ( pWebServer->Entries >= MaxEntries ) {
|
||||
MaxEntriesNew = 16 + MaxEntries;
|
||||
|
||||
//
|
||||
// The current FD list is full
|
||||
// Allocate a new FD list
|
||||
//
|
||||
LengthInBytes = sizeof ( *pFdList ) * MaxEntriesNew;
|
||||
Status = gBS->AllocatePool ( EfiRuntimeServicesData,
|
||||
LengthInBytes,
|
||||
(VOID **)&pFdListNew );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_POOL,
|
||||
"ERROR - Failed to allocate the FD list, Status: %r\r\n",
|
||||
Status ));
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate a new port list
|
||||
//
|
||||
LengthInBytes = sizeof ( *ppPortListNew ) * MaxEntriesNew;
|
||||
Status = gBS->AllocatePool ( EfiRuntimeServicesData,
|
||||
LengthInBytes,
|
||||
(VOID **) &ppPortListNew );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_POOL,
|
||||
"ERROR - Failed to allocate the port list, Status: %r\r\n",
|
||||
Status ));
|
||||
|
||||
//
|
||||
// Free the new FD list
|
||||
//
|
||||
gBS->FreePool ( pFdListNew );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Duplicate the FD list
|
||||
//
|
||||
Index = MaxEntries;
|
||||
if ( NULL != pFdList ) {
|
||||
CopyMem ( pFdListNew,
|
||||
pFdList,
|
||||
Index * sizeof ( *pFdList ));
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the new entries in the FD list
|
||||
//
|
||||
for ( ; MaxEntriesNew > Index; Index++ ) {
|
||||
pFdListNew [ Index ].fd = -1;
|
||||
pFdListNew [ Index ].events = 0;
|
||||
pFdListNew [ Index ].revents = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Free the old FD list
|
||||
//
|
||||
if ( NULL != pFdList ) {
|
||||
gBS->FreePool ( pFdList );
|
||||
}
|
||||
|
||||
//
|
||||
// Switch to the new FD list
|
||||
//
|
||||
pWebServer->pFdList = pFdListNew;
|
||||
pFdList = pWebServer->pFdList;
|
||||
|
||||
//
|
||||
// Duplicate the port list
|
||||
//
|
||||
Index = MaxEntries;
|
||||
if ( NULL != pWebServer->ppPortList ) {
|
||||
CopyMem ( ppPortListNew,
|
||||
pWebServer->ppPortList,
|
||||
Index * sizeof ( *ppPortListNew ));
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the new entries in the port list
|
||||
//
|
||||
for ( ; MaxEntriesNew > Index; Index++ ) {
|
||||
ppPortListNew [ Index ] = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Free the old port list
|
||||
//
|
||||
if ( NULL != pWebServer->ppPortList ) {
|
||||
gBS->FreePool ( pWebServer->ppPortList );
|
||||
}
|
||||
|
||||
//
|
||||
// Switch to the new port list
|
||||
//
|
||||
pWebServer->ppPortList = ppPortListNew;
|
||||
|
||||
//
|
||||
// Update the list size
|
||||
//
|
||||
pWebServer->MaxEntries = MaxEntriesNew;
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate a new port
|
||||
//
|
||||
LengthInBytes = sizeof ( *pPort );
|
||||
Status = gBS->AllocatePool ( EfiRuntimeServicesData,
|
||||
LengthInBytes,
|
||||
(VOID **)&pPort );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_POOL,
|
||||
"ERROR - Failed to allocate the port, Status: %r\r\n",
|
||||
Status ));
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the port
|
||||
//
|
||||
pPort->RequestLength = 0;
|
||||
pPort->TxBytes = 0;
|
||||
|
||||
//
|
||||
// Add the socket to the FD list
|
||||
//
|
||||
pFdList [ pWebServer->Entries ].fd = SocketFD;
|
||||
pFdList [ pWebServer->Entries ].events = POLLRDNORM
|
||||
| POLLHUP;
|
||||
pFdList [ pWebServer->Entries ].revents = 0;
|
||||
|
||||
//
|
||||
// Add the port to the port list
|
||||
//
|
||||
pWebServer->ppPortList [ pWebServer->Entries ] = pPort;
|
||||
|
||||
//
|
||||
// Account for the new entry
|
||||
//
|
||||
pWebServer->Entries += 1;
|
||||
DEBUG (( DEBUG_PORT_WORK | DEBUG_INFO,
|
||||
"WebServer handling %d ports\r\n",
|
||||
pWebServer->Entries ));
|
||||
|
||||
//
|
||||
// All done
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove a port from the list of ports to be polled.
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
|
||||
**/
|
||||
VOID
|
||||
PortRemove (
|
||||
IN DT_WEB_SERVER * pWebServer,
|
||||
IN int SocketFD
|
||||
)
|
||||
{
|
||||
nfds_t Entries;
|
||||
nfds_t Index;
|
||||
struct pollfd * pFdList;
|
||||
WSDT_PORT ** ppPortList;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Attempt to remove the entry from the list
|
||||
//
|
||||
Entries = pWebServer->Entries;
|
||||
pFdList = pWebServer->pFdList;
|
||||
ppPortList = pWebServer->ppPortList;
|
||||
for ( Index = 0; Entries > Index; Index++ ) {
|
||||
//
|
||||
// Locate the specified socket file descriptor
|
||||
//
|
||||
if ( SocketFD == pFdList [ Index ].fd ) {
|
||||
//
|
||||
// Determine if this is the listen port
|
||||
//
|
||||
if ( SocketFD == pWebServer->HttpListenPort ) {
|
||||
pWebServer->HttpListenPort = -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Close the socket
|
||||
//
|
||||
close ( SocketFD );
|
||||
|
||||
//
|
||||
// Free the port structure
|
||||
//
|
||||
gBS->FreePool ( ppPortList [ Index ]);
|
||||
|
||||
//
|
||||
// Remove this port from the list by copying
|
||||
// the rest of the list down one entry
|
||||
//
|
||||
Entries -= 1;
|
||||
for ( ; Entries > Index; Index++ ) {
|
||||
pFdList [ Index ] = pFdList [ Index + 1 ];
|
||||
ppPortList [ Index ] = ppPortList [ Index + 1 ];
|
||||
}
|
||||
pFdList [ Index ].fd = -1;
|
||||
pFdList [ Index ].events = 0;
|
||||
pFdList [ Index ].revents = 0;
|
||||
ppPortList [ Index ] = NULL;
|
||||
|
||||
//
|
||||
// Update the number of entries in the list
|
||||
//
|
||||
pWebServer->Entries = Entries;
|
||||
DEBUG (( DEBUG_PORT_WORK | DEBUG_INFO,
|
||||
"WebServer handling %d ports\r\n",
|
||||
pWebServer->Entries ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DBG_EXIT ( );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process the work for the sockets.
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
@param [in] SocketFD The socket's file descriptor to add to the list.
|
||||
|
||||
@param [in] events everts is a bitmask of the work to be done
|
||||
|
||||
@param [in] pPort The address of a WSDT_PORT structure
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful
|
||||
@retval EFI_DEVICE_ERROR Error, close the port
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PortWork (
|
||||
IN DT_WEB_SERVER * pWebServer,
|
||||
IN int SocketFD,
|
||||
IN INTN events,
|
||||
IN WSDT_PORT * pPort
|
||||
)
|
||||
{
|
||||
BOOLEAN bDone;
|
||||
size_t LengthInBytes;
|
||||
int NewSocket;
|
||||
EFI_STATUS OpStatus;
|
||||
struct sockaddr RemoteAddress;
|
||||
socklen_t RemoteAddressLength;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG (( DEBUG_PORT_WORK, "Entering PortWork\r\n" ));
|
||||
|
||||
//
|
||||
// Assume success
|
||||
//
|
||||
OpStatus = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Handle input events
|
||||
//
|
||||
if ( 0 != ( events & POLLRDNORM )) {
|
||||
//
|
||||
// Determine if this is a connection attempt
|
||||
//
|
||||
if ( SocketFD == pWebServer->HttpListenPort ) {
|
||||
//
|
||||
// Handle connection attempts
|
||||
// Accepts arrive as read events
|
||||
//
|
||||
RemoteAddressLength = sizeof ( RemoteAddress );
|
||||
NewSocket = accept ( SocketFD,
|
||||
&RemoteAddress,
|
||||
&RemoteAddressLength );
|
||||
if ( -1 != NewSocket ) {
|
||||
if ( 0 != NewSocket ) {
|
||||
//
|
||||
// Add this port to the list monitored by the web server
|
||||
//
|
||||
Status = PortAdd ( pWebServer, NewSocket );
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
DEBUG (( DEBUG_ERROR,
|
||||
"ERROR - Failed to add the port 0x%08x, Status: %r\r\n",
|
||||
NewSocket,
|
||||
Status ));
|
||||
|
||||
//
|
||||
// Done with the new socket
|
||||
//
|
||||
close ( NewSocket );
|
||||
}
|
||||
}
|
||||
else {
|
||||
DEBUG (( DEBUG_ERROR,
|
||||
"ERROR - Socket not available!\r\n" ));
|
||||
}
|
||||
|
||||
//
|
||||
// Leave the listen port open
|
||||
//
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Listen port error
|
||||
// Close the listen port by returning error status
|
||||
//
|
||||
OpStatus = EFI_DEVICE_ERROR;
|
||||
DEBUG (( DEBUG_ERROR,
|
||||
"ERROR - Failed to accept new connection, errno: 0x%08x\r\n",
|
||||
errno ));
|
||||
}
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Handle the data received event
|
||||
//
|
||||
if ( 0 == pPort->RequestLength ) {
|
||||
//
|
||||
// Receive the page request
|
||||
//
|
||||
pPort->RequestLength = recv ( SocketFD,
|
||||
&pPort->Request[0],
|
||||
DIM ( pPort->Request ),
|
||||
0 );
|
||||
if ( -1 == pPort->RequestLength ) {
|
||||
//
|
||||
// Receive error detected
|
||||
// Close the port
|
||||
//
|
||||
OpStatus = EFI_DEVICE_ERROR;
|
||||
}
|
||||
else {
|
||||
DEBUG (( DEBUG_REQUEST,
|
||||
"0x%08x: Socket - Received %d bytes of HTTP request\r\n",
|
||||
SocketFD,
|
||||
pPort->RequestLength ));
|
||||
|
||||
//
|
||||
// Process the request
|
||||
//
|
||||
OpStatus = HttpRequest ( SocketFD, pPort, &bDone );
|
||||
if ( bDone ) {
|
||||
//
|
||||
// Notify the upper layer to close the socket
|
||||
//
|
||||
OpStatus = EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Receive the file data
|
||||
//
|
||||
LengthInBytes = recv ( SocketFD,
|
||||
&pPort->RxBuffer[0],
|
||||
DIM ( pPort->RxBuffer ),
|
||||
0 );
|
||||
if ( -1 == LengthInBytes ) {
|
||||
//
|
||||
// Receive error detected
|
||||
// Close the port
|
||||
//
|
||||
OpStatus = EFI_DEVICE_ERROR;
|
||||
}
|
||||
else {
|
||||
DEBUG (( DEBUG_REQUEST,
|
||||
"0x%08x: Socket - Received %d bytes of file data\r\n",
|
||||
SocketFD,
|
||||
LengthInBytes ));
|
||||
|
||||
//
|
||||
// TODO: Process the file data
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle the close event
|
||||
//
|
||||
if ( 0 != ( events & POLLHUP )) {
|
||||
//
|
||||
// Close the port
|
||||
//
|
||||
OpStatus = EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DEBUG (( DEBUG_PORT_WORK,
|
||||
"Exiting PortWork, Status: %r\r\n",
|
||||
OpStatus ));
|
||||
return OpStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Scan the list of sockets and process any pending work
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SocketPoll (
|
||||
IN DT_WEB_SERVER * pWebServer
|
||||
)
|
||||
{
|
||||
int FDCount;
|
||||
struct pollfd * pPoll;
|
||||
WSDT_PORT ** ppPort;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG (( DEBUG_SOCKET_POLL, "Entering SocketPoll\r\n" ));
|
||||
|
||||
//
|
||||
// Determine if any ports are active
|
||||
//
|
||||
FDCount = poll ( pWebServer->pFdList,
|
||||
pWebServer->Entries,
|
||||
CLIENT_POLL_DELAY );
|
||||
if ( -1 == FDCount ) {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_SOCKET_POLL,
|
||||
"ERROR - errno: %d\r\n",
|
||||
errno ));
|
||||
}
|
||||
|
||||
pPoll = pWebServer->pFdList;
|
||||
ppPort = pWebServer->ppPortList;
|
||||
while ( 0 < FDCount ) {
|
||||
//
|
||||
// Walk the list of ports to determine what work needs to be done
|
||||
//
|
||||
if ( 0 != pPoll->revents ) {
|
||||
//
|
||||
// Process this port
|
||||
//
|
||||
Status = PortWork ( pWebServer,
|
||||
pPoll->fd,
|
||||
pPoll->revents,
|
||||
*ppPort );
|
||||
pPoll->revents = 0;
|
||||
|
||||
//
|
||||
// Close the port if necessary
|
||||
//
|
||||
if ( EFI_ERROR ( Status )) {
|
||||
PortRemove ( pWebServer, pPoll->fd );
|
||||
pPoll -= 1;
|
||||
ppPort -= 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Account for this file descriptor
|
||||
//
|
||||
FDCount -= 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the next port
|
||||
//
|
||||
pPoll += 1;
|
||||
ppPort += 1;
|
||||
}
|
||||
|
||||
DEBUG (( DEBUG_SOCKET_POLL, "Exiting SocketPoll\r\n" ));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create the HTTP port for the web server
|
||||
|
||||
This routine polls the network layer to create the HTTP port for the
|
||||
web server. More than one attempt may be necessary since it may take
|
||||
some time to get the IP address and initialize the upper layers of
|
||||
the network stack.
|
||||
|
||||
After the HTTP port is created, the socket layer will manage the
|
||||
coming and going of the network connections until the last network
|
||||
connection is broken.
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
**/
|
||||
VOID
|
||||
WebServerTimer (
|
||||
IN DT_WEB_SERVER * pWebServer
|
||||
)
|
||||
{
|
||||
UINT16 HttpPort;
|
||||
struct sockaddr_in WebServerAddress;
|
||||
int SocketStatus;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG (( DEBUG_SERVER_TIMER, "Entering WebServerTimer\r\n" ));
|
||||
|
||||
//
|
||||
// Open the HTTP port on the server
|
||||
//
|
||||
do {
|
||||
do {
|
||||
//
|
||||
// Complete the client operations
|
||||
//
|
||||
SocketPoll ( pWebServer );
|
||||
|
||||
//
|
||||
// Wait for a while
|
||||
//
|
||||
Status = gBS->CheckEvent ( pWebServer->TimerEvent );
|
||||
} while ( EFI_SUCCESS != Status );
|
||||
|
||||
//
|
||||
// Attempt to create the socket for the web server
|
||||
//
|
||||
pWebServer->HttpListenPort = socket ( AF_INET,
|
||||
SOCK_STREAM,
|
||||
IPPROTO_TCP );
|
||||
if ( -1 != pWebServer->HttpListenPort )
|
||||
{
|
||||
//
|
||||
// Set the socket address
|
||||
//
|
||||
ZeroMem ( &WebServerAddress, sizeof ( WebServerAddress ));
|
||||
HttpPort = PcdGet16 ( WebServer_HttpPort );
|
||||
DEBUG (( DEBUG_HTTP_PORT,
|
||||
"HTTP Port: %d\r\n",
|
||||
HttpPort ));
|
||||
WebServerAddress.sin_len = sizeof ( WebServerAddress );
|
||||
WebServerAddress.sin_family = AF_INET;
|
||||
WebServerAddress.sin_addr.s_addr = INADDR_ANY;
|
||||
WebServerAddress.sin_port = htons ( HttpPort );
|
||||
|
||||
//
|
||||
// Bind the socket to the HTTP port
|
||||
//
|
||||
SocketStatus = bind ( pWebServer->HttpListenPort,
|
||||
(struct sockaddr *) &WebServerAddress,
|
||||
WebServerAddress.sin_len );
|
||||
if ( -1 != SocketStatus ) {
|
||||
//
|
||||
// Enable connections to the HTTP port
|
||||
//
|
||||
SocketStatus = listen ( pWebServer->HttpListenPort,
|
||||
SOMAXCONN );
|
||||
}
|
||||
|
||||
//
|
||||
// Release the socket if necessary
|
||||
//
|
||||
if ( -1 == SocketStatus ) {
|
||||
close ( pWebServer->HttpListenPort );
|
||||
pWebServer->HttpListenPort = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Wait until the socket is open
|
||||
//
|
||||
}while ( -1 == pWebServer->HttpListenPort );
|
||||
|
||||
DEBUG (( DEBUG_SERVER_TIMER, "Exiting WebServerTimer\r\n" ));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Start the web server port creation timer
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
@retval EFI_SUCCESS The timer was successfully started.
|
||||
@retval EFI_ALREADY_STARTED The timer is already running.
|
||||
@retval Other The timer failed to start.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
WebServerTimerStart (
|
||||
IN DT_WEB_SERVER * pWebServer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 TriggerTime;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Assume the timer is already running
|
||||
//
|
||||
Status = EFI_ALREADY_STARTED;
|
||||
if ( !pWebServer->bTimerRunning ) {
|
||||
//
|
||||
// Compute the poll interval
|
||||
//
|
||||
TriggerTime = HTTP_PORT_POLL_DELAY * ( 1000 * 10 );
|
||||
Status = gBS->SetTimer ( pWebServer->TimerEvent,
|
||||
TimerPeriodic,
|
||||
TriggerTime );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
DEBUG (( DEBUG_HTTP_PORT, "HTTP port timer started\r\n" ));
|
||||
|
||||
//
|
||||
// Mark the timer running
|
||||
//
|
||||
pWebServer->bTimerRunning = TRUE;
|
||||
}
|
||||
else {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_HTTP_PORT,
|
||||
"ERROR - Failed to start HTTP port timer, Status: %r\r\n",
|
||||
Status ));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Stop the web server port creation timer
|
||||
|
||||
@param [in] pWebServer The web server control structure address.
|
||||
|
||||
@retval EFI_SUCCESS The HTTP port timer is stopped
|
||||
@retval Other Failed to stop the HTTP port timer
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
WebServerTimerStop (
|
||||
IN DT_WEB_SERVER * pWebServer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DBG_ENTER ( );
|
||||
|
||||
//
|
||||
// Assume the timer is stopped
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
if ( pWebServer->bTimerRunning ) {
|
||||
//
|
||||
// Stop the port creation polling
|
||||
//
|
||||
Status = gBS->SetTimer ( pWebServer->TimerEvent,
|
||||
TimerCancel,
|
||||
0 );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
DEBUG (( DEBUG_HTTP_PORT, "HTTP port timer stopped\r\n" ));
|
||||
|
||||
//
|
||||
// Mark the timer stopped
|
||||
//
|
||||
pWebServer->bTimerRunning = FALSE;
|
||||
}
|
||||
else {
|
||||
DEBUG (( DEBUG_ERROR | DEBUG_HTTP_PORT,
|
||||
"ERROR - Failed to stop HTTP port timer, Status: %r\r\n",
|
||||
Status ));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return the operation status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Entry point for the web server application.
|
||||
|
||||
@param [in] Argc The number of arguments
|
||||
@param [in] Argv The argument value array
|
||||
|
||||
@retval 0 The application exited normally.
|
||||
@retval Other An error occurred.
|
||||
**/
|
||||
int
|
||||
main (
|
||||
IN int Argc,
|
||||
IN char **Argv
|
||||
)
|
||||
{
|
||||
DT_WEB_SERVER * pWebServer;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Create a timer event to start HTTP port
|
||||
//
|
||||
pWebServer = &mWebServer;
|
||||
Status = gBS->CreateEvent ( EVT_TIMER,
|
||||
TPL_WEB_SERVER,
|
||||
NULL,
|
||||
NULL,
|
||||
&pWebServer->TimerEvent );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
Status = WebServerTimerStart ( pWebServer );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
//
|
||||
// Run the web server forever
|
||||
//
|
||||
for ( ; ; ) {
|
||||
//
|
||||
// Poll the network layer to create the HTTP port
|
||||
// for the web server. More than one attempt may
|
||||
// be necessary since it may take some time to get
|
||||
// the IP address and initialize the upper layers
|
||||
// of the network stack.
|
||||
//
|
||||
WebServerTimer ( pWebServer );
|
||||
|
||||
//
|
||||
// Add the HTTP port to the list of ports
|
||||
//
|
||||
Status = PortAdd ( pWebServer, pWebServer->HttpListenPort );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
//
|
||||
// Poll the sockets for activity
|
||||
//
|
||||
do {
|
||||
SocketPoll ( pWebServer );
|
||||
} while ( -1 != pWebServer->HttpListenPort );
|
||||
|
||||
//
|
||||
// The HTTP port failed the accept and was closed
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Close the HTTP port if necessary
|
||||
//
|
||||
if ( -1 != pWebServer->HttpListenPort ) {
|
||||
close ( pWebServer->HttpListenPort );
|
||||
pWebServer->HttpListenPort = -1;
|
||||
}
|
||||
//
|
||||
// TODO: Remove the following test code
|
||||
// Exit when the network connection is broken
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Done with the timer event
|
||||
//
|
||||
WebServerTimerStop ( pWebServer );
|
||||
Status = gBS->CloseEvent ( pWebServer->TimerEvent );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return the final status
|
||||
//
|
||||
DBG_EXIT_STATUS ( Status );
|
||||
return Status;
|
||||
}
|
1105
AppPkg/Applications/Sockets/WebServer/WebServer.h
Normal file
1105
AppPkg/Applications/Sockets/WebServer/WebServer.h
Normal file
File diff suppressed because it is too large
Load Diff
97
AppPkg/Applications/Sockets/WebServer/WebServer.inf
Normal file
97
AppPkg/Applications/Sockets/WebServer/WebServer.inf
Normal file
@@ -0,0 +1,97 @@
|
||||
#/** @file
|
||||
# Web Server Application
|
||||
#
|
||||
# This file contains an 'Intel Peripheral Driver' and is
|
||||
# licensed for Intel CPUs and chipsets under the terms of your
|
||||
# license agreement with Intel or your vendor. This file may
|
||||
# be modified by the user, subject to additional terms of the
|
||||
# license agreement
|
||||
#
|
||||
#
|
||||
# Copyright (c) 20011 Intel Corporation. All rights reserved
|
||||
# This software and associated documentation (if any) is furnished
|
||||
# under a license and may only be used or copied in accordance
|
||||
# with the terms of the license. Except as permitted by such
|
||||
# license, no part of this software or documentation may be
|
||||
# reproduced, stored in a retrieval system, or transmitted in any
|
||||
# form or by any means without the express written consent of
|
||||
# Intel Corporation.
|
||||
#
|
||||
##
|
||||
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = WebServer
|
||||
FILE_GUID = 99E87DCF-6162-40c5-9FA1-32111F5197F7
|
||||
MODULE_TYPE = UEFI_APPLICATION
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = ShellCEntryLib
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
ACPI.c
|
||||
BootServicesTable.c
|
||||
ConfigurationTable.c
|
||||
DhcpOptions.c
|
||||
DxeServicesTable.c
|
||||
Firmware.c
|
||||
Handles.c
|
||||
Hello.c
|
||||
HTTP.c
|
||||
Index.c
|
||||
PageList.c
|
||||
Reboot.c
|
||||
RuntimeServicesTable.c
|
||||
SystemTable.c
|
||||
WebServer.c
|
||||
|
||||
|
||||
[Pcd]
|
||||
gStdLibTokenSpaceGuid.WebServer_HttpPort
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
ShellPkg/ShellPkg.dec
|
||||
StdLib/StdLib.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
BaseMemoryLib
|
||||
BsdSocketLib
|
||||
DebugLib
|
||||
DevShell
|
||||
# EfiSocketLib
|
||||
LibC
|
||||
ShellLib
|
||||
ShellCEntryLib
|
||||
UefiBootServicesTableLib
|
||||
UefiLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UseSocketDxe
|
||||
|
||||
[Guids]
|
||||
gEfiAcpi10TableGuid
|
||||
gEfiAcpiTableGuid
|
||||
gEfiDebugImageInfoTableGuid
|
||||
gEfiDxeServicesTableGuid
|
||||
gEfiHobListGuid
|
||||
gEfiMemoryTypeInformationGuid
|
||||
gLoadFixedAddressConfigurationTableGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiDhcp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDhcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
[BuildOptions]
|
||||
INTEL:*_*_*_CC_FLAGS = /Qdiag-disable:181,186
|
||||
MSFT:*_*_*_CC_FLAGS = /Od
|
||||
GCC:*_*_*_CC_FLAGS = -O0 -Wno-unused-variable
|
||||
|
Reference in New Issue
Block a user