sfcc 0.1.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +24 -0
- data/README.rdoc +16 -0
- data/ext/sfcc/cim_class.c +147 -58
- data/ext/sfcc/cim_class.h +1 -1
- data/ext/sfcc/cim_client.c +187 -198
- data/ext/sfcc/cim_client.h +1 -1
- data/ext/sfcc/cim_enumeration.c +109 -21
- data/ext/sfcc/cim_enumeration.h +1 -1
- data/ext/sfcc/cim_instance.c +70 -77
- data/ext/sfcc/cim_instance.h +1 -1
- data/ext/sfcc/cim_object_path.c +141 -122
- data/ext/sfcc/cim_object_path.h +1 -1
- data/ext/sfcc/cim_string.c +9 -13
- data/ext/sfcc/cim_string.h +1 -1
- data/ext/sfcc/extconf.rb +8 -4
- data/ext/sfcc/sfcc.c +163 -105
- data/ext/sfcc/sfcc.h +15 -40
- data/lib/sfcc.rb +75 -12
- data/lib/sfcc/version.rb +1 -1
- metadata +68 -95
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
== 0.4.0
|
2
|
+
|
3
|
+
* support https access
|
4
|
+
* extend Client.connect API for https data
|
5
|
+
* allow mix of uri and explicit paraters in Client.connect
|
6
|
+
|
7
|
+
== 0.3.1
|
8
|
+
|
9
|
+
* simplify properties access for Instance and ObjectPath
|
10
|
+
|
11
|
+
== 0.3.0
|
12
|
+
|
13
|
+
* use sfcc 'new' api
|
14
|
+
* link against libcimcclient
|
15
|
+
|
16
|
+
== 0.2.0
|
17
|
+
|
18
|
+
* fix Client.connect for URI
|
19
|
+
* transparently convert Ruby values to string whereever needed
|
20
|
+
|
21
|
+
== 0.1.3
|
22
|
+
|
23
|
+
* fix finding libcmpisfcc for sblim-sfcc-2.2.3
|
24
|
+
|
1
25
|
== 0.1.2
|
2
26
|
|
3
27
|
* build with ruby 1.9
|
data/README.rdoc
CHANGED
@@ -10,6 +10,22 @@ ruby-sfcc provides the SBLIM client API ( http://sblim.wiki.sourceforge.net/Sfcc
|
|
10
10
|
You can use it to connect to any CIMOM talking CIM-XML, but it can take advantage of
|
11
11
|
sfcb CIMOM by connecting using a native interface.
|
12
12
|
|
13
|
+
== Requirements
|
14
|
+
|
15
|
+
=== Ruby interpreters
|
16
|
+
|
17
|
+
ruby-sfcc has been built and the testsuite ran against:
|
18
|
+
|
19
|
+
* ruby 1.8.7
|
20
|
+
* ruby 1.9.2
|
21
|
+
* rubinius HEAD (what will be 1.1 soon)
|
22
|
+
|
23
|
+
=== sblim
|
24
|
+
|
25
|
+
ruby-sfcc has been built and the testsuite ran against:
|
26
|
+
|
27
|
+
* sblim-sfcc 2.2.1
|
28
|
+
|
13
29
|
== Quick Start
|
14
30
|
|
15
31
|
You can create a gem by running rake gem.
|
data/ext/sfcc/cim_class.c
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
#include "cim_class.h"
|
3
3
|
|
4
4
|
static void
|
5
|
-
dealloc(
|
5
|
+
dealloc(CIMCClass *c)
|
6
6
|
{
|
7
|
-
|
7
|
+
/* fprintf(stderr, "Sfcc_dealloc_cim_class %p\n", c); */
|
8
|
+
c->ft->release(c);
|
8
9
|
}
|
9
10
|
|
10
11
|
/**
|
@@ -15,13 +16,96 @@ dealloc(CMPIConstClass *cimclass)
|
|
15
16
|
*/
|
16
17
|
static VALUE class_name(VALUE self)
|
17
18
|
{
|
18
|
-
|
19
|
-
|
20
|
-
Data_Get_Struct(self,
|
21
|
-
classname = cimclass->ft->
|
22
|
-
return rb_str_new2(classname
|
19
|
+
CIMCClass *cimclass;
|
20
|
+
const char *classname;
|
21
|
+
Data_Get_Struct(self, CIMCClass, cimclass);
|
22
|
+
classname = cimclass->ft->getCharClassName(cimclass);
|
23
|
+
return rb_str_new2(classname);
|
23
24
|
}
|
24
25
|
|
26
|
+
/**
|
27
|
+
* call-seq:
|
28
|
+
* superclass_name()
|
29
|
+
*
|
30
|
+
* gets the superclass name
|
31
|
+
*/
|
32
|
+
static VALUE superclass_name(VALUE self)
|
33
|
+
{
|
34
|
+
CIMCClass *cimclass;
|
35
|
+
const char *classname;
|
36
|
+
Data_Get_Struct(self, CIMCClass, cimclass);
|
37
|
+
classname = cimclass->ft->getCharSuperClassName(cimclass);
|
38
|
+
return rb_str_new2(classname);
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
/**
|
43
|
+
* call-seq:
|
44
|
+
* keys()
|
45
|
+
*
|
46
|
+
* gets the list of keys
|
47
|
+
*/
|
48
|
+
static VALUE keys(VALUE self)
|
49
|
+
{
|
50
|
+
VALUE ret;
|
51
|
+
CIMCClass *cimclass;
|
52
|
+
CIMCArray *keylist;
|
53
|
+
Data_Get_Struct(self, CIMCClass, cimclass);
|
54
|
+
keylist = cimclass->ft->getKeyList(cimclass);
|
55
|
+
ret = sfcc_cimcarray_to_rubyarray(keylist);
|
56
|
+
keylist->ft->release(keylist);
|
57
|
+
return ret;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
/**
|
62
|
+
* call-seq:
|
63
|
+
* association?
|
64
|
+
*
|
65
|
+
* returns True if the class is an association
|
66
|
+
*/
|
67
|
+
static VALUE is_association(VALUE self)
|
68
|
+
{
|
69
|
+
CIMCClass *cimclass;
|
70
|
+
CIMCBoolean is;
|
71
|
+
Data_Get_Struct(self, CIMCClass, cimclass);
|
72
|
+
is = cimclass->ft->isAssociation(cimclass);
|
73
|
+
return is ? Qtrue : Qfalse;
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
/**
|
78
|
+
* call-seq:
|
79
|
+
* abstract?
|
80
|
+
*
|
81
|
+
* returns True if the class is abstract
|
82
|
+
*/
|
83
|
+
static VALUE is_abstract(VALUE self)
|
84
|
+
{
|
85
|
+
CIMCClass *cimclass;
|
86
|
+
CIMCBoolean is;
|
87
|
+
Data_Get_Struct(self, CIMCClass, cimclass);
|
88
|
+
is = cimclass->ft->isAbstract(cimclass);
|
89
|
+
return is ? Qtrue : Qfalse;
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
/**
|
94
|
+
* call-seq:
|
95
|
+
* indication?
|
96
|
+
*
|
97
|
+
* returns True if the class is an indication
|
98
|
+
*/
|
99
|
+
static VALUE is_indication(VALUE self)
|
100
|
+
{
|
101
|
+
CIMCClass *cimclass;
|
102
|
+
CIMCBoolean is;
|
103
|
+
Data_Get_Struct(self, CIMCClass, cimclass);
|
104
|
+
is = cimclass->ft->isIndication(cimclass);
|
105
|
+
return is ? Qtrue : Qfalse;
|
106
|
+
}
|
107
|
+
|
108
|
+
|
25
109
|
/**
|
26
110
|
* call-seq:
|
27
111
|
* property(name)
|
@@ -30,16 +114,16 @@ static VALUE class_name(VALUE self)
|
|
30
114
|
*/
|
31
115
|
static VALUE property(VALUE self, VALUE name)
|
32
116
|
{
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
memset(&status, 0, sizeof(
|
37
|
-
Data_Get_Struct(self,
|
38
|
-
data = ptr->ft->getProperty(ptr,
|
117
|
+
CIMCClass *ptr;
|
118
|
+
CIMCStatus status;
|
119
|
+
CIMCData data;
|
120
|
+
memset(&status, 0, sizeof(CIMCStatus));
|
121
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
122
|
+
data = ptr->ft->getProperty(ptr, to_charptr(name), &status);
|
39
123
|
if ( !status.rc )
|
40
124
|
return sfcc_cimdata_to_value(data);
|
41
125
|
|
42
|
-
sfcc_rb_raise_if_error(status, "Can't retrieve property '%s'",
|
126
|
+
sfcc_rb_raise_if_error(status, "Can't retrieve property '%s'", to_charptr(name));
|
43
127
|
return Qnil;
|
44
128
|
}
|
45
129
|
|
@@ -55,13 +139,13 @@ static VALUE property(VALUE self, VALUE name)
|
|
55
139
|
*/
|
56
140
|
static VALUE each_property(VALUE self)
|
57
141
|
{
|
58
|
-
|
59
|
-
|
142
|
+
CIMCClass *ptr;
|
143
|
+
CIMCStatus status;
|
60
144
|
int k=0;
|
61
145
|
int num_props=0;
|
62
|
-
|
63
|
-
|
64
|
-
Data_Get_Struct(self,
|
146
|
+
CIMCString *property_name;
|
147
|
+
CIMCData data;
|
148
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
65
149
|
|
66
150
|
num_props = ptr->ft->getPropertyCount(ptr, &status);
|
67
151
|
if (!status.rc) {
|
@@ -72,7 +156,7 @@ static VALUE each_property(VALUE self)
|
|
72
156
|
}
|
73
157
|
else {
|
74
158
|
sfcc_rb_raise_if_error(status, "Can't retrieve property #%d", k);
|
75
|
-
}
|
159
|
+
}
|
76
160
|
if (property_name) CMRelease(property_name);
|
77
161
|
}
|
78
162
|
}
|
@@ -90,8 +174,9 @@ static VALUE each_property(VALUE self)
|
|
90
174
|
*/
|
91
175
|
static VALUE property_count(VALUE self)
|
92
176
|
{
|
93
|
-
|
94
|
-
Data_Get_Struct(self,
|
177
|
+
CIMCClass *ptr;
|
178
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
179
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
95
180
|
return UINT2NUM(ptr->ft->getPropertyCount(ptr, NULL));
|
96
181
|
}
|
97
182
|
|
@@ -103,16 +188,16 @@ static VALUE property_count(VALUE self)
|
|
103
188
|
*/
|
104
189
|
static VALUE qualifier(VALUE self, VALUE name)
|
105
190
|
{
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
memset(&status, 0, sizeof(
|
110
|
-
Data_Get_Struct(self,
|
111
|
-
data = ptr->ft->getQualifier(ptr,
|
191
|
+
CIMCClass *ptr;
|
192
|
+
CIMCStatus status;
|
193
|
+
CIMCData data;
|
194
|
+
memset(&status, 0, sizeof(CIMCStatus));
|
195
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
196
|
+
data = ptr->ft->getQualifier(ptr, to_charptr(name), &status);
|
112
197
|
if ( !status.rc )
|
113
198
|
return sfcc_cimdata_to_value(data);
|
114
199
|
|
115
|
-
sfcc_rb_raise_if_error(status, "Can't retrieve qualifier '%s'",
|
200
|
+
sfcc_rb_raise_if_error(status, "Can't retrieve qualifier '%s'", to_charptr(name));
|
116
201
|
return Qnil;
|
117
202
|
}
|
118
203
|
|
@@ -128,13 +213,13 @@ static VALUE qualifier(VALUE self, VALUE name)
|
|
128
213
|
*/
|
129
214
|
static VALUE each_qualifier(VALUE self)
|
130
215
|
{
|
131
|
-
|
132
|
-
|
216
|
+
CIMCClass *ptr;
|
217
|
+
CIMCStatus status;
|
133
218
|
int k=0;
|
134
219
|
int num_props=0;
|
135
|
-
|
136
|
-
|
137
|
-
Data_Get_Struct(self,
|
220
|
+
CIMCString *qualifier_name;
|
221
|
+
CIMCData data;
|
222
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
138
223
|
|
139
224
|
num_props = ptr->ft->getQualifierCount(ptr, &status);
|
140
225
|
if (!status.rc) {
|
@@ -145,7 +230,7 @@ static VALUE each_qualifier(VALUE self)
|
|
145
230
|
}
|
146
231
|
else {
|
147
232
|
sfcc_rb_raise_if_error(status, "Can't retrieve qualifier #%d", k);
|
148
|
-
}
|
233
|
+
}
|
149
234
|
if (qualifier_name) CMRelease(qualifier_name);
|
150
235
|
}
|
151
236
|
}
|
@@ -163,8 +248,8 @@ static VALUE each_qualifier(VALUE self)
|
|
163
248
|
*/
|
164
249
|
static VALUE qualifier_count(VALUE self)
|
165
250
|
{
|
166
|
-
|
167
|
-
Data_Get_Struct(self,
|
251
|
+
CIMCClass *ptr;
|
252
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
168
253
|
return UINT2NUM(ptr->ft->getQualifierCount(ptr, NULL));
|
169
254
|
}
|
170
255
|
|
@@ -176,17 +261,17 @@ static VALUE qualifier_count(VALUE self)
|
|
176
261
|
*/
|
177
262
|
static VALUE property_qualifier(VALUE self, VALUE property_name, VALUE qualifier_name)
|
178
263
|
{
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
memset(&status, 0, sizeof(
|
183
|
-
Data_Get_Struct(self,
|
184
|
-
data = ptr->ft->
|
185
|
-
|
264
|
+
CIMCClass *ptr;
|
265
|
+
CIMCStatus status;
|
266
|
+
CIMCData data;
|
267
|
+
memset(&status, 0, sizeof(CIMCStatus));
|
268
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
269
|
+
data = ptr->ft->getPropQualifier(ptr, to_charptr(property_name),
|
270
|
+
to_charptr(qualifier_name), &status);
|
186
271
|
if ( !status.rc )
|
187
272
|
return sfcc_cimdata_to_value(data);
|
188
273
|
|
189
|
-
sfcc_rb_raise_if_error(status, "Can't retrieve property_qualifier '%s'",
|
274
|
+
sfcc_rb_raise_if_error(status, "Can't retrieve property_qualifier '%s'", to_charptr(qualifier_name));
|
190
275
|
return Qnil;
|
191
276
|
}
|
192
277
|
|
@@ -202,24 +287,24 @@ static VALUE property_qualifier(VALUE self, VALUE property_name, VALUE qualifier
|
|
202
287
|
*/
|
203
288
|
static VALUE each_property_qualifier(VALUE self, VALUE property_name)
|
204
289
|
{
|
205
|
-
|
206
|
-
|
290
|
+
CIMCClass *ptr;
|
291
|
+
CIMCStatus status;
|
207
292
|
int k=0;
|
208
293
|
int num_props=0;
|
209
|
-
|
210
|
-
|
211
|
-
Data_Get_Struct(self,
|
294
|
+
CIMCString *property_qualifier_name;
|
295
|
+
CIMCData data;
|
296
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
212
297
|
|
213
|
-
num_props = ptr->ft->
|
298
|
+
num_props = ptr->ft->getPropQualifierCount(ptr, to_charptr(property_name), &status);
|
214
299
|
if (!status.rc) {
|
215
300
|
for (; k < num_props; ++k) {
|
216
|
-
data = ptr->ft->
|
301
|
+
data = ptr->ft->getPropQualifierAt(ptr, to_charptr(property_name), k, &property_qualifier_name, &status);
|
217
302
|
if (!status.rc) {
|
218
303
|
rb_yield_values(2, (property_qualifier_name ? rb_str_intern(rb_str_new2(property_qualifier_name->ft->getCharPtr(property_qualifier_name, NULL))) : Qnil), sfcc_cimdata_to_value(data));
|
219
304
|
}
|
220
305
|
else {
|
221
306
|
sfcc_rb_raise_if_error(status, "Can't retrieve property qualifier #%d", k);
|
222
|
-
}
|
307
|
+
}
|
223
308
|
if (property_qualifier_name) CMRelease(property_qualifier_name);
|
224
309
|
}
|
225
310
|
}
|
@@ -237,15 +322,14 @@ static VALUE each_property_qualifier(VALUE self, VALUE property_name)
|
|
237
322
|
*/
|
238
323
|
static VALUE property_qualifier_count(VALUE self, VALUE property_name)
|
239
324
|
{
|
240
|
-
|
241
|
-
Data_Get_Struct(self,
|
242
|
-
return UINT2NUM(ptr->ft->
|
325
|
+
CIMCClass *ptr;
|
326
|
+
Data_Get_Struct(self, CIMCClass, ptr);
|
327
|
+
return UINT2NUM(ptr->ft->getPropQualifierCount(ptr, to_charptr(property_name), NULL));
|
243
328
|
}
|
244
329
|
|
245
330
|
VALUE
|
246
|
-
Sfcc_wrap_cim_class(
|
331
|
+
Sfcc_wrap_cim_class(CIMCClass *cimclass)
|
247
332
|
{
|
248
|
-
SFCC_INC_REFCOUNT(cimclass);
|
249
333
|
return Data_Wrap_Struct(cSfccCimClass, NULL, dealloc, cimclass);
|
250
334
|
}
|
251
335
|
|
@@ -271,4 +355,9 @@ void init_cim_class()
|
|
271
355
|
rb_define_method(klass, "property_qualifier", property_qualifier, 2);
|
272
356
|
rb_define_method(klass, "each_property_qualifier", each_property_qualifier, 1);
|
273
357
|
rb_define_method(klass, "property_qualifier_count", property_qualifier_count, 1);
|
358
|
+
rb_define_method(klass, "superclass_name", superclass_name, 0);
|
359
|
+
rb_define_method(klass, "keys", keys, 0);
|
360
|
+
rb_define_method(klass, "association?", is_association, 0);
|
361
|
+
rb_define_method(klass, "abstract?", is_abstract, 0);
|
362
|
+
rb_define_method(klass, "indication?", is_indication, 0);
|
274
363
|
}
|
data/ext/sfcc/cim_class.h
CHANGED
data/ext/sfcc/cim_client.c
CHANGED
@@ -5,9 +5,10 @@
|
|
5
5
|
#include "cim_instance.h"
|
6
6
|
|
7
7
|
static void
|
8
|
-
dealloc(
|
8
|
+
dealloc(CIMCClient *c)
|
9
9
|
{
|
10
|
-
|
10
|
+
/* fprintf(stderr, "Sfcc_dealloc_cim_client %p\n", c); */
|
11
|
+
c->ft->release(c);
|
11
12
|
}
|
12
13
|
|
13
14
|
/**
|
@@ -32,28 +33,25 @@ static VALUE get_class(int argc, VALUE *argv, VALUE self)
|
|
32
33
|
VALUE flags;
|
33
34
|
VALUE properties;
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
CMPIConstClass *cimclassnew = NULL;
|
36
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
37
|
+
CIMCObjectPath *op = NULL;
|
38
|
+
CIMCClient *client = NULL;
|
39
|
+
CIMCClass *cimclass = NULL;
|
40
40
|
char **props;
|
41
41
|
|
42
42
|
rb_scan_args(argc, argv, "12", &object_path, &flags, &properties);
|
43
43
|
|
44
44
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
45
45
|
|
46
|
-
Data_Get_Struct(self,
|
47
|
-
Data_Get_Struct(object_path,
|
46
|
+
Data_Get_Struct(self, CIMCClient, client);
|
47
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
48
48
|
|
49
49
|
props = sfcc_value_array_to_string_array(properties);
|
50
50
|
cimclass = client->ft->getClass(client, op, NUM2INT(flags), props, &status);
|
51
51
|
free(props);
|
52
52
|
|
53
53
|
if (!status.rc) {
|
54
|
-
|
55
|
-
cimclass->ft->release(cimclass);
|
56
|
-
return Sfcc_wrap_cim_class(cimclassnew);
|
54
|
+
return Sfcc_wrap_cim_class(cimclass);
|
57
55
|
}
|
58
56
|
sfcc_rb_raise_if_error(status, "Can't get class at %s", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
|
59
57
|
return Qnil;
|
@@ -73,22 +71,20 @@ static VALUE class_names(int argc, VALUE *argv, VALUE self)
|
|
73
71
|
VALUE object_path;
|
74
72
|
VALUE flags;
|
75
73
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
75
|
+
CIMCObjectPath *op;
|
76
|
+
CIMCClient *client;
|
77
|
+
CIMCEnumeration *enm;
|
80
78
|
|
81
79
|
rb_scan_args(argc, argv, "11", &object_path, &flags);
|
82
80
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
83
81
|
|
84
|
-
Data_Get_Struct(self,
|
85
|
-
Data_Get_Struct(object_path,
|
82
|
+
Data_Get_Struct(self, CIMCClient, client);
|
83
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
86
84
|
|
87
|
-
|
85
|
+
enm = client->ft->enumClassNames(client, op, NUM2INT(flags), &status);
|
88
86
|
if (enm && !status.rc ) {
|
89
|
-
|
90
|
-
enm->ft->release(enm);
|
91
|
-
return rbenm;
|
87
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
92
88
|
}
|
93
89
|
|
94
90
|
sfcc_rb_raise_if_error(status, "Can't get class names");
|
@@ -110,25 +106,23 @@ static VALUE classes(int argc, VALUE *argv, VALUE self)
|
|
110
106
|
VALUE object_path;
|
111
107
|
VALUE flags;
|
112
108
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
109
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
110
|
+
CIMCObjectPath *op;
|
111
|
+
CIMCClient *client;
|
112
|
+
CIMCEnumeration *enm;
|
117
113
|
|
118
114
|
rb_scan_args(argc, argv, "11", &object_path, &flags);
|
119
115
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
120
116
|
|
121
|
-
Data_Get_Struct(self,
|
122
|
-
Data_Get_Struct(object_path,
|
117
|
+
Data_Get_Struct(self, CIMCClient, client);
|
118
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
123
119
|
|
124
|
-
|
120
|
+
enm = client->ft->enumClasses(client, op, NUM2INT(flags), &status);
|
125
121
|
if (enm && !status.rc ) {
|
126
|
-
|
127
|
-
enm->ft->release(enm);
|
128
|
-
return rbenm;
|
122
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
129
123
|
}
|
130
124
|
|
131
|
-
sfcc_rb_raise_if_error(status, "Can't get classes");
|
125
|
+
sfcc_rb_raise_if_error(status, "Can't get classes, try increasing maxMsgLen in sfcb.cfg ?");
|
132
126
|
return Qnil;
|
133
127
|
}
|
134
128
|
|
@@ -155,17 +149,17 @@ static VALUE get_instance(int argc, VALUE *argv, VALUE self)
|
|
155
149
|
VALUE flags;
|
156
150
|
VALUE properties;
|
157
151
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
152
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
153
|
+
CIMCObjectPath *op;
|
154
|
+
CIMCClient *client;
|
155
|
+
CIMCInstance *ciminstance;
|
162
156
|
char **props;
|
163
157
|
|
164
158
|
rb_scan_args(argc, argv, "12", &object_path, &flags, &properties);
|
165
159
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
166
160
|
|
167
|
-
Data_Get_Struct(self,
|
168
|
-
Data_Get_Struct(object_path,
|
161
|
+
Data_Get_Struct(self, CIMCClient, client);
|
162
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
169
163
|
|
170
164
|
props = sfcc_value_array_to_string_array(properties);
|
171
165
|
|
@@ -173,7 +167,7 @@ static VALUE get_instance(int argc, VALUE *argv, VALUE self)
|
|
173
167
|
free(props);
|
174
168
|
|
175
169
|
if (!status.rc)
|
176
|
-
return Sfcc_wrap_cim_instance(ciminstance
|
170
|
+
return Sfcc_wrap_cim_instance(ciminstance);
|
177
171
|
|
178
172
|
sfcc_rb_raise_if_error(status, "Can't get instance");
|
179
173
|
return Qnil;
|
@@ -193,19 +187,20 @@ static VALUE get_instance(int argc, VALUE *argv, VALUE self)
|
|
193
187
|
*/
|
194
188
|
static VALUE create_instance(VALUE self, VALUE object_path, VALUE instance)
|
195
189
|
{
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
190
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
191
|
+
CIMCClient *client;
|
192
|
+
CIMCObjectPath *op;
|
193
|
+
CIMCObjectPath *new_op;
|
194
|
+
CIMCInstance *inst;
|
201
195
|
|
202
|
-
Data_Get_Struct(self,
|
203
|
-
Data_Get_Struct(object_path,
|
204
|
-
Data_Get_Struct(instance,
|
205
|
-
|
196
|
+
Data_Get_Struct(self, CIMCClient, client);
|
197
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
198
|
+
Data_Get_Struct(instance, CIMCInstance, inst);
|
199
|
+
|
200
|
+
new_op = client->ft->createInstance(client, op, inst, &status);
|
206
201
|
|
207
202
|
if (!status.rc)
|
208
|
-
return Sfcc_wrap_cim_object_path(new_op
|
203
|
+
return Sfcc_wrap_cim_object_path(new_op);
|
209
204
|
|
210
205
|
sfcc_rb_raise_if_error(status, "Can't create instance");
|
211
206
|
return Qnil;
|
@@ -233,18 +228,18 @@ static VALUE set_instance(int argc, VALUE *argv, VALUE self)
|
|
233
228
|
VALUE flags;
|
234
229
|
VALUE properties;
|
235
230
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
231
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
232
|
+
CIMCObjectPath *op;
|
233
|
+
CIMCInstance *inst;
|
234
|
+
CIMCClient *client;
|
240
235
|
char **props;
|
241
236
|
|
242
237
|
rb_scan_args(argc, argv, "22", &object_path, &instance, &flags, &properties);
|
243
238
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
244
239
|
|
245
|
-
Data_Get_Struct(self,
|
246
|
-
Data_Get_Struct(object_path,
|
247
|
-
Data_Get_Struct(instance,
|
240
|
+
Data_Get_Struct(self, CIMCClient, client);
|
241
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
242
|
+
Data_Get_Struct(instance, CIMCInstance, inst);
|
248
243
|
|
249
244
|
props = sfcc_value_array_to_string_array(properties);
|
250
245
|
|
@@ -264,12 +259,12 @@ static VALUE set_instance(int argc, VALUE *argv, VALUE self)
|
|
264
259
|
*/
|
265
260
|
static VALUE delete_instance(VALUE self, VALUE object_path)
|
266
261
|
{
|
267
|
-
|
268
|
-
|
269
|
-
|
262
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
263
|
+
CIMCObjectPath *op;
|
264
|
+
CIMCClient *client;
|
270
265
|
|
271
|
-
Data_Get_Struct(self,
|
272
|
-
Data_Get_Struct(object_path,
|
266
|
+
Data_Get_Struct(self, CIMCClient, client);
|
267
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
273
268
|
|
274
269
|
status = client->ft->deleteInstance(client, op);
|
275
270
|
sfcc_rb_raise_if_error(status, "Can't delete instance '%s'", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
|
@@ -296,23 +291,21 @@ static VALUE query(VALUE self,
|
|
296
291
|
VALUE query,
|
297
292
|
VALUE lang)
|
298
293
|
{
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
Data_Get_Struct(
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
294
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
295
|
+
CIMCObjectPath *op;
|
296
|
+
CIMCClient *client;
|
297
|
+
CIMCEnumeration *enm;
|
298
|
+
|
299
|
+
Data_Get_Struct(self, CIMCClient, client);
|
300
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
301
|
+
|
302
|
+
enm = client->ft->execQuery(client,
|
303
|
+
op,
|
304
|
+
to_charptr(query),
|
305
|
+
to_charptr(lang),
|
306
|
+
&status);
|
312
307
|
if (enm && !status.rc ) {
|
313
|
-
|
314
|
-
enm->ft->release(enm);
|
315
|
-
return rbenm;
|
308
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
316
309
|
}
|
317
310
|
|
318
311
|
sfcc_rb_raise_if_error(status, "Can't get instances from query");
|
@@ -327,20 +320,18 @@ static VALUE query(VALUE self,
|
|
327
320
|
*/
|
328
321
|
static VALUE instance_names(VALUE self, VALUE object_path)
|
329
322
|
{
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
323
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
324
|
+
CIMCObjectPath *op;
|
325
|
+
CIMCClient *client;
|
326
|
+
CIMCEnumeration *enm;
|
334
327
|
|
335
|
-
Data_Get_Struct(self,
|
336
|
-
Data_Get_Struct(object_path,
|
328
|
+
Data_Get_Struct(self, CIMCClient, client);
|
329
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
337
330
|
|
338
|
-
|
331
|
+
enm = client->ft->enumInstanceNames(client, op, &status);
|
339
332
|
|
340
333
|
if (enm && !status.rc ) {
|
341
|
-
|
342
|
-
enm->ft->release(enm);
|
343
|
-
return rbenm;
|
334
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
344
335
|
}
|
345
336
|
sfcc_rb_raise_if_error(status, "Can't get instance names");
|
346
337
|
return Qnil;
|
@@ -362,7 +353,7 @@ static VALUE instance_names(VALUE self, VALUE object_path)
|
|
362
353
|
* Property names.
|
363
354
|
* Each returned Object MUST NOT include elements for any Properties
|
364
355
|
* missing from this list
|
365
|
-
*
|
356
|
+
*
|
366
357
|
*/
|
367
358
|
static VALUE instances(int argc, VALUE *argv, VALUE self)
|
368
359
|
{
|
@@ -370,28 +361,26 @@ static VALUE instances(int argc, VALUE *argv, VALUE self)
|
|
370
361
|
VALUE flags;
|
371
362
|
VALUE properties;
|
372
363
|
|
373
|
-
|
374
|
-
|
375
|
-
|
364
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
365
|
+
CIMCObjectPath *op;
|
366
|
+
CIMCClient *client;
|
367
|
+
CIMCEnumeration *enm;
|
376
368
|
char **props;
|
377
|
-
VALUE rbenm = Qnil;
|
378
369
|
|
379
370
|
rb_scan_args(argc, argv, "12", &object_path, &flags, &properties);
|
380
371
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
381
372
|
|
382
|
-
Data_Get_Struct(self,
|
383
|
-
Data_Get_Struct(object_path,
|
373
|
+
Data_Get_Struct(self, CIMCClient, client);
|
374
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
384
375
|
|
385
376
|
props = sfcc_value_array_to_string_array(properties);
|
386
377
|
|
387
|
-
|
378
|
+
enm = client->ft->enumInstances(client, op, NUM2INT(flags), props, &status);
|
388
379
|
|
389
380
|
free(props);
|
390
381
|
|
391
382
|
if (enm && !status.rc ) {
|
392
|
-
|
393
|
-
enm->ft->release(enm);
|
394
|
-
return rbenm;
|
383
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
395
384
|
}
|
396
385
|
|
397
386
|
sfcc_rb_raise_if_error(status, "Can't get instances");
|
@@ -405,7 +394,7 @@ static VALUE instances(int argc, VALUE *argv, VALUE self)
|
|
405
394
|
* properties=nil)
|
406
395
|
*
|
407
396
|
* Enumerate instances associated with the Instance defined by the +object_path+
|
408
|
-
*
|
397
|
+
*
|
409
398
|
* +object_path+ Source ObjectPath containing nameSpace, classname
|
410
399
|
* and key components.
|
411
400
|
*
|
@@ -452,35 +441,32 @@ static VALUE associators(int argc, VALUE *argv, VALUE self)
|
|
452
441
|
VALUE flags;
|
453
442
|
VALUE properties;
|
454
443
|
|
455
|
-
|
456
|
-
|
457
|
-
|
444
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
445
|
+
CIMCObjectPath *op;
|
446
|
+
CIMCClient *client;
|
458
447
|
char **props;
|
459
|
-
|
460
|
-
VALUE rbenm = Qnil;
|
448
|
+
CIMCEnumeration *enm;
|
461
449
|
|
462
450
|
rb_scan_args(argc, argv, "16", &object_path,
|
463
451
|
&assoc_class, &result_class,
|
464
452
|
&role, &result_role, &flags, &properties);
|
465
453
|
|
466
454
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
467
|
-
Data_Get_Struct(self,
|
468
|
-
Data_Get_Struct(object_path,
|
455
|
+
Data_Get_Struct(self, CIMCClient, client);
|
456
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
469
457
|
|
470
458
|
props = sfcc_value_array_to_string_array(properties);
|
471
459
|
|
472
460
|
enm = client->ft->associators(client,
|
473
461
|
op,
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
462
|
+
to_charptr(assoc_class),
|
463
|
+
to_charptr(result_class),
|
464
|
+
to_charptr(role),
|
465
|
+
to_charptr(result_role),
|
478
466
|
NUM2INT(flags), props, &status);
|
479
467
|
free(props);
|
480
468
|
if (enm && !status.rc ) {
|
481
|
-
|
482
|
-
enm->ft->release(enm);
|
483
|
-
return rbenm;
|
469
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
484
470
|
}
|
485
471
|
|
486
472
|
sfcc_rb_raise_if_error(status, "Can't get associators for '%s'", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
|
@@ -495,7 +481,7 @@ static VALUE associators(int argc, VALUE *argv, VALUE self)
|
|
495
481
|
*
|
496
482
|
* Enumerate object paths associated with the Instance defined by the
|
497
483
|
* +object_path+
|
498
|
-
*
|
484
|
+
*
|
499
485
|
* +object_path+ Source ObjectPath containing nameSpace, classname
|
500
486
|
* and key components.
|
501
487
|
*
|
@@ -533,30 +519,27 @@ static VALUE associator_names(int argc, VALUE *argv, VALUE self)
|
|
533
519
|
VALUE role;
|
534
520
|
VALUE result_role;
|
535
521
|
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
VALUE rbenm = Qnil;
|
522
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
523
|
+
CIMCObjectPath *op;
|
524
|
+
CIMCClient *client;
|
525
|
+
CIMCEnumeration *enm;
|
541
526
|
|
542
527
|
rb_scan_args(argc, argv, "14", &object_path,
|
543
528
|
&assoc_class, &result_class,
|
544
529
|
&role, &result_role);
|
545
530
|
|
546
|
-
Data_Get_Struct(self,
|
547
|
-
Data_Get_Struct(object_path,
|
531
|
+
Data_Get_Struct(self, CIMCClient, client);
|
532
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
548
533
|
|
549
534
|
enm = client->ft->associatorNames(client,
|
550
535
|
op,
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
536
|
+
to_charptr(assoc_class),
|
537
|
+
to_charptr(result_class),
|
538
|
+
to_charptr(role),
|
539
|
+
to_charptr(result_role),
|
555
540
|
&status);
|
556
541
|
if (enm && !status.rc ) {
|
557
|
-
|
558
|
-
enm->ft->release(enm);
|
559
|
-
return rbenm;
|
542
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
560
543
|
}
|
561
544
|
sfcc_rb_raise_if_error(status, "Can't get associator names for '%s'", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
|
562
545
|
return Qnil;
|
@@ -600,33 +583,30 @@ static VALUE references(int argc, VALUE *argv, VALUE self)
|
|
600
583
|
VALUE flags;
|
601
584
|
VALUE properties;
|
602
585
|
|
603
|
-
|
604
|
-
|
605
|
-
|
586
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
587
|
+
CIMCObjectPath *op;
|
588
|
+
CIMCClient *client;
|
606
589
|
char **props;
|
607
|
-
|
608
|
-
VALUE rbenm = Qnil;
|
590
|
+
CIMCEnumeration *enm;
|
609
591
|
|
610
592
|
rb_scan_args(argc, argv, "14", &object_path,
|
611
593
|
&result_class, &role,
|
612
594
|
&flags, &properties);
|
613
595
|
|
614
596
|
if (NIL_P(flags)) flags = INT2NUM(0);
|
615
|
-
Data_Get_Struct(self,
|
616
|
-
Data_Get_Struct(object_path,
|
597
|
+
Data_Get_Struct(self, CIMCClient, client);
|
598
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
617
599
|
|
618
600
|
props = sfcc_value_array_to_string_array(properties);
|
619
601
|
|
620
602
|
enm = client->ft->references(client,
|
621
603
|
op,
|
622
|
-
|
623
|
-
|
604
|
+
to_charptr(result_class),
|
605
|
+
to_charptr(role),
|
624
606
|
NUM2INT(flags), props, &status);
|
625
607
|
free(props);
|
626
608
|
if (enm && !status.rc ) {
|
627
|
-
|
628
|
-
enm->ft->release(enm);
|
629
|
-
return rbenm;
|
609
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
630
610
|
}
|
631
611
|
sfcc_rb_raise_if_error(status, "Can't get references for '%s'", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
|
632
612
|
return Qnil;
|
@@ -660,28 +640,25 @@ static VALUE reference_names(int argc, VALUE *argv, VALUE self)
|
|
660
640
|
VALUE object_path = Qnil;
|
661
641
|
VALUE result_class = Qnil;
|
662
642
|
VALUE role = Qnil;
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
VALUE rbenm = Qnil;
|
643
|
+
|
644
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
645
|
+
CIMCObjectPath *op;
|
646
|
+
CIMCClient *client;
|
647
|
+
CIMCEnumeration *enm;
|
669
648
|
|
670
649
|
rb_scan_args(argc, argv, "12", &object_path,
|
671
650
|
&result_class, &role);
|
672
651
|
|
673
|
-
Data_Get_Struct(self,
|
674
|
-
Data_Get_Struct(object_path,
|
652
|
+
Data_Get_Struct(self, CIMCClient, client);
|
653
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
675
654
|
|
676
655
|
enm = client->ft->referenceNames(client,
|
677
656
|
op,
|
678
|
-
|
679
|
-
|
657
|
+
to_charptr(result_class),
|
658
|
+
to_charptr(role),
|
680
659
|
&status);
|
681
660
|
if (enm && !status.rc ) {
|
682
|
-
|
683
|
-
enm->ft->release(enm);
|
684
|
-
return rbenm;
|
661
|
+
return Sfcc_wrap_cim_enumeration(enm);
|
685
662
|
}
|
686
663
|
sfcc_rb_raise_if_error(status, "Can't get reference names for '%s'", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
|
687
664
|
return Qnil;
|
@@ -707,32 +684,32 @@ static VALUE invoke_method(VALUE self,
|
|
707
684
|
VALUE argin,
|
708
685
|
VALUE argout)
|
709
686
|
{
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
687
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
688
|
+
CIMCClient *client;
|
689
|
+
CIMCObjectPath *op;
|
690
|
+
CIMCArgs *cimcargsout;
|
714
691
|
VALUE method_name_str;
|
715
|
-
char *method_name_cstr;
|
716
|
-
|
692
|
+
const char *method_name_cstr;
|
693
|
+
CIMCData ret;
|
717
694
|
Check_Type(argin, T_HASH);
|
718
695
|
|
719
|
-
|
696
|
+
cimcargsout = cimcEnv->ft->newArgs(cimcEnv, NULL);
|
720
697
|
|
721
|
-
Data_Get_Struct(self,
|
722
|
-
Data_Get_Struct(object_path,
|
698
|
+
Data_Get_Struct(self, CIMCClient, client);
|
699
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
723
700
|
|
724
701
|
method_name_str = rb_funcall(method_name, rb_intern("to_s"), 0);
|
725
|
-
method_name_cstr =
|
726
|
-
ret =
|
702
|
+
method_name_cstr = to_charptr(method_name_str);
|
703
|
+
ret = client->ft->invokeMethod(client,
|
727
704
|
op,
|
728
705
|
method_name_cstr,
|
729
706
|
sfcc_hash_to_cimargs(argin),
|
730
|
-
|
707
|
+
cimcargsout,
|
731
708
|
&status);
|
732
709
|
if (!status.rc) {
|
733
|
-
if (
|
710
|
+
if (cimcargsout && ! NIL_P(argout)) {
|
734
711
|
Check_Type(argout, T_HASH);
|
735
|
-
rb_funcall(argout, rb_intern("merge!"), 1, sfcc_cimargs_to_hash(
|
712
|
+
rb_funcall(argout, rb_intern("merge!"), 1, sfcc_cimargs_to_hash(cimcargsout));
|
736
713
|
}
|
737
714
|
return sfcc_cimdata_to_value(ret);
|
738
715
|
}
|
@@ -755,18 +732,18 @@ static VALUE set_property(VALUE self,
|
|
755
732
|
VALUE name,
|
756
733
|
VALUE value)
|
757
734
|
{
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
Data_Get_Struct(self,
|
763
|
-
Data_Get_Struct(object_path,
|
735
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
736
|
+
CIMCClient *client;
|
737
|
+
CIMCObjectPath *op;
|
738
|
+
CIMCData data;
|
739
|
+
Data_Get_Struct(self, CIMCClient, client);
|
740
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
764
741
|
data = sfcc_value_to_cimdata(value);
|
765
|
-
status =
|
742
|
+
status = client->ft->setProperty(client, op, to_charptr(name), &data.value, data.type);
|
766
743
|
|
767
744
|
if ( !status.rc )
|
768
745
|
return value;
|
769
|
-
sfcc_rb_raise_if_error(status, "Can't set property '%s'",
|
746
|
+
sfcc_rb_raise_if_error(status, "Can't set property '%s'", to_charptr(name));
|
770
747
|
return Qnil;
|
771
748
|
}
|
772
749
|
|
@@ -782,30 +759,44 @@ static VALUE set_property(VALUE self,
|
|
782
759
|
*/
|
783
760
|
static VALUE property(VALUE self, VALUE object_path, VALUE name)
|
784
761
|
{
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
Data_Get_Struct(self,
|
791
|
-
Data_Get_Struct(object_path,
|
792
|
-
data =
|
762
|
+
CIMCClient *client;
|
763
|
+
CIMCObjectPath *op = NULL;
|
764
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
765
|
+
CIMCData data;
|
766
|
+
|
767
|
+
Data_Get_Struct(self, CIMCClient, client);
|
768
|
+
Data_Get_Struct(object_path, CIMCObjectPath, op);
|
769
|
+
data = client->ft->getProperty(client, op, to_charptr(name), &status);
|
793
770
|
if ( !status.rc )
|
794
771
|
return sfcc_cimdata_to_value(data);
|
795
772
|
|
796
|
-
sfcc_rb_raise_if_error(status, "Can't retrieve property '%s'",
|
773
|
+
sfcc_rb_raise_if_error(status, "Can't retrieve property '%s'", to_charptr(name));
|
797
774
|
return Qnil;
|
798
775
|
}
|
799
776
|
|
800
|
-
static VALUE connect(VALUE klass, VALUE host, VALUE scheme, VALUE port, VALUE user, VALUE pwd
|
777
|
+
static VALUE connect(VALUE klass, VALUE host, VALUE scheme, VALUE port, VALUE user, VALUE pwd,
|
778
|
+
VALUE verify, VALUE trust_store, VALUE cert_file, VALUE key_file)
|
801
779
|
{
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
780
|
+
CIMCClient *client;
|
781
|
+
CIMCStatus status = {CIMC_RC_OK, NULL};
|
782
|
+
/*
|
783
|
+
* CIMCClient* (*connect2)
|
784
|
+
* (CIMCEnv *ce, const char *hn, const char *scheme, const char *port, const char *user, const char *pwd,
|
785
|
+
* int verifyMode, const char * trustStore,
|
786
|
+
* const char * certFile, const char * keyFile,
|
787
|
+
* CIMCStatus *rc);
|
788
|
+
*/
|
789
|
+
|
790
|
+
client = cimcEnv->ft->connect2(cimcEnv,
|
791
|
+
to_charptr(host),
|
792
|
+
to_charptr(scheme),
|
793
|
+
to_charptr(port),
|
794
|
+
to_charptr(user),
|
795
|
+
to_charptr(pwd),
|
796
|
+
(verify == Qfalse)?0:1,
|
797
|
+
to_charptr(trust_store),
|
798
|
+
to_charptr(cert_file),
|
799
|
+
to_charptr(key_file),
|
809
800
|
&status);
|
810
801
|
if ( !status.rc )
|
811
802
|
return Sfcc_wrap_cim_client(client);
|
@@ -814,10 +805,8 @@ static VALUE connect(VALUE klass, VALUE host, VALUE scheme, VALUE port, VALUE us
|
|
814
805
|
}
|
815
806
|
|
816
807
|
VALUE
|
817
|
-
Sfcc_wrap_cim_client(
|
808
|
+
Sfcc_wrap_cim_client(CIMCClient *client)
|
818
809
|
{
|
819
|
-
assert(client);
|
820
|
-
SFCC_INC_REFCOUNT(client);
|
821
810
|
return Data_Wrap_Struct(cSfccCimClient, NULL, dealloc, client);
|
822
811
|
}
|
823
812
|
|
@@ -833,14 +822,14 @@ void init_cim_client()
|
|
833
822
|
VALUE klass = rb_define_class_under(cimc, "Client", rb_cObject);
|
834
823
|
cSfccCimClient = klass;
|
835
824
|
|
836
|
-
rb_define_singleton_method(klass, "native_connect", connect,
|
825
|
+
rb_define_singleton_method(klass, "native_connect", connect, 9);
|
837
826
|
rb_define_method(klass, "get_class", get_class, -1);
|
838
827
|
rb_define_method(klass, "class_names", class_names, -1);
|
839
828
|
rb_define_method(klass, "classes", classes, -1);
|
840
829
|
rb_define_method(klass, "get_instance", get_instance, -1);
|
841
830
|
rb_define_method(klass, "create_instance", create_instance, 2);
|
842
831
|
rb_define_method(klass, "set_instance", set_instance, -1);
|
843
|
-
rb_define_method(klass, "delete_instance", delete_instance, 1);
|
832
|
+
rb_define_method(klass, "delete_instance", delete_instance, 1);
|
844
833
|
rb_define_method(klass, "query", query, 3);
|
845
834
|
rb_define_method(klass, "instance_names", instance_names, 1);
|
846
835
|
rb_define_method(klass, "instances", instances, -1);
|