(file) Return to provreg.h CVS log (file) (dir) Up to [OMI] / omi / provreg

  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 krisbash 1.3 #include <pal/dir.h>
 32 mike     1.1 
 33              BEGIN_EXTERNC
 34              
 35              typedef enum _ProvInterface
 36              {
 37                  PROV_INTERFACE_STATIK = 1
 38              }
 39              ProvInterface;
 40              
 41 krisbash 1.3 typedef enum _ProvRegType
 42              {
 43                  PROVREG_DEFAULT = 0,
 44                  PROVREG_INDICATION = 1
 45              } ProvRegType;
 46              
 47 mike     1.1 typedef enum _ProvHosting
 48              {
 49                  PROV_HOSTING_INPROC = 0,
 50                  PROV_HOSTING_REQUESTOR = 1,
 51                  PROV_HOSTING_USER = 2
 52              }
 53              ProvHosting;
 54              
 55              #define  PROV_REG_HOSTING_INPROC          "@inproc@"
 56              #define  PROV_REG_HOSTING_REQUESTOR       "@requestor@"
 57              
 58              typedef struct _ProvRegPosition
 59              {
 60                  struct _ProvRegClassInheritanceNode* start;
 61                  struct _ProvRegClassInheritanceNode* current;
 62                  MI_Boolean deep;
 63              }
 64              ProvRegPosition;
 65              
 66              typedef struct _ProvRegAssocPosition
 67              {
 68 mike     1.1     struct _ProvRegClassInheritanceNode*    assocClass;
 69                  struct _ProvRegClassInheritanceNode*    resultClass;
 70                  struct _ProvRegClassInheritanceNode*    currentLeft;
 71                  struct _ProvRegAssocBackLinkNode*       currentAssoc;
 72                  struct _ProvRegClassInheritanceNode*    currentRight;
 73              }
 74              ProvRegAssocPosition;
 75              
 76              typedef struct _ProvRegEntry
 77              {
 78                  /* Pointer to next entry */
 79                  struct _ProvRegEntry* next;
 80              
 81                  /* Provider interface type */
 82                  ProvInterface provInterface;
 83              
 84                  /* Hosting type for provider execution */
 85                  ProvHosting hosting;
 86              
 87                  /* User name for 'USER' mode (when user specified at registration time) */
 88                  const char*     user;
 89 mike     1.1 
 90                  /* Namespace this provider serves */
 91 krisbash 1.3     const ZChar* nameSpace;
 92                  unsigned int nameSpaceHash;
 93 mike     1.1 
 94                  /* Class this provider supplies */
 95 krisbash 1.3     const ZChar* className;
 96                  unsigned int classNameHash;
 97 mike     1.1 
 98                  /* The name library of the library containing provider */
 99                  const char* libraryName;
100 krisbash 1.3 
101              #if defined(CONFIG_ENABLE_PREEXEC)
102              
103                  /* Name of program to be executed before invoking this provider */
104                  const char* preexec;
105              
106              #endif /* defined(CONFIG_ENABLE_PREEXEC) */
107              
108                  /* The type of the registered class */
109                  ProvRegType regType;
110              
111                  /* 1 if lifetime of instance is that of context,
112                   * 0 otherwise
113                   */
114                  int instanceLifetimeContext;
115 mike     1.1 }
116              ProvRegEntry;
117              
118              typedef struct _ProvReg
119              {
120                  Batch batch;
121                  char buffer[1024];
122                  ProvRegEntry* head;
123                  ProvRegEntry* tail;
124                  struct _ProvRegNamespaceNode* namespaces;
125 krisbash 1.3     struct _ProvRegNamespaceNode* namespacesForExtraClasses;
126 mike     1.1 }
127              ProvReg;
128              
129 krisbash 1.3 /* Initialize ProvReg strucutre from given directory */
130              MI_Result ProvReg_Init(
131                  _Inout_ ProvReg* self,
132                  _In_z_ const char* directory);
133 mike     1.1 
134 krisbash 1.3 /* Initialize ProvReg strucutre from omiregister directory */
135 mike     1.1 MI_Result ProvReg_Init2(
136 krisbash 1.3     _Inout_ ProvReg* self);
137 mike     1.1 
138              void ProvReg_Destroy(
139                  ProvReg* self);
140              
141              const ProvRegEntry* ProvReg_FindProviderForClass(
142                  ProvReg* self,
143 krisbash 1.3     const ZChar* nameSpace,
144                  const ZChar* className,
145                  MI_Result *findError);
146 mike     1.1 
147              /* returns ok or not-found; baseClass will be null if no base class exist */
148              MI_EXPORT MI_Result ProvReg_GetDirectBaseClass(
149                  ProvReg* self,
150 krisbash 1.3     const ZChar* nameSpace,
151                  const ZChar* className,
152                  const ZChar** baseClass,
153                  MI_Boolean extraClass);
154 mike     1.1 
155              /* enumerates classes derived classes:
156               - if deep == false and className == null, returns all root classes
157               - if deep == true and className == null, returns all classes
158               - if deep == false and className provided, returns all classes directly derived from given
159               - if deep == true and className provided, returns all classes derived from given
160              */
161              MI_EXPORT MI_Result ProvReg_BeginClasses(
162                  ProvReg* self,
163 krisbash 1.3     const ZChar* nameSpace,
164                  const ZChar* className,
165 mike     1.1     MI_Boolean deep,
166 krisbash 1.3     ProvRegPosition* pos,
167                  MI_Boolean extraClass);
168 mike     1.1 
169              MI_EXPORT MI_Result ProvReg_NextClass(
170                  ProvRegPosition* pos,
171 krisbash 1.3     const ZChar** className,
172 mike     1.1     MI_Boolean* done);
173              
174              MI_EXPORT MI_Result ProvReg_EndClasses(
175                  ProvRegPosition* pos);
176              
177              
178              /* returns enumerator to all registered association classes by given instance 
179               * class and (optionally) assoc/result classes 
180               */
181              MI_EXPORT MI_Result ProvReg_BeginAssocClasses(
182                  ProvReg* self,
183 krisbash 1.3     const ZChar* nameSpace,
184                  const ZChar* className,
185                  const ZChar* assocClassName,  /* can be NULL */
186                  const ZChar* resultClassName, /* can be NULL */
187 mike     1.1     ProvRegAssocPosition* pos);
188              
189              MI_EXPORT MI_Result ProvReg_NextAssocClass(
190                  ProvRegAssocPosition* pos,
191 krisbash 1.3     const ZChar** className,
192 mike     1.1     MI_Boolean* done);
193              
194              MI_EXPORT MI_Result ProvReg_EndAssocClasses(
195                  ProvRegAssocPosition* pos);
196              
197 krisbash 1.3 void MapRegPositionValuesToRegEntry(
198                  ProvRegEntry* reg,
199                  ProvRegPosition* pos);
200              
201 mike     1.1 void ProvReg_Dump(
202                  ProvReg* self,
203                  FILE* os);
204              
205 krisbash 1.3 /* Find provider registration object for class */
206              const ProvRegEntry* ProvReg_FindProviderForClassByType(
207                  _In_ ProvReg* self,
208                  _In_z_ const ZChar* nameSpace,
209                  _In_opt_z_ const ZChar* className,
210                  _In_ ProvRegType type,
211                  _Out_ MI_Result *findError);
212              
213 mike     1.1 END_EXTERNC
214              
215              #endif /* _omi_provreg_h */

ViewCVS 0.9.2