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/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgHello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/4386 to look at the new patch set (#2). osmux_snprintf: Support different types of Osmux frames Previous implementation handled all types as if they were Osmux AMR frames. For Dummy frames, we account the padding but we don't care about the padding content. For Signalling ones, as they are not in the specification yet, it is better avoid using unespecified fields and return an error because it's still not known how extra data will be handled in the input msgb. Change-Id: I48565472b47c2a0e5db50881fbb005537af8c70d --- M src/osmux.c 1 file changed, 35 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/86/4386/2 diff --git a/src/osmux.c b/src/osmux.c index cad4c5d..0027a51 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -921,30 +921,44 @@ msg_off += sizeof(struct osmux_hdr); msg_len -= sizeof(struct osmux_hdr); - if (!osmo_amr_ft_valid(osmuxh->amr_ft)) { - LOGP(DLMIB, LOGL_ERROR, "Bad AMR FT %d, skipping\n", - osmuxh->amr_ft); + switch (osmuxh->ft) { + case OSMUX_FT_SIGNAL: + ret = snprintf(buf + offset, remain, "[signal]"); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); + return -1; + case OSMUX_FT_DUMMY: + case OSMUX_FT_VOICE_AMR: + if (!osmo_amr_ft_valid(osmuxh->amr_ft)) { + LOGP(DLMIB, LOGL_ERROR, "Bad AMR FT %d, skipping\n", + osmuxh->amr_ft); + return -1; + } + + payload_len = osmux_get_payload_len(osmuxh); + + if (msg_len < payload_len) { + LOGP(DLMIB, LOGL_ERROR, + "No room for OSMUX payload: only %d bytes\n", + msg_len); + return -1; + } + + if (osmuxh->ft == OSMUX_FT_VOICE_AMR) { + ret = osmux_snprintf_payload(buf + offset, remain, + osmux_get_payload(osmuxh), + payload_len); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); + } + + msg_off += payload_len; + msg_len -= payload_len; + break; + default: + LOGP(DLMIB, LOGL_ERROR, "Unknown OSMUX ft value %d\n", + osmuxh->ft); return -1; } - - payload_len = osmux_get_payload_len(osmuxh); - - if (msg_len < payload_len) { - LOGP(DLMIB, LOGL_ERROR, - "No room for OSMUX payload: only %d bytes\n", - msg_len); - return -1; - } - - ret = osmux_snprintf_payload(buf + offset, remain, - osmux_get_payload(osmuxh), - payload_len); - SNPRINTF_BUFFER_SIZE(ret, remain, offset); - - msg_off += payload_len; - msg_len -= payload_len; } - return offset; } -- To view, visit https://gerrit.osmocom.org/4386 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I48565472b47c2a0e5db50881fbb005537af8c70d Gerrit-PatchSet: 2 Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>