]>
Commit | Line | Data |
---|---|---|
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 hexadecimal 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 | |
22 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
23 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
24 | \r | |
25 | **/\r | |
26 | \r | |
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 | |
40 | VOID *\r | |
41 | EFIAPI\r | |
42 | OpenIniFile (\r | |
43 | IN UINT8 *DataBuffer,\r | |
44 | IN UINTN BufferSize\r | |
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 | |
58 | EFI_STATUS\r | |
59 | EFIAPI\r | |
60 | GetStringFromDataFile (\r | |
61 | IN VOID *Context,\r | |
62 | IN CHAR8 *SectionName,\r | |
63 | IN CHAR8 *EntryName,\r | |
64 | OUT CHAR8 **EntryValue\r | |
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 | |
78 | EFI_STATUS\r | |
79 | EFIAPI\r | |
80 | GetGuidFromDataFile (\r | |
81 | IN VOID *Context,\r | |
82 | IN CHAR8 *SectionName,\r | |
83 | IN CHAR8 *EntryName,\r | |
84 | OUT EFI_GUID *Guid\r | |
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 | |
98 | EFI_STATUS\r | |
99 | EFIAPI\r | |
100 | GetDecimalUintnFromDataFile (\r | |
101 | IN VOID *Context,\r | |
102 | IN CHAR8 *SectionName,\r | |
103 | IN CHAR8 *EntryName,\r | |
104 | OUT UINTN *Data\r | |
105 | );\r | |
106 | \r | |
107 | /**\r | |
108 | Get section entry hexadecimal UINTN value.\r | |
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 | |
113 | @param[out] Data Point to the got hexadecimal UINTN value.\r | |
114 | \r | |
115 | @retval EFI_SUCCESS Section entry hexadecimal UINTN value is got.\r | |
116 | @retval EFI_NOT_FOUND Section is not found.\r | |
117 | **/\r | |
118 | EFI_STATUS\r | |
119 | EFIAPI\r | |
120 | GetHexUintnFromDataFile (\r | |
121 | IN VOID *Context,\r | |
122 | IN CHAR8 *SectionName,\r | |
123 | IN CHAR8 *EntryName,\r | |
124 | OUT UINTN *Data\r | |
125 | );\r | |
126 | \r | |
127 | /**\r | |
128 | Get section entry hexadecimal UINT64 value.\r | |
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 | |
133 | @param[out] Data Point to the got hexadecimal UINT64 value.\r | |
134 | \r | |
135 | @retval EFI_SUCCESS Section entry hexadecimal UINT64 value is got.\r | |
136 | @retval EFI_NOT_FOUND Section is not found.\r | |
137 | **/\r | |
138 | EFI_STATUS\r | |
139 | EFIAPI\r | |
140 | GetHexUint64FromDataFile (\r | |
141 | IN VOID *Context,\r | |
142 | IN CHAR8 *SectionName,\r | |
143 | IN CHAR8 *EntryName,\r | |
144 | OUT UINT64 *Data\r | |
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 | |
152 | VOID\r | |
153 | EFIAPI\r | |
154 | CloseIniFile (\r | |
155 | IN VOID *Context\r | |
156 | );\r | |
157 | \r | |
158 | #endif\r |