8
extern char *value2Chars(CMPIType type, CMPIValue * value);
9
void showProperty( CMPIData , char * );
10
void showInstance( CMPIInstance * );
11
static char * CMPIState_str(CMPIValueState);
13
* comment out this define to use v2 http XML interface
24
CMPIObjectPath *op = NULL ;
25
CIMCEnumeration *enm = NULL;
26
CIMCClient *client = NULL;
27
CIMCInstance *instance = NULL;
29
char *cim_host, *cim_host_passwd, *cim_host_userid, *cim_host_port;
33
* Setup a connection to the CIMOM by checking environment
34
* if not found we default those values
36
cim_host = getenv("CIM_HOST");
38
cim_host = "localhost";
39
cim_host_userid = getenv("CIM_HOST_USERID");
40
if (cim_host_userid == NULL)
41
cim_host_userid = "root";
42
cim_host_passwd = getenv("CIM_HOST_PASSWD");
43
if (cim_host_passwd == NULL)
44
cim_host_passwd = "password";
45
cim_host_port = getenv("CIM_HOST_PORT");
46
if (cim_host_port == NULL)
47
cim_host_port = "5988";
49
printf(" Testing enumerateInstanceNames \n") ;
52
printf(" using SfcbLocal interface : host = %s userid = %s\n",
53
cim_host,cim_host_userid) ;
54
ce = NewCIMCEnv("SfcbLocal",0,&rc,&msg);
56
printf(" using XML HTTP interface : host = %s userid = %s port=%s\n",
57
cim_host,cim_host_userid,cim_host_port) ;
58
ce = NewCIMCEnv("XML",0,&rc,&msg);
62
printf(" local connect failed call to NewCIMCEnv message = [%s] \n",msg) ;
65
printf("do connect \n") ;
66
client = ce->ft->connect(ce, cim_host , "http", cim_host_port, cim_host_userid, cim_host_passwd , &status);
69
printf(" failed the call to connect \n") ;
72
printf("do newObjectPath \n") ;
73
op = (CMPIObjectPath *)ce->ft->newObjectPath(ce, "root/cimv2", "CIM_ManagedElement" , &status);
76
printf(" failed the call to newObjectPath \n") ;
79
printf("do enumInstances \n") ;
80
enm = client->ft->enumInstanceNames(client, (CIMCObjectPath *) op , &status);
83
printf(" failed the call to client->ft->enumInstances \n") ;
86
/* Print the results */
90
count = enm->ft->hasNext(enm, NULL) ;
93
data = enm->ft->getNext(enm, NULL);
95
showObjectPath(data.value.ref);
97
* see if we have any more
99
count = enm->ft->hasNext(enm, NULL) ;
102
printf(" ERROR received from enumInstanceNames status.rc = %d\n",status.rc) ;
104
printf(" ERROR msg = %s\n",msg) ;
107
if(enm) enm->ft->release(enm);
108
if(op) op->ft->release(op);
109
if(client) client->ft->release(client);
110
if(ce) ce->ft->release(ce);
111
if(status.msg) CMRelease(status.msg);