[PATCH] osmo-mgw[master]: rename mgcpgw_client_* to mgcp_client_*

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 4 00:38:05 UTC 2017


Review at  https://gerrit.osmocom.org/3784

rename mgcpgw_client_* to mgcp_client_*

The name "mgcpgw_client" referred to an MGCP gateway, which is rather an MGW
(Media Gateway). But this client code is more generally a client for the MGCP
protocol, independently from what the server program is called.

Rename the files as well as the function prefixes to drop the "gw". It is
purely cosmetic and not strictly necessary, but a good point in time for fixes
like this.

osmo-msc build will be adjusted by I093ad02ca0e532f659447c785e09678b3e6f220d.
osmo-bsc build will be adjusted by I6402c7cbe58dacae7630f7f03819f8102e54c699.
These should be applied right after this here is merged to avoid fallout.

Change-Id: I99f7faab637cfcc22ece64a1dbcbe590f2042187
---
M include/Makefile.am
M include/osmocom/mgcp_client/Makefile.am
A include/osmocom/mgcp_client/mgcp_client.h
R include/osmocom/mgcp_client/mgcp_client_internal.h
D include/osmocom/mgcp_client/mgcpgw_client.h
M src/libosmo-mgcp-client/Makefile.am
R src/libosmo-mgcp-client/mgcp_client.c
R src/libosmo-mgcp-client/mgcp_client_vty.c
M tests/mgcp_client/Makefile.am
R tests/mgcp_client/mgcp_client_test.c
R tests/mgcp_client/mgcp_client_test.err
R tests/mgcp_client/mgcp_client_test.ok
M tests/testsuite.at
13 files changed, 175 insertions(+), 175 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/84/3784/1

diff --git a/include/Makefile.am b/include/Makefile.am
index e2baf41..94d74bb 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -6,5 +6,5 @@
 	osmocom/legacy_mgcp/mgcp.h \
 	osmocom/legacy_mgcp/mgcp_internal.h \
 	osmocom/legacy_mgcp/osmux.h \
-	osmocom/mgcp_client/mgcpgw_client.h \
+	osmocom/mgcp_client/mgcp_client.h \
 	$(NULL)
diff --git a/include/osmocom/mgcp_client/Makefile.am b/include/osmocom/mgcp_client/Makefile.am
index 224a7dc..24401f1 100644
--- a/include/osmocom/mgcp_client/Makefile.am
+++ b/include/osmocom/mgcp_client/Makefile.am
@@ -1,3 +1,3 @@
 noinst_HEADERS = \
-	mgcpgw_client_internal.h \
+	mgcp_client_internal.h \
 	$(NULL)
diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h
new file mode 100644
index 0000000..df73811
--- /dev/null
+++ b/include/osmocom/mgcp_client/mgcp_client.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#include <stdint.h>
+
+#define MGCP_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
+#define MGCP_CLIENT_LOCAL_PORT_DEFAULT 0
+#define MGCP_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
+#define MGCP_CLIENT_REMOTE_PORT_DEFAULT 2427
+
+struct msgb;
+struct vty;
+struct mgcp_client;
+
+struct mgcp_client_conf {
+	const char *local_addr;
+	int local_port;
+	const char *remote_addr;
+	int remote_port;
+	uint16_t first_endpoint;
+	uint16_t last_endpoint;
+	uint16_t bts_base;
+};
+
+typedef unsigned int mgcp_trans_id_t;
+
+struct mgcp_response_head {
+       int response_code;
+       mgcp_trans_id_t trans_id;
+       const char *comment;
+};
+
+struct mgcp_response {
+	char *body;
+	struct mgcp_response_head head;
+	uint16_t audio_port;
+};
+
+void mgcp_client_conf_init(struct mgcp_client_conf *conf);
+void mgcp_client_vty_init(void *talloc_ctx, int node, struct mgcp_client_conf *conf);
+int mgcp_client_config_write(struct vty *vty, const char *indent);
+struct mgcp_client_conf *mgcp_client_conf_actual(struct mgcp_client *mgcp);
+
+struct mgcp_client *mgcp_client_init(void *ctx,
+				     struct mgcp_client_conf *conf);
+int mgcp_client_connect(struct mgcp_client *mgcp);
+
+const char *mgcp_client_remote_addr_str(struct mgcp_client *mgcp);
+uint16_t mgcp_client_remote_port(struct mgcp_client *mgcp);
+uint32_t mgcp_client_remote_addr_n(struct mgcp_client *mgcp);
+
+int mgcp_client_next_endpoint(struct mgcp_client *client);
+void mgcp_client_release_endpoint(uint16_t id, struct mgcp_client *client);
+
+/* Invoked when an MGCP response is received or sending failed.  When the
+ * response is passed as NULL, this indicates failure during transmission. */
+typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
+int mgcp_response_parse_params(struct mgcp_response *r);
+
+int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
+		   mgcp_response_cb_t response_cb, void *priv);
+
+enum mgcp_connection_mode;
+
+struct msgb *mgcp_msg_crcx(struct mgcp_client *mgcp,
+			   uint16_t rtp_endpoint, unsigned int call_id,
+			   enum mgcp_connection_mode mode);
+
+struct msgb *mgcp_msg_mdcx(struct mgcp_client *mgcp,
+			   uint16_t rtp_endpoint, const char *rtp_conn_addr,
+			   uint16_t rtp_port, enum mgcp_connection_mode mode);
+
+struct msgb *mgcp_msg_dlcx(struct mgcp_client *mgcp, uint16_t rtp_endpoint,
+			   unsigned int call_id);
diff --git a/include/osmocom/mgcp_client/mgcpgw_client_internal.h b/include/osmocom/mgcp_client/mgcp_client_internal.h
similarity index 69%
rename from include/osmocom/mgcp_client/mgcpgw_client_internal.h
rename to include/osmocom/mgcp_client/mgcp_client_internal.h
index d3a7849..1b149e2 100644
--- a/include/osmocom/mgcp_client/mgcpgw_client_internal.h
+++ b/include/osmocom/mgcp_client/mgcp_client_internal.h
@@ -2,8 +2,8 @@
 
 #define MSGB_CB_MGCP_TRANS_ID 0
 
-struct mgcpgw_client {
-	struct mgcpgw_client_conf actual;
+struct mgcp_client {
+	struct mgcp_client_conf actual;
 	uint32_t remote_addr;
 	struct osmo_wqueue wq;
 	mgcp_trans_id_t next_trans_id;
@@ -24,10 +24,10 @@
 	void *priv;
 };
 
-int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg);
+int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg);
 
-struct mgcp_response_pending * mgcpgw_client_pending_add(
-					struct mgcpgw_client *mgcp,
+struct mgcp_response_pending * mgcp_client_pending_add(
+					struct mgcp_client *mgcp,
 					mgcp_trans_id_t trans_id,
 					mgcp_response_cb_t response_cb,
 					void *priv);
diff --git a/include/osmocom/mgcp_client/mgcpgw_client.h b/include/osmocom/mgcp_client/mgcpgw_client.h
deleted file mode 100644
index 09db816..0000000
--- a/include/osmocom/mgcp_client/mgcpgw_client.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#pragma once
-
-#include <stdint.h>
-
-#define MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
-#define MGCPGW_CLIENT_LOCAL_PORT_DEFAULT 0
-#define MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
-#define MGCPGW_CLIENT_REMOTE_PORT_DEFAULT 2427
-
-struct msgb;
-struct vty;
-struct mgcpgw_client;
-
-struct mgcpgw_client_conf {
-	const char *local_addr;
-	int local_port;
-	const char *remote_addr;
-	int remote_port;
-	uint16_t first_endpoint;
-	uint16_t last_endpoint;
-	uint16_t bts_base;
-};
-
-typedef unsigned int mgcp_trans_id_t;
-
-struct mgcp_response_head {
-       int response_code;
-       mgcp_trans_id_t trans_id;
-       const char *comment;
-};
-
-struct mgcp_response {
-	char *body;
-	struct mgcp_response_head head;
-	uint16_t audio_port;
-};
-
-void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf);
-void mgcpgw_client_vty_init(void *talloc_ctx, int node, struct mgcpgw_client_conf *conf);
-int mgcpgw_client_config_write(struct vty *vty, const char *indent);
-struct mgcpgw_client_conf *mgcpgw_client_conf_actual(struct mgcpgw_client *mgcp);
-
-struct mgcpgw_client *mgcpgw_client_init(void *ctx,
-					 struct mgcpgw_client_conf *conf);
-int mgcpgw_client_connect(struct mgcpgw_client *mgcp);
-
-const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
-uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
-uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp);
-
-int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
-void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client);
-
-/* Invoked when an MGCP response is received or sending failed.  When the
- * response is passed as NULL, this indicates failure during transmission. */
-typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
-int mgcp_response_parse_params(struct mgcp_response *r);
-
-int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
-		     mgcp_response_cb_t response_cb, void *priv);
-
-enum mgcp_connection_mode;
-
-struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
-			   uint16_t rtp_endpoint, unsigned int call_id,
-			   enum mgcp_connection_mode mode);
-
-struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
-			   uint16_t rtp_endpoint, const char *rtp_conn_addr,
-			   uint16_t rtp_port, enum mgcp_connection_mode mode);
-
-struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
-			   unsigned int call_id);
diff --git a/src/libosmo-mgcp-client/Makefile.am b/src/libosmo-mgcp-client/Makefile.am
index 02b9177..dbbd303 100644
--- a/src/libosmo-mgcp-client/Makefile.am
+++ b/src/libosmo-mgcp-client/Makefile.am
@@ -29,8 +29,8 @@
 	$(NULL)
 
 libosmo_mgcp_client_la_SOURCES = \
-	mgcpgw_client.c \
-	mgcpgw_client_vty.c \
+	mgcp_client.c \
+	mgcp_client_vty.c \
 	../libosmo-legacy-mgcp/mgcp_common.c \
 	$(NULL)
 
diff --git a/src/libosmo-mgcp-client/mgcpgw_client.c b/src/libosmo-mgcp-client/mgcp_client.c
similarity index 85%
rename from src/libosmo-mgcp-client/mgcpgw_client.c
rename to src/libosmo-mgcp-client/mgcp_client.c
index 7ed4b07..b72fc50 100644
--- a/src/libosmo-mgcp-client/mgcpgw_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -26,8 +26,8 @@
 
 #include <osmocom/legacy_mgcp/mgcp.h>
 #include <osmocom/legacy_mgcp/mgcp_internal.h>
-#include <osmocom/mgcp_client/mgcpgw_client.h>
-#include <osmocom/mgcp_client/mgcpgw_client_internal.h>
+#include <osmocom/mgcp_client/mgcp_client.h>
+#include <osmocom/mgcp_client/mgcp_client_internal.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -36,10 +36,10 @@
 #include <unistd.h>
 #include <string.h>
 
-void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf)
+void mgcp_client_conf_init(struct mgcp_client_conf *conf)
 {
-	/* NULL and -1 default to MGCPGW_CLIENT_*_DEFAULT values */
-	*conf = (struct mgcpgw_client_conf){
+	/* NULL and -1 default to MGCP_CLIENT_*_DEFAULT values */
+	*conf = (struct mgcp_client_conf){
 		.local_addr = NULL,
 		.local_port = -1,
 		.remote_addr = NULL,
@@ -51,7 +51,7 @@
 }
 
 /* Test if a given endpoint id is currently in use */
-static bool endpoint_in_use(uint16_t id, struct mgcpgw_client *client)
+static bool endpoint_in_use(uint16_t id, struct mgcp_client *client)
 {
 	struct mgcp_inuse_endpoint *endpoint;
 	llist_for_each_entry(endpoint, &client->inuse_endpoints, entry) {
@@ -63,7 +63,7 @@
 }
 
 /* Find and seize an unsused endpoint id */
-int mgcpgw_client_next_endpoint(struct mgcpgw_client *client)
+int mgcp_client_next_endpoint(struct mgcp_client *client)
 {
 	int i;
 	uint16_t first_endpoint = client->actual.first_endpoint;
@@ -96,7 +96,7 @@
 }
 
 /* Release a seized endpoint id to make it available again for other calls */
-void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client)
+void mgcp_client_release_endpoint(uint16_t id, struct mgcp_client *client)
 {
 	struct mgcp_inuse_endpoint *endpoint;
 	struct mgcp_inuse_endpoint *endpoint_tmp;
@@ -108,9 +108,9 @@
 	}
 }
 
-static void mgcpgw_client_handle_response(struct mgcpgw_client *mgcp,
-					  struct mgcp_response_pending *pending,
-					  struct mgcp_response *response)
+static void mgcp_client_handle_response(struct mgcp_client *mgcp,
+					struct mgcp_response_pending *pending,
+					struct mgcp_response *response)
 {
 	if (!pending) {
 		LOGP(DLMGCP, LOGL_ERROR,
@@ -226,8 +226,8 @@
 	return 0;
 }
 
-static struct mgcp_response_pending *mgcpgw_client_response_pending_get(
-					 struct mgcpgw_client *mgcp,
+static struct mgcp_response_pending *mgcp_client_response_pending_get(
+					 struct mgcp_client *mgcp,
 					 struct mgcp_response *r)
 {
 	struct mgcp_response_pending *pending;
@@ -248,7 +248,7 @@
  * mgcp_do_read that reads from the socket connected to the MGCP gateway. This
  * function is published mainly to be able to feed data from the test suite.
  */
-int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg)
+int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg)
 {
 	struct mgcp_response r = { 0 };
 	struct mgcp_response_pending *pending;
@@ -260,7 +260,7 @@
 		return -1;
 	}
 
-	pending = mgcpgw_client_response_pending_get(mgcp, &r);
+	pending = mgcp_client_response_pending_get(mgcp, &r);
 	if (!pending) {
 		LOGP(DLMGCP, LOGL_ERROR,
 		     "Cannot find matching MGCP transaction for trans_id %d\n",
@@ -268,13 +268,13 @@
 		return -1;
 	}
 
-	mgcpgw_client_handle_response(mgcp, pending, &r);
+	mgcp_client_handle_response(mgcp, pending, &r);
 	return 0;
 }
 
 static int mgcp_do_read(struct osmo_fd *fd)
 {
-	struct mgcpgw_client *mgcp = fd->data;
+	struct mgcp_client *mgcp = fd->data;
 	struct msgb *msg;
 	int ret;
 
@@ -296,7 +296,7 @@
         }
 
 	msg->l2h = msgb_put(msg, ret);
-	ret = mgcpgw_client_rx(mgcp, msg);
+	ret = mgcp_client_rx(mgcp, msg);
 	talloc_free(msg);
 	return ret;
 }
@@ -327,12 +327,12 @@
 	return ret;
 }
 
-struct mgcpgw_client *mgcpgw_client_init(void *ctx,
-					 struct mgcpgw_client_conf *conf)
+struct mgcp_client *mgcp_client_init(void *ctx,
+				     struct mgcp_client_conf *conf)
 {
-	struct mgcpgw_client *mgcp;
+	struct mgcp_client *mgcp;
 
-	mgcp = talloc_zero(ctx, struct mgcpgw_client);
+	mgcp = talloc_zero(ctx, struct mgcp_client);
 
 	INIT_LLIST_HEAD(&mgcp->responses_pending);
 	INIT_LLIST_HEAD(&mgcp->inuse_endpoints);
@@ -340,14 +340,14 @@
 	mgcp->next_trans_id = 1;
 
 	mgcp->actual.local_addr = conf->local_addr ? conf->local_addr :
-		MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT;
+		MGCP_CLIENT_LOCAL_ADDR_DEFAULT;
 	mgcp->actual.local_port = conf->local_port >= 0 ? (uint16_t)conf->local_port :
-		MGCPGW_CLIENT_LOCAL_PORT_DEFAULT;
+		MGCP_CLIENT_LOCAL_PORT_DEFAULT;
 
 	mgcp->actual.remote_addr = conf->remote_addr ? conf->remote_addr :
-		MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT;
+		MGCP_CLIENT_REMOTE_ADDR_DEFAULT;
 	mgcp->actual.remote_port = conf->remote_port >= 0 ? (uint16_t)conf->remote_port :
-		MGCPGW_CLIENT_REMOTE_PORT_DEFAULT;
+		MGCP_CLIENT_REMOTE_PORT_DEFAULT;
 
 	mgcp->actual.first_endpoint = conf->first_endpoint > 0 ? (uint16_t)conf->first_endpoint : 0;
 	mgcp->actual.last_endpoint = conf->last_endpoint > 0 ? (uint16_t)conf->last_endpoint : 0;
@@ -356,7 +356,7 @@
 	return mgcp;
 }
 
-int mgcpgw_client_connect(struct mgcpgw_client *mgcp)
+int mgcp_client_connect(struct mgcp_client *mgcp)
 {
 	int on;
 	struct sockaddr_in addr;
@@ -434,24 +434,24 @@
 	return rc;
 }
 
-const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp)
+const char *mgcp_client_remote_addr_str(struct mgcp_client *mgcp)
 {
 	return mgcp->actual.remote_addr;
 }
 
-uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp)
+uint16_t mgcp_client_remote_port(struct mgcp_client *mgcp)
 {
 	return mgcp->actual.remote_port;
 }
 
 /* Return the MGCP GW binary IPv4 address in network byte order. */
-uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp)
+uint32_t mgcp_client_remote_addr_n(struct mgcp_client *mgcp)
 {
 	return mgcp->remote_addr;
 }
 
-struct mgcp_response_pending * mgcpgw_client_pending_add(
-					struct mgcpgw_client *mgcp,
+struct mgcp_response_pending * mgcp_client_pending_add(
+					struct mgcp_client *mgcp,
 					mgcp_trans_id_t trans_id,
 					mgcp_response_cb_t response_cb,
 					void *priv)
@@ -472,8 +472,8 @@
  * mgcp_response_parse_params(response) to get the parsed parameters -- to
  * potentially save some CPU cycles, only the head line has been parsed when
  * the response_cb is invoked. */
-int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
-		     mgcp_response_cb_t response_cb, void *priv)
+int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
+		   mgcp_response_cb_t response_cb, void *priv)
 {
 	struct mgcp_response_pending *pending;
 	mgcp_trans_id_t trans_id;
@@ -487,7 +487,7 @@
 		return -EINVAL;
 	}
 
-	pending = mgcpgw_client_pending_add(mgcp, trans_id, response_cb, priv);
+	pending = mgcp_client_pending_add(mgcp, trans_id, response_cb, priv);
 
 	if (msgb_l2len(msg) > 4096) {
 		LOGP(DLMGCP, LOGL_ERROR,
@@ -510,7 +510,7 @@
 
 mgcp_tx_error:
 	/* Pass NULL to response cb to indicate an error */
-	mgcpgw_client_handle_response(mgcp, pending, NULL);
+	mgcp_client_handle_response(mgcp, pending, NULL);
 	return -1;
 }
 
@@ -562,7 +562,7 @@
 	return mgcp_msg_from_buf(trans_id, compose, len);
 }
 
-static mgcp_trans_id_t mgcpgw_client_next_trans_id(struct mgcpgw_client *mgcp)
+static mgcp_trans_id_t mgcp_client_next_trans_id(struct mgcp_client *mgcp)
 {
 	/* avoid zero trans_id to distinguish from unset trans_id */
 	if (!mgcp->next_trans_id)
@@ -570,11 +570,11 @@
 	return mgcp->next_trans_id ++;
 }
 
-struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
+struct msgb *mgcp_msg_crcx(struct mgcp_client *mgcp,
 			   uint16_t rtp_endpoint, unsigned int call_id,
 			   enum mgcp_connection_mode mode)
 {
-	mgcp_trans_id_t trans_id = mgcpgw_client_next_trans_id(mgcp);
+	mgcp_trans_id_t trans_id = mgcp_client_next_trans_id(mgcp);
 	return mgcp_msg_from_str(trans_id,
 		 "CRCX %u %x at mgw MGCP 1.0\r\n"
 		 "C: %x\r\n"
@@ -587,12 +587,12 @@
 		 mgcp_cmode_name(mode));
 }
 
-struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
+struct msgb *mgcp_msg_mdcx(struct mgcp_client *mgcp,
 			   uint16_t rtp_endpoint, const char *rtp_conn_addr,
 			   uint16_t rtp_port, enum mgcp_connection_mode mode)
 
 {
-	mgcp_trans_id_t trans_id = mgcpgw_client_next_trans_id(mgcp);
+	mgcp_trans_id_t trans_id = mgcp_client_next_trans_id(mgcp);
 	return mgcp_msg_from_str(trans_id,
 		 "MDCX %u %x at mgw MGCP 1.0\r\n"
 		 "M: %s\r\n"
@@ -607,16 +607,16 @@
 		 rtp_port);
 }
 
-struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
+struct msgb *mgcp_msg_dlcx(struct mgcp_client *mgcp, uint16_t rtp_endpoint,
 			   unsigned int call_id)
 {
-	mgcp_trans_id_t trans_id = mgcpgw_client_next_trans_id(mgcp);
+	mgcp_trans_id_t trans_id = mgcp_client_next_trans_id(mgcp);
 	return mgcp_msg_from_str(trans_id,
 				 "DLCX %u %x at mgw MGCP 1.0\r\n"
 				 "C: %x\r\n", trans_id, rtp_endpoint, call_id);
 }
 
-struct mgcpgw_client_conf *mgcpgw_client_conf_actual(struct mgcpgw_client *mgcp)
+struct mgcp_client_conf *mgcp_client_conf_actual(struct mgcp_client *mgcp)
 {
 	return &mgcp->actual;
 }
diff --git a/src/libosmo-mgcp-client/mgcpgw_client_vty.c b/src/libosmo-mgcp-client/mgcp_client_vty.c
similarity index 74%
rename from src/libosmo-mgcp-client/mgcpgw_client_vty.c
rename to src/libosmo-mgcp-client/mgcp_client_vty.c
index 034c84c..1e8bba6 100644
--- a/src/libosmo-mgcp-client/mgcpgw_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -28,23 +28,23 @@
 #include <osmocom/core/utils.h>
 
 #include <osmocom/legacy_mgcp/vty.h>
-#include <osmocom/mgcp_client/mgcpgw_client.h>
+#include <osmocom/mgcp_client/mgcp_client.h>
 
 #define MGCPGW_STR "MGCP gateway configuration for RTP streams\n"
 
-void *global_mgcpgw_client_ctx = NULL;
-struct mgcpgw_client_conf *global_mgcpgw_client_conf = NULL;
+void *global_mgcp_client_ctx = NULL;
+struct mgcp_client_conf *global_mgcp_client_conf = NULL;
 
 DEFUN(cfg_mgcpgw_local_ip, cfg_mgcpgw_local_ip_cmd,
       "mgcpgw local-ip A.B.C.D",
       MGCPGW_STR "local bind to connect to MGCP gateway with\n"
       "local bind IP address\n")
 {
-	if (!global_mgcpgw_client_conf)
+	if (!global_mgcp_client_conf)
 		return CMD_ERR_NOTHING_TODO;
-	OSMO_ASSERT(global_mgcpgw_client_ctx);
-	global_mgcpgw_client_conf->local_addr =
-		talloc_strdup(global_mgcpgw_client_ctx, argv[0]);
+	OSMO_ASSERT(global_mgcp_client_ctx);
+	global_mgcp_client_conf->local_addr =
+		talloc_strdup(global_mgcp_client_ctx, argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -53,9 +53,9 @@
       MGCPGW_STR "local bind to connect to MGCP gateway with\n"
       "local bind port\n")
 {
-	if (!global_mgcpgw_client_conf)
+	if (!global_mgcp_client_conf)
 		return CMD_ERR_NOTHING_TODO;
-	global_mgcpgw_client_conf->local_port = atoi(argv[0]);
+	global_mgcp_client_conf->local_port = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -64,11 +64,11 @@
       MGCPGW_STR "remote bind to connect to MGCP gateway with\n"
       "remote bind IP address\n")
 {
-	if (!global_mgcpgw_client_conf)
+	if (!global_mgcp_client_conf)
 		return CMD_ERR_NOTHING_TODO;
-	OSMO_ASSERT(global_mgcpgw_client_ctx);
-	global_mgcpgw_client_conf->remote_addr =
-		talloc_strdup(global_mgcpgw_client_ctx, argv[0]);
+	OSMO_ASSERT(global_mgcp_client_ctx);
+	global_mgcp_client_conf->remote_addr =
+		talloc_strdup(global_mgcp_client_ctx, argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -77,9 +77,9 @@
       MGCPGW_STR "remote bind to connect to MGCP gateway with\n"
       "remote bind port\n")
 {
-	if (!global_mgcpgw_client_conf)
+	if (!global_mgcp_client_conf)
 		return CMD_ERR_NOTHING_TODO;
-	global_mgcpgw_client_conf->remote_port = atoi(argv[0]);
+	global_mgcp_client_conf->remote_port = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -98,8 +98,8 @@
 		return CMD_SUCCESS;
 	}
 
-	global_mgcpgw_client_conf->first_endpoint = first_endpoint;
-	global_mgcpgw_client_conf->last_endpoint = last_endpoint;
+	global_mgcp_client_conf->first_endpoint = first_endpoint;
+	global_mgcp_client_conf->last_endpoint = last_endpoint;
 	return CMD_SUCCESS;
 }
 
@@ -112,11 +112,11 @@
       BTS_START_STR
       UDP_PORT_STR)
 {
-	global_mgcpgw_client_conf->bts_base = atoi(argv[0]);
+	global_mgcp_client_conf->bts_base = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
-int mgcpgw_client_config_write(struct vty *vty, const char *indent)
+int mgcp_client_config_write(struct vty *vty, const char *indent)
 {
 	const char *addr;
 	int port;
@@ -124,32 +124,32 @@
 	uint16_t last_endpoint;
 	uint16_t bts_base;
 
-	addr = global_mgcpgw_client_conf->local_addr;
+	addr = global_mgcp_client_conf->local_addr;
 	if (addr)
 		vty_out(vty, "%smgcpgw local-ip %s%s", indent, addr,
 			VTY_NEWLINE);
-	port = global_mgcpgw_client_conf->local_port;
+	port = global_mgcp_client_conf->local_port;
 	if (port >= 0)
 		vty_out(vty, "%smgcpgw local-port %u%s", indent,
 			(uint16_t)port, VTY_NEWLINE);
 
-	addr = global_mgcpgw_client_conf->remote_addr;
+	addr = global_mgcp_client_conf->remote_addr;
 	if (addr)
 		vty_out(vty, "%smgcpgw remote-ip %s%s", indent, addr,
 			VTY_NEWLINE);
-	port = global_mgcpgw_client_conf->remote_port;
+	port = global_mgcp_client_conf->remote_port;
 	if (port >= 0)
 		vty_out(vty, "%smgcpgw remote-port %u%s", indent,
 			(uint16_t)port, VTY_NEWLINE);
 
-	first_endpoint = global_mgcpgw_client_conf->first_endpoint;
-	last_endpoint = global_mgcpgw_client_conf->last_endpoint;
+	first_endpoint = global_mgcp_client_conf->first_endpoint;
+	last_endpoint = global_mgcp_client_conf->last_endpoint;
 	if (last_endpoint != 0) {
 		vty_out(vty, "%smgcpgw endpoint-range %u %u%s", indent,
 			first_endpoint, last_endpoint, VTY_NEWLINE);
 	}
 
-	bts_base = global_mgcpgw_client_conf->bts_base;
+	bts_base = global_mgcp_client_conf->bts_base;
 	if (bts_base) {
 		vty_out(vty, "%smgcpgw bts-base %u%s", indent,
 			bts_base, VTY_NEWLINE);
@@ -158,10 +158,10 @@
 	return CMD_SUCCESS;
 }
 
-void mgcpgw_client_vty_init(void *talloc_ctx, int node, struct mgcpgw_client_conf *conf)
+void mgcp_client_vty_init(void *talloc_ctx, int node, struct mgcp_client_conf *conf)
 {
-	global_mgcpgw_client_ctx = talloc_ctx;
-	global_mgcpgw_client_conf = conf;
+	global_mgcp_client_ctx = talloc_ctx;
+	global_mgcp_client_conf = conf;
 
 	install_element(node, &cfg_mgcpgw_local_ip_cmd);
 	install_element(node, &cfg_mgcpgw_local_port_cmd);
diff --git a/tests/mgcp_client/Makefile.am b/tests/mgcp_client/Makefile.am
index 2253770..e33f0e8 100644
--- a/tests/mgcp_client/Makefile.am
+++ b/tests/mgcp_client/Makefile.am
@@ -17,19 +17,19 @@
 	$(NULL)
 
 EXTRA_DIST = \
-	mgcpgw_client_test.ok \
-	mgcpgw_client_test.err \
+	mgcp_client_test.ok \
+	mgcp_client_test.err \
 	$(NULL)
 
 noinst_PROGRAMS = \
-	mgcpgw_client_test \
+	mgcp_client_test \
 	$(NULL)
 
-mgcpgw_client_test_SOURCES = \
-	mgcpgw_client_test.c \
+mgcp_client_test_SOURCES = \
+	mgcp_client_test.c \
 	$(NULL)
 
-mgcpgw_client_test_LDADD = \
+mgcp_client_test_LDADD = \
 	$(top_builddir)/src/libosmo-mgcp-client/libosmo-mgcp-client.la \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOVTY_LIBS) \
diff --git a/tests/mgcp_client/mgcpgw_client_test.c b/tests/mgcp_client/mgcp_client_test.c
similarity index 89%
rename from tests/mgcp_client/mgcpgw_client_test.c
rename to tests/mgcp_client/mgcp_client_test.c
index e90a4ed..6045297 100644
--- a/tests/mgcp_client/mgcpgw_client_test.c
+++ b/tests/mgcp_client/mgcp_client_test.c
@@ -23,8 +23,8 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/application.h>
 #include <osmocom/legacy_mgcp/mgcp.h>
-#include <osmocom/mgcp_client/mgcpgw_client.h>
-#include <osmocom/mgcp_client/mgcpgw_client_internal.h>
+#include <osmocom/mgcp_client/mgcp_client.h>
+#include <osmocom/mgcp_client/mgcp_client_internal.h>
 
 void *ctx;
 
@@ -71,8 +71,8 @@
 	return msg;
 }
 
-static struct mgcpgw_client_conf conf;
-struct mgcpgw_client *mgcp = NULL;
+static struct mgcp_client_conf conf;
+struct mgcp_client *mgcp = NULL;
 
 static void reply_to(mgcp_trans_id_t trans_id, int code, const char *comment,
 		     int conn_id, const char *params)
@@ -88,7 +88,7 @@
 
 	printf("composed response:\n-----\n%s\n-----\n",
 	       compose);
-	mgcpgw_client_rx(mgcp, from_str(compose));
+	mgcp_client_rx(mgcp, from_str(compose));
 }
 
 void test_response_cb(struct mgcp_response *response, void *priv)
@@ -114,7 +114,7 @@
 	trans_id = msg->cb[MSGB_CB_MGCP_TRANS_ID];
 	char *end;
 
-	OSMO_ASSERT(mgcpgw_client_pending_add(mgcp, trans_id, test_response_cb, mgcp));
+	OSMO_ASSERT(mgcp_client_pending_add(mgcp, trans_id, test_response_cb, mgcp));
 
 	end = (char*)msgb_put(msg, 1);
 	*end = '\0';
@@ -134,7 +134,7 @@
 
 	if (mgcp)
 		talloc_free(mgcp);
-	mgcp = mgcpgw_client_init(ctx, &conf);
+	mgcp = mgcp_client_init(ctx, &conf);
 
 	msg = mgcp_msg_crcx(mgcp, 23, 42, MGCP_CONN_LOOPBACK);
 	trans_id = dummy_mgcp_send(msg);
@@ -161,11 +161,11 @@
 
 int main(int argc, char **argv)
 {
-	ctx = talloc_named_const(NULL, 1, "mgcpgw_client_test");
+	ctx = talloc_named_const(NULL, 1, "mgcp_client_test");
 	msgb_talloc_ctx_init(ctx, 0);
 	osmo_init_logging(&log_info);
 
-	mgcpgw_client_conf_init(&conf);
+	mgcp_client_conf_init(&conf);
 
 	test_crcx();
 
diff --git a/tests/mgcp_client/mgcpgw_client_test.err b/tests/mgcp_client/mgcp_client_test.err
similarity index 100%
rename from tests/mgcp_client/mgcpgw_client_test.err
rename to tests/mgcp_client/mgcp_client_test.err
diff --git a/tests/mgcp_client/mgcpgw_client_test.ok b/tests/mgcp_client/mgcp_client_test.ok
similarity index 100%
rename from tests/mgcp_client/mgcpgw_client_test.ok
rename to tests/mgcp_client/mgcp_client_test.ok
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 37347b3..4f4a303 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -14,9 +14,9 @@
 AT_CHECK([$abs_top_builddir/tests/legacy_mgcp/mgcp_transcoding_test], [], [expout], [ignore])
 AT_CLEANUP
 
-AT_SETUP([mgcpgw_client])
-AT_KEYWORDS([mgcpgw_client])
-cat $abs_srcdir/mgcp_client/mgcpgw_client_test.ok > expout
-cat $abs_srcdir/mgcp_client/mgcpgw_client_test.err > experr
-AT_CHECK([$abs_top_builddir/tests/mgcp_client/mgcpgw_client_test], [], [expout], [experr])
+AT_SETUP([mgcp_client])
+AT_KEYWORDS([mgcp_client])
+cat $abs_srcdir/mgcp_client/mgcp_client_test.ok > expout
+cat $abs_srcdir/mgcp_client/mgcp_client_test.err > experr
+AT_CHECK([$abs_top_builddir/tests/mgcp_client/mgcp_client_test], [], [expout], [experr])
 AT_CLEANUP

-- 
To view, visit https://gerrit.osmocom.org/3784
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99f7faab637cfcc22ece64a1dbcbe590f2042187
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list