lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

December 2022

  • 1 participants
  • 1979 discussions
Change in libosmo-netif[master]: amr: osmo_amr_bwe_to_oa(): validate input data is long enough
by fixeria 21 Dec '22

21 Dec '22
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30756 ) Change subject: amr: osmo_amr_bwe_to_oa(): validate input data is long enough ...................................................................... Patch Set 1: (1 comment) File src/amr.c: https://gerrit.osmocom.org/c/libosmo-netif/+/30756/comment/25e65c33_626ecc25 PS1, Line 224: 10 Can you please explain where 10 comes from? BTW, we have OSMO_BYTES_FOR_BITS in <osmocom/core/utils.h>. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30756 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I2d11ce71c29ae046c2feab1e59045d97dc3e5099 Gerrit-Change-Number: 30756 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Dec 2022 19:22:08 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-netif[master]: amr: use struct bwe_hdr in osmo_amr_bwe_to_oa()
by fixeria 21 Dec '22

21 Dec '22
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30755 ) Change subject: amr: use struct bwe_hdr in osmo_amr_bwe_to_oa() ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30755 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I5042dc628ac70eca62b4980f4acae991dd976528 Gerrit-Change-Number: 30755 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Dec 2022 19:19:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-netif[master]: amr: constify input buffer in osmo_amr_is_oa()
by fixeria 21 Dec '22

21 Dec '22
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30754 ) Change subject: amr: constify input buffer in osmo_amr_is_oa() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30754 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I72ef6fc700f628ea158ea888a5f1e9dc8776ab7e Gerrit-Change-Number: 30754 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Dec 2022 19:15:40 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-netif[master]: amr: Add missing header stdbool.h
by fixeria 21 Dec '22

21 Dec '22
Attention is currently required from: osmith, laforge, pespin, daniel, dexter. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30753 ) Change subject: amr: Add missing header stdbool.h ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30753 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I84e447960c4912147d2f3a6170393370d354625b Gerrit-Change-Number: 30753 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Dec 2022 19:15:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-netif[master]: Introduce utils/osmo-amr-inspect program
by pespin 21 Dec '22

21 Dec '22
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/30757 to look at the new patch set (#2). Change subject: Introduce utils/osmo-amr-inspect program ...................................................................... Introduce utils/osmo-amr-inspect program This program allows inspecting a list of AMR PDUs in hexstring format present in a text file. This allows easily finding out the properties of the PDU as well as finding potential errors on the data. It also allows forcing decode in different formats (octet-aligned, bandwidth-efficient) in order to detect which may be the correct one. Related: SYS#6161 Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 --- M Makefile.am M configure.ac M contrib/libosmo-netif.spec.in A utils/Makefile.am A utils/osmo-amr-inspect.c 5 files changed, 306 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/57/30757/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30757 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 Gerrit-Change-Number: 30757 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in libosmo-netif[master]: Introduce utils/osmo-amr-inspect program
by Jenkins Builder 21 Dec '22

21 Dec '22
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30757 ) Change subject: Introduce utils/osmo-amr-inspect program ...................................................................... Patch Set 1: (5 comments) File utils/osmo-amr-inspect.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2189): https://gerrit.osmocom.org/c/libosmo-netif/+/30757/comment/cb50c224_fbaa1efb PS1, Line 69: printf( " Payload (%lu bytes): %s\n", space prohibited after that open parenthesis '(' Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2189): https://gerrit.osmocom.org/c/libosmo-netif/+/30757/comment/966bba87_5c04e864 PS1, Line 113: printf( " Payload continuation (%lu bytes): %s\n", buf_len - sizeof(*hdr), space prohibited after that open parenthesis '(' Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2189): https://gerrit.osmocom.org/c/libosmo-netif/+/30757/comment/52d8a7c3_152dd0de PS1, Line 145: printf( " Payload (octet-aligned %d bytes): %s", rc, space prohibited after that open parenthesis '(' Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2189): https://gerrit.osmocom.org/c/libosmo-netif/+/30757/comment/3b28a4dd_efef5b14 PS1, Line 187: FILE * fp; "foo * bar" should be "foo *bar" Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2189): https://gerrit.osmocom.org/c/libosmo-netif/+/30757/comment/4d51bdc6_064f8820 PS1, Line 188: char * line = NULL; "foo * bar" should be "foo *bar" -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30757 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 Gerrit-Change-Number: 30757 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Wed, 21 Dec 2022 19:03:33 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-netif[master]: amr: osmo_amr_bwe_to_oa(): validate input data is long enough
by pespin 21 Dec '22

21 Dec '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30756 ) Change subject: amr: osmo_amr_bwe_to_oa(): validate input data is long enough ...................................................................... amr: osmo_amr_bwe_to_oa(): validate input data is long enough Change-Id: I2d11ce71c29ae046c2feab1e59045d97dc3e5099 --- M src/amr.c 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/56/30756/1 diff --git a/src/amr.c b/src/amr.c index e4f0dd8..19557b3 100644 --- a/src/amr.c +++ b/src/amr.c @@ -221,6 +221,8 @@ ft = (bwe_hdr->ft_hi << 1) | bwe_hdr->ft_lo; if (!osmo_amr_ft_valid(ft)) return -1; + if ((10 + osmo_amr_bits(ft) + 7)/8 > payload_len) + return -1; memset(buf, 0, sizeof(buf)); oa_hdr = (struct amr_hdr *)buf; -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30756 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I2d11ce71c29ae046c2feab1e59045d97dc3e5099 Gerrit-Change-Number: 30756 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: Introduce utils/osmo-amr-inspect program
by pespin 21 Dec '22

21 Dec '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30757 ) Change subject: Introduce utils/osmo-amr-inspect program ...................................................................... Introduce utils/osmo-amr-inspect program This program allows inspecting a list of AMR PDUs in hexstring format present in a text file. This allows easily finding out the properties of the PDU as well as finding potential errors on the data. It also allows forcing decode in different formats (octet-aligned, bandwidth-efficient) in order to detect which may be the correct one. Related: SYS#6161 Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 --- M Makefile.am M configure.ac A utils/Makefile.am A utils/osmo-amr-inspect.c 4 files changed, 305 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/57/30757/1 diff --git a/Makefile.am b/Makefile.am index 55a650a..0497895 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include src examples tests +SUBDIRS = include src examples utils tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-netif.pc diff --git a/configure.ac b/configure.ac index 5bb0b5c..06eaf6c 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0) +PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 1.7.0) AC_ARG_ENABLE([lapd_examples], [AS_HELP_STRING( @@ -144,6 +145,7 @@ include/osmocom/netif/Makefile src/Makefile examples/Makefile + utils/Makefile tests/Makefile Doxyfile Makefile diff --git a/utils/Makefile.am b/utils/Makefile.am new file mode 100644 index 0000000..5640190 --- /dev/null +++ b/utils/Makefile.am @@ -0,0 +1,19 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOCODEC_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(TALLOC_CFLAGS) \ + $(NULL) + +LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOCODEC_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(top_builddir)/src/libosmonetif.la \ + $(NULL) + +noinst_PROGRAMS = osmo-amr-inspect + +osmo_amr_inspect_SOURCES = osmo-amr-inspect.c diff --git a/utils/osmo-amr-inspect.c b/utils/osmo-amr-inspect.c new file mode 100644 index 0000000..344c9be --- /dev/null +++ b/utils/osmo-amr-inspect.c @@ -0,0 +1,283 @@ +/*! \file osmo-arfcn.c + * Utility program for ARFCN / frequency calculations. */ +/* + * (C) 2011 by Harald Welte <laforge(a)gnumonks.org> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <stdio.h> +#include <getopt.h> +#include <errno.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <strings.h> + +#include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> +#include <osmocom/codec/codec.h> +#include <osmocom/netif/amr.h> + +enum force_amr_input_fmt { + FORCE_AMR_INPUT_FMT_AUTO = 0, + FORCE_AMR_INPUT_FMT_OA, + FORCE_AMR_INPUT_FMT_BWE, + FORCE_AMR_INPUT_FMT_ALL, +}; + +enum force_amr_input_fmt force_fmt = FORCE_AMR_INPUT_FMT_AUTO; + +static void help(const char *progname) +{ + printf("Usage: %s [-h] [-i filename] [-F (auto|oa|bwe|all)]\n", + progname); +} + +#define print_color(color, fmt, args ...) \ + printf(color fmt OSMO_LOGCOLOR_END, ## args) + +#define print_red(fmt, args ...) \ + print_color(OSMO_LOGCOLOR_RED, fmt OSMO_LOGCOLOR_END, ## args) + +#define print_orange(fmt, args ...) \ + print_color(OSMO_LOGCOLOR_YELLOW, fmt OSMO_LOGCOLOR_END, ## args) + +static void inspect_amr_oa(const uint8_t *buf, size_t buf_len) +{ + const struct amr_hdr *hdr = (const struct amr_hdr *)buf; + size_t payload_len = buf_len - sizeof(*hdr); + const uint8_t *payload = hdr->data; + size_t ft_bytes, ft_bits; + printf(" octet-aligned\n"); + printf(" CMR: %u\n", hdr->cmr); + printf(" F: %u\n", hdr->f); + printf(" FT: %u (%s)\n", hdr->ft, osmo_amr_type_name(hdr->ft)); + printf(" Q: %u\n", hdr->q); + printf( " Payload (%lu bytes): %s\n", + buf_len - sizeof(*hdr), osmo_hexdump_nospc(payload, payload_len)); + + if (hdr->f) + print_orange(" WARN: F=%u not supported!\n", hdr->f); + if (!osmo_amr_ft_valid(hdr->cmr)) + print_red(" ERROR: CMR=%u not valid!\n", hdr->cmr); + if (!osmo_amr_ft_valid(hdr->ft)) + print_red(" ERROR: FT=%u not valid!\n", hdr->ft); + if (hdr->pad1 != 0) + print_orange(" WARN: PAD1=0x%x not zero!\n", hdr->pad1); + if (hdr->pad2 != 0) + print_orange(" WARN: PAD2=0x%x not zero!\n", hdr->pad2); + ft_bytes = osmo_amr_bytes(hdr->ft); + if (payload_len != ft_bytes) { + print_red(" ERROR: Wrong payload byte-length %lu != exp %lu!\n", payload_len, ft_bytes); + } else { + ft_bits = osmo_amr_bits(hdr->ft); + if (ft_bits/8 == ft_bytes) { + printf(" Payload has no padding (%lu bits)\n", ft_bits); + } else { + uint8_t last_byte = payload[payload_len - 1]; + uint8_t padding = last_byte & (0xff >> (ft_bits & 3)); + if (padding) + print_orange(" WARN: Payload last byte = 0x%02x has PAD=0x%02x not zero!\n", last_byte, padding); + } + } +} + +static void inspect_amr_bwe(const uint8_t *buf, size_t buf_len) +{ + const struct amr_hdr_bwe *hdr = (const struct amr_hdr_bwe *)buf; + size_t payload_len_bits = 6 + (buf_len - sizeof(*hdr))*8; + size_t ft_bits; + int rc; + uint8_t buf_oa[buf_len + 1]; + uint8_t ft = (hdr->ft_hi << 1) | hdr->ft_lo; + + printf(" bandwith-efficient\n"); + printf(" CMR: %u\n", hdr->cmr); + printf(" F: %u\n", hdr->f); + printf(" FT: %u (%s)\n", ft, osmo_amr_type_name(ft)); + printf(" Q: %u\n", hdr->q); + printf(" Payload first 6 bits: 0x%02x\n", hdr->data_start); + printf( " Payload continuation (%lu bytes): %s\n", buf_len - sizeof(*hdr), + osmo_hexdump_nospc(buf + sizeof(*hdr), buf_len - sizeof(*hdr))); + + if (hdr->f) + print_orange(" WARN: F=%u not supported!\n", hdr->f); + if (!osmo_amr_ft_valid(hdr->cmr)) + print_red(" ERROR: CMR=%u not valid!\n", hdr->cmr); + if (!osmo_amr_ft_valid(ft)) { + print_red(" ERROR: FT=%u not valid!\n", ft); + return; + } + ft_bits = osmo_amr_bits(ft); + if (ft_bits != payload_len_bits) { + print_red(" ERROR: Wrong payload bits-length %lu != exp %lu! (FT=%u)\n", payload_len_bits, ft_bits, ft); + return; + } + + if (!((10 + ft_bits) & 0x03)) { + printf(" Payload has no padding (%lu bits with offset 10)\n", ft_bits); + } else { + uint8_t last_byte = buf[buf_len - 1]; + uint8_t padding = last_byte & (0xff >> ((10 + ft_bits) & 0x03)); + if (padding) + print_orange(" WARN: Payload last byte = 0x%02x has PAD=0x%02x not zero!\n", last_byte, padding); + } + + memcpy(buf_oa, buf, buf_len); + rc = osmo_amr_bwe_to_oa(buf_oa, buf_len, sizeof(buf_oa)); + if (rc < 0) { + print_red(" ERROR: Unable to convert to octet-aligned!\n"); + return; + } + printf( " Payload (octet-aligned %d bytes): %s", rc, + osmo_hexdump_nospc(buf_oa + sizeof(struct amr_hdr), rc)); +} + +static void inspect_amr(unsigned int i, const uint8_t *buf, size_t buf_len) +{ + bool is_oa; + printf("[%u] Buffer (%lu bytes): %s\n", i, buf_len, osmo_hexdump_nospc(buf, buf_len)); + is_oa = osmo_amr_is_oa(buf, buf_len); + switch (force_fmt) { + case FORCE_AMR_INPUT_FMT_AUTO: + if (is_oa) + inspect_amr_oa(buf, buf_len); + else + inspect_amr_bwe(buf, buf_len); + break; + case FORCE_AMR_INPUT_FMT_OA: + if (!is_oa) + print_orange(" WARN: detected as 'bwe' but forced as 'oa'\n"); + inspect_amr_oa(buf, buf_len); + break; + case FORCE_AMR_INPUT_FMT_BWE: + if (is_oa) + print_orange(" WARN: detected as 'oa' but forced as 'bwe'\n"); + inspect_amr_bwe(buf, buf_len); + break; + case FORCE_AMR_INPUT_FMT_ALL: + if (!is_oa) + print_orange(" WARN: detected as 'bwe' but forced as 'oa'\n"); + inspect_amr_oa(buf, buf_len); + if (is_oa) + print_orange(" WARN: detected as 'oa' but forced as 'bwe'\n"); + inspect_amr_bwe(buf, buf_len); + break; + default: + OSMO_ASSERT(0); + } + printf("\n"); +} + +static int read_file(const char *filename) +{ + FILE * fp; + char * line = NULL; + size_t len = 0; + ssize_t read; + uint8_t buf[4096]; + int rc = 0; + unsigned int i = 0; + + fp = fopen(filename, "r"); + if (fp == NULL) { + fprintf(stderr, "Failed opening %s: %s\n", filename, strerror(errno)); + return -errno; + } + + while ((read = getline(&line, &len, fp)) != -1) { + if (len & 1) { + fprintf(stderr, "Failed parsing (wrong even length): %s\n", line); + rc = -1; + goto free_ret; + } + if (len > sizeof(buf)*2) { + fprintf(stderr, "Failed parsing (too big): %s\n", line); + rc = -1; + goto free_ret; + } + rc = osmo_hexparse(line, buf, sizeof(buf)); + if (rc < 0) { + fprintf(stderr, "Failed parsing (hexparse error): %s\n", line); + rc = -1; + goto free_ret; + } + if (rc < 2) { + fprintf(stderr, "Too short to be an AMR buffer (%u bytes): %s\n", rc, line); + rc = -1; + goto free_ret; + } + inspect_amr(i, buf, rc); + i++; + } + +free_ret: + fclose(fp); + if (line) + free(line); + return rc; +} + +int main(int argc, char **argv) +{ + int opt; + char *filename = NULL; + int rc; + + while ((opt = getopt(argc, argv, "i:F:h")) != -1) { + switch (opt) { + case 'i': + filename = optarg; + break; + case 'F': + if (strcasecmp(optarg, "auto") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_AUTO; + } else if (strcasecmp(optarg, "oa") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_OA; + } else if (strcasecmp(optarg, "bwe") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_BWE; + } else if (strcasecmp(optarg, "all") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_ALL; + } else { + help(argv[0]); + exit(1); + } + break; + case 'h': + help(argv[0]); + exit(0); + break; + default: + break; + } + } + + if (argc > optind) { + fprintf(stderr, "Unsupported positional arguments in command line\n"); + exit(2); + } + + if (filename) { + rc = read_file(filename); + exit(-rc); + } else { + fprintf(stderr, "Reading from stdin not yet supported!\n"); + help(argv[0]); + exit(3); + } + + exit(0); +} -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30757 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 Gerrit-Change-Number: 30757 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: amr.h: Fix AMR_FT_{GSM,TDMA,PDC}_EFR_SID_LEN
by pespin 21 Dec '22

21 Dec '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30752 ) Change subject: amr.h: Fix AMR_FT_{GSM,TDMA,PDC}_EFR_SID_LEN ...................................................................... amr.h: Fix AMR_FT_{GSM,TDMA,PDC}_EFR_SID_LEN Fixes: 678c7fc8fe4fd11e09ccd642ad60c10c365bd19a Change-Id: I63c8082bec12bf81760330d1fc0b13de23ac6a24 --- M include/osmocom/netif/amr.h 1 file changed, 13 insertions(+), 13 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/osmocom/netif/amr.h b/include/osmocom/netif/amr.h index 0eb26e2..1cc4385 100644 --- a/include/osmocom/netif/amr.h +++ b/include/osmocom/netif/amr.h @@ -139,20 +139,20 @@ * * NOTE: These constants refer to the length of one AMR speech frame-block, * not counting CMR, TOC. */ -#define AMR_FT_0_LEN ((AMR_FT_0_LEN_BITS+7)/8) /* 4.75 */ -#define AMR_FT_1_LEN ((AMR_FT_1_LEN_BITS+7)/8) /* 5.15 */ -#define AMR_FT_2_LEN ((AMR_FT_2_LEN_BITS+7)/8) /* 5.90 */ -#define AMR_FT_3_LEN ((AMR_FT_3_LEN_BITS+7)/8) /* 6.70 */ -#define AMR_FT_4_LEN ((AMR_FT_4_LEN_BITS+7)/8) /* 7.40 */ -#define AMR_FT_5_LEN ((AMR_FT_5_LEN_BITS+7)/8) /* 7.95 */ -#define AMR_FT_6_LEN ((AMR_FT_6_LEN_BITS+7)/8) /* 10.2 */ -#define AMR_FT_7_LEN ((AMR_FT_7_LEN_BITS+7)/8) /* 12.2 */ -#define AMR_FT_SID_LEN ((AMR_FT_SID_LEN_BITS+7)/8) /* SID */ -#define AMR_FT_GSM_EFR_SID_LEN 43 /* GSM-EFR SID */ -#define AMR_FT_TDMA_EFR_SID_LEN 38 /* TDMA-EFR SID */ -#define AMR_FT_PDC_EFR_SID_LEN 37 /* PDC-EFR SID */ +#define AMR_FT_0_LEN ((AMR_FT_0_LEN_BITS+7)/8) /* 4.75 */ +#define AMR_FT_1_LEN ((AMR_FT_1_LEN_BITS+7)/8) /* 5.15 */ +#define AMR_FT_2_LEN ((AMR_FT_2_LEN_BITS+7)/8) /* 5.90 */ +#define AMR_FT_3_LEN ((AMR_FT_3_LEN_BITS+7)/8) /* 6.70 */ +#define AMR_FT_4_LEN ((AMR_FT_4_LEN_BITS+7)/8) /* 7.40 */ +#define AMR_FT_5_LEN ((AMR_FT_5_LEN_BITS+7)/8) /* 7.95 */ +#define AMR_FT_6_LEN ((AMR_FT_6_LEN_BITS+7)/8) /* 10.2 */ +#define AMR_FT_7_LEN ((AMR_FT_7_LEN_BITS+7)/8) /* 12.2 */ +#define AMR_FT_SID_LEN ((AMR_FT_SID_LEN_BITS+7)/8) /* SID */ +#define AMR_FT_GSM_EFR_SID_LEN ((AMR_FT_GSM_EFR_SID_LEN_BITS+7)/8) /* GSM-EFR SID */ +#define AMR_FT_TDMA_EFR_SID_LEN ((AMR_FT_TDMA_EFR_SID_LEN_BITS+7)/8) /* TDMA-EFR SID */ +#define AMR_FT_PDC_EFR_SID_LEN ((AMR_FT_PDC_EFR_SID_LEN_BITS+7)/8) /* PDC-EFR SID */ /* version 16.0.0 Release 16: 12-14 for future use */ -#define AMR_FT_NO_DATA_LEN 0 /* NO_DATA */ +#define AMR_FT_NO_DATA_LEN ((AMR_FT_NO_DATA_LEN_BITS+7)/8) /* NO_DATA */ int osmo_amr_ft_valid(uint8_t amr_ft); size_t osmo_amr_bytes(uint8_t amr_cmr); -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30752 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I63c8082bec12bf81760330d1fc0b13de23ac6a24 Gerrit-Change-Number: 30752 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmo-netif[master]: amr.h: Fix AMR_FT_{GSM,TDMA,PDC}_EFR_SID_LEN
by pespin 21 Dec '22

21 Dec '22
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30752 ) Change subject: amr.h: Fix AMR_FT_{GSM,TDMA,PDC}_EFR_SID_LEN ...................................................................... Patch Set 1: Code-Review+2 (1 comment) Patchset: PS1: Quick merge since fix is obvious and since this could create issues when receiving and converting an AMR payload of those types -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30752 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I63c8082bec12bf81760330d1fc0b13de23ac6a24 Gerrit-Change-Number: 30752 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 21 Dec 2022 18:54:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • ...
  • 198
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.