provider.h

Go to the documentation of this file.
00001 /*
00002  * provider.h
00003  *
00004  * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE 
00005  * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE 
00006  * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
00007  *
00008  * You can obtain a current copy of the Common Public License from
00009  * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html
00010  *
00011  * Author: Frank Scheffler <frank.scheffler@de.ibm.com>
00012  * Contributors:
00013  *
00014  * Description: InstanceProvider function definitions and the 
00015  *              <LIBNAME>_initFunctionTable macro.
00016  */
00017 #ifndef _PROVIDER_H_
00018 #define _PROVIDER_H_
00019 
00020 #ifdef __cplusplus
00021 #define EXTERN_C extern "C"
00022 #else
00023 #define EXTERN_C
00024 #endif
00025 
00026 #include "npi.h"
00027 
00028 /* 
00029  * These are the CIMProvider methods, that have to be written for any provider.
00030  */
00031 static char * initialize ( NPIHandle *, CIMOMHandle );
00032 static void cleanup ( NPIHandle * );
00033 
00034 
00035 /*
00036  * This part defines the InstanceProvider methods and their function pointers,
00037  * if the provider is meant to be an instance provider.
00038  */
00039 #ifdef INSTANCE_PROVIDER
00040 #define _INCLUDE_INSTANCE_PROVIDER_METHODS \
00041             enumInstanceNames, enumInstances, \
00042             getInstance, createInstance, setInstance, deleteInstance, execQuery,
00043 #else
00044 #define _INCLUDE_INSTANCE_PROVIDER_METHODS \
00045             0, 0, 0, 0, 0, 0, 0,
00046 #endif
00047 
00048 static Vector enumInstanceNames ( NPIHandle *, CIMObjectPath, int, CIMClass );
00049 static Vector enumInstances ( NPIHandle *, CIMObjectPath, int, CIMClass, int );
00050 static CIMInstance getInstance ( NPIHandle *, CIMObjectPath, CIMClass, int );
00051 static CIMObjectPath createInstance ( NPIHandle *, CIMObjectPath, 
00052                   CIMInstance );
00053 static void setInstance ( NPIHandle *, CIMObjectPath, CIMInstance );
00054 static void deleteInstance ( NPIHandle *, CIMObjectPath );
00055 static Vector execQuery ( NPIHandle *, CIMObjectPath, const char *, int, 
00056            CIMClass );
00057 
00058 /* 
00059  * This part defines the AssociatorProvider methods and their function 
00060  * pointers, if the provider is meant to be an associator provider.
00061  */
00062 #ifdef ASSOCIATOR_PROVIDER
00063 #define _INCLUDE_ASSOCIATOR_PROVIDER_METHODS \
00064             associators, associatorNames, references, referenceNames,
00065 static Vector associators ( NPIHandle *, CIMObjectPath, CIMObjectPath,
00066              const char *, const char *, const char *,
00067              int, int, const char * [], int);
00068 static Vector associatorNames ( NPIHandle *, CIMObjectPath, CIMObjectPath,
00069             const char *, const char *, const char * );
00070 static Vector references ( NPIHandle *, CIMObjectPath, CIMObjectPath,
00071             const char *, int, int, const char * [], int);
00072 static Vector referenceNames ( NPIHandle *, CIMObjectPath, CIMObjectPath, 
00073                 const char * );
00074 #else
00075 #define _INCLUDE_ASSOCIATOR_PROVIDER_METHODS \
00076             0, 0, 0, 0,
00077 #endif
00078 
00079 /* 
00080  * This part defines the MethodProvider interface 
00081  */
00082 #ifdef METHOD_PROVIDER
00083 #define _INCLUDE_METHOD_PROVIDER_METHODS \
00084             invokeMethod,
00085 static CIMValue invokeMethod ( NPIHandle *, CIMObjectPath, 
00086                 const char *, Vector, Vector);
00087 #else
00088 #define _INCLUDE_METHOD_PROVIDER_METHODS \
00089             0,
00090 #endif
00091 
00092 
00093 /*
00094  * This part defines the EventProvider interface
00095  */
00096 #ifdef EVENT_PROVIDER
00097 
00098 static void authorizeFilter(NPIHandle*,SelectExp,const char*,
00099        CIMObjectPath, const char*);
00100 static int mustPoll(NPIHandle*,SelectExp,const char*,
00101        CIMObjectPath);
00102 static void activateFilter(NPIHandle*,SelectExp,const char*,
00103        CIMObjectPath,int);
00104 static void deActivateFilter(NPIHandle*,SelectExp,const char*,
00105        CIMObjectPath,int);
00106 
00107 #define _INCLUDE_EVENT_PROVIDER_METHODS \
00108             authorizeFilter,mustPoll,activateFilter,deActivateFilter,
00109 #else
00110 #define _INCLUDE_EVENT_PROVIDER_METHODS \
00111             0,0,0,0,
00112 #endif
00113 
00114 
00115 /* the macro to generate the exported <LIBNAME>_initFunctionTable() */
00116 #define PROVIDER_NAME(n) EXTERN_C \
00117     NPIEXPORT FTABLE NPICALL n##_initFunctionTable ( void ) { \
00118       FTABLE fTable = { \
00119              initialize, cleanup, \
00120              /* the local provider function pointers will be included here */ \
00121              _INCLUDE_INSTANCE_PROVIDER_METHODS \
00122              _INCLUDE_ASSOCIATOR_PROVIDER_METHODS \
00123              _INCLUDE_METHOD_PROVIDER_METHODS \
00124              _INCLUDE_EVENT_PROVIDER_METHODS \
00125              }; \
00126       return fTable; \
00127     }
00128 
00129 #endif
00130 
00131 
00132 

Generated on Thu Feb 9 08:48:29 2006 for openwbem by  doxygen 1.4.6