Projects
osmocom:latest
libosmocore
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 5
View file
libosmocore.spec
Changed
@@ -14,13 +14,13 @@ Name: libosmocore Requires: osmocom-latest -Version: 1.6.0 +Version: 1.7.0 Release: 0 Summary: The Open Source Mobile Communications Core Library License: GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND AGPL-3.0-or-later Group: Productivity/Telephony/Utilities Url: https://osmocom.org/projects/libosmocore/wiki/Libosmocore -Source: libosmocore_1.6.0.tar.xz +Source: libosmocore_1.7.0.tar.xz BuildRequires: automake >= 1.6 BuildRequires: libtool >= 2 BuildRequires: lksctp-tools-devel @@ -56,7 +56,8 @@ This package contains a program for frequency calculation for GSM called "osmo-arfcn", and a program called "osmo-auc-gen" that is used -for testing GSM authentication. +for testing GSM authentication, as well as "osmo-config-merge", a tool +for merging Osmocom configuration files. %package -n libosmocodec0 Requires: osmocom-latest @@ -117,14 +118,14 @@ This subpackage contains libraries and header files for developing applications that want to make use of libosmocoding. -%package -n libosmocore18 +%package -n libosmocore19 Requires: osmocom-latest Summary: Osmocom core library # crc16.c has GPL2-only clauses, the rest (*.c) is GPL-2.0+ License: GPL-2.0-only AND GPL-2.0-or-later Group: System/Libraries -%description -n libosmocore18 +%description -n libosmocore19 libosmocore is a library with various utility functions shared between OpenBSC and OsmocomBB. @@ -134,8 +135,9 @@ # crc16.h has GPL2-only clauses, the rest (*.h) is GPL-2.0+ License: GPL-2.0-only AND GPL-2.0-or-later Group: Development/Libraries/C and C++ -Requires: libosmocore18 = %version +Requires: libosmocore19 = %version Requires: libtalloc-devel +Requires: lksctp-tools-devel %description -n libosmocore-devel libosmocore is a library with various utility functions shared @@ -173,13 +175,13 @@ This subpackage contains libraries and header files for developing applications that want to make use of libosmoctrl. -%package -n libosmogb12 +%package -n libosmogb14 Requires: osmocom-latest Summary: Osmocom GPRS Gb Interface (NS/BSSGP) library License: AGPL-3.0-or-later Group: System/Libraries -%description -n libosmogb12 +%description -n libosmogb14 libosmocore is a package with various utility functions that were originally developed as part of the OpenBSC project. @@ -191,7 +193,7 @@ License: AGPL-3.0-or-later Group: Development/Libraries/C and C++ Requires: libosmocore-devel = %version -Requires: libosmogb12 = %version +Requires: libosmogb14 = %version Requires: libosmovty-devel = %version %description -n libosmogb-devel @@ -200,13 +202,13 @@ This subpackage contains libraries and header files for developing applications that want to make use of libosmogb. -%package -n libosmogsm17 +%package -n libosmogsm18 Requires: osmocom-latest Summary: Osmocom GSM utility library License: GPL-2.0-or-later AND AGPL-3.0-or-later Group: System/Libraries -%description -n libosmogsm17 +%description -n libosmogsm18 libosmocore is a package with various utility functions that were originally developed as part of the OpenBSC project. @@ -222,7 +224,7 @@ License: GPL-2.0-or-later AND AGPL-3.0-or-later Group: Development/Libraries/C and C++ Requires: libosmocore-devel = %version -Requires: libosmogsm17 = %version +Requires: libosmogsm18 = %version %description -n libosmogsm-devel The libosmogsm library in particular is a collection of common code @@ -342,14 +344,14 @@ %postun -n libosmocodec0 -p /sbin/ldconfig %post -n libosmocoding0 -p /sbin/ldconfig %postun -n libosmocoding0 -p /sbin/ldconfig -%post -n libosmocore18 -p /sbin/ldconfig -%postun -n libosmocore18 -p /sbin/ldconfig +%post -n libosmocore19 -p /sbin/ldconfig +%postun -n libosmocore19 -p /sbin/ldconfig %post -n libosmoctrl0 -p /sbin/ldconfig %postun -n libosmoctrl0 -p /sbin/ldconfig -%post -n libosmogb12 -p /sbin/ldconfig -%postun -n libosmogb12 -p /sbin/ldconfig -%post -n libosmogsm17 -p /sbin/ldconfig -%postun -n libosmogsm17 -p /sbin/ldconfig +%post -n libosmogb14 -p /sbin/ldconfig +%postun -n libosmogb14 -p /sbin/ldconfig +%post -n libosmogsm18 -p /sbin/ldconfig +%postun -n libosmogsm18 -p /sbin/ldconfig %post -n libosmosim2 -p /sbin/ldconfig %postun -n libosmosim2 -p /sbin/ldconfig %post -n libosmovty9 -p /sbin/ldconfig @@ -385,9 +387,9 @@ %_libdir/libosmocoding.so %_libdir/pkgconfig/libosmocoding.pc -%files -n libosmocore18 +%files -n libosmocore19 %defattr(-,root,root) -%_libdir/libosmocore.so.18* +%_libdir/libosmocore.so.19* %files -n libosmocore-devel %defattr(-,root,root) @@ -411,9 +413,9 @@ %_libdir/libosmoctrl.so %_libdir/pkgconfig/libosmoctrl.pc -%files -n libosmogb12 +%files -n libosmogb14 %defattr(-,root,root) -%_libdir/libosmogb.so.12* +%_libdir/libosmogb.so.14* %files -n libosmogb-devel %defattr(-,root,root) @@ -423,9 +425,9 @@ %_libdir/libosmogb.so %_libdir/pkgconfig/libosmogb.pc -%files -n libosmogsm17 +%files -n libosmogsm18 %defattr(-,root,root) -%_libdir/libosmogsm.so.17* +%_libdir/libosmogsm.so.18* %files -n libosmogsm-devel %defattr(-,root,root)
View file
libosmocore_1.6.0.tar.xz/tests/tdef/tdef_vty_test_config_root.c
Deleted
@@ -1,295 +0,0 @@ -/* Test implementation for osmo_tdef VTY configuration API. */ -/* - * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> - * - * All Rights Reserved - * - * SPDX-License-Identifier: GPL-2.0+ - * - * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> - * - * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#define _GNU_SOURCE -#include <getopt.h> -#include <signal.h> -#include <limits.h> -#include <string.h> - -#include <osmocom/core/application.h> - -#include <osmocom/vty/command.h> -#include <osmocom/vty/misc.h> -#include <osmocom/vty/telnet_interface.h> - -#include <osmocom/core/tdef.h> -#include <osmocom/vty/tdef_vty.h> - -#include <stdlib.h> - -#include "config.h" - -/* ------------------- HERE IS THE INTERESTING TDEF RELEVANT PART ------------------- */ - -/* This example keeps several separate timer groups and offers 'timer' VTY commands at the root of the config node. See - * the tdef_vty_test_config_root.vty transcript test. - */ - -static struct osmo_tdef tdefs_test = { - { .T=1, .default_val=100, .desc="Testing a hundred seconds" }, // default is .unit=OSMO_TDEF_S == 0 - { .T=2, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Testing a hundred milliseconds" }, - { .T=3, .default_val=100, .unit=OSMO_TDEF_M, .desc="Testing a hundred minutes" }, - { .T=4, .default_val=100, .unit=OSMO_TDEF_CUSTOM, .desc="Testing a hundred potatoes" }, - { .T=0x7fffffff, .default_val=0xffffffff, .unit=OSMO_TDEF_M, .desc="Very large" }, - { .T=-23, .default_val=239471, .desc="Negative T number" }, - { .T=30, .default_val=50, .desc="Testing range min", .min_val=20 }, - { .T=31, .default_val=50, .desc="Testing range max", .max_val=52 }, - { .T=32, .default_val=50, .desc="Testing range both", .min_val=20, .max_val=52 }, - {} // <-- important! last entry shall be zero -}; - -static struct osmo_tdef tdefs_tea = { - { .T=1, .default_val=50, .desc="Water Boiling Timeout" }, - { .T=2, .default_val=300, .desc="Tea brewing" }, - { .T=3, .default_val=5, .unit=OSMO_TDEF_M, .desc="Let tea cool down before drinking" }, - { .T=4, .default_val=20, .unit=OSMO_TDEF_M, .desc="Forgot to drink tea while it's warm" }, - {} -}; - -static struct osmo_tdef tdefs_software = { - { .T=1, .default_val=30, .unit=OSMO_TDEF_M, .desc="Write code" }, - { .T=2, .default_val=20, .unit=OSMO_TDEF_MS, .desc="Hit segfault" }, - { .T=3, .default_val=480, .unit=OSMO_TDEF_M, .desc="Fix bugs" }, - {} -}; - -static struct osmo_tdef_group tdef_groups = { - { - .name = "tea", - .desc = "Tea time", - .tdefs = tdefs_tea, - }, - { - .name = "test", - .desc = "Test timers", - .tdefs = tdefs_test, - }, - { - .name = "software", - .desc = "Typical software development cycle", - .tdefs = tdefs_software, - }, - {} -}; - -enum tdef_vty_test_nodes { - TIMER_NODE = _LAST_OSMOVTY_NODE + 1, -}; - -/* This example puts 'timer' configuration commands directly at the root of the CONFIG_NODE. - * This TIMER_NODE is merely needed as a hook for the vty_write() command, but becomes an empty node in the VTY docs. - * It is possible to cheat around needing this if you choose to config_write_timer() in another root nodes' write cb. - * Another example using a 'network' subnode is \ref tdef_vty_test_config_subnode.c */ -static struct cmd_node timer_node = { - TIMER_NODE, - "%s(config-timer)# ", - 1, -}; - -static int config_write_timer(struct vty *vty) -{ - osmo_tdef_vty_groups_write(vty, ""); - return CMD_SUCCESS; -} - -static void timer_init_vty() -{ - /* Again, this is merely to get a vty write hook, see above. */ - install_node(&timer_node, config_write_timer); - - osmo_tdef_vty_groups_init(CONFIG_NODE, tdef_groups); -} - -/* ------------------- THE REST is just boilerplate osmo main() ------------------- */ - -void *root_ctx = NULL; - -static void print_help() -{ - printf( "options:\n" - " -h --help this text\n" - " -d --debug MASK Enable debugging (e.g. -d DRSL:DOML:DLAPDM)\n" - " -D --daemonize For the process into a background daemon\n" - " -c --config-file Specify the filename of the config file\n" - " -s --disable-color Don't use colors in stderr log output\n" - " -T --timestamp Prefix every log line with a timestamp\n" - " -V --version Print version information and exit\n" - " -e --log-level Set a global log-level\n" - ); -} - -static struct { - const char *config_file; - int daemonize; -} cmdline_config = {}; - -static void handle_options(int argc, char **argv) -{ - while (1) { - int option_idx = 0, c; - static const struct option long_options = { - { "help", 0, 0, 'h' }, - { "debug", 1, 0, 'd' }, - { "daemonize", 0, 0, 'D' }, - { "config-file", 1, 0, 'c' }, - { "disable-color", 0, 0, 's' }, - { "timestamp", 0, 0, 'T' }, - { "version", 0, 0, 'V' }, - { "log-level", 1, 0, 'e' }, - {} - }; - - c = getopt_long(argc, argv, "hc:d:Dc:sTVe:", - long_options, &option_idx); - if (c == -1) - break; - - switch (c) { - case 'h': - print_help(); - exit(0); - case 's': - log_set_use_color(osmo_stderr_target, 0); - break; - case 'd': - log_parse_category_mask(osmo_stderr_target, optarg); - break; - case 'D': - cmdline_config.daemonize = 1; - break; - case 'c': - cmdline_config.config_file = optarg; - break; - case 'T': - log_set_print_timestamp(osmo_stderr_target, 1); - break; - case 'e': - log_set_log_level(osmo_stderr_target, atoi(optarg)); - break; - case 'V': - print_version(1); - exit(0); - break; - default: - /* catch unknown options *as well as* missing arguments. */ - fprintf(stderr, "Error in command line options. Exiting.\n"); - exit(-1); - } - } -} - -static int quit = 0; - -static void signal_handler(int signal) -{ - fprintf(stdout, "signal %u received\n", signal); - - switch (signal) { - case SIGINT: - case SIGTERM: - quit++; - break; - case SIGABRT: - osmo_generate_backtrace(); - /* in case of abort, we want to obtain a talloc report - * and then return to the caller, who will abort the process */ - case SIGUSR1: - talloc_report(tall_vty_ctx, stderr); - talloc_report_full(root_ctx, stderr); - break; - case SIGUSR2: - talloc_report_full(tall_vty_ctx, stderr); - break; - default: - break; - } -} - -static struct vty_app_info vty_info = { - .name = "tdef_vty_test", - .version = PACKAGE_VERSION, -}; - -static const struct log_info_cat default_categories = {}; - -const struct log_info log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - -int main(int argc, char **argv) -{ - int rc; - - root_ctx = talloc_named_const(NULL, 0, "tdef_vty_test"); - - osmo_init_logging2(root_ctx, &log_info); - - vty_info.tall_ctx = root_ctx; - vty_init(&vty_info); - osmo_talloc_vty_add_cmds(); - - timer_init_vty(); /* <---- the only tdef relevant init */ - - handle_options(argc, argv); - - if (cmdline_config.config_file) { - rc = vty_read_config_file(cmdline_config.config_file, NULL); - if (rc < 0) { - fprintf(stderr, "Failed to parse the config file: '%s'\n", cmdline_config.config_file); - return 1; - } - } - - rc = telnet_init_dynif(root_ctx, NULL, vty_get_bind_addr(), 42042); - if (rc < 0) - return 2; - - signal(SIGINT, &signal_handler); - signal(SIGTERM, &signal_handler); - signal(SIGABRT, &signal_handler); - signal(SIGUSR1, &signal_handler); - signal(SIGUSR2, &signal_handler); - osmo_init_ignore_signals(); - - if (cmdline_config.daemonize) { - rc = osmo_daemonize(); - if (rc < 0) { - perror("Error during daemonize"); - return 6; - } - } - - while (!quit) { - log_reset_context(); - osmo_select_main(0); - } - - talloc_free(root_ctx); - talloc_free(tall_vty_ctx); - - return 0; -}
View file
libosmocore_1.6.0.tar.xz/tests/tdef/tdef_vty_test_config_subnode.c
Deleted
@@ -1,288 +0,0 @@ -/* Test implementation for osmo_tdef VTY configuration API. */ -/* - * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> - * - * All Rights Reserved - * - * SPDX-License-Identifier: GPL-2.0+ - * - * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> - * - * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#define _GNU_SOURCE -#include <getopt.h> -#include <signal.h> -#include <limits.h> -#include <string.h> - -#include <osmocom/core/application.h> - -#include <osmocom/vty/command.h> -#include <osmocom/vty/misc.h> -#include <osmocom/vty/telnet_interface.h> - -#include <osmocom/core/tdef.h> -#include <osmocom/vty/tdef_vty.h> - -#include <stdlib.h> - -#include "config.h" - -/* ------------------- HERE IS THE INTERESTING TDEF RELEVANT PART ------------------- */ - -/* This example keeps a single global timer group and offers a custom 'timer' VTY command in a 'network' subnode below - * the CONFIG_NODE. - * the tdef_vty_test_config_subnode.vty transcript test. - */ - -static struct osmo_tdef global_tdefs = { - { .T=1, .default_val=100, .desc="Testing a hundred seconds" }, // default is .unit=OSMO_TDEF_S == 0 - { .T=2, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Testing a hundred milliseconds" }, - { .T=3, .default_val=100, .unit=OSMO_TDEF_M, .desc="Testing a hundred minutes" }, - { .T=4, .default_val=100, .unit=OSMO_TDEF_CUSTOM, .desc="Testing a hundred potatoes" }, - { .T=0x7fffffff, .default_val=0xffffffff, .unit=OSMO_TDEF_M, .desc="Very large" }, - { .T=-23, .default_val=239471, .desc="Negative T number" }, - {} // <-- important! last entry shall be zero -}; - -enum tdef_vty_test_nodes { - GSMNET_NODE = _LAST_OSMOVTY_NODE + 1, -}; - -/* This example offers 'timer T123' commands within an "unrelated" already existing subnode. */ -static struct cmd_node gsmnet_node = { - GSMNET_NODE, - "%s(config-net)# ", - 1, -}; - -DEFUN(show_timer, show_timer_cmd, - "show timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL, - SHOW_STR "Show timers\n" - OSMO_TDEF_VTY_DOC_T) -{ - const char *T_arg = argc > 0 ? argv0 : NULL; - return osmo_tdef_vty_show_cmd(vty, global_tdefs, T_arg, NULL); -} - -DEFUN(cfg_net_timer, cfg_net_timer_cmd, - "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL, - "Configure or show timers\n" - OSMO_TDEF_VTY_DOC_SET) -{ - /* If any arguments are missing, redirect to 'show' */ - if (argc < 2) - return show_timer(self, vty, argc, argv); - return osmo_tdef_vty_set_cmd(vty, global_tdefs, argv); -} - -DEFUN(cfg_net, cfg_net_cmd, - "network", "Enter network node\n") -{ - vty->node = GSMNET_NODE; - return CMD_SUCCESS; -} - -static int config_write_gsmnet(struct vty *vty) -{ - vty_out(vty, "net%s", VTY_NEWLINE); - /* usually, here would be the output of any other 'net' config items... */ - - osmo_tdef_vty_write(vty, global_tdefs, " timer "); - return CMD_SUCCESS; -} - -static void gsmnet_init_vty() -{ - install_node(&gsmnet_node, config_write_gsmnet); - install_element(CONFIG_NODE, &cfg_net_cmd); - - osmo_tdefs_reset(global_tdefs); - install_element_ve(&show_timer_cmd); - install_element(GSMNET_NODE, &cfg_net_timer_cmd); -} - -/* ------------------- THE REST is just boilerplate osmo main() ------------------- */ - -void *root_ctx = NULL; - -static void print_help() -{ - printf( "options:\n" - " -h --help this text\n" - " -d --debug MASK Enable debugging (e.g. -d DRSL:DOML:DLAPDM)\n" - " -D --daemonize For the process into a background daemon\n" - " -c --config-file Specify the filename of the config file\n" - " -s --disable-color Don't use colors in stderr log output\n" - " -T --timestamp Prefix every log line with a timestamp\n" - " -V --version Print version information and exit\n" - " -e --log-level Set a global log-level\n" - ); -} - -static struct { - const char *config_file; - int daemonize; -} cmdline_config = {}; - -static void handle_options(int argc, char **argv) -{ - while (1) { - int option_idx = 0, c; - static const struct option long_options = { - { "help", 0, 0, 'h' }, - { "debug", 1, 0, 'd' }, - { "daemonize", 0, 0, 'D' }, - { "config-file", 1, 0, 'c' }, - { "disable-color", 0, 0, 's' }, - { "timestamp", 0, 0, 'T' }, - { "version", 0, 0, 'V' }, - { "log-level", 1, 0, 'e' }, - {} - }; - - c = getopt_long(argc, argv, "hc:d:Dc:sTVe:", - long_options, &option_idx); - if (c == -1) - break; - - switch (c) { - case 'h': - print_help(); - exit(0); - case 's': - log_set_use_color(osmo_stderr_target, 0); - break; - case 'd': - log_parse_category_mask(osmo_stderr_target, optarg); - break; - case 'D': - cmdline_config.daemonize = 1; - break; - case 'c': - cmdline_config.config_file = optarg; - break; - case 'T': - log_set_print_timestamp(osmo_stderr_target, 1); - break; - case 'e': - log_set_log_level(osmo_stderr_target, atoi(optarg)); - break; - case 'V': - print_version(1); - exit(0); - break; - default: - /* catch unknown options *as well as* missing arguments. */ - fprintf(stderr, "Error in command line options. Exiting.\n"); - exit(-1); - } - } -} - -static int quit = 0; - -static void signal_handler(int signal) -{ - fprintf(stdout, "signal %u received\n", signal); - - switch (signal) { - case SIGINT: - case SIGTERM: - quit++; - break; - case SIGABRT: - osmo_generate_backtrace(); - /* in case of abort, we want to obtain a talloc report - * and then return to the caller, who will abort the process */ - case SIGUSR1: - talloc_report(tall_vty_ctx, stderr); - talloc_report_full(root_ctx, stderr); - break; - case SIGUSR2: - talloc_report_full(tall_vty_ctx, stderr); - break; - default: - break; - } -} - -static struct vty_app_info vty_info = { - .name = "tdef_vty_test", - .version = PACKAGE_VERSION, -}; - -static const struct log_info_cat default_categories = {}; - -const struct log_info log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - -int main(int argc, char **argv) -{ - int rc; - - root_ctx = talloc_named_const(NULL, 0, "tdef_vty_test"); - - osmo_init_logging2(root_ctx, &log_info); - - vty_info.tall_ctx = root_ctx; - vty_init(&vty_info); - osmo_talloc_vty_add_cmds(); - - gsmnet_init_vty(); /* <--- relevant init for this example */ - - handle_options(argc, argv); - - if (cmdline_config.config_file) { - rc = vty_read_config_file(cmdline_config.config_file, NULL); - if (rc < 0) { - fprintf(stderr, "Failed to parse the config file: '%s'\n", cmdline_config.config_file); - return 1; - } - } - - rc = telnet_init_dynif(root_ctx, NULL, vty_get_bind_addr(), 42042); - if (rc < 0) - return 2; - - signal(SIGINT, &signal_handler); - signal(SIGTERM, &signal_handler); - signal(SIGABRT, &signal_handler); - signal(SIGUSR1, &signal_handler); - signal(SIGUSR2, &signal_handler); - osmo_init_ignore_signals(); - - if (cmdline_config.daemonize) { - rc = osmo_daemonize(); - if (rc < 0) { - perror("Error during daemonize"); - return 6; - } - } - - while (!quit) { - log_reset_context(); - osmo_select_main(0); - } - - talloc_free(root_ctx); - talloc_free(tall_vty_ctx); - - return 0; -}
View file
libosmocore_1.6.0.tar.xz/tests/tdef/tdef_vty_test_dynamic.c
Deleted
@@ -1,362 +0,0 @@ -/* Test implementation for osmo_tdef VTY configuration API. */ -/* - * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> - * - * All Rights Reserved - * - * SPDX-License-Identifier: GPL-2.0+ - * - * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> - * - * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#define _GNU_SOURCE -#include <getopt.h> -#include <signal.h> -#include <limits.h> -#include <string.h> - -#include <osmocom/core/application.h> - -#include <osmocom/vty/command.h> -#include <osmocom/vty/misc.h> -#include <osmocom/vty/telnet_interface.h> - -#include <osmocom/core/tdef.h> -#include <osmocom/vty/tdef_vty.h> - -#include <stdlib.h> - -#include "config.h" - -void *root_ctx = NULL; - -/* ------------------- HERE IS THE INTERESTING TDEF RELEVANT PART ------------------- */ - -/* This example keeps a separate list of timers for each instance of a dynamically allocated instance of a VTY node, - * for example of keeping separate timers for each BTS in a BSC. - */ - -static const struct osmo_tdef bts_default_tdefs = { - { .T=1111, .default_val=2, .desc="Dynamic Duo" }, - { .T=2222, .default_val=1, .desc="BATMAN" }, - { .T=3333, .default_val=12, .desc="Dadadadadadadadadadadada" }, - { .T=4444, .default_val=500, .unit=OSMO_TDEF_MS, .desc="POW!" }, - {} -}; - - -/* Boilerplate dynamic VTY node ... */ - -enum tdef_vty_test_nodes { - MEMBER_NODE = _LAST_OSMOVTY_NODE + 1, -}; - -static struct cmd_node member_node = { - MEMBER_NODE, - "%s(config-member)# ", - 1, -}; - -struct member { - struct llist_head entry; - char name23; - struct osmo_tdef *tdefs; -}; - -LLIST_HEAD(all_members); - -struct member *member_alloc(const char *name) -{ - struct member *m = talloc_zero(root_ctx, struct member); - osmo_strlcpy(m->name, name, sizeof(m->name)); - - /* DYNAMIC TDEF COPIES */ - m->tdefs = (struct osmo_tdef*)talloc_size(m, sizeof(bts_default_tdefs)); - memcpy((char*)m->tdefs, (char*)&bts_default_tdefs, sizeof(bts_default_tdefs)); - osmo_tdefs_reset(m->tdefs); - - llist_add_tail(&m->entry, &all_members); - return m; -} - -struct member *member_find(const char *name) -{ - struct member *m; - llist_for_each_entry(m, &all_members, entry) { - if (!strcmp(m->name, name)) - return m; - } - return NULL; -} - -DEFUN(cfg_member, cfg_member_cmd, - "member NAME", - "Enter member node\n" "Existing or new member node name\n") -{ - const char *name = argv0; - struct member *m = member_find(name); - if (!m) - m = member_alloc(name); - vty->index = m; - vty->node = MEMBER_NODE; - return CMD_SUCCESS; -} - - -/* TDEF SPECIFIC VTY */ - -static bool startswith(const char *str, const char *startswith_str) -{ - if (!startswith_str) - return true; - if (!str) - return false; - return strncmp(str, startswith_str, strlen(startswith_str)) == 0; -} - -DEFUN(show_timer, show_member_timer_cmd, - "show member-timer NAME " OSMO_TDEF_VTY_ARG_T_OPTIONAL, - SHOW_STR "Show timers for a specific member" "member name\n" - OSMO_TDEF_VTY_DOC_T) -{ - const char *name = argc > 0 ? argv0 : NULL; - struct member *m; - const char *T_arg = argc > 1 ? argv1 : NULL; - int shown = 0; - - llist_for_each_entry(m, &all_members, entry) { - if (!name || startswith(m->name, name)) { - osmo_tdef_vty_show_cmd(vty, m->tdefs, T_arg, "%11s: ", m->name); - shown ++; - } - } - if (!shown) { - vty_out(vty, "%% No such member: %s%s", name ? : "(none)", VTY_NEWLINE); - return CMD_WARNING; - } - return CMD_SUCCESS; -} - -DEFUN(cfg_member_timer, cfg_member_timer_cmd, - "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL, - "Configure or show timers for this member\n" - OSMO_TDEF_VTY_DOC_SET) -{ - struct member *m = vty->index; - - if (!m || !m->tdefs) { - vty_out(vty, "%% No timers here%s", VTY_NEWLINE); - return CMD_WARNING; - } - - /* If any arguments are missing, redirect to 'show' */ - if (argc < 2) { - const char *T_arg = argc > 0 ? argv0 : NULL; - return osmo_tdef_vty_show_cmd(vty, m->tdefs, T_arg, "%11s: ", m->name); - } - - return osmo_tdef_vty_set_cmd(vty, m->tdefs, argv); -} - -static int config_write_member(struct vty *vty) -{ - struct member *m; - llist_for_each_entry(m, &all_members, entry) { - vty_out(vty, "member %s%s", m->name, VTY_NEWLINE); - osmo_tdef_vty_write(vty, m->tdefs, " timer "); - } - - return CMD_SUCCESS; -} - -static void member_init_vty() -{ - install_node(&member_node, config_write_member); - install_element(CONFIG_NODE, &cfg_member_cmd); - - install_element_ve(&show_member_timer_cmd); - install_element(MEMBER_NODE, &cfg_member_timer_cmd); -} - -/* ------------------- THE REST is just boilerplate osmo main() ------------------- */ - -static void print_help() -{ - printf( "options:\n" - " -h --help this text\n" - " -d --debug MASK Enable debugging (e.g. -d DRSL:DOML:DLAPDM)\n" - " -D --daemonize For the process into a background daemon\n" - " -c --config-file Specify the filename of the config file\n" - " -s --disable-color Don't use colors in stderr log output\n" - " -T --timestamp Prefix every log line with a timestamp\n" - " -V --version Print version information and exit\n" - " -e --log-level Set a global log-level\n" - ); -} - -static struct { - const char *config_file; - int daemonize; -} cmdline_config = {}; - -static void handle_options(int argc, char **argv) -{ - while (1) { - int option_idx = 0, c; - static const struct option long_options = { - { "help", 0, 0, 'h' }, - { "debug", 1, 0, 'd' }, - { "daemonize", 0, 0, 'D' }, - { "config-file", 1, 0, 'c' }, - { "disable-color", 0, 0, 's' }, - { "timestamp", 0, 0, 'T' }, - { "version", 0, 0, 'V' }, - { "log-level", 1, 0, 'e' }, - {} - }; - - c = getopt_long(argc, argv, "hc:d:Dc:sTVe:", - long_options, &option_idx); - if (c == -1) - break; - - switch (c) { - case 'h': - print_help(); - exit(0); - case 's': - log_set_use_color(osmo_stderr_target, 0); - break; - case 'd': - log_parse_category_mask(osmo_stderr_target, optarg); - break; - case 'D': - cmdline_config.daemonize = 1; - break; - case 'c': - cmdline_config.config_file = optarg; - break; - case 'T': - log_set_print_timestamp(osmo_stderr_target, 1); - break; - case 'e': - log_set_log_level(osmo_stderr_target, atoi(optarg)); - break; - case 'V': - print_version(1); - exit(0); - break; - default: - /* catch unknown options *as well as* missing arguments. */ - fprintf(stderr, "Error in command line options. Exiting.\n"); - exit(-1); - } - } -} - -static int quit = 0; - -static void signal_handler(int signal) -{ - fprintf(stdout, "signal %u received\n", signal); - - switch (signal) { - case SIGINT: - case SIGTERM: - quit++; - break; - case SIGABRT: - osmo_generate_backtrace(); - /* in case of abort, we want to obtain a talloc report - * and then return to the caller, who will abort the process */ - case SIGUSR1: - talloc_report(tall_vty_ctx, stderr); - talloc_report_full(root_ctx, stderr); - break; - case SIGUSR2: - talloc_report_full(tall_vty_ctx, stderr); - break; - default: - break; - } -} - -static struct vty_app_info vty_info = { - .name = "tdef_vty_test", - .version = PACKAGE_VERSION, -}; - -static const struct log_info_cat default_categories = {}; - -const struct log_info log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - -int main(int argc, char **argv) -{ - int rc; - - root_ctx = talloc_named_const(NULL, 0, "tdef_vty_test"); - - osmo_init_logging2(root_ctx, &log_info); - - vty_info.tall_ctx = root_ctx; - vty_init(&vty_info); - osmo_talloc_vty_add_cmds(); - - member_init_vty(); /* <--- relevant init for this example */ - - handle_options(argc, argv); - - if (cmdline_config.config_file) { - rc = vty_read_config_file(cmdline_config.config_file, NULL); - if (rc < 0) { - fprintf(stderr, "Failed to parse the config file: '%s'\n", cmdline_config.config_file); - return 1; - } - } - - rc = telnet_init_dynif(root_ctx, NULL, vty_get_bind_addr(), 42042); - if (rc < 0) - return 2; - - signal(SIGINT, &signal_handler); - signal(SIGTERM, &signal_handler); - signal(SIGABRT, &signal_handler); - signal(SIGUSR1, &signal_handler); - signal(SIGUSR2, &signal_handler); - osmo_init_ignore_signals(); - - if (cmdline_config.daemonize) { - rc = osmo_daemonize(); - if (rc < 0) { - perror("Error during daemonize"); - return 6; - } - } - - while (!quit) { - log_reset_context(); - osmo_select_main(0); - } - - talloc_free(root_ctx); - talloc_free(tall_vty_ctx); - - return 0; -}
View file
libosmocore_1.6.0.dsc -> libosmocore_1.7.0.dsc
Changed
@@ -1,14 +1,14 @@ Format: 3.0 (native) Source: libosmocore -Binary: libosmocore, libosmocodec0, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore18, libosmocore-doc, libosmogb12, libosmogb-doc, libosmogsm17, libosmogsm-doc, libosmovty9, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmousb0, libosmocore-dev, libosmocore-utils, libosmocore-dbg +Binary: libosmocore, libosmocodec0, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore19, libosmocore-doc, libosmogb14, libosmogb-doc, libosmogsm18, libosmogsm-doc, libosmovty9, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmousb0, libosmocore-dev, libosmocore-utils, libosmocore-dbg Architecture: any all -Version: 1.6.0 +Version: 1.7.0 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/libosmocore Standards-Version: 3.9.8 -Vcs-Browser: http://git.osmocom.org/libosmocore/ -Vcs-Git: git://git.osmocom.org/libosmocore.git -Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libgnutls28-dev, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev, libsctp-dev, libusb-1.0-0-dev, libmnl-dev, libsystemd-dev, python3:native +Vcs-Browser: https://gitea.osmocom.org/osmocom/libosmocore +Vcs-Git: https://gitea.osmocom.org/osmocom/libosmocore +Build-Depends: debhelper (>= 9), autotools-dev, autoconf, automake, libtool, dh-autoreconf, libdpkg-perl, git, libgnutls28-dev, doxygen, libpcsclite-dev, pkg-config, libtalloc-dev (>= 2.1.0), libsctp-dev, libusb-1.0-0-dev, libmnl-dev, libsystemd-dev, python3:native Package-List: libosmocodec-doc deb doc optional arch=all libosmocodec0 deb libs optional arch=any @@ -19,20 +19,20 @@ libosmocore-dev deb libdevel optional arch=any libosmocore-doc deb doc optional arch=all libosmocore-utils deb utils optional arch=any - libosmocore18 deb libs optional arch=any + libosmocore19 deb libs optional arch=any libosmoctrl-doc deb doc optional arch=all libosmoctrl0 deb libs optional arch=any libosmogb-doc deb doc optional arch=all - libosmogb12 deb libs optional arch=any + libosmogb14 deb libs optional arch=any libosmogsm-doc deb doc optional arch=all - libosmogsm17 deb libs optional arch=any + libosmogsm18 deb libs optional arch=any libosmosim2 deb libs optional arch=any libosmousb0 deb libs optional arch=any libosmovty-doc deb doc optional arch=all libosmovty9 deb libs optional arch=any Checksums-Sha1: - ade1a05126d71bcb53db063304f4b2c40506bc35 976656 libosmocore_1.6.0.tar.xz + 421f3f1a5738fb0d4c1218b126cc56a9e5302b55 998336 libosmocore_1.7.0.tar.xz Checksums-Sha256: - 89517ecf5a407d1c600cf6a8088cc55bda0fe7863d58b28cedca96513c9f06d5 976656 libosmocore_1.6.0.tar.xz + 81953672e915a2786f70f0bb38e2fcfeb33aaa75d559adcf851e9d35ff501bd9 998336 libosmocore_1.7.0.tar.xz Files: - b5253233435068619812fe501aa2175f 976656 libosmocore_1.6.0.tar.xz + f719049ed7040f1d86212f7428bec91d 998336 libosmocore_1.7.0.tar.xz
View file
libosmocore_1.6.0.tar.xz/.tarball-version -> libosmocore_1.7.0.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.6.0 \ No newline at end of file +1.7.0 \ No newline at end of file
View file
libosmocore_1.6.0.tar.xz/Makefile.am -> libosmocore_1.7.0.tar.xz/Makefile.am
Changed
@@ -1,7 +1,22 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -SUBDIRS = include src src/vty src/codec src/gsm src/coding src/gb src/ctrl src/sim src/pseudotalloc src/usb utils tapset tests +SUBDIRS = \ + include \ + src \ + src/vty \ + src/codec \ + src/gsm \ + src/coding \ + src/gb \ + src/ctrl \ + src/sim \ + src/pseudotalloc \ + src/usb \ + utils \ + tapset \ + tests \ + $(NULL) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \
View file
libosmocore_1.6.0.tar.xz/README.md -> libosmocore_1.7.0.tar.xz/README.md
Changed
@@ -41,9 +41,9 @@ You can clone from the official libosmocore.git repository using - git clone git://git.osmocom.org/libosmocore.git + git clone https://gitea.osmocom.org/osmocom/libosmocore -There is a cgit interface at <https://git.osmocom.org/libosmocore/> +There is a web interface at <https://gitea.osmocom.org/osmocom/libosmocore> Documentation -------------
View file
libosmocore_1.6.0.tar.xz/configure.ac -> libosmocore_1.7.0.tar.xz/configure.ac
Changed
@@ -78,6 +78,24 @@ # check for pthread (PTHREAD_CFLAGS, PTHREAD_LIBS) AX_PTHREAD +AC_MSG_CHECKING(for pthread_getname_np(pthread_t, char*, size_t)) +saved_CFLAGS="$CFLAGS" +saved_LIBS="$LIBS" +CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +LIBS="$LIBS $PTHREAD_LIBS" +AC_LINK_IFELSE( + AC_LANG_PROGRAM( + #define _GNU_SOURCE + #include <pthread.h>, + pthread_getname_np(pthread_self(),"example",0)), + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1, + Have function pthread_setname_np(const char*)), + AC_MSG_RESULT(no)) +CFLAGS="$saved_CFLAGS" +LIBS="$saved_LIBS" + + # check for old glibc < 2.17 to get clock_gettime AC_SEARCH_LIBS(clock_gettime, rt posix4, AC_DEFINE(HAVE_CLOCK_GETTIME, 1, Define if clock_gettime is available) @@ -223,16 +241,22 @@ ENABLE_LIBSCTP=$enableval, ENABLE_LIBSCTP="yes") AM_CONDITIONAL(ENABLE_LIBSCTP, test x"$ENABLE_LIBSCTP" = x"yes") AS_IF(test "x$ENABLE_LIBSCTP" = "xyes", - old_LIBS=$LIBS - AC_SEARCH_LIBS(sctp_bindx, sctp, - AC_DEFINE(HAVE_LIBSCTP, 1, Define 1 to enable SCTP support) - AC_SUBST(HAVE_LIBSCTP, 1) - if test -n "$ac_lib"; then - AC_SUBST(LIBSCTP_LIBS, -l$ac_lib) - fi - , - AC_MSG_ERROR(sctp_bindx not found in searched libs)) - LIBS=$old_LIBS + AC_DEFINE(HAVE_LIBSCTP, 1, Define 1 to enable SCTP support) + # Attempt finding .pc, otherwise set manually (<1.0.17 have no .pc file) + PKG_CHECK_MODULES(LIBSCTP, libsctp, + AC_SUBST(LIBSCTP_PC, libsctp), + + AC_MSG_NOTICE(libsctp.pc not found (building against <1.0.17 ?), attempting manual lib lookup) + old_LIBS=$LIBS + AC_SEARCH_LIBS(sctp_bindx, sctp, + AC_SUBST(HAVE_LIBSCTP, 1) + if test -n "$ac_lib"; then + AC_SUBST(LIBSCTP_LIBS, -l$ac_lib) + fi + , + AC_MSG_ERROR(sctp_bindx not found in searched libs)) + LIBS=$old_LIBS + ) ) AC_ARG_ENABLE(sctp-tests, AS_HELP_STRING(--disable-sctp-tests, Do not run socket tests requiring system SCTP support), @@ -357,7 +381,9 @@ AM_CONDITIONAL(ENABLE_UTILITIES, false) AM_CONDITIONAL(ENABLE_GB, false) AM_CONDITIONAL(ENABLE_GNUTLS, false) + AM_CONDITIONAL(ENABLE_LIBMNL, false) AM_CONDITIONAL(ENABLE_LIBSCTP, false) + AM_CONDITIONAL(ENABLE_LIBUSB, false) AM_CONDITIONAL(ENABLE_PCSC, false) AM_CONDITIONAL(ENABLE_PSEUDOTALLOC, true) AM_CONDITIONAL(ENABLE_SERCOM_STUB, true) @@ -366,6 +392,17 @@ AC_DEFINE(PANIC_INFLOOP,1,Use infinite loop on panic rather than fprintf/abort) fi +AC_ARG_ENABLE(log_macros, + AS_HELP_STRING( + --disable-log-macros, + Disable logging macros that are also used internally to print information + ), + log_macros="yes", log_macros="no") +if test x"$log_macros" == x"yes" +then + AC_DEFINE(LIBOSMOCORE_NO_LOGGING,1,Disable logging macros) +fi + AC_ARG_ENABLE(sanitize, AS_HELP_STRING( --enable-sanitize, @@ -404,7 +441,7 @@ AM_PATH_PYTHON AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmo_verify_transcript_vty.py,yes) if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then - AC_MSG_ERROR(Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.) + AC_MSG_ERROR(Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.) fi fi AC_MSG_CHECKING(whether to enable VTY/CTRL tests) @@ -505,6 +542,35 @@ CHECK_BUILTIN_SUPPORT(__builtin_cpu_supports, Runtime SIMD detection will be disabled) +dnl There are some members in struct tcp_info that might not exist on all linux versions +AC_CHECK_MEMBER(struct tcp_info.tcpi_notsent_bytes, + AC_DEFINE(HAVE_TCP_INFO_TCPI_NOTSENT_BYTES, + 1, + Define to 1 if your <linux/tcp.h> header file have the tcpi_notsent_bytes member in struct tcp_info), + , + #include <linux/tcp.h>) + +AC_CHECK_MEMBER(struct tcp_info.tcpi_rwnd_limited, + AC_DEFINE(HAVE_TCP_INFO_TCPI_RWND_LIMITED, + 1, + Define to 1 if your <linux/tcp.h> header file have the tcpi_rwnd_limited member in struct tcp_info), + , + #include <linux/tcp.h>) + +AC_CHECK_MEMBER(struct tcp_info.tcpi_sndbuf_limited, + AC_DEFINE(HAVE_TCP_INFO_TCPI_SNDBUF_LIMITED, + 1, + Define to 1 if your <linux/tcp.h> header file have the tcpi_sndbuf_limited member in struct tcp_info), + , + #include <linux/tcp.h>) + +AC_CHECK_MEMBER(struct tcp_info.tcpi_reord_seen, + AC_DEFINE(HAVE_TCP_INFO_TCPI_REORD_SEEN, + 1, + Define to 1 if your <linux/tcp.h> header file have the tcpi_reord_seen member in struct tcp_info), + , + #include <linux/tcp.h>) + AC_MSG_RESULT(CFLAGS="$CFLAGS") AC_MSG_RESULT(CPPFLAGS="$CPPFLAGS")
View file
libosmocore_1.6.0.tar.xz/contrib/jenkins_amd64.sh -> libosmocore_1.7.0.tar.xz/contrib/jenkins_amd64.sh
Changed
@@ -3,19 +3,13 @@ . $(dirname "$0")/jenkins_common.sh -ENABLE_SANITIZE="--enable-sanitize" - -if "x$label" = "xFreeBSD_amd64" ; then - ENABLE_SANITIZE="" -fi - src_dir="$PWD" build() { build_dir="$1" prep_build "$src_dir" "$build_dir" - "$src_dir"/configure --disable-silent-rules --enable-static $ENABLE_SANITIZE --enable-werror \ + "$src_dir"/configure --disable-silent-rules --enable-static --enable-sanitize --enable-werror \ --enable-external-tests run_make
View file
libosmocore_1.6.0.tar.xz/contrib/jenkins_common.sh -> libosmocore_1.7.0.tar.xz/contrib/jenkins_common.sh
Changed
@@ -12,6 +12,37 @@ verify_value_string_arrays_are_terminated.py +# Validate enum fields in header are added to tlv_definition in source file (SYS#5891): + +verify_gsm0808_tlv_definition() { + set +x; + enums=$(grep "GSM0808_IE_" include/osmocom/gsm/protocol/gsm_08_08.h | grep "=" | awk '{ print $1 }') + counted_enums=$(for f in $enums; do printf "%-60s %s\n" "$f" "$(grep -c "\$f\" src/gsm/gsm0808.c)"; done) + missing_enums=$(echo "$counted_enums" | grep -v GSM0808_IE_RESERVED | grep "0$" || true) + if "x$missing_enums" != "x" ; then + echo "Missing IEs in src/gsm/gsm0808.c!" + echo "$missing_enums" + exit 1 + fi + set -x; +} +verify_gsm0808_tlv_definition + +verify_gsm_08_05_tlv_definition() { + set +x; + enums=$(grep "RSL_IE_" include/osmocom/gsm/protocol/gsm_08_58.h | grep -e "=" -e ",$" | awk '{ print $1 }' | tr -d ',') + counted_enums=$(for f in $enums; do printf "%-60s %s\n" "$f" "$(grep -c "\$f\" src/gsm/rsl.c)"; done) + # TODO: Add RSL_IE_SIEMENS_* to the tlv struct definitions. + missing_enums=$(echo "$counted_enums" | grep -v RSL_IE_SIEMENS |grep "0$" || true) + if "x$missing_enums" != "x" ; then + echo "Missing IEs in src/gsm/rsl.c!" + echo "$missing_enums" + exit 1 + fi + set -x; +} +verify_gsm_08_05_tlv_definition + prep_build() { _src_dir="$1" _build_dir="$2"
View file
libosmocore_1.6.0.tar.xz/contrib/libosmocore.spec.in -> libosmocore_1.7.0.tar.xz/contrib/libosmocore.spec.in
Changed
@@ -54,7 +54,8 @@ This package contains a program for frequency calculation for GSM called "osmo-arfcn", and a program called "osmo-auc-gen" that is used -for testing GSM authentication. +for testing GSM authentication, as well as "osmo-config-merge", a tool +for merging Osmocom configuration files. %package -n libosmocodec0 Summary: GSM 06.10, 06.20, 06.60, 06.90 codec library @@ -111,13 +112,13 @@ This subpackage contains libraries and header files for developing applications that want to make use of libosmocoding. -%package -n libosmocore18 +%package -n libosmocore19 Summary: Osmocom core library # crc16.c has GPL2-only clauses, the rest (*.c) is GPL-2.0+ License: GPL-2.0-only AND GPL-2.0-or-later Group: System/Libraries -%description -n libosmocore18 +%description -n libosmocore19 libosmocore is a library with various utility functions shared between OpenBSC and OsmocomBB. @@ -126,8 +127,9 @@ # crc16.h has GPL2-only clauses, the rest (*.h) is GPL-2.0+ License: GPL-2.0-only AND GPL-2.0-or-later Group: Development/Libraries/C and C++ -Requires: libosmocore18 = %version +Requires: libosmocore19 = %version Requires: libtalloc-devel +Requires: lksctp-tools-devel %description -n libosmocore-devel libosmocore is a library with various utility functions shared @@ -163,12 +165,12 @@ This subpackage contains libraries and header files for developing applications that want to make use of libosmoctrl. -%package -n libosmogb12 +%package -n libosmogb14 Summary: Osmocom GPRS Gb Interface (NS/BSSGP) library License: AGPL-3.0-or-later Group: System/Libraries -%description -n libosmogb12 +%description -n libosmogb14 libosmocore is a package with various utility functions that were originally developed as part of the OpenBSC project. @@ -179,7 +181,7 @@ License: AGPL-3.0-or-later Group: Development/Libraries/C and C++ Requires: libosmocore-devel = %version -Requires: libosmogb12 = %version +Requires: libosmogb14 = %version Requires: libosmovty-devel = %version %description -n libosmogb-devel @@ -188,12 +190,12 @@ This subpackage contains libraries and header files for developing applications that want to make use of libosmogb. -%package -n libosmogsm17 +%package -n libosmogsm18 Summary: Osmocom GSM utility library License: GPL-2.0-or-later AND AGPL-3.0-or-later Group: System/Libraries -%description -n libosmogsm17 +%description -n libosmogsm18 libosmocore is a package with various utility functions that were originally developed as part of the OpenBSC project. @@ -208,7 +210,7 @@ License: GPL-2.0-or-later AND AGPL-3.0-or-later Group: Development/Libraries/C and C++ Requires: libosmocore-devel = %version -Requires: libosmogsm17 = %version +Requires: libosmogsm18 = %version %description -n libosmogsm-devel The libosmogsm library in particular is a collection of common code @@ -322,14 +324,14 @@ %postun -n libosmocodec0 -p /sbin/ldconfig %post -n libosmocoding0 -p /sbin/ldconfig %postun -n libosmocoding0 -p /sbin/ldconfig -%post -n libosmocore18 -p /sbin/ldconfig -%postun -n libosmocore18 -p /sbin/ldconfig +%post -n libosmocore19 -p /sbin/ldconfig +%postun -n libosmocore19 -p /sbin/ldconfig %post -n libosmoctrl0 -p /sbin/ldconfig %postun -n libosmoctrl0 -p /sbin/ldconfig -%post -n libosmogb12 -p /sbin/ldconfig -%postun -n libosmogb12 -p /sbin/ldconfig -%post -n libosmogsm17 -p /sbin/ldconfig -%postun -n libosmogsm17 -p /sbin/ldconfig +%post -n libosmogb14 -p /sbin/ldconfig +%postun -n libosmogb14 -p /sbin/ldconfig +%post -n libosmogsm18 -p /sbin/ldconfig +%postun -n libosmogsm18 -p /sbin/ldconfig %post -n libosmosim2 -p /sbin/ldconfig %postun -n libosmosim2 -p /sbin/ldconfig %post -n libosmovty9 -p /sbin/ldconfig @@ -365,9 +367,9 @@ %_libdir/libosmocoding.so %_libdir/pkgconfig/libosmocoding.pc -%files -n libosmocore18 +%files -n libosmocore19 %defattr(-,root,root) -%_libdir/libosmocore.so.18* +%_libdir/libosmocore.so.19* %files -n libosmocore-devel %defattr(-,root,root) @@ -391,9 +393,9 @@ %_libdir/libosmoctrl.so %_libdir/pkgconfig/libosmoctrl.pc -%files -n libosmogb12 +%files -n libosmogb14 %defattr(-,root,root) -%_libdir/libosmogb.so.12* +%_libdir/libosmogb.so.14* %files -n libosmogb-devel %defattr(-,root,root) @@ -403,9 +405,9 @@ %_libdir/libosmogb.so %_libdir/pkgconfig/libosmogb.pc -%files -n libosmogsm17 +%files -n libosmogsm18 %defattr(-,root,root) -%_libdir/libosmogsm.so.17* +%_libdir/libosmogsm.so.18* %files -n libosmogsm-devel %defattr(-,root,root)
View file
libosmocore_1.6.0.tar.xz/debian/changelog -> libosmocore_1.7.0.tar.xz/debian/changelog
Changed
@@ -1,3 +1,163 @@ +libosmocore (1.7.0) unstable; urgency=medium + + Vadim Yanitskiy + * .gitignore: add utils/osmo-aka-verify binary + * tests/vty: fix use of GNU 'missing =' extension in designator + * debian/control: minimum version of libtalloc-dev must be >= 2.1.0 + * tests/tdef: rename the binaries to end with '_test' + * tdef: fix wrong path in documentation: tests/vty -> tests/tdef + * bitvec_read_field(): indicate errors using errno + * bitvec_read_field(): fix incorrect bit-shift issue found by UBSan + * bitvec_read_field(): optimize by expanding bytenum_from_bitnum() + * tests/testsuite.at: ensure empty stderr for the bitvec_test + * VTY: enable talloc introspection for OTC_GLOBAL + * VTY: implement 'no log gsmtap HOSTNAME' command + * contrib/libosmocore.spec.in: mention osmo-config-merge in utils + * gsm_7bit_encode_n(): use regular malloc() instead of calloc() + * tests/logging: ensure both stream and wqueue modes are tested + * tests/logging: also test printing the filename information + * logging: fix coding style issues in _output_buf() + * logging: fix printing of '\0' when filename printed last + * tests/logging: merge both logging_test_{stream,wqueue}.err + * core/utils.h: add OSMO_LIKELY / OSMO_UNLIKELY macros + * core/utils.h: wrap OSMO_ASSERT() with do { ... } while (0) + * core/msgb.h: make use of OSMO_LIKELY / OSMO_UNLIKELY + * core/utils.h: make use of OSMO_LIKELY in OSMO_ASSERT + * libosmocodec: osmo_hr_check_sid(): simplify the logic + * contrib/jenkins_amd64.sh: remove FreeBSD specific quirks + * bssmap_le: support additional IEs in Perform Location Request + * Use internal <osmocom/core/talloc.h> everywhere + * coding: fix comments for detect_afs_sid_{first,update,onset} + * coding: cosmetic: move 'dtx_prev' to the scope where it's used + * coding: use switch statement in gsm0503_tch_afhs_decode_dtx() + * coding: properly handle AFS_SID_UPDATE frames in DTX mode + * coding: prevent marking FACCH frames as AMR's special DTX frames + * tests/dtx: test detection/decoding of AFHS_SID_UPDATE + * tests/dtx: test tagging of FACCH/FH frames + * coding: fix decoding of AHS_SID_UPDATE frames (BER ~50%) + * coding: do not reset codec ID on receipt of DTX frames + * coding: add gsm0503_detect_afhs_dtx_frame2() + * coding: separate gsm0503_tch_afhs_decode_inband() + + Eric + * fix isdigit taking unsigned as input + * logging: allow disabling macros using a new define: LIBOSMOCORE_NO_LOGGING + + Daniel Willmann + * bssgp_bvc_fsm: Move log message to the correct place + * bssgp_bvc_fsm: Add a hook to notify when a reset was acknowledged + + Harald Welte + * logging: Fix memory leak in case async log write queue overflows + * write_queue: Document it that caller is responsible if enqueue fails + * gsmtap: Add gsmtap_sendmsg_free() as alternative to gsmtap_sendmsg() + * Introduce CRC and FSM for IuUP (user plane) as used in 3G RTP data + * tcp_stats: fix compilation on CentOS 7 + * iuup: Fix signed/unsigned loop counter control flow issue + * src/conv.c: Align better with Osmocom coding style + * bitvec: Fix -Wsign-compare warnings + * utils: Fix -Wsign-compare warnings + * log_taget_find() should use enum log_target_type, not int + * bits.c: Fix -Wsign-compare warnings + * socket, select: Fix -Wsign-compare warnings + * msgb: Fix -Wsign-compare warnings + * osmo_libusb: Fix NULL check in osmo_usb_removed_cb() + * osmo_libusb: Use libusb_get_pollfds() to get initial file descriptors + * osmo_libusb: Print log message on libusb initialization error + * gsm0808: Test if we properly decode a SRVCC cell identifier list + * usb: Match device by VID/PID without path/addr if it is unique + * clean-up pkg-config files: Make use of "Requires" as documented + * debian/control: libosmocore-dev must depend on libsctp-dev and libusb-1.0-0-dev + * libosmo{gb,vty}.pc.in: Add talloc to 'Requires' + * libosmocore.spec: Make libosmocore-devel require libsctp + * libosmovty: Link libosmovty against libpthread + * vty: Support platforms that don't support pthread_getname_np() + * vty: Add a 'skip-zero' version of 'show stats' and 'show rate-counters' + * stats: Functions with no arguments should specify(void) + * stats: Avoid NULL pointer deref in allocation failure paths. + * stats: don't try to save unknown stats reporter types + * fsm_vty: use unsigned int when left-shifting 31 bits! + * update git URLs (git -> https; gitea) + + Eric Wild + * logging: make LIBOSMOCORE_NO_LOGGING work as expected + + Oliver Smith + * treewide: remove FSF address + * select_main: don't poll forever during shutdown + * Cosmetic: linuxlist.h: fix misleading comment + + Philipp Maier + * stats: fix typo + * stat_item: tolerate NULL pointer argument in osmo_stat_item_group_free + * select: gather statistics for TCP connections + * stats_tcp: use a default batch size of 5 instead of 1 + * stats_tcp: fix stats item identifier + * gsm23003: fix docstring for osmo_plmn_from_bcd() + * iuup: do not use illegal characters in state/event names. + * logging: log to stderr when logging is not initialized + * reader: more meaningful null pointer check in get_sw + + Pau Espin Pedrol + * include/: Adapt some headers to match contrib/struct_endianess.py format + * logging: Fix Not enough tailroom msgb_put in _output_buf callers + * osmo-release.sh: Use variable containing bumpversion path everywhere + * iuup: Fix decoding of 1byte-length subflow size fields + * iuup: Submit RNL-STATUS-Initialization.ind upon rx of Init + * iuup: Improve CRC checksum error logging + * gsm: ABI BREAK Support CellId SAI, change CellId CGI-PS id number + * gsm: lapd_core: Change log line NOTICE->INFO + * gsm0808_test: Add new unit test showing dec error + * gsm0808: Fix decoding of IE GSM0808_IE_LCS_CLIENT_TYPE + * cosmetic: gsm_08_08.h: Add space between assignment sides + * gsm0808: Add missing IEs in bss_att_tlvdef + * jenkins: Validate IEs are added to tlv_definition + * libosmocore.pc.in: put libsctp in Requires.private + * configure: Support libsctp < 1.0.17 without libsctp.pc + * rsl: Fix tlv_parse of IPAC_DLCX_IND message + * jenkins: Validate gsm 08.58 IEs are added to tlv_definition + * gsm: Introduce helper rach_tx_integer_raw2val() + * cosmetic: logging.h: fix indentation + * gsm_12_21.h: Fix abis_nm_avail_state InTest and Failed values + * gsm_12_21.h: Add header description pointing to TS files + * coding: Refactor function to avoid gcc false positive warn + * osmo-arfcn: Fix false positive in gcc 12.1.0 + * coding: Use ARRAY_SIZE macro + * iuup: Rework API to support RFCI IDs != RFCI index + * cosmetic: iuup.h: Fix indentation + * iuup: Fix IPTIs_present not set to 0 if no IPTIs received + * cbsp: Add enum and value string for Cause + * iuup: Add missing state to bitmask for st SMpSDU_Data_Transfer_Ready + * iuup: Drop unused events + * tests/iuup: Showcase IuUP stack not answering subsequent Init msgs + * iuup: Fix Handling of subsequent Initialization msgs + * vty: command.c: Add assert + + Sylvain Munaut + * conv: Fix the traceback for tail biting codes + * build: Disable libusb and libmnl for embedded builds + + Neels Hofmeyr + * PFCP: add DLPFCP and osmo-upf port numbers + * ports.h: add osmo-pfcp-tool ports + * add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2() + * log: socket.c: rather use the osmo_sockaddr_str _FMT + * add osmo_quote_str_buf3, osmo_escape_str_buf3 + * add osmo_sockaddr_from/to_octets() + * follow-up to osmo_sockaddr_from/to_octets() + * BSSAP: HO Request Ack: add missing Codec List (BSS Supported) + * add osmo_sockaddr_set_port() + * osmo_time_cc: rate_ctr presence should not affect counting + * cosmetic tweak in Makefile.am + + Michael Iedema + * stats: use tcp stat names as provided + + Karsten Ohme + * APDU parsing support for GlobalPlatform + + -- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 28 Jun 2022 17:00:51 +0200 + libosmocore (1.6.0) unstable; urgency=medium Pau Espin Pedrol
View file
libosmocore_1.6.0.tar.xz/debian/control -> libosmocore_1.7.0.tar.xz/debian/control
Changed
@@ -14,15 +14,15 @@ doxygen, libpcsclite-dev, pkg-config, - libtalloc-dev, + libtalloc-dev (>= 2.1.0), libsctp-dev, libusb-1.0-0-dev, libmnl-dev, libsystemd-dev, python3:native Standards-Version: 3.9.8 -Vcs-Git: git://git.osmocom.org/libosmocore.git -Vcs-Browser: http://git.osmocom.org/libosmocore/ +Vcs-Git: https://gitea.osmocom.org/osmocom/libosmocore +Vcs-Browser: https://gitea.osmocom.org/osmocom/libosmocore Homepage: https://projects.osmocom.org/projects/libosmocore Package: libosmocore @@ -31,9 +31,9 @@ Multi-Arch: foreign Depends: osmocom-latest, libosmocodec0 (= ${binary:Version}), libosmocoding0 (= ${binary:Version}), - libosmocore18 (= ${binary:Version}), - libosmogb12 (= ${binary:Version}), - libosmogsm17 (= ${binary:Version}), + libosmocore19 (= ${binary:Version}), + libosmogb14 (= ${binary:Version}), + libosmogsm18 (= ${binary:Version}), libosmovty9 (= ${binary:Version}), libosmoctrl0 (= ${binary:Version}), libosmosim2 (= ${binary:Version}), @@ -115,7 +115,7 @@ . This package contains the documentation for the libosmocoding library. -Package: libosmocore18 +Package: libosmocore19 Section: libs Architecture: any Multi-Arch: same @@ -129,14 +129,14 @@ (at least) other programs that are developed in the sphere of Free Software / Open Source mobile communication. . - The libosmocore18 library in particular is a collection of common code used in + The libosmocore library in particular is a collection of common code used in various sub-projects inside the Osmocom family of projects. Package: libosmocore-doc Architecture: all Section: doc Depends: osmocom-latest, ${misc:Depends}, - libosmocore18, + libosmocore19, libjs-jquery, libosmocodec-doc, libosmocoding-doc, @@ -151,7 +151,7 @@ . This package contains the documentation for the libosmocore library. -Package: libosmogb12 +Package: libosmogb14 Section: libs Architecture: any Multi-Arch: same @@ -172,7 +172,7 @@ Architecture: all Section: doc Depends: osmocom-latest, ${misc:Depends}, - libosmogb12, + libosmogb14, libjs-jquery Description: Documentation for the Osmo GPRS Gb library This is part of the libosmocore "meta"-library. The libosmocore library @@ -183,7 +183,7 @@ . This package contains the documentation for the libosmogb library. -Package: libosmogsm17 +Package: libosmogsm18 Section: libs Architecture: any Multi-Arch: same @@ -207,7 +207,7 @@ Architecture: all Section: doc Depends: osmocom-latest, ${misc:Depends}, - libosmogsm17, + libosmogsm18, libjs-jquery Description: Documentation for the Osmo GSM utility library This is part of the libosmocore "meta"-library. The libosmocore library @@ -319,7 +319,9 @@ Multi-Arch: same Section: libdevel Depends: osmocom-latest, libosmocore, - libtalloc-dev, + libtalloc-dev (>= 2.1.0), + libsctp-dev, + libusb-1.0-0-dev, ${misc:Depends} Description: Development headers for Open Source MObile COMmunications CORE library The header files provided by this package may be used to develop
View file
libosmocore_1.6.0.tar.xz/debian/copyright -> libosmocore_1.7.0.tar.xz/debian/copyright
Changed
@@ -1,6 +1,6 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: libosmocore -Source: git://git.osmocom.org/libosmocore.git +Source: https://gitea.osmocom.org/osmocom/libosmocore Files: * Copyright: 2008 Daniel Willmann <daniel@totalueberwachung.de>
View file
libosmocore_1.7.0.tar.xz/debian/libosmocore19.install
Changed
(renamed from debian/libosmocore18.install)
View file
libosmocore_1.7.0.tar.xz/debian/libosmogb14.install
Changed
(renamed from debian/libosmogb12.install)
View file
libosmocore_1.7.0.tar.xz/debian/libosmogsm18.install
Changed
(renamed from debian/libosmogsm17.install)
View file
libosmocore_1.6.0.tar.xz/include/Makefile.am -> libosmocore_1.7.0.tar.xz/include/Makefile.am
Changed
@@ -46,6 +46,7 @@ osmocom/core/process.h \ osmocom/core/rate_ctr.h \ osmocom/core/stat_item.h \ + osmocom/core/stats_tcp.h \ osmocom/core/select.h \ osmocom/core/sercomm.h \ osmocom/core/signal.h \ @@ -125,6 +126,7 @@ osmocom/gsm/gsup_sms.h \ osmocom/gsm/i460_mux.h \ osmocom/gsm/ipa.h \ + osmocom/gsm/iuup.h \ osmocom/gsm/lapd_core.h \ osmocom/gsm/lapdm.h \ osmocom/gsm/meas_rep.h \ @@ -148,6 +150,7 @@ osmocom/gsm/protocol/gsm_12_21.h \ osmocom/gsm/protocol/gsm_23_003.h \ osmocom/gsm/protocol/gsm_23_041.h \ + osmocom/gsm/protocol/gsm_25_415.h \ osmocom/gsm/protocol/gsm_29_118.h \ osmocom/gsm/protocol/gsm_44_004.h \ osmocom/gsm/protocol/gsm_44_318.h \
View file
libosmocore_1.6.0.tar.xz/include/osmocom/coding/gsm0503_amr_dtx.h -> libosmocore_1.7.0.tar.xz/include/osmocom/coding/gsm0503_amr_dtx.h
Changed
@@ -34,7 +34,14 @@ return get_value_string(gsm0503_amr_dtx_frame_names, frame); } -enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits); -enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits); +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits) + OSMO_DEPRECATED("Use gsm0503_detect_afs_dtx_frame2() instead"); +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t *ubits) + OSMO_DEPRECATED("Use gsm0503_detect_ahs_dtx_frame2() instead"); + +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits); +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits); /*! @} */
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/base64.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/base64.h
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/bitXXgen.h.tpl -> libosmocore_1.7.0.tar.xz/include/osmocom/core/bitXXgen.h.tpl
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/bitcomp.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/bitcomp.h
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/bitvec.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/bitvec.h
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -77,7 +73,7 @@ void bitvec_to_string_r(const struct bitvec *bv, char *str); void bitvec_zero(struct bitvec *bv); unsigned bitvec_rl(const struct bitvec *bv, bool b); -unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits); +unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, unsigned int max_bits); void bitvec_shiftl(struct bitvec *bv, unsigned int n); int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits); unsigned int bitvec_add_array(struct bitvec *bv, const uint32_t *array,
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/conv.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/conv.h
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*! \defgroup conv Convolutional encoding and decoding routines @@ -128,6 +124,7 @@ const sbit_t *input, int n); int osmo_conv_decode_flush(struct osmo_conv_decoder *decoder, const sbit_t *input); +int osmo_conv_decode_get_best_end_state(struct osmo_conv_decoder *decoder); int osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder, ubit_t *output, int has_flush, int end_state);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/crcXXgen.h.tpl -> libosmocore_1.7.0.tar.xz/include/osmocom/core/crcXXgen.h.tpl
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/crcgen.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/crcgen.h
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/exec.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/exec.h
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ extern const char *osmo_environment_whitelist;
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/gsmtap_util.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/gsmtap_util.h
Changed
@@ -44,10 +44,12 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port, int ofd_wq_mode); +void gsmtap_source_free(struct gsmtap_inst *gti); int gsmtap_source_add_sink(struct gsmtap_inst *gti); int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg); +int gsmtap_sendmsg_free(struct gsmtap_inst *gti, struct msgb *msg); int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, uint32_t fn,
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/isdnhdlc.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/isdnhdlc.h
Changed
@@ -20,10 +20,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ISDNHDLC_H__
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/linuxlist.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/linuxlist.h
Changed
@@ -328,8 +328,7 @@ pos = llist_entry(pos->member.next, typeof(*pos), member), \ prefetch(pos->member.next)) -/*! Iterate over llist of given type, safe against removal of - * non-consecutive(!) llist entries. +/*! Iterate over llist of given type, safe against removal of llist entry. * \param pos the 'type *' to use as a loop counter. * \param n another 'type *' to use as temporary storage. * \param head the head of the list over which to iterate.
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/linuxrbtree.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/linuxrbtree.h
Changed
@@ -12,11 +12,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA. - linux/include/linux/rbtree.h To use rbtrees you'll have to implement your own insert and search cores.
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/logging.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/logging.h
Changed
@@ -11,10 +11,16 @@ #include <osmocom/core/defs.h> #include <osmocom/core/linuxlist.h> +extern struct log_info *osmo_log_info; + #ifndef DEBUG #define DEBUG #endif +#ifdef LIBOSMOCORE_NO_LOGGING +#undef DEBUG +#endif + #ifdef DEBUG /*! Log a debug message through the Osmocom logging framework * \paramin ss logging subsystem (e.g. \ref DLGLOBAL) @@ -49,11 +55,19 @@ * \paramin fmt format string * \paramin args variable argument list */ +#ifndef LIBOSMOCORE_NO_LOGGING #define LOGPC(ss, level, fmt, args...) \ do { \ + if (!osmo_log_info) { \ + logp_stub(__FILE__, __LINE__, 1, fmt, ##args); \ + break; \ + } \ if (log_check_level(ss, level)) \ logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \ } while(0) +#else +#define LOGPC(ss, level, fmt, args...) +#endif /*! Log through the Osmocom logging framework with explicit source. * If caller_file is passed as NULL, __FILE__ and __LINE__ are used @@ -83,8 +97,16 @@ * \paramin fmt format string * \paramin args variable argument list */ +#ifndef LIBOSMOCORE_NO_LOGGING #define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \ do { \ + if (!osmo_log_info) { \ + if (caller_file) \ + logp_stub(caller_file, caller_line, cont, fmt, ##args); \ + else \ + logp_stub(__FILE__, __LINE__, cont, fmt, ##args); \ + break; \ + } \ if (log_check_level(ss, level)) {\ if (caller_file) \ logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \ @@ -92,6 +114,9 @@ logp2(ss, level, __FILE__, __LINE__, cont, fmt, ##args); \ }\ } while(0) +#else +#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) +#endif /*! different log levels */ #define LOGL_DEBUG 1 /*!< debugging information */ @@ -124,7 +149,9 @@ #define DLBSSGP -21 /*!< Osmocom BSSGP layer */ #define DLNSDATA -22 /*!< Osmocom NS layer data pdus */ #define DLNSSIGNAL -23 /*!< Osmocom NS layer signal pdus */ -#define OSMO_NUM_DLIB 23 /*!< Number of logging sub-systems in libraries */ +#define DLIUUP -24 /*!< Osmocom IuUP layer */ +#define DLPFCP -25 /*!< Osmocom Packet Forwarding Control Protocol */ +#define OSMO_NUM_DLIB 25 /*!< Number of logging sub-systems in libraries */ /* Colors that can be used in log_info_cat.color */ #define OSMO_LOGCOLOR_NORMAL NULL @@ -267,7 +294,7 @@ /*! structure representing a logging target */ struct log_target { - struct llist_head entry; /*!< linked list */ + struct llist_head entry; /*!< linked list */ /*! Internal data for filtering */ int filter_map; @@ -367,7 +394,9 @@ void logp2(int subsys, unsigned int level, const char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 6, 7))); +void logp_stub(const char *file, int line, int cont, const char *format, ...); int log_init(const struct log_info *inf, void *talloc_ctx); +int log_initialized(void); void log_fini(void); int log_check_level(int subsys, unsigned int level); @@ -418,7 +447,7 @@ void log_add_target(struct log_target *target); void log_del_target(struct log_target *target); -struct log_target *log_target_find(int type, const char *fname); +struct log_target *log_target_find(enum log_target_type type, const char *fname); void log_enable_multithread(void);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/loggingrb.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/loggingrb.h
Changed
@@ -11,10 +11,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/msgb.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/msgb.h
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h> @@ -238,7 +234,7 @@ static inline unsigned char *msgb_put(struct msgb *msgb, unsigned int len) { unsigned char *tmp = msgb->tail; - if (msgb_tailroom(msgb) < (int) len) + if (OSMO_UNLIKELY(msgb_tailroom(msgb) < (int) len)) MSGB_ABORT(msgb, "Not enough tailroom msgb_put" " (allocated %u, head at %u, len %u, tailroom %u < want tailroom %u)\n", msgb->data_len - sizeof(struct msgb), @@ -286,7 +282,7 @@ */ static inline unsigned char *msgb_get(struct msgb *msgb, unsigned int len) { - if (msgb_length(msgb) < len) + if (OSMO_UNLIKELY(msgb_length(msgb) < len)) MSGB_ABORT(msgb, "msgb too small to get %u (len %u)\n", len, msgb_length(msgb)); msgb->tail -= len; @@ -338,7 +334,7 @@ */ static inline unsigned char *msgb_push(struct msgb *msgb, unsigned int len) { - if (msgb_headroom(msgb) < (int) len) + if (OSMO_UNLIKELY(msgb_headroom(msgb) < (int) len)) MSGB_ABORT(msgb, "Not enough headroom msgb_push" " (allocated %u, head at %u < want headroom %u, len %u, tailroom %u)\n", msgb->data_len - sizeof(struct msgb), @@ -401,7 +397,7 @@ */ static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len) { - if (msgb_length(msgb) < len) + if (OSMO_UNLIKELY(msgb_length(msgb) < len)) MSGB_ABORT(msgb, "msgb too small to pull %u (len %u)\n", len, msgb_length(msgb)); msgb->len -= len; @@ -492,9 +488,9 @@ */ static inline int msgb_trim(struct msgb *msg, int len) { - if (len < 0) + if (OSMO_UNLIKELY(len < 0)) MSGB_ABORT(msg, "Negative length is not allowed\n"); - if (len > msg->data_len) + if (OSMO_UNLIKELY(len > msg->data_len)) return -1; msg->len = len; @@ -530,7 +526,7 @@ osmo_static_assert(size >= headroom, headroom_bigger); struct msgb *msg = msgb_alloc_c(ctx, size, name); - if (msg) + if (OSMO_LIKELY(msg)) msgb_reserve(msg, headroom); return msg; } @@ -552,7 +548,7 @@ osmo_static_assert(size >= headroom, headroom_bigger); struct msgb *msg = msgb_alloc(size, name); - if (msg) + if (OSMO_LIKELY(msg)) msgb_reserve(msg, headroom); return msg; }
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/msgfile.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/msgfile.h
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/serial.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/serial.h
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*! \defgroup serial Utility functions to deal with serial ports
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/sockaddr_str.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/sockaddr_str.h
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/socket.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/socket.h
Changed
@@ -96,6 +96,7 @@ const char *osmo_sockaddr_ntop(const struct sockaddr *sa, char *dst); uint16_t osmo_sockaddr_port(const struct sockaddr *sa); +void osmo_sockaddr_set_port(struct sockaddr *sa, uint16_t port); int osmo_sock_unix_init(uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags); @@ -127,9 +128,14 @@ int osmo_sockaddr_cmp(const struct osmo_sockaddr *a, const struct osmo_sockaddr *b); +int osmo_sockaddr_to_octets(uint8_t *dst, size_t dst_maxlen, const struct osmo_sockaddr *os); +int osmo_sockaddr_from_octets(struct osmo_sockaddr *os, const void *src, size_t src_len); + const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr); char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr); +int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr); +char *osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr); int osmo_sock_set_dscp(int fd, uint8_t dscp); int osmo_sock_set_priority(int fd, int prio);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/stats.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/stats.h
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -112,7 +108,7 @@ extern struct osmo_stats_config *osmo_stats_config; void osmo_stats_init(void *ctx); -int osmo_stats_report(); +int osmo_stats_report(void); int osmo_stats_set_interval(int interval);
View file
libosmocore_1.7.0.tar.xz/include/osmocom/core/stats_tcp.h
Added
@@ -0,0 +1,16 @@ +#pragma once + +#define TCP_STATS_DEFAULT_INTERVAL 0 /* secs */ +#define TCP_STATS_DEFAULT_BATCH_SIZE 5 /* sockets per interval */ + +struct osmo_tcp_stats_config { + /* poll interval in seconds, use osmo_stats_tcp_set_interval() to manipulate this value */ + int interval; + /* specify how many sockets are processed when the interval timer expires */ + int batch_size; +}; +extern struct osmo_tcp_stats_config *osmo_tcp_stats_config; + +int osmo_stats_tcp_osmo_fd_register(const struct osmo_fd *fd, const char *name); +int osmo_stats_tcp_osmo_fd_unregister(const struct osmo_fd *fd); +int osmo_stats_tcp_set_interval(int interval);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/strrb.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/strrb.h
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/thread.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/thread.h
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \defgroup thread Osmocom thread helpers
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/timer.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/timer.h
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \defgroup timer Osmocom timers
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/timer_compat.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/timer_compat.h
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \defgroup timer Osmocom timers
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/use_count.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/use_count.h
Changed
@@ -19,10 +19,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/utils.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/utils.h
Changed
@@ -38,9 +38,18 @@ /*! Copy a C-string into a sized buffer using sizeof to detect buffer's size */ #define OSMO_STRLCPY_ARRAY(array, src) osmo_strlcpy(array, src, sizeof(array)) +/*! Branch prediction optimizations */ +#if defined(__GNUC__) +#define OSMO_LIKELY(exp) __builtin_expect(!!(exp), 1) +#define OSMO_UNLIKELY(exp) __builtin_expect(!!(exp), 0) +#else +#define OSMO_LIKELY(exp) exp +#define OSMO_UNLIKELY(exp) exp +#endif + /*! A mapping between human-readable string and numeric value */ struct value_string { - int value; /*!< numeric value */ + uint32_t value; /*!< numeric value */ const char *str; /*!< human-readable string */ }; @@ -57,7 +66,7 @@ int osmo_bcd2str(char *dst, size_t dst_size, const uint8_t *bcd, int start_nibble, int end_nibble, bool allow_hex); int osmo_str2bcd(uint8_t *dst, size_t dst_size, const char *digits, int start_nibble, int end_nibble, bool allow_hex); -int osmo_hexparse(const char *str, uint8_t *b, int max_len); +int osmo_hexparse(const char *str, uint8_t *b, unsigned int max_len); char *osmo_ubit_dump_buf(char *buf, size_t buf_len, const uint8_t *bits, unsigned int len); char *osmo_ubit_dump(const uint8_t *bits, unsigned int len); @@ -102,9 +111,11 @@ * the predicate evaluates to false (0). */ #define OSMO_ASSERT(exp) \ - if (!(exp)) { \ +do { \ + if (OSMO_UNLIKELY(!(exp))) { \ osmo_panic("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ - } + } \ +} while (0); /* some code invokes OSMO_ASSERT() without the semicolon */ /*! duplicate a string using talloc and release its prior content (if any) * \paramin ctx Talloc context to use for allocation @@ -157,10 +168,12 @@ char *osmo_quote_cstr_c(void *ctx, const char *str, int in_len); const char *osmo_escape_str(const char *str, int len); +int osmo_escape_str_buf3(char *buf, size_t bufsize, const char *str, int in_len); char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int in_len); const char *osmo_escape_str_buf(const char *str, int in_len, char *buf, size_t bufsize); char *osmo_escape_str_c(const void *ctx, const char *str, int in_len); const char *osmo_quote_str(const char *str, int in_len); +int osmo_quote_str_buf3(char *buf, size_t bufsize, const char *str, int in_len); char *osmo_quote_str_buf2(char *buf, size_t bufsize, const char *str, int in_len); const char *osmo_quote_str_buf(const char *str, int in_len, char *buf, size_t bufsize); char *osmo_quote_str_c(const void *ctx, const char *str, int in_len); @@ -323,7 +336,7 @@ _needed = FUNC_BUF(_str, _len, ## FUNC_BUF_ARGS); \ if (_needed < 0) \ goto OSMO_NAME_C_on_error; \ - if (_needed < _len) \ + if ((unsigned int) _needed < _len) \ return _str; \ _len = _needed + 1; \ if (_str) \
View file
libosmocore_1.6.0.tar.xz/include/osmocom/core/write_queue.h -> libosmocore_1.7.0.tar.xz/include/osmocom/core/write_queue.h
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/ctrl/ports.h -> libosmocore_1.7.0.tar.xz/include/osmocom/ctrl/ports.h
Changed
@@ -30,4 +30,8 @@ #define OSMO_CTRL_PORT_SMLC 4272 /* 4273 used by VTY interface */ #define OSMO_CTRL_PORT_HNODEB 4274 +/* 4275: OSMO_VTY_PORT_UPF */ +#define OSMO_CTRL_PORT_UPF 4276 +/* 4277: OSMO_VTY_PORT_PFCP_TOOL */ +#define OSMO_CTRL_PORT_PFCP_TOOL 4278 /* When adding/changing port numbers, keep docs and wiki in sync. See above. */
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gprs/bssgp_bvc_fsm.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gprs/bssgp_bvc_fsm.h
Changed
@@ -40,6 +40,8 @@ void (*reset_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id, uint8_t cause, void *priv); void (*rx_fc_bvc)(uint16_t nsei, uint16_t bvci, const struct bssgp2_flow_ctrl *fc, void *priv); + void (*reset_ack_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, + uint16_t cell_id, uint8_t cause, void *priv); }; struct osmo_fsm_inst *
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gprs/protocol/gsm_08_18.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gprs/protocol/gsm_08_18.h
Changed
@@ -362,13 +362,12 @@ /* RIM PDU Indications * 3GPP TS 48.018, section 11.3.65.0 */ struct bssgp_rim_pdu_ind { -#if OSMO_IS_BIG_ENDIAN - uint8_t reserved:4, - pdu_type_ext:3, - ack_requested:1; -#elif OSMO_IS_LITTLE_ENDIAN +#if OSMO_IS_LITTLE_ENDIAN uint8_t ack_requested:1, pdu_type_ext:3, reserved:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t reserved:4, pdu_type_ext:3, ack_requested:1; #endif } __attribute__ ((packed));
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/a5.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/a5.h
Changed
@@ -12,10 +12,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/bsslap.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/bsslap.h
Changed
@@ -21,10 +21,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/bssmap_le.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/bssmap_le.h
Changed
@@ -21,10 +21,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/cbsp.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/cbsp.h
Changed
@@ -24,10 +24,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* Decoded 8.2.3 Message Content */ @@ -75,7 +71,7 @@ struct llist_head list; /* entry in a fail_list below */ enum CELL_IDENT id_discr; union gsm0808_cell_id_u cell_id; - uint8_t cause; + uint8_t cause; /* enum osmo_cbsp_cause */ }; @@ -245,6 +241,30 @@ enum cbsp_channel_ind *channel_ind; }; +/* 8.2.13 Cause */ +enum osmo_cbsp_cause { + OSMO_CBSP_CAUSE_PARAM_NOT_RECOGNISED = 0, + OSMO_CBSP_CAUSE_PARAM_VALUE_INVALID, + OSMO_CBSP_CAUSE_MSG_REF_NOT_IDENTIFIED, + OSMO_CBSP_CAUSE_CELL_ID_NOT_VALID, + OSMO_CBSP_CAUSE_UNRECOGNISED_MESSAGE, + OSMO_CBSP_CAUSE_MISSING_MANDATORY_ELEMENT, + OSMO_CBSP_CAUSE_BSC_CAPACITY_EXCEEDED, + OSMO_CBSP_CAUSE_CELL_MEMORY_EXCEEDED, + OSMO_CBSP_CAUSE_BSC_MEMORY_EXCEEDED, + OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_SUPPORTED, + OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_OPERATIONAL, + OSMO_CBSP_CAUSE_INCOMPATIBLE_DRX_PARAM, + OSMO_CBSP_CAUSE_EXT_CHAN_NOT_SUPPORTED, + OSMO_CBSP_CAUSE_MSG_REF_ALREADY_USED, + OSMO_CBSP_CAUSE_UNSPECIFIED_ERROR, + OSMO_CBSP_CAUSE_LAI_OR_LAC_NOT_VALID, +}; +extern const struct value_string osmo_cbsp_cause_names; +static inline const char *osmo_cbsp_cause_name(enum osmo_cbsp_cause cause) +{ + return get_value_string(osmo_cbsp_cause_names, cause); +} /* decoded CBSP message */ struct osmo_cbsp_decoded {
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm0808.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm0808.h
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -250,8 +246,12 @@ const struct sockaddr_storage *aoip_transport_layer; + bool more_items; /*!< set this to true iff any fields below are used */ + + struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */ + /* more items are defined in the spec and may be added later */ - bool more_items; /*!< always set this to false */ + bool more_items2; /*!< always set this to false */ }; struct msgb *gsm0808_create_handover_request_ack2(const struct gsm0808_handover_request_ack *params);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm0808_lcs.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm0808_lcs.h
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm0808_utils.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm0808_utils.h
Changed
@@ -44,6 +44,8 @@ uint16_t ci; struct osmo_location_area_id lai_and_lac; uint16_t lac; + struct osmo_service_area_id sai; + /* osmocom specific: */ struct osmo_cell_global_id_ps global_ps; };
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm23003.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm23003.h
Changed
@@ -30,6 +30,9 @@ uint16_t cell_identity; }; +/* 3GPP TS 48.018: + * 8c.1.4.1.1 GERAN BSS identification (RIM) + * sec 11.3.9 Cell Identifier */ struct osmo_cell_global_id_ps { struct osmo_routing_area_id rai; uint16_t cell_identity; @@ -134,6 +137,10 @@ const char *osmo_cgi_ps_name2(const struct osmo_cell_global_id_ps *cgi_ps); char *osmo_cgi_ps_name_buf(char *buf, size_t buf_len, const struct osmo_cell_global_id_ps *cgi_ps); char *osmo_cgi_ps_name_c(const void *ctx, const struct osmo_cell_global_id_ps *cgi_ps); +const char *osmo_sai_name(const struct osmo_service_area_id *sai); +const char *osmo_sai_name2(const struct osmo_service_area_id *sai); +char *osmo_sai_name_buf(char *buf, size_t buf_len, const struct osmo_service_area_id *sai); +char *osmo_sai_name_c(const void *ctx, const struct osmo_service_area_id *sai); const char *osmo_gummei_name(const struct osmo_gummei *gummei); char *osmo_gummei_name_buf(char *buf, size_t buf_len, const struct osmo_gummei *gummei); char *osmo_gummei_name_c(const void *ctx, const struct osmo_gummei *gummei);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm29118.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm29118.h
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm29205.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm29205.h
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/gsm_utils.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/gsm_utils.h
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -156,6 +152,13 @@ const int tbl4 = { 1, 2, 4, 7 }; return tblraw & 3; } +static inline uint8_t rach_tx_integer_raw2val(uint8_t raw) { + const int tbl6 = { 14, 16, 20, 25, 32, 50 }; + raw &= 0x0f; + if (raw <= 9) + return raw + 3; + return tblraw - 10; +} #define ARFCN_PCS 0x8000 #define ARFCN_UPLINK 0x4000
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/i460_mux.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/i460_mux.h
Changed
@@ -14,11 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #pragma once
View file
libosmocore_1.7.0.tar.xz/include/osmocom/gsm/iuup.h
Added
@@ -0,0 +1,129 @@ +#pragma once + +#include <stdint.h> + +#include <osmocom/core/prim.h> +#include <osmocom/gsm/protocol/gsm_25_415.h> + +/*********************************************************************** + * Primitives towards the lower layers (typically RTP transport) + ***********************************************************************/ +enum osmo_iuup_tnl_prim_type { + OSMO_IUUP_TNL_UNITDATA, +}; + +struct osmo_iuup_tnl_prim { + struct osmo_prim_hdr oph; +}; + +/*********************************************************************** + * Primitives towards the upper layers at the RNL SAP + ***********************************************************************/ + +/* 3GPP TS 25.415 Section 7.2.1 */ +enum osmo_iuup_rnl_prim_type { + OSMO_IUUP_RNL_CONFIG, + OSMO_IUUP_RNL_DATA, + OSMO_IUUP_RNL_STATUS, + OSMO_IUUP_RNL_UNIT_DATA, +}; + +/* TS 25.413 9.2.1.3*/ +#define IUUP_MAX_SUBFLOWS 7 +#define IUUP_MAX_RFCIS 64 + +#define IUUP_TIMER_INIT_T_DEFAULT 1000 +#define IUUP_TIMER_TA_T_DEFAULT 500 +#define IUUP_TIMER_RC_T_DEFAULT 500 +#define IUUP_TIMER_INIT_N_DEFAULT 3 +#define IUUP_TIMER_TA_N_DEFAULT 1 +#define IUUP_TIMER_RC_N_DEFAULT 1 +struct osmo_iuup_rnl_config_timer { + uint32_t t_ms; /* time in ms */ + uint32_t n_max; /* max number of repetitions */ +}; +struct osmo_iuup_rfci { + uint8_t used:1, + spare1:1, + id:6; + uint8_t spare2:4, + IPTI:4; /* values range 0-15, 4 bits */; + uint16_t subflow_sizesIUUP_MAX_SUBFLOWS; +}; +struct osmo_iuup_rnl_config { + /* transparent (true) or SMpSDU (false): */ + bool transparent; + + /* should we actively transmit INIT in SmpSDU mode? */ + bool active; + + /* Currently Version 0 or 1: */ + uint8_t data_pdu_type; + + /* Supported mode versions */ + uint16_t supported_versions_mask; + uint8_t num_rfci; + uint8_t num_subflows; + bool IPTIs_present; + struct osmo_iuup_rfci rfciIUUP_MAX_RFCIS; + + /* TODO: Indication of delivery of erroneous SDUs*/ + struct osmo_iuup_rnl_config_timer t_init; + struct osmo_iuup_rnl_config_timer t_ta; + struct osmo_iuup_rnl_config_timer t_rc; +}; + +struct osmo_iuup_rnl_data { + uint8_t rfci; + uint8_t frame_nr; + uint8_t fqc; +}; + +struct osmo_iuup_rnl_status { + enum iuup_procedure procedure; + union { + struct { + enum iuup_error_cause cause; + enum iuup_error_distance distance; + } error_event; + struct { + uint16_t mode_version; + uint8_t data_pdu_type; + uint8_t num_rfci; + uint8_t num_subflows; + bool IPTIs_present; + struct osmo_iuup_rfci rfciIUUP_MAX_RFCIS; + } initialization; + struct { + } rate_control; + struct { + } time_alignment; + } u; +}; + +/* SAP on the upper side of IuUP, towards the user */ +struct osmo_iuup_rnl_prim { + struct osmo_prim_hdr oph; + union { + struct osmo_iuup_rnl_config config; + struct osmo_iuup_rnl_data data; + struct osmo_iuup_rnl_status status; + //struct osmo_iuup_rnl_unitdata unitdata; + } u; +}; + +struct osmo_iuup_instance; +struct osmo_iuup_instance *osmo_iuup_instance_alloc(void *ctx, const char *id); +void osmo_iuup_instance_free(struct osmo_iuup_instance *iui); + +void osmo_iuup_instance_set_user_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv); +void osmo_iuup_instance_set_transport_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv); +int osmo_iuup_tnl_prim_up(struct osmo_iuup_instance *iui, struct osmo_iuup_tnl_prim *itp); +int osmo_iuup_rnl_prim_down(struct osmo_iuup_instance *inst, struct osmo_iuup_rnl_prim *irp); + + +int osmo_iuup_compute_header_crc(const uint8_t *iuup_pdu, unsigned int pdu_len); +int osmo_iuup_compute_payload_crc(const uint8_t *iuup_pdu, unsigned int pdu_len); + +struct osmo_iuup_rnl_prim *osmo_iuup_rnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size); +struct osmo_iuup_tnl_prim *osmo_iuup_tnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size);
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/prim.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/prim.h
Changed
@@ -18,4 +18,7 @@ SAP_NS, SAP_BSSGP_RIM, + + SAP_IUUP_TNL, + SAP_IUUP_RNL, };
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/protocol/gsm_08_08.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_08_08.h
Changed
@@ -25,9 +25,10 @@ CELL_IDENT_UTRAN_PLMN_LAC_RNC = 8, CELL_IDENT_UTRAN_RNC = 9, CELL_IDENT_UTRAN_LAC_RNC = 10, + CELL_IDENT_SAI = 11, - /* Not in 03.03 nor 08.08 */ - CELL_IDENT_WHOLE_GLOBAL_PS = 11, /* CGI with + RAC */ + /* Not in 03.03 nor 08.08. Place them > 0x0f (discr_id is 4 bits) */ + CELL_IDENT_WHOLE_GLOBAL_PS = 128, /* CGI + RAC, TS 48.018 8c.1.4.1.1 */ }; /* Keep this misnamed CELL_IDENT for API backwards compatibility (see OS#3124). */ #define CELL_IDENT_LAI_AND_LAC CELL_IDENT_LAI @@ -265,7 +266,7 @@ GSM0808_IE_SEGMENTATION = 79, GSM0808_IE_SERVICE_HANDOVER = 80, GSM0808_IE_SOURCE_RNC_TO_TARGET_RNC_TRANSPARENT_UMTS = 81, - GSM0808_IE_SOURCE_RNC_TO_TARGET_RNC_TRANSPARENT_CDMA2000= 82, + GSM0808_IE_SOURCE_RNC_TO_TARGET_RNC_TRANSPARENT_CDMA2000 = 82, GSM0808_IE_RESERVED_5 = 65, GSM0808_IE_RESERVED_6 = 66, GSM0808_IE_GERAN_CLASSMARK = 0x53,
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/protocol/gsm_08_58.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_08_58.h
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -122,35 +118,29 @@ /* Osmocom specific IE to negotiate repeated ACCH capabilities */ struct abis_rsl_osmo_rep_acch_cap { -#if OSMO_IS_BIG_ENDIAN - uint8_t reserved:1, - rxqual:3, - ul_sacch:1, - dl_sacch:1, - dl_facch_all:1, - dl_facch_cmd:1; -#elif OSMO_IS_LITTLE_ENDIAN +#if OSMO_IS_LITTLE_ENDIAN uint8_t dl_facch_cmd:1, dl_facch_all:1, dl_sacch:1, ul_sacch:1, rxqual:3, reserved:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t reserved:1, rxqual:3, ul_sacch:1, dl_sacch:1, dl_facch_all:1, dl_facch_cmd:1; #endif } __attribute__ ((packed)); /* Osmocom specific IE to negotiate temporary overpower of ACCH channels */ struct abis_rsl_osmo_temp_ovp_acch_cap { -#if OSMO_IS_BIG_ENDIAN - uint8_t sacch_enable:1, - facch_enable:1, - rxqual:3, - overpower_db:3; -#elif OSMO_IS_LITTLE_ENDIAN +#if OSMO_IS_LITTLE_ENDIAN uint8_t overpower_db:3, rxqual:3, facch_enable:1, sacch_enable:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t sacch_enable:1, facch_enable:1, rxqual:3, overpower_db:3; #endif } __attribute__ ((packed)); @@ -395,9 +385,9 @@ RSL_IE_IPAC_RTP_CSD_FMT = 0xf9, RSL_IE_IPAC_RTP_JIT_BUF = 0xfa, RSL_IE_IPAC_RTP_COMPR = 0xfb, - RSL_IE_IPAC_RTP_PAYLOAD2= 0xfc, + RSL_IE_IPAC_RTP_PAYLOAD2 = 0xfc, RSL_IE_IPAC_RTP_MPLEX = 0xfd, - RSL_IE_IPAC_RTP_MPLEX_ID= 0xfe, + RSL_IE_IPAC_RTP_MPLEX_ID = 0xfe, }; /* Ericsson specific IEs, clash with above partially, so they're not @@ -866,10 +856,10 @@ uint8_t u_rxqual:3, reserved_u_rxqual:1, l_rxqual:3, reserved_l_rxqual:1; #elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t reserved_l_rxlev:2, l_rxlev:6; uint8_t reserved_u_rxlev:2, u_rxlev:6; - uint8_t reserved_l_rxqual:1, l_rxqual:3, - reserved_u_rxqual:1, u_rxqual:3; + uint8_t reserved_l_rxqual:1, l_rxqual:3, reserved_u_rxqual:1, u_rxqual:3; #endif }__attribute__ ((packed)); @@ -926,6 +916,7 @@ uint8_t pc_interval:5, reserved_pc:3; uint8_t red_step_size:4, inc_step_size:4; #elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t reserved_p1:3, p1:5; uint8_t reserved_n1:3, n1:5; uint8_t reserved_p2:3, p2:5; @@ -947,11 +938,12 @@ uint8_t upper_p:5, reserved_upper_p:3; uint8_t upper_n:5, reserved_upper_n:3; #elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ uint8_t reserved_lower_p:3, lower_p:5; uint8_t reserved_lower_n:3, lower_n:5; uint8_t reserved_upper_p:3, upper_p:5; uint8_t reserved_upper_n:3, upper_n:5; - #endif +#endif }__attribute__ ((packed)); struct osmo_preproc_pc_comp { /* Used for Carrier-to-Interference (C/I), in dB: */ @@ -1055,18 +1047,16 @@ }; struct rsl_l1_info { -#if OSMO_IS_BIG_ENDIAN - uint8_t ms_pwr:5, - fpc_epc:1, - srr_sro:1, - reserved:1; - uint8_t ta; -#elif OSMO_IS_LITTLE_ENDIAN +#if OSMO_IS_LITTLE_ENDIAN uint8_t reserved:1, srr_sro:1, fpc_epc:1, ms_pwr:5; uint8_t ta; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t ms_pwr:5, fpc_epc:1, srr_sro:1, reserved:1; + uint8_t ta; #endif } __attribute__ ((packed));
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/protocol/gsm_12_21.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_12_21.h
Changed
@@ -1,3 +1,4 @@ +/* 3GPP TS 12.21, nowadays 3GPP TS 52.021 */ /* * (C) 2008-2009 by Harald Welte <laforge@gnumonks.org> * All Rights Reserved @@ -12,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once @@ -526,9 +523,11 @@ /*! OML Availability State (Section 9.4.7) */ enum abis_nm_avail_state { - NM_AVSTATE_IN_TEST = 1, + NM_AVSTATE_IN_TEST = 0, + NM_AVSTATE_FAILED = 1, NM_AVSTATE_POWER_OFF = 2, NM_AVSTATE_OFF_LINE = 3, + /* <not used> = 4, */ NM_AVSTATE_DEPENDENCY = 5, NM_AVSTATE_DEGRADED = 6, NM_AVSTATE_NOT_INSTALLED= 7,
View file
libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_25_415.h
Added
@@ -0,0 +1,222 @@ +#pragma once +/* Iu User Plane (IuUP) Definitions as per 3GPP TS 25.415 */ +/* (C) 2017 by Harald Welte <laforge@gnumonks.org> + * All Rights Reserved. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <stdint.h> +#include <osmocom/core/endian.h> + +/* 3GPP TS 25.415 Section 6.6.2.1 */ +struct iuup_pdutype0_hdr { +#if OSMO_IS_LITTLE_ENDIAN + /* control part */ + uint8_t frame_nr:4, + pdu_type:4; + uint8_t rfci:6, + fqc:2; + /* checksum part */ + uint8_t payload_crc_hi:2, header_crc:6; + uint8_t payload_crc_lo; + + /* payload part */ + uint8_t payload0; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t pdu_type:4, frame_nr:4; + uint8_t fqc:2, rfci:6; + uint8_t header_crc:6, payload_crc_hi:2; + uint8_t payload_crc_lo; + uint8_t payload0; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.2 */ +struct iuup_pdutype1_hdr { +#if OSMO_IS_LITTLE_ENDIAN + /* control part */ + uint8_t frame_nr:4, + pdu_type:4; + uint8_t rfci:6, + fqc:2; + /* checksum part */ + uint8_t spare:2, + header_crc:6; + /* payload part */ + uint8_t payload0; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t pdu_type:4, frame_nr:4; + uint8_t fqc:2, rfci:6; + uint8_t header_crc:6, spare:2; + uint8_t payload0; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3 */ +struct iuup_pdutype14_hdr { +#if OSMO_IS_LITTLE_ENDIAN + /* control part */ + uint8_t frame_nr:2, + ack_nack:2, + pdu_type:4; + uint8_t proc_ind:4, + mode_version:4; + /* checksum part */ + uint8_t payload_crc_hi:2, header_crc:6; + uint8_t payload_crc_lo; + /* payload part */ + uint8_t payload0; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t pdu_type:4, ack_nack:2, frame_nr:2; + uint8_t mode_version:4, proc_ind:4; + uint8_t header_crc:6, payload_crc_hi:2; + uint8_t payload_crc_lo; + uint8_t payload0; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.4.1 */ +struct iuup_ctrl_init_rfci_hdr { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t rfci:6, + li:1, + lri:1; + uint8_t subflow_length0; /* 1 or 2 bytes depending on li */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t lri:1, li:1, rfci:6; + uint8_t subflow_length0; +#endif +} __attribute__((packed)); +struct iuup_ctrl_init_hdr { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t chain_ind:1, + num_subflows_per_rfci:3, + ti:1, + spare:3; + uint8_t rfci_data0; /* struct iuup_ctrl_init_rfci_hdr* */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t spare:3, ti:1, num_subflows_per_rfci:3, chain_ind:1; + uint8_t rfci_data0; /* struct iuup_ctrl_init_rfci_hdr* */ +; +#endif +} __attribute__((packed)); +struct iuup_ctrl_init_tail { +#if OSMO_IS_LITTLE_ENDIAN + uint16_t versions_supported; + uint8_t spare:4, + data_pdu_type:4; + uint8_t spare_extension0; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint16_t versions_supported; + uint8_t data_pdu_type:4, spare:4; + uint8_t spare_extension0; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.4.4 */ +struct iuup_ctrl_error_event { +#if OSMO_IS_LITTLE_ENDIAN + struct iuup_pdutype14_hdr hdr; + uint8_t error_cause:6, + error_distance:2; + uint8_t spare_extension0; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + struct iuup_pdutype14_hdr hdr; + uint8_t error_distance:2, error_cause:6; + uint8_t spare_extension0; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.2 */ +struct iuup_ctrl_ack { + struct iuup_pdutype14_hdr hdr; + uint8_t spare_extension0; +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2.3.3 */ +struct iuup_ctrl_nack { +#if OSMO_IS_LITTLE_ENDIAN + struct iuup_pdutype14_hdr hdr; + uint8_t spare:2, + error_cause:6; + uint8_t spare_extension0; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + struct iuup_pdutype14_hdr hdr; + uint8_t error_cause:6, spare:2; + uint8_t spare_extension0; +#endif +} __attribute__((packed)); + +/* 3GPP TS 25.415 Section 6.6.2 + 6.6.3.1 */ +enum iuup_pdu_type { + IUUP_PDU_T_DATA_CRC = 0, + IUUP_PDU_T_DATA_NOCRC = 1, + IUUP_PDU_T_CONTROL = 14, +}; + +/* 3GPP TS 25.415 Section 6.6.3.2 */ +enum iuup_ack_nack { + IUUP_AN_PROCEDURE = 0, + IUUP_AN_ACK = 1, + IUUP_AN_NACK = 2, +}; + +/* 3GPP TS 25.415 Section 6.6.3.5 */ +enum iuup_fqc { + IUUP_FQC_FRAME_GOOD = 0, + IUUP_FQC_FRAME_BAD = 1, + IUUP_FQC_FRAME_BAD_RADIO = 2, +}; + +/* 3GPP TS 25.415 Section 6.6.3.7 */ +enum iuup_procedure { + IUUP_PROC_INIT = 0, + IUUP_PROC_RATE_CTRL = 1, + IUUP_PROC_TIME_ALIGN = 2, + IUUP_PROC_ERR_EVENT = 3, +}; + + +/* 3GPP TS 25.415 Section 6.6.3.15 */ +enum iuup_error_distance { + IUUP_ERR_DIST_LOCAL = 0, + IUUP_ERR_DIST_FIRST_FWD = 1, + IUUP_ERR_DIST_SECOND_FWD = 2, + IUUP_ERR_DIST_RESERVED = 3, +}; + + +/* 3GPP TS 25.415 Section 6.6.3.16 */ +enum iuup_error_cause { + IUUP_ERR_CAUSE_CRC_ERR_HDR = 0, + IUUP_ERR_CAUSE_CRC_ERR_DATA = 1, + IUUP_ERR_CAUSE_UNEXPECTED_FN = 2, + IUUP_ERR_CAUSE_FRAME_LOSS = 3, + IUUP_ERR_CAUSE_UNKNOWN_PDUTYPE = 4, + IUUP_ERR_CAUSE_UNKNOWN_PROC = 5, + IUUP_ERR_CAUSE_UNKNNOWN_RES_VAL = 6, + IUUP_ERR_CAUSE_UNKNNOWN_FIELD = 7, + IUUP_ERR_CAUSE_FRAME_TOO_SHORT = 8, + IUUP_ERR_CAUSE_MISSING_FIELDS = 9, + IUUP_ERR_CAUSE_UNEXPECTED_PDU_T = 16, + IUUP_ERR_CAUSE_UNEXPECTED_PROC = 18, + IUUP_ERR_CAUSE_UNEXPECTED_RFCI = 19, + IUUP_ERR_CAUSE_UNEXPECTED_VALUE = 20, + IUUP_ERR_CAUSE_INIT_FAILURE = 42, + IUUP_ERR_CAUSE_INIT_FAILURE_NET_TMR = 43, + IUUP_ERR_CAUSE_INIT_FAILURE_REP_NACK = 44, + IUUP_ERR_CAUSE_RATE_CTRL_FAILURE = 45, + IUUP_ERR_CAUSE_ERR_EVENT_FAIL = 46, + IUUP_ERR_CAUSE_TIME_ALIGN_NOTSUPP = 47, + IUUP_ERR_CAUSE_REQ_TIME_ALIGN_NOTPOSS = 48, + IUUP_ERR_CAUSE_MODE_VERSION_NOT_SUPPORTED = 49, +};
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/protocol/gsm_44_004.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_44_004.h
Changed
@@ -5,17 +5,15 @@ /* TS 44.004 Section 7.1 */ struct gsm_sacch_l1_hdr { -#if OSMO_IS_BIG_ENDIAN - uint8_t reserved:1, - srr_sro:1, - fpc_epc:1, - ms_pwr:5; - uint8_t ta; -#elif OSMO_IS_LITTLE_ENDIAN +#if OSMO_IS_LITTLE_ENDIAN uint8_t ms_pwr:5, fpc_epc:1, srr_sro:1, reserved:1; uint8_t ta; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t reserved:1, srr_sro:1, fpc_epc:1, ms_pwr:5; + uint8_t ta; #endif } __attribute__ ((packed));
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/protocol/gsm_48_071.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_48_071.h
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/gsm/protocol/gsm_49_031.h -> libosmocore_1.7.0.tar.xz/include/osmocom/gsm/protocol/gsm_49_031.h
Changed
@@ -20,15 +20,13 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once #include <stdint.h> #include <stdbool.h> + +#include <osmocom/core/endian.h> #include <osmocom/gsm/protocol/gsm_48_071.h> #include <osmocom/gsm/protocol/gsm_23_032.h> #include <osmocom/gsm/gsm0808_utils.h> @@ -62,6 +60,21 @@ uint8_t diag_val; }; +/* 3GPP TS 49.031 10.16 LCS QoS IE */ +struct osmo_bssmap_le_lcs_qos { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t vert:1, vel:1, spare1:6; + uint8_t ha_val:7, ha_ind:1; + uint8_t va_val:7, va_ind:1; + uint8_t spare3:6, rt:2; +#elif OSMO_IS_BIG_ENDIAN + uint8_t spare1:6, vel:1, vert:1; + uint8_t ha_ind:1, ha_val:7; + uint8_t va_ind:1, va_val:7; + uint8_t rt:2, spare3:6; +#endif +} __attribute__ ((packed)); + enum bssap_le_msg_discr { BSSAP_LE_MSG_DISCR_BSSMAP_LE = 0, }; @@ -171,7 +184,15 @@ bool apdu_present; struct bsslap_pdu apdu; - bool more_items; /*!< always set this to false */ + bool more_items; /*!< set this to true iff any fields below are used */ + + bool lcs_priority_present; + uint8_t lcs_priority; /*!< see in 3GPP TS 29.002 */ + + bool lcs_qos_present; + struct osmo_bssmap_le_lcs_qos lcs_qos; + + bool more_items2; /*!< always set this to false */ }; struct bssmap_le_perform_loc_resp {
View file
libosmocore_1.6.0.tar.xz/include/osmocom/sim/class_tables.h -> libosmocore_1.7.0.tar.xz/include/osmocom/sim/class_tables.h
Changed
@@ -11,10 +11,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/usb/libusb.h -> libosmocore_1.7.0.tar.xz/include/osmocom/usb/libusb.h
Changed
@@ -12,10 +12,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <libusb.h>
View file
libosmocore_1.6.0.tar.xz/include/osmocom/vty/misc.h -> libosmocore_1.7.0.tar.xz/include/osmocom/vty/misc.h
Changed
@@ -14,15 +14,23 @@ void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg); +void vty_out_rate_ctr_group2(struct vty *vty, const char *prefix, + struct rate_ctr_group *ctrg, bool skip_zero); void vty_out_rate_ctr_group_fmt(struct vty *vty, const char *fmt, struct rate_ctr_group *ctrg); +void vty_out_rate_ctr_group_fmt2(struct vty *vty, const char *fmt, + struct rate_ctr_group *ctrg, bool skip_zero); + void vty_out_stat_item_group(struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg); +void vty_out_stat_item_group2(struct vty *vty, const char *prefix, + struct osmo_stat_item_group *statg, bool skip_zero); void vty_out_statistics_full(struct vty *vty, const char *prefix); -void vty_out_statistics_partial(struct vty *vty, const char *prefix, - int max_level); +void vty_out_statistics_full2(struct vty *vty, const char *prefix, bool skip_zero); +void vty_out_statistics_partial(struct vty *vty, const char *prefix, int max_level); +void vty_out_statistics_partial2(struct vty *vty, const char *prefix, int max_level, bool skip_zero); struct osmo_fsm;
View file
libosmocore_1.6.0.tar.xz/include/osmocom/vty/ports.h -> libosmocore_1.7.0.tar.xz/include/osmocom/vty/ports.h
Changed
@@ -42,4 +42,8 @@ /* 4272 used by control interface */ #define OSMO_VTY_PORT_HNODEB 4273 /* 4274 used by control interface */ +#define OSMO_VTY_PORT_UPF 4275 +/* 4276: OSMO_CTRL_PORT_UPF */ +#define OSMO_VTY_PORT_PFCP_TOOL 4277 +/* 4278: OSMO_CTRL_PORT_UPF */ /* When adding/changing port numbers, keep docs and wiki in sync. See above. */
View file
libosmocore_1.6.0.tar.xz/include/osmocom/vty/telnet_interface.h -> libosmocore_1.7.0.tar.xz/include/osmocom/vty/telnet_interface.h
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once
View file
libosmocore_1.6.0.tar.xz/include/osmocom/vty/vector.h -> libosmocore_1.7.0.tar.xz/include/osmocom/vty/vector.h
Changed
@@ -14,11 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. */ #pragma once
View file
libosmocore_1.6.0.tar.xz/libosmocodec.pc.in -> libosmocore_1.7.0.tar.xz/libosmocodec.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom Codec related utilities Library Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmocodec -Cflags: -I${includedir}/ @TALLOC_CFLAGS@ - +Requires: talloc, libosmocore +Libs: -L${libdir} -losmocodec +Cflags: -I${includedir}/
View file
libosmocore_1.6.0.tar.xz/libosmocoding.pc.in -> libosmocore_1.7.0.tar.xz/libosmocoding.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom L1 transcoding Library Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmocoding -losmocodec -losmogsm -losmocore -Cflags: -I${includedir}/ @TALLOC_CFLAGS@ - +Requires: talloc, libosmocore, libosmogsm, libosmocodec +Libs: -L${libdir} -losmocoding +Cflags: -I${includedir}/
View file
libosmocore_1.6.0.tar.xz/libosmocore.pc.in -> libosmocore_1.7.0.tar.xz/libosmocore.pc.in
Changed
@@ -6,6 +6,8 @@ Name: Osmocom Core Library Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmocore +Requires: talloc +Requires.private: @LIBSCTP_PC@ +Libs: -L${libdir} -losmocore Libs.private: @PTHREAD_LIBS@ @LIBSCTP_LIBS@ -Cflags: -I${includedir}/ @TALLOC_CFLAGS@ @PTHREAD_CFLAGS@ +Cflags: -I${includedir}/ @PTHREAD_CFLAGS@
View file
libosmocore_1.6.0.tar.xz/libosmoctrl.pc.in -> libosmocore_1.7.0.tar.xz/libosmoctrl.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom Control Interface Library Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmoctrl -losmogsm -losmocore +Requires: talloc, libosmocore, libosmogsm +Libs: -L${libdir} -losmoctrl Cflags: -I${includedir}/ -
View file
libosmocore_1.6.0.tar.xz/libosmogb.pc.in -> libosmocore_1.7.0.tar.xz/libosmogb.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom GPRS Gb Library Description: Osmocom GPRS Gb Interface (NS/BSSGP) Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmogb -losmovty -losmocore +Requires: talloc, libosmocore, libosmovty +Libs: -L${libdir} -losmogb Cflags: -I${includedir}/ -fno-strict-aliasing -
View file
libosmocore_1.6.0.tar.xz/libosmogsm.pc.in -> libosmocore_1.7.0.tar.xz/libosmogsm.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom GSM Core Library Description: GSM Core Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmogsm -losmocore +Requires: talloc, libosmocore +Libs: -L${libdir} -losmogsm Cflags: -I${includedir}/ -
View file
libosmocore_1.6.0.tar.xz/libosmosim.pc.in -> libosmocore_1.7.0.tar.xz/libosmosim.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom SIM card related utilities Library Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmosim -losmocore +Requires: talloc, libosmocore +Libs: -L${libdir} -losmosim Cflags: -I${includedir}/ -
View file
libosmocore_1.6.0.tar.xz/libosmousb.pc.in -> libosmocore_1.7.0.tar.xz/libosmousb.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom libusb (USB) integration Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmousb -losmocore +Requires: talloc, libusb-1.0, libosmocore +Libs: -L${libdir} -losmousb Cflags: -I${includedir}/ -
View file
libosmocore_1.6.0.tar.xz/libosmovty.pc.in -> libosmocore_1.7.0.tar.xz/libosmovty.pc.in
Changed
@@ -6,6 +6,6 @@ Name: Osmocom VTY Interface Library Description: C Utility Library Version: @VERSION@ -Libs: -L${libdir} @TALLOC_LIBS@ -losmovty -losmocore +Requires: talloc, libosmocore +Libs: -L${libdir} -losmovty Cflags: -I${includedir}/ -
View file
libosmocore_1.6.0.tar.xz/osmo-release.sh -> libosmocore_1.7.0.tar.xz/osmo-release.sh
Changed
@@ -279,7 +279,7 @@ --new-version="$NEW_VER_WITH_EPOCH" dch -r -m --distribution "unstable" "" git add ${GIT_TOPDIR}/debian/changelog -bumpversion --current-version $VERSION $REL --tag --commit --tag-name $NEW_VER --allow-dirty +$BUMPVER --current-version $VERSION $REL --tag --commit --tag-name $NEW_VER --allow-dirty git commit --amend # let the user add extra information to the release commit. git tag -s $NEW_VER -f -m "Release v$NEW_VER on $ISODATE." echo "Release $NEW_VER prepared, tagged and signed."
View file
libosmocore_1.6.0.tar.xz/src/Makefile.am -> libosmocore_1.7.0.tar.xz/src/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=18:0:0 +LIBVERSION=19:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS) $(LIBSCTP_CFLAGS) $(LIBMNL_CFLAGS) @@ -22,6 +22,7 @@ conv.c application.c rbtree.c strrb.c \ loggingrb.c crc8gen.c crc16gen.c crc32gen.c crc64gen.c \ macaddr.c stat_item.c stats.c stats_statsd.c prim.c \ + stats_tcp.c \ conv_acc.c conv_acc_generic.c sercomm.c prbs.c \ isdnhdlc.c \ tdef.c \
View file
libosmocore_1.6.0.tar.xz/src/application.c -> libosmocore_1.7.0.tar.xz/src/application.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \mainpage libosmocore Documentation
View file
libosmocore_1.6.0.tar.xz/src/backtrace.c -> libosmocore_1.7.0.tar.xz/src/backtrace.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/src/base64.c -> libosmocore_1.7.0.tar.xz/src/base64.c
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <osmocom/core/base64.h>
View file
libosmocore_1.6.0.tar.xz/src/bitcomp.c -> libosmocore_1.7.0.tar.xz/src/bitcomp.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \defgroup bitcomp Bit compression
View file
libosmocore_1.6.0.tar.xz/src/bits.c -> libosmocore_1.7.0.tar.xz/src/bits.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h> @@ -192,7 +188,7 @@ const ubit_t *in, unsigned int in_ofs, unsigned int num_bits, int lsb_mode) { - int i, op, bn; + unsigned int i, op, bn; for (i=0; i<num_bits; i++) { op = out_ofs + i; bn = lsb_mode ? (op&7) : (7-(op&7)); @@ -217,7 +213,7 @@ const pbit_t *in, unsigned int in_ofs, unsigned int num_bits, int lsb_mode) { - int i, ip, bn; + unsigned int i, ip, bn; for (i=0; i<num_bits; i++) { ip = in_ofs + i; bn = lsb_mode ? (ip&7) : (7-(ip&7)); @@ -308,7 +304,7 @@ */ void osmo_revbytebits_buf(uint8_t *buf, int len) { - unsigned int i; + int i; for (i = 0; i < len; i++) bufi = flip_tablebufi;
View file
libosmocore_1.6.0.tar.xz/src/bitvec.c -> libosmocore_1.7.0.tar.xz/src/bitvec.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup bitvec @@ -201,7 +197,8 @@ * \return 0 on success; negative in case of error */ int bitvec_set_bits(struct bitvec *bv, const enum bit_value *bits, unsigned int count) { - int i, rc; + unsigned int i; + int rc; for (i = 0; i < count; i++) { rc = bitvec_set_bit(bv, bitsi); @@ -264,7 +261,7 @@ * \return integer value retrieved from bit vector */ int bitvec_get_uint(struct bitvec *bv, unsigned int num_bits) { - int i; + unsigned int i; unsigned int ui = 0; for (i = 0; i < num_bits; i++) { @@ -472,19 +469,29 @@ * \paramin bv The boolean vector to work on * \paramin,out read_index Where reading supposed to start in the vector * \paramin len How many bits to read from vector - * \returns read bits or negative value on error + * \returns An integer made up of the bits read. + * + * In case of an error, errno is set to a non-zero value. Otherwise it holds 0. */ uint64_t bitvec_read_field(struct bitvec *bv, unsigned int *read_index, unsigned int len) { unsigned int i; uint64_t ui = 0; + + /* Prevent bitvec overrun due to incorrect index and/or length */ + if (len && bytenum_from_bitnum(*read_index + len - 1) >= bv->data_len) { + errno = EOVERFLOW; + return 0; + } + bv->cur_bit = *read_index; + errno = 0; for (i = 0; i < len; i++) { - int bit = bitvec_get_bit_pos((const struct bitvec *)bv, bv->cur_bit); - if (bit < 0) - return bit; - if (bit) + unsigned int bytenum = bytenum_from_bitnum(bv->cur_bit); + unsigned int bitnum = 7 - (bv->cur_bit % 8); + + if (bv->databytenum & (1 << bitnum)) ui |= ((uint64_t)1 << (len - i - 1)); bv->cur_bit++; } @@ -597,7 +604,7 @@ * \returns Number of consecutive bits of \p b in \p bv and cur_bit will * \go to cur_bit + number of consecutive bit */ -unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits) +unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, unsigned int max_bits) { unsigned i = 0; unsigned j = 8;
View file
libosmocore_1.6.0.tar.xz/src/codec/Makefile.am -> libosmocore_1.7.0.tar.xz/src/codec/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=3:0:3 +LIBVERSION=3:1:3 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall
View file
libosmocore_1.6.0.tar.xz/src/codec/ecu.c -> libosmocore_1.7.0.tar.xz/src/codec/ecu.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /* As the developer and copyright holder of the related code, I hereby
View file
libosmocore_1.6.0.tar.xz/src/codec/ecu_fr.c -> libosmocore_1.7.0.tar.xz/src/codec/ecu_fr.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdbool.h>
View file
libosmocore_1.6.0.tar.xz/src/codec/gsm610.c -> libosmocore_1.7.0.tar.xz/src/codec/gsm610.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/codec/gsm620.c -> libosmocore_1.7.0.tar.xz/src/codec/gsm620.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h> @@ -268,12 +264,6 @@ 81, /* Code 3:7 */ }; -static inline uint16_t mask(const uint8_t msb) -{ - const uint16_t m = (uint16_t)1 << (msb - 1); - return (m - 1) ^ m; -} - /*! Check whether RTP frame contains HR SID code word according to * TS 101 318 §5.2.2 * \paramin rtp_payload Buffer with RTP payload @@ -282,15 +272,15 @@ */ bool osmo_hr_check_sid(const uint8_t *rtp_payload, size_t payload_len) { - uint8_t i, bits = { 1, 2, 8, 9, 5, 4, 9, 5, 4, 9, 5, 4, 9, 5 }; - struct bitvec bv; - bv.data = (uint8_t *) rtp_payload; - bv.data_len = payload_len; - bv.cur_bit = 33; + struct bitvec bv = { + .data = (uint8_t *)rtp_payload, + .data_len = payload_len, + }; - /* code word is all 1 at given bits, numbered from 1, MODE is always 3 */ - for (i = 0; i < ARRAY_SIZE(bits); i++) - if (bitvec_get_uint(&bv, bitsi) != mask(bitsi)) + /* A SID frame is identified by a SID codeword consisting of 79 bits which are all 1, + * so we basically check if all bits in range r34..r112 (inclusive) are 1. */ + for (bv.cur_bit = 33; bv.cur_bit < bv.data_len * 8; bv.cur_bit++) + if (bitvec_get_bit_pos(&bv, bv.cur_bit) != ONE) return false; return true;
View file
libosmocore_1.6.0.tar.xz/src/codec/gsm660.c -> libosmocore_1.7.0.tar.xz/src/codec/gsm660.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/codec/gsm690.c -> libosmocore_1.7.0.tar.xz/src/codec/gsm690.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/coding/Makefile.am -> libosmocore_1.7.0.tar.xz/src/coding/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read Chapter 6 "Library interface versions" of the libtool # documentation before making any modification -LIBVERSION=1:2:1 +LIBVERSION=2:0:2 AM_CPPFLAGS = \ -I"$(top_srcdir)/include" \
View file
libosmocore_1.6.0.tar.xz/src/coding/gsm0503_amr_dtx.c -> libosmocore_1.7.0.tar.xz/src/coding/gsm0503_amr_dtx.c
Changed
@@ -1,5 +1,5 @@ /* - * (C) 2020 by sysmocom - s.f.m.c. GmbH, Author: Philipp Maier + * (C) 2020-2022 by sysmocom - s.f.m.c. GmbH, Author: Philipp Maier * All Rights Reserved * * SPDX-License-Identifier: GPL-2.0+ @@ -32,6 +32,8 @@ #include <osmocom/coding/gsm0503_parity.h> #include <osmocom/gsm/gsm0503.h> +#define S2U(b) ((b) < 0) + /* See also: 3GPP TS 05.03, chapter 3.10.1.3, 3.10.5.2 Identification marker */ static const ubit_t id_marker_1 = { 1, 0, 1, 1, 0, 0, 0, 0, 1 }; @@ -60,7 +62,7 @@ { 0, NULL } }; -static bool detect_afs_id_marker(int *n_errors, int *n_bits_total, const ubit_t * ubits, uint8_t offset, uint8_t count, +static bool detect_afs_id_marker(int *n_errors, int *n_bits_total, const sbit_t *sbits, uint8_t offset, uint8_t count, const ubit_t * id_marker, uint8_t id_marker_len) { unsigned int i, k; @@ -69,20 +71,20 @@ int bits = 0; /* Override coded in-band data */ - ubits += offset; + sbits += offset; /* Check for identification marker bits */ for (i = 0; i < count; i++) { for (k = 0; k < 4; k++) { - if (id_markerid_bit_nr % id_marker_len != *ubits) + if (*sbits == 0 || id_markerid_bit_nr % id_marker_len != S2U(*sbits)) errors++; id_bit_nr++; - ubits++; + sbits++; bits++; } /* Jump to the next block of 4 bits */ - ubits += 4; + sbits += 4; } *n_errors = errors; @@ -92,30 +94,30 @@ return *n_errors < *n_bits_total / 8; } -static bool detect_ahs_id_marker(int *n_errors, int *n_bits_total, const ubit_t * ubits, const ubit_t * id_marker) +static bool detect_ahs_id_marker(int *n_errors, int *n_bits_total, const sbit_t *sbits, const ubit_t *id_marker) { unsigned int i, k; int errors = 0; int bits = 0; /* Override coded in-band data */ - ubits += 16; + sbits += 16; /* Check first identification marker bits (23*9 bits) */ for (i = 0; i < 23; i++) { for (k = 0; k < 9; k++) { - if (id_markerk != *ubits) + if (*sbits == 0 || id_markerk != S2U(*sbits)) errors++; - ubits++; + sbits++; bits++; } } /* Check remaining identification marker bits (5 bits) */ for (k = 0; k < 5; k++) { - if (id_markerk != *ubits) + if (*sbits == 0 || id_markerk != S2U(*sbits)) errors++; - ubits++; + sbits++; bits++; } @@ -126,7 +128,7 @@ return *n_errors < *n_bits_total / 8; } -static bool detect_interleaved_ahs_id_marker(int *n_errors, int *n_bits_total, const ubit_t * ubits, uint8_t offset, +static bool detect_interleaved_ahs_id_marker(int *n_errors, int *n_bits_total, const sbit_t *sbits, uint8_t offset, uint8_t n_bits, const ubit_t * id_marker, uint8_t id_marker_len) { unsigned int i, k; @@ -136,23 +138,23 @@ uint8_t remainder = n_bits % id_marker_len; /* Override coded in-band data */ - ubits += offset; + sbits += offset; /* Check first identification marker bits (23*9 bits) */ for (i = 0; i < full_rounds; i++) { for (k = 0; k < id_marker_len; k++) { - if (id_markerk != *ubits) + if (*sbits == 0 || id_markerk != S2U(*sbits)) errors++; - ubits += 2; + sbits += 2; bits++; } } /* Check remaining identification marker bits (5 bits) */ for (k = 0; k < remainder; k++) { - if (id_markerk != *ubits) + if (*sbits == 0 || id_markerk != S2U(*sbits)) errors++; - ubits += 2; + sbits += 2; bits++; } @@ -163,126 +165,128 @@ return *n_errors < *n_bits_total / 8; } -/* Detect a an FR AMR SID_FIRST frame by its identifcation marker */ -static bool detect_afs_sid_first(int *n_errors, int *n_bits_total, const ubit_t * ubits) +/* Detect an FR AMR SID_FIRST frame by its identifcation marker */ +static bool detect_afs_sid_first(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_afs_id_marker(n_errors, n_bits_total, ubits, 32, 53, id_marker_0, 9); + return detect_afs_id_marker(n_errors, n_bits_total, sbits, 32, 53, id_marker_0, 9); } -/* Detect an FR AMR SID_FIRST frame by its identification marker */ -static bool detect_afs_sid_update(int *n_errors, int *n_bits_total, const ubit_t * ubits) +/* Detect an FR AMR SID_UPDATE frame by its identification marker */ +static bool detect_afs_sid_update(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_afs_id_marker(n_errors, n_bits_total, ubits, 36, 53, id_marker_0, 9); + return detect_afs_id_marker(n_errors, n_bits_total, sbits, 36, 53, id_marker_0, 9); } -/* Detect an FR AMR SID_FIRST frame by its repeating coded inband data */ -static bool detect_afs_onset(int *n_errors, int *n_bits_total, const ubit_t * ubits) +/* Detect an FR AMR ONSET frame by its repeating coded inband data */ +static int detect_afs_onset(int *n_errors, int *n_bits_total, const sbit_t *sbits) { bool rc; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_1_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_1_sid, 16); if (rc) - return true; + return 0; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_2_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_2_sid, 16); if (rc) - return true; + return 1; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_3_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_3_sid, 16); if (rc) - return true; + return 2; - rc = detect_afs_id_marker(n_errors, n_bits_total, ubits, 4, 57, codec_mode_4_sid, 16); + rc = detect_afs_id_marker(n_errors, n_bits_total, sbits, 4, 57, codec_mode_4_sid, 16); if (rc) - return true; + return 3; - return false; + return -1; } /* Detect an HR AMR SID UPDATE frame by its identification marker */ -static bool detect_ahs_sid_update(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_update(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_ahs_id_marker(n_errors, n_bits_total, ubits, id_marker_1); + return detect_ahs_id_marker(n_errors, n_bits_total, sbits, id_marker_1); } /* Detect an HR AMR SID FIRST (part 1) frame by its identification marker */ -static bool detect_ahs_sid_first_p1(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_first_p1(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_ahs_id_marker(n_errors, n_bits_total, ubits, id_marker_0); + return detect_ahs_id_marker(n_errors, n_bits_total, sbits, id_marker_0); } /* Detect an HR AMR SID FIRST (part 2) frame by its repeating coded inband data */ -static bool detect_ahs_sid_first_p2(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static int detect_ahs_sid_first_p2(int *n_errors, int *n_bits_total, const sbit_t *sbits) { bool rc; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_1_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_1_sid, 16); if (rc) - return true; + return 0; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_2_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_2_sid, 16); if (rc) - return true; + return 1; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_3_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_3_sid, 16); if (rc) - return true; + return 2; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 0, 114, codec_mode_4_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 0, 114, codec_mode_4_sid, 16); if (rc) - return true; + return 3; - return false; + return -1; } /* Detect an HR AMR ONSET frame by its repeating coded inband data */ -static bool detect_ahs_onset(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static int detect_ahs_onset(int *n_errors, int *n_bits_total, const sbit_t *sbits) { bool rc; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_1_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_1_sid, 16); if (rc) - return true; + return 0; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_2_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_2_sid, 16); if (rc) - return true; + return 1; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_3_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_3_sid, 16); if (rc) - return true; + return 2; - rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 1, 114, codec_mode_4_sid, 16); + rc = detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 1, 114, codec_mode_4_sid, 16); if (rc) - return true; + return 3; - return false; + return -1; } /* Detect an HR AMR SID FIRST INHIBIT frame by its identification marker */ -static bool detect_ahs_sid_first_inh(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_first_inh(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 33, 212, id_marker_1, 9); + return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 33, 212, id_marker_1, 9); } /* Detect an HR AMR SID UPDATE INHIBIT frame by its identification marker */ -static bool detect_ahs_sid_update_inh(int *n_errors, int *n_bits_total, const ubit_t * ubits) +static bool detect_ahs_sid_update_inh(int *n_errors, int *n_bits_total, const sbit_t *sbits) { - return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, ubits, 33, 212, id_marker_0, 9); + return detect_interleaved_ahs_id_marker(n_errors, n_bits_total, sbits, 33, 212, id_marker_0, 9); } /*! Detect FR AMR DTX frame in unmapped, deinterleaved frame bits. - * \paramin ubits input bits (456 bit). * \paramout n_errors number of errornous bits. * \paramout n_bits_total number of checked bits. + * \paramout mode_id codec mode ID (0..3 or -1). + * \paramin sbits input soft-bits (456 bit). * \returns dtx frame type. */ -enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t * ubits) +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits) { - if (detect_afs_sid_first(n_errors, n_bits_total, ubits)) + if (detect_afs_sid_first(n_errors, n_bits_total, sbits)) return AFS_SID_FIRST; - if (detect_afs_sid_update(n_errors, n_bits_total, ubits)) + if (detect_afs_sid_update(n_errors, n_bits_total, sbits)) return AFS_SID_UPDATE; - if (detect_afs_onset(n_errors, n_bits_total, ubits)) + if ((*mode_id = detect_afs_onset(n_errors, n_bits_total, sbits)) != -1) return AFS_ONSET; *n_errors = 0; @@ -290,27 +294,62 @@ return AMR_OTHER; } -/*! Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. +/*! Detect FR AMR DTX frame in unmapped, deinterleaved frame bits. + * DEPRECATED: use gsm0503_detect_afs_dtx_frame2() instead. + * \paramout n_errors number of errornous bits. + * \paramout n_bits_total number of checked bits. * \paramin ubits input bits (456 bit). + * \returns dtx frame type. */ +enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame(int *n_errors, int *n_bits_total, + const ubit_t *ubits) +{ + int mode_id; /* unused */ + sbit_t sbits456; + + osmo_ubit2sbit(&sbits0, &ubits0, sizeof(sbits)); + return gsm0503_detect_afs_dtx_frame2(n_errors, n_bits_total, &mode_id, &sbits0); +} + +/*! Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. * \paramout n_errors number of errornous bits. * \paramout n_bits_total number of checked bits. + * \paramout mode_id codec ID (CMI or CMC/CMR). + * \paramout mode_id codec mode ID (0..3 or -1). + * \paramin sbits input soft-bits (456 bit). * \returns dtx frame type, */ -enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, const ubit_t * ubits) +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame2(int *n_errors, int *n_bits_total, + int *mode_id, const sbit_t *sbits) { - if (detect_ahs_sid_update(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_update(n_errors, n_bits_total, sbits)) return AHS_SID_UPDATE; - if (detect_ahs_sid_first_inh(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_first_inh(n_errors, n_bits_total, sbits)) return AHS_SID_FIRST_INH; - if (detect_ahs_sid_update_inh(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_update_inh(n_errors, n_bits_total, sbits)) return AHS_SID_UPDATE_INH; - if (detect_ahs_sid_first_p1(n_errors, n_bits_total, ubits)) + if (detect_ahs_sid_first_p1(n_errors, n_bits_total, sbits)) return AHS_SID_FIRST_P1; - if (detect_ahs_sid_first_p2(n_errors, n_bits_total, ubits)) + if ((*mode_id = detect_ahs_sid_first_p2(n_errors, n_bits_total, sbits)) != -1) return AHS_SID_FIRST_P2; - if (detect_ahs_onset(n_errors, n_bits_total, ubits)) + if ((*mode_id = detect_ahs_onset(n_errors, n_bits_total, sbits)) != -1) return AHS_ONSET; *n_errors = 0; *n_bits_total = 0; return AMR_OTHER; } + +/*! Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. + * DEPRECATED: use gsm0503_detect_ahs_dtx_frame2() instead. + * \paramout n_errors number of errornous bits. + * \paramout n_bits_total number of checked bits. + * \paramin ubits input bits (456 bit). + * \returns dtx frame type, */ +enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame(int *n_errors, int *n_bits_total, + const ubit_t *ubits) +{ + int mode_id; /* unused */ + sbit_t sbits456; + + osmo_ubit2sbit(&sbits0, &ubits0, sizeof(sbits)); + return gsm0503_detect_ahs_dtx_frame2(n_errors, n_bits_total, &mode_id, &sbits0); +}
View file
libosmocore_1.6.0.tar.xz/src/coding/gsm0503_coding.c -> libosmocore_1.7.0.tar.xz/src/coding/gsm0503_coding.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdio.h> @@ -547,10 +543,11 @@ res = osmo_conv_decode(code, input, output); - if (n_bits_total || n_errors) { - coded_len = osmo_conv_encode(code, output, recoded); - OSMO_ASSERT(sizeof(recoded) / sizeof(recoded0) >= coded_len); - } + if (!n_bits_total && !n_errors) + return res; + + coded_len = osmo_conv_encode(code, output, recoded); + OSMO_ASSERT(ARRAY_SIZE(recoded) >= coded_len); /* Count bit errors */ if (n_errors) { @@ -2118,6 +2115,26 @@ return 0; } +/* TCH/AFS: parse codec ID (CMI or CMC/CMR) from coded in-band data (16 bit) */ +static uint8_t gsm0503_tch_afs_decode_inband(const sbit_t *cB) +{ + unsigned int id = 0, best = 0; + unsigned int i, j, k; + + for (i = 0; i < 4; i++) { + /* FIXME: why not using remaining (16 - 8) soft-bits here? */ + for (j = 0, k = 0; j < 8; j++) + k += abs(((int)gsm0503_afs_ic_sbitij) - ((int)cBj)); + + if (i == 0 || k < best) { + best = k; + id = i; + } + } + + return id; +} + /*! Perform channel decoding of a TCH/AFS channel according TS 05.03 * \paramout tch_data Codec frame in RTP payload format * \paramin bursts buffer containing the symbols of 8 bursts @@ -2160,12 +2177,10 @@ { sbit_t iB912, cB456, h; ubit_t d244, p6, conv250; - int i, j, k, best = 0, rv, len, steal = 0, id = 0; - ubit_t cBd456; + int i, rv, len, steal = 0, id = -1; *n_errors = 0; *n_bits_total = 0; static ubit_t sid_first_dummy64 = { 0 }; sbit_t sid_update_enc256; - uint8_t dtx_prev; for (i=0; i<8; i++) { gsm0503_tch_burst_unmap(&iBi * 114, &burstsi * 116, &h, i >> 2); @@ -2175,6 +2190,12 @@ gsm0503_tch_fr_deinterleave(cB, iB); if (steal > 0) { + /* If not NULL, dtx indicates type of previously decoded TCH/AFS frame. + * It's normally updated by gsm0503_detect_afs_dtx_frame2(), which is not + * reached in case of FACCH. Reset it here to avoid FACCH/F frames being + * misinterpreted as AMR's special DTX frames. */ + if (dtx != NULL) + *dtx = AMR_OTHER; rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { /* Error decoding FACCH frame */ @@ -2186,16 +2207,20 @@ /* Determine the DTX frame type (SID_UPDATE, ONSET etc...) */ if (dtx) { - osmo_sbit2ubit(cBd, cB, 456); - dtx_prev = *dtx; - *dtx = gsm0503_detect_afs_dtx_frame(n_errors, n_bits_total, cBd); + const enum gsm0503_amr_dtx_frames dtx_prev = *dtx; + + *dtx = gsm0503_detect_afs_dtx_frame2(n_errors, n_bits_total, &id, cB); - if (dtx_prev == AFS_SID_UPDATE && *dtx == AMR_OTHER) { + switch (*dtx) { + case AMR_OTHER: /* NOTE: The AFS_SID_UPDATE frame is splitted into * two half rate frames. If the id marker frame * (AFS_SID_UPDATE) is detected the following frame * contains the actual comfort noised data part of * (AFS_SID_UPDATE_CN). */ + if (dtx_prev != AFS_SID_UPDATE) + break; + /* TODO: parse CMI _and_ CMC/CMR (16 + 16 bit) */ *dtx = AFS_SID_UPDATE_CN; extract_afs_sid_update(sid_update_enc, cB); @@ -2211,35 +2236,28 @@ tch_amr_sid_update_append(conv, 1, (codec_mode_req) ? codec*ft - : codecid); + : codecid > 0 ? id : 0); tch_amr_reassemble(tch_data, conv, 39); len = 5; goto out; - } else if (*dtx == AFS_SID_FIRST) { + case AFS_SID_FIRST: /* TODO: parse CMI or CMC/CMR (16 bit) */ tch_amr_sid_update_append(sid_first_dummy, 0, (codec_mode_req) ? codec*ft - : codecid); + : codecid > 0 ? id : 0); tch_amr_reassemble(tch_data, conv, 39); len = 5; goto out; - } else if (*dtx == AFS_ONSET) { + case AFS_SID_UPDATE: /* TODO: parse CMI _and_ CMC/CMR (16 + 16 bit) */ + case AFS_ONSET: len = 0; goto out; + default: + break; } } - for (i = 0; i < 4; i++) { - for (j = 0, k = 0; j < 8; j++) - k += abs(((int)gsm0503_afs_ic_sbitij) - ((int)cBj)); - - if (i == 0 || k < best) { - best = k; - id = i; - } - } - - /* Check if indicated codec fits into range of codecs */ - if (id >= codecs) { + /* Parse codec ID (CMI or CMC/CMR) and check if it fits into range of codecs */ + if ((id = gsm0503_tch_afs_decode_inband(&cB0)) >= codecs) { /* Codec mode out of range, return id */ return id; } @@ -2390,10 +2408,12 @@ out: /* Change codec request / indication, if frame is valid */ - if (codec_mode_req) - *cmr = id; - else - *ft = id; + if (id != -1) { + if (codec_mode_req) + *cmr = id; + else + *ft = id; + } return len; } @@ -2568,6 +2588,26 @@ return -1; } +/* TCH/AHS: parse codec ID (CMI or CMC/CMR) from coded in-band data (16 bit) */ +static uint8_t gsm0503_tch_ahs_decode_inband(const sbit_t *cB) +{ + unsigned int id = 0, best = 0; + unsigned int i, j, k; + + for (i = 0, k = 0; i < 4; i++) { + /* FIXME: why not using remaining (16 - 4) soft-bits here? */ + for (j = 0, k = 0; j < 4; j++) + k += abs(((int)gsm0503_ahs_ic_sbitij) - ((int)cBj)); + + if (i == 0 || k < best) { + best = k; + id = i; + } + } + + return id; +} + /*! Perform channel decoding of a TCH/AFS channel according TS 05.03 * \paramout tch_data Codec frame in RTP payload format * \paramin bursts buffer containing the symbols of 8 bursts @@ -2612,10 +2652,8 @@ { sbit_t iB912, cB456, h; ubit_t d244, p6, conv135; - int i, j, k, best = 0, rv, len, steal = 0, id = 0; - ubit_t cBd456; + int i, rv, len, steal = 0, id = -1; static ubit_t sid_first_dummy64 = { 0 }; - uint8_t dtx_prev; /* only unmap the stealing bits */ if (!odd) { @@ -2631,6 +2669,13 @@ /* if we found a stole FACCH, but only at correct alignment */ if (steal > 0) { + /* If not NULL, dtx indicates type of previously decoded TCH/AHS frame. + * It's normally updated by gsm0503_detect_ahs_dtx_frame2(), which is not + * reached in case of FACCH. Reset it here to avoid FACCH/H frames being + * misinterpreted as AMR's special DTX frames. */ + if (dtx != NULL) + *dtx = AMR_OTHER; + for (i = 0; i < 6; i++) { gsm0503_tch_burst_unmap(&iBi * 114, &burstsi * 116, NULL, i >> 2); @@ -2661,21 +2706,37 @@ /* Determine the DTX frame type (SID_UPDATE, ONSET etc...) */ if (dtx) { - osmo_sbit2ubit(cBd, cB, 456); - dtx_prev = *dtx; - *dtx = gsm0503_detect_ahs_dtx_frame(n_errors, n_bits_total, cBd); + int n_bits_total_sid; + int n_errors_sid; - if (dtx_prev == AHS_SID_UPDATE && *dtx == AMR_OTHER) { - /* NOTE: The AHS_SID_UPDATE frame is splitted into - * two half rate frames. If the id marker frame - * (AHS_SID_UPDATE) is detected the following frame - * contains the actual comfort noised data part of - * (AHS_SID_UPDATE_CN). */ + *dtx = gsm0503_detect_ahs_dtx_frame2(n_errors, n_bits_total, &id, cB); + /* TODO: detect and handle AHS_SID_UPDATE + AHS_SID_UPDATE_INH */ + + switch (*dtx) { + case AHS_SID_UPDATE: /* TODO: parse CMI _and_ CMC/CMR (16 + 16 bit) */ + /* cB contains 16 bits of coded in-band data and 212 bits containing + * the identification marker. We need to unmap/deinterleave 114 odd + * bits from the last two blocks, 114 even bits from the first two + * blocks and combine them together. */ + gsm0503_tch_burst_unmap(&iB0 * 114, &bursts2 * 116, NULL, 0); + gsm0503_tch_burst_unmap(&iB1 * 114, &bursts3 * 116, NULL, 0); + gsm0503_tch_burst_unmap(&iB2 * 114, &bursts0 * 116, NULL, 1); + gsm0503_tch_burst_unmap(&iB3 * 114, &bursts1 * 116, NULL, 1); + gsm0503_tch_hr_deinterleave(cB, iB); + + /* cB is expected to contain 16 bits of coded in-band data and + * 212 bits containing the coded data (53 bits coded at 1/4 rate). */ *dtx = AHS_SID_UPDATE_CN; osmo_conv_decode_ber(&gsm0503_tch_axs_sid_update, - cB + 16, conv, n_errors, - n_bits_total); + cB + 16, conv, &n_errors_sid, + &n_bits_total_sid); + /* gsm0503_detect_ahs_dtx_frame2() calculates BER for the marker, + * osmo_conv_decode_ber() calculates BER for the coded data. */ + if (n_errors != NULL) + *n_errors += n_errors_sid; + if (n_bits_total != NULL) + *n_bits_total += n_bits_total_sid; rv = osmo_crc16gen_check_bits(&gsm0503_amr_crc14, conv, 35, conv + 35); if (rv != 0) { @@ -2685,38 +2746,30 @@ tch_amr_sid_update_append(conv, 1, (codec_mode_req) ? codec*ft - : codecid); + : codecid > 0 ? id : 0); tch_amr_reassemble(tch_data, conv, 39); len = 5; goto out; - } else if (*dtx == AHS_SID_FIRST_P2) { + case AHS_SID_FIRST_P2: tch_amr_sid_update_append(sid_first_dummy, 0, (codec_mode_req) ? codec*ft - : codecid); + : codecid > 0 ? id : 0); tch_amr_reassemble(tch_data, sid_first_dummy, 39); len = 5; goto out; - } else if (*dtx == AHS_SID_UPDATE || *dtx == AHS_ONSET - || *dtx == AHS_SID_FIRST_INH - || *dtx == AHS_SID_UPDATE_INH - || *dtx == AHS_SID_FIRST_P1) { + case AHS_ONSET: + case AHS_SID_FIRST_INH: /* TODO: parse CMI or CMC/CMR (16 bit) */ + case AHS_SID_UPDATE_INH: /* TODO: parse CMI or CMC/CMR (16 bit) */ + case AHS_SID_FIRST_P1: /* TODO: parse CMI or CMC/CMR (16 bit) */ len = 0; goto out; + default: + break; } } - for (i = 0; i < 4; i++) { - for (j = 0, k = 0; j < 4; j++) - k += abs(((int)gsm0503_ahs_ic_sbitij) - ((int)cBj)); - - if (i == 0 || k < best) { - best = k; - id = i; - } - } - - /* Check if indicated codec fits into range of codecs */ - if (id >= codecs) { + /* Parse codec ID (CMI or CMC/CMR) and check if it fits into range of codecs */ + if ((id = gsm0503_tch_ahs_decode_inband(&cB0)) >= codecs) { /* Codec mode out of range, return id */ return id; } @@ -2851,10 +2904,12 @@ out: /* Change codec request / indication, if frame is valid */ - if (codec_mode_req) - *cmr = id; - else - *ft = id; + if (id != -1) { + if (codec_mode_req) + *cmr = id; + else + *ft = id; + } return len; }
View file
libosmocore_1.6.0.tar.xz/src/coding/gsm0503_interleaving.c -> libosmocore_1.7.0.tar.xz/src/coding/gsm0503_interleaving.c
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/coding/gsm0503_mapping.c -> libosmocore_1.7.0.tar.xz/src/coding/gsm0503_mapping.c
Changed
@@ -15,10 +15,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/coding/gsm0503_parity.c -> libosmocore_1.7.0.tar.xz/src/coding/gsm0503_parity.c
Changed
@@ -15,10 +15,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/coding/gsm0503_tables.c -> libosmocore_1.7.0.tar.xz/src/coding/gsm0503_tables.c
Changed
@@ -15,10 +15,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/coding/libosmocoding.map -> libosmocore_1.7.0.tar.xz/src/coding/libosmocoding.map
Changed
@@ -123,6 +123,8 @@ gsm0503_amr_dtx_frame_name; gsm0503_detect_afs_dtx_frame; gsm0503_detect_ahs_dtx_frame; +gsm0503_detect_afs_dtx_frame2; +gsm0503_detect_ahs_dtx_frame2; local: *; };
View file
libosmocore_1.6.0.tar.xz/src/context.c -> libosmocore_1.7.0.tar.xz/src/context.c
Changed
@@ -15,11 +15,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include <string.h> #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/conv.c -> libosmocore_1.7.0.tar.xz/src/conv.c
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*! \addtogroup conv @@ -67,7 +63,7 @@ /* Count punctured bits */ if (code->puncture) { - for (pbits=0; code->puncturepbits >= 0; pbits++); + for (pbits = 0; code->puncturepbits >= 0; pbits++) {} out_len -= pbits; } @@ -85,7 +81,7 @@ */ void osmo_conv_encode_init(struct osmo_conv_encoder *encoder, - const struct osmo_conv_code *code) + const struct osmo_conv_code *code) { memset(encoder, 0x00, sizeof(struct osmo_conv_encoder)); OSMO_ASSERT(code != NULL); @@ -94,12 +90,12 @@ void osmo_conv_encode_load_state(struct osmo_conv_encoder *encoder, - const ubit_t *input) + const ubit_t *input) { int i; uint8_t state = 0; - for (i=0; i<(encoder->code->K-1); i++) + for (i = 0; i < (encoder->code->K - 1); i++) state = (state << 1) | inputi; encoder->state = state; @@ -107,15 +103,14 @@ static inline int _conv_encode_do_output(struct osmo_conv_encoder *encoder, - uint8_t out, ubit_t *output) + uint8_t out, ubit_t *output) { const struct osmo_conv_code *code = encoder->code; int o_idx = 0; int j; if (code->puncture) { - for (j=0; j<code->N; j++) - { + for (j = 0; j < code->N; j++) { int bit_no = code->N - j - 1; int r_idx = encoder->i_idx * code->N + j; @@ -125,8 +120,7 @@ outputo_idx++ = (out >> bit_no) & 1; } } else { - for (j=0; j<code->N; j++) - { + for (j = 0; j < code->N; j++) { int bit_no = code->N - j - 1; outputo_idx++ = (out >> bit_no) & 1; } @@ -137,7 +131,7 @@ int osmo_conv_encode_raw(struct osmo_conv_encoder *encoder, - const ubit_t *input, ubit_t *output, int n) + const ubit_t *input, ubit_t *output, int n) { const struct osmo_conv_code *code = encoder->code; uint8_t state; @@ -147,11 +141,11 @@ o_idx = 0; state = encoder->state; - for (i=0; i<n; i++) { + for (i = 0; i < n; i++) { int bit = inputi; uint8_t out; - out = code->next_outputstatebit; + out = code->next_outputstatebit; state = code->next_statestatebit; o_idx += _conv_encode_do_output(encoder, out, &outputo_idx); @@ -165,8 +159,7 @@ } int -osmo_conv_encode_flush(struct osmo_conv_encoder *encoder, - ubit_t *output) +osmo_conv_encode_flush(struct osmo_conv_encoder *encoder, ubit_t *output) { const struct osmo_conv_code *code = encoder->code; uint8_t state; @@ -179,14 +172,14 @@ o_idx = 0; state = encoder->state; - for (i=0; i<n; i++) { + for (i = 0; i < n; i++) { uint8_t out; if (code->next_term_output) { - out = code->next_term_outputstate; + out = code->next_term_outputstate; state = code->next_term_statestate; } else { - out = code->next_outputstate0; + out = code->next_outputstate0; state = code->next_statestate0; } @@ -212,7 +205,7 @@ */ int osmo_conv_encode(const struct osmo_conv_code *code, - const ubit_t *input, ubit_t *output) + const ubit_t *input, ubit_t *output) { struct osmo_conv_encoder encoder; int l; @@ -242,17 +235,18 @@ /* Forward declaration for accerlated decoding with certain codes */ int osmo_conv_decode_acc(const struct osmo_conv_code *code, - const sbit_t *input, ubit_t *output); + const sbit_t *input, ubit_t *output); void osmo_conv_decode_init(struct osmo_conv_decoder *decoder, - const struct osmo_conv_code *code, int len, int start_state) + const struct osmo_conv_code *code, int len, + int start_state) { int n_states; /* Init */ if (len <= 0) - len = code->len; + len = code->len; n_states = 1 << (code->K - 1); @@ -263,7 +257,7 @@ decoder->len = len; /* Allocate arrays */ - decoder->ae = malloc(sizeof(unsigned int) * n_states); + decoder->ae = malloc(sizeof(unsigned int) * n_states); decoder->ae_next = malloc(sizeof(unsigned int) * n_states); decoder->state_history = malloc(sizeof(uint8_t) * n_states * (len + decoder->code->K - 1)); @@ -287,7 +281,7 @@ memset(decoder->ae, 0x00, sizeof(unsigned int) * decoder->n_states); } else { /* Fixed start state */ - for (i=0; i<decoder->n_states; i++) { + for (i = 0; i < decoder->n_states; i++) { decoder->aei = (i == start_state) ? 0 : MAX_AE; } } @@ -304,12 +298,12 @@ decoder->p_idx = 0; /* Initial error normalize (remove constant) */ - for (i=0; i<decoder->n_states; i++) { + for (i = 0; i < decoder->n_states; i++) { if (decoder->aei < min_ae) min_ae = decoder->aei; } - for (i=0; i<decoder->n_states; i++) + for (i = 0; i < decoder->n_states; i++) decoder->aei -= min_ae; } @@ -325,7 +319,7 @@ int osmo_conv_decode_scan(struct osmo_conv_decoder *decoder, - const sbit_t *input, int n) + const sbit_t *input, int n) { const struct osmo_conv_code *code = decoder->code; @@ -342,27 +336,25 @@ /* Prepare */ n_states = decoder->n_states; - ae = decoder->ae; + ae = decoder->ae; ae_next = decoder->ae_next; state_history = &decoder->state_historyn_states * decoder->o_idx; - in_sym = alloca(sizeof(sbit_t) * code->N); + in_sym = alloca(sizeof(sbit_t) * code->N); i_idx = 0; p_idx = decoder->p_idx; /* Scan the treillis */ - for (i=0; i<n; i++) - { + for (i = 0; i < n; i++) { /* Reset next accumulated error */ - for (s=0; s<n_states; s++) { + for (s = 0; s < n_states; s++) ae_nexts = MAX_AE; - } /* Get input */ if (code->puncture) { /* Hard way ... */ - for (j=0; j<code->N; j++) { + for (j = 0; j < code->N; j++) { int idx = ((decoder->o_idx + i) * code->N) + j; if (idx == code->puncturep_idx) { in_symj = 0; /* Undefined */ @@ -379,23 +371,21 @@ } /* Scan all state */ - for (s=0; s<n_states; s++) - { + for (s = 0; s < n_states; s++) { /* Scan possible input bits */ - for (b=0; b<2; b++) - { + for (b = 0; b < 2; b++) { int nae, ov, e; uint8_t m; /* Next output and state */ - uint8_t out = code->next_outputsb; + uint8_t out = code->next_outputsb; uint8_t state = code->next_statesb; /* New error for this path */ nae = aes; /* start from last error */ m = 1 << (code->N - 1); /* mask for 'out' bit selection */ - for (j=0; j<code->N; j++) { + for (j = 0; j < code->N; j++) { int is = (int)in_symj; if (is) { ov = (out & m) ? -127 : 127; /* sbit_t value for it */ @@ -425,8 +415,7 @@ } int -osmo_conv_decode_flush(struct osmo_conv_decoder *decoder, - const sbit_t *input) +osmo_conv_decode_flush(struct osmo_conv_decoder *decoder, const sbit_t *input) { const struct osmo_conv_code *code = decoder->code; @@ -443,27 +432,25 @@ /* Prepare */ n_states = decoder->n_states; - ae = decoder->ae; + ae = decoder->ae; ae_next = decoder->ae_next; state_history = &decoder->state_historyn_states * decoder->o_idx; - in_sym = alloca(sizeof(sbit_t) * code->N); + in_sym = alloca(sizeof(sbit_t) * code->N); i_idx = 0; p_idx = decoder->p_idx; /* Scan the treillis */ - for (i=0; i<code->K-1; i++) - { + for (i = 0; i < code->K - 1; i++) { /* Reset next accumulated error */ - for (s=0; s<n_states; s++) { + for (s = 0; s < n_states; s++) ae_nexts = MAX_AE; - } /* Get input */ if (code->puncture) { /* Hard way ... */ - for (j=0; j<code->N; j++) { + for (j = 0; j < code->N; j++) { int idx = ((decoder->o_idx + i) * code->N) + j; if (idx == code->puncturep_idx) { in_symj = 0; /* Undefined */ @@ -480,8 +467,7 @@ } /* Scan all state */ - for (s=0; s<n_states; s++) - { + for (s = 0; s < n_states; s++) { int nae, ov, e; uint8_t m; @@ -490,10 +476,10 @@ uint8_t state; if (code->next_term_output) { - out = code->next_term_outputs; + out = code->next_term_outputs; state = code->next_term_states; } else { - out = code->next_outputs0; + out = code->next_outputs0; state = code->next_states0; } @@ -501,7 +487,7 @@ nae = aes; /* start from last error */ m = 1 << (code->N - 1); /* mask for 'out' bit selection */ - for (j=0; j<code->N; j++) { + for (j = 0; j < code->N; j++) { int is = (int)in_symj; if (is) { ov = (out & m) ? -127 : 127; /* sbit_t value for it */ @@ -530,38 +516,86 @@ } int -osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder, - ubit_t *output, int has_flush, int end_state) +osmo_conv_decode_get_best_end_state(struct osmo_conv_decoder *decoder) { const struct osmo_conv_code *code = decoder->code; - int min_ae; - uint8_t min_state, cur_state; - int i, s, n; + int min_ae, min_state; + int s; - uint8_t *sh_ptr; + /* If flushed, we _know_ the end state */ + if (code->term == CONV_TERM_FLUSH) + return 0; - /* End state ? */ - if (end_state < 0) { - /* Find state with least error */ - min_ae = MAX_AE; - min_state = 0xff; + /* Search init */ + min_state = -1; + min_ae = MAX_AE; - for (s=0; s<decoder->n_states; s++) - { + /* If tail biting, we search for the minimum path metric that + * gives a circular traceback (i.e. start_state == end_state */ + if (code->term == CONV_TERM_TAIL_BITING) { + int t, n, i; + uint8_t *sh_ptr; + + for (s = 0; s < decoder->n_states; s++) { + /* Check if that state traces back to itself */ + n = decoder->o_idx; + sh_ptr = &decoder->state_historydecoder->n_states * (n-1); + t = s; + + for (i = n - 1; i >= 0; i--) { + t = sh_ptrt; + sh_ptr -= decoder->n_states; + } + + if (s != t) + continue; + + /* If it does, consider it */ if (decoder->aes < min_ae) { min_ae = decoder->aes; min_state = s; } } - if (min_state == 0xff) - return -1; - } else { - min_state = (uint8_t) end_state; - min_ae = decoder->aeend_state; + if (min_ae < MAX_AE) + return min_state; + } + + /* Finally, just the lowest path metric */ + for (s = 0; s < decoder->n_states; s++) { + /* Is it smaller ? */ + if (decoder->aes < min_ae) { + min_ae = decoder->aes; + min_state = s; + } } + return min_state; +} + +int +osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder, + ubit_t *output, int has_flush, int end_state) +{ + const struct osmo_conv_code *code = decoder->code; + + int min_ae; + uint8_t min_state, cur_state; + int i, n; + + uint8_t *sh_ptr; + + /* End state ? */ + if (end_state < 0) + end_state = osmo_conv_decode_get_best_end_state(decoder); + + if (end_state < 0) + return -1; + + min_state = (uint8_t) end_state; + min_ae = decoder->aeend_state; + /* Traceback */ cur_state = min_state; @@ -571,16 +605,15 @@ /* No output for the K-1 termination input bits */ if (has_flush) { - for (i=0; i<code->K-1; i++) { + for (i = 0; i < code->K - 1; i++) { cur_state = sh_ptrcur_state; sh_ptr -= decoder->n_states; } n -= code->K - 1; } - /* Generate output backward */ - for (i=n-1; i>=0; i--) - { + /* Generate output backward */ + for (i = n - 1; i >= 0; i--) { min_state = cur_state; cur_state = sh_ptrcur_state; @@ -602,12 +635,12 @@ * * This is an all-in-one function, taking care of * \ref osmo_conv_decode_init, \ref osmo_conv_decode_scan, - * \ref osmo_conv_decode_flush, \ref osmo_conv_decode_get_output and - * \ref osmo_conv_decode_deinit. + * \ref osmo_conv_decode_flush, \ref osmo_conv_decode_get_best_end_state, + * \ref osmo_conv_decode_get_output and \ref osmo_conv_decode_deinit. */ int osmo_conv_decode(const struct osmo_conv_code *code, - const sbit_t *input, ubit_t *output) + const sbit_t *input, ubit_t *output) { struct osmo_conv_decoder decoder; int rv, l; @@ -630,7 +663,7 @@ rv = osmo_conv_decode_get_output(&decoder, output, code->term == CONV_TERM_FLUSH, /* has_flush */ - code->term == CONV_TERM_FLUSH ? 0 : -1 /* end_state */ + -1 /* end_state */ ); osmo_conv_decode_deinit(&decoder);
View file
libosmocore_1.6.0.tar.xz/src/conv_acc.c -> libosmocore_1.7.0.tar.xz/src/conv_acc.c
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdlib.h> @@ -487,10 +483,27 @@ */ static int traceback(struct vdecoder *dec, uint8_t *out, int term, int len) { - int i, sum, max = -1; - unsigned path, state = 0; + int i, j, sum, max = -1; + unsigned path, state = 0, state_scan; - if (term != CONV_TERM_FLUSH) { + if (term == CONV_TERM_TAIL_BITING) { + for (i = 0; i < dec->trellis.num_states; i++) { + state_scan = i; + for (j = len - 1; j >= 0; j--) { + path = dec->pathsjstate_scan + 1; + state_scan = vstate_lshift(state_scan, dec->k, path); + } + if (state_scan != i) + continue; + sum = dec->trellis.sumsi; + if (sum > max) { + max = sum; + state = i; + } + } + } + + if ((max < 0) && (term != CONV_TERM_FLUSH)) { for (i = 0; i < dec->trellis.num_states; i++) { sum = dec->trellis.sumsi; if (sum > max) {
View file
libosmocore_1.6.0.tar.xz/src/conv_acc_generic.c -> libosmocore_1.7.0.tar.xz/src/conv_acc_generic.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdlib.h>
View file
libosmocore_1.6.0.tar.xz/src/conv_acc_neon.c -> libosmocore_1.7.0.tar.xz/src/conv_acc_neon.c
Changed
@@ -18,10 +18,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdlib.h>
View file
libosmocore_1.6.0.tar.xz/src/conv_acc_neon_impl.h -> libosmocore_1.7.0.tar.xz/src/conv_acc_neon_impl.h
Changed
@@ -18,10 +18,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* Some distributions (notably Alpine Linux) for some strange reason
View file
libosmocore_1.6.0.tar.xz/src/conv_acc_sse.c -> libosmocore_1.7.0.tar.xz/src/conv_acc_sse.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/conv_acc_sse_avx.c -> libosmocore_1.7.0.tar.xz/src/conv_acc_sse_avx.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/conv_acc_sse_impl.h -> libosmocore_1.7.0.tar.xz/src/conv_acc_sse_impl.h
Changed
@@ -18,10 +18,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* Some distributions (notably Alpine Linux) for some strange reason
View file
libosmocore_1.6.0.tar.xz/src/counter.c -> libosmocore_1.7.0.tar.xz/src/counter.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h>
View file
libosmocore_1.6.0.tar.xz/src/crcXXgen.c.tpl -> libosmocore_1.7.0.tar.xz/src/crcXXgen.c.tpl
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*! \addtogroup crc
View file
libosmocore_1.6.0.tar.xz/src/ctrl/Makefile.am -> libosmocore_1.7.0.tar.xz/src/ctrl/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=6:0:6 +LIBVERSION=7:0:7 AM_CFLAGS = -Wall $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS)
View file
libosmocore_1.6.0.tar.xz/src/ctrl/control_cmd.c -> libosmocore_1.7.0.tar.xz/src/ctrl/control_cmd.c
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <ctype.h>
View file
libosmocore_1.6.0.tar.xz/src/ctrl/control_if.c -> libosmocore_1.7.0.tar.xz/src/ctrl/control_if.c
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h"
View file
libosmocore_1.6.0.tar.xz/src/ctrl/control_vty.c -> libosmocore_1.7.0.tar.xz/src/ctrl/control_vty.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdlib.h>
View file
libosmocore_1.6.0.tar.xz/src/exec.c -> libosmocore_1.7.0.tar.xz/src/exec.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h"
View file
libosmocore_1.6.0.tar.xz/src/fsm.c -> libosmocore_1.7.0.tar.xz/src/fsm.c
Changed
@@ -14,11 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/gb/Makefile.am -> libosmocore_1.7.0.tar.xz/src/gb/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=13:0:1 +LIBVERSION=14:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} -fno-strict-aliasing \
View file
libosmocore_1.6.0.tar.xz/src/gb/bssgp_bvc_fsm.c -> libosmocore_1.7.0.tar.xz/src/gb/bssgp_bvc_fsm.c
Changed
@@ -375,6 +375,7 @@ struct bvc_fsm_priv *bfp = fi->priv; const struct tlv_parsed *tp = NULL; struct msgb *rx = NULL, *tx; + uint8_t cause; switch (event) { case BSSGP_BVCFSM_E_RX_RESET: @@ -385,6 +386,7 @@ /* fall-through */ case BSSGP_BVCFSM_E_RX_RESET_ACK: rx = data; + cause = bfp->last_reset_cause; tp = (const struct tlv_parsed *) msgb_bcid(rx); if (bfp->bvci == 0) update_negotiated_features(fi, tp); @@ -398,6 +400,8 @@ osmo_fsm_inst_state_chg(fi, BSSGP_BVCFSM_S_BLOCKED, T1_SECS, T1); } else osmo_fsm_inst_state_chg(fi, BSSGP_BVCFSM_S_UNBLOCKED, 0, 0); + if (bfp->ops && bfp->ops->reset_ack_notification) + bfp->ops->reset_ack_notification(bfp->nsei, bfp->bvci, &bfp->ra_id, bfp->cell_id, cause, bfp->ops_priv); break; } } @@ -415,8 +419,8 @@ rx = data; tp = (const struct tlv_parsed *) msgb_bcid(rx); /* If BVC-UNBLOCK-ACK PDU is received by an BSS for the signalling BVC, the PDU is ignored. */ - LOGPFSML(fi, LOGL_ERROR, "Rx BVC-UNBLOCK-ACK on BVCI=0 is illegal\n"); if (bfp->bvci == 0) { + LOGPFSML(fi, LOGL_ERROR, "Rx BVC-UNBLOCK-ACK on BVCI=0 is illegal\n"); if (!bfp->role_sgsn) break; _tx_status(fi, BSSGP_CAUSE_SEM_INCORR_PDU, rx);
View file
libosmocore_1.6.0.tar.xz/src/gsm/Makefile.am -> libosmocore_1.7.0.tar.xz/src/gsm/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=17:0:0 +LIBVERSION=18:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(TALLOC_CFLAGS) AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN} @@ -33,7 +33,7 @@ gsup.c gsup_sms.c gprs_gea.c gsm0503_conv.c oap.c gsm0808_utils.c \ gsm23003.c gsm23236.c mncc.c bts_features.c oap_client.c \ gsm29118.c gsm48_rest_octets.c cbsp.c gsm48049.c i460_mux.c \ - gad.c bsslap.c bssmap_le.c kdf.c + gad.c bsslap.c bssmap_le.c kdf.c iuup.c libgsmint_la_LDFLAGS = -no-undefined libgsmint_la_LIBADD = $(top_builddir)/src/libosmocore.la
View file
libosmocore_1.6.0.tar.xz/src/gsm/a5.c -> libosmocore_1.7.0.tar.xz/src/gsm/a5.c
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*! \addtogroup a5
View file
libosmocore_1.6.0.tar.xz/src/gsm/apn.c -> libosmocore_1.7.0.tar.xz/src/gsm/apn.c
Changed
@@ -24,8 +24,8 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> -#include <talloc.h> +#include <osmocom/core/talloc.h> #include <osmocom/gsm/apn.h> #define APN_OI_GPRS_FMT "mnc%03u.mcc%03u.gprs"
View file
libosmocore_1.6.0.tar.xz/src/gsm/auth_comp128v1.c -> libosmocore_1.7.0.tar.xz/src/gsm/auth_comp128v1.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/crypt/auth.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/auth_comp128v23.c -> libosmocore_1.7.0.tar.xz/src/gsm/auth_comp128v23.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/crypt/auth.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/auth_core.c -> libosmocore_1.7.0.tar.xz/src/gsm/auth_core.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h"
View file
libosmocore_1.6.0.tar.xz/src/gsm/auth_milenage.c -> libosmocore_1.7.0.tar.xz/src/gsm/auth_milenage.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/crypt/auth.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/auth_xor.c -> libosmocore_1.7.0.tar.xz/src/gsm/auth_xor.c
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/bsslap.c -> libosmocore_1.7.0.tar.xz/src/gsm/bsslap.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/bssmap_le.c -> libosmocore_1.7.0.tar.xz/src/gsm/bssmap_le.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h> @@ -265,6 +261,57 @@ } } +/*! Encode full BSSMAP-LE LCS Priority IE, including IEI tag and length. + * \paraminout msg Message buffer to append to. + * \paramin priority Value to enconde. + * \returns length of bytes written to the msgb. + */ +static uint8_t osmo_bssmap_le_ie_enc_lcs_priority(struct msgb *msg, uint8_t priority) +{ + OSMO_ASSERT(msg); + msgb_put_u8(msg, BSSMAP_LE_IEI_LCS_PRIORITY); + /* length */ + msgb_put_u8(msg, 1); + msgb_put_u8(msg, priority); + return 3; +} + +static int osmo_bssmap_le_ie_dec_lcs_priority(uint8_t *priority, + enum bssmap_le_msgt msgt, enum bssmap_le_iei iei, + struct osmo_bssmap_le_err **err, void *err_ctx, + const uint8_t *elem, uint8_t len) +{ + if (!elem || len != 1) + DEC_ERR(-EINVAL, msgt, iei, LCS_CAUSE_UNSPECIFIED, "unexpected length"); + + *priority = elem0; + return 0; +} + +/*! Encode full BSSMAP-LE LCS QoS IE, including IEI tag and length. + * \paraminout msg Message buffer to append to. + * \paramin priority Value to enconde. + * \returns length of bytes written to the msgb. + */ +static uint8_t osmo_bssmap_le_ie_enc_lcs_qos(struct msgb *msg, const struct osmo_bssmap_le_lcs_qos *qos) +{ + OSMO_ASSERT(msg); + msgb_tlv_put(msg, BSSMAP_LE_IEI_LCS_QoS, sizeof(*qos), (const uint8_t *)qos); + return 2 + sizeof(*qos); +} + +static int osmo_bssmap_le_ie_dec_lcs_qos(struct osmo_bssmap_le_lcs_qos *qos, + enum bssmap_le_msgt msgt, enum bssmap_le_iei iei, + struct osmo_bssmap_le_err **err, void *err_ctx, + const uint8_t *elem, uint8_t len) +{ + if (!elem || len != sizeof(*qos)) + DEC_ERR(-EINVAL, msgt, iei, LCS_CAUSE_UNSPECIFIED, "unexpected length"); + + memcpy(qos, elem, len); + return 0; +} + /*! Encode the value part of 3GPP TS 49.031 10.13 LCS Cause, without IEI and len. * Identically used in 3GPP TS 48.008 3.2.2.66. Usage example: * @@ -476,6 +523,12 @@ if (params->lcs_client_type_present) osmo_bssmap_le_ie_enc_lcs_client_type(msg, params->lcs_client_type); + if (params->more_items && params->lcs_priority_present) + osmo_bssmap_le_ie_enc_lcs_priority(msg, params->lcs_priority); + + if (params->more_items && params->lcs_qos_present) + osmo_bssmap_le_ie_enc_lcs_qos(msg, ¶ms->lcs_qos); + if (params->apdu_present) { int rc = osmo_bssmap_le_ie_enc_apdu(msg, ¶ms->apdu); if (rc < 0) @@ -513,11 +566,18 @@ ¶ms->cell_id); DEC_IE_OPTIONAL_FLAG(msgt, BSSMAP_LE_IEI_LCS_CLIENT_TYPE, osmo_bssmap_le_ie_dec_lcs_client_type, ¶ms->lcs_client_type, params->lcs_client_type_present); + DEC_IE_OPTIONAL_FLAG(msgt, BSSMAP_LE_IEI_LCS_PRIORITY, osmo_bssmap_le_ie_dec_lcs_priority, + ¶ms->lcs_priority, params->lcs_priority_present); + DEC_IE_OPTIONAL_FLAG(msgt, BSSMAP_LE_IEI_LCS_QoS, osmo_bssmap_le_ie_dec_lcs_qos, + ¶ms->lcs_qos, params->lcs_qos_present); DEC_IE_OPTIONAL_FLAG(msgt, BSSMAP_LE_IEI_APDU, osmo_bssmap_le_ie_dec_apdu, ¶ms->apdu, params->apdu_present); DEC_IE_OPTIONAL(msgt, BSSMAP_LE_IEI_IMSI, osmo_bssmap_le_ie_dec_imsi, ¶ms->imsi); DEC_IE_OPTIONAL(msgt, BSSMAP_LE_IEI_IMEI, osmo_bssmap_le_ie_dec_imei, ¶ms->imei); + if (params->lcs_priority_present || params->lcs_qos_present) + params->more_items = true; + return 0; }
View file
libosmocore_1.6.0.tar.xz/src/gsm/bts_features.c -> libosmocore_1.7.0.tar.xz/src/gsm/bts_features.c
Changed
@@ -14,11 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include <osmocom/gsm/bts_features.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/cbsp.c -> libosmocore_1.7.0.tar.xz/src/gsm/cbsp.c
Changed
@@ -15,10 +15,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" @@ -1481,4 +1477,25 @@ return rc; } +/*! value_string for enum osmo_cbsp_cause. */ +const struct value_string osmo_cbsp_cause_names = { + { OSMO_CBSP_CAUSE_PARAM_NOT_RECOGNISED, "Parameter-not-recognised" }, + { OSMO_CBSP_CAUSE_PARAM_VALUE_INVALID, "Parameter-value-invalid" }, + { OSMO_CBSP_CAUSE_MSG_REF_NOT_IDENTIFIED, "Message-reference-not-identified" }, + { OSMO_CBSP_CAUSE_CELL_ID_NOT_VALID, "Cell-identity-not-valid" }, + { OSMO_CBSP_CAUSE_UNRECOGNISED_MESSAGE, "Unrecognised-message" }, + { OSMO_CBSP_CAUSE_MISSING_MANDATORY_ELEMENT, "Missing-mandatory-element" }, + { OSMO_CBSP_CAUSE_BSC_CAPACITY_EXCEEDED, "BSC-capacity-exceeded" }, + { OSMO_CBSP_CAUSE_CELL_MEMORY_EXCEEDED, "Cell-memory-exceeded" }, + { OSMO_CBSP_CAUSE_BSC_MEMORY_EXCEEDED, "BSC-memory-exceeded" }, + { OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_SUPPORTED, "Cell-broadcast-not-supported" }, + { OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_OPERATIONAL, "Cell-broadcast-not-operational" }, + { OSMO_CBSP_CAUSE_INCOMPATIBLE_DRX_PARAM, "Incompatible-DRX-parameter:"}, + { OSMO_CBSP_CAUSE_EXT_CHAN_NOT_SUPPORTED, "Extended-channel-not-supported"}, + { OSMO_CBSP_CAUSE_MSG_REF_ALREADY_USED, "Message-reference-already-used"}, + { OSMO_CBSP_CAUSE_UNSPECIFIED_ERROR, "Unspecified-error"}, + { OSMO_CBSP_CAUSE_LAI_OR_LAC_NOT_VALID, "LAI-or-LAC-not-valid"}, + { 0, NULL } +}; + #endif /* HAVE_SYS_SOCKET_H */
View file
libosmocore_1.6.0.tar.xz/src/gsm/comp128.c -> libosmocore_1.7.0.tar.xz/src/gsm/comp128.c
Changed
@@ -58,10 +58,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/comp128v23.c -> libosmocore_1.7.0.tar.xz/src/gsm/comp128v23.c
Changed
@@ -23,10 +23,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gea.c -> libosmocore_1.7.0.tar.xz/src/gsm/gea.c
Changed
@@ -12,10 +12,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <osmocom/core/bits.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gprs_cipher_core.c -> libosmocore_1.7.0.tar.xz/src/gsm/gprs_cipher_core.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h"
View file
libosmocore_1.6.0.tar.xz/src/gsm/gprs_gea.c -> libosmocore_1.7.0.tar.xz/src/gsm/gprs_gea.c
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <osmocom/crypt/gprs_cipher.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm0341.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm0341.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm0480.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm0480.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/gsm/gsm48.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm0808.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm0808.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h> @@ -1049,6 +1045,12 @@ if (params->aoip_transport_layer) gsm0808_enc_aoip_trasp_addr(msg, params->aoip_transport_layer); + /* AoIP: add Codec List (BSS Supported) 3.2.2.103. + * (codec_list_bss_supported was added to struct gsm0808_handover_request_ack later than speech_codec_chosen + * below, but it needs to come before it in the message coding). */ + if (params->more_items && params->codec_list_bss_supported.len) + gsm0808_enc_speech_codec_list(msg, ¶ms->codec_list_bss_supported); + /* AoIP: Speech Codec (Chosen) 3.2.2.104 */ if (params->speech_codec_chosen_present) gsm0808_enc_speech_codec(msg, ¶ms->speech_codec_chosen); @@ -1523,6 +1525,7 @@ GSM0808_IE_LOCATION_ESTIMATE = { TLV_TYPE_TLV }, GSM0808_IE_POSITIONING_DATA = { TLV_TYPE_TLV }, GSM0808_IE_LCS_CAUSE = { TLV_TYPE_TLV }, + GSM0808_IE_LCS_CLIENT_TYPE = { TLV_TYPE_TLV }, GSM0808_IE_APDU = { TLV_TYPE_TLV }, GSM0808_IE_NETWORK_ELEMENT_IDENTITY = { TLV_TYPE_TLV }, GSM0808_IE_GPS_ASSISTANCE_DATA = { TLV_TYPE_TLV }, @@ -1539,6 +1542,7 @@ GSM0800_IE_INTER_SYSTEM_INFO = { TLV_TYPE_TLV }, GSM0808_IE_SNA_ACCESS_INFO = { TLV_TYPE_TLV }, GSM0808_IE_VSTK_RAND_INFO = { TLV_TYPE_TLV }, + GSM0808_IE_VSTK_INFO = { TLV_TYPE_TLV }, GSM0808_IE_PAGING_INFO = { TLV_TYPE_TV }, GSM0808_IE_IMEI = { TLV_TYPE_TLV }, GSM0808_IE_VELOCITY_ESTIMATE = { TLV_TYPE_TLV }, @@ -1581,6 +1585,11 @@ GSM0808_IE_CN_TO_MS_TRANSP_INFO = { TLV_TYPE_TLV }, GSM0808_IE_SELECTED_PLMN_ID = { TLV_TYPE_FIXED, 3 }, GSM0808_IE_LAST_USED_EUTRAN_PLMN_ID = { TLV_TYPE_FIXED, 3 }, + GSM0808_IE_OLD_LAI = { TLV_TYPE_FIXED, 5 }, + GSM0808_IE_ATTACH_INDICATOR = { TLV_TYPE_T }, + GSM0808_IE_SELECTED_OPERATOR = { TLV_TYPE_FIXED, 3 }, + GSM0808_IE_PS_REGISTERED_OPERATOR = { TLV_TYPE_FIXED, 3 }, + GSM0808_IE_CS_REGISTERED_OPERATOR = { TLV_TYPE_FIXED, 3 }, /* Osmocom extensions */ GSM0808_IE_OSMO_OSMUX_SUPPORT = { TLV_TYPE_T },
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm0808_utils.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm0808_utils.c
Changed
@@ -831,6 +831,10 @@ dst->lai.lac = u->lac; return; + case CELL_IDENT_SAI: + dst->lai = u->sai.lai; + return; + case CELL_IDENT_NO_CELL: case CELL_IDENT_BSS: case CELL_IDENT_UTRAN_PLMN_LAC_RNC: @@ -858,6 +862,8 @@ case CELL_IDENT_BSS: case CELL_IDENT_NO_CELL: return 0; + case CELL_IDENT_SAI: + return 7; case CELL_IDENT_WHOLE_GLOBAL_PS: return 8; default: @@ -904,6 +910,12 @@ case CELL_IDENT_NO_CELL: /* Does not have any list items */ break; + case CELL_IDENT_SAI: + if (len < 7) + return -EINVAL; + decode_lai(buf, &out->sai.lai); + out->sai.sac = osmo_load16be(buf + sizeof(struct gsm48_loc_area_id)); + break; case CELL_IDENT_WHOLE_GLOBAL_PS: /* 3GPP TS 48.018 sec 11.3.9 "Cell Identifier" */ if (len < 8) @@ -953,6 +965,16 @@ case CELL_IDENT_NO_CELL: /* Does not have any list items */ break; + + case CELL_IDENT_SAI: { + const struct osmo_service_area_id *id = &u->sai; + struct gsm48_loc_area_id lai; + gsm48_generate_lai2(&lai, &id->lai); + memcpy(msgb_put(msg, sizeof(lai)), &lai, sizeof(lai)); + msgb_put_u16(msg, id->sac); + break; + } + case CELL_IDENT_WHOLE_GLOBAL_PS: { /* 3GPP TS 48.018 sec 11.3.9 "Cell Identifier" */ const struct osmo_cell_global_id_ps *id = &u->global_ps; @@ -1166,6 +1188,31 @@ return i; } +static int parse_cell_id_sai_list(struct gsm0808_cell_id_list2 *cil, const uint8_t *data, size_t remain, size_t *consumed) +{ + struct osmo_service_area_id *id; + uint16_t *sac_be; + size_t lai_offset; + int i = 0; + const size_t elemlen = sizeof(struct gsm48_loc_area_id) + sizeof(*sac_be); + + *consumed = 0; + while (remain >= elemlen) { + if (i >= GSM0808_CELL_ID_LIST2_MAXLEN) + return -ENOSPC; + id = &cil->id_listi.sai; + lai_offset = i * elemlen; + decode_lai(&datalai_offset, &id->lai); + sac_be = (uint16_t *)(&datalai_offset + sizeof(struct gsm48_loc_area_id)); + id->sac = osmo_load16be(sac_be); + *consumed += elemlen; + remain -= elemlen; + i++; + } + + return i; +} + /*! Decode Cell Identifier List IE * \paramout cil Caller-provided memory to store Cell ID list * \paramin elem IE value to be decoded @@ -1210,6 +1257,12 @@ case CELL_IDENT_NO_CELL: /* Does not have any list items */ break; + case CELL_IDENT_SAI: + list_len = parse_cell_id_sai_list(cil, elem, len, &bytes_elem); + break; + case CELL_IDENT_UTRAN_PLMN_LAC_RNC: + case CELL_IDENT_UTRAN_RNC: + case CELL_IDENT_UTRAN_LAC_RNC: default: /* Remaining cell identification types are not implemented. */ return -EINVAL; @@ -1703,6 +1756,8 @@ return snprintf(buf, buflen, "%s", osmo_cgi_name(&u->global)); case CELL_IDENT_WHOLE_GLOBAL_PS: return snprintf(buf, buflen, "%s", osmo_cgi_ps_name(&u->global_ps)); + case CELL_IDENT_SAI: + return snprintf(buf, buflen, "%s", osmo_sai_name(&u->sai)); default: /* For CELL_IDENT_BSS and CELL_IDENT_NO_CELL, just print the discriminator. * Same for kinds we have no string representation of yet. */ @@ -1859,6 +1914,12 @@ cid->id.lac = cgi->lai.lac; return; + case CELL_IDENT_SAI: + cid->id.sai = (struct osmo_service_area_id){ + .lai = cgi->lai, + }; + return; + case CELL_IDENT_NO_CELL: case CELL_IDENT_BSS: case CELL_IDENT_UTRAN_PLMN_LAC_RNC: @@ -1905,6 +1966,10 @@ cgi->lai.lac = cid->id.lac; return OSMO_CGI_PART_LAC; + case CELL_IDENT_SAI: + cgi->lai = cid->id.sai.lai; + return OSMO_CGI_PART_PLMN | OSMO_CGI_PART_LAC; + case CELL_IDENT_NO_CELL: case CELL_IDENT_BSS: case CELL_IDENT_UTRAN_PLMN_LAC_RNC: @@ -1927,6 +1992,7 @@ { CELL_IDENT_UTRAN_PLMN_LAC_RNC, "UTRAN-PLMN-LAC-RNC" }, { CELL_IDENT_UTRAN_RNC, "UTRAN-RNC" }, { CELL_IDENT_UTRAN_LAC_RNC, "UTRAN-LAC-RNC" }, + { CELL_IDENT_SAI, "SAI" }, { CELL_IDENT_WHOLE_GLOBAL_PS, "CGI-PS"}, { 0, NULL } };
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm23003.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm23003.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <ctype.h> @@ -372,6 +368,51 @@ return osmo_cgi_ps_name_buf(buf, 32, cgi_ps); } +/*! Return MCC-MNC-LAC-SAC as string, in caller-provided output buffer. + * \paramout buf caller-allocated output buffer + * \paramin buf_len size of buf in bytes + * \paramin sai SAI to encode. + * \returns buf + */ +char *osmo_sai_name_buf(char *buf, size_t buf_len, const struct osmo_service_area_id *sai) +{ + snprintf(buf, buf_len, "%s-%u", osmo_lai_name(&sai->lai), sai->sac); + return buf; +} + +/*! Return MCC-MNC-LAC-SAC as string, in a static buffer. + * \paramin sai SAI to encode. + * \returns Static string buffer. + */ +const char *osmo_sai_name(const struct osmo_service_area_id *sai) +{ + static __thread char buf32; + return osmo_sai_name_buf(buf, sizeof(buf), sai); +} + +/*! Same as osmo_cgi_name(), but uses a different static buffer. + * Useful for printing two distinct CGIs in the same printf format. + * \paramin sai SAI to encode. + * \returns Static string buffer. + */ +const char *osmo_sai_name2(const struct osmo_service_area_id *sai) +{ + static __thread char buf32; + return osmo_sai_name_buf(buf, sizeof(buf), sai); +} + +/*! Return MCC-MNC-LAC-SAC as string, in a talloc-allocated output buffer. + * \paramin ctx talloc context from which to allocate output buffer + * \paramin sai SAI to encode. + * \returns string representation of CGI in dynamically-allocated buffer. + */ +char *osmo_sai_name_c(const void *ctx, const struct osmo_service_area_id *sai) +{ + char *buf = talloc_size(ctx, 32); + return osmo_sai_name_buf(buf, 32, sai); +} + + static void to_bcd(uint8_t *bcd, uint16_t val) { bcd2 = val % 10; @@ -449,14 +490,12 @@ } } -/* Convert given 3-byte BCD buffer to integers and write results to *mcc and - * *mnc. The first three BCD digits result in the MCC and the remaining ones in - * the MNC. Return mnc_3_digits as false if the MNC's most significant digit is encoded as 0xF, true - * otherwise; i.e. true if MNC > 99 or if it is represented with leading zeros instead of 0xF. +/* Convert given 3-byte BCD buffer to integers and write results to plmn->mcc and plmn->mnc. The first three BCD digits + * result in the MCC and the remaining ones in the MNC. Set plmn->mnc_3_digits as false if the MNC's most significant + * digit is encoded as 0xF, true otherwise; i.e. true if MNC > 99 or if it is represented with leading zeros instead of + * 0xF. * \paramin bcd_src 3-byte BCD buffer containing MCC+MNC representations. - * \paramout mcc MCC result buffer, or NULL. - * \paramout mnc MNC result buffer, or NULL. - * \paramout mnc_3_digits Result buffer for 3-digit flag, or NULL. + * \paramout plmn user provided memory to store the result. */ void osmo_plmn_from_bcd(const uint8_t *bcd_src, struct osmo_plmn_id *plmn) {
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm23236.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm23236.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm29118.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm29118.c
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <osmocom/core/utils.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm29205.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm29205.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h"
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm48.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm48.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm48_ie.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm48_ie.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/gsm/gsm_utils.c -> libosmocore_1.7.0.tar.xz/src/gsm/gsm_utils.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \mainpage libosmogsm Documentation @@ -329,12 +325,13 @@ int i = 0, z = 0; uint8_t cb, nb; int shift = 0; - uint8_t *data = calloc(septet_len + 1, sizeof(uint8_t)); + uint8_t *data = malloc(septet_len + 1); if (padding) { shift = 7 - padding; /* the first zero is needed for padding */ memcpy(data + 1, rdata, septet_len); + data0 = 0x00; septet_len++; } else memcpy(data, rdata, septet_len); @@ -388,7 +385,7 @@ size_t max_septets = n * 8 / 7; /* prepare for the worst case, every character expanding to two bytes */ - uint8_t *rdata = calloc(strlen(data) * 2, sizeof(uint8_t)); + uint8_t *rdata = malloc(strlen(data) * 2); y = gsm_septet_encode(rdata, data); if (y > max_septets) {
View file
libosmocore_1.6.0.tar.xz/src/gsm/i460_mux.c -> libosmocore_1.7.0.tar.xz/src/gsm/i460_mux.c
Changed
@@ -14,11 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include <errno.h>
View file
libosmocore_1.7.0.tar.xz/src/gsm/iuup.c
Added
@@ -0,0 +1,1062 @@ +/*! \file iu_up.c + * IuUP (Iu User Plane) according to 3GPP TS 25.415 */ +/* + * (C) 2017 by Harald Welte <laforge@gnumonks.org> + * + * SPDX-License-Identifier: GPL-2.0+ + * + * 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 <errno.h> +#include <inttypes.h> + +#include <osmocom/core/crc8gen.h> +#include <osmocom/core/crc16gen.h> +#include <osmocom/core/fsm.h> +#include <osmocom/core/prim.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/logging.h> + +#include <osmocom/gsm/prim.h> +#include <osmocom/gsm/protocol/gsm_25_415.h> +#include <osmocom/gsm/iuup.h> + +/*********************************************************************** + * CRC Calculation + ***********************************************************************/ + +/* Section 6.6.3.8 Header CRC */ +const struct osmo_crc8gen_code iuup_hdr_crc_code = { + .bits = 6, + .poly = 47, + .init = 0, + .remainder = 0, +}; + +/* Section 6.6.3.9 Payload CRC */ +const struct osmo_crc16gen_code iuup_data_crc_code = { + .bits = 10, + .poly = 563, + .init = 0, + .remainder = 0, +}; + +static int iuup_get_payload_offset(const uint8_t *iuup_pdu) +{ + uint8_t pdu_type = iuup_pdu0 >> 4; + switch (pdu_type) { + case 0: + case 14: + return 4; + case 1: + return 3; + default: + return -1; + } +} + +int osmo_iuup_compute_payload_crc(const uint8_t *iuup_pdu, unsigned int pdu_len) +{ + ubit_t buf1024*8; + uint8_t pdu_type; + int offset, payload_len_bytes; + + if (pdu_len < 1) + return -1; + + pdu_type = iuup_pdu0 >> 4; + + /* Type 1 has no CRC */ + if (pdu_type == 1) + return 0; + + offset = iuup_get_payload_offset(iuup_pdu); + if (offset < 0) + return offset; + + if (pdu_len < offset) + return -1; + + payload_len_bytes = pdu_len - offset; + osmo_pbit2ubit(buf, iuup_pdu+offset, payload_len_bytes*8); + return osmo_crc16gen_compute_bits(&iuup_data_crc_code, buf, payload_len_bytes*8); +} + +int osmo_iuup_compute_header_crc(const uint8_t *iuup_pdu, unsigned int pdu_len) +{ + ubit_t buf2*8; + + if (pdu_len < 2) + return -1; + + osmo_pbit2ubit(buf, iuup_pdu, 2*8); + return osmo_crc8gen_compute_bits(&iuup_hdr_crc_code, buf, 2*8); +} + +/*********************************************************************** + * Internal State / FSM (Annex B) + ***********************************************************************/ + +#define S(x) (1 << (x)) + +#define IUUP_TIMER_INIT 1 +#define IUUP_TIMER_TA 2 +#define IUUP_TIMER_RC 3 + +struct osmo_timer_nt { + uint32_t n; /* number of repetitions */ + struct osmo_iuup_tnl_prim *retrans_itp; + struct osmo_timer_list timer; +}; + +struct osmo_iuup_instance { + struct osmo_iuup_rnl_config config; + struct osmo_fsm_inst *fi; + + uint8_t mode_version; + + struct { + struct osmo_timer_nt init; + struct osmo_timer_nt ta; + struct osmo_timer_nt rc; + } timer; + /* call-back function to pass primitives up to the user */ + osmo_prim_cb user_prim_cb; + void *user_prim_priv; + osmo_prim_cb transport_prim_cb; + void *transport_prim_priv; + uint8_t type14_fn; /* 2 bits */ +}; + +enum iuup_fsm_state { + IUUP_FSM_ST_NULL, + IUUP_FSM_ST_INIT, + IUUP_FSM_ST_TrM_DATA_XFER_READY, + IUUP_FSM_ST_SMpSDU_DATA_XFER_READY, +}; + +enum iuup_fsm_event { + IUUP_FSM_EVT_IUUP_CONFIG_REQ, + IUUP_FSM_EVT_IUUP_DATA_REQ, + IUUP_FSM_EVT_IUUP_DATA_IND, + IUUP_FSM_EVT_IUUP_STATUS_REQ, + IUUP_FSM_EVT_IUUP_STATUS_IND, + IUUP_FSM_EVT_SSASAR_UNITDATA_REQ, + IUUP_FSM_EVT_SSASAR_UNITDATA_IND, + IUUP_FSM_EVT_IUUP_UNITDATA_REQ, + IUUP_FSM_EVT_IUUP_UNITDATA_IND, + IUUP_FSM_EVT_INIT, + IUUP_FSM_EVT_LAST_INIT_ACK, + IUUP_FSM_EVT_INIT_NACK, +}; + +static const struct value_string iuup_fsm_event_names = { + { IUUP_FSM_EVT_IUUP_CONFIG_REQ, "IuUP-CONFIG-req" }, + { IUUP_FSM_EVT_IUUP_DATA_REQ, "IuUP-DATA-req" }, + { IUUP_FSM_EVT_IUUP_DATA_IND, "IuUP-DATA-ind" }, + { IUUP_FSM_EVT_IUUP_STATUS_REQ, "IuUP-STATUS-req" }, + { IUUP_FSM_EVT_IUUP_STATUS_IND, "IuUP-STATUS-ind" }, + { IUUP_FSM_EVT_SSASAR_UNITDATA_REQ, "SSSAR-UNITDATA-req" }, + { IUUP_FSM_EVT_SSASAR_UNITDATA_IND, "SSSAR-UNITDATA-ind" }, + { IUUP_FSM_EVT_IUUP_UNITDATA_REQ, "IuUP-UNITDATA-req" }, + { IUUP_FSM_EVT_IUUP_UNITDATA_IND, "IuUP-UNITDATA-ind" }, + { IUUP_FSM_EVT_INIT, "INIT" }, + { IUUP_FSM_EVT_LAST_INIT_ACK, "LAST_INIT_ACK" }, + { IUUP_FSM_EVT_INIT_NACK, "INIT_NACK" }, + { 0, NULL } +}; + +static inline uint8_t iuup_get_pdu_type(const uint8_t *data) +{ + return data0 >> 4; +} + +static inline uint8_t iuup_get_hdr_crc(const uint8_t *data) +{ + return data2 >> 2; +} + +/* Helper functions to store non-packed structs in msgb so that pointers are properly aligned: */ +#define IUUP_MSGB_SIZE 4096 +#define PTR_ALIGNMENT_BYTES 8 +#define IUUP_MSGB_HEADROOM_MIN_REQUIRED (OSMO_MAX(sizeof(struct osmo_iuup_tnl_prim), sizeof(struct osmo_iuup_rnl_prim)) + (PTR_ALIGNMENT_BYTES - 1)) +static inline struct msgb *osmo_iuup_msgb_alloc_c(void *ctx, size_t size) +{ + osmo_static_assert(size > IUUP_MSGB_HEADROOM_MIN_REQUIRED, iuup_msgb_alloc_headroom_bigger); + return msgb_alloc_headroom_c(ctx, size, IUUP_MSGB_HEADROOM_MIN_REQUIRED, "iuup-msgb"); +} + +/* push data so that the resulting pointer to write to is aligned to 8 byte */ +static inline __attribute__((assume_aligned(PTR_ALIGNMENT_BYTES))) +unsigned char *aligned_msgb_push(struct msgb *msg, unsigned int len) +{ + uint8_t *ptr = (msgb_data(msg) - len); + size_t extra_size = ((uintptr_t)ptr & (PTR_ALIGNMENT_BYTES - 1)); + + return msgb_push(msg, len + extra_size); +} + +struct osmo_iuup_rnl_prim *osmo_iuup_rnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size) +{ + struct msgb *msg; + struct osmo_iuup_rnl_prim *irp; + + msg = osmo_iuup_msgb_alloc_c(ctx, size); + irp = (struct osmo_iuup_rnl_prim *)aligned_msgb_push(msg, sizeof(*irp)); + osmo_prim_init(&irp->oph, SAP_IUUP_RNL, primitive, operation, msg); + return irp; +} + +struct osmo_iuup_tnl_prim *osmo_iuup_tnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size) +{ + struct msgb *msg; + struct osmo_iuup_tnl_prim *itp; + + msg = osmo_iuup_msgb_alloc_c(ctx, size); + itp = (struct osmo_iuup_tnl_prim *) aligned_msgb_push(msg, sizeof(*itp)); + osmo_prim_init(&itp->oph, SAP_IUUP_TNL, primitive, operation, msg); + return itp; +} + +/* 6.6.2.3.2 */ +static struct osmo_iuup_tnl_prim *itp_ctrl_ack_alloc(struct osmo_iuup_instance *iui, enum iuup_procedure proc_ind, uint8_t fn) +{ + struct osmo_iuup_tnl_prim *itp; + struct iuup_ctrl_ack *ack; + itp = osmo_iuup_tnl_prim_alloc(iui, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + itp->oph.msg->l2h = msgb_put(itp->oph.msg, sizeof(struct iuup_ctrl_ack)); + ack = (struct iuup_ctrl_ack *) msgb_l2(itp->oph.msg); + *ack = (struct iuup_ctrl_ack){ + .hdr = { + .frame_nr = fn, + .ack_nack = IUUP_AN_ACK, + .pdu_type = IUUP_PDU_T_CONTROL, + .proc_ind = proc_ind, + .mode_version = iui->mode_version, + .payload_crc_hi = 0, + .header_crc = 0, + .payload_crc_lo = 0, + }, + }; + ack->hdr.header_crc = osmo_iuup_compute_header_crc(msgb_l2(itp->oph.msg), msgb_l2len(itp->oph.msg)); + return itp; +} + +/* 6.6.2.3.3 */ +static struct osmo_iuup_tnl_prim *tnp_ctrl_nack_alloc(struct osmo_iuup_instance *iui, enum iuup_procedure proc_ind, enum iuup_error_cause error_cause, uint8_t fn) +{ + struct osmo_iuup_tnl_prim *itp; + struct iuup_ctrl_nack *nack; + itp = osmo_iuup_tnl_prim_alloc(iui, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + itp->oph.msg->l2h = msgb_put(itp->oph.msg, sizeof(struct iuup_ctrl_nack)); + nack = (struct iuup_ctrl_nack *) msgb_l2(itp->oph.msg); + *nack = (struct iuup_ctrl_nack){ + .hdr = { + .frame_nr = fn, + .ack_nack = IUUP_AN_NACK, + .pdu_type = IUUP_PDU_T_CONTROL, + .proc_ind = proc_ind, + .mode_version = iui->mode_version, + .payload_crc_hi = 0, + .header_crc = 0, + .payload_crc_lo = 0, + }, + .spare = 0, + .error_cause = error_cause, + }; + nack->hdr.header_crc = osmo_iuup_compute_header_crc(msgb_l2(itp->oph.msg), msgb_l2len(itp->oph.msg)); + return itp; +} + +/* 6.6.2.3.4.1 */ +static struct osmo_iuup_tnl_prim *tnp_ctrl_init_alloc(struct osmo_iuup_instance *iui) +{ + struct osmo_iuup_tnl_prim *itp; + struct iuup_pdutype14_hdr *hdr; + struct iuup_ctrl_init_hdr *ihdr; + struct iuup_ctrl_init_rfci_hdr *ihdr_rfci; + struct iuup_ctrl_init_tail *itail; + unsigned int i, j; + uint16_t payload_crc; + uint8_t rfci_cnt; + struct msgb *msg; + + itp = osmo_iuup_tnl_prim_alloc(iui, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + msg = itp->oph.msg; + + msg->l2h = msgb_put(msg, sizeof(*hdr)); + hdr = (struct iuup_pdutype14_hdr *)msgb_l2(msg); + hdr->frame_nr = iui->type14_fn++; + hdr->ack_nack = IUUP_AN_PROCEDURE; + hdr->pdu_type = IUUP_PDU_T_CONTROL; + hdr->proc_ind = IUUP_PROC_INIT; + hdr->mode_version = 0; /* Use here the minimum version required to negotiate */ + hdr->header_crc = osmo_iuup_compute_header_crc(msgb_l2(msg), msgb_l2len(msg)); + + ihdr = (struct iuup_ctrl_init_hdr *)msgb_put(msg, sizeof(*ihdr)); + ihdr->chain_ind = 0; /* this frame is the last frame for the procedure. TODO: support several */ + ihdr->num_subflows_per_rfci = iui->config.num_subflows; + ihdr->ti = iui->config.IPTIs_present ? 1 : 0; + ihdr->spare = 0; + + /* RFCI + subflow size part: */ + rfci_cnt = 0; + for (i = 0; i < ARRAY_SIZE(iui->config.rfci); i++) { + bool last; + uint8_t len_size; + struct osmo_iuup_rfci *rfci = &iui->config.rfcii; + if (!rfci->used) + continue; + rfci_cnt++; + last = (rfci_cnt == iui->config.num_rfci); + + len_size = 1; + for (j = 0; j < iui->config.num_subflows; j++) { + if (rfci->subflow_sizesj > UINT8_MAX) + len_size = 2; + } + + ihdr_rfci = (struct iuup_ctrl_init_rfci_hdr *)msgb_put(msg, sizeof(*ihdr_rfci) + len_size * iui->config.num_subflows); + ihdr_rfci->rfci = rfci->id; + ihdr_rfci->li = len_size - 1; + ihdr_rfci->lri = last; + if (len_size == 2) { + uint16_t *buf = (uint16_t *)&ihdr_rfci->subflow_length0; + for (j = 0; j < iui->config.num_subflows; j++) + osmo_store16be(rfci->subflow_sizesj, buf++); + } else { + for (j = 0; j < iui->config.num_subflows; j++) + ihdr_rfci->subflow_lengthj = rfci->subflow_sizesj; + } + /* early loop termination: */ + if (last) + break; + } + /* Sanity check: */ + if (rfci_cnt != iui->config.num_rfci) { + LOGP(DLIUUP, LOGL_ERROR, "rfci_cnt %u != num_rfci %u\n", + rfci_cnt, iui->config.num_rfci); + msgb_free(msg); + return NULL; + } + + if (iui->config.IPTIs_present) { + uint8_t num_bytes = (iui->config.num_rfci + 1) / 2; + uint8_t *buf = msgb_put(msg, num_bytes); + rfci_cnt = 0; + for (i = 0; i < ARRAY_SIZE(iui->config.rfci); i++) { + struct osmo_iuup_rfci *rfci = &iui->config.rfcii; + if (!rfci->used) + continue; + if (!(rfci_cnt & 0x01)) /* is even: */ + bufrfci_cnt / 2 = (((uint8_t)rfci->IPTI) << 4); + else + bufrfci_cnt / 2 |= (rfci->IPTI & 0x0F); + rfci_cnt++; + /* early loop termination: */ + if (rfci_cnt == iui->config.num_rfci) + break; + } + } + + itail = (struct iuup_ctrl_init_tail *)msgb_put(msg, sizeof(*itail)); + osmo_store16be(iui->config.supported_versions_mask, &itail->versions_supported); + itail->spare = 0; + itail->data_pdu_type = iui->config.data_pdu_type; + + payload_crc = osmo_iuup_compute_payload_crc(msgb_l2(msg), msgb_l2len(msg)); + hdr->payload_crc_hi = (payload_crc >> 8) & 0x03; + hdr->payload_crc_lo = payload_crc & 0xff; + + + return itp; +} + +static struct osmo_iuup_rnl_prim *irp_init_ind_alloc(struct osmo_iuup_instance *iui) +{ + struct osmo_iuup_rnl_prim *irp; + + irp = osmo_iuup_rnl_prim_alloc(iui, OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + irp->u.status.procedure = IUUP_PROC_INIT; + irp->u.status.u.initialization.mode_version = iui->mode_version; + irp->u.status.u.initialization.data_pdu_type = iui->config.data_pdu_type; + irp->u.status.u.initialization.num_subflows = iui->config.num_subflows; + irp->u.status.u.initialization.num_rfci = iui->config.num_rfci; + irp->u.status.u.initialization.IPTIs_present = iui->config.IPTIs_present; + memcpy(irp->u.status.u.initialization.rfci, iui->config.rfci, sizeof(iui->config.rfci)); + return irp; +} + +/* transform a RNL data primitive into a TNL data primitive (down the stack) */ +static struct osmo_iuup_tnl_prim *rnl_to_tnl_data(struct osmo_iuup_instance *iui, + struct osmo_iuup_rnl_prim *irp) +{ + struct osmo_iuup_tnl_prim *itp; + struct osmo_iuup_rnl_data dt; + struct msgb *msg; + uint16_t payload_crc; + struct iuup_pdutype0_hdr *h0; + struct iuup_pdutype1_hdr *h1; + + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_DATA, PRIM_OP_REQUEST)); + + msg = irp->oph.msg; + dt = irp->u.data; + + /* pull up to the IuUP payload and push a new primitive header in front */ + msgb_pull_to_l3(msg); + + /* push the PDU TYPE 0 / 1 header in front of the payload */ + switch (iui->config.data_pdu_type) { + case 0: + msg->l2h = msgb_push(msg, sizeof(*h0)); + h0 = (struct iuup_pdutype0_hdr *)msg->l2h; + h0->frame_nr = dt.frame_nr; + h0->pdu_type = IUUP_PDU_T_DATA_CRC; + h0->rfci = dt.rfci; + h0->fqc = dt.fqc; + h0->header_crc = osmo_iuup_compute_header_crc(msgb_l2(msg), msgb_l2len(msg)); + payload_crc = osmo_iuup_compute_payload_crc(msgb_l2(msg), msgb_l2len(msg)); + h0->payload_crc_hi = (payload_crc >> 8) & 0x03; + h0->payload_crc_lo = payload_crc & 0xff; + break; + case 1: + msg->l2h = msgb_push(msg, sizeof(*h1)); + h1 = (struct iuup_pdutype1_hdr *)msg->l2h; + h1->frame_nr = dt.frame_nr; + h1->pdu_type = IUUP_PDU_T_DATA_NOCRC; + h1->rfci = dt.rfci; + h1->fqc = dt.fqc; + h1->header_crc = osmo_iuup_compute_header_crc(msgb_l2(msg), msgb_l2len(msg)); + h1->spare = 0; + break; + default: + OSMO_ASSERT(0); + } + + /* Avoid allocating irp out of 8byte-aligned address, Asan is not happy with it */ + itp = (struct osmo_iuup_tnl_prim *) aligned_msgb_push(msg, sizeof(*itp)); + osmo_prim_init(&itp->oph, SAP_IUUP_TNL, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST, msg); + + return itp; +} + +/* transform a TNL primitive into a RNL primitive (up the stack) */ +static struct osmo_iuup_rnl_prim *tnl_to_rnl_data(struct osmo_iuup_tnl_prim *itp) +{ + struct msgb *msg; + struct iuup_pdutype0_hdr *h0; + struct iuup_pdutype1_hdr *h1; + struct osmo_iuup_rnl_data dt; + struct osmo_iuup_rnl_prim *irp; + + msg = itp->oph.msg; + + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION)); + + switch (iuup_get_pdu_type(msgb_l2(msg))) { + case IUUP_PDU_T_DATA_CRC: + h0 = (struct iuup_pdutype0_hdr *) msgb_l2(msg); + dt.rfci = h0->rfci; + dt.frame_nr = h0->frame_nr; + dt.fqc = h0->fqc; + break; + case IUUP_PDU_T_DATA_NOCRC: + h1 = (struct iuup_pdutype1_hdr *) msgb_l2(msg); + dt.rfci = h1->rfci; + dt.frame_nr = h1->frame_nr; + dt.fqc = h1->fqc; + break; + } + + /* pull up to the IuUP payload and push a new primitive header in front */ + msgb_pull_to_l3(msg); + + /* Avoid allocating irp out of 8byte-aligned address, Asan is not happy with it */ + irp = (struct osmo_iuup_rnl_prim *) aligned_msgb_push(msg, sizeof(*irp)); + osmo_prim_init(&irp->oph, SAP_IUUP_RNL, OSMO_IUUP_RNL_DATA, PRIM_OP_INDICATION, msg); + irp->u.data = dt; + + return irp; +} + +static struct osmo_iuup_rnl_prim *irp_error_event_alloc_c(void *ctx, enum iuup_error_cause cause, enum iuup_error_distance distance) +{ + struct osmo_iuup_rnl_prim *irp; + struct msgb *msg; + msg = msgb_alloc_c(ctx, sizeof(*irp), "iuup-tx"); + irp = (struct osmo_iuup_rnl_prim *) msgb_put(msg, sizeof(*irp)); + osmo_prim_init(&irp->oph, SAP_IUUP_RNL, OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION, msg); + irp->u.status.procedure = IUUP_PROC_ERR_EVENT; + irp->u.status.u.error_event.cause = cause; + irp->u.status.u.error_event.distance = distance; + return irp; +} + +static struct osmo_iuup_tnl_prim *itp_copy_c(void *ctx, const struct osmo_iuup_tnl_prim *src_itp) +{ + struct msgb *msg; + struct osmo_iuup_tnl_prim *dst_itp; + + msg = msgb_copy_c(ctx, src_itp->oph.msg, "iuup-tx-retrans"); + dst_itp = (struct osmo_iuup_tnl_prim *)msgb_data(msg); + dst_itp->oph.msg = msg; + return dst_itp; +} + +static void retransmit_initialization(struct osmo_iuup_instance *iui) +{ + struct osmo_iuup_tnl_prim *itp; + iui->fi->T = IUUP_TIMER_INIT; + osmo_timer_schedule(&iui->fi->timer, iui->config.t_init.t_ms / 1000, (iui->config.t_init.t_ms % 1000) * 1000); + itp = itp_copy_c(iui, iui->timer.init.retrans_itp); + iui->transport_prim_cb(&itp->oph, iui->transport_prim_priv); +} + +/* return: whether the last Init was Acked correctly and hence can transition to next state */ +static bool iuup_rx_initialization(struct osmo_iuup_instance *iui, struct osmo_iuup_tnl_prim *itp) +{ + struct iuup_pdutype14_hdr *hdr; + struct iuup_ctrl_init_hdr *ihdr; + struct iuup_ctrl_init_rfci_hdr *ihdr_rfci; + struct iuup_ctrl_init_tail *itail; + enum iuup_error_cause err_cause; + uint8_t num_rfci = 0; + int i; + bool is_last; + uint16_t remote_mask, match_mask; + struct osmo_iuup_rnl_prim *irp; + struct osmo_iuup_tnl_prim *resp; + + /* TODO: whenever we check message boundaries, length, etc. and we fail, send NACK */ + + hdr = (struct iuup_pdutype14_hdr *)msgb_l2(itp->oph.msg); + ihdr = (struct iuup_ctrl_init_hdr *)hdr->payload; + if (ihdr->num_subflows_per_rfci == 0) { + LOGPFSML(iui->fi, LOGL_NOTICE, "Initialization: Unexpected num_subflows=0 received\n"); + err_cause = IUUP_ERR_CAUSE_UNEXPECTED_VALUE; + goto send_nack; + } + ihdr_rfci = (struct iuup_ctrl_init_rfci_hdr *)ihdr->rfci_data; + + do { + struct osmo_iuup_rfci *rfci = &iui->config.rfcinum_rfci; + uint8_t l_size_bytes = ihdr_rfci->li + 1; + is_last = ihdr_rfci->lri; + if (num_rfci >= IUUP_MAX_RFCIS) { + LOGPFSML(iui->fi, LOGL_NOTICE, "Initialization: Too many RFCIs received (%u)\n", + num_rfci); + err_cause = IUUP_ERR_CAUSE_UNEXPECTED_RFCI; + goto send_nack; + } + rfci->used = 1; + rfci->id = ihdr_rfci->rfci; + if (l_size_bytes == 2) { + uint16_t *subflow_size = (uint16_t *)ihdr_rfci->subflow_length; + for (i = 0; i < ihdr->num_subflows_per_rfci; i++) { + rfci->subflow_sizesi = osmo_load16be(subflow_size); + subflow_size++; + } + } else { + uint8_t *subflow_size = ihdr_rfci->subflow_length; + for (i = 0; i < ihdr->num_subflows_per_rfci; i++) { + rfci->subflow_sizesi = *subflow_size; + subflow_size++; + } + } + num_rfci++; + ihdr_rfci++; + ihdr_rfci = (struct iuup_ctrl_init_rfci_hdr *)(((uint8_t *)ihdr_rfci) + ihdr->num_subflows_per_rfci * l_size_bytes); + } while (!is_last); + + if (ihdr->ti) { /* Timing information present */ + uint8_t *buf = (uint8_t *)ihdr_rfci; + uint8_t num_bytes = (num_rfci + 1) / 2; + iui->config.IPTIs_present = true; + for (i = 0; i < num_bytes - 1; i++) { + iui->config.rfcii*2.IPTI = *buf >> 4; + iui->config.rfcii*2 + 1.IPTI = *buf & 0x0f; + buf++; + } + iui->config.rfcii*2.IPTI = *buf >> 4; + if (!(num_rfci & 0x01)) /* is even: */ + iui->config.rfcii*2 + 1.IPTI = *buf & 0x0f; + buf++; + itail = (struct iuup_ctrl_init_tail *)buf; + } else { + iui->config.IPTIs_present = false; + itail = (struct iuup_ctrl_init_tail *)ihdr_rfci; + } + if (itail->data_pdu_type > 1) { + LOGPFSML(iui->fi, LOGL_NOTICE, "Initialization: Unexpected Data PDU Type %u received\n", itail->data_pdu_type); + err_cause = IUUP_ERR_CAUSE_UNEXPECTED_VALUE; + goto send_nack; + } + + remote_mask = osmo_load16be(&itail->versions_supported); + match_mask = (remote_mask & iui->config.supported_versions_mask); + if (match_mask == 0x0000) { + LOGPFSML(iui->fi, LOGL_NOTICE, + "Initialization: No match in supported versions local=0x%04x vs remote=0x%04x\n", + iui->config.supported_versions_mask, remote_mask); + err_cause = IUUP_ERR_CAUSE_UNEXPECTED_VALUE; + goto send_nack; + } + for (i = 15; i >= 0; i--) { + if (match_mask & (1<<i)) { + iui->mode_version = i; + break; + } + } + + iui->config.num_rfci = num_rfci; + iui->config.num_subflows = ihdr->num_subflows_per_rfci; + iui->config.data_pdu_type = itail->data_pdu_type; + + irp = irp_init_ind_alloc(iui); + iui->user_prim_cb(&irp->oph, iui->user_prim_priv); + + LOGPFSML(iui->fi, LOGL_DEBUG, "Tx Initialization ACK\n"); + resp = itp_ctrl_ack_alloc(iui, IUUP_PROC_INIT, hdr->frame_nr); + iui->transport_prim_cb(&resp->oph, iui->transport_prim_priv); + return ihdr->chain_ind == 0; +send_nack: + LOGPFSML(iui->fi, LOGL_NOTICE, "Tx Initialization NACK cause=%u orig_message=%s\n", + err_cause, osmo_hexdump((const unsigned char *) msgb_l2(itp->oph.msg), msgb_l2len(itp->oph.msg))); + resp = tnp_ctrl_nack_alloc(iui, IUUP_PROC_INIT, err_cause, hdr->frame_nr); + iui->transport_prim_cb(&resp->oph, iui->transport_prim_priv); + return false; +} + +/********************** + * FSM STATE FUNCTIONS + **********************/ +static void iuup_fsm_null(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct osmo_iuup_instance *iui = fi->priv; + struct osmo_iuup_rnl_prim *user_prim = NULL; + + switch (event) { + case IUUP_FSM_EVT_IUUP_CONFIG_REQ: + user_prim = data; + iui->config = user_prim->u.config; + iui->config.supported_versions_mask &= 0x0003; /* We only support versions 1 and 2 ourselves */ + //TODO: if supported_versions_mask == 0x0000,no supported versions, send error to upper layers + + if (iui->config.transparent) + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_TrM_DATA_XFER_READY, 0, 0); + else { + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_INIT, 0, 0); + } + break; + } +} + +/* transparent mode data transfer */ +static void iuup_fsm_trm_data(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + //struct osmo_iuup_instance *iui = fi->priv; + + switch (event) { + case IUUP_FSM_EVT_IUUP_CONFIG_REQ: + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_NULL, 0, 0); + break; + case IUUP_FSM_EVT_IUUP_DATA_REQ: + /* Data coming down from RNL (user) towards TNL (transport) */ + break; + case IUUP_FSM_EVT_IUUP_DATA_IND: + /* Data coming up from TNL (transport) towards RNL (user) */ + break; + case IUUP_FSM_EVT_IUUP_UNITDATA_REQ: + case IUUP_FSM_EVT_IUUP_UNITDATA_IND: + case IUUP_FSM_EVT_SSASAR_UNITDATA_REQ: + case IUUP_FSM_EVT_SSASAR_UNITDATA_IND: + /* no state change */ + break; + } +} + +static void iuup_fsm_init_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct osmo_iuup_instance *iui = fi->priv; + + iui->type14_fn = 0; + if (iui->config.active) { + iui->timer.init.n = 0; + iui->timer.init.retrans_itp = tnp_ctrl_init_alloc(iui); + retransmit_initialization(iui); + } +} + +static void iuup_fsm_init(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct osmo_iuup_instance *iui = fi->priv; + struct osmo_iuup_rnl_prim *irp; + struct osmo_iuup_tnl_prim *itp; + + switch (event) { + case IUUP_FSM_EVT_IUUP_CONFIG_REQ: + /* the only permitted 'config req' type is the request to release the instance */ + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_NULL, 0, 0); + break; + case IUUP_FSM_EVT_INIT: + itp = data; + if (iuup_rx_initialization(iui, itp)) + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_SMpSDU_DATA_XFER_READY, 0, 0); + break; + case IUUP_FSM_EVT_LAST_INIT_ACK: + /* last INIT ACK was received, transition to DATA_XFER_READY state */ + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_SMpSDU_DATA_XFER_READY, 0, 0); + break; + case IUUP_FSM_EVT_INIT_NACK: + LOGPFSML(fi, LOGL_NOTICE, "Rx Initialization NACK N=%" PRIu32 "/%" PRIu32 "\n", + iui->timer.init.n, iui->config.t_init.n_max); + osmo_timer_del(&fi->timer); + if (iui->timer.init.n == iui->config.t_init.n_max) { + irp = irp_error_event_alloc_c(iui, IUUP_ERR_CAUSE_INIT_FAILURE_REP_NACK, IUUP_ERR_DIST_SECOND_FWD); + iui->user_prim_cb(&irp->oph, iui->user_prim_priv); + return; + } + iui->timer.init.n++; + retransmit_initialization(iui); + break; + default: + OSMO_ASSERT(false); + } +} + +/* 3GPP TS 25.415 B.2.3 "Support Mode Data Transfer Ready State" */ +static void iuup_fsm_smpsdu_data(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct osmo_iuup_instance *iui = fi->priv; + struct osmo_iuup_rnl_prim *irp = NULL; + struct osmo_iuup_tnl_prim *itp = NULL; + + switch (event) { + case IUUP_FSM_EVT_IUUP_CONFIG_REQ: + irp = data; + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_NULL, 0, 0); + break; + case IUUP_FSM_EVT_INIT: + /* "In case of handover or relocation, Initialisation procedures + * may have to be performed and Iu UP instance may have to enter + * the initialisation state." */ + itp = data; + if (!iuup_rx_initialization(iui, itp)) + osmo_fsm_inst_state_chg(fi, IUUP_FSM_ST_INIT, 0, 0); + break; + case IUUP_FSM_EVT_IUUP_DATA_REQ: + /* Data coming down from RNL (user) towards TNL (transport) */ + irp = data; + itp = rnl_to_tnl_data(iui, irp); + iui->transport_prim_cb(&itp->oph, iui->transport_prim_priv); + break; + case IUUP_FSM_EVT_IUUP_DATA_IND: + /* Data coming up from TNL (transport) towards RNL (user) */ + itp = data; + irp = tnl_to_rnl_data(itp); + iui->user_prim_cb(&irp->oph, iui->user_prim_priv); + break; + } +} + +static int iuup_fsm_timer_cb(struct osmo_fsm_inst *fi) +{ + struct osmo_iuup_instance *iui = fi->priv; + struct osmo_iuup_rnl_prim *irp; + + switch (fi->T) { + case IUUP_TIMER_INIT: + OSMO_ASSERT(fi->state == IUUP_FSM_ST_INIT); + if (iui->timer.init.n == iui->config.t_init.n_max) { + irp = irp_error_event_alloc_c(iui, IUUP_ERR_CAUSE_INIT_FAILURE_NET_TMR, IUUP_ERR_DIST_LOCAL); + iui->user_prim_cb(&irp->oph, iui->user_prim_priv); + return 0; + } + iui->timer.init.n++; + retransmit_initialization(iui); + break; + case IUUP_TIMER_TA: + break; + case IUUP_TIMER_RC: + break; + default: + OSMO_ASSERT(0); + } + return 0; +} + + +static const struct osmo_fsm_state iuup_fsm_states = { + IUUP_FSM_ST_NULL = { + .in_event_mask = S(IUUP_FSM_EVT_IUUP_CONFIG_REQ), + .out_state_mask = S(IUUP_FSM_ST_INIT) | + S(IUUP_FSM_ST_TrM_DATA_XFER_READY), + .name = "NULL", + .action = iuup_fsm_null, + }, + IUUP_FSM_ST_TrM_DATA_XFER_READY = { + .in_event_mask = S(IUUP_FSM_EVT_IUUP_CONFIG_REQ) | + S(IUUP_FSM_EVT_IUUP_STATUS_REQ) | + S(IUUP_FSM_EVT_IUUP_DATA_REQ) | + S(IUUP_FSM_EVT_IUUP_DATA_IND) | + S(IUUP_FSM_EVT_IUUP_UNITDATA_REQ) | + S(IUUP_FSM_EVT_IUUP_UNITDATA_IND) | + S(IUUP_FSM_EVT_SSASAR_UNITDATA_REQ) | + S(IUUP_FSM_EVT_SSASAR_UNITDATA_IND), + .out_state_mask = S(IUUP_FSM_ST_NULL), + .name = "TrM_Data_Transfer_Ready", + .action = iuup_fsm_trm_data, + }, + IUUP_FSM_ST_INIT = { + .in_event_mask = S(IUUP_FSM_EVT_IUUP_CONFIG_REQ) | + S(IUUP_FSM_EVT_INIT) | + S(IUUP_FSM_EVT_LAST_INIT_ACK) | + S(IUUP_FSM_EVT_INIT_NACK), + .out_state_mask = S(IUUP_FSM_ST_NULL) | + S(IUUP_FSM_ST_SMpSDU_DATA_XFER_READY), + .name = "Initialisation", + .onenter = iuup_fsm_init_on_enter, + .action = iuup_fsm_init, + }, + IUUP_FSM_ST_SMpSDU_DATA_XFER_READY = { + .in_event_mask = S(IUUP_FSM_EVT_IUUP_CONFIG_REQ) | + S(IUUP_FSM_EVT_INIT) | + S(IUUP_FSM_EVT_IUUP_DATA_REQ) | + S(IUUP_FSM_EVT_IUUP_DATA_IND), + .out_state_mask = S(IUUP_FSM_ST_NULL) | + S(IUUP_FSM_ST_INIT), + .name = "SMpSDU_Data_Transfer_Ready", + .action = iuup_fsm_smpsdu_data, + }, +}; + +static struct osmo_fsm iuup_fsm = { + .name = "IuUP", + .states = iuup_fsm_states, + .num_states = ARRAY_SIZE(iuup_fsm_states), + .timer_cb = iuup_fsm_timer_cb, + .log_subsys = DLIUUP, + .event_names = iuup_fsm_event_names, +}; + +static int iuup_verify_pdu(const uint8_t *data, unsigned int len) +{ + int header_crc_computed, payload_crc_computed; + uint16_t payload_crc; + uint8_t pdu_type = iuup_get_pdu_type(data); + struct iuup_pdutype0_hdr *t0h; + struct iuup_pdutype14_hdr *t14h; + + if (len < 3) + return -EINVAL; + + header_crc_computed = osmo_iuup_compute_header_crc(data, len); + if (iuup_get_hdr_crc(data) != header_crc_computed) { + LOGP(DLIUUP, LOGL_NOTICE, "Header Checksum error: rx 0x%02x vs exp 0x%02x\n", + iuup_get_hdr_crc(data), header_crc_computed); + return -EIO; + } + switch (pdu_type) { + case IUUP_PDU_T_DATA_NOCRC: + if (len < 4) + return -EINVAL; + break; + case IUUP_PDU_T_DATA_CRC: + t0h = (struct iuup_pdutype0_hdr *) data; + payload_crc = ((uint16_t)t0h->payload_crc_hi << 8) | t0h->payload_crc_lo; + payload_crc_computed = osmo_iuup_compute_payload_crc(data, len); + if (payload_crc != payload_crc_computed) + goto payload_crc_err; + break; + case IUUP_PDU_T_CONTROL: + t14h = (struct iuup_pdutype14_hdr *) data; + if (t14h->ack_nack == IUUP_AN_PROCEDURE) { + payload_crc = ((uint16_t)t14h->payload_crc_hi << 8) | t14h->payload_crc_lo; + payload_crc_computed = osmo_iuup_compute_payload_crc(data, len); + if (payload_crc != payload_crc_computed) + goto payload_crc_err; + } + break; + default: + return -EINVAL; + } + return 0; + +payload_crc_err: + LOGP(DLIUUP, LOGL_NOTICE, "Payload Checksum error (pdu type %u): rx 0x%02x vs exp 0x%02x\n", + pdu_type, payload_crc, payload_crc_computed); + return -EIO; +} + +/* A IuUP TNL SAP primitive from transport (lower layer) */ +int osmo_iuup_tnl_prim_up(struct osmo_iuup_instance *inst, struct osmo_iuup_tnl_prim *itp) +{ + struct osmo_prim_hdr *oph = &itp->oph; + struct iuup_pdutype14_hdr *t14h; + int rc = 0; + + OSMO_ASSERT(oph->sap == SAP_IUUP_TNL); + + switch (OSMO_PRIM_HDR(oph)) { + case OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION): + if (iuup_verify_pdu(msgb_l2(oph->msg), msgb_l2len(oph->msg)) < 0) { + LOGPFSML(inst->fi, LOGL_NOTICE, "Discarding invalid IuUP PDU: %s\n", + osmo_hexdump((const unsigned char *) msgb_l2(oph->msg), msgb_l2len(oph->msg))); + /* don't return error as the caller is not responsible for the PDU which + * was transmitted from some remote peer */ + return 0; + } + switch (iuup_get_pdu_type(msgb_l2(oph->msg))) { + case IUUP_PDU_T_DATA_CRC: + oph->msg->l3h = msgb_l2(oph->msg) + sizeof(struct iuup_pdutype0_hdr); + rc = osmo_fsm_inst_dispatch(inst->fi, IUUP_FSM_EVT_IUUP_DATA_IND, itp); + break; + case IUUP_PDU_T_DATA_NOCRC: + oph->msg->l3h = msgb_l2(oph->msg) + sizeof(struct iuup_pdutype1_hdr); + rc = osmo_fsm_inst_dispatch(inst->fi, IUUP_FSM_EVT_IUUP_DATA_IND, itp); + break; + case IUUP_PDU_T_CONTROL: + t14h = (struct iuup_pdutype14_hdr *) msgb_l2(oph->msg); + switch (t14h->ack_nack) { + case IUUP_AN_PROCEDURE: + switch (t14h->proc_ind) { + case IUUP_PROC_INIT: + rc = osmo_fsm_inst_dispatch(inst->fi, IUUP_FSM_EVT_INIT, itp); + break; + case IUUP_PROC_RATE_CTRL: + case IUUP_PROC_TIME_ALIGN: + case IUUP_PROC_ERR_EVENT: + LOGPFSML(inst->fi, LOGL_NOTICE, "Received Request for " + "unsupported IuUP procedure %u\n", t14h->proc_ind); + break; + default: + LOGPFSML(inst->fi, LOGL_NOTICE, "Received Request for " + "unknown IuUP procedure %u\n", t14h->proc_ind); + break; + } + break; + case IUUP_AN_ACK: + switch (t14h->proc_ind) { + case IUUP_PROC_INIT: + rc = osmo_fsm_inst_dispatch(inst->fi, + IUUP_FSM_EVT_LAST_INIT_ACK, itp); + break; + default: + LOGPFSML(inst->fi, LOGL_ERROR, "Received ACK for " + "unknown IuUP procedure %u\n", t14h->proc_ind); + break; + } + break; + case IUUP_AN_NACK: + switch (t14h->proc_ind) { + case IUUP_PROC_INIT: + rc = osmo_fsm_inst_dispatch(inst->fi, + IUUP_FSM_EVT_INIT_NACK, itp); + break; + default: + LOGPFSML(inst->fi, LOGL_ERROR, "Received NACK for " + "unknown IuUP procedure %u\n", t14h->proc_ind); + break; + } + break; + default: + LOGPFSML(inst->fi, LOGL_ERROR, "Received unknown IuUP ACK/NACK\n"); + break; + } + break; + default: + LOGPFSML(inst->fi, LOGL_NOTICE, "Received unknown IuUP PDU type %u\n", + iuup_get_pdu_type(msgb_l2(oph->msg))); + break; + } + break; + default: + /* exception: return an error code due to a wrong primitive */ + return -EINVAL; + } + + return rc; +} + +/* A IuUP RNL SAP primitive from user (higher layer) */ +int osmo_iuup_rnl_prim_down(struct osmo_iuup_instance *inst, struct osmo_iuup_rnl_prim *irp) +{ + struct osmo_prim_hdr *oph = &irp->oph; + int rc; + + OSMO_ASSERT(oph->sap == SAP_IUUP_RNL); + + switch (OSMO_PRIM_HDR(oph)) { + case OSMO_PRIM(OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST): + rc = osmo_fsm_inst_dispatch(inst->fi, IUUP_FSM_EVT_IUUP_CONFIG_REQ, irp); + msgb_free(irp->oph.msg); + break; + case OSMO_PRIM(OSMO_IUUP_RNL_DATA, PRIM_OP_REQUEST): + rc = osmo_fsm_inst_dispatch(inst->fi, IUUP_FSM_EVT_IUUP_DATA_REQ, irp); + if (rc != 0) + msgb_free(irp->oph.msg); + break; + case OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_REQUEST): + rc = osmo_fsm_inst_dispatch(inst->fi, IUUP_FSM_EVT_IUUP_STATUS_REQ, irp); + msgb_free(irp->oph.msg); + break; + default: + rc = -EINVAL; + msgb_free(irp->oph.msg); + } + return rc; +} + +struct osmo_iuup_instance *osmo_iuup_instance_alloc(void *ctx, const char *id) +{ + struct osmo_iuup_instance *iui; + iui = talloc_zero(ctx, struct osmo_iuup_instance); + if (!iui) + return NULL; + + iui->fi = osmo_fsm_inst_alloc(&iuup_fsm, NULL, iui, LOGL_DEBUG, id); + if (!iui->fi) + goto free_ret; + + return iui; +free_ret: + talloc_free(iui); + return NULL; +} + +void osmo_iuup_instance_free(struct osmo_iuup_instance *iui) +{ + if (!iui) + return; + + if (iui->fi) + osmo_fsm_inst_free(iui->fi); + iui->fi = NULL; + talloc_free(iui); +} + +void osmo_iuup_instance_set_user_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv) +{ + iui->user_prim_cb = func; + iui->user_prim_priv = priv; +} +void osmo_iuup_instance_set_transport_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv) +{ + iui->transport_prim_cb = func; + iui->transport_prim_priv = priv; +} + +static __attribute__((constructor)) void on_dso_load_iuup_fsm(void) +{ + OSMO_ASSERT(osmo_fsm_register(&iuup_fsm) == 0); +}
View file
libosmocore_1.6.0.tar.xz/src/gsm/kasumi.c -> libosmocore_1.7.0.tar.xz/src/gsm/kasumi.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/kdf.c -> libosmocore_1.7.0.tar.xz/src/gsm/kdf.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h>
View file
libosmocore_1.6.0.tar.xz/src/gsm/lapd_core.c -> libosmocore_1.7.0.tar.xz/src/gsm/lapd_core.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup lapd @@ -946,7 +942,7 @@ dl->cont_res = lapd_msgb_alloc(length, "CONT RES"); memcpy(msgb_put(dl->cont_res, length), msg->l3h, length); - LOGDL(dl, LOGL_NOTICE, "Store content res.\n"); + LOGDL(dl, LOGL_INFO, "Store content res.\n"); } /* send notification to L3 */ if (length == 0) {
View file
libosmocore_1.6.0.tar.xz/src/gsm/lapdm.c -> libosmocore_1.7.0.tar.xz/src/gsm/lapdm.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup lapdm
View file
libosmocore_1.6.0.tar.xz/src/gsm/libosmogsm.map -> libosmocore_1.7.0.tar.xz/src/gsm/libosmogsm.map
Changed
@@ -771,5 +771,16 @@ osmo_gad_raw_write; osmo_gad_type_names; +osmo_iuup_compute_header_crc; +osmo_iuup_compute_payload_crc; +osmo_iuup_instance_alloc; +osmo_iuup_instance_free; +osmo_iuup_instance_set_user_prim_cb; +osmo_iuup_instance_set_transport_prim_cb; +osmo_iuup_tnl_prim_up; +osmo_iuup_rnl_prim_down; +osmo_iuup_rnl_prim_alloc; +osmo_iuup_tnl_prim_alloc; + local: *; };
View file
libosmocore_1.6.0.tar.xz/src/gsm/rsl.c -> libosmocore_1.7.0.tar.xz/src/gsm/rsl.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h> @@ -129,6 +125,7 @@ RSL_IE_OSMO_REP_ACCH_CAP = { TLV_TYPE_TLV }, RSL_IE_OSMO_TRAINING_SEQUENCE = { TLV_TYPE_TLV }, RSL_IE_OSMO_TEMP_OVP_ACCH_CAP = { TLV_TYPE_TLV }, + RSL_IE_IPAC_SRTP_CONFIG = { TLV_TYPE_TLV }, RSL_IE_IPAC_PROXY_UDP = { TLV_TYPE_FIXED, 2 }, RSL_IE_IPAC_BSCMPL_TOUT = { TLV_TYPE_TV }, RSL_IE_IPAC_REMOTE_IP = { TLV_TYPE_FIXED, 4 }, @@ -137,6 +134,8 @@ RSL_IE_IPAC_LOCAL_PORT = { TLV_TYPE_FIXED, 2 }, RSL_IE_IPAC_SPEECH_MODE = { TLV_TYPE_TV }, RSL_IE_IPAC_LOCAL_IP = { TLV_TYPE_FIXED, 4 }, + RSL_IE_IPAC_CONN_STAT = { TLV_TYPE_TLV, 28 }, + RSL_IE_IPAC_HO_C_PARMS = { TLV_TYPE_TLV }, RSL_IE_IPAC_CONN_ID = { TLV_TYPE_FIXED, 2 }, RSL_IE_IPAC_RTP_CSD_FMT = { TLV_TYPE_TV }, RSL_IE_IPAC_RTP_JIT_BUF = { TLV_TYPE_FIXED, 2 },
View file
libosmocore_1.6.0.tar.xz/src/gsm/rxlev_stat.c -> libosmocore_1.7.0.tar.xz/src/gsm/rxlev_stat.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <unistd.h>
View file
libosmocore_1.6.0.tar.xz/src/gsmtap_util.c -> libosmocore_1.7.0.tar.xz/src/gsmtap_util.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "../config.h" @@ -323,6 +319,20 @@ } } +/*! Send a \ref msgb through a GSMTAP source; free the message even if tx queue full. + * \paramin gti GSMTAP instance + * \paramin msg message buffer; always freed, caller must not reference it later. + * \return 0 in case of success; negative in case of error + */ +int gsmtap_sendmsg_free(struct gsmtap_inst *gti, struct msgb *msg) +{ + int rc; + rc = gsmtap_sendmsg(gti, msg); + if (rc < 0) + msgb_free(msg); + return rc; +} + /*! send an arbitrary type through GSMTAP. * See \ref gsmtap_makemsg_ex for arguments */ @@ -476,6 +486,22 @@ return gti; } +void gsmtap_source_free(struct gsmtap_inst *gti) +{ + if (gti->ofd_wq_mode) { + osmo_fd_unregister(>i->wq.bfd); + osmo_wqueue_clear(>i->wq); + + if (gti->sink_ofd.fd != -1) { + osmo_fd_unregister(>i->sink_ofd); + close(gti->sink_ofd.fd); + } + } + + close(gti->wq.bfd.fd); + talloc_free(gti); +} + #endif /* HAVE_SYS_SOCKET_H */ const struct value_string gsmtap_gsm_channel_names = {
View file
libosmocore_1.6.0.tar.xz/src/isdnhdlc.c -> libosmocore_1.7.0.tar.xz/src/isdnhdlc.c
Changed
@@ -18,10 +18,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h>
View file
libosmocore_1.6.0.tar.xz/src/it_q.c -> libosmocore_1.7.0.tar.xz/src/it_q.c
Changed
@@ -14,11 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ /*! \addtogroup it_q
View file
libosmocore_1.6.0.tar.xz/src/logging.c -> libosmocore_1.7.0.tar.xz/src/logging.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup logging @@ -71,6 +67,7 @@ #include <osmocom/core/thread.h> #include <osmocom/core/select.h> #include <osmocom/core/write_queue.h> +#include <osmocom/core/gsmtap_util.h> #include <osmocom/vty/logging.h> /* for LOGGING_STR. */ @@ -298,6 +295,18 @@ .enabled = 1, .loglevel = LOGL_NOTICE, .color = "\03338;5;63m", }, + INT2IDX(DLIUUP) = { + .name = "DLIUUP", + .description = "Iu UP layer", + .enabled = 1, .loglevel = LOGL_NOTICE, + .color = "\03338;5;65m", + }, + INT2IDX(DLPFCP) = { + .name = "DLPFCP", + .description = "libosmo-pfcp Packet Forwarding Control Protocol", + .enabled = 1, .loglevel = LOGL_NOTICE, + .color = "\03338;5;51m", + }, }; void assert_loginfo(const char *src) @@ -571,19 +580,21 @@ * message in '\n'. If so, nip the last '\n' away, insert the source file info and re-append an * '\n'. All this to allow LOGP("start..."); LOGPC("...end\n") constructs. */ if (target->print_filename_pos == LOG_FILENAME_POS_LINE_END - && offset > 0 && bufoffset-1 == '\n') { + && offset > 0 && bufoffset - 1 == '\n') { switch (target->print_filename2) { case LOG_FILENAME_NONE: break; case LOG_FILENAME_PATH: - offset --; + offset--; + len--; ret = snprintf(buf + offset, rem, " (%s:%d)\n", file, line); if (ret < 0) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); break; case LOG_FILENAME_BASENAME: - offset --; + offset--; + len--; ret = snprintf(buf + offset, rem, " (%s:%d)\n", const_basename(file), line); if (ret < 0) goto err; @@ -599,7 +610,8 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } err: - bufbuf_len-1 = '\0'; + len = OSMO_MIN(buf_len - 1, len); + buflen = '\0'; return len; } @@ -744,6 +756,18 @@ TRACE(LIBOSMOCORE_LOG_DONE()); } +/* This logging function is used as a fallback when the logging framework is + * not is not properly initialized. */ +void logp_stub(const char *file, int line, int cont, const char *format, ...) +{ + va_list ap; + if (!cont) + fprintf(stderr, "%s:%d ", file, line); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + /*! Register a new log target with the logging core * \paramin target Log target to be registered */ @@ -992,7 +1016,10 @@ } /* if we reach here, either we already had elements in the write_queue, or the synchronous write * failed: enqueue the message to the write_queue (backlog) */ - osmo_wqueue_enqueue_quiet(target->tgt_file.wqueue, msg); + if (osmo_wqueue_enqueue_quiet(target->tgt_file.wqueue, msg) < 0) { + msgb_free(msg); + /* TODO: increment some counter so we can see that messages were dropped */ + } } #endif @@ -1252,7 +1279,7 @@ * \returns Log target (if found), NULL otherwise * Must be called with mutex osmo_log_tgt_mutex held, see log_tgt_mutex_lock. */ -struct log_target *log_target_find(int type, const char *fname) +struct log_target *log_target_find(enum log_target_type type, const char *fname) { struct log_target *tgt; @@ -1307,6 +1334,9 @@ talloc_free((void *)target->tgt_file.fname); target->tgt_file.fname = NULL; break; + case LOG_TGT_TYPE_GSMTAP: + gsmtap_source_free(target->tgt_gsmtap.gsmtap_inst); + break; #ifdef HAVE_SYSLOG_H case LOG_TGT_TYPE_SYSLOG: closelog();
View file
libosmocore_1.6.0.tar.xz/src/logging_gsmtap.c -> libosmocore_1.7.0.tar.xz/src/logging_gsmtap.c
Changed
@@ -21,10 +21,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup logging
View file
libosmocore_1.6.0.tar.xz/src/logging_syslog.c -> libosmocore_1.7.0.tar.xz/src/logging_syslog.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup logging
View file
libosmocore_1.6.0.tar.xz/src/logging_systemd.c -> libosmocore_1.7.0.tar.xz/src/logging_systemd.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup logging
View file
libosmocore_1.6.0.tar.xz/src/loggingrb.c -> libosmocore_1.7.0.tar.xz/src/loggingrb.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup loggingrb
View file
libosmocore_1.6.0.tar.xz/src/macaddr.c -> libosmocore_1.7.0.tar.xz/src/macaddr.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup utils
View file
libosmocore_1.6.0.tar.xz/src/mnl.c -> libosmocore_1.7.0.tar.xz/src/mnl.c
Changed
@@ -21,11 +21,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include <osmocom/core/select.h>
View file
libosmocore_1.6.0.tar.xz/src/msgb.c -> libosmocore_1.7.0.tar.xz/src/msgb.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup msgb @@ -430,11 +426,11 @@ */ char *msgb_hexdump_buf(char *buf, size_t buf_len, const struct msgb *msg) { - int buf_offs = 0; + unsigned int buf_offs = 0; int nchars; const unsigned char *start = msg->data; const unsigned char *lxhs4; - int i; + unsigned int i; lxhs0 = msg->l1h; lxhs1 = msg->l2h;
View file
libosmocore_1.6.0.tar.xz/src/msgfile.c -> libosmocore_1.7.0.tar.xz/src/msgfile.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #define _WITH_GETLINE
View file
libosmocore_1.6.0.tar.xz/src/panic.c -> libosmocore_1.7.0.tar.xz/src/panic.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup utils
View file
libosmocore_1.6.0.tar.xz/src/plugin.c -> libosmocore_1.7.0.tar.xz/src/plugin.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup utils
View file
libosmocore_1.6.0.tar.xz/src/rate_ctr.c -> libosmocore_1.7.0.tar.xz/src/rate_ctr.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup rate_ctr
View file
libosmocore_1.6.0.tar.xz/src/rbtree.c -> libosmocore_1.7.0.tar.xz/src/rbtree.c
Changed
@@ -15,11 +15,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA - linux/lib/rbtree.c */
View file
libosmocore_1.6.0.tar.xz/src/select.c -> libosmocore_1.7.0.tar.xz/src/select.c
Changed
@@ -18,11 +18,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include <fcntl.h> @@ -38,6 +33,8 @@ #include <osmocom/core/logging.h> #include <osmocom/core/talloc.h> #include <osmocom/core/utils.h> +#include <osmocom/core/stat_item.h> +#include <osmocom/core/stats_tcp.h> #include "../config.h" @@ -186,6 +183,9 @@ #ifndef FORCE_IO_SELECT g_poll.num_registered--; #endif /* FORCE_IO_SELECT */ + + /* If existent, free any statistical data */ + osmo_stats_tcp_osmo_fd_unregister(fd); } /*! Close a file descriptor, mark it as closed + unregister from select loop abstraction @@ -316,7 +316,7 @@ } /* iterate over first n_fd entries of g_poll.poll + dispatch */ -static int poll_disp_fds(int n_fd) +static int poll_disp_fds(unsigned int n_fd) { struct osmo_fd *ufd; unsigned int i; @@ -372,14 +372,20 @@ { unsigned int n_poll; int rc; + int timeout = 0; /* prepare read and write fdsets */ n_poll = poll_fill_fds(); - if (!polling) + if (!polling) { osmo_timers_prepare(); + timeout = osmo_timers_nearest_ms(); + + if (_osmo_select_shutdown_requested && timeout == -1) + timeout = 0; + } - rc = poll(g_poll.poll, n_poll, polling ? 0 : osmo_timers_nearest_ms()); + rc = poll(g_poll.poll, n_poll, timeout); if (rc < 0) return 0;
View file
libosmocore_1.6.0.tar.xz/src/sercomm.c -> libosmocore_1.7.0.tar.xz/src/sercomm.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup sercomm
View file
libosmocore_1.6.0.tar.xz/src/serial.c -> libosmocore_1.7.0.tar.xz/src/serial.c
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*! \addtogroup serial
View file
libosmocore_1.6.0.tar.xz/src/signal.c -> libosmocore_1.7.0.tar.xz/src/signal.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/signal.h>
View file
libosmocore_1.6.0.tar.xz/src/sim/Makefile.am -> libosmocore_1.7.0.tar.xz/src/sim/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=3:0:1 +LIBVERSION=3:1:1 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -fPIC -Wall $(TALLOC_CFLAGS)
View file
libosmocore_1.6.0.tar.xz/src/sim/card_fs_hpsim.c -> libosmocore_1.7.0.tar.xz/src/sim/card_fs_hpsim.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/sim/card_fs_isim.c -> libosmocore_1.7.0.tar.xz/src/sim/card_fs_isim.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/sim/card_fs_sim.c -> libosmocore_1.7.0.tar.xz/src/sim/card_fs_sim.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/sim/card_fs_tetra.c -> libosmocore_1.7.0.tar.xz/src/sim/card_fs_tetra.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/sim/card_fs_uicc.c -> libosmocore_1.7.0.tar.xz/src/sim/card_fs_uicc.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/sim/card_fs_usim.c -> libosmocore_1.7.0.tar.xz/src/sim/card_fs_usim.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/sim/class_tables.c -> libosmocore_1.7.0.tar.xz/src/sim/class_tables.c
Changed
@@ -13,10 +13,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdint.h> @@ -177,6 +173,24 @@ return 0; } +static int gp_cla_ins_helper(const struct osim_cla_ins_case *cic, + const uint8_t *hdr) +{ + uint8_t ins = hdr1; + uint8_t p1 = hdr2; + + switch (ins) { + case 0xE2: /* STORE DATA */ + switch (p1 & 0x01) { + case 1: + return 4; + default: + return 3; + } + } + return 0; +} + /* ETSI TS 102 221, Table 10.5, CLA = 0x8x, 0xCx or 0xEx */ static const uint8_t uicc_ins_tbl_8ce256 = { 0xF2 = 2, /* STATUS */ @@ -194,6 +208,19 @@ 0x14 = 3, /* TERMINAL RESPONSE */ }; +/* Card Specification v2.3.1*/ +static const uint8_t gp_ins_tbl_8ce256 = { + 0xE4 = 4, /* DELETE */ + 0xE2 = 0x80, /* STORE DATA */ + 0xCA = 4, /* GET DATA */ + 0xCB = 4, /* GET DATA */ + 0xF2 = 4, /* GET STATUS */ + 0xE6 = 4, /* INSTALL */ + 0xE8 = 4, /* LOAD */ + 0xD8 = 4, /* PUT KEY */ + 0xF0 = 3, /* SET STATUS */ +}; + static const struct osim_cla_ins_case uicc_ins_case = { { .cla = 0x80, @@ -226,6 +253,21 @@ .cla = 0xE0, .cla_mask = 0xF0, .ins_tbl = uicc_ins_tbl_8ce, + }, { + .cla = 0x80, + .cla_mask = 0xF0, + .helper = gp_cla_ins_helper, + .ins_tbl = gp_ins_tbl_8ce, + }, { + .cla = 0xC0, + .cla_mask = 0xF0, + .helper = gp_cla_ins_helper, + .ins_tbl = gp_ins_tbl_8ce, + }, { + .cla = 0xE0, + .cla_mask = 0xF0, + .helper = gp_cla_ins_helper, + .ins_tbl = gp_ins_tbl_8ce, }, }; @@ -273,7 +315,23 @@ .cla = 0xE0, .cla_mask = 0xF0, .ins_tbl = uicc_ins_tbl_8ce, + }, { + .cla = 0x80, + .cla_mask = 0xF0, + .helper = gp_cla_ins_helper, + .ins_tbl = gp_ins_tbl_8ce, + }, { + .cla = 0xC0, + .cla_mask = 0xF0, + .helper = gp_cla_ins_helper, + .ins_tbl = gp_ins_tbl_8ce, + }, { + .cla = 0xE0, + .cla_mask = 0xF0, + .helper = gp_cla_ins_helper, + .ins_tbl = gp_ins_tbl_8ce, }, + }; const struct osim_cla_ins_card_profile osim_uicc_sim_cic_profile = { @@ -305,7 +363,7 @@ case 0x80: return cic->helper(cic, hdr); case 0x00: - /* continue with fruther cic, rather than abort + /* continue with further cic, rather than abort * now */ continue; default:
View file
libosmocore_1.6.0.tar.xz/src/sim/core.c -> libosmocore_1.7.0.tar.xz/src/sim/core.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/sim/reader.c -> libosmocore_1.7.0.tar.xz/src/sim/reader.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ @@ -44,7 +40,7 @@ { int ret; - if (!msgb_apdu_de(resp) || msgb_apdu_le(resp) < 2) + if (!resp->l2h || msgb_apdu_le(resp) < 2) return -EIO; ret = msgb_get_u16(resp);
View file
libosmocore_1.6.0.tar.xz/src/sim/reader_pcsc.c -> libosmocore_1.7.0.tar.xz/src/sim/reader_pcsc.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/sockaddr_str.c -> libosmocore_1.7.0.tar.xz/src/sockaddr_str.c
Changed
@@ -20,10 +20,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h"
View file
libosmocore_1.6.0.tar.xz/src/socket.c -> libosmocore_1.7.0.tar.xz/src/socket.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "../config.h" @@ -118,7 +114,7 @@ static int addrinfo_helper_multi(struct addrinfo **addrinfo, uint16_t family, uint16_t type, uint8_t proto, const char **hosts, size_t host_cnt, uint16_t port, bool passive) { - int i, j; + unsigned int i, j; for (i = 0; i < host_cnt; i++) { addrinfoi = addrinfo_helper(family, type, proto, hostsi, port, passive); @@ -214,7 +210,8 @@ static int multiaddr_snprintf(char* buf, size_t buf_len, const char **hosts, size_t host_cnt) { int len = 0, offset = 0, rem = buf_len; - int ret, i; + size_t i; + int ret; char *after; if (buf_len < 3) @@ -487,8 +484,8 @@ } #define _SOCKADDR_TO_STR(dest, sockaddr) do { \ - if (osmo_sockaddr_str_from_sockaddr(&dest, &sockaddr->u.sas)) \ - osmo_strlcpy(dest.ip, "Invalid IP", 11); \ + if (osmo_sockaddr_str_from_sockaddr(dest, &sockaddr->u.sas)) \ + osmo_strlcpy((dest)->ip, "Invalid IP", 11); \ } while (0) /*! Initialize a socket (including bind and/or connect) @@ -523,7 +520,8 @@ unsigned int flags) { int sfd = -1, rc, on = 1; - struct osmo_sockaddr_str sastr = {}; + struct osmo_sockaddr_str _sastr = {}; + struct osmo_sockaddr_str *sastr = &_sastr; if ((flags & (OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT)) == 0) { LOGP(DLGLOBAL, LOGL_ERROR, "invalid: you have to specify either " @@ -554,8 +552,8 @@ sfd = socket_helper_osa(local, type, proto, flags); if (sfd < 0) { _SOCKADDR_TO_STR(sastr, local); - LOGP(DLGLOBAL, LOGL_ERROR, "no suitable local addr found for: %s:%u\n", - sastr.ip, sastr.port); + LOGP(DLGLOBAL, LOGL_ERROR, "no suitable local addr found for: " OSMO_SOCKADDR_STR_FMT "\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr)); return -ENODEV; } @@ -565,10 +563,8 @@ if (rc < 0) { _SOCKADDR_TO_STR(sastr, local); LOGP(DLGLOBAL, LOGL_ERROR, - "cannot setsockopt socket:" - " %s:%u: %s\n", - sastr.ip, sastr.port, - strerror(errno)); + "cannot setsockopt socket: " OSMO_SOCKADDR_STR_FMT ": %s\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr), strerror(errno)); close(sfd); return rc; } @@ -576,8 +572,8 @@ if (bind(sfd, &local->u.sa, sizeof(struct osmo_sockaddr)) == -1) { _SOCKADDR_TO_STR(sastr, local); - LOGP(DLGLOBAL, LOGL_ERROR, "unable to bind socket: %s:%u: %s\n", - sastr.ip, sastr.port, strerror(errno)); + LOGP(DLGLOBAL, LOGL_ERROR, "unable to bind socket: " OSMO_SOCKADDR_STR_FMT ": %s\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr), strerror(errno)); close(sfd); return -1; } @@ -599,8 +595,8 @@ rc = connect(sfd, &remote->u.sa, sizeof(struct osmo_sockaddr)); if (rc != 0 && errno != EINPROGRESS) { _SOCKADDR_TO_STR(sastr, remote); - LOGP(DLGLOBAL, LOGL_ERROR, "unable to connect socket: %s:%u: %s\n", - sastr.ip, sastr.port, strerror(errno)); + LOGP(DLGLOBAL, LOGL_ERROR, "unable to connect socket: " OSMO_SOCKADDR_STR_FMT ": %s\n", + OSMO_SOCKADDR_STR_FMT_ARGS(sastr), strerror(errno)); close(sfd); return rc; } @@ -669,7 +665,7 @@ /* Build array of addresses taking first addrinfo result of the requested family * for each host in addrs_buf. */ static int addrinfo_to_sockaddr(uint16_t family, const struct addrinfo **result, - const char **hosts, int host_cont, + const char **hosts, unsigned int host_cont, uint8_t *addrs_buf, size_t addrs_buf_len) { size_t host_idx, offset = 0; const struct addrinfo *rp; @@ -725,7 +721,7 @@ { struct addrinfo *res_locOSMO_SOCK_MAX_ADDRS, *res_remOSMO_SOCK_MAX_ADDRS; int sfd = -1, rc, on = 1; - int i; + unsigned int i; bool loc_has_v4addr, rem_has_v4addr; bool loc_has_v6addr, rem_has_v6addr; struct sockaddr_in6 addrs_bufOSMO_SOCK_MAX_ADDRS; @@ -1258,6 +1254,23 @@ return 0; } +/*! Set sockaddr port content (to network byte order). + * \paramout sa sockaddr to set the port of. + * \paramin port port nr to set. + */ +void osmo_sockaddr_set_port(struct sockaddr *sa, uint16_t port) +{ + struct osmo_sockaddr *osa = (struct osmo_sockaddr *)sa; + switch (osa->u.sa.sa_family) { + case AF_INET6: + osa->u.sin6.sin6_port = htons(port); + return; + case AF_INET: + osa->u.sin.sin_port = htons(port); + return; + } +} + /*! Initialize a unix domain socket (including bind/connect) * \paramin type Socket type like SOCK_DGRAM, SOCK_STREAM * \paramin proto Protocol like IPPROTO_TCP, IPPROTO_UDP @@ -1737,6 +1750,65 @@ return rc; } +/*! Copy the addr part, the IP address octets in network byte order, to a buffer. + * Useful for encoding network protocols. + * \paramout dst Write octets to this buffer. + * \paramin dst_maxlen Space available in buffer. + * \paramin os Sockaddr to copy IP of. + * \return nr of octets written on success, negative on error. + */ +int osmo_sockaddr_to_octets(uint8_t *dst, size_t dst_maxlen, const struct osmo_sockaddr *os) +{ + const void *addr; + size_t len; + switch (os->u.sa.sa_family) { + case AF_INET: + addr = &os->u.sin.sin_addr; + len = sizeof(os->u.sin.sin_addr); + break; + case AF_INET6: + addr = &os->u.sin6.sin6_addr; + len = sizeof(os->u.sin6.sin6_addr); + break; + default: + return -ENOTSUP; + } + if (dst_maxlen < len) + return -ENOSPC; + memcpy(dst, addr, len); + return len; +} + +/*! Copy the addr part, the IP address octets in network byte order, from a buffer. + * Useful for decoding network protocols. + * \paramout os Write IP address to this sockaddr. + * \paramin src Source buffer to read IP address octets from. + * \paramin src_len Number of octets to copy. + * \return number of octets read on success, negative on error. + */ +int osmo_sockaddr_from_octets(struct osmo_sockaddr *os, const void *src, size_t src_len) +{ + void *addr; + size_t len; + *os = (struct osmo_sockaddr){0}; + switch (src_len) { + case sizeof(os->u.sin.sin_addr): + os->u.sa.sa_family = AF_INET; + addr = &os->u.sin.sin_addr; + len = sizeof(os->u.sin.sin_addr); + break; + case sizeof(os->u.sin6.sin6_addr): + os->u.sin6.sin6_family = AF_INET6; + addr = &os->u.sin6.sin6_addr; + len = sizeof(os->u.sin6.sin6_addr); + break; + default: + return -ENOTSUP; + } + memcpy(addr, src, len); + return len; +} + /*! Compare two osmo_sockaddr. * \paramin a * \paramin b @@ -1779,52 +1851,68 @@ return osmo_sockaddr_to_str_buf(buf, sizeof(buf), sockaddr); } -/*! string-format a given osmo_sockaddr address into a user-supplied buffer +/*! string-format a given osmo_sockaddr address into a user-supplied buffer. + * Same as osmo_sockaddr_to_str_buf() but returns a would-be length in snprintf() style. * \paramin buf user-supplied output buffer * \paramin buf_len size of the user-supplied output buffer in bytes * \paramin sockaddr the osmo_sockaddr to print - * \return pointer to the string on success; NULL on error + * \return number of characters that would be written if the buffer is large enough, like snprintf(). */ -char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, - const struct osmo_sockaddr *sockaddr) +int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr) { + struct osmo_strbuf sb = { .buf = buf, .len = buf_len }; uint16_t port = 0; - size_t written; - if (buf_len < 5) - return NULL; - if (!sockaddr) - return NULL; + if (!sockaddr) { + OSMO_STRBUF_PRINTF(sb, "NULL"); + return sb.chars_needed; + } switch (sockaddr->u.sa.sa_family) { case AF_INET: - written = osmo_sockaddr_to_str_and_uint(buf, buf_len, &port, &sockaddr->u.sa); - if (written + 1 >= buf_len && port) - return NULL; + OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_and_uint, &port, &sockaddr->u.sa); if (port) - snprintf(buf + written, buf_len - written, ":%u", port); + OSMO_STRBUF_PRINTF(sb, ":%u", port); break; case AF_INET6: - buf0 = ''; - written = osmo_sockaddr_to_str_and_uint(buf + 1, buf_len - 1, &port, &sockaddr->u.sa); - if (written + 2 >= buf_len) - return NULL; - - if (written + 3 >= buf_len && port) - return NULL; - + OSMO_STRBUF_PRINTF(sb, ""); + OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_and_uint, &port, &sockaddr->u.sa); + OSMO_STRBUF_PRINTF(sb, ""); if (port) - snprintf(buf + 1 + written, buf_len - written - 1, ":%u", port); - else { - bufwritten + 1 = ''; - bufwritten + 2 = 0; - } + OSMO_STRBUF_PRINTF(sb, ":%u", port); break; default: - snprintf(buf, buf_len, "unsupported family %d", sockaddr->u.sa.sa_family); - return buf; + OSMO_STRBUF_PRINTF(sb, "unsupported family %d", sockaddr->u.sa.sa_family); + break; } + return sb.chars_needed; +} + +/*! string-format a given osmo_sockaddr address into a talloc allocated buffer. + * Like osmo_sockaddr_to_str_buf2() but returns a talloc allocated string. + * \paramin ctx talloc context to allocate from, e.g. OTC_SELECT. + * \paramin sockaddr the osmo_sockaddr to print. + * \return human readable string. + */ +char *osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr) +{ + OSMO_NAME_C_IMPL(ctx, 64, "ERROR", osmo_sockaddr_to_str_buf2, sockaddr) +} + +/*! string-format a given osmo_sockaddr address into a user-supplied buffer. + * Like osmo_sockaddr_to_str_buf2() but returns buf, or NULL if too short. + * \paramin buf user-supplied output buffer + * \paramin buf_len size of the user-supplied output buffer in bytes + * \paramin sockaddr the osmo_sockaddr to print + * \return pointer to the string on success; NULL on error + */ +char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, + const struct osmo_sockaddr *sockaddr) +{ + int chars_needed = osmo_sockaddr_to_str_buf2(buf, buf_len, sockaddr); + if (chars_needed >= buf_len) + return NULL; return buf; }
View file
libosmocore_1.6.0.tar.xz/src/stat_item.c -> libosmocore_1.7.0.tar.xz/src/stat_item.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup osmo_stat_item @@ -228,6 +224,9 @@ /*! Free the memory for the specified group of stat items */ void osmo_stat_item_group_free(struct osmo_stat_item_group *grp) { + if (!grp) + return; + llist_del(&grp->list); talloc_free(grp); }
View file
libosmocore_1.6.0.tar.xz/src/stats.c -> libosmocore_1.7.0.tar.xz/src/stats.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup stats @@ -89,6 +85,7 @@ #include <osmocom/core/select.h> #include <osmocom/core/counter.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/stats_tcp.h> #ifdef HAVE_SYSTEMTAP /* include the generated probes header and put markers in code */ @@ -178,7 +175,7 @@ return 0; } -static int start_timer() +static int start_timer(void) { int rc; int interval = osmo_stats_config->interval; @@ -217,7 +214,9 @@ { struct osmo_stats_reporter *srep; srep = talloc_zero(osmo_stats_ctx, struct osmo_stats_reporter); - OSMO_ASSERT(srep); + if (!srep) + return NULL; + srep->type = type; if (name) srep->name = talloc_strdup(srep, name); @@ -244,6 +243,10 @@ osmo_stats_ctx = ctx; is_initialised = 1; start_timer(); + + /* Make sure that the tcp-stats interval timer also runs at its + * preconfigured rate. The vty might change this setting later. */ + osmo_stats_tcp_set_interval(osmo_tcp_stats_config->interval); } /*! Find a stats_reporter of given \a type and \a name. @@ -411,7 +414,7 @@ /*! Set the name prefix of a given stats_reporter. * \paramin srep stats_reporter whose name prefix is to be set - * \paramin prefix NAme perfix to pre-pend for any reported value + * \paramin prefix Name prefix to pre-pend for any reported value * \returns 0 on success; negative on error */ int osmo_stats_reporter_set_name_prefix(struct osmo_stats_reporter *srep, const char *prefix) { @@ -485,6 +488,8 @@ } srep->buffer = msgb_alloc(buffer_size, "stats buffer"); + if (!srep->buffer) + goto failed; return 0; @@ -568,6 +573,8 @@ { struct osmo_stats_reporter *srep; srep = osmo_stats_reporter_alloc(OSMO_STATS_REPORTER_LOG, name); + if (!srep) + return NULL; srep->have_net_config = 0; @@ -757,7 +764,7 @@ /*** main reporting function ***/ -static void flush_all_reporters() +static void flush_all_reporters(void) { struct osmo_stats_reporter *srep; @@ -780,7 +787,7 @@ } } -int osmo_stats_report() +int osmo_stats_report(void) { /* per group actions */ TRACE(LIBOSMOCORE_STATS_START());
View file
libosmocore_1.6.0.tar.xz/src/stats_statsd.c -> libosmocore_1.7.0.tar.xz/src/stats_statsd.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup stats @@ -58,6 +54,8 @@ { struct osmo_stats_reporter *srep; srep = osmo_stats_reporter_alloc(OSMO_STATS_REPORTER_STATSD, name); + if (!srep) + return NULL; srep->have_net_config = 1;
View file
libosmocore_1.7.0.tar.xz/src/stats_tcp.c
Added
@@ -0,0 +1,325 @@ +/* + * (C) 2021 by sysmocom - s.f.m.c. GmbH + * Author: Philipp Maier <pmaier@sysmocom.de> + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * 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. + * + */ + +/*! \addtogroup stats + * @{ + * \file stats_tcp.c */ + +#include "config.h" +#if !defined(EMBEDDED) + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netinet/ip.h> +#include <linux/tcp.h> +#include <errno.h> +#include <pthread.h> + +#include <osmocom/core/select.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/talloc.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/stat_item.h> +#include <osmocom/core/stats.h> +#include <osmocom/core/socket.h> +#include <osmocom/core/stats_tcp.h> + +static struct osmo_tcp_stats_config s_tcp_stats_config = { + .interval = TCP_STATS_DEFAULT_INTERVAL, +}; + +struct osmo_tcp_stats_config *osmo_tcp_stats_config = &s_tcp_stats_config; + +static struct osmo_timer_list stats_tcp_poll_timer; + +static LLIST_HEAD(stats_tcp); +static struct stats_tcp_entry *stats_tcp_entry_cur; +pthread_mutex_t stats_tcp_lock; + +struct stats_tcp_entry { + struct llist_head entry; + const struct osmo_fd *fd; + struct osmo_stat_item_group *stats_tcp; + const char *name; +}; + +enum { + STATS_TCP_UNACKED, + STATS_TCP_LOST, + STATS_TCP_RETRANS, + STATS_TCP_RTT, + STATS_TCP_RCV_RTT, + STATS_TCP_NOTSENT_BYTES, + STATS_TCP_RWND_LIMITED, + STATS_TCP_SNDBUF_LIMITED, + STATS_TCP_REORD_SEEN, +}; + +static struct osmo_stat_item_desc stats_tcp_item_desc = { + STATS_TCP_UNACKED = { "tcp:unacked", "unacknowledged packets", "", 60, 0 }, + STATS_TCP_LOST = { "tcp:lost", "lost packets", "", 60, 0 }, + STATS_TCP_RETRANS = { "tcp:retrans", "retransmitted packets", "", 60, 0 }, + STATS_TCP_RTT = { "tcp:rtt", "roundtrip-time", "", 60, 0 }, + STATS_TCP_RCV_RTT = { "tcp:rcv_rtt", "roundtrip-time (receive)", "", 60, 0 }, + STATS_TCP_NOTSENT_BYTES = { "tcp:notsent_bytes", "bytes not yet sent", "", 60, 0 }, + STATS_TCP_RWND_LIMITED = { "tcp:rwnd_limited", "time (usec) limited by receive window", "", 60, 0 }, + STATS_TCP_SNDBUF_LIMITED = { "tcp:sndbuf_limited", "Time (usec) limited by send buffer", "", 60, 0 }, + STATS_TCP_REORD_SEEN = { "tcp:reord_seen", "reordering events seen", "", 60, 0 }, +}; + +static struct osmo_stat_item_group_desc stats_tcp_desc = { + .group_name_prefix = "tcp", + .group_description = "stats tcp", + .class_id = OSMO_STATS_CLASS_GLOBAL, + .num_items = ARRAY_SIZE(stats_tcp_item_desc), + .item_desc = stats_tcp_item_desc, +}; + +static void fill_stats(struct stats_tcp_entry *stats_tcp_entry) +{ + int rc; + struct tcp_info tcp_info; + socklen_t tcp_info_len = sizeof(tcp_info); + char stat_name256; + + /* Do not fill in anything before the socket is connected to a remote end */ + if (osmo_sock_get_ip_and_port(stats_tcp_entry->fd->fd, NULL, 0, NULL, 0, false) != 0) + return; + + /* Gather TCP statistics and update the stats items */ + rc = getsockopt(stats_tcp_entry->fd->fd, IPPROTO_TCP, TCP_INFO, &tcp_info, &tcp_info_len); + if (rc < 0) + return; + + /* Create stats items if they do not exist yet */ + if (!stats_tcp_entry->stats_tcp) { + stats_tcp_entry->stats_tcp = + osmo_stat_item_group_alloc(stats_tcp_entry, &stats_tcp_desc, stats_tcp_entry->fd->fd); + OSMO_ASSERT(stats_tcp_entry->stats_tcp); + } + + /* Update statistics */ + if (stats_tcp_entry->name) + snprintf(stat_name, sizeof(stat_name), "%s", stats_tcp_entry->name); + else + snprintf(stat_name, sizeof(stat_name), "%s", osmo_sock_get_name2(stats_tcp_entry->fd->fd)); + osmo_stat_item_group_set_name(stats_tcp_entry->stats_tcp, stat_name); + + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_UNACKED), + tcp_info.tcpi_unacked); + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_LOST), + tcp_info.tcpi_lost); + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RETRANS), + tcp_info.tcpi_retrans); + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RTT), tcp_info.tcpi_rtt); + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RCV_RTT), + tcp_info.tcpi_rcv_rtt); +#if HAVE_TCP_INFO_TCPI_NOTSENT_BYTES == 1 + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_NOTSENT_BYTES), + tcp_info.tcpi_notsent_bytes); +#else + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_NOTSENT_BYTES), -1); +#endif + +#if HAVE_TCP_INFO_TCPI_RWND_LIMITED == 1 + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RWND_LIMITED), + tcp_info.tcpi_rwnd_limited); +#else + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_RWND_LIMITED), -1); +#endif + +#if STATS_TCP_SNDBUF_LIMITED == 1 + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_REORD_SEEN), + tcp_info.tcpi_sndbuf_limited); +#else + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_REORD_SEEN), -1); +#endif + +#if HAVE_TCP_INFO_TCPI_REORD_SEEN == 1 + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_REORD_SEEN), + tcp_info.tcpi_reord_seen); +#else + osmo_stat_item_set(osmo_stat_item_group_get_item(stats_tcp_entry->stats_tcp, STATS_TCP_REORD_SEEN), -1); +#endif + +} + +static bool is_tcp(const struct osmo_fd *fd) +{ + int rc; + struct stat fd_stat; + int so_protocol = 0; + socklen_t so_protocol_len = sizeof(so_protocol); + + /* Is this a socket? */ + rc = fstat(fd->fd, &fd_stat); + if (rc < 0) + return false; + if (!S_ISSOCK(fd_stat.st_mode)) + return false; + + /* Is it a TCP socket? */ + rc = getsockopt(fd->fd, SOL_SOCKET, SO_PROTOCOL, &so_protocol, &so_protocol_len); + if (rc < 0) + return false; + if (so_protocol == IPPROTO_TCP) + return true; + + return false; +} + +/*! Register an osmo_fd for TCP stats monitoring. + * \paramin fd osmocom file descriptor to be registered. + * \paramin human readbla name that is used as prefix for the related stats item. + * \returns 0 on success; negative in case of error. */ +int osmo_stats_tcp_osmo_fd_register(const struct osmo_fd *fd, const char *name) +{ + struct stats_tcp_entry *stats_tcp_entry; + + /* Only TCP sockets can be registered for monitoring, anything else will fall through. */ + if (!is_tcp(fd)) + return -EINVAL; + + /* When the osmo_fd is registered and unregistered properly there shouldn't be any leftovers from already closed + * osmo_fds in the stats_tcp list. But lets proactively make sure that any leftovers are cleaned up. */ + osmo_stats_tcp_osmo_fd_unregister(fd); + + /* Make a new list object, attach the osmo_fd... */ + stats_tcp_entry = talloc_zero(OTC_GLOBAL, struct stats_tcp_entry); + OSMO_ASSERT(stats_tcp_entry); + stats_tcp_entry->fd = fd; + stats_tcp_entry->name = talloc_strdup(stats_tcp_entry, name); + + pthread_mutex_lock(&stats_tcp_lock); + llist_add_tail(&stats_tcp_entry->entry, &stats_tcp); + pthread_mutex_unlock(&stats_tcp_lock); + + return 0; +} + +static void next_stats_tcp_entry(void) +{ + struct stats_tcp_entry *last; + + if (llist_empty(&stats_tcp)) { + stats_tcp_entry_cur = NULL; + return; + } + + last = (struct stats_tcp_entry *)llist_last_entry(&stats_tcp, struct stats_tcp_entry, entry); + + if (!stats_tcp_entry_cur || stats_tcp_entry_cur == last) + stats_tcp_entry_cur = + (struct stats_tcp_entry *)llist_first_entry(&stats_tcp, struct stats_tcp_entry, entry); + else + stats_tcp_entry_cur = + (struct stats_tcp_entry *)llist_entry(stats_tcp_entry_cur->entry.next, struct stats_tcp_entry, + entry); +} + +/*! Register an osmo_fd for TCP stats monitoring. + * \paramin fd osmocom file descriptor to be unregistered. + * \returns 0 on success; negative in case of error. */ +int osmo_stats_tcp_osmo_fd_unregister(const struct osmo_fd *fd) +{ + struct stats_tcp_entry *stats_tcp_entry; + int rc = -EINVAL; + + pthread_mutex_lock(&stats_tcp_lock); + llist_for_each_entry(stats_tcp_entry, &stats_tcp, entry) { + if (fd->fd == stats_tcp_entry->fd->fd) { + /* In case we want to remove exactly that item which is also selected as the current itemy, we + * must designate either a different item or invalidate the current item. */ + if (stats_tcp_entry == stats_tcp_entry_cur) { + if (llist_count(&stats_tcp) > 2) + next_stats_tcp_entry(); + else + stats_tcp_entry_cur = NULL; + } + + /* Date item from list */ + llist_del(&stats_tcp_entry->entry); + osmo_stat_item_group_free(stats_tcp_entry->stats_tcp); + talloc_free(stats_tcp_entry); + rc = 0; + break; + } + } + pthread_mutex_unlock(&stats_tcp_lock); + + return rc; +} + +static void stats_tcp_poll_timer_cb(void *data) +{ + int i; + int batch_size; + int llist_size; + + pthread_mutex_lock(&stats_tcp_lock); + + /* Make sure we do not run over the same sockets multiple times if the + * configured llist_size is larger then the actual list */ + batch_size = osmo_tcp_stats_config->batch_size; + llist_size = llist_count(&stats_tcp); + if (llist_size < batch_size) + batch_size = llist_size; + + /* Process a batch of sockets */ + for (i = 0; i < batch_size; i++) { + next_stats_tcp_entry(); + if (stats_tcp_entry_cur) + fill_stats(stats_tcp_entry_cur); + } + + pthread_mutex_unlock(&stats_tcp_lock); + + if (osmo_tcp_stats_config->interval > 0) + osmo_timer_schedule(&stats_tcp_poll_timer, osmo_tcp_stats_config->interval, 0); +} + +/*! Set the polling interval (common for all sockets) + * \paramin interval Poll interval in seconds + * \returns 0 on success; negative on error */ +int osmo_stats_tcp_set_interval(int interval) +{ + osmo_tcp_stats_config->interval = interval; + if (osmo_tcp_stats_config->interval > 0) + osmo_timer_schedule(&stats_tcp_poll_timer, osmo_tcp_stats_config->interval, 0); + return 0; +} + +static __attribute__((constructor)) +void on_dso_load_stats_tcp(void) +{ + stats_tcp_entry_cur = NULL; + pthread_mutex_init(&stats_tcp_lock, NULL); + + osmo_tcp_stats_config->interval = TCP_STATS_DEFAULT_INTERVAL; + osmo_tcp_stats_config->batch_size = TCP_STATS_DEFAULT_BATCH_SIZE; + + osmo_timer_setup(&stats_tcp_poll_timer, stats_tcp_poll_timer_cb, NULL); +} + +#endif /* !EMBEDDED */ + +/* @} */
View file
libosmocore_1.6.0.tar.xz/src/strrb.c -> libosmocore_1.7.0.tar.xz/src/strrb.c
Changed
@@ -31,10 +31,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup utils
View file
libosmocore_1.6.0.tar.xz/src/tdef.c -> libosmocore_1.7.0.tar.xz/src/tdef.c
Changed
@@ -52,18 +52,18 @@ * By keeping separate osmo_tdef arrays, several groups of timers can be kept * separately. The VTY tests in tests/tdef/ showcase different schemes: * - * - \ref tests/vty/tdef_vty_test_config_root.c: + * - \ref tests/tdef/tdef_vty_config_root_test.c: * Keep several timer definitions in separately named groups: showcase the * osmo_tdef_vty_groups*() API. Each timer group exists exactly once. * - * - \ref tests/vty/tdef_vty_test_config_subnode.c: + * - \ref tests/tdef/tdef_vty_config_subnode_test.c: * Keep a single list of timers without separate grouping. * Put this list on a specific subnode below the CONFIG_NODE. * There could be several separate subnodes with timers like this, i.e. * continuing from this example, sets of timers could be separated by placing * timers in specific config subnodes instead of using the global group name. * - * - \ref tests/vty/tdef_vty_test_dynamic.c: + * - \ref tests/tdef/tdef_vty_dynamic_test.c: * Dynamically allocate timer definitions per each new created object. * Thus there can be an arbitrary number of independent timer definitions, one * per allocated object.
View file
libosmocore_1.6.0.tar.xz/src/thread.c -> libosmocore_1.7.0.tar.xz/src/thread.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup thread
View file
libosmocore_1.6.0.tar.xz/src/time_cc.c -> libosmocore_1.7.0.tar.xz/src/time_cc.c
Changed
@@ -120,8 +120,6 @@ { uint64_t delta; uint64_t n; - if (!tc->cfg.rate_ctr) - return; /* We report a sum "rounded up", ahead of time. If the granularity period has not yet elapsed after the last * reporting, do not report again yet. */ if (tc->reported_sum > tc->sum) @@ -139,7 +137,8 @@ /* integer sanity, since rate_ctr_add() takes an int argument. */ if (n > INT_MAX) n = INT_MAX; - rate_ctr_add(tc->cfg.rate_ctr, n); + if (tc->cfg.rate_ctr) + rate_ctr_add(tc->cfg.rate_ctr, n); /* Store the increments of gran_usec that were counted. */ tc->reported_sum += n * GRAN_USEC(tc); } @@ -205,7 +204,7 @@ next_event = OSMO_MIN(next_event, next_forget_time); } /* Next rate_ctr increment? */ - if (tc->flag_state && tc->cfg.rate_ctr) { + if (tc->flag_state) { uint64_t next_inc = now + (tc->reported_sum - tc->sum) + ROUND_THRESHOLD_USEC(tc); next_event = OSMO_MIN(next_event, next_inc); }
View file
libosmocore_1.6.0.tar.xz/src/timer.c -> libosmocore_1.7.0.tar.xz/src/timer.c
Changed
@@ -19,10 +19,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/src/timer_clockgettime.c -> libosmocore_1.7.0.tar.xz/src/timer_clockgettime.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup timer
View file
libosmocore_1.6.0.tar.xz/src/timer_gettimeofday.c -> libosmocore_1.7.0.tar.xz/src/timer_gettimeofday.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*! \addtogroup timer
View file
libosmocore_1.6.0.tar.xz/src/usb/Makefile.am -> libosmocore_1.7.0.tar.xz/src/usb/Makefile.am
Changed
@@ -1,7 +1,7 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=0:0:0 +LIBVERSION=0:1:0 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -fPIC -Wall $(LIBUSB_CFLAGS) $(TALLOC_CFLAGS)
View file
libosmocore_1.6.0.tar.xz/src/usb/osmo_libusb.c -> libosmocore_1.7.0.tar.xz/src/usb/osmo_libusb.c
Changed
@@ -14,10 +14,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <errno.h> #include <unistd.h> @@ -103,7 +99,7 @@ static void osmo_usb_removed_cb(int fd, void *user_data) { struct osmo_fd *ofd = osmo_fd_get_by_fd(fd); - if (!fd) + if (!ofd) return; osmo_fd_unregister(ofd); talloc_free(ofd); @@ -541,7 +537,8 @@ addr = libusb_get_device_address(*dev); path = osmo_libusb_dev_get_path_buf(pathbuf, sizeof(pathbuf), *dev); if ((ifm->addr && addr == ifm->addr) || - (strlen(ifm->path) && !strcmp(path, ifm->path))) { + (strlen(ifm->path) && !strcmp(path, ifm->path)) || + (!ifm->addr && !strlen(ifm->path) && !list1 /* only one device */)) { rc = libusb_open(*dev, &usb_devh); if (rc < 0) { fprintf(stderr, "Cannot open device: %s\n", libusb_error_name(rc)); @@ -739,11 +736,15 @@ int osmo_libusb_init(libusb_context **pluctx) { libusb_context *luctx = NULL; + const struct libusb_pollfd **pfds; + int rc; rc = libusb_init(pluctx); - if (rc != 0) + if (rc != 0) { + LOGP(DLUSB, LOGL_ERROR, "Error initializing libusb: %s\n", libusb_strerror(rc)); return rc; + } if (pluctx) luctx = *pluctx; @@ -754,6 +755,17 @@ libusb_set_pollfd_notifiers(luctx, osmo_usb_added_cb, osmo_usb_removed_cb, luctx); + /* get the initial file descriptors which were created even before during libusb_init() */ + pfds = libusb_get_pollfds(luctx); + if (pfds) { + const struct libusb_pollfd **pfds2 = pfds; + const struct libusb_pollfd *pfd; + /* synthesize 'add' call-backs. not sure why libusb doesn't do that by itself? */ + for (pfd = *pfds2; pfd; pfd = *++pfds2) + osmo_usb_added_cb(pfd->fd, pfd->events, luctx); + libusb_free_pollfds(pfds); + } + return 0; }
View file
libosmocore_1.6.0.tar.xz/src/use_count.c -> libosmocore_1.7.0.tar.xz/src/use_count.c
Changed
@@ -19,10 +19,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <errno.h>
View file
libosmocore_1.6.0.tar.xz/src/utils.c -> libosmocore_1.7.0.tar.xz/src/utils.c
Changed
@@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ @@ -206,7 +202,7 @@ if (end_nibble & 1) end_nibble++; } - if ((end_nibble / 2) > dst_size) + if ((unsigned int) (end_nibble / 2) > dst_size) return -ENOMEM; for (nibble_i = start_nibble; nibble_i < end_nibble; nibble_i++) { @@ -241,7 +237,7 @@ * \paramin max_len maximum space in output buffer * \returns number of parsed octets, or -1 on error */ -int osmo_hexparse(const char *str, uint8_t *b, int max_len) +int osmo_hexparse(const char *str, uint8_t *b, unsigned int max_len) { char c; @@ -316,7 +312,7 @@ for (i = 0; i < len; i++) { const char *delimp = delim; int len_remain = out_buf_size - (cur - out_buf) - 1; - if (len_remain < (2 + delim_len) + if (len_remain < (int) (2 + delim_len) && !(!delim_after_last && i == (len - 1) && len_remain >= 2)) break; @@ -344,7 +340,7 @@ */ char *osmo_ubit_dump_buf(char *buf, size_t buf_len, const uint8_t *bits, unsigned int len) { - int i; + unsigned int i; if (len > buf_len-1) len = buf_len-1; @@ -758,7 +754,7 @@ * the non-legacy format also escapes those as "\xNN" sequences. * \return Number of characters that would be written if bufsize were large enough excluding '\0' (like snprintf()). */ -static size_t _osmo_escape_str_buf(char *buf, size_t bufsize, const char *str, int in_len, bool legacy_format) +static int _osmo_escape_str_buf(char *buf, size_t bufsize, const char *str, int in_len, bool legacy_format) { struct osmo_strbuf sb = { .buf = buf, .len = bufsize }; int in_pos = 0; @@ -830,6 +826,18 @@ * \paramin bufsize sizeof(buf). * \paramin str A string that may contain any characters. * \paramin in_len Pass -1 to print until nul char, or >= 0 to force a length (also past nul chars). + * \return Number of characters that would be written if bufsize were large enough excluding '\0' (like snprintf()). + */ +int osmo_escape_str_buf3(char *buf, size_t bufsize, const char *str, int in_len) +{ + return _osmo_escape_str_buf(buf, bufsize, str, in_len, false); +} + +/*! Return the string with all non-printable characters escaped. + * \paramout buf string buffer to write escaped characters to. + * \paramin bufsize sizeof(buf). + * \paramin str A string that may contain any characters. + * \paramin in_len Pass -1 to print until nul char, or >= 0 to force a length (also past nul chars). * \return The output buffer (buf). */ char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int in_len) @@ -887,6 +895,20 @@ return sb.chars_needed; } +/*! Like osmo_escape_str_buf3(), but returns double-quotes around a string, or "NULL" for a NULL string. + * This allows passing any char* value and get its C representation as string. + * The function signature is suitable for OSMO_STRBUF_APPEND_NOLEN(). + * \paramout buf string buffer to write escaped characters to. + * \paramin bufsize sizeof(buf). + * \paramin str A string that may contain any characters. + * \paramin in_len Pass -1 to print until nul char, or >= 0 to force a length. + * \return Number of characters that would be written if bufsize were large enough excluding '\0' (like snprintf()). + */ +int osmo_quote_str_buf3(char *buf, size_t bufsize, const char *str, int in_len) +{ + return _osmo_quote_str_buf(buf, bufsize, str, in_len, false); +} + /*! Like osmo_escape_str_buf2(), but returns double-quotes around a string, or "NULL" for a NULL string. * This allows passing any char* value and get its C representation as string. * The function signature is suitable for OSMO_STRBUF_APPEND_NOLEN(). @@ -1226,7 +1248,7 @@ int64_t precision_factor; int64_t integer_max; int64_t decimal_max; - int i; + unsigned int i; OSMO_ASSERT(val); *val = 0; @@ -1250,7 +1272,7 @@ if (point) return -EINVAL; point = p; - } else if (!isdigit(*p)) + } else if (!isdigit((unsigned char)*p)) return -EINVAL; }
View file
libosmocore_1.6.0.tar.xz/src/vty/Makefile.am -> libosmocore_1.7.0.tar.xz/src/vty/Makefile.am
Changed
@@ -1,10 +1,10 @@ # This is _NOT_ the library release version, it's an API version. # Please read chapter "Library interface versions" of the libtool documentation # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html -LIBVERSION=10:0:1 +LIBVERSION=11:0:2 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -AM_CFLAGS = -Wall $(TALLOC_CFLAGS) +AM_CFLAGS = -Wall $(TALLOC_CFLAGS) $(PTHREAD_CFLAGS) if ENABLE_VTY lib_LTLIBRARIES = libosmovty.la @@ -14,5 +14,5 @@ fsm_vty.c talloc_ctx_vty.c \ cpu_sched_vty.c tdef_vty.c libosmovty_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined -libosmovty_la_LIBADD = $(top_builddir)/src/libosmocore.la $(TALLOC_LIBS) +libosmovty_la_LIBADD = $(top_builddir)/src/libosmocore.la $(TALLOC_LIBS) $(PTHREAD_LIBS) endif
View file
libosmocore_1.6.0.tar.xz/src/vty/command.c -> libosmocore_1.7.0.tar.xz/src/vty/command.c
Changed
@@ -1092,6 +1092,7 @@ static vector cmd_node_vector(vector v, enum node_type ntype) { struct cmd_node *cnode = vector_slot(v, ntype); + OSMO_ASSERT(cnode != NULL); return cnode->cmd_vector; }
View file
libosmocore_1.6.0.tar.xz/src/vty/cpu_sched_vty.c -> libosmocore_1.7.0.tar.xz/src/vty/cpu_sched_vty.c
Changed
@@ -25,6 +25,8 @@ #define _GNU_SOURCE +#include "../../config.h" + #include <string.h> #include <stdlib.h> #include <errno.h> @@ -637,8 +639,10 @@ return 0; } +#ifdef HAVE_PTHREAD_GETNAME_NP if (pthread_getname_np(pthread_self(), name, sizeof(name)) == 0) has_name = true; +#endif /* Get latest matching mask for the thread */ pthread_mutex_lock(&sched_vty_opts->cpu_affinity_li_mutex);
View file
libosmocore_1.6.0.tar.xz/src/vty/fsm_vty.c -> libosmocore_1.7.0.tar.xz/src/vty/fsm_vty.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdlib.h> @@ -65,7 +61,7 @@ if (fsm->event_names) { for (evt_name = fsm->event_names; evt_name->str != NULL; evt_name++) { vty_out(vty, "%s Event %02u (0x%08x): '%s'%s", prefix, evt_name->value, - (1 << evt_name->value), evt_name->str, VTY_NEWLINE); + (1U << evt_name->value), evt_name->str, VTY_NEWLINE); } } else vty_out(vty, "%s No event names are defined for this FSM! Please fix!%s", prefix, VTY_NEWLINE);
View file
libosmocore_1.6.0.tar.xz/src/vty/logging_vty.c -> libosmocore_1.7.0.tar.xz/src/vty/logging_vty.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdlib.h> @@ -834,6 +830,27 @@ RET_WITH_UNLOCK(CMD_SUCCESS); } +DEFUN(cfg_no_log_gsmtap, cfg_no_log_gsmtap_cmd, + "no log gsmtap HOSTNAME", + NO_STR LOG_STR "Logging via GSMTAP\n" + "Host name to send the GSMTAP logging to (UDP port 4729)\n") +{ + const char *hostname = argc ? argv0 : "127.0.0.1"; + struct log_target *tgt; + + log_tgt_mutex_lock(); + tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); + if (tgt == NULL) { + vty_out(vty, "%% Unable to find GSMTAP log target for %s%s", + hostname, VTY_NEWLINE); + RET_WITH_UNLOCK(CMD_WARNING); + } + + log_target_destroy(tgt); + + RET_WITH_UNLOCK(CMD_SUCCESS); +} + DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, "log stderr blocking-io", LOG_STR "Logging via STDERR of the process\n" @@ -1249,4 +1266,5 @@ install_lib_element(CONFIG_NODE, &cfg_log_systemd_journal_cmd); install_lib_element(CONFIG_NODE, &cfg_no_log_systemd_journal_cmd); install_lib_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); + install_lib_element(CONFIG_NODE, &cfg_no_log_gsmtap_cmd); }
View file
libosmocore_1.6.0.tar.xz/src/vty/stats_vty.c -> libosmocore_1.7.0.tar.xz/src/vty/stats_vty.c
Changed
@@ -1,5 +1,5 @@ /* - * (C) 2009-2010 by Harald Welte <laforge@gnumonks.org> + * (C) 2009-2022 by Harald Welte <laforge@gnumonks.org> * (C) 2009-2014 by Holger Hans Peter Freyther * (C) 2015 by sysmocom - s.f.m.c. GmbH * All Rights Reserved @@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdlib.h> @@ -37,11 +33,13 @@ #include <osmocom/core/stats.h> #include <osmocom/core/counter.h> #include <osmocom/core/rate_ctr.h> +#include <osmocom/core/stats_tcp.h> #define CFG_STATS_STR "Configure stats sub-system\n" #define CFG_REPORTER_STR "Configure a stats reporter\n" #define SHOW_STATS_STR "Show statistical values\n" +#define SKIP_ZERO_STR "Skip items with total count zero\n" #define STATS_STR "Stats related commands\n" @@ -393,27 +391,60 @@ return CMD_SUCCESS; } +DEFUN(cfg_tcp_stats_interval, cfg_tcp_stats_interval_cmd, + "stats-tcp interval <0-65535>", + CFG_STATS_STR "Set the tcp socket stats polling interval\n" + "Interval in seconds (0 disables the polling interval)\n") +{ + int rc; + int interval = atoi(argv0); + rc = osmo_stats_tcp_set_interval(interval); + if (rc < 0) { + vty_out(vty, "%% Unable to set interval: %s%s", + strerror(-rc), VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + +DEFUN(cfg_tcp_stats_batch_size, cfg_tcp_stats_batch_size_cmd, + "stats-tcp batch-size <1-65535>", + CFG_STATS_STR "Set the number of tcp sockets that are processed per stats polling interval\n" + "Number of sockets per interval\n") +{ + osmo_tcp_stats_config->batch_size = atoi(argv0); + return CMD_SUCCESS; +} + DEFUN(show_stats, show_stats_cmd, - "show stats", - SHOW_STR SHOW_STATS_STR) + "show stats skip-zero", + SHOW_STR SHOW_STATS_STR SKIP_ZERO_STR) { - vty_out_statistics_full(vty, ""); + bool skip_zero = false; + if (argc > 0) + skip_zero = true; + + vty_out_statistics_full2(vty, "", skip_zero); return CMD_SUCCESS; } DEFUN(show_stats_level, show_stats_level_cmd, - "show stats level (global|peer|subscriber)", + "show stats level (global|peer|subscriber) skip-zero", SHOW_STR SHOW_STATS_STR "Set the maximum group level\n" "Show global groups only\n" "Show global and network peer related groups\n" - "Show global, peer, and subscriber groups\n") + "Show global, peer, and subscriber groups\n" SKIP_ZERO_STR) { int level = get_string_value(stats_class_strs, argv0); - vty_out_statistics_partial(vty, "", level); + bool skip_zero = false; + if (argc > 1) + skip_zero = true; + vty_out_statistics_partial2(vty, "", level, skip_zero); return CMD_SUCCESS; } @@ -576,23 +607,32 @@ return CMD_SUCCESS; } +struct rctr_vty_ctx { + struct vty *vty; + bool skip_zero; +}; + static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_) { - struct vty *vty = sctx_; + struct rctr_vty_ctx *sctx = sctx_; + struct vty *vty = sctx->vty; vty_out(vty, "%s %u", ctrg->desc->group_description, ctrg->idx); if (ctrg->name != NULL) vty_out(vty, " (%s)", ctrg->name); vty_out(vty, ":%s", VTY_NEWLINE); - vty_out_rate_ctr_group_fmt(vty, "%25n: %10c (%S/s %M/m %H/h %D/d) %d", ctrg); + vty_out_rate_ctr_group_fmt2(vty, "%25n: %10c (%S/s %M/m %H/h %D/d) %d", ctrg, sctx->skip_zero); return 0; } DEFUN(show_rate_counters, show_rate_counters_cmd, - "show rate-counters", - SHOW_STR "Show all rate counters\n") + "show rate-counters skip-zero", + SHOW_STR "Show all rate counters\n" SKIP_ZERO_STR) { - rate_ctr_for_each_group(rate_ctr_group_handler, vty); + struct rctr_vty_ctx rctx = { .vty = vty, .skip_zero = false }; + if (argc > 0) + rctx.skip_zero = true; + rate_ctr_for_each_group(rate_ctr_group_handler, &rctx); return CMD_SUCCESS; } @@ -631,6 +671,11 @@ case OSMO_STATS_REPORTER_LOG: type = "log"; break; + default: + /* don't try to save unknown stats reporters to the VTY. Imagine some + * application registering a new application specific stats reporter that + * this VTY code knows nothing about! */ + return 0; } vty_out(vty, "stats reporter %s", type); @@ -681,6 +726,10 @@ struct osmo_stats_reporter *srep; vty_out(vty, "stats interval %d%s", osmo_stats_config->interval, VTY_NEWLINE); + if (osmo_tcp_stats_config->interval != TCP_STATS_DEFAULT_INTERVAL) + vty_out(vty, "stats-tcp interval %d%s", osmo_tcp_stats_config->interval, VTY_NEWLINE); + if (osmo_tcp_stats_config->batch_size != TCP_STATS_DEFAULT_BATCH_SIZE) + vty_out(vty, "stats-tcp batch-size %d%s", osmo_tcp_stats_config->batch_size, VTY_NEWLINE); /* Loop through all reporters */ llist_for_each_entry(srep, &osmo_stats_reporter_list, list) @@ -703,6 +752,8 @@ install_lib_element(CONFIG_NODE, &cfg_stats_reporter_log_cmd); install_lib_element(CONFIG_NODE, &cfg_no_stats_reporter_log_cmd); install_lib_element(CONFIG_NODE, &cfg_stats_interval_cmd); + install_lib_element(CONFIG_NODE, &cfg_tcp_stats_interval_cmd); + install_lib_element(CONFIG_NODE, &cfg_tcp_stats_batch_size_cmd); install_node(&cfg_stats_node, config_write_stats);
View file
libosmocore_1.6.0.tar.xz/src/vty/talloc_ctx_vty.c -> libosmocore_1.7.0.tar.xz/src/vty/talloc_ctx_vty.c
Changed
@@ -17,17 +17,13 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h> #include <regex.h> #include <string.h> -#include <talloc.h> +#include <osmocom/core/talloc.h> #include <osmocom/vty/command.h> #include <osmocom/vty/vty.h> @@ -151,6 +147,8 @@ /* Determine a context for report */ if (!strncmp(ctx, "app", 3)) talloc_ctx = host.app_info->tall_ctx; + else if (!strcmp(ctx, "global")) + talloc_ctx = OTC_GLOBAL; else if (!strncmp(ctx, "all", 3)) talloc_ctx = NULL; @@ -167,11 +165,12 @@ } #define BASE_CMD_STR \ - "show talloc-context (application|all) (full|brief|DEPTH)" + "show talloc-context (application|global|all) (full|brief|DEPTH)" #define BASE_CMD_DESCR \ SHOW_STR "Show talloc memory hierarchy\n" \ "Application's context\n" \ + "Global context (OTC_GLOBAL)\n" \ "All contexts, if NULL-context tracking is enabled\n" \ "Display a full talloc memory hierarchy\n" \ "Display a brief talloc memory hierarchy\n" \
View file
libosmocore_1.6.0.tar.xz/src/vty/tdef_vty.c -> libosmocore_1.7.0.tar.xz/src/vty/tdef_vty.c
Changed
@@ -242,7 +242,7 @@ /*! Write current timer configuration arguments to the vty. Skip all entries that reflect their default value. * The passed prefix string must contain both necessary indent and the VTY command the specific implementation is using. - * See tdef_vty_test_config_subnode.c and tdef_vty_test_dynamic.c for examples. + * See tdef_vty_config_subnode_test.c and tdef_vty_dynamic_test.c for examples. * \paramin vty VTY context. * \paramin tdefs Array of timers to print, ended with a fully zero-initialized entry. * \paramin prefix_fmt Arbitrary string to start each line with, with variable printf like arguments.
View file
libosmocore_1.6.0.tar.xz/src/vty/telnet_interface.c -> libosmocore_1.7.0.tar.xz/src/vty/telnet_interface.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <sys/socket.h>
View file
libosmocore_1.6.0.tar.xz/src/vty/utils.c -> libosmocore_1.7.0.tar.xz/src/vty/utils.c
Changed
@@ -18,13 +18,10 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdint.h> +#include <stdbool.h> #include <inttypes.h> #include <string.h> #include <ctype.h> @@ -48,6 +45,7 @@ struct vty *vty; const char *prefix; int max_level; + bool skip_zero; }; static int rate_ctr_handler( @@ -57,6 +55,9 @@ struct vty_out_context *vctx = vctx_; struct vty *vty = vctx->vty; + if (vctx->skip_zero && ctr->current == 0) + return 0; + vty_out(vty, " %s%s: %8" PRIu64 " " "(%" PRIu64 "/s %" PRIu64 "/m %" PRIu64 "/h %" PRIu64 "/d)%s", vctx->prefix, desc->description, ctr->current, @@ -73,17 +74,24 @@ * \paramin vty The VTY to which it should be printed * \paramin prefix Any additional log prefix ahead of each line * \paramin ctrg Rate counter group to be printed + * \paramin skip_zero Skip all zero-valued counters */ -void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, - struct rate_ctr_group *ctrg) +void vty_out_rate_ctr_group2(struct vty *vty, const char *prefix, + struct rate_ctr_group *ctrg, bool skip_zero) { - struct vty_out_context vctx = {vty, prefix}; + struct vty_out_context vctx = {vty, prefix, 0, skip_zero}; vty_out(vty, "%s%s:%s", prefix, ctrg->desc->group_description, VTY_NEWLINE); rate_ctr_for_each_counter(ctrg, rate_ctr_handler, &vctx); } +void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, + struct rate_ctr_group *ctrg) +{ + vty_out_rate_ctr_group2(vty, prefix, ctrg, false); +} + static char * pad_append_str(char *s, const char *a, int minwidth) { @@ -107,7 +115,12 @@ struct vty_out_context *vctx = vctx_; struct vty *vty = vctx->vty; const char *fmt = vctx->prefix; - char *s = talloc_strdup(vty, ""); + char *s; + + if (vctx->skip_zero && ctr->current == 0) + return 0; + + s = talloc_strdup(vty, ""); OSMO_ASSERT(s); while (*fmt) { @@ -209,14 +222,20 @@ * \paramin vty The VTY to which it should be printed * \paramin ctrg Rate counter group to be printed * \paramin fmt A format which may contain the above directives. + * \paramin skip_zero Skip all zero-valued counters */ -void vty_out_rate_ctr_group_fmt(struct vty *vty, const char *fmt, - struct rate_ctr_group *ctrg) +void vty_out_rate_ctr_group_fmt2(struct vty *vty, const char *fmt, + struct rate_ctr_group *ctrg, bool skip_zero) { - struct vty_out_context vctx = {vty, fmt}; + struct vty_out_context vctx = {vty, fmt, 0, skip_zero}; rate_ctr_for_each_counter(ctrg, rate_ctr_handler_fmt, &vctx); } +void vty_out_rate_ctr_group_fmt(struct vty *vty, const char *fmt, + struct rate_ctr_group *ctrg) +{ + vty_out_rate_ctr_group_fmt2(vty, fmt, ctrg, false); +} static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *vctx_) { struct vty_out_context *vctx = vctx_; @@ -248,12 +267,14 @@ struct vty_out_context *vctx = vctx_; struct vty *vty = vctx->vty; const struct osmo_stat_item_desc *desc = osmo_stat_item_get_desc(item); + int32_t value = osmo_stat_item_get_last(item); const char *unit = (desc->unit != OSMO_STAT_ITEM_NO_UNIT) ? desc->unit : ""; + if (vctx->skip_zero && value == 0) + return 0; + vty_out(vty, " %s%s: %8" PRIi32 " %s%s", - vctx->prefix, desc->description, - osmo_stat_item_get_last(item), - unit, VTY_NEWLINE); + vctx->prefix, desc->description, value, unit, VTY_NEWLINE); return 0; } @@ -262,17 +283,24 @@ * \paramin vty The VTY to which it should be printed * \paramin prefix Any additional log prefix ahead of each line * \paramin statg Stat item group to be printed + * \paramin skip_zero Skip all zero-valued counters */ -void vty_out_stat_item_group(struct vty *vty, const char *prefix, - struct osmo_stat_item_group *statg) +void vty_out_stat_item_group2(struct vty *vty, const char *prefix, + struct osmo_stat_item_group *statg, bool skip_zero) { - struct vty_out_context vctx = {vty, prefix}; + struct vty_out_context vctx = {vty, prefix, 0, skip_zero}; vty_out(vty, "%s%s:%s", prefix, statg->desc->group_description, VTY_NEWLINE); osmo_stat_item_for_each_item(statg, osmo_stat_item_handler, &vctx); } +void vty_out_stat_item_group(struct vty *vty, const char *prefix, + struct osmo_stat_item_group *statg) +{ + return vty_out_stat_item_group2(vty, prefix, statg, false); +} + static int osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *vctx_) { struct vty_out_context *vctx = vctx_; @@ -302,21 +330,22 @@ struct vty_out_context *vctx = vctx_; struct vty *vty = vctx->vty; const char *description = counter->description; + unsigned long value = osmo_counter_get(counter); + + if (vctx->skip_zero && value == 0) + return 0; if (!counter->description) description = counter->name; - vty_out(vty, " %s%s: %8lu%s", - vctx->prefix, description, - osmo_counter_get(counter), VTY_NEWLINE); + vty_out(vty, " %s%s: %8lu%s", vctx->prefix, description, value, VTY_NEWLINE); return 0; } -void vty_out_statistics_partial(struct vty *vty, const char *prefix, - int max_level) +void vty_out_statistics_partial2(struct vty *vty, const char *prefix, int max_level, bool skip_zero) { - struct vty_out_context vctx = {vty, prefix, max_level}; + struct vty_out_context vctx = {vty, prefix, max_level, skip_zero}; vty_out(vty, "%sUngrouped counters:%s", prefix, VTY_NEWLINE); osmo_counters_for_each(handle_counter, &vctx); @@ -324,9 +353,19 @@ osmo_stat_item_for_each_group(osmo_stat_item_group_handler, &vctx); } +void vty_out_statistics_partial(struct vty *vty, const char *prefix, int max_level) +{ + return vty_out_statistics_partial2(vty, prefix, max_level, false); +} + +void vty_out_statistics_full2(struct vty *vty, const char *prefix, bool skip_zero) +{ + vty_out_statistics_partial2(vty, prefix, INT_MAX, skip_zero); +} + void vty_out_statistics_full(struct vty *vty, const char *prefix) { - vty_out_statistics_partial(vty, prefix, INT_MAX); + vty_out_statistics_full2(vty, prefix, false); } /*! Generate a VTY command string from value_string */
View file
libosmocore_1.6.0.tar.xz/src/vty/vector.c -> libosmocore_1.7.0.tar.xz/src/vty/vector.c
Changed
@@ -16,11 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. */ #include <stdlib.h>
View file
libosmocore_1.6.0.tar.xz/src/write_queue.c -> libosmocore_1.7.0.tar.xz/src/write_queue.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <errno.h> @@ -106,7 +102,7 @@ /*! Enqueue a new \ref msgb into a write queue (without logging full queue events) * \paramin queue Write queue to be used * \paramin data to-be-enqueued message buffer - * \returns 0 on success; negative on error + * \returns 0 on success; negative on error (MESSAGE NOT FREED IN CASE OF ERROR). */ int osmo_wqueue_enqueue_quiet(struct osmo_wqueue *queue, struct msgb *data) { @@ -122,7 +118,7 @@ /*! Enqueue a new \ref msgb into a write queue * \paramin queue Write queue to be used * \paramin data to-be-enqueued message buffer - * \returns 0 on success; negative on error + * \returns 0 on success; negative on error (MESSAGE NOT FREED IN CASE OF ERROR). */ int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data) {
View file
libosmocore_1.6.0.tar.xz/tests/Makefile.am -> libosmocore_1.7.0.tar.xz/tests/Makefile.am
Changed
@@ -28,9 +28,9 @@ oap/oap_client_test gsm29205/gsm29205_test \ logging/logging_vty_test \ vty/vty_transcript_test \ - tdef/tdef_test tdef/tdef_vty_test_config_root \ - tdef/tdef_vty_test_config_subnode \ - tdef/tdef_vty_test_dynamic \ + tdef/tdef_test tdef/tdef_vty_config_root_test \ + tdef/tdef_vty_config_subnode_test \ + tdef/tdef_vty_dynamic_test \ sockaddr_str/sockaddr_str_test \ use_count/use_count_test \ context/context_test \ @@ -45,6 +45,7 @@ time_cc/time_cc_test \ gsm48/rest_octets_test \ base64/base64_test \ + iuup/iuup_test \ $(NULL) if ENABLE_MSGFILE @@ -286,14 +287,14 @@ tdef_tdef_test_SOURCES = tdef/tdef_test.c tdef_tdef_test_LDADD = $(LDADD) -tdef_tdef_vty_test_config_root_SOURCES = tdef/tdef_vty_test_config_root.c -tdef_tdef_vty_test_config_root_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la +tdef_tdef_vty_config_root_test_SOURCES = tdef/tdef_vty_config_root_test.c +tdef_tdef_vty_config_root_test_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la -tdef_tdef_vty_test_config_subnode_SOURCES = tdef/tdef_vty_test_config_subnode.c -tdef_tdef_vty_test_config_subnode_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la +tdef_tdef_vty_config_subnode_test_SOURCES = tdef/tdef_vty_config_subnode_test.c +tdef_tdef_vty_config_subnode_test_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la -tdef_tdef_vty_test_dynamic_SOURCES = tdef/tdef_vty_test_dynamic.c -tdef_tdef_vty_test_dynamic_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la +tdef_tdef_vty_dynamic_test_SOURCES = tdef/tdef_vty_dynamic_test.c +tdef_tdef_vty_dynamic_test_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la sockaddr_str_sockaddr_str_test_SOURCES = sockaddr_str/sockaddr_str_test.c sockaddr_str_sockaddr_str_test_LDADD = $(LDADD) @@ -328,6 +329,9 @@ time_cc_time_cc_test_SOURCES = time_cc/time_cc_test.c time_cc_time_cc_test_LDADD = $(LDADD) +iuup_iuup_test_SOURCES = iuup/iuup_test.c +iuup_iuup_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la + # The `:;' works around a Bash 3.2 bug when the output is not writeable. $(srcdir)/package.m4: $(top_srcdir)/configure.ac :;{ \ @@ -402,9 +406,9 @@ vty/vty_transcript_test.vty \ tdef/tdef_test.ok \ tdef/tdef_test_range_64bit.ok \ - tdef/tdef_vty_test_config_root.vty \ - tdef/tdef_vty_test_config_subnode.vty \ - tdef/tdef_vty_test_dynamic.vty \ + tdef/tdef_vty_config_root_test.vty \ + tdef/tdef_vty_config_subnode_test.vty \ + tdef/tdef_vty_dynamic_test.vty \ sockaddr_str/sockaddr_str_test.ok \ use_count/use_count_test.ok use_count/use_count_test.err \ context/context_test.ok \ @@ -420,6 +424,7 @@ time_cc/time_cc_test.ok \ gsm48/rest_octets_test.ok \ base64/base64_test.ok \ + iuup/iuup_test.ok \ $(NULL) if ENABLE_LIBSCTP @@ -616,6 +621,8 @@ >$(srcdir)/it_q/it_q_test.ok time_cc/time_cc_test \ >$(srcdir)/time_cc/time_cc_test.ok + iuup/iuup_test \ + >$(srcdir)/iuup/iuup_test.ok check-local: atconfig $(TESTSUITE) -e /proc/cpuinfo && cat /proc/cpuinfo @@ -678,16 +685,16 @@ vty-test-tdef: osmo_verify_transcript_vty.py -v \ -p 42042 \ - -r "$(top_builddir)/tests/tdef/tdef_vty_test_config_root" \ - $(U) $(srcdir)/tdef/tdef_vty_test_config_root.vty + -r "$(top_builddir)/tests/tdef/tdef_vty_config_root_test" \ + $(U) $(srcdir)/tdef/tdef_vty_config_root_test.vty osmo_verify_transcript_vty.py -v \ -p 42042 \ - -r "$(top_builddir)/tests/tdef/tdef_vty_test_config_subnode" \ - $(U) $(srcdir)/tdef/tdef_vty_test_config_subnode.vty + -r "$(top_builddir)/tests/tdef/tdef_vty_config_subnode_test" \ + $(U) $(srcdir)/tdef/tdef_vty_config_subnode_test.vty osmo_verify_transcript_vty.py -v \ -p 42042 \ - -r "$(top_builddir)/tests/tdef/tdef_vty_test_dynamic" \ - $(U) $(srcdir)/tdef/tdef_vty_test_dynamic.vty + -r "$(top_builddir)/tests/tdef/tdef_vty_dynamic_test" \ + $(U) $(srcdir)/tdef/tdef_vty_dynamic_test.vty vty-test-stats: osmo_verify_transcript_vty.py -v \
View file
libosmocore_1.6.0.tar.xz/tests/abis/abis_test.c -> libosmocore_1.7.0.tar.xz/tests/abis/abis_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/application.h> @@ -197,6 +193,52 @@ msgb_free(msg); } +/* Test decode IPAC_DLCX_IND obtained from SYS#5915 */ +static void test_dec_ipac_dlc_indx() +{ +/* Radio Signalling Link (RSL) + 0111 111. = Message discriminator: ip.access Vendor Specific messages (63) + .... ...0 = T bit: Not considered transparent by BTS + .111 0110 = Message type: ip.access DLCX INDication (0x76) + Channel number IE + Element identifier: Channel Number (0x01) + 0000 1... = C-bits: Bm + ACCH (1) + .... .110 = Time slot number (TN): 6 + Element identifier: Connection Identifier (0xf8) + ip.access Connection ID: 0 + Element identifier: Connection Statistics (0xf6) + 1 byte length here, val = 28 (0x1c) + Packets Sent: 1202 + Octets Sent: 45052 + Packets Received: 556 + Octets Received: 24580 + Packets Lost: 0 + Inter-arrival Jitter: 0 + Average Tx Delay: 0 + Cause IE + Element identifier: Cause (0x1a) + Length: 1 + 0... .... = Extension: No Extension + .000 .... = Class: Normal event (0) + .000 1111 = Cause Value: normal event, unspecified (15) +*/ + const uint8_t hex = { + 0x7e, 0x76, 0x01, 0x0e, 0xf8, 0x00, 0x00, 0xf6, 0x1c, 0x00, 0x00, 0x04, 0xb2, 0x00, 0x00, 0xaf, + 0xfc, 0x00, 0x00, 0x02, 0x2c, 0x00, 0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x01, 0x0f + }; + struct abis_rsl_dchan_hdr *dh = (struct abis_rsl_dchan_hdr *)&hex0; + + struct tlv_parsed tp; + int rc; + + printf("Testing decoding IPAC_DLCX_IND\n"); + + rc = rsl_tlv_parse(&tp, dh->data, sizeof(hex) - sizeof(*dh)); + + OSMO_ASSERT(rc == 3); +} + int main(int argc, char **argv) { void *ctx = talloc_named_const(NULL, 0, "abis_test"); @@ -206,6 +248,7 @@ test_simple_sw_config(); test_simple_sw_short(); test_dual_sw_config(); + test_dec_ipac_dlc_indx(); printf("OK.\n");
View file
libosmocore_1.6.0.tar.xz/tests/abis/abis_test.ok -> libosmocore_1.7.0.tar.xz/tests/abis/abis_test.ok
Changed
@@ -38,4 +38,5 @@ file_id: 09 07 05 file_ver: 06 07 08 test_dual_sw_config(): OK +Testing decoding IPAC_DLCX_IND OK.
View file
libosmocore_1.6.0.tar.xz/tests/bitvec/bitvec_test.c -> libosmocore_1.7.0.tar.xz/tests/bitvec/bitvec_test.c
Changed
@@ -237,7 +237,8 @@ #define _bitvec_read_field(idx, len) \ readIndex = idx; \ field = bitvec_read_field(&bv, &readIndex, len); \ - printf("bitvec_read_field(idx=%u, len=%u) => %" PRIx64 "\n", idx, len, field); + printf("bitvec_read_field(idx=%u, len=%u) => %" PRIx64 " (%s)\n", \ + idx, len, field, errno == 0 ? "success" : "error"); _bitvec_read_field(0, 64); _bitvec_read_field(0, 32);
View file
libosmocore_1.6.0.tar.xz/tests/bitvec/bitvec_test.ok -> libosmocore_1.7.0.tar.xz/tests/bitvec/bitvec_test.ok
Changed
@@ -171,21 +171,21 @@ bitvec bytes used. test bitvec_read_field(): -bitvec_read_field(idx=0, len=64) => deadbeeffeebdaed -bitvec_read_field(idx=0, len=32) => deadbeef -bitvec_read_field(idx=0, len=16) => dead -bitvec_read_field(idx=0, len=8) => de -bitvec_read_field(idx=0, len=0) => 0 -bitvec_read_field(idx=8, len=8) => ad -bitvec_read_field(idx=8, len=4) => a -bitvec_read_field(idx=8, len=0) => 0 -bitvec_read_field(idx=10, len=9) => 16d -bitvec_read_field(idx=10, len=7) => 5b -bitvec_read_field(idx=10, len=5) => 16 -bitvec_read_field(idx=10, len=3) => 5 -bitvec_read_field(idx=10, len=1) => 1 -bitvec_read_field(idx=512, len=16) => ffffffffffffffea -bitvec_read_field(idx=0, len=65) => ffffffffffffffea -bitvec_read_field(idx=64, len=16) => ffffffffffffffea +bitvec_read_field(idx=0, len=64) => deadbeeffeebdaed (success) +bitvec_read_field(idx=0, len=32) => deadbeef (success) +bitvec_read_field(idx=0, len=16) => dead (success) +bitvec_read_field(idx=0, len=8) => de (success) +bitvec_read_field(idx=0, len=0) => 0 (success) +bitvec_read_field(idx=8, len=8) => ad (success) +bitvec_read_field(idx=8, len=4) => a (success) +bitvec_read_field(idx=8, len=0) => 0 (success) +bitvec_read_field(idx=10, len=9) => 16d (success) +bitvec_read_field(idx=10, len=7) => 5b (success) +bitvec_read_field(idx=10, len=5) => 16 (success) +bitvec_read_field(idx=10, len=3) => 5 (success) +bitvec_read_field(idx=10, len=1) => 1 (success) +bitvec_read_field(idx=512, len=16) => 0 (error) +bitvec_read_field(idx=0, len=65) => 0 (error) +bitvec_read_field(idx=64, len=16) => 0 (error) bitvec ok.
View file
libosmocore_1.6.0.tar.xz/tests/bssmap_le/bssmap_le_test.c -> libosmocore_1.7.0.tar.xz/tests/bssmap_le/bssmap_le_test.c
Changed
@@ -118,6 +118,36 @@ }, }, }, + { + .msg_type = BSSMAP_LE_MSGT_PERFORM_LOC_REQ, + .perform_loc_req = { + .location_type = { + .location_information = BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC, + }, + + .cell_id = { + .id_discr = CELL_IDENT_LAC_AND_CI, + .id.lac_and_ci = { + .lac = 23, + .ci = 42, + }, + }, + + .lcs_client_type_present = true, + .lcs_client_type = BSSMAP_LE_LCS_CTYPE_EMERG_SVC_UNSPECIFIED, + + .more_items = true, + + .lcs_priority_present = true, + .lcs_priority = 0x00, /* highest */ + + .lcs_qos_present = true, + .lcs_qos = { + .ha_ind = 1, + .ha_val = 0x12, + }, + }, + }, }; void test_bssmap_le_enc_dec()
View file
libosmocore_1.6.0.tar.xz/tests/bssmap_le/bssmap_le_test.ok -> libosmocore_1.7.0.tar.xz/tests/bssmap_le/bssmap_le_test.ok
Changed
@@ -9,3 +9,4 @@ 7 CONNECTION ORIENTED INFORMATON: ok (encoded len = 8) 8 CONNECTION ORIENTED INFORMATON: ok (encoded len = 13) 9 CONNECTION ORIENTED INFORMATON: ok (encoded len = 10) +10 PERFORM LOCATION REQUEST: ok (encoded len = 25)
View file
libosmocore_1.6.0.tar.xz/tests/coding/coding_test.c -> libosmocore_1.7.0.tar.xz/tests/coding/coding_test.c
Changed
@@ -13,10 +13,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/dtx/dtx_gsm0503_test.c -> libosmocore_1.7.0.tar.xz/tests/dtx/dtx_gsm0503_test.c
Changed
@@ -15,18 +15,18 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h> #include <stdio.h> #include <stdint.h> #include <osmocom/core/utils.h> +#include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_amr_dtx.h> +/* Length of payload bits in a Normal Burst */ +#define BURST_PLEN (57 * 2 + 2) + char sample_afs_sid_frame = { "111111110000000011001100101010100100010011111111001000100111011110011001001100111100110010011001111011100100010011111111001000100111011110011001001100111100110010011001111011100100010011111111001000100111011110011001001100111100110010011001111011100100010011111111001000100111011110011001001100111100110010011001111011100100010011111111001000100111011110011001001100111100110010011001111011100100010011111111001000100111011110011001001100111100110010011001" @@ -72,7 +72,7 @@ "xBxBxBxBxBxBxBxBxBxBxBxBxBxBxBxBx0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1x1x1x1x0x0x1x0x0x1" }; -unsigned int string_to_ubit(ubit_t * ubits, char *string) +unsigned int string_to_sbit(sbit_t *sbits, char *string) { unsigned int len; unsigned int i; @@ -80,7 +80,7 @@ len = strlen(string); for (i = 0; i < len; i++) { - ubitsi = stringi & 1; + sbitsi = stringi == '1' ? -127 : 127; } return len; @@ -88,28 +88,161 @@ void test_gsm0503_detect_afs_dtx_frame(char *string) { - ubit_t ubits512; + sbit_t sbits512; uint8_t dtx_frame_type; int n_errors; int n_bits_total; + int mode_id = -1; - string_to_ubit(ubits, string); - dtx_frame_type = gsm0503_detect_afs_dtx_frame(&n_errors, &n_bits_total, ubits); - printf(" ==> %s, n_errors=%i, n_bits_total=%i\n", gsm0503_amr_dtx_frame_name(dtx_frame_type), - n_errors, n_bits_total); + string_to_sbit(sbits, string); + dtx_frame_type = gsm0503_detect_afs_dtx_frame2(&n_errors, &n_bits_total, &mode_id, sbits); + printf(" ==> %s, n_errors=%d, n_bits_total=%d, mode_id=%d\n", + gsm0503_amr_dtx_frame_name(dtx_frame_type), + n_errors, n_bits_total, mode_id); } void test_gsm0503_detect_ahs_dtx_frame(char *string) { - ubit_t ubits512; + sbit_t sbits512; uint8_t dtx_frame_type; int n_errors; int n_bits_total; + int mode_id = -1; - string_to_ubit(ubits, string); - dtx_frame_type = gsm0503_detect_ahs_dtx_frame(&n_errors, &n_bits_total, ubits); - printf(" ==> %s, n_errors=%i, n_bits_total=%i\n", gsm0503_amr_dtx_frame_name(dtx_frame_type), - n_errors, n_bits_total); + string_to_sbit(sbits, string); + dtx_frame_type = gsm0503_detect_ahs_dtx_frame2(&n_errors, &n_bits_total, &mode_id, sbits); + printf(" ==> %s, n_errors=%d, n_bits_total=%d, mode_id=%d\n", + gsm0503_amr_dtx_frame_name(dtx_frame_type), + n_errors, n_bits_total, mode_id); +} + +static void test_gsm0503_tch_afhs_decode_dtx(const sbit_t *bursts, size_t offset, + enum gsm0503_amr_dtx_frames *amr_last_dtx, + bool full_rate, const char *test_desc) +{ + uint8_t tch_data128; /* just to be safe */ + int n_errors = 0, n_bits_total = 0; + int rc; + + printf("Running %s(at offset=%zu): testing %s\n", __func__, offset, test_desc); + + /* Dummy (not really important) values */ + uint8_t codec4 = { 0, 1, 2, 3 }; + int codecs = ARRAY_SIZE(codec); + uint8_t ul_cmr = 0; + uint8_t ul_ft = 0; + + if (full_rate) { + rc = gsm0503_tch_afs_decode_dtx(&tch_data0, &burstsoffset, false, + codec, codecs, &ul_ft, &ul_cmr, + &n_errors, &n_bits_total, + (uint8_t *)amr_last_dtx); + } else { + rc = gsm0503_tch_ahs_decode_dtx(&tch_data0, &burstsoffset, false, false, + codec, codecs, &ul_ft, &ul_cmr, + &n_errors, &n_bits_total, + (uint8_t *)amr_last_dtx); + } + printf(" ==> gsm0503_tch_a%cs_decode_dtx() yields '%s' (rc=%d, BER %d/%d)\n", + full_rate ? 'f' : 'h', gsm0503_amr_dtx_frame_name(*amr_last_dtx), + rc, n_errors, n_bits_total); + if (rc > 0) + printf(" ====> tch_data = { %s }\n", osmo_hexdump_nospc(tch_data, rc)); +} + +static void test_gsm0503_tch_afhs_decode_dtx_sid_update(void) +{ + enum gsm0503_amr_dtx_frames amr_last_dtx = AMR_OTHER; + sbit_t burstsBURST_PLEN * 12; /* 12 bursts */ + int rc; + + /* 456 soft-bits containing an AFS_SID_UPDATE frame (captured on the air) */ + const char *afs_sid_update = \ + "94 81 83 76 7b 81 6b 7f 76 8c 81 81 81 86 71 7f 75 81 6d 7a 81 6b 7f 78 8a 87 70 75 8e" + "81 8d 7f 81 70 72 81 7f 85 86 7f 93 81 8a 74 7f 71 89 8a 75 7f 7f 78 8c 81 8b 7f 81 7f" + "7f 7f 70 8a 8b 7f 90 81 81 81 8a 77 7f 7f 70 81 70 71 86 8e 7f 81 7f 81 75 72 87 8c 76" + "7f 72 8e 81 81 81 81 92 7f 8c 81 92 7f 8c 89 7f 81 7f 8f 8b 77 76 86 8c 78 73 88 81 8b" + "81 7f 8c 85 77 7b 8d 81 81 81 8b 7f 81 7f 8e 81 8e 7f 8a 8a 7f 93 85 6b 7f 7f 72 81 6f" + "76 89 81 81 81 8a 73 7f 72 88 87 73 7f 73 81 7f 81 7f 92 87 73 78 81 6f 7f 71 81 76 77" + "6f 81 7f 81 71 7f 6e 81 75 77 83 81 81 90 7f 8b 88 76 76 8a 8d 76 74 81 7f 92 81 81 8b" + "78 72 81 77 76 81 6c 7c 8b 81 81 8d 7f 8b 81 8e 74 7f 7f 72 81 7f 81 74 7f 71 81 75 7f" + "8e 81 81 8c 72 79 85 8c 78 75 8c 8a 7f 90 81 8e 77 77 81 70 7f 7f 71 81 7f 81 7f 8e 89" + "7f 8f 81 8f 7f 8c 8d 7f 81 7f 81 6f 7f 71 8a 87 7f 81 6f 77 81 7f 8d 88 73 79 8a 8a 7f" + "7f 7f 7f 7f 76 8b 81 8c 77 7c 8a 81 91 7f 81 76 79 81 71 7f 7f 6f 84 8e 78 7f 7f 7f 74" + "88 86 7b 77 81 6f 7f 7f 7f 7f 7f 75 81 70 7f 76 89 81 81 81 8d 78 74 84 81 8e 7f 8d 8a" + "7f 79 8c 87 7f 81 7f 81 6f 7f 75 8d 8a 7f 81 7f 92 81 81 85 76 7f 6f 8c 88 6c 7f 73 91" + "81 8d 71 7f 7f 73 8d 88 7f 81 7f 91 86 6f 7f 73 8e 81 8d 79 78 81 72 74 8c 86 72 7f 77" + "6e 81 7f 81 77 76 81 72 74 81 6f 7f 6f 8d 81 91 7f 81 6d 7f 6d 81 6c 7f 6c 81 7f 81 7f" + "8c 8b 7f 8e 89 74 74 8c 81 81 81 81 81 92 7f 8e 8b 7f 93 81 8f 7f 90 81 8d 74 7b 8b 89"; + + memset(&bursts0, 0, sizeof(bursts)); + rc = osmo_hexparse(afs_sid_update, (uint8_t *)&burstsBURST_PLEN * 4, BURST_PLEN * 8); + OSMO_ASSERT(rc == BURST_PLEN * 4); + + /* Test detection of AFS_SID_UPDATE (marker) */ + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 0, &amr_last_dtx, true /* AFS */, + "detection of AFS_SID_UPDATE"); + + /* Test decoding of AFS_SID_UPDATE_CN (actual SID) */ + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 4, &amr_last_dtx, true /* AFS */, + "decoding of AFS_SID_UPDATE"); + + /* 456 soft-bits containing an AHS_SID_UPDATE frame (captured on the air) */ + const char *ahs_sid_update = \ + "81 67 7f 7f 7f 71 8f 88 6f 73 81 7e 81 6b 7f 7e 7d 6f 8f 8a 72 76 92 81 82 81 8f 6d 6f" + "81 7f 92 8c 7f 97 81 8e 6f 7f 7c 7f 6e 81 7e 81 6e 73 81 7f 93 8d 6f 7f 6c 81 6b 7f 72" + "7c 7c 7d 7f 6f 8f 81 94 7f 92 8d 6e 7d 7d 7f 6c 8b 8e 73 71 81 7f 92 90 7f 81 6e 6e 81" + "7f 94 8e 70 7f 6e 8c 8d 77 7f 6a 81 7f 81 70 6d 81 6c 71 8c 91 7f 90 8e 73 6e 81 6d 7f" + "81 8b 71 6e 81 7f 82 7c 81 7f 81 6d 73 81 6c 6d 81 6d 7f 6e 81 7e 81 6b 7f 7f 7f 6b 81" + "6e 6f 81 68 7f 71 91 81 82 81 8e 70 7f 7c 7d 7f 70 81 7f 91 8f 7f 81 6c 7f 71 81 6d 74" + "6f 8f 81 92 7f 82 7f 91 8b 7f 81 6b 7f 6d 81 6b 6f 81 6f 6e 90 81 81 92 7f 94 81 95 7f" + "96 81 96 70 7f 72 8f 81 95 7f 81 6f 70 81 7f 90 92 7f 81 6c 70 81 6b 7f 6f 8d 8d 7f 81" + "77 81 6a 7e 7e 73 92 8c 7f 81 6a 7f 6c 8e 8e 6e 7f 71 8e 8d 7e 81 6d 7f 6c 81 6d 6c 81" + "7f 94 81 92 7f 97 81 92 6e 7f 70 8c 8b 73 73 91 81 93 7f 81 70 72 81 7d 81 71 70 81 7f" + "7d 7f 6d 90 8d 73 76 92 81 92 6f 7d 7d 70 91 81 8f 73 75 8c 90 7f 94 81 91 70 7f 7d 7e" + "70 8d 8d 73 7f 7c 7e 6a 81 7e 81 6d 7f 6a 81 6f 7f 7f 71 8e 81 82 81 81 81 96 72 7e 7d" + "81 8d 7f 81 68 7f 7e 7c 7b 7f 6c 81 6a 7f 7f 71 8f 8d 7f 81 6c 72 8e 88 70 70 81 6d 70" + "8d 90 7f 81 7e 95 81 94 7f 92 8b 6e 7f 7f 70 8c 8c 73 75 91 81 91 6d 7d 7e 7b 7c 7d 71" + "6c 89 91 7f 81 7f 95 81 93 7f 95 90 7f 81 6d 70 81 6f 75 8c 8e 75 71 81 6e 70 8d 8d 7f" + "91 92 7f 81 7f 94 8d 70 71 81 6e 6d 81 6e 75 8e 81 93 70 7f 70 8f 8c 7f 81 6d 6f 81 6a"; + + memset(&bursts0, 0, sizeof(bursts)); + rc = osmo_hexparse(ahs_sid_update, (uint8_t *)&burstsBURST_PLEN * 2, BURST_PLEN * 10); + OSMO_ASSERT(rc == BURST_PLEN * 4); + + /* Test detection and decoding of AHS_SID_UPDATE */ + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 0, &amr_last_dtx, false /* AHS */, + "detection/decoding of AHS_SID_UPDATE"); + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 2, &amr_last_dtx, false /* AHS */, + "detection/decoding of AHS_SID_UPDATE"); + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 4, &amr_last_dtx, false /* AHS */, + "detection/decoding of AHS_SID_UPDATE"); +} + +static void test_gsm0503_tch_afhs_decode_dtx_facch(void) +{ + enum gsm0503_amr_dtx_frames amr_last_dtx; + sbit_t burstsBURST_PLEN * 8; /* 8 bursts */ + unsigned int i; + + /* Set stealing bits to provoke FACCH/FH detection */ + for (i = 0; i < 8; i++) { + sbit_t *burst = &burstsBURST_PLEN * i; + memset(&burst0, 0, BURST_PLEN); + bursti >> 2 ? 57 : 58 = -127; + } + + amr_last_dtx = AFS_SID_UPDATE; + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 0, + &amr_last_dtx, true /* AFS */, + "tagging of FACCH/F"); + OSMO_ASSERT(amr_last_dtx == AMR_OTHER); + + amr_last_dtx = AHS_SID_UPDATE; + test_gsm0503_tch_afhs_decode_dtx(&bursts0, BURST_PLEN * 0, + &amr_last_dtx, false /* AHS */, + "tagging of FACCH/H"); + OSMO_ASSERT(amr_last_dtx == AMR_OTHER); } int main(int argc, char **argv) @@ -126,5 +259,8 @@ test_gsm0503_detect_ahs_dtx_frame(sample_sid_first_inh_frame); test_gsm0503_detect_ahs_dtx_frame(sample_sid_update_inh_frame); + test_gsm0503_tch_afhs_decode_dtx_sid_update(); + test_gsm0503_tch_afhs_decode_dtx_facch(); + return EXIT_SUCCESS; }
View file
libosmocore_1.6.0.tar.xz/tests/dtx/dtx_gsm0503_test.ok -> libosmocore_1.7.0.tar.xz/tests/dtx/dtx_gsm0503_test.ok
Changed
@@ -1,11 +1,27 @@ FR AMR DTX FRAMES: - ==> AFS_SID_FIRST, n_errors=0, n_bits_total=212 - ==> AFS_SID_UPDATE (marker), n_errors=0, n_bits_total=212 - ==> AFS_ONSET, n_errors=0, n_bits_total=228 + ==> AFS_SID_FIRST, n_errors=0, n_bits_total=212, mode_id=-1 + ==> AFS_SID_UPDATE (marker), n_errors=0, n_bits_total=212, mode_id=-1 + ==> AFS_ONSET, n_errors=0, n_bits_total=228, mode_id=0 HR AMR DTX FRAMES: - ==> AHS_SID_UPDATE (marker), n_errors=0, n_bits_total=212 - ==> AHS_SID_FIRST_P1, n_errors=0, n_bits_total=212 - ==> AHS_SID_FIRST_P2, n_errors=0, n_bits_total=114 - ==> AHS_ONSET, n_errors=0, n_bits_total=114 - ==> AHS_SID_FIRST_INH, n_errors=0, n_bits_total=212 - ==> AHS_SID_UPDATE_INH, n_errors=0, n_bits_total=212 + ==> AHS_SID_UPDATE (marker), n_errors=0, n_bits_total=212, mode_id=-1 + ==> AHS_SID_FIRST_P1, n_errors=0, n_bits_total=212, mode_id=-1 + ==> AHS_SID_FIRST_P2, n_errors=0, n_bits_total=114, mode_id=0 + ==> AHS_ONSET, n_errors=0, n_bits_total=114, mode_id=0 + ==> AHS_SID_FIRST_INH, n_errors=0, n_bits_total=212, mode_id=-1 + ==> AHS_SID_UPDATE_INH, n_errors=0, n_bits_total=212, mode_id=-1 +Running test_gsm0503_tch_afhs_decode_dtx(at offset=0): testing detection of AFS_SID_UPDATE + ==> gsm0503_tch_afs_decode_dtx() yields 'AFS_SID_UPDATE (marker)' (rc=0, BER 0/212) +Running test_gsm0503_tch_afhs_decode_dtx(at offset=464): testing decoding of AFS_SID_UPDATE + ==> gsm0503_tch_afs_decode_dtx() yields 'AFS_SID_UPDATE_CN (audio)' (rc=5, BER 0/212) + ====> tch_data = { 26e9b1d2b0 } +Running test_gsm0503_tch_afhs_decode_dtx(at offset=0): testing detection/decoding of AHS_SID_UPDATE + ==> gsm0503_tch_ahs_decode_dtx() yields 'AMR_OTHER (audio)' (rc=-1, BER 109/212) +Running test_gsm0503_tch_afhs_decode_dtx(at offset=232): testing detection/decoding of AHS_SID_UPDATE + ==> gsm0503_tch_ahs_decode_dtx() yields 'AHS_SID_UPDATE_CN (audio)' (rc=5, BER 0/424) + ====> tch_data = { 6003ccb270 } +Running test_gsm0503_tch_afhs_decode_dtx(at offset=464): testing detection/decoding of AHS_SID_UPDATE + ==> gsm0503_tch_ahs_decode_dtx() yields 'AMR_OTHER (audio)' (rc=-1, BER 111/212) +Running test_gsm0503_tch_afhs_decode_dtx(at offset=0): testing tagging of FACCH/F + ==> gsm0503_tch_afs_decode_dtx() yields 'AMR_OTHER (audio)' (rc=-1, BER 456/456) +Running test_gsm0503_tch_afhs_decode_dtx(at offset=0): testing tagging of FACCH/H + ==> gsm0503_tch_ahs_decode_dtx() yields 'AMR_OTHER (audio)' (rc=-1, BER 456/456)
View file
libosmocore_1.6.0.tar.xz/tests/fr/fr_test.c -> libosmocore_1.7.0.tar.xz/tests/fr/fr_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #define _GNU_SOURCE
View file
libosmocore_1.6.0.tar.xz/tests/gsm0408/gsm0408_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm0408/gsm0408_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -1736,6 +1732,16 @@ VERIFY(rc, <, 0); } +static void test_rach_tx_integer_raw2val() +{ + unsigned int raw; + for (raw = 0; raw <= 0x0f; raw++) { + unsigned int val = rach_tx_integer_raw2val(raw); + printf("rach_tx_integer_raw2val(0x0%x): %u slots used to spread transmission\n", + raw, val); + } +} + int main(int argc, char **argv) { test_bearer_cap(); @@ -1754,6 +1760,7 @@ test_print_encoding(); test_range_encoding(); test_power_ctrl(); + test_rach_tx_integer_raw2val(); return EXIT_SUCCESS; }
View file
libosmocore_1.6.0.tar.xz/tests/gsm0408/gsm0408_test.ok -> libosmocore_1.7.0.tar.xz/tests/gsm0408/gsm0408_test.ok
Changed
@@ -791,3 +791,19 @@ Random range test: range 255, max num ARFCNs 22 Random range test: range 511, max num ARFCNs 18 Random range test: range 1023, max num ARFCNs 16 +rach_tx_integer_raw2val(0x00): 3 slots used to spread transmission +rach_tx_integer_raw2val(0x01): 4 slots used to spread transmission +rach_tx_integer_raw2val(0x02): 5 slots used to spread transmission +rach_tx_integer_raw2val(0x03): 6 slots used to spread transmission +rach_tx_integer_raw2val(0x04): 7 slots used to spread transmission +rach_tx_integer_raw2val(0x05): 8 slots used to spread transmission +rach_tx_integer_raw2val(0x06): 9 slots used to spread transmission +rach_tx_integer_raw2val(0x07): 10 slots used to spread transmission +rach_tx_integer_raw2val(0x08): 11 slots used to spread transmission +rach_tx_integer_raw2val(0x09): 12 slots used to spread transmission +rach_tx_integer_raw2val(0x0a): 14 slots used to spread transmission +rach_tx_integer_raw2val(0x0b): 16 slots used to spread transmission +rach_tx_integer_raw2val(0x0c): 20 slots used to spread transmission +rach_tx_integer_raw2val(0x0d): 25 slots used to spread transmission +rach_tx_integer_raw2val(0x0e): 32 slots used to spread transmission +rach_tx_integer_raw2val(0x0f): 50 slots used to spread transmission
View file
libosmocore_1.6.0.tar.xz/tests/gsm0502/gsm0502_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm0502/gsm0502_test.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h>
View file
libosmocore_1.6.0.tar.xz/tests/gsm0808/gsm0808_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm0808/gsm0808_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/gsm/gsm0808.h> @@ -428,6 +424,59 @@ osmo_hexdump(diag->msg, diag_len-2)); } +/* Test Perform Location Report SYS#5891 */ +static void test_dec_perform_location_report_sys5891() +{ +/* Message Type Perform Location Request + Location Type + Element ID: 0x44 + Length: 1 + Location Information: current geographic location (0x00) + Cell Identifier/CI (25911) + Element ID: 0x05 + Length: 8 + 0000 .... = Spare bit(s): 0x00 + .... 0000 = Cell identification discriminator: The whole Cell Global Identification, CGI, is used to identify the cells. (0) + Mobile Country Code (MCC): (removed)) + Mobile Network Code (MNC): (removed)) + Cell LAC: 0x001e (30) + Cell CI: 0x6537 (25911) + LCS Client Type + Element ID: 0x48 + Length: 1 + 0011 .... = Client Category: Emergency Services (0x03) + .... 0000 = Client Subtype: unspecified (0x00) + LCS Priority + Element ID: 0x43 + Length: 1 + Periodicity: highest (0) + LCS QoS + Element ID: 0x3e + Length: 4 + 0000 00.. = Spare: 0x00 + .... ..0. = Velocity Requested: do not report velocity (0x00) + .... ...0 = Vertical Coordinate Indicator: vertical coordinate not requested (0x00) + 1... .... = Horizontal Accuracy Indicator: horizontal accuracy is specified (0x01) + .001 0010 = Horizontal Accuracy: 0x12 + 0... .... = Vertical Accuracy Indicator: vertical accuracy is not specified (0x00) + .000 0000 = Spare: 0x00 + 00.. .... = Response Time Category: Response Time is not specified (0x00) +*/ + const uint8_t hex = { + 0x2b, 0x44, 0x01, 0x00, 0x05, 0x08, 0x00, 0xab, 0xbc, 0xcd, 0x00, 0x1e, + 0x65, 0x37, 0x48, 0x01, 0x30, 0x43, 0x01, 0x00, 0x3e, 0x04, 0x00, 0x92, + 0x00, 0x00 + }; + + struct tlv_parsed tp; + int rc; + + printf("Testing decoding Perform Location Report SYS#5891\n"); + + rc = tlv_parse(&tp, gsm0808_att_tlvdef(), hex+1, sizeof(hex)-1, 0, 0); + OSMO_ASSERT(rc == 5); +} + static void test_create_ass() { static const uint8_t res1 = @@ -1076,6 +1125,19 @@ msgb_free(msg); } +static void test_gsm0808_dec_cell_id_list_srvcc() +{ + /* taken from a pcap file of a real-world 3rd party MSC (SYS#5838) */ + const uint8_t enc_cil = { 0x0b, 0x2, 0xf2, 0x10, 0x4e, 0x20, 0x15, 0xbe}; + struct gsm0808_cell_id_list2 dec_cil; + int rc; + + rc = gsm0808_dec_cell_id_list2(&dec_cil, enc_cil, sizeof(enc_cil)); + OSMO_ASSERT(rc == sizeof(enc_cil)); + OSMO_ASSERT(dec_cil.id_discr = CELL_IDENT_SAI); + OSMO_ASSERT(dec_cil.id_list_len = 1); +} + static void test_gsm0808_enc_dec_cell_id_list_lac() { struct gsm0808_cell_id_list2 enc_cil; @@ -2494,6 +2556,7 @@ test_gsm0808_enc_dec_cell_id_list_multi_ci(); test_gsm0808_enc_dec_cell_id_list_multi_lac_and_ci(); test_gsm0808_enc_dec_cell_id_list_multi_global(); + test_gsm0808_dec_cell_id_list_srvcc(); test_cell_id_list_add(); @@ -2515,6 +2578,7 @@ test_gsm0808_cell_id_to_from_cgi(); test_dec_confusion(); + test_dec_perform_location_report_sys5891(); printf("Done\n"); return EXIT_SUCCESS;
View file
libosmocore_1.6.0.tar.xz/tests/gsm0808/gsm0808_test.ok -> libosmocore_1.7.0.tar.xz/tests/gsm0808/gsm0808_test.ok
Changed
@@ -916,4 +916,5 @@ Diagnostics error octet location 0 (Error location not determined) Diagnostics error bit location 15 (Reserved value) Diagnostics message that provoked the error: 00 03 25 03 25 +Testing decoding Perform Location Report SYS#5891 Done
View file
libosmocore_1.6.0.tar.xz/tests/gsm23003/gsm23003_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm23003/gsm23003_test.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/gsm23236/gsm23236_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm23236/gsm23236_test.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/gsm29205/gsm29205_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm29205/gsm29205_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/gsm/gsm29205.h>
View file
libosmocore_1.6.0.tar.xz/tests/gsm48/rest_octets_test.c -> libosmocore_1.7.0.tar.xz/tests/gsm48/rest_octets_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h>
View file
libosmocore_1.7.0.tar.xz/tests/iuup
Added
+(directory)
View file
libosmocore_1.7.0.tar.xz/tests/iuup/iuup_test.c
Added
@@ -0,0 +1,764 @@ +#include <stdint.h> +#include <stdio.h> + +#include <osmocom/core/application.h> +#include <osmocom/core/logging.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/fsm.h> +#include <osmocom/core/select.h> + +#include <osmocom/gsm/prim.h> +#include <osmocom/gsm/iuup.h> + +static void *iuup_test_ctx; + +static struct osmo_iuup_rnl_config def_configure_req = { + .transparent = false, + .active = true, + .supported_versions_mask = 0x0001, + .num_rfci = 3, + .num_subflows = 3, + .IPTIs_present = true, + .rfci = { + {.used = 1, .id = 0, .IPTI = 1, .subflow_sizes = {81, 103, 60} }, + {.used = 1, .id = 1, .IPTI = 7, .subflow_sizes = {39, 0, 0} }, + {.used = 1, .id = 2, .IPTI = 1, .subflow_sizes = {0, 0, 0} }, + }, + /* .delivery_err_sdu = All set to 0 (YES) by default, */ + .IPTIs_present = true, + .t_init = { .t_ms = IUUP_TIMER_INIT_T_DEFAULT, .n_max = IUUP_TIMER_INIT_N_DEFAULT }, + .t_ta = { .t_ms = IUUP_TIMER_TA_T_DEFAULT, .n_max = IUUP_TIMER_TA_N_DEFAULT }, + .t_rc = { .t_ms = IUUP_TIMER_RC_T_DEFAULT, .n_max = IUUP_TIMER_RC_N_DEFAULT }, +}; + +/* Frame 33, "Initialization", OS#4744 3g_call_23112021.pcapng +IuUP + 1110 .... = PDU Type: Control Procedure (14) + .... 00.. = Ack/Nack: Procedure (0) + .... ..00 = Frame Number: 0 + 0000 .... = Mode Version: 0x0 + .... 0000 = Procedure: Initialization (0) + 1101 11.. = Header CRC: 0x37 correct + .... ..11 1001 1001 = Payload CRC: 0x399 + 000. .... = Spare: 0x0 + ...1 .... = TI: IPTIs present in frame (1) + .... 011. = Subflows: 3 + .... ...0 = Chain Indicator: this frame is the last frame for the procedure (0) + RFCI 0 Initialization + 0... .... = RFCI 0 LRI: Not last RFCI (0x0) + .0.. .... = RFCI 0 LI: one octet used (0x0) + ..00 0000 = RFCI 0: 0 + RFCI 0 Flow 0 Len: 81 + RFCI 0 Flow 1 Len: 103 + RFCI 0 Flow 2 Len: 60 + RFCI 1 Initialization + 0... .... = RFCI 1 LRI: Not last RFCI (0x0) + .0.. .... = RFCI 1 LI: one octet used (0x0) + ..00 0001 = RFCI 1: 1 + RFCI 1 Flow 0 Len: 39 + RFCI 1 Flow 1 Len: 0 + RFCI 1 Flow 2 Len: 0 + RFCI 2 Initialization + 1... .... = RFCI 2 LRI: Last RFCI in current frame (0x1) + .0.. .... = RFCI 2 LI: one octet used (0x0) + ..00 0010 = RFCI 2: 2 + RFCI 2 Flow 0 Len: 0 + RFCI 2 Flow 1 Len: 0 + RFCI 2 Flow 2 Len: 0 + IPTIs + 0001 .... = RFCI 0 IPTI: 0x1 + .... 0111 = RFCI 1 IPTI: 0x7 + 0001 .... = RFCI 2 IPTI: 0x1 + Iu UP Mode Versions Supported: 0x0001 + 0... .... .... .... = Version 16: not supported (0x0) + .0.. .... .... .... = Version 15: not supported (0x0) + ..0. .... .... .... = Version 14: not supported (0x0) + ...0 .... .... .... = Version 13: not supported (0x0) + .... 0... .... .... = Version 12: not supported (0x0) + .... .0.. .... .... = Version 11: not supported (0x0) + .... ..0. .... .... = Version 10: not supported (0x0) + .... ...0 .... .... = Version 9: not supported (0x0) + .... .... 0... .... = Version 8: not supported (0x0) + .... .... .0.. .... = Version 7: not supported (0x0) + .... .... ..0. .... = Version 6: not supported (0x0) + .... .... ...0 .... = Version 5: not supported (0x0) + .... .... .... 0... = Version 4: not supported (0x0) + .... .... .... .0.. = Version 3: not supported (0x0) + .... .... .... ..0. = Version 2: not supported (0x0) + .... .... .... ...1 = Version 1: supported (0x1) + 0000 .... = RFCI Data Pdu Type: PDU type 0 (0x0) +*/ +static const uint8_t iuup_initialization = { + 0xe0, 0x00, 0xdf, 0x99, 0x16, 0x00, 0x51, 0x67, 0x3c, 0x01, 0x27, 0x00, + 0x00, 0x82, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x00 +}; + +/* Frame 87, "Data RFCI=0 FN = 1", OS#4744 3g_call_23112021.pcapng +IuUP + 0000 .... = PDU Type: Data with CRC (0) + .... 0001 = Frame Number: 1 + 00.. .... = FQC: Frame Good (0) + ..00 0000 = RFCI: 0x00 + 1110 00.. = Header CRC: 0x38 correct + .... ..11 1111 1111 = Payload CRC: 0x3ff + Payload Data: 08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740 +*/ +static const uint8_t iuup_data = { + 0x01, 0x00, 0xe3, 0xff, /*payload starts here: */ 0x08, 0x55, 0x6d, 0x94, 0x4c, 0x71, 0xa1, 0xa0, + 0x81, 0xe7, 0xea, 0xd2, 0x04, 0x24, 0x44, 0x80, 0x00, 0x0e, 0xcd, 0x82, + 0xb8, 0x11, 0x18, 0x00, 0x00, 0x97, 0xc4, 0x79, 0x4e, 0x77, 0x40 +}; + +#define IUUP_MSGB_SIZE 4096 + +static struct osmo_iuup_tnl_prim *itp_ctrl_nack_alloc(enum iuup_procedure proc_ind, enum iuup_error_cause error_cause, uint8_t fn) +{ + struct osmo_iuup_tnl_prim *tnp; + struct iuup_ctrl_nack *nack; + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(struct iuup_ctrl_nack)); + nack = (struct iuup_ctrl_nack *) msgb_l2(tnp->oph.msg); + *nack = (struct iuup_ctrl_nack){ + .hdr = { + .frame_nr = fn, + .ack_nack = IUUP_AN_NACK, + .pdu_type = IUUP_PDU_T_CONTROL, + .proc_ind = proc_ind, + .mode_version = 0, + .payload_crc_hi = 0, + .header_crc = 0, + .payload_crc_lo = 0, + }, + .spare = 0, + .error_cause = error_cause, + }; + nack->hdr.header_crc = osmo_iuup_compute_header_crc(msgb_l2(tnp->oph.msg), msgb_l2len(tnp->oph.msg)); + return tnp; +} + +static struct osmo_iuup_tnl_prim *itp_ctrl_ack_alloc(enum iuup_procedure proc_ind, uint8_t fn) +{ + struct osmo_iuup_tnl_prim *tnp; + struct iuup_ctrl_ack *ack; + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(struct iuup_ctrl_ack)); + ack = (struct iuup_ctrl_ack *) msgb_l2(tnp->oph.msg); + *ack = (struct iuup_ctrl_ack){ + .hdr = { + .frame_nr = fn, + .ack_nack = IUUP_AN_ACK, + .pdu_type = IUUP_PDU_T_CONTROL, + .proc_ind = proc_ind, + .mode_version = 0, + .payload_crc_hi = 0, + .header_crc = 0, + .payload_crc_lo = 0, + }, + }; + ack->hdr.header_crc = osmo_iuup_compute_header_crc(msgb_l2(tnp->oph.msg), msgb_l2len(tnp->oph.msg)); + return tnp; +} + +static void clock_override_set(long sec, long usec) +{ + osmo_gettimeofday_override_time.tv_sec = sec + usec / (1000*1000); + osmo_gettimeofday_override_time.tv_usec = usec % (1000*1000); + printf("sys={%lu.%06lu}, %s\n", osmo_gettimeofday_override_time.tv_sec, + osmo_gettimeofday_override_time.tv_usec, __func__); +} + +void test_crc(void) +{ + int rc; + + /* Frame 34, "Initialization ACK", OS#4744 3g_call_23112021.pcapng */ + static const uint8_t iuup_initialization_ack = { + 0xe4, 0x00, 0xdf, 0x99, 0x16, 0x00, 0x51, 0x67, 0x3c, 0x01, 0x27, 0x00, + 0x00, 0x82, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x00 + }; + + printf("=== start: %s ===\n", __func__); + + rc = osmo_iuup_compute_header_crc(iuup_initialization, sizeof(iuup_initialization)); + printf("iuup_initialization: Header CRC = 0x%02x\n", rc); + rc = osmo_iuup_compute_payload_crc(iuup_initialization, sizeof(iuup_initialization)); + printf("iuup_initialization: Payload CRC = 0x%03x\n", rc); + + rc = osmo_iuup_compute_header_crc(iuup_initialization_ack, sizeof(iuup_initialization_ack)); + printf("iuup_initialization_ack: Header CRC = 0x%02x\n", rc); + rc = osmo_iuup_compute_payload_crc(iuup_initialization_ack, sizeof(iuup_initialization_ack)); + printf("iuup_initialization_ack: Payload CRC = 0x%03x\n", rc); + + printf("=== end: %s ===\n", __func__); +} + + +/**************************** + * test_tinit_timeout_retrans + ****************************/ +static unsigned int _tinit_timeout_retrans_user_rx_prim = 0; +static int _tinit_timeout_retrans_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + printf("%s()\n", __func__); + + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION)); + + OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_ERR_EVENT); + OSMO_ASSERT(irp->u.status.u.error_event.cause == IUUP_ERR_CAUSE_INIT_FAILURE_NET_TMR); + OSMO_ASSERT(irp->u.status.u.error_event.distance == IUUP_ERR_DIST_LOCAL); + _tinit_timeout_retrans_user_rx_prim++; + msgb_free(oph->msg); + return 0; +} +static unsigned int _tinit_timeout_retrans_transport_rx_prim = 0; +static int _tinit_timeout_retrans_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph; + struct msgb *msg = oph->msg; + + printf("%s()\n", __func__); + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST)); + printf("Transport: DL len=%u: %s\n", msgb_l2len(msg), + osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg))); + _tinit_timeout_retrans_transport_rx_prim++; + + msgb_free(msg); + return 0; +} +void test_tinit_timeout_retrans(void) +{ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + int rc, i; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _tinit_timeout_retrans_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _tinit_timeout_retrans_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + /* STATUS-INIT.req is transmitted automatically: */ + OSMO_ASSERT(_tinit_timeout_retrans_transport_rx_prim == 1); + + /* After one sec, INITIALIZATION msg is retransmitted */ + for (i = 1; i < IUUP_TIMER_INIT_N_DEFAULT + 1; i++) { + clock_override_set(0, IUUP_TIMER_INIT_T_DEFAULT*1000 * i); + osmo_select_main(0); + OSMO_ASSERT(_tinit_timeout_retrans_transport_rx_prim == i + 1); + } + /* Last one should send an error event: */ + OSMO_ASSERT(_tinit_timeout_retrans_user_rx_prim == 0); + clock_override_set(0, IUUP_TIMER_INIT_T_DEFAULT*1000 * i); + osmo_select_main(0); + OSMO_ASSERT(_tinit_timeout_retrans_transport_rx_prim == i); + OSMO_ASSERT(_tinit_timeout_retrans_user_rx_prim == 1); + + /* Nothing else is received afterwards. osmo_select_main() will block forever. */ + /*clock_override_set(i + 1, 0); + osmo_select_main(0); + OSMO_ASSERT(_tinit_timeout_retrans_transport_rx_prim == i); + OSMO_ASSERT(_tinit_timeout_retrans_user_rx_prim == 1);*/ + + osmo_iuup_instance_free(iui); +} + +/**************************** + * test_tinit_nack + ****************************/ +static unsigned int _init_nack_retrans_user_rx_prim = 0; +static int _init_nack_retrans_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + + printf("%s()\n", __func__); + + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION)); + + OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_ERR_EVENT); + OSMO_ASSERT(irp->u.status.u.error_event.cause == IUUP_ERR_CAUSE_INIT_FAILURE_REP_NACK); + OSMO_ASSERT(irp->u.status.u.error_event.distance == IUUP_ERR_DIST_SECOND_FWD); + _init_nack_retrans_user_rx_prim++; + msgb_free(oph->msg); + return 0; +} +static int _init_nack_retrans_transport_rx_prim = 0; +static int _init_nack_retrans_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph; + struct msgb *msg = oph->msg; + + printf("%s()\n", __func__); + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST)); + printf("Transport: DL len=%u: %s\n", msgb_l2len(msg), + osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg))); + _init_nack_retrans_transport_rx_prim++; + + msgb_free(msg); + return 0; +} +void test_init_nack_retrans(void) +{ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + struct osmo_iuup_tnl_prim *tnp; + int rc, i; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _init_nack_retrans_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _init_nack_retrans_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + /* STATUS-INIT.req is transmitted automatically: */ + OSMO_ASSERT(_init_nack_retrans_transport_rx_prim == 1); + + /* After one sec, INITIALIZATION msg is retransmitted */ + for (i = 1; i < IUUP_TIMER_INIT_N_DEFAULT + 1; i++) { + /* Send NACK: */ + tnp = itp_ctrl_nack_alloc(IUUP_PROC_INIT, IUUP_ERR_CAUSE_MODE_VERSION_NOT_SUPPORTED, 0); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + /* A new INIT is retransmitted: */ + OSMO_ASSERT(_init_nack_retrans_transport_rx_prim == i + 1); + } + /* Last one should send an error event: */ + OSMO_ASSERT(_init_nack_retrans_user_rx_prim == 0); + tnp = itp_ctrl_nack_alloc(IUUP_PROC_INIT, IUUP_ERR_CAUSE_MODE_VERSION_NOT_SUPPORTED, 0); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + OSMO_ASSERT(_init_nack_retrans_transport_rx_prim == i); + OSMO_ASSERT(_init_nack_retrans_user_rx_prim == 1); + + /* Nothing else is received afterwards. osmo_select_main() will block forever. */ + + osmo_iuup_instance_free(iui); +} + + +/**************************** + * test_init_ack + ****************************/ +static unsigned int _init_ack_user_rx_prim = 0; +static int _init_ack_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + struct msgb *msg = oph->msg; + + printf("%s()\n", __func__); + + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_DATA, PRIM_OP_INDICATION)); + printf("User: UL len=%u: %s\n", msgb_l3len(msg), + osmo_hexdump((const unsigned char *) msgb_l3(msg), msgb_l3len(msg))); + + _init_ack_user_rx_prim++; + msgb_free(oph->msg); + return 0; +} +static int _init_ack_transport_rx_prim = 0; +static int _init_ack_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph; + struct msgb *msg = oph->msg; + + printf("%s()\n", __func__); + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST)); + printf("Transport: DL len=%u: %s\n", msgb_l2len(msg), + osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg))); + _init_ack_transport_rx_prim++; + + msgb_free(msg); + return 0; +} +void test_init_ack(void) +{ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + struct osmo_iuup_tnl_prim *tnp; + struct iuup_pdutype0_hdr *hdr0; + int rc; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _init_ack_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _init_ack_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + /* STATUS-INIT.req is transmitted automatically: */ + OSMO_ASSERT(_init_ack_transport_rx_prim == 1); + + /* Send ACK: */ + tnp = itp_ctrl_ack_alloc(IUUP_PROC_INIT, 0); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + OSMO_ASSERT(_init_ack_transport_rx_prim == 1); /* Make sure there's no retrans */ + OSMO_ASSERT(_init_ack_user_rx_prim == 0); /* Make sure there's no error event */ + + /* Send IuUP incoming data to the implementation: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_data)); + hdr0 = (struct iuup_pdutype0_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr0, iuup_data, sizeof(iuup_data)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + /* We receive it in RNL: */ + OSMO_ASSERT(_init_ack_user_rx_prim == 1); + + /* Now in opposite direction, RNL->IuuP->TNL: */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_DATA, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.data.rfci = 0; + rnp->u.data.frame_nr = 1; + rnp->u.data.fqc = IUUP_FQC_FRAME_GOOD; + rnp->oph.msg->l3h = msgb_put(rnp->oph.msg, sizeof(iuup_data) - 4); + memcpy(rnp->oph.msg->l3h, iuup_data + 4, sizeof(iuup_data) - 4); + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + OSMO_ASSERT(_init_ack_transport_rx_prim == 2); /* We receive data in TNL */ + + osmo_iuup_instance_free(iui); +} + +/**************************** + * test_passive_init + ****************************/ +static unsigned int _passive_init_user_rx_prim = 0; +static int _passive_init_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + struct msgb *msg = oph->msg; + + printf("%s()\n", __func__); + + switch (_passive_init_user_rx_prim) { + case 0: + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION)); + OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_INIT); + break; + case 1: + default: + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_DATA, PRIM_OP_INDICATION)); + printf("User: UL len=%u: %s\n", msgb_l3len(msg), + osmo_hexdump((const unsigned char *) msgb_l3(msg), msgb_l3len(msg))); + } + + _passive_init_user_rx_prim++; + msgb_free(oph->msg); + return 0; +} +static int _passive_init_transport_rx_prim = 0; +static int _passive_init_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph; + struct msgb *msg; + + printf("%s()\n", __func__); + msg = oph->msg; + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST)); + printf("Transport: DL len=%u: %s\n", msgb_l2len(msg), + osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg))); + _passive_init_transport_rx_prim++; + + msgb_free(msg); + return 0; +} +void test_passive_init(void) +{ + /* Here we check the passive INIT code path, aka receiving INIT and returning INIT_ACK/NACK */ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + struct osmo_iuup_tnl_prim *tnp; + struct iuup_pdutype14_hdr *hdr14; + struct iuup_pdutype0_hdr *hdr0; + int rc; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _passive_init_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _passive_init_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + rnp->u.config.active = false; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + /* STATUS-INIT.req is NOT transmitted automatically: */ + OSMO_ASSERT(_passive_init_transport_rx_prim == 0); + + /* Send Init: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_initialization)); + hdr14 = (struct iuup_pdutype14_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr14, iuup_initialization, sizeof(iuup_initialization)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + OSMO_ASSERT(_passive_init_transport_rx_prim == 1); /* We receive an Init ACK */ + OSMO_ASSERT(_passive_init_user_rx_prim == 1); /* We receive the Status-Init.ind */ + + /* Send IuUP incoming data to the implementation: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_data)); + hdr0 = (struct iuup_pdutype0_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr0, iuup_data, sizeof(iuup_data)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + /* We receive it in RNL: */ + OSMO_ASSERT(_passive_init_user_rx_prim == 2); + + /* Now in opposite direction, RNL->IuuP->TNL: */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_DATA, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.data.rfci = 0; + rnp->u.data.frame_nr = 1; + rnp->u.data.fqc = IUUP_FQC_FRAME_GOOD; + rnp->oph.msg->l3h = msgb_put(rnp->oph.msg, sizeof(iuup_data) - 4); + memcpy(rnp->oph.msg->l3h, iuup_data + 4, sizeof(iuup_data) - 4); + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + OSMO_ASSERT(_passive_init_transport_rx_prim == 2); /* We receive data in TNL */ + + osmo_iuup_instance_free(iui); +} + +/**************************** + * test_passive_init_retrans + ****************************/ +static unsigned int _passive_init_retrans_user_rx_prim = 0; +static int _passive_init_retrans_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + struct msgb *msg = oph->msg; + + printf("%s()\n", __func__); + + switch (_passive_init_retrans_user_rx_prim) { + case 0: + case 1: + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION)); + OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_INIT); + break; + case 2: + default: + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_DATA, PRIM_OP_INDICATION)); + printf("User: UL len=%u: %s\n", msgb_l3len(msg), + osmo_hexdump((const unsigned char *) msgb_l3(msg), msgb_l3len(msg))); + } + + _passive_init_retrans_user_rx_prim++; + msgb_free(oph->msg); + return 0; +} +void test_passive_init_retrans(void) +{ + /* Here we check the passive INIT code path, aka receiving INIT and + * returning INIT_ACK/NACK. We emulate the peer not receiving the INIT + * ACK and hence retransmitting the INIT. The IuUP stack should then + * push the new INIT info up the stack and ACK it. */ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + struct osmo_iuup_tnl_prim *tnp; + struct iuup_pdutype14_hdr *hdr14; + struct iuup_pdutype0_hdr *hdr0; + int rc; + + /* reset global var, we reuse it together wth callback from test_passive_init(): */ + _passive_init_transport_rx_prim = 0; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _passive_init_retrans_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _passive_init_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + rnp->u.config.active = false; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + /* STATUS-INIT.req is NOT transmitted automatically: */ + OSMO_ASSERT(_passive_init_transport_rx_prim == 0); + + /* Send Init: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_initialization)); + hdr14 = (struct iuup_pdutype14_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr14, iuup_initialization, sizeof(iuup_initialization)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + OSMO_ASSERT(_passive_init_transport_rx_prim == 1); /* We receive an Init ACK */ + OSMO_ASSERT(_passive_init_retrans_user_rx_prim == 1); /* We receive the Status-Init.ind */ + + /* Send Init (retrans): */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_initialization)); + hdr14 = (struct iuup_pdutype14_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr14, iuup_initialization, sizeof(iuup_initialization)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + OSMO_ASSERT(_passive_init_transport_rx_prim == 2); /* We receive another Init ACK */ + OSMO_ASSERT(_passive_init_retrans_user_rx_prim == 2); /* We receive another Status-Init.ind */ + + /* Send IuUP incoming data to the implementation: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_data)); + hdr0 = (struct iuup_pdutype0_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr0, iuup_data, sizeof(iuup_data)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + /* We receive it in RNL: */ + OSMO_ASSERT(_passive_init_retrans_user_rx_prim == 3); + + /* Now in opposite direction, RNL->IuuP->TNL: */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_DATA, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.data.rfci = 0; + rnp->u.data.frame_nr = 1; + rnp->u.data.fqc = IUUP_FQC_FRAME_GOOD; + rnp->oph.msg->l3h = msgb_put(rnp->oph.msg, sizeof(iuup_data) - 4); + memcpy(rnp->oph.msg->l3h, iuup_data + 4, sizeof(iuup_data) - 4); + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + OSMO_ASSERT(_passive_init_transport_rx_prim == 3); /* We receive data in TNL */ + + osmo_iuup_instance_free(iui); +} + +static int _decode_passive_init_2_rfci_no_iptis_user_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_rnl_prim *irp = (struct osmo_iuup_rnl_prim *)oph; + printf("%s(): Initialization decoded fine!\n", __func__); + OSMO_ASSERT(OSMO_PRIM_HDR(&irp->oph) == OSMO_PRIM(OSMO_IUUP_RNL_STATUS, PRIM_OP_INDICATION)); + OSMO_ASSERT(irp->u.status.procedure == IUUP_PROC_INIT); + OSMO_ASSERT(irp->u.status.u.initialization.num_rfci == 2); + OSMO_ASSERT(irp->u.status.u.initialization.num_subflows == 3); + OSMO_ASSERT(irp->u.status.u.initialization.data_pdu_type == 0); + OSMO_ASSERT(irp->u.status.u.initialization.IPTIs_present == false); + msgb_free(oph->msg); + return 0; +} +static int _decode_passive_init_2_rfci_no_iptis_transport_prim_cb(struct osmo_prim_hdr *oph, void *ctx) +{ + struct osmo_iuup_tnl_prim *itp = (struct osmo_iuup_tnl_prim *)oph; + struct msgb *msg; + struct iuup_pdutype14_hdr *hdr; + + printf("%s()\n", __func__); + msg = oph->msg; + OSMO_ASSERT(OSMO_PRIM_HDR(&itp->oph) == OSMO_PRIM(OSMO_IUUP_TNL_UNITDATA, PRIM_OP_REQUEST)); + printf("Transport: DL len=%u: %s\n", msgb_l2len(msg), + osmo_hexdump((const unsigned char *) msgb_l2(msg), msgb_l2len(msg))); + hdr = msgb_l2(msg); + OSMO_ASSERT(hdr->pdu_type == IUUP_PDU_T_CONTROL); + OSMO_ASSERT(hdr->ack_nack == IUUP_AN_ACK); + msgb_free(msg); + return 0; +} +void test_decode_passive_init_2_rfci_no_iptis(void) +{ + /* Here we check the passive INIT code path, aka receiving INIT and returning INIT_ACK/NACK */ + struct osmo_iuup_instance *iui; + struct osmo_iuup_rnl_prim *rnp; + struct osmo_iuup_tnl_prim *tnp; + struct iuup_pdutype14_hdr *hdr14; + int rc; + + /* Frame 46, "Initialization", SYS#5969 call4_Iu_Iuh.pcap + 1110 .... = PDU Type: Control Procedure (14) + .... 00.. = Ack/Nack: Procedure (0) + .... ..00 = Frame Number: 0 + 0000 .... = Mode Version: 0x0 + .... 0000 = Procedure: Initialization (0) + 1101 11.. = Header CRC: 0x37 correct + .... ..01 1011 0100 = Payload CRC: 0x1b4 + 000. .... = Spare: 0x0 + ...0 .... = TI: IPTIs not present (0) + .... 011. = Subflows: 3 + .... ...0 = Chain Indicator: this frame is the last frame for the procedure (0) + RFCI 1 Initialization + 0... .... = RFCI 0 LRI: Not last RFCI (0x0) + .0.. .... = RFCI 0 LI: one octet used (0x0) + ..00 0001 = RFCI 0: 1 + RFCI 0 Flow 0 Len: 81 + RFCI 0 Flow 1 Len: 103 + RFCI 0 Flow 2 Len: 60 + RFCI 6 Initialization + 1... .... = RFCI 1 LRI: Last RFCI in current frame (0x1) + .0.. .... = RFCI 1 LI: one octet used (0x0) + ..00 0110 = RFCI 1: 6 + RFCI 1 Flow 0 Len: 39 + RFCI 1 Flow 1 Len: 0 + RFCI 1 Flow 2 Len: 0 + Iu UP Mode Versions Supported: 0x0001 + 0... .... .... .... = Version 16: not supported (0x0) + .0.. .... .... .... = Version 15: not supported (0x0) + ..0. .... .... .... = Version 14: not supported (0x0) + ...0 .... .... .... = Version 13: not supported (0x0) + .... 0... .... .... = Version 12: not supported (0x0) + .... .0.. .... .... = Version 11: not supported (0x0) + .... ..0. .... .... = Version 10: not supported (0x0) + .... ...0 .... .... = Version 9: not supported (0x0) + .... .... 0... .... = Version 8: not supported (0x0) + .... .... .0.. .... = Version 7: not supported (0x0) + .... .... ..0. .... = Version 6: not supported (0x0) + .... .... ...0 .... = Version 5: not supported (0x0) + .... .... .... 0... = Version 4: not supported (0x0) + .... .... .... .0.. = Version 3: not supported (0x0) + .... .... .... ..0. = Version 2: not supported (0x0) + .... .... .... ...1 = Version 1: supported (0x1) + 0000 .... = RFCI Data Pdu Type: PDU type 0 (0x0) + */ + const uint8_t iuup_init = { + 0xe0, 0x00, 0xdd, 0xb4, 0x06, 0x01, 0x51, 0x67, 0x3c, 0x86, 0x27, + 0x00, 0x00, 0x00, 0x01, 0x00 + }; + + iui = osmo_iuup_instance_alloc(iuup_test_ctx, __func__); + OSMO_ASSERT(iui); + osmo_iuup_instance_set_user_prim_cb(iui, _decode_passive_init_2_rfci_no_iptis_user_prim_cb, NULL); + osmo_iuup_instance_set_transport_prim_cb(iui, _decode_passive_init_2_rfci_no_iptis_transport_prim_cb, NULL); + + clock_override_set(0, 0); + + /* Tx CONFIG.req */ + rnp = osmo_iuup_rnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_RNL_CONFIG, PRIM_OP_REQUEST, IUUP_MSGB_SIZE); + rnp->u.config = def_configure_req; + rnp->u.config.active = false; + OSMO_ASSERT((rc = osmo_iuup_rnl_prim_down(iui, rnp)) == 0); + + /* Send Init: */ + tnp = osmo_iuup_tnl_prim_alloc(iuup_test_ctx, OSMO_IUUP_TNL_UNITDATA, PRIM_OP_INDICATION, IUUP_MSGB_SIZE); + tnp->oph.msg->l2h = msgb_put(tnp->oph.msg, sizeof(iuup_init)); + hdr14 = (struct iuup_pdutype14_hdr *)msgb_l2(tnp->oph.msg); + memcpy(hdr14, iuup_init, sizeof(iuup_init)); + OSMO_ASSERT((rc = osmo_iuup_tnl_prim_up(iui, tnp)) == 0); + + osmo_iuup_instance_free(iui); +} + +int main(int argc, char **argv) +{ + iuup_test_ctx = talloc_named_const(NULL, 0, "iuup_test"); + osmo_init_logging2(iuup_test_ctx, NULL); + log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); + log_set_print_category(osmo_stderr_target, 1); + log_set_print_category_hex(osmo_stderr_target, 0); + log_set_use_color(osmo_stderr_target, 0); + log_set_category_filter(osmo_stderr_target, DLIUUP, 1, LOGL_DEBUG); + osmo_fsm_log_addr(false); + + osmo_gettimeofday_override = true; + + test_crc(); + test_tinit_timeout_retrans(); + test_init_nack_retrans(); + test_init_ack(); + test_passive_init(); + test_passive_init_retrans(); + test_decode_passive_init_2_rfci_no_iptis(); + + printf("OK.\n"); +}
View file
libosmocore_1.7.0.tar.xz/tests/iuup/iuup_test.ok
Added
@@ -0,0 +1,61 @@ +=== start: test_crc === +iuup_initialization: Header CRC = 0x37 +iuup_initialization: Payload CRC = 0x399 +iuup_initialization_ack: Header CRC = 0x09 +iuup_initialization_ack: Payload CRC = 0x399 +=== end: test_crc === +sys={0.000000}, clock_override_set +_tinit_timeout_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +sys={1.000000}, clock_override_set +_tinit_timeout_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +sys={2.000000}, clock_override_set +_tinit_timeout_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +sys={3.000000}, clock_override_set +_tinit_timeout_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +sys={4.000000}, clock_override_set +_tinit_timeout_retrans_user_prim_cb() +sys={0.000000}, clock_override_set +_init_nack_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +_init_nack_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +_init_nack_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +_init_nack_retrans_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +_init_nack_retrans_user_prim_cb() +sys={0.000000}, clock_override_set +_init_ack_transport_prim_cb() +Transport: DL len=22: e0 00 df 99 16 00 51 67 3c 01 27 00 00 82 00 00 00 17 10 00 01 00 +_init_ack_user_prim_cb() +User: UL len=31: 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +_init_ack_transport_prim_cb() +Transport: DL len=35: 01 00 e3 ff 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +sys={0.000000}, clock_override_set +_passive_init_user_prim_cb() +_passive_init_transport_prim_cb() +Transport: DL len=4: e4 00 24 00 +_passive_init_user_prim_cb() +User: UL len=31: 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +_passive_init_transport_prim_cb() +Transport: DL len=35: 01 00 e3 ff 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +sys={0.000000}, clock_override_set +_passive_init_retrans_user_prim_cb() +_passive_init_transport_prim_cb() +Transport: DL len=4: e4 00 24 00 +_passive_init_retrans_user_prim_cb() +_passive_init_transport_prim_cb() +Transport: DL len=4: e4 00 24 00 +_passive_init_retrans_user_prim_cb() +User: UL len=31: 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +_passive_init_transport_prim_cb() +Transport: DL len=35: 01 00 e3 ff 08 55 6d 94 4c 71 a1 a0 81 e7 ea d2 04 24 44 80 00 0e cd 82 b8 11 18 00 00 97 c4 79 4e 77 40 +sys={0.000000}, clock_override_set +_decode_passive_init_2_rfci_no_iptis_user_prim_cb(): Initialization decoded fine! +_decode_passive_init_2_rfci_no_iptis_transport_prim_cb() +Transport: DL len=4: e4 00 24 00 +OK.
View file
libosmocore_1.6.0.tar.xz/tests/lapd/lapd_test.c -> libosmocore_1.7.0.tar.xz/tests/lapd/lapd_test.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/application.h>
View file
libosmocore_1.6.0.tar.xz/tests/logging/logging_test.c -> libosmocore_1.7.0.tar.xz/tests/logging/logging_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/logging.h> @@ -82,6 +78,11 @@ log_set_print_category(stderr_target, 1); log_set_use_color(stderr_target, 0); + if (argc > 1 && !strcmp(argv1, "wqueue")) + log_target_file_switch_to_wqueue(stderr_target); + else + log_target_file_switch_to_stream(stderr_target); + log_parse_category_mask(stderr_target, "DRLL:DCC"); log_parse_category_mask(stderr_target, "DRLL"); @@ -129,5 +130,13 @@ log_set_category_filter(stderr_target, DLGLOBAL, 1, LOGL_DEBUG); DEBUGP(DLGLOBAL, "You should see this (DLGLOBAL on DEBUG)\n"); + /* Test printing of the filename */ + log_set_print_filename2(stderr_target, LOG_FILENAME_BASENAME); + + log_set_print_filename_pos(stderr_target, LOG_FILENAME_POS_HEADER_END); + DEBUGP(DLGLOBAL, "A message with source info printed first\n"); + log_set_print_filename_pos(stderr_target, LOG_FILENAME_POS_LINE_END); + DEBUGP(DLGLOBAL, "A message with source info printed last\n"); + return 0; }
View file
libosmocore_1.6.0.tar.xz/tests/logging/logging_test.err -> libosmocore_1.7.0.tar.xz/tests/logging/logging_test.err
Changed
@@ -7,3 +7,5 @@ DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e) DLGLOBAL You should see this (DLGLOBAL on DEBUG) +DLGLOBAL logging_test.c:137 A message with source info printed first +DLGLOBAL A message with source info printed last (logging_test.c:139)
View file
libosmocore_1.6.0.tar.xz/tests/logging/logging_vty_test.c -> libosmocore_1.7.0.tar.xz/tests/logging/logging_vty_test.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #define _GNU_SOURCE
View file
libosmocore_1.6.0.tar.xz/tests/logging/logging_vty_test.vty -> libosmocore_1.7.0.tar.xz/tests/logging/logging_vty_test.vty
Changed
@@ -54,7 +54,7 @@ logging print level (0|1) logging print file (0|1|basename) last logging set-log-mask MASK - logging level (aa|bb|ccc|dddd|eee|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro|lns|lbssgp|lnsdata|lnssignal) (debug|info|notice|error|fatal) + logging level (aa|bb|ccc|dddd|eee|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro|lns|lbssgp|lnsdata|lnssignal|liuup|lpfcp) (debug|info|notice|error|fatal) logging level set-all (debug|info|notice|error|fatal) logging level force-all (debug|info|notice|error|fatal) no logging level force-all @@ -472,7 +472,7 @@ logging_vty_test# list ... - logp (aa|bb|ccc|dddd|eee|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro|lns|lbssgp|lnsdata|lnssignal) (debug|info|notice|error|fatal) .LOGMESSAGE + logp (aa|bb|ccc|dddd|eee|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf|lrspro|lns|lbssgp|lnsdata|lnssignal|liuup|lpfcp) (debug|info|notice|error|fatal) .LOGMESSAGE ... logging_vty_test# logp? @@ -507,6 +507,8 @@ lbssgp GPRS BSSGP layer lnsdata GPRS NS layer data PDU lnssignal GPRS NS layer signal PDU + liuup Iu UP layer + lpfcp libosmo-pfcp Packet Forwarding Control Protocol logging_vty_test# logp lglobal ? debug Log debug messages and higher levels
View file
libosmocore_1.6.0.tar.xz/tests/loggingrb/loggingrb_test.c -> libosmocore_1.7.0.tar.xz/tests/loggingrb/loggingrb_test.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/logging.h>
View file
libosmocore_1.6.0.tar.xz/tests/msgb/msgb_test.c -> libosmocore_1.7.0.tar.xz/tests/msgb/msgb_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdlib.h>
View file
libosmocore_1.6.0.tar.xz/tests/msgfile/msgfile_test.c -> libosmocore_1.7.0.tar.xz/tests/msgfile/msgfile_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/msgfile.h>
View file
libosmocore_1.6.0.tar.xz/tests/oap/oap_test.c -> libosmocore_1.7.0.tar.xz/tests/oap/oap_test.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/application.h>
View file
libosmocore_1.6.0.tar.xz/tests/sercomm/sercomm_test.c -> libosmocore_1.7.0.tar.xz/tests/sercomm/sercomm_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/sim/sim_test.c -> libosmocore_1.7.0.tar.xz/tests/sim/sim_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/sms/sms_test.c -> libosmocore_1.7.0.tar.xz/tests/sms/sms_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/smscb/gsm0341_test.c -> libosmocore_1.7.0.tar.xz/tests/smscb/gsm0341_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <string.h>
View file
libosmocore_1.6.0.tar.xz/tests/smscb/smscb_test.c -> libosmocore_1.7.0.tar.xz/tests/smscb/smscb_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/gsm/protocol/gsm_03_41.h>
View file
libosmocore_1.6.0.tar.xz/tests/sockaddr_str/sockaddr_str_test.c -> libosmocore_1.7.0.tar.xz/tests/sockaddr_str/sockaddr_str_test.c
Changed
@@ -18,10 +18,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/socket/socket_sctp_test.c -> libosmocore_1.7.0.tar.xz/tests/socket/socket_sctp_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/socket/socket_test.c -> libosmocore_1.7.0.tar.xz/tests/socket/socket_test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h> @@ -349,9 +345,11 @@ OSMO_ASSERT(!strncmp("::1:42", result, sizeof(buf))); memset(&buf0, 0, sizeof(buf)); - result = osmo_sockaddr_to_str_buf(buf, 8, &localhost6); printf("Checking osmo_sockaddr_to_str_buf too short IPv6\n"); - OSMO_ASSERT(!strncmp("::1:4", result, sizeof(buf))); + result = osmo_sockaddr_to_str_buf(buf, 8, &localhost6); + OSMO_ASSERT(result == NULL); + osmo_sockaddr_to_str_buf2(buf, 8, &localhost6); + OSMO_ASSERT(!strncmp("::1:4", buf, sizeof(buf))); memset(&buf0, 0, sizeof(buf)); result = osmo_sockaddr_to_str_buf(buf, 5, &localhost6);
View file
libosmocore_1.6.0.tar.xz/tests/stats/stats_test.c -> libosmocore_1.7.0.tar.xz/tests/stats/stats_test.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/application.h>
View file
libosmocore_1.6.0.tar.xz/tests/stats/stats_vty_test.vty -> libosmocore_1.7.0.tar.xz/tests/stats/stats_vty_test.vty
Changed
@@ -7,6 +7,7 @@ stats reporter log NAME no stats reporter log NAME stats interval <0-65535> + stats-tcp interval <0-65535> ... stats_vty_test(config)# ### No reporters shall be configured by default
View file
libosmocore_1.6.0.tar.xz/tests/strrb/strrb_test.c -> libosmocore_1.7.0.tar.xz/tests/strrb/strrb_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/tdef/tdef_test.c -> libosmocore_1.7.0.tar.xz/tests/tdef/tdef_test.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdio.h>
View file
libosmocore_1.7.0.tar.xz/tests/tdef/tdef_vty_config_root_test.c
Added
@@ -0,0 +1,291 @@ +/* Test implementation for osmo_tdef VTY configuration API. */ +/* + * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> + * + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> + * + * 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. + */ + +#define _GNU_SOURCE +#include <getopt.h> +#include <signal.h> +#include <limits.h> +#include <string.h> + +#include <osmocom/core/application.h> + +#include <osmocom/vty/command.h> +#include <osmocom/vty/misc.h> +#include <osmocom/vty/telnet_interface.h> + +#include <osmocom/core/tdef.h> +#include <osmocom/vty/tdef_vty.h> + +#include <stdlib.h> + +#include "config.h" + +/* ------------------- HERE IS THE INTERESTING TDEF RELEVANT PART ------------------- */ + +/* This example keeps several separate timer groups and offers 'timer' VTY commands at the root of the config node. See + * the tdef_vty_config_root_test.vty transcript test. + */ + +static struct osmo_tdef tdefs_test = { + { .T=1, .default_val=100, .desc="Testing a hundred seconds" }, // default is .unit=OSMO_TDEF_S == 0 + { .T=2, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Testing a hundred milliseconds" }, + { .T=3, .default_val=100, .unit=OSMO_TDEF_M, .desc="Testing a hundred minutes" }, + { .T=4, .default_val=100, .unit=OSMO_TDEF_CUSTOM, .desc="Testing a hundred potatoes" }, + { .T=0x7fffffff, .default_val=0xffffffff, .unit=OSMO_TDEF_M, .desc="Very large" }, + { .T=-23, .default_val=239471, .desc="Negative T number" }, + { .T=30, .default_val=50, .desc="Testing range min", .min_val=20 }, + { .T=31, .default_val=50, .desc="Testing range max", .max_val=52 }, + { .T=32, .default_val=50, .desc="Testing range both", .min_val=20, .max_val=52 }, + {} // <-- important! last entry shall be zero +}; + +static struct osmo_tdef tdefs_tea = { + { .T=1, .default_val=50, .desc="Water Boiling Timeout" }, + { .T=2, .default_val=300, .desc="Tea brewing" }, + { .T=3, .default_val=5, .unit=OSMO_TDEF_M, .desc="Let tea cool down before drinking" }, + { .T=4, .default_val=20, .unit=OSMO_TDEF_M, .desc="Forgot to drink tea while it's warm" }, + {} +}; + +static struct osmo_tdef tdefs_software = { + { .T=1, .default_val=30, .unit=OSMO_TDEF_M, .desc="Write code" }, + { .T=2, .default_val=20, .unit=OSMO_TDEF_MS, .desc="Hit segfault" }, + { .T=3, .default_val=480, .unit=OSMO_TDEF_M, .desc="Fix bugs" }, + {} +}; + +static struct osmo_tdef_group tdef_groups = { + { + .name = "tea", + .desc = "Tea time", + .tdefs = tdefs_tea, + }, + { + .name = "test", + .desc = "Test timers", + .tdefs = tdefs_test, + }, + { + .name = "software", + .desc = "Typical software development cycle", + .tdefs = tdefs_software, + }, + {} +}; + +enum tdef_vty_test_nodes { + TIMER_NODE = _LAST_OSMOVTY_NODE + 1, +}; + +/* This example puts 'timer' configuration commands directly at the root of the CONFIG_NODE. + * This TIMER_NODE is merely needed as a hook for the vty_write() command, but becomes an empty node in the VTY docs. + * It is possible to cheat around needing this if you choose to config_write_timer() in another root nodes' write cb. + * Another example using a 'network' subnode is \ref tdef_vty_config_subnode_test.c */ +static struct cmd_node timer_node = { + TIMER_NODE, + "%s(config-timer)# ", + 1, +}; + +static int config_write_timer(struct vty *vty) +{ + osmo_tdef_vty_groups_write(vty, ""); + return CMD_SUCCESS; +} + +static void timer_init_vty() +{ + /* Again, this is merely to get a vty write hook, see above. */ + install_node(&timer_node, config_write_timer); + + osmo_tdef_vty_groups_init(CONFIG_NODE, tdef_groups); +} + +/* ------------------- THE REST is just boilerplate osmo main() ------------------- */ + +void *root_ctx = NULL; + +static void print_help() +{ + printf( "options:\n" + " -h --help this text\n" + " -d --debug MASK Enable debugging (e.g. -d DRSL:DOML:DLAPDM)\n" + " -D --daemonize For the process into a background daemon\n" + " -c --config-file Specify the filename of the config file\n" + " -s --disable-color Don't use colors in stderr log output\n" + " -T --timestamp Prefix every log line with a timestamp\n" + " -V --version Print version information and exit\n" + " -e --log-level Set a global log-level\n" + ); +} + +static struct { + const char *config_file; + int daemonize; +} cmdline_config = {}; + +static void handle_options(int argc, char **argv) +{ + while (1) { + int option_idx = 0, c; + static const struct option long_options = { + { "help", 0, 0, 'h' }, + { "debug", 1, 0, 'd' }, + { "daemonize", 0, 0, 'D' }, + { "config-file", 1, 0, 'c' }, + { "disable-color", 0, 0, 's' }, + { "timestamp", 0, 0, 'T' }, + { "version", 0, 0, 'V' }, + { "log-level", 1, 0, 'e' }, + {} + }; + + c = getopt_long(argc, argv, "hc:d:Dc:sTVe:", + long_options, &option_idx); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(); + exit(0); + case 's': + log_set_use_color(osmo_stderr_target, 0); + break; + case 'd': + log_parse_category_mask(osmo_stderr_target, optarg); + break; + case 'D': + cmdline_config.daemonize = 1; + break; + case 'c': + cmdline_config.config_file = optarg; + break; + case 'T': + log_set_print_timestamp(osmo_stderr_target, 1); + break; + case 'e': + log_set_log_level(osmo_stderr_target, atoi(optarg)); + break; + case 'V': + print_version(1); + exit(0); + break; + default: + /* catch unknown options *as well as* missing arguments. */ + fprintf(stderr, "Error in command line options. Exiting.\n"); + exit(-1); + } + } +} + +static int quit = 0; + +static void signal_handler(int signal) +{ + fprintf(stdout, "signal %u received\n", signal); + + switch (signal) { + case SIGINT: + case SIGTERM: + quit++; + break; + case SIGABRT: + osmo_generate_backtrace(); + /* in case of abort, we want to obtain a talloc report + * and then return to the caller, who will abort the process */ + case SIGUSR1: + talloc_report(tall_vty_ctx, stderr); + talloc_report_full(root_ctx, stderr); + break; + case SIGUSR2: + talloc_report_full(tall_vty_ctx, stderr); + break; + default: + break; + } +} + +static struct vty_app_info vty_info = { + .name = "tdef_vty_test", + .version = PACKAGE_VERSION, +}; + +static const struct log_info_cat default_categories = {}; + +const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + int rc; + + root_ctx = talloc_named_const(NULL, 0, "tdef_vty_test"); + + osmo_init_logging2(root_ctx, &log_info); + + vty_info.tall_ctx = root_ctx; + vty_init(&vty_info); + osmo_talloc_vty_add_cmds(); + + timer_init_vty(); /* <---- the only tdef relevant init */ + + handle_options(argc, argv); + + if (cmdline_config.config_file) { + rc = vty_read_config_file(cmdline_config.config_file, NULL); + if (rc < 0) { + fprintf(stderr, "Failed to parse the config file: '%s'\n", cmdline_config.config_file); + return 1; + } + } + + rc = telnet_init_dynif(root_ctx, NULL, vty_get_bind_addr(), 42042); + if (rc < 0) + return 2; + + signal(SIGINT, &signal_handler); + signal(SIGTERM, &signal_handler); + signal(SIGABRT, &signal_handler); + signal(SIGUSR1, &signal_handler); + signal(SIGUSR2, &signal_handler); + osmo_init_ignore_signals(); + + if (cmdline_config.daemonize) { + rc = osmo_daemonize(); + if (rc < 0) { + perror("Error during daemonize"); + return 6; + } + } + + while (!quit) { + log_reset_context(); + osmo_select_main(0); + } + + talloc_free(root_ctx); + talloc_free(tall_vty_ctx); + + return 0; +}
View file
libosmocore_1.7.0.tar.xz/tests/tdef/tdef_vty_config_root_test.vty
Changed
(renamed from tests/tdef/tdef_vty_test_config_root.vty)
View file
libosmocore_1.7.0.tar.xz/tests/tdef/tdef_vty_config_subnode_test.c
Added
@@ -0,0 +1,284 @@ +/* Test implementation for osmo_tdef VTY configuration API. */ +/* + * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> + * + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> + * + * 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. + */ + +#define _GNU_SOURCE +#include <getopt.h> +#include <signal.h> +#include <limits.h> +#include <string.h> + +#include <osmocom/core/application.h> + +#include <osmocom/vty/command.h> +#include <osmocom/vty/misc.h> +#include <osmocom/vty/telnet_interface.h> + +#include <osmocom/core/tdef.h> +#include <osmocom/vty/tdef_vty.h> + +#include <stdlib.h> + +#include "config.h" + +/* ------------------- HERE IS THE INTERESTING TDEF RELEVANT PART ------------------- */ + +/* This example keeps a single global timer group and offers a custom 'timer' VTY command in a 'network' subnode below + * the CONFIG_NODE. + * the tdef_vty_config_subnode_test.vty transcript test. + */ + +static struct osmo_tdef global_tdefs = { + { .T=1, .default_val=100, .desc="Testing a hundred seconds" }, // default is .unit=OSMO_TDEF_S == 0 + { .T=2, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Testing a hundred milliseconds" }, + { .T=3, .default_val=100, .unit=OSMO_TDEF_M, .desc="Testing a hundred minutes" }, + { .T=4, .default_val=100, .unit=OSMO_TDEF_CUSTOM, .desc="Testing a hundred potatoes" }, + { .T=0x7fffffff, .default_val=0xffffffff, .unit=OSMO_TDEF_M, .desc="Very large" }, + { .T=-23, .default_val=239471, .desc="Negative T number" }, + {} // <-- important! last entry shall be zero +}; + +enum tdef_vty_test_nodes { + GSMNET_NODE = _LAST_OSMOVTY_NODE + 1, +}; + +/* This example offers 'timer T123' commands within an "unrelated" already existing subnode. */ +static struct cmd_node gsmnet_node = { + GSMNET_NODE, + "%s(config-net)# ", + 1, +}; + +DEFUN(show_timer, show_timer_cmd, + "show timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL, + SHOW_STR "Show timers\n" + OSMO_TDEF_VTY_DOC_T) +{ + const char *T_arg = argc > 0 ? argv0 : NULL; + return osmo_tdef_vty_show_cmd(vty, global_tdefs, T_arg, NULL); +} + +DEFUN(cfg_net_timer, cfg_net_timer_cmd, + "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL, + "Configure or show timers\n" + OSMO_TDEF_VTY_DOC_SET) +{ + /* If any arguments are missing, redirect to 'show' */ + if (argc < 2) + return show_timer(self, vty, argc, argv); + return osmo_tdef_vty_set_cmd(vty, global_tdefs, argv); +} + +DEFUN(cfg_net, cfg_net_cmd, + "network", "Enter network node\n") +{ + vty->node = GSMNET_NODE; + return CMD_SUCCESS; +} + +static int config_write_gsmnet(struct vty *vty) +{ + vty_out(vty, "net%s", VTY_NEWLINE); + /* usually, here would be the output of any other 'net' config items... */ + + osmo_tdef_vty_write(vty, global_tdefs, " timer "); + return CMD_SUCCESS; +} + +static void gsmnet_init_vty() +{ + install_node(&gsmnet_node, config_write_gsmnet); + install_element(CONFIG_NODE, &cfg_net_cmd); + + osmo_tdefs_reset(global_tdefs); + install_element_ve(&show_timer_cmd); + install_element(GSMNET_NODE, &cfg_net_timer_cmd); +} + +/* ------------------- THE REST is just boilerplate osmo main() ------------------- */ + +void *root_ctx = NULL; + +static void print_help() +{ + printf( "options:\n" + " -h --help this text\n" + " -d --debug MASK Enable debugging (e.g. -d DRSL:DOML:DLAPDM)\n" + " -D --daemonize For the process into a background daemon\n" + " -c --config-file Specify the filename of the config file\n" + " -s --disable-color Don't use colors in stderr log output\n" + " -T --timestamp Prefix every log line with a timestamp\n" + " -V --version Print version information and exit\n" + " -e --log-level Set a global log-level\n" + ); +} + +static struct { + const char *config_file; + int daemonize; +} cmdline_config = {}; + +static void handle_options(int argc, char **argv) +{ + while (1) { + int option_idx = 0, c; + static const struct option long_options = { + { "help", 0, 0, 'h' }, + { "debug", 1, 0, 'd' }, + { "daemonize", 0, 0, 'D' }, + { "config-file", 1, 0, 'c' }, + { "disable-color", 0, 0, 's' }, + { "timestamp", 0, 0, 'T' }, + { "version", 0, 0, 'V' }, + { "log-level", 1, 0, 'e' }, + {} + }; + + c = getopt_long(argc, argv, "hc:d:Dc:sTVe:", + long_options, &option_idx); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(); + exit(0); + case 's': + log_set_use_color(osmo_stderr_target, 0); + break; + case 'd': + log_parse_category_mask(osmo_stderr_target, optarg); + break; + case 'D': + cmdline_config.daemonize = 1; + break; + case 'c': + cmdline_config.config_file = optarg; + break; + case 'T': + log_set_print_timestamp(osmo_stderr_target, 1); + break; + case 'e': + log_set_log_level(osmo_stderr_target, atoi(optarg)); + break; + case 'V': + print_version(1); + exit(0); + break; + default: + /* catch unknown options *as well as* missing arguments. */ + fprintf(stderr, "Error in command line options. Exiting.\n"); + exit(-1); + } + } +} + +static int quit = 0; + +static void signal_handler(int signal) +{ + fprintf(stdout, "signal %u received\n", signal); + + switch (signal) { + case SIGINT: + case SIGTERM: + quit++; + break; + case SIGABRT: + osmo_generate_backtrace(); + /* in case of abort, we want to obtain a talloc report + * and then return to the caller, who will abort the process */ + case SIGUSR1: + talloc_report(tall_vty_ctx, stderr); + talloc_report_full(root_ctx, stderr); + break; + case SIGUSR2: + talloc_report_full(tall_vty_ctx, stderr); + break; + default: + break; + } +} + +static struct vty_app_info vty_info = { + .name = "tdef_vty_test", + .version = PACKAGE_VERSION, +}; + +static const struct log_info_cat default_categories = {}; + +const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + int rc; + + root_ctx = talloc_named_const(NULL, 0, "tdef_vty_test"); + + osmo_init_logging2(root_ctx, &log_info); + + vty_info.tall_ctx = root_ctx; + vty_init(&vty_info); + osmo_talloc_vty_add_cmds(); + + gsmnet_init_vty(); /* <--- relevant init for this example */ + + handle_options(argc, argv); + + if (cmdline_config.config_file) { + rc = vty_read_config_file(cmdline_config.config_file, NULL); + if (rc < 0) { + fprintf(stderr, "Failed to parse the config file: '%s'\n", cmdline_config.config_file); + return 1; + } + } + + rc = telnet_init_dynif(root_ctx, NULL, vty_get_bind_addr(), 42042); + if (rc < 0) + return 2; + + signal(SIGINT, &signal_handler); + signal(SIGTERM, &signal_handler); + signal(SIGABRT, &signal_handler); + signal(SIGUSR1, &signal_handler); + signal(SIGUSR2, &signal_handler); + osmo_init_ignore_signals(); + + if (cmdline_config.daemonize) { + rc = osmo_daemonize(); + if (rc < 0) { + perror("Error during daemonize"); + return 6; + } + } + + while (!quit) { + log_reset_context(); + osmo_select_main(0); + } + + talloc_free(root_ctx); + talloc_free(tall_vty_ctx); + + return 0; +}
View file
libosmocore_1.7.0.tar.xz/tests/tdef/tdef_vty_config_subnode_test.vty
Changed
(renamed from tests/tdef/tdef_vty_test_config_subnode.vty)
View file
libosmocore_1.7.0.tar.xz/tests/tdef/tdef_vty_dynamic_test.c
Added
@@ -0,0 +1,358 @@ +/* Test implementation for osmo_tdef VTY configuration API. */ +/* + * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> + * + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> + * + * 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. + */ + +#define _GNU_SOURCE +#include <getopt.h> +#include <signal.h> +#include <limits.h> +#include <string.h> + +#include <osmocom/core/application.h> + +#include <osmocom/vty/command.h> +#include <osmocom/vty/misc.h> +#include <osmocom/vty/telnet_interface.h> + +#include <osmocom/core/tdef.h> +#include <osmocom/vty/tdef_vty.h> + +#include <stdlib.h> + +#include "config.h" + +void *root_ctx = NULL; + +/* ------------------- HERE IS THE INTERESTING TDEF RELEVANT PART ------------------- */ + +/* This example keeps a separate list of timers for each instance of a dynamically allocated instance of a VTY node, + * for example of keeping separate timers for each BTS in a BSC. + */ + +static const struct osmo_tdef bts_default_tdefs = { + { .T=1111, .default_val=2, .desc="Dynamic Duo" }, + { .T=2222, .default_val=1, .desc="BATMAN" }, + { .T=3333, .default_val=12, .desc="Dadadadadadadadadadadada" }, + { .T=4444, .default_val=500, .unit=OSMO_TDEF_MS, .desc="POW!" }, + {} +}; + + +/* Boilerplate dynamic VTY node ... */ + +enum tdef_vty_test_nodes { + MEMBER_NODE = _LAST_OSMOVTY_NODE + 1, +}; + +static struct cmd_node member_node = { + MEMBER_NODE, + "%s(config-member)# ", + 1, +}; + +struct member { + struct llist_head entry; + char name23; + struct osmo_tdef *tdefs; +}; + +LLIST_HEAD(all_members); + +struct member *member_alloc(const char *name) +{ + struct member *m = talloc_zero(root_ctx, struct member); + osmo_strlcpy(m->name, name, sizeof(m->name)); + + /* DYNAMIC TDEF COPIES */ + m->tdefs = (struct osmo_tdef*)talloc_size(m, sizeof(bts_default_tdefs)); + memcpy((char*)m->tdefs, (char*)&bts_default_tdefs, sizeof(bts_default_tdefs)); + osmo_tdefs_reset(m->tdefs); + + llist_add_tail(&m->entry, &all_members); + return m; +} + +struct member *member_find(const char *name) +{ + struct member *m; + llist_for_each_entry(m, &all_members, entry) { + if (!strcmp(m->name, name)) + return m; + } + return NULL; +} + +DEFUN(cfg_member, cfg_member_cmd, + "member NAME", + "Enter member node\n" "Existing or new member node name\n") +{ + const char *name = argv0; + struct member *m = member_find(name); + if (!m) + m = member_alloc(name); + vty->index = m; + vty->node = MEMBER_NODE; + return CMD_SUCCESS; +} + + +/* TDEF SPECIFIC VTY */ + +static bool startswith(const char *str, const char *startswith_str) +{ + if (!startswith_str) + return true; + if (!str) + return false; + return strncmp(str, startswith_str, strlen(startswith_str)) == 0; +} + +DEFUN(show_timer, show_member_timer_cmd, + "show member-timer NAME " OSMO_TDEF_VTY_ARG_T_OPTIONAL, + SHOW_STR "Show timers for a specific member" "member name\n" + OSMO_TDEF_VTY_DOC_T) +{ + const char *name = argc > 0 ? argv0 : NULL; + struct member *m; + const char *T_arg = argc > 1 ? argv1 : NULL; + int shown = 0; + + llist_for_each_entry(m, &all_members, entry) { + if (!name || startswith(m->name, name)) { + osmo_tdef_vty_show_cmd(vty, m->tdefs, T_arg, "%11s: ", m->name); + shown ++; + } + } + if (!shown) { + vty_out(vty, "%% No such member: %s%s", name ? : "(none)", VTY_NEWLINE); + return CMD_WARNING; + } + return CMD_SUCCESS; +} + +DEFUN(cfg_member_timer, cfg_member_timer_cmd, + "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL, + "Configure or show timers for this member\n" + OSMO_TDEF_VTY_DOC_SET) +{ + struct member *m = vty->index; + + if (!m || !m->tdefs) { + vty_out(vty, "%% No timers here%s", VTY_NEWLINE); + return CMD_WARNING; + } + + /* If any arguments are missing, redirect to 'show' */ + if (argc < 2) { + const char *T_arg = argc > 0 ? argv0 : NULL; + return osmo_tdef_vty_show_cmd(vty, m->tdefs, T_arg, "%11s: ", m->name); + } + + return osmo_tdef_vty_set_cmd(vty, m->tdefs, argv); +} + +static int config_write_member(struct vty *vty) +{ + struct member *m; + llist_for_each_entry(m, &all_members, entry) { + vty_out(vty, "member %s%s", m->name, VTY_NEWLINE); + osmo_tdef_vty_write(vty, m->tdefs, " timer "); + } + + return CMD_SUCCESS; +} + +static void member_init_vty() +{ + install_node(&member_node, config_write_member); + install_element(CONFIG_NODE, &cfg_member_cmd); + + install_element_ve(&show_member_timer_cmd); + install_element(MEMBER_NODE, &cfg_member_timer_cmd); +} + +/* ------------------- THE REST is just boilerplate osmo main() ------------------- */ + +static void print_help() +{ + printf( "options:\n" + " -h --help this text\n" + " -d --debug MASK Enable debugging (e.g. -d DRSL:DOML:DLAPDM)\n" + " -D --daemonize For the process into a background daemon\n" + " -c --config-file Specify the filename of the config file\n" + " -s --disable-color Don't use colors in stderr log output\n" + " -T --timestamp Prefix every log line with a timestamp\n" + " -V --version Print version information and exit\n" + " -e --log-level Set a global log-level\n" + ); +} + +static struct { + const char *config_file; + int daemonize; +} cmdline_config = {}; + +static void handle_options(int argc, char **argv) +{ + while (1) { + int option_idx = 0, c; + static const struct option long_options = { + { "help", 0, 0, 'h' }, + { "debug", 1, 0, 'd' }, + { "daemonize", 0, 0, 'D' }, + { "config-file", 1, 0, 'c' }, + { "disable-color", 0, 0, 's' }, + { "timestamp", 0, 0, 'T' }, + { "version", 0, 0, 'V' }, + { "log-level", 1, 0, 'e' }, + {} + }; + + c = getopt_long(argc, argv, "hc:d:Dc:sTVe:", + long_options, &option_idx); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(); + exit(0); + case 's': + log_set_use_color(osmo_stderr_target, 0); + break; + case 'd': + log_parse_category_mask(osmo_stderr_target, optarg); + break; + case 'D': + cmdline_config.daemonize = 1; + break; + case 'c': + cmdline_config.config_file = optarg; + break; + case 'T': + log_set_print_timestamp(osmo_stderr_target, 1); + break; + case 'e': + log_set_log_level(osmo_stderr_target, atoi(optarg)); + break; + case 'V': + print_version(1); + exit(0); + break; + default: + /* catch unknown options *as well as* missing arguments. */ + fprintf(stderr, "Error in command line options. Exiting.\n"); + exit(-1); + } + } +} + +static int quit = 0; + +static void signal_handler(int signal) +{ + fprintf(stdout, "signal %u received\n", signal); + + switch (signal) { + case SIGINT: + case SIGTERM: + quit++; + break; + case SIGABRT: + osmo_generate_backtrace(); + /* in case of abort, we want to obtain a talloc report + * and then return to the caller, who will abort the process */ + case SIGUSR1: + talloc_report(tall_vty_ctx, stderr); + talloc_report_full(root_ctx, stderr); + break; + case SIGUSR2: + talloc_report_full(tall_vty_ctx, stderr); + break; + default: + break; + } +} + +static struct vty_app_info vty_info = { + .name = "tdef_vty_test", + .version = PACKAGE_VERSION, +}; + +static const struct log_info_cat default_categories = {}; + +const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; + +int main(int argc, char **argv) +{ + int rc; + + root_ctx = talloc_named_const(NULL, 0, "tdef_vty_test"); + + osmo_init_logging2(root_ctx, &log_info); + + vty_info.tall_ctx = root_ctx; + vty_init(&vty_info); + osmo_talloc_vty_add_cmds(); + + member_init_vty(); /* <--- relevant init for this example */ + + handle_options(argc, argv); + + if (cmdline_config.config_file) { + rc = vty_read_config_file(cmdline_config.config_file, NULL); + if (rc < 0) { + fprintf(stderr, "Failed to parse the config file: '%s'\n", cmdline_config.config_file); + return 1; + } + } + + rc = telnet_init_dynif(root_ctx, NULL, vty_get_bind_addr(), 42042); + if (rc < 0) + return 2; + + signal(SIGINT, &signal_handler); + signal(SIGTERM, &signal_handler); + signal(SIGABRT, &signal_handler); + signal(SIGUSR1, &signal_handler); + signal(SIGUSR2, &signal_handler); + osmo_init_ignore_signals(); + + if (cmdline_config.daemonize) { + rc = osmo_daemonize(); + if (rc < 0) { + perror("Error during daemonize"); + return 6; + } + } + + while (!quit) { + log_reset_context(); + osmo_select_main(0); + } + + talloc_free(root_ctx); + talloc_free(tall_vty_ctx); + + return 0; +}
View file
libosmocore_1.7.0.tar.xz/tests/tdef/tdef_vty_dynamic_test.vty
Changed
(renamed from tests/tdef/tdef_vty_test_dynamic.vty)
View file
libosmocore_1.6.0.tar.xz/tests/testsuite.at -> libosmocore_1.7.0.tar.xz/tests/testsuite.at
Changed
@@ -36,7 +36,7 @@ AT_SETUP(bitvec) AT_KEYWORDS(bitvec) cat $abs_srcdir/bitvec/bitvec_test.ok > expout -AT_CHECK($abs_top_builddir/tests/bitvec/bitvec_test, 0, expout, ignore) +AT_CHECK($abs_top_builddir/tests/bitvec/bitvec_test, 0, expout) AT_CLEANUP AT_SETUP(bitcomp) @@ -168,11 +168,18 @@ AT_CHECK($abs_top_builddir/tests/gprs/gprs_test, 0, expout, ignore) AT_CLEANUP -AT_SETUP(logging) -AT_KEYWORDS(logging) +AT_SETUP(logging_stream) +AT_KEYWORDS(logging_stream) cat $abs_srcdir/logging/logging_test.ok > expout cat $abs_srcdir/logging/logging_test.err > experr -AT_CHECK($abs_top_builddir/tests/logging/logging_test, 0, expout, experr) +AT_CHECK($abs_top_builddir/tests/logging/logging_test stream, 0, expout, experr) +AT_CLEANUP + +AT_SETUP(logging_wqueue) +AT_KEYWORDS(logging_wqueue) +cat $abs_srcdir/logging/logging_test.ok > expout +cat $abs_srcdir/logging/logging_test.err > experr +AT_CHECK($abs_top_builddir/tests/logging/logging_test wqueue, 0, expout, experr) AT_CLEANUP AT_SETUP(codec) @@ -458,3 +465,9 @@ cat $abs_srcdir/time_cc/time_cc_test.ok > expout AT_CHECK($abs_top_builddir/tests/time_cc/time_cc_test, 0, expout, ignore) AT_CLEANUP + +AT_SETUP(iuup) +AT_KEYWORDS(iuup) +cat $abs_srcdir/iuup/iuup_test.ok > expout +AT_CHECK($abs_top_builddir/tests/iuup/iuup_test, 0, expout, ignore) +AT_CLEANUP
View file
libosmocore_1.6.0.tar.xz/tests/timer/clk_override_test.c -> libosmocore_1.7.0.tar.xz/tests/timer/clk_override_test.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/timer/timer_test.c -> libosmocore_1.7.0.tar.xz/tests/timer/timer_test.c
Changed
@@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/use_count/use_count_test.c -> libosmocore_1.7.0.tar.xz/tests/use_count/use_count_test.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <stdio.h>
View file
libosmocore_1.6.0.tar.xz/tests/use_count/use_count_test.err -> libosmocore_1.7.0.tar.xz/tests/use_count/use_count_test.err
Changed
@@ -11,9 +11,9 @@ 3 foos A few gets and puts, logging source file information -DFOO NOTICE foo(a){IN_USE}: a +1 barring: now used by 1 (barring) (use_count_test.c:223) -DFOO NOTICE foo(b){IN_USE}: b +1 barring: now used by 1 (barring) (use_count_test.c:225) -DFOO NOTICE foo(b){IN_USE}: b +1 fighting: now used by 2 (barring,fighting) (use_count_test.c:226) +DFOO NOTICE foo(a){IN_USE}: a +1 barring: now used by 1 (barring) (use_count_test.c:219) +DFOO NOTICE foo(b){IN_USE}: b +1 barring: now used by 1 (barring) (use_count_test.c:221) +DFOO NOTICE foo(b){IN_USE}: b +1 fighting: now used by 2 (barring,fighting) (use_count_test.c:222) all use counts: a: 1 (barring) @@ -22,7 +22,7 @@ 3 foos Attempt to get more than one on limited 'barring' user: -DFOO ERROR foo(b){IN_USE}: Attempt to get more than one barring (use_count_test.c:231) +DFOO ERROR foo(b){IN_USE}: Attempt to get more than one barring (use_count_test.c:227) osmo_use_count_get_put(b, barring, 1) returned error: -34 Numerical result out of range all use counts: @@ -32,7 +32,7 @@ 3 foos Put away one user of b -DFOO NOTICE foo(b){IN_USE}: b -1 barring: now used by 1 (fighting) (use_count_test.c:235) +DFOO NOTICE foo(b){IN_USE}: b -1 barring: now used by 1 (fighting) (use_count_test.c:231) all use counts: a: 1 (barring)
View file
libosmocore_1.6.0.tar.xz/tests/ussd/ussd_test.c -> libosmocore_1.7.0.tar.xz/tests/ussd/ussd_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/application.h>
View file
libosmocore_1.6.0.tar.xz/tests/utils/utils_test.c -> libosmocore_1.7.0.tar.xz/tests/utils/utils_test.c
Changed
@@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/gsm/ipa.h>
View file
libosmocore_1.6.0.tar.xz/tests/vty/vty_test.c -> libosmocore_1.7.0.tar.xz/tests/vty/vty_test.c
Changed
@@ -13,10 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h> @@ -542,9 +538,9 @@ /* Reserved for libraries */ VTY_TEST_ATTR_UPPER = 'X', /* Reserved for global attribues */ - VTY_TEST_ATTR_RAFC_DOT '.', - VTY_TEST_ATTR_RAFC_EXCL '!', - VTY_TEST_ATTR_RAFC_AT '@', + VTY_TEST_ATTR_RAFC_DOT = '.', + VTY_TEST_ATTR_RAFC_EXCL = '!', + VTY_TEST_ATTR_RAFC_AT = '@', }, };
View file
libosmocore_1.6.0.tar.xz/tests/vty/vty_transcript_test.c -> libosmocore_1.7.0.tar.xz/tests/vty/vty_transcript_test.c
Changed
@@ -17,10 +17,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _GNU_SOURCE
View file
libosmocore_1.6.0.tar.xz/utils/conv_gen.py -> libosmocore_1.7.0.tar.xz/utils/conv_gen.py
Changed
@@ -16,10 +16,6 @@ * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ """
View file
libosmocore_1.6.0.tar.xz/utils/osmo-arfcn.c -> libosmocore_1.7.0.tar.xz/utils/osmo-arfcn.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h> @@ -97,7 +93,7 @@ { int arfcn, freq, pcs = 0, uplink = -1; int opt; - char *param; + char *param = NULL; enum program_mode mode = MODE_NONE; while ((opt = getopt(argc, argv, "pa:f:udh")) != -1) {
View file
libosmocore_1.6.0.tar.xz/utils/osmo-auc-gen.c -> libosmocore_1.7.0.tar.xz/utils/osmo-auc-gen.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */
View file
libosmocore_1.6.0.tar.xz/utils/osmo-config-merge.c -> libosmocore_1.7.0.tar.xz/utils/osmo-config-merge.c
Changed
@@ -15,10 +15,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ /*
View file
libosmocore_1.6.0.tar.xz/utils/osmo-ns-dummy-vty.c -> libosmocore_1.7.0.tar.xz/utils/osmo-ns-dummy-vty.c
Changed
@@ -21,7 +21,6 @@ * */ -#include <talloc.h> #include <errno.h> #include <string.h> #include <stdio.h> @@ -30,6 +29,7 @@ #include <inttypes.h> +#include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/application.h> #include <osmocom/core/stats.h>
View file
libosmocore_1.6.0.tar.xz/utils/osmo-sim-test.c -> libosmocore_1.7.0.tar.xz/utils/osmo-sim-test.c
Changed
@@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <stdio.h>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.