]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/ExtractGuidedSectionLib.h
63595ee3b7102d0a905a5777c80a38d9f3136bf5
[mirror_edk2.git] / MdePkg / Include / Library / ExtractGuidedSectionLib.h
1 /** @file
2 Extract Guided Section Library class defintions,
3 which can provide many handlers for the different guided section data.
4
5 Copyright (c) 2007 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15 #ifndef __EXTRACT_GUIDED_SECTION_H__
16 #define __EXTRACT_GUIDED_SECTION_H__
17
18 /**
19 Get information 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 is not the valid guided section.
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 and Auth from the 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 directly points to the start of the section's contents,
49 if guided data is not prcessed. Otherwise,
50 OutputBuffer contains 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 is not the valid guided section.
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 information 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 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 table, which is maintained
91 by library. The caller can directly get the guid table
92 without responsibility to allocate or free this table buffer.
93 It will ASSERT () if ExtractHandlerGuidTable = NULL.
94
95 @param[out] ExtractHandlerGuidTable The extract Handler guid pointer list.
96
97 @return the number of the supported extract guided Handler.
98 **/
99 UINTN
100 EFIAPI
101 ExtractGuidedSectionGetGuidList (
102 OUT GUID **ExtractHandlerGuidTable
103 );
104
105 /**
106 Get information from the guided section. This function first gets the guid value
107 from guided section header, then match this guid in the registered extract Handler list
108 to its corresponding getinfo Handler.
109 If not found, RETURN_UNSUPPORTED will be return.
110 If found, it will call the getinfo Handler to get the required size and attribute.
111
112 It will ASSERT () if the pointer to OutputBufferSize is NULL.
113 It will ASSERT () if the pointer to ScratchBufferSize is NULL.
114 It will ASSERT () if the pointer to SectionAttribute is NULL.
115
116 @param[in] InputSection Buffer containing the input GUIDed section to be processed.
117 @param[out] OutputBufferSize The size of OutputBuffer.
118 @param[out] ScratchBufferSize The size of ScratchBuffer.
119 @param[out] SectionAttribute The attribute of the input guided section.
120
121 @retval RETURN_SUCCESS Get the required information successfully.
122 @retval RETURN_UNSUPPORTED Guided section data is not supported.
123 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.
124
125 **/
126 RETURN_STATUS
127 EFIAPI
128 ExtractGuidedSectionGetInfo (
129 IN CONST VOID *InputSection,
130 OUT UINT32 *OutputBufferSize,
131 OUT UINT32 *ScratchBufferSize,
132 OUT UINT16 *SectionAttribute
133 );
134
135 /**
136 Extract data from the guided section. This function first gets the guid value
137 from guided section header, then match this guid in the registered extract Handler list
138 to its corresponding extract Handler.
139 If not found, RETURN_UNSUPPORTED will be return.
140 If found, it will call this extract Handler to get output data and AuthenticationStatus.
141
142 It will ASSERT () if the pointer to OutputBuffer is NULL.
143 It will ASSERT () if the pointer to AuthenticationStatus is NULL.
144
145 @param[in] InputSection Buffer containing the input GUIDed section to be processed.
146 @param[out] OutputBuffer OutputBuffer to point the start of the section's contents
147 if guided data is not required prcessing. Otherwise,
148 OutputBuffer to contain the output data, which is
149 allocated by the caller.
150 @param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
151 @param[out] AuthenticationStatus
152 A pointer to a caller-allocated UINT32 that indicates the
153 authentication status of the output buffer.
154
155 @retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.
156 @retval RETURN_UNSUPPORTED Guided section data is not supported to be decoded.
157 @retval RETURN_INVALID_PARAMETER The input data is not the valid guided section.
158 **/
159 RETURN_STATUS
160 EFIAPI
161 ExtractGuidedSectionDecode (
162 IN CONST VOID *InputSection,
163 OUT VOID **OutputBuffer,
164 OUT VOID *ScratchBuffer, OPTIONAL
165 OUT UINT32 *AuthenticationStatus
166 );
167
168 #endif