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