Compare commits
75 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
91ceb56495 | 3 weeks ago |
![]() |
7aa290154a | 3 weeks ago |
![]() |
5268c0fc9b | 3 weeks ago |
![]() |
c2bf2598b1 | 3 weeks ago |
![]() |
f489ce381c | 3 weeks ago |
![]() |
dd23410c52 | 3 weeks ago |
![]() |
aa07ba4a48 | 3 weeks ago |
![]() |
40fddb83a7 | 3 weeks ago |
![]() |
a53c366853 | 3 weeks ago |
![]() |
56467e746e | 3 weeks ago |
![]() |
ebfab5792d | 1 month ago |
![]() |
a4483db3af | 1 month ago |
![]() |
e59752a1cb | 2 months ago |
![]() |
c6d0c2452c | 2 months ago |
![]() |
8b00969b4a | 2 months ago |
![]() |
3aee692b1c | 2 months ago |
![]() |
687e963fd4 | 2 months ago |
![]() |
905a1b22cf | 2 months ago |
![]() |
85fe6f55bb | 2 months ago |
![]() |
61d531cedc | 2 months ago |
![]() |
9c0893403d | 2 months ago |
![]() |
36dc03731a | 2 months ago |
![]() |
ef33793758 | 2 months ago |
![]() |
5d972a0077 | 2 months ago |
![]() |
a260178387 | 2 months ago |
![]() |
3ebe29e28f | 2 months ago |
![]() |
5addae556a | 2 months ago |
![]() |
ba46786de7 | 2 months ago |
![]() |
58937c291b | 2 months ago |
![]() |
fbb97bdd73 | 2 months ago |
![]() |
920fada1bc | 2 months ago |
![]() |
276b423051 | 2 months ago |
![]() |
4994a59962 | 2 months ago |
![]() |
852990f2e3 | 3 months ago |
![]() |
6a4a58d4b1 | 3 months ago |
![]() |
513f3bba5a | 3 months ago |
![]() |
aeae94c547 | 3 months ago |
![]() |
2a23a1c9cf | 3 months ago |
![]() |
65dac95ff0 | 3 months ago |
![]() |
b64a17c748 | 3 months ago |
![]() |
7b4561f7cf | 3 months ago |
![]() |
ca0d2f6091 | 3 months ago |
![]() |
ff619cc54b | 3 months ago |
![]() |
595d1091bc | 3 months ago |
![]() |
f457d272b6 | 3 months ago |
![]() |
3cabd7f1a6 | 3 months ago |
![]() |
ff5e1d4947 | 3 months ago |
![]() |
dec8a8adea | 3 months ago |
![]() |
d91fd97210 | 3 months ago |
![]() |
33eea99531 | 3 months ago |
![]() |
83d8cbdd3a | 3 months ago |
![]() |
3586180ae2 | 3 months ago |
![]() |
f5e54dfa77 | 3 months ago |
![]() |
0325fbedc1 | 3 months ago |
![]() |
afa29770cc | 3 months ago |
![]() |
a8428e073d | 3 months ago |
![]() |
331c19228e | 3 months ago |
![]() |
e066033770 | 3 months ago |
![]() |
a02b14892a | 3 months ago |
![]() |
eeb77df89f | 3 months ago |
![]() |
ae1a7de2b8 | 3 months ago |
![]() |
537301f656 | 3 months ago |
![]() |
d9cea69a90 | 3 months ago |
![]() |
ee6d366feb | 3 months ago |
![]() |
ffeded74af | 3 months ago |
|
65dfe9080b | 3 months ago |
![]() |
5af684bed2 | 3 months ago |
![]() |
fe6a4b91f8 | 3 months ago |
![]() |
1560a36dfc | 3 months ago |
![]() |
5fd7b682f4 | 3 months ago |
![]() |
a77eb4020f | 3 months ago |
![]() |
0bb6303c34 | 3 months ago |
![]() |
04e99eb55f | 3 months ago |
![]() |
4f9292b698 | 3 months ago |
![]() |
10b269d24c | 3 months ago |
@ -0,0 +1,46 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
*.pc
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
config.h*
|
||||
config.sub
|
||||
config.log
|
||||
config.status
|
||||
config.guess
|
||||
configure
|
||||
compile
|
||||
depcomp
|
||||
missing
|
||||
ltmain.sh
|
||||
install-sh
|
||||
stamp-h1
|
||||
#libosmo-abis-*
|
||||
tests/*_test
|
||||
*~
|
||||
|
||||
# libtool and e.g. arm-poky-linux-gnueabi-libtool
|
||||
*libtool
|
||||
|
||||
.tarball-version
|
||||
.version
|
||||
.dirstamp
|
||||
|
||||
# tests
|
||||
tests/atconfig
|
||||
tests/package.m4
|
||||
tests/testsuite
|
||||
tests/testsuite.log
|
||||
|
||||
# vi/vim files
|
||||
*.sw?
|
||||
|
||||
src/libg711/libg711.a
|
||||
src/libecho/libecho.a
|
||||
src/osmo-v5-le
|
||||
tests/answer_detect
|
@ -1,11 +0,0 @@
|
||||
LIBS=-lasan -ltalloc -losmocore -losmovty -losmogsm -losmoctrl -losmoabis
|
||||
CFLAGS=-Wall -DPACKAGE_VERSION=\"0.0\"
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $^
|
||||
|
||||
v5le: main.o v5x_data.o lapv5.o
|
||||
$(CC) -o $@ $^ $(LIBS)
|
||||
|
||||
clean:
|
||||
@rm v5le *.o
|
@ -0,0 +1,8 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
AM_CPPFLAGS = $(all_includes)
|
||||
SUBDIRS = src tests
|
||||
|
||||
dist-hook:
|
||||
echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
@ -0,0 +1,116 @@
|
||||
AC_INIT([osmo-v5],
|
||||
m4_esyscmd([./git-version-gen .tarball-version]),
|
||||
[openbsc@lists.osmocom.org])
|
||||
|
||||
dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects])
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
|
||||
CFLAGS="$CFLAGS -std=gnu11"
|
||||
|
||||
dnl kernel style compile messages
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
dnl include release helper
|
||||
RELMAKE='-include osmo-release.mk'
|
||||
AC_SUBST([RELMAKE])
|
||||
|
||||
dnl checks for programs
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
LT_INIT([pic-only])
|
||||
|
||||
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
|
||||
AS_CASE(["$LD"],[*clang*],
|
||||
[AS_CASE(["${host_os}"],
|
||||
[*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
|
||||
|
||||
dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
|
||||
AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
|
||||
if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
|
||||
AC_MSG_WARN([You need to install pkg-config])
|
||||
fi
|
||||
PKG_PROG_PKG_CONFIG([0.20])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
CPPFLAGS="$CPPFLAGS -Wall"
|
||||
|
||||
AC_ARG_ENABLE(sanitize,
|
||||
[AS_HELP_STRING(
|
||||
[--enable-sanitize],
|
||||
[Compile with address sanitizer enabled],
|
||||
)],
|
||||
[sanitize=$enableval], [sanitize="no"])
|
||||
if test x"$sanitize" = x"yes"
|
||||
then
|
||||
CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
|
||||
CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
|
||||
fi
|
||||
|
||||
# The following test is taken from WebKit's webkit.m4
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden "
|
||||
AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
SYMBOL_VISIBILITY="-fvisibility=hidden"],
|
||||
AC_MSG_RESULT([no]))
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
AC_SUBST(SYMBOL_VISIBILITY)
|
||||
|
||||
dnl Generate the output
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.8.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.8.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.8.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.8.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.3.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOISDN, libosmoisdn >= 1.8.0)
|
||||
|
||||
AC_ARG_ENABLE(sanitize,
|
||||
[AS_HELP_STRING(
|
||||
[--enable-sanitize],
|
||||
[Compile with address sanitizer enabled],
|
||||
)],
|
||||
[sanitize=$enableval], [sanitize="no"])
|
||||
if test x"$sanitize" = x"yes"
|
||||
then
|
||||
CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
|
||||
CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(werror,
|
||||
[AS_HELP_STRING(
|
||||
[--enable-werror],
|
||||
[Turn all compiler warnings into errors, with exceptions:
|
||||
a) deprecation (allow upstream to mark deprecation without breaking builds);
|
||||
b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
|
||||
]
|
||||
)],
|
||||
[werror=$enableval], [werror="no"])
|
||||
if test x"$werror" = x"yes"
|
||||
then
|
||||
WERROR_FLAGS="-Werror"
|
||||
WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
|
||||
WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
|
||||
CFLAGS="$CFLAGS $WERROR_FLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
|
||||
fi
|
||||
|
||||
AX_CHECK_X86_FEATURES()
|
||||
|
||||
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
|
||||
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
|
||||
|
||||
AC_OUTPUT(
|
||||
src/libecho/Makefile
|
||||
src/libg711/Makefile
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
Makefile)
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,151 @@
|
||||
#!/bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2010-01-28.01
|
||||
|
||||
# Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
|
||||
# It may be run two ways:
|
||||
# - from a git repository in which the "git describe" command below
|
||||
# produces useful output (thus requiring at least one signed tag)
|
||||
# - from a non-git-repo directory containing a .tarball-version file, which
|
||||
# presumes this script is invoked like "./git-version-gen .tarball-version".
|
||||
|
||||
# In order to use intra-version strings in your project, you will need two
|
||||
# separate generated version string files:
|
||||
#
|
||||
# .tarball-version - present only in a distribution tarball, and not in
|
||||
# a checked-out repository. Created with contents that were learned at
|
||||
# the last time autoconf was run, and used by git-version-gen. Must not
|
||||
# be present in either $(srcdir) or $(builddir) for git-version-gen to
|
||||
# give accurate answers during normal development with a checked out tree,
|
||||
# but must be present in a tarball when there is no version control system.
|
||||
# Therefore, it cannot be used in any dependencies. GNUmakefile has
|
||||
# hooks to force a reconfigure at distribution time to get the value
|
||||
# correct, without penalizing normal development with extra reconfigures.
|
||||
#
|
||||
# .version - present in a checked-out repository and in a distribution
|
||||
# tarball. Usable in dependencies, particularly for files that don't
|
||||
# want to depend on config.h but do want to track version changes.
|
||||
# Delete this file prior to any autoconf run where you want to rebuild
|
||||
# files to pick up a version string change; and leave it stale to
|
||||
# minimize rebuild time after unrelated changes to configure sources.
|
||||
#
|
||||
# It is probably wise to add these two files to .gitignore, so that you
|
||||
# don't accidentally commit either generated file.
|
||||
#
|
||||
# Use the following line in your configure.ac, so that $(VERSION) will
|
||||
# automatically be up-to-date each time configure is run (and note that
|
||||
# since configure.ac no longer includes a version string, Makefile rules
|
||||
# should not depend on configure.ac for version updates).
|
||||
#
|
||||
# AC_INIT([GNU project],
|
||||
# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
# [bug-project@example])
|
||||
#
|
||||
# Then use the following lines in your Makefile.am, so that .version
|
||||
# will be present for dependencies, and so that .tarball-version will
|
||||
# exist in distribution tarballs.
|
||||
#
|
||||
# BUILT_SOURCES = $(top_srcdir)/.version
|
||||
# $(top_srcdir)/.version:
|
||||
# echo $(VERSION) > $@-t && mv $@-t $@
|
||||
# dist-hook:
|
||||
# echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
case $# in
|
||||
1) ;;
|
||||
*) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;;
|
||||
esac
|
||||
|
||||
tarball_version_file=$1
|
||||
nl='
|
||||
'
|
||||
|
||||
# First see if there is a tarball-only version file.
|
||||
# then try "git describe", then default.
|
||||
if test -f $tarball_version_file
|
||||
then
|
||||
v=`cat $tarball_version_file` || exit 1
|
||||
case $v in
|
||||
*$nl*) v= ;; # reject multi-line output
|
||||
[0-9]*) ;;
|
||||
*) v= ;;
|
||||
esac
|
||||
test -z "$v" \
|
||||
&& echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
|
||||
fi
|
||||
|
||||
if test -n "$v"
|
||||
then
|
||||
: # use $v
|
||||
elif
|
||||
v=`git describe --abbrev=4 HEAD 2>/dev/null \
|
||||
|| git describe --abbrev=4 --match='v*' HEAD 2>/dev/null` \
|
||||
&& case $v in
|
||||
[0-9]*) ;;
|
||||
v[0-9]*) ;;
|
||||
*) (exit 1) ;;
|
||||
esac
|
||||
then
|
||||
# Is this a new git that lists number of commits since the last
|
||||
# tag or the previous older version that did not?
|
||||
# Newer: v6.10-77-g0f8faeb
|
||||
# Older: v6.10-g0f8faeb
|
||||
case $v in
|
||||
*-*-*) : git describe is okay three part flavor ;;
|
||||
*-*)
|
||||
: git describe is older two part flavor
|
||||
# Recreate the number of commits and rewrite such that the
|
||||
# result is the same as if we were using the newer version
|
||||
# of git describe.
|
||||
vtag=`echo "$v" | sed 's/-.*//'`
|
||||
numcommits=`git rev-list "$vtag"..HEAD | wc -l`
|
||||
v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
|
||||
;;
|
||||
esac
|
||||
|
||||
# Change the first '-' to a '.', so version-comparing tools work properly.
|
||||
# Remove the "g" in git describe's output string, to save a byte.
|
||||
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
|
||||
else
|
||||
v=UNKNOWN
|
||||
fi
|
||||
|
||||
v=`echo "$v" |sed 's/^v//'`
|
||||
|
||||
# Don't declare a version "dirty" merely because a time stamp has changed.
|
||||
git status > /dev/null 2>&1
|
||||
|
||||
dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
|
||||
case "$dirty" in
|
||||
'') ;;
|
||||
*) # Append the suffix only if there isn't one already.
|
||||
case $v in
|
||||
*-dirty) ;;
|
||||
*) v="$v-dirty" ;;
|
||||
esac ;;
|
||||
esac
|
||||
|
||||
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
|
||||
echo "$v" | tr -d '\012'
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <osmocom/abis/lapd.h>
|
||||
|
||||
struct lapv5_instance {
|
||||
struct llist_head list; /* list of LAPV5 instances */
|
||||
bool network_side;
|
||||
|
||||
void (*transmit_cb)(struct msgb *msg, void *cbdata);
|
||||
void *transmit_cbdata;
|
||||
void (*receive_cb)(struct osmo_dlsap_prim *odp, uint16_t dladdr, void *rx_cbdata);
|
||||
void *receive_cbdata;
|
||||
|
||||
struct lapd_profile profile; /* must be a copy */
|
||||
|
||||
struct llist_head sap_list; /* list of SAP/datalinks in this instance */
|
||||
int pcap_fd; /* PCAP file descriptor */
|
||||
char *name; /* human-readable name */
|
||||
};
|
||||
|
||||
int lapv5ef_rx(struct v5x_link *link, struct msgb *msg);
|
@ -0,0 +1,13 @@
|
||||
AC_DEFUN([AX_CHECK_X86_FEATURES],
|
||||
[m4_foreach_w(
|
||||
[ax_x86_feature],
|
||||
[mmx popcnt sse sse2 sse3 sse4.1 sse4.2 sse4a avx avx2 avx512f fma fma4 bmi bmi2],
|
||||
[AX_GCC_X86_CPU_SUPPORTS(ax_x86_feature,
|
||||
[X86_FEATURE_CFLAGS="$X86_FEATURE_CFLAGS -m[]ax_x86_feature"],
|
||||
[])
|
||||
])
|
||||
AC_SUBST([X86_FEATURE_CFLAGS])
|
||||
m4_ifval([$1],[$1],
|
||||
[CFLAGS="$CFLAGS $X86_FEATURE_CFLAGS"])
|
||||
$2
|
||||
])
|
@ -0,0 +1,44 @@
|
||||
AC_DEFUN_ONCE([_AX_GCC_X86_CPU_INIT],
|
||||
[AC_LANG_PUSH([C])
|
||||
AC_CACHE_CHECK([for gcc __builtin_cpu_init function],
|
||||
[ax_cv_gcc_check_x86_cpu_init],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <stdlib.h>],
|
||||
[__builtin_cpu_init ();])
|
||||
],
|
||||
[ax_cv_gcc_check_x86_cpu_init=yes],
|
||||
[ax_cv_gcc_check_x86_cpu_init=no])])
|
||||
AC_LANG_POP([C])
|
||||
AS_IF([test "X$ax_cv_gcc_check_x86_cpu_init" = "Xno"],
|
||||
[AC_MSG_ERROR([Need GCC to support X86 CPU features tests])])
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_GCC_X86_CPU_SUPPORTS],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([_AX_GCC_X86_CPU_INIT])
|
||||
AC_LANG_PUSH([C])
|
||||
AS_VAR_PUSHDEF([gcc_x86_feature], [AS_TR_SH([ax_cv_gcc_x86_cpu_supports_$1])])
|
||||
AC_CACHE_CHECK([for x86 $1 instruction support],
|
||||
[gcc_x86_feature],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM( [#include <stdlib.h> ],
|
||||
[ __builtin_cpu_init ();
|
||||
if (__builtin_cpu_supports("$1"))
|
||||
return 0;
|
||||
return 1;
|
||||
])],
|
||||
[gcc_x86_feature=yes],
|
||||
[gcc_x86_feature=no]
|
||||
)]
|
||||
)
|
||||
AC_LANG_POP([C])
|
||||
AS_VAR_IF([gcc_x86_feature],[yes],
|
||||
[AC_DEFINE(
|
||||
AS_TR_CPP([HAVE_$1_INSTRUCTIONS]),
|
||||
[1],
|
||||
[Define if $1 instructions are supported])
|
||||
$2],
|
||||
[$3]
|
||||
)
|
||||
AS_VAR_POPDEF([gcc_x86_feature])
|
||||
])
|
@ -1,12 +0,0 @@
|
||||
e1_input
|
||||
e1_line 0 driver dahdi
|
||||
e1_line 0 port 7
|
||||
|
||||
log stderr
|
||||
logging filter all 1
|
||||
logging color 1
|
||||
logging print category-hex 0
|
||||
logging print category 1
|
||||
logging print file 1
|
||||
logging level llapd debug
|
||||
logging level linp debug
|
@ -0,0 +1,31 @@
|
||||
AM_CPPFLAGS = $(all_includes)
|
||||
AM_CFLAGS= -Wall -Wextra -g $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBOSMOCTRL_CFLAGS)
|
||||
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
|
||||
COMMONLIBS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS)
|
||||
|
||||
SUBDIRS = libecho libg711
|
||||
|
||||
bin_PROGRAMS = osmo-v5-le
|
||||
|
||||
osmo_v5_le_SOURCES = logging.c \
|
||||
ph_socket.c \
|
||||
v5x_data.c \
|
||||
v5le_vty.c \
|
||||
lapv5.c \
|
||||
layer1.c \
|
||||
v5x_protocol.c \
|
||||
v5x_l1_fsm.c \
|
||||
v5x_le_ctrl_fsm.c \
|
||||
v5x_le_port_fsm.c \
|
||||
v5x_le_pstn_fsm.c \
|
||||
v52_le_lcp_fsm.c \
|
||||
v52_le_bcc_fsm.c \
|
||||
v52_le_pp_fsm.c \
|
||||
v5x_le_management.c \
|
||||
main.c
|
||||
|
||||
osmo_v5_le_LDADD = $(COMMON_LA) \
|
||||
$(COMMONLIBS) \
|
||||
libecho/libecho.a \
|
||||
libg711/libg711.a \
|
||||
-lm
|
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <osmocom/abis/lapd.h>
|
||||
|
||||
struct lapv5_instance {
|
||||
struct llist_head list; /* list of LAPV5 instances */
|
||||
bool network_side;
|
||||
|
||||
int (*ph_data_req_cb)(struct msgb *msg, void *cbdata);
|
||||
void *ph_data_req_cbdata;
|
||||
int (*dl_receive_cb)(struct osmo_dlsap_prim *odp, uint16_t dladdr, void *rx_cbdata);
|
||||
void *dl_receive_cbdata;
|
||||
|
||||
struct lapd_profile profile; /* must be a copy */
|
||||
|
||||
struct llist_head sap_list; /* list of SAP/datalinks in this instance */
|
||||
int pcap_fd; /* PCAP file descriptor */
|
||||
char *name; /* human-readable name */
|
||||
|
||||
bool enabled; /* only receive messages when enabled */
|
||||
};
|
||||
|
||||
extern const struct lapd_profile lapd_profile_lapv5dl;
|
||||
|
||||
int lapv5ef_rx(struct v5x_link *link, struct msgb *msg);
|
||||
|
||||
int lapv5_dl_est_req(struct lapv5_instance *li, uint16_t dladdr);
|
||||
int lapv5_dl_rel_req(struct lapv5_instance *li, uint16_t dladdr);
|
||||
int lapv5_dl_data_req(struct lapv5_instance *li, uint16_t dladdr, struct msgb *msg);
|
||||
|
||||
int lapv5_ph_data_ind(struct lapv5_instance *li, struct msgb *msg, int *error);
|
||||
|
||||
struct lapv5_instance *lapv5_instance_alloc(int network_side,
|
||||
int (*ph_data_req_cb)(struct msgb *msg, void *cbdata), void *ph_data_req_cbdata,
|
||||
int (*dl_receive_cb)(struct osmo_dlsap_prim *odp, uint16_t dladdr, void *rx_cbdata), void *dl_receive_cbdata,
|
||||
const struct lapd_profile *profile, const char *name);
|
||||
void lapv5_instance_set_profile(struct lapv5_instance *li, const struct lapd_profile *profile);
|
||||
void lapv5_instance_free(struct lapv5_instance *li);
|
||||
|
||||
int lapv5ef_rx(struct v5x_link *link, struct msgb *msg);
|
||||
int lapv5ef_tx(struct v5x_user_port *v5up, struct msgb *msg);
|
||||
|
||||
void lapv5_set_enabled(struct lapv5_instance *li, bool enabled);
|
@ -0,0 +1,537 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <osmocom/core/gsmtap.h>
|
||||
#include <osmocom/core/gsmtap_util.h>
|
||||
#include <osmocom/core/signal.h>
|
||||
|
||||
#include "v5x_internal.h"
|
||||
#include "v5x_protocol.h"
|
||||
#include "lapv5.h"
|
||||
#include "layer1.h"
|
||||
#include "v5x_l1_fsm.h"
|
||||
#include "v5x_le_management.h"
|
||||
#include "logging.h"
|
||||
#include "libg711/g711.h"
|
||||
|
||||
extern int ulaw;
|
||||
extern int test_sa7;
|
||||
extern const char *gsmtap_ip;
|
||||
|
||||
extern struct v5x_instance *v5i;
|
||||
|
||||
static struct gsmtap_inst *g_gti = NULL;
|
||||
|
||||
/* only temporarily until this is in libosmocore gsmtap.h */
|
||||
#ifndef GSMTAP_E1T1_V5EF
|
||||
#define GSMTAP_E1T1_V5EF 0x06
|
||||
#endif
|
||||
|
||||
/* Callback function to receive L1 signal from E1 port */
|
||||
static int inp_sig_cb(unsigned int subsys, unsigned int signal, void __attribute__((unused)) *handler_data,
|
||||
void *signal_data)
|
||||
{
|
||||
struct input_signal_data *isd = signal_data;
|
||||
struct v5x_link *v5l;
|
||||
|
||||
if (subsys != SS_L_INPUT)
|
||||
return 0;
|
||||
|
||||
/* not used by any link */
|
||||
if (!isd->line->ops)
|
||||
return 0;
|
||||
v5l = container_of(isd->line->ops, struct v5x_link, e1_line_ops);
|
||||
|
||||
switch (signal) {
|
||||
case S_L_INP_LINE_LOS:
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_LOS);
|
||||
break;
|
||||
case S_L_INP_LINE_NOLOS:
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_NO_LOS);
|
||||
break;
|
||||
case S_L_INP_LINE_RAI:
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_RAI);
|
||||
break;
|
||||
case S_L_INP_LINE_NORAI:
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_NO_RAI);
|
||||
break;
|
||||
case S_L_INP_LINE_AIS:
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_AIS);
|
||||
break;
|
||||
case S_L_INP_LINE_NOAIS:
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_NO_AIS);
|
||||
break;
|
||||
case S_L_INP_LINE_SA_BITS:
|
||||
if ((isd->sa_bits & 0x40)) {
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_SA7_1);
|
||||
if (test_sa7) {
|
||||
printf("Currently Sa 7 is set to 1, changing it to 0. (Link ID %d)\n", v5l->id);
|
||||
v5x_l1_signal_snd(v5l, L1_SIGNAL_SA7_0);
|
||||
}
|
||||
} else {
|
||||
v5x_l1_signal_rcv(v5l, L1_SIGNAL_SA7_0);
|
||||
if (test_sa7) {
|
||||
printf("Currently Sa 7 is set to 0, changing it to 1. (Link ID %d)\n", v5l->id);
|
||||
v5x_l1_signal_snd(v5l, L1_SIGNAL_SA7_1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case S_L_INP_LINE_SLIP_RX:
|
||||
printf("RX slip detected on link %d.\n", v5l->id);
|
||||
break;
|
||||
case S_L_INP_LINE_SLIP_TX:
|
||||
printf("TX slip detected on link %d.\n", v5l->id);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send L1 signal to E1 port */
|
||||
int v5x_l1_signal_snd(struct v5x_link *v5l, enum l1_signal_prim prim)
|
||||
{
|
||||
struct e1inp_line *e1_line = v5l->e1_line;
|
||||
|
||||
/* no line assigned */
|
||||
if (!e1_line)
|
||||
return 0;
|
||||
|
||||
switch (prim) {
|
||||
case L1_SIGNAL_SA7_0:
|
||||
e1inp_ts_set_sa_bits(e1_line, 0xbf);
|
||||
break;
|
||||
case L1_SIGNAL_SA7_1:
|
||||
e1inp_ts_set_sa_bits(e1_line, 0xff);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* store TX to buffer */
|
||||
static void echo_tx(struct v5x_echo_proc *ep, uint8_t *data, int len)
|
||||
{
|
||||
int in;
|
||||
int16_t tx;
|
||||
|
||||
if (!ep->enabled)
|
||||
return;
|
||||
|
||||
while (len--) {
|
||||
if (ulaw)
|
||||
tx = g711_ulaw_flipped_to_linear[*data++];
|
||||
else
|
||||
tx = g711_alaw_flipped_to_linear[*data++];
|
||||
ep->tx_buffer[ep->tx_buffer_in] = tx;
|
||||
in = (ep->tx_buffer_in + 1) % EC_BUFFER;
|
||||
/* buffer overflow condition, should not happen, if application syncs to RX */
|
||||
if (in == ep->tx_buffer_out)
|
||||
break;
|
||||
ep->tx_buffer_in = in;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove echo from RX using TX from buffer */
|
||||
static void echo_rx(struct v5x_echo_proc *ep, uint8_t *data, int len)
|
||||
{
|
||||
struct v5x_user_port *v5up = ep->port;
|
||||
int16_t tx, rx, rx_can;
|
||||
int16_t answer_buffer[len];
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
if (!ep->enabled)
|
||||
return;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
/* buffer underrun condition, may happen before buffer was filled with first frame */
|
||||
if (ep->tx_buffer_out == ep->tx_buffer_in)
|
||||
tx = 0;
|
||||
else {
|
||||
tx = ep->tx_buffer[ep->tx_buffer_out];
|
||||
ep->tx_buffer_out = (ep->tx_buffer_out + 1) % EC_BUFFER;
|
||||
}
|
||||
if (ulaw) {
|
||||
rx = g711_ulaw_flipped_to_linear[*data];
|
||||
if (ep->port->use_line_echo == USE_ECHO_CANCELER)
|
||||
rx_can = echo_can_update(ep->ec, tx, rx);
|
||||
else
|
||||
rx_can = echo_sup_update(ep->es, tx, rx);
|
||||
*data++ = g711_linear_to_ulaw_flipped[(uint16_t)rx_can];
|
||||
} else {
|
||||
rx = g711_alaw_flipped_to_linear[*data];
|
||||
if (ep->port->use_line_echo == USE_ECHO_CANCELER)
|
||||
rx_can = echo_can_update(ep->ec, tx, rx);
|
||||
else
|
||||
rx_can = echo_sup_update(ep->es, tx, rx);
|
||||
*data++ = g711_linear_to_alaw_flipped[(uint16_t)rx_can];
|
||||
}
|
||||
answer_buffer[i] = rx + tx; /* yes, may overflow, but then it is no valid tone anyway */
|
||||
}
|
||||
|
||||
rc = answertone_process(&ep->at, answer_buffer, len, (ep->port->use_line_echo == USE_ECHO_CANCELER));
|
||||
if (rc > 0) {
|
||||
LOGP(DV5, LOGL_NOTICE, "Detected answer tone, disable echo %s of %s port %d.\n",
|
||||
(ep->port->use_line_echo == USE_ECHO_CANCELER) ? "canceler" : "suppressor",
|
||||
(v5up->type == V5X_USER_TYPE_PSTN) ? "PSTN" : "ISDN", v5up->nr);
|
||||
ep->enabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* data L1 -> L2 from E1 interface */
|
||||
static void hdlc_rx_cb(struct e1inp_ts *ts, struct msgb *msg)
|
||||
{
|
||||
struct v5x_link *v5l;
|
||||
|
||||
/* not used by any link */
|
||||
if (!ts->line->ops) {
|
||||
msgb_free(msg);
|
||||
return;
|
||||
}
|
||||
v5l = container_of(ts->line->ops, struct v5x_link, e1_line_ops);
|
||||
|
||||
LOGP(DLINP, LOGL_DEBUG, "Link %d L1->L2: %s\n", v5l->id, msgb_hexdump(msg));
|
||||
|
||||
/* send V5 data via gsmtap so wireshark can receive + decode it */
|
||||
if (g_gti) {
|
||||
gsmtap_send_ex(g_gti, GSMTAP_TYPE_E1T1, v5l->id, ts->num, GSMTAP_E1T1_V5EF,
|
||||
0, 0, 0, 0, msgb_data(msg), msgb_length(msg));
|
||||
}
|
||||
|
||||
lapv5ef_rx(v5l, msg);
|
||||
}
|
||||
|
||||
/* data B-channel data from E1 interface */
|
||||
static void raw_rx_cb(struct e1inp_ts *ts, struct msgb *msg)
|
||||
{
|
||||
struct v5x_link *v5l;
|
||||
struct v5x_user_port *v5up;
|
||||
|
||||
/* not used by any link */
|
||||
if (!ts->line->ops) {
|
||||
msgb_free(msg);
|
||||
return;
|
||||
}
|
||||
v5l = container_of(ts->line->ops, struct v5x_link, e1_line_ops);
|
||||
v5up = v5l->ts[ts->num].v5up;
|
||||
|
||||
/* not used by any user port */
|
||||
if (!v5up) {
|
||||
msgb_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
/* we want B-channel data flipped */
|
||||
osmo_revbytebits_buf(msg->data, msg->len);
|
||||
|
||||
/* if assigned and active, send B-channel data to socket interface */
|
||||
if (v5up->ts[0] && v5up->ts[0]->nr == ts->num && v5up->ts[0]->b_activated) {
|
||||
echo_rx(&v5up->ep[0], msg->data, msg->len);
|
||||
ph_socket_tx_msg(&v5up->ph_socket, 1, PH_PRIM_DATA_IND, msg->data, msg->len);
|
||||
}
|
||||
if (v5up->ts[1] && v5up->ts[1]->nr == ts->num && v5up->ts[1]->b_activated) {
|
||||
echo_rx(&v5up->ep[1], msg->data, msg->len);
|
||||
ph_socket_tx_msg(&v5up->ph_socket, 2, PH_PRIM_DATA_IND, msg->data, msg->len);
|
||||
}
|
||||
msgb_free(msg);
|
||||
}
|
||||
|
||||
/* send HDLC frame to signaling channel (from ISDN) */
|
||||
int ph_data_req_hdlc(struct msgb *msg, struct v5x_interface *v5if)
|
||||
{
|
||||
struct e1inp_line *e1_line = v5if->cc_link->e1_line;
|
||||
|
||||
if (!e1_line) {
|
||||
msgb_free(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!v5x_l1_is_up(v5if->cc_link->l1)) {
|
||||
LOGP(DLINP, LOGL_DEBUG, "Link %d is down!\n", v5if->cc_link->id);
|
||||
msgb_free(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOGP(DLINP, LOGL_DEBUG, "Link %d L2->L1: %s\n", v5if->cc_link->id, msgb_hexdump(msg));
|
||||
|
||||
struct e1inp_ts *ts = &e1_line->ts[v5if->cc_link->c_channel[0].ts->nr - 1];
|
||||
|
||||
/* send V5 data via gsmtap so wireshark can receive + decode it */
|
||||
if (g_gti) {
|
||||
gsmtap_send_ex(g_gti, GSMTAP_TYPE_E1T1, v5if->cc_link->id | GSMTAP_ARFCN_F_UPLINK, ts->num,
|
||||
GSMTAP_E1T1_V5EF, 0, 0, 0, 0, msgb_data(msg), msgb_length(msg));
|
||||
}
|
||||
|
||||
return e1inp_ts_send_hdlc(ts, msg);
|
||||
}
|
||||
|
||||
/* send HDLC frame to signaling channel (from DL) */
|
||||
int ph_data_req_dl_cc(struct msgb *msg, void *cbdata)
|
||||
{
|
||||
struct v5x_interface *v5if = (struct v5x_interface *)cbdata;
|
||||
struct e1inp_line *e1_line = v5if->cc_link->e1_line;
|
||||
|
||||
if (!e1_line) {
|
||||
msgb_free(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!v5x_l1_is_up(v5if->cc_link->l1)) {
|
||||
LOGP(DLINP, LOGL_DEBUG, "Link %d is down!\n", v5if->cc_link->id);
|
||||
msgb_free(msg);
|
||||
return 0;
|
||||