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.orgNeels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/13116 ) Change subject: make codec_table public as osmo_mgcpc_codec_names ...................................................................... make codec_table public as osmo_mgcpc_codec_names These value_string[]s are also useful for printing chosen codecs in osmo-msc. Change-Id: Ida0e59f9a1f2dd18efea0a51680a67b69f141efa --- M include/osmocom/mgcp_client/mgcp_client.h M src/libosmo-mgcp-client/mgcp_client.c 2 files changed, 10 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified Max: Looks good to me, but someone else must approve Pau Espin Pedrol: Looks good to me, approved Harald Welte: Looks good to me, approved diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h index 98e58d7..e09a446 100644 --- a/include/osmocom/mgcp_client/mgcp_client.h +++ b/include/osmocom/mgcp_client/mgcp_client.h @@ -47,6 +47,10 @@ * this is an internal assumption that is made to avoid lookup tables. * The API-User should not rely on this coincidence! */ +extern const struct value_string osmo_mgcpc_codec_names[]; +static inline const char *osmo_mgcpc_codec_name(enum mgcp_codecs val) +{ return get_value_string(osmo_mgcpc_codec_names, val); } + /*! Structure to build a payload type map to allow the defiition custom payload * types. */ struct ptmap { diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c index 29acd0a..ead3512 100644 --- a/src/libosmo-mgcp-client/mgcp_client.c +++ b/src/libosmo-mgcp-client/mgcp_client.c @@ -37,7 +37,7 @@ #include <string.h> /* Codec descripton for dynamic payload types (SDP) */ -static const struct value_string codec_table[] = { +const struct value_string osmo_mgcpc_codec_names[] = { { CODEC_PCMU_8000_1, "PCMU/8000/1" }, { CODEC_GSM_8000_1, "GSM/8000/1" }, { CODEC_PCMA_8000_1, "PCMA/8000/1" }, @@ -81,12 +81,12 @@ osmo_strlcpy(str_buf, extract_codec_name(str), sizeof(str_buf)); - for (i = 0; i < ARRAY_SIZE(codec_table); i++) { - codec_name = extract_codec_name(codec_table[i].str); + for (i = 0; i < ARRAY_SIZE(osmo_mgcpc_codec_names); i++) { + codec_name = extract_codec_name(osmo_mgcpc_codec_names[i].str); if (!codec_name) continue; if (strcmp(codec_name, str_buf) == 0) - return codec_table[i].value; + return osmo_mgcpc_codec_names[i].value; } return -1; @@ -978,7 +978,7 @@ rc += msgb_printf(msg, " a:"); for (i = 0; i < mgcp_msg->codecs_len; i++) { pt = mgcp_msg->codecs[i]; - codec = get_value_string_or_null(codec_table, pt); + codec = get_value_string_or_null(osmo_mgcpc_codec_names, pt); /* Note: Use codec descriptors from enum mgcp_codecs * in mgcp_client only! */ @@ -1058,7 +1058,7 @@ * require to be explained further via rtpmap. All others * are implcitly definedby the number in m=audio */ if (pt >= 96 && pt <= 127) { - codec = get_value_string_or_null(codec_table, mgcp_msg->codecs[i]); + codec = get_value_string_or_null(osmo_mgcpc_codec_names, mgcp_msg->codecs[i]); /* Note: Use codec descriptors from enum mgcp_codecs * in mgcp_client only! */ -- To view, visit https://gerrit.osmocom.org/13116 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ida0e59f9a1f2dd18efea0a51680a67b69f141efa Gerrit-Change-Number: 13116 Gerrit-PatchSet: 1 Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: dexter <pmaier at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190306/c12b6847/attachment.htm>