From 757f793a9ad0024d0a4498299c489206b1ace49e Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Feb 2024 05:46:46 +0100 Subject: [PATCH] sdp Change-Id: Ia0484192ba318ee712a9910f631c169060dfabd8 --- include/osmocom/msc/codec_filter.h | 12 ++++++------ include/osmocom/msc/csd_filter.h | 8 ++++---- include/osmocom/msc/rtp_stream.h | 2 +- include/osmocom/msc/transaction.h | 4 ++-- src/libmsc/codec_filter.c | 12 ++++++------ src/libmsc/csd_filter.c | 8 ++++---- src/libmsc/gsm_04_08_cc.c | 12 ++++++------ src/libmsc/rtp_stream.c | 2 +- tests/msc_vlr/msc_vlr_test_call.c | 8 ++++---- tests/sdp_msg/sdp_msg_test.c | 10 +++++----- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/include/osmocom/msc/codec_filter.h b/include/osmocom/msc/codec_filter.h index a8be8445e..d409cf8e1 100644 --- a/include/osmocom/msc/codec_filter.h +++ b/include/osmocom/msc/codec_filter.h @@ -47,11 +47,11 @@ struct codec_filter { void codec_filter_set_ran(struct codec_filter *codec_filter, const struct sdp_audio_codecs *codecs); void codec_filter_set_bss(struct codec_filter *codec_filter, const struct gsm0808_speech_codec_list *codec_list_bss_supported); -int codec_filter_run(struct codec_filter *codec_filter, struct sdp_msg *result, const struct sdp_msg *remote); +int codec_filter_run(struct codec_filter *codec_filter, struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote); int codec_filter_to_str_buf(char *buf, size_t buflen, const struct codec_filter *codec_filter, - const struct sdp_msg *result, const struct sdp_msg *remote); -char *codec_filter_to_str_c(void *ctx, const struct codec_filter *codec_filter, const struct sdp_msg *result, - const struct sdp_msg *remote); -const char *codec_filter_to_str(const struct codec_filter *codec_filter, const struct sdp_msg *result, - const struct sdp_msg *remote); + const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote); +char *codec_filter_to_str_c(void *ctx, const struct codec_filter *codec_filter, const struct osmo_sdp_msg *result, + const struct osmo_sdp_msg *remote); +const char *codec_filter_to_str(const struct codec_filter *codec_filter, const struct osmo_sdp_msg *result, + const struct osmo_sdp_msg *remote); diff --git a/include/osmocom/msc/csd_filter.h b/include/osmocom/msc/csd_filter.h index 51ffff706..9803f9d84 100644 --- a/include/osmocom/msc/csd_filter.h +++ b/include/osmocom/msc/csd_filter.h @@ -45,9 +45,9 @@ struct csd_filter { }; void csd_filter_set_ran(struct csd_filter *filter, enum osmo_rat_type ran_type); -int csd_filter_run(struct csd_filter *filter, struct sdp_msg *result, const struct sdp_msg *remote); +int csd_filter_run(struct csd_filter *filter, struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote); int csd_filter_to_str_buf(char *buf, size_t buflen, const struct csd_filter *filter, - const struct sdp_msg *result, const struct sdp_msg *remote); -char *csd_filter_to_str_c(void *ctx, const struct csd_filter *filter, const struct sdp_msg *result, const struct sdp_msg *remote); -const char *csd_filter_to_str(const struct csd_filter *filter, const struct sdp_msg *result, const struct sdp_msg *remote); + const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote); +char *csd_filter_to_str_c(void *ctx, const struct csd_filter *filter, const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote); +const char *csd_filter_to_str(const struct csd_filter *filter, const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote); diff --git a/include/osmocom/msc/rtp_stream.h b/include/osmocom/msc/rtp_stream.h index 5bc01440f..24f2d0d26 100644 --- a/include/osmocom/msc/rtp_stream.h +++ b/include/osmocom/msc/rtp_stream.h @@ -73,7 +73,7 @@ void rtp_stream_set_one_codec(struct rtp_stream *rtps, const struct sdp_audio_co void rtp_stream_set_codecs(struct rtp_stream *rtps, const struct sdp_audio_codecs *codecs); void rtp_stream_set_mode(struct rtp_stream *rtps, enum mgcp_connection_mode mode); void rtp_stream_set_remote_addr(struct rtp_stream *rtps, const struct osmo_sockaddr_str *r); -void rtp_stream_set_remote_addr_and_codecs(struct rtp_stream *rtps, const struct sdp_msg *sdp); +void rtp_stream_set_remote_addr_and_codecs(struct rtp_stream *rtps, const struct osmo_sdp_msg *sdp); void rtp_stream_set_remote_osmux_cid(struct rtp_stream *rtps, uint8_t osmux_cid); int rtp_stream_commit(struct rtp_stream *rtps); diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h index aa529e494..33e435a5d 100644 --- a/include/osmocom/msc/transaction.h +++ b/include/osmocom/msc/transaction.h @@ -131,13 +131,13 @@ struct gsm_trans { bool mncc_initiated; /* Whether an MNCC Release is necessary on failure */ struct osmo_lcls *lcls; /* SDP as last received from the remote call leg. */ - struct sdp_msg remote; + struct osmo_sdp_msg remote; /* Track codec/CSD choices from BSS and remote call leg */ struct codec_filter codecs; struct csd_filter csd; /* Resulting choice from codecs/bearer services and the * local RTP address to be sent to the remote call leg. */ - struct sdp_msg local; + struct osmo_sdp_msg local; } cc; struct { struct gsm411_smc_inst smc_inst; diff --git a/src/libmsc/codec_filter.c b/src/libmsc/codec_filter.c index 7f3fc1fbe..c33f5f77e 100644 --- a/src/libmsc/codec_filter.c +++ b/src/libmsc/codec_filter.c @@ -47,7 +47,7 @@ void codec_filter_set_bss(struct codec_filter *codec_filter, /* Render intersections of all known audio codec constraints to reach a resulting choice of favorite audio codec, plus * possible set of alternative audio codecs, in codec_filter->result. (The result.rtp address remains unchanged.) */ -int codec_filter_run(struct codec_filter *codec_filter, struct sdp_msg *result, const struct sdp_msg *remote) +int codec_filter_run(struct codec_filter *codec_filter, struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote) { struct sdp_audio_codecs *r = &result->audio_codecs; struct sdp_audio_codec *a = &codec_filter->assignment; @@ -76,7 +76,7 @@ int codec_filter_run(struct codec_filter *codec_filter, struct sdp_msg *result, } int codec_filter_to_str_buf(char *buf, size_t buflen, const struct codec_filter *codec_filter, - const struct sdp_msg *result, const struct sdp_msg *remote) + const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote) { struct osmo_strbuf sb = { .buf = buf, .len = buflen }; OSMO_STRBUF_APPEND(sb, sdp_msg_to_str_buf, result); @@ -114,14 +114,14 @@ int codec_filter_to_str_buf(char *buf, size_t buflen, const struct codec_filter return sb.chars_needed; } -char *codec_filter_to_str_c(void *ctx, const struct codec_filter *codec_filter, const struct sdp_msg *result, - const struct sdp_msg *remote) +char *codec_filter_to_str_c(void *ctx, const struct codec_filter *codec_filter, const struct osmo_sdp_msg *result, + const struct osmo_sdp_msg *remote) { OSMO_NAME_C_IMPL(ctx, 128, "codec_filter_to_str_c-ERROR", codec_filter_to_str_buf, codec_filter, result, remote) } -const char *codec_filter_to_str(const struct codec_filter *codec_filter, const struct sdp_msg *result, - const struct sdp_msg *remote) +const char *codec_filter_to_str(const struct codec_filter *codec_filter, const struct osmo_sdp_msg *result, + const struct osmo_sdp_msg *remote) { return codec_filter_to_str_c(OTC_SELECT, codec_filter, result, remote); } diff --git a/src/libmsc/csd_filter.c b/src/libmsc/csd_filter.c index 0f428cffe..6c2757144 100644 --- a/src/libmsc/csd_filter.c +++ b/src/libmsc/csd_filter.c @@ -75,7 +75,7 @@ void csd_filter_set_ran(struct csd_filter *filter, enum osmo_rat_type ran_type) } } -int csd_filter_run(struct csd_filter *filter, struct sdp_msg *result, const struct sdp_msg *remote) +int csd_filter_run(struct csd_filter *filter, struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote) { struct csd_bs_list *r = &result->bearer_services; enum csd_bs a = filter->assignment; @@ -109,7 +109,7 @@ int csd_filter_run(struct csd_filter *filter, struct sdp_msg *result, const stru int csd_filter_to_str_buf(char *buf, size_t buflen, const struct csd_filter *filter, - const struct sdp_msg *result, const struct sdp_msg *remote) + const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote) { struct osmo_strbuf sb = { .buf = buf, .len = buflen }; OSMO_STRBUF_APPEND(sb, sdp_msg_to_str_buf, result); @@ -146,12 +146,12 @@ int csd_filter_to_str_buf(char *buf, size_t buflen, const struct csd_filter *fil return sb.chars_needed; } -char *csd_filter_to_str_c(void *ctx, const struct csd_filter *filter, const struct sdp_msg *result, const struct sdp_msg *remote) +char *csd_filter_to_str_c(void *ctx, const struct csd_filter *filter, const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote) { OSMO_NAME_C_IMPL(ctx, 128, "csd_filter_to_str_c-ERROR", csd_filter_to_str_buf, filter, result, remote) } -const char *csd_filter_to_str(const struct csd_filter *filter, const struct sdp_msg *result, const struct sdp_msg *remote) +const char *csd_filter_to_str(const struct csd_filter *filter, const struct osmo_sdp_msg *result, const struct osmo_sdp_msg *remote) { return csd_filter_to_str_c(OTC_SELECT, filter, result, remote); } diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index 2fee94673..49a583f3d 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -240,7 +240,7 @@ static void _log_mncc_rx_tx(const char *file, int line, struct gsm_trans *trans, const char *rx_tx, const union mncc_msg *mncc) { const char *sdp = NULL; - struct sdp_msg sdp_msg = {}; + struct osmo_sdp_msg sdp_msg = {}; struct osmo_sockaddr addr = {}; if (!log_check_level(DMNCC, LOGL_DEBUG)) @@ -723,7 +723,7 @@ void gsm48_cc_rx_setup_cn_local_rtp_port_known(struct gsm_trans *trans) struct msc_a *msc_a = trans->msc_a; struct gsm_mncc setup = trans->cc.msg; struct osmo_sockaddr_str *rtp_cn_local; - struct sdp_msg *sdp; + struct osmo_sdp_msg *sdp; int rc; if (trans->cc.state != GSM_CSTATE_INITIATED @@ -797,7 +797,7 @@ static void rx_mncc_sdp(struct gsm_trans *trans, uint32_t mncc_msg_type, const c /* if there is no SDP information or we failed to parse it, try using the Bearer Cap from MNCC, if any. */ if (!trans->cc.remote.audio_codecs.count && bcap) { - trans->cc.remote = (struct sdp_msg){}; + trans->cc.remote = (struct osmo_sdp_msg){}; trans_cc_set_remote_from_bc(trans, bcap); LOG_TRANS_CAT(trans, DMNCC, LOGL_DEBUG, "rx %s Bearer Cap: remote=%s\n", get_mncc_name(mncc_msg_type), sdp_msg_to_str(&trans->cc.remote)); @@ -908,7 +908,7 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg) case GSM48_BCAP_ITCAP_FAX_G3: case GSM48_BCAP_ITCAP_UNR_DIG_INF: if (setup->fields & MNCC_F_BEARER_CAP) { - trans->cc.remote = (struct sdp_msg){}; + trans->cc.remote = (struct osmo_sdp_msg){}; trans_cc_set_remote_from_bc(trans, &setup->bearer_cap); LOG_TRANS_CAT(trans, DMNCC, LOGL_DEBUG, "rx %s Bearer Cap: remote=%s\n", get_mncc_name(setup->msg_type), sdp_msg_to_str(&trans->cc.remote)); @@ -1087,7 +1087,7 @@ static int gsm48_cc_rx_call_conf(struct gsm_trans *trans, struct msgb *msg) static int mncc_recv_rtp(struct gsm_network *net, struct gsm_trans *trans, uint32_t callref, int cmd, struct osmo_sockaddr_str *rtp_addr, uint32_t payload_type, - uint32_t payload_msg_type, const struct sdp_msg *sdp); + uint32_t payload_msg_type, const struct osmo_sdp_msg *sdp); static int gsm48_cc_mt_rtp_port_and_codec_known(struct gsm_trans *trans) { @@ -2042,7 +2042,7 @@ static int gsm48_cc_rx_userinfo(struct gsm_trans *trans, struct msgb *msg) static int mncc_recv_rtp(struct gsm_network *net, struct gsm_trans *trans, uint32_t callref, int cmd, struct osmo_sockaddr_str *rtp_addr, uint32_t payload_type, - uint32_t payload_msg_type, const struct sdp_msg *sdp) + uint32_t payload_msg_type, const struct osmo_sdp_msg *sdp) { uint8_t data[sizeof(struct gsm_mncc)]; struct gsm_mncc_rtp *rtp; diff --git a/src/libmsc/rtp_stream.c b/src/libmsc/rtp_stream.c index 29ca72915..b13a45dff 100644 --- a/src/libmsc/rtp_stream.c +++ b/src/libmsc/rtp_stream.c @@ -478,7 +478,7 @@ void rtp_stream_set_remote_addr(struct rtp_stream *rtps, const struct osmo_socka rtp_stream_update_id(rtps); } -void rtp_stream_set_remote_addr_and_codecs(struct rtp_stream *rtps, const struct sdp_msg *sdp) +void rtp_stream_set_remote_addr_and_codecs(struct rtp_stream *rtps, const struct osmo_sdp_msg *sdp) { rtp_stream_set_codecs(rtps, &sdp->audio_codecs); if (osmo_sockaddr_str_is_nonzero(&sdp->rtp)) diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c index 9b7755ce9..7df718aab 100644 --- a/tests/msc_vlr/msc_vlr_test_call.c +++ b/tests/msc_vlr/msc_vlr_test_call.c @@ -1329,7 +1329,7 @@ static bool validate_sdp(const char *func, const char *desc, { const char * const *expect_pos; struct sdp_audio_codec *codec; - struct sdp_msg sdp; + struct osmo_sdp_msg sdp; if (sdp_msg_from_sdp_str(&sdp, sdp_str)) { BTW("%s: %s: ERROR: failed to parse SDP\n%s", func, desc, sdp_str); return false; @@ -1427,10 +1427,10 @@ static bool validate_perm_speech(const char *func, const char *desc, /* Compose a valid SDP string from the list of codec subtype names given. If a subtype name includes a payload type * number ("AMR#96") then use that PT number in the SDP instead of the default from codec_mapping.c. */ -static struct sdp_msg *sdp_from_codec_strs(const char *const *codec_strs) +static struct osmo_sdp_msg *sdp_from_codec_strs(const char *const *codec_strs) { - static struct sdp_msg sdp; - sdp = (struct sdp_msg){}; + static struct osmo_sdp_msg sdp; + sdp = (struct osmo_sdp_msg){}; const char *const *codec_str; osmo_sockaddr_str_from_str(&sdp.rtp, "1.2.3.4", 56); for (codec_str = codec_strs; *codec_str; codec_str++) { diff --git a/tests/sdp_msg/sdp_msg_test.c b/tests/sdp_msg/sdp_msg_test.c index 4798ae007..face56c78 100644 --- a/tests/sdp_msg/sdp_msg_test.c +++ b/tests/sdp_msg/sdp_msg_test.c @@ -131,7 +131,7 @@ void test_parse_and_compose() for (i = 0; i < ARRAY_SIZE(sdp_tests); i++) { struct sdp_test_data *t = &sdp_tests[i]; - struct sdp_msg sdp = {}; + struct osmo_sdp_msg sdp = {}; char str[1024]; printf("\n[%d]\n", i); dump_sdp(t->sdp_input, "sdp input: "); @@ -343,7 +343,7 @@ struct sdp_intersect_test_data sdp_intersect_tests[] = { } }; -const char *sdp_msg_logstr(const struct sdp_msg *sdp) +const char *sdp_msg_logstr(const struct osmo_sdp_msg *sdp) { static char buf[1024]; sdp_msg_to_sdp_str_buf(buf, sizeof(buf), sdp); @@ -360,8 +360,8 @@ static void test_intersect() for (i = 0; i < ARRAY_SIZE(sdp_intersect_tests); i++) { struct sdp_intersect_test_data *t = &sdp_intersect_tests[i]; - struct sdp_msg sdp_a = {}; - struct sdp_msg sdp_b = {}; + struct osmo_sdp_msg sdp_a = {}; + struct osmo_sdp_msg sdp_b = {}; char str[1024]; printf("\n[%d] %s\n", i, t->descr); dump_sdp(t->sdp_a, "SDP A: "); @@ -523,7 +523,7 @@ static void test_select() for (i = 0; i < ARRAY_SIZE(sdp_select_tests); i++) { struct sdp_select_test_data *t = &sdp_select_tests[i]; - struct sdp_msg sdp = {}; + struct osmo_sdp_msg sdp = {}; struct sdp_audio_codec *codec; char buf[1024]; const char *expect_sdp;