From 73bd4d93a2891d4ca194b0e2dfd19027711e9123 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 3 Sep 2007 16:41:11 +0000 Subject: [PATCH] add IFF constants --- bindings/ruby/rbsigar.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bindings/ruby/rbsigar.c b/bindings/ruby/rbsigar.c index 8a930306..876e43ba 100644 --- a/bindings/ruby/rbsigar.c +++ b/bindings/ruby/rbsigar.c @@ -174,6 +174,24 @@ static VALUE rb_sigar_net_route(VALUE obj) #include "./rbsigar_generated.rx" +#define RB_SIGAR_CONST_INT(name) \ + rb_define_const(rclass, #name, INT2FIX(SIGAR_##name)) + +static void Init_rbsigar_constants(VALUE rclass) +{ + RB_SIGAR_CONST_INT(IFF_UP); + RB_SIGAR_CONST_INT(IFF_BROADCAST); + RB_SIGAR_CONST_INT(IFF_DEBUG); + RB_SIGAR_CONST_INT(IFF_LOOPBACK); + RB_SIGAR_CONST_INT(IFF_POINTOPOINT); + RB_SIGAR_CONST_INT(IFF_NOTRAILERS); + RB_SIGAR_CONST_INT(IFF_RUNNING); + RB_SIGAR_CONST_INT(IFF_NOARP); + RB_SIGAR_CONST_INT(IFF_PROMISC); + RB_SIGAR_CONST_INT(IFF_ALLMULTI); + RB_SIGAR_CONST_INT(IFF_MULTICAST); +} + void Init_rbsigar(void) { VALUE rclass = rb_define_class("Sigar", rb_cObject); @@ -186,6 +204,8 @@ void Init_rbsigar(void) rb_define_singleton_method(rclass, "net_interface_flags_to_s", rb_sigar_net_interface_flags_to_s, 1); + Init_rbsigar_constants(rclass); + /* generated */ rb_sigar_define_module_methods(rclass); }