+++ /dev/null
-/** @file\r
- Definitions for the web server.\r
-\r
- Copyright (c) 2011-2012, Intel Corporation. All rights reserved.\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef _WEB_SERVER_H_\r
-#define _WEB_SERVER_H_\r
-\r
-#include <errno.h>\r
-#include <Uefi.h>\r
-\r
-#include <Guid/EventGroup.h>\r
-\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/UefiApplicationEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Protocol/BlockIo.h>\r
-\r
-#include <netinet/in.h>\r
-\r
-#include <sys/EfiSysCall.h>\r
-#include <sys/poll.h>\r
-#include <sys/socket.h>\r
-\r
-#if defined(_MSC_VER) // Handle Microsoft VC++ compiler specifics.\r
-#pragma warning ( disable : 4054 )\r
-#pragma warning ( disable : 4152 )\r
-#endif // defined(_MSC_VER)\r
-\r
-//------------------------------------------------------------------------------\r
-// Pages\r
-//------------------------------------------------------------------------------\r
-\r
-#define PAGE_ACPI_APIC L"/APIC"\r
-#define PAGE_ACPI_BGRT L"/BGRT"\r
-#define PAGE_ACPI_DSDT L"/DSDT"\r
-#define PAGE_ACPI_FADT L"/FADT"\r
-#define PAGE_ACPI_HPET L"/HPET"\r
-#define PAGE_ACPI_MCFG L"/MCFG"\r
-#define PAGE_ACPI_RSDP_10B L"/RSDP1.0b"\r
-#define PAGE_ACPI_RSDP_30 L"/RSDP3.0"\r
-#define PAGE_ACPI_RSDT L"/RSDT"\r
-#define PAGE_ACPI_SSDT L"/SSDT"\r
-#define PAGE_ACPI_TCPA L"/TCPA"\r
-#define PAGE_ACPI_UEFI L"/UEFI"\r
-#define PAGE_BOOT_SERVICES_TABLE L"/BootServicesTable"\r
-#define PAGE_CONFIGURATION_TABLE L"/ConfigurationTable"\r
-#define PAGE_DXE_SERVICES_TABLE L"/DxeServicesTable"\r
-#define PAGE_RUNTIME_SERVICES_TABLE L"/RuntimeServicesTable"\r
-\r
-//------------------------------------------------------------------------------\r
-// Signatures\r
-//------------------------------------------------------------------------------\r
-\r
-#define APIC_SIGNATURE 0x43495041\r
-#define BGRT_SIGNATURE 0x54524742\r
-#define DSDT_SIGNATURE 0x54445344\r
-#define FADT_SIGNATURE 0x50434146\r
-#define HPET_SIGNATURE 0x54455048\r
-#define MCFG_SIGNATURE 0x4746434d\r
-#define SSDT_SIGNATURE 0x54445353\r
-#define TCPA_SIGNATURE 0x41504354\r
-#define UEFI_SIGNATURE 0x49464555\r
-\r
-//------------------------------------------------------------------------------\r
-// Macros\r
-//------------------------------------------------------------------------------\r
-\r
-#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */\r
-#define DBG_ENTER() DEBUG (( DEBUG_INFO, "Entering " __FUNCTION__ "\n" )) ///< Display routine entry\r
-#define DBG_EXIT() DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ "\n" )) ///< Display routine exit\r
-#define DBG_EXIT_DEC(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %d\n", Status )) ///< Display routine exit with decimal value\r
-#define DBG_EXIT_HEX(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: 0x%08x\n", Status )) ///< Display routine exit with hex value\r
-#define DBG_EXIT_STATUS(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %r\n", Status )) ///< Display routine exit with status value\r
-#define DBG_EXIT_TF(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", returning %s\n", (FALSE == Status) ? L"FALSE" : L"TRUE" )) ///< Display routine with TRUE/FALSE value\r
-#else // _MSC_VER\r
-#define DBG_ENTER()\r
-#define DBG_EXIT()\r
-#define DBG_EXIT_DEC(Status)\r
-#define DBG_EXIT_HEX(Status)\r
-#define DBG_EXIT_STATUS(Status)\r
-#define DBG_EXIT_TF(Status)\r
-#endif // _MSC_VER\r
-\r
-#define DIM(x) ( sizeof ( x ) / sizeof ( x[0] )) ///< Compute the number of entries in an array\r
-\r
-//------------------------------------------------------------------------------\r
-// Constants\r
-//------------------------------------------------------------------------------\r
-\r
-#define DEBUG_SOCKET_POLL 0x00080000 ///< Display the socket poll messages\r
-#define DEBUG_PORT_WORK 0x00040000 ///< Display the port work messages\r
-#define DEBUG_SERVER_LISTEN 0x00020000 ///< Display the socket poll messages\r
-#define DEBUG_HTTP_PORT 0x00010000 ///< Display HTTP port related messages\r
-#define DEBUG_REQUEST 0x00008000 ///< Display the HTTP request messages\r
-\r
-#define HTTP_PORT_POLL_DELAY ( 2 * 1000 ) ///< Delay in milliseconds for attempts to open the HTTP port\r
-#define CLIENT_POLL_DELAY 50 ///< Delay in milliseconds between client polls\r
-\r
-#define TPL_WEB_SERVER TPL_CALLBACK ///< TPL for routine synchronization\r
-\r
-/**\r
- Verify new TPL value\r
-\r
- This macro which is enabled when debug is enabled verifies that\r
- the new TPL value is >= the current TPL value.\r
-**/\r
-#ifdef VERIFY_TPL\r
-#undef VERIFY_TPL\r
-#endif // VERIFY_TPL\r
-\r
-#if !defined(MDEPKG_NDEBUG)\r
-\r
-#define VERIFY_TPL(tpl) \\r
-{ \\r
- EFI_TPL PreviousTpl; \\r
- \\r
- PreviousTpl = gBS->RaiseTPL ( TPL_HIGH_LEVEL ); \\r
- gBS->RestoreTPL ( PreviousTpl ); \\r
- if ( PreviousTpl > tpl ) { \\r
- DEBUG (( DEBUG_ERROR, "Current TPL: %d, New TPL: %d\r\n", PreviousTpl, tpl )); \\r
- ASSERT ( PreviousTpl <= tpl ); \\r
- } \\r
-}\r
-\r
-#else // MDEPKG_NDEBUG\r
-\r
-#define VERIFY_TPL(tpl)\r
-\r
-#endif // MDEPKG_NDEBUG\r
-\r
-#define WEB_SERVER_SIGNATURE SIGNATURE_32 ('W','e','b','S') ///< DT_WEB_SERVER memory signature\r
-\r
-#define SPACES_ADDRESS_TO_DATA 2\r
-#define BYTES_ON_A_LINE 16\r
-#define SPACES_BETWEEN_BYTES 1\r
-#define SPACES_DATA_TO_ASCII 2\r
-\r
-\r
-//------------------------------------------------------------------------------\r
-// Protocol Declarations\r
-//------------------------------------------------------------------------------\r
-\r
-extern EFI_COMPONENT_NAME_PROTOCOL gComponentName; ///< Component name protocol declaration\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2; ///< Component name 2 protocol declaration\r
-extern EFI_DRIVER_BINDING_PROTOCOL gDriverBinding; ///< Driver binding protocol declaration\r
-\r
-//------------------------------------------------------------------------------\r
-// Data Types\r
-//------------------------------------------------------------------------------\r
-\r
-/**\r
- Port control structure\r
-**/\r
-typedef struct {\r
- //\r
- // Buffer management\r
- //\r
- size_t RequestLength; ///< Request length in bytes\r
- size_t TxBytes; ///< Bytes in the TX buffer\r
- UINT8 Request[ 65536 ]; ///< Page request\r
- UINT8 RxBuffer[ 65536 ]; ///< Receive buffer\r
- UINT8 TxBuffer[ 65536 ]; ///< Transmit buffer\r
-} WSDT_PORT;\r
-\r
-/**\r
- Web server control structure\r
-**/\r
-typedef struct {\r
- UINTN Signature; ///< Structure identification\r
-\r
- //\r
- // Image attributes\r
- //\r
- EFI_HANDLE ImageHandle; ///< Image handle\r
-\r
- //\r
- // HTTP port management\r
- //\r
- BOOLEAN bRunning; ///< Web server running\r
- EFI_EVENT TimerEvent; ///< Timer to open HTTP port\r
- int HttpListenPort; ///< File descriptor for the HTTP listen port over TCP4\r
- int HttpListenPort6; ///< File descriptor for the HTTP listen port over TCP6\r
-\r
- //\r
- // Client port management\r
- //\r
- nfds_t MaxEntries; ///< Maximum entries in the PortList array\r
- nfds_t Entries; ///< The current number of entries in the PortList array\r
- struct pollfd * pFdList; ///< List of socket file descriptors\r
- WSDT_PORT ** ppPortList; ///< List of port management structures\r
-} DT_WEB_SERVER;\r
-\r
-//#define SERVER_FROM_SERVICE(a) CR (a, DT_WEB_SERVER, ServiceBinding, WEB_SERVER_SIGNATURE) ///< Locate DT_LAYER from service binding\r
-\r
-extern DT_WEB_SERVER mWebServer;\r
-\r
-/**\r
- Process an HTTP request\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(* PFN_RESPONSE) (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Data structure to delcare page support routines\r
-**/\r
-typedef struct {\r
- UINT16 * pPageName; ///< Name of the page\r
- PFN_RESPONSE pfnResponse; ///< Routine to generate the response\r
- UINT16 * pDescription; ///< Description of the page\r
-} DT_PAGE;\r
-\r
-extern CONST DT_PAGE mPageList[]; ///< List of pages\r
-extern CONST UINTN mPageCount; ///< Number of pages\r
-\r
-//------------------------------------------------------------------------------\r
-// Web Pages\r
-//------------------------------------------------------------------------------\r
-\r
-/**\r
- Respond with the APIC table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiApicPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the BGRT table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiBgrtPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the ACPI DSDT table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiDsdtPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the ACPI FADT table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiFadtPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the HPET table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiHpetPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the MCFG table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiMcfgPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the ACPI RSDP 1.0b table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiRsdp10Page (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the ACPI RSDP 3.0 table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiRsdp30Page (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the ACPI RSDT table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiRsdtPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the SSDT table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiSsdtPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the TCPA table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiTcpaPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the UEFI table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-AcpiUefiPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the boot services table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-BootServicesTablePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the configuration tables\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-ConfigurationTablePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the DHCP options\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-DhcpOptionsPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the DXE services table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-DxeServicesTablePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the Exit page\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-ExitPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the firmware status\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-FirmwarePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the handles in the system\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HandlePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the Hello World page\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HelloPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the list of known pages\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-IndexPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Page to display the memory map\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-MemoryMapPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Display the memory type registers\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-MemoryTypeRegistersPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the Ports page\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-PortsPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Page to reboot the system\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RebootPage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the runtime services table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RuntimeSservicesTablePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Respond with the system table\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-SystemTablePage (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN * pbDone\r
- );\r
-\r
-//------------------------------------------------------------------------------\r
-// Support routines\r
-//------------------------------------------------------------------------------\r
-\r
-/**\r
- Display the EFI Table Header\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pHeader Address of the EFI_TABLE_HEADER structure\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-EfiTableHeader (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN EFI_TABLE_HEADER * pHeader\r
- );\r
-\r
-/**\r
- Buffer the HTTP page header\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pTitle A zero terminated Unicode title string\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpPageHeader (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR16 * pTitle\r
- );\r
-\r
-/**\r
- Buffer and send the HTTP page trailer\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpPageTrailer (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Process an HTTP request\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpRequest (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN BOOLEAN * pbDone\r
- );\r
-\r
-/**\r
- Buffer data for sending\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] LengthInBytes Length of valid data in the buffer\r
- @param [in] pBuffer Buffer of data to send\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSend (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN size_t LengthInBytes,\r
- IN CONST UINT8 * pBuffer\r
- );\r
-\r
-/**\r
- Send an ANSI string\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pString A zero terminated Unicode string\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSendAnsiString (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST char * pString\r
- );\r
-\r
-/**\r
- Buffer a single byte\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] Data The data byte to send\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSendByte (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN UINT8 Data\r
- );\r
-\r
-/**\r
- Display a character\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] Character Character to display\r
- @param [in] pReplacement Replacement character string\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSendCharacter (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CHAR8 Character,\r
- IN CHAR8 * pReplacement\r
- );\r
-\r
-/**\r
- Send a buffer dump\r
- \r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] ByteCount The number of bytes to display\r
- @param [in] pData Address of the byte array\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSendDump (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN UINTN ByteCount,\r
- IN CONST UINT8 * pData\r
- );\r
-\r
-/**\r
- Display a row containing a GUID value\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pGuid Address of the GUID to display\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSendGuid (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST EFI_GUID * pGuid\r
- );\r
-\r
-/**\r
- Output a hex value to the HTML page\r
-\r
- @param [in] SocketFD Socket file descriptor\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] Bits Number of bits to display\r
- @param [in] Value Value to display\r
-\r
- @retval EFI_SUCCESS Successfully displayed the address\r
-**/\r
-EFI_STATUS\r
-HttpSendHexBits (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN INT32 Bits,\r
- IN UINT64 Value\r
- );\r
-\r
-/**\r
- Output a hex value to the HTML page\r
-\r
- @param [in] SocketFD Socket file descriptor\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] Value Value to display\r
-\r
- @retval EFI_SUCCESS Successfully displayed the address\r
-**/\r
-EFI_STATUS\r
-HttpSendHexValue (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN UINT64 Value\r
- );\r
-\r
-/**\r
- Output an IP address to the HTML page\r
-\r
- @param [in] SocketFD Socket file descriptor\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pAddress Address of the socket address\r
-\r
- @retval EFI_SUCCESS Successfully displayed the address\r
-**/\r
-EFI_STATUS\r
-HttpSendIpAddress (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN struct sockaddr_in6 * pAddress\r
- );\r
-\r
-/**\r
- Send a Unicode string\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pString A zero terminated Unicode string\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-HttpSendUnicodeString (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST UINT16 * pString\r
- );\r
-\r
-/**\r
- Output a value to the HTML page\r
-\r
- @param [in] SocketFD Socket file descriptor\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] Value Value to display\r
-\r
- @retval EFI_SUCCESS Successfully displayed the address\r
-**/\r
-EFI_STATUS\r
-HttpSendValue (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN UINT64 Value\r
- );\r
-\r
-/**\r
- Display a row containing a decimal value\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] Value The value to display\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RowDecimalValue (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR8 * pName,\r
- IN UINT64 Value\r
- );\r
-\r
-/**\r
- Display a row containing a GUID value\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] pGuid Address of the GUID to display\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RowGuid (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR8 * pName,\r
- IN CONST EFI_GUID * pGuid\r
- );\r
-\r
-/**\r
- Display a row containing a hex value\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] Value The value to display\r
- @param [in] pWebPage Address of a zero terminated web page name\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RowHexValue (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR8 * pName,\r
- IN UINT64 Value,\r
- IN CONST CHAR16 * pWebPage\r
- );\r
-\r
-/**\r
- Display a row containing a pointer\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] pAddress The address to display\r
- @param [in] pWebPage Address of a zero terminated web page name\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RowPointer (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR8 * pName,\r
- IN CONST VOID * pAddress,\r
- IN CONST CHAR16 * pWebPage\r
- );\r
-\r
-/**\r
- Display a row containing a revision\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] Revision The revision to display\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RowRevision (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR8 * pName,\r
- IN UINT32 Revision\r
- );\r
-\r
-/**\r
- Display a row containing a unicode string\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] pString Address of a zero terminated unicode string\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-RowUnicodeString (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR8 * pName,\r
- IN CONST CHAR16 * pString\r
- );\r
-\r
-/**\r
- Start the table page\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [in] pName Address of a zero terminated name string\r
- @param [in] pTable Address of the table\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-TableHeader (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- IN CONST CHAR16 * pName,\r
- IN CONST VOID * pTable\r
- );\r
-\r
-/**\r
- End the table page\r
-\r
- @param [in] SocketFD The socket's file descriptor to add to the list.\r
- @param [in] pPort The WSDT_PORT structure address\r
- @param [out] pbDone Address to receive the request completion status\r
-\r
- @retval EFI_SUCCESS The request was successfully processed\r
-\r
-**/\r
-EFI_STATUS\r
-TableTrailer (\r
- IN int SocketFD,\r
- IN WSDT_PORT * pPort,\r
- OUT BOOLEAN *pbDone\r
- );\r
-\r
-/**\r
- HTTP port creation timer routine\r
-\r
- This routine polls the socket layer waiting for the initial network connection\r
- which will enable the creation of the HTTP port. The socket layer will manage\r
- the coming and going of the network connections after that until the last network\r
- connection is broken.\r
-\r
- @param [in] pWebServer The web server control structure address.\r
-\r
-**/\r
-VOID\r
-WebServerTimer (\r
- IN DT_WEB_SERVER * pWebServer\r
- );\r
-\r
-/**\r
- Start the web server port creation timer\r
-\r
- @param [in] pWebServer The web server control structure address.\r
-\r
- @retval EFI_SUCCESS The timer was successfully started.\r
- @retval EFI_ALREADY_STARTED The timer is already running.\r
- @retval Other The timer failed to start.\r
-\r
-**/\r
-EFI_STATUS\r
-WebServerTimerStart (\r
- IN DT_WEB_SERVER * pWebServer\r
- );\r
-\r
-/**\r
- Stop the web server port creation timer\r
-\r
- @param [in] pWebServer The web server control structure address.\r
-\r
- @retval EFI_SUCCESS The HTTP port timer is stopped\r
- @retval Other Failed to stop the HTTP port timer\r
-\r
-**/\r
-EFI_STATUS\r
-WebServerTimerStop (\r
- IN DT_WEB_SERVER * pWebServer\r
- );\r
-\r
-//------------------------------------------------------------------------------\r
-// Driver Binding Protocol Support\r
-//------------------------------------------------------------------------------\r
-\r
-/**\r
- Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and\r
- closing the DevicePath and PciIo protocols on Controller.\r
-\r
- @param [in] pThis Protocol instance pointer.\r
- @param [in] Controller Handle of device to stop driver on.\r
- @param [in] NumberOfChildren How many children need to be stopped.\r
- @param [in] pChildHandleBuffer Not used.\r
-\r
- @retval EFI_SUCCESS This driver is removed Controller.\r
- @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
- @retval other This driver was not removed from this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DriverStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL * pThis,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE * pChildHandleBuffer\r
- );\r
-\r
-//------------------------------------------------------------------------------\r
-// EFI Component Name Protocol Support\r
-//------------------------------------------------------------------------------\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
- This function retrieves the user readable name of a driver in the form of a\r
- Unicode string. If the driver specified by This has a user readable name in\r
- the language specified by Language, then a pointer to the driver name is\r
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
- by This does not support the language specified by Language,\r
- then EFI_UNSUPPORTED is returned.\r
-\r
- @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
- @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified\r
- in RFC 3066 or ISO 639-2 language code format.\r
- @param [out] ppDriverName A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- driver specified by This in the language\r
- specified by Language.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
- This and the language specified by Language was\r
- returned in DriverName.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
- IN CHAR8 * pLanguage,\r
- OUT CHAR16 ** ppDriverName\r
- );\r
-\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
- @param [in] ControllerHandle The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
- @param [in] ChildHandle The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
- @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 3066 or ISO 639-2 language code format.\r
- @param [out] ppControllerName A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN OPTIONAL EFI_HANDLE ChildHandle,\r
- IN CHAR8 * pLanguage,\r
- OUT CHAR16 ** ppControllerName\r
- );\r
-\r
-//------------------------------------------------------------------------------\r
-\r
-#endif // _WEB_SERVER_H_\r