From patchwork Tue Mar 8 17:35:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Freyther X-Patchwork-Id: 594286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 9AFE714031D for ; Wed, 9 Mar 2016 04:35:33 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 670C1192A2; Tue, 8 Mar 2016 17:35:32 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from gandharva.secretlabs.de (gandharva.secretlabs.de [IPv6:2a01:4f8:161:8201::2:4]) by lists.osmocom.org (Postfix) with ESMTP id 2DF931926C for ; Tue, 8 Mar 2016 17:35:30 +0000 (UTC) Received: from localhost.localdomain (ip5b41fb99.dynamic.kabel-deutschland.de [91.65.251.153]) by gandharva.secretlabs.de (Postfix) with ESMTPSA id B82666B356 for ; Tue, 8 Mar 2016 17:35:29 +0000 (UTC) From: Holger Hans Peter Freyther To: openbsc@lists.osmocom.org Subject: [PATCH 2/3] mgcp: Simplify and shorten routine names Date: Tue, 8 Mar 2016 18:35:19 +0100 Message-Id: <1457458520-34314-2-git-send-email-holger@freyther.de> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1457458520-34314-1-git-send-email-holger@freyther.de> References: <1457458520-34314-1-git-send-email-holger@freyther.de> X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Holger Hans Peter Freyther 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 --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 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,