1 krisbash 1.1 /*
2 **==============================================================================
3 **
4 ** Open Management Infrastructure (OMI)
5 **
6 ** Copyright (c) Microsoft Corporation
7 **
8 ** Licensed under the Apache License, Version 2.0 (the "License"); you may not
9 ** use this file except in compliance with the License. You may obtain a copy
10 ** of the License at
11 **
12 ** http://www.apache.org/licenses/LICENSE-2.0
13 **
14 ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 ** MERCHANTABLITY OR NON-INFRINGEMENT.
18 **
19 ** See the Apache 2 License for the specific language governing permissions
20 ** and limitations under the License.
21 **
22 krisbash 1.1 **==============================================================================
23 */
24
25 #ifndef _provmgr_filter_h
26 #define _provmgr_filter_h
27
28 #include <common.h>
29 #include <base/messages.h>
30 #include <wql/wql.h>
31
32 BEGIN_EXTERNC
33
34 typedef struct _InstanceFilter InstanceFilter;
35
36 /*
37 * Defines common internal operations for structs derived from InstanceFilter.
38 */
39 typedef struct _InstanceFilterFT
40 {
41 /* Evaluates the specified instance using the pre-defined filter */
42 MI_Result (*Filter)(
43 krisbash 1.1 _In_ InstanceFilter* self,
44 _In_ const MI_Instance* instance,
45 _Out_ MI_Boolean* isMatch);
46
47 /* Cleans up the InstanceFilter's internal state */
48 void (*Destroy)(
49 _In_ InstanceFilter* self);
50
51 /* Gets the query WQL or CQL */
52 WQL* (*GetWQL)(
53 _In_ InstanceFilter* self);
54 }
55 InstanceFilterFT;
56
57 /*
58 * Base structure for all "derived" InstanceFilter.
59 */
60 struct _InstanceFilter
61 {
62 MI_Filter base;
63 MI_Uint32 magic;
64 krisbash 1.1
65 InstanceFilterFT* ft;
66
67 Message* msg;
68 };
69
70
71
72 /*
73 * Generates a "derived" InstanceFilter structure based on the specified
74 * query within the message. It allocates the filter using the msg's
75 * Batch and initializes internal values.
76 *
77 * Returns newly allocated filter or NULL for failure.
78 */
79 InstanceFilter* InstanceFilter_New(
80 _In_ Message* msg);
81
82 /*
83 * Deactivates the filter and cleans it up.
84 */
85 krisbash 1.1 void InstanceFilter_Destroy(
86 _Inout_ InstanceFilter* self );
87
88 MI_Result InstanceFilter_Filter(
89 _In_ InstanceFilter* self,
90 _In_ const MI_Instance* instance,
91 _Out_ MI_Boolean* isMatch );
92
93 WQL* InstanceFilter_GetWQL(
94 _In_ InstanceFilter* self );
95
96 END_EXTERNC
97
98 #endif /* _provmgr_filter_h */
99
|