]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/ExtractGuidedSectionLib.h
Synchronization of MDE Library Spec., Mde.dec, and corresponding head files in MdePkg...
[mirror_edk2.git] / MdePkg / Include / Library / ExtractGuidedSectionLib.h
CommitLineData
18fd8d65 1/** @file\r
50a64e5b 2 This library provides common functions to process the different guided section data. \r
18fd8d65 3\r
50a64e5b 4Copyright (c) 2006 - 2008, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
18fd8d65 9\r
50a64e5b 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
18fd8d65 12\r
18fd8d65
LG
13**/\r
14#ifndef __EXTRACT_GUIDED_SECTION_H__\r
15#define __EXTRACT_GUIDED_SECTION_H__\r
16\r
98c39c6b 17/**\r
eceb3a4c 18 Get information for the input guided section data.\r
18fd8d65 19 It will ASSERT () if the pointer to OutputBufferSize is NULL.\r
98c39c6b 20 It will ASSERT () if the pointer to ScratchBufferSize is NULL.\r
18fd8d65
LG
21 It will ASSERT () if the pointer to SectionAttribute is NULL.\r
22\r
23 @param[in] InputSection Buffer containing the input GUIDed section to be processed. \r
24 @param[out] OutputBufferSize The size of OutputBuffer.\r
25 @param[out] ScratchBufferSize The size of ScratchBuffer.\r
26 @param[out] SectionAttribute The attribute of the input guided section.\r
98c39c6b 27\r
18fd8d65 28 @retval RETURN_SUCCESS Get the required information successfully.\r
eceb3a4c 29 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.\r
18fd8d65
LG
30\r
31**/\r
32typedef\r
33RETURN_STATUS\r
34(EFIAPI *EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)(\r
35 IN CONST VOID *InputSection,\r
36 OUT UINT32 *OutputBufferSize,\r
37 OUT UINT32 *ScratchBufferSize,\r
38 OUT UINT16 *SectionAttribute\r
39 );\r
40\r
98c39c6b 41/**\r
42 Extract data and Auth from the specific guided section.\r
18fd8d65
LG
43 It will ASSERT () if the pointer to OutputBuffer is NULL.\r
44 It will ASSERT () if the pointer to AuthenticationStatus is NULL.\r
45\r
46 @param[in] InputSection Buffer containing the input GUIDed section to be processed. \r
eceb3a4c 47 @param[out] OutputBuffer OutputBuffer directly points to the start of the section's contents,\r
18fd8d65 48 if guided data is not prcessed. Otherwise,\r
eceb3a4c 49 OutputBuffer contains the output data, which is allocated by the caller.\r
18fd8d65
LG
50 @param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use. \r
51 @param[out] AuthenticationStatus \r
52 A pointer to a caller-allocated UINT32 that indicates the\r
98c39c6b 53 authentication status of the output buffer. \r
54\r
18fd8d65 55 @retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.\r
eceb3a4c 56 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.\r
18fd8d65
LG
57\r
58**/\r
59typedef\r
60RETURN_STATUS\r
61(EFIAPI *EXTRACT_GUIDED_SECTION_DECODE_HANDLER)(\r
62 IN CONST VOID *InputSection,\r
63 OUT VOID **OutputBuffer,\r
64 IN VOID *ScratchBuffer, OPTIONAL\r
65 OUT UINT32 *AuthenticationStatus\r
66 );\r
67\r
98c39c6b 68/**\r
18fd8d65
LG
69 Register Guided Section Extract and GetInfo Handler.\r
70\r
98c39c6b 71 @param[in] SectionGuid The guid matches this Extraction Handler.\r
eceb3a4c 72 @param[in] GetInfoHandler Handler to get information from guided section.\r
98c39c6b 73 @param[in] DecodeHandler Handler to extract guided section.\r
74\r
75 @retval RETURN_SUCCESS Register Guided Section Extract Handler successfully.\r
18fd8d65 76 @retval RETURN_OUT_OF_RESOURCES Resource is not enough to register new Handler. \r
eceb3a4c 77 @retval RETURN_INVALID_PARAMETER Pointer to Guid value is not valid.\r
18fd8d65
LG
78\r
79**/\r
80RETURN_STATUS\r
81EFIAPI\r
82ExtractGuidedSectionRegisterHandlers (\r
83 IN CONST GUID *SectionGuid,\r
84 IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler,\r
85 IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler\r
86 );\r
87\r
98c39c6b 88/**\r
0fa00159 89 Get the supported exract guided section Handler guid table, which is maintained\r
eceb3a4c 90 by library. The caller can directly get the guid table \r
0fa00159 91 without responsibility to allocate or free this table buffer. \r
18fd8d65
LG
92 It will ASSERT () if ExtractHandlerGuidTable = NULL.\r
93\r
98c39c6b 94 @param[out] ExtractHandlerGuidTable The extract Handler guid pointer list.\r
18fd8d65 95\r
98c39c6b 96 @return the number of the supported extract guided Handler.\r
18fd8d65
LG
97**/\r
98UINTN\r
99EFIAPI\r
100ExtractGuidedSectionGetGuidList (\r
eceb3a4c 101 OUT GUID **ExtractHandlerGuidTable\r
18fd8d65
LG
102 );\r
103\r
98c39c6b 104/**\r
18fd8d65
LG
105 Get information from the guided section. This function first gets the guid value\r
106 from guided section header, then match this guid in the registered extract Handler list\r
107 to its corresponding getinfo Handler. \r
108 If not found, RETURN_UNSUPPORTED will be return. \r
109 If found, it will call the getinfo Handler to get the required size and attribute.\r
110\r
111 It will ASSERT () if the pointer to OutputBufferSize is NULL.\r
98c39c6b 112 It will ASSERT () if the pointer to ScratchBufferSize is NULL.\r
18fd8d65
LG
113 It will ASSERT () if the pointer to SectionAttribute is NULL.\r
114\r
115 @param[in] InputSection Buffer containing the input GUIDed section to be processed. \r
116 @param[out] OutputBufferSize The size of OutputBuffer.\r
117 @param[out] ScratchBufferSize The size of ScratchBuffer. \r
118 @param[out] SectionAttribute The attribute of the input guided section.\r
98c39c6b 119\r
18fd8d65
LG
120 @retval RETURN_SUCCESS Get the required information successfully.\r
121 @retval RETURN_UNSUPPORTED Guided section data is not supported.\r
eceb3a4c 122 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.\r
18fd8d65
LG
123\r
124**/\r
125RETURN_STATUS\r
126EFIAPI\r
127ExtractGuidedSectionGetInfo (\r
128 IN CONST VOID *InputSection,\r
129 OUT UINT32 *OutputBufferSize,\r
130 OUT UINT32 *ScratchBufferSize,\r
131 OUT UINT16 *SectionAttribute \r
132 );\r
133\r
98c39c6b 134/**\r
18fd8d65
LG
135 Extract data from the guided section. This function first gets the guid value\r
136 from guided section header, then match this guid in the registered extract Handler list\r
137 to its corresponding extract Handler. \r
138 If not found, RETURN_UNSUPPORTED will be return. \r
98c39c6b 139 If found, it will call this extract Handler to get output data and AuthenticationStatus.\r
18fd8d65
LG
140\r
141 It will ASSERT () if the pointer to OutputBuffer is NULL.\r
142 It will ASSERT () if the pointer to AuthenticationStatus is NULL.\r
143\r
144 @param[in] InputSection Buffer containing the input GUIDed section to be processed. \r
145 @param[out] OutputBuffer OutputBuffer to point the start of the section's contents \r
146 if guided data is not required prcessing. Otherwise,\r
147 OutputBuffer to contain the output data, which is \r
148 allocated by the caller.\r
149 @param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use. \r
150 @param[out] AuthenticationStatus \r
151 A pointer to a caller-allocated UINT32 that indicates the\r
98c39c6b 152 authentication status of the output buffer. \r
153\r
d173d9c7 154 @retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.\r
18fd8d65 155 @retval RETURN_UNSUPPORTED Guided section data is not supported to be decoded.\r
98c39c6b 156 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.\r
18fd8d65
LG
157**/\r
158RETURN_STATUS\r
159EFIAPI\r
160ExtractGuidedSectionDecode (\r
161 IN CONST VOID *InputSection,\r
162 OUT VOID **OutputBuffer,\r
163 OUT VOID *ScratchBuffer, OPTIONAL\r
164 OUT UINT32 *AuthenticationStatus \r
165 );\r
166\r
167#endif\r