git » nmdb » commit 4768480

Support the new TCP default port in libnmdb.

author Alberto Bertogli
2007-06-01 18:14:24 UTC
committer Alberto Bertogli
2007-06-01 18:14:24 UTC
parent 7c3e94e5efd5bd122098264ce676c7d0653a5050

Support the new TCP default port in libnmdb.

The bindings need no modification as they rely on libnmdb's behaviour
of choosing the default port if port = -1.

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

libnmdb/libnmdb.c +3 -0
libnmdb/net-const.h +4 -0

diff --git a/libnmdb/libnmdb.c b/libnmdb/libnmdb.c
index b11b7e8..2d44a55 100644
--- a/libnmdb/libnmdb.c
+++ b/libnmdb/libnmdb.c
@@ -201,6 +201,9 @@ static int add_tcp_server_addr(nmdb_t *db, in_addr_t *inetaddr, int port)
 	db->servers = newarray;
 	db->nservers++;
 
+	if (port < 0)
+		port = TCP_SERVER_PORT;
+
 	newsrv = &(db->servers[db->nservers - 1]);
 
 	newsrv->fd = fd;
diff --git a/libnmdb/net-const.h b/libnmdb/net-const.h
index e0f5fc2..16871e7 100644
--- a/libnmdb/net-const.h
+++ b/libnmdb/net-const.h
@@ -11,6 +11,10 @@
 #define TIPC_SERVER_TYPE 26001
 #define TIPC_SERVER_INST 10
 
+/* TCP default listen address and port. */
+#define TCP_SERVER_ADDR "0.0.0.0"
+#define TCP_SERVER_PORT 26010
+
 /* Protocol version, for checking in the network header. */
 #define PROTO_VER 1