nat: Start making the number of multiplexes configurable

Introduce a VTY setting that right now needs to be set to
one. To make updating this setting possible we will now store
the number of endpoints in the bsc connection as well.
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index 01bee74..2aefe9b 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -113,6 +113,7 @@
 		vty_out(vty, "  description %s%s", bsc->description, VTY_NEWLINE);
 	if (bsc->acc_lst_name)
 		vty_out(vty, "  access-list-name %s%s", bsc->acc_lst_name, VTY_NEWLINE);
+	vty_out(vty, "  number-multiplexes %d%s", bsc->number_multiplexes, VTY_NEWLINE);
 }
 
 static int config_write_bsc(struct vty *vty)
@@ -183,7 +184,7 @@
 			continue;
 
 		vty_out(vty, "MGCP Status for %d%s", con->cfg->nr, VTY_NEWLINE);
-		endpoints = 31 * con->cfg->number_multiplexes;
+		endpoints = con->number_endpoints;
 		for (i = 1; i <= endpoints; ++i)
 			vty_out(vty, " Endpoint 0x%x %s%s", i,
 				con->_endpoint_status[i] == 0 ? "free" : "allocated",
@@ -630,6 +631,16 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_bsc_nr_multip, cfg_bsc_nr_multip_cmd,
+      "number-multiplexes <1-1>",
+      "Number of multiplexes on a BSC\n" "Number of ports\n")
+{
+	struct bsc_config *conf = vty->index;
+
+	conf->number_multiplexes = atoi(argv[0]);
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_bsc_paging,
       cfg_bsc_paging_cmd,
       "paging forbidden (0|1)",
@@ -730,6 +741,7 @@
 	install_element(NAT_BSC_NODE, &cfg_bsc_paging_cmd);
 	install_element(NAT_BSC_NODE, &cfg_bsc_desc_cmd);
 	install_element(NAT_BSC_NODE, &cfg_bsc_acc_lst_name_cmd);
+	install_element(NAT_BSC_NODE, &cfg_bsc_nr_multip_cmd);
 
 	mgcp_vty_init();