libopendrim-1.1.3/0000755000175000017500000000000011404077256014560 5ustar guillaumeguillaumelibopendrim-1.1.3/Transtype.cpp0000644000175000017500000005040411404077256017260 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #include "Transtype.h" string CT_CMPIObjectPathToString(const CMPIObjectPath* cop) { string result; Objectpath _cop(NULL, (CMPIObjectPath*) cop); result = _cop.getNamespace() + ":" + _cop.getClassname(); unsigned long nbKeys = _cop.getKeyCount(); vector keyNames; vector keyValues; for (unsigned int i = 0; i < nbKeys; i++) { string keyName; CMPIData keyValue; _cop.getKeyAt(i, keyValue, keyName); vector::size_type _index; CF_foundInSortedList(keyName, keyNames, _index); keyNames.insert(keyNames.begin() + _index, keyName); keyValues.insert(keyValues.begin() + _index, CT_CMPIDataToString(keyValue)); } for (unsigned int i = 0; i < keyNames.size(); i++) result += "." + keyNames[i] + "=" + keyValues[i]; return result; } string CT_CMPIArrayToString(const CMPIArray* array) { string result; if (array == NULL) return "null"; for (unsigned int i = 0; i < array->ft->getSize(array, NULL); i++) { result += CT_CMPIDataToString(array->ft->getElementAt(array, i, NULL)); if (i < array->ft->getSize(array, NULL)-1) result += ","; } return result; } string CT_CMPIDataToString(const CMPIData& data) { if ((data.state & CMPI_goodValue) != CMPI_goodValue && (data.state & CMPI_keyValue) != CMPI_keyValue) return "null"; switch (data.type) { case (CMPI_uint8): return CF_intToStr((unsigned char) data.value.uint8); case (CMPI_uint16): return CF_intToStr((unsigned short) data.value.uint16); case (CMPI_uint32): return CF_intToStr((unsigned long) data.value.uint32); case (CMPI_uint64): return CF_intToStr((unsigned long long) data.value.uint64); case (CMPI_sint8): return CF_intToStr((char) data.value.sint8); case (CMPI_sint16): return CF_intToStr((short) data.value.sint16); case (CMPI_sint32): return CF_intToStr((long) data.value.sint32); case (CMPI_sint64): return CF_intToStr((long long) data.value.sint64); case (CMPI_real32): return CF_intToStr((float) data.value.real32); case (CMPI_real64): return CF_intToStr((double) data.value.real64); case (CMPI_boolean): return CF_boolToStr((bool) data.value.boolean); case (CMPI_char16): return CF_intToStr((unsigned short) data.value.char16); case (CMPI_string): return "\"" + CF_quoteString(CMGetCharPtr(data.value.string)) + "\""; case (CMPI_dateTime): return CMGetCharPtr(data.value.dateTime->ft->getStringFormat(data.value.dateTime, NULL)); case (CMPI_ref): return CT_CMPIObjectPathToString(data.value.ref); case (CMPI_ARRAY): return CT_CMPIArrayToString(data.value.array); default: return "unkown"; } } //uint8 CMPIValue CT_toCMPI(const unsigned char& value) { CMPIValue myValue; myValue.uint8 = value; return myValue; } int CT_ToC(const CMPIData& data, unsigned char& value) { value = data.value.uint8; return OK; } //uint16 CMPIValue CT_toCMPI(const unsigned short& value) { CMPIValue myValue; myValue.uint16 = value; return myValue; } int CT_ToC(const CMPIData& data, unsigned short& value) { value = data.value.uint16; return OK; } //uint32 CMPIValue CT_toCMPI(const unsigned int& value) { CMPIValue myValue; myValue.uint32 = value; return myValue; } int CT_ToC(const CMPIData& data, unsigned int& value) { value = data.value.uint32; return OK; } //uint32 deprecated CMPIValue CT_toCMPI(const unsigned long& value) { CMPIValue myValue; myValue.uint32 = value; return myValue; } int CT_ToC(const CMPIData& data, unsigned long& value) { value = data.value.uint32; return OK; } //uint64 CMPIValue CT_toCMPI(const unsigned long long& value) { CMPIValue myValue; myValue.uint64 = value; return myValue; } int CT_ToC(const CMPIData& data, unsigned long long& value) { value = data.value.uint64; return OK; } //sint8 CMPIValue CT_toCMPI(const signed char& value) { CMPIValue myValue; myValue.sint8 = value; return myValue; } int CT_ToC(const CMPIData& data, signed char& value) { value = data.value.sint8; return OK; } //sint16 CMPIValue CT_toCMPI(const short& value) { CMPIValue myValue; myValue.sint16 = value; return myValue; } int CT_ToC(const CMPIData& data, short& value) { value = data.value.sint16; return OK; } //sint32 CMPIValue CT_toCMPI(const int& value) { CMPIValue myValue; myValue.sint32 = value; return myValue; } int CT_ToC(const CMPIData& data, signed int& value) { value = data.value.sint32; return OK; } //sint32 deprecated CMPIValue CT_toCMPI(const long& value) { CMPIValue myValue; myValue.sint32 = value; return myValue; } int CT_ToC(const CMPIData& data, signed long& value) { value = data.value.sint32; return OK; } //sint64 CMPIValue CT_toCMPI(const long long& value) { CMPIValue myValue; myValue.sint64 = value; return myValue; } int CT_ToC(const CMPIData& data, signed long long& value) { value = data.value.sint64; return OK; } //real32 CMPIValue CT_toCMPI(const float& value) { CMPIValue myValue; myValue.real32 = value; return myValue; } int CT_ToC(const CMPIData& data, float& value) { value = data.value.real32; return OK; } //real64 CMPIValue CT_toCMPI(const double& value) { CMPIValue myValue; myValue.real64 = value; return myValue; } int CT_ToC(const CMPIData& data, double& value) { value = data.value.real64; return OK; } //char16 CMPIValue CT_toCMPIChar16(const unsigned short & value) { CMPIValue myValue; myValue.char16 = value; return myValue; } int CT_ToCChar16(const CMPIData& data, unsigned short& value) { value = data.value.char16; return OK; } //boolean CMPIValue CT_toCMPI(const bool& value) { CMPIValue myValue; myValue.boolean = value; return myValue; } int CT_ToC(const CMPIData& data, bool& value) { value = data.value.boolean; return OK; } //string CMPIValue CT_toCMPI(const CMPIBroker* broker, const string& value) { CMPIValue myValue; myValue.string = broker->eft->newString(broker, value.c_str(), NULL); return myValue; } int CT_ToC(const CMPIData& data, string& value) { if (data.value.string == NULL) return FAILED; value = CMGetCharPtr(data.value.string); return OK; } //datetime CMPIValue CT_toCMPIDatetime(const CMPIBroker* broker, const string& value) { CMPIValue myValue; myValue.dateTime = broker->eft->newDateTimeFromChars(broker, value.c_str(), NULL); return myValue; } int CT_ToCDatetime(const CMPIData& data, string& value) { CMPIDateTime* myTime = data.value.dateTime; value = CMGetCharPtr(myTime->ft->getStringFormat(myTime, NULL)); return OK; } //REF CMPIValue CT_toCMPI(const Objectpath& value) { CMPIValue myValue; myValue.ref = ((Objectpath&) value).getHdl(); return myValue; } int CT_ToC(const CMPIBroker* broker, const CMPIData& data, Objectpath& value) { CMPIObjectPath* myPath = data.value.ref; value = Objectpath((const CMPIBroker*) broker, myPath); return OK; } //uint8[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_uint8, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.uint8 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_uint8); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.uint8); return OK; } //uint16[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_uint16, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.uint16 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_uint16); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.uint16); return OK; } //uint32[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_uint32, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.uint32 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_uint32); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.uint32); return OK; } //uint32[] deprecated CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_uint32, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.uint32 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_uint32); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.uint32); return OK; } //uint64[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_uint64, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.uint64 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_uint64); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.uint64); return OK; } //sint8[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_sint8, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.sint8 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_sint8); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.sint8); return OK; } //sint16[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_sint16, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.sint16 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_sint16); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.sint16); return OK; } //sint32[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_sint32, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.sint32 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_sint32); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.sint32); return OK; } //sint32[] deprecated CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_sint32, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.sint32 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_sint32); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.sint32); return OK; } //sint64[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_sint64, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.sint64 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_sint64); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.sint64); return OK; } //real32[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_real32, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.real32 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_real32); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.real32); return OK; } //real64[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_real64, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.real64 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_real64); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.real64); return OK; } //char16[] CMPIValue CT_toCMPIChar16(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_char16, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.char16 = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_char16); } myValue.array = myArray; return myValue; } int CT_ToCChar16(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.char16); return OK; } //boolean[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_boolean, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.boolean = value[i]; myArray->ft->setElementAt(myArray, i, &myValue, CMPI_boolean); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(myArray->ft->getElementAt(myArray, i, NULL).value.boolean); return OK; } //string[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_string, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.string = broker->eft->newString(broker, value[i].c_str(), NULL); myArray->ft->setElementAt(myArray, i, &myValue, CMPI_string); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) value.push_back(CMGetCharPtr(myArray->ft->getElementAt(myArray, i, NULL).value.string)); return OK; } //datetime[] CMPIValue CT_toCMPIDatetime(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_dateTime, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.dateTime = broker->eft->newDateTimeFromChars(broker, value[i].c_str(), NULL); myArray->ft->setElementAt(myArray, i, &myValue, CMPI_dateTime); } myValue.array = myArray; return myValue; } int CT_ToCDatetime(const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) { CMPIDateTime* myTime = myArray->ft->getElementAt(myArray, i, NULL).value.dateTime; value.push_back(CMGetCharPtr(myTime->ft->getStringFormat(myTime, NULL))); } return OK; } //REF[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value) { CMPIArray* myArray; CMPIValue myValue; myArray = broker->eft->newArray(broker, value.size(), CMPI_ref, NULL); for (unsigned int i = 0; i < value.size(); i++) { myValue.ref = ((Objectpath&) value[i]).getHdl(); myArray->ft->setElementAt(myArray, i, &myValue, CMPI_ref); } myValue.array = myArray; return myValue; } int CT_ToC(const CMPIBroker* broker, const CMPIData& data, vector& value) { CMPIArray* myArray; myArray = data.value.array; if (myArray == NULL) return FAILED; for (unsigned int i = 0; i < myArray->ft->getSize(myArray, NULL); i++) { CMPIObjectPath* myPath = myArray->ft->getElementAt(myArray, i, NULL).value.ref; value.push_back(Objectpath((const CMPIBroker*) broker, myPath)); } return OK; } libopendrim-1.1.3/Common.h0000644000175000017500000004127111404077256016166 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #ifndef _COMMON_H_ #define _COMMON_H_ #ifndef _ERROR_CODES #define _ERROR_CODES // Standard return codes #define OK 0 #define FAILED 1 #define ACCESS_DENIED 2 #define INVALID_NAMESPACE 3 #define INVALID_PARAMETER 4 #define INVALID_CLASS 5 #define NOT_FOUND 6 #define NOT_SUPPORTED 7 #define CLASS_HAS_CHILDREN 8 #define CLASS_HAS_INSTANCES 9 #define INVALID_SUPERCLASS 10 #define ALREADY_EXISTS 11 #define NO_SUCH_PROPERTY 12 #define TYPE_MISMATCH 13 #define QUERY_LANGUAGE_NOT_SUPPORTED 14 #define INVALID_QUERY 15 #define METHOD_NOT_AVAILABLE 16 #define METHOD_NOT_FOUND 17 // Return codes specific to the "cleanup" (unload) method #define DO_NOT_UNLOAD 50 #define NEVER_UNLOAD 51 // Internal CMPI return codes #define INVALID_HANDLE 60 #define INVALID_DATA_TYPE 61 // Hosting OS errors #define ERROR_SYSTEM 100 #define ERROR 200 #endif //_ERROR_CODES //Added by Ilsoo Byun (2007-05-09) //To enhance readability. #ifndef _COMMON_MACROS #define _COMMON_MACROS #define CF_assert(target) if ( int ___rc = (target) != OK ) return ___rc; #define CF_assertFail(target) if ( int ___rc = (target) == OK ) return ___rc #define CF_assertWithString(target, msg) if ( int ___rc = (target) != OK ) {errorMessage=(msg); return ___rc;} #define CF_assertFailWithString(target, msg) if ( int ___rc = (target) == OK ) {errorMessage=(msg); return ___rc;} #define CF_assertTrueWithString(target, msg) if (!(target)) {errorMessage=(msg); return FAILED;} #define CF_assertFalseWithString(target, msg) if ((target)) {errorMessage=(msg); return FAILED;} #define errmsg(msg) {errorMessage=(msg); return FAILED;} #define _ARRAY_CMP if (vect1.size() != vect2.size())\ return false;\ for (size_t i=0; i < vect1.size(); i++) {\ if (vect1[i] != vect2[i])\ return false;\ }\ return true; #define _TO_STR ostringstream ostr;\ ostr << value;\ return ostr.str(); #endif //_COMMON_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Datastore.h" #include "Objectpath.h" using namespace std; /* ---------------------------------------------------------------------------*/ /* System Calls */ /* ---------------------------------------------------------------------------*/ // Execute a command and get the response int CF_runCommand(const string& cmd, string& stdout_msg, string& stderr_msg, string& errorMessage); // Execute a command and get the response. Set do_trace to trace commands (trace result in cmpi_prov_debug.txt) int CF_runCommand(const string& cmd, string& stdout_msg, string& stderr_msg, bool do_trace, string& errorMessage); // Execute a command and get the first line of the response int CF_runCommandFL(const string& cmd, string& stdOut, string& errorMessage); // Execute a command and split the response into lines. // If expected_number_of_lines != 0 and the number of lines != expected_number_of_lines // then a FAILED status is returned int CF_runCommandToLines(const string& cmd, vector& output, unsigned long expected_number_of_lines, string& errorMessage); // Get the computer system name int CF_getSystemName(string& sysName, string& errorMessage); // Get the operating system name int CF_getOSName(string& OSName, string& errorMessage); //Get the list of ethernet port //Deprecated int CF_getEthernetPortNames(vector& result, string& errorMessage); //Get IP by the ethernet port name //Deprecated int CF_getIP(const string& ethName, string& ip, string& errorMessage); //Get the ip of the first ethernet port. int CF_getMachineIP(string& ip, string& errorMessage); // Refer to the below URL for block size calculation // http://www.faqs.org/docs/Linux-mini/Partition.html#BLOCKSIZE int CF_getBlockSize(const string& path, int& blocksize, int& num_blocks, string& errorMessage); // Get the first line of the response of "whatis" for a specified program name int CF_getWhatisFL(const string& name, string& output, string& errorMessage); /* ---------------------------------------------------------------------------*/ /* File manipulation */ /* ---------------------------------------------------------------------------*/ // Lock a file (multi-process safety) int CF_lock(const struct flock& file_lock, int& fd, string& errorMessage); // Unlock a file (multi-process safety) int CF_unlock(struct flock& file_lock, int fd, string& errorMessage); // Read the content of a file and put it into a string int CF_readTextFile(const string& path, string& content, string& errorMessage); // Read the content of a file and return the first line only int CF_readTextFileFL(const string& path, string& content, string& errorMessage); // Read the content of a file and split it into lines. // If expected_number_of_lines != 0 and the number of lines != expected_number_of_lines // then a FAILED status is returned int CF_readTextFileToLines(const string& path, vector& content, unsigned long expected_number_of_lines, string& errorMessage); // The result of CF_writeTextFile(...) has unkonwn characters at the end. // It remove those characters. int CF_readFileToString(const string& path, string& result, string& errorMessage); // Write the content of a string to a file int CF_writeTextFile(const string& path, const string& content, string& errorMessage); // Check whether or not the file exist. bool CF_isExist(const string& filePath); // Check if the given path corresponds to a regular file bool CF_isRegularFile(const string& path); // Check if the given path corresponds to a directory bool CF_isDirectory(const string& path); // List the regular files/directories/block devices/character devices contained in a directory int CF_scanDirectory(const string& directory, vector& regular_files, vector& directories, vector& block_devices, vector& character_devices, string& errorMessage); /* ---------------------------------------------------------------------------*/ /* String manipulation */ /* ---------------------------------------------------------------------------*/ // Remove desired characters from a string string CF_removeChar(const string& input, const char* characters); // Split a text into strings using one or multiple separators void CF_splitText(vector& output, const string& input, const char* separators); // Split a text into strings void CF_splitText(vector& output, const string& input, char separator); // Split a text into strings (space character as separator) and removes spaces void CF_splitTextBySpace(vector& output, const string& input); // Remove the formatting characters (tabulations and backspaces) string CF_trimText(const string& Text); // Replace tabs by spaces in a string string CF_untab(const string& text); // Convert string to low case string CF_toLowCase(const string& str); // Check if "word" is at the begining of the string "str" bool CF_startsWith(const string& str, const string& word); // Check if "word" is at the begining of the string "str" (case insensitive version) bool CF_startsWithNoCase(const string& str, const string& word); // Check if "word" is at the end of the string "str" bool CF_endsWith(const string& str, const string& word); // Check if "word" is at the end of the string "str" (case insensitive version) bool CF_endsWithNoCase(const string& str, const string& word); // Add escape characters in front of double quotes. // Useful for quoting strings string CF_quoteString(const string& str); /* ---------------------------------------------------------------------------*/ /* C++ type comparison */ /* ---------------------------------------------------------------------------*/ // Compare two strings in a case-insensitive manner bool CF_strCmpNoCase(const string& str1, const string& str2); // Compare two arrays of strings in a case-insensitive manner bool CF_strArrayCmpNoCase(const vector& vect1, const vector& vect2); // Compare two arrays of numerical values bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); bool CF_numArrayCmp(const vector& vect1, const vector& vect2); // Compare two arrays of booleans bool CF_boolArrayCmp(const vector& vect1, const vector& vect2); // Compare two arrays of references bool CF_refArrayCmp(const vector& vect1, const vector& vect2); // Compare two string datetimes // Result is given in sign: // -1: datetime1 < datetime2 // 0: datetime1 = datetime2 // +1: datetime1 > datetime2 int CF_datetimeCmp(int& sign, const string& datetime1, const string& datetime2, string& errorMessage); /* ---------------------------------------------------------------------------*/ /* CMPI type comparison */ /* ---------------------------------------------------------------------------*/ bool CF_CMPIDataCmp(const CMPIBroker* broker, const CMPIData& data1, const CMPIData& data2); /* ---------------------------------------------------------------------------*/ /* Time and Datetime manipulation */ /* ---------------------------------------------------------------------------*/ // Get the number of minutes from the UTC timezone in minutes short CF_getCurrentTimeZone(); // Get the time in seconds since the Epoch (UTC 1970.01.01) time_t CF_getUTCTime(); // Append the timezone to a string following the CIM format for datetime properties void CF_addTimeZone(string& datetime, short timezone); // Convert a time_t C structure (time in seconds since the Epoch (UTC 1970.01.01)) // into a CIM datetime formated string without the timezone (local time) string CF_toLocalTime(time_t time); // Convert a time_t C structure (time in seconds since the Epoch (UTC 1970.01.01)) // into a CIM datetime formated string (local time) string CF_toLocalTime(time_t UTC_time, short timezone); // Get the local date time into a CIM datetime formated string string CF_getLocalDateTime(time_t UTC_time); // Get the last time when the state is changed int CF_lastModified(const string& filepath, string& modifiedTime, string& errorMessage); // Tells if the string contains a valid datetime or not bool CF_isDatetime(const string& myDatetime); // Converts a string datetime into its number of microseconds since the EPOCH (1970/01/01) // Dates before the EPOCH are not supported int CF_datetimeToBinary(unsigned long long& binaryDatetime, const string& myDatetime, string& errorMessage); // Converts an abbreviated month name (month name on 3 characters) string to its number int CF_monthAbvStrToInt(const string& month); // Converts an abbreviated month name (month name on 3 characters) string (char* format) to its number int CF_monthAbvStrToInt(const char* month); // DEPRECATED // Get the number of minutes from the UTC timezone in minutes (can be negative) signed short CF_getOsTimezone(); // DEPRECATED // Get the local time in seconds since the Epoch (1970.01.01) time_t CF_localTime(); // DEPRECATED // Append the timezone to a string following the CIM format for datetime properties void CF_catTimezone(char *str, signed short zone); // DEPRECATED // Convert a time_t C structure into a CIM datetime formated string, including the timezone string CF_timeToString(time_t time); /* ---------------------------------------------------------------------------*/ /* Integer / String conversion */ /* ---------------------------------------------------------------------------*/ // Convert int to string string CF_intToStr(unsigned char value); string CF_intToStr(unsigned short value); string CF_intToStr(unsigned long value); string CF_intToStr(unsigned long long value); string CF_intToStr(signed char value); string CF_intToStr(short value); string CF_intToStr(long value); string CF_intToStr(long long value); string CF_intToStr(float value); string CF_intToStr(double value); string CF_intToStr(int value); string CF_intToStr(unsigned int value); // convert boolean to string string CF_boolToStr(bool value); // Convert a string to an unsigned long unsigned long CF_strToUL(const string& input); // Convert a string to an unsigned long long unsigned long long CF_strToULL(const string& input); //Check if it is a number bool CF_isNumber(const string& str); /* ---------------------------------------------------------------------------*/ /* Sorting */ /* ---------------------------------------------------------------------------*/ // Find the index of an element in list bool CF_foundInList(const string& element, const vector& list, vector::size_type& index); // Find the index of an element in a sorted list bool CF_foundInSortedList(const string& element, const vector& list, vector::size_type& index); /* ---------------------------------------------------------------------------*/ /* Provider Debugging mechanism */ /* ---------------------------------------------------------------------------*/ // A simple debuging mechanism // The debugging infomation is written in the /var/tmp/cmpi_prov_debug.txt file located where the cimserver was launched. // _E_; // This will print "<< enter [FUNCTION]" when you enter a method. // _L_; // This will print ">> leave [FUNCTION]" when you leave a method. // DEBUG; // This will print "== debug [FILE][FUNCTION][LINE]" #ifdef __DEBUG__ #define DEBUG system(((string) "echo \"== debug [" + CF_intToStr(getpid()) + "][" + __FILE__ + (string) "][" + __func__ + (string) "][" + CF_intToStr(__LINE__) + (string) "]\" >> /var/tmp/cmpi_prov_debug.txt").c_str()) #define _DEBUG(errorMessage) system(((string) "echo \"== debug [" + CF_intToStr(getpid()) + "][" + __FILE__ + (string) "][" + __func__ + (string) "][" + CF_intToStr(__LINE__) + (string) "]: " + errorMessage + (string) "\" >> /var/tmp/cmpi_prov_debug.txt").c_str()) #define _E_ system(((string) "echo \"<< enter [" + CF_intToStr(getpid()) + "][" + __func__ + (string) "]\" >> /var/tmp/cmpi_prov_debug.txt").c_str()) #define _L_ system(((string) "echo \">> leave [" + CF_intToStr(getpid()) + "][" + __func__ + (string) "]\" >> /var/tmp/cmpi_prov_debug.txt").c_str()) #else #define DEBUG #define _DEBUG(errorMessage) #define _E_ #define _L_ #endif #endif /*COMMON_H_*/ libopendrim-1.1.3/Datastore.h0000644000175000017500000003222111404077256016657 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef _DATASTORE_H_ #define _DATASTORE_H_ #include "Common.h" using namespace std; #define _DATASTORE_PATH "/var/lib/OpenDRIM" // Initialize a datastore int DS_initDataStore(const string& nameSpace, const string& classname, const string& keys, const string& property_name, string& errorMessage); // Delete the data of an instance in a datastore int DS_deleteDataStore(const string& nameSpace, const string& classname, const string& keys, string& errorMessage); // Set any property stored in local datastore to NULL int DS_setPropertyNULL(const string& nameSpace, const string& classname, const string& keys, const string& property_name, string& errorMessage); // Get the list of the entries of keys int DS_getKeysEntries(const string& nameSpace, const string& classname, vector& keys_entries, string& errorMessage); // Check if an instance exists according to the values of its keys bool DS_keysEntryExists(const string& nameSpace, const string& classname, const string& keys_entry, string& errorMessage); #define _GETPROPERTY_INTEGER string property_file;\ CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage));\ vector property_file_lines;\ CF_splitText(property_file_lines, property_file, '\n');\ property = atoll(property_file_lines[0].c_str());\ return OK; #define _SETPROPERTY_INTEGER_AND_REAL CF_assert(DS_initDataStore(nameSpace, classname, keys, errorMessage));\ string property_file;\ CF_assert(CF_writeTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), CF_intToStr(property), errorMessage));\ return OK; #define _GETPROPERTY_REAL string property_file;\ CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage));\ vector property_file_lines;\ CF_splitText(property_file_lines, property_file, '\n');\ property = atof(property_file_lines[0].c_str());\ return OK; #define _GETPROPERTY_INTEGERARRAY property.clear();\ string property_file;\ CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage));\ vector property_file_lines;\ CF_splitText(property_file_lines, property_file, '\n');\ for (size_t i=0; i property_file_lines;\ CF_splitText(property_file_lines, property_file, '\n');\ for (size_t i=0; i& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage); int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage); #endif /*COMMON_H_*/ libopendrim-1.1.3/EmbeddedInstance.h0000644000175000017500000000365211404077256020115 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Ilsoo Byun, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #ifndef __OPENDRIM_EMBEDDED_INSTANCe_H #define __OPENDRIM_EMBEDDED_INSTANCe_H #include "cmpidt.h" #include "cmpimacs.h" #include "cmpift.h" /* * - Return code * Success: 0 * Failed: 1 */ int CF_parseXmlInstance(const char *xml, const CMPIBroker *broker, const char *ns, CMPIInstance **instance); #endif libopendrim-1.1.3/Makefile.am0000644000175000017500000000720511404077256016620 0ustar guillaumeguillaume################################################################################# # Note: This Copyright statement covers the OpenDRIM original parts of this file. # It does NOT concern the parts generated by automake. # # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################# VENDOR = OpenDRIM VERSION = $(shell cat ./VERSION) APP_NAME = libopendrim RPM_PACKAGE_DIR = packaging PLATFORM = $(shell rpm --eval %_target_cpu) WORKING_DIR = $(shell pwd) SUBDIRS = cmpi commonlibdir = @COMMONLIBDIR@ library_includedir = $(OPENDRIMCOMMONINCLUDE) library_include_HEADERS = Association.h CMPIBroking.h Common.h Datastore.h Indication.h Instance.h Objectpath.h Transtype.h EmbeddedInstance.h net_dev.h SMBIOS.h commonlib_LTLIBRARIES = libopendrim.la libopendrim_la_SOURCES = Association.cpp CMPIBroking.cpp Common.cpp Datastore.cpp Indication.cpp Instance.cpp Objectpath.cpp Transtype.cpp EmbeddedInstance.cpp net_dev.cpp SMBIOS.cpp libopendrim_la_LDFLAGS = -lpthread -lxml2 -version-info 0:0:0 pkg-src: rm -rf packaging/$(APP_NAME)-$(VERSION) rm -rf .tmp mkdir .tmp cp -r ./* .tmp/ rm -rf ./tmp/packaging/ mv .tmp packaging/$(APP_NAME)-$(VERSION) tar --directory packaging -zcf packaging/$(APP_NAME)-$(VERSION).tar.gz $(APP_NAME)-$(VERSION) rm -rf packaging/$(APP_NAME)-$(VERSION) pkg-rpm: pkg-src mkdir -p $(RPM_PACKAGE_DIR)/rpm/RPMS/$(PLATFORM) mkdir -p $(RPM_PACKAGE_DIR)/rpm/SRPMS mkdir -p $(RPM_PACKAGE_DIR)/rpm/BUILD mkdir -p $(RPM_PACKAGE_DIR)/rpm/SOURCES mkdir -p $(RPM_PACKAGE_DIR)/rpm/tmp - rm -r $(RPM_PACKAGE_DIR)/rpm/BUILD/$(APP_NAME)-root - rm -r $(RPM_PACKAGE_DIR)/rpm/RPMS/$(APP_NAME)-* - rm -r $(RPM_PACKAGE_DIR)/rpm/SRPMS/$(APP_NAME)-* - rm -r $(RPM_PACKAGE_DIR)/rpm/SOURCES/$(APP_NAME)-* mv packaging/$(APP_NAME)-$(VERSION).tar.gz $(RPM_PACKAGE_DIR)/rpm/SOURCES/ rpmbuild --define="_topdir $(WORKING_DIR)/$(RPM_PACKAGE_DIR)/rpm" --define="version $(VERSION)" -ba $(RPM_PACKAGE_DIR)/$(APP_NAME).spec pkg-deb: pkg-src cp packaging/$(APP_NAME)-$(VERSION).tar.gz packaging/$(APP_NAME)-$(VERSION).orig.tar.gz cd packaging/ && tar axf $(APP_NAME)-$(VERSION).tar.gz cp -R packaging/debian packaging/$(APP_NAME)-$(VERSION) - cd packaging/$(APP_NAME)-$(VERSION) && dpkg-buildpackage -b rm -rf packaging/$(APP_NAME)-$(VERSION)* packaging/*.changes libopendrim-1.1.3/Instance.h0000644000175000017500000001650211404077256016501 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef INSTANCE_H_ #define INSTANCE_H_ #include "Objectpath.h" using namespace std; #define _GET_PROPERTY CMPIStatus rc;\ CMPIData data = CMGetProperty(hdl, name.c_str(), &rc);\ if (rc.rc != CMPI_RC_OK) return FAILED;\ if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound)\ return FAILED;\ return CT_ToC(data, value); // C++ class to represent a CIM instance class Instance { private: CMPIInstance* hdl; CMPIBroker* broker; public: Instance(); Instance(const CMPIBroker* _broker, CMPIInstance* inst); Instance(const CMPIBroker* _broker, Objectpath& op); ~Instance(); CMPIInstance* getHdl(); Objectpath getObjectpath(); string getClassname() const; string getNamespace() const; int getPropertyCount() const; string toString() const; //uint8 void setProperty(const string& name, const unsigned char& value); int getProperty(const string& name, unsigned char& value) const; //uint16 void setProperty(const string& name, const unsigned short int& value); int getProperty(const string& name, unsigned short int& value) const; //uint32 void setProperty(const string& name, const unsigned int& value); int getProperty(const string& name, unsigned int& value) const; //uint32 deprecated void setProperty(const string& name, const unsigned long& value); int getProperty(const string& name, unsigned long& value) const; //uint64 void setProperty(const string& name, const unsigned long long& value); int getProperty(const string& name, unsigned long long& value) const; //sint8 void setProperty(const string& name, const signed char& value); int getProperty(const string& name, signed char& value) const; //sint16 void setProperty(const string& name, const short int& value); int getProperty(const string& name, short int& value) const; //sint32 void setProperty(const string& name, const int& value); int getProperty(const string& name, int& value) const; //sint32 deprecated void setProperty(const string& name, const long& value); int getProperty(const string& name, long& value) const; //sint64 void setProperty(const string& name, const long long& value); int getProperty(const string& name, long long& value) const; //real32 void setProperty(const string& name, const float& value); int getProperty(const string& name, float& value) const; //real64 void setProperty(const string& name, const double& value); int getProperty(const string& name, double& value) const; //char16 void setPropertyChar16(const string& name, const unsigned short int& value); int getPropertyChar16(const string& name, unsigned short int& value) const; //boolean void setProperty(const string& name, const bool& value); int getProperty(const string& name, bool& value) const; //string void setProperty(const string& name, const string& value); int getProperty(const string& name, string& value) const; //datetime void setPropertyDatetime(const string& name, const string& value); int getPropertyDatetime(const string& name, string& value) const; //REF void setProperty(const string& name, const Objectpath& value); int getProperty(const string& name, Objectpath& value) const; //uint8[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //uint16[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //uint32[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //uint32[] deprecated void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //uint64[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //sint8[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //sint16[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //sint32[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //sint32[] deprecated void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //sint64[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //real32[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //real64[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //char16[] void setPropertyChar16(const string& name, const vector& value); int getPropertyChar16(const string& name, vector& value) const; //boolean[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //string[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; //datetime[] void setPropertyDatetime(const string& name, const vector& value); int getPropertyDatetime(const string& name, vector& value) const; // REF[] void setProperty(const string& name, const vector& value); int getProperty(const string& name, vector& value) const; }; #endif /*INSTANCE_H_*/ libopendrim-1.1.3/Objectpath.cpp0000644000175000017500000002351611404077256017356 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #include "Objectpath.h" Objectpath::Objectpath(){} Objectpath::~Objectpath(){} Objectpath::Objectpath(const CMPIBroker* _broker, const string& classname, const string& nameSpace) { broker = (CMPIBroker*) _broker; hdl = CMNewObjectPath((CMPIBroker*) broker, nameSpace.c_str(), classname.c_str(), NULL); } Objectpath::Objectpath(const CMPIBroker* _broker, CMPIObjectPath* ob) { hdl = ob; broker = (CMPIBroker*) _broker; } CMPIObjectPath* Objectpath::getHdl() const { return hdl; } Objectpath Objectpath::getObjectpath() const { return *this; } string Objectpath::getNamespace() const { CMPIStatus status; string nameSpace = CMGetCharPtr(hdl->ft->getNameSpace(hdl, &status)); if (status.rc != CMPI_RC_OK) return ""; return nameSpace; } void Objectpath::setNamespace(const string& value) { hdl->ft->setNameSpace(hdl, value.c_str()); } string Objectpath::getClassname() const { CMPIStatus status; string classname = CMGetCharPtr(hdl->ft->getClassName(hdl, &status)); if (status.rc != CMPI_RC_OK) return ""; return classname; } string Objectpath::getHostname() const { CMPIStatus status; string hostname = CMGetCharPtr(hdl->ft->getHostname(hdl, &status)); if (status.rc != CMPI_RC_OK) return ""; return hostname; } bool Objectpath::equals(const Objectpath& anotherObjectpath) const { if (anotherObjectpath.getKeyCount() != getKeyCount() || anotherObjectpath.getNamespace() != getNamespace() || anotherObjectpath.getClassname() != getClassname() || anotherObjectpath.getHostname() != getHostname()) return false; vector key_names, another_key_names; for (unsigned int i = 0; i < getKeyCount(); i++) { CMPIData data, anotherData; string name; // Get fist instance key name and value if (getKeyAt(i, data, name) != OK) return false; // Get second instance key value (same name) if (anotherObjectpath.getKey(name, anotherData) != OK) return false; if (!CF_CMPIDataCmp(broker, data, anotherData)) return false; } return true; } string Objectpath::toString() const { return CT_CMPIObjectPathToString(hdl); } unsigned int Objectpath::getKeyCount() const { CMPIStatus status; unsigned int keyCount = hdl->ft->getKeyCount(hdl, &status); if (status.rc != CMPI_RC_OK) return 0; return keyCount; } int Objectpath::getKeyAt(unsigned int index, CMPIData& data, string& name) const { CMPIStatus status; CMPIString* _name; data = hdl->ft->getKeyAt(hdl, index, &_name, &status); if (status.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; name = CMGetCharPtr(_name); return OK; } int Objectpath::getKey(const string& name, CMPIData& data) const { CMPIStatus status; data = hdl->ft->getKey(hdl, name.c_str(), &status); if (status.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return OK; } //uint8 void Objectpath::addKey(const string& name, const unsigned char& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_uint8); } int Objectpath::getKey(const string& name, unsigned char& value) const { _GET_KEY } //uint16 void Objectpath::addKey(const string& name, const unsigned short int& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_uint16); } int Objectpath::getKey(const string& name, unsigned short int& value) const { _GET_KEY } //uint32 void Objectpath::addKey(const string& name, const unsigned int& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_uint32); } int Objectpath::getKey(const string& name, unsigned int& value) const { _GET_KEY } //uint32 deprecated void Objectpath::addKey(const string& name, const unsigned long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_uint32); } int Objectpath::getKey(const string& name, unsigned long& value) const { _GET_KEY } //uint64 void Objectpath::addKey(const string& name, const unsigned long long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_uint64); } int Objectpath::getKey(const string& name, unsigned long long& value) const { _GET_KEY } //sint8 void Objectpath::addKey(const string& name, const signed char& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_sint8); } int Objectpath::getKey(const string& name, signed char& value) const { _GET_KEY } //sint16 void Objectpath::addKey(const string& name, const short int& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_sint16); } int Objectpath::getKey(const string& name, short int& value) const { _GET_KEY } //sint32 void Objectpath::addKey(const string& name, const int& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_sint32); } int Objectpath::getKey(const string& name, int& value) const { _GET_KEY } //sint32 deprecated void Objectpath::addKey(const string& name, const long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_sint32); } int Objectpath::getKey(const string& name, long& value) const { _GET_KEY } //sint64 void Objectpath::addKey(const string& name, const long long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_sint64); } int Objectpath::getKey(const string& name, long long& value) const { _GET_KEY } //real32 void Objectpath::addKey(const string& name, const float& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_real32); } int Objectpath::getKey(const string& name, float& value) const { _GET_KEY } //real64 void Objectpath::addKey(const string& name, const double& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_real64); } int Objectpath::getKey(const string& name, double& value) const { _GET_KEY } //char16 void Objectpath::addKeyChar16(const string& name, const unsigned short int& value) { CMPIValue myValue = CT_toCMPIChar16(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_char16); } int Objectpath::getKeyChar16(const string& name, unsigned short int& value) const { CMPIStatus rc; CMPIData data = CMGetKey(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToCChar16(data, value); } //boolean void Objectpath::addKey(const string& name, const bool& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_boolean); } int Objectpath::getKey(const string& name, bool& value) const { _GET_KEY } //string void Objectpath::addKey(const string& name, const string& value) { CMPIValue myValue = CT_toCMPI(broker, value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_string); } int Objectpath::getKey(const string& name, string& value) const { _GET_KEY } //datetime void Objectpath::addKeyDatetime(const string& name, const string& value) { CMPIValue myValue = CT_toCMPIDatetime(broker, value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_dateTime); } int Objectpath::getKeyDatetime(const string& name, string& value) const { CMPIStatus rc; CMPIData data = CMGetKey(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToCDatetime(data, value); } //REF void Objectpath::addKey(const string& name, const Objectpath& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->addKey(hdl, name.c_str(), &myValue, CMPI_ref); } int Objectpath::getKey(const string& name, Objectpath& value) const { CMPIStatus rc; CMPIData data = CMGetKey(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToC(broker, data, value); } libopendrim-1.1.3/net_dev.h0000644000175000017500000000442011404077256016355 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2008 Ilsoo Byun, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #ifndef __OPENDRIM_NET_DEV_H #define __OPENDRIM_NET_DEV_H #include #include #include #include #include #include #include #include #include #include #include #define MAXLINE 100 #define ADDR_MAX 32 struct net_proc { const char* name; unsigned long long tx; unsigned long long rx; }; int CN_getNetDevices(struct net_proc** result); void CN_releaseNetDevices(struct net_proc** result, int count); const char* CN_getMacAddress(const char* name); const char* CN_getIP(const char* name); const char* CN_getNetMask(const char* name); const char* CN_getBroadcastAddress(const char* name); #endif libopendrim-1.1.3/SMBIOS.h0000644000175000017500000002011411404077256015723 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2008 Guillaume BOTTEX, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #ifndef SMBIOS_H_ #define SMBIOS_H_ #include #include #include "Common.h" #define _SMBIOS_ANCHOR_SEARCH_OFFSET 0xF0000 #define _SMBIOS_ANCHOR_SEARCH_RANGE 0xFFFF // Define SMBIOS structure types #define _SYSTEM_INFORMATION 1 #define _PROCESSOR_INFORMATION 4 #define _CACHE_INFORMATION 7 #define _MEMORY_DEVICE 17 #define _MEMORY_ERROR_INFORMATION 18 #define _MEMORY_ARRAY_MAPPED_ADDRESS 19 #define _MEMORY_DEVICE_MAPPED_ADDRESS 20 #define DEV_MEM "/dev/mem" typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; typedef signed short s16; typedef u8 BYTE; typedef u16 WORD; typedef u32 DWORD; typedef u64 QWORD; typedef struct { char anchor_string[4]; // _SM_ } _smbios_anchor; typedef struct { BYTE anchor_string[4]; // _SM_ BYTE entry_point_structure_checksum; BYTE entry_point_length; BYTE smbios_major_version; BYTE smbios_minor_version; WORD maximum_structure_size; BYTE entry_point_revision; BYTE formatted_area[5]; BYTE intermediate_anchor_string[5]; //_DMI_ BYTE intermediate_checksum; WORD structure_table_length; DWORD structure_table_address; WORD number_of_smbios_structure; BYTE smbios_bcd_revision; } _smbios_entry_point; typedef struct { BYTE type; BYTE length; WORD handle; } _smbios_structure_header; typedef struct { // needed for mapping caches to processors unsigned short handle; // 0: Unknown, 1: Other, 2: Write Back, 3: Write Through, 4: Varies with Memory Address unsigned short operational_mode; bool enabled; // 0: Unknown, 1: Other, 2: Not Applicable, 3: Primary, 4: Secondary, 5: Tertiary unsigned short cache_level; // in bytes unsigned long long granularity; // in granularity unit unsigned long long installed_size; // 0: Unknown, 1: Other, 2: Instruction, 3: Data, 4: Unified unsigned short system_cache_type; // 0: Unknown, 1: Other, 2: Direct Mapped, 3: 2-way Set-Associative, 4: 4-way Set-Associative, // 5: Fully Associative, 6: 8-way Set-Associative, 7: 16-way Set-Associative unsigned short associativity; } _cache_information; typedef struct { // 1: Others, 2: Unknown, 3: Central Processor, 4: Math Processor, 5: DSP Processor, 6: Video Processor unsigned char processor_type; // 2: unknown unsigned short processor_family; bool has_voltage; // in milliVolts long voltage; // in MHz unsigned int external_clock; // in MHz unsigned int max_speed; // in MHz unsigned int current_speed; // 0: Unknown, 1: CPU Enabled, 2: CPU Disabled by User via BIOS Setup, 3: CPU Disabled By BIOS (POST Error), // 4: CPU is Idle, wating to be enabled, 5-6: Reserved, 7: Other unsigned short status; // 1: Other, 2- : See SMBIOS reference specification unsigned short processor_upgrade; // 0: Unknown unsigned short core_enabled; // Empty: Unknown vector processor_characteristics; bool has_l1_cache; unsigned short l1_cache_handle; _cache_information l1_cache; bool has_l2_cache; unsigned short l2_cache_handle; _cache_information l2_cache; bool has_l3_cache; unsigned short l3_cache_handle; _cache_information l3_cache; } _processor_information; typedef struct { char* string[256]; } _string_map; typedef struct _memory_device { BYTE type; BYTE length; WORD handle; WORD physical_memory; WORD memory_error; WORD total_width; WORD data_width; WORD size; BYTE form_factor; BYTE device_set; BYTE device_locator; BYTE bank_locator; BYTE memory_type; WORD type_detail; WORD speed; BYTE manufacturer; BYTE serial_number; BYTE asset_tag; BYTE part_number; BYTE attributes; }memory_device; typedef struct _memory_array_mapped_address { BYTE type; BYTE length; WORD handle; DWORD starting_address; DWORD ending_address; WORD memory_array_handle; BYTE partition_width; }memory_array_mapped_address; typedef struct _memory_error_information { BYTE type; BYTE length; WORD handle; BYTE error_type; BYTE error_granularity; BYTE error_operation; DWORD vendor_syndrome; DWORD memory_array_error_address; DWORD device_error_address; DWORD error_resolution; }memory_error_information; typedef struct _UUID { DWORD time_low; WORD time_mid; WORD time_hi_and_version; BYTE clock_seq_hi_and_reserved; BYTE clock_seq_low; BYTE node[6]; }UUID; typedef struct _system_information { BYTE type; BYTE length; WORD handle; BYTE manufacturer; BYTE product_name; BYTE version; BYTE serial_number; UUID uuid; BYTE wake_up_type; BYTE sku_number; BYTE family; }system_information; enum MemoryType { Other_MemoryType = 0x1, Unknown_MemoryType, DRAM, EDRAM, VRAM, SRAM, RAM, ROM, FLASH, EEPROM, FEPROM, EPROM, CDRAM, _3DRAM, SDRAM, SGRAM, RDRAM, DDR, DDR2, DDR2_FB_DIMM }; enum MemoryTypeDetail { Other_MemoryTypeDetail = 0x1, Unknown_MemoryTypeDetail, Fast_paged, Static_Column, Pseudo_static, RAMBus, Synchronous, CMOS, EDO, Window_DRAM, Cache_DRAM, Non_Volatile }; enum MemoryErrorType { Other_MemoryErrorType = 0x1, Unknown_MemoryErrorType, MemoryErrorType_OK, Bad_read, Parity_error, Single_bit_error, Double_bit_error, Multi_bit_error, Nibble_error, Checksum_error, CRC_error, Corrected_single_bit_error, Corrected_error, Uncorrectable_error }; enum MemoryErrorGranularity { Other_MemoryErrorGranularity = 0x1, Unknown_MemoryErrorGranularity, Device_level, Memory_partition_level }; enum MemoryErrorOperation { Other_MemoryErrorOperation = 0x1, Unknown_MemoryErrorOperation, Read, Write, Partial_write, }; string SMBIOS_processorInformationToString(const _processor_information& processor_information, const string& identation); string SMBIOS_cacheInformationToString(const _cache_information& cache_information, const string& identation); void SMBIOS_cacheInformationToDefault(_cache_information& cache_information); void SMBIOS_processorInformationToDefault(_processor_information& processor_information); int SMBIOS_findEntryPoint(int& dev_mem, void** ptrptr, _smbios_anchor** smbios_anchor_ptrptr, string& errorMessage); char* SMBIOS_nextSMBIOSStructureHeader(char* ptr, _string_map *string_map_ptr); int SMBIOS_getProcessorsInformation(vector<_processor_information>& processors_information, string& errorMessage); void *SMBIOS_getRawData(size_t base, size_t len, string& errorMessage); _smbios_entry_point *SMBIOS_getEntryPoint(void *start); int SMBIOS_getStructure(vector& output,char *tableAddress, u16 structureCount, u8 Type); const char *SMBIOS_getDmiString(_smbios_structure_header *dm, BYTE s); int SMBIOS_getSystemInformation(system_information& system_info,vector& dmi_strings,string& errorMessage); #endif /*SMBIOS_H_*/ libopendrim-1.1.3/Association.h0000644000175000017500000000731111404077256017207 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef ASSOCIATION_H_ #define ASSOCIATION_H_ #include "Instance.h" #include "CMPIBroking.h" // DEPRECATED by Frederic Desmons, ETRI (2007/05/22) int CA_resolveDirection(const CMPIBroker* broker, const string& refLeftClass, const string& refRightClass, const string& known, const string& unknown, Objectpath& left, Objectpath& right, const Objectpath& Known, int& direction, string& errorMessage); // DEPRECATED by Frederic Desmons, ETRI (2007/05/22) int CA_associatorFilter(const CMPIBroker* broker, const CMPIContext* ctx, const string& assocClass, const string& resultClass, const string& classname, const string refLeftClass, const string& refRightClass, const string& refLeft, const string& refRight, const string& role, const string& resultRole, Objectpath& left, Objectpath& right, const Objectpath& Known, int& direction, string& errorMessage); // DEPRECATED by Frederic Desmons, ETRI (2007/05/22) int CA_referenceFilter(const CMPIBroker* broker, const CMPIContext* ctx, const string& assocClass, const string& classname, const string& refLeftClass, const string& refRightClass, const string& refLeft, const string& refRight, const string& role, Objectpath& left, Objectpath& right, const Objectpath& Known, int& direction, string& errorMessage); // Added by Frederic Desmons, ETRI (2007/05/22) int CA_associatorResolveDirection(const char* leftClasses[], const char* rightClasses[], const string& leftNamespace, const string& rightNamespace, const string& leftRole, const string& rightRole, const Objectpath& known, const string& resultClass, const string& role, const string& resultRole, bool& leftToRight); // Added by Ilsoo Byun, ETRI (2007/11/07) int CA_associatorResolveDirection(const CMPIBroker* broker, const char* leftClasses[], const char* rightClasses[], const string& leftNamespace, const string& rightNamespace, const string& leftRole, const string& rightRole, const Objectpath& known, const string& resultClass, const string& role, const string& resultRole, bool& leftToRight); #endif /*ASSOCIATION_H_*/ libopendrim-1.1.3/EmbeddedInstance.cpp0000644000175000017500000001211211404077256020437 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Ilsoo Byun, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #include "Common.h" #include "EmbeddedInstance.h" #include #include #include static int parse_sizeof(const char* str) { size_t size = 0; while (str[size] != '\0') { ++size; } return size; } int CF_parseXmlInstance(const char *xml, const CMPIBroker *broker, const char *ns, CMPIInstance **instance) { xmlDocPtr doc = xmlReadMemory(xml, parse_sizeof(xml), NULL, NULL, 0); if (doc == NULL) { return 1; } xmlNodePtr node, cur; node = xmlDocGetRootElement(doc); if (node == NULL) { return 1; } xmlChar* classname = xmlGetProp(node, BAD_CAST "CLASSNAME"); if (classname == NULL) { return 1; } CMPIStatus status = {CMPI_RC_OK, NULL}; CMPIObjectPath* op = CMNewObjectPath(broker, ns, (char *)classname, &status); if (status.rc != CMPI_RC_OK || op == NULL) { return 1; } CMPIInstance* temp_instance = CMNewInstance(broker, op, &status); if (status.rc != CMPI_RC_OK || temp_instance == NULL) { return 1; } cur = node->children; while(cur != NULL) { if (cur->type == XML_ELEMENT_NODE && xmlStrcasecmp(cur->name, BAD_CAST "PROPERTY")==0 ) { xmlChar* prop_name = xmlGetProp(cur, BAD_CAST "NAME"); xmlChar* type_name = xmlGetProp(cur, BAD_CAST "TYPE"); CMPIValue cmpi_value; xmlNodePtr child = cur->children; while (child != NULL) { if (xmlStrcasecmp(child->name, BAD_CAST "VALUE")==0 && child->children != NULL) { xmlChar* value = child->children->content; if (xmlStrcasecmp(type_name, BAD_CAST "string") == 0) { CMPIString* str_value = CMNewString(broker, (char *)value, NULL); cmpi_value.string = str_value; CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_string); } else if (xmlStrcasecmp(type_name, BAD_CAST "uint16") == 0) { cmpi_value.uint16 = atoi((char *)value); CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_uint16); } else if (xmlStrcasecmp(type_name, BAD_CAST "uint32") == 0) { cmpi_value.uint32 = atoi((char *)value); CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_uint32); } else if (xmlStrcasecmp(type_name, BAD_CAST "uint64") == 0) { cmpi_value.uint64 = atoi((char *)value); CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_uint64); } else if (xmlStrcasecmp(type_name, BAD_CAST "sint16") == 0) { cmpi_value.sint16 = atoi((char *)value); CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_sint16); } else if (xmlStrcasecmp(type_name, BAD_CAST "sint32") == 0) { cmpi_value.sint32 = atoi((char *)value); CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_sint32); } else if (xmlStrcasecmp(type_name, BAD_CAST "sint64") == 0) { cmpi_value.sint64 = atoi((char *)value); CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_sint64); } else if (xmlStrcasecmp(type_name, BAD_CAST "boolean") == 0) { if (strcasecmp((char *)value, "true") == 0) { cmpi_value.boolean = true; } else if (strcasecmp((char *)value, "false") == 0) { cmpi_value.boolean = false; } else { _DEBUG("boolean type can has only two values:true or false."); return 1; } CMSetProperty(temp_instance, (char *) prop_name, &cmpi_value, CMPI_boolean); } break; } child = child->next; } } cur = cur->next; } xmlFree(doc); xmlCleanupParser(); *instance = temp_instance; return 0; } libopendrim-1.1.3/VERSION0000644000175000017500000000000611404077256015624 0ustar guillaumeguillaume1.1.3 libopendrim-1.1.3/acinclude.m40000644000175000017500000001107611404077256016756 0ustar guillaumeguillaume################################################################################# # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################# AC_DEFUN([SHOW_COPYRIGHT], [ echo "################################################################################# # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# " ] ) AC_DEFUN([CHECK_CIMSERVER], [ AC_MSG_CHECKING(for CIM servers) if test x"$CIMSERVER" == x then AC_MSG_ERROR([[please define the CIMSERVER variable (see ./configure --help)]]) fi if test "$CIMSERVER" != pegasus && test "$CIMSERVER" != sfcb && test "$CIMSERVER" != openwbem then AC_MSG_ERROR([[please define the CIMSERVER variable (see ./configure --help)]]) fi if test "$CIMSERVER" == pegasus then if test x"$prefix" == xNONE then if test "$HW" == X86_64 || test "$HW" == IA64 then COMMONLIBDIR=/usr/lib64 else COMMONLIBDIR=/usr/lib fi CMPIINCLUDEDIR=/usr/include/Pegasus/Provider/CMPI OPENDRIMCOMMONINCLUDE=/usr/include/OpenDRIM else if test "$HW" == X86_64 || test "$HW" == IA64 then COMMONLIBDIR=$prefix/lib64 else COMMONLIBDIR=$prefix/lib fi CMPIINCLUDEDIR=$prefix/include/Pegasus/Provider/CMPI OPENDRIMCOMMONINCLUDE=$prefix/include/OpenDRIM fi if test x"$PEGASUS_HOME" != x then COMMONLIBDIR=$PEGASUS_HOME/lib CMPIINCLUDEDIR=$PEGASUS_ROOT/src/Pegasus/Provider/CMPI OPENDRIMCOMMONINCLUDE=$PEGASUS_HOME/include/OpenDRIM fi fi if test "$CIMSERVER" == sfcb then if test x"$prefix" == xNONE then COMMONLIBDIR=$ac_default_prefix/lib CMPIINCLUDEDIR=/usr/include/cmpi OPENDRIMCOMMONINCLUDE=$ac_default_prefix/include/OpenDRIM else COMMONLIBDIR=$prefix/lib CMPIINCLUDEDIR=/usr/include/cmpi OPENDRIMCOMMONINCLUDE=$prefix/include/OpenDRIM fi fi if test "$CIMSERVER" == openwbem then if test x"$prefix" == xNONE then if test "$HW" == X86_64 || test "$HW" == IA64 then COMMONLIBDIR=/usr/lib64 else COMMONLIBDIR=/usr/lib fi CMPIINCLUDEDIR=/usr/local/include/openwbem OPENDRIMCOMMONINCLUDE=/usr/include/OpenDRIM else COMMONLIBDIR=$prefix/lib CMPIINCLUDEDIR=$prefix/include/openwbem OPENDRIMCOMMONINCLUDE=$prefix/include/OpenDRIM fi fi AC_MSG_RESULT(yes) ] ) libopendrim-1.1.3/configure.ac0000644000175000017500000001121411404077256017045 0ustar guillaumeguillaume# Process this file with autoconf to produce a configure script. ################################################################################# # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################# AC_PREREQ(2.59) AC_COPYRIGHT([[############################################################################### Note: This Copyright statement covers the OpenDRIM original parts of this file. It does NOT concern the parts generated by autoconf. Linux Management Providers (LMP), Provider Common Library Copyright (C) 2007 Frederic Desmons, ETRI This program is being developed under the "OpenDRIM" project. The "OpenDRIM" project web page: http://opendrim.sourceforge.net The "OpenDRIM" project mailing list: opendrim@googlegroups.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ###############################################################################]]) AC_INIT(Provider Common Library, -, -) SHOW_COPYRIGHT AC_CONFIG_SRCDIR([Association.h]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([foreign]) AC_CANONICAL_HOST case $host_cpu in i*86) HW=INTEL;; s390*) HW=S390;; ppc*) HW=PPC;; x86_64) HW=X86_64;; ia64) HW=IA64;; **) HW=GENERIC;; esac # Configuration AC_ARG_VAR([STANDARDCMPIHEADERS],[force usage of standard CMPI headers (true|false, default false)]) AC_ARG_VAR([CIMSERVER],[the target CIM server (pegasus|sfcb|openwbem).]) AC_ARG_VAR([OPENDRIMCOMMONINCLUDE],[the directory where OpenDRIM includes are to be installed.]) AC_ARG_VAR([COMMONLIBDIR],[the directory where the package common libraries will be installed.]) # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL # Check for CIM server (defined in acinclude.m4) CHECK_CIMSERVER # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_CONFIG_FILES([Makefile cmpi/Makefile]) CFLAGS="-Wall -Wunused -fPIC $CFLAGS -D_REENTRANT -D$HW -DCMPI_PLATFORM_LINUX_GENERIC_GNU -I./cmpi" CXXFLAGS="-Wall -Wunused -fPIC -fno-rtti -fno-exceptions -U_FORTIFY_SOURCE $CXXFLAGS" CPPFLAGS="$CPPFLAGS -D_REENTRANT -D$HW -DCMPI_PLATFORM_LINUX_GENERIC_GNU -I./cmpi -I/usr/include/libxml2" echo "-------------------------------------------------------" echo "CIMSERVER: " $CIMSERVER echo "OPENDRIMCOMMONINCLUDE: " $OPENDRIMCOMMONINCLUDE echo "COMMONLIBDIR: " $COMMONLIBDIR echo "CFLAGS : " $CFLAGS echo "CXXFLAGS : " $CXXFLAGS echo "CPPFLAGS:" $CPPFLAGS echo "-------------------------------------------------------" AC_OUTPUT echo "You may now run make" libopendrim-1.1.3/TODO0000644000175000017500000000017511404077256015253 0ustar guillaumeguillaumeTODO for 1.1.0 ========================= - Utilities for mapping Value to ValueMap - Function for comparing Datetime values libopendrim-1.1.3/INSTALL0000644000175000017500000000436211404077256015616 0ustar guillaumeguillaume################################################################################# # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################# --------------------------------------------------------- BUILD --------------------------------------------------------- ./configure CIMSERVER= // For seeing the possible options: ./configure --help make --------------------------------------------------------- INSTALLATION --------------------------------------------------------- make install // Complile and copy the libraries to the common library directory --------------------------------------------------------- REMOVAL --------------------------------------------------------- make uninstall // Delete the libraries from the common provider directory --------------------------------------------------------- CLEANUP --------------------------------------------------------- make clean libopendrim-1.1.3/AUTHORS0000644000175000017500000000031111404077256015623 0ustar guillaumeguillaumeFrederic Desmons, ETRI Ilsoo Byun Guillaume BOTTEX, ETRI libopendrim-1.1.3/Indication.h0000644000175000017500000000607211404077256017017 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef INDICATION_H_ #define INDICATION_H_ #include "cmpidt.h" #include "cmpimacs.h" #include "Common.h" using namespace std; // Worker state possible values #define BROKER_NOT_REGISTERED 0x0010 #define BROKER_REGISTERED 0x0001 #define WORKER_STOP 0x0002 #define WORKER_START 0x0004 #define WORKER_END_LIFE 0x0008 // Worker state typedef struct { pthread_mutex_t mutex; int flag; } _workerFlag; typedef struct { pthread_mutex_t mutex; pthread_cond_t cond; } _workerSleep; typedef struct { pthread_mutex_t mutex; CMPISelectExp* filter; bool isSet; } _indicationFilter; // Enable an indication filter void CI_enableFilter(bool& enabled, _workerFlag& workerFlag, _workerSleep& workerSleep); // Disable an indication filter void CI_disableFilter(bool& enabled, _workerFlag& workerFlag); // Add an indication filter int CI_addFilter(const CMPISelectExp* filter, _indicationFilter& indicationFilter, bool enabled, _workerFlag& workerFlag, _workerSleep& workerSleep, string& errorMessage); // Remove an indication filter int CI_removeFilter(const CMPISelectExp* filter, _indicationFilter& indicationFilter, string& errorMessage); // Initialize an indication worker int CI_initWorker(const CMPIBroker* broker, const CMPIContext* ctx, bool& inited, _workerFlag& workerFlag, void* (*worker)(void*), pthread_t& workerID, string& errorMessage); // Finalize an indication worker int CI_finalizeWorker(_workerFlag& workerFlag, _workerSleep& workerSleep, pthread_t workerID, bool& inited, _indicationFilter& indicationFilter, string& errorMessage); #endif /*INDICATION_H_*/ libopendrim-1.1.3/Transtype.h0000644000175000017500000001515311404077256016727 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef TRANSTYPE_H_ #define TRANSTYPE_H_ #include "cmpidt.h" #include "cmpimacs.h" #include "Objectpath.h" // Added 2007/10/29 by Frederic Desmons (desmons_frederic@yahoo.fr) // Gets the string interpretation of a CMPIObjectPath string CT_CMPIObjectPathToString(const CMPIObjectPath* cop); // Added 2007/10/29 by Frederic Desmons (desmons_frederic@yahoo.fr) // Gets the string interpretation of a CMPIArray string CT_CMPIArrayToString(const CMPIArray* array); // Added 2007/10/29 by Frederic Desmons (desmons_frederic@yahoo.fr) // Gets the string interpretation of a CMPIData string CT_CMPIDataToString(const CMPIData& data); //uint8 CMPIValue CT_toCMPI(const unsigned char& value); int CT_ToC(const CMPIData& data, unsigned char& value); //uint16 CMPIValue CT_toCMPI(const unsigned short& value); int CT_ToC(const CMPIData& data, unsigned short& value); //uint32 CMPIValue CT_toCMPI(const unsigned int& value); int CT_ToC(const CMPIData& data, unsigned int& value); //uint32 deprecated CMPIValue CT_toCMPI(const unsigned long& value); int CT_ToC(const CMPIData& data, unsigned long& value); //uint64 CMPIValue CT_toCMPI(const unsigned long long& value); int CT_ToC(const CMPIData& data, unsigned long long& value); //sint8 CMPIValue CT_toCMPI(const signed char& value); int CT_ToC(const CMPIData& data, signed char& value); //sint16 CMPIValue CT_toCMPI(const short& value); int CT_ToC(const CMPIData& data, short& value); //sint32 CMPIValue CT_toCMPI(const int& value); int CT_ToC(const CMPIData& data, int& value); //sint32 deprecated CMPIValue CT_toCMPI(const long& value); int CT_ToC(const CMPIData& data, long& value); //sint64 CMPIValue CT_toCMPI(const long long& value); int CT_ToC(const CMPIData& data, long long& value); //real32 CMPIValue CT_toCMPI(const float& value); int CT_ToC(const CMPIData& data, float& value); //real64 CMPIValue CT_toCMPI(const double& value); int CT_ToC(const CMPIData& data, double& value); //char16 CMPIValue CT_toCMPIChar16(const unsigned short& value); int CT_ToCChar16(const CMPIData& data, unsigned short& value); //boolean CMPIValue CT_toCMPI(const bool& value); int CT_ToC(const CMPIData& data, bool& value); //string CMPIValue CT_toCMPI(const CMPIBroker* broker, const string& value); int CT_ToC(const CMPIData& data, string& value); //datetime CMPIValue CT_toCMPIDatetime(const CMPIBroker* broker, const string& value); int CT_ToCDatetime(const CMPIData& data, string& value); //REF CMPIValue CT_toCMPI(const Objectpath& value); int CT_ToC(const CMPIBroker* broker, const CMPIData& data, Objectpath& value); //uint8[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //uint16[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //uint32[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //uint32[] deprecated CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //uint64[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //sint8[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //sint16[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //sint32[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //sint32[] deprecated CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //sint64[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //real32[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //real64[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //char16[] CMPIValue CT_toCMPIChar16(const CMPIBroker* broker, const vector& value); int CT_ToCChar16(const CMPIData& data, vector& value); //boolean[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //string[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIData& data, vector& value); //datetime[] CMPIValue CT_toCMPIDatetime(const CMPIBroker* broker, const vector& value); int CT_ToCDatetime(const CMPIData& data, vector& value); //REF[] CMPIValue CT_toCMPI(const CMPIBroker* broker, const vector& value); int CT_ToC(const CMPIBroker* broker, const CMPIData& data, vector& value); #endif /*TRANSTYPE_H_*/ libopendrim-1.1.3/packaging/0000755000175000017500000000000011404077256016504 5ustar guillaumeguillaumelibopendrim-1.1.3/packaging/debian/0000755000175000017500000000000011404077256017726 5ustar guillaumeguillaumelibopendrim-1.1.3/packaging/debian/libopendrim0.install0000644000175000017500000000003511404077256023700 0ustar guillaumeguillaumeusr/lib/libopendrim.so.0.0.0 libopendrim-1.1.3/packaging/debian/source/0000755000175000017500000000000011404077256021226 5ustar guillaumeguillaumelibopendrim-1.1.3/packaging/debian/source/format0000644000175000017500000000001411404077256022434 0ustar guillaumeguillaume3.0 (quilt) libopendrim-1.1.3/packaging/debian/libopendrim0-dev.links0000644000175000017500000000006411404077256024130 0ustar guillaumeguillaumeusr/lib/libopendrim.so.0.0.0 usr/lib/libopendrim.so libopendrim-1.1.3/packaging/debian/copyright0000644000175000017500000000316511404077256021666 0ustar guillaumeguillaumeThis package was debianized by Guillaume BOTTEX on Tue, 24 Mar 2009 17:02:09 +0900. It was downloaded from http://sourceforge.net/projects/opendrim/files/ Upstream Authors: Frederic Desmons Ilsoo Byun Guillaume BOTTEX Copyright: Copyright (C) 2007 ETRI Frederic DESMONS Copyright (C) 2007 ETRI Ilsoo BYUN Copyright (C) 2008 ETRI Guillaume BOTTEX License: Linux Management Providers (LMP), Provider Common Library This program is being developed under the "OpenDRIM" project. The "OpenDRIM" project web page: http://opendrim.sourceforge.net The "OpenDRIM" project mailing list: opendrim@googlegroups.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. The Debian packaging is copyright 2009, Guillaume BOTTEX and is licensed under the GPL, see `/usr/share/common-licenses/GPL-2'. libopendrim-1.1.3/packaging/debian/control0000644000175000017500000000167511404077256021342 0ustar guillaumeguillaumeSource: libopendrim Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Guillaume BOTTEX Build-Depends: debhelper (>= 5), automake, autoconf, libtool, libxml2-dev Standards-Version: 3.8.4 Section: libs Homepage: http://opendrim.sourceforge.net/ Package: libopendrim0-dev Section: libdevel Architecture: any Depends: libopendrim0 (= ${binary:Version}), ${misc:Depends} Description: OpenDRIM Provider Common Library - development files This package contains the headers and other development files not included in the main OpenDRIM Provider Common Library package. Install this if you wish to compile your own OpenDRIM providers. Package: libopendrim0 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libxml2, net-tools Description: OpenDRIM Provider Common Library Library providing common functionalities needed by all the OpenDRIM providers. libopendrim-1.1.3/packaging/debian/changelog0000644000175000017500000000112711404077256021601 0ustar guillaumeguillaumelibopendrim (1.1.3-0ubuntu1) lucid; urgency=low * New upstream version * DATASTORE_PATH changed from /var/cache/OpenDRIM to /var/lib/OpenDIRM -- Guillaume BOTTEX Thu, 10 Jun 2010 14:45:00 +0900 libopendrim (1.1.2-0ubuntu1) lucid; urgency=low * New Common Functions added. * Correction of SMBIOS CPU related code. -- Guillaume BOTTEX Tue, 23 Feb 2010 17:30:00 +0900 libopendrim (1.1.1-0ubuntu1) karmic; urgency=low * Initial Release. -- Guillaume BOTTEX Mon, 15 Jun 2009 14:59:30 +0900 libopendrim-1.1.3/packaging/debian/libopendrim0.dirs0000644000175000017500000000011311404077256023170 0ustar guillaumeguillaumevar/lib/OpenDRIM var/lib/OpenDRIM/root/cimv2 var/lib/OpenDRIM/root/interop libopendrim-1.1.3/packaging/debian/rules0000755000175000017500000000435311404077256021013 0ustar guillaumeguillaume#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 CONFIGURE_OPTIONS := CIMSERVER=sfcb --prefix=/usr DESTDIR=$(CURDIR)/debian/tmp # shared library versions, option 1 # version=2.0.5 # major=2 # option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so #version=`ls src/.libs/lib*.so.* | \ # awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` #major=`ls src/.libs/lib*.so.* | \ # awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. autoreconf -i --force ./configure $(CONFIGURE_OPTIONS) touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. $(MAKE) touch $@ clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) clean dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/tmp $(MAKE) DESTDIR=$(DESTDIR) install # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs dh_installdocs dh_installexamples dh_install --sourcedir=$(DESTDIR) # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_installinit # dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_python dh_makeshlibs -plibopendrim0 dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure libopendrim-1.1.3/packaging/debian/libopendrim0.links0000644000175000017500000000006611404077256023356 0ustar guillaumeguillaumeusr/lib/libopendrim.so.0.0.0 usr/lib/libopendrim.so.0 libopendrim-1.1.3/packaging/debian/docs0000644000175000017500000000002111404077256020572 0ustar guillaumeguillaumeNEWS README TODO libopendrim-1.1.3/packaging/debian/libopendrim0-dev.install0000644000175000017500000000014011404077256024451 0ustar guillaumeguillaumeusr/include/OpenDRIM/* usr/include/OpenDRIM/cmpi/* usr/lib/libopendrim.a usr/lib/libopendrim.la libopendrim-1.1.3/packaging/debian/compat0000644000175000017500000000000211404077256021124 0ustar guillaumeguillaume5 libopendrim-1.1.3/packaging/libopendrim.spec0000644000175000017500000000656111404077256021674 0ustar guillaumeguillaume################################################################################# # Note: This Copyright statement covers the OpenDRIM original parts of this file. # It does NOT concern the parts generated by automake. # # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2008 Guillaume BOTTEX, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################# %define packageVersion 1 Version: %{version} Release: %{packageVersion}%{?dist} Vendor: OpenDRIM Summary: OpenDRIM Providers Common Library Name: libopendrim Group: Systems Management/Base License: GPL BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://opendrim.sourceforge.net Source: %{name}-%{version}.tar.gz BuildRequires: autoconf, tog-pegasus-devel, libxml2-devel Requires: tog-pegasus, libxml2, coreutils, net-tools, awk, util-linux Provides: libopendrim-smbios %description %global PEGASUS_ARCH_LIB %{_lib} %global COMMONLIBDIR $RPM_BUILD_ROOT/usr/%PEGASUS_ARCH_LIB %global OPENDRIMCOMMONINCLUDE $RPM_BUILD_ROOT/usr/include/OpenDRIM %prep %setup -q -n %{name}-%{version} %build autoreconf --install --force ./configure CIMSERVER=pegasus make %install #make install COMMONLIBDIR=$RPM_BUILD_ROOT/%PEGASUS_ARCH_LIB/ OPENDRIMCOMMONINCLUDE=$RPM_BUILD_ROOT/include/OpenDRIM %{__rm} -rf %{buildroot} %{__install} -d %OPENDRIMCOMMONINCLUDE/cmpi $RPM_BUILD_ROOT/var/lib/OpenDRIM %{__install} -m 644 Association.h CMPIBroking.h Common.h Datastore.h Indication.h Instance.h Objectpath.h Transtype.h EmbeddedInstance.h net_dev.h SMBIOS.h %OPENDRIMCOMMONINCLUDE %{__install} -m 644 cmpi/* %OPENDRIMCOMMONINCLUDE/cmpi/ %{__install} -Dp -m 755 -s .libs/libopendrim.so %COMMONLIBDIR/libopendrim.so %clean [ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT; [ "${RPM_BUILD_DIR}" != "/" ] && %{__rm} -rf ${RPM_BUILD_DIR}/%{name}-%{version}; %files %defattr(-, root, root, 755) %attr(755,root,pegasus) /usr/%PEGASUS_ARCH_LIB/libopendrim.so %dir /var/lib/OpenDRIM %dir /usr/include/OpenDRIM %dir /usr/include/OpenDRIM/cmpi %attr(644,root,root) /usr/include/OpenDRIM/*.h %attr(644,root,root) /usr/include/OpenDRIM/cmpi/* libopendrim-1.1.3/CMPIBroking.h0000644000175000017500000000467011404077256017004 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef CMPIBROKING_H_ #define CMPIBROKING_H_ #include "Instance.h" using namespace std; // CMPI broker utility, enumerate the objectpaths of the instances of the given CIM class (classname parameter) int CB_enumerateInstanceNames(const CMPIBroker* broker, const CMPIContext* ctx, const string& nameSpace, const string& classname, vector& objectpaths, string& errorMessage); // CMPI broker utility, enumerate the instances of the given CIM class (classname parameter) int CB_enumerateInstances(const CMPIBroker* broker, const CMPIContext* ctx, const string& nameSpace, const string& classname, const char** properties, vector& instances, string& errorMessage); // CMPI broker utility, get the instance corresponding to the given Objectpath (op parameter) int CB_getInstance(const CMPIBroker* broker, const CMPIContext* ctx, const Objectpath& op, const char** properties, Instance& instance, string& errorMessage); #endif /*CMPIBROKING_H_*/ libopendrim-1.1.3/Association.cpp0000644000175000017500000002072011404077256017541 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #include "Association.h" // Deprecated by Frederic Desmons, ETRI (2007/05/22) int CA_resolveDirection(const CMPIBroker* broker, const string& refLeftClass, const string& refRightClass, const string& known, const string& unknown, Objectpath& left, Objectpath& right, const Objectpath& Known, int& direction, string& errorMessage) { string _unknown = unknown; string knownClass = Known.getClassname(); if (!CF_strCmpNoCase(knownClass, refLeftClass) && !CF_strCmpNoCase(knownClass, refRightClass)) return -1; if (CF_strCmpNoCase(known, refLeftClass)) { if (CF_strCmpNoCase(_unknown, "Null")) _unknown = refRightClass; if (!CF_strCmpNoCase(_unknown, refRightClass)) return -1; left = Known; right = Objectpath(broker, _unknown, left.getNamespace()); direction = 1; } else { if (CF_strCmpNoCase(known, refRightClass)) { if (CF_strCmpNoCase(_unknown, "Null")) _unknown = refLeftClass; if (!CF_strCmpNoCase(_unknown, refLeftClass)) return -1; right = Known; left = Objectpath(broker, _unknown, right.getNamespace()); direction = 0; } } return OK; } // Deprecated by Frederic Desmons, ETRI (2007/05/22) int CA_associatorFilter(const CMPIBroker* broker, const CMPIContext* ctx, const string& assocClass, const string& resultClass, const string& classname, const string refLeftClass, const string& refRightClass, const string& refLeft, const string& refRight, const string& role, const string& resultRole, Objectpath& left, Objectpath& right, const Objectpath& Known, int& direction, string& errorMessage) { if (!CF_strCmpNoCase(assocClass, classname)) { errorMessage = "Wrong assosClass parameter: " + assocClass; return INVALID_PARAMETER; } int errorCode = CA_resolveDirection(broker, refLeftClass, refRightClass, ((Objectpath&) Known).getClassname(), resultClass, left, right, Known, direction, errorMessage); if (errorCode != OK) return errorCode; if ((direction==1 && ((!CF_strCmpNoCase(role, "Null") && !CF_strCmpNoCase(role, refLeft)) || (!CF_strCmpNoCase(resultRole, "Null") && !CF_strCmpNoCase(resultRole, refRight)))) || (direction==0 && ((!CF_strCmpNoCase(role, "Null") && !CF_strCmpNoCase(role, refRight)) || (!CF_strCmpNoCase(resultRole, "Null") && !CF_strCmpNoCase(resultRole, refLeft))))) return -1; /*Instance instance; const char** _properties = NULL; errorCode = CB_getInstance(broker, ctx, Known, _properties, instance, errorMessage); if (errorCode != OK) return errorCode;*/ return OK; } // Deprecated by Frederic Desmons, ETRI (2007/05/22) int CA_referenceFilter(const CMPIBroker* broker, const CMPIContext* ctx, const string& assocClass, const string& classname, const string& refLeftClass, const string& refRightClass, const string& refLeft, const string& refRight, const string& role, Objectpath& left, Objectpath& right, const Objectpath& Known, int& direction, string& errorMessage) { if (!CF_strCmpNoCase(assocClass, classname)) { errorMessage = "Wrong assosClass parameter: " + assocClass; return INVALID_PARAMETER; } if (CF_strCmpNoCase(((Objectpath&) Known).getClassname(), refLeftClass)) { direction = 1; left = Known; } else { if (CF_strCmpNoCase(((Objectpath&) Known).getClassname(), refRightClass)) { direction = 0; right = Known; } else return -1; } if ((direction==1 && (!CF_strCmpNoCase(role, "Null") && !CF_strCmpNoCase(role, refLeft))) || (direction==0 && (!CF_strCmpNoCase(role, "Null") && !CF_strCmpNoCase(role, refRight)))) return -1; /*Instance instance; const char** _properties = NULL; int errorCode = CB_getInstance(broker, ctx, Known, _properties, instance, errorMessage); if (errorCode != OK) return errorCode;*/ return OK; } // Added by Frederic Desmons, ETRI (2007/05/22) int CA_associatorResolveDirection(const char* leftClasses[], const char* rightClasses[], const string& leftNamespace, const string& rightNamespace, const string& leftRole, const string& rightRole, const Objectpath& known, const string& resultClass, const string& role, const string& resultRole, bool& leftToRight) { string knownClass = known.getClassname(); string knownNamespace = known.getNamespace(); string _resultClass = resultClass; if (CF_strCmpNoCase(knownClass, leftClasses[0])) { if (!CF_strCmpNoCase(knownNamespace, "") && !CF_strCmpNoCase(knownNamespace, leftNamespace)) return -1; if (!CF_strCmpNoCase(role, "null") && !CF_strCmpNoCase(role, leftRole)) return -1; if (!CF_strCmpNoCase(resultRole, "null") && !CF_strCmpNoCase(resultRole, rightRole)) return -1; for (unsigned int i=0; i # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #include "net_dev.h" static const char hexval[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; char *trim(char *str); struct net_proc parse(char* line, int len); void fill_net_proc(struct net_proc* target, char* line); char *trim(char *str) { char *ibuf = str, *obuf = str; int i = 0, cnt = 0; if (str) { for (ibuf = str; *ibuf && isspace(*ibuf); ++ibuf) ; if (str != ibuf) memmove(str, ibuf, ibuf - str); while (*ibuf) { if (isspace(*ibuf) && cnt) ibuf++; else { if (!isspace(*ibuf)) cnt = 0; else { *ibuf = ' '; cnt = 1; } obuf[i++] = *ibuf++; } } obuf[i] = (char) NULL; while (--i >= 0) { if (!isspace(obuf[i])) break; } obuf[++i] = (char) NULL; } return str; } int CN_getNetDevices(struct net_proc** result) { *result = (struct net_proc*) malloc(sizeof(struct net_proc)*100); struct net_proc* current = *result; const char* filename = "/proc/net/dev"; FILE* ifp; ifp = fopen(filename, "r"); if (ifp == NULL) { fprintf(stderr, "can't open %s\n", filename); return -1; } char* line = NULL; ssize_t readed = 0; size_t len = 0; unsigned int count = 0; while((readed = getline(&line, &len, ifp)) > 0) { if ((count++) < 2) continue; *current = parse(line, readed); ++current; } current = NULL; if (line) free(line); fclose(ifp); return count > 1 ? count-2 : 0; } void CN_releaseNetDevices(struct net_proc** result, int count) { int i = 0; for (; i < count; ++i) { struct net_proc device = (*result)[i]; if (device.name) free((void *) device.name); } free(*result); } struct net_proc parse(char* line, int len) { char* token = NULL; char* saveptr; int col_num = 0; struct net_proc result; while((token = strtok_r(line, ":", &saveptr)) != NULL) { switch (col_num) { case 0: result.name = strdup(trim(token)); break; case 1: fill_net_proc(&result, token); break; } line = NULL; ++col_num; } return result; } void fill_net_proc(struct net_proc* target, char* line) { char* token = NULL; char* saveptr; int col_num = 0; while((token = strtok_r(line, " ", &saveptr)) != NULL) { switch (col_num) { case 0: target->rx = atoi(token); break; case 8: target->tx = atoi(token); break; } line = NULL; ++col_num; } } const char* CN_getMacAddress(const char* name) { int fd; struct ifreq ifr; fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL)); if (fd < 0) { fprintf(stderr, "socket(2) failed: %s\n", strerror(errno)); return NULL; } strcpy(ifr.ifr_name, "eth0"); if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { fprintf(stderr, "ioctl(2) failed: %s\n", strerror(errno)); close(fd); return NULL; } char* result = (char *) malloc(sizeof(char)*18); //memset(result, (int) NULL, sizeof(char)*16); char *hwaddr; hwaddr = ifr.ifr_hwaddr.sa_data; int i = 0; int first_char_idx = 0; for (;i < 6; ++i) { result[first_char_idx] = hexval[(hwaddr[i] >> 4) & 0x0F]; result[first_char_idx+1] = hexval[hwaddr[i] & 0x0F]; if (i != 5) result[first_char_idx+2] = ':'; first_char_idx += 3; } if (i == 6) result[first_char_idx-1] = (char) NULL; close(fd); return result; } const char* CN_getIP(const char* name) { int fd; struct ifreq ifr; struct sockaddr_in *aptr; fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { fprintf(stderr, "socket(2) failed: %s\n", strerror(errno)); return NULL; } strncpy(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) { fprintf(stderr, "ioctl(2) failed: %s\n", strerror(errno)); close(fd); return NULL; } char* address = (char *) malloc(sizeof(char)*ADDR_MAX); aptr = (struct sockaddr_in *)&ifr.ifr_addr; inet_ntop(AF_INET, &aptr->sin_addr, address, ADDR_MAX); close(fd); return address; } const char* CN_getNetMask(const char* name) { int fd; struct ifreq ifr; struct sockaddr_in *aptr; fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { fprintf(stderr, "socket(2) failed: %s\n", strerror(errno)); return NULL; } strncpy(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFNETMASK, &ifr) < 0) { fprintf(stderr, "ioctl(2) failed: %s\n", strerror(errno)); close(fd); return NULL; } char* address = (char *) malloc(sizeof(char)*ADDR_MAX); aptr = (struct sockaddr_in *)&ifr.ifr_netmask; inet_ntop(AF_INET, &aptr->sin_addr, address, ADDR_MAX); close(fd); return address; } const char* CN_getBroadcastAddress(const char* name) { int fd; struct ifreq ifr; struct sockaddr_in *aptr; fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { fprintf(stderr, "socket(2) failed: %s\n", strerror(errno)); return NULL; } strncpy(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFBRDADDR, &ifr) < 0) { fprintf(stderr, "ioctl(2) failed: %s\n", strerror(errno)); close(fd); return NULL; } char* address = (char *) malloc(sizeof(char)*ADDR_MAX); aptr = (struct sockaddr_in *)&ifr.ifr_broadaddr; inet_ntop(AF_INET, &aptr->sin_addr, address, ADDR_MAX); close(fd); return address; } libopendrim-1.1.3/COPYING0000644000175000017500000004310311404077256015614 0ustar guillaumeguillaume GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. libopendrim-1.1.3/Indication.cpp0000644000175000017500000001406511404077256017353 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #include "Indication.h" void CI_enableFilter(bool& enabled, _workerFlag& workerFlag, _workerSleep& workerSleep) { if (!enabled) { pthread_mutex_lock(&workerFlag.mutex); // Worker sleeps because the indication is disabled. // Wake up! if ((workerFlag.flag & WORKER_STOP) == WORKER_STOP) { workerFlag.flag = workerFlag.flag & !WORKER_STOP | WORKER_START; pthread_mutex_lock(&workerSleep.mutex); pthread_cond_signal(&workerSleep.cond); pthread_mutex_unlock(&workerSleep.mutex); } pthread_mutex_unlock(&workerFlag.mutex); } enabled=true; } // Indication utility, disable an indication filter void CI_disableFilter(bool& enabled, _workerFlag& workerFlag) { if (enabled) { pthread_mutex_lock(&workerFlag.mutex); // Worker is awake, we're gonna put it to sleep if ((workerFlag.flag & WORKER_START) == WORKER_START) { workerFlag.flag = workerFlag.flag & !WORKER_START | WORKER_STOP; } pthread_mutex_unlock(&workerFlag.mutex); } enabled=false; } int CI_addFilter(const CMPISelectExp* filter, _indicationFilter& indicationFilter, bool enabled, _workerFlag& workerFlag, _workerSleep& workerSleep, string& errorMessage) { if (filter == NULL){ errorMessage+="Filter argument is null!"; return FAILED; } pthread_mutex_lock(&indicationFilter.mutex); if (indicationFilter.isSet) { errorMessage+="Duplicated indication filter found!"; return FAILED; } indicationFilter.isSet=true; CMPIStatus rc; if (filter!=NULL) { indicationFilter.filter=CMClone(filter, &rc); if (rc.rc==CMPI_RC_ERR_NOT_SUPPORTED) { errorMessage+="Cloning of filters is not supported!"; indicationFilter.filter=(CMPISelectExp*) filter; } else if (rc.rc==CMPI_RC_ERR_FAILED) { errorMessage+="Cloning of filter failed!"; return FAILED; } } pthread_mutex_unlock(&indicationFilter.mutex); // The filter was not set, assume the worker was sleeping, so we awake it. // In the case the worker is stopped because the indication is disabled, we skip this pthread_mutex_lock(&workerFlag.mutex); if (enabled) { pthread_mutex_lock(&workerSleep.mutex); pthread_cond_signal(&workerSleep.cond); pthread_mutex_unlock(&workerSleep.mutex); } pthread_mutex_unlock(&workerFlag.mutex); return OK; } int CI_removeFilter(const CMPISelectExp* filter, _indicationFilter& indicationFilter, string& errorMessage) { if (filter == NULL){ errorMessage+="Filter argument is null!"; return FAILED; } pthread_mutex_lock(&indicationFilter.mutex); if (!indicationFilter.isSet) { errorMessage+="Filter was not registered!"; return FAILED; } // Just mark the filter as unset indicationFilter.isSet=false; pthread_mutex_unlock(&indicationFilter.mutex); return OK; } int CI_initWorker(const CMPIBroker* broker, const CMPIContext* ctx, bool& inited, _workerFlag& workerFlag, void* (*worker)(void*), pthread_t& workerID, string& errorMessage) { if (broker == NULL) { errorMessage+="CMPI broker is NULL!"; return FAILED; } CMPIContext* context = CBPrepareAttachThread (broker, ctx); if (context == NULL) { errorMessage+="CMPI context is NULL!"; return FAILED; } if (inited) return OK; pthread_mutex_lock(&workerFlag.mutex); if ((workerFlag.flag & BROKER_REGISTERED) == BROKER_REGISTERED) { errorMessage+="Attempt to register the broker twice!"; pthread_mutex_unlock(&workerFlag.mutex); return FAILED; } workerFlag.flag = BROKER_REGISTERED | WORKER_STOP; pthread_mutex_unlock(&workerFlag.mutex); void** threadData=(void**) malloc(sizeof(CMPIBroker*)+sizeof(CMPIContext*)); threadData[0]=(CMPIBroker*) broker; threadData[1]=(CMPIContext*) context; workerID=0; pthread_create(&workerID, NULL, worker, threadData); inited=true; return OK; } int CI_finalizeWorker(_workerFlag& workerFlag, _workerSleep& workerSleep, pthread_t workerID, bool& inited, _indicationFilter& indicationFilter, string& errorMessage) { pthread_mutex_lock(&workerFlag.mutex); if ((workerFlag.flag & BROKER_NOT_REGISTERED) == BROKER_NOT_REGISTERED) { errorMessage+="Broker was not registered!"; pthread_mutex_unlock(&workerFlag.mutex); return FAILED; } pthread_mutex_lock(&indicationFilter.mutex); if (indicationFilter.isSet) { errorMessage+="At least on filter is still registered, will not shutdown!"; pthread_mutex_unlock(&indicationFilter.mutex); pthread_mutex_unlock(&workerFlag.mutex); return DO_NOT_UNLOAD; } workerFlag.flag = BROKER_NOT_REGISTERED | WORKER_END_LIFE; pthread_mutex_unlock(&indicationFilter.mutex); pthread_mutex_unlock(&workerFlag.mutex); pthread_cond_signal(&workerSleep.cond); // Join the worker pthread_join(workerID, NULL); inited=false; return OK; } libopendrim-1.1.3/SMBIOS.cpp0000644000175000017500000005353011404077256016266 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2008 Guillaume BOTTEX, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #include "SMBIOS.h" string SMBIOS_cacheInformationToString(const _cache_information& cache_information, const string& identation) { _E_; string cache_information_string; cache_information_string += identation + "handle: " + CF_intToStr(cache_information.handle) + "\n"; cache_information_string += identation + "operational_mode: " + CF_intToStr(cache_information.operational_mode) + "\n"; cache_information_string += identation + "enabled: " + CF_boolToStr(cache_information.enabled) + "\n"; cache_information_string += identation + "cache_level: " + CF_intToStr(cache_information.cache_level) + "\n"; cache_information_string += identation + "granularity: " + CF_intToStr(cache_information.granularity) + "\n"; cache_information_string += identation + "installed_size: " + CF_intToStr(cache_information.installed_size) + "\n"; cache_information_string += identation + "system_cache_type: " + CF_intToStr(cache_information.system_cache_type) + "\n"; cache_information_string += identation + "associativity: " + CF_intToStr(cache_information.associativity) + "\n"; _L_; return cache_information_string; } string SMBIOS_processorInformationToString(const _processor_information& processor_information, const string& identation) { _E_; string processor_information_string; processor_information_string += identation + "processor_type: " + CF_intToStr(processor_information.processor_type) + "\n"; processor_information_string += identation + "processor_family: " + CF_intToStr(processor_information.processor_family) + "\n"; processor_information_string += identation + "has_voltage: " + CF_boolToStr(processor_information.has_voltage) + "\n"; processor_information_string += identation + "voltage: " + CF_intToStr(processor_information.voltage) + "\n"; processor_information_string += identation + "external_clock: " + CF_intToStr(processor_information.external_clock) + "\n"; processor_information_string += identation + "max_speed: " + CF_intToStr(processor_information.max_speed) + "\n"; processor_information_string += identation + "status: " + CF_intToStr(processor_information.status) + "\n"; processor_information_string += identation + "processor_upgrade: " + CF_intToStr(processor_information.processor_upgrade) + "\n"; processor_information_string += identation + "core_enabled: " + CF_intToStr(processor_information.core_enabled) + "\n"; processor_information_string += identation + "processor_characteristics: "; for (unsigned int i = 0; i < processor_information.processor_characteristics.size(); i++) processor_information_string += CF_intToStr(processor_information.processor_characteristics[i])+ ";"; processor_information_string += "\n"; processor_information_string += identation + "has_l1_cache: " + CF_boolToStr(processor_information.has_l1_cache) + "\n"; processor_information_string += identation + "l1_cache_handle: " + CF_intToStr(processor_information.l1_cache_handle) + "\n"; if (processor_information.has_l1_cache) processor_information_string += SMBIOS_cacheInformationToString(processor_information.l1_cache, identation + " "); processor_information_string += identation + "has_l2_cache: " + CF_boolToStr(processor_information.has_l2_cache) + "\n"; processor_information_string += identation + "l2_cache_handle: " + CF_intToStr(processor_information.l2_cache_handle) + "\n"; if (processor_information.has_l2_cache) processor_information_string += SMBIOS_cacheInformationToString(processor_information.l2_cache, identation + " "); processor_information_string += identation + "has_l3_cache: " + CF_boolToStr(processor_information.has_l3_cache) + "\n"; processor_information_string += identation + "l3_cache_handle: " + CF_intToStr(processor_information.l3_cache_handle) + "\n"; if (processor_information.has_l3_cache) processor_information_string += SMBIOS_cacheInformationToString(processor_information.l3_cache, identation + " "); _L_; return processor_information_string; } void SMBIOS_cacheInformationToDefault(_cache_information& cache_information) { _E_; cache_information.handle = 0; cache_information.operational_mode = 0; // Unknown cache_information.enabled = false; cache_information.cache_level = 0; // Unknown cache_information.granularity = 0; cache_information.installed_size = 0; cache_information.system_cache_type = 0; // Unknown cache_information.associativity = 0; // Unknown _L_; } void SMBIOS_processorInformationToDefault(_processor_information& processor_information) { _E_; processor_information.processor_characteristics.clear(); processor_information.has_l1_cache = false; processor_information.has_l2_cache = false; processor_information.has_l3_cache = false; processor_information.core_enabled = 0; _L_; } int SMBIOS_findEntryPoint(int& dev_mem, void** ptrptr, _smbios_anchor** smbios_anchor_ptrptr, string& errorMessage) { _E_; // try to open the system memory (read-only) dev_mem = open("/dev/mem", O_RDONLY); // we cannot open the file, exit if (dev_mem < 0) { errorMessage = "Cannot open file: /dev/mem"; return FAILED; } // look for smbios anchor // the anchor is located between 0x000f0000 and 0x000fffff in system memory *ptrptr = mmap(NULL, _SMBIOS_ANCHOR_SEARCH_RANGE, PROT_READ, MAP_SHARED, dev_mem, _SMBIOS_ANCHOR_SEARCH_OFFSET); if (*ptrptr == MAP_FAILED) { errorMessage = "Cannot map system BIOS memory"; close(dev_mem); return FAILED; } for ((*smbios_anchor_ptrptr) = (_smbios_anchor*) *ptrptr; (unsigned long) (*smbios_anchor_ptrptr) < ((unsigned long) *ptrptr + (unsigned long) _SMBIOS_ANCHOR_SEARCH_RANGE);) { // look for the sequence "_SM_" if (memcmp("_SM_", (*smbios_anchor_ptrptr)->anchor_string, 4) == 0) { return OK; } // skip 16 bytes (anchor string is aligned on 16 bytes paragraph boundaries) *smbios_anchor_ptrptr+=4; } errorMessage = "Failed to locate SMBIOS information in mermory"; _L_; return FAILED; } char* SMBIOS_nextSMBIOSStructureHeader(char* ptr, _string_map *string_map_ptr) { _E_; char* base = ptr + ((_smbios_structure_header*) ptr)->length; memset(string_map_ptr, 0, sizeof(_string_map)); string_map_ptr->string[0]="unknown"; if (base[0]==0 && base[1]==0) return base + 2; for (unsigned int i = 1; *base != 0 && i < 256; i++) { string_map_ptr->string[i] = base; base += strlen(base) + 1; } _L_; return base + 1; } int SMBIOS_getProcessorsInformation(vector<_processor_information>& processors_information, string& errorMessage) { _E_; void* ptr = NULL; int dev_mem; _smbios_anchor* smbios_anchor = NULL; // look for the SMBIOS entry point CF_assert(SMBIOS_findEntryPoint(dev_mem, &ptr, &smbios_anchor, errorMessage)); _smbios_entry_point* smbios_entry_point_ptr = (_smbios_entry_point*) smbios_anchor; unsigned smbios_off; // align to memory pages size_t page_size = getpagesize(); if (page_size != 0 && smbios_entry_point_ptr->structure_table_address%page_size != 0) smbios_off = smbios_entry_point_ptr->structure_table_address/page_size * page_size; else smbios_off = smbios_entry_point_ptr->structure_table_address; // map the SMBIOS memory (page aligned) void* smbios_ptr = mmap(NULL, smbios_entry_point_ptr->structure_table_address + smbios_entry_point_ptr->structure_table_length - smbios_off, PROT_READ, MAP_SHARED, dev_mem, smbios_off); if (smbios_ptr == MAP_FAILED) { errorMessage = "Cannot map SMBIOS memory"; close(dev_mem); return FAILED; } // text strings _string_map string_map; // pointer to the first SMBIOS structure char* char_ptr = (char*) (smbios_entry_point_ptr->structure_table_address - smbios_off + (unsigned long) smbios_ptr); // recover the processor and cache information first unsigned short number_of_smbios_structure = smbios_entry_point_ptr->number_of_smbios_structure; vector<_cache_information> caches_information; while (number_of_smbios_structure > 0 && char_ptr) { char* next_ptr = SMBIOS_nextSMBIOSStructureHeader(char_ptr, &string_map); // processor if (((_smbios_structure_header*) char_ptr)->type == _PROCESSOR_INFORMATION) { _processor_information processor_information; SMBIOS_processorInformationToDefault(processor_information); // Processor Type processor_information.processor_type = (unsigned char) char_ptr[0x5]; // Processor Family processor_information.processor_family = (unsigned char) char_ptr[0x6]; // Voltage unsigned char temp = char_ptr[0x11]; if (temp & 0x80) { // real time voltage processor_information.voltage = (temp & 0x7f)*100; processor_information.has_voltage = true; } else { // we are not interested in the voltage capabilities... processor_information.has_voltage = false; } // External Clock processor_information.external_clock = ((unsigned char) char_ptr[0x12]) + (((unsigned char) char_ptr[0x13]) << 8); // Max Speed processor_information.max_speed = ((unsigned char) char_ptr[0x14]) + (((unsigned char) char_ptr[0x15]) << 8); // Current Speed processor_information.current_speed = ((unsigned char) char_ptr[0x16]) + (((unsigned char) char_ptr[0x17]) << 8); // Status temp = char_ptr[0x18]; processor_information.status = (temp & 0x7); // Processor Upgrade processor_information.processor_upgrade = (unsigned char) char_ptr[0x19]; // Core Enabled if (((_smbios_structure_header*) char_ptr)->length >= 0x25) processor_information.core_enabled = (unsigned char) char_ptr[0x24]; else processor_information.core_enabled = 0; // Processor Charateristics if (((_smbios_structure_header*) char_ptr)->length >= 0x28) { temp = char_ptr[0x27]; if (temp & 0x2) processor_information.processor_characteristics.push_back(1); if (temp & 0x4) processor_information.processor_characteristics.push_back(2); if (temp & 0x8) processor_information.processor_characteristics.push_back(3); if (temp & 0x10) processor_information.processor_characteristics.push_back(4); if (temp & 0x20) processor_information.processor_characteristics.push_back(5); if (temp & 0x40) processor_information.processor_characteristics.push_back(6); if (temp & 0x80) processor_information.processor_characteristics.push_back(7); temp = char_ptr[0x26]; if (temp & 0x1) processor_information.processor_characteristics.push_back(8); if (temp & 0x2) processor_information.processor_characteristics.push_back(9); if (temp & 0x4) processor_information.processor_characteristics.push_back(10); if (temp & 0x8) processor_information.processor_characteristics.push_back(11); if (temp & 0x10) processor_information.processor_characteristics.push_back(12); if (temp & 0x20) processor_information.processor_characteristics.push_back(13); if (temp & 0x40) processor_information.processor_characteristics.push_back(14); if (temp & 0x80) processor_information.processor_characteristics.push_back(15); } // L1 Cache Handle if (((_smbios_structure_header*) char_ptr)->length >= 0x1c) { processor_information.l1_cache_handle = ((unsigned char) char_ptr[0x1a]) + (((unsigned char) char_ptr[0x1b]) << 8); processor_information.has_l1_cache = true; // no cache or no information about the cache memory if (processor_information.l1_cache_handle == 0x0ffff) processor_information.has_l1_cache = false; } // L2 Cache Handle if (((_smbios_structure_header*) char_ptr)->length >= 0x1e) { processor_information.l2_cache_handle = ((unsigned char) char_ptr[0x1c]) + (((unsigned char) char_ptr[0x1d]) << 8); processor_information.has_l2_cache = true; // no cache or no information about the cache memory if (processor_information.l2_cache_handle == 0x0ffff) processor_information.has_l2_cache = false; } // L3 Cache Handle if (((_smbios_structure_header*) char_ptr)->length >= 0x20) { processor_information.l3_cache_handle = ((unsigned char) char_ptr[0x1e]) + (((unsigned char) char_ptr[0x1f]) << 8); processor_information.has_l3_cache = true; // no cache or no information about the cache memory if (processor_information.l3_cache_handle == 0x0ffff) processor_information.has_l3_cache = false; } processors_information.push_back(processor_information); } // cache if (((_smbios_structure_header*) char_ptr)->type == _CACHE_INFORMATION) { _cache_information cache_information; SMBIOS_cacheInformationToDefault(cache_information); // Handle cache_information.handle = ((unsigned char) char_ptr[0x2]) + (((unsigned char) char_ptr[0x3]) << 8); // Cache Configuration unsigned char temp = char_ptr[0x5]; switch(temp & 0x3) { case 0: cache_information.operational_mode = 3; break; case 1: cache_information.operational_mode = 2; break; case 2: cache_information.operational_mode = 4; break; case 3: cache_information.operational_mode = 0; break; } cache_information.enabled = false; temp = char_ptr[0x6]; if (temp & 0x80) cache_information.enabled = true; cache_information.cache_level = (temp & 0x7); cache_information.cache_level+=3; // Installed Size temp = char_ptr[0x9]; if (temp & 0x80) cache_information.granularity = 64*1024; else cache_information.granularity = 1024; cache_information.installed_size = (temp & 0x78) + (((unsigned char) char_ptr[0xa]) << 8); // System Cache Type if (((_smbios_structure_header*) char_ptr)->length >= 0x12) { if((unsigned char) char_ptr[0x11] ==0x1) cache_information.system_cache_type = 1; else if((unsigned char) char_ptr[0x11] == 0x2) cache_information.system_cache_type = 0; else cache_information.system_cache_type = (unsigned char) char_ptr[0x11]-1; } // Associativity if (((_smbios_structure_header*) char_ptr)->length >= 0x13) { if((unsigned char) char_ptr[0x12]==0x1) cache_information.associativity = 1; else if((unsigned char) char_ptr[0x12]==0x2) cache_information.associativity = 0; else cache_information.associativity = (unsigned char) char_ptr[0x12]-1; } caches_information.push_back(cache_information); } number_of_smbios_structure--; char_ptr = next_ptr; } // unmap the memory if (smbios_ptr) munmap(smbios_ptr, smbios_entry_point_ptr->structure_table_address + smbios_entry_point_ptr->structure_table_length - smbios_off); if (ptr) munmap(ptr, _SMBIOS_ANCHOR_SEARCH_RANGE); // close the memory file if (dev_mem>0) close(dev_mem); // map caches to processors... for (unsigned int i = 0; i < processors_information.size(); i++) { bool got_l1 = !(processors_information[i].has_l1_cache); bool got_l2 = !(processors_information[i].has_l2_cache); bool got_l3 = !(processors_information[i].has_l3_cache); for (unsigned int j = 0; j < caches_information.size(); j++) { if (!got_l1 && caches_information[j].handle == processors_information[i].l1_cache_handle) { processors_information[i].l1_cache = caches_information[j]; // this means the cache doesn't exist if (caches_information[j].installed_size == 0) processors_information[i].has_l1_cache = false; got_l1 = true; } if (!got_l2 && caches_information[j].handle == processors_information[i].l2_cache_handle) { processors_information[i].l2_cache = caches_information[j]; // this means the cache doesn't exist if (caches_information[j].installed_size == 0) processors_information[i].has_l2_cache = false; got_l2 = true; } if (!got_l3 && caches_information[j].handle == processors_information[i].l3_cache_handle) { processors_information[i].l3_cache = caches_information[j]; // this means the cache doesn't exist if (caches_information[j].installed_size == 0) processors_information[i].has_l3_cache = false; got_l3 = true; } if (got_l1 && got_l2 && got_l3) break; } // we didn't find the information about the cache so we'll set it to default if (!got_l1) SMBIOS_cacheInformationToDefault(processors_information[i].l1_cache); if (!got_l2) SMBIOS_cacheInformationToDefault(processors_information[i].l2_cache); if (!got_l3) SMBIOS_cacheInformationToDefault(processors_information[i].l3_cache); } _L_; return OK; } void *SMBIOS_getRawData(size_t base, size_t len, string& errorMessage) { int fd; // File descriptor void *p; // Pointer to return void *mmp; // Memory Map pointer size_t mmoffset; p=NULL; if((fd=open(DEV_MEM, O_RDONLY))==-1) { errorMessage = DEV_MEM; errorMessage+= ": "; errorMessage+= strerror(errno); return NULL; } if((p=malloc(len))==NULL) { errorMessage = "malloc: "; errorMessage+= strerror(errno); return NULL; } #ifdef _SC_PAGESIZE mmoffset=base%sysconf(_SC_PAGESIZE); #else mmoffset=base%getpagesize(); #endif /* _SC_PAGESIZE */ mmp=mmap(NULL, mmoffset+len, PROT_READ, MAP_SHARED, fd, base-mmoffset); if(mmp==MAP_FAILED) { errorMessage = "mmap: "; errorMessage+= strerror(errno); close(fd); return NULL; } memcpy(p, (u8 *)mmp+mmoffset, len); if(munmap(mmp,mmoffset+len)==-1) { errorMessage = "unmap: "; errorMessage+= strerror(errno); close(fd); return NULL; } if(close(fd)==-1) { errorMessage = DEV_MEM; errorMessage+= ": "; errorMessage+= strerror(errno); } return p; } _smbios_entry_point *SMBIOS_getEntryPoint(void *start) { _smbios_anchor *anchor; for(anchor = (_smbios_anchor*) start; (unsigned long) anchor < ((unsigned long) start + (unsigned long) _SMBIOS_ANCHOR_SEARCH_RANGE); anchor+=4) // skip 16 bytes (anchor string is aligned on 16 bytes paragraph boundaries) { // look for the sequence "_SM_" if (memcmp("_SM_", anchor->anchor_string, 4) == 0) return (_smbios_entry_point*)anchor; } return NULL; } int SMBIOS_getStructure(vector& output,char *tableAddress, u16 structureCount, u8 Type) { u16 i; u8 lasttype; i = 0; output.clear(); while( i < structureCount) { lasttype = ((_smbios_structure_header *)tableAddress)->type; if( lasttype == Type ) output.push_back((void*)tableAddress); char* base = tableAddress + ((_smbios_structure_header*) tableAddress)->length; if (base[0]==0 && base[1]==0) tableAddress = base + 2; else { for (unsigned int j = 1; *base != 0 && j < 256; j++) base += strlen(base) + 1; tableAddress = base + 1; } i++; } return OK; } const char *SMBIOS_getDmiString(_smbios_structure_header *dm, BYTE s) { //char *bp=(char *)dm->data; char *bp; size_t i, len; if(s==0) return "Not Specified"; bp=(char *)dm; bp+=dm->length; while(s>1 && *bp) { bp+=strlen(bp); bp++; s--; } if(!*bp) return "BAD INDEX"; // ASCII filtering len=strlen(bp); for(i=0; i& dmi_strings,string& errorMessage) { vector infos; void *start_ptr; char *tableAddress; _smbios_entry_point *anchor; vector indexes; int index_max; if((start_ptr=SMBIOS_getRawData(_SMBIOS_ANCHOR_SEARCH_OFFSET,_SMBIOS_ANCHOR_SEARCH_RANGE,errorMessage))==NULL) return FAILED; anchor=SMBIOS_getEntryPoint(start_ptr); if((tableAddress=(char*)SMBIOS_getRawData(anchor->structure_table_address,anchor->structure_table_length,errorMessage))==NULL) { free(start_ptr); return FAILED; } SMBIOS_getStructure(infos,tableAddress,anchor->number_of_smbios_structure,_SYSTEM_INFORMATION); memcpy(&system_info,infos[0],sizeof(system_information)); if(system_info.length>=0x08) { indexes.push_back((int)system_info.manufacturer); indexes.push_back((int)system_info.product_name); indexes.push_back((int)system_info.version); indexes.push_back((int)system_info.serial_number); if(system_info.length>=0x19) { if(system_info.length>=0x1B) { indexes.push_back((int)system_info.sku_number); indexes.push_back((int)system_info.family); } } } index_max=*max_element(indexes.begin(), indexes.end()); for(int i=0;i<=index_max;i++) dmi_strings.push_back(SMBIOS_getDmiString((_smbios_structure_header*)infos[0],i)); free(tableAddress); free(start_ptr); return OK; } libopendrim-1.1.3/NEWS0000644000175000017500000000064611404077256015265 0ustar guillaumeguillaumeChanges in 1.1.3 ========================= - DATASTORE_PATH changed from /var/cache/OpenDRIM to /var/lib/OpenDIRM Changes in 1.1.0 ========================= - Adding SMBIOS implementation Changes in 1.0.2 ========================= - Adding some functions - Fixing some bugs Changes in 1.0.1 ========================= - Adding some functions Initial Release 1.0.0 ========================= - Initial Release libopendrim-1.1.3/LICENSE0000644000175000017500000000325311404077256015570 0ustar guillaumeguillaume################################################################################# # Note: This Copyright statement covers the OpenDRIM original parts of this file. # It does NOT concern the parts generated by automake. # # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################# libopendrim-1.1.3/CMPIBroking.cpp0000644000175000017500000000764411404077256017343 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ // CIM servers have cmpi headers that don't conform to the CMPI standard #ifndef USE_STANDARD_CMPI #define enumerateInstanceNames enumInstanceNames #define enumerateInstances enumInstances #endif #include "CMPIBroking.h" int CB_enumerateInstanceNames(const CMPIBroker* broker, const CMPIContext* ctx, const string& nameSpace, const string& classname, vector& objectpaths, string& errorMessage) { CMPIStatus rc={CMPI_RC_OK, NULL}; CMPIObjectPath* cop = CMNewObjectPath(broker, nameSpace.c_str(), classname.c_str(), &rc); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } CMPIEnumeration* en = broker->bft->enumerateInstanceNames(broker, ctx, cop, &rc); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } while ((bool) en->ft->hasNext(en, &rc)) { Objectpath ref(broker, en->ft->getNext(en, &rc).value.ref); objectpaths.push_back(ref); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } } if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } return OK; } int CB_enumerateInstances(const CMPIBroker* broker, const CMPIContext* ctx, const string& nameSpace, const string& classname, const char** properties, vector& instances, string& errorMessage) { CMPIStatus rc={CMPI_RC_OK, NULL}; CMPIObjectPath* cop = CMNewObjectPath(broker, nameSpace.c_str(), classname.c_str(), &rc); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } CMPIEnumeration* en = broker->bft->enumerateInstances(broker, ctx, cop, properties, &rc); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } while ((bool) en->ft->hasNext(en, &rc)) { CMPIInstance* inst = en->ft->getNext(en, &rc).value.inst; instances.push_back(Instance(broker, inst)); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } } if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } return OK; } int CB_getInstance(const CMPIBroker* broker, const CMPIContext* ctx, const Objectpath& op, const char** properties, Instance& instance, string& errorMessage) { CMPIStatus rc={CMPI_RC_OK, NULL}; CMPIInstance* ci = broker->bft->getInstance(broker, ctx, ((Objectpath) op).getHdl(), properties, &rc); if (rc.rc!=CMPI_RC_OK) { errorMessage = CMGetCharPtr(rc.msg); return rc.rc; } instance = Instance(broker, ci); return OK; } libopendrim-1.1.3/Instance.cpp0000644000175000017500000003454211404077256017040 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #include "Instance.h" Instance::Instance(){} Instance::~Instance(){} Instance::Instance(const CMPIBroker* _broker, CMPIInstance* inst) { hdl = inst; broker = (CMPIBroker*) _broker; } Instance::Instance(const CMPIBroker* _broker, Objectpath& op) { hdl = CMNewInstance(_broker, op.getHdl(), NULL); // Added by Frederic Desmons, ETRI (2007/05/20) // Copy the objectpath keys as instance properties unsigned int keyCount = CMGetKeyCount(op.getHdl(), NULL); for (unsigned int i=0; ift->getObjectPath(hdl, NULL)); } string Instance::getClassname() const { CMPIObjectPath* op = hdl->ft->getObjectPath(hdl, NULL); return CMGetCharPtr(op->ft->getClassName(op, NULL)); } string Instance::getNamespace() const { CMPIObjectPath* op = hdl->ft->getObjectPath(hdl, NULL); return CMGetCharPtr(op->ft->getNameSpace(op, NULL)); } int Instance::getPropertyCount() const { return CMGetPropertyCount(hdl, NULL); } string Instance::toString() const { return CMGetCharPtr(broker->eft->toString(broker, hdl, NULL)); } //uint8 void Instance::setProperty(const string& name, const unsigned char& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_uint8); } int Instance::getProperty(const string& name, unsigned char& value) const { _GET_PROPERTY } //uint16 void Instance::setProperty(const string& name, const unsigned short& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_uint16); } int Instance::getProperty(const string& name, unsigned short& value) const { _GET_PROPERTY } //uint32 void Instance::setProperty(const string& name, const unsigned int& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_uint32); } int Instance::getProperty(const string& name, unsigned int& value) const { _GET_PROPERTY } //uint32 deprecated void Instance::setProperty(const string& name, const unsigned long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_uint32); } int Instance::getProperty(const string& name, unsigned long& value) const { _GET_PROPERTY } //uint64 void Instance::setProperty(const string& name, const unsigned long long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_uint64); } int Instance::getProperty(const string& name, unsigned long long& value) const { _GET_PROPERTY } //sint8 void Instance::setProperty(const string& name, const signed char& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_sint8); } int Instance::getProperty(const string& name, signed char& value) const { _GET_PROPERTY } //sint16 void Instance::setProperty(const string& name, const short& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_sint16); } int Instance::getProperty(const string& name, short& value) const { _GET_PROPERTY } //sint32 void Instance::setProperty(const string& name, const int& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_sint32); } int Instance::getProperty(const string& name, int& value) const { _GET_PROPERTY } //sint32 deprecated void Instance::setProperty(const string& name, const long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_sint32); } int Instance::getProperty(const string& name, long& value) const { _GET_PROPERTY } //sint64 void Instance::setProperty(const string& name, const long long& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_sint64); } int Instance::getProperty(const string& name, long long& value) const { _GET_PROPERTY } //real32 void Instance::setProperty(const string& name, const float& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_real32); } int Instance::getProperty(const string& name, float& value) const { _GET_PROPERTY } //real64 void Instance::setProperty(const string& name, const double& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_real64); } int Instance::getProperty(const string& name, double& value) const { _GET_PROPERTY } //char16 void Instance::setPropertyChar16(const string& name, const unsigned short& value) { CMPIValue myValue = CT_toCMPIChar16(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_char16); } int Instance::getPropertyChar16(const string& name, unsigned short& value) const { CMPIStatus rc; CMPIData data = CMGetProperty(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToCChar16(data, value); } //boolean void Instance::setProperty(const string& name, const bool& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_boolean); } int Instance::getProperty(const string& name, bool& value) const { _GET_PROPERTY } //string void Instance::setProperty(const string& name, const string& value) { CMPIValue myValue = CT_toCMPI(broker, value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_string); } int Instance::getProperty(const string& name, string& value) const { _GET_PROPERTY } //datetime void Instance::setPropertyDatetime(const string& name, const string& value) { CMPIValue myValue = CT_toCMPIDatetime(broker, value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_dateTime); } int Instance::getPropertyDatetime(const string& name, string& value) const { CMPIStatus rc; CMPIData data = CMGetProperty(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToCDatetime(data, value); } //REF void Instance::setProperty(const string& name, const Objectpath& value) { CMPIValue myValue = CT_toCMPI(value); hdl->ft->setProperty(hdl, name.c_str(), &myValue, CMPI_ref); } int Instance::getProperty(const string& name, Objectpath& value) const { CMPIStatus rc; CMPIData data = CMGetProperty(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return FAILED; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToC(broker, data, value); } //uint8[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_uint8A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //uint16[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_uint16A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //uint32[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_uint32A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //uint32[] deprecated void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_uint32A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //uint64[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_uint64A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //sint8[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_sint8A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //sint16[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_sint16A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //sint32[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_sint32A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //sint32[] deprecated void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_sint32A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //sint64[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_sint64A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //real32[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_real32A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //real64[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_real64A); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //char16[] void Instance::setPropertyChar16(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPIChar16(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_char16A); } int Instance::getPropertyChar16(const string& name, vector& value) const { CMPIStatus rc; CMPIData data = CMGetProperty(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return rc.rc; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToCChar16(data, value); } //boolean[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_booleanA); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //string[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_charsA); } int Instance::getProperty(const string& name, vector& value) const { _GET_PROPERTY } //datetime[] void Instance::setPropertyDatetime(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPIDatetime(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_dateTimeA); } int Instance::getPropertyDatetime(const string& name, vector& value) const { CMPIStatus rc; CMPIData data = CMGetProperty(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return rc.rc; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToCDatetime(data, value); } //REF[] void Instance::setProperty(const string& name, const vector& value) { CMPIValue myValue = CT_toCMPI(broker, value); CMSetProperty(hdl, name.c_str(), &myValue, CMPI_refA); } int Instance::getProperty(const string& name, vector& value) const { CMPIStatus rc; CMPIData data = CMGetProperty(hdl, name.c_str(), &rc); if (rc.rc != CMPI_RC_OK) return rc.rc; if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound) return FAILED; return CT_ToC(broker, data, value); } libopendrim-1.1.3/Datastore.cpp0000644000175000017500000003560511404077256017223 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #include "Datastore.h" int DS_initDataStore(const string& nameSpace, const string& classname, const string& keys, string& errorMessage) { if (!CF_isExist((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys)) { string stdOut, stdErr; CF_assert(CF_runCommand("mkdir -p -m 750 '"+ (string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys + "'", stdOut, stdErr, errorMessage)); } return OK; } int DS_deleteDataStore(const string& nameSpace, const string& classname, const string& keys, string& errorMessage) { if (CF_isExist((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys)) { string stdOut, stdErr; CF_assert(CF_runCommand("rm -rf '"+ (string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"'", stdOut, stdErr, errorMessage)); if (CF_isExist((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys)) { errorMessage = "Failed to delete datastore: " + (string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys; return FAILED; } } return OK; } int DS_setPropertyNULL(const string& nameSpace, const string& classname, const string& keys, const string& property_name, string& errorMessage) { if (CF_isExist((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name))) { string stdOut, stdErr; CF_assert(CF_runCommand("rm '"+ (string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name) + "'", stdOut, stdErr, errorMessage)); } return OK; } int DS_getKeysEntries(const string& nameSpace, const string& classname, vector& keys_entries, string& errorMessage) { keys_entries.clear(); if (CF_isExist((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname)) { vector regular_files, block_devices, character_devices; CF_assert(CF_scanDirectory((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname, regular_files, keys_entries, block_devices, character_devices, errorMessage)); } return OK; } bool DS_keysEntryExists(const string& nameSpace, const string& classname, const string& keys_entry, string& errorMessage) { if (!CF_isExist((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys_entry)) return false; return true; } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, bool& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const bool& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, unsigned char& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const unsigned char& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, unsigned short& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const unsigned short& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, unsigned long& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const unsigned long& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, unsigned long long& property, string& errorMessage) { string property_file; CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage)); vector property_file_lines; CF_splitText(property_file_lines, property_file, '\n'); property = CF_strToULL(property_file_lines[0]); return OK; } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const unsigned long long& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, signed char& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const signed char& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, short& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const short& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, long& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const long& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, long long& property, string& errorMessage) { _GETPROPERTY_INTEGER } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const long long& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, float& property, string& errorMessage) { _GETPROPERTY_REAL } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const float& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, double& property, string& errorMessage) { _GETPROPERTY_REAL } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const double& property, string& errorMessage) { _SETPROPERTY_INTEGER_AND_REAL } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, string& property, string& errorMessage) { string property_file; CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage)); vector property_file_lines; CF_splitText(property_file_lines, property_file, '\n'); property = property_file_lines[0]; return OK; } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const string& property, string& errorMessage) { CF_assert(DS_initDataStore(nameSpace, classname, keys, errorMessage)); string property_file; CF_assert(CF_writeTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property, errorMessage)); return OK; } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { property.clear(); string property_file; CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage)); vector property_file_lines; CF_splitText(property_file_lines, property_file, '\n'); for (size_t i=0; i& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_INTEGERARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_REALARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { _GETPROPERTY_REALARRAY } int DS_setProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, const vector& property, string& errorMessage) { _SETPROPERTY_INTEGERARRAY } int DS_getProperty(const string& nameSpace, const string& classname, const string& keys, const string& property_name, vector& property, string& errorMessage) { property.clear(); string property_file; CF_assert(CF_readTextFile((string) _DATASTORE_PATH+"/"+nameSpace+"/"+classname+"/"+keys+"/"+CF_toLowCase(property_name), property_file, errorMessage)); vector property_file_lines; CF_splitText(property_file_lines, property_file, '\n'); for (size_t i=0; i& property, string& errorMessage) { CF_assert(DS_initDataStore(nameSpace, classname, keys, errorMessage)); string property_file; for (size_t i=0; i # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################*/ #ifndef OBJECTPATH_H_ #define OBJECTPATH_H_ #include #include "cmpidt.h" #include "cmpimacs.h" using namespace std; #define _GET_KEY CMPIStatus rc;\ CMPIData data = CMGetKey(hdl, name.c_str(), &rc);\ if (rc.rc != CMPI_RC_OK) return FAILED;\ if ((data.state & CMPI_nullValue) == CMPI_nullValue || (data.state & CMPI_badValue) == CMPI_badValue || (data.state & CMPI_notFound) == CMPI_notFound)\ return FAILED;\ return CT_ToC(data, value); // C++ class to represent a CIM objectpath class Objectpath { private: CMPIObjectPath* hdl; CMPIBroker* broker; public: Objectpath(); Objectpath(const CMPIBroker* _broker, const string& classname, const string& nameSpace); Objectpath(const CMPIBroker* _broker, CMPIObjectPath* ob); ~Objectpath(); CMPIObjectPath* getHdl() const; Objectpath getObjectpath() const; string getNamespace() const; void setNamespace(const string& value); string getClassname() const; string getHostname() const; bool equals(const Objectpath& anotherObjectpath) const; string toString() const; unsigned int getKeyCount() const; int getKeyAt(unsigned int index, CMPIData& data, string& name) const; int getKey(const string& name, CMPIData& data) const; //uint8 void addKey(const string& name, const unsigned char& value); int getKey(const string& name, unsigned char& value) const; //uint16 void addKey(const string& name, const unsigned short int& value); int getKey(const string& name, unsigned short int& value) const; //uint32 void addKey(const string& name, const unsigned int& value); int getKey(const string& name, unsigned int& value) const; //uint32 deprecated void addKey(const string& name, const unsigned long& value); int getKey(const string& name, unsigned long& value) const; //uint64 void addKey(const string& name, const unsigned long long& value); int getKey(const string& name, unsigned long long& value) const; //sint8 void addKey(const string& name, const signed char& value); int getKey(const string& name, signed char& value) const; //sint16 void addKey(const string& name, const short int& value); int getKey(const string& name, short int& value) const; //sint32 void addKey(const string& name, const int& value); int getKey(const string& name, int& value) const; //sint32 deprecated void addKey(const string& name, const long& value); int getKey(const string& name, long& value) const; //sint64 void addKey(const string& name, const long long& value); int getKey(const string& name, long long& value) const; //real32 void addKey(const string& name, const float& value); int getKey(const string& name, float& value) const; //real64 void addKey(const string& name, const double& value); int getKey(const string& name, double& value) const; //char16 void addKeyChar16(const string& name, const unsigned short int& value); int getKeyChar16(const string& name, unsigned short int& value) const; //boolean void addKey(const string& name, const bool& value); int getKey(const string& name, bool& value) const; //string void addKey(const string& name, const string& value); int getKey(const string& name, string& value) const; //datetime void addKeyDatetime(const string& name, const string& value); int getKeyDatetime(const string& name, string& value) const; //REF void addKey(const string& name, const Objectpath& value); int getKey(const string& name, Objectpath& value) const; }; #include "Common.h" #include "Transtype.h" #endif /*OBJECTPATH_H_*/ libopendrim-1.1.3/cmpi/0000755000175000017500000000000011404077256015510 5ustar guillaumeguillaumelibopendrim-1.1.3/cmpi/cmpidt.h0000644000175000017500000006636111404077256017155 0ustar guillaumeguillaume/* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 2006 The Open Group */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a */ /* copy of this software (the "Software"), to deal in the Software without */ /* restriction, including without limitation the rights to use, copy, */ /* modify, merge, publish, distribute, sublicense, and/or sell copies of */ /* the Software, and to permit persons to whom the Software is furnished */ /* to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included */ /* in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ /* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ /* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /* ------------------------------------------------------------------------- */ #ifndef _CMPIDT_H_ # define _CMPIDT_H_ # include "cmpipl.h" # ifdef __cplusplus extern "C" { # endif // defintion of version numbers to be used by providers using CMBrokerVersion() // They indicate what CMPI version is supported by both the broker and its adapter # define CMPIVersion100 100 // 1.00 # define CMPIVersion200 200 // 2.00 // CMPI_VERSION compile switch should be used during MI compilation only. // It is used define minimal version support needed from Management Broker. // This value will be set in _CreateMI.mi_version # ifdef CMPI_VERSION # if (CMPI_VERSION==200) # define CMPI_VER_200 1 # elif (CMPI_VERSION==100) # define CMPI_VER_100 1 // Please note that if the CMPI implementations supports "historical" CMPI // levels (90, 86, etc) this would be the place to add the checks for the // version. // # else # error Unsupported CMPI_VERSION defined # endif # else # define CMPI_VER_200 # endif // CMPI_VER_x switch is used by Management Broker implementations only. // It defines the CMPI version supported by the Management Broker. // This value must be set in the ftVersion field of all functions tables. // Version definitions are cumulative. // A new version definition must #define all previous definitions. // During MI loading MBs must ensure that // _CreateMI.miVersion<=_CreateMI.ftVersion // If this is not the case, the MI might require higher version MB support. # if defined (CMPI_VER_200) || defined(CMPI_VER_ALL) # define CMPI_VER_100 # define CMPICurrentVersion CMPIVersion200 # elif defined (CMPI_VER_100) || defined(CMPI_VER_ALL) # define CMPICurrentVersion CMPIVersion100 // Please note that if the CMPI implementations supports "historical" CMPI // levels (90, 86, etc) this would be the place to add the checks for the // version. # else // default version # define CMPI_VER_200 # define CMPI_VER_100 # define CMPICurrentVersion CMPIVersion200 # endif /** A platform independent CMPI data type, usually an unsigned int */ typedef unsigned int CMPICount; struct _CMPIBroker; struct _CMPIInstance; struct _CMPIObjectPath; struct _CMPIArgs; struct _CMPISelectExp; struct _CMPISelectCond; struct _CMPISubCond; struct _CMPIPredicate; struct _CMPIEnumeration; struct _CMPIArray; struct _CMPIString; struct _CMPIResult; struct _CMPIContext; struct _CMPIDateTime; typedef struct _CMPIBroker CMPIBroker; typedef struct _CMPIInstance CMPIInstance; typedef struct _CMPIObjectPath CMPIObjectPath; typedef struct _CMPIArgs CMPIArgs; typedef struct _CMPISelectExp CMPISelectExp; typedef struct _CMPISelectCond CMPISelectCond; typedef struct _CMPISubCond CMPISubCond; typedef struct _CMPIPredicate CMPIPredicate; typedef struct _CMPIEnumeration CMPIEnumeration; typedef struct _CMPIArray CMPIArray; typedef struct _CMPIString CMPIString; typedef struct _CMPIResult CMPIResult; typedef struct _CMPIContext CMPIContext; typedef struct _CMPIDateTime CMPIDateTime; # ifdef CMPI_VER_200 struct _CMPIError; typedef struct _CMPIError CMPIError; # endif struct _CMPIBrokerFT; struct _CMPIBrokerEncFT; struct _CMPIInstanceFT; struct _CMPIObjectPathFT; struct _CMPIArgsFT; struct _CMPISelectExpFT; struct _CMPISelectCondFT; struct _CMPISelectCondDocFT; struct _CMPISelectCondCodFT; struct _CMPISubCondFT; struct _CMPIPredicateFT; struct _CMPIEnumerationFT; struct _CMPIArrayFT; struct _CMPIStringFT; struct _CMPIresultFT; struct _CMPIContextFT; struct _CMPIDateTimeFT; # ifdef CMPI_VER_200 struct _CMPIBrokerMemFT; struct _CMPIErrorFT; typedef struct _CMPIBrokerMemFT CMPIBrokerMemFT; typedef struct _CMPIErrorFT CMPIErrorFT; # endif typedef struct _CMPIBrokerFT CMPIBrokerFT; typedef struct _CMPIBrokerEncFT CMPIBrokerEncFT; typedef struct _CMPIBrokerExtFT CMPIBrokerExtFT; typedef struct _CMPIInstanceFT CMPIInstanceFT; typedef struct _CMPIObjectPathFT CMPIObjectPathFT; typedef struct _CMPIArgsFT CMPIArgsFT; typedef struct _CMPISelectExpFT CMPISelectExpFT; typedef struct _CMPISelectCondFT CMPISelectCondFT; typedef struct _CMPISubCondFT CMPISubCondFT; typedef struct _CMPIPredicateFT CMPIPredicateFT; typedef struct _CMPIEnumerationFT CMPIEnumerationFT; typedef struct _CMPIArrayFT CMPIArrayFT; typedef struct _CMPIStringFT CMPIStringFT; typedef struct _CMPIResultFT CMPIResultFT; typedef struct _CMPIContextFT CMPIContextFT; typedef struct _CMPIDateTimeFT CMPIDateTimeFT; typedef unsigned char CMPIBoolean; typedef unsigned short CMPIChar16; typedef unsigned char CMPIUint8; typedef unsigned short CMPIUint16; typedef unsigned int CMPIUint32; # ifndef CMPI_PLATFORM_WIN32_IX86_MSVC typedef unsigned long long CMPIUint64; # else typedef unsigned __int64 CMPIUint64; # endif typedef signed char CMPISint8; typedef short CMPISint16; typedef signed int CMPISint32; # ifndef CMPI_PLATFORM_WIN32_IX86_MSVC typedef long long CMPISint64; # else typedef __int64 CMPISint64; # endif typedef float CMPIReal32; typedef double CMPIReal64; typedef struct _CMPIValuePtr { void *ptr; CMPICount length; } CMPIValuePtr; typedef union _CMPIValue { CMPIUint64 uint64; CMPIUint32 uint32; CMPIUint16 uint16; CMPIUint8 uint8; CMPISint64 sint64; CMPISint32 sint32; CMPISint16 sint16; CMPISint8 sint8; CMPIReal64 real64; CMPIReal32 real32; CMPIBoolean boolean; CMPIChar16 char16; CMPIInstance *inst; CMPIObjectPath *ref; CMPIArgs *args; CMPISelectExp *filter; CMPIEnumeration *Enum; CMPIArray *array; CMPIString *string; char *chars; CMPIDateTime *dateTime; CMPIValuePtr dataPtr; CMPISint8 Byte; CMPISint16 Short; CMPISint32 Int; CMPISint64 Long; CMPIReal32 Float; CMPIReal64 Double; } CMPIValue; typedef unsigned short CMPIType; # define CMPI_null 0 # define CMPI_SIMPLE (2) # define CMPI_boolean (2+0) # define CMPI_char16 (2+1) # define CMPI_REAL ((2)<<2) # define CMPI_real32 ((2+0)<<2) # define CMPI_real64 ((2+1)<<2) # define CMPI_UINT ((8)<<4) # define CMPI_uint8 ((8+0)<<4) # define CMPI_uint16 ((8+1)<<4) # define CMPI_uint32 ((8+2)<<4) # define CMPI_uint64 ((8+3)<<4) # define CMPI_SINT ((8+4)<<4) # define CMPI_sint8 ((8+4)<<4) # define CMPI_sint16 ((8+5)<<4) # define CMPI_sint32 ((8+6)<<4) # define CMPI_sint64 ((8+7)<<4) # define CMPI_INTEGER ((CMPI_UINT | CMPI_SINT)) # define CMPI_ENC ((16)<<8) # define CMPI_instance ((16+0)<<8) # define CMPI_ref ((16+1)<<8) # define CMPI_args ((16+2)<<8) # define CMPI_class ((16+3)<<8) # define CMPI_filter ((16+4)<<8) # define CMPI_enumeration ((16+5)<<8) # define CMPI_string ((16+6)<<8) # define CMPI_chars ((16+7)<<8) # define CMPI_dateTime ((16+8)<<8) # define CMPI_ptr ((16+9)<<8) # define CMPI_charsptr ((16+10)<<8) # define CMPI_ARRAY ((1)<<13) # define CMPI_SIMPLEA (CMPI_ARRAY | CMPI_SIMPLE) # define CMPI_booleanA (CMPI_ARRAY | CMPI_boolean) # define CMPI_char16A (CMPI_ARRAY | CMPI_char16) # define CMPI_REALA (CMPI_ARRAY | CMPI_REAL) # define CMPI_real32A (CMPI_ARRAY | CMPI_real32) # define CMPI_real64A (CMPI_ARRAY | CMPI_real64) # define CMPI_UINTA (CMPI_ARRAY | CMPI_UINT) # define CMPI_uint8A (CMPI_ARRAY | CMPI_uint8) # define CMPI_uint16A (CMPI_ARRAY | CMPI_uint16) # define CMPI_uint32A (CMPI_ARRAY | CMPI_uint32) # define CMPI_uint64A (CMPI_ARRAY | CMPI_uint64) # define CMPI_SINTA (CMPI_ARRAY | CMPI_SINT) # define CMPI_sint8A (CMPI_ARRAY | CMPI_sint8) # define CMPI_sint16A (CMPI_ARRAY | CMPI_sint16) # define CMPI_sint32A (CMPI_ARRAY | CMPI_sint32) # define CMPI_sint64A (CMPI_ARRAY | CMPI_sint64) # define CMPI_INTEGERA (CMPI_ARRAY | CMPI_INTEGER) # define CMPI_ENCA (CMPI_ARRAY | CMPI_ENC) # define CMPI_stringA (CMPI_ARRAY | CMPI_string) # define CMPI_charsA (CMPI_ARRAY | CMPI_chars) # define CMPI_dateTimeA (CMPI_ARRAY | CMPI_dateTime) # define CMPI_instanceA (CMPI_ARRAY | CMPI_instance) # define CMPI_refA (CMPI_ARRAY | CMPI_ref) # define CMPI_charsptrA (CMPI_ARRAY | CMPI_charsptr) // the following are CMPIObjectPath key-types synonyms // and are valid only when CMPI_keyValue of CMPIValueState is set # define CMPI_keyInteger (CMPI_sint64) # define CMPI_keyString (CMPI_string) # define CMPI_keyBoolean (CMPI_boolean) # define CMPI_keyRef (CMPI_ref) // the following are predicate types only # define CMPI_charString (CMPI_string) # define CMPI_integerString (CMPI_string | CMPI_sint64) # define CMPI_realString (CMPI_string | CMPI_real64) # define CMPI_numericString (CMPI_string | CMPI_sint64 | CMPI_real64) # define CMPI_booleanString (CMPI_string | CMPI_boolean) # define CMPI_dateTimeString (CMPI_string | CMPI_dateTime) # define CMPI_classNameString (CMPI_string | CMPI_class) # define CMPI_nameString (CMPI_string | ((16+10)<<8)) /** Indicates the state of a CMPI value.
  • CMPI_goodValue - Value embedded in CMPIData object is valid.
  • CMPI_nullValue - Value embedded in CMPIData object is NULL.
  • CMPI_keyValue - Value embedded in CMPIData object is valid & is a key
  • CMPI_notFound -
  • CMPI_badValue - Value embedded in CMPIData object is not valid.
*/ typedef unsigned short CMPIValueState; # define CMPI_goodValue (0) # define CMPI_nullValue (1<<8) # define CMPI_keyValue (2<<8) # define CMPI_notFound (4<<8) # define CMPI_badValue (0x80<<8) /** Values transferred from CMPI functions to the MI return three components: the value, its state, and its type as defined by the schema. All three components are bundled into this one structure. */ typedef struct _CMPIData { /** An unsigned short representing the type of the CMPIData object */ CMPIType type; /** An unsigned short representing whether this CMPIData object is valid or not. */ CMPIValueState state; /** A union which holds the actual underlying value of the data object */ CMPIValue value; } CMPIData; typedef CMPIData CMPIAccessor (const char *, void *parm); # ifndef CMPI_NO_SYNONYM_SUPPORT # define CMPI_Byte CMPI_sint8 # define CMPI_Short CMPI_sint16 # define CMPI_Int CMPI_sint32 # define CMPI_Long CMPI_sint64 # define CMPI_Float CMPI_real32 # define CMPI_Double CMPI_real64 # define CMPI_ByteA CMPI_sint8A # define CMPI_ShortA CMPI_sint16A # define CMPI_IntA CMPI_sint32A # define CMPI_LongA CMPI_sint64A # define CMPI_FloatA CMPI_real32A # define CMPI_DoubleA CMPI_real64A # endif // CMPI_NO_SYNONYM_SUPPORT typedef void* CMPIMsgFileHandle; typedef void CMPIGcStat; /** The CMPIFlags type is used to inform MI functions about options specified by the client and passed on to the MI for certain requests. CMPIFlags are not passed to MIs directly. MIs must use the CMPIContext services to gain access under the name CMPIInvocationFlags.
  • CMPI_FLAG_LocalOnly - Local only attributes
  • CMPI_FLAG_DeepInheritance - Providers should provide deep inhertiance information
  • CMPI_FLAG_IncludeQualifiers - deprecated Indicates that a MI's should return qualifiers
  • CMPI_FLAG_IncludeClassOrigin - MI should return class origin info
*/ typedef unsigned int CMPIFlags; # define CMPI_FLAG_LocalOnly 1 # define CMPI_FLAG_DeepInheritance 2 # define CMPI_FLAG_IncludeQualifiers 4 # define CMPI_FLAG_IncludeClassOrigin 8 /* Authenticated ID of the user requesting this MI invocation. */ # define CMPIPrincipal "CMPIPrincipal" /* CMPIFlags - invocation flags as specified by the client. */ # define CMPIInvocationFlags "CMPIInvocationFlags" /* Namespace for which the MI is started. */ # define CMPIInitNameSpace "CMPIInitNameSpace" /* The role assumed by the current authenticated user. */ # define CMPIRole "CMPIRole" /* The accept language from the request */ # define CMPIAcceptLanguage "CMPIAcceptLanguage" /* The content language of the request */ # define CMPIContentLanguage "CMPIContentLanguage" /** Enum which indicates success or failure, usually accessed as part of the CMPIStatus structure */ typedef enum _CMPIrc { /** Success */ CMPI_RC_OK = 0, /** Generic failure */ CMPI_RC_ERR_FAILED = 1, /** Specified user does not have access to perform the requested action */ CMPI_RC_ERR_ACCESS_DENIED = 2, /** invalid namespace specified */ CMPI_RC_ERR_INVALID_NAMESPACE = 3, /** invalid parameter specified */ CMPI_RC_ERR_INVALID_PARAMETER = 4, /** Invalid class specified */ CMPI_RC_ERR_INVALID_CLASS = 5, /** Item was not found */ CMPI_RC_ERR_NOT_FOUND = 6, /** Operation not supported */ CMPI_RC_ERR_NOT_SUPPORTED = 7, /** Object has child objects */ CMPI_RC_ERR_CLASS_HAS_CHILDREN = 8, /** Object has instances */ CMPI_RC_ERR_CLASS_HAS_INSTANCES = 9, /** Invalid super class specified */ CMPI_RC_ERR_INVALID_SUPERCLASS = 10, /** specified object already exists */ CMPI_RC_ERR_ALREADY_EXISTS = 11, /** Property does not exist */ CMPI_RC_ERR_NO_SUCH_PROPERTY = 12, /** This is a type mismatch */ CMPI_RC_ERR_TYPE_MISMATCH = 13, /** Query language not supported */ CMPI_RC_ERR_QUERY_LANGUAGE_NOT_SUPPORTED = 14, /** Invalid query */ CMPI_RC_ERR_INVALID_QUERY = 15, /** Method is not available */ CMPI_RC_ERR_METHOD_NOT_AVAILABLE = 16, /** could not find the specified method */ CMPI_RC_ERR_METHOD_NOT_FOUND = 17, /** Returned by a MI to indicate that it should not be unloaded, only returned via a cleanup() call */ CMPI_RC_DO_NOT_UNLOAD = 50, /** Returned by a MI to indicate that it should never be unloaded, only returned via a cleanup() call */ CMPI_RC_NEVER_UNLOAD = 51, /* Internal CMPI return codes. */ CMPI_RC_ERR_INVALID_HANDLE = 60, CMPI_RC_ERR_INVALID_DATA_TYPE = 61, /* Hosting OS errors. */ CMPI_RC_ERROR_SYSTEM = 100, CMPI_RC_ERROR = 200 } CMPIrc; /** The status structure is used to indicate success or failure of a call */ typedef struct _CMPIStatus { /** The CMPIrc value. @see _CMPIrc */ CMPIrc rc; /** A text string representing the error message @see CMPIString */ CMPIString *msg; } CMPIStatus; /* Management Broker capabilities and feature support */ # define CMPI_MB_Class_0 0x00000001 # define CMPI_MB_Class_1 0x00000003 # define CMPI_MB_Class_2 0x00000007 # define CMPI_MB_Supports_PropertyMI 0x00000100 # define CMPI_MB_Supports_IndicationMI 0x00000200 # define CMPI_MB_Supports_IndicationPolling 0x00000400 # define CMPI_MB_Supports_QueryNormalization 0x00000800 # define CMPI_MB_Supports_Qualifier 0x00001000 # define CMPI_MB_Supports_Schema 0x00003000 # ifdef CMPI_VER_200 # define CMPI_MB_Supports_MemEnhancements 0x00004000 # define CMPI_MB_Supports_Extended_Error 0x00008000 # endif # define CMPI_MB_BasicRead 0x00000001 # define CMPI_MB_BasicWrite 0x00000003 # define CMPI_MB_InstanceManipulation 0x00000007 # define CMPI_MB_AssociationTraversal 0x00000009 # define CMPI_MB_QueryExecution 0x00000011 # define CMPI_MB_QueryNormalization 0x00000031 # define CMPI_MB_Indications 0x00000081 # define CMPI_MB_BasicQualifierSupport 0x00000047 # define CMPI_MB_OSEncapsulationSupport 0x00000100 /* Query Predicate operations */ typedef enum _CMPIPredOp { CMPI_PredOp_Equals = 1, CMPI_PredOp_NotEquals = 2, CMPI_PredOp_LessThan = 3, CMPI_PredOp_GreaterThanOrEquals = 4, CMPI_PredOp_GreaterThan = 5, CMPI_PredOp_LessThanOrEquals = 6, CMPI_PredOp_Isa = 7, CMPI_PredOp_NotIsa = 8, CMPI_PredOp_Like = 9, CMPI_PredOp_NotLike = 10 # ifdef CMPI_VER_200 , CMPI_PredOp_Not_Null = 11, CMPI_PredOp_Null = 12, CMPI_PredOp_And = 13, CMPI_PredOp_Or = 14 # endif } CMPIPredOp; /** Severity levels for logging functions */ typedef enum _CMPISeverity { /** Error */ CMPI_SEV_ERROR = 1, /** General info */ CMPI_SEV_INFO = 2, /** Warning message */ CMPI_SEV_WARNING = 3, /** Debug message */ CMPI_DEV_DEBUG = 4 } CMPISeverity; /** Logging level for trace functions*/ typedef enum _CMPILevel { /** Generic information */ CMPI_LEV_INFO = 1, /** warnings */ CMPI_LEV_WARNING = 2, /** detailed/specific information */ CMPI_LEV_VERBOSE = 3 } CMPILevel; /** Type of query expression it is normalized to. */ typedef enum _CMPISelectCondType { /** Disjuntion Of Conjunctions */ CMPI_COND_DOC = 0, /** Conjuction of disjunctions */ CMPI_COND_COD = 1 } CMPISelectCondType; #ifdef CMPI_VER_200 /** Possible values an Error object can use in its type property @version 2.0 */ typedef enum _CMPIErrorType { /** Unkown */ UnknownErrorType = 0, /** Other */ OtherErrorType = 1, /** Communications error */ CommunicationsError = 2, /** QoS error */ QualityOfServiceError = 3, /** Software error */ SoftwareError = 4, /** Hardware error */ HardwareError = 5, /** Environmental error */ EnvironmentalError = 6, /** Security error */ SecurityError = 7, /** over subscription error */ Oversubscription_Error = 8, /** Unavailable resource */ UnavailableResourceError = 9, /** Unsupported operation */ UnsupportedOperationError = 10 } CMPIErrorType; /** Possible values an Error object can use to indicate severity */ typedef enum _CMPIErrorSeverity { /** Unknown */ ErrorSevUnknown = 0, /** Low severity */ ErrorSevLow = 2, /** Medium Severity */ ErrorSevMedium = 3, /** High severity */ ErrorSevHigh = 4, /** Fatal error */ ErrorSevFatal = 5, } CMPIErrorSeverity; /** Possible values an Error object can use to indicate the probable cause */ typedef enum _CMPIErrorProbableCause { /** Unknown */ ErrorProbCauseUnknown = 0, /** Other cause */ ErrorProbCauseOther = 1, /** Adpater card failure */ Adapter_Card_Error = 2, /** Subsystem failure */ Application_Subsystem_Failure = 3, /** Reduced bandwidth */ Bandwidth_Reduced = 4, /** Could not establish connection */ Connection_Establishment_Error = 5, /** protocol error */ Communications_Protocol_Error = 6, /** Subsystem failure */ Communications_Subsystem_Failure = 7, /** Configuration error */ ConfigurationCustomization_Error = 8, /** Congested */ Congestion = 9, /** Data is corrupt */ Corrupt_Data = 10, /** CPU cycles exceeded */ CPU_Cycles_Limit_Exceeded = 11, /* Dataset modem error */ DatasetModem_Error = 12, /** Degraded signal */ Degraded_Signal = 13, /** STE/DCE Interface Error */ DTE_DCE_Interface_Error = 14, /** Door open */ Enclosure_Door_Open = 15, /** Equipment malfunction */ Equipment_Malfunction = 16, /** Excessive Vibration */ Excessive_Vibration = 17, /** File format error */ File_Format_Error = 18, /** Fire detected */ Fire_Detected = 19, /** Flood detected */ Flood_Detected = 20, /** framing error */ Framing_Error = 21, /** HVAC problem */ HVAC_Problem = 22, /* Humidity unacceptable */ Humidity_Unacceptable = 23, /** IO device error */ IO_Device_Error = 24, /** Input device error */ Input_Device_Error = 25, /** LAN Error */ LAN_Error = 26, /** Non-toxic leak detected */ Non_Toxic_Leak_Detected = 27, /* Local node transmission error */ Local_Node_Transmission_Error = 28, /** loss of frame */ Loss_of_Frame = 29, /** loss of signal */ Loss_of_Signal = 30, /** Material supply exhausted */ Material_Supply_Exhausted = 31, /** Multiplexer problem */ Multiplexer_Problem = 32, /** Out of memory */ Out_of_Memory = 33, /** Output device error */ Output_Device_Error = 34, /** Performance degraded */ Performance_Degraded = 35, /** Power problem */ Power_Problem = 36, /** Pressure unacceptable */ Pressure_Unacceptable = 37, /** Processor problem */ Processor_Problem = 38, /** Pump failure */ Pump_Failure = 39, /** Queue size exceeded */ Queue_Size_Exceeded = 40, /** Receive failure */ Receive_Failure = 41, /** Receiver failure */ Receiver_Failure = 42, /** Remote node transmission error */ Remote_Node_Transmission_Error = 43, /** Resource at or nearing capacity */ Resource_at_or_Nearing_Capacity = 44, /** Response time excessive */ Response_Time_Excessive = 45, /** Retransmission rate excessive */ Retransmission_Rate_Excessive = 46, /** Software Error */ Software_Error = 47, /** Software terminated abnormally */ Software_Program_Abnormally_Terminated = 48, /** Program error */ Software_Program_Error = 49, /** Storage capacity problem */ Storage_Capacity_Problem = 50, /** Temperature_Unacceptable */ Temperature_Unacceptable = 51, /** Threshold_Crossed */ Threshold_Crossed = 52, /** Timing_Problem */ Timing_Problem = 53, /** Toxic_Leak_Detected */ Toxic_Leak_Detected = 54, /** Transmit_Failure */ Transmit_Failure = 55, /** Transmitter_Failure */ Transmitter_Failure = 56, /** Underlying_Resource_Unavailable */ Underlying_Resource_Unavailable = 57, /** Version_Mismatch */ Version_Mismatch = 58, /** Previous_Alert_Cleared */ Previous_Alert_Cleared = 59, /** Login_Attempts_Failed */ Login_Attempts_Failed = 60, /** Software_Virus_Detected */ Software_Virus_Detected = 61, /** Hardware_Security_Breached */ Hardware_Security_Breached = 62, /** Denial_of_Service_Detected */ Denial_of_Service_Detected = 63, /** Security_Credential_Mismatch */ Security_Credential_Mismatch = 64, /** Unauthorized_Access */ Unauthorized_Access = 65, /** Alarm_Received */ Alarm_Received = 66, /** Loss_of_Pointer */ Loss_of_Pointer = 67, /** Payload_Mismatch */ Payload_Mismatch = 68, /** Transmission_Error */ Transmission_Error = 69, /** Excessive_Error_Rate */ Excessive_Error_Rate = 70, /** Trace_Problem */ Trace_Problem = 71, /** Element_Unavailable */ Element_Unavailable = 72, /** Element_Missing */ Element_Missing = 73, /** Loss_of_Multi_Frame */ Loss_of_Multi_Frame = 74, /** Broadcast_Channel_Failure */ Broadcast_Channel_Failure = 75, /** Invalid_Message_Received */ Invalid_Message_Received = 76, /** Routing_Failure */ Routing_Failure = 77, /** Backplane_Failure */ Backplane_Failure = 78, /** Identifier_Duplication */ Identifier_Duplication = 79, /** Protection_Path_Failure */ Protection_Path_Failure = 80, /** Sync_Loss_or_Mismatch */ Sync_Loss_or_Mismatch = 81, /** Terminal_Problem */ Terminal_Problem = 82, /** Real_Time_Clock_Failure */ Real_Time_Clock_Failure = 83, /** Antenna_Failure */ Antenna_Failure = 84, /** Battery_Charging_Failure */ Battery_Charging_Failure = 85, /** Disk_Failure */ Disk_Failure = 86, /** Frequency_Hopping_Failure */ Frequency_Hopping_Failure = 87, /** Loss_of_Redundancy */ Loss_of_Redundancy = 88, /** Power_Supply_Failure */ Power_Supply_Failure = 89, /** Signal_Quality_Problem */ Signal_Quality_Problem = 90, /** Battery_Discharging */ Battery_Discharging = 91, /** Battery_Failure */ Battery_Failure = 92, /** Commercial_Power_Problem */ Commercial_Power_Problem = 93, /** Fan_Failure */ Fan_Failure = 94, /** Engine_Failure */ Engine_Failure = 95, /** Sensor_Failure */ Sensor_Failure = 96, /** Fuse_Failure */ Fuse_Failure = 97, /** Generator_Failure */ Generator_Failure = 98, /** Low_Battery */ Low_Battery = 99, /** Low_Fuel */ Low_Fuel = 100, /** Low_Water */ Low_Water = 101, /** Explosive_Gas */ Explosive_Gas = 102, /** High_Winds */ High_Winds = 103, /** Ice_Buildup */ Ice_Buildup = 104, /** Smoke */ Smoke = 105, /** Memory_Mismatch */ Memory_Mismatch = 106, /** Out_of_CPU_Cycles */ Out_of_CPU_Cycles = 107, /** Software_Environment_Problem */ Software_Environment_Problem = 108, /** Software_Download_Failure */ Software_Download_Failure = 109, /** Element_Reinitialized */ Element_Reinitialized = 110, /** Timeout */ Timeout = 111, /** Logging_Problems */ Logging_Problems = 112, /** Leak_Detected */ Leak_Detected_113, /** Protection_Mechanism_Failure */ Protection_Mechanism_Failure = 114, /** Protecting_Resource_Failure */ Protecting_Resource_Failure = 115, /** Database_Inconsistency */ Database_Inconsistency = 116, /** Authentication_Failure */ Authentication_Failure = 117, /** Breach_of_Confidentiality */ Breach_of_Confidentiality = 118, /** Cable_Tamper */ Cable_Tamper = 119, /** Delayed_Information */ Delayed_Information = 120, /** Duplicate_Information */ Duplicate_Information = 121, /** Information_Missing */ Information_Missing = 122, /** Information_Modification */ Information_Modification = 123, /** Information_Out_of_Sequence */ Information_Out_of_Sequence = 124, /** Key_Expired */ Key_Expired = 125, /** Non_Repudiation_Failure */ Non_Repudiation_Failure = 126, /** Out_of_Hours_Activity */ Out_of_Hours_Activity = 127, /** Out_of_Service */ Out_of_Service = 128, /** Procedural_Error */ Procedural_Error = 129, /** Unexpected_Information */ Unexpected_Information = 130, } CMPIErrorProbableCause; /** Possible values an Error object can have for the error src format */ typedef enum _CMPIErrorSrcFormat { /** Unknown source */ CMPIErrSrcUnknown = 0, /** Other source */ CMPIErrSrcOther = 1, /* Object handle */ CIMObjectHandle = 2, } CMPIErrorSrcFormat; #endif /* CMPI_VER_200 */ # ifdef __cplusplus }; # endif #endif // _CMPIDT_H_ libopendrim-1.1.3/cmpi/Makefile.am0000644000175000017500000000334711404077256017553 0ustar guillaumeguillaume################################################################################# # Note: This Copyright statement covers the OpenDRIM original parts of this file. # It does NOT concern the parts generated by automake. # # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2009 Guillaume BOTTEX, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by , , ################################################################################ library_includedir = $(OPENDRIMCOMMONINCLUDE)/cmpi library_include_HEADERS = cmpidt.h cmpift.h cmpimacs.h cmpios.h cmpipl.h libopendrim-1.1.3/cmpi/cmpift.h0000644000175000017500000036061511404077256017156 0ustar guillaumeguillaume/* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 2006 The Open Group */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a */ /* copy of this software (the "Software"), to deal in the Software without */ /* restriction, including without limitation the rights to use, copy, */ /* modify, merge, publish, distribute, sublicense, and/or sell copies of */ /* the Software, and to permit persons to whom the Software is furnished */ /* to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included */ /* in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ /* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ /* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /* ------------------------------------------------------------------------- */ #ifndef _CMPIFT_H_ # define _CMPIFT_H_ # include "cmpidt.h" # include "cmpios.h" # ifdef __cplusplus extern "C" { # endif //--------------------------------------------------- //-- // _CMPIBrokerEncFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers to broker and factory services of encapsulated CMPIObjects. This table is made available by the Management Broker, aka CIMOM, whenever a provider is loaded and initialized. */ struct _CMPIBrokerEncFT { /** Function table version */ int ftVersion; /** Instance factory service. @param mb Pointer to the broker. @param op ObjectPath containing namespace and classname. @param rc Output: Service return status (suppressed when NULL). @return The newly created Instance. */ CMPIInstance *(*newInstance) (const CMPIBroker * mb, const CMPIObjectPath * op, CMPIStatus * rc); /** ObjectPath factory service. @param mb Pointer to the broker. @param ns Namespace @param cn Classname. @param rc Output: Service return status (suppressed when NULL). @return The newly created ObjectPath. */ CMPIObjectPath *(*newObjectPath) (const CMPIBroker * mb, const char *ns, const char *cn, CMPIStatus * rc); /** Args container factory service. @param mb Pointer to the broker. @param rc Output: Service return status (suppressed when NULL). @return The newly created Args container. */ CMPIArgs *(*newArgs) (const CMPIBroker * mb, CMPIStatus * rc); /** String container factory service. @param mb Pointer to the broker. @param data String data @param rc Output: Service return status (suppressed when NULL). @return The newly created String. */ CMPIString *(*newString) (const CMPIBroker * mb, const char *data, CMPIStatus * rc); /** Array container factory service. @param mb Pointer to the broker. @param max Maximum number of elements @param type Element type @param rc Output: Service return status (suppressed when NULL). @return The newly created Array. */ CMPIArray *(*newArray) (const CMPIBroker * mb, CMPICount max, CMPIType type, CMPIStatus * rc); /** DateTime factory service. Initialized with the time of day. @param mb Pointer to the broker. @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */ CMPIDateTime *(*newDateTime) (const CMPIBroker * mb, CMPIStatus * rc); /** DateTime factory service. Initialized from <binTime>. @param mb Pointer to the broker. @param binTime Date/Time definition in binary format in microsecods starting since 00:00:00 GMT, Jan 1,1970. @param interval Wenn true, defines Date/Time definition to be an interval value @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */ CMPIDateTime *(*newDateTimeFromBinary) (const CMPIBroker * mb, CMPIUint64 binTime, CMPIBoolean interval, CMPIStatus * rc); /** DateTime factory service. Is initialized from <utcTime>. @param mb Pointer to the broker. @param utcTime Date/Time definition in UTC format @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */ CMPIDateTime *(*newDateTimeFromChars) (const CMPIBroker * mb, const char *utcTime, CMPIStatus * rc); /** SelectExp factory service. @param mb Pointer to the broker. @param query The select expression. @param lang The query language. @param projection Output: Projection specification (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return The newly created SelectExp. */ CMPISelectExp *(*newSelectExp) (const CMPIBroker * mb, const char *query, const char *lang, CMPIArray ** projection, CMPIStatus * st); /** Function to determine whether a CIM class is of <type> or any of <type> subclasses. @param mb Pointer to the broker. @param op The class path (namespace and classname components). @param type The type to tested for. @param rc Output: Service return status (suppressed when NULL). @return True if test successful. */ CMPIBoolean (*classPathIsA) (const CMPIBroker * mb, const CMPIObjectPath * op, const char *type, CMPIStatus * rc); /** Attempts to transforms an CMPI object to a broker specific string format. Intended for debugging purposes only. @param mb Pointer to the broker. @param object A valid CMPI object. @param rc Output: Service return status (suppressed when NULL). @return String from representation of <object>. */ CMPIString *(*toString) (const CMPIBroker * mb, const void *object, CMPIStatus * rc); /** Verifies whether <object> is of CMPI type <type>. Intended for debugging purposes only. @param mb Pointer to the broker. @param object A valid CMPI object. @param type A string specifying a valid CMPI Object type ("CMPIInstance", "CMPIObjectPath", etc). @param rc Output: Service return status (suppressed when NULL). @return True if test successful. */ CMPIBoolean (*isOfType) (const CMPIBroker * mb, const void *object, const char *type, CMPIStatus * rc); /** Retrieves the CMPI type of <object>. Intended for debugging purposes only. @param mb Pointer to the broker. @param object A valid CMPI object. @param rc Output: Service return status (suppressed when NULL). @return CMPI object type. */ CMPIString *(*getType) (const CMPIBroker * mb, const void *object, CMPIStatus * rc); /** Retrieves translated message. @param mb Pointer to the broker. @param msgId The message identifier. @param defMsg The default message. @param rc Output: Service return status (suppressed when NULL). @param count The number of message substitution values. @return the trabslated message. */ CMPIString *(*getMessage) (const CMPIBroker * mb, const char *msgId, const char *defMsg, CMPIStatus * rc, CMPICount count, ...); /** Logs a diagnostic message. @param mb The mb argument points to a CMPIBroker structure. @param severity The level argument describes the level of log message. Levels are defined in Section 4.9. @param id The component argument, if not NULL, is the component ID. @param text The text argument, if not NULL, is the message text to be logged. @param string The string argument, if not NULL, is the message text to be logged. string will be ignored when text is not NULL. @return Service return status. */ CMPIStatus (*logMessage) (const CMPIBroker *, int severity, const char *id, const char *text, const CMPIString * string); /** Logs a trace entry. Intended for debugging purposes. @param mb The mb argument points to a CMPIBroker structure. @param level The level argument describes the level of log message. Levels are defined in Section 4.9. @param component The component argument, if not NULL, is the component ID. @param text The text argument, if not NULL, is the message text to be logged. @param string The string argument, if not NULL, is the message text to be logged. string will be ignored when text is not NULL. @return Service return status. */ CMPIStatus (*trace) (const CMPIBroker *, int level, const char *component, const char *text, const CMPIString * string); # ifdef CMPI_VER_200 /** Error factory service. @param mb Pointer to the broker. @param msgID A string which uniquely identifies, within the scope of the 'owner' argument, the format of the message. @param msg A string which represenst the formatted message. @parem sev The percieved severity of the error. @param pc The probably cause of this error @param status Service return status. @return The newly created Error. */ CMPIError* (*newCMPIError) (const CMPIBroker*, const char*, const char*, const char*, const CMPIErrorSeverity, const CMPIErrorProbableCause,const CMPIrc, CMPIStatus *rc); /** Opens a message file. @param mb Broker this pointer @param msgFile The message file identifier. @param msgFileHandle Output: The handle representing the open message file. @return Service return status. */ CMPIStatus (*openMessageFile) (const CMPIBroker* mb, const char *msgFile, CMPIMsgFileHandle* msgFileHandle); /** Closes a message file. @param mb Broker this pointer @param msgFileHandle The handle representing the open message file. @return Service return status. */ CMPIStatus (*closeMessageFile) (const CMPIBroker* mb, const CMPIMsgFileHandle msgFileHandle); /** Retrieves translated message. @param mb Broker this pointer @param msgId The message identifier. @param msgFileHandle The handle representing the open message file. @param defMsg The default message. @param rc Output: Service return status (suppressed when NULL). @param count The number of message substitution values. @return the translated message. */ CMPIString* (*getMessage2) (const CMPIBroker* mb, const char *msgId, const CMPIMsgFileHandle msgFileHandle, const char *defMsg, CMPIStatus* rc, CMPICount count, ...); # endif /* CMPI_VER_200 */ }; //--------------------------------------------------- //-- // _CMPIBrokerFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers to broker CIMOM services (up-calls). This table is made available by the Management Broker, whenever a provider is loaded and initialized. */ struct _CMPIBrokerFT { /** 32 bits describing CMPI features supported by this CIMOM. See CMPI_MB_Class_x and CMPI_MB_Supports_xxx flags. */ unsigned int brokerCapabilities; /** CIMOM version as defined by CIMOM */ unsigned int brokerVersion; /** CIMOM name */ const char *brokerName; /** This function prepares the CMPI run time system to accept a thread that will be using CMPI services. The returned CMPIContext object must be used by the subsequent attachThread() and detachThread() invocations. @param mb Pointer to the broker. @param ctx Old Context object @return New Context object to be used by thread to be attached. */ CMPIContext *(*prepareAttachThread) (const CMPIBroker * mb, const CMPIContext * ctx); /** This function informs the CMPI run time system that the current thread with Context will begin using CMPI services. @param mb Pointer to the broker. @param ctx Context object @return Service return status. */ CMPIStatus (*attachThread) (const CMPIBroker *, const CMPIContext *); /** This function informs the CMPI run time system that the current thread will not be using CMPI services anymore. The Context object will be freed during this operation. @param mb Pointer to the broker. @param ctx Context object @return Service return status. */ CMPIStatus (*detachThread) (const CMPIBroker * mb, const CMPIContext * ctx); // class 0 services /** This function requests delivery of an Indication. The CIMOM will locate pertinent subscribers and notify them about the event. @param mb Pointer to the broker. @param ctx Context object @param ns Namespace @param ind Indication Instance @return Service return status. */ CMPIStatus (*deliverIndication) (const CMPIBroker * mb, const CMPIContext * ctx, const char *ns, const CMPIInstance * ind); // class 1 services /** Enumerate Instance Names of the class (and subclasses) defined by <op>. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace and classname components. @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPathes. */ CMPIEnumeration *(*enumerateInstanceNames) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, CMPIStatus * rc); /** Get Instance using <op> as reference. Instance structure can be controled using the CMPIInvocationFlags entry in <ctx>. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return The Instance. */ CMPIInstance *(*getInstance) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char **properties, CMPIStatus * rc); // class 2 services /** Create Instance from <inst> using <op> as reference. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param inst Complete instance. @param rc Output: Service return status (suppressed when NULL). @return The assigned instance reference. */ CMPIObjectPath *(*createInstance) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const CMPIInstance * inst, CMPIStatus * rc); /** Replace an existing Instance from <inst> using <op> as reference. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param inst Complete instance. @return Service return status. */ CMPIStatus (*modifyInstance) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const CMPIInstance * inst, const char **properties); /** Delete an existing Instance using <op> as reference. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @return Service return status. */ CMPIStatus (*deleteInstance) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op); /** Query the enumeration of instances of the class (and subclasses) defined by <op> using <query> expression. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace and classname components. @param query Query expression @param lang Query Language @param rc Output: Service return status (suppressed when NULL). @return Resulting eumeration of Instances. */ CMPIEnumeration *(*execQuery) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *query, const char *lang, CMPIStatus * rc); /** Enumerate Instances of the class (and subclasses) defined by <op>. Instance structure and inheritance scope can be controled using the CMPIInvocationFlags entry in <ctx>. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace and classname components. @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return Enumeration of Instances. */ CMPIEnumeration *(*enumerateInstances) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char **properties, CMPIStatus * rc); /** Enumerate instances associated with the Instance defined by the <op>. @param mb Pointer to the broker. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param assocClass If not NULL, MUST be a valid Association Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Instance of this Class or one of its subclasses. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param resultRole If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the returned Object MUST match the value of this parameter). @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return Enumeration of Instances. */ CMPIEnumeration *(*associators) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, const char **properties, CMPIStatus * rc); /** Enumerate ObjectPaths associated with the Instance defined by <op>. @param mb Pointer to the broker. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param assocClass If not NULL, MUST be a valid Association Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Instance of this Class or one of its subclasses. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param resultRole If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the returned Object MUST match the value of this parameter). @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPaths. */ CMPIEnumeration *(*associatorNames) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, CMPIStatus * rc); /** Enumerates the association instances that refer to the instance defined by <op>. @param mb Pointer to the broker. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPaths. */ CMPIEnumeration *(*references) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *resultClass, const char *role, const char **properties, CMPIStatus * rc); /** Enumerates the association ObjectPaths that refer to the instance defined by <op>. @param mb Pointer to the broker. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPaths. */ CMPIEnumeration *(*referenceNames) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *resultClass, const char *role, CMPIStatus * rc); /** Invoke a named, extrinsic method of an Instance defined by the <op> parameter. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param method Method name @param in Input parameters. @param out Output parameters. @param rc Output: Service return status (suppressed when NULL). @return Method return value. */ CMPIData (*invokeMethod) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *method, const CMPIArgs * in, CMPIArgs * out, CMPIStatus * rc); /** Set the named property value of an Instance defined by the <op> parameter. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param name Property name @param value Value. @param type Value type. @return Service return status. */ CMPIStatus (*setProperty) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *name, const CMPIValue * value, CMPIType type); /** Get the named property value of an Instance defined by the <op> parameter. @param mb Pointer to the broker. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param name Property name @param rc Output: Service return status (suppressed when NULL). @return Property value. */ CMPIData (*getProperty) (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *name, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIBrokerExtFT Function Table //-- //--------------------------------------------------- struct timespec; /** This structure is a table of pointers to extended broker CIMOM services This table is made available by the Management Broker, whenever a provider is loaded and initialized. This is an extension used by Pegasus to support platform dependencies. */ struct _CMPIBrokerExtFT { /** Function table version */ int ftVersion; /** This function complements a generic dynamic library nameto its OS-dependent native format. @param filename Pointer to the generic library name, @return The returned char* pointer points to the complemented library name in native OS format. Space for this string has been obtained using malloc() and must be released using free() by the caller. In case no storage could be obtained for the complemented library name, NULL will be returned. */ char *(*resolveFileName) (const char *filename); /** Start a new thread using the POSIX threading semantics. @param start Pointer to the function to be started as a thread. @param param Pointer to the function to be started as a thread. @param detached If not zero, defines that the thread should run in detached mode. @return The return value is the thread ID. */ CMPI_THREAD_TYPE (*newThread) (CMPI_THREAD_RETURN (CMPI_THREAD_CDECL * start) (void *), void *parm, int detached); /** Waits until the specified thread ends using the POSIX threading semantics. @param thread The thread ID of the thread waiting for completion. @param retval Pointer to the return value of the thread. @return Completion code as defined by POSIX threading semantics (pthread_join) */ int (*joinThread) (CMPI_THREAD_TYPE thread, CMPI_THREAD_RETURN * retval); /** Causes the current thread to exit with the passed in return code using POSIX threading semantics. @param return_code Is the return code that should be used for the thread. @return The function never exits. */ int (*exitThread) (CMPI_THREAD_RETURN return_code); /** Cancel the thread using the POSIX threading semantics. @param thread The thread to be canceled. @return Completion code as defined by POSIX threading semantics (pthread_cancel) */ int (*cancelThread) (CMPI_THREAD_TYPE thread); /** Suspends the execution of the current thread for the specified duration. @param msec The suspend duration in milliseconds. @return Completion code as defined by POSIX threading semantics (pthread_sleep) */ int (*threadSleep) (CMPIUint32 msec); /** Executes the specified function procedure only once during the lifetime of the thread. @param once The pointer to the counter. @param The function to be called @return Completion code as defined by POSIX threading semantics (pthread_once) */ int (*threadOnce) (int *once, void (*init) (void)); /* Create a POSIX threading conformant thread key. This key can be used as a key to access the thread local store. @param key The address for the key to be returned. @param cleanup Function to be invoked during thread local store cleanup. @return Completion code as defined by POSIX threading semantics. */ int (*createThreadKey) (CMPI_THREAD_KEY_TYPE * key, void (*cleanup) (void *)); /** Destroy a POSIX threading conformant thread key. @param key The key to be destroyed. @return Completion code as defined by POSIX threading semantics. */ int (*destroyThreadKey) (CMPI_THREAD_KEY_TYPE key); /** Return data from the thread local store using a thread key. @param key The key to be used to retrieve the data. @return Completion code as defined by POSIX threading semantics. */ void *(*getThreadSpecific) (CMPI_THREAD_KEY_TYPE key); /** Set a pointer to data in the therad local store using a thread key. @param key The key to be used. @param value The pointer to the data. @return Completion code as defined by POSIX threading semantics. */ int (*setThreadSpecific) (CMPI_THREAD_KEY_TYPE key, void *value); /** Create a POSIX threading conformant mutex. @param opt The POSIX options. If not options are to be defined the 0 values must be used. @return Handle of newly created mutex. */ CMPI_MUTEX_TYPE (*newMutex) (int opt); /** Destroy a POSIX threading conformant mutex. @param mutex The mutex to be destroyed. */ void (*destroyMutex) (CMPI_MUTEX_TYPE mutex); /** Attempt to get control of the mutex and must wait until released when not available. @param mutex The mutex to be locked. */ void (*lockMutex) (CMPI_MUTEX_TYPE mutex); /** Release control of the mutex. @param mutex The mutex to be unlocked. */ void (*unlockMutex) (CMPI_MUTEX_TYPE mutex); /** Create a new POSIX threading-conformant condition variable. @param opt The POSIX options. If not options are to be defined the 0 values must be used. @return Handle of newly created condition variable. */ CMPI_COND_TYPE (*newCondition) (int opt); /** Destroy a condition variable. @param cond The condition variable to be destroyed. */ void (*destroyCondition) (CMPI_COND_TYPE cond); /** Wait until condition is signalled. This function returns when condition has been signalled already and otherwise must wait for the signal and then return. @param cond The handle of the condition variable to be used. @param mutex The handle of a locked mutex guarding this condition variable. @return Return value As defined by POSIX threading specifications. */ int (*condWait) (CMPI_COND_TYPE cond, CMPI_MUTEX_TYPE mutex); /** Wait until the condition is signalled using a timeout value. This function shall return when condition has been signalled already and otherwise must wait for the signal and then return. The function shall return when the timeout specification elapses before the condition is signalled. @param cond Specifies the handle of the condition variable to be used. @param mutex Specifies the handle of a locked mutex guarding this condition variable. @param wait Specifies the timeout value. @return As defined by POSIX threading specifications. */ int (*timedCondWait) (CMPI_COND_TYPE cond, CMPI_MUTEX_TYPE mutex, struct timespec * wait); /** Sends a signal to a condition variable. @param cond Specifies the handle of the condition variable to send the signal. @return As defined by POSIX threading specifications. */ int (*signalCondition) (CMPI_COND_TYPE cond); }; # if defined (CMPI_VER_200) //--------------------------------------------------- //-- // _CMPIBroker Memory Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers to memory specific  CIMOM services. This table is made available by the Management Broker, whenever a provider is loaded and initialized. This is an extension used by CIMOMs to support memory management enhancements. */ struct _CMPIBrokerMemFT { const int ftVersion; /** Returns a marker. Invoking this function marks subsequent newly created CMPI objects to be released when release() function is invoked. Note: mark() functions can be stacked. @param mb The broker. @param rc Output: Service return status (suppressed when NULL). @return Handle to be provided to releae() function. � */ CMPIGcStat *(*mark) (const CMPIBroker * mb, CMPIStatus * rc); /** Release all CMPI objects created since last mark() operation represented by the parameter. release() functions can be stacked. @param mb The broker. @param gc The handle returned from the mark() operation. @return Service return status. */ CMPIStatus (*release) (const CMPIBroker * mb, const CMPIGcStat * gc); /** Allocates uninitalized memory of the specified size. @param mb Specifies the broker. @param�size Specifies the amount of memory to allocate. @return Returns a pointer to the allocated memory, or NULL if the memory could not be allocated */ void *(*cmpiMalloc) (const CMPIBroker * mb, size_t size); /** This function shall return a pointer to the allocated memory, the memory will be initialized to zero. @param mb The broker. @param nElems The number of elements to allocate. @param sizeElem The number of elements to allocate. @return Returns a pointer to the allocated memory, or NULL if the memory could not be allocated */ void *(*cmpiCalloc) (const CMPIBroker * mb, size_t, size_t); /** This function changes the size of the memory block pointed to by ptr which must have been returned by a previous call to cmpiMalloc or cmpiCalloc. See the ANSI-C function realloc for more information @param mb the broker. @param ptr Pointer to previosuly allocated memory. Passing a pointer to this function which was not allocated explicitly by cmpiMalloc or cmpiCalloc is undefined. @param size The new size of the memory block. @return Returns a pointer to the newly allocated memory block, or NULL if the new memory is not allcoated. If the function fals nothing is done with the original ptr argument. */ void *(*cmpiRealloc) (const CMPIBroker * mb, void *, size_t); /** This function returns a pointer to a new string which is a duplicate of the string src. @param mb The broker @param src The string to duplicate @return a pointer to the duplicated string, or NULL if insufficient memory was available. */ char *(*cmpiStrDup) (const CMPIBroker * mb, const char *); /** This function frees memory allocated via the cmpiMalloc, cmpiCalloc or cmpiRealloc functions. @param�mb The broker. @param ptr The memory to free. This memory MUST have been allocated via the cmpiMalloc, cmpiCalloc or cmpiRealloc functions. @return None */ void (*cmpiFree) (const CMPIBroker * mb, void *); /** Allows a MI to free memory associated to a CMPIinstance which was allocated via CMPIBrokerEncFT.newInstance. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects (e.g. properties). @param mb the broker. @parma inst The instance to free. @return None */ void (*freeInstance) (const CMPIBroker * mb, CMPIInstance * inst); /** Allows a MI to free memory associated to a CMPIArgs which was allocated via CMPIBrokerEncFT.newArgs. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects. @param mb the broker. @param obj The object path to free. @return None */ void (*freeObjectPath) (const CMPIBroker * mb, CMPIObjectPath * obj); /** Allows a MI to free memory associated to a CMPIArgs which was allocated via CMPIBrokerEncFT.newArgs. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects. @param mb the broker. @param args The argument to free. @return None. */ void (*freeArgs) (const CMPIBroker * mb, CMPIArgs * args); /** Allows a MI to free memory associated to a CMPIString which was allocated via CMPIBrokerEncFT.newString. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects. @param mb the broker. @param args The string to free. @return None. */ void (*freeString) (const CMPIBroker * mb, CMPIString * str); /** Allows a MI to free memory associated to a CMPIArray which was allocated via CMPIBrokerEncFT.newArray. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects (e.g. the array elements). @param mb the broker. @param args The string to free. @return None. */ void (*freeArray) (const CMPIBroker * mb, CMPIArray * array); /** Allows a MI to free memory associated to a CMPIDateTime which was allocated via CMPIBrokerEncFT.newDateTime functions. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects. @param mb the broker. @param args The string to free. @return None. */ void (*freeDateTime) (const CMPIBroker * mb, CMPIDateTime * date); /** Allows a MI to free memory associated to a CMPISelectExp which was allocated via CMPIBrokerEncFT.newSelectExp functions. this function should be called when an instance is no longer being used by the MI. This function will free all contained objects. @param mb the broker. @param args The string to free. @return None. */ void (*freeSelectExp) (const CMPIBroker * mb, CMPISelectExp * se); }; # endif //--------------------------------------------------- //-- // _CMPIBroker Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Management Broker (CIM Object Manager). */ struct _CMPIBroker { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to MB service routines function table. */ CMPIBrokerFT *bft; /** Pointer to MB factory service routines function table. */ CMPIBrokerEncFT *eft; /** Pointer to MB extended services function table. */ CMPIBrokerExtFT *xft; # ifdef CMPI_VER_200 /** Pointer to MB memory enhancements function table. */ CMPIBrokerMemFT *mft; # endif }; //--------------------------------------------------- //-- // _CMPIContext Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Context support sevices. */ struct _CMPIContextFT { /** Function table version */ int ftVersion; /** The Context object will not be used any further and may be freed by CMPI run time system. @param ctx Context this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIContext * ctx); /** Create an independent copy of the Context object. @param ctx Context this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Context object. */ CMPIContext *(*clone) (const CMPIContext * ctx, CMPIStatus * rc); /** Gets a named Context entry value. @param ctx Context this pointer. @param name Context entry name. @param rc Output: Service return status (suppressed when NULL). @return Entry value. */ CMPIData (*getEntry) (const CMPIContext * ctx, const char *name, CMPIStatus * rc); /** Gets a Context entry value defined by its index. @param ctx Context this pointer. @param index Position in the internal Data array. @param name Output: Returned Context entry name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Entry value. */ CMPIData (*getEntryAt) (const CMPIContext * ctx, CMPICount index, CMPIString ** name, CMPIStatus * rc); /** Gets the number of entries contained in this Context. @param ctx Context this pointer. @return Number of entries. */ CMPICount (*getEntryCount) (const CMPIContext * ctx, CMPIStatus * rc); /** Adds/replaces a named Context entry. @param ctx Context this pointer. @param name Entry name. @param value Address of value structure. @param type Value type. @return Service return status. */ CMPIStatus (*addEntry) (const CMPIContext * ctx, const char *name, const CMPIValue * value, const CMPIType type); }; //--------------------------------------------------- //-- // _CMPIContext Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Context object. */ struct _CMPIContext { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Context Function Table. */ CMPIContextFT *ft; }; //--------------------------------------------------- //-- // _CMPIResult Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Result object. */ struct _CMPIResult { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Result Function Table. */ CMPIResultFT *ft; }; //--------------------------------------------------- //-- // _CMPIResult Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Result support sevices. Result support services are used to explicity return data produced by provider functions. */ struct _CMPIResultFT { /** Function table version */ int ftVersion; /** The Result object will not be used any further and may be freed by CMPI run time system. @param rslt Result this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIResult * rslt); /** Create an independent copy of this Result object. @param rslt Result this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Result object. */ CMPIResult *(*clone) (const CMPIResult * rslt, CMPIStatus * rc); /** Return a value/type pair. @param rslt Result this pointer. @param value Address of a Value object. @param type Type of the Value object. @return Service return status. */ CMPIStatus (*returnData) (const CMPIResult * rslt, const CMPIValue * value, const CMPIType type); /** Return a Instance object. @param rslt Result this pointer. @param inst Instance to be returned. @return Service return status. */ CMPIStatus (*returnInstance) (const CMPIResult * rslt, const CMPIInstance * inst); /** Return a ObjectPath object. @param rslt Result this pointer. @param ref ObjectPath to be returned. @return Service return status. */ CMPIStatus (*returnObjectPath) (const CMPIResult * rslt, const CMPIObjectPath * ref); /** Indicates no further data to be returned. @param rslt Result this pointer. @return Service return status. */ CMPIStatus (*returnDone) (const CMPIResult * rslt); # ifdef CMPI_VER_200 /** Return a CMPIError object instance @param rslt Result this pointer. @param er Error to be returned. @return Service return status. */ CMPIStatus (*returnError)(const CMPIResult* rslt, const CMPIError* er); # endif }; # ifdef CMPI_VER_200 struct _CMPIError { void *hdl; CMPIErrorFT *ft; }; //--------------------------------------------------- //-- // _CMPIErrorFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Error support services. */ struct _CMPIErrorFT { /** Function table version */ CMPISint32 ftVersion; /** The Error object will not be used any further and may be freed by CMPI run time system. @param er Error this pointer. @return Service return status. */ CMPIStatus (*release)(CMPIError*); /** Create an independent copy of this Error object. @param er Error this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Error object. */ CMPIError* (*clone)(const CMPIError*, CMPIStatus*); /** Gets the type of this Error @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return the error type this Error object conatins */ CMPIErrorType (*getErrorType)(const CMPIError*, CMPIStatus*); /** Returns a string which describes the alternate error type. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getOtherErrorType)(const CMPIError*, CMPIStatus*); /** Returns a string which describes the owneing entity @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getOwningEntity)(const CMPIError*, CMPIStatus*); /** Returns a string which is the message ID. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getMessageID)(const CMPIError*, CMPIStatus*); /** Returns a string comnating an error message. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getMessage)(const CMPIError*, CMPIStatus*); /** Returns the perceieved severity of this error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return the perceived severity */ CMPIErrorSeverity (*getPerceivedSeverity)(const CMPIError*, CMPIStatus*); /** Returns the probable cause of this error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A probable cause value */ CMPIErrorProbableCause (*getProbableCause)(const CMPIError*, CMPIStatus*); /** Returns a string which describes the probable cause. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getProbableCauseDescription)(const CMPIError*, CMPIStatus*); /** Returns an array of strings which describes recomended actions. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A array of strings, which can be NULL */ CMPIArray* (*getRecommendedActions)(const CMPIError*, CMPIStatus*); /** Returns a string which describes the Error source. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getErrorSource)(const CMPIError*, CMPIStatus*); /** Returns a the format that the error src is in. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A error source format code */ CMPIErrorSrcFormat (*getErrorSourceFormat)(const CMPIError*, CMPIStatus*); /** Returns a string which describes the 'other' format, only available if the error source is OTHER. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getOtherErrorSourceFormat)(const CMPIError*, CMPIStatus*); /** Returns the status code of this error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A CMPI Status code */ CMPIrc (*getCIMStatusCode)(const CMPIError*, CMPIStatus*); /** Returns a string which describes the status code error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ CMPIString* (*getCIMStatusCodeDescription)(const CMPIError*, CMPIStatus*); /** Returns an array which contains the dynamic content of the message. @param er The Error this pointer @param rc Output: Serbice return status (surpressed when NULL) @return An array of CMPIStrings which represents the dynamic values */ CMPIArray* (*getMessageArguments)(const CMPIError*, CMPIStatus*); /** Sets the error type of this error object. @param er Error this pointer @param et The error type @return Output: Service return status */ CMPIStatus (*setErrorType)(CMPIError*, const CMPIErrorType); /** Sets the 'other' error type of this error object. @param er Error this pointer @param oet A string which describes the error type, it is only valis when error type is "OTHER" @return Output: Service return status */ CMPIStatus (*setOtherErrorType)(CMPIError*, const char *); /** Sets the description of the probable cause. @param er Error this pointer @param pc The probable cause string @return Output: Service return status */ CMPIStatus (*setProbableCauseDescription)(CMPIError*, const char *); /** Sets the recomended actions array. @param er Error this pointer @param ar An array of strings describing actions that shoudl be taken to deal with this error @return Output: Service return status */ CMPIStatus (*setRecommendedActions)(CMPIError*, const CMPIArray*); /** Specifies a string which specifes The identifying information of the entity (i.e., the instance) generating the error.. @param er Error this pointer @param es the string which describes the source @return Output: Service return status */ CMPIStatus (*setErrorSource)(CMPIError*, const char*); /** Sets the source format of the error object @param er Error this pointer @param esf the string which describes the source format @return Output: Service return status */ CMPIStatus (*setErrorSourceFormat)(CMPIError*, const CMPIErrorSrcFormat ); /** specifies A string defining "Other" values for ErrorSourceFormat @param er Error this pointer @param oef the string which describes the other source format @return Output: Service return status */ CMPIStatus (*setOtherErrorSourceFormat)(CMPIError*, const char*); /** Sets the description of the status code. @param er Error this pointer @param scd A string whcih describes the status code. @return Output: Service return status */ CMPIStatus (*setCIMStatusCodeDescription)(CMPIError*, const char*); /** Sets an array of strings for the dynamic content of the message @param er Error this pointer @param values Specifies an array of CMPIStrings containing the dynamic content of the message. @return Service return status */ CMPIStatus (*setMessageArguments)(CMPIError*, CMPIArray*); }; # endif /* CMPI_VER_200 */ //--------------------------------------------------- //-- // _CMPIInstance Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Instance object. */ struct _CMPIInstance { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Instance Function Table. */ CMPIInstanceFT *ft; }; //--------------------------------------------------- //-- // _CMPIInstance Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Instance support sevices. */ struct _CMPIInstanceFT { /** Function table version */ int ftVersion; /** The Instance object will not be used any further and may be freed by CMPI run time system. This will also release the contained objects. @param inst Instance this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIInstance * inst); /** Create an independent copy of this Instance object. The resulting object must be released explicitly. @param inst Instance this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Instance object. */ CMPIInstance *(*clone) (const CMPIInstance * inst, CMPIStatus * rc); /** Gets a named property value. @param inst Instance this pointer. @param name Property name. @param rc Output: Service return status (suppressed when NULL). @return Property value. */ CMPIData (*getProperty) (const CMPIInstance * inst, const char *name, CMPIStatus * rc); /** Gets a Property value defined by its index. @param inst Instance this pointer. @param index Position in the internal Data array. @param name Output: Returned property name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Property value. */ CMPIData (*getPropertyAt) (const CMPIInstance * inst, CMPICount index, CMPIString ** name, CMPIStatus * rc); /** Gets the number of properties contained in this Instance. @param inst Instance this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of properties. */ CMPICount (*getPropertyCount) (const CMPIInstance * inst, CMPIStatus * rc); /** Adds/replaces a named Property. @param inst Instance this pointer. @param name Entry name. @param value Address of value structure. @param type Value type. @return Service return status. */ CMPIStatus (*setProperty) (const CMPIInstance * inst, const char *name, const CMPIValue * value, CMPIType type); /** Generates an ObjectPath out of the namespace, classname and key propeties of this Instance. @param inst Instance this pointer. @param rc Output: Service return status (suppressed when NULL). @return the generated ObjectPath. */ CMPIObjectPath *(*getObjectPath) (const CMPIInstance * inst, CMPIStatus * rc); /** Directs CMPI to ignore any setProperty operations for this instance for any properties not in this list. @param inst Instance this pointer. @param propertyList If not NULL, the members of the array define one or more Property names to be accepted by setProperty operations. @param keys Deprecated, ignored by MB, maintained here for compatibility. @return Service return status. */ CMPIStatus (*setPropertyFilter) (CMPIInstance * inst, const char **propertyList, const char **keys); /** Set/replace the ObjectPath component in an instance. @param inst The CMPIInstance structure containing a complete instance. @parmm op The CMPIObjectPath structure. This objectpath shall contain the namespace,classname, as well as all keys for the specified instance. @return Service return status. */ CMPIStatus (*setObjectPath) (CMPIInstance * inst, const CMPIObjectPath * op); #ifdef CMPI_VER_200 /** add/replace a named Property value and origin @param inst is a pointer to the CMPIInstance structure. @param name is a string containing the Property name. @param value points to a CMPIValue structure containing the value to be assigned to the Property. @param type is a CMPIType structure defining the type of the value. @param origin specifies the instance origin. If NULL, then no origin is attached to the property @return Service return status */ CMPIStatus (*setPropertyWithOrigin)(const CMPIInstance*, const char*, const CMPIValue*, const CMPIType, const char*); #endif /* CMPI_VER_200 */ }; //--------------------------------------------------- //-- // _CMPIObjectPath Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Instance object. */ struct _CMPIObjectPath { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the ObjectPath Function Table. */ CMPIObjectPathFT *ft; }; //--------------------------------------------------- //-- // _CMPIObjectPath Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to ObjectPath support sevices. */ struct _CMPIObjectPathFT { /** Function table version */ int ftVersion; /** The ObjectPath object will not be used any further and may be freed by CMPI run time system. @param op ObjectPath this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIObjectPath * op); /** Create an independent copy of this ObjectPath object. The resulting object must be released explicitly. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied ObjectPath object. */ CMPIObjectPath *(*clone) (const CMPIObjectPath * op, CMPIStatus * rc); /** Set/replace the namespace component. @param op ObjectPath this pointer. @param ns The namespace string @return Service return status. */ CMPIStatus (*setNameSpace) (CMPIObjectPath * op, const char *ns); /** Get the namespace component. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return The namespace component. */ CMPIString *(*getNameSpace) (const CMPIObjectPath * op, CMPIStatus * rc); /** Set/replace the hostname component. @param op ObjectPath this pointer. @param hn The hostname string @return Service return status. */ CMPIStatus (*setHostname) (CMPIObjectPath * op, const char *hn); /** Get the hostname component. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return The hostname component. */ CMPIString *(*getHostname) (const CMPIObjectPath * op, CMPIStatus * rc); /** Set/replace the classname component. @param op ObjectPath this pointer. @param cn The hostname string @return Service return status. */ CMPIStatus (*setClassName) (CMPIObjectPath * op, const char *cn); /** Get the classname component. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return The classname component. */ CMPIString *(*getClassName) (const CMPIObjectPath * op, CMPIStatus * rc); /** Adds/replaces a named key property. @param op ObjectPath this pointer. @param name Key property name. @param value Address of value structure. @param type Value type. @return Service return status. */ CMPIStatus (*addKey) (CMPIObjectPath * op, const char *name, const CMPIValue * value, const CMPIType type); /** Gets a named key property value. @param op ObjectPath this pointer. @param name Key property name. @param rc Output: Service return status (suppressed when NULL). @return Entry value. */ CMPIData (*getKey) (const CMPIObjectPath * op, const char *name, CMPIStatus * rc); /** Gets a key property value defined by its index. @param op ObjectPath this pointer. @param index Position in the internal Data array. @param name Output: Returned property name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Data value. */ CMPIData (*getKeyAt) (const CMPIObjectPath * op, CMPICount index, CMPIString ** name, CMPIStatus * rc); /** Gets the number of key properties contained in this ObjectPath. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of properties. */ CMPICount (*getKeyCount) (const CMPIObjectPath * op, CMPIStatus * rc); /** Set/replace namespace and classname components from <src>. @param op ObjectPath this pointer. @param src Source input. @return Service return status. */ CMPIStatus (*setNameSpaceFromObjectPath) (CMPIObjectPath * op, const CMPIObjectPath * src); /** Set/replace hostname, namespace and classname components from <src>. @param op ObjectPath this pointer. @param src Source input. @return Service return status. */ CMPIStatus (*setHostAndNameSpaceFromObjectPath) (CMPIObjectPath * op, const CMPIObjectPath * src); // optional qualifier support /** Get class qualifier value. @param op ObjectPath this pointer. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ CMPIData (*getClassQualifier) (const CMPIObjectPath * op, const char *qName, CMPIStatus * rc); /** Get property qualifier value. @param op ObjectPath this pointer. @param pName Property name. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ CMPIData (*getPropertyQualifier) (const CMPIObjectPath * op, const char *pName, const char *qName, CMPIStatus * rc); /** Get method qualifier value. @param op ObjectPath this pointer. @param mName Method name. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ CMPIData (*getMethodQualifier) (const CMPIObjectPath * op, const char *methodName, const char *qName, CMPIStatus * rc); /** Get method parameter quailifier value. @param op ObjectPath this pointer. @param mName Method name. @param pName Parameter name. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ CMPIData (*getParameterQualifier) (const CMPIObjectPath * op, const char *mName, const char *pName, const char *qName, CMPIStatus * rc); /** Generates a well formed string representation of this ObjectPath @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return String representation. */ CMPIString *(*toString) (const CMPIObjectPath * op, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPISelectExp Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated SelectExp object. */ struct _CMPISelectExp { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the SelExp Function Table. */ CMPISelectExpFT *ft; }; //--------------------------------------------------- //-- // _CMPISelectExpFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to SelectExp support sevices. */ struct _CMPISelectExpFT { /** Function table version */ int ftVersion; /** The SelectExp object will not be used any further and may be freed by CMPI run time system. @param se SelectExp this pointer. @return Service return status. */ CMPIStatus (*release) (CMPISelectExp * se); /** Create an independent copy of this SelectExp object. The resulting object must be released explicitly. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied SelectExp object. */ CMPISelectExp *(*clone) (const CMPISelectExp * se, CMPIStatus * rc); /** Evaluate the instance using this select expression. @param se SelectExp this pointer. @param inst Instance to be evaluated. @param rc Output: Service return status (suppressed when NULL). @return True or false incicator. */ CMPIBoolean (*evaluate) (const CMPISelectExp * se, const CMPIInstance * inst, CMPIStatus * rc); /** Return the select expression in string format. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return The select expression. */ CMPIString *(*getString) (const CMPISelectExp * se, CMPIStatus * rc); /** Return the select expression as disjunction of conjunctions. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return The disjunction. */ CMPISelectCond *(*getDOC) (const CMPISelectExp * se, CMPIStatus * rc); /** Return the select expression as conjunction of disjunctions. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return The conjunction. */ CMPISelectCond *(*getCOD) (const CMPISelectExp * se, CMPIStatus * rc); /** Evaluate this select expression by using a data value accessor routine. @param se SelectExp this pointer. @param accessor Address of data accessor routine. @param parm Data accessor routine parameter. @param rc Output: Service return status (suppressed when NULL). @return True or false incicator. */ CMPIBoolean (*evaluateUsingAccessor) (const CMPISelectExp * se, CMPIAccessor * accessor, void *parm, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPISelectCond Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated SelectCond object. */ struct _CMPISelectCond { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the SelCond Function Table. */ CMPISelectCondFT *ft; }; //--------------------------------------------------- //-- // _CMPISelectCondFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to SelectCond support sevices. */ struct _CMPISelectCondFT { /** Function table version */ const int ftVersion; /** The SelectCond object will not be used any further and may be freed by CMPI run time system. @param sc SelectCond this pointer. @return Service return status. */ CMPIStatus (*release) (CMPISelectCond * sc); /** Create an independent copy of this SelectCond object. The resulting object must be released explicitly. @param sc SelectCond this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied SelectExp object. */ CMPISelectCond *(*clone) (const CMPISelectCond * sc, CMPIStatus * rc); /** Return the number of sub conditions that are part of this SelectCond. Optionally, the SelectCond type (COD or DOC) will be returned. @param sc SelectCond this pointer. @param type Output: SelectCond type (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Number of SubCond elements. */ CMPICount (*getCountAndType) (const CMPISelectCond * sc, int* type, CMPIStatus * rc); /** Return a SubCond element based on its index. @param sc SelectCond this pointer. @param index Position in the internal SubCoind array. @param rc Output: Service return status (suppressed when NULL). @return The indexed SubCond element. */ CMPISubCond *(*getSubCondAt) (const CMPISelectCond * sc, CMPICount index, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPISubCond Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated SubCond object. */ struct _CMPISubCond { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the SubCond Function Table. */ CMPISubCondFT *ft; }; //--------------------------------------------------- //-- // _CMPISubCondFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to SubCond support sevices. */ struct _CMPISubCondFT { /** Function table version */ int ftVersion; /** The SubCond object will not be used any further and may be freed by CMPI run time system. @param sc SubCond this pointer. @return Service return status. */ CMPIStatus (*release) (CMPISubCond * sc); /** Create an independent copy of this SubCond object. The resulting object must be released explicitly. @param se SubCond this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied SelectExp object. */ CMPISubCond *(*clone) (const CMPISubCond * sc, CMPIStatus * rc); /** Return the number of predicates that are part of sub condition. @param sc SubCond this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of Predicate elements. */ CMPICount (*getCount) (const CMPISubCond * sc, CMPIStatus * rc); /** Return a Predicate element based on its index. @param sc SubCond this pointer. @param index Position in the internal Predicate array. @param rc Output: Service return status (suppressed when NULL). @return The indexed Predicate element. */ CMPIPredicate *(*getPredicateAt) (const CMPISubCond * sc, CMPICount index, CMPIStatus * rc); /** Return a named Predicate element. @param sc SubCond this pointer. @param name Predicate name (property name). @param rc Output: Service return status (suppressed when NULL). @return The named Predicate element. */ CMPIPredicate *(*getPredicate) (const CMPISubCond * sc, const char *name, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIPredicate Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Predicate object. */ struct _CMPIPredicate { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Predicate Function Table. */ CMPIPredicateFT *ft; }; //--------------------------------------------------- //-- // _CMPIPredicateFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to SubCond support sevices. */ struct _CMPIPredicateFT { /** Function table version */ int ftVersion; /** The Predicate object will not be used any further and may be freed by CMPI run time system. @param pr Predicate this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIPredicate * pr); /** Create an independent copy of this Predicate object. The resulting object must be released explicitly. @param pr Predicate this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Predicate object. */ CMPIPredicate *(*clone) (const CMPIPredicate * pr, CMPIStatus * rc); /** Get the predicate components. @param pr Predicate this pointer. @param type Property type. @param op Predicate operation. @param lhs Left hand side of predicate. @param rhs Right hand side of predicate. @return Service return status. */ CMPIStatus (*getData) (const CMPIPredicate * pr, CMPIType * type, CMPIPredOp * op, CMPIString ** lhs, CMPIString ** rhs); /** Evaluate the predicate using a property data accessor function. @param pr Predicate this pointer. @param accessorFnc Pointer to a property value accessor function. The evaluation process will invoke this function to request a CMPIData structure for a particular property. The signature of the accessor function is: CMPIData CMPIAccessor(const char* propertyName, void* parm); @param parm Parameter that will be passed to the accessor function and can be used for providing context data to the accessor function. @param rc Output: Service return status (suppressed when NULL). @return Evaluation result. */ CMPIBoolean (*evaluateUsingAccessor) (const CMPIPredicate * pr, CMPIAccessor * accessorFnc, void *parm, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIArgs Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Args object. */ struct _CMPIArgs { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Args Function Table. */ CMPIArgsFT *ft; }; //--------------------------------------------------- //-- // _CMPIArgsFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Args support sevices. */ struct _CMPIArgsFT { /** Function table version */ int ftVersion; /** The Args object will not be used any further and may be freed by CMPI run time system. @param as Args this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIArgs * as); /** Create an independent copy of this Args object. The resulting object must be released explicitly. @param as Args this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Args object. */ CMPIArgs *(*clone) (const CMPIArgs * as, CMPIStatus * rc); /** Adds/replaces a named argument. @param as Args this pointer. @param name Argument name. @param value Address of value structure. @param type Value type. @return Service return status. */ CMPIStatus (*addArg) (const CMPIArgs * as, const char *name, const CMPIValue * value, const CMPIType type); /** Gets a named argument value. @param as Args this pointer. @param name Argument name. @param rc Output: Service return status (suppressed when NULL). @return Argument value. */ CMPIData (*getArg) (const CMPIArgs * as, const char *name, CMPIStatus * rc); /** Gets a Argument value defined by its index. @param as Args this pointer. @param index Position in the internal Data array. @param name Output: Returned argument name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Argument value. */ CMPIData (*getArgAt) (const CMPIArgs * as, CMPICount index, CMPIString ** name, CMPIStatus * rc); /** Gets the number of arguments contained in this Args. @param as Args this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of properties. */ CMPICount (*getArgCount) (const CMPIArgs * as, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIString Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated String object. */ struct _CMPIString { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the String Function Table. */ CMPIStringFT *ft; }; //--------------------------------------------------- //-- // _CMPIStringFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to String support sevices. */ struct _CMPIStringFT { /** Function table version */ int ftVersion; /** The String object will not be used any further and may be freed by CMPI run time system. @param st String this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIString * st); /** Create an independent copy of this String object. The resulting object must be released explicitly. @param st String this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied String object. */ CMPIString *(*clone) (const CMPIString * st, CMPIStatus * rc); /** Get a pointer to a C char *representation of this String. @param st String this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to char *representation. */ const char *(*getCharPtr) (const CMPIString * st, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIArray Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Array object. */ struct _CMPIArray { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Array Function Table. */ CMPIArrayFT *ft; }; //--------------------------------------------------- //-- // _CMPIArrayFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Array support sevices. */ struct _CMPIArrayFT { /** Function table version */ int ftVersion; /** The Array object will not be used any further and may be freed by CMPI run time system. @param ar Array this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIArray * ar); /** Create an independent copy of this Array object. The resulting object must be released explicitly. @param ar Array this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Array object. */ CMPIArray *(*clone) (const CMPIArray * ar, CMPIStatus * rc); /** Gets the number of elements contained in this Array. @param ar Array this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of elements. */ CMPICount (*getSize) (const CMPIArray * ar, CMPIStatus * rc); /** Gets the element type. @param ar Array this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of elements. */ CMPIType (*getSimpleType) (const CMPIArray * ar, CMPIStatus * rc); /** Gets an element value defined by its index. @param ar Array this pointer. @param index Position in the internal Data array. @param rc Output: Service return status (suppressed when NULL). @return Element value. */ CMPIData (*getElementAt) (const CMPIArray * ar, CMPICount index, CMPIStatus * rc); /** Sets an element value defined by its index. @param ar Array this pointer. @param index Position in the internal Data array. @param value Address of value structure. @param type Value type. @return Service return status. */ CMPIStatus (*setElementAt) (CMPIArray * ar, CMPICount index, const CMPIValue * value, CMPIType type); }; //--------------------------------------------------- //-- // _CMPIEnumeration Encapsulated object //-- //--------------------------------------------------- /** This structure represents the Encapsulated Enumeration object. */ struct _CMPIEnumeration { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the Enumeration Function Table. */ CMPIEnumerationFT *ft; }; //--------------------------------------------------- //-- // _CMPIEnumerationFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Enumeration support sevices. */ struct _CMPIEnumerationFT { /** Function table version */ int ftVersion; /** The Enumeration object will not be used any further and may be freed by CMPI run time system. @param en Enumeration this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIEnumeration * en); /** Create an independent copy of this Enumeration object. The resulting object must be released explicitly. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied Enumeration object. */ CMPIEnumeration *(*clone) (const CMPIEnumeration * en, CMPIStatus * rc); /** Get the next element of this Enumeration. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return Element value. */ CMPIData (*getNext) (const CMPIEnumeration * en, CMPIStatus * rc); /** Test for any elements left in this Enumeration. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return True or false. */ CMPIBoolean (*hasNext) (const CMPIEnumeration * en, CMPIStatus * rc); /** Convert this Enumeration into an Array. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return The Array. */ CMPIArray *(*toArray) (const CMPIEnumeration * en, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIDateTime Encapsulated object //-- //--------------------------------------------------- /** This structure represents the DateTime object. */ struct _CMPIDateTime { /** Opaque pointer to MB specific implementation data. */ void *hdl; /** Pointer to the DateTime Function Table. */ CMPIDateTimeFT *ft; }; //--------------------------------------------------- //-- // _CMPIDateTimeFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to DateTime support sevices. */ struct _CMPIDateTimeFT { /** Function table version */ int ftVersion; /** The DateTime object will not be used any further and may be freed by CMPI run time system. @param dt DateTime this pointer. @return Service return status. */ CMPIStatus (*release) (CMPIDateTime * dt); /** Create an independent copy of this DateTime object. The resulting object must be released explicitly. @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to copied DateTime object. */ CMPIDateTime *(*clone) (const CMPIDateTime * dt, CMPIStatus * rc); /** Get DateTime setting in binary format (in microsecods starting since 00:00:00 GMT, Jan 1,1970). @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return DateTime in binary. */ CMPIUint64 (*getBinaryFormat) (const CMPIDateTime * dt, CMPIStatus * rc); /** Get DateTime setting in UTC string format. @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return DateTime as UTC string. */ CMPIString *(*getStringFormat) (const CMPIDateTime * dt, CMPIStatus * rc); /** Tests whether DateTime is an interval value. @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return True if interval value. */ CMPIBoolean (*isInterval) (const CMPIDateTime * dt, CMPIStatus * rc); }; //--------------------------------------------------- //-- // _CMPIInstanceMI Instance Provider object //-- //--------------------------------------------------- /** This structure represents an Instance provider. */ typedef struct _CMPIInstanceMIFT CMPIInstanceMIFT; typedef struct _CMPIInstanceMI { /** Opaque pointer to Provider specific implementation data. */ const void *hdl; /** Pointer to the Instance Provider Function Table. */ CMPIInstanceMIFT *ft; } CMPIInstanceMI; //--------------------------------------------------- //-- // _CMPIInstanceMIFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Instance provider functions. This table must be returend during initialization by the provider. */ struct _CMPIInstanceMIFT { /** Function table version */ int ftVersion; /** Provider version */ int miVersion; /** Provider name */ const char *miName; /** The CMPIInstanceMIFT.cleanup() function shall perform any necessary cleanup operation prior to the unloading of the library of which this MI group is part. This function is called prior to the unloading of the provider. @param mi The mi argument is a pointer to a CMPIInstanceMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param terminating When true, the terminating argument indicates that the MB is in the process of terminating and that cleanup must be done. When set to false, the MI may respond with CMPI_IRC_DO_NOT_UNLOAD, or CMPI_IRC_NEVER_UNLOAD, indicating that unload will interfere with current MI processing. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_DO_NOT_UNLOAD Operation successful - do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful - never unload.o */ CMPIStatus (*cleanup) (CMPIInstanceMI * mi, const CMPIContext * ctx, CMPIBoolean terminating); /** Enumerate ObjectPaths of Instances serviced by this provider. @param mi Provider this pointer. @param ctx Invocation Context. @param rslt Result data container. @param op ObjectPath containing namespace and classname components. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*enumerateInstanceNames) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op); /** Enumerate the Instances serviced by this provider. @param mi Provider this pointer. @param ctx Invocation Context. @param rslt Result data container. @param op ObjectPath containing namespace and classname components. @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*enumerateInstances) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char **properties); /** Get the Instances defined by <op>. @param mi Provider this pointer. @param ctx Invocation Context. @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*getInstance) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char **properties); /** Create Instance from <inst> using <op> as reference. @param mi Provider this pointer. @param ctx Invocation Context. @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @param inst The Instance. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ALREADY_EXISTS Instance already exists. */ CMPIStatus (*createInstance) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const CMPIInstance * inst); /** Replace an existing Instance from <inst> using <op> as reference. @param mi Provider this pointer. @param ctx Invocation Context. @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @param inst The Instance. @param properties If not NULL, the members of the array define one or more Property names. The process MUST NOT replace elements for any Properties missing from this list. If NULL all properties will be replaced. @return Function return status. */ CMPIStatus (*modifyInstance) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const CMPIInstance * inst, const char **properties); /** Delete an existing Instance defined by <op>. @param mi Provider this pointer. @param ctx Invocation Context. @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*deleteInstance) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op); /** Query the enumeration of instances of the class (and subclasses) defined by <op> using <query> expression. @param mi Provider this pointer. @param ctx Context object @param rslt Result data container. @param op ObjectPath containing namespace and classname components. @param query Query expression @param lang Query language @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_QUERY_LANGUAGE_NOT_SUPPORTED Query language not supported. CMPI_RC_ERR_INVALID_QUERY Invalid query. */ CMPIStatus (*execQuery) (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *query, const char *lang); }; //--------------------------------------------------- //-- // _CMPIAssociationMI Association Provider object //-- //--------------------------------------------------- /** This structure represents an Association provider. */ typedef struct _CMPIAssociationMIFT CMPIAssociationMIFT; typedef struct _CMPIAssociationMI { /** Opaque pointer to Provider specific implementation data. */ void *hdl; /** Pointer to the Association Provider Function Table. */ CMPIAssociationMIFT *ft; } CMPIAssociationMI; //--------------------------------------------------- //-- // _CMPIAssociationMIFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Association provider functions. This table must be returend during initialization by the provider. */ struct _CMPIAssociationMIFT { /** Function table version */ int ftVersion; /** Provider version */ const CMPISint32 miVersion; /** Provider name */ const char *miName; /** Cleanup is called prior to unloading of the provider. This function shall perform any necessary cleanup operations prior to the unloading of the library of which this MI group is part. @param mi This argument is a pointer to a CMPIAssociationMI structure. @param ctx This argument is a pointer to a CMPIContext structure containing the Invocation Context. @param terminating When true, the terminating argument indicates that the MB is in the process of terminating and that cleanup must be done. When set to false, the MI may respond with CMPI_IRC_DO_NOT_UNLOAD, or CMPI_IRC_NEVER_UNLOAD, indicating that unload will interfere with current MI processing. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_DO_NOT_UNLOAD Operation successful - do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful - never unload. */ CMPIStatus (*cleanup) (CMPIAssociationMI * mi, const CMPIContext * ctx, CMPIBoolean terminating); /** Enumerate ObjectPaths associated with the Instance defined by <op>. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op Source ObjectPath containing namespace, classname and key components. @param assocClass If not NULL, MUST be a valid Association Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Instance of this Class or one of its subclasses. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param resultRole If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list. If NULL all properties must be returned. the returned Object MUST match the value of this parameter). @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*associators) (CMPIAssociationMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *asscClass, const char *resultClass, const char *role, const char *resultRole, const char **properties); /** Enumerate ObjectPaths associated with the Instance defined by <op>. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op Source ObjectPath containing namespace, classname and key components. @param assocClass If not NULL, MUST be a valid Association Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Instance of this Class or one of its subclasses. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param resultRole If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the returned Object MUST match the value of this parameter). @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*associatorNames) (CMPIAssociationMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *assocClass, const char *resultClass, const char *role, const char *resultRole); /** Enumerates the association instances that refer to the instance defined by <op>. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op Source ObjectPath containing namespace, classname and key components. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*references) (CMPIAssociationMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *resultClass, const char *role, const char **properties); /** Enumerates the association ObjectPaths that refer to the instance defined by <op>. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op Source ObjectPath containing namespace, classname and key components. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. */ CMPIStatus (*referenceNames) (CMPIAssociationMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *resultClass, const char *role); }; //--------------------------------------------------- //-- // _CMPIMethodMI Method Provider object //-- //--------------------------------------------------- /** This structure represents an Method provider. */ typedef struct _CMPIMethodMIFT CMPIMethodMIFT; typedef struct _CMPIMethodMI { /** Opaque pointer to Provider specific implementation data. */ void *hdl; /** Pointer to the Method Provider Function Table. */ CMPIMethodMIFT *ft; } CMPIMethodMI; //--------------------------------------------------- //-- // _CMPIMethodMIFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Method provider functions. This table must be returend during initialization by the provider. */ struct _CMPIMethodMIFT { /** Function table version */ int ftVersion; /** Provider version */ int miVersion; /** Provider name */ const char *miName; /** The CMPIMethodMIFT.cleanup() function shall perform any necessary cleanup operation prior to the unloading of the library of which this MI group is part. This function is called prior to the unloading of the provider. @param mi The mi argument is a pointer to a CMPIMethodMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param terminating When true, the terminating argument indicates that the MB is in the process of terminating and that cleanup must be done. When set to false, the MI may respond with CMPI_IRC_DO_NOT_UNLOAD, or CMPI_IRC_NEVER_UNLOAD, indicating that unload will interfere with current MI processing. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_DO_NOT_UNLOAD Operation successful - do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful - never unload. */ CMPIStatus (*cleanup) (CMPIMethodMI * mi, const CMPIContext * ctx, CMPIBoolean terminating); /** Invoke a named, extrinsic method of an Instance defined by the <op> parameter. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @param method Method name @param in Input parameters. @param out Output parameters. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_NOT_FOUND Instance not found. CMPI_RC_ERR_METHOD_NOT_AVAILABLE Method not available. CMPI_RC_ERR_METHOD_NOT_FOUND Method not found. */ CMPIStatus (*invokeMethod) (CMPIMethodMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *method, const CMPIArgs * in, CMPIArgs * out); }; //--------------------------------------------------- //-- // _CMPIPropertyMI Property Provider object //-- //--------------------------------------------------- /** This structure represents an Property provider. */ typedef struct _CMPIPropertyMIFT CMPIPropertyMIFT; typedef struct _CMPIPropertyMI { /** Opaque pointer to Provider specific implementation data. */ void *hdl; /** Pointer to the Property Provider Function Table. */ CMPIPropertyMIFT *ft; } CMPIPropertyMI; //--------------------------------------------------- //-- // _CMPIPropertyMIFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Property provider functions. This table must be returend during initialization by the provider. */ struct _CMPIPropertyMIFT { /** Function table version */ int ftVersion; /** Provider version */ int miVersion; /** Provider name */ const char *miName; /** Cleanup is called prior to unloading of the provider. @param mi Provider this pointer. @param ctx Invocation Context @param terminating When true, the terminating argument indicates that the MB is in the process of terminating and that cleanup must be done. When set to false, the MI may respond with CMPI_IRC_DO_NOT_UNLOAD, or CMPI_IRC_NEVER_UNLOAD, indicating that unload will interfere with current MI processing. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_DO_NOT_UNLOAD Operation successful - do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful - never unload. */ CMPIStatus (*cleanup) (CMPIPropertyMI * mi, const CMPIContext * ctx, CMPIBoolean terminating); /** Set the named property value of an Instance defined by the <op> parameter. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @param name Property name @param data Property value. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_TYPE_MISATCH type does not correspond to class-defined type. CMPI_RC_ERR_INVALID_HANDLE The inst handle is invalid. */ CMPIStatus (*setProperty) (CMPIPropertyMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * op, const char *name, const CMPIData data); /** Get the named property value of an Instance defined by the <op> parameter. @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components. @param name Property name @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_INVALID_NAMESPACE The namespace is invalid. CMPI_RC_ERR_INVALID_PARAMETER The parameter is invalid. CMPI_RC_ERR_INVALID_CLASS The CIM class does not exist in the specified namespace. CMPI_RC_ERR_NOT_FOUND Instance not found. CMPI_RC_ERR_NO_SUCH_PROPERTY Entry not found. */ CMPIStatus (*getProperty) (CMPIPropertyMI *, const CMPIContext *, const CMPIResult *, const CMPIObjectPath *, const char *name); #ifdef CMPI_VER_200 /** add/replace a named Property value and origin @param mi Provider this pointer. @param ctx Invocation Context @param rslt Result data container. @param op ObjectPath containing namespace, classname and key components @param name Property name @param data Property value. @param origin specifies the instance origin. If NULL, then no origin is attached to the property @return Service return status */ CMPIStatus (*setPropertyWithOrigin)(CMPIPropertyMI*, const CMPIContext*, const CMPIResult*, CMPIObjectPath * op, const char *name, const CMPIData data, const char*); #endif /* CMPI_VER_200 */ }; //--------------------------------------------------- //-- // _CMPIIndicationMI Indication Provider object //-- //--------------------------------------------------- /** This structure represents an Indication provider. */ typedef struct _CMPIIndicationMIFT CMPIIndicationMIFT; typedef struct _CMPIIndicationMI { /** Opaque pointer to Provider specific implementation data. */ void *hdl; /** Pointer to the Property Provider Function Table. */ CMPIIndicationMIFT *ft; } CMPIIndicationMI; //--------------------------------------------------- //-- // _CMPIIndicationMIFT Function Table //-- //--------------------------------------------------- /** This structure is a table of pointers providing access to Indication provider functions. This table must be returend during initialization by the provider. */ struct _CMPIIndicationMIFT { /** Function table version */ int ftVersion; /** Provider version */ int miVersion; /** Provider name */ const char *miName; /** Cleanup is called prior to unloading of the provider. This function shall perform any necessary cleanup operation prior to the unloading of the library of which this MI group is part. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param terminating When true, the terminating argument indicates that the MB is in the process of terminating and that cleanup must be done. When set to false, the MI may respond with CMPI_RC_DO_NOT_UNLOAD, or CMPI_RC_NEVER_UNLOAD, indicating that unload will interfere with current MI processing. @return Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_DO_NOT_UNLOAD Operation successful do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful never unload */ CMPIStatus (*cleanup) (CMPIIndicationMI * mi, const CMPIContext * ctx, CMPIBoolean terminating); /** Ask the provider to verify whether this filter is allowed. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param filter Contains the filter that must be authorized. @param className Contains the class name extracted from the filter FROM clause. @param op The name of the class for which monitoring is required. Only the namespace part is set if className is a process indication. @param owner The owner argument is the destination owner. @return This function shall structure containing the service return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_INVALID_QUERY Invalid query or too complex. */ CMPIStatus (*authorizeFilter) (CMPIIndicationMI * mi, const CMPIContext * ctx, const CMPISelectExp * filter, const char *className, const CMPIObjectPath * op, const char *owner); /** Ask the MI whether polling mode should be used. This function enables very simple MIs to support indications without providing a complete indication support implementation. When true is returned, the MB will enumerate the instances of this MI at regular intervals and apply indication filters. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param className The class name extracted from the filter FROM clause. @param filter The name of the class for which monitoring is required. Only the namespace part is set if eventType is a process indication. @param classPath The name of the class for which polling would be used. Only the namespace part is set if className is a process indication. @return This function shall return a CMPIStatus structure containing the service return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_INVALID_QUERY Invalid query or too complex. */ CMPIStatus (*mustPoll) (CMPIIndicationMI * mi, const CMPIContext * ctx, const CMPISelectExp * filter, const char *className, const CMPIObjectPath * classPath); /** Ask the provider to begin monitoring a resource. The function shall begin monitoring the resource according to the filter express only. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param filter The filter argument contains the filter specification for this subscription to become active. @param className The class name extracted from the filter FROM clause. @param classPath The name of the class for which monitoring is required. Only the namespace part is set if eventType is a process indication. @param firstActivation Set to true if this is the first filter for className. @return The function shall return a CMPIStatus structure containing the service return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_INVALID_QUERY Invalid query or too complex. */ CMPIStatus (*activateFilter) (CMPIIndicationMI * mi, const CMPIContext * ctx, const CMPISelectExp * filter, const char *className, const CMPIObjectPath * classPath, CMPIBoolean firstActivation); /** Inform the MI that monitoring using this filter should stop. The function invocation mandates the MI to stop monitoring the resource using this filter. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @param filter The filter argument contains the filter specification for this subscription to become active. @param className The class name extracted from the filter FROM clause. @param classPath The name of the class for which monitoring is required. Only the namespace part is set if className is a process indication. @param lastActiviation Set to true if this is the last filter for className. @return The function shall return a CMPIStatus structure containing the service return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. CMPI_RC_ERR_ACCESS_DENIED Not authorized. CMPI_RC_ERR_INVALID_QUERY Invalid query or too complex. */ CMPIStatus (*deActivateFilter) (CMPIIndicationMI * mi, const CMPIContext * ctx, const CMPISelectExp * filter, const char *className, const CMPIObjectPath * classPath, CMPIBoolean lastActiviation); /** Tell the MI that indications can now be generated. The MB is now prepared to process indications. The function is normally called by the MB after having done its intialization and processing of persistent subscription requests. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @return The function shall return a CMPIStatus structure containing the service return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. */ CMPIStatus (*enableIndications) (CMPIIndicationMI * mi, const CMPIContext *); /** Tell the MI to stop generating indications. MB will not accept any indications until enabled again. The function is normally called when the MB is shutting down indication services either temporarily or permanently. @param mi The mi argument is a pointer to a CMPIIndicationMI structure. @param ctx The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. @return The function shall return a CMPIStatus structure containing the service return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. CMPI_RC_ERR_NOT_SUPPORTED Operation not supported by this MI. */ CMPIStatus (*disableIndications) (CMPIIndicationMI * mi, const CMPIContext *); }; # include "cmpimacs.h" # ifdef __cplusplus }; # endif #endif // _CMPIFT_H_ libopendrim-1.1.3/cmpi/cmpipl.h0000644000175000017500000000572411404077256017155 0ustar guillaumeguillaume/* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 2006 The Open Group */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a */ /* copy of this software (the "Software"), to deal in the Software without */ /* restriction, including without limitation the rights to use, copy, */ /* modify, merge, publish, distribute, sublicense, and/or sell copies of */ /* the Software, and to permit persons to whom the Software is furnished */ /* to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included */ /* in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ /* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ /* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /* ------------------------------------------------------------------------- */ #ifndef _CMPIPL_H_ # define _CMPIPL_H_ // There are the following list of platforms # if !defined(CMPI_PLATFORM_LINUX_GENERIC_GNU) && !defined(CMPI_PLATFORM_HPUX_ACC) && \ !defined(CMPI_PLATFORM_WIN32_IX86_MSVC) && !defined(CMPI_PLATFORM_SOLARIS_SPARC_GNU) && \ !defined(CMPI_PLATFORM_SOLARIS_SPARC_CC) && !defined(CMPI_PLATFORM_AIX_RS_IBMCXX) && \ !defined(CMPI_PLATFORM_ZOS_ZSERIES_IBM) && !defined(CMPI_PLATFORM_TRU64_ALPHA_DECCXX) && \ !defined(CMPI_PLATFORM_OS400_ISERIES_IBM) && !defined(CMPI_PLATFORM_DARWIN_PPC_GNU) && \ !defined(CMPI_PLATFORM_VMS_ALPHA_DECCXX) && !defined(CMPI_PLATFORM_VMS_IA64_DECCXX) # error "You have not defined the right platform. The choices are:" # error "CMPI_PLATFORM_LINUX_GENERIC_GNU, CMPI_PLATFORM_HPUX_ACC," # error "CMPI_PLATFORM_WIN32_IX86_MSVC, CMPI_PLATFORM_SOLARIS_SPARC_GNU," # error "CMPI_PLATFORM_SOLARIS_SPARC_CC, CMPI_PLATFORM_AIX_RS_IBMCXX," # error "CMPI_PLATFORM_ZOS_ZSERIES_IBM, CMPI_PLATFORM_TRU64_ALPHA_DECCXX," # error "CMPI_PLATFORM_OS400_ISERIES_IBM, CMPI_PLATFORM_DARWIN_PPC_GNU," # error "CMPI_PLATFORM_VMS_ALPHA_DECCXX, CMPI_PLATFORM_VMS_IA64_DECCXX" # endif #endif libopendrim-1.1.3/cmpi/cmpios.h0000644000175000017500000000632411404077256017160 0ustar guillaumeguillaume/* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 2006 The Open Group */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a */ /* copy of this software (the "Software"), to deal in the Software without */ /* restriction, including without limitation the rights to use, copy, */ /* modify, merge, publish, distribute, sublicense, and/or sell copies of */ /* the Software, and to permit persons to whom the Software is furnished */ /* to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included */ /* in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ /* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ /* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /* ------------------------------------------------------------------------- */ #ifndef _CMPIOS_H_ # define _CMPIOS_H_ # include "cmpipl.h" # include // To get the size_t # define CMPI_THREAD_RETURN void* # define CMPI_THREAD_TYPE void* # define CMPI_MUTEX_TYPE void* # define CMPI_COND_TYPE void* # if defined(CMPI_PLATFORM_WIN32_IX86_MSVC) # define CMPI_THREAD_CDECL __stdcall # define CMPI_THREAD_KEY_TYPE unsigned long int # ifndef HAVE_STRUCT_TIMESPEC # define HAVE_STRUCT_TIMESPEC struct timespec { long tv_sec; long tv_nsec; }; # endif /* HAVE_STRUCT_TIMESPEC */ # elif defined(CMPI_PLATFORM_ZOS_ZSERIES_IBM) # ifndef __cplusplus # include # define CMPI_THREAD_CDECL # else # define CMPI_THREAD_CDECL __cdecl # endif # define CMPI_THREAD_KEY_TYPE pthread_key_t # else # define CMPI_THREAD_CDECL # define CMPI_THREAD_KEY_TYPE unsigned long int # endif /* Define CMPI_EXPORT */ # if defined(CMPI_PLATFORM_WIN32_IX86_MSVC) # define CMPI_EXPORT __declspec(dllexport) # elif defined(CMPI_PLATFORM_LINUX_GENERIC_GNU) && (__GNUC__ >= 4) # define CMPI_EXPORT __attribute__((visibility("default"))) # else # define CMPI_EXPORT /* empty */ # endif /* Define CMPI_EXTERN_C */ # ifdef __cplusplus # define CMPI_EXTERN_C extern "C" CMPI_EXPORT # else # define CMPI_EXTERN_C CMPI_EXPORT # endif #endif libopendrim-1.1.3/cmpi/cmpimacs.h0000644000175000017500000033106311404077256017463 0ustar guillaumeguillaume/* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 2006 The Open Group */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a */ /* copy of this software (the "Software"), to deal in the Software without */ /* restriction, including without limitation the rights to use, copy, */ /* modify, merge, publish, distribute, sublicense, and/or sell copies of */ /* the Software, and to permit persons to whom the Software is furnished */ /* to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included */ /* in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ /* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ /* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /* ------------------------------------------------------------------------- */ #ifndef _CMPIMACS_H_ # define _CMPIMACS_H_ # ifndef DOC_ONLY # include "cmpidt.h" # include "cmpift.h" # endif # ifdef DOC_ONLY # define CMPI_INLINE # endif # ifdef DOC_ONLY /** This macro builds a CMPIStatus object with <rc> as return code and returns to the CIMOM. @param rc the CMPI return code @return This macro contains a return statement and leaves the function. */ noReturn CMReturn (CMPIrc rc); # else # define CMReturn(rc) \ { CMPIStatus stat={(rc),NULL}; \ return stat; } # endif # ifdef DOC_ONLY /** This macro builds a CMPIStatus object with <rc> as return code and <str> as message and returns to the Broker. @param rc the CMPI return code @param str the message as String object @return This macro contains a return statement and leaves the function. */ noReturn CMReturnWithString (CMPIrc rc, CMPIString * str); # else # define CMReturnWithString(rc,str) \ { CMPIStatus stat={(rc),(str)}; \ return stat; } # endif # ifdef DOC_ONLY /** This macro builds a CMPIStatus object with <rc> as return code and <msg> as message and returns to the Broker. @param mb Broker this pointer @param rc the CMPI return code @param msg the message as character string @return This macro contains a return statement and leaves the function. */ noReturn CMReturnWithChars (const CMPIBroker * mb, CMPIrc rc, char *msg); # else # define CMReturnWithChars(b,rc,chars) \ { CMPIStatus stat={(rc),NULL}; \ stat.msg=(b)->eft->newString((b),(chars),NULL); \ return stat; } # endif # ifdef CMPI_INLINE /** Initializes status object with <rc> and NULL message. @param st Address of status object @param rcp CMPI return code */ inline static void CMSetStatus (CMPIStatus * st, CMPIrc rcp) { if (st) { (st)->rc = (rcp); (st)->msg = NULL; } } # else # define CMSetStatus(st,rcp) \ { (st)->rc=(rcp); (st)->msg=NULL; } # endif # ifdef CMPI_INLINE /** Initializes status object with rc and message. @param st Address of status object @param rcp CMPI return code @param string Message string */ inline static void CMSetStatusWithString (CMPIStatus * st, CMPIrc rcp, const CMPIString * string) { if (st) { (st)->rc = (rcp); (st)->msg = (string); } } # else # define CMSetStatusWithString(st,rcp,string) \ { (st)->rc=(rcp); (st)->msg=(string); } # endif # ifdef CMPI_INLINE /** Initializes status object with <rc> and message. @param mb Broker this pointer @param st Address of status object @param rcp CMPI return code @param chars Message character string */ inline static void CMSetStatusWithChars (const CMPIBroker * mb, CMPIStatus * st, CMPIrc rcp, const char *chars) { if (st && mb) { (st)->rc = (rcp); (st)->msg = (mb)->eft->newString ((mb), (chars), NULL); } } # else # define CMSetStatusWithChars(mb,st,rcp,chars) \ { (st)->rc=(rcp); \ (st)->msg=(mb)->eft->newString((mb),(chars),NULL); } # endif # ifdef CMPI_INLINE /** Tests for encapsulated NULL object. @param obj CMPI Object pointer */ inline static CMPIBoolean CMIsNullObject (const void *obj) { return ((obj) == NULL || *((void **) (obj)) == NULL); } # else # define CMIsNullObject(o) ((o)==NULL || *((void**)(o))==NULL) # endif # ifdef CMPI_INLINE /** Tests for nullValue data item. @param val Value object */ inline static CMPIBoolean CMIsNullValue (const CMPIData val) { return ((val.state) & CMPI_nullValue); } # else # define CMIsNullValue(v) ((v.state) & CMPI_nullValue) # endif # ifdef CMPI_INLINE /** Tests for keyValue data item. @param val Value object */ inline static CMPIBoolean CMIsKeyValue (CMPIData val) { return ((val.state) & CMPI_keyValue); } # else # define CMIsKeyValue(v) ((v.state) & CMPI_keyValue) # endif # ifdef CMPI_INLINE /** Tests for keyValue data item. @param val Value object */ inline static CMPIBoolean CMIsArray (const CMPIData val) { return ((val.type) & CMPI_ARRAY); } # else # define CMIsArray(v) ((v.type) & CMPI_ARRAY) # endif // Life-cycle macros # define CMClone(o,rc) ((o)->ft->clone((o),(rc))) # define CMRelease(o) ((o)->ft->release((o))) // CMPIBroker factory macros # ifdef CMPI_INLINE /** Instance factory service. @param mb Broker this pointer. @param op ObjectPath containing namespace and classname. @param rc Output: Service return status (suppressed when NULL). @return The newly created Instance. */ inline static CMPIInstance * CMNewInstance (const CMPIBroker * mb, const CMPIObjectPath * op, CMPIStatus * rc) { return ((mb)->eft->newInstance ((mb), (op), (rc))); } # else # define CMNewInstance(b,c,rc) ((b)->eft->newInstance((b),(c),(rc))) # endif # ifdef CMPI_INLINE /** ObjectPath factory service. @param mb Broker this pointer. @param ns Namespace @param cn Classname. @param rc Output: Service return status (suppressed when NULL). @return The newly created ObjectPath. */ inline static CMPIObjectPath * CMNewObjectPath (const CMPIBroker * mb, const char *ns, const char *cn, CMPIStatus * rc) { return ((mb)->eft->newObjectPath ((mb), (ns), (cn), (rc))); } # else # define CMNewObjectPath(b,n,c,rc) \ ((b)->eft->newObjectPath((b),(n),(c),(rc))) # endif # ifdef CMPI_INLINE /** String container factory service. @param mb Broker this pointer. @param data String data @param rc Output: Service return status (suppressed when NULL). @return The newly created String. */ inline static CMPIString * CMNewString (const CMPIBroker * mb, const char *data, CMPIStatus * rc) { return ((mb)->eft->newString ((mb), (data), (rc))); } # else # define CMNewString(b,s,rc) ((b)->eft->newString((b),(s),(rc))) # endif # ifdef CMPI_INLINE /** Args container factory service. @param mb Broker this pointer. @param rc Output: Service return status (suppressed when NULL). @return The newly created Args container. */ inline static CMPIArgs * CMNewArgs (const CMPIBroker * mb, CMPIStatus * rc) { return ((mb)->eft->newArgs ((mb), (rc))); } # else # define CMNewArgs(b,rc) ((b)->eft->newArgs((b),(rc))) # endif # ifdef CMPI_INLINE /** Array container factory service. @param mb Broker this pointer @param max Maximum number of elements @param type Element type @param rc Output: Service return status (suppressed when NULL). @return The newly created Array. */ inline static CMPIArray * CMNewArray (const CMPIBroker * mb, CMPICount max, CMPIType type, CMPIStatus * rc) { return ((mb)->eft->newArray ((mb), (max), (type), (rc))); } # else # define CMNewArray(b,c,t,rc) ((b)->eft->newArray((b),(c),(t),(rc))) # endif # ifdef CMPI_INLINE /** DateTime factory service. Initialized with the time of day. @param mb Broker this pointer @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */ inline static CMPIDateTime * CMNewDateTime (const CMPIBroker * mb, CMPIStatus * rc) { return ((mb)->eft->newDateTime ((mb), (rc))); } # else # define CMNewDateTime(b,rc) ((b)->eft->newDateTime((b),(rc))) # endif # ifdef CMPI_INLINE /** DateTime factory service. Initialized from <binTime>. @param mb Broker this pointer @param binTime Date/Time definition in binary format in microsecods starting since 00:00:00 GMT, Jan 1,1970. @param interval Wenn true, defines Date/Time definition to be an interval value @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */ inline static CMPIDateTime *CMNewDateTimeFromBinary (const CMPIBroker * mb, CMPIUint64 binTime, CMPIBoolean interval, CMPIStatus * rc) { return ((mb)->eft-> newDateTimeFromBinary ((mb), (binTime), (interval), (rc))); } # else # define CMNewDateTimeFromBinary(b,d,i,rc) \ ((b)->eft->newDateTimeFromBinary((b),(d),(i),(rc))) # endif # ifdef CMPI_INLINE /** DateTime factory service. Is initialized from <utcTime>. @param mb Broker this pointer @param utcTime Date/Time definition in UTC format @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */ inline static CMPIDateTime *CMNewDateTimeFromChars (const CMPIBroker * mb, const char *utcTime, CMPIStatus * rc) { return ((mb)->eft->newDateTimeFromChars ((mb), (utcTime), (rc))); } # else # define CMNewDateTimeFromChars(b,d,rc) \ ((b)->eft->newDateTimeFromChars((b),(d),(rc))) # endif # ifdef CMPI_INLINE /** SelectExp factory service. This structure encompasses queries and provides mechanism to operate on the query. @param mb Broker this pointer @param query The select expression. @param lang The query language. @param projection Output: Projection specification (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return The newly created SelectExp. */ inline static CMPISelectExp *CMNewSelectExp (const CMPIBroker * mb, const char *query, const char *lang, CMPIArray ** projection, CMPIStatus * rc) { return ((mb)->eft-> newSelectExp ((mb), (query), (lang), (projection), (rc))); } # else # define CMNewSelectExp(b,q,l,p,rc) \ ((b)->eft->newSelectExp((b),(q),(l),(p),(rc))) # endif # ifdef CMPI_INLINE /** Function to determine whether a CIM class is of <type> or any of <type> subclasses. @param mb Broker this pointer @param op The class path (namespace and classname components). @param type The type to tested for. @param rc Output: Service return status (suppressed when NULL). @return True if test successful. */ inline static CMPIBoolean CMClassPathIsA (const CMPIBroker * mb, const CMPIObjectPath * op, const char *type, CMPIStatus * rc) { return ((mb)->eft->classPathIsA ((mb), (op), (type), (rc))); } # else # define CMClassPathIsA(b,p,pn,rc) \ ((b)->eft->classPathIsA((b),(p),(pn),(rc))) # endif // Debugging macros # ifdef CMPI_INLINE /** Attempts to transforms an CMPI object to a broker specific string format. Intended for debugging purposes only. @param mb Broker this pointer @param object A valid CMPI object. @param rc Output: Service return status (suppressed when NULL). @return String from representation of <object>. */ inline static CMPIString *CDToString (const CMPIBroker * mb, const void *object, CMPIStatus * rc) { return ((mb)->eft->toString ((mb), (void *) (object), (rc))); } # else # define CDToString(b,o,rc) ((b)->eft->toString((b),(void*)(o),(rc))) # endif # ifdef CMPI_INLINE /** Verifies whether <object> is of CMPI type <type>. Intended for debugging purposes only. @param mb Broker this pointer @param object A valid CMPI object. @param type A string specifying a valid CMPI Object type ("CMPIInstance", "CMPIObjectPath", etc). @param rc Output: Service return status (suppressed when NULL). @return True if test successful. */ inline static CMPIBoolean CDIsOfType (const CMPIBroker * mb, const void *object, const char *type, CMPIStatus * rc) { return ((mb)->eft->isOfType ((mb), (void *) (object), (type), (rc))); } # else # define CDIsOfType(b,o,t,rc) \ (b)->eft->isOfType((b),(void*)(o),(t),(rc)) # endif # ifdef CMPI_INLINE /** Retrieves the CMPI type of <object>. Intended for debugging purposes only. @param mb Broker this pointer @param object A valid CMPI object. @param rc Output: Service return status (suppressed when NULL). @return CMPI object type. */ inline static CMPIString *CDGetType (const CMPIBroker * mb, const void *object, CMPIStatus * rc) { return ((mb)->eft->getType ((mb), (object), (rc))); } # else # define CDGetType(b,o,rc) ((b)->eft->getType((b),(void*)(o),(rc))) # endif # ifdef CMPI_VER_85 # ifdef CMPI_INLINE /** Retrieves translated message. When using as macro, use CMFmtArgsX and CMFmtX macros to generate the variable parameter list and ommit the count parameter. @example CMGetMessage(_broker,"msgid","Test $0 $1",NULL, CMFmtArgs2(CMFmtChars("message"),CMFmtSint(1)); @param mb Broker this pointer @param msgId The message identifier. @param defMsg The default message. The message can have up to 10 message insert placeholders ($0 through $9). The placeholders will be replaced by the corresponding message insert values. @param rc Output: Service return status (suppressed when NULL). @param count The number of message insert values. Ommit when using the CMFmtArgsXX macro. @param ... Up to 10 Message insert values. These are specified using the following macros: CMFmtSint(v) integer value CMFmtUint(v) unsigned integer value CMFmtSint64(v) long integer value CMFmtUint64(v) long unsigned integer vale CMFmtReal(v) float or double real value CMFmtBoolean(v) CMPIBoolean value CMFmtChars(v) char string CMFmtString(v) CMPIString @return the translated message. */ inline static CMPIString *CMGetMessage (const CMPIBroker * b, const char *msgId, const char *defMsg, CMPIStatus * rc, unsigned int, ...) # else # define CMFmtSint(v) CMPI_sint32,((long int)v) # define CMFmtUint(v) CMPI_uint32,((unsigned long int)v) # define CMFmtSint64(v) CMPI_sint64,((long long int)v) # define CMFmtUint64(v) CMPI_uint64,((unsigned long long int)v) # define CMFmtReal(v) CMPI_real64,((double)v) # define CMFmtBoolean(v) CMPI_boolean,((int)v) # define CMFmtChars(v) CMPI_chars,((char*)v) # define CMFmtString(v) CMPI_String,((CMPI_String*)v) # define CMFmtArgs0() 0 # define CMFmtArgs1(v1) \ 1,v1 # define CMFmtArgs2(v1,v2) \ 2,v1,v2 # define CMFmtArgs3(v1,v2,v3) \ 3,v1,v2,v3 # define CMFmtArgs4(v1,v2,v3,v4) \ 4,v1,v2,v3,v4 # define CMFmtArgs5(v1,v2,v3,v4,v5) \ 5,v1,v2,v3,v4,v5 # define CMFmtArgs6(v1,v2,v3,v4,v5,v6) \ 6,v1,v2,v3,v4,v5,v6 # define CMFmtArgs7(v1,v2,v3,v4,v5,v6,v7) \ 7,v1,v2,v3,v4,v5,v6,v7 # define CMFmtArgs8(v1,v2,v3,v4,v5,v6,v7,v8) \ 8,v1,v2,v3,v4,v5,v6,v7,v8 # define CMFmtArgs9(v1,v2,v3,v4,v5,v6,v7,v8,v9) \ 9,v1,v2,v3,v4,v5,v6,v7,v8,v9 # define CMFmtArgs10(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10) \ 10,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10 # define CMGetMessage(b,id,def,rc,parms) ((b)->eft->getMessage((b),(id),(def),(rc),parms)) # endif /* CMPI_INLINE */ # endif /* CMPI_VER_85 */ # ifdef CMPI_VER_100 # ifdef CMPI_INLINE /** Logs the message to the standard logging facility. @example CMLogMessage(_broker, 1, "TestProvider","Entering EnumerateInstance", NULL); @param mb Broker this pointer @param severity The severity is from 1-4. 1 is for information, 2, is for warning, 3 for severe and 4 for fatal. @param id The ID of the provider. @param text The message. If not NULL, is the message text to be logged. @param string The message. If not NULL, is the message text to be logged. string will be ignored when text is not NULL. @param rc Output: Service return status */ inline static CMPIStatus CMLogMessage (const CMPIBroker * b, int severity, const char *id, const char *text, const CMPIString * string) { return ((b)->eft->logMessage ((b), (severity), (id), (text), (string))); } # else # define CMLogMessage(b,severity,id, text, string) ((b)->eft->logMessage((b),(severity),(id),(text),(string))) # endif # endif /* CMPI_VER_100 */ # ifdef CMPI_VER_100 # ifdef CMPI_INLINE /** Logs the message to the trace facility. @example CMTraceMessage( ); @param mb Broker this pointer @param level The severity is from 1-4. @param component The component name to use for logging. The available facilities are defined in TraceComponents.h file. @param text The message. If not NULL, is the message text to be logged. @param string The message. If not NULL, is the message text to be logged. string will be ignored when text is not NULL. @param rc Output: Service return status */ inline static CMPIStatus CMTraceMessage (const CMPIBroker * b, int level, const char *component, const char *text, const CMPIString * string) { return ((b)->eft->trace ((b), (level), (component), (text), (string))); } # else # define CMTraceMessage(b,level,component, text, string) ((b)->eft->trace((b),(level),(component),(text),(string))) # endif # endif /* CMPI_VER_100 */ # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Create a new CMPIError object. @example CMNewCMPIError( ); @param b Broker this pointer @param owner Identifies the entity that owns the msg format definition. @param msgID Identifies the format of the message. @param msg Formatted and translated message. @param sev Perceived severity of this error. @param pc Probable caues of this error. @param cimStatusCode Status Code. @param rc Service return status @return Pointer to a newly allocated CMPIError object. */ inline static CMPIError* CMNewCMPIError (const CMPIBroker* b, const char *owner, const char* msgID, const char* msg, const CMPIErrorSeverity sev, const CMPIErrorProbableCause pc, const CMPIrc cimStatusCode, CMPIStatus* rc) { return ((b)->eft->newCMPIError ((b), (owner), (msgID), (msg), (sev), (pc), (cimStatusCode), (rc))); } # else # define CMNewCMPIError(b,owner,msgID,msg,sev,pc,cimStatusCode,rc) \ ((b)->eft->newCMPIError((b),(owner),(msgID),(msg),(sev), \ (pc),(cimStatusCode),(rc))) # endif /* CMPI_INLINE */ # endif /* CMPI_VER_200 */ # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Opens a message file and returns a handle to it. @example CMOpenMessageFile(_broker,"/path/msgFile",&msgFileHandle); @param b Broker this pointer @param msgFile The message file identifier. @param msgFileHandle Output: The handle representing the open msg file. @return Service return status */ inline static CMPIStatus CMOpenMessageFile (const CMPIBroker* b, const char *msgFile, CMPIMsgFileHandle *msgFileHandle) { return ((b)->eft->openMessageFile ((b), (msgFile), (msgFileHandle))); } # else # define CMOpenMessageFile(b,mf,mfh) ((b)->eft->openMessageFile((b),(mf),(mfh))) # endif /* CMPI_INLINE */ # endif /* CMPI_VER_200 */ # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Closes a message file and returns a handle to it. @example CMCloseMessageFile(_broker,msgFileHandle); @param mb Broker this pointer @param msgFileHandle The handle representing the open message file. @return Service return status */ inline static CMPIStatus CMCloseMessageFile (const CMPIBroker* b, const CMPIMsgFileHandle msgFilehandle) { return ((b)->eft->closeMessageFile ((b), (msgFileHandle))); } # else # define CMCloseMessageFile(b,mfh) ((b)->eft->closeMessageFile((b),(mfh))) # endif /* CMPI_INLINE */ # endif /* CMPI_VER_200 */ # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Retrieves translated message from a message file. When using as macro, use CMFmtArgsX and CMFmtX macros (defined above) to generate the variable parameter list and ommit the count parameter. @example CMGetMessage2(_broker,"msgid",msgFileHandle,"Test $0 $1", NULL,CMFmtArgs2(CMFmtChars("message"),CMFmtSint(1)); @param mb Broker this pointer @param msgId The message identifier. @param msgFileHandle The handle representing the open message file. @param defMsg The default message. The message can have up to 10 msg insert placeholders ($0 through $9). The placeholders will be replaced by the corresponding message insert values. @param rc Output: Service return status (suppressed when NULL). @param count The number of message insert values. Omit when using the CMFmtArgsXX macro. @param ... Up to 10 Message insert values. These are specified using the following macros: CMFmtSint(v) integer value CMFmtUint(v) unsigned integer value CMFmtSint64(v) long integer value CMFmtUint64(v) long unsigned integer vale CMFmtReal(v) float or double real value CMFmtBoolean(v) CMPIBoolean value CMFmtChars(v) char string CMFmtString(v) CMPIString @return the translated message. */ inline static CMPIString* CMGetMessage2 (const CMPIBroker* mb, const char *msgId, const CMPIMsgFileHandle msgFilehandle, const char *defMsg, CMPIStatus* rc, unsigned int, ...); # else # define CMGetMessage2(b,id,mfh,def,rc,parms) ((b)->eft->getMessage2((b),(id),(mfh),(def),(rc),parms)) # endif /* CMPI_INLINE */ # endif /* CMPI_VER_200 */ // CMPIInstance macros # ifdef CMPI_INLINE /** Gets a named property value. @param inst Instance this pointer. @param name Property name. @param rc Output: Service return status (suppressed when NULL). @return Property value. */ inline static CMPIData CMGetProperty (const CMPIInstance * inst, const char *name, CMPIStatus * rc) { return ((inst)->ft->getProperty ((inst), (name), (rc))); } # else # define CMGetProperty(i,n,rc) ((i)->ft->getProperty((i),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets a Property value defined by its index. @param inst Instance this pointer. @param index Position in the internal Data array. @param name Output: Returned property name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Property value. */ inline static CMPIData CMGetPropertyAt (const CMPIInstance * inst, CMPICount index, CMPIString ** name, CMPIStatus * rc) { return ((inst)->ft->getPropertyAt ((inst), (index), (name), (rc))); } # else # define CMGetPropertyAt(i,num,s,rc) \ ((i)->ft->getPropertyAt((i),(num),(s),(rc))) # endif # ifdef CMPI_INLINE /** Adds/replaces a named Property. @param inst Instance this pointer. @param name Entry name. @param value Address of value structure. @param type Value type. @return Service return status. */ inline static CMPIStatus CMSetProperty (const CMPIInstance * inst, const char *name, const CMPIValue * value, CMPIType type) { return ((inst)->ft->setProperty ((inst), (name), (value), (type))); } # else # define CMSetProperty(i,n,v,t) \ ((i)->ft->setProperty((i),(n),(CMPIValue*)(v),(t))) # endif # ifdef CMPI_INLINE /** Gets the number of properties contained in this Instance. @param inst Instance this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of properties. */ inline static CMPICount CMGetPropertyCount (const CMPIInstance * inst, CMPIStatus * rc) { return ((inst)->ft->getPropertyCount ((inst), (rc))); } # else # define CMGetPropertyCount(i,rc) ((i)->ft->getPropertyCount((i),(rc))) # endif # ifdef CMPI_INLINE /** Generates an ObjectPath out of the namespace, classname and key propeties of this Instance. @param inst Instance this pointer. @param rc Output: Service return status (suppressed when NULL). @return the generated ObjectPath. */ inline static CMPIObjectPath *CMGetObjectPath (const CMPIInstance * inst, CMPIStatus * rc) { return ((inst)->ft->getObjectPath ((inst), (rc))); } # else # define CMGetObjectPath(i,rc) ((i)->ft->getObjectPath((i),(rc))) # endif # ifdef CMPI_VER_100 # ifdef CMPI_INLINE /** Replaces the ObjectPath of the instance. @param inst Instance this pointer. @param obj Pointer to the new object path. This objectpath shall contain the namespace, classname, as well as all keys for the specified instance. @param rc Output: Service return status (suppressed when NULL). @return the generated ObjectPath. */ inline static CMPIStatus CMSetObjectPath (CMPIInstance * inst, const CMPIObjectPath * obj) { return ((inst)->ft->setObjectPath ((inst), (obj))); } # else # define CMSetObjectPath(i,obj) ((i)->ft->setObjectPath((i),(obj))) # endif # endif /* CMPI_VER_100 */ # ifdef CMPI_INLINE /** Directs CMPI to ignore any setProperty operations for this instance for any properties not in this list. @param inst Instance this pointer. @param propertyList If not NULL, the members of the array define one or more Property names to be accepted by setProperty operations. @param keys Deprecated, ignored by MB, maintained here for compatibility. @return Service return status. */ inline static CMPIStatus CMSetPropertyFilter (CMPIInstance * inst, const char **propertyList, char **keys) { return ((inst)->ft->setPropertyFilter ((inst), (propertyList), (keys))); } # else # define CMSetPropertyFilter(i,pl,k) ((i)->ft->setPropertyFilter((i),(pl),(k))) # endif # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Add/replace a named Property value and origin @param inst is a pointer to the CMPIInstance structure. @param name is a string containing the Property name. @param value points to a CMPIValue structure containing the value to be assigned to the Property. @param type is a CMPIType structure defining the type of the value. @param origin specifies the instance origin. If NULL, then no origin is attached to the property @return Service return status */ inline static CMPIStatus CMSetPropertyWithOrigin (const CMPIInstance * inst, const char *name, const CMPIValue * value, CMPIType type, const char * origin) { return ((inst)->ft->setPropertyWithOrigin ( (inst), (name), (value), (type), (origin))); } # else # define CMSetPropertyWithOrigin(i,n,v,t,o) \ ((i)->ft->setPropertyWithOrigin((i),(n),(CMPIValue*)(v),(t),(o))) # endif # endif /* CMPI_VER_200 */ // CMPIObjectPath macros # ifdef CMPI_INLINE /** Set/replace the hostname component. @param op ObjectPath this pointer. @param hn The hostname string @return Service return status. */ inline static CMPIStatus CMSetHostname (CMPIObjectPath * op, const char *hn) { return ((op)->ft->setHostname ((op), (hn))); } # else # define CMSetHostname(p,n) ((p)->ft->setHostname((p),(n))) # endif # ifdef CMPI_INLINE /** Get the hostname component. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return The hostname component. */ inline static CMPIString *CMGetHostname (const CMPIObjectPath * op, CMPIStatus * rc) { return ((op)->ft->getHostname ((op), (rc))); } # else # define CMGetHostname(p,rc) ((p)->ft->getHostname((p),(rc))) # endif # ifdef CMPI_INLINE /** Set/replace the namespace component. @param op ObjectPath this pointer. @param ns The namespace string @return Service return status. */ inline static CMPIStatus CMSetNameSpace (CMPIObjectPath * op, const char *ns) { return ((op)->ft->setNameSpace ((op), (ns))); } # else # define CMSetNameSpace(p,n) ((p)->ft->setNameSpace((p),(n))) # endif # ifdef CMPI_INLINE /** Get the namespace component. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return The namespace component. */ inline static CMPIString *CMGetNameSpace (const CMPIObjectPath * op, CMPIStatus * rc) { return ((op)->ft->getNameSpace ((op), (rc))); } # else # define CMGetNameSpace(p,rc) ((p)->ft->getNameSpace((p),(rc))) # endif # ifdef CMPI_INLINE /** Set/replace the classname component. @param op ObjectPath this pointer. @param cn The hostname string @return Service return status. */ inline static CMPIStatus CMSetClassName (CMPIObjectPath * op, const char *cn) { return ((op)->ft->setClassName ((op), (cn))); } # else # define CMSetClassName(p,n) ((p)->ft->setClassName((p),(n))) # endif # ifdef CMPI_INLINE /** Get the classname component. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return The classname component. */ inline static CMPIString *CMGetClassName (const CMPIObjectPath * op, CMPIStatus * rc) { return ((op)->ft->getClassName ((op), (rc))); } # else # define CMGetClassName(p,rc) ((p)->ft->getClassName((p),(rc))) # endif # ifdef CMPI_INLINE /** Adds/replaces a named key property. @param op ObjectPath this pointer. @param name Key property name. @param value Address of value structure. @param type Value type. @return Service return status. */ inline static CMPIStatus CMAddKey (CMPIObjectPath * op, const char *name, const CMPIValue * value, const CMPIType type) { return ((op)->ft->addKey ((op), (name), (value), (type))); } # else # define CMAddKey(p,n,v,t) \ ((p)->ft->addKey((p),(n),(CMPIValue*)(v),(t))) # endif # ifdef CMPI_INLINE /** Gets a named key property value. @param op ObjectPath this pointer. @param name Key property name. @param rc Output: Service return status (suppressed when NULL). @return Entry value. */ inline static CMPIData CMGetKey (const CMPIObjectPath * op, const char *name, CMPIStatus * rc) { return ((op)->ft->getKey ((op), (name), (rc))); } # else # define CMGetKey(p,n,rc) ((p)->ft->getKey((p),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets a key property value defined by its index. @param op ObjectPath this pointer. @param index Position in the internal Data array. @param name Output: Returned property name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Data value. */ inline static CMPIData CMGetKeyAt (const CMPIObjectPath * op, CMPICount index, CMPIString ** name, CMPIStatus * rc) { return ((op)->ft->getKeyAt ((op), (index), (name), (rc))); } # else # define CMGetKeyAt(p,i,n,rc) ((p)->ft->getKeyAt((p),(i),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets the number of key properties contained in this ObjectPath. @param op ObjectPath this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of properties. */ inline static CMPICount CMGetKeyCount (const CMPIObjectPath * op, CMPIStatus * rc) { return ((op)->ft->getKeyCount ((op), (rc))); } # else # define CMGetKeyCount(p,rc) ((p)->ft->getKeyCount((p),(rc))) # endif # ifdef CMPI_INLINE /** Set/replace namespace and classname components from <src>. @param op ObjectPath this pointer. @param src Source input. @return Service return status. */ inline static CMPIStatus CMSetNameSpaceFromObjectPath (CMPIObjectPath * op, const CMPIObjectPath * src) { return ((op)->ft->setNameSpaceFromObjectPath ((op), (src))); } # else # define CMSetNameSpaceFromObjectPath(p,s) \ ((p)->ft->setNameSpaceFromObjectPath((p),(s))) # endif # ifdef CMPI_INLINE /** Set/replace hostname, namespace and classname components from <src>. @param op ObjectPath this pointer. @param src Source input. @return Service return status. */ inline static CMPIStatus CMSetHostAndNameSpaceFromObjectPath (CMPIObjectPath * op, const CMPIObjectPath * src) { return ((op)->ft->setHostAndNameSpaceFromObjectPath ((op), (src))); } # else # define CMSetHostAndNameSpaceFromObjectPath(p,s) \ ((p)->ft->setHostAndNameSpaceFromObjectPath((p),(s))) # endif #ifdef CMPI_INLINE /** Get class qualifier value. @param op ObjectPath this pointer. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ inline static CMPIData CMGetClassQualifier (const CMPIObjectPath* op, const char *qName, CMPIStatus *rc) { return ((op)->ft->getClassQualifier((op),(qName),(rc))); } #else #define CMGetClassQualifier(op,qName,rc) \ ((op)->ft->getClassQualifier((op),(qName),(rc))) #endif #ifdef CMPI_INLINE /** Get property qualifier value. @param op ObjectPath this pointer. @param pName Property name. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ inline static CMPIData CMGetPropertyQualifier (const CMPIObjectPath* op, const char *pName, const char *qName, CMPIStatus *rc) { return ((op)->ft->getPropertyQualifier((op),(pName),(qName),(rc))); } #else #define CMGetPropertyQualifier(op,pName,qName,rc) \ ((op)->ft->getPropertyQualifier((op),(pName),(qName),(rc))) #endif #ifdef CMPI_INLINE /** Get method qualifier value. @param op ObjectPath this pointer. @param mName Method name. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ inline static CMPIData CMGetMethodQualifier (const CMPIObjectPath* op, const char *methodName, const char *qName, CMPIStatus *rc) { return ((op)->ft->getMethodQualifier((op),(methodName),(qName),(rc))); } #else #define CMGetMethodQualifier(op,methodName,qName,rc) \ ((op)->ft->getMethodQualifier((op),(methodName),(qName),(rc))) #endif #ifdef CMPI_INLINE /** Get method parameter qualifier value. @param op ObjectPath this pointer. @param mName Method name. @param pName Parameter name. @param qName Qualifier name. @param rc Output: Service return status (suppressed when NULL). @return Qualifier value. */ inline static CMPIData CMGetParameterQualifier (const CMPIObjectPath* op, const char *mName, const char *pName, const char *qName, CMPIStatus *rc) { return ((op)->ft->getParameterQualifier((op),(mName),(pName),(qName),(rc))); } #else #define CMGetParameterQualifier(op,mName,pName,qName,rc) \ ((op)->ft->getParameterQualifier((op),(mName),(pName),(qName),(rc))) #endif # ifdef CMPI_VER_86 # ifdef CMPI_INLINE /** Set/replace hostname, namespace and classname components from <src>. @param op ObjectPath this pointer. @param src Source input. @return Service return status. */ inline static CMPIString *CMObjectPathToString (const CMPIObjectPath * op, CMPIStatus * rc) { return ((op)->ft->toString ((op), (rc))); } # else # define CMObjectPathToString(p,rc) \ ((p)->ft->toString((p),(rc))) # endif # endif /* CMPI_VER_86 */ // CMPIArray macros # ifdef CMPI_INLINE /** Gets the number of elements contained in this Array. @param ar Array this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of elements. */ inline static CMPICount CMGetArrayCount (const CMPIArray * ar, CMPIStatus * rc) { return ((ar)->ft->getSize ((ar), (rc))); } # else # define CMGetArrayCount(a,rc) ((a)->ft->getSize((a),(rc))) # endif # ifdef CMPI_INLINE /** Gets the element type. @param ar Array this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of elements. */ inline static CMPIType CMGetArrayType (const CMPIArray * ar, CMPIStatus * rc) { return ((ar)->ft->getSimpleType ((ar), (rc))); } # else # define CMGetArrayType(a,rc) ((a)->ft->getSimpleType((a),(rc))) # endif # ifdef CMPI_INLINE /** Gets an element value defined by its index. @param ar Array this pointer. @param index Position in the internal Data array. @param rc Output: Service return status (suppressed when NULL). @return Element value. */ inline static CMPIData CMGetArrayElementAt (const CMPIArray * ar, CMPICount index, CMPIStatus * rc) { return ((ar)->ft->getElementAt ((ar), (index), (rc))); } # else # define CMGetArrayElementAt(a,n,rc) \ ((a)->ft->getElementAt((a),(n),(rc))) # endif # ifdef CMPI_INLINE /** Sets an element value defined by its index. @param ar Array this pointer. @param index Position in the internal Data array. @param value Address of value structure. @param type Value type. @return Service return status. */ inline static CMPIStatus CMSetArrayElementAt (CMPIArray * ar, CMPICount index, const CMPIValue * value, CMPIType type) { return ((ar)->ft->setElementAt ((ar), (index), (value), (type))); } # else # define CMSetArrayElementAt(a,n,v,t) \ ((a)->ft->setElementAt((a),(n),(CMPIValue*)(v),(t))) # endif // CMPIArgs macros # ifdef CMPI_INLINE /** Adds/replaces a named argument. @param as Args this pointer. @param name Argument name. @param value Address of value structure. @param type Value type. @return Service return status. */ inline static CMPIStatus CMAddArg (CMPIArgs * as, char *name, const CMPIValue * value, const CMPIType type) { return ((as)->ft->addArg ((as), (name), (CMPIValue*)(value), (type))); } # else # define CMAddArg(a,n,v,t) \ ((a)->ft->addArg((a),(n),(CMPIValue*)(v),(t))) # endif # ifdef CMPI_INLINE /** Gets a named argument value. @param as Args this pointer. @param name Argument name. @param rc Output: Service return status (suppressed when NULL). @return Argument value. */ inline static CMPIData CMGetArg (const CMPIArgs * as, const char *name, CMPIStatus * rc) { return ((as)->ft->getArg ((as), (name), (rc))); } # else # define CMGetArg(a,n,rc) ((a)->ft->getArg((a),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets a Argument value defined by its index. @param as Args this pointer. @param index Position in the internal Data array. @param name Output: Returned argument name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Argument value. */ inline static CMPIData CMGetArgAt (const CMPIArgs * as, CMPICount index, CMPIString ** name, CMPIStatus * rc) { return ((as)->ft->getArgAt ((as), (index), (name), (rc))); } # else # define CMGetArgAt(a,p,n,rc) ((a)->ft->getArgAt((a),(p),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets the number of arguments contained in this Args. @param as Args this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of properties. */ inline static CMPICount CMGetArgCount (const CMPIArgs * as, CMPIStatus * rc) { return ((as)->ft->getArgCount ((as), (rc))); } # else # define CMGetArgCount(a,rc) ((a)->ft->getArgCount((a),(rc))) # endif // CMPIString Macros # define CMGetCharPtr(s) ((char*)s->hdl) # ifdef CMPI_INLINE /** Get a pointer to a C char* representation of this String. @param st String this pointer. @param rc Output: Service return status (suppressed when NULL). @return Pointer to char* representation. */ inline static char * CMGetCharsPtr (const CMPIString * st, CMPIStatus * rc) { return ((st)->ft->getCharPtr ((st), (rc))); } # else # define CMGetCharsPtr(st,rc) ((st)->ft->getCharPtr((st),(rc))) # endif // CMPIDateTime macros # ifdef CMPI_INLINE /** Get DateTime setting in UTC string format. @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return DateTime as UTC string. */ inline static CMPIString *CMGetStringFormat (const CMPIDateTime * dt, CMPIStatus * rc) { return ((dt)->ft->getStringFormat ((dt), (rc))); } # else # define CMGetStringFormat(d,rc) ((d)->ft->getStringFormat((d),(rc))) # endif # ifdef CMPI_INLINE /** Get DateTime setting in binary format (in microsecods starting since 00:00:00 GMT, Jan 1,1970). @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return DateTime in binary. */ inline static CMPIUint64 CMGetBinaryFormat (const CMPIDateTime * dt, CMPIStatus * rc) { return ((dt)->ft->getBinaryFormat ((dt), (rc))); } # else # define CMGetBinaryFormat(d,rc) ((d)->ft->getBinaryFormat((d),(rc))) # endif # ifdef CMPI_INLINE /** Tests whether DateTime is an interval value. @param dt DateTime this pointer. @param rc Output: Service return status (suppressed when NULL). @return True if interval value. */ inline static CMPIBoolean CMIsInterval (const CMPIDateTime * dt, CMPIStatus * rc) { return ((dt)->ft->isInterval ((dt), (rc))); } # else # define CMIsInterval(d,rc) ((d)->ft->isInterval((d),(rc))) # endif // CMPIError macros # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Gets the type of this Error @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return the error type this Error object conatins */ inline static CMPIErrorType (*getErrorType)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getErrorType ((er), (rc))); } # else # define CMGetErrorType(e,rc) \ ((e)->ft->getErrorType((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which describes the alternate error type. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getOtherErrorType)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getOtherErrorType ((er), (rc))); } # else # define CMGetOtherErrorType(e,rc) \ ((e)->ft->getOtherErrorType((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which describes the owneing entity @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getOwningEntity)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getOwningEntity ((er), (rc))); } # else # define CMGetOwningEntity(e,rc) \ ((e)->ft->getOwningEntity((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which is the message ID. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getMessageID)(const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getMessageID ((er), (rc))); } # else # define CMGetMessageID(e,rc) \ ((e)->ft->getMessageID((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string comnating an error message. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getMessage)(const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getMessage ((er), (rc))); } # else # define CMGetErrorMessage(e,rc) \ ((e)->ft->getMessage((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns the perceieved severity of this error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return the perceived severity */ inline static CMPIErrorSeverity (*getPerceivedSeverity)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getPerceivedSeverity ((er), (rc))); } # else # define CMGetPerceivedSeverity(e,rc) \ ((e)->ft->getPerceivedSeverity((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns the probable cause of this error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A probable cause value */ inline static CMPIErrorProbableCause (*getProbableCause)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getProbableCause ((er), (rc))); } # else # define CMGetProbableCause(e,rc) \ ((e)->ft->getProbableCause((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which describes the probable cause. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getProbableCauseDescription)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getProbableCauseDescription ((er), (rc))); } # else # define CMGetProbableCauseDescription(e,rc) \ ((e)->ft->getProbableCauseDescription((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns an array of strings which describes recomended actions. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A array of strings, which can be NULL */ inline static CMPIArray* (*getRecommendedActions)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getRecommendedActions ((er), (rc))); } # else # define CMGetRecommendedActions(e,rc) \ ((e)->ft->getRecommendedActions((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which describes the Error source. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getErrorSource)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getErrorSource ((er), (rc))); } # else # define CMGetErrorSource(e,rc) \ ((e)->ft->getErrorSource((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a the format that the error src is in. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A error source format code */ inline static CMPIErrorSrcFormat (*getErrorSourceFormat)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getErrorSourceFormat ((er), (rc))); } # else # define CMGetErrorSourceFormat(e,rc) \ ((e)->ft->getErrorSourceFormat((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which describes the 'other' format, only available if the error source is OTHER. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getOtherErrorSourceFormat)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getOtherErrorSourceFormat ((er), (rc))); } # else # define CMGetOtherErrorSourceFormat(e,rc) \ ((e)->ft->getOtherErrorSourceFormat((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns the status code of this error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A CMPI Status code */ inline static CMPIrc (*getCIMStatusCode)(const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getCIMStatusCode ((er), (rc))); } # else # define CMGetCIMStatusCode(e,rc) \ ((e)->ft->getCIMStatusCode((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns a string which describes the status code error. @param er Error this pointer @param rc Output: Service return status (suppressed when NULL). @return A string, which can be NULL */ inline static CMPIString* (*getCIMStatusCodeDescription)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getCIMStatusCodeDescription ((er), (rc))); } # else # define CMGetCIMStatusCodeDescription(e,rc) \ ((e)->ft->getCIMStatusCodeDescription((e),(rc))) # endif # ifdef CMPI_INLINE /** Returns an array which contains the dynamic content of the message. @param er The Error this pointer @param rc Output: Serbice return status (surpressed when NULL) @return An array of CMPIStrings which represents the dynamic values */ inline static CMPIArray* (*getMessageArguments)( const CMPIError* er, CMPIStatus* rc) { return ((er)->ft->getMessageArguments ((er), (rc))); } # else # define CMGetMessageArguments(e,rc) \ ((e)->ft->getMessageArguments((e),(rc))) # endif # ifdef CMPI_INLINE /** Sets the error type of this error object. @param er Error this pointer @param et The error type @return Output: Service return status */ inline static CMPIStatus (*setErrorType)( CMPIError* er, const CMPIErrorType et) { return ((er)->ft->setErrorType ((er), (et))); } # else # define CMSetErrorType(e,et) \ ((e)->ft->setErrorType((e),(et))) # endif # ifdef CMPI_INLINE /** Sets the 'other' error type of this error object. @param er Error this pointer @param oet A string which describes the error type, it is only valis when error type is "OTHER" @return Output: Service return status */ inline static CMPIStatus (*setOtherErrorType)(CMPIError* er, const char * oet) { return ((er)->ft->setOtherErrorType ((er), (oet))); } # else # define CMSetOtherErrorType(e,oet) \ ((e)->ft->setOtherErrorType((e),(oet))) # endif # ifdef CMPI_INLINE /** Sets the description of the probable cause. @param er Error this pointer @param pc The probable cause string @return Output: Service return status */ inline static CMPIStatus (*setProbableCauseDescription)( CMPIError* er, const char * pcd) { return ((er)->ft->setProbableCauseDescription ((er), (pcd))); } # else # define CMSetProbableCauseDescription(e,pcd) \ ((e)->ft->setProbableCauseDescription((e),(pcd))) # endif # ifdef CMPI_INLINE /** Sets the recomended actions array. @param er Error this pointer @param ar An array of strings describing actions that shoudl be taken to deal with this error @return Output: Service return status */ inline static CMPIStatus (*setRecommendedActions)( CMPIError* er, const CMPIArray* ra) { return ((er)->ft->setRecommendedActions ((er), (ra))); } # else # define CMSetRecommendedActions(e,ra) \ ((e)->ft->setRecommendedActions((e),(ra))) # endif # ifdef CMPI_INLINE /** Specifies a string which specifes The identifying information of the entity (i.e., the instance) generating the error.. @param er Error this pointer @param es the string which describes the source @return Output: Service return status */ inline static CMPIStatus (*setErrorSource)(CMPIError* er, const char* es); { return ((er)->ft->setErrorSource ((er), (es))); } # else # define CMSetErrorSource(e,es) \ ((e)->ft->setErrorSource((e),(es))) # endif # ifdef CMPI_INLINE /** Sets the source format of the error object @param er Error this pointer @param esf the string which describes the source format @return Output: Service return status */ inline static CMPIStatus (*setErrorSourceFormat)( CMPIError* er, const CMPIErrorSrcFormat esf); { return ((er)->ft->setErrorSourceFormat ((er), (esf))); } # else # define CMSetErrorSourceFormat(e,esf) \ ((e)->ft->setErrorSourceFormat((e),(esf))) # endif # ifdef CMPI_INLINE /** specifies A string defining "Other" values for ErrorSourceFormat @param er Error this pointer @param oef the string which describes the other source format @return Output: Service return status */ inline static CMPIStatus (*setOtherErrorSourceFormat)( CMPIError* er, const char* oesf) { return ((er)->ft->setOtherErrorSourceFormat ((er), (oesf))); } # else # define CMSetOtherErrorSourceFormat(e,oesf) \ ((e)->ft->setOtherErrorSourceFormat((e),(oesf))) # endif # ifdef CMPI_INLINE /** Sets the description of the status code. @param er Error this pointer @param scd A string whcih describes the status code. @return Output: Service return status */ inline static CMPIStatus (*setCIMStatusCodeDescription)( CMPIError* er, const char* cd); { return ((er)->ft->setCIMStatusCodeDescription ((er), (cd))); } # else # define CMSetCIMStatusCodeDescription(e,cd) \ ((e)->ft->setCIMStatusCodeDescription((e),(cd))) # endif # ifdef CMPI_INLINE /** Sets an array of strings for the dynamic content of the message @param er Error this pointer @param values Specifies an array of CMPIStrings containing the dynamic content of the message. @return Service return status */ inline static CMPIStatus (*setMessageArguments)(CMPIError* er, CMPIArray* ma) { return ((er)->ft->setMessageArguments ((er), (ma))); } # else # define CMSetMessageArguments(e,ma) \ ((e)->ft->setMessageArguments((e),(ma))) # endif # endif /* CMPI_VER_200 */ // CMPIEnumeration Macros # ifdef CMPI_INLINE /** Get the next element of this Enumeration. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return Element value. */ inline static CMPIData CMGetNext (const CMPIEnumeration * en, CMPIStatus * rc) { return ((en)->ft->getNext ((en), (rc))); } # else # define CMGetNext(n,rc) ((n)->ft->getNext((n),(rc))) # endif # ifdef CMPI_INLINE /** Test for any elements left in this Enumeration. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return True or false. */ inline static CMPIBoolean CMHasNext (const CMPIEnumeration * en, CMPIStatus * rc) { return ((en)->ft->hasNext ((en), (rc))); } # else # define CMHasNext(n,rc) ((n)->ft->hasNext((n),(rc))) # endif # ifdef CMPI_INLINE /** Convert this Enumeration into an Array. @param en Enumeration this pointer. @param rc Output: Service return status (suppressed when NULL). @return The Array. */ inline static CMPIArray *CMToArray (const CMPIEnumeration * en, CMPIStatus * rc) { return ((en)->ft->toArray ((en), (rc))); } # else # define CMToArray(n,rc) ((n)->ft->toArray((n),(rc))) # endif // CMPIResult Macros # ifdef CMPI_INLINE /** Return a value/type pair. @param rslt Result this pointer. @param value Address of a Value object. @param type Type of the Value object. @return Service return status. */ inline static CMPIStatus CMReturnData (const CMPIResult * rslt, const CMPIValue * value, const CMPIType type) { return ((rslt)->ft->returnData ((rslt), (value), (type))); } # else # define CMReturnData(r,v,t) \ ((r)->ft->returnData((r),(CMPIValue*)(v),(t))) # endif # ifdef CMPI_INLINE /** Return a Instance object. @param rslt Result this pointer. @param inst Instance to be returned. @return Service return status. */ inline static CMPIStatus CMReturnInstance (const CMPIResult * rslt, const CMPIInstance * inst) { return ((rslt)->ft->returnInstance ((rslt), (inst))); } # else # define CMReturnInstance(r,i) ((r)->ft->returnInstance((r),(i))) # endif # ifdef CMPI_INLINE /** Return a ObjectPath object.. @param rslt Result this pointer. @param ref ObjectPath to be returned. @return Service return status. */ inline static CMPIStatus CMReturnObjectPath (const CMPIResult * rslt, const CMPIObjectPath * ref) { return ((rslt)->ft->returnObjectPath ((rslt), (ref))); } # else # define CMReturnObjectPath(r,o) ((r)->ft->returnObjectPath((r),(o))) # endif # ifdef CMPI_INLINE /** Indicates no further data to be returned. @param rslt Result this pointer. @return Service return status. */ inline static CMPIStatus CMReturnDone (const CMPIResult * rslt) { return ((rslt)->ft->returnDone ((rslt))); } # else # define CMReturnDone(r) ((r)->ft->returnDone((r))) # endif # ifdef CMPI_VER_200 # ifdef CMPI_INLINE /** Return a CMPIError object instance @param rslt Result this pointer. @param er Error to be returned. @return Service return status. */ inline static CMPIStatus CMReturnError (const CMPIResult* rslt, const CMPIError* er) { return ((rslt)->ft->returnError ((rslt), (er))); } # else # define CMReturnError(r,e) \ ((r)->ft->returnError((r),(e))) # endif # endif /* CMPI_VER_200 */ // CMPIContext Macros # ifdef CMPI_INLINE /** Gets a named Context entry value. @param ctx Context this pointer. @param name Context entry name. @param rc Output: Service return status (suppressed when NULL). @return Entry value. */ inline static CMPIData CMGetContextEntry (const CMPIContext * ctx, const char *name, CMPIStatus * rc) { return ((ctx)->ft->getEntry ((ctx), (name), (rc))); } # else # define CMGetContextEntry(c,n,rc) \ ((c)->ft->getEntry((c),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets a Context entry value defined by its index. @param ctx Context this pointer. @param index Position in the internal Data array. @param name Output: Returned Context entry name (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Entry value. */ inline static CMPIData CMGetContextEntryAt (const CMPIContext * ctx, CMPICount index, CMPIString ** name, CMPIStatus * rc) { return ((ctx)->ft->getEntryAt ((ctx), (index), (name), (rc))); } # else # define CMGetContextEntryAt(c,p,n,rc) \ ((c)->ft->getEntryAt((c),(p),(n),(rc))) # endif # ifdef CMPI_INLINE /** Gets the number of entries contained in this Context. @param ctx Context this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of entries. */ inline static CMPICount CMGetContextEntryCount (const CMPIContext * ctx, CMPIStatus * rc) { return ((ctx)->ft->getEntryCount ((ctx), (rc))); } # else # define CMGetContextEntryCount(c,rc) \ ((c)->ft->getEntryCount((c),(rc))) # endif # ifdef CMPI_INLINE /** adds/replaces a named Context entry @param ctx Context this pointer. @param name Entry name. @param value Address of value structure. @param type Value type. @return Service return status. */ inline static CMPIStatus CMAddContextEntry (const CMPIContext * ctx, const char *name, const CMPIValue * value, const CMPIType type) { return ((ctx)->ft->addEntry ((ctx), (name), (value), (type))); } # else # define CMAddContextEntry(c,n,v,t) \ ((c)->ft->addEntry((c),(n),(CMPIValue*)(v),(t))) # endif // CMPISelectExp macros # ifdef CMPI_INLINE /** Return the select expression in string format. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return The select expression. */ inline static CMPIString *CMGetSelExpString (const CMPISelectExp * se, CMPIStatus * rc) { return ((se)->ft->getString ((se), (rc))); } # else # define CMGetSelExpString(s,rc) ((s)->ft->getString((s),(rc))) # endif # ifdef CMPI_INLINE /** Evaluate the instance using this select expression. @param se SelectExp this pointer. @param inst Instance to be evaluated. @param rc Output: Service return status (suppressed when NULL). @return True or false incicator. */ inline static CMPIBoolean CMEvaluateSelExp (const CMPISelectExp * se, const CMPIInstance * inst, CMPIStatus * rc) { return ((se)->ft->evaluate ((se), (inst), (rc))); } # else # define CMEvaluateSelExp(s,i,r) ((s)->ft->evaluate((s),(i),(r))) # endif # ifdef CMPI_VER_87 # ifdef CMPI_INLINE /** Evaluate this select expression by using a data value accessor routine. . @param se SelectExp this pointer. @param accessor Data accessor routine to be used. @param parm Data accessor parameter. @param rc Output: Service return status (suppressed when NULL). @return True or false incicator. */ inline static CMPIBoolean CMEvaluateSelExpUsingAccessor (const CMPISelectExp * se, CMPIAccessor * accessor, void *parm, CMPIStatus * rc) { return ((se)->ft->evaluateUsingAccessor ((se), (accessor), (parm), (rc))); } # else # define CMEvaluateSelExpUsingAccessor(s,i,p,r) \ ((s)->ft->evaluateUsingAccessor((s),(i),(p),(r))) # endif # endif /* CMPI_VER_87 */ # ifdef CMPI_INLINE /** Return the select expression as disjunction of conjunctions. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return The disjunction. */ inline static CMPISelectCond *CMGetDoc (const CMPISelectExp * se, CMPIStatus * rc) { return ((se)->ft->getDOC ((se), (rc))); } # else # define CMGetDoc(s,rc) ((s)->ft->getDOC((s),(rc))) # endif # ifdef CMPI_INLINE /** Return the select expression as conjunction of disjunctions. @param se SelectExp this pointer. @param rc Output: Service return status (suppressed when NULL). @return The conjunction. */ inline static CMPISelectCond *CMGetCod (const CMPISelectExp * se, CMPIStatus * rc) { return ((se)->ft->getCOD ((se), (rc))); } # else # define CMGetCod(s,rc) ((s)->ft->getCOD((s),(rc))) # endif // CMPISelectCond macros # ifdef CMPI_INLINE /** Return the number of sub conditions that are partof this SelectCond. Optionally, the SelectCond type (COD or DOC) will be returned. @param sc SelectCond this pointer. @param type Output: SelectCond type (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return Number of SubCond elements. */ inline static CMPICount CMGetSubCondCountAndType (const CMPISelectCond * sc, int * type, CMPIStatus * rc) { return ((sc)->ft->getCountAndType ((sc), (type), (rc))); } # else # define CMGetSubCondCountAndType(c,t,rc) \ ((c)->ft->getCountAndType((c),(t),(rc))) # endif # ifdef CMPI_INLINE /** Return a SubCond element based on its index. @param sc SelectCond this pointer. @param index Position in the internal SubCoind array. @param rc Output: Service return status (suppressed when NULL). @return The indexed SubCond element. */ inline static CMPISubCond *CMGetSubCondAt (const CMPISelectCond * sc, CMPICount index, CMPIStatus * rc) { return ((sc)->ft->getSubCondAt ((sc), (index), (rc))); } # else # define CMGetSubCondAt(c,p,rc) ((c)->ft->getSubCondAt((c),(p),(rc))) # endif // CMPISubCond macros # ifdef CMPI_INLINE /** Return the number of predicates that are part of sub condition. @param sc SubCond this pointer. @param rc Output: Service return status (suppressed when NULL). @return Number of Predicate elements. */ inline static CMPICount CMGetPredicateCount (const CMPISubCond * sc, CMPIStatus * rc) { return ((sc)->ft->getCount ((sc), (rc))); } # else # define CMGetPredicateCount(s,rc) ((s)->ft->getCount((s),(rc))) # endif # ifdef CMPI_INLINE /** Return a Predicate element based on its index. @param sc SubCond this pointer. @param index Position in the internal Predicate array. @param rc Output: Service return status (suppressed when NULL). @return The indexed Predicate element. */ inline static CMPIPredicate *CMGetPredicateAt (const CMPISubCond * sc, CMPICount index, CMPIStatus * rc) { return ((sc)->ft->getPredicateAt ((sc), (index), (rc))); } # else # define CMGetPredicateAt(s,p,rc) \ ((s)->ft->getPredicateAt((s),(p),(rc))) # endif # ifdef CMPI_INLINE /** Return a named Predicate element. @param sc SubCond this pointer. @param name Predicate name (property name). @param rc Output: Service return status (suppressed when NULL). @return The named Predicate element. */ inline static CMPIPredicate *CMGetPredicate (const CMPISubCond * sc, const char *name, CMPIStatus * rc) { return ((sc)->ft->getPredicate ((sc), (name), (rc))); } # else # define CMGetPredicate(s,n,rc) ((s)->ft->getPredicate((s),(n),(rc))) # endif // CMPIPredicate macros # ifdef CMPI_INLINE /** Get the predicate components. @param pr Predicate this pointer. @param type Property type. @param op Predicate operation. @param lhs Left hand side of predicate. @param rhs Right hand side of predicate. @return Service return status. */ inline static CMPIStatus CMGetPredicateData (const CMPIPredicate * pr, CMPIType * type, CMPIPredOp * op, CMPIString ** lhs, CMPIString ** rhs) { return ((pr)->ft->getData ((pr), (type), (op), (lhs), (rhs))); } # else # define CMGetPredicateData(p,t,o,n,v) \ ((p)->ft->getData((p),(t),(o),(n),(v))) # endif # if defined(CMPI_VER_87) && !defined(CMPI_VER_100) # ifdef CMPI_INLINE /** Evaluate the predicate using a specific value. @param pr Predicate this pointer. @param type Property type. @param value Address of value structure. @param type Value type. @param rc Output: Service return status (suppressed when NULL). @return Evaluation result. */ inline static int CMEvaluatePredicate (CMPIPredicate* pr, void* value, CMPIType type, CMPIStatus* rc) { return ((pr)->ft->evaluate((pr),(CMPIValue*)(value),(type),(rc))); } # else # define CMEvaluatePredicate(p,v,t,rc) \ ((p)->ft->evaluate((p),(CMPIValue*)(v),(t),(rc))) # endif # endif /* CMPI_VER_87 && !CMPI_VER_100 */ # ifdef CMPI_VER_100 # ifdef CMPI_INLINE /** Evaluate this predicate by using a data value accessor routine. . @param accessor Data accessor routine to be used. @param parm Data accessor parameter. @param rc Output: Service return status (suppressed when NULL). @return Evaluation result. */ inline static int CMEvaluatePredicateUsingAccessor (const CMPIPredicate * pr, CMPIAccessor * accessor, void *parm, CMPIStatus * rc) { return ((pr)->ft->evaluateUsingAccessor ((pr), (accessor), (parm), (rc))); } # else # define CMEvaluatePredicateUsingAccessor(p,a,parm,rc) \ ((p)->ft->evaluateUsingAccessor((p),(a),(parm),(rc))) # endif # endif /* CMPI_VER_100 */ // CMPIBroker Macros # ifdef CMPI_INLINE /** 32 bits describing CMPI features supported by this CIMOM. See CMPI_MB_Class_x and CMPI_MB_Supports_xxx flags. */ inline static unsigned long CBGetClassification (const CMPIBroker * mb) { return ((mb)->bft->brokerClassification); } # else # define CBGetClassification(b) ((b)->bft->brokerClassification) # endif # ifdef CMPI_INLINE /** CIMOM version as defined by CIMOM */ inline static int CBBrokerVersion (const CMPIBroker * mb) { return ((mb)->bft->brokerVersion); } # else # define CBBrokerVersion(b) ((b)->bft->brokerVersion) # endif # ifdef CMPI_INLINE /** CIMOM name */ inline static const char * CBBrokerName (const CMPIBroker * mb) { return ((mb)->bft->brokerName); } # else # define CBBrokerName(b) ((b)->bft->brokerName) # endif # ifdef CMPI_INLINE /** This function prepares the CMPI run time system to accept a thread that will be using CMPI services. The returned CMPIContext object must be used by the subsequent attachThread() and detachThread() invocations. @param mb Broker this pointer. @param ctx Old Context object @return New Context object to be used by thread to be attached. */ inline static CMPIContext *CBPrepareAttachThread (const CMPIBroker * mb, const CMPIContext * ctx) { return ((mb)->bft->prepareAttachThread ((mb), (ctx))); } # else # define CBPrepareAttachThread(b,c) \ ((b)->bft->prepareAttachThread((b),(c))) # endif # ifdef CMPI_INLINE /** This function informs the CMPI run time system that the current thread with Context will begin using CMPI services. @param mb Broker this pointer. @param ctx Context object @return Service return status. */ inline static CMPIStatus CBAttachThread (const CMPIBroker * mb, const CMPIContext * ctx) { return ((mb)->bft->attachThread ((mb), (ctx))); } # else # define CBAttachThread(b,c) ((b)->bft->attachThread((b),(c))) # endif # ifdef CMPI_INLINE /** This function informs the CMPI run time system that the current thread will not be using CMPI services anymore. The Context object will be freed during this operation. @param mb Broker this pointer. @param ctx Context object @return Service return status. */ inline static CMPIStatus CBDetachThread (const CMPIBroker * mb, const CMPIContext * ctx) { return ((mb)->bft->detachThread ((mb), (ctx))); } # else # define CBDetachThread(b,c) ((b)->bft->detachThread((b),(c))) # endif # ifdef CMPI_INLINE /** This function requests delivery of an Indication. The CIMOM will locate pertinent subscribers and notify them about the event. @param mb Broker this pointer. @param ctx Context object @param ns Namespace @param ind Indication Instance @return Service return status. */ inline static CMPIStatus CBDeliverIndication (const CMPIBroker * mb, const CMPIContext * ctx, const char *ns, const CMPIInstance * ind) { return ((mb)->bft->deliverIndication ((mb), (ctx), (ns), (ind))); } # else # define CBDeliverIndication(b,c,n,i) \ ((b)->bft->deliverIndication((b),(c),(n),(i))) # endif # ifdef CMPI_INLINE /** Enumerate Instance Names of the class (and subclasses) defined by <op>. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace and classname components. @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPathes. */ inline static CMPIEnumeration *CBEnumInstanceNames (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, CMPIStatus * rc) { return ((mb)->bft->enumInstanceNames ((mb), (ctx), (op), (rc))); } # else # define CBEnumInstanceNames(b,c,p,rc) \ ((b)->bft->enumInstanceNames((b),(c),(p),(rc))) # endif # ifdef CMPI_INLINE /** Enumerate Instances of the class (and subclasses) defined by <op>. Instance structure and inheritance scope can be controled using the CMPIInvocationFlags entry in <ctx>. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace and classname components. @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return Enumeration of Instances. */ inline static CMPIEnumeration *CBEnumInstances (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char **properties, CMPIStatus * rc) { return ((mb)->bft->enumInstances ((mb), (ctx), (op), (properties), (rc))); } # else # define CBEnumInstances(b,c,p,pr,rc) \ ((b)->bft->enumInstances((b),(c),(p),(pr),(rc))) # endif # ifdef CMPI_INLINE /** Get Instance using <op> as reference. Instance structure can be controled using the CMPIInvocationFlags entry in <ctx>. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return The Instance. */ inline static CMPIInstance *CBGetInstance (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char **properties, CMPIStatus * rc) { return ((mb)->bft->getInstance ((mb), (ctx), (op), (properties), (rc))); } # else # define CBGetInstance(b,c,p,pr,rc) \ ((b)->bft->getInstance((b),(c),(p),(pr),(rc))) # endif # ifdef CMPI_INLINE /** Create Instance from <inst> using <op> as reference. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param inst Complete instance. @param rc Output: Service return status (suppressed when NULL). @return The assigned instance reference. */ inline static CMPIObjectPath *CBCreateInstance (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const CMPIInstance * inst, CMPIStatus * rc) { return ((mb)->bft->createInstance ((mb), (ctx), (op), (inst), (rc))); } # else # define CBCreateInstance(b,c,p,i,rc) \ ((b)->bft->createInstance((b),(c),(p),(i),(rc))) # endif # ifdef CMPI_VER_90 # ifdef CMPI_INLINE /** Replace an existing Instance from <inst> using <op> as reference. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param inst Complete instance. @param properties Specifies which properties to set. All properties will be ste if NULL. @return Service return status. */ # ifdef CMPI_VER_100 inline static CMPIStatus CBModifyInstance (const CMPIBroker* mb, const CMPIContext* ctx, const CMPIObjectPath* op, const CMPIInstance* inst, const char** properties) { return ((mb)->bft-> modifyInstance ((mb), (ctx), (op), (inst), (properties))); } # else inline static CMPIStatus CBSetInstance (const CMPIBroker* mb, const CMPIContext* ctx, const CMPIObjectPath* op, const CMPIInstance* inst, const char** properties) { return ((mb)->bft-> setInstance ((mb), (ctx), (op), (inst), (properties))); } # endif /* CMPI_VER_100 */ # else # ifdef CMPI_VER_100 # define CBModifyInstance(b,c,p,i,pr) ((b)->bft->modifyInstance((b),(c),(p),(i),(pr))) # else # define CBSetInstance(b,c,p,i,pr) ((b)->bft->setInstance((b),(c),(p),(i),(pr))) # endif /* CMPI_VER_100 */ # endif # else /* CMPI_VER_90 */ # ifdef CMPI_INLINE /** Replace an existing Instance from <inst> using <op> as reference. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param inst Complete instance. @return Service return status. */ inline static CMPIStatus CBSetInstance (CMPIBroker* mb, CMPIContext* ctx, CMPIObjectPath* op, CMPIInstance* inst) { return ((mb)->bft-> setInstance ((mb), (ctx), (op), (inst), NULL)); } # else # define CBSetInstance(b,c,p,i) ((b)->bft->setInstance((b),(c),(p),(i),NULL)) # endif # endif /* CMPI_VER_90 */ # ifdef CMPI_INLINE /** Delete an existing Instance using <op> as reference. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @return Service return status. */ inline static CMPIStatus CBDeleteInstance (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op) { return ((mb)->bft->deleteInstance ((mb), (ctx), (op))); } # else # define CBDeleteInstance(b,c,p) ((b)->bft->deleteInstance((b),(c),(p))) # endif # ifdef CMPI_INLINE /** Query the enumeration of instances of the class (and subclasses) defined by <op> using <query> expression. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace and classname components. @param query Query expression @param lang Query Language @param rc Output: Service return status (suppressed when NULL). @return Resulting eumeration of Instances. */ inline static CMPIEnumeration *CBExecQuery (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *query, const char *lang, CMPIStatus * rc) { return ((mb)->bft->execQuery ((mb), (ctx), (op), (query), (lang), (rc))); } # else # define CBExecQuery(b,c,p,l,q,rc) \ ((b)->bft->execQuery((b),(c),(p),(l),(q),(rc))) # endif # ifdef CMPI_INLINE /** Enumerate instances associated with the Instance defined by the <op>. @param mb Broker this pointer. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param assocClass If not NULL, MUST be a valid Association Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Instance of this Class or one of its subclasses. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param resultRole If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the returned Object MUST match the value of this parameter). @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return Enumeration of Instances. */ inline static CMPIEnumeration *CBAssociators (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, const char **properties, CMPIStatus * rc) { return ((mb)->bft-> associators ((mb), (ctx), (op), (assocClass), (resultClass), (role), (resultRole), (properties), (rc))); } # else # define CBAssociators(b,c,p,acl,rcl,r,rr,pr,rc) \ ((b)->bft->associators((b),(c),(p),(acl),(rcl),(r),(rr),(pr),(rc))) # endif # ifdef CMPI_INLINE /** Enumerate ObjectPaths associated with the Instance defined by <op>. @param mb Broker this pointer. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param assocClass If not NULL, MUST be a valid Association Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Instance of this Class or one of its subclasses. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param resultRole If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the returned Object MUST match the value of this parameter). @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPaths. */ inline static CMPIEnumeration *CBAssociatorNames (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, CMPIStatus * rc) { return ((mb)->bft->associatorNames ((mb), (ctx), (op), (assocClass), (resultClass), (role), (resultRole), (rc))); } # else # define CBAssociatorNames(b,c,p,acl,rcl,r,rr,rc) \ ((b)->bft->associatorNames((b),(c),(p),(acl),(rcl),(r),(rr),(rc))) # endif # ifdef CMPI_INLINE /** Enumerates the association instances that refer to the instance defined by <op>. @param mb Broker this pointer. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param properties If not NULL, the members of the array define one or more Property names. Each returned Object MUST NOT include elements for any Properties missing from this list @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPaths. */ inline static CMPIEnumeration *CBReferences (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *resultClass, const char *role, const char **properties, CMPIStatus * rc) { return ((mb)->bft->references ((mb), (ctx), (op), (resultClass), (role), (properties), (rc))); } # else # define CBReferences(b,c,p,acl,r,pr,rc) \ ((b)->bft->references((b),(c),(p),(acl),(r),(pr),(rc))) # endif # ifdef CMPI_INLINE /** Enumerates the association ObjectPaths that refer to the instance defined by <op>. @param mb Broker this pointer. @param ctx Context object @param op Source ObjectPath containing namespace, classname and key components. @param resultClass If not NULL, MUST be a valid Class name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses). @param role If not NULL, MUST be a valid Property name. It acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). @param rc Output: Service return status (suppressed when NULL). @return Enumeration of ObjectPaths. */ inline static CMPIEnumeration *CBReferenceNames (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *resultClass, const char *role, CMPIStatus * rc) { return ((mb)->bft-> referenceNames ((mb), (ctx), (op), (resultClass), (role), (rc))); } # else # define CBReferenceNames(b,c,p,acl,r,rc) \ ((b)->bft->referenceNames((b),(c),(p),(acl),(r),(rc))) # endif # ifdef CMPI_INLINE /** Invoke a named, extrinsic method of an Instance defined by the <op> parameter. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param method Method name @param in Input parameters. @param out Output parameters. @param rc Output: Service return status (suppressed when NULL). @return Method return value. */ inline static CMPIData CBInvokeMethod (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *method, const CMPIArgs * in, CMPIArgs * out, CMPIStatus * rc) { return ((mb)->bft-> invokeMethod ((mb), (ctx), (op), (method), (in), (out), (rc))); } # else # define CBInvokeMethod(b,c,p,m,ai,ao,rc) \ ((b)->bft->invokeMethod((b),(c),(p),(m),(ai),(ao),(rc))) # endif # ifdef CMPI_INLINE /** Set the named property value of an Instance defined by the <op> parameter. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param name Property name @param value Value. @param type Value type. @return Service return status. */ inline static CMPIStatus CBSetProperty (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *name, const CMPIValue * value, const CMPIType type) { return ((mb)->bft->setProperty ((mb), (ctx), (op), (name), (CMPIValue *) (value), (type))); } # else # define CBSetProperty(b,c,p,n,v,t) \ ((b)->bft->setProperty((b),(c),(p),(n),(CMPIValue*)(v),(t))) # endif # ifdef CMPI_INLINE /** Get the named property value of an Instance defined by the <op> parameter. @param mb Broker this pointer. @param ctx Context object @param op ObjectPath containing namespace, classname and key components. @param name Property name @param rc Output: Service return status (suppressed when NULL). @return Property value. */ inline static CMPIData CBGetProperty (const CMPIBroker * mb, const CMPIContext * ctx, const CMPIObjectPath * op, const char *name, CMPIStatus * rc) { return (mb)->bft->getProperty ((mb), (ctx), (op), (name), (rc)); } # else # define CBGetProperty(b,c,p,n,rc) \ (b)->bft->getProperty((b),(c),(p),(n),(rc)) # endif # ifndef DOC_ONLY // MI factory stubs // Used when the MI factory function is not going to call // a function during initialization. # define CMNoHook # endif /* ----------------- C provider factories --------------------- */ # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an instance provider. The initialization routine <pn>Create_InstanceMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in plain C. @param pfx The prefix for all mandatory association provider functions. This is a character string without quotes. Mandatory functions are: <pfx>Cleanup, <pfx>EnumInstanceNames, <pfx>EnumInstances, <pfx>GetInstance, <pfx>CreateInstance, <pfx>SetInstance, <pfx>DeleteInstance and <pfx>ExecQuery. @param pn The provider name under which this provider is registered. This is a character string without quotes. @param broker The name of the broker variable used by this macro to store the CMPIBroker pointer @param hook A statement that is executed within <pn>Create_InstanceMI routine. This enables you to perform additional initialization functions and is normally a function call like furtherInit(broker) or CMNoHook. Use CMNoHook if no further intialization is required. @return The function table of this instance provider. */ CMPIInstanceMI *CMInstanceMIStub (chars pfx, chars pn, CMPIBroker * broker, statement hook); # else # ifdef CMPI_VER_100 # define CMInstanceMIStubChange(pfx) pfx##ModifyInstance # else # define CMInstanceMIStubChange(pfx) pfx##SetInstance # endif /* CMPI_VER_100 */ # define CMInstanceMIStub(pfx,pn,broker,hook) \ static CMPIInstanceMIFT instMIFT__={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "instance" #pn, \ pfx##Cleanup, \ pfx##EnumInstanceNames, \ pfx##EnumInstances, \ pfx##GetInstance, \ pfx##CreateInstance, \ CMInstanceMIStubChange(pfx), \ pfx##DeleteInstance, \ pfx##ExecQuery, \ }; \ CMPI_EXTERN_C \ CMPIInstanceMI* pn##_Create_InstanceMI(const CMPIBroker* brkr,const CMPIContext *ctx, CMPIStatus *rc) { \ static CMPIInstanceMI mi={ \ NULL, \ &instMIFT__, \ }; \ broker=brkr; \ hook; \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an association provider. The initialization routine <pn>Create_AssociationMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in plain C. @param pfx The prefix for all mandatory instance provider functions. This is a character string without quotes. Mandatory functions are: <pfx>AssociationCleanup, <pfx>Associators, <pfx>AssociatorNames, <pfx>References and <pfx>ReferenceNames. @param pn The provider name under which this provider is registered. This is a character string without quotes. @param broker The name of the broker variable used by this macro to store the CMPIBroker pointer @param hook A statement that is executed within <pn>Create_AssociationMI routine. This enables you to perform additional initialization functions and is normally a function call like furtherInit(broker) or CMNoHook. Use CMNoHook if no further intialization is required. @return The function table of this association provider. */ CMPIAssociationMI *CMAssociationMIStub (chars pfx, chars pn, CMPIBroker * broker, statement hook); # else # define CMAssociationMIStub(pfx,pn,broker,hook) \ static CMPIAssociationMIFT assocMIFT__={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "association" #pn, \ pfx##AssociationCleanup, \ pfx##Associators, \ pfx##AssociatorNames, \ pfx##References, \ pfx##ReferenceNames, \ }; \ CMPI_EXTERN_C \ CMPIAssociationMI* pn##_Create_AssociationMI(const CMPIBroker* brkr,const CMPIContext *ctx, CMPIStatus *rc) { \ static CMPIAssociationMI mi={ \ NULL, \ &assocMIFT__, \ }; \ broker=brkr; \ hook; \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for a method provider. The initialization routine <pn>Create_MethodMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in plain C. @param pfx The prefix for all mandatory method provider functions. This is a character string without quotes. Mandatory functions are: <pfx>MthodCleanup and <pfx>InvokeMethod. @param pn The provider name under which this provider is registered. This is a character string without quotes. @param broker The name of the broker variable used by this macro to store the CMPIBroker pointer @param hook A statement that is executed within <pn>Create_MethodMI routine. This enables you to perform additional initialization functions and is normally a function call like furtherInit(broker) or CMNoHook. Use CMNoHook if no further intialization is required. @return The function table of this method provider. */ CMPIMethodMI *CMMethodMIStub (chars pfx, chars pn, CMPIBroker * broker, statement hook); # else # define CMMethodMIStub(pfx,pn,broker,hook) \ static CMPIMethodMIFT methMIFT__={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "method" #pn, \ pfx##MethodCleanup, \ pfx##InvokeMethod, \ }; \ CMPI_EXTERN_C \ CMPIMethodMI* pn##_Create_MethodMI(const CMPIBroker* brkr, const CMPIContext *ctx, CMPIStatus *rc) { \ static CMPIMethodMI mi={ \ NULL, \ &methMIFT__, \ }; \ broker=brkr; \ hook; \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for a property provider. The initialization routine <pn>Create_PropertyMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in plain C. @param pfx The prefix for all mandatory property provider functions. This is a character string without quotes. Mandatory functions are: <pfx>PropertyCleanup, <pfx>SetProperty and <pfx>GetProperty. @param pn The provider name under which this provider is registered. This is a character string without quotes. @param broker The name of the broker variable used by this macro to store the CMPIBroker pointer @param hook A statement that is executed within <pn>Create_PropertyMI routine. This enables you to perform additional initialization functions and is normally a function call like furtherInit(broker) or CMNoHook. Use CMNoHook if no further intialization is required. @return The function table of this property provider. */ CMPIPropertyMI *CMPropertyMIStub (chars pfx, chars pn, CMPIBroker * broker, statement hook); # else # define CMPropertyMIStub(pfx,pn,broker,hook) \ static CMPIPropertyMIFT propMIFT__={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "property" #pn, \ pfx##PropertyCleanup, \ pfx##SetProperty, \ pfx##GetProperty, \ }; \ CMPI_EXTERN_C \ CMPIPropertyMI* pn##_Create_PropertyMI(const CMPIBroker* brkr,const CMPIContext *ctx, CMPIStatus *rc) { \ static CMPIPropertyMI mi={ \ NULL, \ &propMIFT__, \ }; \ broker=brkr; \ hook; \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an indication provider. The initialization routine <pn>Create_IndicationMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in plain C. @param pfx The prefix for all mandatory indication provider functions. This is a character string without quotes. Mandatory functions are: <pfx>IndicationCleanup, <pfx>AuthorizeFilter, <pfx>MustPoll, <pfx>ActivateFilter and <pfx>DeActivateFilter. @param pn The provider name under which this provider is registered. This is a character string without quotes. @param broker The name of the broker variable used by this macro to store the CMPIBroker pointer @param hook A statement that is executed within <pn>Create_IndicationMI routine. This enables you to perform additional initialization functions and is normally a function call like furtherInit(broker) or CMNoHook. Use CMNoHook if no further intialization is required. @return The function table of this indication provider. */ CMPIIndicationMI *CMIndicationMIStub (chars pfx, chars pn, CMPIBroker * broker, statement hook); # else # ifdef CMPI_VER_86 # define CMIndicationMIStubExtensions(pfx) pfx##EnableIndications, \ pfx##DisableIndications, # else # define CMIndicationMIStubExtensions(pfx) # endif /* CMPI_VER_86 */ # define CMIndicationMIStub(pfx,pn,broker,hook) \ static CMPIIndicationMIFT indMIFT__={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "Indication" #pn, \ pfx##IndicationCleanup, \ pfx##AuthorizeFilter, \ pfx##MustPoll, \ pfx##ActivateFilter, \ pfx##DeActivateFilter, \ CMIndicationMIStubExtensions(pfx) \ }; \ CMPI_EXTERN_C \ CMPIIndicationMI* pn##_Create_IndicationMI(const CMPIBroker* brkr,const CMPIContext *ctx,CMPIStatus *rc) { \ static CMPIIndicationMI mi={ \ NULL, \ &indMIFT__, \ }; \ broker=brkr; \ hook; \ return &mi; \ } # endif /* ----------------- C++ provider factories --------------------- */ # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an instance provider. The initialization routine <pn>Create_IndicationMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in C++ using the Cmpi* classes. @param cn The C++ class name of this instance provider (a subclass of CmpiInstanceMI). This is a character string without quotes. @param pn The provider name under which this provider is registered. This is a character string without quotes. @return The function table of this instance provider. */ CMPIInstanceMI *CMInstanceMIFactory (chars cn, chars pn); # else # define CMInstanceMIFactory(cn,pn) \ CMPI_EXTERN_C \ CMPIInstanceMI* pn##_Create_InstanceMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIInstanceMIFT instMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "instance" #pn, \ (CMPIStatus(*)(CMPIInstanceMI*,const CMPIContext*,CMPIBoolean))CmpiBaseMI::driveBaseCleanup, \ CmpiInstanceMI::driveEnumInstanceNames, \ CmpiInstanceMI::driveEnumInstances, \ CmpiInstanceMI::driveGetInstance, \ CmpiInstanceMI::driveCreateInstance, \ CmpiInstanceMI::driveSetInstance, \ CmpiInstanceMI::driveDeleteInstance, \ CmpiInstanceMI::driveExecQuery, \ }; \ static CMPIInstanceMI mi; \ CmpiContext ctx((CMPIContext*)ctxp); \ mi.ft=&instMIFT; \ CmpiBaseMI *provider=base##pn.getBaseMI(); \ if (provider == 0) {\ provider = new cn(CmpiBroker((CMPIBroker*)broker),ctx); \ provider->setProviderBase(&base##pn); \ provider->initialize(ctx); \ base##pn.setBaseMI(provider); \ } \ mi.hdl=provider; \ base##pn.incUseCount(); \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an association provider. The initialization routine <pn>Create_AssociationMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in C++ using the Cmpi* classes. @param cn The C++ class name of this instance provider (a subclass of CmpiInstanceMI). This is a character string without quotes. @param pn The provider name under which this provider is registered. This is a character string without quotes. @return The function table of this instance provider. */ CMPIAssociationMI *CMAssociationMIFactory (chars cn, chars pn); # else # define CMAssociationMIFactory(cn,pn) \ CMPI_EXTERN_C \ CMPIAssociationMI* pn##_Create_AssociationMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIAssociationMIFT assocMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "association" #pn, \ (CMPIStatus(*)(CMPIAssociationMI*,const CMPIContext*,CMPIBoolean))CmpiBaseMI::driveBaseCleanup, \ CmpiAssociationMI::driveAssociators, \ CmpiAssociationMI::driveAssociatorNames, \ CmpiAssociationMI::driveReferences, \ CmpiAssociationMI::driveReferenceNames, \ }; \ static CMPIAssociationMI mi; \ CmpiContext ctx((CMPIContext*)ctxp); \ mi.ft=&assocMIFT; \ CmpiBaseMI *provider=base##pn.getBaseMI(); \ if (provider == 0) {\ provider = new cn(CmpiBroker((CMPIBroker*)broker),ctx); \ provider->setProviderBase(&base##pn); \ provider->initialize(ctx); \ base##pn.setBaseMI(provider); \ } \ mi.hdl=provider; \ base##pn.incUseCount(); \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an method provider. The initialization routine <pn>Create_MethodMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in C++ using the Cmpi* classes. @param cn The C++ class name of this method provider (a subclass of CmpiMethodMI). This is a character string without quotes. @param pn The provider name under which this provider is registered. This is a character string without quotes. @return The function table of this association provider. */ CMPIMethodMI *CMMethodMIFactory (chars cn, chars pn); # else # define CMMethodMIFactory(cn,pn) \ CMPI_EXTERN_C \ CMPIMethodMI* pn##_Create_MethodMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIMethodMIFT methMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "method" #pn, \ (CMPIStatus(*)(CMPIMethodMI*,const CMPIContext*, CMPIBoolean))CmpiBaseMI::driveBaseCleanup, \ CmpiMethodMI::driveInvokeMethod, \ }; \ static CMPIMethodMI mi; \ CmpiContext ctx((CMPIContext*)ctxp); \ mi.ft=&methMIFT; \ CmpiBaseMI *provider=base##pn.getBaseMI(); \ if (provider == 0) {\ provider = new cn(CmpiBroker((CMPIBroker*)broker),ctx); \ provider->setProviderBase(&base##pn); \ provider->initialize(ctx); \ base##pn.setBaseMI(provider); \ } \ mi.hdl=provider; \ base##pn.incUseCount(); \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for a property provider. The initialization routine <pn>Create_PropertyMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in C++ using the Cmpi* classes. @param cn The C++ class name of this method provider (a subclass of CmpiMethodMI). This is a character string without quotes. @param pn The provider name under which this provider is registered. This is a character string without quotes. @return The function table of this association provider. */ CMPIPropertyMI * CMPropertyMIFactory (chars cn, chars pn): # else # define CMPropertyMIFactory(cn,pn) \ CMPI_EXTERN_C \ CMPIPropertyMI* pn##_Create_PropertyMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIPropertyMIFT propMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "property" #pn, \ (CMPIStatus(*)(CMPIPropertyMI*,const CMPIContext*,CMPIBoolean))CmpiBaseMI::driveBaseCleanup, \ CmpiPropertyMI::driveSetProperty, \ CmpiPropertyMI::driveGetProperty, \ }; \ static CMPIPropertyMI mi; \ CmpiContext ctx((CMPIContext*)ctxp); \ mi.ft=&propMIFT; \ CmpiBaseMI *provider=base##pn.getBaseMI(); \ if (provider == 0) {\ provider = new cn(CmpiBroker((CMPIBroker*)broker),ctx); \ provider->setProviderBase(&base##pn); \ provider->initialize(ctx); \ base##pn.setBaseMI(provider); \ } \ mi.hdl=provider; \ base##pn.incUseCount(); \ return &mi; \ } # endif # ifdef DOC_ONLY /** This macro generates the function table and initialization stub for an indication provider. The initialization routine <pn>Create_IndicationMI is called when this provider module is loaded by the broker. This macro is for CMPI providers written in C++ using the Cmpi* classes. @param cn The C++ class name of this indication provider (a subclass of CmpiIndicationMI). This is a character string without quotes. @param pn The provider name under which this provider is registered. This is a character string without quotes. @return The function table of this association provider. */ CMPIIndicationMI *CMIndicationMIFactory (chars cn, chars pn); # else # ifdef CMPI_VER_86 # define CMIndicationMIFactoryExtensions CmpiIndicationMI::driveEnableIndications, \ CmpiIndicationMI::driveDisableIndications, # else # define CMIndicationMIFactoryExtensions # endif /* CMPI_VER_86 */ # define CMIndicationMIFactory(cn,pn) \ CMPI_EXTERN_C \ CMPIIndicationMI* pn##_Create_IndicationMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIIndicationMIFT indMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ "indication" #pn, \ (CMPIStatus(*)(CMPIIndicationMI*,const CMPIContext*,CMPIBoolean))CmpiBaseMI::driveBaseCleanup, \ CmpiIndicationMI::driveAuthorizeFilter, \ CmpiIndicationMI::driveMustPoll, \ CmpiIndicationMI::driveActivateFilter, \ CmpiIndicationMI::driveDeActivateFilter, \ CMIndicationMIFactoryExtensions \ }; \ static CMPIIndicationMI mi; \ CmpiContext ctx((CMPIContext*)ctxp); \ mi.ft=&indMIFT; \ CmpiBaseMI *provider=base##pn.getBaseMI(); \ if (provider == 0) {\ provider = new cn(CmpiBroker((CMPIBroker*)broker),ctx); \ provider->setProviderBase(&base##pn); \ provider->initialize(ctx); \ base##pn.setBaseMI(provider); \ } \ mi.hdl=provider; \ base##pn.incUseCount(); \ return &mi; \ } # endif # define CMProviderBase(pn) \ CmpiProviderBase base##pn; #endif // _CMPIMACS_H_ libopendrim-1.1.3/README0000644000175000017500000000067011404077256015443 0ustar guillaumeguillaume--------------------------------------------------------- REQUIREMENTS --------------------------------------------------------- For compliling: gcc >= 3.2.0 cmpi header files >= ver 86 autoconf >= 2.57 automake >= 1.5 libtool (preferably >= 1.8.5) For running: OpenPegasus >= 2.5.2 OR SBLIM sfcb >= 1.2.0 OR OpenWBEM >= 3.2.2 In the case of pegasus installed from sources, the PEGASUS_HOME and PEGASUS_ROOT variable MUST be defined! libopendrim-1.1.3/Common.cpp0000644000175000017500000010720111404077256016515 0ustar guillaumeguillaume/*################################################################################ # Linux Management Providers (LMP), Provider Common Library # Copyright (C) 2007 Frederic Desmons, ETRI # # This program is being developed under the "OpenDRIM" project. # The "OpenDRIM" project web page: http://opendrim.sourceforge.net # The "OpenDRIM" project mailing list: opendrim@googlegroups.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ################################################################################# ################################################################################# # To contributors, please leave your contact information in this section # AND comment your changes in the source code. # # Modified by 2008 Guillaume BOTTEX, ETRI ################################################################################*/ #include "Common.h" #include "net_dev.h" #include #include using namespace std; /* ---------------------------------------------------------------------------*/ /* System Calls */ /* ---------------------------------------------------------------------------*/ int CF_runCommand(const string& cmd, string& stdout_msg, string& stderr_msg, string& errorMessage) { CF_assert(CF_runCommand(cmd, stdout_msg, stderr_msg, false, errorMessage)); return OK; } // Modified by Ilsoo Byun (2007/08/14) // - Removal of disk access // - Sync problem is also solved. // Modified by Frederic Desmons (2007/06/15) // Multi-Process support for runCommand int CF_runCommand(const string& cmd, string& stdout_msg, string& stderr_msg, bool do_trace, string& errorMessage) { stdout_msg.clear(); stderr_msg.clear(); // to get stdout int stdout_fd[2]; if (pipe(stdout_fd) == -1) { errorMessage = strerror(errno); return FAILED; } // to get stderr int stderr_fd[2]; if (pipe(stderr_fd) == -1) { errorMessage = strerror(errno); return FAILED; } pid_t pid = fork(); if (pid == -1) { errorMessage = strerror(errno); return FAILED; } if (pid != 0) { // parent process // close the write side if (close(stdout_fd[1]) < 0) { errorMessage = strerror(errno); return FAILED; } if (close(stderr_fd[1]) < 0) { errorMessage = strerror(errno); return FAILED; } fd_set readfds; int fdmax; if (stdout_fd[0] > stderr_fd[0]) fdmax = stdout_fd[0]; else fdmax = stderr_fd[0]; char buf[513]; bool stdout_done = false; bool stderr_done = false; while (1) { if (stdout_done && stderr_done) break; FD_ZERO(&readfds); if (!stdout_done) FD_SET(stdout_fd[0], &readfds); if (!stderr_done) FD_SET(stderr_fd[0], &readfds); if (select(fdmax+1, &readfds, NULL, NULL, NULL) < 0) { errorMessage = strerror(errno); return FAILED; } if (FD_ISSET(stdout_fd[0], &readfds)) { ssize_t count = read(stdout_fd[0], buf, 512); if (count == 0) { // EOF stdout_done = true; if (close(stdout_fd[0]) < 0) { errorMessage = strerror(errno); return FAILED; } continue; } if (count < 0) { errorMessage = strerror(errno); return FAILED; } buf[count] = '\0'; // success stdout_msg.append(buf); continue; } if (FD_ISSET(stderr_fd[0], &readfds)) { ssize_t count = read(stderr_fd[0], buf, 512); if (count == 0) { // EOF stderr_done = true; if (close(stderr_fd[0]) < 0) { errorMessage = strerror(errno); return FAILED; } continue; } if (count < 0) { errorMessage = strerror(errno); return FAILED; } buf[count] = '\0'; // success stderr_msg.append(buf); // print strace result into the debug file // warning: strace result is added to stderr if (do_trace) system(("echo \"" + (string) buf + "\" >> cmpi_prov_debug.txt").c_str()); continue; } } int status; waitpid (pid, &status, 0); if (status == -1 || status == 127) { errorMessage = "Failed to execute: "+cmd+"\n"+stderr_msg; return FAILED; } return OK; } else { // child process // close the read side if (close(stdout_fd[0]) < 0) { errorMessage = strerror(errno); exit(FAILED); } if (close(stderr_fd[0]) < 0) { errorMessage = strerror(errno); exit(FAILED); } // redirect stdout if (dup2(stdout_fd[1], 1) < 0) { errorMessage = strerror(errno); exit(FAILED); } // redirect stderr if (dup2(stderr_fd[1], 2) < 0) { errorMessage = strerror(errno); exit(FAILED); } // close the write side, this will only be effective when the child fork by 'system' dies if (close(stdout_fd[1]) < 0) { errorMessage = strerror(errno); exit(FAILED); } if (close(stderr_fd[1]) < 0) { errorMessage = strerror(errno); exit(FAILED); } // openwbem sets the sigmask so the executed command may block. // to avoid this situation we set to an empty mask. sigset_t set, old_set; sigemptyset(&set); sigprocmask(SIG_SETMASK, &set, &old_set); // in standard English please ;) string _cmd = cmd; if (do_trace) _cmd = "/usr/bin/strace " + _cmd; _cmd = "LANG=C " + _cmd; // execute the command int rc = system(_cmd.c_str()); if (rc != 0) exit(FAILED); exit(OK); } } // Added by Frederic Desmons (2007/07/10) int CF_runCommandFL(const string& cmd, string& stdOut, string& errorMessage) { string stdErr; CF_assert(CF_runCommand(cmd, stdOut, stdErr, errorMessage)); size_t i = stdOut.find('\n'); if (i != string::npos) stdOut.erase(i, string::npos); return OK; } // Added by Frederic Desmons (2007/07/16) int CF_runCommandToLines(const string& cmd, vector& output, unsigned long expected_number_of_lines, string& errorMessage) { string cmd_output, stdErr; CF_assert(CF_runCommand(cmd, cmd_output, stdErr, errorMessage)); output.clear(); CF_splitText(output, cmd_output, '\n'); if (expected_number_of_lines != 0 && output.size() != expected_number_of_lines) { errorMessage = "Wrong format: " + cmd + "output"; return FAILED; } return OK; } // Modified by Ilsoo Byun (2007/05/09) // If '/bin/hostname -f' fails, it tries to execute '/bin/hostname' without options. int CF_getSystemName(string& sysName, string& errorMessage) { /* string value, errout; if (CF_runCommand("/bin/hostname -f", sysName, errout, errorMessage)!=OK) { CF_assert( CF_runCommand("/bin/hostname", sysName, errout, errorMessage)); } sysName = CF_trimText(sysName); return OK;*/ /*string ip; CF_getMachineIP(ip, errorMessage); struct hostent* host = gethostbyname(ip.c_str()); if (host == NULL) return FAILED; sysName = host->h_name; free(host); return OK;*/ // Modified by Ilsoo Byun(2008/10/02) struct utsname uts; if (uname(&uts) < 0) { errorMessage = "Failed to get system name: " + (string) strerror(errno); return FAILED; } sysName = uts.nodename; return OK; } // Added by Frederic Desmons (2007/06/28) // Modified by Frederic Desmons (2007/07/10) int CF_getOSName(string& OSName, string& errorMessage) { //CF_assert(CF_runCommandFL("/bin/uname -o", OSName, errorMessage)); //return OK; struct utsname uts; if (uname(&uts) < 0) { errorMessage = "failed to get os: " + (string) strerror(errno); return FAILED; } OSName = uts.sysname; return OK; } // Added by Ilsoo Byun (2007/05/09) int CF_getEthernetPortNames(vector& result, string& errorMessage) { // Modified by Guillaume BOTTEX (2008/11/21) // Now using sockets to get the Ethernet port names struct net_proc* devices; int count = CN_getNetDevices(&devices); for (int i = 0; i < count; ++i) { if (!CF_startsWith(devices[i].name, "eth")) continue; result.push_back(devices[i].name); } CN_releaseNetDevices(&devices, count); sort(result.begin(), result.end()); return OK; } // Added by Ilsoo Byun (2007/05/09) int CF_getIP(const string& ethName, string& ip, string& errorMessage) { // Modified by Frederic Desmons (2007/11/12) // Get only the first line of the std output /*string value; CF_assert( CF_runCommandFL("/sbin/ifconfig "+ethName+" | awk '/HWaddr/{} /inet addr/{print $2}'", value, errorMessage) ); ip = CF_trimText(value); if ( CF_startsWithNoCase(ip, "addr:") ) ip = ip.substr(5); return OK;*/ // Modified by Ilsoo Byun(2008/10/02) const char* result = CN_getIP(ethName.c_str()); if (result == NULL) { errorMessage = "CF_getIP failed"; return FAILED; } ip = string(result); free((void *) result); return OK; } // Added by Ilsoo Byun (2007/05/09) int CF_getMachineIP(string& ip, string& errorMessage) { //string _ip; // Modified by Frederic Desmons (2007/11/12) // Ignore loopback and empty results as well (case there is more than one interface) /* vector result; CF_assert(CF_getEthernetPortNames(result, errorMessage)); for (unsigned int i=0; i < result.size(); i++) { CF_assert(CF_getIP(result[i], _ip, errorMessage)); if (_ip != "127.0.0.1" && _ip !="") { ip = _ip; return OK; } }*/ // Means the system has no configured interface... unlikely //ip = "127.0.0.1"; //return OK; /* int rc = OK; if (_ip.length() == 0) { vector result; rc = CF_getEthernetPortNames(result, errorMessage); if (rc != OK || result.size() < 1) return rc; CF_assert( CF_getIP(result[0], _ip, errorMessage) ); if (_ip == "127.0.0.1") { if (result.size() > 1) { CF_assert( CF_getIP(result[1], _ip, errorMessage) ); } else { errorMessage = "Failed to get an IP address"; return FAILED; } } } ip = _ip; return rc; */ struct net_proc* devices; int count = CN_getNetDevices(&devices); for (int i = 0; i < count; ++i) { if (!CF_startsWith(devices[i].name, "eth")) continue; const char* _ip = CN_getIP(devices[i].name); if (_ip == NULL || strcmp(_ip, "127.0.0.1") == 0) { free((void *) _ip); continue; } else { ip = _ip; free((void *) _ip); return OK; } } CN_releaseNetDevices(&devices, count); ip = "127.0.0.1"; return OK; } // Refer to the below URL for block size calculation // http://www.faqs.org/docs/Linux-mini/Partition.html#BLOCKSIZE int CF_getBlockSize(const string& path, int& blocksize, int& num_blocks, string& errorMessage) { string stdout, stderr, line; CF_assert(CF_runCommand("fdisk -l "+path, stdout, stderr, errorMessage)); istringstream iss(stdout); int heads = 0; int sectors = 0; int bytes = 0; unsigned long long p_size = 0; while (getline(iss, line)) { if (CF_startsWith(line, "Disk "+path)) { vector tokens; CF_splitTextBySpace(tokens, line); p_size = atoi(tokens[4].c_str()); } if (heads == 0) { string::size_type pos = line.find("heads"); if (pos != string::npos) { string heads_str = line.substr(0, pos); heads = atoi(heads_str.c_str()); } } if (sectors == 0) { string::size_type pos = line.find(" sectors/track"); if (pos != string::npos) { string sectors_str = line.substr(0, pos); sectors_str = sectors_str.substr(sectors_str.find_last_of(' ')); sectors = atoi(sectors_str.c_str()); } } if (bytes == 0) { const string start_line = "Units = cylinders of"; if (CF_startsWith(line, start_line)) { string::size_type pos = line.find("*"); bytes = atoi(line.substr(pos+2).c_str()); } } } blocksize = heads * sectors * bytes / 1024; if (blocksize == 0) { errorMessage = "Failed to calculate the block size of "+path; return FAILED; } num_blocks = p_size / blocksize; return OK; } int CF_getWhatisFL(const string& name, string& output, string& errorMessage) { CF_assert(CF_runCommandFL("whatis "+name,output,errorMessage)); int pos; if((pos=output.find_first_of('-'))!=string::npos) output=output.substr(pos+2); else output.clear(); return OK; } /* ---------------------------------------------------------------------------*/ /* File manipulation */ /* ---------------------------------------------------------------------------*/ extern int errno; // Added by Ilsoo Byun (2007/06/15) int CF_lock(const struct flock& file_lock, int& fd, string& errorMessage) { _E_; const char* lock_file = "/root/.opendrim_lock"; fd = open(lock_file, O_RDWR | O_CREAT); if (fcntl(fd, F_SETLKW, &file_lock) == -1) { close(fd); string strerr = strerror(errno); errorMessage = "Failed to lock: "+strerr; return FAILED; }; _L_; return OK; } // Added by Ilsoo Byun (2007/06/15) int CF_unlock(struct flock& file_lock, int fd, string& errorMessage) { _E_; file_lock.l_type = F_UNLCK; if (fcntl(fd, F_SETLKW, &file_lock) == -1) { close(fd); string strerr = strerror(errno); errorMessage = "Failed to lock: "+strerr; return FAILED; } close(fd); _L_; return OK; } int CF_readTextFile(const string& path, string& content, string& errorMessage) { FILE* file; char buf[1025]; content.clear(); file = fopen(path.c_str(), "r"); if (file == NULL) { errorMessage = "Unable to open file: " + path; return FAILED; } while(!feof(file)) { if (fgets(buf,1024,file) != NULL) content += buf; else break; } fclose(file); return OK; } // Added by Frederic Desmons (2007/07/16) int CF_readTextFileFL(const string& path, string& content, string& errorMessage) { vector file_content_lines; CF_assert(CF_readTextFileToLines(path, file_content_lines, 0, errorMessage)); if (file_content_lines.size() < 1) { errorMessage = "Wrong format: " + path; return FAILED; } content = file_content_lines[0]; return OK; } // Added by Frederic Desmons (2007/07/16) int CF_readTextFileToLines(const string& path, vector& content, unsigned long expected_number_of_lines, string& errorMessage) { string file_content; CF_assert(CF_readTextFile(path, file_content, errorMessage)); content.clear(); CF_splitText(content, file_content,'\n'); if (expected_number_of_lines != 0 && content.size() != expected_number_of_lines) { errorMessage = "Wrong format: " + path; return FAILED; } return OK; } int CF_readFileToString(const string& path, string& result, string& errorMessage) { ifstream ifs(path.c_str(), ifstream::in); if (!ifs.is_open()) { errorMessage = "Failed to open: "+path; return FAILED; } string str; bool isFirst = true; while(getline(ifs, str)) { if (isFirst) isFirst = false; else result += "\n"; //new line result += str; } ifs.close(); return OK; } int CF_writeTextFile(const string& path, const string& content, string& errorMessage) { FILE* file; file = fopen(path.c_str(), "w"); if (file == NULL) { errorMessage = "Unable to open file: " + path; return FAILED; } fputs(content.c_str(), file); fclose(file); return OK; } // Added by Ilsoo Byun (2007/05/10) bool CF_isExist(const string& filePath) { FILE * pFile; pFile = fopen (filePath.c_str(),"r"); if (pFile == NULL) return false; // Added by Frederic Desmons (2007/08/08) // Nasty bug, files MUST be closed otherwise re-opening them may not work fclose(pFile); return true; } // Added by Frederic Desmons (2007/08/16) bool CF_isRegularFile(const string& path) { struct stat file_stats; if (stat(path.c_str(), &file_stats) != 0) return FAILED; return (S_ISREG(file_stats.st_mode)); } // Added by Frederic Desmons (2007/08/16) bool CF_isDirectory(const string& path) { struct stat file_stats; if (stat(path.c_str(), &file_stats) != 0) return FAILED; return (S_ISDIR(file_stats.st_mode)); } // Added by Frederic Desmons (2007/07/26) int CF_scanDirectory(const string& directory, vector& regular_files, vector& directories, vector& block_devices, vector& character_devices, string& errorMessage) { regular_files.clear(); directories.clear(); block_devices.clear(); character_devices.clear(); struct dirent **entries; int nb_entries = scandir(directory.c_str(), &entries, 0, alphasort); if (nb_entries < 0) { errorMessage = "Failed to list files: " + directory; return FAILED; } for (int i=0; i < nb_entries; i++) { if (((string) entries[i]->d_name) == "." || ((string) entries[i]->d_name) == "..") continue; switch (entries[i]->d_type) { case DT_REG: regular_files.push_back(entries[i]->d_name); break; case DT_DIR: directories.push_back(entries[i]->d_name); break; case DT_BLK: block_devices.push_back(entries[i]->d_name); break; case DT_CHR: character_devices.push_back(entries[i]->d_name); break; } } return OK; } /* ---------------------------------------------------------------------------*/ /* String manipulation */ /* ---------------------------------------------------------------------------*/ // Added by Guillaume Bottex (2009/04/28) string CF_removeChar(const string& input, const char* characters) { string output=""; char* token; char* _input; _input=(char*)malloc(sizeof(char)*(strlen(input.c_str())+1)); strcpy(_input,input.c_str()); token = strtok(_input,characters); while (token != NULL) { output+=(token); token = strtok (NULL,characters); } free(_input); return output; } // Added by Guillaume Bottex (2008/08/07) void CF_splitText(vector& output, const string& input, const char* separators) { char* token; char* _input; output.clear(); _input=(char*)malloc(sizeof(char)*(strlen(input.c_str())+1)); strcpy(_input,input.c_str()); token = strtok(_input,separators); while (token != NULL) { output.push_back(token); token = strtok (NULL,separators); } free(_input); } void CF_splitText(vector& output, const string& input, char separator) { string buf = input; output.clear(); while (buf.size() > 0) { size_t i = buf.find(separator); output.push_back(buf.substr(0, i)); if (i == string::npos) break; buf.erase(0, i+1); if (buf.size()==0) output.push_back(""); } } // Modified by Ilsoo Byun (2007/10/24) // -To process space characters like ' ', '\t' and '\n'. void CF_splitTextBySpace(vector& output, const string& input) { string buf = input; output.clear(); buf = CF_trimText(buf); if (buf.size() == 0) return; const char* spaceChr = " \t\r\n"; size_t i = 0; while(i != string::npos) { i = buf.find_first_of(spaceChr); //If it is a empty string, skip it. string parsed = buf.substr(0, i); buf.erase(0, i+1); parsed = CF_trimText(parsed); if (parsed.size() == 0) continue; output.push_back(parsed); } } // Modified by Ilsoo Byun (2007/04/30) string CF_trimText(const string& text) { string str = text; const char* spaceChr = " \t\r\n"; size_t pos = str.find_last_not_of(spaceChr); if (pos != string::npos) { str.erase(pos+1); pos = str.find_first_not_of(spaceChr); if (pos != string::npos) str.erase(0, pos); } else { str.erase(str.begin(), str.end()); } return str; } //Added by Frederic Desmons, ETRI (2007/08/23) string CF_untab(const string& text) { string str = text; for (unsigned int i = 0; i < str.size(); i++) { if (str[i] == '\t' || str[i] == '\r') str[i] = ' '; } return str; } string CF_toLowCase(const string& str) { string result = str; for (size_t i=0; i 64 && result[i] < 91) result[i]+=32; } return result; } // Added by Ilsoo Byun (2007/04/30) // Modifed by Frederic Desmons (2007/05/07): Use of "string" instead of "char*" bool CF_startsWith(const string& str, const string& word) { if (str.size() >= word.size() && str.substr(0, word.size())==word) return true; return false; } // Added by Frederic Desmons (2007/05/07) bool CF_startsWithNoCase(const string& str, const string& word) { string str_low_case=CF_toLowCase(str); string word_low_case=CF_toLowCase(word); return CF_startsWith(str_low_case, word_low_case); } // Added by Ilsoo Byun (2007/04/30) // Modifed by Frederic Desmons (2007/05/07): Use of "string" instead of "char*" bool CF_endsWith(const string& str, const string& word) { if (str.size() >= word.size()) { if (str.substr(str.size()-word.size(), string::npos)==word) return true; else return false; } return false; } // Added by Frederic Desmons (2007/05/07) bool CF_endsWithNoCase(const string& str, const string& word) { string str_low_case=CF_toLowCase(str); string word_low_case=CF_toLowCase(word); return CF_endsWith(str_low_case, word_low_case); } string CF_quoteString(const string& str) { string quoted_string; vector _str; CF_splitText(_str, str, '"'); for (size_t i = 0; i < _str.size(); i++) { quoted_string += _str[i]; if (i < _str.size()-1) quoted_string += "\\\""; } return quoted_string; } /* ---------------------------------------------------------------------------*/ /* C++ type comparison */ /* ---------------------------------------------------------------------------*/ bool CF_strCmpNoCase(const string& str1, const string& str2) { string temp1 = CF_toLowCase(str1); string temp2 = CF_toLowCase(str2); return temp1==temp2; } // Added by Frederic Desmons (2007/07/31) bool CF_strArrayCmpNoCase(const vector& vect1, const vector& vect2) { _ARRAY_CMP } // Added by Frederic Desmons (2007/07/31) bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } bool CF_numArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } // Added by Frederic Desmons (2007/07/31) bool CF_boolArrayCmp(const vector& vect1, const vector& vect2) { _ARRAY_CMP } // Added by Frederic Desmons (2007/07/31) bool CF_refArrayCmp(const vector& vect1, const vector& vect2) { if (vect1.size() != vect2.size()) return false; for (size_t i=0; i < vect1.size(); i++) { if (!vect1[i].equals(vect2[i])) return false; } return true; } // Added by Frederic Desmons (2007/11/14) int CF_datetimeCmp(int& sign, const string& datetime1, const string& datetime2, string& errorMessage) { unsigned long long binaryDatetime1, binaryDatetime2; CF_assert(CF_datetimeToBinary(binaryDatetime1, datetime1, errorMessage)); CF_assert(CF_datetimeToBinary(binaryDatetime2, datetime2, errorMessage)); if (binaryDatetime1 > binaryDatetime2) sign = 1; if (binaryDatetime1 < binaryDatetime2) sign = -1; if (binaryDatetime1 == binaryDatetime2) sign = 0; return OK; } /* ---------------------------------------------------------------------------*/ /* CMPI type comparison */ /* ---------------------------------------------------------------------------*/ // Added by Frederic Desmons (2007/07/31) bool CF_CMPIDataCmp(const CMPIBroker* broker, const CMPIData& data1, const CMPIData& data2) { if (data1.type != data2.type || data1.state != data2.state) return false; if ((data1.state & CMPI_goodValue) != CMPI_goodValue && (data1.state & CMPI_keyValue) != CMPI_keyValue) return false; switch (data1.type) { case CMPI_boolean: return data1.value.boolean == data2.value.boolean; case CMPI_char16: return data1.value.char16 == data2.value.char16; case CMPI_real32: return data1.value.real32 == data2.value.real32; case CMPI_real64: return data1.value.real64 == data2.value.real64; case CMPI_uint8: return data1.value.uint8 == data2.value.uint8; case CMPI_uint16: return data1.value.uint16 == data2.value.uint16; case CMPI_uint32: return data1.value.uint32 == data2.value.uint32; case CMPI_uint64: return data1.value.uint64 == data2.value.uint64; case CMPI_sint8: return data1.value.sint8 == data2.value.sint8; case CMPI_sint16: return data1.value.sint16 == data2.value.sint16; case CMPI_sint32: return data1.value.sint32 == data2.value.sint32; case CMPI_sint64: return data1.value.sint64 == data2.value.sint64; case CMPI_ref: { Objectpath ob1, ob2; if (CT_ToC(broker, data1, ob1) != OK || CT_ToC(broker, data2, ob2) != OK) return false; return ob1.equals(ob2); } case CMPI_string: { string str1, str2; if (CT_ToC(data1, str1) != OK || CT_ToC(data2, str2) != OK) return false; return CF_strCmpNoCase(str1, str2); } case CMPI_dateTime: { string dt1, dt2; if (CT_ToCDatetime(data1, dt1) != OK || CT_ToCDatetime(data2, dt2) != OK) return false; // modified by Frederic Desmons (2007/11/15) int sign; string errorMessage; int errorCode = CF_datetimeCmp(sign, dt1, dt2, errorMessage); if (errorCode != OK) return false; return sign==0; //return CF_strCmpNoCase(dt1, dt2); } } return false; } /* ---------------------------------------------------------------------------*/ /* Time and Datetime manipulation */ /* ---------------------------------------------------------------------------*/ // Added by Frederic Desmons (2007/07/10) short CF_getCurrentTimeZone() { struct timeval tv; struct timezone tz; signed short os_timezone; if(gettimeofday(&tv, &tz) == 0) os_timezone = tz.tz_minuteswest*-1; else os_timezone = 0; return os_timezone; } // Added by Frederic Desmons (2007/07/10) time_t CF_getUTCTime() { return time(NULL); } // Added by Frederic Desmons (2007/07/11) string CF_toLocalTime(time_t UTC_time) { string result; struct tm cttm; if (localtime_r(&UTC_time, &cttm) != NULL) { char* temp = (char*) malloc(22); strftime(temp, 22, "%Y%m%d%H%M%S.000000", &cttm); result = temp; if (temp) free(temp); } return result; } // Added by Frederic Desmons (2007/07/11) string CF_toLocalTime(time_t UTC_time, short timezone) { string result; struct tm cttm; if (localtime_r(&UTC_time, &cttm) != NULL) { char* temp = (char*) malloc(22); strftime(temp, 22, "%Y%m%d%H%M%S.000000", &cttm); result = temp; if (temp) free(temp); } CF_addTimeZone(result, timezone); return result; } // Added by Frederic Desmons (2007/07/11) string CF_getLocalDateTime(time_t UTC_time) { return CF_toLocalTime(CF_getUTCTime(), CF_getCurrentTimeZone()); } // Added by Frederic Desmons (2007/07/10) void CF_addTimeZone(string& datetime, short timezone) { if (timezone>=0) datetime += "+"; else datetime += "-"; datetime += CF_intToStr(abs(timezone)); } // Added by Ilsoo Byun (2007/06/11) int CF_lastModified(const string& filepath, string& modifiedTime, string& errorMessage) { struct stat attr; stat(filepath.c_str(), &attr); struct tm* clock = gmtime(&(attr.st_mtime)); char* result = (char*) malloc(26); strftime(result, 26, "%Y%m%d%H%M%S.000000", clock); CF_catTimezone(result, CF_getOsTimezone()); modifiedTime = (string) result; free(result); return OK; } // Added by Frederic Desmons (2007/11/14) bool CF_isDatetime(const string& myDatetime) { if (myDatetime.size() != 25 || (myDatetime[21] != '+' && myDatetime[21] != '-') || myDatetime[14] != '.' || !CF_isNumber(myDatetime.substr(0, 14)) || !CF_isNumber(myDatetime.substr(15, 6)) || !CF_isNumber(myDatetime.substr(22, 3))) return false; // 01 < month < 12 if (atoi(myDatetime.substr(4, 2).c_str()) < 1 || atoi(myDatetime.substr(4, 2).c_str()) > 12) return false; // 01 < day if (atoi(myDatetime.substr(6, 2).c_str()) < 1) return false; // day < 28,29,30,31 switch (atoi(myDatetime.substr(4, 2).c_str())) { case 1: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; case 2: if (atoi(myDatetime.substr(0, 4).c_str())%4 == 0) { if (atoi(myDatetime.substr(6, 2).c_str()) > 29) return false; } else { if (atoi(myDatetime.substr(6, 2).c_str()) > 28) return false; } case 3: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; case 4: if (atoi(myDatetime.substr(6, 2).c_str()) > 30) return false; case 5: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; case 6: if (atoi(myDatetime.substr(6, 2).c_str()) > 30) return false; case 7: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; case 8: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; case 9: if (atoi(myDatetime.substr(6, 2).c_str()) > 30) return false; case 10: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; case 11: if (atoi(myDatetime.substr(6, 2).c_str()) > 30) return false; case 12: if (atoi(myDatetime.substr(6, 2).c_str()) > 31) return false; } // 00 < hour < 23 if (atoi(myDatetime.substr(8, 2).c_str()) > 23) return false; // 00 < minutes < 59 if (atoi(myDatetime.substr(10, 2).c_str()) > 59) return false; // 00 < seconds < 59 if (atoi(myDatetime.substr(12, 2).c_str()) > 59) return false; return true; } // Added by Frederic Desmons (2007/11/14) int CF_datetimeToBinary(unsigned long long& binaryDatetime, const string& myDatetime, string& errorMessage) { // check if the datetime is valid if (!CF_isDatetime(myDatetime)) { errorMessage = "Wrong format: datetime (" + myDatetime + ")"; binaryDatetime=0; return FAILED; } // convert the datetime to struct tm struct tm _time; if (atoi(myDatetime.substr(0, 4).c_str()) < 1970) { errorMessage = "Only dates after 1970/01/01 are supported"; binaryDatetime=0; return FAILED; } _time.tm_year=atoi(myDatetime.substr(0, 4).c_str()) - 1900; _time.tm_mon=atoi(myDatetime.substr(4, 2).c_str()) - 1; _time.tm_mday=atoi(myDatetime.substr(6, 2).c_str()); _time.tm_hour=atoi(myDatetime.substr(8, 2).c_str()); _time.tm_min=atoi(myDatetime.substr(10, 2).c_str()); _time.tm_sec=atoi(myDatetime.substr(12, 2).c_str()); _time.tm_wday=-1; _time.tm_yday=-1; _time.tm_isdst=-1; time_t seconds = mktime(&_time); seconds += CF_getCurrentTimeZone()*60; // absolute time from GMT if (myDatetime[21] == '+') seconds -= atoll(myDatetime.substr(22, 3).c_str())*60; else seconds += atoll(myDatetime.substr(22, 3).c_str())*60; // in microseconds binaryDatetime = ((unsigned long long) seconds)*1000*1000 + atoi(myDatetime.substr(15, 6).c_str()); return OK; } // Added by Guillaume Bottex (2008/08/07) int CF_monthAbvStrToInt(const string& month) { return CF_monthAbvStrToInt(month.c_str()); } // Added by Guillaume Bottex (2008/08/07) int CF_monthAbvStrToInt(const char* month) { const char monthlist[][4]={ "JAN","FEB","MAR","APR","MAY","JUN", "JUL","AUG","SEP","OCT","NOV","DEC"}; char month_upper[4]; for(int i=0;i<4;i++) month_upper[i]=(char)toupper((int)month[i]); for(int i=0;i<12;i++) { if(strcmp(month_upper,monthlist[i])==0) return i+1; } return 0; } // Deprecated by Frederic Desmons (2007/07/10) signed short CF_getOsTimezone() { struct timeval tv; struct timezone tz; signed short os_timezone; if(gettimeofday(&tv, &tz) == 0) os_timezone = tz.tz_minuteswest*-1; else os_timezone = 0; return os_timezone; } // Deprecated by Frederic Desmons (2007/07/10) time_t CF_localTime() { struct timeval tv; struct timezone tz; time_t local_time=0; if(gettimeofday(&tv, &tz)==0) local_time = tv.tv_sec; return local_time; } // Deprecated by Frederic Desmons (2007/07/10) void CF_catTimezone(char *str, signed short zone) { char* tz = NULL; if((tz=(char*) malloc(sizeof(long long))) != NULL) { sprintf(tz, "%+04d", zone); if(str != NULL) strcat(str,tz); if(tz) free(tz); } } // Deprecated by Frederic Desmons (2007/07/10) string CF_timeToString(time_t time) { string result; char* tm = NULL; struct tm cttm; if(gmtime_r(&time , &cttm) != NULL) { tm = (char*) malloc(26); strftime(tm, 26, "%Y%m%d%H%M%S.000000", &cttm); CF_catTimezone(tm, CF_getOsTimezone()); result = tm; if (tm) free(tm); } return result; } /* ---------------------------------------------------------------------------*/ /* Integer / String conversion */ /* ---------------------------------------------------------------------------*/ string CF_intToStr(unsigned char value) { ostringstream ostr; ostr << (unsigned short) value; return ostr.str(); } string CF_intToStr(unsigned short value) { _TO_STR } string CF_intToStr(unsigned long value) { _TO_STR } string CF_intToStr(unsigned long long value) { _TO_STR } string CF_intToStr(signed char value) { ostringstream ostr; ostr << (signed short) value; return ostr.str(); } string CF_intToStr(short value) { _TO_STR } string CF_intToStr(long value) { _TO_STR } string CF_intToStr(long long value) { _TO_STR } string CF_intToStr(float value) { _TO_STR } string CF_intToStr(double value) { _TO_STR } string CF_intToStr(int value) { _TO_STR } string CF_intToStr(unsigned int value) { _TO_STR } string CF_boolToStr(bool value) { if (value) return "true"; else return "false"; } unsigned long CF_strToUL(const string& input) { const char* begin = input.c_str(); char* end = (char*) begin[input.size()-1]; return strtoul(begin, &end, 10); } unsigned long long CF_strToULL(const string& input) { const char* begin = input.c_str(); char* end = (char*) begin[input.size()-1]; return strtoull(begin, &end, 10); } // Added by Ilsoo Byun (2007/05/10) bool CF_isNumber(const string& str) { string::size_type i=0; for (; i < str.size(); i++) { if (!isdigit(str[i])) return false; } return true; } /* ---------------------------------------------------------------------------*/ /* Sorting */ /* ---------------------------------------------------------------------------*/ bool CF_foundInSortedList(const string& element, const vector& list, vector::size_type& index) { if (list.size()==0) { index=0; return false; } if (list.size()==1) { if (strcmp(list[0].c_str(), element.c_str())==0) return true; if (strcmp(list[0].c_str(), element.c_str())>0) { index=0; return false; } else { index=1; return false; } } unsigned int begin=0; unsigned int end=list.size()-1; unsigned int position=(end+begin)/2; while(end-begin>1) { if (strcmp(list[position].c_str(), element.c_str())>=0) end=position; else begin=position; position=(end+begin)/2; } index=begin; if (element==list[begin]) return true; if (element==list[end]) { index=end; return true; } if (strcmp(list[end].c_str(), element.c_str())<0) index=end+1; if (strcmp(list[begin].c_str(), element.c_str())>0) index=begin; if (strcmp(list[begin].c_str(), element.c_str())<0 && strcmp(list[end].c_str(), element.c_str())>0) index=end; return false; } bool CF_foundInList(const string& element, const vector& list, vector::size_type& index) { for (vector::size_type i=0; i