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