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