From: <np...@us...> - 2008-08-27 19:57:28
|
Revision: 885 http://omc.svn.sourceforge.net/omc/?rev=885&view=rev Author: npaxton Date: 2008-08-27 19:57:38 +0000 (Wed, 27 Aug 2008) Log Message: ----------- separate out cmpi_provider.c into type/language specific files for python and ruby Added Paths: ----------- cmpi-bindings/trunk/src/cmpi_provider_python.c cmpi-bindings/trunk/src/cmpi_provider_ruby.c Added: cmpi-bindings/trunk/src/cmpi_provider_python.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider_python.c (rev 0) +++ cmpi-bindings/trunk/src/cmpi_provider_python.c 2008-08-27 19:57:38 UTC (rev 885) @@ -0,0 +1,1197 @@ +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +static char _CLASSNAME[] = "CmpiInstanceSwig"; + +#include <stdio.h> +#include <stdarg.h> + +/* Include the required CMPI macros, data types, and API function headers */ +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> + +// Needed to obtain errno of failed system calls +#include <errno.h> + +/* Needed for kill() */ +#include <signal.h> + +#include <Python.h> + +/* A simple stderr logging/tracing facility. */ +#ifndef _SBLIM_TRACE +#define _SBLIM_TRACE(tracelevel,args) _logstderr args +void _logstderr(char *fmt,...) +{ + va_list ap; + va_start(ap,fmt); + vfprintf(stderr,fmt,ap); + va_end(ap); + fprintf(stderr,"\n"); +} +#endif + +/* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ +static const CMPIBroker * _BROKER = NULL; +static char* _MINAME = NULL; +PyObject* _PYPROVMOD = NULL; + +static char* fmtstr(const char* fmt, ...) +{ + va_list ap; + int len; + va_start(ap, fmt); + len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + if (len <= 0) + { + return NULL; + } + char* str = (char*)malloc(len+1); + if (str == NULL) + { + return NULL; + } + va_start(ap, fmt); + vsnprintf(str, len+1, fmt, ap); + va_end(ap); + return str; +} + +static int PyInitialize(PyObject** self, CMPIStatus* st); +#define PY_CMPI_INIT { if (self->hdl == NULL) if (PyInitialize((PyObject**)&(self->hdl), &status) != 0) return status; } + +static PyObject* proplist2py(const char** cplist) +{ + if (cplist == NULL) + { + Py_RETURN_NONE; + } + PyObject* pl = PyList_New(0); + for (; *cplist != NULL; ++cplist) + { + PyList_Append(pl, PyString_FromString(*cplist)); + } + return pl; +} + + + +#define TB_ERROR(str) {tbstr = str; goto cleanup;} +static CMPIString* get_exc_trace() +{ + char *tbstr = NULL; + + PyObject *iostrmod = NULL; + PyObject *tbmod = NULL; + PyObject *iostr = NULL; + PyObject *obstr = NULL; + PyObject *args = NULL; + PyObject *newstr = NULL; + PyObject *func = NULL; + CMPIString* rv = NULL; + + PyObject *type, *value, *traceback; + _SBLIM_TRACE(1, ("PyErr_Occurred() %d", PyErr_Occurred())); + PyErr_Fetch(&type, &value, &traceback); + _SBLIM_TRACE(1,("** type %p, value %p, traceback %p", type, value, traceback)); + PyErr_Print(); + PyErr_Clear(); + PyErr_NormalizeException(&type, &value, &traceback); + _SBLIM_TRACE(1,("** type %p, value %p, traceback %p", type, value, traceback)); + + iostrmod = PyImport_ImportModule("StringIO"); + if (iostrmod==NULL) + TB_ERROR("can't import StringIO"); + + iostr = PyObject_CallMethod(iostrmod, "StringIO", NULL); + + if (iostr==NULL) + TB_ERROR("cStringIO.StringIO() failed"); + + tbmod = PyImport_ImportModule("traceback"); + if (tbmod==NULL) + TB_ERROR("can't import traceback"); + + obstr = PyObject_CallMethod(tbmod, "print_exception", + "(OOOOO)", + type ? type : Py_None, + value ? value : Py_None, + traceback ? traceback : Py_None, + Py_None, + iostr); + + if (obstr==NULL) + { + PyErr_Print(); + TB_ERROR("traceback.print_exception() failed"); + } + + Py_DecRef(obstr); + + obstr = PyObject_CallMethod(iostr, "getvalue", NULL); + if (obstr==NULL) + TB_ERROR("getvalue() failed."); + + if (!PyString_Check(obstr)) + TB_ERROR("getvalue() did not return a string"); + + args = PyTuple_New(2); + PyTuple_SetItem(args, 0, PyString_FromString("\n")); + PyTuple_SetItem(args, 1, PyString_FromString("<br>")); + + func = PyObject_GetAttrString(obstr, "replace"); + //newstr = PyObject_CallMethod(obstr, "replace", args); + newstr = PyObject_CallObject(func, args); + + tbstr = PyString_AsString(newstr); + + char* tmp = fmtstr("cmpi:%s", tbstr); + rv = _BROKER->eft->newString(_BROKER, tmp, NULL); + free(tmp); + +cleanup: + PyErr_Restore(type, value, traceback); + + if (rv == NULL) + { + rv = _BROKER->eft->newString(_BROKER, tbstr ? tbstr : "", NULL); + } + + Py_DecRef(func); + Py_DecRef(args); + Py_DecRef(newstr); + Py_DecRef(iostr); + Py_DecRef(obstr); + Py_DecRef(iostrmod); + Py_DecRef(tbmod); + + + return rv; +} + + + +static int +call_py_provider(PyObject* hdl, CMPIStatus* st, + const char* opname, int nargs, ...) +{ + int rc = 1; + va_list vargs; + PyObject *pyargs = NULL; + PyObject *pyfunc = NULL; + PyObject *prv = NULL; + pyargs = PyTuple_New(nargs); + pyfunc = PyObject_GetAttrString(hdl, opname); + if (pyfunc == NULL) + { + PyErr_Print(); + PyErr_Clear(); + char* str = fmtstr("Python module does not contain \"%s\"", opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + if (! PyCallable_Check(pyfunc)) + { + char* str = fmtstr("Python module attribute \"%s\" is not callable", + opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + + va_start(vargs, nargs); + int i; + for (i = 0; i < nargs; ++i) + { + PyObject* arg = va_arg(vargs, PyObject*); + if (arg == NULL) + { + arg = Py_None; + Py_IncRef(arg); + } + PyTuple_SET_ITEM(pyargs, i, arg); + } + va_end(vargs); + prv = PyObject_CallObject(pyfunc, pyargs); + if (PyErr_Occurred()) + { + st->rc = CMPI_RC_ERR_FAILED; + st->msg = get_exc_trace(); + PyErr_Clear(); + rc = 1; + goto cleanup; + } + + if (! PyTuple_Check(prv) || + (PyTuple_Size(prv) != 2 && PyTuple_Size(prv) != 1)) + { + char* str = fmtstr("Python function \"%s\" didn't return a two-tuple", + opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + PyObject* prc = PyTuple_GetItem(prv, 0); + PyObject* prstr = Py_None; + if (PyTuple_Size(prv) == 2) + { + prstr = PyTuple_GetItem(prv, 1); + } + + if (! PyInt_Check(prc) || (! PyString_Check(prstr) && prstr != Py_None)) + { + char* str = fmtstr("Python function \"%s\" didn't return a {<int>, <str>) two-tuple", opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + long pi = PyInt_AsLong(prc); + st->rc = (CMPIrc)pi; + if (prstr == Py_None) + { + st->msg = _BROKER->eft->newString(_BROKER, "", NULL); + } + else + { + st->msg = _BROKER->eft->newString(_BROKER, PyString_AsString(prstr), NULL); + } + rc = pi != 0; +cleanup: + Py_DecRef(pyargs); + Py_DecRef(pyfunc); + Py_DecRef(prv); + return rc; +} + + +// ---------------------------------------------------------------------------- +// CMPI INSTANCE PROVIDER FUNCTIONS +// ---------------------------------------------------------------------------- + +static CMPIStatus Cleanup( + const CMPIContext * context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ + + _SBLIM_TRACE(1,("Cleanup() called")); + + Py_DecRef(_PYPROVMOD); + Py_Finalize(); + _SBLIM_TRACE(1,("Cleanup(Python) called")); + + if (_MINAME != NULL) + { + free(_MINAME); + _MINAME = NULL; + } + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("Cleanup() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +static CMPIStatus InstCleanup( + CMPIInstanceMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus AssocCleanup( + CMPIAssociationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus MethodCleanup( + CMPIMethodMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus IndicationCleanup( + CMPIIndicationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +// ---------------------------------------------------------------------------- + + +/* EnumInstanceNames() - return a list of all the instances names (i.e. return their object paths only) */ +static CMPIStatus EnumInstanceNames( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ + const CMPIObjectPath * reference) /* [in] Contains the CIM namespace and classname */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ + + _SBLIM_TRACE(1,("EnumInstanceNames() called")); + + _SBLIM_TRACE(1,("EnumInstancesNames(Python) called, context %p, result %p, reference %p", context, result, reference)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + + call_py_provider((PyObject*)self->hdl, &status, "enum_instance_names", 3, + pycontext, + pyresult, + pyreference); + +exit: + _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* EnumInstances() - return a list of all the instances (i.e. return all the instance data) */ +static CMPIStatus EnumInstances( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ + const CMPIObjectPath * reference, /* [in] Contains the CIM namespace and classname */ + const char ** properties) /* [in] List of desired properties (NULL=all) */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ +/* char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); Our current CIM namespace */ + + _SBLIM_TRACE(1,("EnumInstances(Python) called, context %p, result %p, reference %p, properties %p", context, result, reference, properties)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyproperties = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "enum_instances", 4, + pycontext, + pyresult, + pyreference, + pyproperties); + +exit: + _SBLIM_TRACE(1,("EnumInstances() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* GetInstance() - return the instance data for the specified instance only */ +static CMPIStatus GetInstance( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * results, /* [out] Results of this operation */ + const CMPIObjectPath * reference, /* [in] Contains the CIM namespace, classname and desired object path */ + const char ** properties) /* [in] List of desired properties (NULL=all) */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ + + _SBLIM_TRACE(1,("GetInstance(Python) called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyproperties = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "get_instance", 4, + pycontext, + pyresult, + pyreference, + pyproperties); + +exit: + _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* CreateInstance() - create a new instance from the specified instance data. */ +static CMPIStatus CreateInstance( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any. */ + const CMPIResult * results, /* [out] Results of this operation */ + const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and objectpath. */ + const CMPIInstance * newinstance) /* [in] Contains all the new instance data. */ +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + + /* Creating new instances is not supported for this class. */ + + _SBLIM_TRACE(1,("CreateInstance(Python) called, context %p, results %p, reference %p, newinstance %p", context, results, reference, newinstance)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + + call_py_provider((PyObject*)self->hdl, &status, "create_instance", 4, + pycontext, + pyresult, + pyreference, + pynewinst); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + +#ifdef CMPI_VER_100 +#define SetInstance ModifyInstance +#endif + +/* SetInstance() - save modified instance data for the specified instance. */ +static CMPIStatus SetInstance( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ + const CMPIContext * context, /* [in] Additional context info, if any. */ + const CMPIResult * results, /* [out] Results of this operation. */ + const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and objectpath. */ + const CMPIInstance * newinstance, /* [in] Contains all the new instance data. */ + const char ** properties) /* [in] List of desired properties (NULL=all) */ +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + + /* Modifying existing instances is not supported for this class. */ + + _SBLIM_TRACE(1,("SetInstance(Python) called, context %p, results %p, reference %p, newinstance %p, properties %p", context, results, reference, newinstance, properties)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + PyObject *plist = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "set_instance", 5, + pycontext, + pyresult, + pyreference, + pynewinst, + plist); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("SetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +// ---------------------------------------------------------------------------- + + +/* DeleteInstance() - delete/remove the specified instance. */ +static CMPIStatus DeleteInstance( + CMPIInstanceMI * self, + const CMPIContext * context, + const CMPIResult * results, + const CMPIObjectPath * reference) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + _SBLIM_TRACE(1,("DeleteInstance(Python) called, context %p, results %p, reference %p", context, results, reference)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + + call_py_provider((PyObject*)self->hdl, &status, "delete_instance", 3, + pycontext, + pyresult, + pyreference); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("DeleteInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +// ---------------------------------------------------------------------------- + + +/* ExecQuery() - return a list of all the instances that satisfy the desired query filter. */ +static CMPIStatus ExecQuery( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ + const CMPIContext * context, /* [in] Additional context info, if any. */ + const CMPIResult * results, /* [out] Results of this operation. */ + const CMPIObjectPath * reference, /* [in] Contains the target namespace and classname. */ + const char * query, /* [in] Text of the query, written in the query language. */ + const char * language) /* [in] Name of the query language (e.g. "WQL"). */ +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + + _SBLIM_TRACE(1,("ExecQuery(Python) called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyquery = PyString_FromString(query); + PyObject *pylang = PyString_FromString(language); + + call_py_provider((PyObject*)self->hdl, &status, "exec_query", 5, + pycontext, + pyresult, + pyreference, + pyquery, + pylang); + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +#define PY_CMPI_SETFAIL(msgstr) {if (st != NULL) st->rc = CMPI_RC_ERR_FAILED; st->msg = msgstr; } +static int PyInitialize(PyObject** self, CMPIStatus* st) +{ + int rc = 0; + SWIGEXPORT void SWIG_init(void); + + _SBLIM_TRACE(1,("PyInitialize() called")); + + + _SBLIM_TRACE(1,("Python: Loading")); + Py_SetProgramName("cmpi_swig"); + Py_Initialize(); + SWIG_init(); + + _PYPROVMOD = PyImport_ImportModule("pycmpi_provider"); + if (_PYPROVMOD == NULL) + { + _SBLIM_TRACE(1,("Python: _PYPROVMOD at %p", _PYPROVMOD)); + PY_CMPI_SETFAIL(get_exc_trace()); + return -1; + } + _SBLIM_TRACE(1,("Python: _PYPROVMOD at %p", _PYPROVMOD)); + PyObject* provclass = PyObject_GetAttrString(_PYPROVMOD, + "CMPIProvider"); + if (provclass == NULL) + { + PY_CMPI_SETFAIL(get_exc_trace()); + return -1; + } + PyObject* broker = SWIG_NewPointerObj((void*) _BROKER, SWIGTYPE_p__CMPIBroker, 0); + PyObject* args = PyTuple_New(2); + PyTuple_SetItem(args, 0, PyString_FromString(_MINAME)); + PyTuple_SetItem(args, 1, broker); + PyObject* provinst = PyObject_CallObject(provclass, args); + Py_DecRef(args); + Py_DecRef(provclass); + if (provinst == NULL) + { + PY_CMPI_SETFAIL(get_exc_trace()); + return -1; + } + + *self = provinst; + + _SBLIM_TRACE(1,("PyInitialize() succeeded")); + return 0; +} + + + +// associatorMIFT +// + +CMPIStatus associatorNames( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("associatorNames(Python) called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyassocClass = NULL; + PyObject *pyresultClass = NULL; + PyObject* pyrole = NULL; + PyObject* pyresultRole = NULL; + if (assocClass != NULL) + { + pyassocClass = PyString_FromString(assocClass); + } + if (resultClass != NULL) + { + pyresultClass = PyString_FromString(resultClass); + } + if (role != NULL) + { + pyrole = PyString_FromString(role); + } + if (resultRole != NULL) + { + pyresultRole = PyString_FromString(resultRole); + } + + call_py_provider((PyObject*)self->hdl, &status, "associator_names", 7, + pyctx, + pyrslt, + pyobjName, + pyassocClass, + pyresultClass, + pyrole, + pyresultRole); + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("associatorNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus associators( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("associators(Python) called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyprops = proplist2py(properties); + PyObject *pyassocClass = NULL; + PyObject *pyresultClass = NULL; + PyObject* pyrole = NULL; + PyObject* pyresultRole = NULL; + if (assocClass != NULL) + { + pyassocClass = PyString_FromString(assocClass); + } + if (resultClass != NULL) + { + pyresultClass = PyString_FromString(resultClass); + } + if (role != NULL) + { + pyrole = PyString_FromString(role); + } + if (resultRole != NULL) + { + pyresultRole = PyString_FromString(resultRole); + } + + call_py_provider((PyObject*)self->hdl, &status, "associators", 8, + pyctx, + pyrslt, + pyobjName, + pyassocClass, + pyresultClass, + pyrole, + pyresultRole, + pyprops); + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("associators() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus referenceNames( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* resultClass, + const char* role) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("referenceNames(Python) called, ctx %p, rslt %p, objName %p, resultClass %s, role %s", ctx, rslt, objName, resultClass, role)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject* pyresultClass = NULL; + PyObject* pyrole = NULL; + if (role != NULL) + { + pyrole = PyString_FromString(role); + } + if (resultClass != NULL) + { + pyresultClass = PyString_FromString(resultClass); + } + + call_py_provider((PyObject*)self->hdl, &status, "reference_names", 5, + pyctx, + pyrslt, + pyobjName, + pyresultClass, + pyrole); + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("referenceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +/***************************************************************************/ +CMPIStatus references( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* resultClass, + const char* role, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("references(Python) called, ctx %p, rslt %p, objName %p, resultClass %s, role %s, properties %p", ctx, rslt, objName, resultClass, role, properties)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject* pyrole = NULL; + PyObject* pyresultClass = NULL; + if (role != NULL) + { + pyrole = PyString_FromString(role); + } + if (resultClass != NULL) + { + pyresultClass = PyString_FromString(resultClass); + } + PyObject *pyprops = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "references", 6, + pyctx, + pyrslt, + pyobjName, + pyresultClass, + pyrole, + pyprops); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("references() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus invokeMethod( + CMPIMethodMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* method, + const CMPIArgs* in, + CMPIArgs* out) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("invokeMethod(Python) called, ctx %p, rslt %p, objName %p, method %s, in %p, out %p", ctx, rslt, objName, method, in, out)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pymethod = PyString_FromString(method); + PyObject *pyin = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); + PyObject *pyout = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); + + call_py_provider((PyObject*)self->hdl, &status, "invoke_method", 6, + pyctx, + pyrslt, + pyobjName, + pymethod, + pyin, + pyout); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("invokeMethod() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus authorizeFilter( + CMPIIndicationMI* self, + const CMPIContext* ctx, + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath, + const char* owner) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("authorizeFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, owner %s", ctx, filter, className, classPath, owner)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + PyObject *pyowner = PyString_FromString(owner); + + call_py_provider((PyObject*)self->hdl, &status, "authorize_filter", 5, + pyctx, + pyfilter, + pyclassName, + pyclassPath, + pyowner); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("authorizeFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus activateFilter( + CMPIIndicationMI* self, + const CMPIContext* ctx, + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath, + CMPIBoolean firstActivation) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("activateFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, firstActivation %d", ctx, filter, className, classPath, firstActivation)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + PyObject *pyfirstActivation = PyBool_FromLong(firstActivation); + + call_py_provider((PyObject*)self->hdl, &status, "activate_filter", 5, + pyctx, + pyfilter, + pyclassName, + pyclassPath, + pyfirstActivation); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("activateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus deActivateFilter( + CMPIIndicationMI* self, + const CMPIContext* ctx, + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath, + CMPIBoolean lastActivation) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("deActivateFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, lastActivation %d", ctx, filter, className, classPath, lastActivation)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + PyObject *pylastActivation = PyBool_FromLong(lastActivation); + + call_py_provider((PyObject*)self->hdl, &status, "deactivate_filter", 5, + pyctx, + pyfilter, + pyclassName, + pyclassPath, + pylastActivation); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("deActivateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +/***************************************************************************/ +// Note: sfcb doesn't support mustPoll. :( +// http://sourceforge.net/mailarchive/message.php?msg_id=OFF38FF3F9.39FD2E1F-ONC1257385.004A7122-C1257385.004BB0AF%40de.ibm.com +CMPIStatus mustPoll( + CMPIIndicationMI* self, + const CMPIContext* ctx, + //const CMPIResult* rslt, TODO: figure out who is right: spec. vs. sblim + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + //_SBLIM_TRACE(1,("mustPoll(Python) called, ctx %p, rslt %p, filter %p, className %s, classPath %p", ctx, rslt, filter, className, classPath)); + _SBLIM_TRACE(1,("mustPoll(Python) called, ctx %p, filter %p, className %s, classPath %p", ctx, filter, className, classPath)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + //PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + + call_py_provider((PyObject*)self->hdl, &status, "must_poll", 4, + pyctx, + //pyrslt, + pyfilter, + pyclassName, + pyclassPath); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("mustPoll() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +/***************************************************************************/ +CMPIStatus enableIndications( + CMPIIndicationMI* self, + const CMPIContext* ctx) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("enableIndications(Python) called, ctx %p", ctx)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + + call_py_provider((PyObject*)self->hdl, &status, "enable_indications", 1, pyctx); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; + +} + +/***************************************************************************/ +CMPIStatus disableIndications( + CMPIIndicationMI* self, + const CMPIContext* ctx) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + + _SBLIM_TRACE(1,("disableIndications(Python) called, ctx %p", ctx)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + + call_py_provider((PyObject*)self->hdl, &status, "disable_indications", 1, pyctx); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; + +} + + +/***************************************************************************/ + + + + + + + + + +static CMPIMethodMIFT MethodMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "methodCmpi_Swig", // miName + MethodCleanup, + invokeMethod, +}; + + +static CMPIIndicationMIFT IndicationMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "indicationCmpi_Swig", // miName + IndicationCleanup, + authorizeFilter, + mustPoll, + activateFilter, + deActivateFilter, + enableIndications, + disableIndications, +}; + + +static CMPIAssociationMIFT AssociationMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "instanceCmpi_Swig", // miName + AssocCleanup, + associators, + associatorNames, + references, + referenceNames, +}; + + +static CMPIInstanceMIFT InstanceMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "associatorCmpi_Swig", // miName + InstCleanup, + EnumInstanceNames, + EnumInstances, + GetInstance, + CreateInstance, + SetInstance, + DeleteInstance, + ExecQuery, +}; + +static void createInit(const CMPIBroker* broker, + const CMPIContext* context, const char* miname, CMPIStatus* st) +{ + _BROKER = broker; + _MINAME = strdup(miname); + /* + * We can't initialize Python here and load Python modules, because + * SFCB passes a NULL CMPIStatus* st, which means we can't report + * back error strings. Instead, we'll check and initialize in each + * MIFT function + */ +} + +#define SWIG_CMPI_MI_FACTORY(ptype) \ +CMPI##ptype##MI* _Generic_Create_##ptype##MI(const CMPIBroker* broker, \ + const CMPIContext* context, const char* miname, CMPIStatus* st)\ +{ \ + static CMPI##ptype##MI mi={ \ + NULL, \ + &ptype##MIFT__, \ + }; \ + createInit(broker, context, miname, st); \ + return &mi; \ +} + +SWIG_CMPI_MI_FACTORY(Instance) +SWIG_CMPI_MI_FACTORY(Method) +SWIG_CMPI_MI_FACTORY(Association) +SWIG_CMPI_MI_FACTORY(Indication) + Added: cmpi-bindings/trunk/src/cmpi_provider_ruby.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider_ruby.c (rev 0) +++ cmpi-bindings/trunk/src/cmpi_provider_ruby.c 2008-08-27 19:57:38 UTC (rev 885) @@ -0,0 +1,743 @@ +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +static char _CLASSNAME[] = "CmpiInstanceRuby"; + +#include <stdio.h> +#include <stdarg.h> + +/* Include the required CMPI macros, data types, and API function headers */ +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> + +// Needed to obtain errno of failed system calls +#include <errno.h> + +/* Needed for kill() */ +#include <signal.h> + + +#include <ruby.h> + +/* A simple stderr logging/tracing facility. */ +#ifndef _SBLIM_TRACE +#define _SBLIM_TRACE(tracelevel,args) _logstderr args +void _logstderr(char *fmt,...) +{ + va_list ap; + va_start(ap,fmt); + vfprintf(stderr,fmt,ap); + va_end(ap); + fprintf(stderr,"\n"); +} +#endif + +/* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ +static const CMPIBroker * _BROKER = NULL; +static char* _MINAME = NULL; + +static char* fmtstr(const char* fmt, ...) +{ + va_list ap; + int len; + va_start(ap, fmt); + len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + if (len <= 0) + { + return NULL; + } + char* str = (char*)malloc(len+1); + if (str == NULL) + { + return NULL; + } + va_start(ap, fmt); + vsnprintf(str, len+1, fmt, ap); + va_end(ap); + return str; +} + +static int RBInitialize(CMPIInstanceMI * self, CMPIStatus* st); + +static VALUE +properties2ruby( const char ** properties ) +{ + if (properties) { + VALUE rproperties = rb_ary_new(); + while (*properties) + rb_ary_push( rproperties, rb_str_new2(*properties++) ); + return rproperties; + } + return Qnil; +} + + +// ---------------------------------------------------------------------------- +// CMPI INSTANCE PROVIDER FUNCTIONS +// ---------------------------------------------------------------------------- + +static CMPIStatus Cleanup( + const CMPIContext * context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ + + _SBLIM_TRACE(1,("Cleanup() called")); + + ruby_finalize(); + _SBLIM_TRACE(1,("Cleanup(Ruby) called")); + + if (_MINAME != NULL) + { + free(_MINAME); + _MINAME = NULL; + } + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("Cleanup() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +static CMPIStatus InstCleanup( + CMPIInstanceMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus AssocCleanup( + CMPIAssociationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus MethodCleanup( + CMPIMethodMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus IndicationCleanup( + CMPIIndicationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +// ---------------------------------------------------------------------------- + + +/* EnumInstanceNames() - return a list of all the instances names (i.e. return their object paths only) */ +static CMPIStatus EnumInstanceNames( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ + const CMPIObjectPath * reference) /* [in] Contains the CIM namespace and classname */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ + + _SBLIM_TRACE(1,("EnumInstanceNames() called")); + + _SBLIM_TRACE(1,("EnumInstanceNames(Ruby) called, context %p, result %p, reference %p", context, result, reference)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + + /* enum_instance_names instead of EnumInstanceNames to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "enum_instance_names" ), 3, rcontext, rresult, rreference ); + _SBLIM_TRACE(1,("r %p", r)); + +exit: + _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* EnumInstances() - return a list of all the instances (i.e. return all the instance data) */ +static CMPIStatus EnumInstances( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ + const CMPIObjectPath * reference, /* [in] Contains the CIM namespace and classname */ + const char ** properties) /* [in] List of desired properties (NULL=all) */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ +/* char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); Our current CIM namespace */ + + _SBLIM_TRACE(1,("EnumInstances(Ruby) called, context %p, result %p, reference %p, properties %p", context, result, reference, properties)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + VALUE rproperties = properties2ruby( properties ); + /* enum_instances instead of EnumInstances to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "enum_instances" ), 4, rcontext, rresult, rreference, rproperties ); + _SBLIM_TRACE(1,("r %p", r)); + +exit: + _SBLIM_TRACE(1,("EnumInstances() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* GetInstance() - return the instance data for the specified instance only */ +static CMPIStatus GetInstance( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * results, /* [out] Results of this operation */ + const CMPIObjectPath * reference, /* [in] Contains the CIM namespace, classname and desired object path */ + const char ** properties) /* [in] List of desired properties (NULL=all) */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ + + _SBLIM_TRACE(1,("GetInstance(Ruby) called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + VALUE rproperties = properties2ruby( properties ); + /* get_instance instead of GetInstance to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "get_instance" ), 4, rcontext, rresults, rreference, rproperties ); + _SBLIM_TRACE(1,("r %p", r)); + +exit: + _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* CreateInstance() - create a new instance from the specified instance data. */ +static CMPIStatus CreateInstance( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any. */ + const CMPIResult * results, /* [out] Results of this operation */ + const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and objectpath. */ + const CMPIInstance * newinstance) /* [in] Contains all the new instance data. */ +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + + /* Creating new instances is not supported for this class. */ + + _SBLIM_TRACE(1,("CreateInstance(Ruby) called, context %p, results %p, reference %p, instance %p, properties %p", context, results, reference, newinstance)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + VALUE rinstance = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + /* create_instance instead of CreateInstance to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "create_instance" ), 4, rcontext, rresults, rreference, rinstance ); + _SBLIM_TRACE(1,("r %p", r)); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + +#ifdef CMPI_VER_100 +#define SetInstance ModifyInstance +#endif + +/* SetInstance() - save modified instance data for the specified instance. */ +static CMPIStatus SetInstance( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ + const CMPIContext * context, /* [in] Additional context info, if any. */ + const CMPIResult * results, /* [out] Results of this operation. */ + const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and objectpath. */ + const CMPIInstance * newinstance, /* [in] Contains all the new instance data. */ + const char ** properties) /* [in] List of desired properties (NULL=all) */ +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + + /* Modifying existing instances is not supported for this class. */ + + _SBLIM_TRACE(1,("SetInstance(Ruby) called, context %p, results %p, reference %p, instance %p, properties %p", context, results, reference, newinstance, properties)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + VALUE rinstance = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + VALUE rproperties = properties2ruby( properties ); + /* set_instance instead of SetInstance to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "set_instance" ), 5, rcontext, rresults, rreference, rinstance, rproperties ); + _SBLIM_TRACE(1,("r %p", r)); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("SetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +// ---------------------------------------------------------------------------- + + +/* DeleteInstance() - delete/remove the specified instance. */ +static CMPIStatus DeleteInstance( + CMPIInstanceMI * self, + const CMPIContext * context, + const CMPIResult * results, + const CMPIObjectPath * reference) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + _SBLIM_TRACE(1,("DeleteInstance(Ruby) called, context %p, results %p, reference %p", context, results, reference)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + /* delete_instance instead of DeleteInstance to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "delete_instance" ), 3, rcontext, rresults, rreference ); + _SBLIM_TRACE(1,("r %p", r)); + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("DeleteInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +// ---------------------------------------------------------------------------- + + +/* ExecQuery() - return a list of all the instances that satisfy the desired query filter. */ +static CMPIStatus ExecQuery( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ + const CMPIContext * context, /* [in] Additional context info, if any. */ + const CMPIResult * results, /* [out] Results of this operation. */ + const CMPIObjectPath * reference, /* [in] Contains the target namespace and classname. */ + const char * query, /* [in] Text of the query, written in the query language. */ + const char * language) /* [in] Name of the query language (e.g. "WQL"). */ +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + + _SBLIM_TRACE(1,("ExecQuery(Ruby) called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + VALUE rquery = rb_str_new2( query ); + VALUE rlanguage = rb_str_new2( language ); + /* exec_query instead of ExecQuery to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "exec_query" ), 5, rcontext, rresults, rreference, query, language ); + _SBLIM_TRACE(1,("r %p", r)); + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + +static VALUE load_code() +{ + _SBLIM_TRACE(1,("Ruby: require 'rcmpi_instance'...")); + + rb_require("rcmpi_instance"); + + _SBLIM_TRACE(1,("Ruby: ... done")); +} + +static VALUE create_cmpi(VALUE args) +{ + VALUE *values = (VALUE *)args; + _SBLIM_TRACE(1,("Ruby: Cmpi_Instance.new ...")); + VALUE klass = rb_class_new_instance(1, values, rb_const_get(rb_cObject, rb_intern("Cmpi_Instance"))); + _SBLIM_TRACE(1,("Ruby: ... done")); + return klass; +} + +/* Initialize() - perform any necessary initialization immediately after this provider is loaded. */ +static int RBInitialize( + CMPIInstanceMI * self, CMPIStatus* st) /* [in] Handle to this provider (i.e. 'self'). */ +{ + int rc = 0; + if (st != NULL) + { + st->rc = CMPI_RC_OK; + st->msg = NULL; + } + int error = 0; + VALUE cmpiInstance; + SWIGEXPORT void SWIG_init(void); + + _SBLIM_TRACE(1,("Initialize() called")); + + _SBLIM_TRACE(1,("Ruby: Loading")); + ruby_init(); + ruby_init_loadpath(); + ruby_script("rcmpi_instance"); + SWIG_init(); + + rb_protect(load_code, Qnil, &error); + if (error) { + _SBLIM_TRACE(1,("Ruby: FAILED loading rcmpi_instance.rb")); + if (st != NULL) + { + st->rc = CMPI_RC_ERR_FAILED; + } + } + else { + _SBLIM_TRACE(1,("Ruby: loaded rcmpi_instance.rb")); + VALUE args[1]; + args[0] = rb_str_new2(_CLASSNAME); + cmpiInstance = rb_protect(create_cmpi, (VALUE)args, &error); + if (error) { + _SBLIM_TRACE(1,("Ruby: FAILED creating Cmpi")); + if (st != NULL) + { + st->rc = CMPI_RC_ERR_FAILED; + } + } + else { + _SBLIM_TRACE(1,("Ruby: cmpi at %p", cmpiI... [truncated message content] |
From: <kk...@us...> - 2008-10-03 12:30:37
|
Revision: 1066 http://omc.svn.sourceforge.net/omc/?rev=1066&view=rev Author: kkaempf Date: 2008-10-03 12:30:25 +0000 (Fri, 03 Oct 2008) Log Message: ----------- define SWIG_init() per target, keeps gcc happy Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c cmpi-bindings/trunk/src/target_python.c cmpi-bindings/trunk/src/target_ruby.c Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-03 00:29:33 UTC (rev 1065) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-03 12:30:25 UTC (rev 1066) @@ -59,11 +59,6 @@ } #endif - -#if 0 -SWIGEXPORT void SWIG_init(void); -#endif - #define _CMPI_SETFAIL(msgstr) {if (st != NULL) st->rc = CMPI_RC_ERR_FAILED; st->msg = msgstr; } /* Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-10-03 00:29:33 UTC (rev 1065) +++ cmpi-bindings/trunk/src/target_python.c 2008-10-03 12:30:25 UTC (rev 1066) @@ -138,6 +138,7 @@ Py_SetProgramName("cmpi_swig"); Py_Initialize(); + SWIGEXPORT void SWIG_init(void); SWIG_init(); cmpiMainPyThreadState = PyGILState_GetThisThreadState(); PyEval_ReleaseThread(cmpiMainPyThreadState); Modified: cmpi-bindings/trunk/src/target_ruby.c =================================================================== --- cmpi-bindings/trunk/src/target_ruby.c 2008-10-03 00:29:33 UTC (rev 1065) +++ cmpi-bindings/trunk/src/target_ruby.c 2008-10-03 12:30:25 UTC (rev 1066) @@ -105,6 +105,7 @@ ruby_init(); ruby_init_loadpath(); ruby_script("cmpi_swig_ruby"); + extern void SWIG_init(); SWIG_init(); /* load module */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mik...@us...> - 2008-10-09 17:27:31
|
Revision: 1080 http://omc.svn.sourceforge.net/omc/?rev=1080&view=rev Author: mike-brasher Date: 2008-10-09 17:27:29 +0000 (Thu, 09 Oct 2008) Log Message: ----------- Fixed ISO compiler warnings (illegal mixed declartions) Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c cmpi-bindings/trunk/src/target_perl.c Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-09 17:26:31 UTC (rev 1079) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-09 17:27:29 UTC (rev 1080) @@ -92,10 +92,11 @@ static Target_Type string2target(const char *s) { + Target_Type obj; + if (s == NULL) return Target_Null; - Target_Type obj; TARGET_THREAD_BEGIN_BLOCK; obj = Target_String(s); @@ -113,6 +114,8 @@ static Target_Type proplist2target(const char** cplist) { + Target_Type pl; + TARGET_THREAD_BEGIN_BLOCK; if (cplist == NULL) { @@ -120,7 +123,6 @@ TARGET_THREAD_END_BLOCK; return Target_Void; } - Target_Type pl; pl = Target_Array(); for (; (cplist!=NULL && *cplist != NULL); ++cplist) @@ -138,6 +140,8 @@ { va_list ap; int len; + char* str; + va_start(ap, fmt); len = vsnprintf(NULL, 0, fmt, ap); va_end(ap); @@ -145,7 +149,7 @@ { return NULL; } - char* str = (char*)malloc(len+1); + str = (char*)malloc(len+1); if (str == NULL) { return NULL; @@ -247,8 +251,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Instance provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -262,8 +267,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Association provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -277,8 +283,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Method provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -292,8 +299,9 @@ const CMPIContext * context, CMPIBoolean terminating) { + CMPIStatus st; _SBLIM_TRACE(1,("Cleanup() called for Indication provider %s", ((ProviderMIHandle *)self->hdl)->miName)); - CMPIStatus st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); + st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating); return st; } @@ -309,6 +317,10 @@ const CMPIResult * result, const CMPIObjectPath * reference) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + CMPIStatus status = {CMPI_RC_OK, NULL}; _SBLIM_TRACE(1,("EnumInstancesNames() called, context %p, result %p, reference %p", context, result, reference)); @@ -316,9 +328,9 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3, @@ -344,6 +356,11 @@ const CMPIObjectPath * reference, const char ** properties) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _properties; + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ /* char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); Our current CIM namespace */ @@ -352,11 +369,11 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _properties = proplist2target(properties); + _properties = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4, _context, @@ -382,6 +399,11 @@ const CMPIObjectPath * reference, const char ** properties) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _properties; + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ _SBLIM_TRACE(1,("GetInstance() called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); @@ -389,11 +411,11 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _properties = proplist2target(properties); + _properties = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "get_instance", 4, _context, @@ -419,7 +441,13 @@ const CMPIObjectPath * reference, const CMPIInstance * newinstance) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _newinst; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + /* Creating new instances is not supported for this class. */ @@ -428,10 +456,10 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "create_instance", 4, @@ -462,6 +490,12 @@ const CMPIInstance * newinstance, const char ** properties) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _newinst; + Target_Type plist; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ /* Modifying existing instances is not supported for this class. */ @@ -471,12 +505,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); TARGET_THREAD_END_BLOCK; - Target_Type plist = proplist2target(properties); + plist = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "set_instance", 5, _context, @@ -501,6 +535,10 @@ const CMPIResult * results, const CMPIObjectPath * reference) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + CMPIStatus status = {CMPI_RC_OK, NULL}; _SBLIM_TRACE(1,("DeleteInstance() called, context %p, results %p, reference %p", context, results, reference)); @@ -508,9 +546,9 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "delete_instance", 3, @@ -536,6 +574,12 @@ const char * query, const char * language) { + Target_Type _context; + Target_Type _result; + Target_Type _reference; + Target_Type _query; + Target_Type _lang; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ _SBLIM_TRACE(1,("ExecQuery() called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); @@ -543,12 +587,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - Target_Type _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - Target_Type _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _query = string2target(query); - Target_Type _lang = string2target(language); + _query = string2target(query); + _lang = string2target(language); call_provider((ProviderMIHandle*)self->hdl, &status, "exec_query", 5, _context, @@ -583,6 +627,14 @@ const char* role, const char* resultRole) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName ; + Target_Type _assocClass; + Target_Type _resultClass; + Target_Type _role; + Target_Type _resultRole; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("associatorNames() called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); @@ -590,14 +642,14 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _assocClass = Target_Null; - Target_Type _resultClass = Target_Null; - Target_Type _role = Target_Null; - Target_Type _resultRole = Target_Null; + _assocClass = Target_Null; + _resultClass = Target_Null; + _role = Target_Null; + _resultRole = Target_Null; if (assocClass != NULL) { _assocClass = string2target(assocClass); @@ -645,6 +697,15 @@ const char* resultRole, const char** properties) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _props; + Target_Type _assocClass; + Target_Type _resultClass; + Target_Type _role; + Target_Type _resultRole; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("associators() called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); @@ -652,15 +713,15 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _props = proplist2target(properties); - Target_Type _assocClass = Target_Null; - Target_Type _resultClass = Target_Null; - Target_Type _role = Target_Null; - Target_Type _resultRole = Target_Null; + _props = proplist2target(properties); + _assocClass = Target_Null; + _resultClass = Target_Null; + _role = Target_Null; + _resultRole = Target_Null; if (assocClass != NULL) { _assocClass = string2target(assocClass); @@ -706,6 +767,12 @@ const char* resultClass, const char* role) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _resultClass; + Target_Type _role; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("referenceNames() called, ctx %p, rslt %p, objName %p, resultClass %s, role %s", ctx, rslt, objName, resultClass, role)); @@ -713,12 +780,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _resultClass = Target_Null; - Target_Type _role = Target_Null; + _resultClass = Target_Null; + _role = Target_Null; if (role != NULL) { _role = string2target(role); @@ -755,6 +822,13 @@ const char* role, const char** properties) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _role; + Target_Type _resultClass; + Target_Type _props; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("references() called, ctx %p, rslt %p, objName %p, resultClass %s, role %s, properties %p", ctx, rslt, objName, resultClass, role, properties)); @@ -762,12 +836,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _role = Target_Null; - Target_Type _resultClass = Target_Null; + _role = Target_Null; + _resultClass = Target_Null; if (role != NULL) { _role = string2target(role); @@ -776,7 +850,7 @@ { _resultClass = string2target(resultClass); } - Target_Type _props = proplist2target(properties); + _props = proplist2target(properties); call_provider((ProviderMIHandle*)self->hdl, &status, "references", 6, _ctx, @@ -803,6 +877,13 @@ const CMPIArgs* in, CMPIArgs* out) { + Target_Type _ctx; + Target_Type _rslt; + Target_Type _objName; + Target_Type _in; + Target_Type _out; + Target_Type _method; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("invokeMethod() called, ctx %p, rslt %p, objName %p, method %s, in %p, out %p", ctx, rslt, objName, method, in, out)); @@ -810,13 +891,13 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _in = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); - Target_Type _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + _in = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); + _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); TARGET_THREAD_END_BLOCK; - Target_Type _method = string2target(method); + _method = string2target(method); call_provider((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6, _ctx, @@ -843,6 +924,12 @@ const CMPIObjectPath* classPath, const char* owner) { + Target_Type _ctx; + Target_Type _filter; + Target_Type _classPath; + Target_Type _className; + Target_Type _owner; + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("authorizeFilter() called, ctx %p, filter %p, className %s, classPath %p, owner %s", ctx, filter, className, classPath, owner)); @@ -850,12 +937,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); - Target_Type _owner = string2target(owner); + _className = string2target(className); + _owner = string2target(owner); call_provider((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5, _ctx, @@ -882,18 +969,23 @@ CMPIBoolean firstActivation) { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + Target_Type _ctx; + Target_Type _filter; + Target_Type _classPath; + Target_Type _firstActivation; + Target_Type _className; _SBLIM_TRACE(1,("activateFilter() called, ctx %p, filter %p, className %s, classPath %p, firstActivation %d", ctx, filter, className, classPath, firstActivation)); TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _firstActivation = Target_Bool(firstActivation); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _firstActivation = Target_Bool(firstActivation); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); + _className = string2target(className); call_provider((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5, _ctx, @@ -920,18 +1012,23 @@ CMPIBoolean lastActivation) { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + Target_Type _ctx; + Target_Type _filter; + Target_Type _classPath; + Target_Type _lastActivation; + Target_Type _className; _SBLIM_TRACE(1,("deActivateFilter() called, ctx %p, filter %p, className %s, classPath %p, lastActivation %d", ctx, filter, className, classPath, lastActivation)); TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - Target_Type _lastActivation = Target_Bool(lastActivation); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _lastActivation = Target_Bool(lastActivation); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); + _className = string2target(className); call_provider((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5, _ctx, @@ -959,6 +1056,10 @@ const char* className, const CMPIObjectPath* classPath) { + Target_Type _ctx; + Target_Type _className; + Target_Type _filter; + Target_Type _classPath; CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; //_SBLIM_TRACE(1,("mustPoll() called, ctx %p, rslt %p, filter %p, className %s, classPath %p", ctx, rslt, filter, className, classPath)); @@ -967,12 +1068,12 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); //Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - Target_Type _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - Target_Type _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); TARGET_THREAD_END_BLOCK; - Target_Type _className = string2target(className); + _className = string2target(className); call_provider((ProviderMIHandle*)self->hdl, &status, "must_poll", 4, _ctx, @@ -995,6 +1096,7 @@ CMPIIndicationMI* self, const CMPIContext* ctx) { + Target_Type _ctx; CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("enableIndications() called, ctx %p", ctx)); @@ -1002,7 +1104,7 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enable_indications", 1, _ctx); @@ -1022,6 +1124,7 @@ CMPIIndicationMI* self, const CMPIContext* ctx) { + Target_Type _ctx; CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; _SBLIM_TRACE(1,("disableIndications() called, ctx %p", ctx)); @@ -1029,7 +1132,7 @@ TARGET_CMPI_INIT TARGET_THREAD_BEGIN_BLOCK; - Target_Type _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "disable_indications", 1, _ctx); @@ -1113,14 +1216,16 @@ CMPI##ptype##MI* _Generic_Create_##ptype##MI(const CMPIBroker* broker, \ const CMPIContext* context, const char* miname, CMPIStatus* st)\ { \ + CMPI##ptype##MI *mi; \ + ProviderMIHandle *hdl; \ _SBLIM_TRACE(1, ("\n>>>>> in FACTORY: CMPI"#ptype"MI* _Generic_Create_"#ptype"MI... miname=%s", miname)); \ - ProviderMIHandle *hdl = (ProviderMIHandle*)malloc(sizeof(ProviderMIHandle)); \ + hdl = (ProviderMIHandle*)malloc(sizeof(ProviderMIHandle)); \ if (hdl) { \ hdl->instance = Target_Null; \ hdl->miName = strdup(miname); \ hdl->broker = broker; \ } \ - CMPI##ptype##MI *mi= (CMPI##ptype##MI*)malloc(sizeof(CMPI##ptype##MI)); \ + mi= (CMPI##ptype##MI*)malloc(sizeof(CMPI##ptype##MI)); \ if (mi) { \ mi->hdl = hdl; \ mi->ft = &ptype##MIFT__; \ Modified: cmpi-bindings/trunk/src/target_perl.c =================================================================== --- cmpi-bindings/trunk/src/target_perl.c 2008-10-09 17:26:31 UTC (rev 1079) +++ cmpi-bindings/trunk/src/target_perl.c 2008-10-09 17:27:29 UTC (rev 1080) @@ -37,6 +37,7 @@ { int error; char *embedding[] = { "", "-e", "0" }; + extern void SWIG_init(PerlInterpreter* my_perl, CV* cv); if (_TARGET_INIT) { @@ -49,8 +50,6 @@ perl_construct(_TARGET_INIT); perl_parse(_TARGET_INIT, NULL, 3, embedding, NULL); perl_run(_TARGET_INIT); - - extern void SWIG_init(PerlInterpreter* my_perl, CV* cv); SWIG_init(_TARGET_INIT, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-17 09:26:17
|
Revision: 1110 http://omc.svn.sourceforge.net/omc/?rev=1110&view=rev Author: kkaempf Date: 2008-10-17 08:32:52 +0000 (Fri, 17 Oct 2008) Log Message: ----------- move thread locking outside of call_provider, so we have just a single lock/unlock for each MI call Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c cmpi-bindings/trunk/src/target_python.c Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-16 17:24:00 UTC (rev 1109) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-17 08:32:52 UTC (rev 1110) @@ -329,15 +329,14 @@ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3, _context, _result, _reference); - - _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -372,15 +371,14 @@ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _properties = proplist2target(properties); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4, _context, _result, _reference, _properties); - - _SBLIM_TRACE(1,("EnumInstances() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("EnumInstances() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -414,15 +412,14 @@ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _properties = proplist2target(properties); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "get_instance", 4, _context, _result, _reference, _properties); - - _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -444,7 +441,7 @@ Target_Type _reference; Target_Type _newinst; - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ /* Creating new instances is not supported for this class. */ @@ -458,16 +455,15 @@ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "create_instance", 4, _context, _result, _reference, _newinst); - - _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -509,16 +505,15 @@ _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); plist = proplist2target(properties); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "set_instance", 5, _context, _result, _reference, _newinst, plist); - - _SBLIM_TRACE(1,("SetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("SetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -547,15 +542,14 @@ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "delete_instance", 3, _context, _result, _reference); - - _SBLIM_TRACE(1,("DeleteInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("DeleteInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -590,7 +584,6 @@ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _query = string2target(query); _lang = string2target(language); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "exec_query", 5, _context, @@ -598,11 +591,12 @@ _reference, _query, _lang); + TARGET_THREAD_END_BLOCK; - /* Query filtering is not supported for this class. */ + /* Query filtering is not supported for this class. */ - _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -663,7 +657,6 @@ { _resultRole = string2target(resultRole); } - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "associator_names", 7, _ctx, @@ -673,10 +666,9 @@ _resultClass, _role, _resultRole); - - - _SBLIM_TRACE(1,("associatorNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("associatorNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } /* @@ -735,7 +727,6 @@ { _resultRole = string2target(resultRole); } - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "associators", 8, _ctx, @@ -745,11 +736,11 @@ _resultClass, _role, _resultRole, - _props); + _props); - - _SBLIM_TRACE(1,("associators() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("associators() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } /* @@ -791,7 +782,6 @@ { _resultClass = string2target(resultClass); } - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "reference_names", 5, _ctx, @@ -800,9 +790,9 @@ _resultClass, _role); - - _SBLIM_TRACE(1,("referenceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("referenceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -848,7 +838,6 @@ _resultClass = string2target(resultClass); } _props = proplist2target(properties); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "references", 6, _ctx, @@ -857,9 +846,9 @@ _resultClass, _role, _props); - - _SBLIM_TRACE(1,("references() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("references() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } /* @@ -896,17 +885,16 @@ _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); _method = string2target(method); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6, _ctx, _rslt, _objName, _method, _in, - _out); - - _SBLIM_TRACE(1,("invokeMethod() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + _out); + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("invokeMethod() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -941,16 +929,15 @@ _className = string2target(className); _owner = string2target(owner); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5, _ctx, _filter, _className, _classPath, _owner); - - _SBLIM_TRACE(1,("authorizeFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("authorizeFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -984,16 +971,15 @@ _firstActivation = Target_Bool(firstActivation); _className = string2target(className); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5, _ctx, _filter, _className, _classPath, _firstActivation); - - _SBLIM_TRACE(1,("activateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("activateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -1027,16 +1013,15 @@ _lastActivation = Target_Bool(lastActivation); _className = string2target(className); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5, _ctx, _filter, _className, _classPath, _lastActivation); - - _SBLIM_TRACE(1,("deActivateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("deActivateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -1072,16 +1057,15 @@ _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); _className = string2target(className); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "must_poll", 4, _ctx, //_rslt, _filter, _className, _classPath); - - _SBLIM_TRACE(1,("mustPoll() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("mustPoll() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -1103,13 +1087,12 @@ TARGET_THREAD_BEGIN_BLOCK; _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "enable_indications", 1, _ctx); - _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; - + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } @@ -1131,12 +1114,12 @@ TARGET_THREAD_BEGIN_BLOCK; _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - TARGET_THREAD_END_BLOCK; call_provider((ProviderMIHandle*)self->hdl, &status, "disable_indications", 1, _ctx); - _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-10-16 17:24:00 UTC (rev 1109) +++ cmpi-bindings/trunk/src/target_python.c 2008-10-17 08:32:52 UTC (rev 1110) @@ -174,6 +174,7 @@ /* * call_provider * + * ** must be called while holding the threads lock ** */ static int @@ -185,7 +186,6 @@ PyObject *pyargs = NULL; PyObject *pyfunc = NULL; PyObject *prv = NULL; - TARGET_THREAD_BEGIN_BLOCK; pyargs = PyTuple_New(nargs); pyfunc = PyObject_GetAttrString(hdl->instance, opname); @@ -279,15 +279,17 @@ } else { + char *msg = PyString_AsString(prstr); + TARGET_THREAD_BEGIN_ALLOW; st->msg = hdl->broker->eft->newString(hdl->broker, - PyString_AsString(prstr), NULL); + msg, NULL); + TARGET_THREAD_END_ALLOW; } rc = pi != 0; cleanup: Py_DecRef(pyargs); Py_DecRef(pyfunc); Py_DecRef(prv); - TARGET_THREAD_END_BLOCK; return rc; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-28 09:59:19
|
Revision: 1136 http://omc.svn.sourceforge.net/omc/?rev=1136&view=rev Author: kkaempf Date: 2008-10-28 09:54:58 +0000 (Tue, 28 Oct 2008) Log Message: ----------- code cleanup, make target API consistent: - rename call_provider to TargetCall Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c cmpi-bindings/trunk/src/target_perl.c cmpi-bindings/trunk/src/target_python.c cmpi-bindings/trunk/src/target_ruby.c Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-26 03:23:08 UTC (rev 1135) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-28 09:54:58 UTC (rev 1136) @@ -330,7 +330,7 @@ _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3, + TargetCall((ProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3, _context, _result, _reference); @@ -371,7 +371,7 @@ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _properties = proplist2target(properties); - call_provider((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4, + TargetCall((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4, _context, _result, _reference, @@ -412,7 +412,7 @@ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _properties = proplist2target(properties); - call_provider((ProviderMIHandle*)self->hdl, &status, "get_instance", 4, + TargetCall((ProviderMIHandle*)self->hdl, &status, "get_instance", 4, _context, _result, _reference, @@ -456,7 +456,7 @@ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - call_provider((ProviderMIHandle*)self->hdl, &status, "create_instance", 4, + TargetCall((ProviderMIHandle*)self->hdl, &status, "create_instance", 4, _context, _result, _reference, @@ -505,7 +505,7 @@ _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); plist = proplist2target(properties); - call_provider((ProviderMIHandle*)self->hdl, &status, "set_instance", 5, + TargetCall((ProviderMIHandle*)self->hdl, &status, "set_instance", 5, _context, _result, _reference, @@ -543,7 +543,7 @@ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - call_provider((ProviderMIHandle*)self->hdl, &status, "delete_instance", 3, + TargetCall((ProviderMIHandle*)self->hdl, &status, "delete_instance", 3, _context, _result, _reference); @@ -585,7 +585,7 @@ _query = string2target(query); _lang = string2target(language); - call_provider((ProviderMIHandle*)self->hdl, &status, "exec_query", 5, + TargetCall((ProviderMIHandle*)self->hdl, &status, "exec_query", 5, _context, _result, _reference, @@ -658,7 +658,7 @@ _resultRole = string2target(resultRole); } - call_provider((ProviderMIHandle*)self->hdl, &status, "associator_names", 7, + TargetCall((ProviderMIHandle*)self->hdl, &status, "associator_names", 7, _ctx, _rslt, _objName, @@ -728,7 +728,7 @@ _resultRole = string2target(resultRole); } - call_provider((ProviderMIHandle*)self->hdl, &status, "associators", 8, + TargetCall((ProviderMIHandle*)self->hdl, &status, "associators", 8, _ctx, _rslt, _objName, @@ -783,7 +783,7 @@ _resultClass = string2target(resultClass); } - call_provider((ProviderMIHandle*)self->hdl, &status, "reference_names", 5, + TargetCall((ProviderMIHandle*)self->hdl, &status, "reference_names", 5, _ctx, _rslt, _objName, @@ -839,7 +839,7 @@ } _props = proplist2target(properties); - call_provider((ProviderMIHandle*)self->hdl, &status, "references", 6, + TargetCall((ProviderMIHandle*)self->hdl, &status, "references", 6, _ctx, _rslt, _objName, @@ -885,7 +885,7 @@ _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); _method = string2target(method); - call_provider((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6, + TargetCall((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6, _ctx, _rslt, _objName, @@ -929,7 +929,7 @@ _className = string2target(className); _owner = string2target(owner); - call_provider((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5, + TargetCall((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5, _ctx, _filter, _className, @@ -971,7 +971,7 @@ _firstActivation = Target_Bool(firstActivation); _className = string2target(className); - call_provider((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5, + TargetCall((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5, _ctx, _filter, _className, @@ -1013,7 +1013,7 @@ _lastActivation = Target_Bool(lastActivation); _className = string2target(className); - call_provider((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5, + TargetCall((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5, _ctx, _filter, _className, @@ -1057,7 +1057,7 @@ _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); _className = string2target(className); - call_provider((ProviderMIHandle*)self->hdl, &status, "must_poll", 4, + TargetCall((ProviderMIHandle*)self->hdl, &status, "must_poll", 4, _ctx, //_rslt, _filter, @@ -1088,7 +1088,7 @@ TARGET_THREAD_BEGIN_BLOCK; _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - call_provider((ProviderMIHandle*)self->hdl, &status, "enable_indications", 1, _ctx); + TargetCall((ProviderMIHandle*)self->hdl, &status, "enable_indications", 1, _ctx); TARGET_THREAD_END_BLOCK; _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); @@ -1115,7 +1115,7 @@ TARGET_THREAD_BEGIN_BLOCK; _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - call_provider((ProviderMIHandle*)self->hdl, &status, "disable_indications", 1, _ctx); + TargetCall((ProviderMIHandle*)self->hdl, &status, "disable_indications", 1, _ctx); TARGET_THREAD_END_BLOCK; _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); Modified: cmpi-bindings/trunk/src/target_perl.c =================================================================== --- cmpi-bindings/trunk/src/target_perl.c 2008-10-26 03:23:08 UTC (rev 1135) +++ cmpi-bindings/trunk/src/target_perl.c 2008-10-28 09:54:58 UTC (rev 1136) @@ -95,12 +95,12 @@ /* - * call_provider + * TargetCall * */ static int -call_provider(ProviderMIHandle* hdl, CMPIStatus* st, +TargetCall(ProviderMIHandle* hdl, CMPIStatus* st, const char* opname, int nargs, ...) { int i; Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-10-26 03:23:08 UTC (rev 1135) +++ cmpi-bindings/trunk/src/target_python.c 2008-10-28 09:54:58 UTC (rev 1136) @@ -172,13 +172,13 @@ /*---------------------------------------------------------------*/ /* - * call_provider + * TargetCall * * ** must be called while holding the threads lock ** */ static int -call_provider(ProviderMIHandle* hdl, CMPIStatus* st, +TargetCall(ProviderMIHandle* hdl, CMPIStatus* st, const char* opname, int nargs, ...) { int rc = 1; Modified: cmpi-bindings/trunk/src/target_ruby.c =================================================================== --- cmpi-bindings/trunk/src/target_ruby.c 2008-10-26 03:23:08 UTC (rev 1135) +++ cmpi-bindings/trunk/src/target_ruby.c 2008-10-28 09:54:58 UTC (rev 1136) @@ -184,12 +184,12 @@ /* - * call_provider + * TargetCall * Call function 'opname' with nargs arguments within managed interface hdl->instance */ static int -call_provider(ProviderMIHandle* hdl, CMPIStatus* st, +TargetCall(ProviderMIHandle* hdl, CMPIStatus* st, const char* opname, int nargs, ...) { int i; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-11-06 16:28:36
|
Revision: 1154 http://omc.svn.sourceforge.net/omc/?rev=1154&view=rev Author: kkaempf Date: 2008-11-06 16:28:25 +0000 (Thu, 06 Nov 2008) Log Message: ----------- add copyright notice Modified Paths: -------------- cmpi-bindings/trunk/src/target_perl.c cmpi-bindings/trunk/src/target_python.c cmpi-bindings/trunk/src/target_ruby.c Modified: cmpi-bindings/trunk/src/target_perl.c =================================================================== --- cmpi-bindings/trunk/src/target_perl.c 2008-11-06 14:41:43 UTC (rev 1153) +++ cmpi-bindings/trunk/src/target_perl.c 2008-11-06 16:28:25 UTC (rev 1154) @@ -6,6 +6,37 @@ * Here: Perl */ +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + /* load <RB_BINDINGS_FILE>.pl */ #define PL_BINDINGS_FILE "cmpi_plwbem_bindings" Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-11-06 14:41:43 UTC (rev 1153) +++ cmpi-bindings/trunk/src/target_python.c 2008-11-06 16:28:25 UTC (rev 1154) @@ -6,6 +6,36 @@ * Here: Python */ +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ #include <Python.h> Modified: cmpi-bindings/trunk/src/target_ruby.c =================================================================== --- cmpi-bindings/trunk/src/target_ruby.c 2008-11-06 14:41:43 UTC (rev 1153) +++ cmpi-bindings/trunk/src/target_ruby.c 2008-11-06 16:28:25 UTC (rev 1154) @@ -6,6 +6,37 @@ * Here: Ruby */ +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + /* load <RB_BINDINGS_FILE>.rb */ #define RB_BINDINGS_FILE "cmpi_rbwbem_bindings" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |