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