]>
Commit | Line | Data |
---|---|---|
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 | |
33 | typedef\r | |
34 | RETURN_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 | |
60 | typedef\r | |
61 | RETURN_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 | |
81 | RETURN_STATUS\r | |
82 | EFIAPI\r | |
83 | ExtractGuidedSectionRegisterHandlers (\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 | /** | |
0fa00159 LG |
90 | Get the supported exract guided section Handler guid table, which is maintained\r |
91 | by library. The caller can directly get this guid table pointer \r | |
92 | without responsibility to allocate or free this table buffer. \r | |
18fd8d65 LG |
93 | It will ASSERT () if ExtractHandlerGuidTable = NULL.\r |
94 | \r | |
95 | @param[in, out] ExtractHandlerGuidTable The extract Handler guid pointer list. | |
96 | \r | |
97 | @retval return the number of the supported extract guided Handler. | |
98 | **/\r | |
99 | UINTN\r | |
100 | EFIAPI\r | |
101 | ExtractGuidedSectionGetGuidList (\r | |
102 | IN OUT GUID **ExtractHandlerGuidTable\r | |
103 | );\r | |
104 | \r | |
105 | /** | |
106 | Get information from the guided section. This function first gets the guid value\r | |
107 | from guided section header, then match this guid in the registered extract Handler list\r | |
108 | to its corresponding getinfo Handler. \r | |
109 | If not found, RETURN_UNSUPPORTED will be return. \r | |
110 | If found, it will call the getinfo Handler to get the required size and attribute.\r | |
111 | \r | |
112 | It will ASSERT () if the pointer to OutputBufferSize is NULL.\r | |
113 | It will ASSERT () if the pointer to ScratchBufferSize is NULL. | |
114 | It will ASSERT () if the pointer to SectionAttribute is NULL.\r | |
115 | \r | |
116 | @param[in] InputSection Buffer containing the input GUIDed section to be processed. \r | |
117 | @param[out] OutputBufferSize The size of OutputBuffer.\r | |
118 | @param[out] ScratchBufferSize The size of ScratchBuffer. \r | |
119 | @param[out] SectionAttribute The attribute of the input guided section.\r | |
120 | ||
121 | @retval RETURN_SUCCESS Get the required information successfully.\r | |
122 | @retval RETURN_UNSUPPORTED Guided section data is not supported.\r | |
123 | @retval RETURN_INVALID_PARAMETER The input data can't be parsed correctly.\r | |
124 | \r | |
125 | **/\r | |
126 | RETURN_STATUS\r | |
127 | EFIAPI\r | |
128 | ExtractGuidedSectionGetInfo (\r | |
129 | IN CONST VOID *InputSection,\r | |
130 | OUT UINT32 *OutputBufferSize,\r | |
131 | OUT UINT32 *ScratchBufferSize,\r | |
132 | OUT UINT16 *SectionAttribute \r | |
133 | );\r | |
134 | \r | |
135 | /** | |
136 | Extract data from the guided section. This function first gets the guid value\r | |
137 | from guided section header, then match this guid in the registered extract Handler list\r | |
138 | to its corresponding extract Handler. \r | |
139 | If not found, RETURN_UNSUPPORTED will be return. \r | |
140 | If found, it will call this extract Handler to get output data and AuthenticationStatus. | |
141 | \r | |
142 | It will ASSERT () if the pointer to OutputBuffer is NULL.\r | |
143 | It will ASSERT () if the pointer to AuthenticationStatus is NULL.\r | |
144 | \r | |
145 | @param[in] InputSection Buffer containing the input GUIDed section to be processed. \r | |
146 | @param[out] OutputBuffer OutputBuffer to point the start of the section's contents \r | |
147 | if guided data is not required prcessing. Otherwise,\r | |
148 | OutputBuffer to contain the output data, which is \r | |
149 | allocated by the caller.\r | |
150 | @param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use. \r | |
151 | @param[out] AuthenticationStatus \r | |
152 | A pointer to a caller-allocated UINT32 that indicates the\r | |
153 | authentication status of the output buffer. | |
154 | ||
d173d9c7 | 155 | @retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.\r |
18fd8d65 LG |
156 | @retval RETURN_UNSUPPORTED Guided section data is not supported to be decoded.\r |
157 | @retval RETURN_INVALID_PARAMETER The input data can't be parsed correctly. | |
158 | **/\r | |
159 | RETURN_STATUS\r | |
160 | EFIAPI\r | |
161 | ExtractGuidedSectionDecode (\r | |
162 | IN CONST VOID *InputSection,\r | |
163 | OUT VOID **OutputBuffer,\r | |
164 | OUT VOID *ScratchBuffer, OPTIONAL\r | |
165 | OUT UINT32 *AuthenticationStatus \r | |
166 | );\r | |
167 | \r | |
168 | #endif\r |