]> git.proxmox.com Git - mirror_edk2.git/blame - SignedCapsulePkg/Include/Library/IniParsingLib.h
SignedCapsulePkg/Include: Add PlatformFlashAccessLib header.
[mirror_edk2.git] / SignedCapsulePkg / Include / Library / IniParsingLib.h
CommitLineData
034e881e
JY
1/** @file\r
2 INI configuration parsing library.\r
3\r
4 The INI file format is:\r
5 ================\r
6 [SectionName]\r
7 EntryName=EntryValue\r
8 ================\r
9\r
10 Where:\r
11 1) SectionName is an ASCII string. The valid format is [A-Za-z0-9_]+\r
12 2) EntryName is an ASCII string. The valid format is [A-Za-z0-9_]+\r
13 3) EntryValue can be:\r
14 3.1) an ASCII String. The valid format is [A-Za-z0-9_]+\r
15 3.2) a GUID. The valid format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where x is [A-Fa-f0-9]\r
16 3.3) a decimal value. The valid format is [0-9]+\r
17 3.4) a heximal value. The valid format is 0x[A-Fa-f0-9]+\r
18 4) '#' or ';' can be used as comment at anywhere.\r
19 5) TAB(0x20) or SPACE(0x9) can be used as separator.\r
20 6) LF(\n, 0xA) or CR(\r, 0xD) can be used as line break.\r
21\r
22Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
23This program and the accompanying materials\r
24are licensed and made available under the terms and conditions of the BSD License\r
25which accompanies this distribution. The full text of the license may be found at\r
26http://opensource.org/licenses/bsd-license.php\r
27\r
28THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
29WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
30\r
31**/\r
32\r
33\r
34#ifndef __INI_PARSING_LIB_H__\r
35#define __INI_PARSING_LIB_H__\r
36\r
37/**\r
38 Open an INI config file and return a context.\r
39\r
40 @param[in] DataBuffer Config raw file buffer.\r
41 @param[in] BufferSize Size of raw buffer.\r
42\r
43 @return Config data buffer is opened and context is returned.\r
44 @retval NULL No enough memory is allocated.\r
45 @retval NULL Config data buffer is invalid.\r
46**/\r
47VOID *\r
48EFIAPI\r
49OpenIniFile (\r
50 IN UINT8 *DataBuffer,\r
51 IN UINTN BufferSize\r
52 );\r
53\r
54/**\r
55 Get section entry string value.\r
56\r
57 @param[in] Context INI Config file context.\r
58 @param[in] SectionName Section name.\r
59 @param[in] EntryName Section entry name.\r
60 @param[out] EntryValue Point to the got entry string value.\r
61\r
62 @retval EFI_SUCCESS Section entry string value is got.\r
63 @retval EFI_NOT_FOUND Section is not found.\r
64**/\r
65EFI_STATUS\r
66EFIAPI\r
67GetStringFromDataFile (\r
68 IN VOID *Context,\r
69 IN CHAR8 *SectionName,\r
70 IN CHAR8 *EntryName,\r
71 OUT CHAR8 **EntryValue\r
72 );\r
73\r
74/**\r
75 Get section entry GUID value.\r
76\r
77 @param[in] Context INI Config file context.\r
78 @param[in] SectionName Section name.\r
79 @param[in] EntryName Section entry name.\r
80 @param[out] Guid Point to the got GUID value.\r
81\r
82 @retval EFI_SUCCESS Section entry GUID value is got.\r
83 @retval EFI_NOT_FOUND Section is not found.\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87GetGuidFromDataFile (\r
88 IN VOID *Context,\r
89 IN CHAR8 *SectionName,\r
90 IN CHAR8 *EntryName,\r
91 OUT EFI_GUID *Guid\r
92 );\r
93\r
94/**\r
95 Get section entry decimal UINTN value.\r
96\r
97 @param[in] Context INI Config file context.\r
98 @param[in] SectionName Section name.\r
99 @param[in] EntryName Section entry name.\r
100 @param[out] Data Point to the got decimal UINTN value.\r
101\r
102 @retval EFI_SUCCESS Section entry decimal UINTN value is got.\r
103 @retval EFI_NOT_FOUND Section is not found.\r
104**/\r
105EFI_STATUS\r
106EFIAPI\r
107GetDecimalUintnFromDataFile (\r
108 IN VOID *Context,\r
109 IN CHAR8 *SectionName,\r
110 IN CHAR8 *EntryName,\r
111 OUT UINTN *Data\r
112 );\r
113\r
114/**\r
115 Get section entry heximal UINTN value.\r
116\r
117 @param[in] Context INI Config file context.\r
118 @param[in] SectionName Section name.\r
119 @param[in] EntryName Section entry name.\r
120 @param[out] Data Point to the got heximal UINTN value.\r
121\r
122 @retval EFI_SUCCESS Section entry heximal UINTN value is got.\r
123 @retval EFI_NOT_FOUND Section is not found.\r
124**/\r
125EFI_STATUS\r
126EFIAPI\r
127GetHexUintnFromDataFile (\r
128 IN VOID *Context,\r
129 IN CHAR8 *SectionName,\r
130 IN CHAR8 *EntryName,\r
131 OUT UINTN *Data\r
132 );\r
133\r
134/**\r
135 Get section entry heximal UINT64 value.\r
136\r
137 @param[in] Context INI Config file context.\r
138 @param[in] SectionName Section name.\r
139 @param[in] EntryName Section entry name.\r
140 @param[out] Data Point to the got heximal UINT64 value.\r
141\r
142 @retval EFI_SUCCESS Section entry heximal UINT64 value is got.\r
143 @retval EFI_NOT_FOUND Section is not found.\r
144**/\r
145EFI_STATUS\r
146EFIAPI\r
147GetHexUint64FromDataFile (\r
148 IN VOID *Context,\r
149 IN CHAR8 *SectionName,\r
150 IN CHAR8 *EntryName,\r
151 OUT UINT64 *Data\r
152 );\r
153\r
154/**\r
155 Close an INI config file and free the context.\r
156\r
157 @param[in] Context INI Config file context.\r
158**/\r
159VOID\r
160EFIAPI\r
161CloseIniFile (\r
162 IN VOID *Context\r
163 );\r
164\r
165#endif\r
166\r