]> git.proxmox.com Git - mirror_edk2.git/blame - SignedCapsulePkg/Include/Library/IniParsingLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
582b6cdd 17 3.4) a hexadecimal value. The valid format is 0x[A-Fa-f0-9]+\r
034e881e
JY
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
fbf06957 23SPDX-License-Identifier: BSD-2-Clause-Patent\r
034e881e
JY
24\r
25**/\r
26\r
034e881e
JY
27#ifndef __INI_PARSING_LIB_H__\r
28#define __INI_PARSING_LIB_H__\r
29\r
30/**\r
31 Open an INI config file and return a context.\r
32\r
33 @param[in] DataBuffer Config raw file buffer.\r
34 @param[in] BufferSize Size of raw buffer.\r
35\r
36 @return Config data buffer is opened and context is returned.\r
37 @retval NULL No enough memory is allocated.\r
38 @retval NULL Config data buffer is invalid.\r
39**/\r
40VOID *\r
41EFIAPI\r
42OpenIniFile (\r
b8786489
MK
43 IN UINT8 *DataBuffer,\r
44 IN UINTN BufferSize\r
034e881e
JY
45 );\r
46\r
47/**\r
48 Get section entry string value.\r
49\r
50 @param[in] Context INI Config file context.\r
51 @param[in] SectionName Section name.\r
52 @param[in] EntryName Section entry name.\r
53 @param[out] EntryValue Point to the got entry string value.\r
54\r
55 @retval EFI_SUCCESS Section entry string value is got.\r
56 @retval EFI_NOT_FOUND Section is not found.\r
57**/\r
58EFI_STATUS\r
59EFIAPI\r
60GetStringFromDataFile (\r
b8786489
MK
61 IN VOID *Context,\r
62 IN CHAR8 *SectionName,\r
63 IN CHAR8 *EntryName,\r
64 OUT CHAR8 **EntryValue\r
034e881e
JY
65 );\r
66\r
67/**\r
68 Get section entry GUID value.\r
69\r
70 @param[in] Context INI Config file context.\r
71 @param[in] SectionName Section name.\r
72 @param[in] EntryName Section entry name.\r
73 @param[out] Guid Point to the got GUID value.\r
74\r
75 @retval EFI_SUCCESS Section entry GUID value is got.\r
76 @retval EFI_NOT_FOUND Section is not found.\r
77**/\r
78EFI_STATUS\r
79EFIAPI\r
80GetGuidFromDataFile (\r
b8786489
MK
81 IN VOID *Context,\r
82 IN CHAR8 *SectionName,\r
83 IN CHAR8 *EntryName,\r
84 OUT EFI_GUID *Guid\r
034e881e
JY
85 );\r
86\r
87/**\r
88 Get section entry decimal UINTN value.\r
89\r
90 @param[in] Context INI Config file context.\r
91 @param[in] SectionName Section name.\r
92 @param[in] EntryName Section entry name.\r
93 @param[out] Data Point to the got decimal UINTN value.\r
94\r
95 @retval EFI_SUCCESS Section entry decimal UINTN value is got.\r
96 @retval EFI_NOT_FOUND Section is not found.\r
97**/\r
98EFI_STATUS\r
99EFIAPI\r
100GetDecimalUintnFromDataFile (\r
b8786489
MK
101 IN VOID *Context,\r
102 IN CHAR8 *SectionName,\r
103 IN CHAR8 *EntryName,\r
104 OUT UINTN *Data\r
034e881e
JY
105 );\r
106\r
107/**\r
582b6cdd 108 Get section entry hexadecimal UINTN value.\r
034e881e
JY
109\r
110 @param[in] Context INI Config file context.\r
111 @param[in] SectionName Section name.\r
112 @param[in] EntryName Section entry name.\r
582b6cdd 113 @param[out] Data Point to the got hexadecimal UINTN value.\r
034e881e 114\r
582b6cdd 115 @retval EFI_SUCCESS Section entry hexadecimal UINTN value is got.\r
034e881e
JY
116 @retval EFI_NOT_FOUND Section is not found.\r
117**/\r
118EFI_STATUS\r
119EFIAPI\r
120GetHexUintnFromDataFile (\r
b8786489
MK
121 IN VOID *Context,\r
122 IN CHAR8 *SectionName,\r
123 IN CHAR8 *EntryName,\r
124 OUT UINTN *Data\r
034e881e
JY
125 );\r
126\r
127/**\r
582b6cdd 128 Get section entry hexadecimal UINT64 value.\r
034e881e
JY
129\r
130 @param[in] Context INI Config file context.\r
131 @param[in] SectionName Section name.\r
132 @param[in] EntryName Section entry name.\r
582b6cdd 133 @param[out] Data Point to the got hexadecimal UINT64 value.\r
034e881e 134\r
582b6cdd 135 @retval EFI_SUCCESS Section entry hexadecimal UINT64 value is got.\r
034e881e
JY
136 @retval EFI_NOT_FOUND Section is not found.\r
137**/\r
138EFI_STATUS\r
139EFIAPI\r
140GetHexUint64FromDataFile (\r
b8786489
MK
141 IN VOID *Context,\r
142 IN CHAR8 *SectionName,\r
143 IN CHAR8 *EntryName,\r
144 OUT UINT64 *Data\r
034e881e
JY
145 );\r
146\r
147/**\r
148 Close an INI config file and free the context.\r
149\r
150 @param[in] Context INI Config file context.\r
151**/\r
152VOID\r
153EFIAPI\r
154CloseIniFile (\r
b8786489 155 IN VOID *Context\r
034e881e
JY
156 );\r
157\r
158#endif\r