]> git.proxmox.com Git - mirror_edk2.git/blob - 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
1 /** @file
2 This library provides common functions to process the different guided section data.
3
4 Copyright (c) 2006 - 2008, 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 **/
14 #ifndef __EXTRACT_GUIDED_SECTION_H__
15 #define __EXTRACT_GUIDED_SECTION_H__
16
17 /**
18 Get information for the input guided section data.
19 It will ASSERT () if the pointer to OutputBufferSize is NULL.
20 It will ASSERT () if the pointer to ScratchBufferSize is NULL.
21 It will ASSERT () if the pointer to SectionAttribute is NULL.
22
23 @param[in] InputSection Buffer containing the input GUIDed section to be processed.
24 @param[out] OutputBufferSize The size of OutputBuffer.
25 @param[out] ScratchBufferSize The size of ScratchBuffer.
26 @param[out] SectionAttribute The attribute of the input guided section.
27
28 @retval RETURN_SUCCESS Get the required information successfully.
29 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.
30
31 **/
32 typedef
33 RETURN_STATUS
34 (EFIAPI *EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)(
35 IN CONST VOID *InputSection,
36 OUT UINT32 *OutputBufferSize,
37 OUT UINT32 *ScratchBufferSize,
38 OUT UINT16 *SectionAttribute
39 );
40
41 /**
42 Extract data and Auth from the specific guided section.
43 It will ASSERT () if the pointer to OutputBuffer is NULL.
44 It will ASSERT () if the pointer to AuthenticationStatus is NULL.
45
46 @param[in] InputSection Buffer containing the input GUIDed section to be processed.
47 @param[out] OutputBuffer OutputBuffer directly points to the start of the section's contents,
48 if guided data is not prcessed. Otherwise,
49 OutputBuffer contains the output data, which is allocated by the caller.
50 @param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
51 @param[out] AuthenticationStatus
52 A pointer to a caller-allocated UINT32 that indicates the
53 authentication status of the output buffer.
54
55 @retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.
56 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.
57
58 **/
59 typedef
60 RETURN_STATUS
61 (EFIAPI *EXTRACT_GUIDED_SECTION_DECODE_HANDLER)(
62 IN CONST VOID *InputSection,
63 OUT VOID **OutputBuffer,
64 IN VOID *ScratchBuffer, OPTIONAL
65 OUT UINT32 *AuthenticationStatus
66 );
67
68 /**
69 Register Guided Section Extract and GetInfo Handler.
70
71 @param[in] SectionGuid The guid matches this Extraction Handler.
72 @param[in] GetInfoHandler Handler to get information from guided section.
73 @param[in] DecodeHandler Handler to extract guided section.
74
75 @retval RETURN_SUCCESS Register Guided Section Extract Handler successfully.
76 @retval RETURN_OUT_OF_RESOURCES Resource is not enough to register new Handler.
77 @retval RETURN_INVALID_PARAMETER Pointer to Guid value is not valid.
78
79 **/
80 RETURN_STATUS
81 EFIAPI
82 ExtractGuidedSectionRegisterHandlers (
83 IN CONST GUID *SectionGuid,
84 IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler,
85 IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler
86 );
87
88 /**
89 Get the supported exract guided section Handler guid table, which is maintained
90 by library. The caller can directly get the guid table
91 without responsibility to allocate or free this table buffer.
92 It will ASSERT () if ExtractHandlerGuidTable = NULL.
93
94 @param[out] ExtractHandlerGuidTable The extract Handler guid pointer list.
95
96 @return the number of the supported extract guided Handler.
97 **/
98 UINTN
99 EFIAPI
100 ExtractGuidedSectionGetGuidList (
101 OUT GUID **ExtractHandlerGuidTable
102 );
103
104 /**
105 Get information from the guided section. This function first gets the guid value
106 from guided section header, then match this guid in the registered extract Handler list
107 to its corresponding getinfo Handler.
108 If not found, RETURN_UNSUPPORTED will be return.
109 If found, it will call the getinfo Handler to get the required size and attribute.
110
111 It will ASSERT () if the pointer to OutputBufferSize is NULL.
112 It will ASSERT () if the pointer to ScratchBufferSize is NULL.
113 It will ASSERT () if the pointer to SectionAttribute is NULL.
114
115 @param[in] InputSection Buffer containing the input GUIDed section to be processed.
116 @param[out] OutputBufferSize The size of OutputBuffer.
117 @param[out] ScratchBufferSize The size of ScratchBuffer.
118 @param[out] SectionAttribute The attribute of the input guided section.
119
120 @retval RETURN_SUCCESS Get the required information successfully.
121 @retval RETURN_UNSUPPORTED Guided section data is not supported.
122 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.
123
124 **/
125 RETURN_STATUS
126 EFIAPI
127 ExtractGuidedSectionGetInfo (
128 IN CONST VOID *InputSection,
129 OUT UINT32 *OutputBufferSize,
130 OUT UINT32 *ScratchBufferSize,
131 OUT UINT16 *SectionAttribute
132 );
133
134 /**
135 Extract data from the guided section. This function first gets the guid value
136 from guided section header, then match this guid in the registered extract Handler list
137 to its corresponding extract Handler.
138 If not found, RETURN_UNSUPPORTED will be return.
139 If found, it will call this extract Handler to get output data and AuthenticationStatus.
140
141 It will ASSERT () if the pointer to OutputBuffer is NULL.
142 It will ASSERT () if the pointer to AuthenticationStatus is NULL.
143
144 @param[in] InputSection Buffer containing the input GUIDed section to be processed.
145 @param[out] OutputBuffer OutputBuffer to point the start of the section's contents
146 if guided data is not required prcessing. Otherwise,
147 OutputBuffer to contain the output data, which is
148 allocated by the caller.
149 @param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
150 @param[out] AuthenticationStatus
151 A pointer to a caller-allocated UINT32 that indicates the
152 authentication status of the output buffer.
153
154 @retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.
155 @retval RETURN_UNSUPPORTED Guided section data is not supported to be decoded.
156 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.
157 **/
158 RETURN_STATUS
159 EFIAPI
160 ExtractGuidedSectionDecode (
161 IN CONST VOID *InputSection,
162 OUT VOID **OutputBuffer,
163 OUT VOID *ScratchBuffer, OPTIONAL
164 OUT UINT32 *AuthenticationStatus
165 );
166
167 #endif