From 8c982e45ff5010ba08171a0ba47749a6e6f8410f Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 23 Sep 2007 23:48:29 +0000 Subject: [PATCH] add net_stat wrapper --- bindings/ruby/rbsigar.c | 50 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/bindings/ruby/rbsigar.c b/bindings/ruby/rbsigar.c index 1794aa85..ed462c64 100644 --- a/bindings/ruby/rbsigar.c +++ b/bindings/ruby/rbsigar.c @@ -107,6 +107,18 @@ static VALUE rb_sigar_new_strlist(char **data, unsigned long number) return av; } +static VALUE rb_sigar_new_intlist(int *data, int number) +{ + int i; + VALUE av = rb_ary_new2(number); + + for (i=0; itcp_states[0], SIGAR_TCP_UNKNOWN); } static VALUE rb_cSigarNetConnection; @@ -341,6 +385,7 @@ void Init_rbsigar(void) rb_define_method(rclass, "net_connection_list", rb_sigar_net_connection_list, 1); rb_define_method(rclass, "net_interface_list", rb_sigar_net_interface_list, 0); rb_define_method(rclass, "net_services_name", rb_sigar_net_services_name, 2); + rb_define_method(rclass, "net_stat", rb_sigar_net_stat, 1); rb_define_method(rclass, "who_list", rb_sigar_who_list, 0); rb_define_method(rclass, "proc_args", rb_sigar_proc_args, 1); rb_define_method(rclass, "proc_env", rb_sigar_proc_env, 1); @@ -358,4 +403,5 @@ void Init_rbsigar(void) /* generated */ rb_sigar_define_module_methods(rclass); + rb_define_method(rb_cSigarNetStat, "tcp_states", rb_sigar_NetStat_tcp_states, 0); }