Hello community, here is the log from the commit of package libosmo-netif for openSUSE:Factory checked in at 2017-12-29 18:51:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libosmo-netif (Old) and /work/SRC/openSUSE:Factory/.libosmo-netif.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libosmo-netif" Fri Dec 29 18:51:59 2017 rev:4 rq:560209 version:0.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libosmo-netif/libosmo-netif.changes 2017-10-10 11:42:27.408867331 +0200 +++ /work/SRC/openSUSE:Factory/.libosmo-netif.new/libosmo-netif.changes 2017-12-29 18:52:07.475958562 +0100 @@ -1,0 +2,8 @@ +Wed Dec 27 20:38:21 UTC 2017 - jeng...@inai.de + +- Update to new upstream release 0.1.1 + * cosmetic: relax UDP length check + * cosmetic: print textual error from recv() + * osmux_snprintf: Support different types of Osmux frames + +------------------------------------------------------------------- Old: ---- libosmo-netif-0.0.6.85.tar.xz New: ---- libosmo-netif-0.1.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libosmo-netif.spec ++++++ --- /var/tmp/diff_new_pack.XZE1VU/_old 2017-12-29 18:52:08.219744939 +0100 +++ /var/tmp/diff_new_pack.XZE1VU/_new 2017-12-29 18:52:08.223743791 +0100 @@ -16,13 +16,13 @@ # -%define version_unconverted 0.0.6.85 +%define version_unconverted 0.1.1 Name: libosmo-netif Summary: Osmocom library for muxed audio License: GPL-2.0+ Group: Productivity/Telephony/Utilities -Version: 0.0.6.85 +Version: 0.1.1 Release: 0 Url: https://osmocom.org/projects/libosmo-netif @@ -34,28 +34,27 @@ BuildRequires: lksctp-tools-devel BuildRequires: pkg-config >= 0.20 BuildRequires: xz -BuildRequires: pkgconfig(libosmoabis) >= 0.3.2.3 -BuildRequires: pkgconfig(libosmocore) >= 0.3.0 -BuildRequires: pkgconfig(libosmogsm) >= 0.3.0 -BuildRequires: pkgconfig(libosmovty) >= 0.3.0 +BuildRequires: pkgconfig(libosmoabis) >= 0.0.7 +BuildRequires: pkgconfig(libosmocore) >= 0.10.0 +BuildRequires: pkgconfig(libosmogsm) >= 0.10.0 BuildRequires: pkgconfig(talloc) %description Network interface demuxer library for OsmoCom projects. -%package -n libosmonetif3 +%package -n libosmonetif4 Summary: Osmocom library for muxed audio License: AGPL-3.0+ Group: System/Libraries -%description -n libosmonetif3 +%description -n libosmonetif4 Network interface demuxer library for OsmoCom projects. %package -n libosmonetif-devel Summary: Development files for the Osmocom muxed audio library License: AGPL-3.0+ Group: Development/Libraries/C and C++ -Requires: libosmonetif3 = %version +Requires: libosmonetif4 = %version %description -n libosmonetif-devel Network interface demuxer library for OsmoCom projects. @@ -85,12 +84,12 @@ # timing issue fi -%post -n libosmonetif3 -p /sbin/ldconfig -%postun -n libosmonetif3 -p /sbin/ldconfig +%post -n libosmonetif4 -p /sbin/ldconfig +%postun -n libosmonetif4 -p /sbin/ldconfig -%files -n libosmonetif3 +%files -n libosmonetif4 %defattr(-,root,root) -%_libdir/libosmonetif.so.3* +%_libdir/libosmonetif.so.4* %files -n libosmonetif-devel %defattr(-,root,root) ++++++ _service ++++++ --- /var/tmp/diff_new_pack.XZE1VU/_old 2017-12-29 18:52:08.263732306 +0100 +++ /var/tmp/diff_new_pack.XZE1VU/_new 2017-12-29 18:52:08.263732306 +0100 @@ -2,7 +2,8 @@ <service name="tar_scm" mode="disabled"> <param name="scm">git</param> <param name="url">git://git.osmocom.org/libosmo-netif</param> - <param name="versionformat">@PARENT_TAG@.@TAG_OFFSET@</param> + <param name="revision">0.1.1</param> + <param name="versionformat">0.1.1</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> ++++++ libosmo-netif-0.0.6.85.tar.xz -> libosmo-netif-0.1.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/configure.ac new/libosmo-netif-0.1.1/configure.ac --- old/libosmo-netif-0.0.6.85/configure.ac 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/configure.ac 2017-10-28 12:41:34.000000000 +0200 @@ -52,8 +52,8 @@ dnl Generate the output AM_CONFIG_HEADER(config.h) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.0) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.0) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.10.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.10.0) dnl FIXME: We depend on libosmoabis by now until we can move LAPD code here PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.0.7) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/debian/changelog new/libosmo-netif-0.1.1/debian/changelog --- old/libosmo-netif-0.0.6.85/debian/changelog 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/debian/changelog 2017-10-28 12:41:34.000000000 +0200 @@ -1,8 +1,18 @@ -libosmo-netif (0.0.7) UNRELEASED; urgency=medium +libosmo-netif (0.1.1) unstable; urgency=medium + * New upstream release. + + -- Harald Welte <laf...@gnumonks.org> Sat, 28 Oct 2017 12:41:34 +0200 + +libosmo-netif (0.1.0) unstable; urgency=medium + + [ Holger Hans Peter Freyther ] * Move forward toward a new release. - -- Holger Hans Peter Freyther <hol...@moiji-mobile.com> Tue, 24 May 2016 23:06:33 +0200 + [ Harald Welte ] + * Update to upstream 0.1.0 + + -- Holger Hans Peter Freyther <hol...@moiji-mobile.com> Fri, 27 Oct 2017 20:00:39 +0200 libosmo-netif (0.0.6) unstable; urgency=medium diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/debian/control new/libosmo-netif-0.1.1/debian/control --- old/libosmo-netif-0.0.6.85/debian/control 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/debian/control 2017-10-28 12:41:34.000000000 +0200 @@ -21,7 +21,7 @@ Vcs-Git: git://git.osmocom.org/libosmo-netif.git Homepage: https://projects.osmocom.org/projects/libosmo-netif -Package: libosmonetif3 +Package: libosmonetif4 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} @@ -35,11 +35,10 @@ Package: libosmo-netif-dev Section: libdevel Architecture: any -Depends: ${shlibs:Depends}, - ${misc:Depends}, +Depends: ${misc:Depends}, libosmocore-dev, libosmocore, - libosmonetif3 (= ${binary:Version}) + libosmonetif4 (= ${binary:Version}) Multi-Arch: same Description: Development headers for Osmocom network interface The libosmo-netif library is one of the libraries needed by the @@ -53,7 +52,7 @@ Architecture: all Section: doc Depends: ${misc:Depends}, - libosmonetif3, + libosmonetif4, libjs-jquery Description: Documentation for the Osmo network interface library The libosmo-netif library is one of the libraries needed by the @@ -66,7 +65,7 @@ Section: debug Architecture: any Priority: extra -Depends: libosmonetif3 (= ${binary:Version}), ${misc:Depends} +Depends: libosmonetif4 (= ${binary:Version}), ${misc:Depends} Multi-Arch: same Description: Debug symbols for Osmocom network interface library The libosmo-netif library is one of the libraries needed by the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/debian/libosmonetif3.install new/libosmo-netif-0.1.1/debian/libosmonetif3.install --- old/libosmo-netif-0.0.6.85/debian/libosmonetif3.install 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/debian/libosmonetif3.install 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -usr/lib/*/libosmonetif*.so.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/debian/libosmonetif4.install new/libosmo-netif-0.1.1/debian/libosmonetif4.install --- old/libosmo-netif-0.0.6.85/debian/libosmonetif4.install 1970-01-01 01:00:00.000000000 +0100 +++ new/libosmo-netif-0.1.1/debian/libosmonetif4.install 2017-10-28 12:41:34.000000000 +0200 @@ -0,0 +1 @@ +usr/lib/*/libosmonetif*.so.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/debian/rules new/libosmo-netif-0.1.1/debian/rules --- old/libosmo-netif-0.0.6.85/debian/rules 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/debian/rules 2017-10-28 12:41:34.000000000 +0200 @@ -26,3 +26,6 @@ override_dh_clean: dh_clean rm -f tests/package.m4 tests/testsuite .version .tarball-version + +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/examples/Makefile.am new/libosmo-netif-0.1.1/examples/Makefile.am --- old/libosmo-netif-0.0.6.85/examples/Makefile.am 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/examples/Makefile.am 2017-10-28 12:41:34.000000000 +0200 @@ -14,9 +14,13 @@ rs232-write \ rtp-udp-test-client \ rtp-udp-test-server \ + udp-test-client \ + udp-test-server \ osmux-test-input \ osmux-test-output +noinst_HEADERS = udp-test.h + ipa_stream_client_SOURCES = ipa-stream-client.c ipa_stream_client_LDADD = $(top_builddir)/src/libosmonetif.la \ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) @@ -57,6 +61,12 @@ rtp_udp_test_server_LDADD = $(top_builddir)/src/libosmonetif.la \ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) +udp_test_client_SOURCES = udp-test-client.c +udp_test_client_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) + +udp_test_server_SOURCES = udp-test-server.c +udp_test_server_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) + osmux_test_input_SOURCES = osmux-test-input.c osmux_test_input_LDADD = $(top_builddir)/src/libosmonetif.la \ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/examples/udp-test-client.c new/libosmo-netif-0.1.1/examples/udp-test-client.c --- old/libosmo-netif-0.0.6.85/examples/udp-test-client.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libosmo-netif-0.1.1/examples/udp-test-client.c 2017-10-28 12:41:34.000000000 +0200 @@ -0,0 +1,43 @@ +#include "udp-test.h" + +static int read_cb(struct osmo_dgram *conn) +{ + struct msgb *msg = print_recv(conn); + if (!msg) + return -1; + + if (msgb_length(msg)) + if (msgb_data(msg)[0] >= NUM_MSG - 1) + please_dont_die = false; /* end test: */ + + msgb_free(msg); + + return 0; +} + +int main(int argc, char **argv) +{ + uint8_t i; + + if (!dgram_init(THOST, CPORT, SPORT, read_cb)) + exit(EXIT_FAILURE); + + for(i = 0; i < NUM_MSG + 1; i++) { + /* N. B: moving this alocation outside of the loop will result in segfault */ + struct msgb *msg = msgb_alloc(MAX_MSG, "UDP/client"); + if (!msg) { + LOGP(DUDP_TEST, LOGL_ERROR, "cann't allocate message\n"); + return EXIT_FAILURE; + } + + if (!mtrim(msg, i, i)) + return EXIT_FAILURE; + + LOGP(DUDP_TEST, LOGL_NOTICE, "queue [%u] %s\n", msgb_length(msg), msgb_hexdump(msg)); + osmo_dgram_send(conn, msg); + } + + main_loop(THOST, CPORT, SPORT); + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/examples/udp-test-server.c new/libosmo-netif-0.1.1/examples/udp-test-server.c --- old/libosmo-netif-0.0.6.85/examples/udp-test-server.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libosmo-netif-0.1.1/examples/udp-test-server.c 2017-10-28 12:41:34.000000000 +0200 @@ -0,0 +1,35 @@ +#include "udp-test.h" + +int read_cb(struct osmo_dgram *conn) +{ + int bytes; + struct msgb *msg = print_recv(conn); + + if (!msg) + return -1; + + /* build reply: */ + bytes = msgb_length(msg); + + if (!mtrim(msg, 0, bytes)) + return -1; + + /* sent reply: */ + osmo_dgram_send(conn, msg); + + /* end test: */ + if (bytes > NUM_MSG - 1) + please_dont_die = false; + + return 0; +} + +int main(int argc, char **argv) +{ + if (!dgram_init(THOST, SPORT, CPORT, read_cb)) + return EXIT_FAILURE; + + main_loop(THOST, SPORT, CPORT); + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/examples/udp-test.h new/libosmo-netif-0.1.1/examples/udp-test.h --- old/libosmo-netif-0.0.6.85/examples/udp-test.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libosmo-netif-0.1.1/examples/udp-test.h 2017-10-28 12:41:34.000000000 +0200 @@ -0,0 +1,137 @@ +#pragma once + +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <signal.h> +#include <unistd.h> +#include <arpa/inet.h> +#include <time.h> + +#include <osmocom/core/talloc.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/logging.h> +#include <osmocom/core/application.h> +#include <osmocom/core/select.h> +#include <osmocom/netif/datagram.h> + +#define MAX_MSG 255 +#define NUM_MSG 11 +#define DUDP_TEST 0 +#define THOST "127.0.0.1" +#define SPORT 15000 +#define CPORT 15001 + +static struct osmo_dgram *conn; +static void *tall_test; +bool please_dont_die = true; + +static void sighandler(int foo) +{ + LOGP(DLINP, LOGL_NOTICE, "closing UDP test...\n"); + osmo_dgram_close(conn); + osmo_dgram_destroy(conn); + please_dont_die = false; +} + +static inline struct msgb *print_recv(struct osmo_dgram *conn) +{ + struct msgb *msg = msgb_alloc(MAX_MSG, "UDP/test"); + int bytes; + + LOGP(DUDP_TEST, LOGL_NOTICE, "received datagram: "); + + if (!msg) { + LOGPC(DUDP_TEST, LOGL_ERROR, "can't allocate message\n"); + return NULL; + } + + /* receive message: */ + bytes = osmo_dgram_recv(conn, msg); + if (bytes < 0) { + LOGPC(DUDP_TEST, LOGL_ERROR, "can't receive message: %u\n", -bytes); + msgb_free(msg); + return NULL; + } + + /* process message: */ + LOGPC(DUDP_TEST, LOGL_NOTICE, "[%u] %s\n", bytes, msgb_hexdump(msg)); + + return msg; +} + +static inline bool dgram_init(const char *host, uint16_t lport, uint16_t rport, void *read_cb) +{ + const struct log_info_cat udp_test_cat[] = { + [DUDP_TEST] = { + .name = "DUDP_TEST", + .description = "UDP test", + .color = "\033[1;35m", + .enabled = 1, .loglevel = LOGL_NOTICE, + }, + }; + + const struct log_info udp_test_log_info = { + .filter_fn = NULL, + .cat = udp_test_cat, + .num_cat = ARRAY_SIZE(udp_test_cat), + }; + + signal(SIGINT, sighandler); + + tall_test = talloc_named_const(NULL, 1, "udp_test"); + + osmo_init_logging(&udp_test_log_info); + log_set_log_level(osmo_stderr_target, LOGL_NOTICE); + + conn = osmo_dgram_create(tall_test); + if (!conn) { + LOGP(DUDP_TEST, LOGL_ERROR, "cannot create UDP socket\n"); + return false; + } + + osmo_dgram_set_local_addr(conn, host); + osmo_dgram_set_local_port(conn, lport); + osmo_dgram_set_remote_addr(conn, host); + osmo_dgram_set_remote_port(conn, rport); + osmo_dgram_set_read_cb(conn, read_cb); + + if (osmo_dgram_open(conn) < 0) { + LOGP(DUDP_TEST, LOGL_ERROR, "cannot open client connection %s:%u -> %s:%u\n", host, lport, host, rport); + return false; + } + + return true; +} + +static inline void main_loop(const char *host, uint16_t lport, uint16_t rport) +{ + LOGP(DUDP_TEST, LOGL_NOTICE, "Entering main loop: %s:%u -> %s:%u\n", host, lport, host, rport); + + while(please_dont_die) + osmo_select_main(0); +} + +/* Smart message trimmer: + * for all positive i trims msg to i - 1 + * for i = 0 trims msg to 0 + * for all positive x adds x to msg +*/ +/*! Smart message trimmer. + * \param[in] msg message buffer + * \param[in] i trim value: for all positive i, msg is trimmed to i - 1, otherwise msg is trimmed to 0 + * \param[in] x message content: for all positive x, x is added to msg, otherwise it's ignored + */ +static inline bool mtrim(struct msgb *msg, uint8_t i, uint8_t x) +{ + if (msgb_trim(msg, i ? i - 1 : i) != 0) { + LOGP(DLINP, LOGL_ERROR, "failed to trim message by %u\n", i); + return false; + } + + if (x) + msgb_put_u8(msg, x); + + return true; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/src/Makefile.am new/libosmo-netif-0.1.1/src/Makefile.am --- old/libosmo-netif-0.0.6.85/src/Makefile.am 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/src/Makefile.am 2017-10-28 12:41:34.000000000 +0200 @@ -1,16 +1,16 @@ # 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=3:0:0 +LIBVERSION=4:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir) -AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBSCTP_CFLAGS) +AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBSCTP_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) SUBDIRS = channel lib_LTLIBRARIES = libosmonetif.la -libosmonetif_la_LIBADD = channel/abis/libosmonetif-abis.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBSCTP_LIBS) +libosmonetif_la_LIBADD = channel/abis/libosmonetif-abis.la $(LIBOSMOCORE_LIBS) $(LIBSCTP_LIBS) libosmonetif_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined libosmonetif_la_SOURCES = amr.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/src/channel/abis/Makefile.am new/libosmo-netif-0.1.1/src/channel/abis/Makefile.am --- old/libosmo-netif-0.0.6.85/src/channel/abis/Makefile.am 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/src/channel/abis/Makefile.am 2017-10-28 12:41:34.000000000 +0200 @@ -1,9 +1,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir) -AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) +AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) noinst_LTLIBRARIES = libosmonetif-abis.la libosmonetif_abis_la_SOURCES = ipa_stream_server.c \ ipa_stream_client.c -libosmonetif_abis_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) +libosmonetif_abis_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/src/datagram.c new/libosmo-netif-0.1.1/src/datagram.c --- old/libosmo-netif-0.0.6.85/src/datagram.c 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/src/datagram.c 2017-10-28 12:41:34.000000000 +0200 @@ -23,6 +23,11 @@ /*! \addtogroup datagram Osmocom Datagram Socket * @{ + * + * This code is intended to abstract any use of datagram type sockets, + * such as UDP. It offers both transmitter and receiver side + * implementations, fully integrated with the libosmocore select loop + * abstraction. */ /*! \file datagram.c @@ -236,15 +241,15 @@ /*! \brief Receive data via Osmocom datagram receiver * \param[in] conn Datagram Receiver from which to receive * \param msg pre-allocate message buffer to which received data is appended - * \returns number of bytes read, negative on error. */ + * \returns number of bytes read (might be 0 for empty UDP packet), negative on error. */ int osmo_dgram_rx_recv(struct osmo_dgram_rx *conn, struct msgb *msg) { int ret; ret = recv(conn->ofd.fd, msg->data, msg->data_len, 0); - if (ret <= 0) { - LOGP(DLINP, LOGL_ERROR, "error receiving data from tx\n"); + if (ret < 0) { + LOGP(DLINP, LOGL_ERROR, "error receiving data from tx: %s\n", strerror(errno)); return ret; } msgb_put(msg, ret); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/src/osmux.c new/libosmo-netif-0.1.1/src/osmux.c --- old/libosmo-netif-0.0.6.85/src/osmux.c 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/src/osmux.c 2017-10-28 12:41:34.000000000 +0200 @@ -25,6 +25,15 @@ /*! \addtogroup osmux Osmocom Multiplex Protocol * @{ + * + * This code implements a variety of utility functions related to the + * OSMUX user-plane multiplexing protocol, an efficient alternative to + * plain UDP/RTP streams for voice transport in back-haul of cellular + * networks. + * + * For information about the OSMUX protocol design, please see the + * OSMUX reference manual at + * http://ftp.osmocom.org/docs/latest/osmux-reference.pdf */ /*! \file osmux.c @@ -892,14 +901,24 @@ return offset; } - +/*! Print osmux header fields and payload from msg into buffer buf. + * \param[out] buf buffer to store the output into + * \param[in] len length of buf in bytes + * \param[in] msgb message buffer containing one or more osmux frames + * \returns the number of characters printed (excluding the null byte used to end output to strings). + * + * If the output was truncated due to this limit, then the return value is the number of characters + * (excluding the terminating null byte) which would have been written to the final string if enough + * space had been available. + */ int osmux_snprintf(char *buf, size_t size, struct msgb *msg) { unsigned int remain = size; - int this_len, msg_off = 0; + unsigned int msg_off = 0; struct osmux_hdr *osmuxh; unsigned int offset = 0; int msg_len = msg->len; + uint32_t payload_len; int ret; if (size) @@ -914,34 +933,50 @@ } osmuxh = (struct osmux_hdr *)((uint8_t *)msg->data + msg_off); - if (!osmo_amr_ft_valid(osmuxh->amr_ft)) { - LOGP(DLMIB, LOGL_ERROR, "Bad AMR FT %d, skipping\n", - osmuxh->amr_ft); - return -1; - } - ret = osmux_snprintf_header(buf + offset, remain, osmuxh); SNPRINTF_BUFFER_SIZE(ret, remain, offset); - this_len = sizeof(struct osmux_hdr) + - osmux_get_payload_len(osmuxh); - msg_off += this_len; + msg_off += sizeof(struct osmux_hdr); + msg_len -= sizeof(struct osmux_hdr); - if (msg_len < this_len) { - LOGP(DLMIB, LOGL_ERROR, - "No room for OSMUX payload: only %d bytes\n", - msg_len); + switch (osmuxh->ft) { + case OSMUX_FT_SIGNAL: + ret = snprintf(buf + offset, remain, "[signal]"); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); return -1; - } + case OSMUX_FT_DUMMY: + case OSMUX_FT_VOICE_AMR: + if (!osmo_amr_ft_valid(osmuxh->amr_ft)) { + LOGP(DLMIB, LOGL_ERROR, "Bad AMR FT %d, skipping\n", + osmuxh->amr_ft); + return -1; + } - ret = osmux_snprintf_payload(buf + offset, remain, - osmux_get_payload(osmuxh), - osmux_get_payload_len(osmuxh)); - SNPRINTF_BUFFER_SIZE(ret, remain, offset); + payload_len = osmux_get_payload_len(osmuxh); - msg_len -= this_len; - } + if (msg_len < payload_len) { + LOGP(DLMIB, LOGL_ERROR, + "No room for OSMUX payload: only %d bytes\n", + msg_len); + return -1; + } + + if (osmuxh->ft == OSMUX_FT_VOICE_AMR) { + ret = osmux_snprintf_payload(buf + offset, remain, + osmux_get_payload(osmuxh), + payload_len); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); + } + msg_off += payload_len; + msg_len -= payload_len; + break; + default: + LOGP(DLMIB, LOGL_ERROR, "Unknown OSMUX ft value %d\n", + osmuxh->ft); + return -1; + } + } return offset; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/src/rs232.c new/libosmo-netif-0.1.1/src/rs232.c --- old/libosmo-netif-0.0.6.85/src/rs232.c 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/src/rs232.c 2017-10-28 12:41:34.000000000 +0200 @@ -35,7 +35,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/logging.h> #include <osmocom/core/talloc.h> -#include <osmocom/abis/e1_input.h> +#include <osmocom/core/timer.h> struct osmo_rs232 { struct osmo_fd ofd; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libosmo-netif-0.0.6.85/src/stream.c new/libosmo-netif-0.1.1/src/stream.c --- old/libosmo-netif-0.0.6.85/src/stream.c 2017-09-12 13:28:41.000000000 +0200 +++ new/libosmo-netif-0.1.1/src/stream.c 2017-10-28 12:41:34.000000000 +0200 @@ -30,6 +30,11 @@ /*! \addtogroup stream Osmocom Stream Socket * @{ + * + * This code is intended to abstract any use of stream-type sockets, + * such as TCP and SCTP. It offers both server and client side + * implementations, fully integrated with the libosmocore select loop + * abstraction. */ /*! \file stream.c ++++++ osmo-talloc.diff ++++++ --- /var/tmp/diff_new_pack.XZE1VU/_old 2017-12-29 18:52:08.403692108 +0100 +++ /var/tmp/diff_new_pack.XZE1VU/_new 2017-12-29 18:52:08.407690960 +0100 @@ -5,16 +5,16 @@ --- configure.ac | 1 + - examples/Makefile.am | 26 +++++++++++++------------- + examples/Makefile.am | 30 +++++++++++++++--------------- examples/channel/Makefile.am | 6 +++--- src/Makefile.am | 4 ++-- src/channel/abis/Makefile.am | 4 ++-- - 5 files changed, 21 insertions(+), 20 deletions(-) + 5 files changed, 23 insertions(+), 22 deletions(-) -Index: libosmo-netif-0.0.6.85/configure.ac +Index: libosmo-netif-0.1.1/configure.ac =================================================================== ---- libosmo-netif-0.0.6.85.orig/configure.ac -+++ libosmo-netif-0.0.6.85/configure.ac +--- libosmo-netif-0.1.1.orig/configure.ac ++++ libosmo-netif-0.1.1/configure.ac @@ -68,6 +68,7 @@ AC_SEARCH_LIBS([sctp_send], [sctp], [ AC_MSG_ERROR([sctp_send not found in searched libs])]) LIBS=$old_LIBS @@ -23,10 +23,10 @@ AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built)) AC_ARG_ENABLE(doxygen, -Index: libosmo-netif-0.0.6.85/examples/Makefile.am +Index: libosmo-netif-0.1.1/examples/Makefile.am =================================================================== ---- libosmo-netif-0.0.6.85.orig/examples/Makefile.am -+++ libosmo-netif-0.0.6.85/examples/Makefile.am +--- libosmo-netif-0.1.1.orig/examples/Makefile.am ++++ libosmo-netif-0.1.1/examples/Makefile.am @@ -1,5 +1,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) @@ -34,7 +34,7 @@ AM_LDFLAGS = $(COVERAGE_LDFLAGS) SUBDIRS = channel -@@ -19,48 +19,48 @@ noinst_PROGRAMS = ipa-stream-client \ +@@ -23,54 +23,54 @@ noinst_HEADERS = udp-test.h ipa_stream_client_SOURCES = ipa-stream-client.c ipa_stream_client_LDADD = $(top_builddir)/src/libosmonetif.la \ @@ -86,6 +86,14 @@ - $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) + $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(TALLOC_LIBS) + udp_test_client_SOURCES = udp-test-client.c +-udp_test_client_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) ++udp_test_client_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(TALLOC_LIBS) + + udp_test_server_SOURCES = udp-test-server.c +-udp_test_server_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) ++udp_test_server_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(TALLOC_LIBS) + osmux_test_input_SOURCES = osmux-test-input.c osmux_test_input_LDADD = $(top_builddir)/src/libosmonetif.la \ - $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) @@ -95,10 +103,10 @@ osmux_test_output_LDADD = $(top_builddir)/src/libosmonetif.la \ - $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) + $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(TALLOC_LIBS) -Index: libosmo-netif-0.0.6.85/examples/channel/Makefile.am +Index: libosmo-netif-0.1.1/examples/channel/Makefile.am =================================================================== ---- libosmo-netif-0.0.6.85.orig/examples/channel/Makefile.am -+++ libosmo-netif-0.0.6.85/examples/channel/Makefile.am +--- libosmo-netif-0.1.1.orig/examples/channel/Makefile.am ++++ libosmo-netif-0.1.1/examples/channel/Makefile.am @@ -1,5 +1,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -AM_CFLAGS=-Wall -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) @@ -117,40 +125,40 @@ abis_ipa_stream_client_LDADD = $(top_builddir)/src/libosmonetif.la \ - $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) + $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(TALLOC_LIBS) -Index: libosmo-netif-0.0.6.85/src/Makefile.am +Index: libosmo-netif-0.1.1/src/Makefile.am =================================================================== ---- libosmo-netif-0.0.6.85.orig/src/Makefile.am -+++ libosmo-netif-0.0.6.85/src/Makefile.am +--- libosmo-netif-0.1.1.orig/src/Makefile.am ++++ libosmo-netif-0.1.1/src/Makefile.am @@ -3,14 +3,14 @@ - LIBVERSION=3:0:0 + LIBVERSION=4:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir) --AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBSCTP_CFLAGS) -+AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBSCTP_CFLAGS) $(TALLOC_CFLAGS) +-AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBSCTP_CFLAGS) ++AM_CFLAGS = -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBSCTP_CFLAGS) $(TALLOC_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) SUBDIRS = channel lib_LTLIBRARIES = libosmonetif.la --libosmonetif_la_LIBADD = channel/abis/libosmonetif-abis.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBSCTP_LIBS) -+libosmonetif_la_LIBADD = channel/abis/libosmonetif-abis.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBSCTP_LIBS) $(TALLOC_LIBS) +-libosmonetif_la_LIBADD = channel/abis/libosmonetif-abis.la $(LIBOSMOCORE_LIBS) $(LIBSCTP_LIBS) ++libosmonetif_la_LIBADD = channel/abis/libosmonetif-abis.la $(LIBOSMOCORE_LIBS) $(LIBSCTP_LIBS) $(TALLOC_LIBS) libosmonetif_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined libosmonetif_la_SOURCES = amr.c \ -Index: libosmo-netif-0.0.6.85/src/channel/abis/Makefile.am +Index: libosmo-netif-0.1.1/src/channel/abis/Makefile.am =================================================================== ---- libosmo-netif-0.0.6.85.orig/src/channel/abis/Makefile.am -+++ libosmo-netif-0.0.6.85/src/channel/abis/Makefile.am +--- libosmo-netif-0.1.1.orig/src/channel/abis/Makefile.am ++++ libosmo-netif-0.1.1/src/channel/abis/Makefile.am @@ -1,9 +1,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir) --AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) -+AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) $(TALLOC_CFLAGS) +-AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) ++AM_CFLAGS = -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) $(TALLOC_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) noinst_LTLIBRARIES = libosmonetif-abis.la libosmonetif_abis_la_SOURCES = ipa_stream_server.c \ ipa_stream_client.c --libosmonetif_abis_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) -+libosmonetif_abis_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(TALLOC_LIBS) +-libosmonetif_abis_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) ++libosmonetif_abis_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(TALLOC_LIBS)