]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | EFI_REGULAR_EXPRESSION_PROTOCOL Header File.\r | |
3 | \r | |
4 | (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r | |
5 | Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | \r | |
11 | #ifndef __REGULAR_EXPRESSIONDXE_H__\r | |
12 | #define __REGULAR_EXPRESSIONDXE_H__\r | |
13 | \r | |
14 | #include "oniguruma/src/oniguruma.h"\r | |
15 | \r | |
16 | #include <Uefi.h>\r | |
17 | #include <Protocol/RegularExpressionProtocol.h>\r | |
18 | #include <Library/UefiBootServicesTableLib.h>\r | |
19 | #include <Library/BaseMemoryLib.h>\r | |
20 | #include <Library/MemoryAllocationLib.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/BaseLib.h>\r | |
23 | \r | |
24 | /**\r | |
25 | Checks if the input string matches to the regular expression pattern.\r | |
26 | \r | |
27 | @param This A pointer to the EFI_REGULAR_EXPRESSION_PROTOCOL instance.\r | |
28 | Type EFI_REGULAR_EXPRESSION_PROTOCOL is defined in Section\r | |
29 | XYZ.\r | |
30 | \r | |
31 | @param String A pointer to a NULL terminated string to match against the\r | |
32 | regular expression string specified by Pattern.\r | |
33 | \r | |
34 | @param Pattern A pointer to a NULL terminated string that represents the\r | |
35 | regular expression.\r | |
36 | \r | |
37 | @param SyntaxType A pointer to the EFI_REGEX_SYNTAX_TYPE that identifies the\r | |
38 | regular expression syntax type to use. May be NULL in which\r | |
39 | case the function will use its default regular expression\r | |
40 | syntax type.\r | |
41 | \r | |
42 | @param Result On return, points to TRUE if String fully matches against\r | |
43 | the regular expression Pattern using the regular expression\r | |
44 | SyntaxType. Otherwise, points to FALSE.\r | |
45 | \r | |
46 | @param Captures A Pointer to an array of EFI_REGEX_CAPTURE objects to receive\r | |
47 | the captured groups in the event of a match. The full\r | |
48 | sub-string match is put in Captures[0], and the results of N\r | |
49 | capturing groups are put in Captures[1:N]. If Captures is\r | |
50 | NULL, then this function doesn't allocate the memory for the\r | |
51 | array and does not build up the elements. It only returns the\r | |
52 | number of matching patterns in CapturesCount. If Captures is\r | |
53 | not NULL, this function returns a pointer to an array and\r | |
54 | builds up the elements in the array. CapturesCount is also\r | |
55 | updated to the number of matching patterns found. It is the\r | |
56 | caller's responsibility to free the memory pool in Captures\r | |
57 | and in each CapturePtr in the array elements.\r | |
58 | \r | |
59 | @param CapturesCount On output, CapturesCount is the number of matching patterns\r | |
60 | found in String. Zero means no matching patterns were found\r | |
61 | in the string.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS The regular expression string matching\r | |
64 | completed successfully.\r | |
65 | @retval EFI_UNSUPPORTED The regular expression syntax specified by\r | |
66 | SyntaxType is not supported by this driver.\r | |
67 | @retval EFI_DEVICE_ERROR The regular expression string matching\r | |
68 | failed due to a hardware or firmware error.\r | |
69 | @retval EFI_INVALID_PARAMETER String, Pattern, Result, or CapturesCountis\r | |
70 | NULL.\r | |
71 | \r | |
72 | **/\r | |
73 | EFI_STATUS\r | |
74 | EFIAPI\r | |
75 | RegularExpressionMatch (\r | |
76 | IN EFI_REGULAR_EXPRESSION_PROTOCOL *This,\r | |
77 | IN CHAR16 *String,\r | |
78 | IN CHAR16 *Pattern,\r | |
79 | IN EFI_REGEX_SYNTAX_TYPE *SyntaxType OPTIONAL,\r | |
80 | OUT BOOLEAN *Result,\r | |
81 | OUT EFI_REGEX_CAPTURE **Captures OPTIONAL,\r | |
82 | OUT UINTN *CapturesCount\r | |
83 | );\r | |
84 | \r | |
85 | /**\r | |
86 | Returns information about the regular expression syntax types supported\r | |
87 | by the implementation.\r | |
88 | \r | |
89 | @param This A pointer to the EFI_REGULAR_EXPRESSION_PROTOCOL\r | |
90 | instance.\r | |
91 | \r | |
92 | @param RegExSyntaxTypeListSize On input, the size in bytes of RegExSyntaxTypeList.\r | |
93 | On output with a return code of EFI_SUCCESS, the\r | |
94 | size in bytes of the data returned in\r | |
95 | RegExSyntaxTypeList. On output with a return code\r | |
96 | of EFI_BUFFER_TOO_SMALL, the size of\r | |
97 | RegExSyntaxTypeList required to obtain the list.\r | |
98 | \r | |
99 | @param RegExSyntaxTypeList A caller-allocated memory buffer filled by the\r | |
100 | driver with one EFI_REGEX_SYNTAX_TYPE element\r | |
101 | for each supported Regular expression syntax\r | |
102 | type. The list must not change across multiple\r | |
103 | calls to the same driver. The first syntax\r | |
104 | type in the list is the default type for the\r | |
105 | driver.\r | |
106 | \r | |
107 | @retval EFI_SUCCESS The regular expression syntax types list\r | |
108 | was returned successfully.\r | |
109 | @retval EFI_UNSUPPORTED The service is not supported by this driver.\r | |
110 | @retval EFI_DEVICE_ERROR The list of syntax types could not be\r | |
111 | retrieved due to a hardware or firmware error.\r | |
112 | @retval EFI_BUFFER_TOO_SMALL The buffer RegExSyntaxTypeList is too small\r | |
113 | to hold the result.\r | |
114 | @retval EFI_INVALID_PARAMETER RegExSyntaxTypeListSize is NULL\r | |
115 | \r | |
116 | **/\r | |
117 | EFI_STATUS\r | |
118 | EFIAPI\r | |
119 | RegularExpressionGetInfo (\r | |
120 | IN EFI_REGULAR_EXPRESSION_PROTOCOL *This,\r | |
121 | IN OUT UINTN *RegExSyntaxTypeListSize,\r | |
122 | OUT EFI_REGEX_SYNTAX_TYPE *RegExSyntaxTypeList\r | |
123 | );\r | |
124 | \r | |
125 | #endif\r |