From: <np...@us...> - 2006-11-01 23:59:19
|
Revision: 12 http://svn.sourceforge.net/omc/?rev=12&view=rev Author: npaxton Date: 2006-11-01 15:59:10 -0800 (Wed, 01 Nov 2006) Log Message: ----------- Original merge of diffs from transition to sourceforge Modified Paths: -------------- cmpibase/trunk/configure.ac cmpibase/trunk/src/include/omc/Makefile.am cmpibase/trunk/src/include/omc/base.h cmpibase/trunk/src/lib/omc/Makefile.am cmpibase/trunk/src/lib/omc/base.c cmpibase/trunk/src/lib/omc/cmpiSimpleAssoc.c cmpibase/trunk/src/lib/omc/cmpiUtils.c cmpibase/trunk/src/providers/Makefile.am cmpibase/trunk/src/providers/computer-system/computerSystemHostNameSettingData.c cmpibase/trunk/src/providers/template/cmpi-providerTemplate.c Added Paths: ----------- cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h cmpibase/trunk/src/include/omc/ntpServer.h cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c cmpibase/trunk/src/lib/omc/ntpServer.c cmpibase/trunk/src/providers/computer-system/mof/ComputerSystemProviderReg.mof cmpibase/trunk/src/providers/time-service/ cmpibase/trunk/src/providers/time-service/Makefile.am cmpibase/trunk/src/providers/time-service/Makefile.in cmpibase/trunk/src/providers/time-service/hostedTimeService.c cmpibase/trunk/src/providers/time-service/mof/ cmpibase/trunk/src/providers/time-service/mof/TimeServiceProviderReg.mof cmpibase/trunk/src/providers/time-service/mof/cleanmof.sh cmpibase/trunk/src/providers/time-service/mof/genmof.sh cmpibase/trunk/src/providers/time-service/mof/importmof.sh cmpibase/trunk/src/providers/time-service/mof/omc-computer-system.mof cmpibase/trunk/src/providers/time-service/mof/omc-computer-system.reg.mof cmpibase/trunk/src/providers/time-service/mof/provider-register.sh cmpibase/trunk/src/providers/time-service/remoteTimeServicePort.c cmpibase/trunk/src/providers/time-service/systemTimeService.c cmpibase/trunk/src/providers/time-service/timeServiceAccessBySAP.c cmpibase/trunk/src/providers/time-service/timeServiceAvailableToElement.c cmpibase/trunk/src/providers/time-service/timeServiceTimeZoneSettingData.c cmpibase/trunk/src/providers/time-service/timeZoneSettingData.c Modified: cmpibase/trunk/configure.ac =================================================================== --- cmpibase/trunk/configure.ac 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/configure.ac 2006-11-01 23:59:10 UTC (rev 12) @@ -29,7 +29,7 @@ OPT_FLAGS=" -DNDEBUG -O2" # Additional optimization flags. -##NOTE: whereever CXXFLAGS is used, we need to also use CPPFLAGS, for the AC_CHECK_HEADERS - +##NOTE: whereever CXXFLAGS is used, we need to also use CPPFLAGS, for the AC_CHECK_HEADERS - ## It now uses compile (primarily) but still uses pre-processor for interim transition / backward compatibility ## pre-processor needs the CPPFLAGS @@ -40,10 +40,10 @@ [ --with-search-dir=PATH Specify an additional directory to look for include/ and lib/ sub dirs ], [ if test "x$withval" != "xno" ; then - CXXFLAGS="$CXXFLAGS -I$withval/include" - CPPFLAGS="$CPPFLAGS -I$withval/include" - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" + CXXFLAGS="$CXXFLAGS -I$withval/include" + CPPFLAGS="$CPPFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" fi ] ) @@ -55,10 +55,10 @@ [ --with-cmpi-include-dir=PATH Specify locaction of the CMPI header files ], [ if test "x$withval" != "xno" ; then - CXXFLAGS="$CXXFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval" - CFLAGS="$CFLAGS -I$withval" - cmpiIncDir="$withval" + CXXFLAGS="$CXXFLAGS -I$withval" + CPPFLAGS="$CPPFLAGS -I$withval" + CFLAGS="$CFLAGS -I$withval" + cmpiIncDir="$withval" fi ] ) @@ -190,5 +190,6 @@ src/providers/processes/Makefile src/providers/computer-system/Makefile src/providers/operating-system/Makefile + src/providers/time-service/Makefile ]) AC_OUTPUT Modified: cmpibase/trunk/src/include/omc/Makefile.am =================================================================== --- cmpibase/trunk/src/include/omc/Makefile.am 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/include/omc/Makefile.am 2006-11-01 23:59:10 UTC (rev 12) @@ -9,4 +9,6 @@ string.h \ linuxProcUtils.h \ cmpiUtils.h \ - cmpiSimpleAssoc.h + cmpiSimpleAssoc.h \ + cmpiTimeServiceUtils.h \ + ntpServer.h Modified: cmpibase/trunk/src/include/omc/base.h =================================================================== --- cmpibase/trunk/src/include/omc/base.h 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/include/omc/base.h 2006-11-01 23:59:10 UTC (rev 12) @@ -109,6 +109,16 @@ char* instanceIdOut, size_t instanceIdOutLen); + +/** + * Get the install date of an RPM (as a time_t?) + * @param rpmName The name of the rpm to get the install date for. + */ +unsigned long long +omcGetRPMInstallDate( + const char *rpmName); + + #ifdef __cplusplus } #endif Added: cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h =================================================================== --- cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h (rev 0) +++ cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,88 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Norm Paxton (np...@no...) +******************************************************************************/ +#ifndef TIME_SERVICE_UTILS_H_GUARD__ +#define TIME_SERVICE_UTILS_H_GUARD__ + +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> + +#include <omc/base.h> +#include <omc/cmpiUtils.h> +#include <omc/cmpiSimpleAssoc.h> +#include <omc/string.h> + +#include <stdlib.h> +#include <unistd.h> + +#ifdef __cplusplus +extern "C" { +#endif + + + +CMPIObjectPath * +makeTimeServiceObjectPath( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus); + + +CMPIInstance * +makeTimeServiceInstance( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus, + const char **properties); + + + +CMPIObjectPath* +makeRemoteTimeServicePortObjectPath( + const CMPIBroker *broker, + const char *ns, + const char *serverName, + CMPIStatus *pStatus); + + +CMPIInstance * +makeRemoteTimeServicePortInstance( + const CMPIBroker *broker, + const char *ns, + const char *serverName, + CMPIStatus *pStatus, + const char **properties); + +int isIPV4Address(const char *arg); + + +#endif // TIME_SERVICE_UTILS_H_GUARD__ Added: cmpibase/trunk/src/include/omc/ntpServer.h =================================================================== --- cmpibase/trunk/src/include/omc/ntpServer.h (rev 0) +++ cmpibase/trunk/src/include/omc/ntpServer.h 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,58 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Norm Paxton (np...@no...) +******************************************************************************/ +#ifndef NTP_SERVER_UTILS_H_GUARD__ +#define NTP_SERVER_UTILS_H_GUARD__ + + +#define NTP_SERVER_NAME_LEN 256 + +typedef struct +{ + char serverName[NTP_SERVER_NAME_LEN]; + int prefer; + int key; + int ntpVersion; + int minPoll; + int maxPoll; +} NTPServer; + + +NTPServer *getNTPServers(int *pCount); +int getNTPServer(const char *serverName, NTPServer *out); +int deleteNTPServer(const char *serverName); +int setNTPServer(NTPServer *server); +void copyNTPServer(const NTPServer *in, NTPServer *out); +NTPServer *createAndCopyNTPServer(const NTPServer *in); + + +#endif // NTP_SERVER_UTILS_H_GUARD__ + Modified: cmpibase/trunk/src/lib/omc/Makefile.am =================================================================== --- cmpibase/trunk/src/lib/omc/Makefile.am 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/lib/omc/Makefile.am 2006-11-01 23:59:10 UTC (rev 12) @@ -16,12 +16,14 @@ ioUtils.c \ modifyFile.c \ string.c \ -linuxProcUtils.c +linuxProcUtils.c \ +ntpServer.c libomc_cmpi_la_LDFLAGS = -version-info 1 libomc_cmpi_la_SOURCES = \ cmpiUtils.c \ -cmpiSimpleAssoc.c +cmpiSimpleAssoc.c \ +cmpiTimeServiceUtils.c Modified: cmpibase/trunk/src/lib/omc/base.c =================================================================== --- cmpibase/trunk/src/lib/omc/base.c 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/lib/omc/base.c 2006-11-01 23:59:10 UTC (rev 12) @@ -41,6 +41,19 @@ #include <sys/param.h> #include <sys/utsname.h> +#include <omc/exec.h> +#include <stdlib.h> + +#define LOCAL_DEBUG + +#ifdef LOCAL_DEBUG +#define DEBUGOUT(fmt, args...) printf(fmt,## args) +#else +#define DEBUGOUT(fmt, args...) +#endif + + + #define OSCLASSNAME "OMC_OperatingSystem" #define CSCLASSNAME "OMC_UnitaryComputerSystem" #define OSNAME "Linux" @@ -152,3 +165,64 @@ omcStrNCpy(hostNameOut, namebuf, hostNameOutLen); return hostNameOut; } + + +/*****************************************************************************/ +unsigned long long +omcGetRPMInstallDate(const char *rpmName) +{ + DEBUGOUT("Entering omcGetRPMInstallDate for rpmName: %s\n", rpmName); + + unsigned long rv = 0; + int status; + char *endptr, *output; + unsigned int outputSize; + + const char *cmd[6]; + + if (!rpmName || (*rpmName==0)) + { + DEBUGOUT(" returning - empty rpmName\n"); + return 0; + } + + cmd[0] = "/bin/rpm"; + cmd[1] = "-q"; + cmd[2] = "--queryformat"; + cmd[3] = "%{INSTALLTIME}"; + cmd[4] = rpmName; + cmd[5] = NULL; /* NULL termination */ + + output = NULL; + + char *errOutput = NULL; + unsigned long ulErrOutputSize = 0; + + if (omcExecuteProcessAndGatherOutputAndError((char* const*) cmd, NULL, &output, + &outputSize, -1, &errOutput, &ulErrOutputSize, -1, NULL, &status, -1) == 0) + { + DEBUGOUT(" execute returned status: %d outputSize: %d\n output: %s\n", status, outputSize, output); + if (status == 0) + { + rv = strtoul(output, &endptr, 10); + if (endptr == output || *endptr) + { + rv = 0; + } + free(output); + return (1000000 * (unsigned long long)rv); + } + else + { + DEBUGOUT(" received error: %s\n", errOutput); + } + } + if (output) + { + free(output); + } + + return 0; +} + + Modified: cmpibase/trunk/src/lib/omc/cmpiSimpleAssoc.c =================================================================== --- cmpibase/trunk/src/lib/omc/cmpiSimpleAssoc.c 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/lib/omc/cmpiSimpleAssoc.c 2006-11-01 23:59:10 UTC (rev 12) @@ -40,7 +40,7 @@ #include <stdio.h> -#define LOCAL_DEBUG +//#define LOCAL_DEBUG #ifdef LOCAL_DEBUG #define DEBUGOUT(fmt, args...) printf(fmt,## args) Added: cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c =================================================================== --- cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c (rev 0) +++ cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,344 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Norm Paxton (np...@no...) +******************************************************************************/ + +#include <omc/cmpiTimeServiceUtils.h> +#include <omc/ntpServer.h> +#include <fnmatch.h> +#include <ctype.h> + +#define LOCAL_DEBUG + +#ifdef LOCAL_DEBUG +#define DEBUGOUT(fmt, args...) printf(fmt,## args) +#else +#define DEBUGOUT(fmt, args...) +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +// NULL terminated list of key property names for this class +static const char * systemTimeServiceClassKeys[] = { + "SystemCreationClassName", + "SystemName", + "CreationClassName", + "Name", + NULL}; + + +static const char * remoteTimeServicePortClassKeys[] = { + "SystemCreationClassName", + "SystemName", + "CreationClassName", + "Name", + NULL}; + + +/*****************************************************************************/ +CMPIObjectPath * +makeTimeServiceObjectPath( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus) +{ + DEBUGOUT("EnumInstanceNames() called\n"); + + CMPIObjectPath *op = CMNewObjectPath(broker, ns, "OMC_SystemTimeService", pStatus); + if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) + { + char name[128] = {0}; + omcGetComputerSystemName(name, sizeof(name)); + + CMAddKey(op, + "SystemCreationClassName", + (CMPIValue *)(char *)omcGetComputerSystemClassName(), + CMPI_chars); + CMAddKey(op, + "SystemName", + (CMPIValue *)&name, + CMPI_chars); + CMAddKey(op, + "CreationClassName", + (CMPIValue *)"OMC_SystemTimeService", + CMPI_chars); + CMAddKey(op, + "Name", + (CMPIValue *)"timeservice", + CMPI_chars); + } + return op; +} + + +/*****************************************************************************/ +CMPIInstance * +makeTimeServiceInstance( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus, + const char **properties) +{ + CMPIInstance *instance = NULL; + CMPIObjectPath *op = makeTimeServiceObjectPath(broker, ns, pStatus); + if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) + { + instance = CMNewInstance(broker, op, pStatus); + if (!CMIsNullObject(instance) && (pStatus->rc == CMPI_RC_OK)) + { + CMSetPropertyFilter(instance, properties, systemTimeServiceClassKeys); + // keys + char name[128] = {0}; + omcGetComputerSystemName(name, sizeof(name)); + + CMSetProperty(instance, + "SystemCreationClassName", + (CMPIValue *)(char *)omcGetComputerSystemClassName(), + CMPI_chars); + CMSetProperty(instance, + "SystemName", + (CMPIValue *)&name, + CMPI_chars); + CMSetProperty(instance, + "CreationClassName", + (CMPIValue *)"OMC_SystemTimeService", + CMPI_chars); + CMSetProperty(instance, + "Name", + (CMPIValue *)"timeservice", + CMPI_chars); + + unsigned int enabledState = 2; + CMSetProperty(instance, "EnabledState", (CMPIValue*)&enabledState, CMPI_uint16); + unsigned int requestedState = 12; + CMSetProperty(instance, "RequestedState", (CMPIValue*)&requestedState, CMPI_uint16); + unsigned int enabledDefault = 2; + CMSetProperty(instance, "EnabledDefault", (CMPIValue*)&enabledDefault, CMPI_uint16); + unsigned int started = 1; + CMSetProperty(instance, "Started", (CMPIValue*)&started, CMPI_boolean); + unsigned int healthState = 5; + CMSetProperty(instance, "HealthState", (CMPIValue*)&healthState, CMPI_uint16); + + CMPIDateTime *lastStateChange = CMNewDateTime(broker, NULL); + CMSetProperty(instance, "TimeOfLastStateChange", (CMPIValue*)&lastStateChange, CMPI_dateTime); + + + // TODO: Get the real one, move LinuxOS_get*** into common library? + // get from the linux os instance? + //CMPIDateTime *installDate = CMNewDateTimeFromBinary(broker, omcLinuxOS_getInstallDate(), 0, NULL); + CMPIDateTime *installDate = CMNewDateTime(broker, NULL); + CMSetProperty(instance, "InstallDate", (CMPIValue*)&installDate, CMPI_dateTime); + + CMSetProperty(instance, "Status", (CMPIValue*)"OK", CMPI_chars); + CMSetProperty(instance, "StartMode", (CMPIValue*)"Automatic", CMPI_chars); + + CMPIArray *pra = CMNewArray(broker, 1, CMPI_uint16, NULL); + if (!CMIsNullObject(pra)) + { + unsigned int opStatus = 2; + CMSetArrayElementAt(pra, 0, (CMPIValue*)&opStatus, CMPI_uint16); + CMSetProperty(instance, "OperationalStatus", (CMPIValue*)&pra, CMPI_uint16A); + } + } + } + return instance; +} + + + +/*****************************************************************************/ +CMPIObjectPath* +makeRemoteTimeServicePortObjectPath( + const CMPIBroker *broker, + const char *ns, + const char *serverName, + CMPIStatus *pStatus) +{ + CMPIObjectPath *op = CMNewObjectPath(broker, ns, "OMC_RemoteTimeServicePort", pStatus); + if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) + { + char name[128] = {0}; + omcGetComputerSystemName(name, sizeof(name)); + + CMAddKey(op, + "SystemCreationClassName", + (CMPIValue *)(char *)omcGetComputerSystemClassName(), + CMPI_chars); + CMAddKey(op, + "SystemName", + (CMPIValue *)&name, + CMPI_chars); + CMAddKey(op, + "CreationClassName", + (CMPIValue *)"OMC_RemoteTimeServicePort", + CMPI_chars); + CMAddKey(op, + "Name", + (CMPIValue *)serverName, + CMPI_chars); + } + return op; +} + + +/*****************************************************************************/ +CMPIInstance * +makeRemoteTimeServicePortInstance( + const CMPIBroker *broker, + const char *ns, + const char *serverName, + CMPIStatus *pStatus, + const char **properties) +{ + CMPIInstance *instance = NULL; + CMPIObjectPath *op = makeRemoteTimeServicePortObjectPath(broker, ns, serverName, pStatus); + if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) + { + NTPServer *server = malloc(sizeof(NTPServer)); + if (server) + { + getNTPServer(serverName, server); + instance = CMNewInstance(broker, op, pStatus); + if (!CMIsNullObject(instance) && (pStatus->rc == CMPI_RC_OK)) + { + CMSetPropertyFilter(instance, properties, remoteTimeServicePortClassKeys); + // keys + char name[128] = {0}; + omcGetComputerSystemName(name, sizeof(name)); + + CMSetProperty(instance, + "SystemCreationClassName", + (CMPIValue *)(char *)omcGetComputerSystemClassName(), + CMPI_chars); + CMSetProperty(instance, + "SystemName", + (CMPIValue *)&name, + CMPI_chars); + CMSetProperty(instance, + "CreationClassName", + (CMPIValue *)"OMC_RemoteTimeServicePort", + CMPI_chars); + CMSetProperty(instance, + "Name", + (CMPIValue *)serverName, + CMPI_chars); + + CMSetProperty(instance, + "AccessInfo", + (CMPIValue *)serverName, + CMPI_chars); + + int infoFmt = (isIPV4Address(serverName)) ? 3 : 2; + CMSetProperty(instance, "InfoFormat", (CMPIValue*)&infoFmt, CMPI_uint16); + + unsigned int enabledState = 2; + CMSetProperty(instance, "EnabledState", (CMPIValue*)&enabledState, CMPI_uint16); + + unsigned int requestedState = 12; + CMSetProperty(instance, "RequestedState", (CMPIValue*)&requestedState, CMPI_uint16); + + unsigned int enabledDefault = 2; + CMSetProperty(instance, "EnabledDefault", (CMPIValue*)&enabledDefault, CMPI_uint16); + + unsigned int started = 1; + CMSetProperty(instance, "Started", (CMPIValue*)&started, CMPI_boolean); + + unsigned int healthState = 5; + CMSetProperty(instance, "HealthState", (CMPIValue*)&healthState, CMPI_uint16); + + CMPIDateTime *lastStateChange = CMNewDateTime(broker, NULL); + CMSetProperty(instance, "TimeOfLastStateChange", (CMPIValue*)&lastStateChange, CMPI_dateTime); + + + // TODO: Get the real one, move LinuxOS_get*** into common library? + // get from the linux os instance? + //CMPIDateTime *installDate = CMNewDateTimeFromBinary(broker, omcLinuxOS_getInstallDate(), 0, NULL); + CMPIDateTime *installDate = CMNewDateTime(broker, NULL); + CMSetProperty(instance, "InstallDate", (CMPIValue*)&installDate, CMPI_dateTime); + + CMSetProperty(instance, "Status", (CMPIValue*)"OK", CMPI_chars); + CMSetProperty(instance, "StartMode", (CMPIValue*)"Automatic", CMPI_chars); + + CMPIArray *pra = CMNewArray(broker, 1, CMPI_uint16, NULL); + if (!CMIsNullObject(pra)) + { + unsigned int opStatus = 2; + CMSetArrayElementAt(pra, 0, (CMPIValue*)&opStatus, CMPI_uint16); + CMSetProperty(instance, "OperationalStatus", (CMPIValue*)&pra, CMPI_uint16A); + } + + unsigned int portProtocol = 2; + CMSetProperty(instance, "PortProtocol", (CMPIValue*)&portProtocol, CMPI_uint16); + + CMPIBoolean prefer = 0; + prefer = (CMPIBoolean)(server->prefer); + CMSetProperty(instance, "Prefer", (CMPIValue*)&prefer, CMPI_boolean); + + if(server->key) + CMSetProperty(instance, "key", (CMPIValue*)&(server->key), CMPI_uint16); + if(server->ntpVersion) + CMSetProperty(instance, "ntpversion", (CMPIValue*)&(server->ntpVersion), CMPI_uint16); + if(server->minPoll) + CMSetProperty(instance, "minpoll", (CMPIValue*)&(server->minPoll), CMPI_uint16); + if(server->maxPoll) + CMSetProperty(instance, "maxpoll", (CMPIValue*)&(server->maxPoll), CMPI_uint16); + } + } + } + return instance; +} + + + +/*****************************************************************************/ +int +isIPV4Address(const char *arg) +{ + const char *p = arg; + if(fnmatch("*.*.*.*", p, 0) != 0) + { + return 0; + } + + for(; *p; p++) + { + if(*p != '.' && !isdigit(*p)) + { + return 0; + } + } + + return 1; +} + Modified: cmpibase/trunk/src/lib/omc/cmpiUtils.c =================================================================== --- cmpibase/trunk/src/lib/omc/cmpiUtils.c 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/lib/omc/cmpiUtils.c 2006-11-01 23:59:10 UTC (rev 12) @@ -40,7 +40,7 @@ #include <cmpift.h> #include <cmpimacs.h> -#define LOCAL_DEBUG +//#define LOCAL_DEBUG #ifdef LOCAL_DEBUG #define DEBUGOUT(fmt, args...) printf(fmt,## args) Added: cmpibase/trunk/src/lib/omc/ntpServer.c =================================================================== --- cmpibase/trunk/src/lib/omc/ntpServer.c (rev 0) +++ cmpibase/trunk/src/lib/omc/ntpServer.c 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,363 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Norm Paxton (np...@no...) +******************************************************************************/ + +#include <omc/ntpServer.h> +#include <omc/ioUtils.h> +#include <omc/string.h> + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + +#define LOCAL_DEBUG + +#ifdef LOCAL_DEBUG +#define DEBUGOUT(fmt, args...) printf(fmt,## args) +#else +#define DEBUGOUT(fmt, args...) +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + + +char * +lineFromServer( + NTPServer *pServer) +{ + char *line = (char *)malloc(256); + char temp[16] = {0}; + + if (line) + { + omcStrAppend(line, "server ", 256); + omcStrAppend(line, pServer->serverName, 256); + + if(pServer->prefer) + { + omcStrAppend(line, " prefer", 256); + } + if(pServer->key) + { + omcStrAppend(line, " key ", 256); + sprintf(temp, "%ul", pServer->key); + omcStrAppend(line, temp, 256); + } + if(pServer->ntpVersion) + { + omcStrAppend(line, " version ", 256); + sprintf(temp, "%ul", pServer->ntpVersion); + omcStrAppend(line, temp, 256); + } + if(pServer->minPoll) + { + omcStrAppend(line, " minpoll ", 256); + sprintf(temp, "%ul", pServer->minPoll); + omcStrAppend(line, temp, 256); + } + if(pServer->maxPoll) + { + omcStrAppend(line, " maxpoll ", 256); + sprintf(temp, "%ul", pServer->maxPoll); + omcStrAppend(line, temp, 256); + } + } + + DEBUGOUT(" lineFromServer returning: %s\n", line); + return line; +} + + +static void +serverFromLine( + const char *line, + NTPServer *pServer) +{ + if (!pServer) + return; + + DEBUGOUT(" into serverFromLine with line: %s\n", line); + + unsigned int i = 0; + unsigned int iTokenCount = 0; + char** tokens = omcStrTokenize(line, " ,", &iTokenCount); + + for(i = 0; i < iTokenCount; i++) + { + DEBUGOUT(" token: %d: %s\n", i, tokens[i]); + } + + if(iTokenCount > 1) + { + // strip serverName... including # from end + strncpy(pServer->serverName, tokens[1], NTP_SERVER_NAME_LEN); + while(pServer->serverName[strlen(pServer->serverName)-1]=='#') + { + pServer->serverName[strlen(pServer->serverName)-1]='\0'; + } + omcStrRTrim(pServer->serverName); + if(iTokenCount > 2) + { + for(i = 2; i < iTokenCount; i++) + { + if(strcasecmp(tokens[i],"prefer") == 0) + { + pServer->prefer = 1; + continue; + } + if(i < iTokenCount-1) + { + if(strcasecmp(tokens[i],"key") == 0) + { + i++; + pServer->key = (unsigned long)atol(tokens[i]); + } + else if(strcasecmp(tokens[i],"version") == 0) + { + i++; + pServer->ntpVersion = (unsigned long)atol(tokens[i]); + } + else if(strcasecmp(tokens[i],"mode") == 0) + { + i++; + // Ignore + } + else if(strcasecmp(tokens[i],"minpoll") == 0) + { + i++; + pServer->minPoll = (unsigned long)atol(tokens[i]); + } + else if(strcasecmp(tokens[i],"maxpoll") == 0) + { + i++; + pServer->maxPoll = (unsigned long)atol(tokens[i]); + } + } + } + } + } +} + + +/****************************************************************************/ +static int +errCond( + char* errMsgBfr, + unsigned int errMsgBfrLen, + int cc, + const char* fmt, + ...) +{ + va_list ap; + + if (!errMsgBfr || !errMsgBfrLen) { + return cc; + } + + va_start(ap, fmt); + vsnprintf(errMsgBfr, errMsgBfrLen, fmt, ap); + va_end(ap); + return cc; +} + + + +/*****************************************************************************/ +NTPServer *getNTPServers(int *pCount) +{ + FILE *file; + unsigned int bfrLen = 0; + char *p = NULL, *bufPtr = NULL; + NTPServer server = {{0},0,0,0,0}; + char* errMsgBfr = NULL; + unsigned int errMsgBfrLen = 0; + int i=0; + int iCount = 0; + + DEBUGOUT("Entering getNTPServers\n"); + + if (!pCount) + { + return 0; + } + + file = fopen("/etc/ntp.conf", "r"); + if (!file) + { + errCond(errMsgBfr, errMsgBfrLen, -1, + "Failed to open file /etc/ntp.conf"); + return NULL; + } + + for(p = omcReadLine(file, &bufPtr, &bfrLen); p; + p = omcReadLine(file, &bufPtr, &bfrLen)) + { + DEBUGOUT(" got line: %s\n", bufPtr); + + if (omcStrStartsWith(p, "server")) + { + iCount++; + } + } + + *pCount = iCount; + DEBUGOUT(" malloc'ing for %d servers in ra\n", iCount); + NTPServer *ra = (NTPServer*)malloc(iCount * sizeof(NTPServer)); + + // reset file pointer + rewind(file); + + i = 0; + for(p = omcReadLine(file, &bufPtr, &bfrLen); p; + p = omcReadLine(file, &bufPtr, &bfrLen)) + { + DEBUGOUT(" got line: %s\n", bufPtr); + + if (omcStrStartsWith(p, "server")) + { + serverFromLine(p, &server); + DEBUGOUT(" Resulted in NTPServer in list: serverName: %s\n", server.serverName); + copyNTPServer(&server, &ra[i]); + + DEBUGOUT(" Adding NTPServer: %s\n", ra[i].serverName); + i++; + } + } + + fclose(file); + + if (bufPtr) + free(bufPtr); + + return ra; +} + + +/*****************************************************************************/ +int getNTPServer(const char *serverName, NTPServer *out) +{ + FILE *file; + unsigned int bfrLen = 0; + char *p, *bufPtr = NULL; + NTPServer server = {{0},0,0,0,0}; + char* errMsgBfr = NULL; + unsigned int errMsgBfrLen = 0; + + if (!serverName || !out) + { + return 0; + } + + file = fopen("/etc/ntp.conf", "r"); + if (!file) + { + return errCond(errMsgBfr, errMsgBfrLen, -1, + "Failed to open file /etc/ntp.conf"); + } + + for(p = omcReadLine(file, &bufPtr, &bfrLen); p; + p = omcReadLine(file, &bufPtr, &bfrLen)) + { + if (omcStrStartsWith(p, "server")) + { + serverFromLine(p, &server); + if(strcasecmp(server.serverName, serverName) == 0) + { + copyNTPServer(&server, out); + return 1; + } + } + } + + return 0; +} + + +/*****************************************************************************/ +int deleteNTPServer(const char *serverName) +{ + /* + DeleteServerListener dsl(serverName); + OMC::FileModifier fm("/etc/ntp.conf", &dsl); + String errMsg; + bool modified; + return fm.processFile(modified, errMsg); + */ + return 0; +} + + +/*****************************************************************************/ +int setNTPServer(NTPServer *server) +{ + /* + SetServerListener ssl(server); + OMC::FileModifier fm("/etc/ntp.conf", &ssl); + String errMsg; + bool modified; + return fm.processFile(modified, errMsg); + */ + return 0; +} + + +/*****************************************************************************/ +void copyNTPServer(const NTPServer *in, NTPServer *out) +{ + if (in && out) + { + strncpy(out->serverName, in->serverName, NTP_SERVER_NAME_LEN); + out->prefer = in->prefer; + out->key = in->key; + out->ntpVersion = in->ntpVersion; + out->minPoll = in->minPoll; + out->maxPoll = in->maxPoll; + } +} + + +/*****************************************************************************/ +NTPServer *createAndCopyNTPServer(const NTPServer* in) +{ + if (!in) + return NULL; + NTPServer *out = (NTPServer *)malloc(sizeof(NTPServer)); + if (out) + { + copyNTPServer(in, out); + } + return out; +} + Modified: cmpibase/trunk/src/providers/Makefile.am =================================================================== --- cmpibase/trunk/src/providers/Makefile.am 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/providers/Makefile.am 2006-11-01 23:59:10 UTC (rev 12) @@ -3,5 +3,6 @@ SUBDIRS = \ processes \ computer-system \ - operating-system + operating-system \ + time-service Modified: cmpibase/trunk/src/providers/computer-system/computerSystemHostNameSettingData.c =================================================================== --- cmpibase/trunk/src/providers/computer-system/computerSystemHostNameSettingData.c 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/providers/computer-system/computerSystemHostNameSettingData.c 2006-11-01 23:59:10 UTC (rev 12) @@ -41,7 +41,7 @@ #include <stdlib.h> #include <string.h> -#define LOCAL_DEBUG +//#define LOCAL_DEBUG #ifdef LOCAL_DEBUG #define DEBUGOUT(fmt, args...) printf(fmt,## args) Added: cmpibase/trunk/src/providers/computer-system/mof/ComputerSystemProviderReg.mof =================================================================== --- cmpibase/trunk/src/providers/computer-system/mof/ComputerSystemProviderReg.mof (rev 0) +++ cmpibase/trunk/src/providers/computer-system/mof/ComputerSystemProviderReg.mof 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,85 @@ + +instance of PG_ProviderModule +{ + Name = "OMC_CS_HostNameSettingData_Module"; + Location = "omccmpi_cshostnamesettingdata"; + Vendor = "SBLIM"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_ProviderModule +{ + Name = "OMC_HostNameSettingData_Module"; + Location = "omccmpi_hostnamesettingdata"; + Vendor = "SBLIM"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_ProviderModule +{ + Name = "OMC_UnitaryComputerSystem_Module"; + Location = "omccmpi_computer_system"; + Vendor = "SBLIM"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_CS_HostNameSettingData_Provider"; + ProviderModuleName = "OMC_CS_HostNameSettingData_Module"; +}; + +instance of PG_Provider +{ + Name = "OMC_HostNameSettingData_Provider"; + ProviderModuleName = "OMC_HostNameSettingData_Module"; +}; + +instance of PG_Provider +{ + Name = "OMC_UnitaryComputerSystem_Provider"; + ProviderModuleName = "OMC_UnitaryComputerSystem_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_UnitaryComputerSystem_Module"; + ProviderName = "OMC_UnitaryComputerSystem_Provider"; + ClassName = "OMC_UnitaryComputerSystem"; + ProviderType = { 2 }; + Namespaces = {"smash"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_UnitaryComputerSystem-1"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_HostNameSettingData_Module"; + ProviderName = "OMC_HostNameSettingData_Provider"; + ClassName = "OMC_HostNameSettingData"; + ProviderType = { 2, 5 }; + Namespaces = {"smash"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_HostNameSettingData-2"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_CS_HostNameSettingData_Module"; + ProviderName = "OMC_CS_HostNameSettingData_Provider"; + ClassName = "OMC_ComputerSystemHostNameSettingData"; + ProviderType = { 2, 3 }; + Namespaces = {"smash"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_ComputerSystemHostNameSettingData-3"; +}; + Modified: cmpibase/trunk/src/providers/template/cmpi-providerTemplate.c =================================================================== --- cmpibase/trunk/src/providers/template/cmpi-providerTemplate.c 2006-11-01 20:01:25 UTC (rev 11) +++ cmpibase/trunk/src/providers/template/cmpi-providerTemplate.c 2006-11-01 23:59:10 UTC (rev 12) @@ -1,12 +1,46 @@ -// place copyright notice here +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Joe Smith (ab...@do...) +******************************************************************************/ -#include "cmpidt.h" -#include "cmpift.h" -#include "cmpimacs.h" +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> +#include <omc/base.h> +#include <omc/cmpiUtils.h> +#include <omc/cmpiSimpleAssoc.h> +#include <omc/string.h> // NULL terminated list of key property names for this class -static char * classKeys[] = {"FooKey", NULL}; +static char * classKeys[] = {"FooKey1", "FooKey2", NULL}; #ifdef DEBUG #define DEBUGOUT(fmt, args...) printf(fmt,## args) @@ -17,7 +51,7 @@ // Global handle to the CIM broker // This is initialized by the CIMOM when the provider is loaded -static CMPIBroker * _broker; +static const CMPIBroker * _broker; // **************************************************************************** @@ -284,39 +318,34 @@ // **************************************************************************** - -// **************************************************************************** -// associatorsHelper() -// params: CMPIAssociationMI* self: [in] Handle to this provider -// CMPIContext* context: [in] any additional context info -// CMPIResult* results: [out] Results -// CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath -// char *assocClass -// char *resultClass -// char *role -// char *resultRole -// char **properties -// int namesOnly -// **************************************************************************** static char * ASSOC_CLASSNAME = "OMC_ComputerSystemHostNameSettingData"; static char * LEFT_CLASSNAME = "OMC_UnitaryComputerSystem"; static char * RIGHT_CLASSNAME = "OMC_HostNameSettingData"; static char * LEFT_PROPERTYNAME = "ManagedElement"; static char * RIGHT_PROPERTYNAME = "SettingData"; -static CMPIStatus associatorsHelper( CMPIAssociationMI* self, - const CMPIContext* context, - const CMPIResult* results, - const CMPIObjectPath* cop, - const char *assocClass, - const char *resultClass, - const char *role, - const char *resultRole, - const char** properties, - int namesOnly, - int refs ) +// **************************************************************************** +// doReferences() +// This is the callback called from the SimpleAssociators helper functions +// It "handles" one or more instances of the association class +// to be filtered by the SimpleAssociatior helper functions to return +// the correct object (instance or object path) +// **************************************************************************** +CMPIStatus +doReferences( + omccmpiSimpleAssocCtx ctx, + CMPIAssociationMI* self, + const CMPIBroker *broker, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char** properties) { - DEBUGOUT("associatorsHelper: namesOnly: %d refs: %d\n", namesOnly, refs); + DEBUGOUT("doReferences called\n"); CMPIStatus status = {CMPI_RC_OK, NULL}; char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); @@ -327,184 +356,129 @@ if(strcasecmp(objClassName, LEFT_CLASSNAME) == 0) { - // this is a <LEFT_CLASSNAME>, returning a <RIGHT_CLASSNAME> - //DEBUGOUT("ResultClass: %s\n", resultClass?resultClass:"<empty>"); + // this is a LEFT_CLASSNAME + // need to get approprate RIGHT_CLASSNAME for ASSOC_CLASSNAME inst + // but if resultClass is set, it must match + + int bHaveMatch = 1; // TRUE if ((resultClass != NULL) && (*resultClass != 0)) { - //DEBUGOUT("Is resultClass (%s) a parent of %s?\n", resultClass, RIGHT_CLASSNAME); - if (!omccmpiClassIsDerivedFrom( RIGHT_CLASSNAME, - resultClass, - _broker, - ns )) + // check + if (!omccmpiClassIsDerivedFrom(RIGHT_CLASSNAME, + resultClass, + _broker,ns,&status)) { - goto exit; + bHaveMatch = 0; // FALSE } } - // TODO - - // check the incoming cop for anything to help determine results - // see example below for comparing incoming computerSystemName with - // 'this' computer system name - /* - char name[128] = {0}; - omcGetComputerSystemName(name, 128); - - CMPIData data = CMGetKey(cop, "Name", &status); - char *inName = CMGetCharPtr(data.value.string); - DEBUGOUT("Comparing inName: %s with name: %s\n", inName, name); - if (strcasecmp(inName, name) == 0) - */ + if ((resultRole != NULL) && (*resultRole != 0)) { - // create the <right_classname> cop that I'll use below - CMPIObjectPath *rightcop = CMNewObjectPath(_broker, ns, RIGHT_CLASSNAME, &status); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(rightcop)) + // check + if (strcasecmp(resultRole, RIGHT_PROPERTYNAME) != 0) { - CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, - "Could not create <RIGHT_CLASSNAME> object path"); - goto exit; + bHaveMatch = 0; // FALSE } - else - { - // add keys to the RIGHT_ object class - /* - char instanceID[] = "omc:computername"; - CMAddKey(rightcop, "InstanceID", (CMPIValue *)instanceID, CMPI_chars); - */ - } + } - // Create and populate results - if (namesOnly) - { - if (refs) - { - // create an association object path with the <rightcop> - DEBUGOUT("associatorsHelper: creating association path: %s\n", ""); - CMPIObjectPath *assocCop = omccmpiCreateAssociationPath(_broker, - ns, - ASSOC_CLASSNAME, - LEFT_PROPERTYNAME, - RIGHT_PROPERTYNAME, - cop, // cop sent in - rightcop ); - CMReturnObjectPath(results, assocCop); - } - else - { - // return the <rightcop> - CMReturnObjectPath(results, rightcop); - } - } - else - { - if (refs) - { - // create an association instance with the <rightcop> - CMPIInstance *assocInst = omccmpiCreateAssociationInst(_broker, - ns, - ASSOC_CLASSNAME, - LEFT_PROPERTYNAME, - RIGHT_PROPERTYNAME, - cop, - rightcop ); - CMReturnInstance(results, assocInst); - } - else - { - // return the instance from <rightcop> - CMPIInstance *rightInst = CBGetInstance(_broker, context, rightcop, properties, &status); - CMReturnInstance(results, rightInst); - } - } + if (bHaveMatch) + { + // do work here: + // create and return the appropriate association instance(s) + // + // loop, if necesssary + // do appropriate checks + + // the left cop was passed in + CMPIObjectPath *leftCop = cop; + + // get or create right side object path + CMPIObjectPath *rightCop = CMNewObjectPath(_broker, ns, RIGHT_CLASSNAME, &status); + // add keys + + + // create association instance + CMPIInstance *assocInst = omccmpiCreateAssociationInst(_broker, + ns, + ASSOC_CLASSNAME, + classKeys, + properties, + LEFT_PROPERTYNAME, + RIGHT_PROPERTYNAME, + leftCop, + rightCop, + &status); + // "handle" the association + omccmpiSimpleAssocResults(ctx, assocInst, &status); } } else if(strcmp(objClassName, RIGHT_CLASSNAME) == 0) { - // this is a <RIGHT_CLASSNAME>, returning a <LEFT_CLASSNAME> - //DEBUGOUT("ResultClass: %s\n", resultClass?resultClass:"<empty>"); + // this is a RIGHT_CLASSNAME + // need to get approprate LEFT_CLASSNAME for ASSOC_CLASSNAME inst + // but if resultClass is set, it must match + + int bHaveMatch = 1; // TRUE if ((resultClass != NULL) && (*resultClass != 0)) { - //DEBUGOUT("Is resultClass (%s) a parent of %s?\n", resultClass, LEFT_CLASSNAME); - if (!omccmpiClassIsDerivedFrom( LEFT_CLASSNAME, - resultClass, - _broker, - ns )) + // check + if (!omccmpiClassIsDerivedFrom(LEFT_CLASSNAME, + resultClass, + _broker,ns,&status)) { - goto exit; + bHaveMatch = 0; // FALSE } } - // TODO - - // check the incoming cop for anything to help determine results - // see example below for comparing incoming computerSystemName with - // 'this' computer system name - /* - CMPIData data = CMGetKey(cop, "InstanceID", &status); - char *inName = CMGetCharPtr(data.value.string); - DEBUGOUT("comparing inName (%s) with name (%s)\n", inName, "omc:computername"); - if (strcasecmp(inName, "omc:computername") == 0) - */ + if ((resultRole != NULL) && (*resultRole != 0)) { - // create the <left_classname> cop that I'll use below - CMPIObjectPath *leftcop = omccmpiCreateCSObjectPath( _broker, ns); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(leftcop)) + // check + if (strcasecmp(resultRole, LEFT_PROPERTYNAME) != 0) { - CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, - "Could not create <left_classname> cop"); - goto exit; + bHaveMatch = 0; // FALSE } + } - // create and populate results - if (namesOnly) - { - if (refs) - { - // create an association object path with the <leftcop> - CMPIObjectPath *assocCop = omccmpiCreateAssociationPath(_broker, - ns, - ASSOC_CLASSNAME, - LEFT_PROPERTYNAME, - RIGHT_PROPERTYNAME, - leftcop, - cop ); - CMReturnObjectPath(results, assocCop); - } - else - { - // return the <leftcop> - CMReturnObjectPath(results, leftcop); - } - } - else - { - if (refs) - { - // create an association instance with the <leftcop> - CMPIInstance *assocInst = omccmpiCreateAssociationInst(_broker, - ns, - ASSOC_CLASSNAME, - LEFT_PROPERTYNAME, - RIGHT_PROPERTYNAME, - leftcop, - cop ); - CMReturnInstance(results, assocInst); - } - else - { - // return the instance from <leftcop> - CMPIInstance *rightInst = CBGetInstance(_broker, context, rightcop, properties, &status); - CMReturnInstance(results, rightInst); - } - } + if (bHaveMatch) + { + // do work here: + // create and return the appropriate association instance(s) + // + // loop, if necesssary + // do appropriate checks + + // get or create left side object path + CMPIObjectPath *leftCop = CMNewObjectPath(_broker, ns, LEFT_CLASSNAME, &status); + // add keys + + // the right cop was passed in + CMPIObjectPath *rightCop = cop; + + + // create association instance + CMPIInstance *assocInst = omccmpiCreateAssociationInst(_broker, + ns, + ASSOC_CLASSNAME, + classKeys, + properties, + LEFT_PROPERTYNAME, + RIGHT_PROPERTYNAME, + leftCop, + rightCop, + &status); + // "handle" the association + omccmpiSimpleAssocResults(ctx, assocInst, &status); } } else { - DEBUGOUT("!!! Object type unknown: %s\n", objsClassName); + DEBUGOUT("!!! Object type unknown: %s\n", objClassName); } } -exit: + //close return handler + CMReturnDone(results); + + DEBUGOUT("Leaving doReferences\n"); return status; } @@ -574,19 +548,10 @@ DEBUGOUT("Associators() called"); - CMPIStatus status = associatorsHelper( self, - context, - results, - cop, - assocClass, - resultClass, - role, - resultRole, - properties, - 0, // not names only - 0 ); // not ref + CMPIStatus status = omccmpiSimpleAssociators( doReferences, self, + _broker, context, results, cop, assocClass, + resultClass, role, resultRole, properties); -exit: DEBUGOUT("Leaving Associatiors(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -616,19 +581,10 @@ DEBUGOUT("AssociatorNames() called"); - CMPIStatus status = associatorsHelper( self, - context, - results, - cop, - assocClass, - resultClass, - role, - resultRole, - properties, - 1, // names only - 0 ); // not ref + CMPIStatus status = omccmpiSimpleAssociatorNames( doReferences, self, + _broker, context, results, cop, assocClass, + resultClass, role, resultRole); -exit: DEBUGOUT("Leaving AssociatiorNames(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -656,19 +612,10 @@ DEBUGOUT("References() called"); - CMPIStatus status = associatorsHelper( self, - context, - results, - cop, - resultClass, - NULL, - role, - NULL, - properties, - 0, // not names only - 1 ); // refs + CMPIStatus status = omccmpiSimpleReferences( doReferences, self, + _broker, context, results, cop, NULL, + resultClass, role, NULL, properties); -exit: DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -694,19 +641,10 @@ DEBUGOUT("ReferenceNames() called"); - CMPIStatus status = associatorsHelper( self, - context, - results, - cop, - resultClass, - NULL, - role, - NULL, - properties, - 1, // names only - 1 ); // refs + CMPIStatus status = omccmpiSimpleReferenceNames( doReferences, self, + _broker, context, results, cop, NULL, + resultClass, role, NULL); -exit: DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } Added: cmpibase/trunk/src/providers/time-service/Makefile.am =================================================================== --- cmpibase/trunk/src/providers/time-service/Makefile.am (rev 0) +++ cmpibase/trunk/src/providers/time-service/Makefile.am 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,96 @@ +include $(top_srcdir)/Makefile.incl.am + +provider_LTLIBRARIES = libomccmpi_systemTimeService.la \ + libomccmpi_remoteTimeServicePort.la +# libomccmpi_hostedTimeService.la \ +# libomccmpi_timeServiceAccessBySAP.la \ +# libomccmpi_timeServiceAvailableToElement.la \ +# libomccmpi_timeServiceTimeZoneSettingData.la \ +# libomccmpi_timeZoneSettingData.la + + +INCLUDES = -I$(top_srcdir)/src/include + +libomccmpi_systemTimeService_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +libomccmpi_systemTimeService_la_SOURCES = \ + systemTimeService.c + +libomccmpi_systemTimeService_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + + +libomccmpi_remoteTimeServicePort_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +libomccmpi_remoteTimeServicePort_la_SOURCES = \ + remoteTimeServicePort.c + +libomccmpi_remoteTimeServicePort_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + + +#libomccmpi_hostedTimeService_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +#libomccmpi_hostedTimeService_la_SOURCES = \ + hostedTimeService.c + +#libomccmpi_hostedTimeService_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + + +#libomccmpi_timeServiceAccessBySAP_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +#libomccmpi_timeServiceAccessBySAP_la_SOURCES = \ + timeServiceAccessBySAP.c + +#libomccmpi_timeServiceAccessBySAP_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + + +#libomccmpi_timeServiceAvailableToElement_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +#libomccmpi_timeServiceAvailableToElement_la_SOURCES = \ + timeServiceAvailableToElement.c + +#libomccmpi_timeServiceAvailableToElement_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + + +#libomccmpi_timeServiceTimeZoneSettingData_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +#libomccmpi_timeServiceTimeZoneSettingData_la_SOURCES = \ + timeServiceTimeZoneSettingData.c + +#libomccmpi_timeServiceTimeZoneSettingData_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + + +#libomccmpi_timeZoneSettingData_la_LIBADD = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la + +#libomccmpi_timeZoneSettingData_la_SOURCES = \ + timeZoneSettingData.c + +#libomccmpi_timeZoneSettingData_la_LDFLAGS = \ + -lpthread \ + -version-info 1 + Added: cmpibase/trunk/src/providers/time-service/Makefile.in =================================================================== --- cmpibase/trunk/src/providers/time-service/Makefile.in (rev 0) +++ cmpibase/trunk/src/providers/time-service/Makefile.in 2006-11-01 23:59:10 UTC (rev 12) @@ -0,0 +1,566 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# *********************************************************************** +# MACROS and VARIABLES +# *********************************************************************** + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.incl.am +subdir = src/providers/time-service +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(providerdir)" +providerLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(provider_LTLIBRARIES) +libomccmpi_remoteTimeServicePort_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(top_builddir)/src/lib/omc/libomc_cbase.la +am_libomccmpi_remoteTimeServicePort_la_OBJECTS = \ + remoteTimeServicePort.lo +libomccmpi_remoteTimeServicePort_la_OBJECTS = \ + $(am_libomccmpi_remoteTimeServicePort_la_OBJECTS) +libomccmpi_systemTimeService_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/omc/libomc_cmpi.la \ + $(to... [truncated message content] |
From: <np...@us...> - 2006-11-02 21:50:56
|
Revision: 17 http://svn.sourceforge.net/omc/?rev=17&view=rev Author: npaxton Date: 2006-11-02 13:50:53 -0800 (Thu, 02 Nov 2006) Log Message: ----------- Initial TimeZoneSettingData object management Modified Paths: -------------- cmpibase/trunk/configure cmpibase/trunk/src/include/omc/base.h cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h cmpibase/trunk/src/include/omc/ntpServer.h cmpibase/trunk/src/lib/omc/base.c cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c cmpibase/trunk/src/lib/omc/ntpServer.c cmpibase/trunk/src/providers/computer-system/hostNameSettingData.c cmpibase/trunk/src/providers/time-service/remoteTimeServicePort.c cmpibase/trunk/src/providers/time-service/timeZoneSettingData.c Modified: cmpibase/trunk/configure =================================================================== --- cmpibase/trunk/configure 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/configure 2006-11-02 21:50:53 UTC (rev 17) @@ -25081,7 +25081,7 @@ done - ac_config_files="$ac_config_files Makefile src/Makefile src/lib/Makefile src/lib/omc/Makefile src/include/Makefile src/include/omc/Makefile src/providers/Makefile src/providers/processes/Makefile src/providers/computer-system/Makefile src/providers/operating-system/Makefile" + ac_config_files="$ac_config_files Makefile src/Makefile src/lib/Makefile src/lib/omc/Makefile src/include/Makefile src/include/omc/Makefile src/providers/Makefile src/providers/processes/Makefile src/providers/computer-system/Makefile src/providers/operating-system/Makefile src/providers/time-service/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -25666,6 +25666,7 @@ "src/providers/processes/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/providers/processes/Makefile" ;; "src/providers/computer-system/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/providers/computer-system/Makefile" ;; "src/providers/operating-system/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/providers/operating-system/Makefile" ;; + "src/providers/time-service/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/providers/time-service/Makefile" ;; "$ac_config_libobj_dir/fnmatch.h" ) CONFIG_LINKS="$CONFIG_LINKS $ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; Modified: cmpibase/trunk/src/include/omc/base.h =================================================================== --- cmpibase/trunk/src/include/omc/base.h 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/include/omc/base.h 2006-11-02 21:50:53 UTC (rev 17) @@ -119,6 +119,7 @@ const char *rpmName); + #ifdef __cplusplus } #endif Modified: cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h =================================================================== --- cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/include/omc/cmpiTimeServiceUtils.h 2006-11-02 21:50:53 UTC (rev 17) @@ -82,7 +82,41 @@ CMPIStatus *pStatus, const char **properties); + + +CMPIObjectPath* +makeTimeZoneSettingDataObjectPath( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus); + + +CMPIInstance * +makeTimeZoneSettingDataInstance( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus, + const char **properties); + + + + + int isIPV4Address(const char *arg); +/** + * Get the timezone, time, and whether UTC + * @param: timezone [out] preallocated string for timezone + * @param: timezonelen [in] length of timezone - num bytes + * allocated + * @param: utcHwClock [out] int* whether UTC or not + */ +void +omcGetClockInfo( + char *timezone, + int timezoneLen, + int *utcHwClock); + + #endif // TIME_SERVICE_UTILS_H_GUARD__ Modified: cmpibase/trunk/src/include/omc/ntpServer.h =================================================================== --- cmpibase/trunk/src/include/omc/ntpServer.h 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/include/omc/ntpServer.h 2006-11-02 21:50:53 UTC (rev 17) @@ -46,13 +46,65 @@ } NTPServer; -NTPServer *getNTPServers(int *pCount); -int getNTPServer(const char *serverName, NTPServer *out); -int deleteNTPServer(const char *serverName); -int setNTPServer(NTPServer *server); -void copyNTPServer(const NTPServer *in, NTPServer *out); -NTPServer *createAndCopyNTPServer(const NTPServer *in); +/* + Determine if the local computer supports NTPServer +*/ +int +serverSupportsNTP(); +/* + get an array of NTPServers with [pCount] elements + Caller is responsible to free the pointer returned +*/ +NTPServer * +getNTPServers( + int *pCount); + + +/* + get the NTPServer that corresponds with [serverName] + Caller is responsible to free the pointer returned +*/ +NTPServer * +getNTPServer( + const char *serverName); + + +/* + delete the NTPServer that corresponds with [serverName] +*/ +int +deleteNTPServer( + const char *serverName); + + +/* + modify the settings of NTPServer that corresponds with [oldServerName] +*/ +int +setNTPServer( + const char *oldServerName, + NTPServer *server); + + +/* + c version of assignment operator +*/ +void +copyNTPServer( + const NTPServer *in, + NTPServer *out); + + +/* + c version of copy constructor + Caller is responsible to free the pointer returned +*/ +NTPServer * +createAndCopyNTPServer( + const NTPServer *in); + + #endif // NTP_SERVER_UTILS_H_GUARD__ Modified: cmpibase/trunk/src/lib/omc/base.c =================================================================== --- cmpibase/trunk/src/lib/omc/base.c 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/lib/omc/base.c 2006-11-02 21:50:53 UTC (rev 17) @@ -138,20 +138,20 @@ size_t hostNameOutLen) { char namebuf[256]; - if (!hostNameOut || !hostNameOutLen) + if (!hostNameOut || !hostNameOutLen) { errno = EINVAL; return NULL; } gethostname(namebuf, sizeof(namebuf)); - if (!strchr(namebuf, '.')) + if (!strchr(namebuf, '.')) { char lbuf[2048]; int herr = 0; struct hostent hostbuf; struct hostent* hent = &hostbuf; - if (gethostbyname_r(namebuf, &hostbuf, lbuf, sizeof(lbuf), - &hent, &herr) != 0) + if (gethostbyname_r(namebuf, &hostbuf, lbuf, sizeof(lbuf), + &hent, &herr) != 0) { hent = NULL; } @@ -225,4 +225,3 @@ return 0; } - Modified: cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c =================================================================== --- cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/lib/omc/cmpiTimeServiceUtils.c 2006-11-02 21:50:53 UTC (rev 17) @@ -32,6 +32,7 @@ #include <omc/cmpiTimeServiceUtils.h> #include <omc/ntpServer.h> +#include <omc/ioUtils.h> #include <fnmatch.h> #include <ctype.h> @@ -66,6 +67,11 @@ NULL}; +static const char * timezoneSettingDataClassKeys[] = { + "InstanceID", + NULL}; + + /*****************************************************************************/ CMPIObjectPath * makeTimeServiceObjectPath( @@ -225,10 +231,9 @@ CMPIObjectPath *op = makeRemoteTimeServicePortObjectPath(broker, ns, serverName, pStatus); if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) { - NTPServer *server = malloc(sizeof(NTPServer)); + NTPServer *server = getNTPServer(serverName); if (server) { - getNTPServer(serverName, server); instance = CMNewInstance(broker, op, pStatus); if (!CMIsNullObject(instance) && (pStatus->rc == CMPI_RC_OK)) { @@ -314,6 +319,7 @@ if(server->maxPoll) CMSetProperty(instance, "maxpoll", (CMPIValue*)&(server->maxPoll), CMPI_uint16); } + free(server); } } return instance; @@ -322,6 +328,69 @@ /*****************************************************************************/ +CMPIObjectPath* +makeTimeZoneSettingDataObjectPath( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus) +{ + CMPIObjectPath *op = CMNewObjectPath(broker, ns, "OMC_TimeZoneSettingData", pStatus); + if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) + { + char name[128] = {0}; + omcGetComputerSystemName(name, sizeof(name)); + + CMAddKey(op, + "InstanceID", + (CMPIValue *)"omc:timezone", + CMPI_chars); + } + return op; +} + + + +/*****************************************************************************/ +CMPIInstance * +makeTimeZoneSettingDataInstance( + const CMPIBroker *broker, + const char *ns, + CMPIStatus *pStatus, + const char **properties) +{ + CMPIInstance *instance = NULL; + CMPIObjectPath *op = makeTimeZoneSettingDataObjectPath(broker, ns, pStatus); + if (!CMIsNullObject(op) && (pStatus->rc == CMPI_RC_OK)) + { + char timezone[32] = {0}; + int utcHwClock = 1; + + omcGetClockInfo(timezone, 32, &utcHwClock); + + instance = CMNewInstance(broker, op, pStatus); + if (!CMIsNullObject(instance) && (pStatus->rc == CMPI_RC_OK)) + { + CMSetPropertyFilter(instance, properties, timezoneSettingDataClassKeys); + // keys + CMSetProperty(instance, + "InstanceID", + (CMPIValue *)"omc:timezone", + CMPI_chars); + + CMSetProperty(instance, + "TimeZone", + (CMPIValue *)timezone, + CMPI_chars); + + CMSetProperty(instance, "UTCHardwareClock", (CMPIValue*)&utcHwClock, CMPI_boolean); + } + } + return instance; +} + + + +/*****************************************************************************/ int isIPV4Address(const char *arg) { @@ -342,3 +411,98 @@ return 1; } + +/*****************************************************************************/ +static int +getKeyValuePair( + const char *line, + char *key, + int keylen, + char *value, + int valuelen) +{ + int retval = 0; + char *delim = strchr(line, '='); + if(delim) + { + int localKeyLen = (int)((char*)delim-(char*)line); + int localValLen = (int)((char*)(line+strlen(line))-(char*)delim); + omcStrNCpy(key, line, (localKeyLen > keylen?keylen:localKeyLen)); + omcStrTrim(key); + omcStrNCpy(value, delim+1, (localValLen > valuelen?valuelen:localValLen)); + omcStrTrim(value); + if (value[0] == '"') + { + omcStrNCpy(value, value+1, strlen(value)-1 ); + } + if (omcStrEndsWith(value, "\"")) + { + value[strlen(value)-1] = '\0'; + } + retval = 1; + } + + return 0; +} + +/*****************************************************************************/ +void omcGetClockInfo( + char *timezone, + int timezoneLen, + int *utcHwClock) +{ + FILE *file; + unsigned int bfrLen = 0; + char *p = NULL, *bufPtr = NULL; + //char* errMsgBfr = NULL; + //unsigned int errMsgBfrLen = 0; + + DEBUGOUT("Entering omcGetClockInfo\n"); + + if (!timezone || !utcHwClock || !timezoneLen) + { + return; + } + + file = fopen("/etc/sysconfig/clock", "r"); + if (!file) + { + //errCond(errMsgBfr, errMsgBfrLen, -1, + // "Failed to open file /etc/sysconfig/clock"); + return; + } + + char key[32] = {0}; + char value[256] = {0}; + + for(p = omcReadLine(file, &bufPtr, &bfrLen); p; + p = omcReadLine(file, &bufPtr, &bfrLen)) + { + DEBUGOUT(" got line: %s\n", bufPtr); + + memset(key, 0, 32); + memset(value, 0, 256); + getKeyValuePair(bufPtr, key, 32, value, 256); + if (strcasecmp(key, "HWCLOCK") == 0) + { + if (strcasecmp(value, "-u") == 0) + { + *utcHwClock = 1; + } + else + { + *utcHwClock = 0; + } + } + else if (strcasecmp(key, "TIMEZONE") == 0) + { + omcStrNCpy(timezone, value, timezoneLen); + } + } + + fclose(file); + + if (bufPtr) + free(bufPtr); +} + Modified: cmpibase/trunk/src/lib/omc/ntpServer.c =================================================================== --- cmpibase/trunk/src/lib/omc/ntpServer.c 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/lib/omc/ntpServer.c 2006-11-02 21:50:53 UTC (rev 17) @@ -31,6 +31,7 @@ ******************************************************************************/ #include <omc/ntpServer.h> +#include <omc/base.h> #include <omc/ioUtils.h> #include <omc/string.h> @@ -53,6 +54,19 @@ +int +serverSupportsNTP() +{ + unsigned long installDate; + installDate = omcGetRPMInstallDate("xntp"); + if (installDate) + { + return 1; + } + return 0; +} + + char * lineFromServer( NTPServer *pServer) @@ -266,7 +280,7 @@ /*****************************************************************************/ -int getNTPServer(const char *serverName, NTPServer *out) +NTPServer *getNTPServer(const char *serverName) { FILE *file; unsigned int bfrLen = 0; @@ -275,16 +289,17 @@ char* errMsgBfr = NULL; unsigned int errMsgBfrLen = 0; - if (!serverName || !out) + if (!serverName) { - return 0; + return NULL; } file = fopen("/etc/ntp.conf", "r"); if (!file) { - return errCond(errMsgBfr, errMsgBfrLen, -1, + errCond(errMsgBfr, errMsgBfrLen, -1, "Failed to open file /etc/ntp.conf"); + return NULL; } for(p = omcReadLine(file, &bufPtr, &bfrLen); p; @@ -295,13 +310,12 @@ serverFromLine(p, &server); if(strcasecmp(server.serverName, serverName) == 0) { - copyNTPServer(&server, out); - return 1; + return createAndCopyNTPServer(&server); } } } - return 0; + return NULL; } @@ -320,7 +334,7 @@ /*****************************************************************************/ -int setNTPServer(NTPServer *server) +int setNTPServer(const char *oldServerName, NTPServer *server) { /* SetServerListener ssl(server); Modified: cmpibase/trunk/src/providers/computer-system/hostNameSettingData.c =================================================================== --- cmpibase/trunk/src/providers/computer-system/hostNameSettingData.c 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/providers/computer-system/hostNameSettingData.c 2006-11-02 21:50:53 UTC (rev 17) @@ -108,7 +108,7 @@ char* errMsgBfr, unsigned int errMsgBfrLen) { - //DEBUGOUT("%s", "writeLine() called\n"); + //DEBUGOUT("writeLine() called\n"); // trim this? if (line[0] == '#') @@ -191,7 +191,7 @@ static int modifyComputerName(const char *curComputerName, const char *newComputerName) { - DEBUGOUT("%s", "modifyComputerName() called\n"); + DEBUGOUT("modifyComputerName() called\n"); int bModified = 0; @@ -226,13 +226,13 @@ char err1[256] = {0}; char err2[256] = {0}; - //DEBUGOUT("%s", "about to call modifyFile on hosts\n"); + //DEBUGOUT("about to call modifyFile on hosts\n"); int r1 = omcModifyFile("/etc/hosts", &fms, err1, 256); - //DEBUGOUT("%s", "about to call modifyFile on HOSTNAME\n"); + //DEBUGOUT("about to call modifyFile on HOSTNAME\n"); int r2 = omcModifyFile("/etc/HOSTNAME", &fms, err2, @@ -278,7 +278,7 @@ } } //exit: - DEBUGOUT("%s", "modifyComputerName() returning\n"); + DEBUGOUT("modifyComputerName() returning\n"); return bModified; } @@ -307,7 +307,7 @@ const CMPIResult * results, const CMPIObjectPath * cop) { - DEBUGOUT("%s", "EnumInstanceNames() called\n"); + DEBUGOUT("EnumInstanceNames() called\n"); CMPIStatus status = {CMPI_RC_OK, NULL}; char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); @@ -345,7 +345,7 @@ static CMPIInstance * CreateSettingDataInstance(const CMPIObjectPath * cop, const char ** properties) { - DEBUGOUT("%s", "CreateSettingDataInstance() called\n"); + DEBUGOUT("CreateSettingDataInstance() called\n"); CMPIStatus status = {CMPI_RC_OK, NULL}; char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); @@ -359,7 +359,7 @@ } else { - DEBUGOUT("%s", "About to set instance properties\n"); + DEBUGOUT("About to set instance properties\n"); status = CMSetPropertyFilter(instance, properties, (const char **)classKeys); @@ -373,7 +373,7 @@ exit: - DEBUGOUT("%s", "Leaving CreateSettingDataInstance()\n"); + DEBUGOUT("Leaving CreateSettingDataInstance()\n"); return instance; } @@ -394,7 +394,7 @@ const CMPIObjectPath * cop, const char ** properties) { - DEBUGOUT("%s", "EnumInstances() called\n"); + DEBUGOUT("EnumInstances() called\n"); CMPIStatus status = {CMPI_RC_OK, NULL}; //char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); @@ -432,7 +432,7 @@ const CMPIObjectPath * cop, const char ** properties) { - DEBUGOUT("%s", "GetInstance() called\n"); + DEBUGOUT("GetInstance() called\n"); CMPIStatus status = {CMPI_RC_OK, NULL}; //char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); @@ -481,7 +481,7 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("%s", "ModifyInstance() called\n"); + DEBUGOUT("ModifyInstance() called\n"); // do work here if supported if (getuid() != 0) @@ -490,11 +490,11 @@ "Insufficient rights to modify the host name setting data"); goto exit; } - DEBUGOUT("%s", "Past getuid\n"); + DEBUGOUT("Past getuid\n"); CMPIData key = CMGetKey(cop, "InstanceID", &status); if (!CMIsNullValue(key)) { - DEBUGOUT("%s", "Past getkey.\n"); + DEBUGOUT("Past getkey.\n"); if (strcmp(CMGetCharPtr(key.value.string), instanceID) == 0) { CMPIData newName = CMGetProperty(newinstance, "ComputerName", &status); @@ -509,7 +509,7 @@ if (strcmp(szNewHostName, csHostName) == 0) { - DEBUGOUT("%s", "HostNameSettingData::modifyInstance - Modified host name is the same as the old name. No action taken.\n"); + DEBUGOUT("HostNameSettingData::modifyInstance - Modified host name is the same as the old name. No action taken.\n"); } else { @@ -546,7 +546,7 @@ { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - DEBUGOUT("%s", "CreateInstance() called - Not Supported"); + DEBUGOUT("CreateInstance() called - Not Supported"); // do work here if supported @@ -569,7 +569,7 @@ { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - DEBUGOUT("%s", "DeleteInstance() called\n"); + DEBUGOUT("DeleteInstance() called\n"); // do work here if supported @@ -596,7 +596,7 @@ { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - DEBUGOUT("%s", "ExecQuery() called - Not Supported"); + DEBUGOUT("ExecQuery() called - Not Supported"); // do work here if supported @@ -617,7 +617,7 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("%s", "Cleanup() called\n"); + DEBUGOUT("Cleanup() called\n"); // do work here if necessary @@ -632,7 +632,7 @@ // **************************************************************************** static void Init(CMPIInstanceMI * self) { - DEBUGOUT("%s", "Initialize() called\n"); + DEBUGOUT("Initialize() called\n"); // do work here if necessary memset(g_szOldHostName, 0, 128); @@ -658,7 +658,7 @@ // **************************************************************************** static void MethodInit(CMPIMethodMI * self) { - DEBUGOUT("%s", "MethodInitialize() called\n"); + DEBUGOUT("MethodInitialize() called\n"); // do work here if necessary @@ -678,7 +678,7 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("%s", "MethodCleanup() called\n"); + DEBUGOUT("MethodCleanup() called\n"); // do work here if necessary @@ -707,7 +707,7 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("%s", "InvokeMethod() called\n"); + DEBUGOUT("InvokeMethod() called\n"); // do work here //CMPIString *class = NULL; Modified: cmpibase/trunk/src/providers/time-service/remoteTimeServicePort.c =================================================================== --- cmpibase/trunk/src/providers/time-service/remoteTimeServicePort.c 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/providers/time-service/remoteTimeServicePort.c 2006-11-02 21:50:53 UTC (rev 17) @@ -126,9 +126,8 @@ DEBUGOUT("RemoteTimeServicePort: EnumInstanceNames() called\n"); - if(omcGetRPMInstallDate("xntp")) + if(serverSupportsNTP()) { - DEBUGOUT(" got RPM Install Date for xntp\n"); int numServers = 0; NTPServer *sra = getNTPServers(&numServers); if (sra && numServers) @@ -148,6 +147,7 @@ CMReturnObjectPath(results, cop); } } + free(sra); } } CMReturnDone(results); @@ -185,9 +185,8 @@ DEBUGOUT("RemoteTimeServicePort: EnumInstances() called\n"); - if(omcGetRPMInstallDate("xntp")) + if(serverSupportsNTP()) { - DEBUGOUT(" got RPM Install Date for xntp\n"); int numServers = 0; NTPServer *sra = getNTPServers(&numServers); if (sra && numServers) @@ -208,6 +207,7 @@ CMReturnInstance(results, inst); } } + free(sra); } } CMReturnDone(results); @@ -241,26 +241,48 @@ const char ** properties) { CMPIStatus status = {CMPI_RC_OK, NULL}; + char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); DEBUGOUT("RemoteTimeServicePort: GetInstance() called\n"); - /* - CMPIObjectPath *op = makeTimeServiceObjectPath(ns, &status); + CMPIData key = CMGetKey(cop, "Name", &status); + if (!CMIsNullValue(key)) + { + char *inServerName = CMGetCharPtr(key.value.string); + DEBUGOUT(" got servername: %s\n", inServerName); - if (omccmpiAreObjectPathsSame(cop, op, &status)) - { - CMPIInstance *inst = makeTimeServiceInstance(ns, &status, properties); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(inst)) + NTPServer *ntpServer = getNTPServer(inServerName); + if (ntpServer) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating TimeService instance"); - DEBUGOUT("EnumInstances(): makeTimeServiceInstance() failed - %s\n", CMGetCharPtr(status.msg)); + DEBUGOUT(" got NTPServer: %s\n", ntpServer->serverName); + CMPIInstance *inst = makeRemoteTimeServicePortInstance( + _broker, + ns, + ntpServer->serverName, + &status, + properties); + if (!CMIsNullObject(cop)) + { + CMReturnInstance(results, inst); + } + free(ntpServer); + } + else + { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_FAILED, "Didn't find ntpServer in file"); + DEBUGOUT("RemoteTimeServerPort: getNTPServer() failed - %s\n", CMGetCharPtr(status.msg)); return status; } - CMReturnInstance(results, inst); } CMReturnDone(results); - */ + if (status.rc != CMPI_RC_OK) + { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating RemotePort instance"); + DEBUGOUT("RemoteTimeServerPort::GetInstance() failed - %s\n", CMGetCharPtr(status.msg)); + return status; + } + DEBUGOUT("RemoteTimeServicePort: Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -285,8 +307,62 @@ DEBUGOUT("RemoteTimeServicePort: ModifyInstance() called - Not Supported\n"); - // do work here if supported + //TODO: this should support ModifyInstance - edit an entry in the file +/* + if (::geteuid() != 0) + { + OW_THROWCIM(CIMException::ACCESS_DENIED); + } + if(!serverSupportsNTP()) + { + OW_THROWCIMMSG(CIMException::NOT_SUPPORTED, + "NTP Support is not available"); + } + + CIMInstance mci = modifiedInstance.createModifiedInstance( + previousInstance, includeQualifiers, propertyList, theClass); + + CIMValue cv = mci.getPropertyValue("Name"); + if(!cv) + { + OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, + "Name property must be specified"); + } + + NTPServer server; + cv.get(server.serverName); + if(server.serverName.empty()) + { + OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, + "Name property must be specified"); + } + + cv = mci.getPropertyValue("Prefer"); + if(cv) + { + Bool prefer; + cv.get(prefer); + server.prefer = prefer; + } + + server.key = getUIntFromCIMValue("key", mci); + server.ntpVersion = getUIntFromCIMValue("ntpversion", mci); + server.minPoll = getUIntFromCIMValue("minpoll", mci); + server.maxPoll = getUIntFromCIMValue("maxpoll", mci); + + if(NTPConf::setServer(server) != 0) + { + OW_THROWCIM(CIMException::FAILED); + } + + String errMsg; + if(restartNTP(errMsg) != 0) + { + OW_THROWCIMMSG(CIMException::FAILED, errMsg.c_str()); + } + +*/ DEBUGOUT("RemoteTimeServicePort: Leaving ModifyInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -310,8 +386,60 @@ DEBUGOUT("RemoteTimeServicePort: CreateInstance() called - Not Supported\n"); - // do work here if supported + //TODO: this should support CreateInstance - add an entry to the file + /* + if (::geteuid() != 0) + { + OW_THROWCIM(CIMException::ACCESS_DENIED); + } + if(!serverSupportsNTP()) + { + OW_THROWCIMMSG(CIMException::NOT_SUPPORTED, + "NTP Support is not available"); + } + + CIMValue cv = cimInstance.getPropertyValue("Name"); + if(!cv) + { + OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, + "Name property must be specified"); + } + + NTPServer server; + cv.get(server.serverName); + if(server.serverName.empty()) + { + OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, + "Name property must be specified"); + } + + if((cv = cimInstance.getPropertyValue("Prefer"))) + { + Bool prefer; + cv.get(prefer); + server.prefer = prefer; + } + + server.key = getUIntFromCIMValue("key", cimInstance); + server.ntpVersion = getUIntFromCIMValue("ntpversion", cimInstance); + server.minPoll = getUIntFromCIMValue("minpoll", cimInstance); + server.maxPoll = getUIntFromCIMValue("maxpoll", cimInstance); + + if(NTPConf::setServer(server) != 0) + { + OW_THROWCIM(CIMException::FAILED); + } + + String errMsg; + if(restartNTP(errMsg) != 0) + { + OW_THROWCIMMSG(CIMException::FAILED, errMsg.c_str()); + } + + return makeRemotePortObjectPath(server.serverName, env, ns); + */ + DEBUGOUT("RemoteTimeServicePort: Leaving CreateInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -333,8 +461,46 @@ DEBUGOUT("RemoteTimeServicePort: DeleteInstance() called\n"); - // do work here if supported + //TODO: this should support DeleteInstance - remove an entry from the file +/* + if (::geteuid() != 0) + { + OW_THROWCIM(CIMException::ACCESS_DENIED); + } + if(!serverSupportsNTP()) + { + OW_THROWCIMMSG(CIMException::NOT_SUPPORTED, + "NTP Support is not available"); + } + + CIMValue cv = cop.getKeyValue("Name"); + if(!cv) + { + OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, + "Name is missing from given object path"); + } + + String serverName; + cv.get(serverName); + if(serverName.length() == 0) + { + OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, + "Name is missing from given object path"); + } + + if(NTPConf::deleteServer(serverName) != 0) + { + OW_THROWCIM(CIMException::FAILED); + } + + String errMsg; + if(restartNTP(errMsg) != 0) + { + OW_THROWCIMMSG(CIMException::FAILED, errMsg.c_str()); + } + +*/ DEBUGOUT("RemoteTimeServicePort: Leaving DeleteInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } Modified: cmpibase/trunk/src/providers/time-service/timeZoneSettingData.c =================================================================== --- cmpibase/trunk/src/providers/time-service/timeZoneSettingData.c 2006-11-02 19:02:03 UTC (rev 16) +++ cmpibase/trunk/src/providers/time-service/timeZoneSettingData.c 2006-11-02 21:50:53 UTC (rev 17) @@ -1,14 +1,53 @@ -// place copyright notice here +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Norm Paxton (np...@no...) +******************************************************************************/ -#include "cmpidt.h" -#include "cmpift.h" -#include "cmpimacs.h" +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> +#include <stdlib.h> +#include <unistd.h> +#include <omc/base.h> +#include <omc/string.h> +#include <omc/modifyFile.h> +#include <omc/exec.h> + // NULL terminated list of key property names for this class -static char * classKeys[] = {"FooKey", NULL}; +static char className[] = "OMC_TimeZoneSettingData"; +static char * classKeys[] = {"InstanceID", NULL}; +static char instanceID[] = "omc:timezone"; -#ifdef DEBUG +#ifdef OMC_DEBUG #define DEBUGOUT(fmt, args...) printf(fmt,## args) #else #define DEBUGOUT(fmt, args...) @@ -17,7 +56,7 @@ // Global handle to the CIM broker // This is initialized by the CIMOM when the provider is loaded -static CMPIBroker * _broker; +static const CMPIBroker * _broker; // **************************************************************************** @@ -51,6 +90,203 @@ */ + + +char g_szOldTimeZone[128]; +char g_szNewTimeZone[128]; + + +// ************* +// Functions to facilitate modifying the host name setting data +// ************* +// +// //int (*writeLine)(const char* line, FILE* const ostrm, char* errMsgBfr, unsigned int errMsgBfrLen); +/* +static int myWriteLine( const char* line, + FILE* const ostrm, + char* errMsgBfr, + unsigned int errMsgBfrLen) +{ + //DEBUGOUT("writeLine() called\n"); + + // trim this? + if (line[0] == '#') + { + // just write it and ignore it + fputs(line, ostrm); + fputs("\n", ostrm); + return 0; + } + + int bModified = 0; + unsigned int tokenCount = 0; + char** toks = omcStrTokenize(line, ", \t", &tokenCount); + int i=0; + if (toks && toks[i]) + { + //DEBUGOUT("line: %s\n", line); + while (toks[i]) + { + //DEBUGOUT(" toks[%d]: %s\n", i, toks[i]); + if(strcmp(toks[i], g_szOldHostName) == 0) + { + toks[i] = g_szNewHostName; + bModified = 1; + //DEBUGOUT(" matched: %s == %s\n", toks[i], g_szOldHostName); + } + else + { + //DEBUGOUT(" didn't match: %s != %s\n", toks[i], g_szOldHostName); + } + + if(strcmp(toks[i], g_szOldShortName) == 0) + { + toks[i] = g_szNewShortName; + bModified = 1; + //DEBUGOUT(" matched: %s != %s\n", toks[i], g_szOldShortName); + } + else + { + //DEBUGOUT(" didn't match: %s != %s\n", toks[i], g_szOldShortName); + } + + i++; + } + + if(bModified > 0) + { + int newlen = (strlen(line)+1) + (strlen(g_szNewHostName)); + char *newline = (char*) malloc(newlen); + memset(newline, 0, newlen); + i = 0; + while(toks[i]) + { + omcStrAppend(newline, toks[i], newlen); + omcStrAppend(newline, "\t", newlen); + i++; + } + //DEBUGOUT("writing new line: %s\n", newline); + fputs(newline, ostrm); + fputs("\n", ostrm); + free(newline); + } + else + { + // didn't modify this line, just write it back out... + // bModify is still 0, let end return handle it + fputs(line, ostrm); + fputs("\n", ostrm); + } + + } + free(toks); + + //DEBUGOUT("writeLine() returning... modified: %d\n", bModified); + + return bModified; +} + + +static int modifyComputerName(const char *curComputerName, + const char *newComputerName) +{ + DEBUGOUT("modifyComputerName() called\n"); + + int bModified = 0; + + strncpy(g_szOldHostName, curComputerName, 127); + strncpy(g_szNewHostName, newComputerName, 127); + + //DEBUGOUT("Set OldHostName to %s\n", g_szOldHostName ); + //DEBUGOUT("Set NewHostName to %s\n", g_szNewHostName ); + + char * loc = NULL; + int len = 0; + loc = strchr(curComputerName, (int)'.'); + len = (int)((char *)loc - (char *)curComputerName); + if (len > 0) + { + strncpy(g_szOldShortName, curComputerName, len); + //DEBUGOUT("Set OldShortName to %s\n", g_szOldShortName ); + } + + loc = strchr(newComputerName, (int)'.'); + len = (int)((char *)loc - (char *)newComputerName); + if (len > 0) + { + strncpy(g_szNewShortName, newComputerName, len); + //DEBUGOUT("Set NewShortName to %s\n", g_szNewShortName ); + } + + + omcFileModifier_CBS fms = {0}; + fms.writeLine = myWriteLine; + + char err1[256] = {0}; + char err2[256] = {0}; + + //DEBUGOUT("about to call modifyFile on hosts\n"); + int r1 = omcModifyFile("/etc/hosts", + &fms, + err1, + 256); + + //DEBUGOUT("about to call modifyFile on HOSTNAME\n"); + int r2 = omcModifyFile("/etc/HOSTNAME", + &fms, + err2, + 256); + + if (r1 || r2) + { + DEBUGOUT("Modifying File returned error:\n hosts: %s\n HOSTNAME: %s\n Attempting rollback\n", + err1, err2); + r1 = omcModifyRollBack("/etc/hosts", + err1, + 256 ); + r2 = omcModifyRollBack("/etc/HOSTNAME", + err2, + 256 ); + if (r1 || r2) + { + DEBUGOUT("Rollback failed. use .orig file for /etc/hosts and /etc/HOSTNAME\n err1: %s\n err2: %s", + err1, err2); + } + } + else + { + char *cmd[] = {"/bin/hostname", g_szNewShortName}; + int rSys = omcSafeSystem(cmd, NULL); + if (rSys != 0) + { + DEBUGOUT("Call to /bin/hostname failed. Unable to modify hostname"); + //CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, + // "Call to /bin/hostname failed. Unable to modify hostname"); + + r1 = omcModifyRollBack("/etc/hosts", + err1, + 256 ); + r2 = omcModifyRollBack("/etc/HOSTNAME", + err2, + 256 ); + if (r1 || r2) + { + DEBUGOUT("Rollback failed. use .orig file for /etc/hosts and /etc/HOSTNAME\n err1: %s\n err2: %s", + err1, err2); + } + } + } +//exit: + DEBUGOUT("modifyComputerName() returning\n"); + + return bModified; +} +*/ + + + + + // **************************************************************************** // CMPI INSTANCE PROVIDER FUNCTIONS // **************************************************************************** @@ -70,16 +306,27 @@ const CMPIResult * results, const CMPIObjectPath * cop) { + DEBUGOUT("TimeZoneSettingData: EnumInstanceNames() called\n"); + CMPIStatus status = {CMPI_RC_OK, NULL}; char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); - DEBUGOUT("EnumInstanceNames() called"); + CMPIObjectPath *op = makeTimeZoneSettingDataObjectPath(_broker, ns, &status); - // do work here + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) + { + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, + "Could not create TimeZoneSettingData ObjectPath"); + } + else + { + CMReturnObjectPath(results, op); + } + //close return handler CMReturnDone(results); - DEBUGOUT("Leaving EnumInstanceNames(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving EnumInstanceNames(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -98,16 +345,27 @@ const CMPIObjectPath * cop, const char ** properties) { + DEBUGOUT("EnumInstances() called\n"); + CMPIStatus status = {CMPI_RC_OK, NULL}; char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); - DEBUGOUT("EnumInstances() called"); + CMPIInstance *inst = makeTimeZoneSettingDataInstance(_broker, ns, &status, properties); - // do work here + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(inst)) + { + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, + "Could not create TimeZoneSettingData Instance"); + } + else + { + CMReturnInstance(results, inst); + } + //close return handler CMReturnDone(results); - DEBUGOUT("Leaving EnumInstances(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving EnumInstances(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -126,14 +384,39 @@ const CMPIObjectPath * cop, const char ** properties) { + DEBUGOUT("GetInstance() called\n"); + CMPIStatus status = {CMPI_RC_OK, NULL}; - char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); + //char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); - DEBUGOUT("GetInstance() called"); - // do work here + CMPIData key = CMGetKey(cop, "InstanceID", &status); + if (!CMIsNullValue(key)) + { + if (strcasecmp(CMGetCharPtr(key.value.string), "omc:timezone") == 0) + { + CMPIStatus status = {CMPI_RC_OK, NULL}; + char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); - DEBUGOUT("Leaving GetInstance(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + CMPIInstance *inst = makeTimeZoneSettingDataInstance(_broker, ns, &status, properties); + + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(inst)) + { + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, + "Could not create TimeZoneSettingData Instance"); + } + else + { + CMReturnInstance(results, inst); + } + } + + //close return handler + CMReturnDone(results); + } + +exit: + DEBUGOUT("Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -153,13 +436,53 @@ const CMPIInstance * newinstance, const char ** properties) { - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("ModifyInstance() called - Not Supported"); + DEBUGOUT("ModifyInstance() called\n"); // do work here if supported + if (getuid() != 0) + { + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_ACCESS_DENIED, + "Insufficient rights to modify the host name setting data"); + goto exit; + } + DEBUGOUT("Past getuid\n"); + CMPIData key = CMGetKey(cop, "InstanceID", &status); + if (!CMIsNullValue(key)) + { + DEBUGOUT("Past getkey.\n"); + if (strcmp(CMGetCharPtr(key.value.string), instanceID) == 0) + { + CMPIData newName = CMGetProperty(newinstance, "ComputerName", &status); + if (!CMIsNullValue(newName)) + { + char *szNewHostName = CMGetCharPtr(newName.value.string); + DEBUGOUT("newHostName: %s\n", szNewHostName); - DEBUGOUT("Leaving ModifyInstance(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + // get current computer system name, to compare + char csHostName[128] = {0}; + omcGetComputerSystemName(csHostName, 128); + + if (strcmp(szNewHostName, csHostName) == 0) + { + DEBUGOUT("HostNameSettingData::modifyInstance - Modified host name is the same as the old name. No action taken.\n"); + } + else + { + if (modifyComputerName(csHostName, szNewHostName) != 0) + { + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_FAILED, + "Failed to modify the computer name via hostNameSettingData"); + goto exit; + } + } + } + } + } + +exit: + DEBUGOUT("Leaving ModifyInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -184,7 +507,7 @@ // do work here if supported - DEBUGOUT("Leaving CreateInstance(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving CreateInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -203,11 +526,11 @@ { CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - DEBUGOUT("DeleteInstance() called"); + DEBUGOUT("DeleteInstance() called\n"); // do work here if supported - DEBUGOUT("Leaving DeleteInstance(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving DeleteInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -234,7 +557,7 @@ // do work here if supported - DEBUGOUT("Leaving ExecQuery(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving ExecQuery(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -251,11 +574,11 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("Cleanup() called"); + DEBUGOUT("Cleanup() called\n"); // do work here if necessary - DEBUGOUT("Leaving Cleanup(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving Cleanup(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -266,359 +589,22 @@ // **************************************************************************** static void Init(CMPIInstanceMI * self) { - CMPIStatus status = {CMPI_RC_OK, NULL}; + DEBUGOUT("Initialize() called\n"); - DEBUGOUT("Initialize() called"); - // do work here if necessary + memset(g_szOldHostName, 0, 128); + memset(g_szNewHostName, 0, 128); + memset(g_szOldShortName, 0, 128); + memset(g_szNewShortName, 0, 128); - DEBUGOUT("Leaving Initialize(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving Initialize(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); } - +/* // **************************************************************************** -// CMPI ASSOCIATION PROVIDER FUNCTIONS -// **************************************************************************** - - -static char * ASSOC_CLASSNAME = "OMC_ComputerSystemHostNameSettingData"; -static char * LEFT_CLASSNAME = "OMC_UnitaryComputerSystem"; -static char * RIGHT_CLASSNAME = "OMC_HostNameSettingData"; -static char * LEFT_PROPERTYNAME = "ManagedElement"; -static char * RIGHT_PROPERTYNAME = "SettingData"; - -// **************************************************************************** -// doReferences() -// This is the callback called from the SimpleAssociators helper functions -// It "handles" one or more instances of the association class -// to be filtered by the SimpleAssociatior helper functions to return -// the correct object (instance or object path) -// **************************************************************************** -CMPIStatus -doReferences( - omccmpiSimpleAssocCtx ctx, - CMPIAssociationMI* self, - const CMPIBroker *broker, - const CMPIContext* context, - const CMPIResult* results, - const CMPIObjectPath* cop, - const char *assocClass, - const char *resultClass, - const char *role, - const char *resultRole, - const char** properties) -{ - DEBUGOUT("doReferences called\n"); - - CMPIStatus status = {CMPI_RC_OK, NULL}; - char * ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); - - if (strcasecmp(assocClass, ASSOC_CLASSNAME) == 0) - { - char *objClassName = CMGetCharPtr(CMGetClassName(cop, NULL)); - - if(strcasecmp(objClassName, LEFT_CLASSNAME) == 0) - { - // this is a LEFT_CLASSNAME - // need to get approprate RIGHT_CLASSNAME for ASSOC_CLASSNAME inst - // but if resultClass is set, it must match - - int bHaveMatch = 1; // TRUE - if ((resultClass != NULL) && (*resultClass != 0)) - { - // check - if (!omccmpiClassIsDerivedFrom(RIGHT_CLASSNAME, - resultClass, - _broker,ns,&status)) - { - bHaveMatch = 0; // FALSE - } - } - - if ((resultRole != NULL) && (*resultRole != 0)) - { - // check - if (strcasecmp(resultRole, RIGHT_PROPERTYNAME) != 0) - { - bHaveMatch = 0; // FALSE - } - } - - if (bHaveMatch) - { - // do work here: - // create and return the appropriate association instance(s) - // - // loop, if necesssary - // do appropriate checks - - // the left cop was passed in - CMPIObjectPath *leftCop = cop; - - // get or create right side object path - CMPIObjectPath *rightCop = CMNewObjectPath(_broker, ns, RIGHT_CLASSNAME, &status); - // add keys - - - // create association instance - CMPIInstance *assocInst = omccmpiCreateAssociationInst(_broker, - ns, - ASSOC_CLASSNAME, - classKeys, - properties, - LEFT_PROPERTYNAME, - RIGHT_PROPERTYNAME, - leftCop, - rightCop, - &status); - // "handle" the association - omccmpiSimpleAssocResults(ctx, assocInst, &status); - } - } - else if(strcmp(objClassName, RIGHT_CLASSNAME) == 0) - { - // this is a RIGHT_CLASSNAME - // need to get approprate LEFT_CLASSNAME for ASSOC_CLASSNAME inst - // but if resultClass is set, it must match - - int bHaveMatch = 1; // TRUE - if ((resultClass != NULL) && (*resultClass != 0)) - { - // check - if (!omccmpiClassIsDerivedFrom(LEFT_CLASSNAME, - resultClass, - _broker,ns,&status)) - { - bHaveMatch = 0; // FALSE - } - } - - if ((resultRole != NULL) && (*resultRole != 0)) - { - // check - if (strcasecmp(resultRole, LEFT_PROPERTYNAME) != 0) - { - bHaveMatch = 0; // FALSE - } - } - - if (bHaveMatch) - { - // do work here: - // create and return the appropriate association instance(s) - // - // loop, if necesssary - // do appropriate checks - - // get or create left side object path - CMPIObjectPath *leftCop = CMNewObjectPath(_broker, ns, LEFT_CLASSNAME, &status); - // add keys - - // the right cop was passed in - CMPIObjectPath *rightCop = cop; - - - // create association instance - CMPIInstance *assocInst = omccmpiCreateAssociationInst(_broker, - ns, - ASSOC_CLASSNAME, - classKeys, - properties, - LEFT_PROPERTYNAME, - RIGHT_PROPERTYNAME, - leftCop, - rightCop, - &status); - // "handle" the association - omccmpiSimpleAssocResults(ctx, assocInst, &status); - } - } - else - { - DEBUGOUT("!!! Object type unknown: %s\n", objClassName); - } - } - //close return handler - CMReturnDone(results); - - DEBUGOUT("Leaving doReferences\n"); - return status; -} - - - -// **************************************************************************** -// AssocInit() - init -// params: CMPIAssociationMI* self: [in] Handle to this provider -// **************************************************************************** -static void AssocInit(CMPIAssociationMI * self) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; - - DEBUGOUT("AssocInit() called"); - - // do work here if necessary - - DEBUGOUT("Leaving AssocInit(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); -} - - - -// **************************************************************************** -// AssociationCleanup() - pre unload -// params: CMPIAssociationMI* self: [in] Handle to this provider -// CMPIContext* context: [in] any additional context info -// CMPIBoolean terminating -// **************************************************************************** -static CMPIStatus AssociationCleanup(CMPIAssociationMI* self, - const CMPIContext* context, - CMPIBoolean terminating) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; - - DEBUGOUT("AssociationCleanup() called"); - - // do work here if necessary - - DEBUGOUT("Leaving AssociationCleanup(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); - return status; -} - - -// **************************************************************************** -// Associators() -// params: CMPIAssociationMI* self: [in] Handle to this provider -// CMPIContext* context: [in] any additional context info -// CMPIResult* results: [out] Results -// CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath -// char *assocClass -// char *resultClass -// char *role -// char *resultRole -// char **properties -// **************************************************************************** -static CMPIStatus Associators( CMPIAssociationMI* self, - const CMPIContext* context, - const CMPIResult* results, - const CMPIObjectPath* cop, - const char *assocClass, - const char *resultClass, - const char *role, - const char *resultRole, - const char** properties) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; - - DEBUGOUT("Associators() called"); - - CMPIStatus status = omccmpiSimpleAssociators( doReferences, self, - _broker, context, results, cop, assocClass, - resultClass, role, resultRole, properties); - - DEBUGOUT("Leaving Associatiors(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); - return status; -} - - -// **************************************************************************** -// Associators() -// params: CMPIAssociationMI* self: [in] Handle to this provider -// CMPIContext* context: [in] any additional context info -// CMPIResult* results: [out] Results -// CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath -// char *assocClass -// char *resultClass -// char *role -// char *resultRole -// **************************************************************************** -static CMPIStatus AssociatorNames(CMPIAssociationMI* self, - const CMPIContext* context, - const CMPIResult* results, - const CMPIObjectPath* cop, - const char *assocClass, - const char *resultClass, - const char *role, - const char *resultRole) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; - - DEBUGOUT("AssociatorNames() called"); - - CMPIStatus status = omccmpiSimpleAssociatorNames( doReferences, self, - _broker, context, results, cop, assocClass, - resultClass, role, resultRole); - - DEBUGOUT("Leaving AssociatiorNames(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); - return status; -} - - -// **************************************************************************** -// References() -// params: CMPIAssociationMI* self: [in] Handle to this provider -// CMPIContext* context: [in] any additional context info -// CMPIResult* results: [out] Results -// CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath -// char *resultClass -// char *role -// char **properties -// **************************************************************************** -static CMPIStatus References( CMPIAssociationMI* self, - const CMPIContext* context, - const CMPIResult* results, - const CMPIObjectPath* cop, - const char *resultClass, - const char *role , - const char** properties) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; - - DEBUGOUT("References() called"); - - CMPIStatus status = omccmpiSimpleReferences( doReferences, self, - _broker, context, results, cop, NULL, - resultClass, role, NULL, properties); - - DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); - return status; -} - - -// **************************************************************************** -// ReferenceNames() -// params: CMPIAssociationMI* self: [in] Handle to this provider -// CMPIContext* context: [in] any additional context info -// CMPIResult* results: [out] Results -// CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath -// char *resultClass -// char *role -// **************************************************************************** -static CMPIStatus ReferenceNames(CMPIAssociationMI* self, - const CMPIContext* context, - const CMPIResult* results, - const CMPIObjectPath* cop, - const char* resultClass, - const char* role) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; - - DEBUGOUT("ReferenceNames() called"); - - CMPIStatus status = omccmpiSimpleReferenceNames( doReferences, self, - _broker, context, results, cop, NULL, - resultClass, role, NULL); - - DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); - return status; -} - - - - -// **************************************************************************** // CMPI METHOD PROVIDER FUNCTIONS // **************************************************************************** @@ -629,13 +615,11 @@ // **************************************************************************** static void MethodInit(CMPIMethodMI * self) { - CMPIStatus status = {CMPI_RC_OK, NULL}; + DEBUGOUT("MethodInitialize() called\n"); - DEBUGOUT("MethodInitialize() called"); - // do work here if necessary - DEBUGOUT("Leaving MethodInitialize(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving MethodInitialize(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); } @@ -651,11 +635,11 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("MethodCleanup() called"); + DEBUGOUT("MethodCleanup() called\n"); // do work here if necessary - DEBUGOUT("Leaving MethodCleanup(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving MethodCleanup(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } @@ -680,23 +664,23 @@ { CMPIStatus status = {CMPI_RC_OK, NULL}; - DEBUGOUT("InvokeMethod() called"); + DEBUGOUT("InvokeMethod() called\n"); // do work here - // CMPIString *class = NULL; - // class = CMGetClassName(ref, &status); - // if (strcasecmp(CMGetCharPtr(class), OMC_FooClass) == 0) && - // strcasecmp("MyMethodName", methodName == 0) - // {} + //CMPIString *class = NULL; + //class = CMGetClassName(ref, &status); + //if (strcasecmp(CMGetCharPtr(class), OMC_FooClass) == 0) && + // strcasecmp("MyMethodName", methodName == 0) + //{ + //} - - DEBUGOUT("Leaving InvokeMethod(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + DEBUGOUT("Leaving InvokeMethod(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } +*/ - // **************************************************************************** // SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE // **************************************************************************** @@ -714,9 +698,6 @@ If no additional init is required, specify "CMNoHook" */ -CMInstanceMIStub( , OMC_FooClass_Provider, _broker, Init(&mi)); -CMMethodMIStub( , OMC_FooClass_Provider, _broker, MethodInit(&mi)); -CMAssociationMIStub( , OMC_FooAssocClass_Provider, _broker, AssocInit(&mi)); +CMInstanceMIStub( , OMC_HostNameSettingData_Provider, _broker, Init(&mi)); +//CMMethodMIStub( , OMC_HostNameSettingData_Provider, _broker, MethodInit(&mi)); - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2007-02-09 01:31:14
|
Revision: 435 http://svn.sourceforge.net/omc/?rev=435&view=rev Author: bartw Date: 2007-02-08 17:31:11 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Added CIMPLE provider for subclasses of CIM_LogicalFile Modified Paths: -------------- cmpibase/trunk/configure.ac cmpibase/trunk/src/include/omc/Makefile.am cmpibase/trunk/src/lib/omc/Makefile.am cmpibase/trunk/src/providers/Makefile.am Added Paths: ----------- cmpibase/trunk/src/include/omc/fileTools.h cmpibase/trunk/src/lib/omc/fileTools.c cmpibase/trunk/src/providers/logical-file/ cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.cpp cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.h cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider_module.cpp cmpibase/trunk/src/providers/logical-file/FilesCommon.cpp cmpibase/trunk/src/providers/logical-file/FilesCommon.hpp cmpibase/trunk/src/providers/logical-file/Makefile.am cmpibase/trunk/src/providers/logical-file/OMC_LinuxDirectoryContainsFile_Provider.cpp cmpibase/trunk/src/providers/logical-file/OMC_LinuxDirectoryContainsFile_Provider.h cmpibase/trunk/src/providers/logical-file/OMC_LinuxDirectoryContainsFile_Provider_module.cpp cmpibase/trunk/src/providers/logical-file/OMC_LinuxFileIdentity_Provider.cpp cmpibase/trunk/src/providers/logical-file/OMC_LinuxFileIdentity_Provider.h cmpibase/trunk/src/providers/logical-file/OMC_LinuxFileIdentity_Provider_module.cpp cmpibase/trunk/src/providers/logical-file/OMC_LinuxFile_Provider.cpp cmpibase/trunk/src/providers/logical-file/OMC_LinuxFile_Provider.h cmpibase/trunk/src/providers/logical-file/OMC_LinuxFile_Provider_module.cpp cmpibase/trunk/src/providers/logical-file/schema/ cmpibase/trunk/src/providers/logical-file/schema/CIM_Component.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_Component.h cmpibase/trunk/src/providers/logical-file/schema/CIM_DataFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_DataFile.h cmpibase/trunk/src/providers/logical-file/schema/CIM_DeviceFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_DeviceFile.h cmpibase/trunk/src/providers/logical-file/schema/CIM_Directory.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_Directory.h cmpibase/trunk/src/providers/logical-file/schema/CIM_DirectoryContainsFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_DirectoryContainsFile.h cmpibase/trunk/src/providers/logical-file/schema/CIM_FIFOPipeFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_FIFOPipeFile.h cmpibase/trunk/src/providers/logical-file/schema/CIM_FileIdentity.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_FileIdentity.h cmpibase/trunk/src/providers/logical-file/schema/CIM_LogicalElement.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_LogicalElement.h cmpibase/trunk/src/providers/logical-file/schema/CIM_LogicalFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_LogicalFile.h cmpibase/trunk/src/providers/logical-file/schema/CIM_LogicalIdentity.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_LogicalIdentity.h cmpibase/trunk/src/providers/logical-file/schema/CIM_ManagedElement.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_ManagedElement.h cmpibase/trunk/src/providers/logical-file/schema/CIM_ManagedSystemElement.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_ManagedSystemElement.h cmpibase/trunk/src/providers/logical-file/schema/CIM_SymbolicLink.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_SymbolicLink.h cmpibase/trunk/src/providers/logical-file/schema/CIM_UnixDeviceFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_UnixDeviceFile.h cmpibase/trunk/src/providers/logical-file/schema/CIM_UnixDirectory.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_UnixDirectory.h cmpibase/trunk/src/providers/logical-file/schema/CIM_UnixFile.cpp cmpibase/trunk/src/providers/logical-file/schema/CIM_UnixFile.h cmpibase/trunk/src/providers/logical-file/schema/Makefile.am cmpibase/trunk/src/providers/logical-file/schema/OMC_DataFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_DataFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_DirectoryContainsFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_DirectoryContainsFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_FIFOPipeFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_FIFOPipeFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_FileIdentity.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_FileIdentity.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDataFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDataFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDeviceFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDeviceFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDirectory.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDirectory.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDirectoryContainsFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxDirectoryContainsFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxFIFOPipeFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxFIFOPipeFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxFileIdentity.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxFileIdentity.h cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxSymbolicLink.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_LinuxSymbolicLink.h cmpibase/trunk/src/providers/logical-file/schema/OMC_SymbolicLink.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_SymbolicLink.h cmpibase/trunk/src/providers/logical-file/schema/OMC_UnixDeviceFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_UnixDeviceFile.h cmpibase/trunk/src/providers/logical-file/schema/OMC_UnixDirectory.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_UnixDirectory.h cmpibase/trunk/src/providers/logical-file/schema/OMC_UnixFile.cpp cmpibase/trunk/src/providers/logical-file/schema/OMC_UnixFile.h cmpibase/trunk/src/providers/logical-file/schema/repository.cpp cmpibase/trunk/src/providers/logical-file/schema/repository.h Removed Paths: ------------- cmpibase/trunk/src/include/omc/Makefile.in cmpibase/trunk/src/providers/time-service/Makefile.in Property Changed: ---------------- cmpibase/trunk/ cmpibase/trunk/src/ cmpibase/trunk/src/include/ cmpibase/trunk/src/include/omc/ cmpibase/trunk/src/lib/ cmpibase/trunk/src/lib/omc/ cmpibase/trunk/src/providers/ cmpibase/trunk/src/providers/computer-system/ cmpibase/trunk/src/providers/operating-system/ cmpibase/trunk/src/providers/processes/ cmpibase/trunk/src/providers/time-service/ Property changes on: cmpibase/trunk ___________________________________________________________________ Name: svn:ignore - Makefile.in configure aclocal.m4 Makefile autom4te.cache config.guess config.log config.status config.sub config.h.in libtool ltmain.sh mybuild *.vpj config depcomp missing *.vpw *.vpwhistu *.vtg *.swp + stamp-h1 configure Makefile.in config.log depcomp config.guess config.h ltmain.sh config.sub Makefile omccmpi-*.tar.gz config.status config.h.in libtool autom4te.cache missing aclocal.m4 Modified: cmpibase/trunk/configure.ac =================================================================== --- cmpibase/trunk/configure.ac 2007-02-01 17:59:16 UTC (rev 434) +++ cmpibase/trunk/configure.ac 2007-02-09 01:31:11 UTC (rev 435) @@ -155,6 +155,15 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h sys/time.h openssl/evp.h sys/param.h sys/vfs.h],,[AC_MSG_ERROR(Missing headers: likely won't compile)]) +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS([cimple/cimple.h],[HAVE_CIMPLE="1"],[HAVE_CIMPLE="0"]) +AM_CONDITIONAL(DO_CIMPLE_PROVIDERS, test "$HAVE_CIMPLE" = 1) + +AC_CHECK_HEADERS([cimple/OpenWBEM_Adapter.h],[HAVE_CIMPLE_OW_ADAPTER="1"],[HAVE_CIMPLE_OW_ADAPTER="0"]) +AM_CONDITIONAL(USE_CIMPLE_OW_ADAPTER, test "$HAVE_CIMPLE_OW_ADAPTER" = 1) +AC_LANG_C + + # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST @@ -191,5 +200,7 @@ src/providers/computer-system/Makefile src/providers/operating-system/Makefile src/providers/time-service/Makefile + src/providers/logical-file/Makefile + src/providers/logical-file/schema/Makefile ]) AC_OUTPUT Property changes on: cmpibase/trunk/src ___________________________________________________________________ Name: svn:ignore - Makefile.in + Makefile Makefile.in Property changes on: cmpibase/trunk/src/include ___________________________________________________________________ Name: svn:ignore - Makefile.in + Makefile.in Makefile Property changes on: cmpibase/trunk/src/include/omc ___________________________________________________________________ Name: svn:ignore - Makefile.in + Makefile Makefile.in Modified: cmpibase/trunk/src/include/omc/Makefile.am =================================================================== --- cmpibase/trunk/src/include/omc/Makefile.am 2007-02-01 17:59:16 UTC (rev 434) +++ cmpibase/trunk/src/include/omc/Makefile.am 2007-02-09 01:31:11 UTC (rev 435) @@ -6,6 +6,7 @@ exec.h \ ioUtils.h \ modifyFile.h \ + fileTools.h \ string.h \ linuxProcUtils.h \ cmpiUtils.h \ Deleted: cmpibase/trunk/src/include/omc/Makefile.in =================================================================== --- cmpibase/trunk/src/include/omc/Makefile.in 2007-02-01 17:59:16 UTC (rev 434) +++ cmpibase/trunk/src/include/omc/Makefile.in 2007-02-09 01:31:11 UTC (rev 435) @@ -1,406 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/include/omc -DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgincludedir)" -pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(pkginclude_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -pkgincludedir = $(includedir)/omccmpi -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CP = @CP@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MV = @MV@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -RM = @RM@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -pkginclude_HEADERS = \ - base.h \ - exec.h \ - ioUtils.h \ - modifyFile.h \ - string.h \ - linuxProcUtils.h \ - cmpiUtils.h \ - cmpiSimpleAssoc.h \ - cmpiTimeServiceUtils.h \ - ntpServer.h - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/include/omc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/include/omc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-pkgincludeHEADERS: $(pkginclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(pkgincludedir)" || $(mkdir_p) "$(DESTDIR)$(pkgincludedir)" - @list='$(pkginclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ - $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ - done - -uninstall-pkgincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(pkginclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(pkgincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgincludeHEADERS - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgincludeHEADERS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pkgincludeHEADERS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: Added: cmpibase/trunk/src/include/omc/fileTools.h =================================================================== --- cmpibase/trunk/src/include/omc/fileTools.h (rev 0) +++ cmpibase/trunk/src/include/omc/fileTools.h 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,104 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +******************************************************************************/ + + +#ifndef OMCFILETOOLS_H_GUARD__ +#define OMCFILETOOLS_H_GUARD__ + +#ifdef __cplusplus +extern "C" { +#endif + +struct stat; + +/** + * Return the name of the directory containing the file (or + * directory) referenced by path. + * + * @param path The path + * + * @return The directory containing the file. The caller is + * responsible to free the buffer returned. + */ +char* omc_dirname(const char* path); + +/** + * Struct containing the six keys of CIM file classes. + * (CIM_LogicalFile and children) + */ +typedef struct omcFileKeys_ +{ + char * CSCreationClassName; + char * CSName; + char * CreationClassName; + char * FSCreationClassName; + char * FSName; + char * Name; +} omcFileKeys; + +/** + * Free a omcFileKeys structure and the pointers contained + * therein. + * + * @param fk pointer to the omcFileKeys structure to be freed. + */ +void omcFileKeys_free(omcFileKeys* fk); + +/** + * Determine the keys for the CIM instance representing a given + * file. + * @param path The full path to the file + * + * @return A pointer to an omcFileKeys structure. The caller is + * responsible to free this with a call to + * omcFileKeys_free(). + */ +omcFileKeys* omcGetKeysForFile(const char* path); + +/** + * Determine the keys for the CIM instance representing a given + * file. Use this version if you already have a stat for the + * file and wish to avoid an aditional stat. + * + * @param path The full path to the file + * @param st A stat structure for the file obtained from stat() + * + * @return A pointer to an omcFileKeys structure. The caller is + * responsible to free this with a call to + * omcFileKeys_free(). + */ +omcFileKeys* omcGetKeysForFileStat(const char* path, struct stat* st); + +#ifdef __cplusplus +} +#endif + +#endif Property changes on: cmpibase/trunk/src/lib ___________________________________________________________________ Name: svn:ignore - Makefile.in + Makefile Makefile.in Property changes on: cmpibase/trunk/src/lib/omc ___________________________________________________________________ Name: svn:ignore - Makefile.in + .deps .libs Makefile.in Makefile Modified: cmpibase/trunk/src/lib/omc/Makefile.am =================================================================== --- cmpibase/trunk/src/lib/omc/Makefile.am 2007-02-01 17:59:16 UTC (rev 434) +++ cmpibase/trunk/src/lib/omc/Makefile.am 2007-02-09 01:31:11 UTC (rev 435) @@ -15,6 +15,7 @@ exec.c \ ioUtils.c \ modifyFile.c \ +fileTools.c \ string.c \ linuxProcUtils.c \ ntpServer.c Added: cmpibase/trunk/src/lib/omc/fileTools.c =================================================================== --- cmpibase/trunk/src/lib/omc/fileTools.c (rev 0) +++ cmpibase/trunk/src/lib/omc/fileTools.c 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,201 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +******************************************************************************/ + + +#include "omc/fileTools.h" +//#include "omccmpi/string.h" +//#include "omccmpi/ioUtils.h" +//#include "string.h" +//#include "ioUtils.h" +#include <libgen.h> +#include "omc/string.h" +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <stdlib.h> +#include <stdio.h> + +char* omc_dirname(const char* path) +{ + char* tmp = strdup(path); + char* rv = dirname(tmp); + if (rv == NULL) + { + free(tmp); + } + return rv; +} + +void omcFileKeys_free(omcFileKeys* fk) +{ + if (fk == NULL) + { + return; + } + //free(fk->CSCreationClassName); // not malloc'd + free(fk->CSName); + //free(fk->CreationClassName); // not malloc'd + free(fk->FSCreationClassName); + free(fk->FSName); + free(fk->Name); + free(fk); +} + +omcFileKeys* omcGetKeysForFile(const char* path) +{ + struct stat st; + if (lstat(path, &st) != 0) + { + return NULL; + } + return omcGetKeysForFileStat(path, &st); +} + +omcFileKeys* omcGetKeysForFileStat(const char* path, struct stat* st) +{ + omcFileKeys* rv = (omcFileKeys*)malloc(sizeof(omcFileKeys)); + memset(rv, 0, sizeof(omcFileKeys)); + if (S_ISREG(st->st_mode)) + { + rv->CreationClassName = "OMC_LinuxDataFile"; + } else if (S_ISDIR(st->st_mode)) + { + rv->CreationClassName = "OMC_LinuxDirectory"; + } else if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) + { + rv->CreationClassName = "OMC_LinuxDeviceFile"; + } else if (S_ISFIFO(st->st_mode)) + { + rv->CreationClassName = "OMC_LinuxFIFOPipeFile"; + } else if (S_ISLNK(st->st_mode)) + { + rv->CreationClassName = "OMC_LinuxSymbolicLink"; + } else + { + free(rv); + return NULL; + } + rv->Name = strdup(path); + rv->CSCreationClassName = "OMC_LinuxUnitaryComputerSystem"; + rv->CSName = (char*)malloc(256); + gethostname(rv->CSName, 256); + FILE* mounts = fopen("/proc/mounts", "r"); + if (mounts == NULL) + { + omcFileKeys_free(rv); + return NULL; + } + char* line = NULL; + char* p = NULL; + size_t bfrLen = 0; + for(p = omcReadLine(mounts, &line,&bfrLen); p; p = omcReadLine(mounts, &line,&bfrLen )) + { + int count = omcStrTokenCount(line, " \t\r\n"); + if (count != 6) + { + continue; + } + size_t numElems = 0; + char** strs = omcStrTokenize(line, " \t\r\n", &numElems); + if (strs == NULL) + { + continue; + } + if (strs[1][0] != '/') + { + free(strs); + continue; + } + if (strs[1][1] == 0 && strcmp(strs[0], "rootfs") == 0) + { + /* skip rootfs junk */ + free(strs); + continue; + } + struct stat dst; + if (stat(strs[1], &dst) != 0) + { + free(strs); + continue; + } + if (st->st_dev == dst.st_dev) + { + rv->FSName = strdup(strs[0]); + char* fstype = strs[2]; + if (strcmp(fstype, "ext2") == 0) + { + rv->FSCreationClassName = strdup("OMC_LinuxExt2FileSystem"); + } else if (strcmp(fstype, "ext3") == 0) + { + rv->FSCreationClassName = strdup("OMC_LinuxExt3FileSystem"); + } else if (strcmp(fstype, "reiserfs") == 0) + { + rv->FSCreationClassName = strdup("OMC_LinuxReiserFileSystem"); + } else if (strcmp(fstype, "nfs") == 0) + { + rv->FSCreationClassName = strdup("OMC_LinuxNFS"); + } else if (strcmp(fstype, "cifs") == 0) + { + rv->FSCreationClassName = strdup("OMC_LinuxCIFS"); /* TODO CIM class doesn't exist yet */ + } + else + { + int len = snprintf(NULL, 0, "Unknown:%s", fstype); + if (len > 0) + { + rv->FSCreationClassName = (char*)malloc(len + 1); + snprintf(rv->FSCreationClassName, len+1, "Unknown:%s", fstype); + } + else + { + rv->FSCreationClassName = strdup("Unknown"); + } + } + } + free(strs); + if (rv->FSName != NULL) + { + break; + } + } + if (line) + { + free(line); + } + fclose(mounts); + return rv; + +} + Property changes on: cmpibase/trunk/src/providers ___________________________________________________________________ Name: svn:ignore - Makefile.in + Makefile.in Makefile Modified: cmpibase/trunk/src/providers/Makefile.am =================================================================== --- cmpibase/trunk/src/providers/Makefile.am 2007-02-01 17:59:16 UTC (rev 434) +++ cmpibase/trunk/src/providers/Makefile.am 2007-02-09 01:31:11 UTC (rev 435) @@ -6,3 +6,7 @@ operating-system \ time-service +if DO_CIMPLE_PROVIDERS +SUBDIRS += logical-file +endif + Property changes on: cmpibase/trunk/src/providers/computer-system ___________________________________________________________________ Name: svn:ignore - Makefile.in + .deps .libs Makefile.in Makefile Property changes on: cmpibase/trunk/src/providers/logical-file ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile.in Makefile Added: cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.cpp =================================================================== --- cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.cpp (rev 0) +++ cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.cpp 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,140 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +******************************************************************************/ + +#include "CIM_LogicalFile_Provider.h" +#include "OMC_LinuxDirectoryContainsFile.h" +#include "omc/fileTools.h" +#include "FilesCommon.hpp" +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +CIMPLE_NAMESPACE_BEGIN + +CIM_LogicalFile_Provider::CIM_LogicalFile_Provider() +{ +} + +CIM_LogicalFile_Provider::~CIM_LogicalFile_Provider() +{ +} + +Load_Status CIM_LogicalFile_Provider::load() +{ + return LOAD_OK; +} + +Unload_Status CIM_LogicalFile_Provider::unload() +{ + return UNLOAD_OK; +} + +Get_Instance_Status CIM_LogicalFile_Provider::get_instance( + const CIM_LogicalFile* model, + CIM_LogicalFile*& instance) +{ + instance = getFile(model->Name.value.c_str()); + return GET_INSTANCE_OK; +} + +Enum_Instances_Status CIM_LogicalFile_Provider::enum_instances( + const CIM_LogicalFile* model, + Enum_Instances_Handler<CIM_LogicalFile>* handler) +{ + if (eqi(model->meta_class->name, "OMC_LinuxDirectory")) + { + struct stat st; + if (lstat("/", &st) != 0) + { + return ENUM_INSTANCES_FAILED; + } + omcFileKeys* keys = omcGetKeysForFileStat("/", &st); + if (keys == NULL) + { + return ENUM_INSTANCES_FAILED; + } + OMC_LinuxDirectory* dir = OMC_LinuxDirectory::create(); + if (dir == NULL) + { + return ENUM_INSTANCES_FAILED; + } + dir->CreationClassName.value = keys->CreationClassName; + dir->CSCreationClassName.value = keys->CSCreationClassName; + dir->CSName.value = keys->CSName; + dir->Name.value = keys->Name; + dir->FSName.value = keys->FSName; + dir->FSCreationClassName.value = keys->FSCreationClassName; + omcFileKeys_free(keys); + handler->handle(cast<CIM_LogicalFile*>(dir)); + } + return ENUM_INSTANCES_OK; +} + +Create_Instance_Status CIM_LogicalFile_Provider::create_instance( + const CIM_LogicalFile* instance) +{ + return CREATE_INSTANCE_UNSUPPORTED; +} + +Delete_Instance_Status CIM_LogicalFile_Provider::delete_instance( + const CIM_LogicalFile* instance) +{ + return DELETE_INSTANCE_UNSUPPORTED; +} + +Modify_Instance_Status CIM_LogicalFile_Provider::modify_instance( + const CIM_LogicalFile* instance) +{ + return MODIFY_INSTANCE_UNSUPPORTED; +} + +int CIM_LogicalFile_Provider::proc( + const Registration* registration, + int operation, + void* arg0, + void* arg1, + void* arg2, + void* arg3, + void* arg4, + void* arg5, + void* arg6, + void* arg7) +{ + // CAUTION: PLEASE DO NOT MODIFY THIS FUNCTION; IT WAS AUTOMATICALLY + // GENERATED. + + typedef CIM_LogicalFile Class; + typedef CIM_LogicalFile_Provider Provider; + return Provider_Proc_T<Provider>::proc(registration, + operation, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +} + +CIMPLE_NAMESPACE_END Added: cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.h =================================================================== --- cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.h (rev 0) +++ cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.h 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,55 @@ +#ifndef _CIM_LogicalFile_Provider_h +#define _CIM_LogicalFile_Provider_h + +#include <cimple/cimple.h> +#include "CIM_LogicalFile.h" + +CIMPLE_NAMESPACE_BEGIN + +class CIM_LogicalFile_Provider +{ +public: + + typedef CIM_LogicalFile Class; + + CIM_LogicalFile_Provider(); + + ~CIM_LogicalFile_Provider(); + + Load_Status load(); + + Unload_Status unload(); + + Get_Instance_Status get_instance( + const CIM_LogicalFile* model, + CIM_LogicalFile*& instance); + + Enum_Instances_Status enum_instances( + const CIM_LogicalFile* model, + Enum_Instances_Handler<CIM_LogicalFile>* handler); + + Create_Instance_Status create_instance( + const CIM_LogicalFile* instance); + + Delete_Instance_Status delete_instance( + const CIM_LogicalFile* instance); + + Modify_Instance_Status modify_instance( + const CIM_LogicalFile* instance); + + static int proc( + const Registration* registration, + int operation, + void* arg0, + void* arg1, + void* arg2, + void* arg3, + void* arg4, + void* arg5, + void* arg6, + void* arg7); +}; + +CIMPLE_NAMESPACE_END + +#endif /* _CIM_LogicalFile_Provider_h */ Added: cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider_module.cpp =================================================================== --- cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider_module.cpp (rev 0) +++ cmpibase/trunk/src/providers/logical-file/CIM_LogicalFile_Provider_module.cpp 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,16 @@ + +#include "config.h" +#include "CIM_LogicalFile_Provider.h" + +using namespace cimple; + +CIMPLE_MODULE(CIM_LogicalFile_Module); + +CIMPLE_PROVIDER(CIM_LogicalFile_Provider); +CIMPLE_CMPI_INSTANCE_PROVIDER(CIM_LogicalFile_Provider); + +#ifdef HAVE_CIMPLE_OPENWBEM_ADAPTER_H + #include <cimple/OpenWBEM_Adapter.h> + CIMPLE_OPENWBEM_PROVIDER(CIM_LogicalFile_Provider); +#endif + Added: cmpibase/trunk/src/providers/logical-file/FilesCommon.cpp =================================================================== --- cmpibase/trunk/src/providers/logical-file/FilesCommon.cpp (rev 0) +++ cmpibase/trunk/src/providers/logical-file/FilesCommon.cpp 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,226 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +******************************************************************************/ + +#include "OMC_LinuxDirectory.h" +#include "OMC_LinuxDeviceFile.h" +#include "OMC_LinuxDataFile.h" +#include "OMC_LinuxFIFOPipeFile.h" +#include "OMC_LinuxSymbolicLink.h" +#include "OMC_LinuxFile.h" +#include "FilesCommon.hpp" +#include "omc/fileTools.h" + +#include <dirent.h> +#include <sys/param.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <sys/param.h> +#include <unistd.h> +#include <grp.h> +#include <pwd.h> + + +CIMPLE_NAMESPACE_BEGIN + + +static +cimple::String _getGroupFromGID(gid_t gid) +{ + String rval; + char buf[PWENT_GRPENT_BUF_SIZE]; + struct group gr; + struct group* pgr; + int rv = getgrgid_r(gid, &gr, buf, PWENT_GRPENT_BUF_SIZE, &pgr); + if (rv == 0 && pgr) + { + rval = gr.gr_name; + } else + { + snprintf(buf, sizeof(buf), "%d", gid); + rval = buf; + } + return rval; +} + +static +cimple::String _getNameFromUID(uid_t uid) +{ + String rval; + char buf[PWENT_GRPENT_BUF_SIZE]; + struct passwd pw; + struct passwd* ppw = 0; + int rv = getpwuid_r(uid, &pw, buf, PWENT_GRPENT_BUF_SIZE, &ppw); + if (rv == 0 && ppw) + { + //rval = strdup(pw.pw_name); + rval = pw.pw_name; + } else + { + snprintf(buf,sizeof(buf),"%d", uid); + rval = buf; + } + return rval; +} + +OMC_LinuxFile* getLinuxFile(const char* path) +{ + struct stat st; + if (stat(path, &st) != 0) + { + return 0; + } + omcFileKeys* keys = omcGetKeysForFileStat(path, &st); + if (!keys) + { + return 0; + } + + OMC_LinuxFile* instance = OMC_LinuxFile::create(); + instance->LFName.value = keys->Name; + instance->FSCreationClassName.value = keys->FSCreationClassName; + instance->FSName.value = keys->FSName; + instance->LFCreationClassName.value = keys->CreationClassName; + instance->CSCreationClassName.value = keys->CSCreationClassName; + instance->CSName.value = keys->CSName; + omcFileKeys_free(keys); + instance->UserReadable.value = st.st_mode & S_IRUSR; + instance->UserWritable.value = st.st_mode & S_IWUSR; + instance->UserExecutable.value = st.st_mode & S_IXUSR; + instance->GroupReadable.value = st.st_mode & S_IRGRP; + instance->GroupWritable.value = st.st_mode & S_IWGRP; + instance->GroupExecutable.value = st.st_mode & S_IXGRP; + instance->WorldReadable.value = st.st_mode & S_IROTH; + instance->WorldWritable.value = st.st_mode & S_IWOTH; + instance->WorldExecutable.value = st.st_mode & S_IXOTH; + instance->UserID.value = _getNameFromUID(st.st_uid); + instance->GroupID.value = _getGroupFromGID(st.st_gid); + instance->SaveText.value = st.st_mode & S_ISVTX; + instance->LinkCount.value = st.st_nlink; + char buf[256]; + snprintf(buf, 255, "%lld", uint64(st.st_ino)); + instance->FileInodeNumber.value = buf; + instance->SetUid.value = st.st_mode & S_ISUID; + instance->SetGid.value = st.st_mode & S_ISGID; + instance->LastModifiedInode.value = Datetime(uint64(st.st_mtime)*1000000L, 0); + instance->NameMax.value = MAXNAMLEN; + instance->PathMax.value = MAXPATHLEN; + return instance; +} + +CIM_LogicalFile* getFile(const char* path) +{ + struct stat st; + if (lstat(path, &st) != 0) + { + return NULL; + } + omcFileKeys* keys = omcGetKeysForFileStat(path, &st); + if (keys == NULL) + { + return NULL; + } + + CIM_LogicalFile* rval = NULL; + if (S_ISREG(st.st_mode)) + { + OMC_LinuxDataFile* df = OMC_LinuxDataFile::create(); + rval = cast<CIM_LogicalFile*>(df); + } else if (S_ISDIR(st.st_mode)) + { + OMC_LinuxDirectory* dir = OMC_LinuxDirectory::create(); + //dir->FileSizeBits.value = ; + rval = cast<CIM_LogicalFile*>(dir); + } else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) + { + OMC_LinuxDeviceFile* dev = OMC_LinuxDeviceFile::create(); + if (S_ISCHR(st.st_mode)) + { + dev->DeviceFileType.value = dev->DeviceFileType.enum_Character; + } + else + { + dev->DeviceFileType.value = dev->DeviceFileType.enum_Block; + } + //dev->DeviceDescription.value = ; + //dev->DeviceMinor.value = ; + //dev->DeviceMajor.value = ; + //dev->DeviceId.value = ; + //dev->OtherTypeDescription.value = ; + rval = cast<CIM_LogicalFile*>(dev); + } else if (S_ISFIFO(st.st_mode)) + { + OMC_LinuxFIFOPipeFile* fifo = OMC_LinuxFIFOPipeFile::create(); + rval = cast<CIM_LogicalFile*>(fifo); + } else if (S_ISLNK(st.st_mode)) + { + OMC_LinuxSymbolicLink* link = OMC_LinuxSymbolicLink::create(); + char buf[MAXPATHLEN]; + int rrdlnk = readlink(keys->Name, buf, MAXPATHLEN); + if (rrdlnk != -1) + { + link->TargetFile.value = buf; + } + rval = cast<CIM_LogicalFile*>(link); + } else + { + return NULL; + } + rval->Name.value = keys->Name; + rval->CreationClassName.value = keys->CreationClassName; + rval->FSName.value = keys->FSName; + rval->FSCreationClassName.value = keys->FSCreationClassName; + rval->CSName.value = keys->CSName; + rval->CSCreationClassName.value = keys->CSCreationClassName; + omcFileKeys_free(keys); + + rval->Writeable.value = st.st_mode & S_IWUSR; + rval->Executable.value = st.st_mode & S_IXUSR; + rval->Readable.value = st.st_mode & S_IRUSR; + rval->FileSize.value = st.st_size; + //rval->CompressionMethod.value = ; + rval->LastModified.value = Datetime(uint64(st.st_mtime)*1000000L, 0); + //rval->InUseCount.value = ; + //rval->EncryptionMethod.value = ; + rval->LastAccessed.value = Datetime(uint64(st.st_atime)*1000000L, 0); + //rval->HealthState.value = ; + //rval->StatusDescriptions.value = ; + //rval->OperationalStatus.value = ; + //rval->Description.value = ; + rval->InstallDate.value = Datetime(uint64(st.st_ctime)*1000000L, 0); + + rval->ElementName.value = rval->Name.value; + //rval->Caption.value = ; + + return rval; +} + +CIMPLE_NAMESPACE_END + Added: cmpibase/trunk/src/providers/logical-file/FilesCommon.hpp =================================================================== --- cmpibase/trunk/src/providers/logical-file/FilesCommon.hpp (rev 0) +++ cmpibase/trunk/src/providers/logical-file/FilesCommon.hpp 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,16 @@ +#ifndef OMC_FilesCommon_hpp_include_guard__ +#define OMC_FilesCommon_hpp_include_guard__ + +#include "CIM_LogicalFile.h" +#include "OMC_LinuxFile.h" + +CIMPLE_NAMESPACE_BEGIN + +#define PWENT_GRPENT_BUF_SIZE 1024 + +CIM_LogicalFile* getFile(const char* path); +OMC_LinuxFile* getLinuxFile(const char* path); + +CIMPLE_NAMESPACE_END + +#endif // #ifndef OMC_FilesCommon_hpp_include_guard__ Added: cmpibase/trunk/src/providers/logical-file/Makefile.am =================================================================== --- cmpibase/trunk/src/providers/logical-file/Makefile.am (rev 0) +++ cmpibase/trunk/src/providers/logical-file/Makefile.am 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,76 @@ +SUBDIRS = schema + +lib_LTLIBRARIES = libOMC_FilesCommon.la + +provider_LTLIBRARIES = \ + libCIM_LogicalFile_Provider.la \ + libOMC_LinuxDirectoryContainsFile_Provider.la \ + libOMC_LinuxFileIdentity_Provider.la \ + libOMC_LinuxFile_Provider.la + +providerdir = ${libdir}/cmpi + +CIMPLE_ADAPTERS = -lcimplecmpiadap +if USE_CIMPLE_OW_ADAPTER + CIMPLE_ADAPTERS += -lcimpleowadap +endif + +libCIM_LogicalFile_Provider_la_LIBADD = \ + libOMC_FilesCommon.la \ + ${CIMPLE_ADAPTERS} \ + schema/libOMC_File_Schema.la +libOMC_LinuxFile_Provider_la_LIBADD = \ + libOMC_FilesCommon.la \ + ${CIMPLE_ADAPTERS} \ + schema/libOMC_File_Schema.la +libOMC_LinuxFileIdentity_Provider_la_LIBADD = \ + libOMC_FilesCommon.la \ + ${CIMPLE_ADAPTERS} \ + schema/libOMC_File_Schema.la +libOMC_LinuxDirectoryContainsFile_Provider_la_LIBADD = \ + libOMC_FilesCommon.la \ + ${CIMPLE_ADAPTERS} \ + schema/libOMC_File_Schema.la + +libOMC_FilesCommon_la_LIBADD = \ + schema/libOMC_File_Schema.la \ + ${top_builddir}/src/lib/omc/libomc_cbase.la + + +INCLUDES = -I${srcdir}/schema -I${top_srcdir}/src/include -I${top_srcdir} + +libOMC_FilesCommon_la_SOURCES = \ +FilesCommon.cpp \ +FilesCommon.hpp + +libOMC_LinuxFile_Provider_la_SOURCES = \ +OMC_LinuxFile_Provider.cpp \ +OMC_LinuxFile_Provider.h \ +OMC_LinuxFile_Provider_module.cpp + +libOMC_LinuxDirectoryContainsFile_Provider_la_SOURCES = \ +OMC_LinuxDirectoryContainsFile_Provider.cpp \ +OMC_LinuxDirectoryContainsFile_Provider.h \ +OMC_LinuxDirectoryContainsFile_Provider_module.cpp + +libOMC_LinuxFileIdentity_Provider_la_SOURCES = \ +OMC_LinuxFileIdentity_Provider.cpp \ +OMC_LinuxFileIdentity_Provider.h \ +OMC_LinuxFileIdentity_Provider_module.cpp + +libCIM_LogicalFile_Provider_la_SOURCES = \ +CIM_LogicalFile_Provider.cpp \ +CIM_LogicalFile_Provider.h \ +CIM_LogicalFile_Provider_module.cpp + +stubs : classes + export CIMPLE_MOF_PATH=/usr/share/mof/cim-current && \ + genprov -M omc-logical-file.mof -m CIM_LogicalFile && \ + mv module.cpp CIM_LogicalFile_Provider_module.cpp && \ + genprov -M omc-logical-file.mof -m OMC_LinuxDirectoryContainsFile && \ + mv module.cpp OMC_LinuxDirectoryContainsFile_Provider_module.cpp && \ + genprov -M omc-logical-file.mof -m OMC_LinuxFileIdentity && \ + mv module.cpp OMC_LinuxFileIdentity_Provider_module.cpp && \ + genprov -M omc-logical-file.mof -m OMC_LinuxFile && \ + mv module.cpp OMC_LinuxFile_Provider_module.cpp + Added: cmpibase/trunk/src/providers/logical-file/OMC_LinuxDirectoryContainsFile_Provider.cpp =================================================================== --- cmpibase/trunk/src/providers/logical-file/OMC_LinuxDirectoryContainsFile_Provider.cpp (rev 0) +++ cmpibase/trunk/src/providers/logical-file/OMC_LinuxDirectoryContainsFile_Provider.cpp 2007-02-09 01:31:11 UTC (rev 435) @@ -0,0 +1,256 @@ +/******************************************************************************* +* Copyright (C) 2005, 2006 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +******************************************************************************/ +#include "OMC_LinuxDirectoryContainsFile_Provider.h" +#include "OMC_LinuxDirectory.h" +#include "CIM_LogicalFile.h" +#include "omc/fileTools.h" +#include "FilesCommon.hpp" +#include <sys/types.h> +#include <dirent.h> + +CIMPLE_NAMESPACE_BEGIN + +#if 0 +# define TRACE CIMPLE_TRACE +#else +# define TRACE +#endif + +OMC_LinuxDirectoryContainsFile_Provider::OMC_LinuxDirectoryContainsFile_Provider() +{ +} + +OMC_LinuxDirectoryContainsFile_Provider::~OMC_LinuxDirectoryContainsFile_Provider() +{ +} + +Load_Status OMC_LinuxDirectoryContainsFile_Provider::load() +{ + return LOAD_OK; +} + +Unload_Status OMC_LinuxDirectoryContainsFile_Provider::unload() +{ + return UNLOAD_OK; +} + +Get_Instance_Status OMC_LinuxDirectoryContainsFile_Provider::get_instance( + const OMC_LinuxDirectoryContainsFile* model, + OMC_LinuxDirectoryContainsFile*& instance) +{ + instance = model->clone(); + return GET_INSTANCE_OK; +} + +Enum_Instances_Status OMC_LinuxDirectoryContainsFile_Provider::enum_instances( + const OMC_LinuxDirectoryContainsFile* model, + Enum_Instances_Handler<OMC_LinuxDirectoryContainsFile>* handler) +{ + return ENUM_INSTANCES_OK; +} + +Create_Instance_Status OMC_LinuxDirectoryContainsFile_Provider::create_instance( + const OMC_LinuxDirectoryContainsFile* instance) +{ + return CREATE_INSTANCE_UNSUPPORTED; +} + +Delete_Instance_Status OMC_LinuxDirectoryContainsFile_Provider::delete_instance( + const OMC_LinuxDirectoryContainsFile* instance) +{ + return DELETE_INSTANCE_UNSUPPORTED; +} + +Modify_Instance_Status OMC_LinuxDirectoryContainsFile_Provider::modify_instance( + const OMC_LinuxDirectoryContainsFile* instance) +{ + return MODIFY_INSTANCE_UNSUPPORTED; +} + +Enum_Associator_Names_Status OMC_LinuxDirectoryContainsFile_Provider::enum_associator_names( + const Instance* instance, + const String& result_class, + const String& role, + const String& result_role, + Enum_Associator_Names_Handler<Instance>* handler) +{ + if (eqi(role, "PartComponent") + || eqi(result_role, "GroupComponent") + || (role.empty() && result_role.empty())) + { + TRACE; + CIM_LogicalFile* clf = cast<CIM_LogicalFile*>(instance); + char* parentPath = omc_dirname(clf->Name.value.c_str()); + CIM_LogicalFile* parentc = getFile(parentPath); + free(parentPath); + OMC_LinuxDirectory* parent = cast<OMC_LinuxDirectory*>(parentc); + handler->handle(parent); + } + if (eqi(role, "GroupComponent") + || eqi(result_role, "PartComponent") + || (role.empty() && result_role.empty())) + { + TRACE; + CIM_LogicalFile* dirc = cast<CIM_LogicalFile*>(instance); + TRACE; + dirc = getFile(dirc->Name.value.c_str()); + Ref<Instance> dirc_d(dirc); + TRACE; + if (eqi(dirc->CreationClassName.value, "OMC_LinuxDirectory")) + { + struct dirent* pDent; + DIR* pDir; + pDir = opendir(dirc->Name.value.c_str()); + if (pDir != 0) + { + String prefix = dirc->Name.value; + TRACE; + if (prefix[prefix.size()-1] != '/') + { + TRACE; + prefix.append('/'); + } + TRACE; + for (pDent = readdir(pDir); pDent != 0; pDent = readdir(pDir)) + { + String curName = pDent->d_name; + if (curName.equal(".") or curName.equal("..")) + { + continue; + } + String fullName = prefix; + fullName.append(curName); + CIM_LogicalFile* fileInDir = getFile(fullName.c_str()); + if (fileInDir) + { + TRACE; + handler->handle(fileInDir); + } + } + } + closedir(pDir); + } + } + return ENUM_ASSOCIATOR_NAMES_OK; +} + +Enum_References_Status OMC_LinuxDirectoryContainsFile_Provider::enum_references( + const Instance* instance, + const OMC_LinuxDirectoryContainsFile* model, + const String& role, + Enum_References_Handler<OMC_LinuxDirectoryContainsFile>* handler) +{ + TRACE; + if (eqi(role, "PartComponent") || role.empty()) + { + TRACE; + CIM_LogicalFile* clf = cast<CIM_LogicalFile*>(instance); + char* parentPath = omc_dirname(clf->Name.value.c_str()); + CIM_LogicalFile* parentc = getFile(parentPath); + free(parentPath); + OMC_LinuxDirectory* parent = cast<OMC_LinuxDirectory*>(parentc); + OMC_LinuxDirectoryContainsFile* assoc = OMC_LinuxDirectoryContainsFile::create(); + assoc->PartComponent = clf->clone(); + assoc->GroupComponent = parent; + handler->handle(assoc); + } + if (eqi(role, "GroupComponent") || role.empty()) + { + TRACE; + CIM_LogicalFile* dirc = cast<CIM_LogicalFile*>(instance); + TRACE; + dirc = getFile(dirc->Name.value.c_str()); + Ref<Instance> dirc_d(dirc); + TRACE; + if (eqi(dirc->CreationClassName.value, "OMC_LinuxDirectory")) + { + struct dirent* pDent; + DIR* pDir; + pDir = opendir(dirc->Name.value.c_str()); + if (pDir != 0) + { + String prefix = dirc->Name.value; + TRACE; + if (prefix[prefix.size()-1] != '/') + { + TRACE; + prefix.append('/'); + } + TRACE; + for (pDent = readdir(pDir); pDent != 0; pDent = readdir(pDir)) + { + String curName = pDent->d_name; + if (curName.equal(".") or curName.equal("..")) + { + continue; + } + String fullName = prefix; + fullName.append(curName); + CIM_LogicalFile* fileInDir = getFile(fullName.c_str()); + if (fileInDir) + { + TRACE; + OMC_LinuxDirectoryContainsFile* assoc = OMC_LinuxDirectoryContainsFile::create(); + OMC_LinuxDirectory* old = cast<OMC_LinuxDirectory*>(dirc); + assoc->GroupComponent = old->clone(); + assoc->PartComponent = fileInDir; + handler->handle(assoc); + } + } + } + closedir(pDir); + } + } + return ENUM_REFERENCES_OK; +} + +int OMC_LinuxDirectoryContainsFile_Provider::proc( + const Registration* registration, + int operation, + void* arg0, + void* arg1, + void* arg2, + void* arg3, + void* arg4, + void* arg5, + void* arg6, + void* arg7) +{ + // CAUTION: PLEASE DO NOT MODIFY THIS FUNCTION; IT WAS AUTOMATICALLY + // GENERATED. + + typedef OMC_LinuxDirectoryContainsFile Class; + typedef OMC_LinuxDirectoryContainsFile_Provider Provider; + return Association_Provider_Proc_T<Provider>::proc(registration, + operation, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +} + +CIMPLE_NAMESPACE_END Added... [truncated message content] |
From: <ba...@us...> - 2007-03-28 00:31:07
|
Revision: 449 http://svn.sourceforge.net/omc/?rev=449&view=rev Author: bartw Date: 2007-03-27 17:31:08 -0700 (Tue, 27 Mar 2007) Log Message: ----------- fixed the build Modified Paths: -------------- cmpibase/trunk/configure.ac cmpibase/trunk/src/providers/computer-system/Makefile.am Modified: cmpibase/trunk/configure.ac =================================================================== --- cmpibase/trunk/configure.ac 2007-03-28 00:30:21 UTC (rev 448) +++ cmpibase/trunk/configure.ac 2007-03-28 00:31:08 UTC (rev 449) @@ -191,10 +191,6 @@ AC_CONFIG_FILES([Makefile src/Makefile - src/lib/Makefile - src/lib/omc/Makefile - src/include/Makefile - src/include/omc/Makefile src/providers/Makefile src/providers/processes/Makefile src/providers/computer-system/Makefile Modified: cmpibase/trunk/src/providers/computer-system/Makefile.am =================================================================== --- cmpibase/trunk/src/providers/computer-system/Makefile.am 2007-03-28 00:30:21 UTC (rev 448) +++ cmpibase/trunk/src/providers/computer-system/Makefile.am 2007-03-28 00:31:08 UTC (rev 449) @@ -15,13 +15,12 @@ -version-info 1 -libomccmpi_hostnamesettingdata_la_LIBADD = \ - $(top_builddir)/src/lib/omc/libomc_cmpi.la libomccmpi_hostnamesettingdata_la_SOURCES = \ hostNameSettingData.c libomccmpi_hostnamesettingdata_la_LDFLAGS = \ + -lomc_cmpi \ -lpthread \ -version-info 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-04-22 22:00:18
|
Revision: 573 http://omc.svn.sourceforge.net/omc/?rev=573&view=rev Author: jcarey Date: 2008-04-22 15:00:14 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Mof and peg provider reg files Added Paths: ----------- cmpibase/trunk/mof/ cmpibase/trunk/mof/omc-cmpi-base.mof cmpibase/trunk/mof/omc-computer-system.mof cmpibase/trunk/mof/omc-core.mof cmpibase/trunk/mof/omc-logical-file.mof cmpibase/trunk/mof/omc-operating-system.mof cmpibase/trunk/mof/omc-processes.mof cmpibase/trunk/mof/omc-time-service.mof cmpibase/trunk/mof/reg/ cmpibase/trunk/mof/reg/computer-system-peg.reg cmpibase/trunk/mof/reg/logical-file-peg.reg cmpibase/trunk/mof/reg/operating-system-peg.reg cmpibase/trunk/mof/reg/processes-peg.reg cmpibase/trunk/mof/reg/time-service-peg.reg Added: cmpibase/trunk/mof/omc-cmpi-base.mof =================================================================== --- cmpibase/trunk/mof/omc-cmpi-base.mof (rev 0) +++ cmpibase/trunk/mof/omc-cmpi-base.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,7 @@ +#pragma include ("omc-core.mof") +#pragma include ("omc-computer-system.mof") +#pragma include ("omc-operating-system.mof") +#pragma include ("omc-logical-file.mof") +#pragma include ("omc-processes.mof") +#pragma include ("omc-time-service.mof") + Added: cmpibase/trunk/mof/omc-computer-system.mof =================================================================== --- cmpibase/trunk/mof/omc-computer-system.mof (rev 0) +++ cmpibase/trunk/mof/omc-computer-system.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,33 @@ +#pragma locale ("en_US") + + +////////////////////////////////////////////////////////////////////////////// +[ Description("OMC Unitary Computer System") ] +class OMC_UnitaryComputerSystem : CIM_UnitaryComputerSystem +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Description("OMC Host Name Setting Data") ] +class OMC_HostNameSettingData : CIM_SettingData +{ + [Description ("The name of this computer"), + Required ] + string ComputerName; +}; + +////////////////////////////////////////////////////////////////////////////// +[ Association, Version ( "2.7.0" ), + Description ("OMC_ComputerSystemSettingData is associates " + " the computer name setting with the computer system") ] +class OMC_ComputerSystemHostNameSettingData : CIM_ElementSettingData +{ + [ Override("ManagedElement"), Key, + Description ("The computer system.")] + OMC_UnitaryComputerSystem REF ManagedElement; + + [ Override("SettingData"), Key, + Description ("The computer name setting the computer.")] + OMC_HostNameSettingData REF SettingData; +}; + Added: cmpibase/trunk/mof/omc-core.mof =================================================================== --- cmpibase/trunk/mof/omc-core.mof (rev 0) +++ cmpibase/trunk/mof/omc-core.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,35 @@ +#pragma locale ("en_US") + +////////////////////////////////////////////////////////////////////////////// +[ Abstract, Description("OMC base class for Services.") ] +class OMC_Service : CIM_Service +{ + [Override("StartService"), + ValueMap {"0", "1", "2", "3", "4", "5"}, + Values {"Success", "Request Not Supported", "Already Running", + "Service Does Not Exist", "Access Denied", "General Failure"}] + uint32 StartService(); + + [Override("StopService"), + ValueMap {"0", "1", "2", "3", "4", "5"}, + Values {"Success", "Request Not Supported", "Service Not Running", + "Service Does Not Exist", "Access Denied", "General Failure"}] + uint32 StopService(); + + uint32 ReloadService(); +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract, Description("OMC base class for software identity") ] +class OMC_SoftwareIdentity : CIM_SoftwareIdentity +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_TimeService : CIM_TimeService +{ +}; + +////////////////////////////////////////////////////////////////////////////// + Added: cmpibase/trunk/mof/omc-logical-file.mof =================================================================== --- cmpibase/trunk/mof/omc-logical-file.mof (rev 0) +++ cmpibase/trunk/mof/omc-logical-file.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,183 @@ +/******************************************************************************* + * Novell_LinuxSSHService and associated classes + * + * + * Copyright (C) 2004 Novell, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * - Neither the name of Novell, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ +#pragma locale ("en_US") + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_DataFile : CIM_DataFile +{ + sint32 append([IN(true), OUT(false), REQUIRED(true)] string newtext); + sint32 write([IN(true), OUT(false), REQUIRED(true)] string newtext); + sint32 read([IN(false), OUT(true), REQUIRED(true)] string filetext); +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_UnixDeviceFile : CIM_UnixDeviceFile +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_SymbolicLink : CIM_SymbolicLink +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_UnixDirectory : CIM_UnixDirectory +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_FIFOPipeFile : CIM_FIFOPipeFile +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Abstract ] +class OMC_UnixFile : CIM_UnixFile +{ + boolean UserReadable; + boolean UserWritable; + boolean UserExecutable; + boolean GroupReadable; + boolean GroupWritable; + boolean GroupExecutable; + boolean WorldReadable; + boolean WorldWritable; + boolean WorldExecutable; +}; + +////////////////////////////////////////////////////////////////////////////// +[ Association, Aggregation, Composition, Abstract, + Description("Specifies the hierarchical arrangement of LogicalFiles in a " + "Directory.")] +class OMC_DirectoryContainsFile : CIM_DirectoryContainsFile +{ + [Override ("GroupComponent"), Aggregate, Max(1), + Description ("The Directory") ] + OMC_UnixDirectory REF GroupComponent; + + [Override ("PartComponent"), + Description ("The LogicalFile 'contained within' the Directory.") ] + CIM_LogicalFile REF PartComponent; +}; + +////////////////////////////////////////////////////////////////////////////// +[ Association, Abstract, Description ( + "CIM_FileIdentity indicates that a UnixFile describes Unix-" + "specific aspects of the various subclasses of LogicalFile. " + "The association exists since it forces UnixFile to be " + "weak to (scoped by) the LogicalFile. This is not true in " + "the association's superclass, LogicalIdentity.")] +class OMC_FileIdentity : CIM_FileIdentity +{ + [Override ("SystemElement"), Min (1), Max (1), + Description ("The Logical File.") ] + CIM_LogicalFile ref SystemElement; + + [Override ("SameElement"), Weak, Max (1), + Description ("SameElement represents the additional aspects of the " + "Unix/Linux Logical file.") ] + OMC_UnixFile ref SameElement; + +}; + +////////////////////////////////////////////////////////////////////////////// +class OMC_LinuxDataFile : OMC_DataFile +{ +}; + +////////////////////////////////////////////////////////////////////////////// +class OMC_LinuxDeviceFile : OMC_UnixDeviceFile +{ +}; + +////////////////////////////////////////////////////////////////////////////// +class OMC_LinuxSymbolicLink : OMC_SymbolicLink +{ +}; + +////////////////////////////////////////////////////////////////////////////// +class OMC_LinuxDirectory : OMC_UnixDirectory +{ +}; + +////////////////////////////////////////////////////////////////////////////// +class OMC_LinuxFIFOPipeFile : OMC_FIFOPipeFile +{ +}; + +////////////////////////////////////////////////////////////////////////////// +class OMC_LinuxFile : OMC_UnixFile +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[Association, Aggregation, Composition, + Description("Specifies the hierarchical arrangement of LogicalFiles in a " + "Directory.") +] +class OMC_LinuxDirectoryContainsFile : OMC_DirectoryContainsFile +{ + [Override ("GroupComponent"), Aggregate, Max(1), + Description ("The Directory") ] + OMC_LinuxDirectory REF GroupComponent; + + [Override ("PartComponent"), + Description ("The LogicalFile 'contained within' the Directory.") ] + CIM_LogicalFile REF PartComponent; +}; + +////////////////////////////////////////////////////////////////////////////// +[Association, Description ( + "CIM_FileIdentity indicates that a UnixFile describes Unix-" + "specific aspects of the various subclasses of LogicalFile. " + "The association exists since it forces UnixFile to be " + "weak to (scoped by) the LogicalFile. This is not true in " + "the association's superclass, LogicalIdentity.")] +class OMC_LinuxFileIdentity : OMC_FileIdentity +{ + [Override ("SystemElement"), Min (1), Max (1), + Description ("The Logical File.") ] + CIM_LogicalFile ref SystemElement; + + [Override ("SameElement"), Weak, Max (1), Description ( + "SameElement represents the additional aspects of the " + "Unix/Linux Logical file.") ] + OMC_LinuxFile ref SameElement; + +}; + Added: cmpibase/trunk/mof/omc-operating-system.mof =================================================================== --- cmpibase/trunk/mof/omc-operating-system.mof (rev 0) +++ cmpibase/trunk/mof/omc-operating-system.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,72 @@ +#pragma locale ("en_US") + +////////////////////////////////////////////////////////////////////////////// +[ Description("OMC Operating System") ] +class OMC_OperatingSystem : CIM_OperatingSystem +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Description("Kernel statistics for the running os kernel") ] +class OMC_OSStatisticalInformation : CIM_StatisticalInformation +{ +}; + +////////////////////////////////////////////////////////////////////////////// +[ Association, + Description("OMC_OSStatistics relates " + "OMC_OSStatisticalInformation with " + "OMC_OperatingSystem") ] +class OMC_OSStatistics : CIM_Statistics +{ + [ Override("Stats"), Weak, + Description("The OS Statistical object") ] + OMC_OSStatisticalInformation REF Stats; + + [ Override("Element"), Min(1), Max(1), + Description("The operating system object") ] + OMC_OperatingSystem REF Element; +}; + +////////////////////////////////////////////////////////////////////////////// +[Association, Description ( + "RunningOS indicates the currently executing OperatingSystem. " + "At most one OperatingSystem can execute at any time on a " + "ComputerSystem. 'At most one' is specified, since the Computer " + "System may not be currently booted, or its OperatingSystem may " + "be unknown.")] +class OMC_RunningOS : CIM_RunningOS +{ + [Override ( "Antecedent" ), Max ( 1 ), Description ( + "The OperatingSystem currently running on the " + "ComputerSystem.")] + OMC_OperatingSystem REF Antecedent; + + [Override ( "Dependent" ), Max ( 1 ), Description ( + "The ComputerSystem.")] + CIM_ComputerSystem REF Dependent; +}; + +// =================================================================== +// InstalledOS +// =================================================================== + [Association, Aggregation, Composition, Version ( "2.7.0" ), + Description ( + "A link between the ComputerSystem and the OperatingSystem(s) " + "installed or loaded on it. An OperatingSystem is 'installed' " + "on a ComputerSystem, when placed on one of its StorageExtents " + "- for example, copied to a disk drive or downloaded to Memory. " + "Using this definition, an OperatingSystem is 'installed' on a " + "NetPC when downloaded via the network.")] +class OMC_InstalledOS : CIM_InstalledOS +{ + [Aggregate, Override ( "GroupComponent" ), Min ( 1 ), Max ( 1 ), + Description ( + "The ComputerSystem.")] + CIM_ComputerSystem REF GroupComponent; + + [Override ( "PartComponent" ), Weak, Description ( + "The OperatingSystem installed on the ComputerSystem.")] + OMC_OperatingSystem REF PartComponent; +}; + Added: cmpibase/trunk/mof/omc-processes.mof =================================================================== --- cmpibase/trunk/mof/omc-processes.mof (rev 0) +++ cmpibase/trunk/mof/omc-processes.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,53 @@ +#pragma locale ("en_US") + +////////////////////////////////////////////////////////////////////////////// +[ Description ("A Unix Process") ] +class OMC_UnixProcess : CIM_UnixProcess +{ + [ Description("Send a signal to some running processes. Only the " + "root/admin user is allowed to invoke this method") ] + string KillAll([IN] string arg); + + [ Description("Send a signal to a running process") ] + string SendSignal([IN] sint32 signal); + + [Description ("Virtual memory size in KBytes") ] + uint32 VirtualMemorySize; + + [Description ("Percentage of CPU used by process") ] + real32 PercentCPU; +}; + +////////////////////////////////////////////////////////////////////////////// +[ Association, Aggregation, Composition, Version ( "2.7.0" ), + Description ("A link between the OperatingSystem and Process(es) " + "running in the context of this OperatingSystem.") ] +class OMC_OSProcess : CIM_OSProcess +{ + [Aggregate, Override ( "GroupComponent" ), Min ( 1 ), Max ( 1 ), + Description ("The OperatingSystem.")] + OMC_OperatingSystem REF GroupComponent; + + [Override ( "PartComponent" ), Weak, + Description ( + "The Process running in the context of the OperatingSystem.") ] + OMC_UnixProcess REF PartComponent; +}; + + +////////////////////////////////////////////////////////////////////////////// +[ Association, + Description("A link between a Process and a DataFile indicating " + "that the File participates in the execution of the Process.") ] +class OMC_ProcessExecutable : CIM_ProcessExecutable +{ + [ Override("Antecedent"), + Description("The DataFile participating in the execution of the" + "Process.") ] + OMC_DataFile REF Antecedent; + + [ Override("Dependent"), + Description("The process.") ] + OMC_UnixProcess REF Dependent; +}; + Added: cmpibase/trunk/mof/omc-time-service.mof =================================================================== --- cmpibase/trunk/mof/omc-time-service.mof (rev 0) +++ cmpibase/trunk/mof/omc-time-service.mof 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,241 @@ +#pragma locale ("en_US") + +////////////////////////////////////////////////////////////////////////////// +// CIM_ManagedElement +// CIM_ManagedSystemElement +// CIM_LogicalElement +// CIM_EnabledLogicalElement +// CIM_Service +// CIM_TimeService +// OMC_TimeService +// ** OMC_SystemTimeService +// +[ Description("OMC_SystemTimeService represents the configuration " + " and function of the system time") ] +class OMC_SystemTimeService : OMC_TimeService +{ + [ Key, Override("SystemCreationClassName") ] + string SystemCreationClassName; + + [ Key, Override("SystemName") ] + string SystemName; + + [ Key, Override("CreationClassName") ] + string CreationClassName = "OMC_SystemTimeService"; + + [ Key, Override("Name") ] + string Name = "timeservice"; + + [ Static(true), + Description ( + "This method gets or sets the time for the system."), + ValueMap { "0", "1", "2", "3", "4", "5", "6..32767", + "32768..65535" }, + Values { "Success", "Not Supported", "Unknown", "Timeout", + "Failed", "Invalid Parameter", "DMTF Reserved", + "Vendor Specific" } ] + uint32 ManageSystemTime ( + [ IN, DESCRIPTION ( + "Indicates what type of request this is: " + "TRUE - Get time request " + "FALSE - Set time request.") ] + boolean GetRequest, + + [ IN, OUT, DESCRIPTION ( + "The current date and time. On input, this is the time " + "that is set on the specified element, if the GetRequest " + "input parameter is TRUE. Otherwise, the input time is " + "ignored. On output, this is the time as known by the " + "element.") ] + datetime TimeData); + + [ INVISIBLE(true), + Description ( + "NOT IMPLEMENTED - DON'T USE. " + "This method is inherited from CIM_TimeService. " + "Since this method always pertains to the ComputerSystem, " + "The ManagedElement element parameter is not necessary. " + "For this reason the ManageSystemTime method should be " + "used instead of ManageTime") ] + uint32 ManageTime ( + [ IN ] + boolean GetRequest, + [ IN, OUT ] + datetime TimeData, + [ REQUIRED, IN ] + CIM_ManagedElement REF ManagedElement); +}; + +////////////////////////////////////////////////////////////////////////////// +// CIM_ManagedElement +// CIM_ManagedSystemElement +// CIM_LogicalElement +// CIM_EnabledLogicalElement +// CIM_ServiceAccessPoint +// CIM_RemoteServiceAccessPoint +// CIM_RemotePort +// ** OMC_RemoteTimeServicePort +// +[ Description("OMC_RemoteTimeServicePort represent the NTP " + "configuration for the time service") ] +class OMC_RemoteTimeServicePort : CIM_RemotePort +{ + [ Override("AccessInfo"), Write(true), + Description ( + "Access and/or addressing information for a remote " + "connection. This can be a host name, network address or " + "similar information. This is inherited from " + "CIM_RemoteServiceAccessPoint"), + ModelCorrespondence { "CIM_RemoteServiceAccessPoint.InfoFormat"} ] + string AccessInfo; + + [ Override("PortInfo"), Write(true), + Description("Address of remote NTP server. This is " + " inherited from CIM_RemotePort. This will be in " + " the form of a DNS name of an IP address. " + " A port may be specified in this field by using " + " the ':' character as a delimeter. Example: " + " 137.65.1.1:123 or time.server.com:123 " + " If not port is specified the NTP well known port " + " (123) will be assumed") ] + string PortInfo; + + [Description ("An enumerated integer describing the protocol of the port " + "addressed by PortInformation."), + ValueMap { "1", "2", "3", "32768..65535" }, + Values { "Other", "TCP", "UDP", "Vendor Specific" }, + ModelCorrespondence { "CIM_RemotePort.OtherProtocolDescription"}] + uint16 PortProtocol = 2; + + [ Description ("The Prefer property Marks the host as a preferred " + "time source. This host is not subject to preliminary filtering.") ] + boolean Prefer; + + [ Description ("The Key property specifies that all packets sent to " + "the time source include authentication fields encrypted using the " + "specified key number. The value of Key is the range of an " + "unsigned 32 bit integer.") ] + uint32 Key; + + [ Description( + "The NTPversion property specifies the version number to use for " + "outgoing NTP packets. The values for NTPversion can be 1 thru 4."), + ValueMap { "1", "2", "3", "4" } ] + uint32 NTPversion; + + [ Description( + "The MinPoll property specifies the minimum poll interval allowed by " + "any peer of the Internet system. The minimum poll interval is " + "calculated, in seconds, as 2 to the power of minpoll value. " + "The default value of minpoll is 6, i.e. the corresponding poll " + "interval is 64 seconds.") ] + uint32 MinPoll; + + [ Description( + "The MaxPoll property specifies the maximum poll interval allowed by " + "any peer of the Internet system. The maximum poll interval is " + "calculated, in seconds, as 2 to the power of maxpoll value. " + "The default value of maxpoll is 10, therefore the corresponding " + "poll interval is ~17 minutes.") ] + uint32 MaxPoll; +}; + +////////////////////////////////////////////////////////////////////////////// +// CIM_ManagedElement +// CIM_SettingData +// ** OMC_TimeZoneSettingData +// +[ Description("OMC_TimeZoneSettingData represents the " + "configuration of the system time zone.") ] +class OMC_TimeZoneSettingData : CIM_SettingData +{ + [ Key, Description( + "InstanceID is the key field inherited from CIM_SettingData. " + "Since there is only one instance of this class, the key " + "value is 'OMC:SUSE:TIMEZONE'") ] + string InstanceID; + + [ Required(true), Description("The time zone"), + Write(true) ] + string TimeZone; + + [ Description("If the value of UTCHardwareClock is set to true, " + " then the hardware clock is set to UTC. Otherwise the " + " hardware clock is set to local time."), + Write(true) ] + boolean UTCHardwareClock = true; +}; + +////////////////////////////////////////////////////////////////////////////// +// CIM_Dependency +// CIM_HostedDependency +// CIM_HostedService +// ** OMC_HostedTimeService +// +[ Association, + Description("OMC_HostedTimeService associates the time service " + "to the computer system") ] +class OMC_HostedTimeService : CIM_HostedService +{ + [ Override("Antecedent"), Min(1), Max(1), + Description("The hosting computer system") ] + OMC_UnitaryComputerSystem REF Antecedent; + + [ Override("Dependent"), Weak, + Description("The hosted system time service") ] + OMC_SystemTimeService REF Dependent; +}; + +////////////////////////////////////////////////////////////////////////////// +// CIM_Dependency +// CIM_ServiceAccessBySAP +// ** OMC_TimeServiceAccessBySAP +// +[ Association, + Description("OMC_TimeServiceAccessBySAP is an association " + "that identifies the configuration for NTP access for the " + "time service") ] +class OMC_TimeServiceAccessBySAP : CIM_ServiceAccessBySAP +{ + [ Override("Antecedent"), + Description("The time service") ] + OMC_SystemTimeService REF Antecedent; + + [ Override("Dependent"), + Description("Access point for the time service") ] + OMC_RemoteTimeServicePort REF Dependent; +}; + +////////////////////////////////////////////////////////////////////////////// +// CIM_ElementSettingData +// ** OMC_TimeServiceTimeZoneSettingData +// +[ Association, + Description("OMC_TimeServiceTimeZoneSettingData associates the time " + "service with the time zone configuration") ] +class OMC_TimeServiceTimeZoneSettingData : CIM_ElementSettingData +{ + [ Override("ManagedElement") ] + OMC_SystemTimeService REF ManagedElement; + + [ Override("SettingData") ] + OMC_TimeZoneSettingData REF SettingData; +}; + + +////////////////////////////////////////////////////////////////////////////// +// CIM_ServiceAvailableToElement +// OMC_TimeServiceAvailableToElement +// +[ Association, + Description("OMC_TimeServiceAvailableToElement indicates that this time " + "service is available for the use of the managed element") ] +class OMC_TimeServiceAvailableToElement : CIM_ServiceAvailableToElement +{ + [ Override("ServiceProvided") ] + OMC_TimeService REF ServiceProvided; + + [ Override("UserOfService") ] + CIM_ManagedElement REF UserOfService; +}; + Added: cmpibase/trunk/mof/reg/computer-system-peg.reg =================================================================== --- cmpibase/trunk/mof/reg/computer-system-peg.reg (rev 0) +++ cmpibase/trunk/mof/reg/computer-system-peg.reg 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,85 @@ + +instance of PG_ProviderModule +{ + Name = "OMC_CS_HostNameSettingData_Module"; + Location = "omccmpi_cshostnamesettingdata"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_ProviderModule +{ + Name = "OMC_HostNameSettingData_Module"; + Location = "omccmpi_hostnamesettingdata"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_ProviderModule +{ + Name = "OMC_UnitaryComputerSystem_Module"; + Location = "omccmpi_computer_system"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_CS_HostNameSettingData_Provider"; + ProviderModuleName = "OMC_CS_HostNameSettingData_Module"; +}; + +instance of PG_Provider +{ + Name = "OMC_HostNameSettingData_Provider"; + ProviderModuleName = "OMC_HostNameSettingData_Module"; +}; + +instance of PG_Provider +{ + Name = "OMC_UnitaryComputerSystem_Provider"; + ProviderModuleName = "OMC_UnitaryComputerSystem_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_UnitaryComputerSystem_Module"; + ProviderName = "OMC_UnitaryComputerSystem_Provider"; + ClassName = "OMC_UnitaryComputerSystem"; + ProviderType = { 2 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_UnitaryComputerSystem-1"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_HostNameSettingData_Module"; + ProviderName = "OMC_HostNameSettingData_Provider"; + ClassName = "OMC_HostNameSettingData"; + ProviderType = { 2, 5 }; // Instance, Method + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_HostNameSettingData-2"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_CS_HostNameSettingData_Module"; + ProviderName = "OMC_CS_HostNameSettingData_Provider"; + ClassName = "OMC_ComputerSystemHostNameSettingData"; + ProviderType = { 2, 3 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_ComputerSystemHostNameSettingData-3"; +}; + Added: cmpibase/trunk/mof/reg/logical-file-peg.reg =================================================================== --- cmpibase/trunk/mof/reg/logical-file-peg.reg (rev 0) +++ cmpibase/trunk/mof/reg/logical-file-peg.reg 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,134 @@ +instance of PG_ProviderModule +{ + Name = "OMC_LinuxLogicalFile_Module"; + Location = "CIM_LogicalFile_Provider"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; +instance of PG_Provider +{ + Name = "OMC_LinuxLogicalFile_Provider"; + ProviderModuleName = "OMC_LinuxLogicalFile_Module"; +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxLogicalFile_Capability0001"; + ProviderModuleName = "OMC_LinuxLogicalFile_Module"; + ProviderName = "OMC_LinuxLogicalFile_Provider"; + ClassName = "OMC_LinuxDataFile"; + Namespaces = {"root/cimv2"}; + ProviderType = {2,5}; // Instance, Method +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxLogicalFile_Capability0002"; + ProviderModuleName = "OMC_LinuxLogicalFile_Module"; + ProviderName = "OMC_LinuxLogicalFile_Provider"; + ClassName = "OMC_LinuxDeviceFile"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxLogicalFile_Capability0003"; + ProviderModuleName = "OMC_LinuxLogicalFile_Module"; + ProviderName = "OMC_LinuxLogicalFile_Provider"; + ClassName = "OMC_LinuxSymbolicLink"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxLogicalFile_Capability0004"; + ProviderModuleName = "OMC_LinuxLogicalFile_Module"; + ProviderName = "OMC_LinuxLogicalFile_Provider"; + ClassName = "OMC_LinuxDirectory"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxLogicalFile_Capability0005"; + ProviderModuleName = "OMC_LinuxLogicalFile_Module"; + ProviderName = "OMC_LinuxLogicalFile_Provider"; + ClassName = "OMC_LinuxFIFOPipeFile"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; + + +instance of PG_ProviderModule +{ + Name = "OMC_LinuxFile_Module"; + Location = "OMC_LinuxFile_Provider"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; +instance of PG_Provider +{ + Name = "OMC_LinuxFile_Provider"; + ProviderModuleName = "OMC_LinuxFile_Module"; +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxFile_Capability0001"; + ProviderModuleName = "OMC_LinuxFile_Module"; + ProviderName = "OMC_LinuxFile_Provider"; + ClassName = "OMC_LinuxFile"; + Namespaces = {"root/cimv2"}; + ProviderType = {2}; // Instance +}; + + +instance of PG_ProviderModule +{ + Name = "OMC_LinuxDirectoryContainsFile_Module"; + Location = "OMC_LinuxDirectoryContainsFile_Provider"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; +instance of PG_Provider +{ + Name = "OMC_LinuxDirectoryContainsFile_Provider"; + ProviderModuleName = "OMC_LinuxDirectoryContainsFile_Module"; +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxDirectoryContainsFile_Capability0001"; + ProviderModuleName = "OMC_LinuxDirectoryContainsFile_Module"; + ProviderName = "OMC_LinuxDirectoryContainsFile_Provider"; + ClassName = "OMC_LinuxDirectoryContainsFile"; + Namespaces = {"root/cimv2"}; + ProviderType = {2,3}; // Instance, Associator +}; + +instance of PG_ProviderModule +{ + Name = "OMC_LinuxFileIdentity_Module"; + Location = "OMC_LinuxFileIdentity_Provider"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; +instance of PG_Provider +{ + Name = "OMC_LinuxFileIdentity_Provider"; + ProviderModuleName = "OMC_LinuxFileIdentity_Module"; +}; +instance of PG_ProviderCapabilities +{ + CapabilityID = "OMC_LinuxFileIdentity_Capability0001"; + ProviderModuleName = "OMC_LinuxFileIdentity_Module"; + ProviderName = "OMC_LinuxFileIdentity_Provider"; + ClassName = "OMC_LinuxFileIdentity"; + Namespaces = {"root/cimv2"}; + ProviderType = {2,3}; // Instance, Associator +}; + Added: cmpibase/trunk/mof/reg/operating-system-peg.reg =================================================================== --- cmpibase/trunk/mof/reg/operating-system-peg.reg (rev 0) +++ cmpibase/trunk/mof/reg/operating-system-peg.reg 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,86 @@ +instance of PG_ProviderModule +{ + Name = "OMC_OperatingSystemProviderModule"; + Location = "OMC_LinuxOS"; + Vendor = "OMC"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + ProviderModuleName = "OMC_OperatingSystemProviderModule"; + Name = "OMC_LinuxOS"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_OperatingSystemProviderModule"; + ProviderName = "OMC_LinuxOS"; + CapabilityID = "1"; + ClassName = "OMC_OperatingSystem"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 5 }; // Instance, Method + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All Methods +}; + +instance of PG_ProviderModule +{ + Name = "OMC_RunningLinuxOSProviderModule"; + Location = "OMC_RunningLinuxOS"; + Vendor = "OMC"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + ProviderModuleName = "OMC_RunningLinuxOSProviderModule"; + Name = "OMC_RunningLinuxOS"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_RunningLinuxOSProviderModule"; + ProviderName = "OMC_RunningLinuxOS"; + CapabilityID = "1"; + ClassName = "OMC_RunningOS"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Associator + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All Methods +}; + + +instance of PG_ProviderModule +{ + Name = "OMC_InstalledLinuxOSProviderModule"; + Location = "OMC_InstalledLinuxOS"; + Vendor = "OMC"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + ProviderModuleName = "OMC_InstalledLinuxOSProviderModule"; + Name = "OMC_InstalledLinuxOS"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_InstalledLinuxOSProviderModule"; + ProviderName = "OMC_InstalledLinuxOS"; + CapabilityID = "1"; + ClassName = "OMC_InstalledOS"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Associator + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All Methods +}; + + Added: cmpibase/trunk/mof/reg/processes-peg.reg =================================================================== --- cmpibase/trunk/mof/reg/processes-peg.reg (rev 0) +++ cmpibase/trunk/mof/reg/processes-peg.reg 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,40 @@ +instance of PG_ProviderModule +{ + Name = "OMC_UnixProcessProviderModule"; + Location = "OMC_UnixProcess"; + Vendor = "OMC"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + ProviderModuleName = "OMC_UnixProcessProviderModule"; + Name = "OMC_UnixProcess"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_UnixProcessProviderModule"; + ProviderName = "OMC_UnixProcess"; + CapabilityID = "1"; + ClassName = "OMC_UnixProcess"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 5 }; // Instance, Method + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All methods +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_UnixProcessProviderModule"; + ProviderName = "OMC_UnixProcess"; + CapabilityID = "2"; + ClassName = "OMC_OSProcess"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Association + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; +}; + Added: cmpibase/trunk/mof/reg/time-service-peg.reg =================================================================== --- cmpibase/trunk/mof/reg/time-service-peg.reg (rev 0) +++ cmpibase/trunk/mof/reg/time-service-peg.reg 2008-04-22 22:00:14 UTC (rev 573) @@ -0,0 +1,215 @@ + +instance of PG_ProviderModule +{ + Name = "OMC_SystemTimeService_Module"; + Location = "omccmpi_systemTimeService"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_SystemTimeService_Provider"; + ProviderModuleName = "OMC_SystemTimeService_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_SystemTimeService_Module"; + ProviderName = "OMC_SystemTimeService_Provider"; + ClassName = "OMC_SystemTimeService"; + ProviderType = { 2 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_SystemTimeService-1"; +}; + + + + +instance of PG_ProviderModule +{ + Name = "OMC_RemoteTimeServicePort_Module"; + Location = "omccmpi_remoteTimeServicePort"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_RemoteTimeServicePort_Provider"; + ProviderModuleName = "OMC_RemoteTimeServicePort_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_RemoteTimeServicePort_Module"; + ProviderName = "OMC_RemoteTimeServicePort_Provider"; + ClassName = "OMC_RemoteTimeServicePort"; + ProviderType = { 2 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_RemoteTimeServicePort-2"; +}; + + + + +instance of PG_ProviderModule +{ + Name = "OMC_TimeZoneSettingData_Module"; + Location = "omccmpi_timeZoneSettingData"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_TimeZoneSettingData_Provider"; + ProviderModuleName = "OMC_TimeZoneSettingData_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_TimeZoneSettingData_Module"; + ProviderName = "OMC_TimeZoneSettingData_Provider"; + ClassName = "OMC_TimeZoneSettingData"; + ProviderType = { 2 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_TimeZoneSettingData-1"; +}; + + + + +instance of PG_ProviderModule +{ + Name = "OMC_HostedTimeService_Module"; + Location = "omccmpi_hostedTimeService"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_HostedTimeService_Provider"; + ProviderModuleName = "OMC_HostedTimeService_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_HostedTimeService_Module"; + ProviderName = "OMC_HostedTimeService_Provider"; + ClassName = "OMC_HostedTimeService"; + ProviderType = { 2, 3 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_HostedTimeService-1"; +}; + + + + +instance of PG_ProviderModule +{ + Name = "OMC_TimeServiceTimeZoneSettingData_Module"; + Location = "omccmpi_timeServiceTimeZoneSettingData"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_TimeServiceTimeZoneSettingData_Provider"; + ProviderModuleName = "OMC_TimeServiceTimeZoneSettingData_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_TimeServiceTimeZoneSettingData_Module"; + ProviderName = "OMC_TimeServiceTimeZoneSettingData_Provider"; + ClassName = "OMC_TimeServiceTimeZoneSettingData"; + ProviderType = { 2, 3 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_TimeServiceTimeZoneSettingData-1"; +}; + + + + +instance of PG_ProviderModule +{ + Name = "OMC_TimeServiceAccessBySAP_Module"; + Location = "omccmpi_timeServiceAccessBySAP"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_TimeServiceAccessBySAP_Provider"; + ProviderModuleName = "OMC_TimeServiceAccessBySAP_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_TimeServiceAccessBySAP_Module"; + ProviderName = "OMC_TimeServiceAccessBySAP_Provider"; + ClassName = "OMC_TimeServiceAccessBySAP"; + ProviderType = { 2, 3 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_TimeServiceAccessBySAP-1"; +}; + + + + +instance of PG_ProviderModule +{ + Name = "OMC_TimeServiceAvailableToElement_Module"; + Location = "omccmpi_timeServiceAvailableToElement"; + Vendor = "OMC"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "OMC_TimeServiceAvailableToElement_Provider"; + ProviderModuleName = "OMC_TimeServiceAvailableToElement_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_TimeServiceAvailableToElement_Module"; + ProviderName = "OMC_TimeServiceAvailableToElement_Provider"; + ClassName = "OMC_TimeServiceAvailableToElement"; + ProviderType = { 2, 3 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "OMC_TimeServiceAvailableToElement-1"; +}; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-04-23 15:43:55
|
Revision: 578 http://omc.svn.sourceforge.net/omc/?rev=578&view=rev Author: jcarey Date: 2008-04-23 08:43:59 -0700 (Wed, 23 Apr 2008) Log Message: ----------- RPM Spec file and adjustment for... Modified Paths: -------------- cmpibase/trunk/Makefile.am cmpibase/trunk/configure.ac Added Paths: ----------- cmpibase/trunk/omc-cmpibase.changes cmpibase/trunk/omc-cmpibase.spec Property Changed: ---------------- cmpibase/trunk/ cmpibase/trunk/mof/ Property changes on: cmpibase/trunk ___________________________________________________________________ Name: svn:ignore - stamp-h1 configure Makefile.in config.log depcomp config.guess config.h ltmain.sh config.sub Makefile omccmpi-*.tar.gz config.status config.h.in libtool autom4te.cache missing aclocal.m4 + stamp-h1 configure Makefile.in mybuild config.log depcomp config.guess config.h ltmain.sh config.sub Makefile omccmpi-*.tar.gz config.status config.h.in libtool autom4te.cache missing aclocal.m4 Modified: cmpibase/trunk/Makefile.am =================================================================== --- cmpibase/trunk/Makefile.am 2008-04-22 22:55:29 UTC (rev 577) +++ cmpibase/trunk/Makefile.am 2008-04-23 15:43:59 UTC (rev 578) @@ -4,6 +4,7 @@ SUBDIRS = \ . \ - src + src \ + mof Modified: cmpibase/trunk/configure.ac =================================================================== --- cmpibase/trunk/configure.ac 2008-04-22 22:55:29 UTC (rev 577) +++ cmpibase/trunk/configure.ac 2008-04-23 15:43:59 UTC (rev 578) @@ -198,5 +198,6 @@ src/providers/time-service/Makefile src/providers/logical-file/Makefile src/providers/logical-file/schema/Makefile + mof/Makefile ]) AC_OUTPUT Property changes on: cmpibase/trunk/mof ___________________________________________________________________ Name: svn:ignore + Makefile.in Added: cmpibase/trunk/omc-cmpibase.changes =================================================================== --- cmpibase/trunk/omc-cmpibase.changes (rev 0) +++ cmpibase/trunk/omc-cmpibase.changes 2008-04-23 15:43:59 UTC (rev 578) @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Tue Apr 22 17:02:33 MDT 2008 - jc...@no... + +- Initial Revision + Added: cmpibase/trunk/omc-cmpibase.spec =================================================================== --- cmpibase/trunk/omc-cmpibase.spec (rev 0) +++ cmpibase/trunk/omc-cmpibase.spec 2008-04-23 15:43:59 UTC (rev 578) @@ -0,0 +1,97 @@ +# +# spec file for package omc-cmpibase +# +# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild +%define omcprefix /usr + +Name: omc-cmpibase +BuildRequires: gcc gcc-c++ cimple-devel omccmpi-devel tog-pegasus-devel +URL: http://sourceforge.net/projects/omc +# Increment the version every time the source code changes. +Version: 1.0.0 +Release: 01 +Group: System/Management +Vendor: Novell, Inc. +Summary: Open-source implementation of CIM Providers for base components. +PreReq: /usr/bin/peg-loadmof.sh +License: BSD +# This is necessary to build the RPM as a non-root user. +BuildRoot: %{_tmppath}/%{name}-%{version}-build +# "yes" is the default, but we put it here explicitly to avoid someone +# setting it to "no" +AutoReqProv: yes +Requires: tog-pegasus cimple omccmpi +Requires: cim-schema >= 2.12 +Source0: cmpibase-%{version}.tar.gz + +%description +Linux providers for instrumentation of base operating system components +such as computer, system, operating system, and processes. + +Authors: +-------- + Jon Carey + Norm Paxton + Bart Whiteley + +%prep +# Untar the sources. +%setup -n cmpibase-%{version} + +%build +# If the LD_RUN_PATH environment variable is set at link time, +# it's value is embedded in the resulting binary. At run time, +# The binary will look here first for shared libraries. This way +# we link against the libraries we want at run-time even if libs +# by the same name are in /usr/lib or some other path in /etc/ld.so.conf +autoreconf --force --install +CFLAGS="$RPM_OPT_FLAGS -fstack-protector" \ +CXXFLAGS="$RPM_OPT_FLAGS -fstack-protector" \ +./configure --prefix=%{omcprefix} --libdir=%_libdir --with-cmpi-include-dir=/usr/include/Pegasus/Provider/CMPI +make %{?jobs:-j%jobs} + +%install +%{__rm} -rf $RPM_BUILD_ROOT +%{__mkdir} -p $RPM_BUILD_ROOT +# Tell 'make install' to install into the BuildRoot +make DESTDIR=$RPM_BUILD_ROOT install +MOFDIR=$RPM_BUILD_ROOT/%{omcprefix}/share/mof/%{name} +install -d $MOFDIR +install mof/*.{mof,reg} $MOFDIR +%{__rm} -f $RPM_BUILD_ROOT%{omcprefix}/%_lib/*.{a,la} +%{__rm} -f $RPM_BUILD_ROOT%{omcprefix}/%_lib/cmpi/*.{a,la} + +%clean +%{__rm} -rf $RPM_BUILD_ROOT + +%post +# Any RPM that installs a shared library into any directory +# listed in /etc/ld.so.conf (or into /usr/lib if it hasn't been +# fixed yet to install into the correct FHS compliant paths) +# must run ldconfig in its post install script. +%run_ldconfig +# load MOF +MOFDIR=%{omcprefix}/share/mof/%{name} +peg-loadmof.sh -n root/cimv2 $MOFDIR/omc-cmpi-base.mof || /bin/true +peg-loadmof.sh -n root/PG_InterOp $MOFDIR/*.reg || /bin/true + +%postun +%run_ldconfig + +%files +%defattr(-,root,root) +%{omcprefix}/%_lib/*.so* +%{omcprefix}/%_lib/cmpi/*.so* +%dir %{omcprefix}/share/mof/%{name} +%{omcprefix}/share/mof/%{name}/* + + +%changelog + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |