[PATCH] osmo-mgw[master]: prune public mgcpgw_client api

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
Wed Aug 30 12:27:39 UTC 2017


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

prune public mgcpgw_client api

Slim down the public mgcpgw_client API, move all elements not actually used by
current callers to private headers / static c.

Change-Id: Ic9199c87c4ac6d249fd210579a877d5404ed8514
---
M include/osmocom/legacy_mgcp/Makefile.am
M include/osmocom/legacy_mgcp/mgcpgw_client.h
A include/osmocom/legacy_mgcp/mgcpgw_client_internal.h
M src/libosmo-legacy-mgcp/mgcpgw_client.c
M tests/legacy_mgcp/mgcpgw_client_test.c
5 files changed, 36 insertions(+), 50 deletions(-)


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

diff --git a/include/osmocom/legacy_mgcp/Makefile.am b/include/osmocom/legacy_mgcp/Makefile.am
index 4a9550c..52f0b5b 100644
--- a/include/osmocom/legacy_mgcp/Makefile.am
+++ b/include/osmocom/legacy_mgcp/Makefile.am
@@ -1,4 +1,5 @@
 noinst_HEADERS = \
+	mgcpgw_client_internal.h \
 	mgcp_transcode.h \
 	vty.h \
 	$(NULL)
diff --git a/include/osmocom/legacy_mgcp/mgcpgw_client.h b/include/osmocom/legacy_mgcp/mgcpgw_client.h
index 9e7a529..c8d92e9 100644
--- a/include/osmocom/legacy_mgcp/mgcpgw_client.h
+++ b/include/osmocom/legacy_mgcp/mgcpgw_client.h
@@ -59,8 +59,6 @@
 
 enum mgcp_connection_mode;
 
-int mgcp_response_parse_params(struct mgcp_response *r);
-
 struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
 			   uint16_t rtp_endpoint, unsigned int call_id,
 			   enum mgcp_connection_mode mode);
@@ -71,10 +69,3 @@
 
 struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
 			   unsigned int call_id);
-
-struct mgcp_response_pending * mgcpgw_client_pending_add(
-					struct mgcpgw_client *mgcp,
-					mgcp_trans_id_t trans_id,
-					mgcp_response_cb_t response_cb,
-					void *priv);
-int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg);
diff --git a/include/osmocom/legacy_mgcp/mgcpgw_client_internal.h b/include/osmocom/legacy_mgcp/mgcpgw_client_internal.h
new file mode 100644
index 0000000..d3a7849
--- /dev/null
+++ b/include/osmocom/legacy_mgcp/mgcpgw_client_internal.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#define MSGB_CB_MGCP_TRANS_ID 0
+
+struct mgcpgw_client {
+	struct mgcpgw_client_conf actual;
+	uint32_t remote_addr;
+	struct osmo_wqueue wq;
+	mgcp_trans_id_t next_trans_id;
+	struct llist_head responses_pending;
+	struct llist_head inuse_endpoints;
+};
+
+struct mgcp_inuse_endpoint {
+	struct llist_head entry;
+	uint16_t id;
+};
+
+struct mgcp_response_pending {
+	struct llist_head entry;
+
+	mgcp_trans_id_t trans_id;
+	mgcp_response_cb_t response_cb;
+	void *priv;
+};
+
+int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg);
+
+struct mgcp_response_pending * mgcpgw_client_pending_add(
+					struct mgcpgw_client *mgcp,
+					mgcp_trans_id_t trans_id,
+					mgcp_response_cb_t response_cb,
+					void *priv);
diff --git a/src/libosmo-legacy-mgcp/mgcpgw_client.c b/src/libosmo-legacy-mgcp/mgcpgw_client.c
index 2a7ae97..2064355 100644
--- a/src/libosmo-legacy-mgcp/mgcpgw_client.c
+++ b/src/libosmo-legacy-mgcp/mgcpgw_client.c
@@ -27,6 +27,7 @@
 #include <osmocom/legacy_mgcp/mgcpgw_client.h>
 #include <osmocom/legacy_mgcp/mgcp.h>
 #include <osmocom/legacy_mgcp/mgcp_internal.h>
+#include <osmocom/legacy_mgcp/mgcpgw_client_internal.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -34,47 +35,6 @@
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
-
-/* When changed, also remember to update the unit test */
-#define MSGB_CB_MGCP_TRANS_ID 0
-
-typedef unsigned int mgcp_trans_id_t;
-
-struct mgcpgw_client {
-	struct mgcpgw_client_conf actual;
-	uint32_t remote_addr;
-	struct osmo_wqueue wq;
-	mgcp_trans_id_t next_trans_id;
-	struct llist_head responses_pending;
-	struct llist_head inuse_endpoints;
-};
-
-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;
-};
-
-struct mgcp_inuse_endpoint {
-	struct llist_head entry;
-	uint16_t id;
-};
-
-struct mgcp_response_pending {
-	struct llist_head entry;
-
-	mgcp_trans_id_t trans_id;
-	mgcp_response_cb_t response_cb;
-	void *priv;
-};
-
-
 
 void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf)
 {
diff --git a/tests/legacy_mgcp/mgcpgw_client_test.c b/tests/legacy_mgcp/mgcpgw_client_test.c
index 4a0ee66..51d5272 100644
--- a/tests/legacy_mgcp/mgcpgw_client_test.c
+++ b/tests/legacy_mgcp/mgcpgw_client_test.c
@@ -24,6 +24,7 @@
 #include <osmocom/core/application.h>
 #include <osmocom/legacy_mgcp/mgcp.h>
 #include <osmocom/legacy_mgcp/mgcpgw_client.h>
+#include <osmocom/legacy_mgcp/mgcpgw_client_internal.h>
 
 void *ctx;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9199c87c4ac6d249fd210579a877d5404ed8514
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