root/openwsman/trunk/bindings/client_opt.i

Revision 3376, 4.4 kB (checked in by kkaempf, 3 weeks ago)

fix wrong function call

Line 
1 /*
2  *
3  * ClientOptions
4  *
5  * client option declarations for openwsman swig bindings
6  *
7  */
8
9 %rename(ClientOptions) client_opt_t;
10 %nodefault client_opt_t;
11 typedef struct {} client_opt_t;
12
13
14 /*
15  * ClientOptions control the behaviour of the Client connection
16  *
17  * The primary use of ClientOptions in normal operations is adding
18  * selectors - key/value pairs added to the request URL.
19  *
20  * For WS-CIM operations, selectors define the key attributes for
21  * the selected CIM class to address a specific instance of the class.
22  *
23  */
24
25 %extend client_opt_t {
26   client_opt_t() {
27     return wsmc_options_init();
28   }
29
30   ~client_opt_t() {
31     wsmc_options_destroy( $self );
32   }
33
34   /*
35    * Request to dump all operations to the dumpfile
36    *
37    * Used for debugging on the wire-level
38    *
39    */
40   void set_dump_request(void) {
41     wsmc_set_action_option($self, FLAG_DUMP_REQUEST );
42   }
43
44   /*
45    * set option flag(s)
46    *
47    */
48   void set_flags(int flags) {
49     wsmc_set_action_option($self, flags);
50   }
51
52   /*
53    * clear option flag(s)
54    *
55    */
56   void clear_flags(int flags) {
57     wsmc_clear_action_option($self, flags);
58   }
59    
60   /*
61    * Add a selector as key/value pair
62    *
63    */
64 #if defined(SWIGRUBY)
65   void add_selector(VALUE k, VALUE v)
66   {
67     VALUE k_s = rb_funcall(k, rb_intern("to_s"), 0 );
68     VALUE v_s = rb_funcall(v, rb_intern("to_s"), 0 );
69     const char *key = StringValuePtr(k_s);
70     const char *value = StringValuePtr(v_s);
71 #else
72   void add_selector(const char *key, const char *value)
73   {
74 #endif
75     wsmc_add_selector($self, key, value);
76   }
77  
78 #if defined(SWIGRUBY)
79   /*
80    * Set selectors from Hash
81    */
82   %rename( "selectors=" ) set_selectors(VALUE hash);
83   void set_selectors(VALUE hash)
84   {
85     $self->selectors = value2hash(NULL, hash);
86   }
87 #endif
88
89   /*
90    * Add a property as key/value pair
91    *
92    */
93 #if defined(SWIGRUBY)
94   void add_property(VALUE k, VALUE v)
95   {
96     VALUE k_s = rb_funcall(k, rb_intern("to_s"), 0 );
97     VALUE v_s = rb_funcall(v, rb_intern("to_s"), 0 );
98     const char *key = StringValuePtr(k_s);
99     const char *value = StringValuePtr(v_s);
100 #else
101   void add_property(const char *key, const char *value)
102   {
103 #endif
104     wsmc_add_property($self, key, value);
105   }
106  
107 #if defined(SWIGRUBY)
108   /*
109    * Set properties from Hash
110    */
111   %rename( "properties=" ) set_properties(VALUE hash);
112   void set_properties(VALUE hash)
113   {
114     $self->properties = value2hash(NULL, hash);
115   }
116 #endif
117
118   /*
119    * Set delivery uri
120    */
121 #if defined(SWIGRUBY)
122   %rename( "delivery_uri=" ) set_delivery_uri(const char *delivery_uri);
123 #endif
124   void set_delivery_uri( const char *delivery_uri ) {
125     wsmc_set_delivery_uri(delivery_uri, $self);
126   }
127
128   /*
129    * Get delivery uri
130    */
131   const char *delivery_uri() {
132     return $self->delivery_uri;
133   }
134
135   /*
136    * Set subscription expiry timeout (in seconds)
137    */
138 #if defined(SWIGRUBY)
139   %rename( "sub_expiry=" ) set_sub_expiry(unsigned int event_subscription_expire);
140 #endif
141   void set_sub_expiry(unsigned int event_subscription_expire) {
142         wsmc_set_sub_expiry(event_subscription_expire, $self);
143   }
144
145   int sub_expiry() {
146     return $self->expires;
147   }
148
149   /*
150    * Set subscription heartbeat interval (in seconds)
151    */
152 #if defined(SWIGRUBY)
153   %rename("heartbeat_interval=") set_heartbeat_interval(unsigned int heartbeat_interval);
154 #endif
155   void set_heartbeat_interval(unsigned int heartbeat_interval) {
156         wsmc_set_heartbeat_interval(heartbeat_interval, $self);
157   }
158
159   int heartbeat_interval() {
160     return $self->heartbeat_interval;
161   }
162
163   /*
164    * Set subscription delivery mode (push, pushwithack,events,pull)
165    */
166 #if defined(SWIGRUBY)
167   %rename( "delivery_mode=" ) set_delivery_mode(unsigned int delivery_mode);
168 #endif
169   void set_delivery_mode(unsigned int delivery_mode) {
170     if (delivery_mode > WSMAN_DELIVERY_PULL)
171       SWIG_exception( SWIG_ValueError, "Bad delivery mode" );
172        
173     wsmc_set_delivery_mode(delivery_mode, $self);
174   }
175
176   int delivery_mode() {
177     return $self->delivery_mode;
178   }
179
180   /*
181    * Set subscription delivery security mode (lots)
182    */
183 #if defined(SWIGRUBY)
184   %rename( "delivery_security_mode=" ) set_delivery_sec_mode(unsigned int delivery_mode);
185 #endif
186   void set_delivery_security_mode(unsigned int delivery_sec_mode) {
187     if (delivery_sec_mode > WSMAN_DELIVERY_SEC_HTTP_SPNEGO_KERBEROS)
188       SWIG_exception( SWIG_ValueError, "Bad delivery security mode" );
189     wsmc_set_delivery_security_mode(delivery_sec_mode, $self);
190   }
191  
192   int delivery_sec_mode() {
193     return $self->delivery_sec_mode;
194   }
195
196 }
197