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