]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Sockets/WebServer/WebServer.h
AppPkg: fix webserver build for !Ia32/X64
[mirror_edk2.git] / AppPkg / Applications / Sockets / WebServer / WebServer.h
index 6078df0362acc2269fa3268d51b807fdb14b5b45..16c30c8d6d89890c13df1aeec9993b755bf40528 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Definitions for the web server.\r
 \r
-  Copyright (c) 2011, Intel Corporation\r
+  Copyright (c) 2011-2012, Intel Corporation\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -22,6 +22,7 @@
 \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 <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
 //  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
 #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_TIMER      0x00020000  ///<  Display the socket poll 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
 \r
 #endif  //  MDEPKG_NDEBUG\r
 \r
-#define WEB_SERVER_SIGNATURE        SIGNATURE_32('W','e','b','S') ///<  DT_WEB_SERVER memory signature\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
@@ -154,9 +171,9 @@ typedef struct {
   //\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
+  UINT8     Request[ 65536 ];   ///<  Page request\r
+  UINT8     RxBuffer[ 65536 ];  ///<  Receive buffer\r
+  UINT8     TxBuffer[ 65536 ];  ///<  Transmit buffer\r
 } WSDT_PORT;\r
 \r
 /**\r
@@ -173,9 +190,10 @@ typedef struct {
   //\r
   //  HTTP port management\r
   //\r
-  BOOLEAN   bTimerRunning;      ///<  Port creation timer status\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\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
@@ -186,7 +204,7 @@ typedef struct {
   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
+//#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
@@ -217,13 +235,47 @@ typedef struct {
   UINT16 * pDescription;      ///<  Description of the page\r
 } DT_PAGE;\r
 \r
-extern CONST DT_PAGE mPageList [];  ///<  List of pages\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
@@ -258,6 +310,40 @@ AcpiFadtPage (
   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
@@ -309,6 +395,57 @@ AcpiRsdtPage (
   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
@@ -377,6 +514,23 @@ DxeServicesTablePage (
   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
@@ -445,6 +599,57 @@ IndexPage (
   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
@@ -723,7 +928,7 @@ EFI_STATUS
 HttpSendIpAddress (\r
   IN int SocketFD,\r
   IN WSDT_PORT * pPort,\r
-  IN struct sockaddr_in * pAddress\r
+  IN struct sockaddr_in6 * pAddress\r
   );\r
 \r
 /**\r