ctrl: take both address and port from vty config

Change-Id: Id053bc02e0a6359e52a0f5e110128d3bb87ed151
diff --git a/include/osmocom/mgcp/Makefile.am b/include/osmocom/mgcp/Makefile.am
index 60f29c6..15ff01a 100644
--- a/include/osmocom/mgcp/Makefile.am
+++ b/include/osmocom/mgcp/Makefile.am
@@ -6,7 +6,6 @@
 	mgcp_endp.h \
 	mgcp_sdp.h \
 	mgcp_codec.h \
-	mgcp_ctrl.h \
 	mgcp_trunk.h \
 	debug.h \
 	mgcp_ratectr.h \
diff --git a/include/osmocom/mgcp/mgcp_ctrl.h b/include/osmocom/mgcp/mgcp_ctrl.h
deleted file mode 100644
index d7ab7cb..0000000
--- a/include/osmocom/mgcp/mgcp_ctrl.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * (C) 2020 by Harald Welte <laforge@gnumonks.org>
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#pragma once
-
-struct ctrl_handle *mgw_ctrl_interface_setup(struct mgcp_config *cfg,
-                                             const char *bind_addr, uint16_t port);
-
diff --git a/src/libosmo-mgcp/Makefile.am b/src/libosmo-mgcp/Makefile.am
index de42c0e..309ae3f 100644
--- a/src/libosmo-mgcp/Makefile.am
+++ b/src/libosmo-mgcp/Makefile.am
@@ -45,7 +45,6 @@
 	mgcp_stat.c \
 	mgcp_endp.c \
 	mgcp_trunk.c \
-	mgcp_ctrl.c \
 	mgcp_ratectr.c \
 	mgcp_e1.c \
 	mgcp_iuup.c \
diff --git a/src/libosmo-mgcp/mgcp_ctrl.c b/src/libosmo-mgcp/mgcp_ctrl.c
deleted file mode 100644
index 0ba231b..0000000
--- a/src/libosmo-mgcp/mgcp_ctrl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * (C) 2020 by Harald Welte <laforge@gnumonks.org>
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <osmocom/ctrl/control_if.h>
-#include <osmocom/mgcp/mgcp.h>
-
-
-static int mgw_ctrl_node_lookup(void *data, vector vline, int *node_type,
-				void **node_data, int *i)
-{
-	return 0;
-}
-
-
-struct ctrl_handle *mgw_ctrl_interface_setup(struct mgcp_config *cfg,
-					     const char *bind_addr, uint16_t port)
-{
-	return ctrl_interface_setup_dynip2(cfg, bind_addr, port, mgw_ctrl_node_lookup,
-					   _LAST_CTRL_NODE);
-}
diff --git a/src/osmo-mgw/mgw_main.c b/src/osmo-mgw/mgw_main.c
index 7a76210..cd9d75d 100644
--- a/src/osmo-mgw/mgw_main.c
+++ b/src/osmo-mgw/mgw_main.c
@@ -41,7 +41,6 @@
 #include <osmocom/mgcp/debug.h>
 #include <osmocom/mgcp/mgcp_endp.h>
 #include <osmocom/mgcp/mgcp_trunk.h>
-#include <osmocom/mgcp/mgcp_ctrl.h>
 
 #include <osmocom/core/application.h>
 #include <osmocom/core/msgb.h>
@@ -51,7 +50,7 @@
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/core/logging.h>
 #include <osmocom/core/socket.h>
-
+#include <osmocom/ctrl/control_if.h>
 #include <osmocom/ctrl/control_vty.h>
 
 #include <osmocom/vty/telnet_interface.h>
@@ -366,7 +365,7 @@
 	if (rc < 0)
 		return rc;
 
-	cfg->ctrl = mgw_ctrl_interface_setup(cfg, ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_MGW);
+	cfg->ctrl = ctrl_interface_setup(cfg, OSMO_CTRL_PORT_MGW, NULL);
 	if (!cfg->ctrl) {
 		fprintf(stderr, "Failed to init the control interface on %s:%u. Exiting\n",
 			ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_MGW);