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