You can subscribe to this list here.
2005 |
Jan
|
Feb
(1) |
Mar
(45) |
Apr
(150) |
May
(145) |
Jun
(150) |
Jul
(79) |
Aug
(313) |
Sep
(160) |
Oct
(309) |
Nov
(115) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(160) |
Feb
(144) |
Mar
(127) |
Apr
(48) |
May
(102) |
Jun
(54) |
Jul
(245) |
Aug
(94) |
Sep
(152) |
Oct
(162) |
Nov
(166) |
Dec
(740) |
2007 |
Jan
(752) |
Feb
(437) |
Mar
(328) |
Apr
(373) |
May
(569) |
Jun
(399) |
Jul
(369) |
Aug
(627) |
Sep
(100) |
Oct
(306) |
Nov
(166) |
Dec
(282) |
2008 |
Jan
(68) |
Feb
(145) |
Mar
(180) |
Apr
(160) |
May
(277) |
Jun
(229) |
Jul
(1188) |
Aug
(51) |
Sep
(97) |
Oct
(99) |
Nov
(95) |
Dec
(170) |
2009 |
Jan
(39) |
Feb
(73) |
Mar
(120) |
Apr
(121) |
May
(104) |
Jun
(262) |
Jul
(57) |
Aug
(171) |
Sep
(131) |
Oct
(88) |
Nov
(64) |
Dec
(83) |
2010 |
Jan
(55) |
Feb
(67) |
Mar
(124) |
Apr
(64) |
May
(130) |
Jun
(75) |
Jul
(164) |
Aug
(64) |
Sep
(44) |
Oct
(17) |
Nov
(43) |
Dec
(31) |
2011 |
Jan
(21) |
Feb
(10) |
Mar
(43) |
Apr
(46) |
May
(52) |
Jun
(71) |
Jul
(7) |
Aug
(16) |
Sep
(51) |
Oct
(14) |
Nov
(33) |
Dec
(15) |
2012 |
Jan
(12) |
Feb
(61) |
Mar
(129) |
Apr
(76) |
May
(70) |
Jun
(52) |
Jul
(29) |
Aug
(41) |
Sep
(32) |
Oct
(23) |
Nov
(38) |
Dec
(26) |
2013 |
Jan
(35) |
Feb
(37) |
Mar
(51) |
Apr
(15) |
May
(52) |
Jun
(15) |
Jul
(23) |
Aug
(21) |
Sep
(46) |
Oct
(69) |
Nov
(57) |
Dec
(26) |
2014 |
Jan
(5) |
Feb
(13) |
Mar
(17) |
Apr
(1) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(16) |
Nov
(8) |
Dec
(4) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(4) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Adrian S. <a3s...@us...> - 2005-06-21 07:27:51
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18217 Modified Files: mlog.c Log Message: Fix from Anas Nashif - fixes segfault on x86_64 Index: mlog.c =================================================================== RCS file: /cvsroot/sblim/sfcb/mlog.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mlog.c 26 Apr 2005 21:58:47 -0000 1.2 +++ mlog.c 21 Jun 2005 07:27:42 -0000 1.3 @@ -12,8 +12,9 @@ * * Author: Viktor Mihajlovski <mih...@de...m> * Contributors: Michael Schuele <sch...@de...> + * Anas Nashif <na...@pl...> * - * Description: Metric Defintiona and Value data types. + * Description: Logger support. * */ @@ -32,7 +33,7 @@ void mlogf(int priority, int errout, const char *fmt, ...) { - va_list ap; + va_list ap,apc; int priosysl; char buf[4096]; @@ -55,7 +56,9 @@ syslog(priosysl,buf); if (errout) { - vfprintf(stderr,fmt,ap); + va_start(apc,fmt); + vfprintf(stderr,fmt,apc); + va_end(apc); } va_end(ap); } |
From: Adrian S. <a3s...@us...> - 2005-06-20 23:59:33
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2456 Modified Files: cimXmlGen.c Log Message: Fixed [ 1224514 ] Incorrect PROPERTY.REFERENCE generated Index: cimXmlGen.c =================================================================== RCS file: /cvsroot/sblim/sfcb/cimXmlGen.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- cimXmlGen.c 13 Jun 2005 23:37:31 -0000 1.9 +++ cimXmlGen.c 20 Jun 2005 23:59:24 -0000 1.10 @@ -663,7 +663,7 @@ if (data.state &CMPI_nullValue) { sb->ft->appendChars(sb, "<PROPERTY.REFERENCE NAME=\""); sb->ft->appendChars(sb, (char*)name->hdl); - sb->ft->appendChars(sb, "\"</PROPERTY.REFERENCE>\n"); + sb->ft->appendChars(sb, "\"></PROPERTY.REFERENCE>\n"); } else data2xml(&data,cls,name,"<PROPERTY.REFERENCE NAME=\"", "</PROPERTY.REFERENCE>\n", sb, qsb, 0,0); |
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31176 Added Files: AUTHORS COPYING ChangeLog Makefile.am NEWS README autoconfiscate.sh configure.ac Removed Files: Makefile rules setting.cmpi ylwrap Log Message: Autoconf/make enabled. --- ylwrap DELETED --- --- NEW FILE: ChangeLog --- --- rules DELETED --- --- NEW FILE: AUTHORS --- --- Makefile DELETED --- --- NEW FILE: configure.ac --- # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(sblim-sfcc, 0.5, sbl...@li...) AC_CONFIG_SRCDIR([args.c]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE # Checks for programs. AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_YACC # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([malloc.h stddef.h stdlib.h string.h sys/time.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM # Checks for libraries AC_CHECK_LIB(curl,curl_easy_init) # Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_ERROR_AT_LINE AC_FUNC_MALLOC AC_FUNC_MKTIME AC_FUNC_REALLOC AC_FUNC_STRFTIME AC_CHECK_FUNCS([gettimeofday localtime_r memset strcasecmp strdup strncasecmp strstr tzset]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT --- NEW FILE: Makefile.am --- # $Id: Makefile.am,v 1.1 2005/06/20 17:04:30 mihajlov Exp $ AM_LFLAGS=-i AM_YFLAGS=-d BUILT_SOURCES=cimXmlResp.h noinst_HEADERS=cimXmlParser.h cmcidt.h cmcift.h cmci.h cmcimacs.h \ genericlist.h native.h tool.h utilList.h utilStringBuffer.h lib_LTLIBRARIES=libcmpisfcc.la libcmpisfcc_la_SOURCES=args.c \ array.c \ datetime.c \ enumeration.c \ instance.c \ constClass.c \ objectpath.c \ property.c \ qualifier.c \ string.c \ value.c \ client.c \ utilStringBuffer.c \ genericlist.c \ cimXmlResp.y \ cimXmlParser.c noinst_PROGRAMS=test test_SOURCES = test.c test_LDADD = -lcmpisfcc --- NEW FILE: autoconfiscate.sh --- #!/bin/sh aclocal && autoheader && libtoolize && automake -af && autoconf --- NEW FILE: COPYING --- Common Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. --- setting.cmpi DELETED --- --- NEW FILE: README --- CVS Instructions: ----------------- If you checkout from CVS run autoconfiscate.sh to prepare for building. --- NEW FILE: NEWS --- |
From: Viktor M. <mih...@us...> - 2005-06-20 16:19:30
|
Update of /cvsroot/sblim/cmpi-samples/autotools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7803 Modified Files: acinclude.m4 Log Message: Added missing internal macro. Index: acinclude.m4 =================================================================== RCS file: /cvsroot/sblim/cmpi-samples/autotools/acinclude.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- acinclude.m4 12 May 2005 15:10:07 -0000 1.5 +++ acinclude.m4 20 Jun 2005 16:19:21 -0000 1.6 @@ -323,6 +323,30 @@ dnl Modifies the CPPFLAGS with the right include directory and sets dnl the 'have_SBLIMBASE' to either 'no' or 'yes' dnl +AC_DEFUN([_CHECK_SBLIM_BASE], + [ + AC_MSG_CHECKING($1) + _ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS -lcmpiOSBase_Common" + AC_TRY_LINK( + [ + #include <OSBase_Common.h> + ], + [ + get_system_name(); + ], + [ + have_SBLIMBASE=yes + LDFLAGS=$_ldflags + dnl AC_MSG_RESULT(yes) + ], + [ + have_SBLIMBASE=no + LDFLAGS=$_ldflags + dnl AC_MSG_RESULT(no) + ]) + +]) AC_DEFUN([CHECK_SBLIM_BASE], [ |
From: Adrian S. <a3s...@us...> - 2005-06-20 15:17:28
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5277 Modified Files: cimXmlResp.c cimXmlResp.y test.c Log Message: Removed trace from cimXmlResp.y Fixed getClass test in test.c Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- test.c 20 Jun 2005 15:04:18 -0000 1.10 +++ test.c 20 Jun 2005 15:17:02 -0000 1.11 @@ -68,7 +68,9 @@ for (i=0; i<numproperties; i++) { CMPIString * propertyname; CMPIData data = class->ft->getPropertyAt(class, i, &propertyname, NULL); - printf("\t%s=%s\n", (char *)propertyname->hdl, value2Chars(data.type, &data.value)); + if (data.state==0) + printf("\t%s=%s\n", (char *)propertyname->hdl, value2Chars(data.type, &data.value)); + else printf("\t%s=NIL\n", (char *)propertyname->hdl); } } @@ -128,7 +130,7 @@ if (objectpath) CMRelease(objectpath); } - if (0) { + if (1) { /* Test getClass() */ printf("\n----------------------------------------------------------\n"); printf("Testing getClass() ...\n"); @@ -141,7 +143,7 @@ printf("result:\n"); showClass(class); } - if (instance) CMRelease(instance); + if (class) CMRelease(class); if (objectpath) CMRelease(objectpath); } Index: cimXmlResp.y =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlResp.y,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- cimXmlResp.y 20 Jun 2005 15:04:18 -0000 1.4 +++ cimXmlResp.y 20 Jun 2005 15:17:02 -0000 1.5 @@ -566,7 +566,7 @@ simpleArrayAdd(PARM->respHdr.rvArray,(CMPIValue*)&PARM->curInstance,CMPI_instance); PARM->curInstance=NULL; } - | objectsWithPath objectWithPath + | objectsWithPath objectWithPath { PARM->curInstance=native_new_CMPIInstance(NULL,NULL); setInstNsAndCn(PARM->curInstance,PARM->nameSpace,$2.instance.className); @@ -953,14 +953,12 @@ $$.bindings.next=0; $$.bindings.keyBindings=NULL; PARM->curPath=NULL; - fprintf(stderr,"### instanceName 0\n"); } | XTOK_INSTANCENAME keyBindings ZTOK_INSTANCENAME { $$.className=$1.className; $$.bindings=$2; createPath(&(PARM->curPath), &$$); - fprintf(stderr,"### instanceName 1\n"); } ; Index: cimXmlResp.c =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlResp.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- cimXmlResp.c 20 Jun 2005 15:04:18 -0000 1.4 +++ cimXmlResp.c 20 Jun 2005 15:17:02 -0000 1.5 @@ -698,7 +698,7 @@ 696, 708, 709, 714, 727, 731, 735, 742, 743, 747, 753, 758, 782, 789, 796, 804, 809, 824, 826, 831, 839, 850, 854, 868, 875, 879, 892, 900, 906, 950, - 958, 968, 978, 989, 995 + 957, 966, 976, 987, 993 }; #endif @@ -2001,22 +2001,20 @@ yyval.xtokInstanceName.bindings.next=0; yyval.xtokInstanceName.bindings.keyBindings=NULL; PARM->curPath=NULL; - fprintf(stderr,"### instanceName 0\n"); } break; case 70: -#line 959 "cimXmlResp.y" +#line 958 "cimXmlResp.y" { yyval.xtokInstanceName.className=yyvsp[-2].xtokInstanceName.className; yyval.xtokInstanceName.bindings=yyvsp[-1].xtokKeyBindings; createPath(&(PARM->curPath), &yyval.xtokInstanceName); - fprintf(stderr,"### instanceName 1\n"); } break; case 71: -#line 969 "cimXmlResp.y" +#line 967 "cimXmlResp.y" { yyval.xtokKeyBindings.next=1; yyval.xtokKeyBindings.max=16; @@ -2029,7 +2027,7 @@ break; case 72: -#line 979 "cimXmlResp.y" +#line 977 "cimXmlResp.y" { yyval.xtokKeyBindings.keyBindings[yyval.xtokKeyBindings.next].name=yyvsp[0].xtokKeyBinding.name; yyval.xtokKeyBindings.keyBindings[yyval.xtokKeyBindings.next].value=yyvsp[0].xtokKeyBinding.value; @@ -2040,7 +2038,7 @@ break; case 73: -#line 990 "cimXmlResp.y" +#line 988 "cimXmlResp.y" { yyval.xtokKeyBinding.name=yyvsp[-3].xtokKeyBinding.name; yyval.xtokKeyBinding.value=yyvsp[-2].xtokKeyValue.value; @@ -2049,7 +2047,7 @@ break; case 74: -#line 996 "cimXmlResp.y" +#line 994 "cimXmlResp.y" { yyval.xtokKeyBinding.name=yyvsp[-2].xtokKeyBinding.name; yyval.xtokKeyBinding.value=NULL; @@ -2062,7 +2060,7 @@ } /* Line 999 of yacc.c. */ -#line 2065 "cimXmlResp.c" +#line 2063 "cimXmlResp.c" yyvsp -= yylen; yyssp -= yylen; @@ -2256,6 +2254,6 @@ } -#line 1004 "cimXmlResp.y" +#line 1002 "cimXmlResp.y" |
From: Adrian S. <a3s...@us...> - 2005-06-20 15:04:28
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30283 Modified Files: cimXmlParser.c cimXmlParser.h cimXmlResp.c cimXmlResp.h cimXmlResp.y client.c test.c Log Message: Added VALUE.OBJECTWITHPATH support for execQuery Fixed some problems in test.c Index: cimXmlParser.h =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlParser.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cimXmlParser.h 13 Jun 2005 23:50:46 -0000 1.2 +++ cimXmlParser.h 20 Jun 2005 15:04:18 -0000 1.3 @@ -143,8 +143,6 @@ } XtokKeyBinding; - - typedef struct xtokQualifier { struct xtokQualifier *next; char *name; @@ -200,6 +198,11 @@ XtokInstance instance; } XtokNamedInstance; +typedef struct xtokObjectWithPath { + XtokInstancePath path; + XtokInstance instance; +} XtokObjectWithPath; + typedef struct xtokPropertyList { XtokValueArray list; } XtokPropertyList; Index: cimXmlResp.c =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlResp.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cimXmlResp.c 13 Jun 2005 23:50:46 -0000 1.3 +++ cimXmlResp.c 20 Jun 2005 15:04:18 -0000 1.4 @@ -118,14 +118,16 @@ ZTOK_CLASS = 320, XTOK_INSTANCE = 321, ZTOK_INSTANCE = 322, - XTOK_PARAMVALUE = 323, - ZTOK_PARAMVALUE = 324, - XTOK_INSTANCEPATH = 325, - ZTOK_INSTANCEPATH = 326, - XTOK_LOCALINSTANCEPATH = 327, - ZTOK_LOCALINSTANCEPATH = 328, - XTOK_LOCALCLASSPATH = 329, - ZTOK_LOCALCLASSPATH = 330 [...1082 lines suppressed...] { yyval.xtokKeyBinding.name=yyvsp[-2].xtokKeyBinding.name; yyval.xtokKeyBinding.value=NULL; @@ -2013,7 +2062,7 @@ } /* Line 999 of yacc.c. */ -#line 2016 "cimXmlResp.c" +#line 2065 "cimXmlResp.c" yyvsp -= yylen; yyssp -= yylen; @@ -2207,6 +2256,6 @@ } -#line 961 "cimXmlResp.y" +#line 1004 "cimXmlResp.y" Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- client.c 20 Jun 2005 06:05:32 -0000 1.13 +++ client.c 20 Jun 2005 15:04:18 -0000 1.14 @@ -864,12 +864,13 @@ return NULL; } - if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_ref) { + int rv; + if ((rv=rh.rvArray->ft->getSimpleType(rh.rvArray,NULL)) == CMPI_instance) { CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray,NULL); CMSetStatus(rc, CMPI_RC_OK); return enm; } - + fprintf(stderr,"rv: %x %d\n",rv,rv); CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); return NULL; } Index: cimXmlParser.c =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlParser.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cimXmlParser.c 13 Jun 2005 23:50:46 -0000 1.2 +++ cimXmlParser.c 20 Jun 2005 15:04:18 -0000 1.3 @@ -737,6 +737,21 @@ return 0; } +static int procValueObjectWithPath(YYSTYPE * lvalp, ParserControl * parm) +{ + static XmlElement elm[] = { + {NULL} + }; + XmlAttr attr[1]; + if (tagEquals(parm->xmb, "VALUE.OBJECTWITHPATH")) { + if (attrsOk(parm->xmb, elm, attr, "VALUE.OBJECTWITHPATH", + XTOK_VALUEOBJECTWITHPATH)) { + return XTOK_VALUEOBJECTWITHPATH; + } + } + return 0; +} + static int procQualifier(YYSTYPE * lvalp, ParserControl * parm) { static XmlElement elm[] = { {"NAME"}, @@ -1050,6 +1065,7 @@ {"VALUE.ARRAY", procValueArray, ZTOK_VALUEARRAY}, {"VALUE.NAMEDINSTANCE", procValueNamedInstance, ZTOK_VALUENAMEDINSTANCE}, {"VALUE.REFERENCE", procValueReference, ZTOK_VALUEREFERENCE}, + {"VALUE.OBJECTWITHPATH", procValueObjectWithPath, ZTOK_VALUEOBJECTWITHPATH}, {"VALUE", procValue, ZTOK_VALUE}, {"HOST", procHost, ZTOK_HOST}, {"KEYVALUE", procKeyValue, ZTOK_KEYVALUE}, Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- test.c 20 Jun 2005 06:04:52 -0000 1.9 +++ test.c 20 Jun 2005 15:04:18 -0000 1.10 @@ -418,12 +418,12 @@ enumeration = cc->ft->execQuery(cc, objectpath, query, "WQL", &status); /* Print the results */ - printf("enumInstanceNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + printf("execQuery() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); if (!status.rc) { printf("result(s):\n"); while (enumeration->ft->hasNext(enumeration, NULL)) { CMPIData data = enumeration->ft->getNext(enumeration, NULL); - showObjectPath(data.value.ref); + showInstance(data.value.inst); } } if (enumeration) CMRelease(enumeration); Index: cimXmlResp.h =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlResp.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cimXmlResp.h 13 Jun 2005 23:50:46 -0000 1.3 +++ cimXmlResp.h 20 Jun 2005 15:04:18 -0000 1.4 @@ -94,14 +94,16 @@ ZTOK_CLASS = 320, XTOK_INSTANCE = 321, ZTOK_INSTANCE = 322, - XTOK_PARAMVALUE = 323, - ZTOK_PARAMVALUE = 324, - XTOK_INSTANCEPATH = 325, - ZTOK_INSTANCEPATH = 326, - XTOK_LOCALINSTANCEPATH = 327, - ZTOK_LOCALINSTANCEPATH = 328, - XTOK_LOCALCLASSPATH = 329, - ZTOK_LOCALCLASSPATH = 330 + XTOK_VALUEOBJECTWITHPATH = 323, + ZTOK_VALUEOBJECTWITHPATH = 324, + XTOK_PARAMVALUE = 325, + ZTOK_PARAMVALUE = 326, + XTOK_INSTANCEPATH = 327, + ZTOK_INSTANCEPATH = 328, + XTOK_LOCALINSTANCEPATH = 329, + ZTOK_LOCALINSTANCEPATH = 330, + XTOK_LOCALCLASSPATH = 331, + ZTOK_LOCALCLASSPATH = 332 }; #endif #define XTOK_XML 258 @@ -169,14 +171,16 @@ #define ZTOK_CLASS 320 #define XTOK_INSTANCE 321 #define ZTOK_INSTANCE 322 -#define XTOK_PARAMVALUE 323 -#define ZTOK_PARAMVALUE 324 -#define XTOK_INSTANCEPATH 325 -#define ZTOK_INSTANCEPATH 326 -#define XTOK_LOCALINSTANCEPATH 327 -#define ZTOK_LOCALINSTANCEPATH 328 -#define XTOK_LOCALCLASSPATH 329 -#define ZTOK_LOCALCLASSPATH 330 +#define XTOK_VALUEOBJECTWITHPATH 323 +#define ZTOK_VALUEOBJECTWITHPATH 324 +#define XTOK_PARAMVALUE 325 +#define ZTOK_PARAMVALUE 326 +#define XTOK_INSTANCEPATH 327 +#define ZTOK_INSTANCEPATH 328 +#define XTOK_LOCALINSTANCEPATH 329 +#define ZTOK_LOCALINSTANCEPATH 330 +#define XTOK_LOCALCLASSPATH 331 +#define ZTOK_LOCALCLASSPATH 332 @@ -203,7 +207,7 @@ XtokValue xtokValue; XtokValueArray xtokValueArray; XtokValueReference xtokValueReference; - + XtokObjectWithPath xtokObjectWithPath; XtokInstanceName xtokInstanceName; XtokKeyBinding xtokKeyBinding; XtokKeyBindings xtokKeyBindings; @@ -224,7 +228,7 @@ XtokParam xtokParam; } YYSTYPE; /* Line 1240 of yacc.c. */ -#line 227 "cimXmlResp.h" +#line 231 "cimXmlResp.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 Index: cimXmlResp.y =================================================================== RCS file: /cvsroot/sblim/sfcc/cimXmlResp.y,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cimXmlResp.y 13 Jun 2005 23:50:46 -0000 1.3 +++ cimXmlResp.y 20 Jun 2005 15:04:18 -0000 1.4 @@ -238,7 +238,7 @@ XtokValue xtokValue; XtokValueArray xtokValueArray; XtokValueReference xtokValueReference; - + XtokObjectWithPath xtokObjectWithPath; XtokInstanceName xtokInstanceName; XtokKeyBinding xtokKeyBinding; XtokKeyBindings xtokKeyBindings; @@ -384,6 +384,10 @@ %type <xtokInstance> instance %type <xtokInstanceData> instanceData +%token <xtokObjectWithPath> XTOK_VALUEOBJECTWITHPATH +%token <intValue> ZTOK_VALUEOBJECTWITHPATH +%type <xtokObjectWithPath> objectWithPath + //%type <xtokParamValue> paramValue %token <xtokParamValue> XTOK_PARAMVALUE %token <intValue> ZTOK_PARAMVALUE @@ -469,9 +473,6 @@ | XTOK_IRETVALUE valueObjectsWithPath ZTOK_IRETVALUE { } - | XTOK_IRETVALUE valueObjectsWithPath ZTOK_IRETVALUE - { - } | XTOK_IRETVALUE valueObjectsWithLocalPath ZTOK_IRETVALUE { } @@ -487,6 +488,9 @@ | XTOK_IRETVALUE valueRef ZTOK_IRETVALUE { } */ + | XTOK_IRETVALUE objectsWithPath ZTOK_IRETVALUE + { + } | XTOK_IRETVALUE classes ZTOK_IRETVALUE { } @@ -497,7 +501,9 @@ { } */ ; - + + + classes : /* empty */ | class @@ -521,7 +527,7 @@ | instance { PARM->curInstance=native_new_CMPIInstance(NULL,NULL); - setInstNsAndCn(PARM->curInstance,$1.className,PARM->nameSpace); + setInstNsAndCn(PARM->curInstance,PARM->nameSpace,$1.className); setInstProperties(PARM->curInstance,&PARM->properties); simpleArrayAdd(PARM->respHdr.rvArray,(CMPIValue*)&PARM->curInstance,CMPI_instance); PARM->curInstance=NULL; @@ -529,7 +535,7 @@ | instances instance { PARM->curInstance=native_new_CMPIInstance(NULL,NULL); - setInstNsAndCn(PARM->curInstance,$2.className,PARM->nameSpace); + setInstNsAndCn(PARM->curInstance,PARM->nameSpace,$2.className); simpleArrayAdd(PARM->respHdr.rvArray,(CMPIValue*)&PARM->curInstance,CMPI_instance); PARM->curInstance=NULL; } @@ -544,12 +550,32 @@ } | instanceNames instanceName { - setInstNsAndCn(PARM->curInstance,$2.className,PARM->nameSpace); +// setInstNsAndCn(PARM->curInstance,PARM->nameSpace,$2.className); simpleArrayAdd(PARM->respHdr.rvArray,(CMPIValue*)&PARM->curPath,CMPI_ref); PARM->curPath=NULL; } ; +objectsWithPath + : /* empty */ + | objectWithPath + { + PARM->curInstance=native_new_CMPIInstance(NULL,NULL); + setInstNsAndCn(PARM->curInstance,PARM->nameSpace,$1.instance.className); + setInstProperties(PARM->curInstance,&PARM->properties); + simpleArrayAdd(PARM->respHdr.rvArray,(CMPIValue*)&PARM->curInstance,CMPI_instance); + PARM->curInstance=NULL; + } + | objectsWithPath objectWithPath + { + PARM->curInstance=native_new_CMPIInstance(NULL,NULL); + setInstNsAndCn(PARM->curInstance,PARM->nameSpace,$2.instance.className); + simpleArrayAdd(PARM->respHdr.rvArray,(CMPIValue*)&PARM->curInstance,CMPI_instance); + PARM->curInstance=NULL; + } +; + + /* * valueNamedInstance */ @@ -564,6 +590,20 @@ /* + * objectWithPath +*/ + +objectWithPath + : XTOK_VALUEOBJECTWITHPATH instancePath instance ZTOK_VALUEOBJECTWITHPATH + { + $$.path=$2; + $$.instance=$3; + } +; + + + +/* * class */ @@ -900,6 +940,7 @@ ; + /* * instanceName */ @@ -912,12 +953,14 @@ $$.bindings.next=0; $$.bindings.keyBindings=NULL; PARM->curPath=NULL; + fprintf(stderr,"### instanceName 0\n"); } | XTOK_INSTANCENAME keyBindings ZTOK_INSTANCENAME { $$.className=$1.className; $$.bindings=$2; createPath(&(PARM->curPath), &$$); + fprintf(stderr,"### instanceName 1\n"); } ; |
From: Adrian S. <a3s...@us...> - 2005-06-20 13:09:54
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2704 Modified Files: httpAdapter.c httpComm.c sfcBroker.c trace.c trace.h Log Message: sfcbd now supports hex input for the -tm parameter. -tm ? now lists trace maks numbers as decimal and hex numbers sfcbd now support TRACE_XMLIN (0x01000) and TRACE_XMLOUT (0x02000) Index: trace.c =================================================================== RCS file: /cvsroot/sblim/sfcb/trace.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- trace.c 21 May 2005 22:02:41 -0000 1.4 +++ trace.c 20 Jun 2005 13:09:44 -0000 1.5 @@ -61,6 +61,8 @@ {"indProvider", TRACE_INDPROVIDER}, {"internalProvider", TRACE_INTERNALPROVIDER}, {"objectImpl", TRACE_OBJECTIMPL}, + {"xmlIn", TRACE_XMLIN}, + {"xmlOut", TRACE_XMLOUT}, {"sockets", TRACE_SOCKETS}, {"memoryMgr", TRACE_MEMORYMGR}, {"msgQueue", TRACE_MSGQUEUE}, Index: trace.h =================================================================== RCS file: /cvsroot/sblim/sfcb/trace.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- trace.h 3 Jun 2005 10:31:57 -0000 1.5 +++ trace.h 20 Jun 2005 13:09:44 -0000 1.6 @@ -110,11 +110,13 @@ #define TRACE_INDPROVIDER 512 #define TRACE_INTERNALPROVIDER 1024 #define TRACE_OBJECTIMPL 2048 -#define TRACE_SOCKETS 4096 -#define TRACE_MEMORYMGR 8192 -#define TRACE_MSGQUEUE 16384 -#define TRACE_XMLPARSING 32768 -#define TRACE_DBPDAEMON 65536 +#define TRACE_XMLIN 4096 +#define TRACE_XMLOUT 8192 +#define TRACE_SOCKETS 16384 +#define TRACE_MEMORYMGR 32768 +#define TRACE_MSGQUEUE 65536 +#define TRACE_XMLPARSING 131072 +#define TRACE_DBPDAEMON 262144 typedef void sigHandler(int); Index: sfcBroker.c =================================================================== RCS file: /cvsroot/sblim/sfcb/sfcBroker.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- sfcBroker.c 14 Jun 2005 11:42:04 -0000 1.15 +++ sfcBroker.c 20 Jun 2005 13:09:44 -0000 1.16 @@ -378,15 +378,17 @@ if (*argv[i+1]=='?') { fprintf(stdout,"--- -tm values:\n"); for (i=0; traceIds[i].id; i++) - fprintf(stdout,"--- \t%18s: %d\n",traceIds[i].id,traceIds[i].code); + fprintf(stdout,"--- \t%18s: %d\t0x%05X\n",traceIds[i].id,traceIds[i].code,traceIds[i].code); exit(1); } if (isdigit(*argv[i + 1])) { - tmask = atoi(argv[++i]); + char *ep; + tmask = strtol(argv[++i], &ep, 0); +// tmask = atoi(argv[++i]); } } else if (strcmp(argv[i], "-c") == 0 && i<(argc-1)) { - configfile = strdup(argv[++i]); + configfile = strdup(argv[++i]); } else if (strcmp(argv[i], "-F") == 0); else if (strcmp(argv[i], "-nF") == 0); Index: httpComm.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpComm.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- httpComm.c 9 Mar 2005 12:25:12 -0000 1.1.1.1 +++ httpComm.c 20 Jun 2005 13:09:44 -0000 1.2 @@ -60,6 +60,14 @@ _SFCB_ENTER(TRACE_HTTPDAEMON, "commWrite"); +#ifdef SFCB_DEBUG + if ((_sfcb_trace_mask & TRACE_XMLOUT) ) { + fprintf(stderr,"-#- xmlOut %d bytes:\n%*s",count,count,(char*)data); + if (*(((char*)data)+count-1)!='\n') fprintf(stderr,"\n"); + fprintf(stderr,"-#- xmlOut end\n"); + } +#endif + #if defined USE_SSL if (to.ssl) { rc = SSL_write(to.ssl, data, count); Index: httpAdapter.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpAdapter.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- httpAdapter.c 14 Jun 2005 11:42:04 -0000 1.11 +++ httpAdapter.c 20 Jun 2005 13:09:34 -0000 1.12 @@ -686,6 +686,16 @@ CimXmlRequestContext ctx = { inBuf.content, inBuf.principle, inBuf.host, len - hl, &conn_fd }; ctx.chunkFncs=&httpChunkFunctions; + +#ifdef SFCB_DEBUG + if ((_sfcb_trace_mask & TRACE_XMLIN) ) { + fprintf(stderr,"-#- xmlIn %d bytes:\n%*s",inBuf.content_length, + inBuf.content_length,(char*)inBuf.content); + if (*(((char*)inBuf.content)+inBuf.content_length-1)!='\n') fprintf(stderr,"\n"); + fprintf(stderr,"-#- xmlIn end\n"); + } +#endif + response = handleCimXmlRequest(&ctx); } free(hdr); |
From: Viktor M. <mih...@us...> - 2005-06-20 08:56:38
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26151 Modified Files: classProvider.c Log Message: Bugs fixed: 1222699 Fixed Repository Directory Recognition. Index: classProvider.c =================================================================== RCS file: /cvsroot/sblim/sfcb/classProvider.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- classProvider.c 13 Jun 2005 23:37:31 -0000 1.15 +++ classProvider.c 20 Jun 2005 08:56:30 -0000 1.16 @@ -384,7 +384,7 @@ static UtilHashTable *gatherNameSpaces(char *dn, UtilHashTable *ns, int first) { DIR *dir; - struct dirent *de; + struct dirent *de, *de_test; char *n; int l; ClassRegister *cr; @@ -397,20 +397,24 @@ dir=opendir(dn); if (dir) while ((de=readdir(dir))!=NULL) { - if (de->d_type==DT_DIR) { - if (strcmp(de->d_name,".")==0) continue; - if (strcmp(de->d_name,"..")==0) continue; - l=strlen(dn)+strlen(de->d_name)+4; - n=(char*)malloc(l+8); - strcpy(n,dn); - strcat(n,"/"); - strcat(n,de->d_name); - cr=newClassRegister(n); - if (cr) { - ns->ft->put(ns, n+nsBaseLen, cr); - gatherNameSpaces(n,ns,0); - } - } + if (strcmp(de->d_name,".")==0) continue; + if (strcmp(de->d_name,"..")==0) continue; + l=strlen(dn)+strlen(de->d_name)+4; + n=(char*)malloc(l+8); + strcpy(n,dn); + strcat(n,"/"); + strcat(n,de->d_name); + de_test = opendir(n); + if (de_test == NULL) { + free(n); + continue; + } + free(de_test); + cr=newClassRegister(n); + if (cr) { + ns->ft->put(ns, n+nsBaseLen, cr); + gatherNameSpaces(n,ns,0); + } } else if (first) { mlogf(M_ERROR,M_SHOW,"--- Repository %s not found\n",dn); |
From: Viktor M. <mih...@us...> - 2005-06-20 08:54:44
|
Update of /cvsroot/sblim/cmpi-base In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25542 Modified Files: ChangeLog NEWS OSBase_Common.c Log Message: Bugs fixed: 1222571 Segmentation Fault on long process command lines. Index: OSBase_Common.c =================================================================== RCS file: /cvsroot/sblim/cmpi-base/OSBase_Common.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- OSBase_Common.c 6 Apr 2005 15:17:33 -0000 1.13 +++ OSBase_Common.c 20 Jun 2005 08:54:36 -0000 1.14 @@ -409,6 +409,23 @@ static void addstring(char *** buf, const char * str) { int i=0; + size_t s; + while ((*buf)[i++] != NULL); + s = i == 1 ? 0 : strlen((*buf)[i-2]); + if (i == 1 || (*buf)[i-2][s-1] == '\n') { + *buf=realloc(*buf,(i+1)*sizeof(char*)); + (*buf)[i-1] = strdup(str); + (*buf)[i] = NULL; + } else { + fprintf(stderr, "******* append (%s)\n", str); + (*buf)[i-2]=realloc((*buf)[i-2],s + strlen(str) + 1); + strcpy((*buf)[i-2] + s, str); + } +} + +static void addstring_noconc(char *** buf, const char * str) +{ + int i=0; while ((*buf)[i++] != NULL); *buf=realloc(*buf,(i+1)*sizeof(char*)); (*buf)[i-1] = strdup(str); @@ -449,11 +466,11 @@ while( ( ptr = strchr( ent , c )) != NULL ) { *ptr='\0'; - addstring( &data , ent ); + addstring_noconc( &data , ent ); ent = ptr+1; ptr = NULL ; } - addstring( &data , ent ); + addstring_noconc( &data , ent ); if(str) free(str); return data; Index: ChangeLog =================================================================== RCS file: /cvsroot/sblim/cmpi-base/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChangeLog 7 Jun 2005 13:12:42 -0000 1.10 +++ ChangeLog 20 Jun 2005 08:54:36 -0000 1.11 @@ -1,3 +1,9 @@ +2005-06-20 <mih...@dy...> + + * OSBase_Common.c: + Bug 1222571: Changed addstring to support lines longer than 4K and + added new function addstring_noconc for lines not ending in newlines. + 2005-06-07 <mihajlov@localhost.localdomain> * mof/Linux_BaseIndication.registration: Index: NEWS =================================================================== RCS file: /cvsroot/sblim/cmpi-base/NEWS,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- NEWS 7 Jun 2005 13:12:42 -0000 1.6 +++ NEWS 20 Jun 2005 08:54:36 -0000 1.7 @@ -1,3 +1,10 @@ +Changes in 1.5.3 +================ + +Bugs Fixed: +- 1222571 Fixed segmentation fault on long process command lines. + + Changes in 1.5.2 ================ |
From: Gareth S B. <bes...@us...> - 2005-06-20 06:07:35
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1067 Modified Files: Makefile Log Message: need to build test.c with value.c Index: Makefile =================================================================== RCS file: /cvsroot/sblim/sfcc/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 13 Jun 2005 23:50:46 -0000 1.2 +++ Makefile 20 Jun 2005 06:07:27 -0000 1.3 @@ -10,7 +10,8 @@ LIBRARIES = libCmpiSfcc.so BINARIES = test -SOURCES.test = test.c +SOURCES.test = test.c \ + value.c SOURCES.CmpiSfcc = args.c \ array.c \ |
From: Gareth S B. <bes...@us...> - 2005-06-20 06:05:42
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32363 Modified Files: client.c Log Message: added execquery support Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- client.c 20 Jun 2005 05:07:23 -0000 1.12 +++ client.c 20 Jun 2005 06:05:32 -0000 1.13 @@ -61,6 +61,8 @@ }; #define NUM_HEADERS ((sizeof(headers))/(sizeof(headers[0]))) +/* --------------------------------------------------------------------------*/ + static char *getErrorMessage(CURLcode err) { static char error[128]; @@ -72,6 +74,8 @@ #endif } +/* --------------------------------------------------------------------------*/ + void list2StringBuffer(UtilStringBuffer *sb, UtilList *ul, char *sep) { void *e; @@ -81,6 +85,8 @@ } } +/* --------------------------------------------------------------------------*/ + static size_t writeCb(void *ptr, size_t size, size_t nmemb, void *stream) { UtilStringBuffer *sb=(UtilStringBuffer*)stream; @@ -89,6 +95,8 @@ return length; } +/* --------------------------------------------------------------------------*/ + static char *addPayload(CMCIConnection *con, UtilStringBuffer *pl) { // con->mBody = pl; @@ -104,6 +112,8 @@ else return NULL; } +/* --------------------------------------------------------------------------*/ + static char* genRequest(ClientEnc *cle, char *op, CMPIObjectPath *cop, int cls, int keys) { CMCIConnection *con=cle->connection; @@ -178,6 +188,8 @@ return NULL; } +/* --------------------------------------------------------------------------*/ + char *getResponse(CMCIConnection *con, CMPIObjectPath *cop) { CURLcode rv; @@ -203,6 +215,8 @@ return NULL; } +/* --------------------------------------------------------------------------*/ + static void initializeHeaders(CMCIConnection *con) { unsigned int i; @@ -361,6 +375,7 @@ } /* --------------------------------------------------------------------------*/ +/* --------------------------------------------------------------------------*/ /* Finished & working */ static CMPIEnumeration * enumInstanceNames( @@ -777,16 +792,86 @@ /* --------------------------------------------------------------------------*/ -/* unfinished */ +/* finish but not working - scanCimXmlResponse fails parsing results */ static CMPIEnumeration * execQuery( - CMCIClient * cl, - CMPIObjectPath * op, + CMCIClient * mb, + CMPIObjectPath * cop, const char * query, const char * lang, CMPIStatus * rc) +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="ExecQuery"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="QueryLanguage"> + <VALUE>WQL</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="Query"> + <VALUE>select * from Linux_ComputerSystem where PrimaryOwnerName="root"</VALUE> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ { - CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); - return NULL; + ClientEnc *cl = (ClientEnc *)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb = newStringBuffer(2048); + char *error; + ResponseHdr rh; + + con->ft->genRequest(cl, "ExecQuery", cop, 0, 0); + + addXmlHeader(sb); + + sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"ExecQuery\">"); + + addXmlNamespace(sb, getNameSpaceComponents(cop)); + + /* Add the query language */ + sb->ft->append3Chars(sb, + "<IPARAMVALUE NAME=\"QueryLanguage\">\n<VALUE>", + lang, "</VALUE>\n</IPARAMVALUE>"); + + /* Add the query */ + sb->ft->append3Chars(sb, + "<IPARAMVALUE NAME=\"Query\">\n<VALUE>", + query, "</VALUE>\n</IPARAMVALUE>"); + + sb->ft->appendChars(sb,"</IMETHODCALL>\n"); + addXmlFooter(sb); + +// fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); + + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + return NULL; + } +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); + + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); + return NULL; + } + + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_ref) { + CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray,NULL); + CMSetStatus(rc, CMPI_RC_OK); + return enm; + } + + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); + return NULL; } /* --------------------------------------------------------------------------*/ @@ -845,7 +930,7 @@ return enm; } - CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); return NULL; } |
From: Gareth S B. <bes...@us...> - 2005-06-20 06:05:00
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31923 Modified Files: test.c Log Message: added execquery test Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- test.c 20 Jun 2005 05:07:44 -0000 1.8 +++ test.c 20 Jun 2005 06:04:52 -0000 1.9 @@ -386,7 +386,7 @@ if (objectpath) CMRelease(objectpath); } - if (1) { + if (0) { /* Test invokeMethod() */ printf("\n----------------------------------------------------------\n"); printf("Testing invokeMethod() ...\n"); @@ -409,5 +409,26 @@ if (objectpath) CMRelease(objectpath); } + if (1) { + /* Test execQuery() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing execQuery() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + char * query = "select * from Linux_ComputerSystem where PrimaryOwnerName=\"root\""; + enumeration = cc->ft->execQuery(cc, objectpath, query, "WQL", &status); + + /* Print the results */ + printf("enumInstanceNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showObjectPath(data.value.ref); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + return 0; } |
From: Gareth S B. <bes...@us...> - 2005-06-20 06:04:38
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31786 Modified Files: native.h Log Message: added omitted #define newCMPIArgs native_new_CMPIArgs Index: native.h =================================================================== RCS file: /cvsroot/sblim/sfcc/native.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- native.h 13 Jun 2005 23:50:46 -0000 1.2 +++ native.h 20 Jun 2005 06:04:27 -0000 1.3 @@ -192,6 +192,7 @@ #define newCMPIInstance native_new_CMPIInstance #define newCMPIArray native_new_CMPIArray #define newCMPIEnumeration native_new_CMPIEnumeration +#define newCMPIArgs native_new_CMPIArgs /****************************************************************************/ struct native_propertyFT propertyFT; |
From: Gareth S B. <bes...@us...> - 2005-06-20 06:03:35
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31482 Modified Files: value.c Log Message: fix for http://sourceforge.net/tracker/index.php?func=detail&aid=1223726&group_id=128809&atid=712784 Index: value.c =================================================================== RCS file: /cvsroot/sblim/sfcc/value.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- value.c 4 May 2005 18:20:08 -0000 1.1 +++ value.c 20 Jun 2005 06:03:23 -0000 1.2 @@ -332,6 +332,9 @@ } switch (type) { + case CMPI_char16: + value.char16 = *val; + break; case CMPI_chars: value.char16 = *val; break; |
From: Gareth S B. <bes...@us...> - 2005-06-20 05:07:52
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4694 Modified Files: test.c Log Message: added test for invokemethod Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- test.c 20 Jun 2005 03:40:05 -0000 1.7 +++ test.c 20 Jun 2005 05:07:44 -0000 1.8 @@ -386,5 +386,28 @@ if (objectpath) CMRelease(objectpath); } + if (1) { + /* Test invokeMethod() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing invokeMethod() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "CWS_Authorization", NULL); + CMAddKey(objectpath, "Username", "bestorga", CMPI_chars); + CMAddKey(objectpath, "Classname", "CIM_OperatingSystem", CMPI_chars); + CMPIArgs * argsin = newCMPIArgs(NULL); + CMPIValue value; + value.string = newCMPIString("Query", NULL); + argsin->ft->addArg(argsin, "operation", &value, CMPI_string); + CMPIData data = cc->ft->invokeMethod(cc, objectpath, "IsAuthorized", argsin, NULL, &status); + + /* Print the results */ + printf("getProperty() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + printf("PrimaryOwnerName=%s\n", (char*)(data.value.string)->hdl); + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + return 0; } |
From: Gareth S B. <bes...@us...> - 2005-06-20 05:07:31
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4564 Modified Files: client.c Log Message: added invokemethod support (not finished yet) Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- client.c 20 Jun 2005 03:39:10 -0000 1.11 +++ client.c 20 Jun 2005 05:07:23 -0000 1.12 @@ -791,7 +791,7 @@ /* --------------------------------------------------------------------------*/ -/* Finished (& working?) */ +/* Finished but not working - scanCimXmlResponse fails parsing results */ static CMPIEnumeration * enumInstances( CMCIClient * mb, CMPIObjectPath * cop, @@ -1089,7 +1089,7 @@ /* --------------------------------------------------------------------------*/ -/* finished (and working?) */ +/* finished (and working?) test against Pegasus / bug in sfcb prevents rin working */ static CMPIEnumeration * references( CMCIClient * mb, CMPIObjectPath * cop, @@ -1175,7 +1175,7 @@ /* --------------------------------------------------------------------------*/ -/* finished (and working?) */ +/* finished (and working?) test against Pegasus / bug in sfcb prevents rin working */ static CMPIEnumeration * referenceNames( CMCIClient * mb, CMPIObjectPath * cop, @@ -1243,23 +1243,124 @@ /* --------------------------------------------------------------------------*/ -/* unfinished */ +/* almost finished (need to add output arg support) but scanCimXmlResponse segv's parsing results */ static CMPIData invokeMethod( - CMCIClient * cl, - CMPIObjectPath * op, + CMCIClient * mb, + CMPIObjectPath * cop, const char * method, CMPIArgs * in, CMPIArgs * out, CMPIStatus * rc) +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <METHODCALL NAME="IsAuthorized"> + <LOCALINSTANCEPATH> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <INSTANCENAME CLASSNAME="CWS_Authorization"> + <KEYBINDING NAME="Username"> + <KEYVALUE VALUETYPE="string">schuur</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Classname"> + <KEYVALUE VALUETYPE="string">CIM_ComputerSystem</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </LOCALINSTANCEPATH> + <PARAMVALUE NAME="operation"> + <VALUE>Query</VALUE> + </PARAMVALUE> + </METHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ { - CMPIData rv = {CMPI_null, CMPI_notFound}; - CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); - return rv; + ClientEnc *cl = (ClientEnc*)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb=newStringBuffer(2048); + char *error; + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + CMPIData retval; + int i, numinargs = 0; + int numoutargs = 0; + + if (in) numinargs = in->ft->getArgCount(in, NULL); + if (out) numoutargs = out->ft->getArgCount(in, NULL); + + con->ft->genRequest(cl, "InvokeMethod", cop, 0, 0); + + addXmlHeader(sb); + + /* Add the extrinsic method name */ + sb->ft->append3Chars(sb,"<METHODCALL NAME=\"", method, "\">"); + + sb->ft->appendChars(sb,"<LOCALINSTANCEPATH>"); + + addXmlNamespace(sb, getNameSpaceComponents(cop)); + + /* Add the objectpath */ + sb->ft->append3Chars(sb,"<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + pathToXml(sb, cop); + sb->ft->appendChars(sb,"</INSTANCENAME>\n"); + + sb->ft->appendChars(sb,"</LOCALINSTANCEPATH>"); + + /* Add the input parameters */ + for (i=0; i<numinargs; i++) { + CMPIString * argname; + CMPIData argdata = in->ft->getArgAt(in, i, &argname, NULL); + sb->ft->append3Chars(sb,"<PARAMVALUE NAME=\"", argname->hdl, "\">\n"); + sb->ft->append3Chars(sb,"<VALUE>", value2Chars(argdata.type,&(argdata.value)), "</VALUE>\n"); + sb->ft->appendChars(sb,"</PARAMVALUE>\n"); + } + + sb->ft->appendChars(sb,"</METHODCALL>\n"); + addXmlFooter(sb); + +// fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); + + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + retval.state = CMPI_notFound | CMPI_nullValue; + return retval; + } + +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); + retval.state = CMPI_notFound | CMPI_nullValue; + return retval; + } + + /* TODO: process output args */ + /* TODO: check this */ + if ((rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_INTEGER) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_ENC) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_REAL) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_SIMPLE) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_ARRAY) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_ENCA)) { + CMSetStatus(rc, CMPI_RC_OK); + return rh.rvArray->ft->getElementAt(rh.rvArray, 0, NULL); + } + + CMSetStatusWithChars(rc, CMPI_RC_ERR_FAILED, "Unexpected return value"); + retval.state = CMPI_badValue; + return retval; } /* --------------------------------------------------------------------------*/ -/* finished (and working?) */ +/* finished (and working?) - need to test against property provider */ static CMPIStatus setProperty( CMCIClient * mb, CMPIObjectPath * cop, @@ -1358,7 +1459,7 @@ /* --------------------------------------------------------------------------*/ -/* finished (and working?) */ +/* finished (and working?) - need to test against property provider */ static CMPIData getProperty( CMCIClient * mb, CMPIObjectPath * cop, |
From: Gareth S B. <bes...@us...> - 2005-06-20 03:40:14
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28295 Modified Files: test.c Log Message: added tests for associators, associatornames, references, referencenames, setproperty, getproperty. Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- test.c 20 Jun 2005 01:11:11 -0000 1.6 +++ test.c 20 Jun 2005 03:40:05 -0000 1.7 @@ -88,7 +88,7 @@ /* Setup a conncetion to the CIMOM */ cc = cmciConnect("localhost",NULL,NULL,NULL,NULL); - if (0) { + if (1) { /* Test enumClassNames() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumClassNames() ...\n"); @@ -145,7 +145,7 @@ if (objectpath) CMRelease(objectpath); } - if (0) { + if (1) { /* Test enumInstanceNames() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumInstanceNames() ...\n"); @@ -185,7 +185,7 @@ if (objectpath) CMRelease(objectpath); } - if (0) { + if (1) { /* Test getInstance() */ printf("\n----------------------------------------------------------\n"); printf("Testing getInstance() ...\n"); @@ -262,5 +262,129 @@ if (objectpath) CMRelease(objectpath); } + if (0) { + /* Test associators() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing associators() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + enumeration = cc->ft->associators(cc, objectpath, "Linux_RunningOS", NULL, NULL, NULL, 0, NULL, &status); + + /* Print the results */ + printf("associators() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showInstance(data.value.inst); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test associatorNames() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing associatorNames() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + enumeration = cc->ft->associatorNames(cc, objectpath, "Linux_RunningOS", NULL, NULL, NULL, &status); + + /* Print the results */ + printf("associatorNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showObjectPath(data.value.ref); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (0) { + /* Test references() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing references() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + enumeration = cc->ft->references(cc, objectpath, NULL, NULL, 0, NULL, &status); + + /* Print the results */ + printf("references() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showInstance(data.value.inst); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (0) { + /* Test referenceNames() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing referenceNames() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + enumeration = cc->ft->referenceNames(cc, objectpath, NULL, NULL, &status); + + /* Print the results */ + printf("referenceNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showObjectPath(data.value.ref); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test getProperty() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing getProperty() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + CMPIData data = cc->ft->getProperty(cc, objectpath, "PrimaryOwnerName", &status); + + /* Print the results */ + printf("getProperty() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + printf("PrimaryOwnerName=%s\n", (char*)(data.value.string)->hdl); + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test setProperty() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing setProperty() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + CMPIValue value; + value.string = newCMPIString("Gareth Bestor", NULL); + status = cc->ft->setProperty(cc, objectpath, "PrimaryOwnerName", &value, CMPI_chars); + + /* Print the results */ + printf("setProperty() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + return 0; } |
From: Gareth S B. <bes...@us...> - 2005-06-20 03:39:22
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27969 Modified Files: client.c Log Message: finished getproperty, added setproperty Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- client.c 20 Jun 2005 01:10:19 -0000 1.10 +++ client.c 20 Jun 2005 03:39:10 -0000 1.11 @@ -777,6 +777,7 @@ /* --------------------------------------------------------------------------*/ +/* unfinished */ static CMPIEnumeration * execQuery( CMCIClient * cl, CMPIObjectPath * op, @@ -850,6 +851,7 @@ /* --------------------------------------------------------------------------*/ +/* finished but not working - scanCimXmlResponse fails parsing XML results */ static CMPIEnumeration * associators( CMCIClient * mb, CMPIObjectPath * cop, @@ -860,6 +862,40 @@ CMPIFlags flags, char ** properties, CMPIStatus * rc) +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="Associators"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="ObjectName"> + <INSTANCENAME CLASSNAME="Linux_ComputerSystem"> + <KEYBINDING NAME="CreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_ComputerSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Name"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </IPARAMVALUE> + <IPARAMVALUE NAME="AssocClass"> + <CLASSNAME NAME="Linux_RunningOS"/> + </IPARAMVALUE> + <IPARAMVALUE NAME="IncludeQualifiers"> + <VALUE>FALSE</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="IncludeClassOrigin"> + <VALUE>TRUE</VALUE> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -884,9 +920,11 @@ pathToXml(sb, cop); sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); + /* Add optional parameters */ if (assocClass!=NULL) sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"AssocClass\"><CLASSNAME NAME=\"", assocClass, "\"/></IPARAMVALUE>\n"); + if (resultClass!=NULL) sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"ResultClass\"><CLASSNAME NAME=\"", resultClass, "\"/></IPARAMVALUE>\n"); @@ -894,14 +932,16 @@ if (role) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"Role\"><VALUE>", role, "</VALUE></IPARAMVALUE>\n"); + if (resultRole) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"ResultRole\"><VALUE>", resultRole, "</VALUE></IPARAMVALUE>\n"); - + + /* Add optional flags */ emitorigin(sb,flags & CMPI_FLAG_IncludeClassOrigin); emitqual(sb,flags & CMPI_FLAG_IncludeQualifiers); - + /* Add property list filter */ if (properties) { sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"PropertyList\"><VALUE.ARRAY>"); while (*properties) { @@ -916,22 +956,22 @@ // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); con->ft->addPayload(con,sb); - if ((error=con->ft->getResponse(con,cop))) { - CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + if ((error = con->ft->getResponse(con,cop))) { + CMSetStatusWithChars(rc, CMPI_RC_ERR_FAILED, error); return NULL; } + // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); - ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); - if (rh.errCode!=0) { - CMSetStatusWithChars(rc,rh.errCode,rh.description); + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); return NULL; } - if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL)==CMPI_instance) { - CMPIEnumeration *enm=newCMPIEnumeration(rh.rvArray,NULL); - CMSetStatus(rc,CMPI_RC_OK); + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_instance) { + CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray, NULL); + CMSetStatus(rc, CMPI_RC_OK); return enm; } @@ -941,6 +981,7 @@ /* --------------------------------------------------------------------------*/ +/* finished & working */ static CMPIEnumeration * associatorNames( CMCIClient * mb, CMPIObjectPath * cop, @@ -949,6 +990,34 @@ const char * role, const char * resultRole, CMPIStatus * rc) +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="AssociatorNames"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="ObjectName"> + <INSTANCENAME CLASSNAME="Linux_ComputerSystem"> + <KEYBINDING NAME="CreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_ComputerSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Name"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </IPARAMVALUE> + <IPARAMVALUE NAME="AssocClass"> + <CLASSNAME NAME="Linux_RunningOS"/> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -973,9 +1042,11 @@ pathToXml(sb, cop); sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); + /* Add optional parameters */ if (assocClass!=NULL) sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"AssocClass\"><CLASSNAME NAME=\"", assocClass, "\"/></IPARAMVALUE>\n"); + if (resultClass!=NULL) sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"ResultClass\"><CLASSNAME NAME=\"", resultClass, "\"/></IPARAMVALUE>\n"); @@ -983,6 +1054,7 @@ if (role) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"Role\"><VALUE>", role, "</VALUE></IPARAMVALUE>\n"); + if (resultRole) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"ResultRole\"><VALUE>", resultRole, "</VALUE></IPARAMVALUE>\n"); @@ -996,18 +1068,18 @@ CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); return NULL; } + // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); - ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); - if (rh.errCode!=0) { - CMSetStatusWithChars(rc,rh.errCode,rh.description); + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); return NULL; } - if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL)==CMPI_ref) { - CMPIEnumeration *enm=newCMPIEnumeration(rh.rvArray,NULL); - CMSetStatus(rc,CMPI_RC_OK); + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_ref) { + CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray, NULL); + CMSetStatus(rc, CMPI_RC_OK); return enm; } @@ -1017,6 +1089,7 @@ /* --------------------------------------------------------------------------*/ +/* finished (and working?) */ static CMPIEnumeration * references( CMCIClient * mb, CMPIObjectPath * cop, @@ -1049,17 +1122,20 @@ pathToXml(sb, cop); sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); + /* Add optional parameters */ if (resultClass) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"ResultClass\"><VALUE>", resultClass, "</VALUE></IPARAMVALUE>\n"); + if (role) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"Role\"><VALUE>", role, "</VALUE></IPARAMVALUE>\n"); - + + /* Add optional flags */ emitorigin(sb,flags & CMPI_FLAG_IncludeClassOrigin); emitqual(sb,flags & CMPI_FLAG_IncludeQualifiers); - + /* Add property list filter */ if (properties) { sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"PropertyList\"><VALUE.ARRAY>"); while (*properties) { @@ -1087,8 +1163,8 @@ return NULL; } - if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL)==CMPI_instance) { - CMPIEnumeration *enm=newCMPIEnumeration(rh.rvArray,NULL); + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_instance) { + CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray,NULL); CMSetStatus(rc,CMPI_RC_OK); return enm; } @@ -1099,6 +1175,7 @@ /* --------------------------------------------------------------------------*/ +/* finished (and working?) */ static CMPIEnumeration * referenceNames( CMCIClient * mb, CMPIObjectPath * cop, @@ -1166,6 +1243,7 @@ /* --------------------------------------------------------------------------*/ +/* unfinished */ static CMPIData invokeMethod( CMCIClient * cl, CMPIObjectPath * op, @@ -1181,85 +1259,207 @@ /* --------------------------------------------------------------------------*/ +/* finished (and working?) */ static CMPIStatus setProperty( - CMCIClient * cl, - CMPIObjectPath * op, + CMCIClient * mb, + CMPIObjectPath * cop, const char * name, CMPIValue * value, CMPIType type) +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="SetProperty"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="PropertyName"> + <VALUE>CurrentTimeZone</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="NewValue"> + <VALUE>123</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="InstanceName"> + <INSTANCENAME CLASSNAME="Linux_OperatingSystem"> + <KEYBINDING NAME="CSCreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_ComputerSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="CSName"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="CreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_OperatingSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Name"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ { - CMPIStatus rc; - CMSetStatusWithChars(&rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); + ClientEnc *cl = (ClientEnc*)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb=newStringBuffer(2048); + char *error; + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + CMPIStatus rc = {CMPI_RC_OK, NULL}; + con->ft->genRequest(cl, "SetProperty", cop, 0, 0); + + addXmlHeader(sb); + sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"SetProperty\">"); + + addXmlNamespace(sb, getNameSpaceComponents(cop)); + + /* Add the property */ + sb->ft->append3Chars(sb, + "<IPARAMVALUE NAME=\"PropertyName\">\n<VALUE>", + name, "</VALUE>\n</IPARAMVALUE>"); + + /* Add the new value */ + sb->ft->append3Chars(sb, + "<IPARAMVALUE NAME=\"NewValue\">\n<VALUE>", + value2Chars(type,value), "</VALUE>\n</IPARAMVALUE>"); + + /* Add the objectpath */ + sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"InstanceName\">\n" + "<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + pathToXml(sb, cop); + sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); + + sb->ft->appendChars(sb,"</IMETHODCALL>\n"); + addXmlFooter(sb); + +// fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); + + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(&rc,CMPI_RC_ERR_FAILED,error); + return rc; + } + +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + + if (rh.errCode != 0) { + CMSetStatusWithChars(&rc, rh.errCode, rh.description); + return rc; + } + return rc; } /* --------------------------------------------------------------------------*/ +/* finished (and working?) */ static CMPIData getProperty( CMCIClient * mb, CMPIObjectPath * cop, const char * name, CMPIStatus * rc) +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="GetProperty"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="PropertyName"> + <VALUE>CurrentTimeZone</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="InstanceName"> + <INSTANCENAME CLASSNAME="Linux_OperatingSystem"> + <KEYBINDING NAME="CSCreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_ComputerSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="CSName"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="CreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_OperatingSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Name"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ { - ClientEnc *cl = (ClientEnc*)mb; - CMCIConnection *con = cl->connection; - UtilStringBuffer *sb=newStringBuffer(2048); - char *error; - ResponseHdr rh; - CMPIData retval; - - con->ft->genRequest(cl, "GetProperty", cop, 0, 0); - - addXmlHeader(sb); - - sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"GetProperty\">"); - - addXmlNamespace(sb, getNameSpaceComponents(cop)); + ClientEnc *cl = (ClientEnc*)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb=newStringBuffer(2048); + char *error; + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + CMPIData retval; - sb->ft->append3Chars(sb, - "<IPARAMVALUE NAME=\"InstanceName\"><INSTANCE CLASSNAME=\"", - (char*)cop->ft->getClassName(cop, NULL), "\">\n"); + con->ft->genRequest(cl, "GetProperty", cop, 0, 0); - pathToXml(sb, cop); + addXmlHeader(sb); + sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"GetProperty\">"); - sb->ft->appendChars(sb, "</INSTANCENAME></IPARAMVALUE>"); + addXmlNamespace(sb, getNameSpaceComponents(cop)); - sb->ft->append3Chars(sb, - "<IPARAMVALUE NAME=\"PropertyName\">\n<VALUE> \"", - name, "\" </VALUE>\n</IPARAMVALUE>"); + /* Add the property */ + sb->ft->append3Chars(sb, + "<IPARAMVALUE NAME=\"PropertyName\">\n<VALUE>", + name, "</VALUE>\n</IPARAMVALUE>"); - sb->ft->appendChars(sb, "</IMETHODCALL></SIMPLEREQ></MESSAGE></CIM>"); + /* Add the objectpath */ + sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"InstanceName\">\n" + "<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + pathToXml(sb, cop); + sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); - sb->ft->appendChars(sb, "</IMETHODCALL></SIMPLEREQ></MESSAGE></CIM>"); + sb->ft->appendChars(sb,"</IMETHODCALL>\n"); + addXmlFooter(sb); // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); - con->ft->addPayload(con,sb); + con->ft->addPayload(con,sb); - if ((error = con->ft->getResponse(con, cop))) { - CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); -//#warning "getProperty: TODO: setup error return value in retval" - return retval; - } + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + retval.state = CMPI_notFound | CMPI_nullValue; + return retval; + } // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); - - rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); - if (rh.errCode != 0) { - CMSetStatusWithChars(rc,rh.errCode,rh.description); -//#warning "getProperty: TODO: setup error return value in retval" - return retval; - } + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); + retval.state = CMPI_notFound | CMPI_nullValue; + return retval; + } - if (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_INTEGER) { -//#warning "getProperty: TODO - setup CMPIData object from rh.rvArray here" - CMSetStatus(rc, CMPI_RC_OK); - return retval; - } - - CMSetStatusWithChars(rc, CMPI_RC_ERR_FAILED, "Unexpected return value"); -//#warning "getProperty: TODO: setup error return value in retval" - return retval; + /* TODO: check this */ + if ((rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_INTEGER) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_ENC) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_REAL) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_SIMPLE) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_ARRAY) || + (rh.rvArray->ft->getSimpleType(rh.rvArray, NULL) == CMPI_ENCA)) { + CMSetStatus(rc, CMPI_RC_OK); + return rh.rvArray->ft->getElementAt(rh.rvArray, 0, NULL); + } + + CMSetStatusWithChars(rc, CMPI_RC_ERR_FAILED, "Unexpected return value"); + retval.state = CMPI_badValue; + return retval; } /* --------------------------------------------------------------------------*/ @@ -1322,6 +1522,7 @@ /* --------------------------------------------------------------------------*/ +/* finished & working */ static CMPIEnumeration* enumClassNames( CMCIClient * mb, CMPIObjectPath * cop, @@ -1372,6 +1573,7 @@ /* --------------------------------------------------------------------------*/ +/* finished (and working?) */ static CMPIEnumeration * enumClasses( CMCIClient * mb, CMPIObjectPath * cop, |
From: Gareth S B. <bes...@us...> - 2005-06-20 01:11:19
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21054 Modified Files: test.c Log Message: added tests for createinstance, setinstance & deleteinstance, using CWS_Authorization sample provider as the target Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- test.c 19 Jun 2005 19:22:56 -0000 1.5 +++ test.c 20 Jun 2005 01:11:11 -0000 1.6 @@ -1,4 +1,5 @@ #include "cmci.h" +#include "native.h" static char * _HOSTNAME = "bestorga.ibm.com"; @@ -87,7 +88,7 @@ /* Setup a conncetion to the CIMOM */ cc = cmciConnect("localhost",NULL,NULL,NULL,NULL); - if (1) { + if (0) { /* Test enumClassNames() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumClassNames() ...\n"); @@ -108,6 +109,26 @@ } if (0) { + /* Test enumClasses() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing enumClasses() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL); + enumeration = cc->ft->enumClasses(cc, objectpath, 0, &status); + + /* Print the results */ + printf("enumClasses() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); +// How get class data out of data.value.???; + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (0) { /* Test getClass() */ printf("\n----------------------------------------------------------\n"); printf("Testing getClass() ...\n"); @@ -124,7 +145,7 @@ if (objectpath) CMRelease(objectpath); } - if (1) { + if (0) { /* Test enumInstanceNames() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumInstanceNames() ...\n"); @@ -164,7 +185,7 @@ if (objectpath) CMRelease(objectpath); } - if (1) { + if (0) { /* Test getInstance() */ printf("\n----------------------------------------------------------\n"); printf("Testing getInstance() ...\n"); @@ -183,5 +204,63 @@ if (objectpath) CMRelease(objectpath); } + if (1) { + /* Test createInstance() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing createInstance() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "CWS_Authorization", NULL); + instance = newCMPIInstance(objectpath, NULL); + CMSetProperty(instance, "Username", "bestorga", CMPI_chars); + CMSetProperty(instance, "Classname", "foobar", CMPI_chars); + + objectpath = cc->ft->createInstance(cc, objectpath, instance, &status); + + /* Print the results */ + printf("createInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result:\n"); + showObjectPath(objectpath); + } + if (instance) CMRelease(instance); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test setInstance() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing setInstance() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "CWS_Authorization", NULL); + CMAddKey(objectpath, "Username", "bestorga", CMPI_chars); + CMAddKey(objectpath, "Classname", "foobar", CMPI_chars); + instance = newCMPIInstance(objectpath, NULL); + CMSetProperty(instance, "Username", "bestorga", CMPI_chars); + CMSetProperty(instance, "Classname", "foobar", CMPI_chars); + int yes = 1; + CMSetProperty(instance, "Query", (CMPIValue *)&yes, CMPI_boolean); + + status = cc->ft->setInstance(cc, objectpath, instance, 0, NULL); + + /* Print the results */ + printf("setInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (instance) CMRelease(instance); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test deleteInstance() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing deleteInstance() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "CWS_Authorization", NULL); + CMAddKey(objectpath, "Username", "bestorga", CMPI_chars); + CMAddKey(objectpath, "Classname", "foobar", CMPI_chars); + + status = cc->ft->deleteInstance(cc, objectpath); + + /* Print the results */ + printf("deleteInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (instance) CMRelease(instance); + if (objectpath) CMRelease(objectpath); + } + return 0; } |
From: Gareth S B. <bes...@us...> - 2005-06-20 01:10:33
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20697 Modified Files: client.c Log Message: createinstance, setinstance, deleteinstance fixed and now working Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- client.c 19 Jun 2005 19:45:07 -0000 1.9 +++ client.c 20 Jun 2005 01:10:19 -0000 1.10 @@ -242,8 +242,9 @@ extern UtilList *getNameSpaceComponents(CMPIObjectPath * cop); extern char *keytype2Chars(CMPIType type); extern void pathToXml(UtilStringBuffer *sb, CMPIObjectPath *cop); +extern char *value2Chars(CMPIType type, CMPIValue * value); -/* --------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ static void emitlocal(UtilStringBuffer *sb, int f) { @@ -283,40 +284,53 @@ sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"DeepInheritance\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); } -#if 0 +/* --------------------------------------------------------------------------*/ + static void addXmlProperty(UtilStringBuffer *sb, char *name, char *value) { - sb->ft->append3Chars(sb, - "<PROPERTY NAME=\"", name, "\" TYPE=\"string\">"); - sb->ft->append3Chars(sb, "<VALUE> \"", value, "\"</VALUE>"); - sb->ft->appendChars (sb, "</PROPERTY>\n"); + sb->ft->append3Chars(sb, "<PROPERTY NAME=\"", name, "\" TYPE=\"string\">"); + sb->ft->append3Chars(sb, "<VALUE>", value, "</VALUE>"); + sb->ft->appendChars(sb, "</PROPERTY>\n"); } -#endif /* --------------------------------------------------------------------------*/ static void addXmlNamespace(UtilStringBuffer *sb, UtilList *nsc) { - char *nsp; + char *nsp; - sb->ft->appendChars(sb,"<LOCALNAMESPACEPATH>"); - for (nsp = nsc->ft->getFirst(nsc); nsp; nsp = nsc->ft->getNext(nsc)) - sb->ft->append3Chars(sb, "<NAMESPACE NAME=\"", nsp, "\"></NAMESPACE>"); - sb->ft->appendChars(sb, "</LOCALNAMESPACEPATH>\n"); + sb->ft->appendChars(sb,"<LOCALNAMESPACEPATH>"); + for (nsp = nsc->ft->getFirst(nsc); nsp; nsp = nsc->ft->getNext(nsc)) { + sb->ft->append3Chars(sb, "<NAMESPACE NAME=\"", nsp, "\"></NAMESPACE>"); + } + sb->ft->appendChars(sb, "</LOCALNAMESPACEPATH>\n"); } /* --------------------------------------------------------------------------*/ static inline void addXmlHeader(UtilStringBuffer *sb) { - static const char xmlHeader[]={ - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" - "<CIM CIMVERSION=\"2.0\" DTDVERSION=\"2.0\">\n" - "<MESSAGE ID=\"4711\" PROTOCOLVERSION=\"1.0\">" - "<SIMPLEREQ>\n" - }; + static const char xmlHeader[]={ + "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<CIM CIMVERSION=\"2.0\" DTDVERSION=\"2.0\">\n" + "<MESSAGE ID=\"4711\" PROTOCOLVERSION=\"1.0\">" + "<SIMPLEREQ>\n" + }; - sb->ft->appendChars(sb, xmlHeader); + sb->ft->appendChars(sb, xmlHeader); +} + +/* --------------------------------------------------------------------------*/ + +static inline void addXmlFooter(UtilStringBuffer *sb) +{ + static const char xmlFooter[]={ + "</SIMPLEREQ>\n" + "</MESSAGE>\n" + "</CIM>\n" + }; + + sb->ft->appendChars(sb, xmlFooter); } /* --------------------------------------------------------------------------*/ @@ -324,11 +338,12 @@ static inline void addXmlClassnameParam(UtilStringBuffer *sb, CMPIObjectPath *cop) { - CMPIString *cn=cop->ft->getClassName(cop, NULL); - if (cn && cn->hdl && *((char*)cn->hdl)) + CMPIString *cn = cop->ft->getClassName(cop, NULL); + if (cn && cn->hdl && *((char*)cn->hdl)) { sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"ClassName\"><CLASSNAME NAME=\"", - (char*)cn->hdl,"\"/></IPARAMVALUE>\n"); + (char*)cn->hdl, "\"/></IPARAMVALUE>\n"); + } } /* --------------------------------------------------------------------------*/ @@ -338,8 +353,8 @@ if (properties) { sb->ft->appendChars(sb, "<IPARAMVALUE NAME=\"PropertyList\"><VALUE.ARRAY>"); while (*properties) { - sb->ft->append3Chars(sb, "<VALUE>", *properties, "</VALUE>"); - properties++; + sb->ft->append3Chars(sb, "<VALUE>", *properties, "</VALUE>"); + properties++; } sb->ft->appendChars(sb, "</VALUE.ARRAY></IPARAMVALUE>\n"); } @@ -347,41 +362,42 @@ /* --------------------------------------------------------------------------*/ +/* Finished & working */ static CMPIEnumeration * enumInstanceNames( CMCIClient * mb, CMPIObjectPath * cop, CMPIStatus * rc) { - ClientEnc *cl=(ClientEnc*)mb; - CMCIConnection *con=cl->connection; - UtilStringBuffer *sb=newStringBuffer(2048); - char *error; + ClientEnc * cl = (ClientEnc*)mb; + CMCIConnection * con = cl->connection; + UtilStringBuffer * sb = newStringBuffer(2048); + char * error; + ResponseHdr rh; - con->ft->genRequest(cl,"EnumerateInstanceNames",cop,0,0); + con->ft->genRequest(cl, "EnumerateInstanceNames", cop, 0, 0); + /* Construct the CIM-XML request */ addXmlHeader(sb); - - sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"EnumerateInstanceNames\">"); + sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"EnumerateInstanceNames\">"); addXmlNamespace(sb, getNameSpaceComponents(cop)); - addXmlClassnameParam(sb, cop); - sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); + sb->ft->appendChars(sb, "</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); con->ft->addPayload(con,sb); - if ((error = con->ft->getResponse(con,cop))) { + if ((error = con->ft->getResponse(con, cop))) { CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); return NULL; } + // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); - - ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); - if (rh.errCode!=0) { - CMSetStatusWithChars(rc,rh.errCode,rh.description); + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); return NULL; } @@ -397,6 +413,7 @@ /* --------------------------------------------------------------------------*/ +/* Finished & working */ static CMPIInstance * getInstance( CMCIClient * mb, CMPIObjectPath * cop, @@ -408,13 +425,47 @@ CMCIConnection *con=cl->connection; UtilStringBuffer *sb=newStringBuffer(2048); char *error; - CMPIString *cn; - - cn=cop->ft->getClassName(cop,NULL); + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + con->ft->genRequest(cl,"GetInstance",cop,0,0); + /* Construct the CIM-XML request */ +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="GetInstance"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="LocalOnly"> + <VALUE>FALSE</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="IncludeClassOrigin"> + <VALUE>FALSE</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="IncludeQualifiers"> + <VALUE>FALSE</VALUE> + </IPARAMVALUE> + <IPARAMVALUE NAME="InstanceName"> + <INSTANCENAME CLASSNAME="Linux_ComputerSystem"> + <KEYBINDING NAME="CreationClassName"> + <KEYVALUE VALUETYPE="string">Linux_ComputerSystem</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Name"> + <KEYVALUE VALUETYPE="string">bestorga.ibm.com</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ addXmlHeader(sb); - sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"GetInstance\">"); addXmlNamespace(sb, getNameSpaceComponents(cop)); @@ -427,9 +478,7 @@ sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"InstanceName\">\n" "<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); - pathToXml(sb, cop); - sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); @@ -437,16 +486,16 @@ // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); con->ft->addPayload(con,sb); - if ((error=con->ft->getResponse(con,cop))) { + if ((error = con->ft->getResponse(con, cop))) { CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); return NULL; } + // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); - - ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); - if (rh.errCode!=0) { - CMSetStatusWithChars(rc,rh.errCode,rh.description); + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); return NULL; } @@ -461,114 +510,269 @@ /* --------------------------------------------------------------------------*/ +/* Finished & working */ static CMPIObjectPath * createInstance( CMCIClient * mb, CMPIObjectPath * cop, CMPIInstance * inst, CMPIStatus * rc) { - ClientEnc *cl = (ClientEnc*)mb; - CMCIConnection *con = cl->connection; - UtilStringBuffer *sb = newStringBuffer(2048); - char *error; - ResponseHdr rh; - - con->ft->genRequest(cl, "CreateInstance", cop, 0, 0); - addXmlHeader(sb); + ClientEnc *cl = (ClientEnc*)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb = newStringBuffer(2048); + char *error; + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + int i, numproperties = inst->ft->getPropertyCount(inst, NULL); + CMPIString * propertyname; + CMPIData propertydata; + + con->ft->genRequest(cl, "CreateInstance", cop, 0, 0); - sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"CreateInstance\">"); + /* Construct the CIM-XML request */ + addXmlHeader(sb); - addXmlNamespace(sb, getNameSpaceComponents(cop)); + sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"CreateInstance\">"); -//#warning "createInstance: TODO - build Xml parameters for *inst" - /* issue here is using the stuff from inst for property list */ + addXmlNamespace(sb, getNameSpaceComponents(cop)); + + sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"NewInstance\">\n" + "<INSTANCE CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + + /* Add all the instance properties */ + for (i=0; i<numproperties; i++) { + propertydata = inst->ft->getPropertyAt(inst, i, &propertyname, NULL); + addXmlProperty(sb, propertyname->hdl, value2Chars(propertydata.type,&(propertydata.value))); + } + + sb->ft->appendChars(sb,"</INSTANCE>\n</IPARAMVALUE>\n"); + + sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); - con->ft->addPayload(con,sb); + con->ft->addPayload(con,sb); - if ((error = con->ft->getResponse(con, cop))) { - CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); - return NULL; - } -// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + return NULL; + } - rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); - if (rh.errCode != 0) { - CMSetStatusWithChars(rc, rh.errCode, rh.description); - return NULL; - } +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); + return NULL; + } - if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_ref) { - CMPIObjectPath *objpath = newCMPIObjectPath(NULL, - (char*)cop->ft->getClassName(cop, NULL), NULL); -//#warning "createInstance: TODO - setup *objpath from rh.rvArray value" - CMSetStatus(rc,CMPI_RC_OK); - return objpath; - } + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_ref) { + CMSetStatus(rc,CMPI_RC_OK); + return rh.rvArray->ft->getElementAt(rh.rvArray, 0, NULL).value.ref; + } - CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); - return NULL; + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); + return NULL; } /* --------------------------------------------------------------------------*/ +/* Finished & working */ static CMPIStatus setInstance( - CMCIClient * cl, - CMPIObjectPath * op, + CMCIClient * mb, + CMPIObjectPath * cop, CMPIInstance * inst, CMPIFlags flags, char ** properties) { - CMPIStatus rc; - CMSetStatusWithChars(&rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); - return rc; -} + ClientEnc *cl = (ClientEnc*)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb = newStringBuffer(2048); + char *error; + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + int i, numproperties = inst->ft->getPropertyCount(inst, NULL); + CMPIString * propertyname; + CMPIData propertydata; + CMPIStatus rc = {CMPI_RC_OK, NULL}; + con->ft->genRequest(cl,"ModifyInstance",cop,0,0); -/* --------------------------------------------------------------------------*/ + /* Construct the CIM-XML request */ + addXmlHeader(sb); + sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"ModifyInstance\">"); -static CMPIStatus deleteInstance( - CMCIClient * mb, - CMPIObjectPath * cop) -{ - ClientEnc *cl = (ClientEnc *)mb; - CMCIConnection *con = cl->connection; - UtilStringBuffer *sb = newStringBuffer(2048); - char *error; - ResponseHdr rh; - CMPIStatus rc; + addXmlNamespace(sb, getNameSpaceComponents(cop)); - con->ft->genRequest(cl, "DeleteInstance", cop, 0, 0); + /* NOTE - IncludeQualifiers flag is now deprecated */ + emitqual(sb,flags & CMPI_FLAG_IncludeQualifiers); - addXmlHeader(sb); + /* Add the property filter list */ + addXmlPropertyListParam(sb, properties); - sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"DeleteInstance\">"); - addXmlNamespace(sb, getNameSpaceComponents(cop)); + sb->ft->appendChars(sb, "<IPARAMVALUE NAME=\"ModifiedInstance\">\n"); + sb->ft->appendChars(sb, "<VALUE.NAMEDINSTANCE>\n"); - addXmlClassnameParam(sb, cop); + /* Add the objectpath */ + sb->ft->append3Chars(sb,"<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + pathToXml(sb, cop); + sb->ft->appendChars(sb,"</INSTANCENAME>\n"); - pathToXml(sb, cop); + /* Add the instance */ + sb->ft->append3Chars(sb,"<INSTANCE CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + for (i=0; i<numproperties; i++) { + propertydata = inst->ft->getPropertyAt(inst, i, &propertyname, NULL); + addXmlProperty(sb, propertyname->hdl, value2Chars(propertydata.type,&(propertydata.value))); + } + sb->ft->appendChars(sb,"</INSTANCE>\n"); - sb->ft->appendChars(sb, "\"/></IPARAMVALUE>\n"); + sb->ft->appendChars(sb,"</VALUE.NAMEDINSTANCE>\n"); + sb->ft->appendChars(sb,"</IPARAMVALUE>\n"); + sb->ft->appendChars(sb,"</IMETHODCALL>\n"); + addXmlFooter(sb); - sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="ModifyInstance"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="ModifiedInstance"> + <VALUE.NAMEDINSTANCE> + <INSTANCENAME CLASSNAME="CWS_Authorization"> + <KEYBINDING NAME="Username"> + <KEYVALUE VALUETYPE="string">foo</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Classname"> + <KEYVALUE VALUETYPE="string">bar</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + <INSTANCE CLASSNAME="CWS_Authorization"> + <PROPERTY NAME="Username" TYPE="string"> + <VALUE>foo</VALUE> + </PROPERTY> + <PROPERTY NAME="Classname" TYPE="string"> + <VALUE>bar</VALUE> + </PROPERTY> + <PROPERTY NAME="Enumerate" TYPE="boolean"> + <VALUE>FALSE</VALUE> + </PROPERTY> + <PROPERTY NAME="Get" TYPE="boolean"> + <VALUE>FALSE</VALUE> + </PROPERTY> + <PROPERTY NAME="Set" TYPE="boolean"> + <VALUE>FALSE</VALUE> + </PROPERTY> + <PROPERTY NAME="Create" TYPE="boolean"> + <VALUE>FALSE</VALUE> + </PROPERTY> + <PROPERTY NAME="Delete" TYPE="boolean"> + <VALUE>FALSE</VALUE> + </PROPERTY> + <PROPERTY NAME="Query" TYPE="boolean"> + <VALUE>true</VALUE> + </PROPERTY> + </INSTANCE> + </VALUE.NAMEDINSTANCE> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); - con->ft->addPayload(con,sb); - - if ((error = con->ft->getResponse(con, cop))) { - CMSetStatusWithChars(&rc,CMPI_RC_ERR_FAILED,error); - return rc; - } + con->ft->addPayload(con,sb); + + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(&rc,CMPI_RC_ERR_FAILED,error); + return rc; + } + // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); + if (rh.errCode != 0) { + CMSetStatusWithChars(&rc, rh.errCode, rh.description); + return rc; + } - rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); + return rc; +} - if (rh.errCode != 0) { - CMSetStatusWithChars(&rc, rh.errCode, rh.description); - } else { - CMSetStatus(&rc, CMPI_RC_OK); - } - return rc; +/* --------------------------------------------------------------------------*/ + +/* Finished & working */ +static CMPIStatus deleteInstance( + CMCIClient * mb, + CMPIObjectPath * cop) +{ + ClientEnc *cl=(ClientEnc*)mb; + CMCIConnection *con=cl->connection; + UtilStringBuffer *sb=newStringBuffer(2048); + char *error; + ResponseHdr rh; + CMPIString *cn = cop->ft->getClassName(cop,NULL); + CMPIStatus rc = {CMPI_RC_OK, NULL}; + con->ft->genRequest(cl,"DeleteInstance",cop,0,0); + + /* Construct the CIM-XML request */ +/* +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="DeleteInstance"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"/> + <NAMESPACE NAME="cimv2"/> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="InstanceName"> + <INSTANCENAME CLASSNAME="CWS_Authorization"> + <KEYBINDING NAME="Username"> + <KEYVALUE VALUETYPE="string">bestorga</KEYVALUE> + </KEYBINDING> + <KEYBINDING NAME="Classname"> + <KEYVALUE VALUETYPE="string">foobar</KEYVALUE> + </KEYBINDING> + </INSTANCENAME> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +*/ + + addXmlHeader(sb); + sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"DeleteInstance\">"); + + addXmlNamespace(sb, getNameSpaceComponents(cop)); + + sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"InstanceName\">\n" + "<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + pathToXml(sb, cop); + sb->ft->appendChars(sb,"</INSTANCENAME>\n"); + + sb->ft->appendChars(sb,"</IPARAMVALUE>\n"); + sb->ft->appendChars(sb,"</IMETHODCALL>\n"); + addXmlFooter(sb); + +// fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); + + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(&rc,CMPI_RC_ERR_FAILED,error); + return rc; + } + +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); + if (rh.errCode != 0) { + CMSetStatusWithChars(&rc, rh.errCode, rh.description); + return rc; + } + + return rc; } /* --------------------------------------------------------------------------*/ @@ -586,6 +790,7 @@ /* --------------------------------------------------------------------------*/ +/* Finished (& working?) */ static CMPIEnumeration * enumInstances( CMCIClient * mb, CMPIObjectPath * cop, @@ -1059,6 +1264,7 @@ /* --------------------------------------------------------------------------*/ +/* finished but not working - scanCimXmlResponse fails */ static CMPIConstClass * getClass( CMCIClient * mb, CMPIObjectPath * cop, @@ -1126,22 +1332,19 @@ CMCIConnection *con=cl->connection; UtilStringBuffer *sb=newStringBuffer(2048); char *error; + ResponseHdr rh; con->ft->genRequest(cl,"EnumerateClassNames",cop,0,0); + /* Construct the CIM-XML request */ addXmlHeader(sb); - sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"EnumerateClassNames\">"); - addXmlNamespace(sb, getNameSpaceComponents(cop)); - emitdeep(sb,flags & CMPI_FLAG_DeepInheritance); - addXmlClassnameParam(sb, cop); - sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); - // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); if ((error = con->ft->getResponse(con,cop))) { @@ -1150,7 +1353,7 @@ } // fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); - ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); if (rh.errCode!=0) { CMSetStatusWithChars(rc,rh.errCode,rh.description); @@ -1175,54 +1378,49 @@ CMPIFlags flags, CMPIStatus * rc) { - ClientEnc *cl = (ClientEnc *)mb; - CMCIConnection *con = cl->connection; - UtilStringBuffer *sb = newStringBuffer(2048); - char *error; - ResponseHdr rh; - - con->ft->genRequest(cl, "EnumerateClasses", cop, 0, 0); - - addXmlHeader(sb); - - sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"EnumerateClasses\">"); - addXmlNamespace(sb, getNameSpaceComponents(cop)); + ClientEnc *cl = (ClientEnc *)mb; + CMCIConnection *con = cl->connection; + UtilStringBuffer *sb = newStringBuffer(2048); + char *error; + ResponseHdr rh; - addXmlClassnameParam(sb, cop); + con->ft->genRequest(cl, "EnumerateClasses", cop, 0, 0); - emitdeep(sb,flags & CMPI_FLAG_DeepInheritance); - emitlocal(sb,flags & CMPI_FLAG_LocalOnly); - emitqual(sb,flags & CMPI_FLAG_IncludeQualifiers); - emitorigin(sb,flags & CMPI_FLAG_IncludeClassOrigin); - + /* Construct the CIM-XML request */ + addXmlHeader(sb); + sb->ft->appendChars(sb, "<IMETHODCALL NAME=\"EnumerateClasses\">"); + addXmlNamespace(sb, getNameSpaceComponents(cop)); + emitdeep(sb,flags & CMPI_FLAG_DeepInheritance); + emitlocal(sb,flags & CMPI_FLAG_LocalOnly); + emitqual(sb,flags & CMPI_FLAG_IncludeQualifiers); + emitorigin(sb,flags & CMPI_FLAG_IncludeClassOrigin); addXmlClassnameParam(sb, cop); - - sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); + sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); // fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); - con->ft->addPayload(con,sb); + con->ft->addPayload(con,sb); - if ((error = con->ft->getResponse(con, cop))) { - CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); - return NULL; - } -// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + if ((error = con->ft->getResponse(con, cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + return NULL; + } - rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + rh = scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse), cop); - if (rh.errCode != 0) { - CMSetStatusWithChars(rc, rh.errCode, rh.description); - return NULL; - } + if (rh.errCode != 0) { + CMSetStatusWithChars(rc, rh.errCode, rh.description); + return NULL; + } - if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_class) { - CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray,NULL); - CMSetStatus(rc, CMPI_RC_OK); - return enm; - } + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL) == CMPI_class) { + CMPIEnumeration *enm = newCMPIEnumeration(rh.rvArray,NULL); + CMSetStatus(rc, CMPI_RC_OK); + return enm; + } - CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); - return NULL; + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); + return NULL; } /* --------------------------------------------------------------------------*/ |
From: Gareth S B. <bes...@us...> - 2005-06-19 19:45:18
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26102 Modified Files: client.c Log Message: pretty up code :-) Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- client.c 13 Jun 2005 23:50:46 -0000 1.8 +++ client.c 19 Jun 2005 19:45:07 -0000 1.9 @@ -173,7 +173,7 @@ rv = curl_easy_setopt(con->mHandle, CURLOPT_FAILONERROR, 1); // Turn this on to enable debugging - // rv = curl_easy_setopt(mHandle, CURLOPT_VERBOSE, 1); + rv = curl_easy_setopt(con->mHandle, CURLOPT_VERBOSE, 1); return NULL; } @@ -222,6 +222,8 @@ initializeHeaders }; +/* --------------------------------------------------------------------------*/ + CMCIConnection *initConnection(CMCIClientData *cld) { CMCIConnection *c=(CMCIConnection*)calloc(1,sizeof(CMCIConnection)); @@ -235,11 +237,14 @@ return c; } +/* --------------------------------------------------------------------------*/ extern UtilList *getNameSpaceComponents(CMPIObjectPath * cop); extern char *keytype2Chars(CMPIType type); extern void pathToXml(UtilStringBuffer *sb, CMPIObjectPath *cop); +/* --------------------------------------------------------------------------*/ + static void emitlocal(UtilStringBuffer *sb, int f) { if (f) @@ -248,6 +253,8 @@ sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"LocalOnly\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); } +/* --------------------------------------------------------------------------*/ + static void emitqual(UtilStringBuffer *sb, int f) { if (f) @@ -256,6 +263,8 @@ sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"IncludeQualifiers\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); } +/* --------------------------------------------------------------------------*/ + static void emitorigin(UtilStringBuffer *sb, int f) { if (f) @@ -264,6 +273,8 @@ sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"IncludeClassOrigin\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); } +/* --------------------------------------------------------------------------*/ + static void emitdeep(UtilStringBuffer *sb, int f) { if (f) @@ -282,6 +293,8 @@ } #endif +/* --------------------------------------------------------------------------*/ + static void addXmlNamespace(UtilStringBuffer *sb, UtilList *nsc) { char *nsp; @@ -292,6 +305,8 @@ sb->ft->appendChars(sb, "</LOCALNAMESPACEPATH>\n"); } +/* --------------------------------------------------------------------------*/ + static inline void addXmlHeader(UtilStringBuffer *sb) { static const char xmlHeader[]={ @@ -304,6 +319,8 @@ sb->ft->appendChars(sb, xmlHeader); } +/* --------------------------------------------------------------------------*/ + static inline void addXmlClassnameParam(UtilStringBuffer *sb, CMPIObjectPath *cop) { @@ -314,6 +331,8 @@ (char*)cn->hdl,"\"/></IPARAMVALUE>\n"); } +/* --------------------------------------------------------------------------*/ + static void addXmlPropertyListParam(UtilStringBuffer *sb, char** properties) { if (properties) { @@ -326,9 +345,12 @@ } } +/* --------------------------------------------------------------------------*/ - -static CMPIEnumeration *enumInstanceNames(CMCIClient* mb, CMPIObjectPath* cop, CMPIStatus* rc) +static CMPIEnumeration * enumInstanceNames( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -373,8 +395,14 @@ return NULL; } -static CMPIInstance * getInstance(CMCIClient* mb, - CMPIObjectPath* cop, CMPIFlags flags, char** properties, CMPIStatus* rc) +/* --------------------------------------------------------------------------*/ + +static CMPIInstance * getInstance( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIFlags flags, + char ** properties, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -431,8 +459,13 @@ return NULL; } -static CMPIObjectPath *createInstance(CMCIClient *mb, - CMPIObjectPath *cop, CMPIInstance *inst, CMPIStatus *rc) +/* --------------------------------------------------------------------------*/ + +static CMPIObjectPath * createInstance( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIInstance * inst, + CMPIStatus * rc) { ClientEnc *cl = (ClientEnc*)mb; CMCIConnection *con = cl->connection; @@ -477,15 +510,25 @@ return NULL; } -static CMPIStatus setInstance(CMCIClient* cl, - CMPIObjectPath* op, CMPIInstance* inst, CMPIFlags flags, char ** properties) +/* --------------------------------------------------------------------------*/ + +static CMPIStatus setInstance( + CMCIClient * cl, + CMPIObjectPath * op, + CMPIInstance * inst, + CMPIFlags flags, + char ** properties) { CMPIStatus rc; CMSetStatusWithChars(&rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); return rc; } -static CMPIStatus deleteInstance(CMCIClient* mb, CMPIObjectPath* cop) +/* --------------------------------------------------------------------------*/ + +static CMPIStatus deleteInstance( + CMCIClient * mb, + CMPIObjectPath * cop) { ClientEnc *cl = (ClientEnc *)mb; CMCIConnection *con = cl->connection; @@ -528,15 +571,27 @@ return rc; } -static CMPIEnumeration *execQuery(CMCIClient* cl, CMPIObjectPath* op, - const char *query, const char *lang, CMPIStatus* rc) +/* --------------------------------------------------------------------------*/ + +static CMPIEnumeration * execQuery( + CMCIClient * cl, + CMPIObjectPath * op, + const char * query, + const char * lang, + CMPIStatus * rc) { CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); return NULL; } -static CMPIEnumeration * enumInstances(CMCIClient* mb, - CMPIObjectPath* cop, CMPIFlags flags, char** properties, CMPIStatus* rc) +/* --------------------------------------------------------------------------*/ + +static CMPIEnumeration * enumInstances( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIFlags flags, + char ** properties, + CMPIStatus * rc) { ClientEnc *cl = (ClientEnc *)mb; CMCIConnection *con = cl->connection; @@ -588,12 +643,18 @@ return NULL; } +/* --------------------------------------------------------------------------*/ -static CMPIEnumeration* associators (CMCIClient* mb, - CMPIObjectPath* cop, const char *assocClass, const char *resultClass, - const char *role, const char *resultRole, CMPIFlags flags, char** properties, - CMPIStatus* rc) - +static CMPIEnumeration * associators( + CMCIClient * mb, + CMPIObjectPath * cop, + const char * assocClass, + const char * resultClass, + const char * role, + const char * resultRole, + CMPIFlags flags, + char ** properties, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -673,9 +734,16 @@ return NULL; } -static CMPIEnumeration* associatorNames(CMCIClient* mb, - CMPIObjectPath* cop, const char *assocClass, const char *resultClass, - const char *role, const char *resultRole, CMPIStatus* rc) +/* --------------------------------------------------------------------------*/ + +static CMPIEnumeration * associatorNames( + CMCIClient * mb, + CMPIObjectPath * cop, + const char * assocClass, + const char * resultClass, + const char * role, + const char * resultRole, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -742,11 +810,16 @@ return NULL; } +/* --------------------------------------------------------------------------*/ - -static CMPIEnumeration* references(CMCIClient* mb, - CMPIObjectPath* cop, const char *resultClass ,const char *role , - CMPIFlags flags, char** properties, CMPIStatus* rc) +static CMPIEnumeration * references( + CMCIClient * mb, + CMPIObjectPath * cop, + const char * resultClass, + const char * role , + CMPIFlags flags, + char ** properties, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -819,11 +892,14 @@ return NULL; } +/* --------------------------------------------------------------------------*/ - -static CMPIEnumeration* referenceNames(CMCIClient* mb, - CMPIObjectPath* cop, const char *resultClass ,const char *role, - CMPIStatus* rc) +static CMPIEnumeration * referenceNames( + CMCIClient * mb, + CMPIObjectPath * cop, + const char * resultClass, + const char * role, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -883,29 +959,42 @@ return NULL; } +/* --------------------------------------------------------------------------*/ -static CMPIData invokeMethod(CMCIClient* cl, CMPIObjectPath* op,const char *method, - CMPIArgs* in, CMPIArgs* out, CMPIStatus* rc) +static CMPIData invokeMethod( + CMCIClient * cl, + CMPIObjectPath * op, + const char * method, + CMPIArgs * in, + CMPIArgs * out, + CMPIStatus * rc) { - CMPIData rv = {CMPI_null, CMPI_notFound}; - CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); - return rv; + CMPIData rv = {CMPI_null, CMPI_notFound}; + CMSetStatusWithChars(rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); + return rv; } +/* --------------------------------------------------------------------------*/ -static CMPIStatus setProperty(CMCIClient* cl, - CMPIObjectPath* op, const char *name , CMPIValue* value, - CMPIType type) +static CMPIStatus setProperty( + CMCIClient * cl, + CMPIObjectPath * op, + const char * name, + CMPIValue * value, + CMPIType type) { - - CMPIStatus rc; - CMSetStatusWithChars(&rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); - return rc; + CMPIStatus rc; + CMSetStatusWithChars(&rc, CMPI_RC_ERROR_SYSTEM, "method not supported"); + return rc; } +/* --------------------------------------------------------------------------*/ -static CMPIData getProperty(CMCIClient *mb, - CMPIObjectPath *cop, const char *name, CMPIStatus *rc) +static CMPIData getProperty( + CMCIClient * mb, + CMPIObjectPath * cop, + const char * name, + CMPIStatus * rc) { ClientEnc *cl = (ClientEnc*)mb; CMCIConnection *con = cl->connection; @@ -968,9 +1057,14 @@ return retval; } +/* --------------------------------------------------------------------------*/ -static CMPIConstClass* getClass (CMCIClient* mb, - CMPIObjectPath* cop, CMPIFlags flags, char** properties, CMPIStatus* rc) +static CMPIConstClass * getClass( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIFlags flags, + char ** properties, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -1020,8 +1114,13 @@ return NULL; } -static CMPIEnumeration* enumClassNames (CMCIClient* mb, - CMPIObjectPath* cop, CMPIFlags flags, CMPIStatus* rc) +/* --------------------------------------------------------------------------*/ + +static CMPIEnumeration* enumClassNames( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIFlags flags, + CMPIStatus * rc) { ClientEnc *cl=(ClientEnc*)mb; CMCIConnection *con=cl->connection; @@ -1068,8 +1167,13 @@ return NULL; } -static CMPIEnumeration* enumClasses (CMCIClient* mb, - CMPIObjectPath* cop, CMPIFlags flags, CMPIStatus* rc) +/* --------------------------------------------------------------------------*/ + +static CMPIEnumeration * enumClasses( + CMCIClient * mb, + CMPIObjectPath * cop, + CMPIFlags flags, + CMPIStatus * rc) { ClientEnc *cl = (ClientEnc *)mb; CMCIConnection *con = cl->connection; @@ -1121,6 +1225,7 @@ return NULL; } +/* --------------------------------------------------------------------------*/ static CMCIClientFT clientFt = { getClass, @@ -1142,29 +1247,23 @@ getProperty }; - - - +/* --------------------------------------------------------------------------*/ CMCIClient *cmciConnect(const char *hn, const char *port, const char *user, const char *pwd, CMPIStatus *rc) { - ClientEnc *cc=(ClientEnc*)calloc(1,sizeof(ClientEnc)); - + cc->enc.hdl=&cc->data; cc->enc.ft=&clientFt; - + cc->data.hostName= hn ? strdup(hn) : "localhost"; cc->data.port= port ? strdup(port) : "5988"; cc->data.user= user ? strdup(user) : NULL; cc->data.pwd= pwd ? strdup(pwd) : NULL; cc->data.scheme= "http"; - + cc->connection=initConnection(&cc->data); - + return (CMCIClient*)cc; - -} - - +} |
From: Gareth S B. <bes...@us...> - 2005-06-19 19:23:05
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15662 Modified Files: test.c Log Message: changes to test.c Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test.c 13 Jun 2005 23:50:46 -0000 1.4 +++ test.c 19 Jun 2005 19:22:56 -0000 1.5 @@ -1,52 +1,187 @@ - #include "cmci.h" -int main(int argc, char *argv[]) +static char * _HOSTNAME = "bestorga.ibm.com"; + +extern char *value2Chars(CMPIType type, CMPIValue * value); + +static void showObjectPath( CMPIObjectPath * objectpath ) +{ + CMPIString * namespace = objectpath->ft->getNameSpace(objectpath, NULL); + CMPIString * classname = objectpath->ft->getClassName(objectpath, NULL); + int numkeys = objectpath->ft->getKeyCount(objectpath, NULL); + int i; + + if (namespace && namespace->hdl) printf("namespace=%s\n", (char *)namespace->hdl); + if (classname && classname->hdl) printf("classname=%s\n", (char *)classname->hdl); + if (numkeys) { + printf("keys:\n"); + for (i=0; i<numkeys; i++) { + CMPIString * keyname; + CMPIData data = objectpath->ft->getKeyAt(objectpath, i, &keyname, NULL); + printf("\t%s=%s\n", (char *)keyname->hdl, value2Chars(data.type, &data.value)); + } + } + + if (classname) CMRelease(classname); + if (namespace) CMRelease(namespace); +} + + +static void showInstance( CMPIInstance *instance ) +{ + CMPIObjectPath * objectpath = instance->ft->getObjectPath(instance, NULL); + CMPIString * objectpathname = objectpath->ft->toString(objectpath, NULL); + CMPIString * namespace = objectpath->ft->getNameSpace(objectpath, NULL); + CMPIString * classname = objectpath->ft->getClassName(objectpath, NULL); + int numproperties = instance->ft->getPropertyCount(instance, NULL); + int i; + + if (objectpathname && objectpathname->hdl) printf("objectpath=%s\n", (char *)objectpathname->hdl); + if (namespace && namespace->hdl) printf("namespace=%s\n", (char *)namespace->hdl); + if (classname && classname->hdl) printf("classname=%s\n", (char *)classname->hdl); + if (numproperties) { + printf("properties:\n"); + for (i=0; i<numproperties; i++) { + CMPIString * propertyname; + CMPIData data = instance->ft->getPropertyAt(instance, i, &propertyname, NULL); + printf("\t%s=%s\n", (char *)propertyname->hdl, value2Chars(data.type, &data.value)); + } + } + + if (classname) CMRelease(classname); + if (namespace) CMRelease(namespace); + if (objectpathname) CMRelease(objectpathname); + if (objectpath) CMRelease(objectpath); +} + + +static void showClass( CMPIConstClass * class ) +{ + CMPIString * classname = class->ft->getClassName(class, NULL); + int numproperties = class->ft->getPropertyCount(class, NULL); + int i; + + if (classname && classname->hdl) printf("classname=%s\n", (char *)classname->hdl); + if (numproperties) { + printf("properties:\n"); + for (i=0; i<numproperties; i++) { + CMPIString * propertyname; + CMPIData data = class->ft->getPropertyAt(class, i, &propertyname, NULL); + printf("\t%s=%s\n", (char *)propertyname->hdl, value2Chars(data.type, &data.value)); + } + } + + if (classname) CMRelease(classname); +} + + +int main( int argc, char * argv[] ) { CMCIClient *cc; - CMPIObjectPath *cop; - CMPIInstance *ci; - CMPIEnumeration *enm; - CMPIStatus rc; - CMPIConstClass *cls; - CMPIData data; - - cc=cmciConnect("localhost",NULL,NULL,NULL,NULL); - cop=newCMPIObjectPath("root/cimv2",NULL,NULL); - - enm=cc->ft->enumClassNames(cc,cop,0,&rc); - printf("--- enumClassNames rc: %d - %s\n",rc.rc, rc.msg ? (char*)rc.msg->hdl : NULL); - while (enm->ft->hasNext(enm,NULL)) { - CMPIData d=enm->ft->getNext(enm,NULL); - CMPIString *cn=d.value.ref->ft->getClassName(d.value.ref,NULL); - printf(" -- className: %s\n",(char*)cn->hdl); - CMRelease(cn); + CMPIObjectPath * objectpath; + CMPIInstance * instance; + CMPIEnumeration * enumeration; + CMPIConstClass * class; + CMPIStatus status; + + /* Setup a conncetion to the CIMOM */ + cc = cmciConnect("localhost",NULL,NULL,NULL,NULL); + + if (1) { + /* Test enumClassNames() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing enumClassNames() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL); + enumeration = cc->ft->enumClassNames(cc, objectpath, 0, &status); + + /* Print the results */ + printf("enumClassNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showObjectPath(data.value.ref); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); } - CMRelease(enm); - CMRelease(cop); - - cop=newCMPIObjectPath("root/cimv2","Linux_ComputerSystem",NULL); - cls=cc->ft->getClass(cc,cop,0,NULL,&rc); - printf("--- getClass rc: %d - %s\n",rc.rc, rc.msg ? (char*)rc.msg->hdl : NULL); - data=cls->ft->getProperty(cls,"InstallDate",&rc); - printf("--- getProperty rc: %d - %s %x\n",rc.rc, rc.msg ? (char*)rc.msg->hdl : NULL,data.state); - data=cls->ft->getProperty(cls,"EnabledDefault",&rc); - printf("--- getProperty rc: %d - %s %x %d\n",rc.rc, rc.msg ? (char*)rc.msg->hdl : NULL,data.state,data.value.uint16); - - CMAddKey(cop,"CreationClassName","Linux_ComputerSystem",CMPI_chars); - - enm=cc->ft->enumInstanceNames(cc,cop,&rc); - printf("--- enumInstanceNames rc: %d - %s\n",rc.rc, rc.msg ? (char*)rc.msg->hdl : NULL); - - if (argc==1) CMAddKey(cop,"Name","localhost.localdomain",CMPI_chars); - else CMAddKey(cop,"Name","dyn-9-152-143-58.boeblingen.de.ibm.com",CMPI_chars); - - ci=cc->ft->getInstance(cc,cop,0,NULL,&rc); - printf("--- getInstance rc: %d - %s\n",rc.rc, rc.msg ? (char*)rc.msg->hdl : NULL); - if (rc.rc) printf("You may need to modify the hostname in line 41 or 42\n"); - + + if (0) { + /* Test getClass() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing getClass() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + class = cc->ft->getClass(cc, objectpath, 0, NULL, &status); + + /* Print the results */ + printf("getClass() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result:\n"); + showClass(class); + } + if (instance) CMRelease(instance); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test enumInstanceNames() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing enumInstanceNames() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + enumeration = cc->ft->enumInstanceNames(cc, objectpath, &status); + + /* Print the results */ + printf("enumInstanceNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showObjectPath(data.value.ref); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (0) { + /* Test enumInstances() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing enumInstances() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + enumeration = cc->ft->enumInstances(cc, objectpath, 0, NULL, &status); + + /* Print the results */ + printf("enumInstances() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result(s):\n"); + while (enumeration->ft->hasNext(enumeration, NULL)) { + CMPIData data = enumeration->ft->getNext(enumeration, NULL); + showInstance(data.value.inst); + } + } + if (enumeration) CMRelease(enumeration); + if (objectpath) CMRelease(objectpath); + } + + if (1) { + /* Test getInstance() */ + printf("\n----------------------------------------------------------\n"); + printf("Testing getInstance() ...\n"); + objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); + instance = cc->ft->getInstance(cc, objectpath, 0, NULL, &status); + + /* Print the results */ + printf("getInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); + if (!status.rc) { + printf("result:\n"); + showInstance(instance); + } + if (instance) CMRelease(instance); + if (objectpath) CMRelease(objectpath); + } + return 0; - - - } |
From: Adrian S. <a3s...@us...> - 2005-06-17 14:32:33
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32276 Modified Files: hashtable.c Log Message: One more try: getting rid of valgrinf message from hashtable.c Index: hashtable.c =================================================================== RCS file: /cvsroot/sblim/sfcb/hashtable.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- hashtable.c 17 Jun 2005 14:05:39 -0000 1.3 +++ hashtable.c 17 Jun 2005 14:32:24 -0000 1.4 @@ -829,9 +829,12 @@ void **key, void **val) { HashTable *t = (HashTable *) ht->hdl; - for (iter->pair = iter->pair->next; iter->bucket < t->numOfBuckets; - iter->pair = t->bucketArray[++iter->bucket]) { + iter->pair = iter->pair->next; + while (iter->bucket < t->numOfBuckets) { if (iter->pair == NULL) { + if (iter->bucket+1 < t->numOfBuckets) + iter->pair = t->bucketArray[++iter->bucket]; + else break; continue; } *key = (void *) iter->pair->key; |
From: Adrian S. <a3s...@us...> - 2005-06-17 14:05:50
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17025 Modified Files: hashtable.c Log Message: Sorry, I have to back out previuous fix to hashtable.c Index: hashtable.c =================================================================== RCS file: /cvsroot/sblim/sfcb/hashtable.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- hashtable.c 17 Jun 2005 13:15:13 -0000 1.2 +++ hashtable.c 17 Jun 2005 14:05:39 -0000 1.3 @@ -829,13 +829,9 @@ void **key, void **val) { HashTable *t = (HashTable *) ht->hdl; -// for (iter->pair = iter->pair->next; iter->bucket < t->numOfBuckets; -// iter->pair = t->bucketArray[++iter->bucket]) { - iter->pair = iter->pair->next; - while (iter->bucket < t->numOfBuckets) { + for (iter->pair = iter->pair->next; iter->bucket < t->numOfBuckets; + iter->pair = t->bucketArray[++iter->bucket]) { if (iter->pair == NULL) { - if (iter->bucket+1 < t->numOfBuckets) - iter->pair = t->bucketArray[++iter->bucket]; continue; } *key = (void *) iter->pair->key; |
From: Adrian S. <a3s...@us...> - 2005-06-17 13:15:22
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22517 Modified Files: hashtable.c Log Message: Fixed anoying message generating under valgrind emanating from hashtable.c Index: hashtable.c =================================================================== RCS file: /cvsroot/sblim/sfcb/hashtable.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- hashtable.c 9 Mar 2005 12:25:12 -0000 1.1.1.1 +++ hashtable.c 17 Jun 2005 13:15:13 -0000 1.2 @@ -829,9 +829,13 @@ void **key, void **val) { HashTable *t = (HashTable *) ht->hdl; - for (iter->pair = iter->pair->next; iter->bucket < t->numOfBuckets; - iter->pair = t->bucketArray[++iter->bucket]) { +// for (iter->pair = iter->pair->next; iter->bucket < t->numOfBuckets; +// iter->pair = t->bucketArray[++iter->bucket]) { + iter->pair = iter->pair->next; + while (iter->bucket < t->numOfBuckets) { if (iter->pair == NULL) { + if (iter->bucket+1 < t->numOfBuckets) + iter->pair = t->bucketArray[++iter->bucket]; continue; } *key = (void *) iter->pair->key; |