git » nmdb » commit 5dd2e65

Add nmdb_add_sctp_server() to Ruby bindings.

author Alberto Bertogli
2007-09-02 01:01:45 UTC
committer Alberto Bertogli
2007-09-02 01:01:45 UTC
parent d71878efb34762e2c77529272072b5de91878f5b

Add nmdb_add_sctp_server() to Ruby bindings.

Also fix TCP and UDP server prototypes.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

bindings/ruby/nmdb.rb +6 -2
bindings/ruby/nmdb_ll.c +11 -0

diff --git a/bindings/ruby/nmdb.rb b/bindings/ruby/nmdb.rb
index a78ab72..7079406 100644
--- a/bindings/ruby/nmdb.rb
+++ b/bindings/ruby/nmdb.rb
@@ -23,11 +23,15 @@ class GenericDB
 	end
 
 	def add_tcp_server(host, port = 26010)
-		return @db.add_tcp_server(port)
+		return @db.add_tcp_server(host, port)
 	end
 
 	def add_udp_server(host, port = 26010)
-		return @db.add_udp_server(port)
+		return @db.add_udp_server(host, port)
+	end
+
+	def add_sctp_server(host, port = 26010)
+		return @db.add_sctp_server(host, port)
 	end
 
 
diff --git a/bindings/ruby/nmdb_ll.c b/bindings/ruby/nmdb_ll.c
index 05e7b4f..6bcfb97 100644
--- a/bindings/ruby/nmdb_ll.c
+++ b/bindings/ruby/nmdb_ll.c
@@ -60,6 +60,16 @@ VALUE m_add_udp_server(VALUE self, VALUE hostname, VALUE port)
 	return INT2NUM(rv);
 }
 
+VALUE m_add_sctp_server(VALUE self, VALUE hostname, VALUE port)
+{
+	nmdb_t *db;
+	Data_Get_Struct(self, nmdb_t, db);
+
+	int rv = nmdb_add_sctp_server(db, StringValuePtr(hostname),
+			NUM2INT(port));
+	return INT2NUM(rv);
+}
+
 
 /* Set functions */
 typedef int (*setf_t) (nmdb_t *db,
@@ -202,6 +212,7 @@ void Init_nmdb_ll()
 	rb_define_method(rb_cDB, "add_tipc_server", m_add_tipc_server, 1);
 	rb_define_method(rb_cDB, "add_tcp_server", m_add_tcp_server, 2);
 	rb_define_method(rb_cDB, "add_udp_server", m_add_udp_server, 2);
+	rb_define_method(rb_cDB, "add_sctp_server", m_add_sctp_server, 2);
 
 	rb_define_method(rb_cDB, "set", m_set, 2);
 	rb_define_method(rb_cDB, "set_sync", m_set_sync, 2);