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