ruby-libvirt 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
1
  #ifndef INTERFACE_H
2
2
  #define INTERFACE_H
3
3
 
4
- void init_interface();
4
+ void ruby_libvirt_interface_init(void);
5
+
6
+ VALUE ruby_libvirt_interface_new(virInterfacePtr i, VALUE conn);
5
7
 
6
8
  #endif
@@ -2,6 +2,7 @@
2
2
  * network.c: virNetwork methods
3
3
  *
4
4
  * Copyright (C) 2007,2010 Red Hat Inc.
5
+ * Copyright (C) 2013 Chris Lalancette <clalancette@gmail.com>
5
6
  *
6
7
  * This library is free software; you can redistribute it and/or
7
8
  * modify it under the terms of the GNU Lesser General Public
@@ -28,124 +29,156 @@
28
29
  #if HAVE_TYPE_VIRNETWORKPTR
29
30
  static VALUE c_network;
30
31
 
31
- static void network_free(void *d) {
32
- generic_free(Network, d);
32
+ static void network_free(void *d)
33
+ {
34
+ ruby_libvirt_free_struct(Network, d);
33
35
  }
34
36
 
35
- static virNetworkPtr network_get(VALUE s) {
36
- generic_get(Network, s);
37
+ static virNetworkPtr network_get(VALUE n)
38
+ {
39
+ ruby_libvirt_get_struct(Network, n);
37
40
  }
38
41
 
39
- VALUE network_new(virNetworkPtr n, VALUE conn) {
40
- return generic_new(c_network, n, conn, network_free);
42
+ VALUE ruby_libvirt_network_new(virNetworkPtr n, VALUE conn)
43
+ {
44
+ return ruby_libvirt_new_class(c_network, n, conn, network_free);
41
45
  }
42
46
 
43
47
  /*
44
48
  * call-seq:
45
49
  * net.undefine -> nil
46
50
  *
47
- * Call +virNetworkUndefine+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkUndefine]
51
+ * Call virNetworkUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkUndefine]
48
52
  * to undefine this network.
49
53
  */
50
- static VALUE libvirt_netw_undefine(VALUE s) {
51
- gen_call_void(virNetworkUndefine, conn(s), network_get(s));
54
+ static VALUE libvirt_network_undefine(VALUE n)
55
+ {
56
+ ruby_libvirt_generate_call_nil(virNetworkUndefine,
57
+ ruby_libvirt_connect_get(n),
58
+ network_get(n));
52
59
  }
53
60
 
54
61
  /*
55
62
  * call-seq:
56
63
  * net.create -> nil
57
64
  *
58
- * Call +virNetworkCreate+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkCreate]
65
+ * Call virNetworkCreate[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkCreate]
59
66
  * to start this network.
60
67
  */
61
- static VALUE libvirt_netw_create(VALUE s) {
62
- gen_call_void(virNetworkCreate, conn(s), network_get(s));
68
+ static VALUE libvirt_network_create(VALUE n)
69
+ {
70
+ ruby_libvirt_generate_call_nil(virNetworkCreate,
71
+ ruby_libvirt_connect_get(n),
72
+ network_get(n));
73
+ }
74
+
75
+ #if HAVE_VIRNETWORKUPDATE
76
+ /*
77
+ * call-seq:
78
+ * net.update -> nil
79
+ *
80
+ * Call virNetworkUpdate[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkUpdate]
81
+ * to update this network.
82
+ */
83
+ static VALUE libvirt_network_update(VALUE n, VALUE command, VALUE section,
84
+ VALUE index, VALUE xml, VALUE flags)
85
+ {
86
+ ruby_libvirt_generate_call_nil(virNetworkUpdate,
87
+ ruby_libvirt_connect_get(n),
88
+ network_get(n), NUM2UINT(command),
89
+ NUM2UINT(section), NUM2INT(index),
90
+ StringValuePtr(xml), NUM2UINT(flags));
63
91
  }
92
+ #endif
64
93
 
65
94
  /*
66
95
  * call-seq:
67
96
  * net.destroy -> nil
68
97
  *
69
- * Call +virNetworkDestroy+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkDestroy]
98
+ * Call virNetworkDestroy[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkDestroy]
70
99
  * to shutdown this network.
71
100
  */
72
- static VALUE libvirt_netw_destroy(VALUE s) {
73
- gen_call_void(virNetworkDestroy, conn(s), network_get(s));
101
+ static VALUE libvirt_network_destroy(VALUE n)
102
+ {
103
+ ruby_libvirt_generate_call_nil(virNetworkDestroy,
104
+ ruby_libvirt_connect_get(n),
105
+ network_get(n));
74
106
  }
75
107
 
76
108
  /*
77
109
  * call-seq:
78
110
  * net.name -> string
79
111
  *
80
- * Call +virNetworkGetName+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetName]
112
+ * Call virNetworkGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetName]
81
113
  * to retrieve the name of this network.
82
114
  */
83
- static VALUE libvirt_netw_name(VALUE s) {
84
- gen_call_string(virNetworkGetName, conn(s), 0, network_get(s));
115
+ static VALUE libvirt_network_name(VALUE n)
116
+ {
117
+ ruby_libvirt_generate_call_string(virNetworkGetName,
118
+ ruby_libvirt_connect_get(n), 0,
119
+ network_get(n));
85
120
  }
86
121
 
87
122
  /*
88
123
  * call-seq:
89
124
  * net.uuid -> string
90
125
  *
91
- * Call +virNetworkGetUUIDString+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetUUIDString]
126
+ * Call virNetworkGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetUUIDString]
92
127
  * to retrieve the UUID of this network.
93
128
  */
94
- static VALUE libvirt_netw_uuid(VALUE s) {
95
- virNetworkPtr netw = network_get(s);
96
- char uuid[VIR_UUID_STRING_BUFLEN];
97
- int r;
98
-
99
- r = virNetworkGetUUIDString(netw, uuid);
100
- _E(r < 0, create_error(e_RetrieveError, "virNetworkGetUUIDString",
101
- conn(s)));
102
-
103
- return rb_str_new2((char *) uuid);
129
+ static VALUE libvirt_network_uuid(VALUE n)
130
+ {
131
+ ruby_libvirt_generate_uuid(virNetworkGetUUIDString,
132
+ ruby_libvirt_connect_get(n), network_get(n));
104
133
  }
105
134
 
106
135
  /*
107
136
  * call-seq:
108
137
  * net.xml_desc(flags=0) -> string
109
138
  *
110
- * Call +virNetworkGetXMLDesc+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetXMLDesc]
139
+ * Call virNetworkGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetXMLDesc]
111
140
  * to retrieve the XML for this network.
112
141
  */
113
- static VALUE libvirt_netw_xml_desc(int argc, VALUE *argv, VALUE s) {
142
+ static VALUE libvirt_network_xml_desc(int argc, VALUE *argv, VALUE n)
143
+ {
114
144
  VALUE flags;
115
145
 
116
146
  rb_scan_args(argc, argv, "01", &flags);
117
147
 
118
- if (NIL_P(flags))
119
- flags = INT2NUM(0);
120
-
121
- gen_call_string(virNetworkGetXMLDesc, conn(s), 1, network_get(s),
122
- NUM2UINT(flags));
148
+ ruby_libvirt_generate_call_string(virNetworkGetXMLDesc,
149
+ ruby_libvirt_connect_get(n), 1,
150
+ network_get(n),
151
+ ruby_libvirt_value_to_uint(flags));
123
152
  }
124
153
 
125
154
  /*
126
155
  * call-seq:
127
156
  * net.bridge_name -> string
128
157
  *
129
- * Call +virNetworkGetBridgeName+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetBridgeName]
158
+ * Call virNetworkGetBridgeName[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetBridgeName]
130
159
  * to retrieve the bridge name for this network.
131
160
  */
132
- static VALUE libvirt_netw_bridge_name(VALUE s) {
133
- gen_call_string(virNetworkGetBridgeName, conn(s), 1, network_get(s));
161
+ static VALUE libvirt_network_bridge_name(VALUE n)
162
+ {
163
+ ruby_libvirt_generate_call_string(virNetworkGetBridgeName,
164
+ ruby_libvirt_connect_get(n),
165
+ 1, network_get(n));
134
166
  }
135
167
 
136
168
  /*
137
169
  * call-seq:
138
170
  * net.autostart? -> [true|false]
139
171
  *
140
- * Call +virNetworkGetAutostart+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetAutostart]
172
+ * Call virNetworkGetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetAutostart]
141
173
  * to determine if this network will be autostarted when libvirtd starts.
142
174
  */
143
- static VALUE libvirt_netw_autostart(VALUE s){
144
- virNetworkPtr netw = network_get(s);
175
+ static VALUE libvirt_network_autostart(VALUE n)
176
+ {
145
177
  int r, autostart;
146
178
 
147
- r = virNetworkGetAutostart(netw, &autostart);
148
- _E(r < 0, create_error(e_RetrieveError, "virNetworkAutostart", conn(s)));
179
+ r = virNetworkGetAutostart(network_get(n), &autostart);
180
+ ruby_libvirt_raise_error_if(r < 0, e_RetrieveError, "virNetworkAutostart",
181
+ ruby_libvirt_connect_get(n));
149
182
 
150
183
  return autostart ? Qtrue : Qfalse;
151
184
  }
@@ -154,27 +187,31 @@ static VALUE libvirt_netw_autostart(VALUE s){
154
187
  * call-seq:
155
188
  * net.autostart = [true|false]
156
189
  *
157
- * Call +virNetworkSetAutostart+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkSetAutostart]
190
+ * Call virNetworkSetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkSetAutostart]
158
191
  * to set this network to be autostarted when libvirtd starts.
159
192
  */
160
- static VALUE libvirt_netw_autostart_set(VALUE s, VALUE autostart) {
161
- if (autostart != Qtrue && autostart != Qfalse)
193
+ static VALUE libvirt_network_autostart_equal(VALUE n, VALUE autostart)
194
+ {
195
+ if (autostart != Qtrue && autostart != Qfalse) {
162
196
  rb_raise(rb_eTypeError,
163
197
  "wrong argument type (expected TrueClass or FalseClass)");
198
+ }
164
199
 
165
- gen_call_void(virNetworkSetAutostart, conn(s), network_get(s),
166
- RTEST(autostart) ? 1 : 0);
200
+ ruby_libvirt_generate_call_nil(virNetworkSetAutostart,
201
+ ruby_libvirt_connect_get(n),
202
+ network_get(n), RTEST(autostart) ? 1 : 0);
167
203
  }
168
204
 
169
205
  /*
170
206
  * call-seq:
171
207
  * net.free -> nil
172
208
  *
173
- * Call +virNetworkFree+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkFree]
209
+ * Call virNetworkFree[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkFree]
174
210
  * to free this network. The object will no longer be valid after this call.
175
211
  */
176
- static VALUE libvirt_netw_free(VALUE s) {
177
- gen_call_free(Network, s);
212
+ static VALUE libvirt_network_free(VALUE n)
213
+ {
214
+ ruby_libvirt_generate_call_free(Network, n);
178
215
  }
179
216
 
180
217
  #if HAVE_VIRNETWORKISACTIVE
@@ -182,11 +219,14 @@ static VALUE libvirt_netw_free(VALUE s) {
182
219
  * call-seq:
183
220
  * net.active? -> [true|false]
184
221
  *
185
- * Call +virNetworkIsActive+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkIsActive]
222
+ * Call virNetworkIsActive[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkIsActive]
186
223
  * to determine if this network is currently active.
187
224
  */
188
- static VALUE libvirt_netw_active_p(VALUE s) {
189
- gen_call_truefalse(virNetworkIsActive, conn(s), network_get(s));
225
+ static VALUE libvirt_network_active_p(VALUE n)
226
+ {
227
+ ruby_libvirt_generate_call_truefalse(virNetworkIsActive,
228
+ ruby_libvirt_connect_get(n),
229
+ network_get(n));
190
230
  }
191
231
  #endif
192
232
 
@@ -195,11 +235,14 @@ static VALUE libvirt_netw_active_p(VALUE s) {
195
235
  * call-seq:
196
236
  * net.persistent? -> [true|false]
197
237
  *
198
- * Call +virNetworkIsPersistent+[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkIsPersistent]
238
+ * Call virNetworkIsPersistent[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkIsPersistent]
199
239
  * to determine if this network is persistent.
200
240
  */
201
- static VALUE libvirt_netw_persistent_p(VALUE s) {
202
- gen_call_truefalse(virNetworkIsPersistent, conn(s), network_get(s));
241
+ static VALUE libvirt_network_persistent_p(VALUE n)
242
+ {
243
+ ruby_libvirt_generate_call_truefalse(virNetworkIsPersistent,
244
+ ruby_libvirt_connect_get(n),
245
+ network_get(n));
203
246
  }
204
247
  #endif
205
248
 
@@ -208,28 +251,204 @@ static VALUE libvirt_netw_persistent_p(VALUE s) {
208
251
  /*
209
252
  * Class Libvirt::Network
210
253
  */
211
- void init_network()
254
+ void ruby_libvirt_network_init(void)
212
255
  {
213
256
  #if HAVE_TYPE_VIRNETWORKPTR
214
257
  c_network = rb_define_class_under(m_libvirt, "Network", rb_cObject);
215
258
  rb_define_attr(c_network, "connection", 1, 0);
216
259
 
217
- rb_define_method(c_network, "undefine", libvirt_netw_undefine, 0);
218
- rb_define_method(c_network, "create", libvirt_netw_create, 0);
219
- rb_define_method(c_network, "destroy", libvirt_netw_destroy, 0);
220
- rb_define_method(c_network, "name", libvirt_netw_name, 0);
221
- rb_define_method(c_network, "uuid", libvirt_netw_uuid, 0);
222
- rb_define_method(c_network, "xml_desc", libvirt_netw_xml_desc, -1);
223
- rb_define_method(c_network, "bridge_name", libvirt_netw_bridge_name, 0);
224
- rb_define_method(c_network, "autostart", libvirt_netw_autostart, 0);
225
- rb_define_method(c_network, "autostart?", libvirt_netw_autostart, 0);
226
- rb_define_method(c_network, "autostart=", libvirt_netw_autostart_set, 1);
227
- rb_define_method(c_network, "free", libvirt_netw_free, 0);
260
+ rb_define_method(c_network, "undefine", libvirt_network_undefine, 0);
261
+ rb_define_method(c_network, "create", libvirt_network_create, 0);
262
+ #if HAVE_VIRNETWORKUPDATE
263
+ rb_define_method(c_network, "update", libvirt_network_update, 5);
264
+ #endif
265
+ rb_define_method(c_network, "destroy", libvirt_network_destroy, 0);
266
+ rb_define_method(c_network, "name", libvirt_network_name, 0);
267
+ rb_define_method(c_network, "uuid", libvirt_network_uuid, 0);
268
+ rb_define_method(c_network, "xml_desc", libvirt_network_xml_desc, -1);
269
+ rb_define_method(c_network, "bridge_name", libvirt_network_bridge_name, 0);
270
+ rb_define_method(c_network, "autostart", libvirt_network_autostart, 0);
271
+ rb_define_method(c_network, "autostart?", libvirt_network_autostart, 0);
272
+ rb_define_method(c_network, "autostart=", libvirt_network_autostart_equal,
273
+ 1);
274
+ rb_define_method(c_network, "free", libvirt_network_free, 0);
228
275
  #if HAVE_VIRNETWORKISACTIVE
229
- rb_define_method(c_network, "active?", libvirt_netw_active_p, 0);
276
+ rb_define_method(c_network, "active?", libvirt_network_active_p, 0);
230
277
  #endif
231
278
  #if HAVE_VIRNETWORKISPERSISTENT
232
- rb_define_method(c_network, "persistent?", libvirt_netw_persistent_p, 0);
279
+ rb_define_method(c_network, "persistent?", libvirt_network_persistent_p, 0);
280
+ #endif
281
+ #if HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_NONE
282
+ /* Ideally we would just have the "UPDATE_COMMAND_NONE" constant.
283
+ * Unfortunately we screwed up long ago, and we have to
284
+ * leave "NETWORK_UPDATE_COMMAND_NONE" for backwards compatibility.
285
+ */
286
+ rb_define_const(c_network, "UPDATE_COMMAND_NONE",
287
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_NONE));
288
+ rb_define_const(c_network, "NETWORK_UPDATE_COMMAND_NONE",
289
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_NONE));
290
+ /* Ideally we would just have the "UPDATE_COMMAND_MODIFY" constant.
291
+ * Unfortunately we screwed up long ago, and we have to
292
+ * leave "NETWORK_UPDATE_COMMAND_MODIFY" for backwards compatibility.
293
+ */
294
+ rb_define_const(c_network, "UPDATE_COMMAND_MODIFY",
295
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_MODIFY));
296
+ rb_define_const(c_network, "NETWORK_UPDATE_COMMAND_MODIFY",
297
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_MODIFY));
298
+ /* Ideally we would just have the "UPDATE_COMMAND_ADD_LAST" constant.
299
+ * Unfortunately we screwed up long ago, and we have to
300
+ * leave "NETWORK_UPDATE_COMMAND_ADD_LAST" for backwards compatibility.
301
+ */
302
+ rb_define_const(c_network, "UPDATE_COMMAND_ADD_LAST",
303
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_ADD_LAST));
304
+ rb_define_const(c_network, "NETWORK_UPDATE_COMMAND_ADD_LAST",
305
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_ADD_LAST));
306
+ /* Ideally we would just have the "UPDATE_COMMAND_ADD_FIRST" constant.
307
+ * Unfortunately we screwed up long ago, and we have to
308
+ * leave "NETWORK_UPDATE_COMMAND_ADD_FIRST" for backwards compatibility.
309
+ */
310
+ rb_define_const(c_network, "UPDATE_COMMAND_ADD_FIRST",
311
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST));
312
+ rb_define_const(c_network, "NETWORK_UPDATE_COMMAND_ADD_FIRST",
313
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST));
314
+ /* Ideally we would just have the "SECTION_NONE" constant.
315
+ * Unfortunately we screwed up long ago, and we have to
316
+ * leave "NETWORK_SECTION_NONE" for backwards compatibility.
317
+ */
318
+ rb_define_const(c_network, "SECTION_NONE",
319
+ INT2NUM(VIR_NETWORK_SECTION_NONE));
320
+ rb_define_const(c_network, "NETWORK_SECTION_NONE",
321
+ INT2NUM(VIR_NETWORK_SECTION_NONE));
322
+ /* Ideally we would just have the "SECTION_BRIDGE" constant.
323
+ * Unfortunately we screwed up long ago, and we have to
324
+ * leave "NETWORK_SECTION_BRIDGE" for backwards compatibility.
325
+ */
326
+ rb_define_const(c_network, "SECTION_BRIDGE",
327
+ INT2NUM(VIR_NETWORK_SECTION_BRIDGE));
328
+ rb_define_const(c_network, "NETWORK_SECTION_BRIDGE",
329
+ INT2NUM(VIR_NETWORK_SECTION_BRIDGE));
330
+ /* Ideally we would just have the "SECTION_DOMAIN" constant.
331
+ * Unfortunately we screwed up long ago, and we have to
332
+ * leave "NETWORK_SECTION_DOMAIN" for backwards compatibility.
333
+ */
334
+ rb_define_const(c_network, "SECTION_DOMAIN",
335
+ INT2NUM(VIR_NETWORK_SECTION_DOMAIN));
336
+ rb_define_const(c_network, "NETWORK_SECTION_DOMAIN",
337
+ INT2NUM(VIR_NETWORK_SECTION_DOMAIN));
338
+ /* Ideally we would just have the "SECTION_IP" constant.
339
+ * Unfortunately we screwed up long ago, and we have to
340
+ * leave "NETWORK_SECTION_IP" for backwards compatibility.
341
+ */
342
+ rb_define_const(c_network, "SECTION_IP",
343
+ INT2NUM(VIR_NETWORK_SECTION_IP));
344
+ rb_define_const(c_network, "NETWORK_SECTION_IP",
345
+ INT2NUM(VIR_NETWORK_SECTION_IP));
346
+ /* Ideally we would just have the "SECTION_IP_DHCP_HOST" constant.
347
+ * Unfortunately we screwed up long ago, and we have to
348
+ * leave "NETWORK_SECTION_IP_DHCP_HOST" for backwards compatibility.
349
+ */
350
+ rb_define_const(c_network, "SECTION_IP_DHCP_HOST",
351
+ INT2NUM(VIR_NETWORK_SECTION_IP_DHCP_HOST));
352
+ rb_define_const(c_network, "NETWORK_SECTION_IP_DHCP_HOST",
353
+ INT2NUM(VIR_NETWORK_SECTION_IP_DHCP_HOST));
354
+ /* Ideally we would just have the "SECTION_IP_DHCP_RANGE" constant.
355
+ * Unfortunately we screwed up long ago, and we have to
356
+ * leave "NETWORK_SECTION_IP_DHCP_RANGE" for backwards compatibility.
357
+ */
358
+ rb_define_const(c_network, "SECTION_IP_DHCP_RANGE",
359
+ INT2NUM(VIR_NETWORK_SECTION_IP_DHCP_RANGE));
360
+ rb_define_const(c_network, "NETWORK_SECTION_IP_DHCP_RANGE",
361
+ INT2NUM(VIR_NETWORK_SECTION_IP_DHCP_RANGE));
362
+ /* Ideally we would just have the "SECTION_FORWARD" constant.
363
+ * Unfortunately we screwed up long ago, and we have to
364
+ * leave "NETWORK_SECTION_FORWARD" for backwards compatibility.
365
+ */
366
+ rb_define_const(c_network, "SECTION_FORWARD",
367
+ INT2NUM(VIR_NETWORK_SECTION_FORWARD));
368
+ rb_define_const(c_network, "NETWORK_SECTION_FORWARD",
369
+ INT2NUM(VIR_NETWORK_SECTION_FORWARD));
370
+ /* Ideally we would just have the "SECTION_FORWARD_INTERFACE" constant.
371
+ * Unfortunately we screwed up long ago, and we have to
372
+ * leave "NETWORK_SECTION_FORWARD_INTERFACE" for backwards compatibility.
373
+ */
374
+ rb_define_const(c_network, "SECTION_FORWARD_INTERFACE",
375
+ INT2NUM(VIR_NETWORK_SECTION_FORWARD_INTERFACE));
376
+ rb_define_const(c_network, "NETWORK_SECTION_FORWARD_INTERFACE",
377
+ INT2NUM(VIR_NETWORK_SECTION_FORWARD_INTERFACE));
378
+ /* Ideally we would just have the "SECTION_FORWARD_PF" constant.
379
+ * Unfortunately we screwed up long ago, and we have to
380
+ * leave "NETWORK_SECTION_FORWARD_PF" for backwards compatibility.
381
+ */
382
+ rb_define_const(c_network, "SECTION_FORWARD_PF",
383
+ INT2NUM(VIR_NETWORK_SECTION_FORWARD_PF));
384
+ rb_define_const(c_network, "NETWORK_SECTION_FORWARD_PF",
385
+ INT2NUM(VIR_NETWORK_SECTION_FORWARD_PF));
386
+ /* Ideally we would just have the "SECTION_PORTGROUP" constant.
387
+ * Unfortunately we screwed up long ago, and we have to
388
+ * leave "NETWORK_SECTION_PORTGROUP" for backwards compatibility.
389
+ */
390
+ rb_define_const(c_network, "SECTION_PORTGROUP",
391
+ INT2NUM(VIR_NETWORK_SECTION_PORTGROUP));
392
+ rb_define_const(c_network, "NETWORK_SECTION_PORTGROUP",
393
+ INT2NUM(VIR_NETWORK_SECTION_PORTGROUP));
394
+ /* Ideally we would just have the "SECTION_DNS_HOST" constant.
395
+ * Unfortunately we screwed up long ago, and we have to
396
+ * leave "NETWORK_SECTION_DNS_HOST" for backwards compatibility.
397
+ */
398
+ rb_define_const(c_network, "SECTION_DNS_HOST",
399
+ INT2NUM(VIR_NETWORK_SECTION_DNS_HOST));
400
+ rb_define_const(c_network, "NETWORK_SECTION_DNS_HOST",
401
+ INT2NUM(VIR_NETWORK_SECTION_DNS_HOST));
402
+ /* Ideally we would just have the "SECTION_DNS_TXT" constant.
403
+ * Unfortunately we screwed up long ago, and we have to
404
+ * leave "NETWORK_SECTION_DNS_TXT" for backwards compatibility.
405
+ */
406
+ rb_define_const(c_network, "SECTION_DNS_TXT",
407
+ INT2NUM(VIR_NETWORK_SECTION_DNS_TXT));
408
+ rb_define_const(c_network, "NETWORK_SECTION_DNS_TXT",
409
+ INT2NUM(VIR_NETWORK_SECTION_DNS_TXT));
410
+ /* Ideally we would just have the "SECTION_DNS_SRV" constant.
411
+ * Unfortunately we screwed up long ago, and we have to
412
+ * leave "NETWORK_SECTION_DNS_SRV" for backwards compatibility.
413
+ */
414
+ rb_define_const(c_network, "SECTION_DNS_SRV",
415
+ INT2NUM(VIR_NETWORK_SECTION_DNS_SRV));
416
+ rb_define_const(c_network, "NETWORK_SECTION_DNS_SRV",
417
+ INT2NUM(VIR_NETWORK_SECTION_DNS_SRV));
418
+ /* Ideally we would just have the "UPDATE_AFFECT_CURRENT" constant.
419
+ * Unfortunately we screwed up long ago, and we have to
420
+ * leave "NETWORK_UPDATE_AFFECT_CURRENT" for backwards compatibility.
421
+ */
422
+ rb_define_const(c_network, "UPDATE_AFFECT_CURRENT",
423
+ INT2NUM(VIR_NETWORK_UPDATE_AFFECT_CURRENT));
424
+ rb_define_const(c_network, "NETWORK_UPDATE_AFFECT_CURRENT",
425
+ INT2NUM(VIR_NETWORK_UPDATE_AFFECT_CURRENT));
426
+ /* Ideally we would just have the "UPDATE_AFFECT_LIVE" constant.
427
+ * Unfortunately we screwed up long ago, and we have to
428
+ * leave "NETWORK_UPDATE_AFFECT_LIVE" for backwards compatibility.
429
+ */
430
+ rb_define_const(c_network, "UPDATE_AFFECT_LIVE",
431
+ INT2NUM(VIR_NETWORK_UPDATE_AFFECT_LIVE));
432
+ rb_define_const(c_network, "NETWORK_UPDATE_AFFECT_LIVE",
433
+ INT2NUM(VIR_NETWORK_UPDATE_AFFECT_LIVE));
434
+ /* Ideally we would just have the "UPDATE_AFFECT_CONFIG" constant.
435
+ * Unfortunately we screwed up long ago, and we have to
436
+ * leave "NETWORK_UPDATE_AFFECT_CONFIG" for backwards compatibility.
437
+ */
438
+ rb_define_const(c_network, "UPDATE_AFFECT_CONFIG",
439
+ INT2NUM(VIR_NETWORK_UPDATE_AFFECT_CONFIG));
440
+ rb_define_const(c_network, "NETWORK_UPDATE_AFFECT_CONFIG",
441
+ INT2NUM(VIR_NETWORK_UPDATE_AFFECT_CONFIG));
233
442
  #endif
443
+
444
+ #if HAVE_CONST_VIR_NETWORK_XML_INACTIVE
445
+ rb_define_const(c_network, "XML_INACTIVE",
446
+ INT2NUM(VIR_NETWORK_XML_INACTIVE));
447
+ #endif
448
+ #if HAVE_CONST_VIR_NETWORK_UPDATE_COMMAND_DELETE
449
+ rb_define_const(c_network, "UPDATE_COMMAND_DELETE",
450
+ INT2NUM(VIR_NETWORK_UPDATE_COMMAND_DELETE));
451
+ #endif
452
+
234
453
  #endif
235
454
  }