📄 cmpiprovider.h
字号:
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation, The Open Group.// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions:// // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////==============================================================================////%/////////////////////////////////////////////////////////////////////////////#ifndef Pegasus_CMPIProvider_h#define Pegasus_CMPIProvider_h#include "CMPI_Object.h"#include "CMPI_Broker.h"#include "CMPI_Version.h"#include <Pegasus/Common/Config.h>#include <Pegasus/Common/Thread.h>#include <Pegasus/Common/List.h>#include <Pegasus/Common/Mutex.h>#include <Pegasus/Provider/CIMOMHandle.h>#include <Pegasus/Provider/CIMOMHandle.h>#include <Pegasus/Provider/CIMInstanceProvider.h>#include <Pegasus/Provider/CIMAssociationProvider.h>#include <Pegasus/Provider/CIMMethodProvider.h>#include <Pegasus/ProviderManager2/CMPI/CMPIResolverModule.h>#include <Pegasus/ProviderManager2/CMPI/Linkage.h>PEGASUS_NAMESPACE_BEGINclass CMPIProviderModule;class CMPIResolverModule;#ifndef _CMPI_Broker_H_struct CMPI_Broker;#endif#define CMPI_MIType_Instance 1#define CMPI_MIType_Association 2#define CMPI_MIType_Method 4#define CMPI_MIType_Property 8#define CMPI_MIType_Indication 16/* Ver 1.00 CMPI spec - which added a new parameter. */#ifdef CMPI_VER_100typedef CMPIInstanceMI* (*CREATE_INST_MI)(const CMPIBroker*,const CMPIContext*, CMPIStatus *rc);typedef CMPIAssociationMI* (*CREATE_ASSOC_MI)(const CMPIBroker*,const CMPIContext*, CMPIStatus *rc);typedef CMPIMethodMI* (*CREATE_METH_MI)(const CMPIBroker*,const CMPIContext*, CMPIStatus *rc);typedef CMPIPropertyMI* (*CREATE_PROP_MI)(const CMPIBroker*,const CMPIContext*, CMPIStatus *rc);typedef CMPIIndicationMI* (*CREATE_IND_MI)(const CMPIBroker*,const CMPIContext*, CMPIStatus *rc);typedef CMPIInstanceMI* (*CREATE_GEN_INST_MI)(const CMPIBroker*,const CMPIContext*,const char*, CMPIStatus *rc);typedef CMPIAssociationMI* (*CREATE_GEN_ASSOC_MI)(const CMPIBroker*,const CMPIContext*,const char*, CMPIStatus *rc);typedef CMPIMethodMI* (*CREATE_GEN_METH_MI)(const CMPIBroker*,const CMPIContext*,const char*, CMPIStatus *rc);typedef CMPIPropertyMI* (*CREATE_GEN_PROP_MI)(const CMPIBroker*,const CMPIContext*,const char*, CMPIStatus *rc);typedef CMPIIndicationMI* (*CREATE_GEN_IND_MI)(const CMPIBroker*,const CMPIContext*,const char*, CMPIStatus *rc);#elsetypedef CMPIInstanceMI* (*CREATE_INST_MI)(CMPIBroker*,CMPIContext*);typedef CMPIAssociationMI* (*CREATE_ASSOC_MI)(CMPIBroker*,CMPIContext*);typedef CMPIMethodMI* (*CREATE_METH_MI)(CMPIBroker*,CMPIContext*);typedef CMPIPropertyMI* (*CREATE_PROP_MI)(CMPIBroker*,CMPIContext*);typedef CMPIIndicationMI* (*CREATE_IND_MI)(CMPIBroker*,CMPIContext*);typedef CMPIInstanceMI* (*CREATE_GEN_INST_MI)(CMPIBroker*,CMPIContext*,const char*);typedef CMPIAssociationMI* (*CREATE_GEN_ASSOC_MI)(CMPIBroker*,CMPIContext*,const char*);typedef CMPIMethodMI* (*CREATE_GEN_METH_MI)(CMPIBroker*,CMPIContext*,const char*);typedef CMPIPropertyMI* (*CREATE_GEN_PROP_MI)(CMPIBroker*,CMPIContext*,const char*);typedef CMPIIndicationMI* (*CREATE_GEN_IND_MI)(CMPIBroker*,CMPIContext*,const char*);#endif#define _Generic_Create_InstanceMI "_Generic_Create_InstanceMI"#define _Generic_Create_AssociationMI "_Generic_Create_AssociationMI"#define _Generic_Create_MethodMI "_Generic_Create_MethodMI"#define _Generic_Create_PropertyMI "_Generic_Create_PropertyMI"#define _Generic_Create_IndicationMI "_Generic_Create_IndicationMI"#define _Create_InstanceMI "_Create_InstanceMI"#define _Create_AssociationMI "_Create_AssociationMI"#define _Create_MethodMI "_Create_MethodMI"#define _Create_PropertyMI "_Create_PropertyMI"#define _Create_IndicationMI "_Create_IndicationMI"struct ProviderVector { int miTypes; int genericMode; CMPIInstanceMI *instMI; CMPIAssociationMI *assocMI; CMPIMethodMI *methMI; CMPIPropertyMI *propMI; CMPIIndicationMI *indMI; CREATE_INST_MI createInstMI; CREATE_ASSOC_MI createAssocMI; CREATE_METH_MI createMethMI; CREATE_PROP_MI createPropMI; CREATE_IND_MI createIndMI; CREATE_GEN_INST_MI createGenInstMI; CREATE_GEN_ASSOC_MI createGenAssocMI; CREATE_GEN_METH_MI createGenMethMI; CREATE_GEN_PROP_MI createGenPropMI; CREATE_GEN_IND_MI createGenIndMI;};// The CMPIProvider class represents the logical provider extracted from a// provider module. It is wrapped in a facade to stabalize the interface// and is directly tied to a module.class PEGASUS_CMPIPM_LINKAGE CMPIProvider : public virtual CIMProvider{public: enum Status { UNINITIALIZED, INITIALIZED };public: class pm_service_op_lock { private: pm_service_op_lock(void); public: pm_service_op_lock(CMPIProvider *provider) : _provider(provider) { _provider->protect(); } ~pm_service_op_lock(void) { _provider->unprotect(); } CMPIProvider * _provider; }; // typedef CMPIProviderFacade Base; CMPIProvider(CMPIProvider*); virtual ~CMPIProvider(void); virtual void initialize(CIMOMHandle & cimom); void setLocation(String loc) { _location=loc; } virtual Boolean tryTerminate(void); virtual void terminate(void); Status getStatus(void); String getName(void) const; void setResolver(CMPIResolverModule *rm) { _rm=rm; } void reset(); // Monitors threads that the provider has allocated. /* * Adds the thread to the watch list. The watch list is monitored when the * provider is terminated and if any of the threads have not cleaned up by * that time, they are forcifully terminated and cleaned up. * * @argument t Thread is not NULL. */ void addThreadToWatch(Thread *t); /* // Removes the thread from the watch list and schedule the CMPILocalProviderManager // to delete the thread. The CMPILocalProviderManager after deleting the thread calls // the CMPIProvider' "cleanupThread". The CMPILocalProviderManager notifies this // CMPIProvider object when the thread is truly dead by calling "threadDeleted" function. // // Note that this function is called from the thread that finished with // running the providers function, and returns immediately while scheduling the // a cleanup procedure. If you want to wait until the thread is truly deleted, // call 'waitUntilThreadsDone' - but DO NOT do it in the the thread that // the Thread owns - you will wait forever. // // @argument t Thread that is not NULL and finished with running the provider function. */ void removeThreadFromWatch(Thread *t); /* * Remove the thread from the list of threads that are being deleted * by the CMPILocalProviderManager. * * @argument t Thread which has been previously provided to 'removeThreadFromWatch' function. */ void threadDelete(Thread *t); /* * Check if the Thread is owner by this CMPIProvider object . * * @argument t Thread that is not NULL. */ Boolean isThreadOwner( Thread *t); CMPIProviderModule *getModule(void) const; virtual void get_idle_timer(struct timeval *);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -