00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _CMPISRV_H_
00025 #define _CMPISRV_H_
00026 #include "OW_config.h"
00027
00028 #include <stdlib.h>
00029 #include <iostream>
00030
00031 #include "cmpidt.h"
00032 #include "cmpift.h"
00033
00034 #include "OW_config.h"
00035 #include "OW_Cache.hpp"
00036 #include "OW_CIMClass.hpp"
00037 #include "OW_CIMInstance.hpp"
00038 #include "OW_CIMProperty.hpp"
00039 #include "OW_CIMObjectPath.hpp"
00040 #include "OW_CIMParamValue.hpp"
00041 #include "OW_CIMValue.hpp"
00042 #include "OW_ResultHandlerIFC.hpp"
00043 #include "OW_ProviderEnvironmentIFC.hpp"
00044
00045
00046 typedef struct {
00047 void * oc;
00048 OpenWBEM::ProviderEnvironmentIFCRef cimom;
00049 } CMPIOperationContext;
00050
00051
00052
00053
00054
00055
00056 #define RESULT_Instance 1
00057
00058 #define RESULT_Object 2
00059 #define RESULT_ObjectPath 4
00060 #define RESULT_Value 8
00061 #define RESULT_Method 16
00062 #define RESULT_Indication 32
00063 #define RESULT_Response 64
00064 #define RESULT_set 128
00065 #define RESULT_done 256
00066
00067
00068 #define ENQ_BOT_LIST(i,f,l,n,p) { if (l) l->n=i; else f=i; \
00069 i->p=l; i->n=NULL; l=i;}
00070 #define ENQ_TOP_LIST(i,f,l,n,p) { if (f) f->p=i; else l=i; \
00071 i->p=NULL; i->n=f; f=i;}
00072 #define DEQ_FROM_LIST(i,f,l,n,p) \
00073 { if (i->n) i->n->p=i->p; else l=i->p; \
00074 if (i->p) i->p->n=i->n; else f=i->n;}
00075
00076 #define CMPI_MIType_Instance 1
00077 #define CMPI_MIType_Association 2
00078 #define CMPI_MIType_Method 4
00079 #define CMPI_MIType_Property 8
00080 #define CMPI_MIType_Indication 16
00081
00082 typedef CMPIInstanceMI* (*CREATE_INST_MI)(CMPIBroker*,CMPIContext*);
00083 typedef CMPIAssociationMI* (*CREATE_ASSOC_MI)(CMPIBroker*,CMPIContext*);
00084 typedef CMPIMethodMI* (*CREATE_METH_MI)(CMPIBroker*,CMPIContext*);
00085 typedef CMPIPropertyMI* (*CREATE_PROP_MI)(CMPIBroker*,CMPIContext*);
00086 typedef CMPIIndicationMI* (*CREATE_IND_MI)(CMPIBroker*,CMPIContext*);
00087
00088 typedef CMPIInstanceMI* (*CREATE_GEN_INST_MI)(CMPIBroker*,CMPIContext*,const char*);
00089 typedef CMPIAssociationMI* (*CREATE_GEN_ASSOC_MI)(CMPIBroker*,CMPIContext*,const char*);
00090 typedef CMPIMethodMI* (*CREATE_GEN_METH_MI)(CMPIBroker*,CMPIContext*,const char*);
00091 typedef CMPIPropertyMI* (*CREATE_GEN_PROP_MI)(CMPIBroker*,CMPIContext*,const char*);
00092 typedef CMPIIndicationMI* (*CREATE_GEN_IND_MI)(CMPIBroker*,CMPIContext*,const char*);
00093
00094 typedef struct {
00095 int miTypes;
00096 int genericMode;
00097 CMPIInstanceMI *instMI;
00098 CMPIAssociationMI *assocMI;
00099 CMPIMethodMI *methMI;
00100 CMPIPropertyMI *propMI;
00101 CMPIIndicationMI *indMI;
00102 CREATE_INST_MI createInstMI;
00103 CREATE_ASSOC_MI createAssocMI;
00104 CREATE_METH_MI createMethMI;
00105 CREATE_PROP_MI createPropMI;
00106 CREATE_IND_MI createIndMI;
00107 CREATE_GEN_INST_MI createGenInstMI;
00108 CREATE_GEN_ASSOC_MI createGenAssocMI;
00109 CREATE_GEN_METH_MI createGenMethMI;
00110 CREATE_GEN_PROP_MI createGenPropMI;
00111 CREATE_GEN_IND_MI createGenIndMI;
00112 } MIs;
00113
00114
00115 typedef struct _CMPIResultRefFT : public CMPIResultFT {
00116 } CMPIResultRefFT;
00117 typedef struct _CMPIResultInstFT : public CMPIResultFT {
00118 } CMPIResultInstFT;
00119 typedef struct _CMPIResultDataFT : public CMPIResultFT {
00120 } CMPIResultDataFT;
00121 typedef struct _CMPIResultMethFT : public CMPIResultFT {
00122 } CMPIResultMethFT;
00123
00124 extern CMPIInstanceFT *CMPI_Instance_Ftab;
00125 extern CMPIInstanceFT *CMPI_InstanceOnStack_Ftab;
00126
00127 extern CMPIObjectPathFT *CMPI_ObjectPath_Ftab;
00128 extern CMPIObjectPathFT *CMPI_ObjectPathOnStack_Ftab;
00129
00130 extern CMPIArgsFT *CMPI_Args_Ftab;
00131 extern CMPIArgsFT *CMPI_ArgsOnStack_Ftab;
00132
00133 extern CMPIContextFT *CMPI_Context_Ftab;
00134 extern CMPIContextFT *CMPI_ContextOnStack_Ftab;
00135
00136 extern CMPIResultFT *CMPI_ResultRefOnStack_Ftab;
00137 extern CMPIResultFT *CMPI_ResultInstOnStack_Ftab;
00138 extern CMPIResultFT *CMPI_ResultData_Ftab;
00139 extern CMPIResultFT *CMPI_ResultMethOnStack_Ftab;
00140 extern CMPIResultFT *CMPI_ResultResponseOnStack_Ftab;
00141
00142 extern CMPIDateTimeFT *CMPI_DateTime_Ftab;
00143 extern CMPIArrayFT *CMPI_Array_Ftab;
00144 extern CMPIStringFT *CMPI_String_Ftab;
00145
00146 extern CMPIBrokerFT *CMPI_Broker_Ftab;
00147 extern CMPIBrokerEncFT *CMPI_BrokerEnc_Ftab;
00148
00149 extern CMPIEnumerationFT *CMPI_ObjEnumeration_Ftab;
00150 extern CMPIEnumerationFT *CMPI_InstEnumeration_Ftab;
00151 extern CMPIEnumerationFT *CMPI_OpEnumeration_Ftab;
00152
00153 struct CMPI_Broker;
00154
00155 struct CMPI_Object {
00156 void *hdl;
00157 void *ftab;
00158 CMPI_Object *next,*prev;
00159 void *priv;
00160 CMPI_Object(OpenWBEM::CIMInstance*);
00161 CMPI_Object(OpenWBEM::CIMObjectPath*);
00162 CMPI_Object(OpenWBEM::CIMDateTime*);
00163 CMPI_Object(const OpenWBEM::String&);
00164 CMPI_Object(char*);
00165 CMPI_Object(void*,void*);
00166 CMPI_Object(OpenWBEM::Array<OpenWBEM::CIMParamValue>*);
00167 CMPI_Object(CMPIData*);
00168 CMPI_Object(CMPI_Object*);
00169 ~CMPI_Object();
00170 void unlinkAndDelete();
00171 };
00172
00173 struct CMPI_Context : CMPIContext {
00174 CMPI_Object *next,*prev;
00175 ::CMPIOperationContext* ctx;
00176 CMPI_Context(const ::CMPIOperationContext& ct);
00177 };
00178
00179 struct CMPI_ContextOnStack : CMPIContext {
00180 CMPI_Object *next,*prev;
00181 ::CMPIOperationContext* ctx;
00182 CMPI_ContextOnStack(const ::CMPIOperationContext& ct);
00183 ~CMPI_ContextOnStack();
00184 };
00185
00186
00187 template<typename T>
00188 class CMPISingleValueResultHandler : public OpenWBEM::ResultHandlerIFC<T>
00189 {
00190 public:
00191 CMPISingleValueResultHandler()
00192 : _t(OpenWBEM::CIMNULL)
00193 {
00194 }
00195
00196 T& getValue()
00197 {
00198 return _t;
00199 }
00200 protected:
00201 virtual void doHandle(const T& t)
00202 {
00203 _t = t;
00204 }
00205 private:
00206 T _t;
00207 };
00208
00209 typedef CMPISingleValueResultHandler<OpenWBEM::CIMClass> CMPIClassValueResultHandler;
00210 typedef CMPISingleValueResultHandler<OpenWBEM::CIMObjectPath> CMPIObjectPathValueResultHandler;
00211 typedef CMPISingleValueResultHandler<OpenWBEM::CIMInstance> CMPIInstanceValueResultHandler;
00212 typedef CMPISingleValueResultHandler<OpenWBEM::CIMValue> CMPIValueValueResultHandler;
00213
00214
00215 struct CMPI_Result : CMPIResult {
00216 CMPI_Object *next,*prev;
00217 long flags;
00218 CMPI_Broker *xBroker;
00219 };
00220
00221 struct CMPI_ResultOnStack : CMPIResult {
00222 CMPI_Object *next,*prev;
00223 long flags;
00224 CMPI_Broker *xBroker;
00225 CMPI_ResultOnStack(const OpenWBEM::CIMObjectPathResultHandlerIFC & handler);
00226 CMPI_ResultOnStack(const OpenWBEM::CIMInstanceResultHandlerIFC& handler);
00227 CMPI_ResultOnStack(const CMPIObjectPathValueResultHandler & handler);
00228 CMPI_ResultOnStack(const CMPIValueValueResultHandler & handler);
00229 #if 0
00230 CMPI_ResultOnStack(const MethodResultResponseHandler& handler);
00231 CMPI_ResultOnStack(const ResponseHandler& handler);
00232 #endif
00233 CMPI_ResultOnStack();
00234 ~CMPI_ResultOnStack();
00235 };
00236
00237 struct CMPI_InstanceOnStack : CMPIInstance {
00238 CMPI_Object *next,*prev;
00239 void *priv;
00240 CMPI_InstanceOnStack(const OpenWBEM::CIMInstance& ci);
00241 };
00242
00243
00244 struct CMPI_ObjectPathOnStack : CMPIObjectPath {
00245 CMPI_Object *next,*prev;
00246 CMPI_ObjectPathOnStack(const OpenWBEM::CIMObjectPath& cop);
00247 };
00248
00249 struct CMPI_ArgsOnStack : CMPIArgs {
00250 CMPI_Object *next,*prev;
00251 CMPI_ArgsOnStack(const OpenWBEM::Array<OpenWBEM::CIMParamValue>& args);
00252 };
00253
00254
00255 struct CMPI_String : CMPIString {
00256 CMPI_Object *next,*prev;
00257 };
00258
00259 struct CMPI_DateTime : CMPIDateTime {
00260 CMPI_Object *next,*prev;
00261 };
00262
00263 struct CMPI_ObjEnumeration : CMPIEnumeration {
00264 CMPI_Object *next,*prev;
00265 int max,cursor;
00266
00267 CMPI_ObjEnumeration(OpenWBEM::Array<OpenWBEM::CIMInstance>* ia);
00268 };
00269
00270 struct CMPI_InstEnumeration : CMPIEnumeration {
00271 CMPI_Object *next,*prev;
00272 int max,cursor;
00273 CMPI_InstEnumeration(OpenWBEM::Array<OpenWBEM::CIMInstance>* ia);
00274 };
00275
00276 struct CMPI_OpEnumeration : CMPIEnumeration {
00277 CMPI_Object *next,*prev;
00278 int max,cursor;
00279 CMPI_OpEnumeration(OpenWBEM::Array<OpenWBEM::CIMObjectPath>* opa);
00280 };
00281
00282
00283
00284
00285
00286
00287 typedef OpenWBEM::Cache<OpenWBEM::CIMClass> ClassCache;
00288
00289 struct CMPI_Broker : CMPIBroker {
00290
00291 };
00292
00293
00294 #include "cmpiThreadContext.h"
00295
00296 CMPIString* string2CMPIString(const OpenWBEM::String &s);
00297 CMPIType type2CMPIType(OpenWBEM::CIMDataType pt, int array);
00298 OpenWBEM::CIMValue value2CIMValue(const CMPIValue* data, const CMPIType type, CMPIrc *rc);
00299 CMPIrc key2CMPIData(const OpenWBEM::String& v, OpenWBEM::CIMDataType t, CMPIData *data);
00300
00301 CMPIrc value2CMPIData(const OpenWBEM::CIMValue&,CMPIType,CMPIData *data);
00302
00303 OpenWBEM::CIMClass *mbGetClass(const CMPIBroker *mb, const OpenWBEM::CIMObjectPath &cop);
00304
00305 #endif
00306