From patchwork Mon Mar 14 17:41:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Freyther X-Patchwork-Id: 597170 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 3qP4n22J6pz9sDb for ; Tue, 15 Mar 2016 04:41:42 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 10E831AFE4; Mon, 14 Mar 2016 17:41:41 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from gandharva.secretlabs.de (gandharva.secretlabs.de [5.9.72.18]) by lists.osmocom.org (Postfix) with ESMTP id B45131AFC6 for ; Mon, 14 Mar 2016 17:41:39 +0000 (UTC) Received: from smb-schiphol-06.hotspot.schiphol.nl (unknown [89.248.140.13]) by gandharva.secretlabs.de (Postfix) with ESMTPSA id EBCBB70BD2 for ; Mon, 14 Mar 2016 17:41:38 +0000 (UTC) From: Holger Hans Peter Freyther To: openbsc@lists.osmocom.org Subject: [PATCH 2/3] mgcp: Simplify and shorten routine names Date: Mon, 14 Mar 2016 18:41:38 +0100 Message-Id: <1457977299-66630-2-git-send-email-holger@freyther.de> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1457977299-66630-1-git-send-email-holger@freyther.de> References: <1457977299-66630-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,