cmpi-bindings 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ #
2
+ # extconf.rb for cmpi-bindings Gem
3
+ #
4
+
5
+ require 'mkmf'
6
+ # $CFLAGS = "#{$CFLAGS} -Werror"
7
+
8
+ # requires sblim-cmpi-devel or tog-pegasus-devel
9
+
10
+ find_header 'cmpidt.h', '/usr/include/cmpi', '/usr/include/Pegasus/Provider/CMPI'
11
+
12
+ $CPPFLAGS = "-I/usr/include/cmpi -I/usr/include/Pegasus/Provider/CMPI -I.."
13
+
14
+ create_makefile('cmpi-bindings')
@@ -0,0 +1,125 @@
1
+ /*
2
+ * This file defines functions for manipulating null-terminated arrays of
3
+ * pointers to strings (string arrays).
4
+ */
5
+ #ifndef string_array_h
6
+ #define string_array_h
7
+
8
+ #include <stdio.h>
9
+ #include <stdlib.h>
10
+
11
+ static size_t string_array_size(char** array)
12
+ {
13
+ char** p;
14
+
15
+ if (!array)
16
+ return 0;
17
+
18
+ for (p = array; *p; p++)
19
+ ;
20
+
21
+ return p - array;
22
+ }
23
+
24
+ static char** string_array_clone(char** array)
25
+ {
26
+ char** p;
27
+ size_t n;
28
+ size_t i;
29
+
30
+ if (!array)
31
+ {
32
+ p = (char**)malloc(sizeof(char*));
33
+ *p = NULL;
34
+ return p;
35
+ }
36
+
37
+ n = string_array_size(array);
38
+
39
+ if (!(p = (char**)malloc((n + 1) * sizeof(char*))))
40
+ return NULL;
41
+
42
+ for (i = 0; i < n; i++)
43
+ p[i] = strdup(array[i]);
44
+
45
+ p[i] = NULL;
46
+
47
+ return p;
48
+ }
49
+
50
+ static char** string_array_append(char** array, const char* str)
51
+ {
52
+ size_t n;
53
+
54
+ n = string_array_size(array);
55
+
56
+ if (!(array = (char**)realloc(array, (n + 2) * sizeof(char*))))
57
+ return NULL;
58
+
59
+ array[n] = strdup(str);
60
+ array[n+1] = NULL;
61
+
62
+ return array;
63
+ }
64
+
65
+ static void string_array_free(char** array)
66
+ {
67
+ char** p;
68
+
69
+ if (!array)
70
+ return;
71
+
72
+ for (p = array; *p; p++)
73
+ free(*p);
74
+
75
+ free(array);
76
+ }
77
+
78
+ #if 0
79
+ static const char* string_array_find(char** array, const char* str)
80
+ {
81
+ char** p;
82
+
83
+ for (p = array; *p; p++)
84
+ {
85
+ if (strcmp(*p, str) == 0)
86
+ return *p;
87
+ }
88
+
89
+ /* Not found! */
90
+ return NULL;
91
+ }
92
+ #endif
93
+
94
+ static const char* string_array_find_ignore_case(char** array, const char* str)
95
+ {
96
+ char** p;
97
+
98
+ for (p = array; *p; p++)
99
+ {
100
+ if (strcasecmp(*p, str) == 0)
101
+ return *p;
102
+ }
103
+
104
+ /* Not found! */
105
+ return NULL;
106
+ }
107
+
108
+ #if 0
109
+ static void string_array_print(char** array)
110
+ {
111
+ char** p;
112
+
113
+ printf("string_array\n");
114
+ printf("{\n");
115
+
116
+ for (p = array; *p; p++)
117
+ {
118
+ printf(" {%s}\n", *p);
119
+ }
120
+
121
+ printf("}\n");
122
+ }
123
+ #endif
124
+
125
+ #endif /* string_array_h */
@@ -0,0 +1,1302 @@
1
+ /*****************************************************************************
2
+ * Copyright (C) 2008 Novell Inc. All rights reserved.
3
+ * Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * - Redistributions of source code must retain the above copyright notice,
9
+ * this list of conditions and the following disclaimer.
10
+ *
11
+ * - Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the
16
+ * names of its contributors may be used to endorse or promote products
17
+ * derived from this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ * ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR
23
+ * THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *****************************************************************************/
31
+
32
+ #include <sys/types.h>
33
+ #include <stdio.h>
34
+ #include <stdarg.h>
35
+ #include <unistd.h>
36
+ #include <pthread.h>
37
+
38
+ /* Include the required CMPI macros, data types, and API function headers */
39
+ #include <cmpi/cmpidt.h>
40
+ #include <cmpi/cmpift.h>
41
+ #include <cmpi/cmpimacs.h>
42
+
43
+ // Needed to obtain errno of failed system calls
44
+ #include <errno.h>
45
+
46
+ /* Needed for kill() */
47
+ #include <signal.h>
48
+
49
+ /* A simple stderr logging/tracing facility. */
50
+ #ifndef _SBLIM_TRACE
51
+ #define _SBLIM_TRACE(tracelevel,args) _logstderr args
52
+ void _logstderr(char *fmt,...)
53
+ {
54
+ va_list ap;
55
+ va_start(ap,fmt);
56
+ vfprintf(stderr,fmt,ap);
57
+ va_end(ap);
58
+ fprintf(stderr,"\n");
59
+ }
60
+ #endif
61
+
62
+ #define _CMPI_SETFAIL(msgstr) {if (st != NULL) st->rc = CMPI_RC_ERR_FAILED; st->msg = msgstr; }
63
+
64
+ /*
65
+ **==============================================================================
66
+ **
67
+ ** Local definitions:
68
+ **
69
+ **==============================================================================
70
+ */
71
+
72
+ /*
73
+ * per-MI struct to keep
74
+ * - name of MI
75
+ * - pointer to target instrumentation
76
+ * - pointer to Broker
77
+ */
78
+
79
+ typedef struct __ProviderMIHandle
80
+ {
81
+ char *miName;
82
+ Target_Type implementation;
83
+ const CMPIBroker* broker;
84
+ const CMPIContext* context;
85
+ } ProviderMIHandle;
86
+
87
+
88
+ /*
89
+ * string2target
90
+ * char* -> Target_Type
91
+ *
92
+ * *must* be called within TARGET_THREAD_BEGIN_BLOCK/TARGET_THREAD_END_BLOCK
93
+ */
94
+
95
+ static Target_Type
96
+ string2target(const char *s)
97
+ {
98
+ Target_Type obj;
99
+
100
+ if (s == NULL)
101
+ {
102
+ obj = Target_Null;
103
+ Target_INCREF(obj);
104
+ }
105
+ else
106
+ {
107
+ obj = Target_String(s);
108
+ }
109
+ return obj;
110
+ }
111
+
112
+
113
+ /*
114
+ * proplist2target
115
+ * char** -> Target_Type
116
+ *
117
+ * *must* be called within TARGET_THREAD_BEGIN_BLOCK/TARGET_THREAD_END_BLOCK
118
+ */
119
+
120
+ static Target_Type
121
+ proplist2target(const char** cplist)
122
+ {
123
+ Target_Type pl;
124
+
125
+ if (cplist == NULL)
126
+ {
127
+ pl = Target_Null;
128
+ Target_INCREF(pl);
129
+ }
130
+ else
131
+ {
132
+ pl = Target_Array();
133
+ for (; (cplist!=NULL && *cplist != NULL); ++cplist)
134
+ {
135
+ Target_Append(pl, Target_String(*cplist));
136
+ }
137
+ }
138
+ return pl;
139
+ }
140
+
141
+
142
+ static char *
143
+ fmtstr(const char* fmt, ...)
144
+ {
145
+ va_list ap;
146
+ int len;
147
+ char* str;
148
+
149
+ va_start(ap, fmt);
150
+ len = vsnprintf(NULL, 0, fmt, ap);
151
+ va_end(ap);
152
+ if (len <= 0)
153
+ {
154
+ return NULL;
155
+ }
156
+ str = (char*)malloc(len+1);
157
+ if (str == NULL)
158
+ {
159
+ return NULL;
160
+ }
161
+ va_start(ap, fmt);
162
+ vsnprintf(str, len+1, fmt, ap);
163
+ va_end(ap);
164
+ return str;
165
+ }
166
+
167
+
168
+ /*
169
+ **==============================================================================
170
+ **
171
+ ** Local definitions:
172
+ **
173
+ **==============================================================================
174
+ */
175
+
176
+
177
+ /*
178
+ * There is one target interpreter, serving multiple MIs
179
+ * The number of MIs using the interpreter is counted in _MI_COUNT,
180
+ * when the last user goes aways, the target interpreter is unloaded.
181
+ *
182
+ * _CMPI_INIT_MUTEX protects this references counter from concurrent access.
183
+ *
184
+ */
185
+
186
+ #if defined(SWIGPERL)
187
+ static PerlInterpreter * _TARGET_INIT = 0; /* acts as a boolean - is target initialized? */
188
+ #else
189
+ static int _TARGET_INIT = 0; /* acts as a boolean - is target initialized? */
190
+ #endif
191
+ static int _MI_COUNT = 0; /* use count, number of MIs */
192
+ static pthread_mutex_t _CMPI_INIT_MUTEX = PTHREAD_MUTEX_INITIALIZER; /* mutex around _MI_COUNT */
193
+
194
+ #ifndef SWIGRUBY
195
+ static Target_Type _TARGET_MODULE = Target_Null; /* The target module (aka namespace) */
196
+ #endif
197
+
198
+ #if defined(SWIGPYTHON)
199
+ #include "target_python.c"
200
+ #endif
201
+
202
+ #if defined(SWIGRUBY)
203
+ #include "target_ruby.c"
204
+ #endif
205
+
206
+ #if defined(SWIGPERL)
207
+ #include "target_perl.c"
208
+ #endif
209
+
210
+ /*
211
+ * Cleanup
212
+ *
213
+ */
214
+
215
+ static CMPIStatus
216
+ Cleanup(
217
+ ProviderMIHandle * miHdl,
218
+ const CMPIContext * context,
219
+ CMPIBoolean terminating)
220
+ {
221
+ _SBLIM_TRACE(1,("Cleanup() called, miHdl %p, miHdl->implementation %p, context %p, terminating %d",
222
+ miHdl, miHdl->implementation, context, terminating));
223
+ CMPIStatus status = {CMPI_RC_OK, NULL};
224
+
225
+ if (miHdl->implementation != Target_Null)
226
+ {
227
+ Target_Type _context;
228
+ Target_Type _terminating;
229
+
230
+ TARGET_THREAD_BEGIN_BLOCK;
231
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
232
+ _terminating = Target_Bool(terminating);
233
+
234
+ TargetCall(miHdl, &status, "cleanup", 2, _context, _terminating);
235
+ TARGET_THREAD_END_BLOCK;
236
+ _SBLIM_TRACE(1,("Cleanup() %d", status.rc));
237
+ }
238
+
239
+ if (!terminating && (status.rc == CMPI_RC_DO_NOT_UNLOAD ||
240
+ status.rc == CMPI_RC_NEVER_UNLOAD))
241
+ {
242
+ _SBLIM_TRACE(1,("Cleanup() Provider requested not to be unloaded."));
243
+ return status;
244
+ }
245
+
246
+ TargetCleanup(miHdl);
247
+ if (miHdl != NULL)
248
+ {
249
+ free(miHdl->miName);
250
+
251
+ // we must free the miHdl - it is our ProviderMIHandle.
252
+ // it is pointed to by the CMPI<type>MI * that the broker holds onto...
253
+ // the broker is responsible for freeing the CMPI<type>MI*
254
+ free(miHdl);
255
+ miHdl = NULL;
256
+ }
257
+
258
+ _SBLIM_TRACE(1,("Cleanup() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
259
+ return status;
260
+ }
261
+
262
+
263
+ /*
264
+ **==============================================================================
265
+ **
266
+ ** Provider Interface functions
267
+ **
268
+ **==============================================================================
269
+ */
270
+
271
+ /*
272
+ * InstCleanup
273
+ */
274
+
275
+ static CMPIStatus
276
+ InstCleanup(CMPIInstanceMI * self,
277
+ const CMPIContext * context,
278
+ CMPIBoolean terminating)
279
+ {
280
+ CMPIStatus st;
281
+ _SBLIM_TRACE(1,("Cleanup() called for Instance provider %s", ((ProviderMIHandle *)self->hdl)->miName));
282
+ st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating);
283
+ if (terminating && st.rc == CMPI_RC_OK)
284
+ free(self);
285
+ return st;
286
+ }
287
+
288
+
289
+ /*
290
+ * AssocCleanup
291
+ */
292
+
293
+ static CMPIStatus
294
+ AssocCleanup(CMPIAssociationMI * self,
295
+ const CMPIContext * context,
296
+ CMPIBoolean terminating)
297
+ {
298
+ CMPIStatus st;
299
+ _SBLIM_TRACE(1,("Cleanup() called for Association provider %s", ((ProviderMIHandle *)self->hdl)->miName));
300
+ st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating);
301
+ if (terminating && st.rc == CMPI_RC_OK)
302
+ free(self);
303
+ return st;
304
+ }
305
+
306
+
307
+ /*
308
+ * MethodCleanup
309
+ */
310
+
311
+ static CMPIStatus
312
+ MethodCleanup(CMPIMethodMI * self,
313
+ const CMPIContext * context,
314
+ CMPIBoolean terminating)
315
+ {
316
+ CMPIStatus st;
317
+ _SBLIM_TRACE(1,("Cleanup() called for Method provider %s", ((ProviderMIHandle *)self->hdl)->miName));
318
+ st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating);
319
+ if (terminating && st.rc == CMPI_RC_OK)
320
+ free(self);
321
+ return st;
322
+ }
323
+
324
+
325
+ /*
326
+ * IndicationCleanup
327
+ */
328
+
329
+ static CMPIStatus
330
+ IndicationCleanup(CMPIIndicationMI * self,
331
+ const CMPIContext * context,
332
+ CMPIBoolean terminating)
333
+ {
334
+ CMPIStatus st;
335
+ _SBLIM_TRACE(1,("Cleanup() called for Indication provider %s", ((ProviderMIHandle *)self->hdl)->miName));
336
+ st = Cleanup((ProviderMIHandle*)self->hdl, context, terminating);
337
+ if (terminating && st.rc == CMPI_RC_OK)
338
+ free(self);
339
+ return st;
340
+ }
341
+
342
+ // ----------------------------------------------------------------------------
343
+
344
+
345
+ /*
346
+ * EnumInstanceNames() - return a list of all the instances names (i.e. return their object paths only)
347
+ */
348
+ static CMPIStatus
349
+ EnumInstanceNames(CMPIInstanceMI * self,
350
+ const CMPIContext * context,
351
+ const CMPIResult * result,
352
+ const CMPIObjectPath * reference)
353
+ {
354
+ Target_Type _context;
355
+ Target_Type _result;
356
+ Target_Type _reference;
357
+
358
+ CMPIStatus status = {CMPI_RC_OK, NULL};
359
+
360
+ _SBLIM_TRACE(1,("EnumInstancesNames() called, self %p, context %p, result %p, reference %p", self, context, result, reference));
361
+
362
+ TARGET_THREAD_BEGIN_BLOCK;
363
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
364
+ _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0);
365
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
366
+
367
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3,
368
+ _context,
369
+ _result,
370
+ _reference);
371
+ TARGET_THREAD_END_BLOCK;
372
+ _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
373
+ return status;
374
+ }
375
+
376
+
377
+ // ----------------------------------------------------------------------------
378
+
379
+
380
+ /*
381
+ * EnumInstances() - return a list of all the instances (i.e. return all the instance data)
382
+ */
383
+ static CMPIStatus
384
+ EnumInstances(CMPIInstanceMI * self,
385
+ const CMPIContext * context,
386
+ const CMPIResult * result,
387
+ const CMPIObjectPath * reference,
388
+ const char ** properties)
389
+ {
390
+ Target_Type _context;
391
+ Target_Type _result;
392
+ Target_Type _reference;
393
+ Target_Type _properties;
394
+
395
+ CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */
396
+ /* char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); Our current CIM namespace */
397
+
398
+ _SBLIM_TRACE(1,("EnumInstances() called, self %p, context %p, result %p, reference %p, properties %p", self, context, result, reference, properties));
399
+
400
+ TARGET_THREAD_BEGIN_BLOCK;
401
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
402
+ _result = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0);
403
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
404
+ _properties = proplist2target(properties);
405
+
406
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "enum_instances", 4,
407
+ _context,
408
+ _result,
409
+ _reference,
410
+ _properties);
411
+ TARGET_THREAD_END_BLOCK;
412
+ _SBLIM_TRACE(1,("EnumInstances() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
413
+ return status;
414
+ }
415
+
416
+
417
+ // ----------------------------------------------------------------------------
418
+
419
+
420
+ /*
421
+ * GetInstance() - return the instance data for the specified instance only
422
+ */
423
+ static CMPIStatus
424
+ GetInstance(CMPIInstanceMI * self,
425
+ const CMPIContext * context,
426
+ const CMPIResult * results,
427
+ const CMPIObjectPath * reference,
428
+ const char ** properties)
429
+ {
430
+ Target_Type _context;
431
+ Target_Type _result;
432
+ Target_Type _reference;
433
+ Target_Type _properties;
434
+
435
+ CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */
436
+
437
+ _SBLIM_TRACE(1,("GetInstance() called, self %p, context %p, results %p, reference %p, properties %p", self, context, results, reference, properties));
438
+
439
+ TARGET_THREAD_BEGIN_BLOCK;
440
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
441
+ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0);
442
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
443
+ _properties = proplist2target(properties);
444
+
445
+ /* For Python, TargetCall() packs all arguments into a tuple and releases this tuple,
446
+ * effectively DECREFing all elements */
447
+
448
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "get_instance", 4,
449
+ _context,
450
+ _result,
451
+ _reference,
452
+ _properties);
453
+ TARGET_THREAD_END_BLOCK;
454
+ _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
455
+ return status;
456
+ }
457
+
458
+
459
+ // ----------------------------------------------------------------------------
460
+
461
+
462
+ /*
463
+ * CreateInstance() - create a new instance from the specified instance data.
464
+ */
465
+ static CMPIStatus
466
+ CreateInstance(CMPIInstanceMI * self,
467
+ const CMPIContext * context,
468
+ const CMPIResult * results,
469
+ const CMPIObjectPath * reference,
470
+ const CMPIInstance * newinstance)
471
+ {
472
+ Target_Type _context;
473
+ Target_Type _result;
474
+ Target_Type _reference;
475
+ Target_Type _newinst;
476
+
477
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */
478
+
479
+
480
+ /* Creating new instances is not supported for this class. */
481
+
482
+ _SBLIM_TRACE(1,("CreateInstance() called, context %p, results %p, reference %p, newinstance %p", context, results, reference, newinstance));
483
+
484
+ TARGET_THREAD_BEGIN_BLOCK;
485
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
486
+ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0);
487
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
488
+ _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0);
489
+
490
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "create_instance", 4,
491
+ _context,
492
+ _result,
493
+ _reference,
494
+ _newinst);
495
+ TARGET_THREAD_END_BLOCK;
496
+ _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
497
+ return status;
498
+ }
499
+
500
+
501
+ // ----------------------------------------------------------------------------
502
+
503
+ #ifdef CMPI_VER_100
504
+ #define SetInstance ModifyInstance
505
+ #endif
506
+
507
+ /*
508
+ * SetInstance() - save modified instance data for the specified instance.
509
+ */
510
+ static CMPIStatus
511
+ SetInstance(CMPIInstanceMI * self,
512
+ const CMPIContext * context,
513
+ const CMPIResult * results,
514
+ const CMPIObjectPath * reference,
515
+ const CMPIInstance * newinstance,
516
+ const char ** properties)
517
+ {
518
+ Target_Type _context;
519
+ Target_Type _result;
520
+ Target_Type _reference;
521
+ Target_Type _newinst;
522
+ Target_Type plist;
523
+
524
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */
525
+
526
+ /* Modifying existing instances is not supported for this class. */
527
+
528
+ _SBLIM_TRACE(1,("SetInstance() called, context %p, results %p, reference %p, newinstance %p, properties %p", context, results, reference, newinstance, properties));
529
+
530
+ TARGET_THREAD_BEGIN_BLOCK;
531
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
532
+ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0);
533
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
534
+ _newinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0);
535
+ plist = proplist2target(properties);
536
+
537
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "set_instance", 5,
538
+ _context,
539
+ _result,
540
+ _reference,
541
+ _newinst,
542
+ plist);
543
+ TARGET_THREAD_END_BLOCK;
544
+ _SBLIM_TRACE(1,("SetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
545
+ return status;
546
+ }
547
+
548
+
549
+ /* ---------------------------------------------------------------------------- */
550
+
551
+ /*
552
+ * DeleteInstance() - delete/remove the specified instance.
553
+ */
554
+ static CMPIStatus
555
+ DeleteInstance(CMPIInstanceMI * self,
556
+ const CMPIContext * context,
557
+ const CMPIResult * results,
558
+ const CMPIObjectPath * reference)
559
+ {
560
+ Target_Type _context;
561
+ Target_Type _result;
562
+ Target_Type _reference;
563
+
564
+ CMPIStatus status = {CMPI_RC_OK, NULL};
565
+
566
+ _SBLIM_TRACE(1,("DeleteInstance() called, context %p, results %p, reference %p", context, results, reference));
567
+
568
+ TARGET_THREAD_BEGIN_BLOCK;
569
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
570
+ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0);
571
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
572
+
573
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "delete_instance", 3,
574
+ _context,
575
+ _result,
576
+ _reference);
577
+ TARGET_THREAD_END_BLOCK;
578
+ _SBLIM_TRACE(1,("DeleteInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
579
+ return status;
580
+ }
581
+
582
+
583
+ /* ---------------------------------------------------------------------------- */
584
+
585
+ /*
586
+ * ExecQuery() - return a list of all the instances that satisfy the desired query filter.
587
+ */
588
+ static CMPIStatus
589
+ ExecQuery(CMPIInstanceMI * self,
590
+ const CMPIContext * context,
591
+ const CMPIResult * results,
592
+ const CMPIObjectPath * reference,
593
+ const char * query,
594
+ const char * language)
595
+ {
596
+ Target_Type _context;
597
+ Target_Type _result;
598
+ Target_Type _reference;
599
+ Target_Type _query;
600
+ Target_Type _lang;
601
+
602
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */
603
+
604
+ _SBLIM_TRACE(1,("ExecQuery() called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language));
605
+
606
+ TARGET_THREAD_BEGIN_BLOCK;
607
+ _context = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0);
608
+ _result = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0);
609
+ _reference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
610
+ _query = string2target(query);
611
+ _lang = string2target(language);
612
+
613
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "exec_query", 5,
614
+ _context,
615
+ _result,
616
+ _reference,
617
+ _query,
618
+ _lang);
619
+ TARGET_THREAD_END_BLOCK;
620
+
621
+ /* Query filtering is not supported for this class. */
622
+
623
+ _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
624
+ return status;
625
+ }
626
+
627
+
628
+ /* ----------------------------------------------------------------------------
629
+ * CMPI external API
630
+ * ---------------------------------------------------------------------------- */
631
+
632
+ /*
633
+ * associatorMIFT
634
+ */
635
+
636
+ static CMPIStatus
637
+ associatorNames(
638
+ CMPIAssociationMI* self,
639
+ const CMPIContext* ctx,
640
+ const CMPIResult* rslt,
641
+ const CMPIObjectPath* objName,
642
+ const char* assocClass,
643
+ const char* resultClass,
644
+ const char* role,
645
+ const char* resultRole)
646
+ {
647
+ Target_Type _ctx;
648
+ Target_Type _rslt;
649
+ Target_Type _objName ;
650
+ Target_Type _assocClass;
651
+ Target_Type _resultClass;
652
+ Target_Type _role;
653
+ Target_Type _resultRole;
654
+
655
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
656
+
657
+ _SBLIM_TRACE(1,("associatorNames() called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole));
658
+
659
+ TARGET_THREAD_BEGIN_BLOCK;
660
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
661
+ _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0);
662
+ _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0);
663
+ _assocClass = (Target_Type)NULL;
664
+ _resultClass = (Target_Type)NULL;
665
+ _role = (Target_Type)NULL;
666
+ _resultRole = (Target_Type)NULL;
667
+ if (assocClass != NULL)
668
+ {
669
+ _assocClass = string2target(assocClass);
670
+ }
671
+ if (resultClass != NULL)
672
+ {
673
+ _resultClass = string2target(resultClass);
674
+ }
675
+ if (role != NULL)
676
+ {
677
+ _role = string2target(role);
678
+ }
679
+ if (resultRole != NULL)
680
+ {
681
+ _resultRole = string2target(resultRole);
682
+ }
683
+
684
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "associator_names", 7,
685
+ _ctx,
686
+ _rslt,
687
+ _objName,
688
+ _assocClass,
689
+ _resultClass,
690
+ _role,
691
+ _resultRole);
692
+ TARGET_THREAD_END_BLOCK;
693
+ _SBLIM_TRACE(1,("associatorNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
694
+ return status;
695
+ }
696
+
697
+ /*
698
+ * associators
699
+ */
700
+
701
+ static CMPIStatus
702
+ associators(
703
+ CMPIAssociationMI* self,
704
+ const CMPIContext* ctx,
705
+ const CMPIResult* rslt,
706
+ const CMPIObjectPath* objName,
707
+ const char* assocClass,
708
+ const char* resultClass,
709
+ const char* role,
710
+ const char* resultRole,
711
+ const char** properties)
712
+ {
713
+ Target_Type _ctx;
714
+ Target_Type _rslt;
715
+ Target_Type _objName;
716
+ Target_Type _props;
717
+ Target_Type _assocClass;
718
+ Target_Type _resultClass;
719
+ Target_Type _role;
720
+ Target_Type _resultRole;
721
+
722
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
723
+
724
+ _SBLIM_TRACE(1,("associators() called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole));
725
+
726
+ TARGET_THREAD_BEGIN_BLOCK;
727
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
728
+ _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0);
729
+ _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0);
730
+ _props = proplist2target(properties);
731
+ _assocClass = (Target_Type)NULL;
732
+ _resultClass = (Target_Type)NULL;
733
+ _role = (Target_Type)NULL;
734
+ _resultRole = (Target_Type)NULL;
735
+ if (assocClass != NULL)
736
+ {
737
+ _assocClass = string2target(assocClass);
738
+ }
739
+ if (resultClass != NULL)
740
+ {
741
+ _resultClass = string2target(resultClass);
742
+ }
743
+ if (role != NULL)
744
+ {
745
+ _role = string2target(role);
746
+ }
747
+ if (resultRole != NULL)
748
+ {
749
+ _resultRole = string2target(resultRole);
750
+ }
751
+
752
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "associators", 8,
753
+ _ctx,
754
+ _rslt,
755
+ _objName,
756
+ _assocClass,
757
+ _resultClass,
758
+ _role,
759
+ _resultRole,
760
+ _props);
761
+
762
+ TARGET_THREAD_END_BLOCK;
763
+ _SBLIM_TRACE(1,("associators() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
764
+ return status;
765
+ }
766
+
767
+ /*
768
+ * referenceNames
769
+ */
770
+
771
+ static CMPIStatus
772
+ referenceNames(
773
+ CMPIAssociationMI* self,
774
+ const CMPIContext* ctx,
775
+ const CMPIResult* rslt,
776
+ const CMPIObjectPath* objName,
777
+ const char* resultClass,
778
+ const char* role)
779
+ {
780
+ Target_Type _ctx;
781
+ Target_Type _rslt;
782
+ Target_Type _objName;
783
+ Target_Type _resultClass;
784
+ Target_Type _role;
785
+
786
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
787
+
788
+ _SBLIM_TRACE(1,("referenceNames() called, ctx %p, rslt %p, objName %p, resultClass %s, role %s", ctx, rslt, objName, resultClass, role));
789
+
790
+ TARGET_THREAD_BEGIN_BLOCK;
791
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
792
+ _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0);
793
+ _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0);
794
+ _resultClass = (Target_Type)NULL;
795
+ _role = (Target_Type)NULL;
796
+ if (role != NULL)
797
+ {
798
+ _role = string2target(role);
799
+ }
800
+ if (resultClass != NULL)
801
+ {
802
+ _resultClass = string2target(resultClass);
803
+ }
804
+
805
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "reference_names", 5,
806
+ _ctx,
807
+ _rslt,
808
+ _objName,
809
+ _resultClass,
810
+ _role);
811
+
812
+ TARGET_THREAD_END_BLOCK;
813
+ _SBLIM_TRACE(1,("referenceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
814
+ return status;
815
+ }
816
+
817
+
818
+ /*
819
+ * references
820
+ */
821
+
822
+ static CMPIStatus
823
+ references(
824
+ CMPIAssociationMI* self,
825
+ const CMPIContext* ctx,
826
+ const CMPIResult* rslt,
827
+ const CMPIObjectPath* objName,
828
+ const char* resultClass,
829
+ const char* role,
830
+ const char** properties)
831
+ {
832
+ Target_Type _ctx;
833
+ Target_Type _rslt;
834
+ Target_Type _objName;
835
+ Target_Type _role;
836
+ Target_Type _resultClass;
837
+ Target_Type _props;
838
+
839
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
840
+
841
+ _SBLIM_TRACE(1,("references() called, ctx %p, rslt %p, objName %p, resultClass %s, role %s, properties %p", ctx, rslt, objName, resultClass, role, properties));
842
+
843
+ TARGET_THREAD_BEGIN_BLOCK;
844
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
845
+ _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0);
846
+ _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0);
847
+ _role = (Target_Type)NULL;
848
+ _resultClass = (Target_Type)NULL;
849
+ if (role != NULL)
850
+ {
851
+ _role = string2target(role);
852
+ }
853
+ if (resultClass != NULL)
854
+ {
855
+ _resultClass = string2target(resultClass);
856
+ }
857
+ _props = proplist2target(properties);
858
+
859
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "references", 6,
860
+ _ctx,
861
+ _rslt,
862
+ _objName,
863
+ _resultClass,
864
+ _role,
865
+ _props);
866
+ TARGET_THREAD_END_BLOCK;
867
+ _SBLIM_TRACE(1,("references() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
868
+ return status;
869
+ }
870
+
871
+ /*
872
+ * invokeMethod
873
+ */
874
+ static CMPIStatus
875
+ invokeMethod(
876
+ CMPIMethodMI* self,
877
+ const CMPIContext* ctx,
878
+ const CMPIResult* rslt,
879
+ const CMPIObjectPath* objName,
880
+ const char* method,
881
+ const CMPIArgs* in,
882
+ CMPIArgs* out)
883
+ {
884
+ Target_Type _ctx;
885
+ Target_Type _objName;
886
+
887
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
888
+
889
+ _SBLIM_TRACE(1,("invokeMethod() called, ctx %p, rslt %p, objName %p, method %s, in %p, out %p", ctx, rslt, objName, method, in, out));
890
+
891
+ TARGET_THREAD_BEGIN_BLOCK;
892
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
893
+ _objName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0);
894
+ #if defined(SWIGRUBY)
895
+ char *methodname = alloca(strlen(method) * 2 + 1);
896
+ decamelize(method, methodname);
897
+ int argsnamesize = strlen(methodname) + 5 + 1;
898
+ char *argsname = alloca(argsnamesize); /* "<name>_args" */
899
+ snprintf(argsname, argsnamesize, "%s_args", methodname);
900
+ /* get the args array, gives names of input and output arguments */
901
+ VALUE args = rb_funcall(((ProviderMIHandle*)self->hdl)->implementation, rb_intern(argsname), 0);
902
+ Check_Type(args, T_ARRAY);
903
+ VALUE argsin = rb_ary_entry(args, 0); /* array of input arg names */
904
+ Check_Type(argsin, T_ARRAY);
905
+ int number_of_arguments = RARRAY_LEN(argsin) / 2;
906
+ /* 3 args will be added by TargetCall, 2 args are added here, others are input args to function */
907
+ VALUE *input = alloca((3 + 2 + number_of_arguments) * sizeof(VALUE));
908
+ input[3] = _ctx;
909
+ input[4] = _objName;
910
+ /* loop over input arg names and types and get CMPIData via CMGetArg() */
911
+ int i;
912
+ for (i = 0; i < number_of_arguments; i += 2) {
913
+ const char *argname;
914
+ CMPIData data;
915
+ argname = target_charptr(rb_ary_entry(argsin, i));
916
+ data = CMGetArg(in, argname, &status);
917
+ if (status.rc != CMPI_RC_OK) {
918
+ if ((data.state & CMPI_nullValue)
919
+ ||(data.state & CMPI_notFound)) {
920
+ input[5+(i>>1)] = Target_Null;
921
+ continue;
922
+ }
923
+ _SBLIM_TRACE(1,("Failed (rc %d) to get input arg %d:%s for %s", status.rc, i>>1, argname, method));
924
+ return status;
925
+ }
926
+ input[5+(i>>1)] = data_value(&data);
927
+ }
928
+ VALUE result = TargetCall((ProviderMIHandle*)self->hdl, &status, methodname, -(2+number_of_arguments), input);
929
+ /* argsout is array of [<return_type>, <output_arg_name>, <output_arg_type>, ... */
930
+ VALUE argsout = rb_ary_entry(args, 1);
931
+ CMPIValue value;
932
+ CMPIType expected_type;
933
+ CMPIType actual_type;
934
+ Check_Type(argsout, T_ARRAY);
935
+ number_of_arguments = (RARRAY_LEN(argsout) - 1) / 2;
936
+
937
+ if (number_of_arguments > 0) {
938
+ /* if output args are defined, result must be an array
939
+ * result[0] is the return value
940
+ * result[1..n] are the output args in argsout order
941
+ */
942
+ Check_Type(result, T_ARRAY);
943
+
944
+ /* loop over output arg names and types and set CMPIData via CMSetArg() */
945
+ for (i = 0; i < number_of_arguments; i += 2) {
946
+ const char *argname;
947
+ argname = target_charptr(rb_ary_entry(argsout, i+1));
948
+ expected_type = FIX2ULONG(rb_ary_entry(argsout, i+2));
949
+ actual_type = target_to_value(rb_ary_entry(result, (i >> 1) + 1), &value, expected_type);
950
+ status = CMAddArg(out, argname, &value, actual_type);
951
+ if (status.rc != CMPI_RC_OK) {
952
+ _SBLIM_TRACE(1,("Failed (rc %d) to set output arg %d:%s for %s; expected type %x, actual type %x", status.rc, i>>1, argname, method, expected_type, actual_type));
953
+ return status;
954
+ }
955
+ }
956
+ /* result[0] is the return value */
957
+ result = rb_ary_entry(result, 0);
958
+
959
+ }
960
+ expected_type = FIX2ULONG(rb_ary_entry(argsout, 0));
961
+ actual_type = target_to_value(result, &value, expected_type);
962
+ CMReturnData(rslt, &value, actual_type);
963
+ CMReturnDone(rslt);
964
+
965
+ #else
966
+ Target_Type _rslt;
967
+ Target_Type _in;
968
+ Target_Type _out;
969
+ _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0);
970
+ _in = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0);
971
+ _out = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0);
972
+ Target_Type _method;
973
+ _method = string2target(method);
974
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "invoke_method", 6,
975
+ _ctx,
976
+ _rslt,
977
+ _objName,
978
+ _method,
979
+ _in,
980
+ _out);
981
+ #endif
982
+ TARGET_THREAD_END_BLOCK;
983
+ _SBLIM_TRACE(1,("invokeMethod() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
984
+ return status;
985
+ }
986
+
987
+
988
+ /*
989
+ * authorizeFilter
990
+ */
991
+
992
+ static CMPIStatus
993
+ authorizeFilter(
994
+ CMPIIndicationMI* self,
995
+ const CMPIContext* ctx,
996
+ const CMPISelectExp* filter,
997
+ const char* className,
998
+ const CMPIObjectPath* classPath,
999
+ const char* owner)
1000
+ {
1001
+ Target_Type _ctx;
1002
+ Target_Type _filter;
1003
+ Target_Type _classPath;
1004
+ Target_Type _className;
1005
+ Target_Type _owner;
1006
+
1007
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
1008
+
1009
+ _SBLIM_TRACE(1,("authorizeFilter() called, ctx %p, filter %p, className %s, classPath %p, owner %s", ctx, filter, className, classPath, owner));
1010
+
1011
+ TARGET_THREAD_BEGIN_BLOCK;
1012
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
1013
+ _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0);
1014
+ _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0);
1015
+ _className = string2target(className);
1016
+ _owner = string2target(owner);
1017
+
1018
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "authorize_filter", 5,
1019
+ _ctx,
1020
+ _filter,
1021
+ _className,
1022
+ _classPath,
1023
+ _owner);
1024
+ TARGET_THREAD_END_BLOCK;
1025
+ _SBLIM_TRACE(1,("authorizeFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
1026
+ return status;
1027
+ }
1028
+
1029
+
1030
+ /*
1031
+ * activateFilter
1032
+ */
1033
+
1034
+ static CMPIStatus
1035
+ activateFilter(
1036
+ CMPIIndicationMI* self,
1037
+ const CMPIContext* ctx,
1038
+ const CMPISelectExp* filter,
1039
+ const char* className,
1040
+ const CMPIObjectPath* classPath,
1041
+ CMPIBoolean firstActivation)
1042
+ {
1043
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
1044
+ Target_Type _ctx;
1045
+ Target_Type _filter;
1046
+ Target_Type _classPath;
1047
+ Target_Type _firstActivation;
1048
+ Target_Type _className;
1049
+
1050
+ _SBLIM_TRACE(1,("activateFilter() called, ctx %p, filter %p, className %s, classPath %p, firstActivation %d", ctx, filter, className, classPath, firstActivation));
1051
+
1052
+ TARGET_THREAD_BEGIN_BLOCK;
1053
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
1054
+ _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0);
1055
+ _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0);
1056
+ _firstActivation = Target_Bool(firstActivation);
1057
+ _className = string2target(className);
1058
+
1059
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "activate_filter", 5,
1060
+ _ctx,
1061
+ _filter,
1062
+ _className,
1063
+ _classPath,
1064
+ _firstActivation);
1065
+ TARGET_THREAD_END_BLOCK;
1066
+ _SBLIM_TRACE(1,("activateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
1067
+ return status;
1068
+ }
1069
+
1070
+
1071
+ /*
1072
+ * deActivateFilter
1073
+ */
1074
+
1075
+ static CMPIStatus
1076
+ deActivateFilter(
1077
+ CMPIIndicationMI* self,
1078
+ const CMPIContext* ctx,
1079
+ const CMPISelectExp* filter,
1080
+ const char* className,
1081
+ const CMPIObjectPath* classPath,
1082
+ CMPIBoolean lastActivation)
1083
+ {
1084
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
1085
+ Target_Type _ctx;
1086
+ Target_Type _filter;
1087
+ Target_Type _classPath;
1088
+ Target_Type _lastActivation;
1089
+ Target_Type _className;
1090
+
1091
+ _SBLIM_TRACE(1,("deActivateFilter() called, ctx %p, filter %p, className %s, classPath %p, lastActivation %d", ctx, filter, className, classPath, lastActivation));
1092
+
1093
+ TARGET_THREAD_BEGIN_BLOCK;
1094
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
1095
+ _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0);
1096
+ _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0);
1097
+ _lastActivation = Target_Bool(lastActivation);
1098
+ _className = string2target(className);
1099
+
1100
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5,
1101
+ _ctx,
1102
+ _filter,
1103
+ _className,
1104
+ _classPath,
1105
+ _lastActivation);
1106
+ TARGET_THREAD_END_BLOCK;
1107
+ _SBLIM_TRACE(1,("deActivateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
1108
+ return status;
1109
+ }
1110
+
1111
+
1112
+ /*
1113
+ * mustPoll
1114
+ * Note: sfcb doesn't support mustPoll. :(
1115
+ * http://sourceforge.net/mailarchive/message.php?msg_id=OFF38FF3F9.39FD2E1F-ONC1257385.004A7122-C1257385.004BB0AF%40de.ibm.com
1116
+ */
1117
+
1118
+ static CMPIStatus
1119
+ mustPoll(
1120
+ CMPIIndicationMI* self,
1121
+ const CMPIContext* ctx,
1122
+ //const CMPIResult* rslt, TODO: figure out who is right: spec. vs. sblim
1123
+ const CMPISelectExp* filter,
1124
+ const char* className,
1125
+ const CMPIObjectPath* classPath)
1126
+ {
1127
+ Target_Type _ctx;
1128
+ Target_Type _className;
1129
+ Target_Type _filter;
1130
+ Target_Type _classPath;
1131
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
1132
+
1133
+ //_SBLIM_TRACE(1,("mustPoll() called, ctx %p, rslt %p, filter %p, className %s, classPath %p", ctx, rslt, filter, className, classPath));
1134
+ _SBLIM_TRACE(1,("mustPoll() called, ctx %p, filter %p, className %s, classPath %p", ctx, filter, className, classPath));
1135
+
1136
+ TARGET_THREAD_BEGIN_BLOCK;
1137
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
1138
+ //Target_Type _rslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0);
1139
+ _filter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0);
1140
+ _classPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0);
1141
+ _className = string2target(className);
1142
+
1143
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "must_poll", 4,
1144
+ _ctx,
1145
+ //_rslt,
1146
+ _filter,
1147
+ _className,
1148
+ _classPath);
1149
+ TARGET_THREAD_END_BLOCK;
1150
+ _SBLIM_TRACE(1,("mustPoll() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
1151
+ return status;
1152
+ }
1153
+
1154
+
1155
+ /*
1156
+ * enableIndications
1157
+ */
1158
+
1159
+ static CMPIStatus
1160
+ enableIndications(
1161
+ CMPIIndicationMI* self,
1162
+ const CMPIContext* ctx)
1163
+ {
1164
+ Target_Type _ctx;
1165
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
1166
+
1167
+ _SBLIM_TRACE(1,("enableIndications() called, ctx %p", ctx));
1168
+
1169
+ TARGET_THREAD_BEGIN_BLOCK;
1170
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
1171
+
1172
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "enable_indications", 1, _ctx);
1173
+
1174
+ TARGET_THREAD_END_BLOCK;
1175
+ _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
1176
+ return status;
1177
+ }
1178
+
1179
+
1180
+ /*
1181
+ * disableIndications
1182
+ */
1183
+
1184
+ static CMPIStatus
1185
+ disableIndications(
1186
+ CMPIIndicationMI* self,
1187
+ const CMPIContext* ctx)
1188
+ {
1189
+ Target_Type _ctx;
1190
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
1191
+
1192
+ _SBLIM_TRACE(1,("disableIndications() called, ctx %p", ctx));
1193
+
1194
+ TARGET_THREAD_BEGIN_BLOCK;
1195
+ _ctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
1196
+
1197
+ TargetCall((ProviderMIHandle*)self->hdl, &status, "disable_indications", 1, _ctx);
1198
+
1199
+ TARGET_THREAD_END_BLOCK;
1200
+ _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
1201
+ return status;
1202
+
1203
+ }
1204
+
1205
+
1206
+ /***************************************************************************/
1207
+
1208
+ /* MI function tables */
1209
+
1210
+ static CMPIMethodMIFT MethodMIFT__={
1211
+ CMPICurrentVersion,
1212
+ CMPICurrentVersion,
1213
+ "methodCmpi_Swig", // miName
1214
+ MethodCleanup,
1215
+ invokeMethod,
1216
+ };
1217
+
1218
+
1219
+ static CMPIIndicationMIFT IndicationMIFT__={
1220
+ CMPICurrentVersion,
1221
+ CMPICurrentVersion,
1222
+ "indicationCmpi_Swig", // miName
1223
+ IndicationCleanup,
1224
+ authorizeFilter,
1225
+ mustPoll,
1226
+ activateFilter,
1227
+ deActivateFilter,
1228
+ enableIndications,
1229
+ disableIndications,
1230
+ };
1231
+
1232
+
1233
+ static CMPIAssociationMIFT AssociationMIFT__={
1234
+ CMPICurrentVersion,
1235
+ CMPICurrentVersion,
1236
+ "associatonCmpi_Swig", // miName
1237
+ AssocCleanup,
1238
+ associators,
1239
+ associatorNames,
1240
+ references,
1241
+ referenceNames,
1242
+ };
1243
+
1244
+
1245
+ static CMPIInstanceMIFT InstanceMIFT__={
1246
+ CMPICurrentVersion,
1247
+ CMPICurrentVersion,
1248
+ "instanceCmpi_Swig", // miName
1249
+ InstCleanup,
1250
+ EnumInstanceNames,
1251
+ EnumInstances,
1252
+ GetInstance,
1253
+ CreateInstance,
1254
+ SetInstance,
1255
+ DeleteInstance,
1256
+ ExecQuery,
1257
+ };
1258
+
1259
+
1260
+ static int
1261
+ createInit(ProviderMIHandle* miHdl, CMPIStatus* st)
1262
+ {
1263
+ _SBLIM_TRACE(1,("\n>>>>> createInit() called, broker %p, miname= %s (ctx=%p), status %p\n", miHdl->broker, miHdl->miName, miHdl->context, st));
1264
+ return TargetInitialize(miHdl, st);
1265
+ }
1266
+
1267
+
1268
+ #define SWIG_CMPI_MI_FACTORY(ptype) \
1269
+ CMPI##ptype##MI* _Generic_Create_##ptype##MI(const CMPIBroker* broker, \
1270
+ const CMPIContext* context, const char* miname, CMPIStatus* st)\
1271
+ { \
1272
+ CMPI##ptype##MI *mi; \
1273
+ ProviderMIHandle *hdl; \
1274
+ _SBLIM_TRACE(1, ("\n>>>>> in FACTORY: CMPI"#ptype"MI* _Generic_Create_"#ptype"MI... miname=%s", miname)); \
1275
+ hdl = (ProviderMIHandle*)malloc(sizeof(ProviderMIHandle)); \
1276
+ if (hdl) { \
1277
+ hdl->implementation = Target_Null; \
1278
+ hdl->miName = strdup(miname); \
1279
+ hdl->broker = broker; \
1280
+ hdl->context = context; \
1281
+ } \
1282
+ if (createInit(hdl, st) != 0) { \
1283
+ free(hdl->miName); \
1284
+ free(hdl); \
1285
+ return NULL; \
1286
+ } \
1287
+ mi = (CMPI##ptype##MI*)malloc(sizeof(CMPI##ptype##MI)); \
1288
+ if (mi) { \
1289
+ mi->hdl = hdl; \
1290
+ mi->ft = &ptype##MIFT__; \
1291
+ } \
1292
+ ++_MI_COUNT; \
1293
+ _SBLIM_TRACE(1, ("\n>>>>>_MI_COUNT %d: returning mi=0x%08x hdl=0x%08x, hdl->implementation=%p mi->ft=0x%08x\n", _MI_COUNT, mi, mi->hdl, hdl->implementation, mi->ft)); \
1294
+ return mi; \
1295
+ }
1296
+
1297
+ SWIG_CMPI_MI_FACTORY(Instance)
1298
+ SWIG_CMPI_MI_FACTORY(Method)
1299
+ SWIG_CMPI_MI_FACTORY(Association)
1300
+ SWIG_CMPI_MI_FACTORY(Indication)
1301
+
1302
+ #undef _CMPI_SETFAIL