]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Include/Protocol/SectionExtraction.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / SectionExtraction.h
diff --git a/OldMdePkg/Include/Protocol/SectionExtraction.h b/OldMdePkg/Include/Protocol/SectionExtraction.h
new file mode 100644 (file)
index 0000000..adc03f5
--- /dev/null
@@ -0,0 +1,160 @@
+/** @file\r
+  This file declares Section Extraction protocols.\r
+\r
+  This interface provides a means of decoding a set of sections into a linked list of\r
+  leaf sections.  This provides for an extensible and flexible file format.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the 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
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SectionExtraction.h\r
+\r
+  @par Revision Reference:\r
+  This protocol is defined in Firmware Volume Specification.\r
+  Version 0.9\r
+\r
+**/\r
+\r
+#ifndef __SECTION_EXTRACTION_PROTOCOL_H__\r
+#define __SECTION_EXTRACTION_PROTOCOL_H__\r
+\r
+\r
+//\r
+// Protocol GUID definition\r
+//\r
+#define EFI_SECTION_EXTRACTION_PROTOCOL_GUID \\r
+  { \\r
+    0x448F5DA4, 0x6DD7, 0x4FE1, {0x93, 0x07, 0x69, 0x22, 0x41, 0x92, 0x21, 0x5D } \\r
+  }\r
+\r
+typedef struct _EFI_SECTION_EXTRACTION_PROTOCOL EFI_SECTION_EXTRACTION_PROTOCOL;\r
+\r
+//\r
+// Protocol member functions\r
+//\r
+/**\r
+  Creates and returns a new section stream handle to represent the new section stream.\r
+\r
+  @param  This                  Indicates the EFI_SECTION_EXTRACTION_PROTOCOL instance.\r
+  @param  SectionStreamLength   Size in bytes of the section stream.\r
+  @param  SectionStream         Buffer containing the new section stream.\r
+  @param  SectionStreamHandle   A pointer to a caller-allocated UINTN that,\r
+                                on output, contains the new section stream handle.\r
+\r
+  @retval EFI_SUCCESS           The SectionStream was successfully processed and\r
+                                the section stream handle was returned.\r
+  @retval EFI_OUT_OF_RESOURCES  The system has insufficient resources to\r
+                                process the request.\r
+  @retval EFI_INVALID_PARAMETER The section stream may be corrupt or the value\r
+                                of SectionStreamLength may be incorrect.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_OPEN_SECTION_STREAM) (\r
+  IN  EFI_SECTION_EXTRACTION_PROTOCOL                   *This,\r
+  IN  UINTN                                             SectionStreamLength,\r
+  IN  VOID                                              *SectionStream,\r
+  OUT UINTN                                             *SectionStreamHandle\r
+  );\r
+\r
+/**\r
+  Reads and returns a single section from a section stream.\r
+\r
+  @param  This                  Indicates the EFI_SECTION_EXTRACTION_PROTOCOL instance.\r
+  @param  SectionStreamHandle   Indicates from which section stream to read.\r
+  @param  SectionType           Pointer to an EFI_SECTION_TYPE.\r
+  @param  SectionDefinitionGuid Pointer to an EFI_GUID.If SectionType ==\r
+                                EFI_SECTION_GUID_DEFINED, SectionDefinitionGuid indicates what section GUID\r
+                                to search for.If SectionType !=EFI_SECTION_GUID_DEFINED, then\r
+                                SectionDefinitionGuid is unused and is ignored.\r
+  @param  SectionInstance       Indicates which instance of the requested section\r
+                                type to return when SectionType is not NULL.\r
+  @param  SectionStreamHandle   A pointer to a caller-allocated UINTN that, on output,\r
+                                contains the new section stream handle.\r
+  @param  Buffer                Pointer to a pointer to a buffer in which the section\r
+                                contents are returned.\r
+  @param  BufferSize            Pointer to a caller-allocated UINTN.\r
+  @param  AuthenticationStatus  Pointer to a caller-allocated UINT32 in\r
+                                which any meta-data from encapsulation GUID-defined sections is returned.\r
+\r
+  @retval EFI_SUCCESS           The SectionStream was successfully processed and\r
+                                the section contents were returned in Buffer.\r
+  @retval EFI_PROTOCOL_ERROR    A GUID-defined section was encountered in\r
+                                the section stream with its EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
+                                but there was no corresponding GUIDed Section Extraction Protocol in\r
+                                the handle database.\r
+  @retval EFI_NOT_FOUND         An error was encountered when parsing the SectionStream,\r
+                                which indicates that the SectionStream is not correctly formatted.\r
+                                Or The requested section does not exist.\r
+  @retval EFI_OUT_OF_RESOURCES  The system has insufficient resources to process\r
+                                the request.\r
+  @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
+  @retval EFI_BUFFER_TOO_SMALL  The size of the input buffer is insufficient to\r
+                                contain the requested section.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_SECTION) (\r
+  IN EFI_SECTION_EXTRACTION_PROTOCOL                    *This,\r
+  IN UINTN                                              SectionStreamHandle,\r
+  IN EFI_SECTION_TYPE                                   *SectionType,\r
+  IN EFI_GUID                                           *SectionDefinitionGuid,\r
+  IN UINTN                                              SectionInstance,\r
+  IN VOID                                               **Buffer,\r
+  IN OUT UINTN                                          *BufferSize,\r
+  OUT UINT32                                            *AuthenticationStatus\r
+  );\r
+\r
+/**\r
+  Deletes a section stream handle and returns all associated resources to the system.\r
+\r
+  @param  This                  Indicates the EFI_SECTION_EXTRACTION_PROTOCOL instance.\r
+  @param  SectionStreamHandle   Indicates the section stream to close.\r
+  @retval EFI_SUCCESS           The SectionStream was successfully processed and\r
+                                the section stream handle was returned.\r
+  @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CLOSE_SECTION_STREAM) (\r
+  IN EFI_SECTION_EXTRACTION_PROTOCOL                    *This,\r
+  IN UINTN                                              SectionStreamHandle\r
+  );\r
+\r
+//\r
+// Protocol definition\r
+//\r
+/**\r
+  @par Protocol Description:\r
+  The Section Extraction Protocol provides a simple method of extracting \r
+  sections from arbitrarily complex files.\r
+\r
+  @param OpenSectionStream\r
+  Takes a bounded stream of sections and returns a section stream handle. \r
+\r
+  @param GetSection\r
+  Given a section stream handle, retrieves the requested section and \r
+  meta-data from the section stream. \r
+\r
+  @param CloseSectionStream\r
+  Given a section stream handle, closes the section stream.\r
+\r
+**/\r
+struct _EFI_SECTION_EXTRACTION_PROTOCOL {\r
+  EFI_OPEN_SECTION_STREAM   OpenSectionStream;\r
+  EFI_GET_SECTION           GetSection;\r
+  EFI_CLOSE_SECTION_STREAM  CloseSectionStream;\r
+};\r
+\r
+extern EFI_GUID gEfiSectionExtractionProtocolGuid;\r
+\r
+#endif\r