git » nmdb » commit a0da39b

Implement UDP support in D bindings.

author Alberto Bertogli
2007-06-07 05:26:28 UTC
committer Alberto Bertogli
2007-06-07 05:26:28 UTC
parent 3cf6bc35ba55cb4cf6c6b031d49a8d550832afc3

Implement UDP support in D bindings.

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

bindings/d/nmdb.d +8 -0
bindings/d/nmdb_ll.d +1 -0

diff --git a/bindings/d/nmdb.d b/bindings/d/nmdb.d
index ce73191..e746d86 100644
--- a/bindings/d/nmdb.d
+++ b/bindings/d/nmdb.d
@@ -59,6 +59,14 @@ class DB
 		}
 	}
 
+	void add_udp_server(char[] addr, int port = -1)
+	{
+		int r = nmdb_add_udp_server(db, cast(ubyte *) addr.ptr, port);
+		if (r == 0) {
+			throw new Exception("Can't add server");
+		}
+	}
+
 	private char[] do_get(char[] key, int mode)
 	{
 		ptrdiff_t size;
diff --git a/bindings/d/nmdb_ll.d b/bindings/d/nmdb_ll.d
index 5c8a5b6..6fc3852 100644
--- a/bindings/d/nmdb_ll.d
+++ b/bindings/d/nmdb_ll.d
@@ -39,6 +39,7 @@ version (X86_64) {
 extern (C) nmdb_t *nmdb_init();
 extern (C) int nmdb_add_tipc_server(nmdb_t *db, int port);
 extern (C) int nmdb_add_tcp_server(nmdb_t *db, ubyte *addr, int port);
+extern (C) int nmdb_add_udp_server(nmdb_t *db, ubyte *addr, int port);
 extern (C) int nmdb_free(nmdb_t *db);
 
 extern (C) ptrdiff_t nmdb_get(nmdb_t *db, ubyte *key, size_t ksize,