1 mike 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 mike 1.1 **==============================================================================
23 */
24
25 #ifndef _omi_provreg_h
26 #define _omi_provreg_h
27
28 #include <common.h>
29 #include <base/stringarray.h>
30 #include <base/batch.h>
31
32 BEGIN_EXTERNC
33
34 typedef enum _ProvInterface
35 {
36 PROV_INTERFACE_STATIK = 1
37 }
38 ProvInterface;
39
40 typedef enum _ProvHosting
41 {
42 PROV_HOSTING_INPROC = 0,
43 mike 1.1 PROV_HOSTING_REQUESTOR = 1,
44 PROV_HOSTING_USER = 2
45 }
46 ProvHosting;
47
48 #define PROV_REG_HOSTING_INPROC "@inproc@"
49 #define PROV_REG_HOSTING_REQUESTOR "@requestor@"
50
51 typedef struct _ProvRegPosition
52 {
53 struct _ProvRegClassInheritanceNode* start;
54 struct _ProvRegClassInheritanceNode* current;
55 MI_Boolean deep;
56 }
57 ProvRegPosition;
58
59 typedef struct _ProvRegAssocPosition
60 {
61 struct _ProvRegClassInheritanceNode* assocClass;
62 struct _ProvRegClassInheritanceNode* resultClass;
63 struct _ProvRegClassInheritanceNode* currentLeft;
64 mike 1.1 struct _ProvRegAssocBackLinkNode* currentAssoc;
65 struct _ProvRegClassInheritanceNode* currentRight;
66 }
67 ProvRegAssocPosition;
68
69 typedef struct _ProvRegEntry
70 {
71 /* Pointer to next entry */
72 struct _ProvRegEntry* next;
73
74 /* Provider interface type */
75 ProvInterface provInterface;
76
77 /* Hosting type for provider execution */
78 ProvHosting hosting;
79
80 /* User name for 'USER' mode (when user specified at registration time) */
81 const char* user;
82
83 /* Namespace this provider serves */
84 const MI_Char* nameSpace;
85 mike 1.1
86 /* Class this provider supplies */
87 const MI_Char* className;
88
89 /* The name library of the library containing provider */
90 const char* libraryName;
91 }
92 ProvRegEntry;
93
94 typedef struct _ProvReg
95 {
96 Batch batch;
97 char buffer[1024];
98 ProvRegEntry* head;
99 ProvRegEntry* tail;
100 struct _ProvRegNamespaceNode* namespaces;
101 }
102 ProvReg;
103
104
105 MI_Result ProvReg_Init2(
106 mike 1.1 ProvReg* self);
107
108 void ProvReg_Destroy(
109 ProvReg* self);
110
111 const ProvRegEntry* ProvReg_FindProviderForClass(
112 ProvReg* self,
113 const MI_Char* nameSpace,
114 const MI_Char* className);
115
116
117 /* returns ok or not-found; baseClass will be null if no base class exist */
118 MI_EXPORT MI_Result ProvReg_GetDirectBaseClass(
119 ProvReg* self,
120 const MI_Char* nameSpace,
121 const MI_Char* className,
122 const MI_Char** baseClass);
123
124 /* enumerates classes derived classes:
125 - if deep == false and className == null, returns all root classes
126 - if deep == true and className == null, returns all classes
127 mike 1.1 - if deep == false and className provided, returns all classes directly derived from given
128 - if deep == true and className provided, returns all classes derived from given
129 */
130 MI_EXPORT MI_Result ProvReg_BeginClasses(
131 ProvReg* self,
132 const MI_Char* nameSpace,
133 const MI_Char* className,
134 MI_Boolean deep,
135 ProvRegPosition* pos);
136
137 MI_EXPORT MI_Result ProvReg_NextClass(
138 ProvRegPosition* pos,
139 const MI_Char** className,
140 MI_Boolean* done);
141
142 MI_EXPORT MI_Result ProvReg_EndClasses(
143 ProvRegPosition* pos);
144
145
146 /* returns enumerator to all registered association classes by given instance
147 * class and (optionally) assoc/result classes
148 mike 1.1 */
149 MI_EXPORT MI_Result ProvReg_BeginAssocClasses(
150 ProvReg* self,
151 const MI_Char* nameSpace,
152 const MI_Char* className,
153 const MI_Char* assocClassName, /* can be NULL */
154 const MI_Char* resultClassName, /* can be NULL */
155 ProvRegAssocPosition* pos);
156
157 MI_EXPORT MI_Result ProvReg_NextAssocClass(
158 ProvRegAssocPosition* pos,
159 const MI_Char** className,
160 MI_Boolean* done);
161
162 MI_EXPORT MI_Result ProvReg_EndAssocClasses(
163 ProvRegAssocPosition* pos);
164
165 void ProvReg_Dump(
166 ProvReg* self,
167 FILE* os);
168
169 mike 1.1 END_EXTERNC
170
171 #endif /* _omi_provreg_h */
|