diff mbox

[2/3] mgcp: Simplify and shorten routine names

Message ID 1457458520-34314-2-git-send-email-holger@freyther.de
State New
Headers show

Commit Message

Holger Freyther March 8, 2016, 5:35 p.m. UTC
From: Holger Hans Peter Freyther <holger@moiji-mobile.com>

Now they are included in a struct we can just call them setup, process
and get_net_downlink_format to manage the lifetime.
---
 openbsc/include/openbsc/mgcp_internal.h    |  6 +++---
 openbsc/src/libmgcp/mgcp_network.c         |  2 +-
 openbsc/src/libmgcp/mgcp_protocol.c        | 16 ++++++++--------
 openbsc/src/libmgcp/mgcp_transcode.c       | 10 +++++-----
 openbsc/tests/mgcp/mgcp_transcoding_test.c |  6 +++---
 5 files changed, 20 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index a62dbb2..8fb8a45 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -154,9 +154,9 @@  enum mgcp_type {
  * Function pointers for RTP processing/transcoding
  */
 struct mgcp_transcoding {
-	mgcp_processing processing_cb;
-	mgcp_processing_setup setup_processing_cb;
-	mgcp_get_format get_net_downlink_format_cb;
+	mgcp_processing process;
+	mgcp_processing_setup setup;
+	mgcp_get_format get_net_downlink_format;
 };
 
 extern const struct mgcp_transcoding *mgcp_default_transcoder;
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index e4f5f7d..ed90d34 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -614,7 +614,7 @@  int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp,
 		int nbytes = 0;
 		int len = rc;
 		do {
-			cont = trans->processing_cb(endp, rtp_end,
+			cont = trans->process(endp, rtp_end,
 							buf, &len, RTP_BUF_SIZE);
 			if (cont < 0)
 				break;
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 8017fe8..18a25bc 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -67,9 +67,9 @@  static int setup_rtp_processing(struct mgcp_endpoint *endp);
 static int mgcp_analyze_header(struct mgcp_parse_data *parse, char *data);
 
 static const struct mgcp_transcoding no_transcoder = {
-	.processing_cb = &mgcp_rtp_processing_default,
-	.setup_processing_cb = &mgcp_setup_rtp_processing_default,
-	.get_net_downlink_format_cb = &mgcp_get_net_downlink_format_default,
+	.process = &mgcp_rtp_processing_default,
+	.setup = &mgcp_setup_rtp_processing_default,
+	.get_net_downlink_format = &mgcp_get_net_downlink_format_default,
 };
 
 const struct mgcp_transcoding *mgcp_default_transcoder = &no_transcoder;
@@ -213,7 +213,7 @@  static int write_response_sdp(struct mgcp_endpoint *endp,
 	int nchars;
 
 	trans = endp->tcfg->transcoder;
-	trans->get_net_downlink_format_cb(endp, &payload_type,
+	trans->get_net_downlink_format(endp, &payload_type,
 					      &audio_name, &fmtp_extra);
 
 	len = snprintf(sdp_record, size,
@@ -1475,14 +1475,14 @@  static int setup_rtp_processing(struct mgcp_endpoint *endp)
 		return 0;
 
 	if (endp->conn_mode & MGCP_CONN_SEND_ONLY)
-		rc |= trans->setup_processing_cb(endp, &endp->net_end, &endp->bts_end);
+		rc |= trans->setup(endp, &endp->net_end, &endp->bts_end);
 	else
-		rc |= trans->setup_processing_cb(endp, &endp->net_end, NULL);
+		rc |= trans->setup(endp, &endp->net_end, NULL);
 
 	if (endp->conn_mode & MGCP_CONN_RECV_ONLY)
-		rc |= trans->setup_processing_cb(endp, &endp->bts_end, &endp->net_end);
+		rc |= trans->setup(endp, &endp->bts_end, &endp->net_end);
 	else
-		rc |= trans->setup_processing_cb(endp, &endp->bts_end, NULL);
+		rc |= trans->setup(endp, &endp->bts_end, NULL);
 	return rc;
 }
 
diff --git a/openbsc/src/libmgcp/mgcp_transcode.c b/openbsc/src/libmgcp/mgcp_transcode.c
index aaa8863..6407cfb 100644
--- a/openbsc/src/libmgcp/mgcp_transcode.c
+++ b/openbsc/src/libmgcp/mgcp_transcode.c
@@ -33,9 +33,9 @@ 
 #include <osmocom/netif/rtp.h>
 
 const struct mgcp_transcoding mgcp_sw_transcoder = {
-	.processing_cb = mgcp_transcoding_process_rtp,
-	.setup_processing_cb = mgcp_transcoding_setup,
-	.get_net_downlink_format_cb = mgcp_transcoding_net_downlink_format,
+	.process = mgcp_transcoding_process_rtp,
+	.setup = mgcp_transcoding_setup,
+	.get_net_downlink_format = mgcp_transcoding_net_downlink_format,
 };
 
 int mgcp_transcoding_get_frame_size(void *state_, int nsamples, int dst)
@@ -480,8 +480,8 @@  struct mgcp_process_rtp_state *check_transcode_state(
 		struct mgcp_rtp_codec tmp_codec = src_end->alt_codec;
 		src_end->alt_codec = src_end->codec;
 		src_end->codec = tmp_codec;
-		trans->setup_processing_cb(endp, &endp->net_end, &endp->bts_end);
-		trans->setup_processing_cb(endp, &endp->bts_end, &endp->net_end);
+		trans->setup(endp, &endp->net_end, &endp->bts_end);
+		trans->setup(endp, &endp->bts_end, &endp->net_end);
 	}
 
 done:
diff --git a/openbsc/tests/mgcp/mgcp_transcoding_test.c b/openbsc/tests/mgcp/mgcp_transcoding_test.c
index 72c75eb..02f2817 100644
--- a/openbsc/tests/mgcp/mgcp_transcoding_test.c
+++ b/openbsc/tests/mgcp/mgcp_transcoding_test.c
@@ -162,9 +162,9 @@  static int audio_name_to_type(const char *name)
 int mgcp_get_trans_frame_size(void *state_, int nsamples, int dst);
 
 static const struct mgcp_transcoding test_transcoder = {
-	.setup_processing_cb = mgcp_transcoding_setup,
-	.processing_cb = mgcp_transcoding_process_rtp,
-	.get_net_downlink_format_cb = mgcp_transcoding_net_downlink_format,
+	.setup = mgcp_transcoding_setup,
+	.process = mgcp_transcoding_process_rtp,
+	.get_net_downlink_format = mgcp_transcoding_net_downlink_format,
 };
 
 static int given_configured_endpoint(int in_samples, int out_samples,