openwsman 2.4.1 → 2.4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/openwsman/extconf.rb +6 -0
- data/ext/openwsman/openwsman.i +595 -0
- data/ext/openwsman/version.i +11 -0
- data/ext/openwsman/wsman-client.i +603 -0
- data/ext/openwsman/wsman-client_opt.i +649 -0
- data/ext/openwsman/wsman-epr.i +288 -0
- data/ext/openwsman/wsman-filter.i +190 -0
- data/ext/openwsman/wsman-names.i +61 -0
- data/ext/openwsman/wsman-soap.i +733 -0
- data/ext/openwsman/wsman-transport.i +636 -0
- data/ext/openwsman/wsman-xml.i +851 -0
- data/lib/openwsman/version.rb +1 -1
- metadata +50 -35
- data/ext/openwsman/openwsman_wrap.c +0 -13912
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 05d9166f187b741d314e0dcef1425925cad610e7
|
|
4
|
+
data.tar.gz: 3b9dac7671f734ecc1f11596b0d8edf124b622a2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 56aea7009ab94074582ff95c7666e3d9fead0a5b2c4ace7062e075fec7ab34f8f0029817349a5e6f3b8bbe8eb6779a71e2e053afe66104394c968a334d838c9c
|
|
7
|
+
data.tar.gz: ab60cc7cb66e9721c7c2d8463465084f9fb423fc6aebe775bc5e71bdb3e416cfa370a56ed154d50b1b21a0c7225f9d618553773112977ffb4748dbbefa6aaf92
|
data/ext/openwsman/extconf.rb
CHANGED
|
@@ -28,6 +28,12 @@ unless have_library('xml2', 'xmlNewDoc')
|
|
|
28
28
|
end
|
|
29
29
|
find_header 'libxml/parser.h', '/usr/include/libxml2'
|
|
30
30
|
|
|
31
|
+
swig = find_executable("swig")
|
|
32
|
+
raise "SWIG not found" unless swig
|
|
33
|
+
|
|
34
|
+
major, minor, path = RUBY_VERSION.split(".")
|
|
35
|
+
raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} -I. -I/usr/include/openwsman -o openwsman_wrap.c openwsman.i")
|
|
36
|
+
|
|
31
37
|
$CPPFLAGS = "-I/usr/include/openwsman -I.."
|
|
32
38
|
|
|
33
39
|
create_makefile('_openwsman')
|
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
%{
|
|
2
|
+
/*
|
|
3
|
+
* type definitions to keep the C code generic
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#if defined(SWIGPYTHON)
|
|
7
|
+
#define Target_Null_p(x) (x == Py_None)
|
|
8
|
+
#define Target_INCREF(x) Py_INCREF(x)
|
|
9
|
+
#define Target_DECREF(x) Py_DECREF(x)
|
|
10
|
+
#define Target_True Py_True
|
|
11
|
+
#define Target_False Py_False
|
|
12
|
+
#define Target_Null Py_None
|
|
13
|
+
#define Target_Type PyObject*
|
|
14
|
+
#define Target_Bool(x) PyBool_FromLong(x)
|
|
15
|
+
#define Target_Char16(x) PyInt_FromLong(x)
|
|
16
|
+
#define Target_Int(x) PyInt_FromLong(x)
|
|
17
|
+
#define Target_String(x) PyString_FromString(x)
|
|
18
|
+
#define Target_Real(x) Py_None
|
|
19
|
+
#define Target_Array() PyList_New(0)
|
|
20
|
+
#define Target_SizedArray(len) PyList_New(len)
|
|
21
|
+
#define Target_ListSet(x,n,y) PyList_SetItem(x,n,y)
|
|
22
|
+
#define Target_Append(x,y) PyList_Append(x,y)
|
|
23
|
+
#include <Python.h>
|
|
24
|
+
#define TARGET_THREAD_BEGIN_BLOCK SWIG_PYTHON_THREAD_BEGIN_BLOCK
|
|
25
|
+
#define TARGET_THREAD_END_BLOCK SWIG_PYTHON_THREAD_END_BLOCK
|
|
26
|
+
#define TARGET_THREAD_BEGIN_ALLOW SWIG_PYTHON_THREAD_BEGIN_ALLOW
|
|
27
|
+
#define TARGET_THREAD_END_ALLOW SWIG_PYTHON_THREAD_END_ALLOW
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#if defined(SWIGRUBY)
|
|
31
|
+
#define Target_Null_p(x) NIL_P(x)
|
|
32
|
+
#define Target_INCREF(x)
|
|
33
|
+
#define Target_DECREF(x)
|
|
34
|
+
#define Target_True Qtrue
|
|
35
|
+
#define Target_False Qfalse
|
|
36
|
+
#define Target_Null Qnil
|
|
37
|
+
#define Target_Type VALUE
|
|
38
|
+
#define Target_Bool(x) ((x)?Qtrue:Qfalse)
|
|
39
|
+
#define Target_Char16(x) INT2FIX(x)
|
|
40
|
+
#define Target_Int(x) INT2FIX(x)
|
|
41
|
+
#define Target_String(x) rb_str_new2(x)
|
|
42
|
+
#define Target_Real(x) rb_float_new(x)
|
|
43
|
+
#define Target_Array() rb_ary_new()
|
|
44
|
+
#define Target_SizedArray(len) rb_ary_new2(len)
|
|
45
|
+
#define Target_ListSet(x,n,y) rb_ary_store(x,n,y)
|
|
46
|
+
#define Target_Append(x,y) rb_ary_push(x,y)
|
|
47
|
+
#define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
|
|
48
|
+
#define TARGET_THREAD_END_BLOCK do {} while(0)
|
|
49
|
+
#define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
|
|
50
|
+
#define TARGET_THREAD_END_ALLOW do {} while(0)
|
|
51
|
+
#include <ruby.h>
|
|
52
|
+
#if HAVE_RUBY_IO_H
|
|
53
|
+
#include <ruby/io.h> /* Ruby 1.9 style */
|
|
54
|
+
#else
|
|
55
|
+
#include <rubyio.h>
|
|
56
|
+
#endif
|
|
57
|
+
#if HAVE_RUBY_VERSION_H
|
|
58
|
+
#include <ruby/version.h>
|
|
59
|
+
#endif
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
#if defined(SWIGPERL)
|
|
63
|
+
#define TARGET_THREAD_BEGIN_BLOCK do {} while(0)
|
|
64
|
+
#define TARGET_THREAD_END_BLOCK do {} while(0)
|
|
65
|
+
#define TARGET_THREAD_BEGIN_ALLOW do {} while(0)
|
|
66
|
+
#define TARGET_THREAD_END_ALLOW do {} while(0)
|
|
67
|
+
|
|
68
|
+
SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value);
|
|
69
|
+
SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr);
|
|
70
|
+
SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value);
|
|
71
|
+
|
|
72
|
+
#define Target_Null_p(x) (x == NULL)
|
|
73
|
+
#define Target_INCREF(x)
|
|
74
|
+
#define Target_DECREF(x)
|
|
75
|
+
#define Target_True (&PL_sv_yes)
|
|
76
|
+
#define Target_False (&PL_sv_no)
|
|
77
|
+
#define Target_Null NULL
|
|
78
|
+
#define Target_Type SV *
|
|
79
|
+
#define Target_Bool(x) (x)?Target_True:Target_False
|
|
80
|
+
#define Target_Char16(x) SWIG_From_long(x)
|
|
81
|
+
#define Target_Int(x) SWIG_From_long(x)
|
|
82
|
+
#define Target_String(x) SWIG_FromCharPtr(x)
|
|
83
|
+
#define Target_Real(x) SWIG_From_double(x)
|
|
84
|
+
#define Target_Array() (SV *)newAV()
|
|
85
|
+
#define Target_SizedArray(len) (SV *)newAV()
|
|
86
|
+
#define Target_ListSet(x,n,y) av_store((AV *)(x),n,y)
|
|
87
|
+
#define Target_Append(x,y) av_push(((AV *)(x)), y)
|
|
88
|
+
#include <perl.h>
|
|
89
|
+
#include <EXTERN.h>
|
|
90
|
+
#endif
|
|
91
|
+
|
|
92
|
+
%}
|
|
93
|
+
|
|
94
|
+
#if defined(SWIGRUBY)
|
|
95
|
+
%module Openwsman
|
|
96
|
+
|
|
97
|
+
%{
|
|
98
|
+
#include <ruby.h>
|
|
99
|
+
#if HAVE_RUBY_IO_H
|
|
100
|
+
#include <ruby/io.h> /* Ruby 1.9 style */
|
|
101
|
+
#else
|
|
102
|
+
#include <rubyio.h>
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
#if HAVE_RUBY_THREAD_H /* New threading model */
|
|
106
|
+
#include <ruby/thread.h>
|
|
107
|
+
#endif
|
|
108
|
+
%}
|
|
109
|
+
|
|
110
|
+
%typemap(in) FILE* {
|
|
111
|
+
#if RUBY_VERSION > 18
|
|
112
|
+
struct rb_io_t *fptr;
|
|
113
|
+
#else
|
|
114
|
+
struct OpenFile *fptr;
|
|
115
|
+
#endif
|
|
116
|
+
Check_Type($input, T_FILE);
|
|
117
|
+
GetOpenFile($input, fptr);
|
|
118
|
+
/*rb_io_check_writable(fptr);*/
|
|
119
|
+
#if RUBY_VERSION > 18
|
|
120
|
+
$1 = rb_io_stdio_file(fptr);
|
|
121
|
+
#else
|
|
122
|
+
$1 = GetReadFile(fptr);
|
|
123
|
+
#endif
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#endif /* SWIGRUBY */
|
|
127
|
+
|
|
128
|
+
#if defined(SWIGJAVA)
|
|
129
|
+
%module OpenWSMan
|
|
130
|
+
|
|
131
|
+
/* evaluate constants */
|
|
132
|
+
%javaconst(1);
|
|
133
|
+
|
|
134
|
+
/* extend JNI class to automatically load shared library from jar file */
|
|
135
|
+
%pragma(java) jniclassimports=%{
|
|
136
|
+
import java.io.File;
|
|
137
|
+
import java.io.InputStream;
|
|
138
|
+
import java.io.FileOutputStream;
|
|
139
|
+
%}
|
|
140
|
+
%pragma(java) jniclasscode=%{
|
|
141
|
+
public final static String libraryFileName = "libjwsman.so";
|
|
142
|
+
|
|
143
|
+
static {
|
|
144
|
+
InputStream inputStream = OpenWSManJNI.class.getClassLoader()
|
|
145
|
+
.getResourceAsStream(libraryFileName);
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
File libraryFile = File.createTempFile(libraryFileName, null);
|
|
149
|
+
libraryFile.deleteOnExit();
|
|
150
|
+
|
|
151
|
+
FileOutputStream fileOutputStream = new FileOutputStream(libraryFile);
|
|
152
|
+
byte[] buffer = new byte[8192];
|
|
153
|
+
int bytesRead;
|
|
154
|
+
while ((bytesRead = inputStream.read(buffer)) > 0) {
|
|
155
|
+
fileOutputStream.write(buffer, 0, bytesRead);
|
|
156
|
+
}
|
|
157
|
+
fileOutputStream.close();
|
|
158
|
+
inputStream.close();
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
System.load(libraryFile.getPath());
|
|
162
|
+
} catch (UnsatisfiedLinkError e) {
|
|
163
|
+
System.err.println("Arch: " + System.getProperty("os.arch"));
|
|
164
|
+
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
|
165
|
+
}
|
|
166
|
+
} catch (Exception e) {
|
|
167
|
+
e.printStackTrace();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
%}
|
|
171
|
+
|
|
172
|
+
/* get the java environment so we can throw exceptions */
|
|
173
|
+
%{
|
|
174
|
+
static JNIEnv *jenv;
|
|
175
|
+
/*:nodoc:*/
|
|
176
|
+
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
|
177
|
+
(*vm)->AttachCurrentThread(vm, (void **)&jenv, NULL);
|
|
178
|
+
return JNI_VERSION_1_2;
|
|
179
|
+
}
|
|
180
|
+
%}
|
|
181
|
+
#endif /* SWIGJAVA */
|
|
182
|
+
|
|
183
|
+
#if defined(SWIGPYTHON)
|
|
184
|
+
%module pywsman
|
|
185
|
+
#endif
|
|
186
|
+
|
|
187
|
+
#if defined(SWIGPERL)
|
|
188
|
+
%module openwsman
|
|
189
|
+
|
|
190
|
+
//==================================
|
|
191
|
+
// Typemap: Allow FILE* as PerlIO
|
|
192
|
+
//----------------------------------
|
|
193
|
+
%typemap(in) FILE* {
|
|
194
|
+
$1 = PerlIO_findFILE(IoIFP(sv_2io($input)));
|
|
195
|
+
}
|
|
196
|
+
#endif /* SWIGPERL */
|
|
197
|
+
|
|
198
|
+
%{
|
|
199
|
+
#if defined(SWIGPERL)
|
|
200
|
+
/* filter_t is defined in Perls CORE/perl.h */
|
|
201
|
+
#define filter_t filter_type
|
|
202
|
+
|
|
203
|
+
/* undef Perl's die and warn macros as libu is going to reuse this names */
|
|
204
|
+
#undef die
|
|
205
|
+
#undef warn
|
|
206
|
+
#endif /* SWIGPERL */
|
|
207
|
+
|
|
208
|
+
#include <u/libu.h>
|
|
209
|
+
#include <wsman-types.h>
|
|
210
|
+
#include <wsman-client.h>
|
|
211
|
+
#include <wsman-client-transport.h>
|
|
212
|
+
#include <wsman-api.h>
|
|
213
|
+
#include <wsman-xml-binding.h>
|
|
214
|
+
#include <wsman-xml.h>
|
|
215
|
+
#include <wsman-epr.h>
|
|
216
|
+
#include <wsman-filter.h>
|
|
217
|
+
#include <wsman-soap.h>
|
|
218
|
+
#include <wsman-soap-envelope.h>
|
|
219
|
+
#include <openwsman.h>
|
|
220
|
+
|
|
221
|
+
#if defined(SWIGRUBY)
|
|
222
|
+
#include <ruby/helpers.h>
|
|
223
|
+
|
|
224
|
+
SWIGEXPORT
|
|
225
|
+
/* Init_ for the %module, defined by Swig
|
|
226
|
+
* :nodoc:
|
|
227
|
+
*/
|
|
228
|
+
void Init_Openwsman(void);
|
|
229
|
+
|
|
230
|
+
SWIGEXPORT
|
|
231
|
+
/* Init_ for the .so lib, called by Ruby
|
|
232
|
+
* :nodoc:
|
|
233
|
+
*/
|
|
234
|
+
void Init__openwsman(void) {
|
|
235
|
+
Init_Openwsman();
|
|
236
|
+
}
|
|
237
|
+
#endif
|
|
238
|
+
#if defined(SWIGPYTHON)
|
|
239
|
+
#include <python/helpers.h>
|
|
240
|
+
#endif
|
|
241
|
+
#if defined(SWIGJAVA)
|
|
242
|
+
#include <java/helpers.h>
|
|
243
|
+
#endif
|
|
244
|
+
#if defined(SWIGPERL)
|
|
245
|
+
#include <perl/helpers.h>
|
|
246
|
+
#endif
|
|
247
|
+
|
|
248
|
+
/* Provide WsManTransport definition so it can be used as
|
|
249
|
+
* dedicated datatype in bindings.
|
|
250
|
+
* :nodoc:ly, its aliased to WsManClient
|
|
251
|
+
*
|
|
252
|
+
*/
|
|
253
|
+
struct _WsManTransport { };
|
|
254
|
+
typedef struct _WsManTransport WsManTransport;
|
|
255
|
+
|
|
256
|
+
static void set_debug(int dbg);
|
|
257
|
+
|
|
258
|
+
/*
|
|
259
|
+
* Set openwsman debug level.
|
|
260
|
+
* call-seq:
|
|
261
|
+
* Openwsman::debug = -1 # full debug
|
|
262
|
+
*
|
|
263
|
+
*/
|
|
264
|
+
static void set_debug(int dbg) {
|
|
265
|
+
static int init = 0;
|
|
266
|
+
|
|
267
|
+
if (!init && dbg != 0) {
|
|
268
|
+
init = 1;
|
|
269
|
+
debug_add_handler( debug_message_handler, DEBUG_LEVEL_ALWAYS, NULL );
|
|
270
|
+
}
|
|
271
|
+
wsman_debug_set_level( dbg );
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* module-level methods */
|
|
276
|
+
|
|
277
|
+
static int get_debug(void);
|
|
278
|
+
|
|
279
|
+
/*
|
|
280
|
+
* Return openwsman debug level.
|
|
281
|
+
* call-seq:
|
|
282
|
+
* Openwsman::debug -> Integer
|
|
283
|
+
*
|
|
284
|
+
*/
|
|
285
|
+
static int get_debug(void) {
|
|
286
|
+
return (int)wsman_debug_get_level();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static WsXmlDocH create_soap_envelope(void);
|
|
290
|
+
|
|
291
|
+
/*
|
|
292
|
+
* Create empty SOAP envelope
|
|
293
|
+
* call-seq:
|
|
294
|
+
* Openwsman::create_soap_envelope -> XmlDoc
|
|
295
|
+
*
|
|
296
|
+
*/
|
|
297
|
+
static WsXmlDocH create_soap_envelope() {
|
|
298
|
+
return ws_xml_create_soap_envelope();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
static WsXmlDocH create_doc_from_file(const char *filename, const char *encoding);
|
|
302
|
+
|
|
303
|
+
/*
|
|
304
|
+
* Read XmlDoc from file
|
|
305
|
+
* call-seq:
|
|
306
|
+
* Openwsman::create_doc_from_file("/path/to/file", "utf-8") -> XmlDoc
|
|
307
|
+
*
|
|
308
|
+
*/
|
|
309
|
+
static WsXmlDocH create_doc_from_file(const char *filename, const char *encoding) {
|
|
310
|
+
return xml_parser_file_to_doc( filename, encoding, 0);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
static WsXmlDocH create_doc_from_string(const char *buf, const char *encoding);
|
|
314
|
+
|
|
315
|
+
/*
|
|
316
|
+
* Read XmlDoc from string
|
|
317
|
+
* call-seq:
|
|
318
|
+
* Openwsman::create_doc_from_string("<xml ...>", "utf-8") -> XmlDoc
|
|
319
|
+
*
|
|
320
|
+
*/
|
|
321
|
+
static WsXmlDocH create_doc_from_string(const char *buf, const char *encoding) {
|
|
322
|
+
return xml_parser_memory_to_doc( buf, strlen(buf), encoding, 0);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
static char *uri_classname(const char *uri);
|
|
326
|
+
/*
|
|
327
|
+
* get classname from resource URI
|
|
328
|
+
* call-seq:
|
|
329
|
+
* Openwsman::uri_classname("http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_OperatingSystem") -> "Linux_OperatingSystem"
|
|
330
|
+
*
|
|
331
|
+
*/
|
|
332
|
+
static char *uri_classname(const char *uri) {
|
|
333
|
+
const char *lastslash = strrchr(uri,'/');
|
|
334
|
+
if (lastslash) {
|
|
335
|
+
return strdup(lastslash+1);
|
|
336
|
+
}
|
|
337
|
+
return NULL;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
static const char *uri_prefix(const char *classname);
|
|
341
|
+
/*
|
|
342
|
+
* Map classname (class schema) to resource uri prefix
|
|
343
|
+
* call-seq:
|
|
344
|
+
* Openwsman::uri_prefix("Linux") -> "http://sblim.sf.net/wbem/wscim/1/cim-schema/2"
|
|
345
|
+
* Openwsman::uri_prefix("Win32") -> "http://schemas.microsoft.com/wbem/wsman/1/wmi"
|
|
346
|
+
*
|
|
347
|
+
*/
|
|
348
|
+
static const char *uri_prefix(const char *classname) {
|
|
349
|
+
static struct map {
|
|
350
|
+
int len;
|
|
351
|
+
const char *schema;
|
|
352
|
+
const char *prefix;
|
|
353
|
+
} mapping[] = {
|
|
354
|
+
/* dmtf CIM */
|
|
355
|
+
{ 3, "CIM", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2" },
|
|
356
|
+
/* dmtf reserved */
|
|
357
|
+
{ 3, "PRS", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2" },
|
|
358
|
+
/* Microsoft WMI */
|
|
359
|
+
{ 5, "Win32", "http://schemas.microsoft.com/wbem/wsman/1/wmi" },
|
|
360
|
+
/* openwbem.org */
|
|
361
|
+
{ 8, "OpenWBEM", "http://schema.openwbem.org/wbem/wscim/1/cim-schema/2" },
|
|
362
|
+
/* sblim */
|
|
363
|
+
{ 5, "Linux", "http://sblim.sf.net/wbem/wscim/1/cim-schema/2" },
|
|
364
|
+
/* omc-project */
|
|
365
|
+
{ 3, "OMC", "http://schema.omc-project.org/wbem/wscim/1/cim-schema/2" },
|
|
366
|
+
/* pegasus.org */
|
|
367
|
+
{ 2, "PG", "http://schema.openpegasus.org/wbem/wscim/1/cim-schema/2" },
|
|
368
|
+
/* Intel AMT */
|
|
369
|
+
{ 3, "AMT", "http://intel.com/wbem/wscim/1/amt-schema/1" },
|
|
370
|
+
/* Intel */
|
|
371
|
+
{ 3, "IPS", "http://intel.com/wbem/wscim/1/ips-schema/1" },
|
|
372
|
+
/* Sun */
|
|
373
|
+
{ 3, "Sun","http://schemas.sun.com/wbem/wscim/1/cim-schema/2" },
|
|
374
|
+
/* Microsoft HyperV */
|
|
375
|
+
{ 4, "Msvm", "http://schemas.microsoft.com/wbem/wsman/1/wmi" },
|
|
376
|
+
/* Dell DRAC */
|
|
377
|
+
{ 4, "DCIM", "http://schemas.dell.com/wbem/wscim/1/cim-schema/2" },
|
|
378
|
+
/* Unisys */
|
|
379
|
+
{ 4, "SPAR", "http://schema.unisys.com/wbem/wscim/1/cim-schema/2" },
|
|
380
|
+
/* Fujitsu */
|
|
381
|
+
{ 3, "SVS", "http://schemas.ts.fujitsu.com/wbem/wscim/1/cim-schema/2" },
|
|
382
|
+
{ 0, NULL, NULL }
|
|
383
|
+
};
|
|
384
|
+
const char *schema_end;
|
|
385
|
+
struct map *map;
|
|
386
|
+
int len;
|
|
387
|
+
if (classname == NULL)
|
|
388
|
+
return NULL;
|
|
389
|
+
if (strcmp(classname, "*") == 0) {
|
|
390
|
+
return "http://schemas.dmtf.org/wbem/wscim/1";
|
|
391
|
+
}
|
|
392
|
+
if ((strcmp(classname, "meta_class") == 0)
|
|
393
|
+
||(strncmp(classname, "__", 2) == 0)) {
|
|
394
|
+
return "http://schemas.microsoft.com/wbem/wsman/1/wmi";
|
|
395
|
+
}
|
|
396
|
+
schema_end = strchr(classname, '_');
|
|
397
|
+
if (schema_end == NULL)
|
|
398
|
+
return NULL; /* Bad class name */
|
|
399
|
+
len = schema_end - classname;
|
|
400
|
+
map = mapping;
|
|
401
|
+
while (map->len > 0) {
|
|
402
|
+
if ((len == map->len)
|
|
403
|
+
&& (strncasecmp(classname, map->schema, map->len) == 0)) {
|
|
404
|
+
return map->prefix;
|
|
405
|
+
}
|
|
406
|
+
++map;
|
|
407
|
+
}
|
|
408
|
+
return NULL;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
#if defined(SWIGRUBY)
|
|
412
|
+
static epr_t *my_epr_deserialize(WsXmlNodeH node);
|
|
413
|
+
/*:nodoc:*/
|
|
414
|
+
static epr_t *my_epr_deserialize(WsXmlNodeH node) {
|
|
415
|
+
if (strcmp(WSA_EPR, ws_xml_get_node_local_name(node)) == 0) {
|
|
416
|
+
/* Use node as-is if its already a WSA_EPR */
|
|
417
|
+
return epr_deserialize(node, NULL, NULL, 1);
|
|
418
|
+
}
|
|
419
|
+
/* else search the WSA_EPR node */
|
|
420
|
+
return epr_deserialize(node, XML_NS_ADDRESSING, WSA_EPR, 1);
|
|
421
|
+
}
|
|
422
|
+
#endif
|
|
423
|
+
|
|
424
|
+
static char *epr_prefix(const char *uri);
|
|
425
|
+
/* Get prefix from a EPR uri
|
|
426
|
+
* :nodoc:
|
|
427
|
+
*/
|
|
428
|
+
static char *epr_prefix(const char *uri) {
|
|
429
|
+
char *classname = uri_classname(uri);
|
|
430
|
+
const char *prefix = uri_prefix(classname);
|
|
431
|
+
if (prefix) {
|
|
432
|
+
const char *lastslash;
|
|
433
|
+
if (strncmp(uri, prefix, strlen(prefix)) == 0) {
|
|
434
|
+
return strdup(prefix);
|
|
435
|
+
}
|
|
436
|
+
lastslash = strrchr(uri, '/');
|
|
437
|
+
if (lastslash) {
|
|
438
|
+
return strndup(uri, lastslash-uri);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return strdup(uri);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
%}
|
|
445
|
+
|
|
446
|
+
#if RUBY_VERSION > 18
|
|
447
|
+
%{
|
|
448
|
+
typedef struct {
|
|
449
|
+
WsManClient *client;
|
|
450
|
+
client_opt_t *options;
|
|
451
|
+
filter_t *filter;
|
|
452
|
+
const char *resource_uri;
|
|
453
|
+
epr_t *epr;
|
|
454
|
+
const char *context;
|
|
455
|
+
const char *identifier;
|
|
456
|
+
const char *data;
|
|
457
|
+
size_t size;
|
|
458
|
+
const char *encoding;
|
|
459
|
+
const char *method;
|
|
460
|
+
WsXmlDocH method_args;
|
|
461
|
+
} wsmc_action_args_t;
|
|
462
|
+
|
|
463
|
+
WsXmlDocH
|
|
464
|
+
ruby_enumerate_thread(wsmc_action_args_t *args) {
|
|
465
|
+
return wsmc_action_enumerate(args->client, args->resource_uri, args->options, args->filter);
|
|
466
|
+
}
|
|
467
|
+
WsXmlDocH
|
|
468
|
+
ruby_identify_thread(wsmc_action_args_t *args) {
|
|
469
|
+
return wsmc_action_identify(args->client, args->options);
|
|
470
|
+
}
|
|
471
|
+
WsXmlDocH
|
|
472
|
+
ruby_get_from_epr_thread(wsmc_action_args_t *args) {
|
|
473
|
+
return wsmc_action_get_from_epr(args->client, args->epr, args->options);
|
|
474
|
+
}
|
|
475
|
+
WsXmlDocH
|
|
476
|
+
ruby_delete_from_epr_thread(wsmc_action_args_t *args) {
|
|
477
|
+
return wsmc_action_delete_from_epr(args->client, args->epr, args->options);
|
|
478
|
+
}
|
|
479
|
+
WsXmlDocH
|
|
480
|
+
ruby_pull_thread(wsmc_action_args_t *args) {
|
|
481
|
+
return wsmc_action_pull(args->client, args->resource_uri, args->options, args->filter, args->context);
|
|
482
|
+
}
|
|
483
|
+
WsXmlDocH
|
|
484
|
+
ruby_create_fromtext_thread(wsmc_action_args_t *args) {
|
|
485
|
+
return wsmc_action_create_fromtext(args->client, args->resource_uri, args->options, args->data, args->size, args->encoding);
|
|
486
|
+
}
|
|
487
|
+
WsXmlDocH
|
|
488
|
+
ruby_put_fromtext_thread(wsmc_action_args_t *args) {
|
|
489
|
+
return wsmc_action_put_fromtext(args->client, args->resource_uri, args->options, args->data, args->size, args->encoding);
|
|
490
|
+
}
|
|
491
|
+
WsXmlDocH
|
|
492
|
+
ruby_release_thread(wsmc_action_args_t *args) {
|
|
493
|
+
return wsmc_action_release(args->client, args->resource_uri, args->options, args->context);
|
|
494
|
+
}
|
|
495
|
+
WsXmlDocH
|
|
496
|
+
ruby_get_thread(wsmc_action_args_t *args) {
|
|
497
|
+
return wsmc_action_get(args->client, args->resource_uri, args->options);
|
|
498
|
+
}
|
|
499
|
+
WsXmlDocH
|
|
500
|
+
ruby_delete_thread(wsmc_action_args_t *args) {
|
|
501
|
+
return wsmc_action_delete(args->client, args->resource_uri, args->options);
|
|
502
|
+
}
|
|
503
|
+
WsXmlDocH
|
|
504
|
+
ruby_invoke_thread(wsmc_action_args_t *args) {
|
|
505
|
+
return wsmc_action_invoke(args->client, args->resource_uri, args->options, args->method, args->method_args);
|
|
506
|
+
}
|
|
507
|
+
WsXmlDocH
|
|
508
|
+
ruby_subscribe_thread(wsmc_action_args_t *args) {
|
|
509
|
+
return wsmc_action_subscribe(args->client, args->resource_uri, args->options, args->filter);
|
|
510
|
+
}
|
|
511
|
+
WsXmlDocH
|
|
512
|
+
ruby_unsubscribe_thread(wsmc_action_args_t *args) {
|
|
513
|
+
return wsmc_action_unsubscribe(args->client, args->resource_uri, args->options, args->identifier);
|
|
514
|
+
}
|
|
515
|
+
WsXmlDocH
|
|
516
|
+
ruby_renew_thread(wsmc_action_args_t *args) {
|
|
517
|
+
return wsmc_action_renew(args->client, args->resource_uri, args->options, args->identifier);
|
|
518
|
+
}
|
|
519
|
+
%}
|
|
520
|
+
#endif
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
/*
|
|
524
|
+
* hash_t typemaps
|
|
525
|
+
*/
|
|
526
|
+
#if defined(SWIGJAVA)
|
|
527
|
+
%typemap(jni) hash_t * "jobject"
|
|
528
|
+
%typemap(jtype) hash_t * "java.util.Map"
|
|
529
|
+
%typemap(jstype) hash_t * "java.util.Map"
|
|
530
|
+
%typemap(javaout) hash_t * {
|
|
531
|
+
return $jnicall;
|
|
532
|
+
}
|
|
533
|
+
#endif
|
|
534
|
+
%typemap(out) hash_t * {
|
|
535
|
+
#if defined(SWIGJAVA)
|
|
536
|
+
$result = hash2value(jenv, $1);
|
|
537
|
+
#else
|
|
538
|
+
$result = hash2value($1);
|
|
539
|
+
#endif
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
%typemap(in) hash_t * {
|
|
543
|
+
$input = value2hash(NULL, $1, 0);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
%ignore __undefined;
|
|
547
|
+
|
|
548
|
+
%include exception.i
|
|
549
|
+
|
|
550
|
+
#if defined(SWIGJAVA)
|
|
551
|
+
|
|
552
|
+
/* if java, pass the new exception macro to C not just SWIG */
|
|
553
|
+
#undef SWIG_exception
|
|
554
|
+
#define SWIG_exception(code, msg) {SWIG_JavaException(jenv, code, msg); goto fail;}
|
|
555
|
+
%inline %{
|
|
556
|
+
#undef SWIG_exception
|
|
557
|
+
#define SWIG_exception(code, msg) {SWIG_JavaException(jenv, code, msg); goto fail;}
|
|
558
|
+
%}
|
|
559
|
+
|
|
560
|
+
#endif
|
|
561
|
+
|
|
562
|
+
%include "version.i"
|
|
563
|
+
|
|
564
|
+
/* start with wsman-xml to get the __WsXmlFoo -> XmlFoo renames right */
|
|
565
|
+
%include "wsman-xml.i"
|
|
566
|
+
|
|
567
|
+
%include "wsman-names.i"
|
|
568
|
+
|
|
569
|
+
%include "wsman-epr.i"
|
|
570
|
+
|
|
571
|
+
%include "wsman-filter.i"
|
|
572
|
+
|
|
573
|
+
%include "wsman-soap.i"
|
|
574
|
+
|
|
575
|
+
%include "wsman-transport.i"
|
|
576
|
+
|
|
577
|
+
%include "wsman-client_opt.i"
|
|
578
|
+
|
|
579
|
+
%include "wsman-client.i"
|
|
580
|
+
|
|
581
|
+
/*-----------------------------------------------------------------*/
|
|
582
|
+
/* debug */
|
|
583
|
+
|
|
584
|
+
#if defined(SWIGRUBY)
|
|
585
|
+
%rename("debug=") set_debug(int debug);
|
|
586
|
+
#endif
|
|
587
|
+
static void set_debug(int dbg);
|
|
588
|
+
#if defined(SWIGRUBY)
|
|
589
|
+
%rename("debug") get_debug();
|
|
590
|
+
#endif
|
|
591
|
+
static int get_debug();
|
|
592
|
+
static WsXmlDocH create_soap_envelope();
|
|
593
|
+
static WsXmlDocH create_doc_from_file(const char *filename, const char *encoding = "UTF-8");
|
|
594
|
+
static WsXmlDocH create_doc_from_string(const char *buf, const char *encoding = "UTF-8");
|
|
595
|
+
static const char *uri_prefix(const char* classname);
|