root/openwsman/trunk/bindings/openwsman.i

Revision 3290, 3.7 kB (checked in by kkaempf, 4 months ago)

clean up binding class names

drop wsman-types.i, include into wsman-xml.i

fix 'method_missing' for XmlNode? in Ruby
add autotools .libs build dir for Perl tests

Line 
1 /*
2  * Document-module: Openwsman
3  * = About openwsman
4  * Openwsman (http://www.openwsman.org) is a project intended to provide an open-source
5  * implementation of the Web Services Management specification
6  * (WS-Management) and to expose system management information on the
7  * Linux operating system using the WS-Management protocol. WS-Management
8  * is based on a suite of web services specifications and usage
9  * requirements that exposes a set of operations focused on and covers
10  * all system management aspects.
11  *
12  * = Using the bindings
13  * The bindings provide access to the client-side API of openwsman.
14  * You start by creating a Client instance and set up ClientOptions
15  * to control the communication.
16  *
17  * The Client instance now provides the WS-Management operations, like
18  * enumerate, get, invoke, etc.
19  *
20  * All client operations return a XmlDoc representing the SOAP response
21  * from the system.
22  *
23  * You can then use XmlDoc methods to extract SOAP elements from the
24  * response and dig down through its XmlNode and XmlAttr objects.
25  *
26  */
27  
28
29 #if defined(SWIGJAVA)
30 %module jwsman
31 #endif
32
33 #if defined(SWIGPYTHON)
34 %module pywsman
35 #endif
36
37 #if defined(SWIGRUBY)
38 %module openwsman
39
40 %{
41 #include <rubyio.h>
42 #include <ruby.h>
43 %}
44
45 %typemap(in) FILE* {
46   struct OpenFile *fptr;
47
48   Check_Type($input, T_FILE);
49   GetOpenFile($input, fptr);
50   /*rb_io_check_writable(fptr);*/
51   $1 = GetReadFile(fptr);
52 }
53 #endif
54
55 #if defined(SWIGPERL)
56 %module openwsman
57
58 //==================================
59 // Typemap: Allow FILE* as PerlIO
60 //----------------------------------
61 %typemap(in) FILE* {
62     $1 = PerlIO_findFILE(IoIFP(sv_2io($input)));
63 }
64 #endif
65
66 %{
67 #if defined(SWIGPERL)
68 /* filter_t is defined in Perls CORE/perl.h */
69 #define filter_t filter_type
70 #endif
71
72 #include <wsman-types.h>
73 #include <wsman-client.h>
74 #include <wsman-client-transport.h>
75 #include <wsman-api.h>
76 #include <wsman-xml.h>
77 #include <wsman-epr.h>
78 #include <wsman-filter.h>
79 #include <wsman-soap.h>
80 #include <wsman-soap-envelope.h>
81 #include <openwsman.h>
82 #if defined(SWIGRUBY)
83 #include <ruby/helpers.c>
84 #endif
85 #if defined(SWIGPYTHON)
86 #include <python/helpers.c>
87 #endif
88 #if defined(SWIGJAVA)
89 #include <java/helpers.c>
90 #endif
91 #if defined(SWIGPERL)
92 #include <perl/helpers.c>
93 #endif
94
95 /* fool swig into aliasing WsManClient and WsManTransport */
96 struct _WsManTransport { };
97 typedef struct _WsManTransport WsManTransport;
98
99 static void set_debug(int dbg);
100
101 static void set_debug(int dbg) {
102   static int init = 0;
103
104   if (!init && dbg != 0) {
105     init = 1;
106     debug_add_handler( debug_message_handler, DEBUG_LEVEL_ALWAYS, NULL );
107   }
108   wsman_debug_set_level( dbg );
109        
110 }
111
112 /* module-level methods */
113
114 static int get_debug(void);
115
116 static int get_debug(void) {
117   return (int)wsman_debug_get_level();
118 }
119
120 static WsXmlDocH create_soap_envelope(void);
121 static WsXmlDocH create_soap_envelope() {
122   return ws_xml_create_soap_envelope();
123 }
124
125 %}
126
127 /*
128  * hash_t typemaps
129  */
130 %typemap(out) hash_t * {
131  $result = hash2value($1);
132 }
133
134 %typemap(in) hash_t * {
135  $input = value2hash(NULL, $1);
136 }
137
138 %ignore __undefined;
139
140 /* start with wsman-xml to get the __WsXmlFoo -> XmlFoo renames right */
141 %include "wsman-xml.i"
142
143 %include "wsman-names.i"
144
145 %include "wsman-epr.i"
146
147 %include "wsman-filter.i"
148
149 %include "wsman-soap.i"
150
151 %include "wsman-transport.i"
152
153 %include "client_opt.i"
154
155 %include "wsman-client.i"
156
157 /*-----------------------------------------------------------------*/
158 /* debug */
159
160 #if defined(SWIGRUBY)
161   %rename("debug=") set_debug(int debug);
162 #endif
163
164 /*
165  * Return openwsman debug level.
166  */
167 static void set_debug(int dbg);
168
169 #if defined(SWIGRUBY)
170   %rename("debug") get_debug();
171 #endif
172
173 /*
174  * Set openwsman debug level.
175  */
176 static int get_debug();
177
178 /*
179  * Create empty SOAP envelope (XmlDoc)
180  *
181  */
182 static WsXmlDocH create_soap_envelope();
183