├── .gitignore ├── .gitreview ├── .mailmap ├── README.md ├── contrib └── jenkins.sh ├── debian ├── autoreconf ├── changelog ├── compat ├── control ├── copyright ├── docs ├── osmo-bsc-mgcp.install ├── osmocom-bs11-utils.install ├── osmocom-bsc-nat.init ├── osmocom-bsc-nat.install ├── osmocom-bsc-sccplite.examples ├── osmocom-bsc-sccplite.install ├── osmocom-nitb.default ├── osmocom-nitb.dirs ├── osmocom-nitb.examples ├── osmocom-nitb.init ├── osmocom-nitb.install ├── rules └── source │ └── format ├── manuals ├── .gitignore ├── OsmoBSCMGCP │ ├── Makefile │ ├── osmo-bsc-mgcp-vty-reference.xml │ └── vty │ │ ├── mgcp_vty_additions.xml │ │ └── mgcp_vty_reference.xml ├── OsmoBSCNAT │ ├── Makefile │ ├── chapters │ │ └── counters_generated.adoc │ ├── osmo-bsc-nat-vty-reference.xml │ └── vty │ │ ├── nat_vty_additions.xml │ │ └── nat_vty_reference.xml ├── OsmoNITB │ ├── Makefile │ ├── chapters │ │ ├── bsc.adoc │ │ ├── bts-examples.adoc │ │ ├── bts.adoc │ │ ├── control.adoc │ │ ├── counters.adoc │ │ ├── counters_generated.adoc │ │ ├── hlr.adoc │ │ ├── net.adoc │ │ ├── overview.adoc │ │ └── running.adoc │ ├── osmonitb-usermanual-docinfo.xml │ ├── osmonitb-usermanual.adoc │ ├── osmonitb-vty-reference.xml │ └── vty │ │ ├── bsc_vty_additions.xml │ │ ├── nitb_vty_additions.xml │ │ └── nitb_vty_reference.xml └── osmo-gsm-manuals-dir.sh └── openbsc ├── .gitignore ├── AUTHORS ├── COPYING ├── Makefile.am ├── README ├── README.vty-tests ├── configure.ac ├── contrib ├── Makefile.am ├── a-link │ └── sccp-split-by-con.lua ├── bsc-test │ ├── README │ ├── all_dial │ ├── dial.sh │ ├── drop-oml.sh │ ├── drop.sh │ ├── hangup │ └── msc.sh ├── bsc_control.py ├── bt.py ├── convert_to_enum.py ├── ctrl2sse.py ├── hlr-remove-old.sql ├── hlrsync │ └── hlrsync.py ├── ipa.py ├── mgcp_server.py ├── nat │ ├── test_regexp.c │ └── ussd_example.py ├── rtp │ ├── gen_rtp_header.erl │ ├── rtp_replay.st │ ├── rtp_replay_shared.st │ ├── rtp_replay_sip.st │ └── timestamp_rtp.lua ├── sms │ ├── fill-hlr.st │ ├── hlr-query.st │ └── sqlite-probe.tap.d ├── soap.py ├── systemd │ ├── Makefile.am │ ├── osmo-bsc-mgcp.service │ ├── osmo-bsc-nat.service │ ├── osmo-bsc-sccplite.service │ └── osmo-nitb.service ├── testconv │ ├── Makefile │ └── testconv_main.c └── twisted_ipa.py ├── doc ├── BS11-OML.txt ├── Makefile.am ├── call-routing.txt ├── channel_release.txt ├── e1-data-model.txt ├── examples │ ├── Makefile.am │ ├── osmo-bsc-sccplite │ │ └── osmo-bsc-sccplite.cfg │ ├── osmo-bsc_mgcp │ │ └── osmo-bsc-mgcp.cfg │ ├── osmo-bsc_nat │ │ ├── black-list.cfg │ │ ├── bscs.config │ │ └── osmo-bsc-nat.cfg │ └── osmo-nitb │ │ ├── bs11 │ │ ├── openbsc-1bts-2trx-hopping.cfg │ │ ├── openbsc-1bts-2trx.cfg │ │ ├── openbsc-2bts-2trx.cfg │ │ └── osmo-nitb.cfg │ │ ├── nanobts │ │ ├── openbsc-multitrx.cfg │ │ └── osmo-nitb.cfg │ │ ├── nokia │ │ └── openbsc_nokia_3trx.cfg │ │ ├── rbs2308 │ │ └── osmo-nitb.cfg │ │ └── sysmobts │ │ └── osmo-nitb.cfg ├── gsm-hopping.txt ├── handover.txt ├── ipa-sccp.txt ├── oml-interface.txt ├── osmo-nitb-data_structures.dot ├── paging.txt └── regen_doc.sh ├── git-version-gen ├── include ├── Makefile.am ├── compat_af_isdn.h ├── mISDNif.h └── openbsc │ ├── Makefile.am │ ├── abis_nm.h │ ├── abis_om2000.h │ ├── abis_rsl.h │ ├── acc_ramp.h │ ├── arfcn_range_encode.h │ ├── auth.h │ ├── bsc_api.h │ ├── bsc_msc.h │ ├── bsc_msc_data.h │ ├── bsc_msg_filter.h │ ├── bsc_nat.h │ ├── bsc_nat_callstats.h │ ├── bsc_nat_sccp.h │ ├── bsc_rll.h │ ├── bsc_subscriber.h │ ├── bss.h │ ├── bts_ipaccess_nanobts_omlattr.h │ ├── chan_alloc.h │ ├── common_bsc.h │ ├── common_cs.h │ ├── ctrl.h │ ├── db.h │ ├── debug.h │ ├── e1_config.h │ ├── gsm_04_08.h │ ├── gsm_04_11.h │ ├── gsm_04_14.h │ ├── gsm_04_80.h │ ├── gsm_data.h │ ├── gsm_data_shared.h │ ├── gsm_subscriber.h │ ├── gsup_client.h │ ├── handover.h │ ├── handover_decision.h │ ├── ipaccess.h │ ├── meas_feed.h │ ├── meas_rep.h │ ├── mgcp.h │ ├── mgcp_internal.h │ ├── mgcp_transcode.h │ ├── misdn.h │ ├── mncc.h │ ├── mncc_int.h │ ├── nat_rewrite_trie.h │ ├── network_listen.h │ ├── oap_client.h │ ├── openbscdefines.h │ ├── osmo_bsc.h │ ├── osmo_bsc_grace.h │ ├── osmo_bsc_rf.h │ ├── osmo_msc.h │ ├── osmux.h │ ├── paging.h │ ├── pcu_if.h │ ├── pcuif_proto.h │ ├── rest_octets.h │ ├── rrlp.h │ ├── rs232.h │ ├── rtp_proxy.h │ ├── signal.h │ ├── silent_call.h │ ├── smpp.h │ ├── sms_queue.h │ ├── socket.h │ ├── system_information.h │ ├── token_auth.h │ ├── transaction.h │ ├── trau_mux.h │ ├── trau_upqueue.h │ ├── ussd.h │ └── vty.h ├── m4 ├── README └── ax_check_compile_flag.m4 ├── osmoappdesc.py ├── src ├── Makefile.am ├── libbsc │ ├── Makefile.am │ ├── abis_nm.c │ ├── abis_nm_ipaccess.c │ ├── abis_nm_vty.c │ ├── abis_om2000.c │ ├── abis_om2000_vty.c │ ├── abis_rsl.c │ ├── acc_ramp.c │ ├── arfcn_range_encode.c │ ├── bsc_api.c │ ├── bsc_ctrl_commands.c │ ├── bsc_ctrl_lookup.c │ ├── bsc_dyn_ts.c │ ├── bsc_init.c │ ├── bsc_msc.c │ ├── bsc_rf_ctrl.c │ ├── bsc_rll.c │ ├── bsc_subscriber.c │ ├── bsc_vty.c │ ├── bts_ericsson_rbs2000.c │ ├── bts_init.c │ ├── bts_ipaccess_nanobts.c │ ├── bts_ipaccess_nanobts_omlattr.c │ ├── bts_nokia_site.c │ ├── bts_siemens_bs11.c │ ├── bts_sysmobts.c │ ├── bts_unknown.c │ ├── chan_alloc.c │ ├── e1_config.c │ ├── gsm_04_08_utils.c │ ├── gsm_04_80_utils.c │ ├── handover_decision.c │ ├── handover_logic.c │ ├── meas_proc.c │ ├── meas_rep.c │ ├── net_init.c │ ├── paging.c │ ├── pcu_sock.c │ ├── rest_octets.c │ └── system_information.c ├── libcommon-cs │ ├── Makefile.am │ ├── common_cs.c │ └── common_cs_vty.c ├── libcommon │ ├── Makefile.am │ ├── bsc_version.c │ ├── common_vty.c │ ├── debug.c │ ├── gsm_data.c │ ├── gsm_data_shared.c │ ├── gsm_subscriber_base.c │ ├── gsup_client.c │ ├── gsup_test_client.c │ ├── oap_client.c │ ├── socket.c │ └── talloc_ctx.c ├── libfilter │ ├── Makefile.am │ ├── bsc_msg_acc.c │ ├── bsc_msg_filter.c │ └── bsc_msg_vty.c ├── libmgcp │ ├── Makefile.am │ ├── g711common.h │ ├── mgcp_network.c │ ├── mgcp_osmux.c │ ├── mgcp_protocol.c │ ├── mgcp_sdp.c │ ├── mgcp_transcode.c │ └── mgcp_vty.c ├── libmsc │ ├── Makefile.am │ ├── auth.c │ ├── ctrl_commands.c │ ├── db.c │ ├── gsm_04_08.c │ ├── gsm_04_11.c │ ├── gsm_04_14.c │ ├── gsm_04_80.c │ ├── gsm_subscriber.c │ ├── meas_feed.c │ ├── meas_feed.h │ ├── mncc.c │ ├── mncc_builtin.c │ ├── mncc_sock.c │ ├── osmo_msc.c │ ├── rrlp.c │ ├── silent_call.c │ ├── smpp_openbsc.c │ ├── smpp_smsc.c │ ├── smpp_smsc.h │ ├── smpp_utils.c │ ├── smpp_vty.c │ ├── sms_queue.c │ ├── token_auth.c │ ├── transaction.c │ ├── ussd.c │ └── vty_interface_layer3.c ├── libtrau │ ├── Makefile.am │ ├── rtp_proxy.c │ ├── trau_mux.c │ └── trau_upqueue.c ├── osmo-bsc │ ├── Makefile.am │ ├── osmo_bsc_api.c │ ├── osmo_bsc_audio.c │ ├── osmo_bsc_bssap.c │ ├── osmo_bsc_ctrl.c │ ├── osmo_bsc_filter.c │ ├── osmo_bsc_grace.c │ ├── osmo_bsc_main.c │ ├── osmo_bsc_msc.c │ ├── osmo_bsc_sccp.c │ └── osmo_bsc_vty.c ├── osmo-bsc_mgcp │ ├── Makefile.am │ └── mgcp_main.c ├── osmo-bsc_nat │ ├── Makefile.am │ ├── bsc_filter.c │ ├── bsc_mgcp_utils.c │ ├── bsc_nat.c │ ├── bsc_nat_ctrl.c │ ├── bsc_nat_filter.c │ ├── bsc_nat_rewrite.c │ ├── bsc_nat_rewrite_trie.c │ ├── bsc_nat_utils.c │ ├── bsc_nat_vty.c │ ├── bsc_sccp.c │ └── bsc_ussd.c ├── osmo-nitb │ ├── Makefile.am │ └── bsc_hack.c └── utils │ ├── Makefile.am │ ├── bs11_config.c │ ├── isdnsync.c │ └── smpp_mirror.c ├── tests ├── Makefile.am ├── abis │ ├── Makefile.am │ ├── abis_test.c │ └── abis_test.ok ├── atlocal.in ├── bsc-nat-trie │ ├── Makefile.am │ ├── bsc_nat_trie_test.c │ ├── bsc_nat_trie_test.ok │ └── prefixes.csv ├── bsc-nat │ ├── Makefile.am │ ├── barr.cfg │ ├── barr_dup.cfg │ ├── bsc_data.c │ ├── bsc_nat_test.c │ ├── bsc_nat_test.ok │ └── prefixes.csv ├── bsc │ ├── Makefile.am │ ├── bsc_test.c │ └── bsc_test.ok ├── channel │ ├── Makefile.am │ ├── channel_test.c │ └── channel_test.ok ├── ctrl_test_runner.py ├── db │ ├── Makefile.am │ ├── db_test.c │ ├── db_test.err │ ├── db_test.ok │ └── hlr.sqlite3 ├── gsm0408 │ ├── Makefile.am │ ├── gsm0408_test.c │ └── gsm0408_test.ok ├── mgcp │ ├── Makefile.am │ ├── mgcp_test.c │ ├── mgcp_test.ok │ ├── mgcp_transcoding_test.c │ └── mgcp_transcoding_test.ok ├── mm_auth │ ├── Makefile.am │ ├── mm_auth_test.c │ └── mm_auth_test.ok ├── nanobts_omlattr │ ├── Makefile.am │ ├── nanobts_omlattr_test.c │ └── nanobts_omlattr_test.ok ├── osmo-bsc-nat.cfg ├── smpp │ ├── Makefile.am │ ├── smpp_test.c │ ├── smpp_test.err │ └── smpp_test.ok ├── smpp_test_runner.py ├── subscr │ ├── Makefile.am │ ├── bsc_subscr_test.c │ ├── bsc_subscr_test.err │ ├── bsc_subscr_test.ok │ ├── subscr_test.c │ └── subscr_test.ok ├── testsuite.at ├── trau │ ├── Makefile.am │ ├── trau_test.c │ └── trau_test.ok └── vty_test_runner.py └── tools └── hlrstat.pl /.gitignore: -------------------------------------------------------------------------------- 1 | debian/*.log 2 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=gerrit.osmocom.org 3 | project=openbsc 4 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Harald Welte 2 | Harald Welte 3 | Harald Welte 4 | Holger Hans Peter Freyther 5 | Holger Hans Peter Freyther 6 | Holger Hans Peter Freyther 7 | Andreas Eversberg 8 | Andreas Eversberg 9 | Andreas Eversberg 10 | Pablo Neira Ayuso 11 | Max Suraev 12 | Tom Tsou 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | openbsc.git 2 | =========== 3 | 4 | This is a HISTORICAL,OBSOLETE repository containing the code-base 5 | of what used to be known as bs11_hack, later OpenBSC and also OsmoNITB. 6 | 7 | Those projects have been superseded by OsmoBSC, OsmoMSC and OsmoHLR 8 | (collectively known as Osmocom CNI). 9 | 10 | The code in this repository is completely unmaintained, unsupported and 11 | it is strongly discouraged to use it. On the other hand, the modern 12 | Osmocom CNI implementations are fully maintained and continuously 13 | tested. 14 | 15 | Do not bother the developers with questions about code from this 16 | repository. 17 | 18 | Further Links 19 | ------------- 20 | 21 | * [New-style GSM NITB baesd on discrete Osmocom CNI projects](https://osmocom.org/projects/cellular-infrastructure/wiki/Osmocom_Network_In_The_Box) 22 | * [Migration guide from OsmoNITB to Osmcoom CNI](https://osmocom.org/projects/cellular-infrastructure/wiki/OsmoNITB_Migration_Guide) 23 | -------------------------------------------------------------------------------- /contrib/jenkins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # jenkins build helper script for openbsc. This is how we build on jenkins.osmocom.org 3 | # 4 | # environment variables: 5 | # * MGCP: configure transcoding for MGCP (values: "--enable-mgcp-transcoding", "--disable-mgcp-transcoding") 6 | # * SMPP: configure the SMPP interface (values: "--enable-smpp", "--disable-smpp") 7 | # * WITH_MANUALS: build manual PDFs if set to "1" 8 | # * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1") 9 | # 10 | 11 | if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then 12 | echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !" 13 | exit 2 14 | fi 15 | 16 | base="$PWD" 17 | deps="$base/deps" 18 | inst="$deps/install" 19 | export deps inst 20 | 21 | osmo-clean-workspace.sh 22 | 23 | mkdir -p "$deps" 24 | rm -rf "$inst" 25 | 26 | # 27 | # Build deps 28 | # 29 | osmo-build-dep.sh libosmocore master ac_cv_path_DOXYGEN=false 30 | 31 | verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") 32 | 33 | export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" 34 | export LD_LIBRARY_PATH="$inst/lib" 35 | export PATH="$inst/bin:$PATH" 36 | 37 | osmo-build-dep.sh libosmo-abis 38 | osmo-build-dep.sh libosmo-netif 39 | osmo-build-dep.sh libosmo-sccp "$sccp_branch" 40 | PARALLEL_MAKE=-j1 osmo-build-dep.sh libsmpp34 41 | 42 | # 43 | # Build project 44 | # 45 | cd "$base/openbsc" 46 | autoreconf --install --force 47 | 48 | ./configure "$SMPP" "$MGCP" \ 49 | --enable-osmo-bsc \ 50 | --enable-nat \ 51 | --enable-vty-tests \ 52 | --enable-external-tests 53 | 54 | "$MAKE" $PARALLEL_MAKE 55 | "$MAKE" check || cat-testlogs.sh 56 | "$MAKE" distcheck || cat-testlogs.sh 57 | "$MAKE" maintainer-clean 58 | 59 | # 60 | # Build and publish manuals 61 | # 62 | if [ "$WITH_MANUALS" = "1" ]; then 63 | # Build all manuals first 64 | for dir in "$base"/manuals/*/; do 65 | make -C "$dir" 66 | done 67 | 68 | # Run 'make check' for the OsmoNITB manuals. 69 | # The other dirs only have VTY references, so there is no 'make check' target for them. 70 | make -C "$base/manuals/OsmoNITB" check 71 | 72 | # Publish all at once 73 | if [ "$PUBLISH" = "1" ]; then 74 | for dir in "$base"/manuals/*/; do 75 | make -C "$dir" publish 76 | done 77 | fi 78 | fi 79 | 80 | osmo-clean-workspace.sh 81 | -------------------------------------------------------------------------------- /debian/autoreconf: -------------------------------------------------------------------------------- 1 | openbsc 2 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | openbsc/README 2 | -------------------------------------------------------------------------------- /debian/osmo-bsc-mgcp.install: -------------------------------------------------------------------------------- 1 | etc/osmocom/osmo-bsc-mgcp.cfg 2 | lib/systemd/system/osmo-bsc-mgcp.service 3 | usr/bin/osmo-bsc_mgcp 4 | -------------------------------------------------------------------------------- /debian/osmocom-bs11-utils.install: -------------------------------------------------------------------------------- 1 | /usr/bin/bs11_config 2 | /usr/bin/isdnsync 3 | -------------------------------------------------------------------------------- /debian/osmocom-bsc-nat.install: -------------------------------------------------------------------------------- 1 | /etc/osmocom/osmo-bsc-nat.cfg 2 | /lib/systemd/system/osmo-bsc-nat.service 3 | /usr/bin/osmo-bsc_nat 4 | -------------------------------------------------------------------------------- /debian/osmocom-bsc-sccplite.examples: -------------------------------------------------------------------------------- 1 | openbsc/doc/examples/osmo-bsc_mgcp 2 | openbsc/doc/examples/osmo-bsc-sccplite 3 | -------------------------------------------------------------------------------- /debian/osmocom-bsc-sccplite.install: -------------------------------------------------------------------------------- 1 | /etc/osmocom/osmo-bsc-sccplite.cfg 2 | /lib/systemd/system/osmo-bsc-sccplite.service 3 | /usr/bin/osmo-bsc-sccplite 4 | -------------------------------------------------------------------------------- /debian/osmocom-nitb.default: -------------------------------------------------------------------------------- 1 | CONFIG_FILE="/etc/osmocom/osmo-nitb.cfg" 2 | HLR_FILE="/var/lib/osmocom/hlr.sqlite3" 3 | 4 | DAEMON_ARGS="-P" 5 | 6 | # Uncomment if using LCR+Asterisk 7 | # DAEMON_ARGS="-m -P" 8 | 9 | -------------------------------------------------------------------------------- /debian/osmocom-nitb.dirs: -------------------------------------------------------------------------------- 1 | /etc/osmocom 2 | /var/log/osmocom 3 | /var/lib/osmocom 4 | -------------------------------------------------------------------------------- /debian/osmocom-nitb.examples: -------------------------------------------------------------------------------- 1 | openbsc/doc/examples/osmo-nitb 2 | -------------------------------------------------------------------------------- /debian/osmocom-nitb.install: -------------------------------------------------------------------------------- 1 | /etc/osmocom/osmo-nitb.cfg 2 | /lib/systemd/system/osmo-nitb.service 3 | /usr/bin/osmo-nitb 4 | openbsc/contrib/*.py usr/bin/ 5 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # Uncomment this to turn on verbose mode. 4 | #export DH_VERBOSE=1 5 | 6 | DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2) 7 | DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1) 8 | VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g') 9 | 10 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all 11 | 12 | %: 13 | dh $@ --sourcedirectory=openbsc --with=systemd --with autoreconf 14 | 15 | # This is needed for debian stable (squeeze) 16 | override_dh_autoreconf: 17 | cd openbsc && autoreconf --install --force 18 | 19 | override_dh_strip: 20 | dh_strip -posmocom-bsc-sccplite --dbg-package=osmocom-bsc-sccplite-dbg 21 | dh_strip -posmocom-nitb --dbg-package=osmocom-nitb-dbg 22 | dh_strip -posmocom-bs11-utils --dbg-package=osmocom-bs11-utils-dbg 23 | dh_strip -posmocom-bsc-nat --dbg-package=osmocom-bsc-nat-dbg 24 | 25 | override_dh_auto_configure: 26 | dh_auto_configure --sourcedirectory=openbsc -- --enable-nat --enable-osmo-bsc --enable-smpp --with-systemdsystemunitdir=/lib/systemd/system 27 | 28 | # Print test results in case of a failure 29 | override_dh_auto_test: 30 | dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) 31 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /manuals/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.svg 3 | *.pdf 4 | *__*.png 5 | *.check 6 | generated 7 | common 8 | build 9 | -------------------------------------------------------------------------------- /manuals/OsmoBSCMGCP/Makefile: -------------------------------------------------------------------------------- 1 | OSMO_GSM_MANUALS_DIR := $(shell ../osmo-gsm-manuals-dir.sh) 2 | srcdir=$(CURDIR) 3 | 4 | VTY_REFERENCE = osmo-bsc-mgcp-vty-reference.xml 5 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc 6 | 7 | OSMO_REPOSITORY = openbsc 8 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.common.inc 9 | -------------------------------------------------------------------------------- /manuals/OsmoBSCMGCP/osmo-bsc-mgcp-vty-reference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | ]> 11 | 12 | 13 | 14 | 15 | 16 | v1 17 | 13th August 2012 18 | hf 19 | Initial 20 | 21 | 22 | v2 23 | 5th March 2014 24 | hf 25 | Update to match osmo-bsc version 0.13.0-305 26 | 27 | 28 | 29 | OsmoBSCMGCP VTY Reference 30 | 31 | 32 | 2012-2014 33 | 34 | 35 | 36 | This work is copyright by sysmocom - s.f.m.c. GmbH. All rights reserved. 37 | 38 | 39 | 40 | 41 | 42 | &chapter-vty; 43 | 44 | 45 | -------------------------------------------------------------------------------- /manuals/OsmoBSCMGCP/vty/mgcp_vty_additions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MGCP Global Commands 5 | This node allows to configure global MGCP settings. These include 6 | the various port numbers. 7 | 8 | 9 | 10 | MGCP Trunk Command 11 | This node allows to configure a MGCP trunk. These include the number, 12 | the local binding ports, SDP configuration. 13 | 14 | 15 | -------------------------------------------------------------------------------- /manuals/OsmoBSCNAT/Makefile: -------------------------------------------------------------------------------- 1 | OSMO_GSM_MANUALS_DIR := $(shell ../osmo-gsm-manuals-dir.sh) 2 | srcdir=$(CURDIR) 3 | 4 | VTY_REFERENCE = osmo-bsc-nat-vty-reference.xml 5 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc 6 | 7 | OSMO_REPOSITORY = openbsc 8 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.common.inc 9 | -------------------------------------------------------------------------------- /manuals/OsmoBSCNAT/chapters/counters_generated.adoc: -------------------------------------------------------------------------------- 1 | 2 | // autogenerated by show asciidoc counters 3 | These counters and their description based on OsmoBSCNAT 1.3.0 (OsmoBSCNAT). 4 | 5 | === Rate Counters 6 | 7 | // generating tables for rate_ctr_group 8 | // rate_ctr_group table NAT Access-List Statistics 9 | .nat:filter - NAT Access-List Statistics 10 | [options="header"] 11 | |=== 12 | | Name | Reference | Description 13 | | access-list:local-filter | <> | Rejected by rule for local 14 | | access-list:global-filter | <> | Rejected by rule for global 15 | |=== 16 | // rate_ctr_group table NAT BSC Statistics 17 | .nat:bsc - NAT BSC Statistics 18 | [options="header"] 19 | |=== 20 | | Name | Reference | Description 21 | | sccp:conn | <> | SCCP Connections 22 | | sccp:calls | <> | SCCP Assignment Commands 23 | | net:reconnects | <> | Network reconnects 24 | | dropped:sccp | <> | Dropped SCCP connections 25 | | dropped:calls | <> | Dropped active calls. 26 | | rejected:cr | <> | Rejected CR due filter 27 | | rejected:msg | <> | Rejected MSG due filter 28 | | rejected:ill | <> | Rejected due parse error 29 | | conn:lu | <> | Conn Location Update 30 | | conn:rq | <> | Conn CM Service Req 31 | | conn:pag | <> | Conn Paging Response 32 | | conn:ssa | <> | Conn USSD 33 | | conn:other | <> | Conn Other 34 | |=== 35 | == Osmo Stat Items 36 | 37 | // generating tables for osmo_stat_items 38 | == Osmo Counters 39 | 40 | // generating tables for osmo_counters 41 | // ungrouped osmo_counters 42 | .ungrouped osmo counters 43 | [options="header"] 44 | |=== 45 | | Name | Reference | Description 46 | | nat.sccp.conn | <> | 47 | | nat.sccp.calls | <> | 48 | | nat.bsc.conn | <> | 49 | | nat.bsc.auth_fail | <> | 50 | | nat.msc.conn | <> | 51 | | nat.ussd.conn | <> | 52 | |=== 53 | -------------------------------------------------------------------------------- /manuals/OsmoBSCNAT/osmo-bsc-nat-vty-reference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | ]> 11 | 12 | 13 | 14 | 15 | 16 | v1 17 | 13th August 2012 18 | hf 19 | Initial 20 | 21 | 22 | v2 23 | 5th March 2014 24 | hf 25 | Update to match osmo-bsc version 0.13.0-305 26 | 27 | 28 | 29 | OsmoBSCNAT VTY Reference 30 | 31 | 32 | 2012-2014 33 | 34 | 35 | 36 | This work is copyright by sysmocom - s.f.m.c. GmbH. All rights reserved. 37 | 38 | 39 | 40 | 41 | 42 | &chapter-vty; 43 | 44 | 45 | -------------------------------------------------------------------------------- /manuals/OsmoBSCNAT/vty/nat_vty_additions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MGCP Commands 5 | This node allows to configure global MGCP settings. These include 6 | the various port numbers. 7 | 8 | 9 | 10 | 11 | NAT Commands 12 | This node allows to configure the global NAT settings. These include 13 | the destination address of the MSC, the filter and rewriting rules to use. 14 | 15 | 16 | 17 | BSC Commands 18 | This node allows to configure a BSC. A BSC has a list of 19 | LACs, an access token associated to it. 20 | 21 | 22 | 23 | 24 | 25 | 26 | Paging Group Commands 27 | This node allows to configure a Paging Group. A Paging Group 28 | holds the LACs of several destinations and a BSC can refer to a Paging 29 | Group. This way several BSCs can receive the paging for a shared LAC. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/Makefile: -------------------------------------------------------------------------------- 1 | OSMO_GSM_MANUALS_DIR := $(shell ../osmo-gsm-manuals-dir.sh) 2 | srcdir=$(CURDIR) 3 | 4 | ASCIIDOC = osmonitb-usermanual.adoc 5 | ASCIIDOC_DEPS = $(srcdir)/chapters/*.adoc 6 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.asciidoc.inc 7 | 8 | VTY_REFERENCE = osmonitb-vty-reference.xml 9 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.vty-reference.inc 10 | 11 | OSMO_REPOSITORY = openbsc 12 | include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.common.inc 13 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/chapters/control.adoc: -------------------------------------------------------------------------------- 1 | [[control]] 2 | == Control interface 3 | 4 | The actual protocol is described in <>, the variables 5 | common to all programs using it are described in <>. The 6 | variables shared with OsmoBSC are described in corresponding section of 7 | OsmoBSC documentation.Here we describe variables specific to OsmoNITB. 8 | 9 | .Variables available over control interface 10 | [options="header",width="100%",cols="20%,5%,5%,50%,20%"] 11 | |=== 12 | |Name|Access|Trap|Value|Comment 13 | |subscriber-modify-v1|WO|No|",,,"|See <> for details. 14 | |subscriber-delete-v1|WO|No|""|See <> for details. 15 | |subscriber-list-active-v1|RO|No||Return list of active subscribers. 16 | |=== 17 | 18 | [[sub1]] 19 | === subscriber-modify-v1 20 | 21 | Modify (or add if missing) subscriber entry with the give IMSI, MSISDN, Ki and 22 | algorithm (valid values are "none", "xor" and "comp128v1"). The subscriber is 23 | automatically marked as authorized. 24 | 25 | [[subdel]] 26 | === subscriber-delete-v1 27 | 28 | Delete the subscriber with the given IMSI. Returns "Removed active subscriber" 29 | or "Removed" depending on the subscriber's use status. 30 | 31 | [[osmo-bsc_nat]] 32 | 33 | The following variables are only available over control interface of 34 | osmo-bsc_nat program. 35 | 36 | .Variables available over control interface of osmo-bsc_nat 37 | [options="header",width="100%",cols="20%,5%,5%,50%,20%"] 38 | |=== 39 | |Name|Access|Trap|Value|Comment 40 | |net.0.bsc.N.*|RW|Yes|Arbitrary variable|Forward given command to BSC N control interface. 41 | |net.0.bsc_cfg.N.access-list-name|RW|No|""|Set/Get ACL for a given BSC N. 42 | |net.0.bsc_cfg.N.no-access-list-name|WO|No|Ignored|Remove ACL for a given BSC N. 43 | |net.0.add.allow.access-list.A|WO|No|""|See <> for details. 44 | |net.0.save-configuration|WO|No|Ignored|Save current running config into file. 45 | |net.0.bsc.N.notification-rejection-v1|NA|Yes|"imsi="|See <> for details. 46 | |=== 47 | 48 | [[nacl]] 49 | === allow.access-list 50 | 51 | Add given regular expression for matching IMSI(s) to allowed access list A. 52 | 53 | [[narej]] 54 | === notification-rejection-v1 55 | 56 | This TRAP event notifies all connected clients about IMSI which was rejected by 57 | BSC N. 58 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/chapters/counters.adoc: -------------------------------------------------------------------------------- 1 | [[counters]] 2 | == Implemented Counters 3 | 4 | include::./counters_generated.adoc[] 5 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/osmonitb-usermanual-docinfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | August 13, 2012 5 | HF 6 | 7 | Initial version. 8 | 9 | 10 | 11 | 2 12 | February 2016 13 | HW 14 | 15 | Conversion to asciidoc, removal of sysmoBTS specific parts. 16 | 17 | 18 | 19 | 20 | 21 | 22 | Holger 23 | Freyther 24 | hfreyther@sysmocom.de 25 | HF 26 | 27 | sysmocom 28 | sysmocom - s.f.m.c. GmbH 29 | former Managing Director 30 | 31 | 32 | 33 | Harald 34 | Welte 35 | hwelte@sysmocom.de 36 | HW 37 | 38 | sysmocom 39 | sysmocom - s.f.m.c. GmbH 40 | Managing Director 41 | 42 | 43 | 44 | 45 | 46 | 2012-2016 47 | sysmocom - s.f.m.c. GmbH 48 | 49 | 50 | 51 | 52 | Permission is granted to copy, distribute and/or modify this 53 | document under the terms of the GNU Free Documentation License, 54 | Version 1.3 or any later version published by the Free Software 55 | Foundation; with the Invariant Sections being just 'Foreword', 56 | 'Acknowledgements' and 'Preface', with no Front-Cover Texts, 57 | and no Back-Cover Texts. A copy of the license is included in 58 | the section entitled "GNU Free Documentation License". 59 | 60 | 61 | The Asciidoc source code of this manual can be found at 62 | 63 | http://git.osmocom.org/osmo-gsm-manuals/ 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/osmonitb-usermanual.adoc: -------------------------------------------------------------------------------- 1 | :gfdl-enabled: 2 | :program-name: OsmoNITB 3 | 4 | OBSOLETE OsmoNITB User Manual 5 | ============================= 6 | Harald Welte 7 | 8 | WARNING:: osmo-nitb is obsolete since 2017. It is not actively maintained, 9 | and it lack several man-years of development effort that went into the 10 | so-called post-NITB stack consisting of separate OsmoBSC, OsmoMSC, 11 | OsmoMGW and OsmoHLR. You should not use this software except for 12 | archaeological purpose. You will be on your own. Do not contact the 13 | developers about any issues you may experience while running unsuported, 14 | obsolete software! 15 | 16 | include::./common/chapters/preface.adoc[] 17 | 18 | include::{srcdir}/chapters/overview.adoc[] 19 | 20 | include::{srcdir}/chapters/running.adoc[] 21 | 22 | include::{srcdir}/chapters/control.adoc[] 23 | 24 | include::./common/chapters/vty.adoc[] 25 | 26 | include::./common/chapters/logging.adoc[] 27 | 28 | include::./common/chapters/counters-overview.adoc[] 29 | 30 | include::{srcdir}/chapters/counters.adoc[] 31 | 32 | include::{srcdir}/chapters/net.adoc[] 33 | 34 | include::{srcdir}/chapters/bsc.adoc[] 35 | 36 | include::{srcdir}/chapters/bts.adoc[] 37 | 38 | include::{srcdir}/chapters/bts-examples.adoc[] 39 | 40 | include::{srcdir}/chapters/hlr.adoc[] 41 | 42 | include::./common/chapters/smpp.adoc[] 43 | 44 | include::./common/chapters/mncc.adoc[] 45 | 46 | include::./common/chapters/control_if.adoc[] 47 | 48 | include::./common/chapters/cell-broadcast.adoc[] 49 | 50 | include::./common/chapters/abis.adoc[] 51 | 52 | include::./common/chapters/port_numbers.adoc[] 53 | 54 | include::./common/chapters/bibliography.adoc[] 55 | 56 | include::./common/chapters/glossary.adoc[] 57 | 58 | include::./common/chapters/gfdl.adoc[] 59 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/osmonitb-vty-reference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | ]> 11 | 12 | 13 | 14 | 15 | 16 | v1 17 | 13th August 2012 18 | hf 19 | Initial 20 | 21 | 22 | v2 23 | 5th March 2014 24 | hf 25 | Update to match osmo-bsc version 0.13.0-305 26 | 27 | 28 | 29 | OsmoNITB VTY Reference 30 | 31 | 32 | 2012-2014 33 | 34 | 35 | 36 | This work is copyright by sysmocom - s.f.m.c. GmbH. All rights reserved. 37 | 38 | 39 | 40 | 41 | 42 | &chapter-vty; 43 | 44 | 45 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/vty/bsc_vty_additions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | This node allows to configure the MSC connection related 4 | settings. 5 | 6 | 7 | This node allows to configure the BSC connection related 8 | settings. 9 | 10 | 11 | -------------------------------------------------------------------------------- /manuals/OsmoNITB/vty/nitb_vty_additions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MNCC Internal Configuration 5 | This node allows to configure the default codecs for 6 | the internal call control handling. 7 | 8 | 9 | 10 | SMPP Configuration 11 | This node allows to configure the SMPP interface 12 | for interfacing with external SMS applications. This section 13 | contains generic/common SMPP related configuration, and no 14 | per-ESME specific parameters. 15 | 16 | 17 | 18 | ESME Configuration 19 | This node allows to configure one particular SMPP 20 | ESME, which is an External SMS Entity such as a SMS based 21 | application server. You can define any number of ESME within 22 | the SMPP node of the OsmoNITB VTY. 23 | 24 | 25 | -------------------------------------------------------------------------------- /manuals/osmo-gsm-manuals-dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Find OSMO_GSM_MANUALS_DIR and print it to stdout. Print where it was taken from to stderr. 3 | 4 | # Find it in env, pkg-conf and ../../osmo-gsm-manuals 5 | RET="$OSMO_GSM_MANUALS_DIR" 6 | if [ -n "$RET" ]; then 7 | RET="$(realpath $RET)" 8 | echo "OSMO_GSM_MANUALS_DIR: $RET (from env)" >&2 9 | else 10 | RET="$(pkg-config osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null || true)" 11 | if [ -n "$RET" ]; then 12 | echo "OSMO_GSM_MANUALS_DIR: $RET (from pkg-conf)" >&2 13 | else 14 | RET="$(realpath $(realpath $(dirname $0))/../../osmo-gsm-manuals)" 15 | echo "OSMO_GSM_MANUALS_DIR: $RET (fallback)" >&2 16 | fi 17 | fi 18 | 19 | # Print the result or error message 20 | if [ -d "$RET" ]; then 21 | echo "$RET" 22 | else 23 | echo "ERROR: OSMO_GSM_MANUALS_DIR does not exist!" >&2 24 | echo "Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR." >&2 25 | exit 1 26 | fi 27 | -------------------------------------------------------------------------------- /openbsc/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.lo 3 | *.a 4 | .deps 5 | Makefile 6 | Makefile.in 7 | bscconfig.h 8 | bscconfig.h.in 9 | openbsc.pc 10 | src/osmo-nitb/osmo-nitb 11 | src/osmo-bsc_mgcp/osmo-bsc_mgcp 12 | src/osmo-bsc/osmo-bsc-sccplite 13 | src/utils/meas_vis 14 | src/utils/meas_json 15 | src/utils/osmo-meas-pcap2db 16 | src/utils/osmo-meas-udp2db 17 | src/utils/smpp_mirror 18 | *.*~ 19 | *.sw? 20 | .libs 21 | *.pyc 22 | *.gcda 23 | *.gcno 24 | 25 | #configure 26 | aclocal.m4 27 | autom4te.cache/ 28 | config.log 29 | config.status 30 | config.guess 31 | config.sub 32 | configure 33 | compile 34 | depcomp 35 | install-sh 36 | missing 37 | stamp-h1 38 | libtool 39 | ltmain.sh 40 | m4/*.m4 41 | configure~ 42 | 43 | # git-version-gen magic 44 | .tarball-version 45 | .version 46 | 47 | 48 | # apps and app data 49 | hlr.sqlite3 50 | src/utils/bs11_config 51 | src/ipaccess/ipaccess-config 52 | src/ipaccess/abisip-find 53 | src/ipaccess/ipaccess-firmware 54 | src/ipaccess/ipaccess-proxy 55 | src/utils/isdnsync 56 | src/nat/bsc_nat 57 | src/osmo-bsc_nat/osmo-bsc_nat 58 | src/libcommon/gsup_test_client 59 | 60 | #tests 61 | tests/testsuite.dir 62 | tests/bsc-nat/bsc_nat_test 63 | tests/bsc-nat-trie/bsc_nat_trie_test 64 | tests/channel/channel_test 65 | tests/db/db_test 66 | tests/debug/debug_test 67 | tests/gsm0408/gsm0408_test 68 | tests/mgcp/mgcp_test 69 | tests/sccp/sccp_test 70 | tests/sms/sms_test 71 | tests/timer/timer_test 72 | tests/abis/abis_test 73 | tests/si/si_test 74 | tests/smpp/smpp_test 75 | tests/bsc/bsc_test 76 | tests/trau/trau_test 77 | tests/mgcp/mgcp_transcoding_test 78 | tests/subscr/subscr_test 79 | tests/subscr/bsc_subscr_test 80 | tests/mm_auth/mm_auth_test 81 | tests/nanobts_omlattr/nanobts_omlattr_test 82 | 83 | tests/atconfig 84 | tests/atlocal 85 | tests/package.m4 86 | tests/testsuite 87 | tests/testsuite.log 88 | 89 | src/openbsc.cfg* 90 | writtenconfig/ 91 | -------------------------------------------------------------------------------- /openbsc/AUTHORS: -------------------------------------------------------------------------------- 1 | Harald Welte 2 | Holger Freyther 3 | Jan Luebbe 4 | Stefan Schmidt 5 | Daniel Willmann 6 | Andreas Eversberg 7 | Sylvain Munaut <246tnt@gmail.com> 8 | Jacob Erlbeck 9 | Neels Hofmeyr 10 | -------------------------------------------------------------------------------- /openbsc/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 2 | 3 | ## FIXME: automake >= 1.13 or autoconf >= 2.70 provide better suited AC_CONFIG_MACRO_DIRS for configure.ac 4 | ## remove line below when OE toolchain is updated to version which include those 5 | ACLOCAL_AMFLAGS = -I m4 6 | AM_CPPFLAGS = \ 7 | $(all_includes) \ 8 | -I$(top_srcdir)/include \ 9 | $(NULL) 10 | 11 | SUBDIRS = \ 12 | doc \ 13 | include \ 14 | src \ 15 | tests \ 16 | contrib \ 17 | $(NULL) 18 | 19 | BUILT_SOURCES = $(top_srcdir)/.version 20 | EXTRA_DIST = git-version-gen osmoappdesc.py .version 21 | 22 | AM_DISTCHECK_CONFIGURE_FLAGS = \ 23 | --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) 24 | 25 | @RELMAKE@ 26 | 27 | $(top_srcdir)/.version: 28 | echo $(VERSION) > $@-t && mv $@-t $@ 29 | dist-hook: 30 | echo $(VERSION) > $(distdir)/.tarball-version 31 | -------------------------------------------------------------------------------- /openbsc/README: -------------------------------------------------------------------------------- 1 | About OpenBSC 2 | ============= 3 | 4 | OpenBSC started as a minimalistic all-in-one implementation of the GSM Network, 5 | with particular emphasis on the functionality typically provided by the BSC, 6 | MSC, HLR, VLR and SMSC. Today it is a growing suite of libraries and programs, 7 | implementing protocol stacks and functional elements, including 8 | 9 | * OsmoBSC - a pure GSM BSC, speaking Abis/IP to the BTS and A/IP to the MSC 10 | * OsmoBSC-MGCP - MGCP helper to the OsmoBSC software 11 | * OsmoNITB - a BSC+MSC+VLR+HLR+SMSC "Network in the box". 12 | * OsmoMSC - a voice CN with A/IP and IuCS/IP towards the BSC and/or HNB-GW 13 | * OsmoSGSN - a GPRS SGSN with Gb/IP and IuPS/IP towards the PCU and/or HNB-GW 14 | * Osmo-GbProxy - a Proxy to aggregate many Gb links as one Gb link to the SGSN 15 | * OsmoBSCNAT - a gateway aggregating many A links as one A link to the MSC 16 | * OsmoGTPHUB - a hub aggregating many GTP links (between SGSN and GGSN) 17 | * bs11_config - a tool to configure the Siemens BS-11 microBTS 18 | 19 | Various interfaces towards the BTS are supported, among which are: 20 | 21 | * Classic A-bis over E1 using a mISDN based E1 interface. In other 22 | words, you can connect existing GSM Base Transceiver Station (BTS) 23 | through E1 to OpenBSC. So far, we have made it work with the Siemens BS-11, 24 | various Ericsson RBS2xxx BTS models and the Nokia MetroSite. 25 | 26 | * A-bis over IP as used by the ip.access nanoBTS product family as well as 27 | the Open Source OsmoBTS software (by the same authors as OpenBSC). OsmoBTS 28 | in turn supports various transceiver hardware, including the sysmoBTS 29 | product family, as well as SDR transceivers supported by OsmoTRX, such as 30 | the UmTRX or USRP boardss. 31 | 32 | * IuCS and IuPS over IP towards an HNB-GW (see osmo-iuh) for UMTS (3G) 33 | voice and data links. 34 | 35 | Find OpenBSC online at 36 | http://openbsc.osmocom.org/ 37 | 38 | Harald Welte 39 | -------------------------------------------------------------------------------- /openbsc/README.vty-tests: -------------------------------------------------------------------------------- 1 | To run the configuration parsing and output (VTY) test suite, first install 2 | 3 | https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests 4 | 5 | and pass the following configure options here: 6 | 7 | ./configure --enable-vty-tests --enable-external-tests 8 | 9 | The VTY tests are then included in the standard check target: 10 | 11 | make check 12 | -------------------------------------------------------------------------------- /openbsc/contrib/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = systemd 2 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/README: -------------------------------------------------------------------------------- 1 | Some crazy scripts call testing... and MSC link failure simulation 2 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/all_dial: -------------------------------------------------------------------------------- 1 | ABORT BUSY 2 | ABORT 'NO CARRIER' 3 | ABORT 'OK' 4 | 5 | '' AT 6 | SAY "Dialing a number\n" 7 | 'OK' ATD05660066; 8 | 9 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/dial.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Evil dial script.. 3 | 4 | while true; 5 | do 6 | chat -v -f all_dial < /dev/ttyACM0 > /dev/ttyACM0 7 | sleep 5s 8 | chat -v -f hangup < /dev/ttyACM0 > /dev/ttyACM0 9 | sleep 2s 10 | done 11 | 12 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/drop-oml.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sleep 3 3 | echo "enable" 4 | sleep 1 5 | echo "drop bts connection 0 oml" 6 | sleep 1 7 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/drop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | while true; 4 | do 5 | echo "Going to drop the OML connection" 6 | ./drop-oml.sh | telnet 127.0.0.1 4242 7 | sleep 58m 8 | done 9 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/hangup: -------------------------------------------------------------------------------- 1 | TIMEOUT 10 2 | '' ^Z 3 | SAY "Waiting for hangup confirm\n" 4 | '' ATH; 5 | -------------------------------------------------------------------------------- /openbsc/contrib/bsc-test/msc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | while true; 4 | do 5 | echo "Kill the osmo-bsc-sccplite" 6 | /usr/bin/kill -s SIGUSR2 `pidof osmo-bsc-sccplite` 7 | sleep 58s 8 | done 9 | -------------------------------------------------------------------------------- /openbsc/contrib/bt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | 5 | f = open("unbalanced") 6 | lines = [] 7 | for line in f: 8 | lines.append(line) 9 | 10 | filenames = {} 11 | 12 | output = [] 13 | for line in lines: 14 | if "[0x" in line: 15 | start = line.find("[") 16 | end = line.find("]") 17 | addr = line[start+1:end] 18 | try: 19 | file = filenames[addr] 20 | except KeyError: 21 | r = os.popen("addr2line -fs -e ./bsc_hack %s" % addr) 22 | all = r.read().replace("\n", ",") 23 | file = all 24 | filenames[addr] = file 25 | 26 | line = line.replace(addr, file) 27 | output.append(line) 28 | 29 | g = open("unbalanced.2", "w") 30 | g.write("".join(output)) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /openbsc/contrib/convert_to_enum.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # 4 | # Convert ETSI documents to an enum 5 | # 6 | 7 | import re, sys 8 | 9 | def convert(string): 10 | string = string.strip().replace(" ", "").rjust(8, "0") 11 | var = 0 12 | offset = 7 13 | for char in string: 14 | assert offset >= 0 15 | var = var | (int(char) << offset) 16 | offset = offset - 1 17 | 18 | return var 19 | 20 | def string(name): 21 | name = name.replace(" ", "_") 22 | name = name.replace('"', "") 23 | name = name.replace('/', '_') 24 | name = name.replace('(', '_') 25 | name = name.replace(')', '_') 26 | return "%s_%s" % (sys.argv[2], name.upper()) 27 | 28 | file = open(sys.argv[1]) 29 | 30 | 31 | for line in file: 32 | m = re.match(r"[ \t]*(?P[01 ]+)[ ]+(?P[a-zA-Z /0-9()]+)", line[:-1]) 33 | 34 | if m: 35 | print "\t%s\t\t= %d," % (string(m.groupdict()["name"]), convert(m.groupdict()["value"])) 36 | else: 37 | print line[:-1] 38 | -------------------------------------------------------------------------------- /openbsc/contrib/hlr-remove-old.sql: -------------------------------------------------------------------------------- 1 | -- Remove old data from the database 2 | DELETE FROM Subscriber 3 | WHERE id != 1 AND datetime('now', '-10 days') > updated AND authorized != 1; 4 | DELETE FROM Equipment 5 | WHERE datetime('now', '-10 days') > updated; 6 | DELETE FROM EquipmentWatch 7 | WHERE datetime('now', '-10 days') > updated; 8 | DELETE FROM SMS 9 | WHERE datetime('now', '-10 days') > created; 10 | DELETE FROM VLR 11 | WHERE datetime('now', '-10 days') > updated; 12 | DELETE FROM ApduBlobs 13 | WHERE datetime('now', '-10 days') > created; 14 | DELETE FROM Counters 15 | WHERE datetime('now', '-10 days') > timestamp; 16 | DELETE FROM RateCounters 17 | WHERE datetime('now', '-10 days') > timestamp; 18 | VACUUM; 19 | -------------------------------------------------------------------------------- /openbsc/contrib/mgcp_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Simple server for mgcp... send audit, receive response.. 3 | 4 | import socket, time 5 | 6 | MGCP_GATEWAY_PORT = 2427 7 | MGCP_CALLAGENT_PORT = 2727 8 | 9 | rsip_resp = """200 321321332\r\n""" 10 | audit_packet = """AUEP %d 13@mgw MGCP 1.0\r\n""" 11 | crcx_packet = """CRCX %d 14@mgw MGCP 1.0\r\nC: 4a84ad5d25f\r\nL: p:20, a:GSM-EFR, nt:IN\r\nM: recvonly\r\n""" 12 | dlcx_packet = """DLCX %d 14@mgw MGCP 1.0\r\nC: 4a84ad5d25f\r\nI: %d\r\n""" 13 | mdcx_packet = """MDCX %d 14@mgw MGCP 1.0\r\nC: 4a84ad5d25f\r\nI: %d\r\nL: p:20, a:GSM-EFR, nt:IN\r\nM: recvonly\r\n\r\nv=0\r\no=- 258696477 0 IN IP4 172.16.1.107\r\ns=-\r\nc=IN IP4 172.16.1.107\r\nt=0 0\r\nm=audio 6666 RTP/AVP 127\r\na=rtpmap:127 GSM-EFR/8000/1\r\na=ptime:20\r\na=recvonly\r\nm=image 4402 udptl t38\r\na=T38FaxVersion:0\r\na=T38MaxBitRate:14400\r\n""" 14 | 15 | def hexdump(src, length=8): 16 | """Recipe is from http://code.activestate.com/recipes/142812/""" 17 | result = [] 18 | digits = 4 if isinstance(src, unicode) else 2 19 | for i in xrange(0, len(src), length): 20 | s = src[i:i+length] 21 | hexa = b' '.join(["%0*X" % (digits, ord(x)) for x in s]) 22 | text = b''.join([x if 0x20 <= ord(x) < 0x7F else b'.' for x in s]) 23 | result.append( b"%04X %-*s %s" % (i, length*(digits + 1), hexa, text) ) 24 | return b'\n'.join(result) 25 | 26 | server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 27 | server_socket.bind(("127.0.0.1", MGCP_CALLAGENT_PORT)) 28 | server_socket.setblocking(1) 29 | 30 | last_ci = 1 31 | def send_and_receive(packet): 32 | global last_ci 33 | server_socket.sendto(packet, ("127.0.0.1", MGCP_GATEWAY_PORT)) 34 | try: 35 | data, addr = server_socket.recvfrom(4096) 36 | 37 | # attempt to store the CI of the response 38 | list = data.split("\n") 39 | for item in list: 40 | if item.startswith("I: "): 41 | last_ci = int(item[3:]) 42 | 43 | print hexdump(data), addr 44 | except socket.error, e: 45 | print e 46 | pass 47 | 48 | def generate_tid(): 49 | import random 50 | return random.randint(0, 65123) 51 | 52 | 53 | 54 | while True: 55 | send_and_receive(audit_packet % generate_tid()) 56 | send_and_receive(crcx_packet % generate_tid() ) 57 | send_and_receive(mdcx_packet % (generate_tid(), last_ci)) 58 | send_and_receive(dlcx_packet % (generate_tid(), last_ci)) 59 | 60 | time.sleep(3) 61 | -------------------------------------------------------------------------------- /openbsc/contrib/nat/test_regexp.c: -------------------------------------------------------------------------------- 1 | /* make test_regexp */ 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | int main(int argc, char **argv) 8 | { 9 | regex_t reg; 10 | regmatch_t matches[2]; 11 | 12 | if (argc != 4) { 13 | printf("Invoke with: test_regexp REGEXP REPLACE NR\n"); 14 | return -1; 15 | } 16 | 17 | if (regcomp(®, argv[1], REG_EXTENDED) != 0) { 18 | fprintf(stderr, "Regexp '%s' is not valid.\n", argv[1]); 19 | return -1; 20 | } 21 | 22 | if (regexec(®, argv[3], 2, matches, 0) == 0 && matches[1].rm_eo != -1) 23 | printf("New Number: %s%s\n", argv[2], &argv[3][matches[1].rm_so]); 24 | else 25 | printf("No match.\n"); 26 | 27 | regfree(®); 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /openbsc/contrib/nat/ussd_example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | """ 4 | AGPLv3+ 2016 Copyright Holger Hans Peter Freyther 5 | 6 | Example of how to connect to the USSD side-channel and how to respond 7 | with a fixed message. 8 | """ 9 | 10 | import socket 11 | import struct 12 | 13 | ussdSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 14 | ussdSocket.connect(('127.0.0.1', 5001)) 15 | 16 | def send_dt1(dstref, data): 17 | dlen = struct.pack('B', len(data)).encode('hex') 18 | hex = '06' + dstref.encode('hex') + '00' + '01' + dlen + data.encode('hex') 19 | pdata = hex.decode('hex') 20 | out = struct.pack('>HB', len(pdata), 0xfd) + pdata 21 | ussdSocket.send(out) 22 | 23 | def send_rel(srcref, dstref): 24 | hex = '04' + dstref.encode('hex') + srcref.encode('hex') + '000100' 25 | pdata = hex.decode('hex') 26 | out = struct.pack('>HB', len(pdata), 0xfd) + pdata 27 | ussdSocket.send(out) 28 | 29 | def recv_one(): 30 | plen = ussdSocket.recv(3) 31 | (plen,ptype) = struct.unpack(">HB", plen) 32 | data = ussdSocket.recv(plen) 33 | 34 | return ptype, data 35 | 36 | # Assume this is the ID request 37 | data = ussdSocket.recv(4) 38 | ussdSocket.send("\x00\x08\xfe\x05\x00" + "\x05\x01" + "ussd") 39 | # ^len ^len of tag ... and ignore 40 | 41 | # Expect a fake message. see struct ipac_msgt_sccp_state 42 | ptype, data = recv_one() 43 | print("%d %s" % (ptype, data.encode('hex'))) 44 | (srcref, dstref, transid, invokeid) = struct.unpack("<3s3sBB", data[1:9]) 45 | print("New transID %d invoke %d" % (transid, invokeid)) 46 | 47 | # Expect a the invocation.. todo.. extract invoke id 48 | ptype, data = recv_one() 49 | print("%d %s" % (ptype, data.encode('hex'))) 50 | 51 | # Reply with BSSAP + GSM 04.08 + MAP portion 52 | # 00 == invoke id 0f == DCS 53 | res = "01002a9b2a0802e1901c22a220020100301b02013b301604010f041155e7d2f9bc3a41412894991c06a9c9a713" 54 | send_dt1(dstref, res.decode('hex')) 55 | 56 | clear = "000420040109" 57 | send_dt1(dstref, clear.decode('hex')) 58 | 59 | # should be the clear complete 60 | send_rel(srcref, dstref) 61 | 62 | # Give it some time to handle connection shutdown properly 63 | print("Gracefully sleeping") 64 | import time 65 | time.sleep(3) 66 | -------------------------------------------------------------------------------- /openbsc/contrib/rtp/rtp_replay.st: -------------------------------------------------------------------------------- 1 | " 2 | Simple UDP replay from the state files 3 | " 4 | 5 | PackageLoader fileInPackage: #Sockets. 6 | FileStream fileIn: 'rtp_replay_shared.st'. 7 | 8 | 9 | Eval [ 10 | | replay file host dport | 11 | 12 | file := Smalltalk arguments at: 1 ifAbsent: [ 'rtpstream.state' ]. 13 | host := Smalltalk arguments at: 2 ifAbsent: [ '127.0.0.1' ]. 14 | dport := (Smalltalk arguments at: 3 ifAbsent: [ '4000' ]) asInteger. 15 | sport := (Smalltalk arguments at: 4 ifAbsent: [ '0' ]) asInteger. 16 | 17 | replay := RTPReplay on: file fromPort: sport. 18 | 19 | Transcript nextPutAll: 'Going to stream now'; nl. 20 | replay streamAudio: host port: dport. 21 | ] 22 | -------------------------------------------------------------------------------- /openbsc/contrib/rtp/rtp_replay_sip.st: -------------------------------------------------------------------------------- 1 | """ 2 | Create a SIP connection and then stream... 3 | """ 4 | 5 | PackageLoader 6 | fileInPackage: #OsmoSIP. 7 | 8 | "Load for the replay code" 9 | FileStream fileIn: 'rtp_replay_shared.st'. 10 | 11 | 12 | Osmo.SIPCall subclass: StreamCall [ 13 | | sem stream | 14 | 15 | createCall: aSDP [ 16 | | sdp | 17 | stream := RTPReplay on: 'rtp_ssrc6976010.240.240.1_to_10.240.240.50.state'. 18 | sdp := aSDP % {stream localPort}. 19 | ^ super createCall: sdp. 20 | ] 21 | 22 | sem: aSemaphore [ 23 | sem := aSemaphore 24 | ] 25 | 26 | sessionNew [ 27 | | host port | 28 | Transcript nextPutAll: 'The call has started'; nl. 29 | Transcript nextPutAll: sdp_result; nl. 30 | 31 | host := SDPUtils findHost: sdp_result. 32 | port := SDPUtils findPort: sdp_result. 33 | 34 | [ 35 | stream streamAudio: host port: port. 36 | Transcript nextPutAll: 'Streaming has finished.'; nl. 37 | ] fork. 38 | ] 39 | 40 | sessionFailed [ 41 | sem signal 42 | ] 43 | 44 | sessionEnd [ 45 | sem signal 46 | ] 47 | ] 48 | 49 | Eval [ 50 | | transport agent call sem sdp_fr sdp_amr | 51 | 52 | 53 | sdp_fr := (WriteStream on: String new) 54 | nextPutAll: 'v=0'; cr; nl; 55 | nextPutAll: 'o=twinkle 1739517580 1043400482 IN IP4 127.0.0.1'; cr; nl; 56 | nextPutAll: 's=-'; cr; nl; 57 | nextPutAll: 'c=IN IP4 127.0.0.1'; cr; nl; 58 | nextPutAll: 't=0 0'; cr; nl; 59 | nextPutAll: 'm=audio %1 RTP/AVP 0 101'; cr; nl; 60 | nextPutAll: 'a=rtpmap:0 PCMU/8000'; cr; nl; 61 | nextPutAll: 'a=rtpmap:101 telephone-event/8000'; cr; nl; 62 | nextPutAll: 'a=fmtp:101 0-15'; cr; nl; 63 | nextPutAll: 'a=ptime:20'; cr; nl; 64 | contents. 65 | 66 | sem := Semaphore new. 67 | transport := Osmo.SIPUdpTransport 68 | startOn: '0.0.0.0' port: 5066. 69 | agent := Osmo.SIPUserAgent createOn: transport. 70 | transport start. 71 | 72 | call := (StreamCall 73 | fromUser: 'sip:1000@sip.zecke.osmocom.org' 74 | host: '127.0.0.1' 75 | port: 5060 76 | to: 'sip:123456@127.0.0.1' 77 | on: agent) 78 | sem: sem; yourself. 79 | 80 | call createCall: sdp_fr. 81 | 82 | 83 | "Wait for the stream to have ended" 84 | sem wait. 85 | 86 | (Delay forSeconds: 4) wait. 87 | ] 88 | -------------------------------------------------------------------------------- /openbsc/contrib/rtp/timestamp_rtp.lua: -------------------------------------------------------------------------------- 1 | print("Ni hao") 2 | 3 | 4 | do 5 | local tap = Listener.new("ip", "rtp") 6 | local rtp_ssrc = Field.new("rtp.ssrc") 7 | local frame_time = Field.new("frame.time_relative") 8 | local rtp = Field.new("rtp") 9 | 10 | function tap.packet(pinfo, tvb, ip) 11 | local ip_src, ip_dst = tostring(ip.ip_src), tostring(ip.ip_dst) 12 | local rtp_data = rtp() 13 | local filename = "rtp_ssrc" .. rtp_ssrc() "_src_" .. ip_src .. "_to_" .. ip_dst .. ".state" 14 | local f = io.open(filename, "a") 15 | 16 | f:write(tostring(frame_time()) .. " ") 17 | f:write(tostring(rtp_data.value)) 18 | f:write("\n") 19 | f:close() 20 | end 21 | 22 | function tap.draw() 23 | print("DRAW") 24 | end 25 | function tap.reset() 26 | print("RESET") 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /openbsc/contrib/sms/fill-hlr.st: -------------------------------------------------------------------------------- 1 | "I create output for some simple SQL statements for the HLR db" 2 | 3 | 4 | Eval [ 5 | 6 | "Create tables if they don't exist" 7 | Transcript show: 'CREATE TABLE SMS ( 8 | id INTEGER PRIMARY KEY AUTOINCREMENT, 9 | created TIMESTAMP NOT NULL, 10 | sent TIMESTAMP, 11 | sender_id INTEGER NOT NULL, 12 | receiver_id INTEGER NOT NULL, 13 | deliver_attempts INTEGER NOT NULL DEFAULT 0, 14 | valid_until TIMESTAMP, 15 | reply_path_req INTEGER NOT NULL, 16 | status_rep_req INTEGER NOT NULL, 17 | protocol_id INTEGER NOT NULL, 18 | data_coding_scheme INTEGER NOT NULL, 19 | ud_hdr_ind INTEGER NOT NULL, 20 | dest_addr TEXT, 21 | user_data BLOB, 22 | header BLOB, 23 | text TEXT);'; nl; 24 | show: 'CREATE TABLE Subscriber ( 25 | id INTEGER PRIMARY KEY AUTOINCREMENT, 26 | created TIMESTAMP NOT NULL, 27 | updated TIMESTAMP NOT NULL, 28 | imsi NUMERIC UNIQUE NOT NULL, 29 | name TEXT, 30 | extension TEXT UNIQUE, 31 | authorized INTEGER NOT NULL DEFAULT 0, 32 | tmsi TEXT UNIQUE, 33 | lac INTEGER NOT NULL DEFAULT 0);'; nl. 34 | 35 | "Create some dummy subscribers" 36 | num_sub := 1000. 37 | num_sms := 30. 38 | lac := 1. 39 | 40 | Transcript show: 'BEGIN;'; nl. 41 | 42 | 1 to: num_sub do: [:each | 43 | Transcript show: 'INSERT INTO Subscriber 44 | (imsi, created, updated, authorized, lac, extension) 45 | VALUES 46 | (%1, datetime(''now''), datetime(''now''), 1, %2, %3);' % 47 | {(274090000000000 + each). lac. each}; nl. 48 | ]. 49 | 50 | 1 to: num_sms do: [:sms | 51 | 1 to: num_sub do: [:sub | 52 | Transcript show: 'INSERT INTO SMS 53 | (created, sender_id, receiver_id, valid_until, 54 | reply_path_req, status_rep_req, protocol_id, 55 | data_coding_scheme, ud_hdr_ind, dest_addr, 56 | text) VALUES 57 | (datetime(''now''), 1, %1, ''2222-2-2'', 58 | 0, 0, 0, 59 | 0, 0, ''123456'', 60 | ''abc'');' % {sub}; nl. 61 | ] 62 | ]. 63 | 64 | Transcript show: 'COMMIT;'; nl. 65 | 66 | ] 67 | -------------------------------------------------------------------------------- /openbsc/contrib/sms/hlr-query.st: -------------------------------------------------------------------------------- 1 | "Query for one SMS" 2 | 3 | Eval [ 4 | 1 to: 100 do: [:each | 5 | Transcript show: 'SELECT SMS.* FROM SMS 6 | JOIN Subscriber ON SMS.receiver_id = Subscriber.id 7 | WHERE SMS.id >= 1 AND SMS.sent IS NULL AND Subscriber.lac > 0 8 | ORDER BY SMS.id LIMIT 1;'; nl. 9 | ]. 10 | ] 11 | -------------------------------------------------------------------------------- /openbsc/contrib/sms/sqlite-probe.tap.d: -------------------------------------------------------------------------------- 1 | probe process("/usr/lib/libsqlite3.so.0.8.6").function("sqlite3_get_table") 2 | { 3 | a = user_string($zSql); 4 | printf("sqlite3_get_table called '%s'\n", a); 5 | } 6 | -------------------------------------------------------------------------------- /openbsc/contrib/systemd/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = \ 2 | osmo-bsc-mgcp.service \ 3 | osmo-bsc-nat.service \ 4 | osmo-bsc-sccplite.service \ 5 | osmo-nitb.service 6 | 7 | if HAVE_SYSTEMD 8 | SYSTEMD_SERVICES = osmo-nitb.service osmo-bsc-mgcp.service 9 | 10 | if BUILD_NAT 11 | SYSTEMD_SERVICES += osmo-bsc-nat.service 12 | endif 13 | 14 | if BUILD_BSC 15 | SYSTEMD_SERVICES += osmo-bsc-sccplite.service 16 | endif 17 | 18 | systemdsystemunit_DATA = $(SYSTEMD_SERVICES) 19 | endif # HAVE_SYSTEMD 20 | -------------------------------------------------------------------------------- /openbsc/contrib/systemd/osmo-bsc-mgcp.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenBSC MGCP 3 | 4 | [Service] 5 | Type=simple 6 | Restart=always 7 | ExecStart=/usr/bin/osmo-bsc_mgcp -s -c /etc/osmocom/osmo-bsc-mgcp.cfg 8 | RestartSec=2 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /openbsc/contrib/systemd/osmo-bsc-nat.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Osmocom GSM BSC Multiplexer (NAT) 3 | 4 | [Service] 5 | Type=simple 6 | Restart=always 7 | ExecStart=/usr/bin/osmo-bsc_nat -c /etc/osmocom/osmo-bsc-nat.cfg 8 | RestartSec=2 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /openbsc/contrib/systemd/osmo-bsc-sccplite.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenBSC BSC (legacy, with SCCPLite) 3 | Wants=osmo-bsc-mgcp.service 4 | 5 | [Service] 6 | Type=simple 7 | Restart=always 8 | ExecStart=/usr/bin/osmo-bsc-sccplite -c /etc/osmocom/osmo-bsc-sccplite.cfg -s 9 | RestartSec=2 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /openbsc/contrib/systemd/osmo-nitb.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenBSC Network In the Box (NITB) 3 | 4 | [Service] 5 | Type=simple 6 | Restart=always 7 | ExecStart=/usr/bin/osmo-nitb -s -C -c /etc/osmocom/osmo-nitb.cfg -l /var/lib/osmocom/hlr.sqlite3 8 | RestartSec=2 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /openbsc/contrib/testconv/Makefile: -------------------------------------------------------------------------------- 1 | 2 | OBJS = testconv_main.o 3 | 4 | CC = gcc 5 | CFLAGS = -O0 -ggdb -Wall 6 | LDFLAGS = 7 | CPPFLAGS = -I../.. -I../../include $(shell pkg-config --cflags libosmocore) $(shell pkg-config --cflags libbcg729) 8 | LIBS = ../../src/libmgcp/libmgcp.a ../../src/libcommon/libcommon.a $(shell pkg-config --libs libosmocore) $(shell pkg-config --libs libbcg729) -lgsm -lrt 9 | 10 | testconv: $(OBJS) 11 | $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) 12 | 13 | testconv_main.o: testconv_main.c 14 | 15 | $(OBJS): 16 | $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 17 | -------------------------------------------------------------------------------- /openbsc/doc/BS11-OML.txt: -------------------------------------------------------------------------------- 1 | The Siemens BS-11 supports the following additional GSM 12.21 OML operations: 2 | 3 | 4 | CREATE OBJECT 5 | 6 | abis_om_fom_hdr.obj_class can be 7 | A3: 8 | A5: ALCO, BBSIG, CCLK, GPSU, LI, PA 9 | A8: EnvaBTSE 10 | A9: BPORT 11 | 12 | the abis_om_obj_inst.trx_nr field indicates the index of object, whereas the 13 | abis_om_fom_hdr.bts_nr indicates the type of the object. 14 | 15 | enum abis_bs11_objtype { 16 | BS11_OBJ_ALCO = 0x01, 17 | BS11_OBJ_BBSIG = 0x02, /* obj_class: 0,1 */ 18 | BS11_OBJ_TRX1 = 0x03, /* only DEACTIVATE TRX1 */ 19 | BS11_OBJ_CCLK = 0x04, 20 | BS11_OBJ_GPSU = 0x06, 21 | BS11_OBJ_LI = 0x07, 22 | BS11_OBJ_PA = 0x09, /* obj_class: 0, 1*/ 23 | }; 24 | 25 | In case of CREATE ENVABTSE, the abis_om_obj_inst.trx_nr indicates the EnvaBTSEx 26 | number. 27 | 28 | In case of A9 (CREAETE BPORT), the abis_om_obj_inst.bts_nr indicates which BPORT 29 | shall be used. 30 | 31 | 32 | -------------------------------------------------------------------------------- /openbsc/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = \ 2 | examples \ 3 | $(NULL) 4 | 5 | EXTRA_DIST = regen_doc.sh 6 | -------------------------------------------------------------------------------- /openbsc/doc/call-routing.txt: -------------------------------------------------------------------------------- 1 | Call routing in OpenBSC 2 | 3 | Flow of events: 4 | 5 | # MO call initiated by MS, CHANNEL RQD, IMMEDIATE ASSIGN 6 | # MS sends CC SETUP message, we assume already on TCH/H FACCH 7 | # OpenBSC does a subscriber lookup based on the target extension 8 | * If a subscriber is found: 9 | # send CALL PROCEEDING message to MO 10 | # page the MT subscriber and ask itI to ask for TCH/H 11 | # once paging completes, we have the TCH/H for the MT end 12 | # send SETUP to MT 13 | # receive CALL CONFIRMED from MT 14 | # set-up the TRAU mux mapping between the E1 subslots for both TCH/H 15 | # receive ALERTING from MT, route ALERTING to MO 16 | # receive CONNECT from MT, confirm to MT with CONNECT_ACK 17 | # send a CONNECT message to MO, receive CONNECT_ACK from MO 18 | * If subscriber is not found: 19 | # send RELEASE COMPLETE with apropriate cause to MO (1: unalloacated 3: no route) 20 | 21 | 22 | 23 | Thoughts about RR/MM: 24 | 25 | * we allocate RR/MM entities on demand, when we need them 26 | -------------------------------------------------------------------------------- /openbsc/doc/examples/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | OSMOCONF_FILES = \ 3 | osmo-nitb/sysmobts/osmo-nitb.cfg \ 4 | osmo-bsc_mgcp/osmo-bsc-mgcp.cfg 5 | 6 | if BUILD_NAT 7 | OSMOCONF_FILES += osmo-bsc_nat/osmo-bsc-nat.cfg 8 | endif 9 | 10 | if BUILD_BSC 11 | OSMOCONF_FILES += osmo-bsc-sccplite/osmo-bsc-sccplite.cfg 12 | endif 13 | 14 | osmoconfdir = $(sysconfdir)/osmocom 15 | osmoconf_DATA = $(OSMOCONF_FILES) 16 | 17 | EXTRA_DIST = $(OSMOCONF_FILES) 18 | 19 | CFG_FILES = find $(srcdir) -name '*.cfg*' | sed -e 's,^$(srcdir),,' 20 | 21 | dist-hook: 22 | for f in $$($(CFG_FILES)); do \ 23 | j="$(distdir)/$$f" && \ 24 | mkdir -p "$$(dirname $$j)" && \ 25 | $(INSTALL_DATA) $(srcdir)/$$f $$j; \ 26 | done 27 | 28 | install-data-hook: 29 | for f in $$($(CFG_FILES)); do \ 30 | j="$(DESTDIR)$(docdir)/examples/$$f" && \ 31 | mkdir -p "$$(dirname $$j)" && \ 32 | $(INSTALL_DATA) $(srcdir)/$$f $$j; \ 33 | done 34 | 35 | uninstall-hook: 36 | @$(PRE_UNINSTALL) 37 | for f in $$($(CFG_FILES)); do \ 38 | j="$(DESTDIR)$(docdir)/examples/$$f" && \ 39 | $(RM) $$j; \ 40 | done 41 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-bsc-sccplite/osmo-bsc-sccplite.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OsmoBSC (0.9.14+gitr1+3d331c0062bb0c9694dbd4d1eab7adc58138c3ae) configuration saved from vty 3 | !! 4 | password foo 5 | ! 6 | ! 7 | line vty 8 | no login 9 | ! 10 | e1_input 11 | e1_line 0 driver ipa 12 | network 13 | network country code 1 14 | mobile network code 1 15 | short name OsmoBSC 16 | long name OsmoBSC 17 | auth policy closed 18 | location updating reject cause 13 19 | encryption a5 0 20 | neci 1 21 | paging any use tch 0 22 | rrlp mode none 23 | mm info 1 24 | handover 0 25 | handover window rxlev averaging 10 26 | handover window rxqual averaging 1 27 | handover window rxlev neighbor averaging 10 28 | handover power budget interval 6 29 | handover power budget hysteresis 3 30 | handover maximum distance 9999 31 | subscriber-keep-in-ram 0 32 | bts 0 33 | type nanobts 34 | band DCS1800 35 | cell_identity 0 36 | location_area_code 1 37 | training_sequence_code 7 38 | base_station_id_code 63 39 | ms max power 15 40 | cell reselection hysteresis 4 41 | rxlev access min 0 42 | channel allocator ascending 43 | rach tx integer 9 44 | rach max transmission 7 45 | dtx uplink force 46 | dtx downlink 47 | ip.access unit_id 0 0 48 | oml ip.access stream_id 255 line 0 49 | neighbor-list mode manual-si5 50 | neighbor-list add arfcn 100 51 | neighbor-list add arfcn 200 52 | si5 neighbor-list add arfcn 10 53 | si5 neighbor-list add arfcn 20 54 | gprs mode none 55 | trx 0 56 | rf_locked 0 57 | arfcn 871 58 | nominal power 23 59 | max_power_red 20 60 | rsl e1 tei 0 61 | timeslot 0 62 | phys_chan_config CCCH+SDCCH4 63 | hopping enabled 0 64 | timeslot 1 65 | phys_chan_config TCH/F 66 | hopping enabled 0 67 | timeslot 2 68 | phys_chan_config TCH/F 69 | hopping enabled 0 70 | timeslot 3 71 | phys_chan_config TCH/F 72 | hopping enabled 0 73 | timeslot 4 74 | phys_chan_config TCH/F 75 | hopping enabled 0 76 | timeslot 5 77 | phys_chan_config TCH/F 78 | hopping enabled 0 79 | timeslot 6 80 | phys_chan_config TCH/F 81 | hopping enabled 0 82 | timeslot 7 83 | phys_chan_config TCH/F 84 | hopping enabled 0 85 | msc 86 | ip.access rtp-base 4000 87 | timeout-ping 20 88 | timeout-pong 5 89 | dest 192.168.100.11 6666 0 90 | access-list-name msc-list 91 | no access-list-name 92 | bsc 93 | no access-list-name 94 | access-list-name bsc-list 95 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-bsc_mgcp/osmo-bsc-mgcp.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! MGCP configuration hand edited 3 | ! ! 4 | password foo 5 | ! 6 | line vty 7 | no login 8 | ! 9 | mgcp 10 | !local ip 213.167.134.14 11 | !bts ip 172.16.252.43 12 | !bind ip 127.0.0.1 13 | bind port 2427 14 | rtp base 4000 15 | rtp force-ptime 20 16 | sdp audio payload number 98 17 | sdp audio payload name AMR/8000 18 | number endpoints 31 19 | no rtcp-omit 20 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-bsc_nat/black-list.cfg: -------------------------------------------------------------------------------- 1 | 678012512671923:6:6: 2 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-bsc_nat/bscs.config: -------------------------------------------------------------------------------- 1 | nat 2 | bsc 0 3 | token lol 4 | location_area_code 1234 5 | description bsc 6 | max-endpoints 32 7 | paging forbidden 0 8 | bsc 1 9 | token wat 10 | location_area_code 5678 11 | description bsc 12 | max-endpoints 32 13 | paging forbidden 0 14 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-bsc_nat/osmo-bsc-nat.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OsmoBSCNAT (0.12.0.266-2daa9) configuration saved from vty 3 | !! 4 | ! 5 | log stderr 6 | logging filter all 1 7 | logging color 1 8 | logging timestamp 0 9 | logging level all debug 10 | logging level rll notice 11 | logging level cc notice 12 | logging level mm notice 13 | logging level rr notice 14 | logging level rsl notice 15 | logging level nm info 16 | logging level mncc notice 17 | logging level pag notice 18 | logging level meas notice 19 | logging level sccp notice 20 | logging level msc notice 21 | logging level mgcp notice 22 | logging level ho notice 23 | logging level db notice 24 | logging level ref notice 25 | logging level gprs debug 26 | logging level ns info 27 | logging level bssgp debug 28 | logging level llc debug 29 | logging level sndcp debug 30 | logging level nat notice 31 | logging level ctrl notice 32 | logging level smpp debug 33 | logging level lglobal notice 34 | logging level llapd notice 35 | logging level linp notice 36 | logging level lmux notice 37 | logging level lmi notice 38 | logging level lmib notice 39 | logging level lsms notice 40 | ! 41 | line vty 42 | no login 43 | ! 44 | mgcp 45 | bind ip 0.0.0.0 46 | bind port 2427 47 | rtp bts-base 4000 48 | rtp net-base 16000 49 | rtp ip-dscp 0 50 | no rtcp-omit 51 | sdp audio-payload number 126 52 | sdp audio-payload name AMR/8000 53 | loop 0 54 | number endpoints 1 55 | call-agent ip 127.0.0.1 56 | rtp transcoder-base 0 57 | transcoder-remote-base 4000 58 | nat 59 | msc ip 127.0.0.1 60 | msc port 5000 61 | timeout auth 2 62 | timeout ping 20 63 | timeout pong 5 64 | ip-dscp 0 65 | bscs-config-file bscs.config 66 | access-list bla imsi-allow ^11$ 67 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OpenBSC configuration saved from vty 3 | ! ! 4 | password foo 5 | ! 6 | line vty 7 | no login 8 | ! 9 | e1_input 10 | e1_line 0 driver misdn 11 | network 12 | network country code 1 13 | mobile network code 1 14 | short name OpenBSC 15 | long name OpenBSC 16 | bts 0 17 | type bs11 18 | band GSM900 19 | cell_identity 1 20 | location_area_code 1 21 | training_sequence_code 7 22 | base_station_id_code 63 23 | oml e1 line 0 timeslot 1 sub-slot full 24 | oml e1 tei 25 25 | trx 0 26 | arfcn 121 27 | max_power_red 0 28 | rsl e1 line 0 timeslot 1 sub-slot full 29 | rsl e1 tei 1 30 | timeslot 0 31 | phys_chan_config CCCH+SDCCH4 32 | e1 line 0 timeslot 1 sub-slot full 33 | timeslot 1 34 | phys_chan_config SDCCH8 35 | e1 line 0 timeslot 2 sub-slot 1 36 | timeslot 2 37 | phys_chan_config TCH/F 38 | e1 line 0 timeslot 2 sub-slot 2 39 | timeslot 3 40 | phys_chan_config TCH/F 41 | e1 line 0 timeslot 2 sub-slot 3 42 | timeslot 4 43 | phys_chan_config TCH/F 44 | e1 line 0 timeslot 3 sub-slot 0 45 | timeslot 5 46 | phys_chan_config TCH/F 47 | e1 line 0 timeslot 3 sub-slot 1 48 | timeslot 6 49 | phys_chan_config TCH/F 50 | e1 line 0 timeslot 3 sub-slot 2 51 | timeslot 7 52 | phys_chan_config TCH/F 53 | e1 line 0 timeslot 3 sub-slot 3 54 | trx 1 55 | arfcn 123 56 | max_power_red 0 57 | rsl e1 line 0 timeslot 1 sub-slot full 58 | rsl e1 tei 2 59 | timeslot 0 60 | phys_chan_config TCH/F 61 | e1 line 0 timeslot 4 sub-slot 0 62 | timeslot 1 63 | phys_chan_config TCH/F 64 | e1 line 0 timeslot 4 sub-slot 1 65 | timeslot 2 66 | phys_chan_config TCH/F 67 | e1 line 0 timeslot 4 sub-slot 2 68 | timeslot 3 69 | phys_chan_config TCH/F 70 | e1 line 0 timeslot 4 sub-slot 3 71 | timeslot 4 72 | phys_chan_config TCH/F 73 | e1 line 0 timeslot 5 sub-slot 0 74 | timeslot 5 75 | phys_chan_config TCH/F 76 | e1 line 0 timeslot 5 sub-slot 1 77 | timeslot 6 78 | phys_chan_config TCH/F 79 | e1 line 0 timeslot 5 sub-slot 2 80 | timeslot 7 81 | phys_chan_config TCH/F 82 | e1 line 0 timeslot 5 sub-slot 3 83 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-nitb/bs11/osmo-nitb.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OpenBSC configuration saved from vty 3 | ! ! 4 | password foo 5 | ! 6 | line vty 7 | no login 8 | ! 9 | e1_input 10 | e1_line 0 driver misdn 11 | network 12 | network country code 1 13 | mobile network code 1 14 | short name OpenBSC 15 | long name OpenBSC 16 | bts 0 17 | type bs11 18 | band GSM900 19 | cell_identity 1 20 | location_area_code 1 21 | training_sequence_code 7 22 | base_station_id_code 63 23 | oml e1 line 0 timeslot 1 sub-slot full 24 | oml e1 tei 25 25 | trx 0 26 | arfcn 121 27 | max_power_red 0 28 | rsl e1 line 0 timeslot 1 sub-slot full 29 | rsl e1 tei 1 30 | timeslot 0 31 | phys_chan_config CCCH+SDCCH4 32 | e1 line 0 timeslot 1 sub-slot full 33 | timeslot 1 34 | phys_chan_config TCH/F 35 | e1 line 0 timeslot 2 sub-slot 1 36 | timeslot 2 37 | phys_chan_config TCH/F 38 | e1 line 0 timeslot 2 sub-slot 2 39 | timeslot 3 40 | phys_chan_config TCH/F 41 | e1 line 0 timeslot 2 sub-slot 3 42 | timeslot 4 43 | phys_chan_config TCH/F 44 | e1 line 0 timeslot 3 sub-slot 0 45 | timeslot 5 46 | phys_chan_config TCH/F 47 | e1 line 0 timeslot 3 sub-slot 1 48 | timeslot 6 49 | phys_chan_config TCH/F 50 | e1 line 0 timeslot 3 sub-slot 2 51 | timeslot 7 52 | phys_chan_config TCH/F 53 | e1 line 0 timeslot 3 sub-slot 3 54 | 55 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OpenBSC configuration saved from vty 3 | ! ! 4 | password foo 5 | ! 6 | line vty 7 | no login 8 | ! 9 | e1_input 10 | e1_line 0 driver ipa 11 | network 12 | network country code 1 13 | mobile network code 1 14 | short name OpenBSC 15 | long name OpenBSC 16 | auth policy closed 17 | location updating reject cause 13 18 | encryption a5 0 19 | neci 1 20 | rrlp mode none 21 | mm info 0 22 | handover 0 23 | handover window rxlev averaging 10 24 | handover window rxqual averaging 1 25 | handover window rxlev neighbor averaging 10 26 | handover power budget interval 6 27 | handover power budget hysteresis 3 28 | handover maximum distance 9999 29 | bts 0 30 | type nanobts 31 | band DCS1800 32 | cell_identity 0 33 | location_area_code 1 34 | training_sequence_code 7 35 | base_station_id_code 63 36 | ms max power 15 37 | cell reselection hysteresis 4 38 | rxlev access min 0 39 | channel allocator ascending 40 | rach tx integer 9 41 | rach max transmission 7 42 | ip.access unit_id 1800 0 43 | oml ip.access stream_id 255 line 0 44 | gprs mode none 45 | trx 0 46 | rf_locked 0 47 | arfcn 871 48 | nominal power 23 49 | max_power_red 0 50 | rsl e1 tei 0 51 | timeslot 0 52 | phys_chan_config CCCH+SDCCH4 53 | timeslot 1 54 | phys_chan_config SDCCH8 55 | timeslot 2 56 | phys_chan_config TCH/F 57 | timeslot 3 58 | phys_chan_config TCH/F 59 | timeslot 4 60 | phys_chan_config TCH/F 61 | timeslot 5 62 | phys_chan_config TCH/F 63 | timeslot 6 64 | phys_chan_config TCH/F 65 | timeslot 7 66 | phys_chan_config TCH/F 67 | trx 1 68 | rf_locked 0 69 | arfcn 873 70 | nominal power 23 71 | max_power_red 0 72 | rsl e1 tei 0 73 | timeslot 0 74 | phys_chan_config TCH/F 75 | timeslot 1 76 | phys_chan_config SDCCH8 77 | timeslot 2 78 | phys_chan_config TCH/F 79 | timeslot 3 80 | phys_chan_config TCH/F 81 | timeslot 4 82 | phys_chan_config TCH/F 83 | timeslot 5 84 | phys_chan_config TCH/F 85 | timeslot 6 86 | phys_chan_config TCH/F 87 | timeslot 7 88 | phys_chan_config TCH/F 89 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OpenBSC configuration saved from vty 3 | ! ! 4 | password foo 5 | ! 6 | line vty 7 | no login 8 | ! 9 | e1_input 10 | e1_line 0 driver ipa 11 | network 12 | network country code 1 13 | mobile network code 1 14 | short name OpenBSC 15 | long name OpenBSC 16 | auth policy closed 17 | location updating reject cause 13 18 | encryption a5 0 19 | neci 1 20 | rrlp mode none 21 | mm info 1 22 | handover 0 23 | handover window rxlev averaging 10 24 | handover window rxqual averaging 1 25 | handover window rxlev neighbor averaging 10 26 | handover power budget interval 6 27 | handover power budget hysteresis 3 28 | handover maximum distance 9999 29 | bts 0 30 | type nanobts 31 | band DCS1800 32 | cell_identity 0 33 | location_area_code 1 34 | training_sequence_code 7 35 | base_station_id_code 63 36 | ms max power 15 37 | cell reselection hysteresis 4 38 | rxlev access min 0 39 | channel allocator ascending 40 | rach tx integer 9 41 | rach max transmission 7 42 | ip.access unit_id 1801 0 43 | oml ip.access stream_id 255 line 0 44 | gprs mode none 45 | trx 0 46 | rf_locked 0 47 | arfcn 514 48 | nominal power 23 49 | max_power_red 20 50 | rsl e1 tei 0 51 | timeslot 0 52 | phys_chan_config CCCH+SDCCH4 53 | timeslot 1 54 | phys_chan_config SDCCH8 55 | timeslot 2 56 | phys_chan_config TCH/F 57 | timeslot 3 58 | phys_chan_config TCH/F 59 | timeslot 4 60 | phys_chan_config TCH/F 61 | timeslot 5 62 | phys_chan_config TCH/F 63 | timeslot 6 64 | phys_chan_config TCH/F 65 | timeslot 7 66 | phys_chan_config TCH/F 67 | -------------------------------------------------------------------------------- /openbsc/doc/examples/osmo-nitb/sysmobts/osmo-nitb.cfg: -------------------------------------------------------------------------------- 1 | ! 2 | ! OpenBSC configuration saved from vty 3 | ! ! 4 | password foo 5 | ! 6 | line vty 7 | no login 8 | ! 9 | e1_input 10 | e1_line 0 driver ipa 11 | network 12 | network country code 1 13 | mobile network code 1 14 | short name OpenBSC 15 | long name OpenBSC 16 | auth policy closed 17 | location updating reject cause 13 18 | encryption a5 0 19 | neci 1 20 | rrlp mode none 21 | mm info 1 22 | handover 0 23 | handover window rxlev averaging 10 24 | handover window rxqual averaging 1 25 | handover window rxlev neighbor averaging 10 26 | handover power budget interval 6 27 | handover power budget hysteresis 3 28 | handover maximum distance 9999 29 | bts 0 30 | type sysmobts 31 | band DCS1800 32 | cell_identity 0 33 | location_area_code 1 34 | training_sequence_code 7 35 | base_station_id_code 63 36 | ms max power 15 37 | cell reselection hysteresis 4 38 | rxlev access min 0 39 | channel allocator ascending 40 | rach tx integer 9 41 | rach max transmission 7 42 | ip.access unit_id 1801 0 43 | oml ip.access stream_id 255 line 0 44 | gprs mode none 45 | trx 0 46 | rf_locked 0 47 | arfcn 514 48 | nominal power 23 49 | max_power_red 20 50 | rsl e1 tei 0 51 | timeslot 0 52 | phys_chan_config CCCH+SDCCH4 53 | timeslot 1 54 | phys_chan_config SDCCH8 55 | timeslot 2 56 | phys_chan_config TCH/F 57 | timeslot 3 58 | phys_chan_config TCH/F 59 | timeslot 4 60 | phys_chan_config TCH/F 61 | timeslot 5 62 | phys_chan_config TCH/F 63 | timeslot 6 64 | phys_chan_config TCH/F 65 | timeslot 7 66 | phys_chan_config TCH/F 67 | -------------------------------------------------------------------------------- /openbsc/doc/gsm-hopping.txt: -------------------------------------------------------------------------------- 1 | according to GSM 05.02: 2 | 3 | general parameters from CCCH: 4 | * CA cell allocation of ARFCN's (System Information / BCCH) 5 | * FN: TDMA frame number (t1,t2,t3') in SCH 6 | 7 | specific parameters from channel assignment: 8 | * MA: mobile allocation, defines set of ARFCN's, up to 64 9 | * MAIO: index 10 | * HSN: hopping sequence generator number (0..64) 11 | 12 | 13 | hopping sequence generation (6.2.3): 14 | 15 | uint8_t rntable[114] = { 16 | 48, 98, 63, 1, 36, 95, 78, 102, 94, 73, 17 | 0, 64, 25, 81, 76, 59, 124, 23, 104, 100, 18 | 101, 47, 118, 85, 18, 56, 96, 86, 54, 2, 19 | 80, 34, 127, 13, 6, 89, 57, 103, 12, 74, 20 | 55, 111, 75, 38, 109, 71, 112, 29, 11, 88, 21 | 87, 19, 3, 68, 110, 26, 33, 31, 8, 45, 22 | 82, 58, 40, 107, 32, 5, 106, 92, 62, 67, 23 | 77, 108, 122, 37, 60, 66, 121, 42, 51, 126, 24 | 117, 114, 4, 90, 43, 52, 53, 113, 120, 72, 25 | 16, 49, 7, 79, 119, 61, 22, 84, 9, 97, 26 | 125, 99, 17, 123 27 | }; 28 | 29 | /* mai=0 represents lowest ARFCN in the MA */ 30 | 31 | 32 | uint8_t hopping_mai(uint8_t hsn, uint32_t fn, uint8_t maio, 33 | uint8_t t1, uint8_t t2, uint8_t t3_) 34 | { 35 | uint8_t mai; 36 | 37 | if (hsn == 0) /* cyclic hopping */ 38 | mai = (fn + maio) % n; 39 | else { 40 | uint32_t m, m_, t_, s; 41 | 42 | m = t2 + rntable[(hsn xor (t1 % 64)) + t3]; 43 | m_ = m % (2^NBIN); 44 | t_ = t3 % (2^NBIN); 45 | if (m_ < n then) 46 | s = m_; 47 | else 48 | s = (m_ + t_) % n; 49 | mai = (s + maio) % n; 50 | } 51 | 52 | return mai; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /openbsc/doc/oml-interface.txt: -------------------------------------------------------------------------------- 1 | oml interface design notes 2 | 3 | problems: 4 | 5 | * there is no way how to tag a command sent to the BTS, with the response 6 | having the same tag to identify the originator of the command 7 | * therefore, we can have e.g. both the BSC and the OML interface send a 8 | SET ATTRIBUTE message, where the responses would end up at the wrong 9 | query. 10 | * The BTS has 10s to ACK/NACK a command. We do not run any timers. 11 | 12 | the only possible solutions i can imagine: 13 | * have some kind of exclusive locking, where the OML interface gets blocked 14 | from the BSC and is exclusively assigned to the OML console until all commands 15 | of the OML console have terminated. This can either be done explicitly 16 | dynamically or on demand 17 | 18 | * use the OML interface synchronously, i.e. always wait for the response from 19 | the BTS before 20 | 21 | * unilateral / unsolicited messages need to be broadcasted to both the BSC and 22 | the OML console 23 | -------------------------------------------------------------------------------- /openbsc/doc/osmo-nitb-data_structures.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | net [label="gsm_network"] 3 | bts [label="gsm_bts"] 4 | trx [label="gsm_bts_trx"] 5 | ts [label="gsm_bts_trx_ts"] 6 | lchan [label="gsm_lchan"] 7 | sub [label="gsm_subscriber"] 8 | subcon [label="gsm_subscriber_conn"] 9 | sccpcon [label="osmo_bsc_sccp_con"] 10 | subgrp [label="gsm_subscriber_group"] 11 | 12 | net -> bts 13 | bts -> trx 14 | trx -> ts 15 | ts -> lchan 16 | 17 | lchan -> ts 18 | ts -> trx 19 | trx -> bts 20 | bts -> net 21 | 22 | lchan -> subcon 23 | 24 | subcon -> sub 25 | subcon -> sccpcon 26 | subcon -> lchan 27 | subcon -> lchan [label="ho_lchan"] 28 | subcon -> bts 29 | subcon -> lchan [label="secondary_lchan"] 30 | 31 | sub -> subgrp 32 | subgrp -> net 33 | } 34 | -------------------------------------------------------------------------------- /openbsc/doc/paging.txt: -------------------------------------------------------------------------------- 1 | 2 | GSM Paging implementation in OpenBSC 3 | 4 | == Code structure == 5 | 6 | The code is implemented in the libbsc/paging.c file. The external 7 | interface is documented/specified in the include/openbsc/paging.h 8 | header file. The code is used by the NITB and BSC application. 9 | 10 | 11 | == Implementation == 12 | 13 | Paging can be initiated in two ways. The standard way is to page by 14 | LAC. Each BTS has its own list/queue of outstanding paging operation. 15 | When a subscriber is paged one "struct paging_request" per BTS will 16 | be allocated and added to the tail of the list. The BTS is supposed 17 | to be configured to not repeat the paging. 18 | 19 | A paging_request will remain in the queue until a paging response or at 20 | the expiry of the T3113. Every 500 milliseconds a RSL paging command is 21 | send to the BTS. The 500 milliseconds is a throttling to not crash the 22 | ip.access nanoBTS. Once one paging_request has been handled it will be 23 | put at the end of the queue/list and the available slots for the BTS 24 | will be decreased. 25 | 26 | The available slots will be updated based on the paging load information 27 | element of the CCCH Load indication. If no paging slots are considered 28 | to be available and no load indication is sent a timer is started. The 29 | current timeout is 500 milliseconds and at the expiry of the timer the 30 | available slots will be set to 20. 31 | 32 | OpenBSC has the " paging free <-1-1024>" configuration option. In case 33 | there are less free channels than required no paging request will be 34 | sent to the BTS. Instead it will be attempted to send the paging request 35 | at the next timeout (500 milliseconds). 36 | 37 | == Limitation == 38 | 39 | The paging throughput could be higher but this has lead to crashes on the 40 | ip.access nanoBTS in the past. 41 | 42 | == Configuration == 43 | 44 | === ip.access nanoBTS === 45 | 46 | The current CCCH Load indication threshold is 10% and the period is 1 second. 47 | The code can be found inside the src/libbsc/bts_ipaccess_nanobts.c inside the 48 | nanobts_attr_bts array. 49 | -------------------------------------------------------------------------------- /openbsc/doc/regen_doc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | if [ -z "$DOCKER_PLAYGROUND" ]; then 4 | echo "You need to set DOCKER_PLAYGROUND" 5 | exit 1 6 | fi 7 | 8 | SCRIPT=$(realpath "$0") 9 | MANUAL_DIR=$(dirname "$SCRIPT")/../../manuals 10 | 11 | COMMIT=${COMMIT:-$(git log -1 --format=format:%H)} 12 | 13 | cd "$DOCKER_PLAYGROUND/scripts" || exit 1 14 | 15 | OSMO_NITB_BRANCH=$COMMIT ./regen_doc.sh osmo-nitb 4242 \ 16 | "$MANUAL_DIR/OsmoNITB/chapters/counters_generated.adoc" \ 17 | "$MANUAL_DIR/OsmoNITB/vty/nitb_vty_reference.xml" 18 | 19 | OSMO_BSCNAT_BRANCH=$COMMIT ./regen_doc.sh osmo-nitb 4244 \ 20 | "$MANUAL_DIR/OsmoBSCNAT/chapters/counters_generated.adoc" \ 21 | "$MANUAL_DIR/OsmoBSCNAT/vty/nat_vty_reference.xml" \ 22 | "osmo-bsc_nat -c /data/osmo-bsc-nat.cfg" 23 | -------------------------------------------------------------------------------- /openbsc/include/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = \ 2 | openbsc \ 3 | $(NULL) 4 | 5 | noinst_HEADERS = \ 6 | mISDNif.h \ 7 | compat_af_isdn.h \ 8 | $(NULL) 9 | -------------------------------------------------------------------------------- /openbsc/include/compat_af_isdn.h: -------------------------------------------------------------------------------- 1 | #ifdef MISDN_OLD_AF_COMPATIBILITY 2 | #undef AF_ISDN 3 | #undef PF_ISDN 4 | 5 | extern int AF_ISDN; 6 | #define PF_ISDN AF_ISDN 7 | 8 | int AF_ISDN; 9 | 10 | #endif 11 | 12 | extern void init_af_isdn(void); 13 | 14 | #ifdef AF_COMPATIBILITY_FUNC 15 | #ifdef MISDN_OLD_AF_COMPATIBILITY 16 | void init_af_isdn(void) 17 | { 18 | int s; 19 | 20 | /* test for new value */ 21 | AF_ISDN = 34; 22 | s = socket(AF_ISDN, SOCK_RAW, ISDN_P_BASE); 23 | if (s >= 0) { 24 | close(s); 25 | return; 26 | } 27 | AF_ISDN = 27; 28 | s = socket(AF_ISDN, SOCK_RAW, ISDN_P_BASE); 29 | if (s >= 0) { 30 | close(s); 31 | return; 32 | } 33 | } 34 | #else 35 | void init_af_isdn(void) 36 | { 37 | } 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = \ 2 | abis_nm.h \ 3 | abis_om2000.h \ 4 | abis_rsl.h \ 5 | acc_ramp.h \ 6 | arfcn_range_encode.h \ 7 | auth.h \ 8 | bsc_msc.h \ 9 | bsc_msg_filter.h \ 10 | bsc_nat.h \ 11 | bsc_nat_callstats.h \ 12 | bsc_nat_sccp.h \ 13 | bsc_rll.h \ 14 | bsc_subscriber.h \ 15 | bss.h \ 16 | bts_ipaccess_nanobts_omlattr.h \ 17 | chan_alloc.h \ 18 | common_bsc.h \ 19 | common_cs.h \ 20 | ctrl.h \ 21 | db.h \ 22 | debug.h \ 23 | e1_config.h \ 24 | gsm_04_08.h \ 25 | gsm_04_11.h \ 26 | gsm_04_14.h \ 27 | gsm_04_80.h \ 28 | gsm_data.h \ 29 | gsm_data_shared.h \ 30 | gsm_subscriber.h \ 31 | gsup_client.h \ 32 | handover.h \ 33 | handover_decision.h \ 34 | ipaccess.h \ 35 | meas_feed.h \ 36 | meas_rep.h \ 37 | mgcp.h \ 38 | mgcp_internal.h \ 39 | mgcp_transcode.h \ 40 | misdn.h \ 41 | mncc.h \ 42 | mncc_int.h \ 43 | nat_rewrite_trie.h \ 44 | network_listen.h \ 45 | oap_client.h \ 46 | openbscdefines.h \ 47 | osmo_bsc.h \ 48 | osmo_bsc_grace.h \ 49 | osmo_bsc_rf.h \ 50 | osmo_msc.h \ 51 | bsc_msc_data.h \ 52 | osmux.h \ 53 | paging.h \ 54 | pcu_if.h \ 55 | pcuif_proto.h \ 56 | rest_octets.h \ 57 | rrlp.h \ 58 | rs232.h \ 59 | rtp_proxy.h \ 60 | signal.h \ 61 | silent_call.h \ 62 | smpp.h \ 63 | sms_queue.h \ 64 | socket.h \ 65 | system_information.h \ 66 | token_auth.h \ 67 | transaction.h \ 68 | trau_mux.h \ 69 | trau_upqueue.h \ 70 | ussd.h \ 71 | vty.h \ 72 | $(NULL) 73 | 74 | openbsc_HEADERS = \ 75 | bsc_api.h \ 76 | gsm_04_08.h \ 77 | meas_rep.h \ 78 | $(NULL) 79 | 80 | # DO NOT add a newline and '$(NULL)' to this line. That would add a trailing 81 | # space to the directory installed: $prefix/include/'openbsc ' 82 | openbscdir = $(includedir)/openbsc 83 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/arfcn_range_encode.h: -------------------------------------------------------------------------------- 1 | #ifndef ARFCN_RANGE_ENCODE_H 2 | #define ARFCN_RANGE_ENCODE_H 3 | 4 | #include 5 | 6 | enum gsm48_range { 7 | ARFCN_RANGE_INVALID = -1, 8 | ARFCN_RANGE_128 = 127, 9 | ARFCN_RANGE_256 = 255, 10 | ARFCN_RANGE_512 = 511, 11 | ARFCN_RANGE_1024 = 1023, 12 | }; 13 | 14 | #define RANGE_ENC_MAX_ARFCNS 29 15 | 16 | int range_enc_determine_range(const int *arfcns, int size, int *f0_out); 17 | int range_enc_arfcns(enum gsm48_range rng, const int *arfcns, int sze, int *out, int idx); 18 | int range_enc_find_index(enum gsm48_range rng, const int *arfcns, int size); 19 | int range_enc_filter_arfcns(int *arfcns, const int sze, const int f0, int *f0_included); 20 | 21 | int range_enc_range128(uint8_t *chan_list, int f0, int *w); 22 | int range_enc_range256(uint8_t *chan_list, int f0, int *w); 23 | int range_enc_range512(uint8_t *chan_list, int f0, int *w); 24 | int range_enc_range1024(uint8_t *chan_list, int f0, int f0_incl, int *w); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/auth.h: -------------------------------------------------------------------------------- 1 | #ifndef _AUTH_H 2 | #define _AUTH_H 3 | 4 | #include 5 | 6 | struct gsm_auth_tuple; 7 | struct gsm_subscriber; 8 | 9 | enum auth_action { 10 | AUTH_ERROR = -1, /* Internal error */ 11 | AUTH_NOT_AVAIL = 0, /* No auth tuple available */ 12 | AUTH_DO_AUTH_THEN_CIPH = 1, /* Firsth authenticate, then cipher */ 13 | AUTH_DO_CIPH = 2, /* Only ciphering */ 14 | AUTH_DO_AUTH = 3, /* Only authentication, no ciphering */ 15 | }; 16 | 17 | extern const struct value_string auth_action_names[]; 18 | static inline const char *auth_action_str(enum auth_action a) 19 | { 20 | return get_value_string(auth_action_names, a); 21 | } 22 | 23 | int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple, 24 | struct gsm_subscriber *subscr, int key_seq); 25 | 26 | #endif /* _AUTH_H */ 27 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bsc_api.h: -------------------------------------------------------------------------------- 1 | /* GSM 08.08 like API for OpenBSC */ 2 | 3 | #ifndef OPENBSC_BSC_API_H 4 | #define OPENBSC_BSC_API_H 5 | 6 | #include "gsm_data.h" 7 | 8 | #define BSC_API_CONN_POL_ACCEPT 0 9 | #define BSC_API_CONN_POL_REJECT 1 10 | 11 | struct bsc_api { 12 | /*! \brief BTS->MSC: tell MSC a SAPI was not established */ 13 | void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci); 14 | /*! \brief MS->MSC: Tell MSC that ciphering has been enabled */ 15 | void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn, 16 | struct msgb *msg, uint8_t chosen_encr); 17 | /*! \brief MS->MSC: New MM context with L3 payload */ 18 | int (*compl_l3)(struct gsm_subscriber_connection *conn, 19 | struct msgb *msg, uint16_t chosen_channel); 20 | /*! \brief MS->BSC/MSC: Um L3 message */ 21 | void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id, 22 | struct msgb *msg); 23 | /*! \brief BSC->MSC: Assignment of lchan successful */ 24 | void (*assign_compl)(struct gsm_subscriber_connection *conn, 25 | uint8_t rr_cause, uint8_t chosen_channel, 26 | uint8_t encr_alg_id, uint8_t speech_mode); 27 | /*! \brief BSC->MSC: Assignment of lchan failed */ 28 | void (*assign_fail)(struct gsm_subscriber_connection *conn, 29 | uint8_t cause, uint8_t *rr_cause); 30 | /*! \brief BSC->MSC: RR conn has been cleared */ 31 | int (*clear_request)(struct gsm_subscriber_connection *conn, 32 | uint32_t cause); 33 | /*! \brief BSC->MSC: Classmark Update */ 34 | void (*classmark_chg)(struct gsm_subscriber_connection *conn, 35 | const uint8_t *cm2, uint8_t cm2_len, 36 | const uint8_t *cm3, uint8_t cm3_len); 37 | 38 | /** 39 | * Configure the multirate setting on this channel. If it is 40 | * not implemented AMR5.9 will be used. 41 | */ 42 | void (*mr_config)(struct gsm_subscriber_connection *conn, 43 | struct gsm_lchan *lchan, int full_rate); 44 | }; 45 | 46 | int bsc_api_init(struct gsm_network *network, struct bsc_api *api); 47 | int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id, int allow_sacch); 48 | int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate); 49 | int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, 50 | const uint8_t *key, int len, int include_imeisv); 51 | int gsm0808_page(struct gsm_bts *bts, unsigned int page_group, 52 | unsigned int mi_len, uint8_t *mi, int chan_type); 53 | int gsm0808_clear(struct gsm_subscriber_connection *conn); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bsc_msc.h: -------------------------------------------------------------------------------- 1 | /* Routines to talk to the MSC using the IPA Protocol */ 2 | /* 3 | * (C) 2010 by Holger Hans Peter Freyther 4 | * (C) 2010 by On-Waves 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as published by 9 | * the Free Software Foundation; either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | * 20 | */ 21 | 22 | #ifndef BSC_MSC_H 23 | #define BSC_MSC_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | struct bsc_msc_dest { 31 | struct llist_head list; 32 | 33 | char *ip; 34 | int port; 35 | int dscp; 36 | }; 37 | 38 | 39 | struct bsc_msc_connection { 40 | struct osmo_wqueue write_queue; 41 | int is_connected; 42 | int is_authenticated; 43 | int first_contact; 44 | 45 | struct llist_head *dests; 46 | 47 | const char *name; 48 | 49 | void (*connection_loss) (struct bsc_msc_connection *); 50 | void (*connected) (struct bsc_msc_connection *); 51 | struct osmo_timer_list reconnect_timer; 52 | struct osmo_timer_list timeout_timer; 53 | 54 | struct msgb *pending_msg; 55 | }; 56 | 57 | struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest); 58 | int bsc_msc_connect(struct bsc_msc_connection *); 59 | void bsc_msc_schedule_connect(struct bsc_msc_connection *); 60 | 61 | void bsc_msc_lost(struct bsc_msc_connection *); 62 | 63 | struct msgb *bsc_msc_id_get_resp(int fixed, const char *token, const uint8_t *res, int len); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bsc_nat_callstats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010-2012 by Holger Hans Peter Freyther 3 | * (C) 2010-2012 by On-Waves 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef BSC_NAT_CALLSTATS_H 22 | #define BSC_NAT_CALLSTATS_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | struct bsc_nat_call_stats { 29 | struct llist_head entry; 30 | 31 | struct sccp_source_reference remote_ref; 32 | struct sccp_source_reference src_ref; /* as seen by the MSC */ 33 | 34 | /* mgcp options */ 35 | uint32_t ci; 36 | int bts_rtp_port; 37 | int net_rtp_port; 38 | struct in_addr bts_addr; 39 | struct in_addr net_addr; 40 | 41 | 42 | /* as witnessed by the NAT */ 43 | uint32_t net_ps; 44 | uint32_t net_os; 45 | uint32_t bts_pr; 46 | uint32_t bts_or; 47 | uint32_t bts_expected; 48 | uint32_t bts_jitter; 49 | int bts_loss; 50 | 51 | uint32_t trans_id; 52 | int msc_endpoint; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bsc_rll.h: -------------------------------------------------------------------------------- 1 | #ifndef _BSC_RLL_H 2 | #define _BSC_RLL_H 3 | 4 | #include 5 | 6 | enum bsc_rllr_ind { 7 | BSC_RLLR_IND_EST_CONF, 8 | BSC_RLLR_IND_REL_IND, 9 | BSC_RLLR_IND_ERR_IND, 10 | BSC_RLLR_IND_TIMEOUT, 11 | }; 12 | 13 | int rll_establish(struct gsm_lchan *lchan, uint8_t link_id, 14 | void (*cb)(struct gsm_lchan *, uint8_t, void *, 15 | enum bsc_rllr_ind), 16 | void *data); 17 | void rll_indication(struct gsm_lchan *lchan, uint8_t link_id, uint8_t type); 18 | 19 | #endif /* _BSC_RLL_H */ 20 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bsc_subscriber.h: -------------------------------------------------------------------------------- 1 | /* GSM subscriber details for use in BSC land */ 2 | 3 | #pragma once 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | struct log_target; 11 | 12 | struct bsc_subscr { 13 | struct llist_head entry; 14 | int use_count; 15 | 16 | char imsi[GSM23003_IMSI_MAX_DIGITS+1]; 17 | uint32_t tmsi; 18 | uint16_t lac; 19 | }; 20 | 21 | const char *bsc_subscr_name(struct bsc_subscr *bsub); 22 | 23 | struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, 24 | const char *imsi); 25 | struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list, 26 | uint32_t tmsi); 27 | 28 | struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list, 29 | const char *imsi); 30 | struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, 31 | uint32_t tmsi); 32 | 33 | void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi); 34 | 35 | struct bsc_subscr *_bsc_subscr_get(struct bsc_subscr *bsub, 36 | const char *file, int line); 37 | struct bsc_subscr *_bsc_subscr_put(struct bsc_subscr *bsub, 38 | const char *file, int line); 39 | #define bsc_subscr_get(bsub) _bsc_subscr_get(bsub, __BASE_FILE__, __LINE__) 40 | #define bsc_subscr_put(bsub) _bsc_subscr_put(bsub, __BASE_FILE__, __LINE__) 41 | 42 | void log_set_filter_bsc_subscr(struct log_target *target, 43 | struct bsc_subscr *bsub); 44 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bss.h: -------------------------------------------------------------------------------- 1 | #ifndef _BSS_H_ 2 | #define _BSS_H_ 3 | 4 | #include 5 | 6 | struct msgb; 7 | 8 | /* start and stop network */ 9 | extern int bsc_network_alloc(mncc_recv_cb_t mncc_recv); 10 | extern int bsc_network_configure(const char *cfg_file); 11 | extern int bsc_shutdown_net(struct gsm_network *net); 12 | 13 | /* register all supported BTS */ 14 | extern int bts_init(void); 15 | extern int bts_model_bs11_init(void); 16 | extern int bts_model_rbs2k_init(void); 17 | extern int bts_model_nanobts_init(void); 18 | extern int bts_model_nokia_site_init(void); 19 | extern int bts_model_sysmobts_init(void); 20 | #endif 21 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/bts_ipaccess_nanobts_omlattr.h: -------------------------------------------------------------------------------- 1 | /* OML attribute table generator for ipaccess nanobts */ 2 | 3 | /* (C) 2016 by sysmocom s.f.m.c. GmbH 4 | * All Rights Reserved 5 | * 6 | * Author: Philipp Maier 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU Affero General Public License as published by 10 | * the Free Software Foundation; either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Affero General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Affero General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts); 28 | struct msgb *nanobts_attr_nse_get(struct gsm_bts *bts); 29 | struct msgb *nanobts_attr_cell_get(struct gsm_bts *bts); 30 | struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts); 31 | struct msgb *nanobts_attr_radio_get(struct gsm_bts *bts, 32 | struct gsm_bts_trx *trx); 33 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/chan_alloc.h: -------------------------------------------------------------------------------- 1 | /* Management functions to allocate/release struct gsm_lchan */ 2 | /* (C) 2008 by Harald Welte 3 | * (C) 2009 by Holger Hans Peter Freyther 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | #ifndef _CHAN_ALLOC_H 21 | #define _CHAN_ALLOC_H 22 | 23 | #include "gsm_data.h" 24 | 25 | struct gsm_subscriber_connection; 26 | 27 | /* Find an allocated channel for a specified subscriber */ 28 | struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr); 29 | 30 | /* Allocate a logical channel (SDCCH, TCH, ...) */ 31 | struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger); 32 | 33 | /* Free a logical channel (SDCCH, TCH, ...) */ 34 | void lchan_free(struct gsm_lchan *lchan); 35 | void lchan_reset(struct gsm_lchan *lchan); 36 | 37 | /* Release the given lchan */ 38 | int lchan_release(struct gsm_lchan *lchan, int sacch_deact, enum rsl_rel_mode release_mode); 39 | 40 | struct pchan_load { 41 | struct load_counter pchan[_GSM_PCHAN_MAX]; 42 | }; 43 | 44 | void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts); 45 | void network_chan_load(struct pchan_load *pl, struct gsm_network *net); 46 | void bts_update_t3122_chan_load(struct gsm_bts *bts); 47 | 48 | int trx_is_usable(struct gsm_bts_trx *trx); 49 | 50 | #endif /* _CHAN_ALLOC_H */ 51 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/common_bsc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct gsm_network *bsc_network_init(void *ctx, 7 | uint16_t country_code, 8 | uint16_t network_code, 9 | mncc_recv_cb_t mncc_recv); 10 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/common_cs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct msgb; 6 | struct gsm_network; 7 | 8 | typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *); 9 | 10 | struct vty; 11 | 12 | struct gsm_network *gsm_network_init(void *ctx, 13 | uint16_t country_code, 14 | uint16_t network_code, 15 | mncc_recv_cb_t mncc_recv); 16 | 17 | int common_cs_vty_init(struct gsm_network *network, 18 | int (* config_write_net )(struct vty *)); 19 | struct gsm_network *gsmnet_from_vty(struct vty *v); 20 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/ctrl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct ctrl_handle *bsc_controlif_setup(struct gsm_network *net, 4 | const char *bind_addr, uint16_t port); 5 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #define DEBUG 7 | #include 8 | 9 | /* Debug Areas of the code */ 10 | enum { 11 | DRLL, 12 | DCC, 13 | DMM, 14 | DRR, 15 | DRSL, 16 | DNM, 17 | DMNCC, 18 | DPAG, 19 | DMEAS, 20 | DSCCP, 21 | DMSC, 22 | DMGCP, 23 | DHO, 24 | DDB, 25 | DREF, 26 | DGPRS, 27 | DNS, 28 | DBSSGP, 29 | DLLC, 30 | DSNDCP, 31 | DSLHC, 32 | DNAT, 33 | DCTRL, 34 | DSMPP, 35 | DFILTER, 36 | DGTPHUB, 37 | DRANAP, 38 | DSUA, 39 | DV42BIS, 40 | DPCU, 41 | Debug_LastEntry, 42 | }; 43 | 44 | struct gsm_subscriber; 45 | 46 | void log_set_filter_vlr_subscr(struct log_target *target, 47 | struct gsm_subscriber *vlr_subscr); 48 | 49 | extern const struct log_info log_info; 50 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/e1_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _E1_CONFIG_H 2 | #define _E1_CONFIG_H 3 | 4 | #include 5 | 6 | int e1_reconfig_ts(struct gsm_bts_trx_ts *ts); 7 | int e1_reconfig_trx(struct gsm_bts_trx *trx); 8 | int e1_reconfig_bts(struct gsm_bts *bts); 9 | 10 | #endif /* _E1_CONFIG_H */ 11 | 12 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/gsm_04_11.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSM_04_11_H 2 | #define _GSM_04_11_H 3 | 4 | #include 5 | 6 | #define UM_SAPI_SMS 3 /* See GSM 04.05/04.06 */ 7 | 8 | /* SMS deliver PDU */ 9 | struct sms_deliver { 10 | uint8_t mti:2; /* message type indicator */ 11 | uint8_t mms:1; /* more messages to send */ 12 | uint8_t rp:1; /* reply path */ 13 | uint8_t udhi:1; /* user data header indicator */ 14 | uint8_t sri:1; /* status report indication */ 15 | uint8_t *orig_addr; /* originating address */ 16 | uint8_t pid; /* protocol identifier */ 17 | uint8_t dcs; /* data coding scheme */ 18 | /* service centre time stamp */ 19 | uint8_t ud_len; /* user data length */ 20 | uint8_t *user_data; /* user data */ 21 | 22 | uint8_t msg_ref; /* message reference */ 23 | uint8_t *smsc; 24 | }; 25 | 26 | struct msgb; 27 | 28 | int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn, struct msgb *msg); 29 | 30 | struct gsm_sms *sms_alloc(void); 31 | void sms_free(struct gsm_sms *sms); 32 | struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, struct gsm_subscriber *sender, int dcs, const char *text); 33 | 34 | void _gsm411_sms_trans_free(struct gsm_trans *trans); 35 | int gsm411_send_sms_subscr(struct gsm_subscriber *subscr, 36 | struct gsm_sms *sms); 37 | int gsm411_send_sms(struct gsm_subscriber_connection *conn, 38 | struct gsm_sms *sms); 39 | void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn); 40 | 41 | uint8_t sms_next_rp_msg_ref(uint8_t *next_rp_ref); 42 | 43 | int gsm411_send_rp_ack(struct gsm_trans *trans, uint8_t msg_ref); 44 | int gsm411_send_rp_error(struct gsm_trans *trans, uint8_t msg_ref, 45 | uint8_t cause); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/gsm_04_14.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | int gsm0414_tx_close_tch_loop_cmd(struct gsm_subscriber_connection *conn, 6 | enum gsm414_tch_loop_mode loop_mode); 7 | int gsm0414_tx_open_loop_cmd(struct gsm_subscriber_connection *conn); 8 | int gsm0414_tx_act_emmi_cmd(struct gsm_subscriber_connection *conn); 9 | int gsm0414_tx_test_interface(struct gsm_subscriber_connection *conn, 10 | uint8_t tested_devs); 11 | int gsm0414_tx_reset_ms_pos_store(struct gsm_subscriber_connection *conn, 12 | uint8_t technology); 13 | 14 | int gsm0414_rcv_test(struct gsm_subscriber_connection *conn, 15 | struct msgb *msg); 16 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/gsm_04_80.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct gsm_subscriber_connection; 8 | 9 | int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn, 10 | const struct msgb *in_msg, const char* response_text, 11 | const struct ss_request *req); 12 | int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn, 13 | const struct msgb *msg, 14 | const struct ss_request *request); 15 | 16 | int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, 17 | const char *text); 18 | int msc_send_ussd_release_complete(struct gsm_subscriber_connection *conn); 19 | 20 | int bsc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, 21 | const char *text); 22 | int bsc_send_ussd_release_complete(struct gsm_subscriber_connection *conn); 23 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/gsup_client.h: -------------------------------------------------------------------------------- 1 | /* GPRS Subscriber Update Protocol client */ 2 | 3 | /* (C) 2014 by Sysmocom s.f.m.c. GmbH 4 | * All Rights Reserved 5 | * 6 | * Author: Jacob Erlbeck 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU Affero General Public License as published by 10 | * the Free Software Foundation; either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Affero General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Affero General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #define GSUP_CLIENT_RECONNECT_INTERVAL 10 29 | #define GSUP_CLIENT_PING_INTERVAL 20 30 | 31 | struct msgb; 32 | struct ipa_client_conn; 33 | struct gsup_client; 34 | 35 | /* Expects message in msg->l2h */ 36 | typedef int (*gsup_client_read_cb_t)(struct gsup_client *gsupc, 37 | struct msgb *msg); 38 | 39 | struct gsup_client { 40 | struct ipa_client_conn *link; 41 | gsup_client_read_cb_t read_cb; 42 | void *data; 43 | 44 | struct oap_client_state oap_state; 45 | 46 | struct osmo_timer_list ping_timer; 47 | struct osmo_timer_list connect_timer; 48 | int is_connected; 49 | int got_ipa_pong; 50 | }; 51 | 52 | struct gsup_client *gsup_client_create(const char *ip_addr, 53 | unsigned int tcp_port, 54 | gsup_client_read_cb_t read_cb, 55 | struct oap_client_config *oap_config); 56 | 57 | void gsup_client_destroy(struct gsup_client *gsupc); 58 | int gsup_client_send(struct gsup_client *gsupc, struct msgb *msg); 59 | struct msgb *gsup_client_msgb_alloc(void); 60 | 61 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/handover.h: -------------------------------------------------------------------------------- 1 | #ifndef _HANDOVER_H 2 | #define _HANDOVER_H 3 | 4 | struct gsm_subscriber_connection; 5 | 6 | int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts); 7 | 8 | /* clear any operation for this connection */ 9 | void bsc_clear_handover(struct gsm_subscriber_connection *conn, int free_lchan); 10 | 11 | /* Return the old lchan or NULL. This is meant for audio handling */ 12 | struct gsm_lchan *bsc_handover_pending(struct gsm_lchan *new_lchan); 13 | 14 | #endif /* _HANDOVER_H */ 15 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/handover_decision.h: -------------------------------------------------------------------------------- 1 | #ifndef _HANDOVER_DECISION_H 2 | #define _HANDOVER_DECISION_H 3 | 4 | void on_dso_load_ho_dec(void); 5 | 6 | #endif /* _HANDOVER_DECISION_H */ 7 | 8 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/ipaccess.h: -------------------------------------------------------------------------------- 1 | #ifndef _IPACCESS_H 2 | #define _IPACCESS_H 3 | 4 | #include 5 | #include "gsm_subscriber.h" 6 | #include 7 | #include 8 | #include 9 | 10 | struct ipac_msgt_sccp_state { 11 | uint8_t src_ref[3]; 12 | uint8_t dst_ref[3]; 13 | uint8_t trans_id; 14 | uint8_t invoke_id; 15 | char imsi[GSM23003_IMSI_MAX_DIGITS+1]; 16 | uint8_t data[0]; 17 | } __attribute__((packed)); 18 | 19 | /* 20 | * @add_remove 0 for remove, 1 for add, 3 to asK 21 | * @nr_lacs Number of extra lacs inside this package 22 | * @lac One lac entry 23 | */ 24 | struct ipac_ext_lac_cmd { 25 | uint8_t add_remove; 26 | uint8_t nr_extra_lacs; 27 | uint16_t lac; 28 | uint8_t data[0]; 29 | } __attribute__((packed)); 30 | 31 | void ipaccess_drop_oml(struct gsm_bts *bts); 32 | void ipaccess_drop_oml_deferred(struct gsm_bts *bts); 33 | void ipaccess_drop_rsl(struct gsm_bts_trx *trx); 34 | 35 | struct sdp_header_item { 36 | struct sdp_header_entry header_entry; 37 | struct llist_head entry; 38 | off_t absolute_offset; 39 | }; 40 | 41 | struct sdp_header { 42 | struct sdp_firmware firmware_info; 43 | 44 | /* for more_magic a list of sdp_header_entry_list */ 45 | struct llist_head header_list; 46 | 47 | /* the entry of the sdp_header */ 48 | struct llist_head entry; 49 | }; 50 | 51 | int ipaccess_analyze_file(int fd, const unsigned int st_size, const unsigned base_offset, struct llist_head *list); 52 | 53 | #endif /* _IPACCESS_H */ 54 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/meas_feed.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPENBSC_MEAS_FEED_H 2 | #define _OPENBSC_MEAS_FEED_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | struct meas_feed_hdr { 9 | uint8_t msg_type; 10 | uint8_t reserved; 11 | uint16_t version; 12 | }; 13 | 14 | struct meas_feed_meas { 15 | struct meas_feed_hdr hdr; 16 | char imsi[15+1]; 17 | char name[31+1]; 18 | char scenario[31+1]; 19 | struct gsm_meas_rep mr; 20 | /* The logical channel type, enum gsm_chan_t */ 21 | uint8_t lchan_type; 22 | /* The physical channel type, enum gsm_phys_chan_config */ 23 | uint8_t pchan_type; 24 | /* number of ths BTS in network */ 25 | uint8_t bts_nr; 26 | /* number of this TRX in the BTS */ 27 | uint8_t trx_nr; 28 | /* number of this timeslot at the TRX */ 29 | uint8_t ts_nr; 30 | /* The logical subslot number in the TS */ 31 | uint8_t ss_nr; 32 | }; 33 | 34 | enum meas_feed_msgtype { 35 | MEAS_FEED_MEAS = 0, 36 | }; 37 | 38 | #define MEAS_FEED_VERSION 1 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/meas_rep.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEAS_REP_H 2 | #define _MEAS_REP_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #define MRC_F_PROCESSED 0x0001 9 | 10 | /* extracted from a L3 measurement report IE */ 11 | struct gsm_meas_rep_cell { 12 | uint8_t rxlev; 13 | uint8_t bsic; 14 | uint8_t neigh_idx; 15 | uint16_t arfcn; 16 | unsigned int flags; 17 | }; 18 | 19 | #define MEAS_REP_F_UL_DTX 0x01 20 | #define MEAS_REP_F_DL_VALID 0x02 21 | #define MEAS_REP_F_BA1 0x04 22 | #define MEAS_REP_F_DL_DTX 0x08 23 | #define MEAS_REP_F_MS_TO 0x10 24 | #define MEAS_REP_F_MS_L1 0x20 25 | #define MEAS_REP_F_FPC 0x40 26 | 27 | /* parsed uplink and downlink measurement result */ 28 | struct gsm_meas_rep { 29 | /* back-pointer to the logical channel */ 30 | struct gsm_lchan *lchan; 31 | 32 | /* number of the measurement report */ 33 | uint8_t nr; 34 | /* flags, see MEAS_REP_F_* */ 35 | unsigned int flags; 36 | 37 | /* uplink and downlink rxlev, rxqual; full and sub */ 38 | struct gsm_meas_rep_unidir ul; 39 | struct gsm_meas_rep_unidir dl; 40 | 41 | uint8_t bs_power; 42 | /* according to 3GPP TS 48.058 § MS Timing Offset [-63; 192] */ 43 | int16_t ms_timing_offset; 44 | struct { 45 | int8_t pwr; /* MS power in dBm */ 46 | uint8_t ta; /* MS timing advance */ 47 | } ms_l1; 48 | 49 | /* neighbor measurement reports for up to 6 cells */ 50 | int num_cell; 51 | struct gsm_meas_rep_cell cell[6]; 52 | }; 53 | 54 | /* obtain an average over the last 'num' fields in the meas reps */ 55 | int get_meas_rep_avg(const struct gsm_lchan *lchan, 56 | enum meas_rep_field field, unsigned int num); 57 | 58 | /* Check if N out of M last values for FIELD are >= bd */ 59 | int meas_rep_n_out_of_m_be(const struct gsm_lchan *lchan, 60 | enum meas_rep_field field, 61 | unsigned int n, unsigned int m, int be); 62 | 63 | unsigned int calc_initial_idx(unsigned int array_size, 64 | unsigned int meas_rep_idx, 65 | unsigned int num_values); 66 | 67 | #endif /* _MEAS_REP_H */ 68 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/mgcp_transcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2014 by On-Waves 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | */ 19 | #ifndef OPENBSC_MGCP_TRANSCODE_H 20 | #define OPENBSC_MGCP_TRANSCODE_H 21 | 22 | #include "bscconfig.h" 23 | 24 | #if HAVE_GSM_H 25 | #include 26 | #elif HAVE_GSM_GSM_H 27 | #include 28 | #endif 29 | #ifdef HAVE_BCG729 30 | #include 31 | #include 32 | #endif 33 | 34 | enum audio_format { 35 | AF_INVALID, 36 | AF_S16, 37 | AF_L16, 38 | AF_GSM, 39 | AF_G729, 40 | AF_PCMA, 41 | AF_PCMU 42 | }; 43 | 44 | 45 | struct mgcp_process_rtp_state { 46 | /* decoding */ 47 | enum audio_format src_fmt; 48 | union { 49 | gsm gsm_handle; 50 | #ifdef HAVE_BCG729 51 | bcg729DecoderChannelContextStruct *g729_dec; 52 | #endif 53 | } src; 54 | size_t src_frame_size; 55 | size_t src_samples_per_frame; 56 | 57 | /* processing */ 58 | 59 | /* encoding */ 60 | enum audio_format dst_fmt; 61 | union { 62 | gsm gsm_handle; 63 | #ifdef HAVE_BCG729 64 | bcg729EncoderChannelContextStruct *g729_enc; 65 | #endif 66 | } dst; 67 | size_t dst_frame_size; 68 | size_t dst_samples_per_frame; 69 | int dst_packet_duration; 70 | 71 | int is_running; 72 | uint16_t next_seq; 73 | uint32_t next_time; 74 | int16_t samples[10*160]; 75 | size_t sample_cnt; 76 | size_t sample_offs; 77 | }; 78 | 79 | 80 | int mgcp_transcoding_setup(struct mgcp_endpoint *endp, 81 | struct mgcp_rtp_end *dst_end, 82 | struct mgcp_rtp_end *src_end); 83 | 84 | void mgcp_transcoding_net_downlink_format(struct mgcp_endpoint *endp, 85 | int *payload_type, 86 | const char**audio_name, 87 | const char**fmtp_extra); 88 | 89 | int mgcp_transcoding_process_rtp(struct mgcp_endpoint *endp, 90 | struct mgcp_rtp_end *dst_end, 91 | char *data, int *len, int buf_size); 92 | 93 | int mgcp_transcoding_get_frame_size(void *state_, int nsamples, int dst); 94 | #endif /* OPENBSC_MGCP_TRANSCODE_H */ 95 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/misdn.h: -------------------------------------------------------------------------------- 1 | /* (C) 2008 by Harald Welte 2 | * All Rights Reserved 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Affero General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Affero General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Affero General Public License 15 | * along with this program. If not, see . 16 | * 17 | */ 18 | 19 | #ifndef MISDN_H 20 | #define MISDN_H 21 | 22 | #include 23 | 24 | int mi_setup(int cardnr, struct e1inp_line *line, int release_l2); 25 | int mi_e1_line_update(struct e1inp_line *line); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/mncc_int.h: -------------------------------------------------------------------------------- 1 | #ifndef _MNCC_INT_H 2 | #define _MNCC_INT_H 3 | 4 | #include 5 | 6 | struct mncc_int { 7 | uint8_t def_codec[2]; 8 | }; 9 | 10 | extern struct mncc_int mncc_int; 11 | 12 | uint8_t mncc_codec_for_mode(int lchan_type); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/nat_rewrite_trie.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2013 by On-Waves 3 | * (C) 2013 by Holger Hans Peter Freyther 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | #ifndef NAT_REWRITE_FILE_H 21 | #define NAT_REWRITE_FILE_H 22 | 23 | #include 24 | 25 | struct vty; 26 | 27 | struct nat_rewrite_rule { 28 | /* For digits 0-9 and + */ 29 | struct nat_rewrite_rule *rules[11]; 30 | 31 | char empty; 32 | char prefix[14]; 33 | char rewrite[6]; 34 | }; 35 | 36 | struct nat_rewrite { 37 | struct nat_rewrite_rule rule; 38 | size_t prefixes; 39 | }; 40 | 41 | 42 | struct nat_rewrite *nat_rewrite_parse(void *ctx, const char *filename); 43 | struct nat_rewrite_rule *nat_rewrite_lookup(struct nat_rewrite *, const char *prefix); 44 | void nat_rewrite_dump(struct nat_rewrite *rewr); 45 | void nat_rewrite_dump_vty(struct vty *vty, struct nat_rewrite *rewr); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/network_listen.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPENBSC_NWL_H 2 | #define _OPENBSC_NWL_H 3 | 4 | #include 5 | #include 6 | 7 | void ipac_nwl_init(void); 8 | 9 | /* Start a NWL test. It will raise the S_IPAC_TEST_COMPLETE signal. */ 10 | int ipac_nwl_test_start(struct gsm_bts_trx *trx, uint8_t testnr, 11 | const uint8_t *phys_conf, unsigned int phys_conf_len); 12 | 13 | int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st, uint8_t min_rxlev, 14 | uint16_t max_num_arfcns); 15 | 16 | #endif /* _OPENBSC_NWL_H */ 17 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/openbscdefines.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2009 by Holger Hans Peter Freyther 3 | * 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef OPENBSCDEFINES_H 22 | #define OPENBSCDEFINES_H 23 | 24 | #ifdef BUILDING_ON_WINDOWS 25 | #ifdef BUILDING_OPENBSC 26 | #define BSC_API __declspec(dllexport) 27 | #else 28 | #define BSC_API __declspec(dllimport) 29 | #endif 30 | #else 31 | #define BSC_API __attribute__((visibility("default"))) 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/osmo_bsc.h: -------------------------------------------------------------------------------- 1 | /* OpenBSC BSC code */ 2 | 3 | #ifndef OSMO_BSC_H 4 | #define OSMO_BSC_H 5 | 6 | #include "bsc_api.h" 7 | #include "bsc_msg_filter.h" 8 | 9 | #define BSS_SEND_USSD 1 10 | 11 | enum bsc_con { 12 | BSC_CON_SUCCESS, 13 | BSC_CON_REJECT_NO_LINK, 14 | BSC_CON_REJECT_RF_GRACE, 15 | BSC_CON_NO_MEM, 16 | }; 17 | 18 | struct sccp_connection; 19 | struct bsc_msc_data; 20 | struct bsc_msc_connection; 21 | 22 | struct osmo_bsc_sccp_con { 23 | struct llist_head entry; 24 | 25 | int ciphering_handled; 26 | 27 | /* for audio handling */ 28 | uint16_t cic; 29 | int rtp_port; 30 | 31 | /* for advanced ping/pong */ 32 | int send_ping; 33 | 34 | /* SCCP connection realted */ 35 | struct sccp_connection *sccp; 36 | struct bsc_msc_data *msc; 37 | struct osmo_timer_list sccp_it_timeout; 38 | struct osmo_timer_list sccp_cc_timeout; 39 | 40 | struct llist_head sccp_queue; 41 | unsigned int sccp_queue_size; 42 | 43 | struct gsm_subscriber_connection *conn; 44 | uint8_t new_subscriber; 45 | 46 | struct bsc_filter_state filter_state; 47 | }; 48 | 49 | struct bsc_api *osmo_bsc_api(); 50 | 51 | int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg); 52 | int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg); 53 | enum bsc_con bsc_create_new_connection(struct gsm_subscriber_connection *conn, 54 | struct bsc_msc_data *msc, int send_ping); 55 | int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp); 56 | 57 | struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn, struct msgb *); 58 | int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); 59 | int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); 60 | int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn); 61 | 62 | int bsc_handle_udt(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length); 63 | int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len); 64 | 65 | int bsc_ctrl_cmds_install(); 66 | 67 | void bsc_gen_location_state_trap(struct gsm_bts *bts); 68 | 69 | struct llist_head *bsc_access_lists(void); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/osmo_bsc_grace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010-2013 by Holger Hans Peter Freyther 3 | * (C) 2010-2013 by On-Waves 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef OSMO_BSC_GRACE_H 22 | #define OSMO_BSC_GRACE_H 23 | 24 | #include 25 | #include 26 | 27 | struct bsc_msc_data; 28 | 29 | int bsc_grace_allow_new_connection(struct gsm_network *net, struct gsm_bts *bts); 30 | int bsc_grace_paging_request(enum signal_rf rf_policy, 31 | struct bsc_subscr *subscr, 32 | int chan_needed, 33 | struct bsc_msc_data *msc); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/osmo_bsc_rf.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMO_BSC_RF 2 | #define OSMO_BSC_RF 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | enum osmo_bsc_rf_opstate { 9 | OSMO_BSC_RF_OPSTATE_INOPERATIONAL, 10 | OSMO_BSC_RF_OPSTATE_OPERATIONAL, 11 | }; 12 | 13 | enum osmo_bsc_rf_adminstate { 14 | OSMO_BSC_RF_ADMINSTATE_UNLOCKED, 15 | OSMO_BSC_RF_ADMINSTATE_LOCKED, 16 | }; 17 | 18 | enum osmo_bsc_rf_policy { 19 | OSMO_BSC_RF_POLICY_OFF, 20 | OSMO_BSC_RF_POLICY_ON, 21 | OSMO_BSC_RF_POLICY_GRACE, 22 | OSMO_BSC_RF_POLICY_UNKNOWN, 23 | }; 24 | 25 | 26 | struct gsm_network; 27 | 28 | struct osmo_bsc_rf { 29 | /* the value of signal.h */ 30 | int policy; 31 | struct osmo_fd listen; 32 | struct gsm_network *gsm_network; 33 | 34 | const char *last_state_command; 35 | 36 | char *last_rf_lock_ctrl_command; 37 | 38 | /* delay the command */ 39 | char last_request; 40 | struct osmo_timer_list delay_cmd; 41 | 42 | /* verify that RF is up as it should be */ 43 | struct osmo_timer_list rf_check; 44 | 45 | /* some handling for the automatic grace switch */ 46 | struct osmo_timer_list grace_timeout; 47 | 48 | /* auto RF switch-off due lack of MSC connection */ 49 | struct osmo_timer_list auto_off_timer; 50 | }; 51 | 52 | struct osmo_bsc_rf_conn { 53 | struct osmo_wqueue queue; 54 | struct osmo_bsc_rf *rf; 55 | }; 56 | 57 | const char *osmo_bsc_rf_get_opstate_name(enum osmo_bsc_rf_opstate opstate); 58 | const char *osmo_bsc_rf_get_adminstate_name(enum osmo_bsc_rf_adminstate adminstate); 59 | const char *osmo_bsc_rf_get_policy_name(enum osmo_bsc_rf_policy policy); 60 | enum osmo_bsc_rf_opstate osmo_bsc_rf_get_opstate_by_bts(struct gsm_bts *bts); 61 | enum osmo_bsc_rf_adminstate osmo_bsc_rf_get_adminstate_by_bts(struct gsm_bts *bts); 62 | enum osmo_bsc_rf_policy osmo_bsc_rf_get_policy_by_bts(struct gsm_bts *bts); 63 | struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net); 64 | void osmo_bsc_rf_schedule_lock(struct osmo_bsc_rf *rf, char cmd); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/osmo_msc.h: -------------------------------------------------------------------------------- 1 | /* Routines for the MSC handling */ 2 | 3 | #ifndef OSMO_MSC_H 4 | #define OSMO_MSC_H 5 | 6 | #include "bsc_api.h" 7 | 8 | struct bsc_api *msc_bsc_api(); 9 | void msc_release_connection(struct gsm_subscriber_connection *conn); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/osmux.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPENBSC_OSMUX_H_ 2 | #define _OPENBSC_OSMUX_H_ 3 | 4 | #include 5 | 6 | #define OSMUX_PORT 1984 7 | 8 | enum { 9 | OSMUX_ROLE_BSC = 0, 10 | OSMUX_ROLE_BSC_NAT, 11 | }; 12 | 13 | int osmux_init(int role, struct mgcp_config *cfg); 14 | int osmux_enable_endpoint(struct mgcp_endpoint *endp, struct in_addr *addr, uint16_t port); 15 | void osmux_disable_endpoint(struct mgcp_endpoint *endp); 16 | void osmux_allocate_cid(struct mgcp_endpoint *endp); 17 | void osmux_release_cid(struct mgcp_endpoint *endp); 18 | 19 | int osmux_xfrm_to_rtp(struct mgcp_endpoint *endp, int type, char *buf, int rc); 20 | int osmux_xfrm_to_osmux(int type, char *buf, int rc, struct mgcp_endpoint *endp); 21 | 22 | int osmux_send_dummy(struct mgcp_endpoint *endp); 23 | 24 | int osmux_get_cid(void); 25 | void osmux_put_cid(uint8_t osmux_cid); 26 | int osmux_used_cid(void); 27 | 28 | enum osmux_state { 29 | OSMUX_STATE_DISABLED = 0, /* Osmux not being currently used by endp */ 30 | OSMUX_STATE_NEGOTIATING, /* Osmux was locally requested in MGCP CRCX */ 31 | OSMUX_STATE_ACTIVATING, /* Osmux was accepted in MGCP CRCX ACK. It can now be enabled by \ref osmux_enable_endpoint. */ 32 | OSMUX_STATE_ENABLED, /* Osmux was initialized by \ref osmux_enable_endpoint and can process frames */ 33 | }; 34 | 35 | enum osmux_usage { 36 | OSMUX_USAGE_OFF = 0, 37 | OSMUX_USAGE_ON = 1, 38 | OSMUX_USAGE_ONLY = 2, 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/paging.h: -------------------------------------------------------------------------------- 1 | /* Paging helper and manager.... */ 2 | /* (C) 2009 by Holger Hans Peter Freyther 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | */ 19 | 20 | #ifndef PAGING_H 21 | #define PAGING_H 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | /** 33 | * A pending paging request 34 | */ 35 | struct gsm_paging_request { 36 | /* list_head for list of all paging requests */ 37 | struct llist_head entry; 38 | /* the subscriber which we're paging. Later gsm_paging_request 39 | * should probably become a part of the bsc_subsrc struct? */ 40 | struct bsc_subscr *bsub; 41 | /* back-pointer to the BTS on which we are paging */ 42 | struct gsm_bts *bts; 43 | /* what kind of channel type do we ask the MS to establish */ 44 | int chan_type; 45 | 46 | /* Timer 3113: how long do we try to page? */ 47 | struct osmo_timer_list T3113; 48 | 49 | /* How often did we ask the BTS to page? */ 50 | int attempts; 51 | 52 | /* callback to be called in case paging completes */ 53 | gsm_cbfn *cbfn; 54 | void *cbfn_param; 55 | }; 56 | 57 | /* schedule paging request */ 58 | int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, 59 | int type, gsm_cbfn *cbfn, void *data); 60 | int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, 61 | int type, gsm_cbfn *cbfn, void *data); 62 | 63 | /* stop paging requests */ 64 | void paging_request_stop(struct llist_head *bts_list, 65 | struct gsm_bts *_bts, struct bsc_subscr *bsub, 66 | struct gsm_subscriber_connection *conn, 67 | struct msgb *msg); 68 | 69 | /* update paging load */ 70 | void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); 71 | 72 | /* pending paging requests */ 73 | unsigned int paging_pending_requests_nr(struct gsm_bts *bts); 74 | 75 | void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/pcu_if.h: -------------------------------------------------------------------------------- 1 | #ifndef _PCU_IF_H 2 | #define _PCU_IF_H 3 | 4 | #include 5 | 6 | extern int pcu_direct; 7 | 8 | struct pcu_sock_state { 9 | struct gsm_network *net; 10 | struct osmo_fd listen_bfd; /* fd for listen socket */ 11 | struct osmo_fd conn_bfd; /* fd for connection to lcr */ 12 | struct llist_head upqueue; /* queue for sending messages */ 13 | }; 14 | 15 | /* PCU relevant information has changed; Inform PCU (if connected) */ 16 | void pcu_info_update(struct gsm_bts *bts); 17 | 18 | /* Forward rach indication to PCU */ 19 | int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn, 20 | uint8_t is_11bit, enum ph_burst_type burst_type); 21 | 22 | /* Confirm the sending of an immediate assignment to the pcu */ 23 | int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli); 24 | 25 | 26 | /* Confirm the sending of an immediate assignment to the pcu */ 27 | int pcu_tx_imm_ass_sent(struct gsm_bts *bts, uint32_t tlli); 28 | 29 | /* Open connection to PCU */ 30 | int pcu_sock_init(const char *path, struct gsm_bts *bts); 31 | 32 | /* Close connection to PCU */ 33 | void pcu_sock_exit(struct gsm_bts *bts); 34 | 35 | #endif /* _PCU_IF_H */ 36 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/rrlp.h: -------------------------------------------------------------------------------- 1 | #ifndef _RRLP_H 2 | #define _RRLP_H 3 | 4 | void on_dso_load_rrlp(void); 5 | 6 | #endif /* _RRLP_H */ 7 | 8 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/rs232.h: -------------------------------------------------------------------------------- 1 | #ifndef _RS232_H 2 | #define _RS232_H 3 | 4 | int rs232_setup(const char *serial_port, unsigned int delay_ms, 5 | struct gsm_bts *bts); 6 | 7 | int handle_serial_msg(struct msgb *msg); 8 | 9 | #endif /* _RS232_H */ 10 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/rtp_proxy.h: -------------------------------------------------------------------------------- 1 | #ifndef _RTP_PROXY_H 2 | #define _RTP_PROXY_H 3 | 4 | /* RTP proxy handling for ip.access nanoBTS */ 5 | 6 | /* (C) 2009 by Harald Welte 7 | * All Rights Reserved 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU Affero General Public License as published by 11 | * the Free Software Foundation; either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Affero General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Affero General Public License 20 | * along with this program. If not, see . 21 | * 22 | */ 23 | 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #define RTP_PT_GSM_FULL 3 33 | #define RTP_PT_GSM_HALF 96 34 | #define RTP_PT_GSM_EFR 97 35 | #define RTP_PT_AMR 98 36 | #define RTP_LEN_GSM_FULL 33 37 | #define RTP_LEN_GSM_HALF 15 38 | #define RTP_LEN_GSM_EFR 31 39 | #define RTP_GSM_DURATION 160 40 | 41 | enum rtp_rx_action { 42 | RTP_NONE, 43 | RTP_PROXY, 44 | RTP_RECV_UPSTREAM, 45 | }; 46 | 47 | enum rtp_tx_action { 48 | RTP_SEND_NONE, 49 | RTP_SEND_DOWNSTREAM, 50 | }; 51 | 52 | struct rtp_sub_socket { 53 | struct sockaddr_in sin_local; 54 | struct sockaddr_in sin_remote; 55 | 56 | struct osmo_fd bfd; 57 | /* linked list of to-be-transmitted msgb's */ 58 | struct llist_head tx_queue; 59 | }; 60 | 61 | struct rtp_socket { 62 | struct llist_head list; 63 | 64 | struct rtp_sub_socket rtp; 65 | struct rtp_sub_socket rtcp; 66 | 67 | /* what should we do on receive? */ 68 | enum rtp_rx_action rx_action; 69 | union { 70 | struct { 71 | struct rtp_socket *other_sock; 72 | } proxy; 73 | struct { 74 | struct gsm_network *net; 75 | uint32_t callref; 76 | } receive; 77 | }; 78 | enum rtp_tx_action tx_action; 79 | struct { 80 | uint16_t sequence; 81 | uint32_t timestamp; 82 | uint32_t ssrc; 83 | struct timeval last_tv; 84 | } transmit; 85 | }; 86 | 87 | struct rtp_socket *rtp_socket_create(void); 88 | int rtp_socket_bind(struct rtp_socket *rs, uint32_t ip); 89 | int rtp_socket_connect(struct rtp_socket *rs, uint32_t ip, uint16_t port); 90 | int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other); 91 | int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, uint32_t callref); 92 | int rtp_socket_free(struct rtp_socket *rs); 93 | int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame); 94 | 95 | #endif /* _RTP_PROXY_H */ 96 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/silent_call.h: -------------------------------------------------------------------------------- 1 | #ifndef _SILENT_CALL_H 2 | #define _SILENT_CALL_H 3 | 4 | struct gsm_subscriber_connection; 5 | 6 | extern int gsm_silent_call_start(struct gsm_subscriber *subscr, 7 | void *data, int type); 8 | extern int gsm_silent_call_stop(struct gsm_subscriber *subscr); 9 | 10 | #if 0 11 | extern int silent_call_rx(struct gsm_subscriber_connection *conn, struct msgb *msg); 12 | extern int silent_call_reroute(struct gsm_subscriber_connection *conn, struct msgb *msg); 13 | #endif 14 | 15 | #endif /* _SILENT_CALL_H */ 16 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/smpp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int smpp_openbsc_alloc_init(void *ctx); 4 | int smpp_openbsc_start(struct gsm_network *net); 5 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/sms_queue.h: -------------------------------------------------------------------------------- 1 | #ifndef SMS_QUEUE_H 2 | #define SMS_QUEUE_H 3 | 4 | struct gsm_network; 5 | struct gsm_sms_queue; 6 | struct vty; 7 | 8 | int sms_queue_start(struct gsm_network *, int in_flight); 9 | int sms_queue_trigger(struct gsm_sms_queue *); 10 | 11 | /* vty helper functions */ 12 | int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty); 13 | int sms_queue_set_max_pending(struct gsm_sms_queue *, int max); 14 | int sms_queue_set_max_failure(struct gsm_sms_queue *, int fail); 15 | int sms_queue_clear(struct gsm_sms_queue *); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/socket.h: -------------------------------------------------------------------------------- 1 | #ifndef _BSC_SOCKET_H 2 | #define _BSC_SOCKET_H 3 | 4 | #include 5 | 6 | #ifndef IPPROTO_GRE 7 | #define IPPROTO_GRE 47 8 | #endif 9 | 10 | int make_sock(struct osmo_fd *bfd, int proto, 11 | uint32_t ip, uint16_t port, int priv_nr, 12 | int (*cb)(struct osmo_fd *fd, unsigned int what), void *data); 13 | 14 | #endif /* _BSC_SOCKET_H */ 15 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/system_information.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYSTEM_INFO_H 2 | #define _SYSTEM_INFO_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | struct gsm_bts; 9 | 10 | int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type); 11 | size_t si2q_earfcn_count(const struct osmo_earfcn_si2q *e); 12 | unsigned range1024_p(unsigned n); 13 | unsigned range512_q(unsigned m); 14 | int range_encode(enum gsm48_range r, int *arfcns, int arfcns_used, int *w, 15 | int f0, uint8_t *chan_list); 16 | uint8_t si2q_num(struct gsm_bts *bts); 17 | int bts_earfcn_add(struct gsm_bts *bts, uint16_t earfcn, uint8_t thresh_hi, uint8_t thresh_lo, uint8_t prio, 18 | uint8_t qrx, uint8_t meas_bw); 19 | int bts_uarfcn_del(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble); 20 | int bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble, 21 | bool diversity); 22 | #endif 23 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/token_auth.h: -------------------------------------------------------------------------------- 1 | #ifndef _TOKEN_AUTH_H 2 | #define _TOKEN_AUTH_H 3 | 4 | void on_dso_load_token(void); 5 | 6 | #endif /* _TOKEN_AUTH_H */ 7 | 8 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/transaction.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRANSACT_H 2 | #define _TRANSACT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | /* One transaction */ 13 | struct gsm_trans { 14 | /* Entry in list of all transactions */ 15 | struct llist_head entry; 16 | 17 | /* Back pointer to the network struct */ 18 | struct gsm_network *net; 19 | 20 | /* The protocol within which we live */ 21 | uint8_t protocol; 22 | 23 | /* The current transaction ID */ 24 | uint8_t transaction_id; 25 | 26 | /* To whom we belong, unique identifier of remote MM entity */ 27 | struct gsm_subscriber *subscr; 28 | 29 | /* The associated connection we are using to transmit messages */ 30 | struct gsm_subscriber_connection *conn; 31 | 32 | /* reference from MNCC or other application */ 33 | uint32_t callref; 34 | 35 | /* if traffic channel receive was requested */ 36 | int tch_recv; 37 | 38 | /* is thats one paging? */ 39 | struct subscr_request *paging_request; 40 | 41 | union { 42 | struct { 43 | 44 | /* current call state */ 45 | int state; 46 | 47 | /* current timer and message queue */ 48 | int Tcurrent; /* current CC timer */ 49 | int T308_second; /* used to send release again */ 50 | struct osmo_timer_list timer; 51 | struct gsm_mncc msg; /* stores setup/disconnect/release message */ 52 | } cc; 53 | struct { 54 | struct gsm411_smc_inst smc_inst; 55 | struct gsm411_smr_inst smr_inst; 56 | 57 | struct gsm_sms *sms; 58 | } sms; 59 | }; 60 | }; 61 | 62 | 63 | 64 | struct gsm_trans *trans_find_by_id(struct gsm_subscriber_connection *conn, 65 | uint8_t proto, uint8_t trans_id); 66 | struct gsm_trans *trans_find_by_callref(struct gsm_network *net, 67 | uint32_t callref); 68 | 69 | struct gsm_trans *trans_alloc(struct gsm_network *net, 70 | struct gsm_subscriber *subscr, 71 | uint8_t protocol, uint8_t trans_id, 72 | uint32_t callref); 73 | void trans_free(struct gsm_trans *trans); 74 | 75 | int trans_assign_trans_id(struct gsm_network *net, struct gsm_subscriber *subscr, 76 | uint8_t protocol, uint8_t ti_flag); 77 | int trans_has_conn(const struct gsm_subscriber_connection *conn); 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/trau_mux.h: -------------------------------------------------------------------------------- 1 | /* Simple TRAU frame reflector to route voice calls */ 2 | 3 | /* (C) 2009 by Harald Welte 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | /* The "TRAU mux map" defines which particular 16kbit sub-slot (in which E1 22 | * timeslot on which E1 interface) should be directly muxed to which other 23 | * sub-slot. Entries in the mux map are always bi-directional. 24 | * 25 | * The idea of all this is to directly switch voice channels in the BSC 26 | * from one phone to another. We do this right now since we don't support 27 | * any external interface for voice channels, and in the future as an 28 | * optimization to routing them externally. 29 | */ 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | struct decoded_trau_frame; 36 | 37 | /* map a TRAU mux map entry */ 38 | int trau_mux_map(const struct gsm_e1_subslot *src, 39 | const struct gsm_e1_subslot *dst); 40 | int trau_mux_map_lchan(const struct gsm_lchan *src, 41 | const struct gsm_lchan *dst); 42 | 43 | /* unmap a TRAU mux map entry */ 44 | int trau_mux_unmap(const struct gsm_e1_subslot *ss, uint32_t callref); 45 | 46 | /* we get called by subchan_demux */ 47 | int trau_mux_input(struct gsm_e1_subslot *src_e1_ss, 48 | const uint8_t *trau_bits, int num_bits); 49 | 50 | /* add a trau receiver */ 51 | int trau_recv_lchan(struct gsm_lchan *lchan, uint32_t callref); 52 | 53 | /* send trau from application */ 54 | int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame); 55 | 56 | /* switch trau muxer to new lchan */ 57 | int switch_trau_mux(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan); 58 | 59 | /* callback invoked if we receive TRAU frames */ 60 | int subch_cb(struct subch_demux *dmx, int ch, uint8_t *data, int len, void *_priv); 61 | 62 | /* TRAU frame transcoding */ 63 | struct msgb *trau_decode_fr(uint32_t callref, 64 | const struct decoded_trau_frame *tf); 65 | struct msgb *trau_decode_efr(uint32_t callref, 66 | const struct decoded_trau_frame *tf); 67 | void trau_encode_fr(struct decoded_trau_frame *tf, 68 | const unsigned char *data); 69 | void trau_encode_efr(struct decoded_trau_frame *tf, 70 | const unsigned char *data); 71 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/trau_upqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRAU_UPQUEUE_H 2 | #define _TRAU_UPQUEUE_H 3 | 4 | void trau_tx_to_mncc(struct gsm_network *net, struct msgb *msg); 5 | 6 | #endif /* _TRAU_UPQUEUE_H */ 7 | 8 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/ussd.h: -------------------------------------------------------------------------------- 1 | #ifndef _USSD_H 2 | #define _USSD_H 3 | 4 | /* Handler function for mobile-originated USSD messages */ 5 | 6 | #include 7 | 8 | int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /openbsc/include/openbsc/vty.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENBSC_VTY_H 2 | #define OPENBSC_VTY_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct gsm_network; 9 | struct vty; 10 | 11 | void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *); 12 | 13 | struct buffer *vty_argv_to_buffer(int argc, const char *argv[], int base); 14 | 15 | extern struct cmd_element cfg_description_cmd; 16 | extern struct cmd_element cfg_no_description_cmd; 17 | 18 | enum bsc_vty_node { 19 | GSMNET_NODE = _LAST_OSMOVTY_NODE + 1, 20 | BTS_NODE, 21 | TRX_NODE, 22 | TS_NODE, 23 | SUBSCR_NODE, 24 | MGCP_NODE, 25 | GBPROXY_NODE, 26 | SGSN_NODE, 27 | OML_NODE, 28 | NAT_NODE, 29 | NAT_BSC_NODE, 30 | MSC_NODE, 31 | OM2K_NODE, 32 | OM2K_CON_GROUP_NODE, 33 | TRUNK_NODE, 34 | PGROUP_NODE, 35 | MNCC_INT_NODE, 36 | NITB_NODE, 37 | BSC_NODE, 38 | SMPP_NODE, 39 | SMPP_ESME_NODE, 40 | GTPHUB_NODE, 41 | }; 42 | 43 | extern int bsc_vty_is_config_node(struct vty *vty, int node); 44 | 45 | struct log_info; 46 | int bsc_vty_init(struct gsm_network *network); 47 | int bsc_vty_init_extra(void); 48 | 49 | struct gsm_network *gsmnet_from_vty(struct vty *vty); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /openbsc/m4/README: -------------------------------------------------------------------------------- 1 | We want to avoid creating too many external build-time dependencies 2 | like this one to autoconf-archive. This directory provides a local 3 | copy of required m4 rules. 4 | -------------------------------------------------------------------------------- /openbsc/osmoappdesc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # (C) 2013 by Katerina Barone-Adesi 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | 17 | 18 | # Most systems won't be able to use these, so they're separated out 19 | nitb_e1_configs = [ 20 | "doc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg", 21 | "doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg", 22 | "doc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg", 23 | "doc/examples/osmo-nitb/bs11/osmo-nitb.cfg", 24 | "doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg", 25 | "doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg", 26 | "doc/examples/osmo-nitb/rbs2308/osmo-nitb.cfg" 27 | ] 28 | 29 | 30 | app_configs = { 31 | "osmo-bsc-sccplite": ["doc/examples/osmo-bsc-sccplite/osmo-bsc-sccplite.cfg"], 32 | "nat": ["tests/osmo-bsc-nat.cfg"], 33 | "mgcp": ["doc/examples/osmo-bsc_mgcp/osmo-bsc-mgcp.cfg"], 34 | "nitb": ["doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg", 35 | "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg"], 36 | } 37 | 38 | 39 | apps = [(4242, "src/osmo-bsc/osmo-bsc-sccplite", "OsmoBSC", "osmo-bsc-sccplite"), 40 | (4244, "src/osmo-bsc_nat/osmo-bsc_nat", "OsmoBSCNAT", "nat"), 41 | (4243, "src/osmo-bsc_mgcp/osmo-bsc_mgcp", "OpenBSC MGCP", "mgcp"), 42 | (4242, "src/osmo-nitb/osmo-nitb --yes-i-really-want-to-run-prehistoric-software", "OpenBSC", "nitb"), 43 | ] 44 | 45 | vty_command = ["./src/osmo-nitb/osmo-nitb", "-c", 46 | "doc/examples/osmo-nitb/nanobts/osmo-nitb.cfg", 47 | "--yes-i-really-want-to-run-prehistoric-software"] 48 | 49 | vty_app = apps[3] # reference apps[] entry for osmo-nitb 50 | -------------------------------------------------------------------------------- /openbsc/src/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOGSM_CFLAGS) \ 12 | $(LIBOSMOVTY_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(LIBOSMOCORE_LIBS) \ 18 | $(LIBOSMOGSM_LIBS) \ 19 | $(COVERAGE_LDFLAGS) \ 20 | $(NULL) 21 | 22 | # Libraries 23 | SUBDIRS = \ 24 | libcommon \ 25 | libmgcp \ 26 | libbsc \ 27 | libmsc \ 28 | libtrau \ 29 | libfilter \ 30 | libcommon-cs \ 31 | $(NULL) 32 | 33 | # Programs 34 | SUBDIRS += \ 35 | osmo-nitb \ 36 | osmo-bsc_mgcp \ 37 | utils \ 38 | $(NULL) 39 | 40 | # Conditional Programs 41 | if BUILD_NAT 42 | SUBDIRS += \ 43 | osmo-bsc_nat \ 44 | $(NULL) 45 | endif 46 | 47 | if BUILD_BSC 48 | SUBDIRS += \ 49 | osmo-bsc \ 50 | $(NULL) 51 | endif 52 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOABIS_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | noinst_LIBRARIES = \ 17 | libbsc.a \ 18 | $(NULL) 19 | 20 | libbsc_a_SOURCES = \ 21 | abis_nm.c \ 22 | abis_nm_vty.c \ 23 | abis_om2000.c \ 24 | abis_om2000_vty.c \ 25 | abis_rsl.c \ 26 | acc_ramp.c \ 27 | bsc_rll.c \ 28 | bsc_subscriber.c \ 29 | paging.c \ 30 | bts_ericsson_rbs2000.c \ 31 | bts_ipaccess_nanobts.c \ 32 | bts_siemens_bs11.c \ 33 | bts_nokia_site.c \ 34 | bts_unknown.c \ 35 | bts_sysmobts.c \ 36 | chan_alloc.c \ 37 | handover_decision.c \ 38 | handover_logic.c \ 39 | meas_rep.c \ 40 | pcu_sock.c \ 41 | rest_octets.c \ 42 | system_information.c \ 43 | e1_config.c \ 44 | bsc_api.c \ 45 | bsc_msc.c bsc_vty.c \ 46 | gsm_04_08_utils.c \ 47 | gsm_04_80_utils.c \ 48 | bsc_init.c \ 49 | bts_init.c \ 50 | bsc_rf_ctrl.c \ 51 | arfcn_range_encode.c \ 52 | bsc_ctrl_commands.c \ 53 | bsc_ctrl_lookup.c \ 54 | net_init.c \ 55 | bsc_dyn_ts.c \ 56 | bts_ipaccess_nanobts_omlattr.c \ 57 | $(NULL) 58 | 59 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/bsc_dyn_ts.c: -------------------------------------------------------------------------------- 1 | /* Dynamic PDCH initialisation implementation shared across NM and RSL */ 2 | 3 | /* (C) 2016 by sysmocom s.f.m.c. GmbH 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | void tchf_pdch_ts_init(struct gsm_bts_trx_ts *ts) 27 | { 28 | int rc; 29 | 30 | if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) { 31 | LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':" 32 | " not activating PDCH.\n", 33 | gsm_ts_and_pchan_name(ts)); 34 | return; 35 | } 36 | 37 | LOGP(DRSL, LOGL_DEBUG, "%s: trying to PDCH ACT\n", 38 | gsm_ts_and_pchan_name(ts)); 39 | 40 | rc = rsl_ipacc_pdch_activate(ts, 1); 41 | if (rc != 0) 42 | LOGP(DRSL, LOGL_ERROR, "%s %s: PDCH ACT failed\n", 43 | gsm_ts_name(ts), gsm_pchan_name(ts->pchan)); 44 | } 45 | 46 | void tchf_tchh_pdch_ts_init(struct gsm_bts_trx_ts *ts) 47 | { 48 | if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) { 49 | LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':" 50 | " not activating PDCH.\n", 51 | gsm_ts_and_pchan_name(ts)); 52 | return; 53 | } 54 | 55 | dyn_ts_switchover_start(ts, GSM_PCHAN_PDCH); 56 | } 57 | 58 | void dyn_ts_init(struct gsm_bts_trx_ts *ts) 59 | { 60 | /* Clear all TCH/F_PDCH flags */ 61 | ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE); 62 | 63 | /* Clear TCH/F_TCH/H_PDCH state */ 64 | ts->dyn.pchan_is = ts->dyn.pchan_want = GSM_PCHAN_NONE; 65 | ts->dyn.pending_chan_activ = NULL; 66 | 67 | switch (ts->pchan) { 68 | case GSM_PCHAN_TCH_F_PDCH: 69 | tchf_pdch_ts_init(ts); 70 | break; 71 | case GSM_PCHAN_TCH_F_TCH_H_PDCH: 72 | tchf_tchh_pdch_ts_init(ts); 73 | break; 74 | default: 75 | break; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/bts_init.c: -------------------------------------------------------------------------------- 1 | /* (C) 2011 by Harald Welte 2 | * 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | */ 19 | #include 20 | 21 | int bts_init(void) 22 | { 23 | bts_model_bs11_init(); 24 | bts_model_rbs2k_init(); 25 | bts_model_nanobts_init(); 26 | bts_model_nokia_site_init(); 27 | bts_model_sysmobts_init(); 28 | /* Your new BTS here. */ 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/bts_sysmobts.c: -------------------------------------------------------------------------------- 1 | /* sysmocom sysmoBTS specific code */ 2 | 3 | /* (C) 2010-2012 by Harald Welte 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as published by 9 | * the Free Software Foundation; either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | extern struct gsm_bts_model bts_model_nanobts; 42 | 43 | static struct gsm_bts_model model_sysmobts; 44 | 45 | int bts_model_sysmobts_init(void) 46 | { 47 | model_sysmobts = bts_model_nanobts; 48 | model_sysmobts.name = "sysmobts"; 49 | model_sysmobts.type = GSM_BTS_TYPE_OSMOBTS; 50 | 51 | model_sysmobts.features.data = &model_sysmobts._features_data[0]; 52 | model_sysmobts.features.data_len = 53 | sizeof(model_sysmobts._features_data); 54 | memset(model_sysmobts.features.data, 0, sizeof(model_sysmobts.features.data_len)); 55 | 56 | gsm_btsmodel_set_feature(&model_sysmobts, BTS_FEAT_GPRS); 57 | gsm_btsmodel_set_feature(&model_sysmobts, BTS_FEAT_EGPRS); 58 | 59 | return gsm_bts_model_register(&model_sysmobts); 60 | } 61 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/bts_unknown.c: -------------------------------------------------------------------------------- 1 | /* Generic BTS - VTY code tries to allocate this BTS before type is known */ 2 | 3 | /* (C) 2010 by Daniel Willmann 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as published by 9 | * the Free Software Foundation; either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | * 20 | */ 21 | 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | static struct gsm_bts_model model_unknown = { 28 | .type = GSM_BTS_TYPE_UNKNOWN, 29 | .name = "unknown", 30 | .oml_rcvmsg = &abis_nm_rcvmsg, 31 | .nm_att_tlvdef = { 32 | .def = { 33 | }, 34 | }, 35 | }; 36 | 37 | int bts_model_unknown_init(void) 38 | { 39 | return gsm_bts_model_register(&model_unknown); 40 | } 41 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/gsm_04_80_utils.c: -------------------------------------------------------------------------------- 1 | /* OpenBSC utility functions for 3GPP TS 04.80 */ 2 | 3 | /* (C) 2016 by sysmocom - s.f.m.c. GmbH 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as published by 9 | * the Free Software Foundation; either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | int bsc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level, 26 | const char *text) 27 | { 28 | struct msgb *msg = gsm0480_create_ussd_notify(level, text); 29 | if (!msg) 30 | return -1; 31 | return gsm0808_submit_dtap(conn, msg, 0, 0); 32 | } 33 | 34 | int bsc_send_ussd_release_complete(struct gsm_subscriber_connection *conn) 35 | { 36 | struct msgb *msg = gsm0480_create_ussd_release_complete(); 37 | if (!msg) 38 | return -1; 39 | return gsm0808_submit_dtap(conn, msg, 0, 0); 40 | } 41 | -------------------------------------------------------------------------------- /openbsc/src/libbsc/meas_proc.c: -------------------------------------------------------------------------------- 1 | /* Measurement Processing */ 2 | 3 | /* (C) 2009 by Harald Welte 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as published by 9 | * the Free Software Foundation; either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* process an already parsed measurement report */ 33 | static int process_meas_rep(struct gsm_meas_rep *mr) 34 | { 35 | struct gsm_meas_rep_cell *mr_cell = NULL; 36 | unsigned int best_better_db; 37 | int i; 38 | 39 | /* FIXME: implement actual averaging over multiple measurement 40 | * reports */ 41 | 42 | /* find the best cell in this report that is at least RXLEV_HYST 43 | * better than the current serving cell */ 44 | for (i = 0; i < mr->num_cell; i++) { 45 | unsigned int better; 46 | if (mr->cell[i].rxlev < mr->dl.full.rx_lev + RXLEV_HYST) 47 | continue; 48 | 49 | better = mr->cell[i].rxlev - mr->dl.full.rx_lev; 50 | if (better > best_better_db) { 51 | mr_cell = &mr->cell[i]; 52 | best_better_db = better; 53 | } 54 | } 55 | 56 | if (mr_cell) 57 | return handover_to_arfcn_bsic(mr->lchan, mr_cell->arfcn, 58 | mr_cell->bsic); 59 | return 0; 60 | } 61 | 62 | static int meas_proc_sig_cb(unsigned int subsys, unsigned int signal, 63 | void *handler_data, void *signal_data) 64 | { 65 | struct gsm_lchan *lchan; 66 | struct gsm_meas_rep *mr; 67 | 68 | if (subsys != SS_LCHAN) 69 | return 0; 70 | 71 | switch (signal) { 72 | case S_LCHAN_MEAS_REP: 73 | mr = signal_data; 74 | process_meas_rep(mr); 75 | break; 76 | } 77 | 78 | return 0; 79 | } 80 | 81 | static __attribute__((constructor)) void on_dso_load_meas(void) 82 | { 83 | osmo_signal_register_handler(SS_LCHAN, meas_proc_sig_cb, NULL); 84 | } 85 | -------------------------------------------------------------------------------- /openbsc/src/libcommon-cs/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOABIS_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | noinst_LIBRARIES = libcommon-cs.a 17 | 18 | libcommon_cs_a_SOURCES = \ 19 | common_cs.c \ 20 | common_cs_vty.c 21 | -------------------------------------------------------------------------------- /openbsc/src/libcommon/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOABIS_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | noinst_LIBRARIES = \ 17 | libcommon.a \ 18 | $(NULL) 19 | 20 | libcommon_a_SOURCES = \ 21 | bsc_version.c \ 22 | common_vty.c \ 23 | debug.c \ 24 | gsm_data.c \ 25 | gsm_data_shared.c \ 26 | gsup_client.c \ 27 | oap_client.c \ 28 | socket.c \ 29 | talloc_ctx.c \ 30 | gsm_subscriber_base.c \ 31 | $(NULL) 32 | 33 | noinst_PROGRAMS = \ 34 | gsup_test_client \ 35 | $(NULL) 36 | 37 | gsup_test_client_SOURCES = \ 38 | gsup_test_client.c \ 39 | $(NULL) 40 | gsup_test_client_LDADD = \ 41 | libcommon.a \ 42 | $(LIBOSMOCORE_LIBS) \ 43 | $(LIBOSMOGSM_LIBS) \ 44 | $(LIBOSMOVTY_LIBS) \ 45 | $(LIBOSMOABIS_LIBS) \ 46 | -lrt \ 47 | $(NULL) 48 | -------------------------------------------------------------------------------- /openbsc/src/libcommon/bsc_version.c: -------------------------------------------------------------------------------- 1 | /* Hold the copyright and version string */ 2 | /* (C) 2010-2016 by Harald Welte 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | */ 19 | 20 | #include "../../bscconfig.h" 21 | 22 | #define DIVIDER "======================================================================\r\n" 23 | const char *openbsc_copyright = 24 | "Copyright (C) 2008-2016 Harald Welte, Holger Freyther\r\n" 25 | "Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n" 26 | "Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n" 27 | "License AGPLv3+: GNU AGPL version 3 or later \r\n" 28 | "This is free software: you are free to change and redistribute it.\r\n" 29 | "There is NO WARRANTY, to the extent permitted by law.\r\n" DIVIDER 30 | "WARNING: You should not run osmo-nitb except for archaeological purpose.\r\n" 31 | "It is ancient, unmaintained and obsolete for several years. But you seem\r\n" 32 | "to insist on using obsolete and known-broken software that ignores years \r\n" 33 | "of hard development work. That's your choice, but you have been warned.\r\n" 34 | "DON'T EVER BOTHER THE DEVELOPERS IF YOU ENCOUNTER PROBLEMS WITH IT!!!\r\n" 35 | "See https://osmocom.org/projects/cellular-infrastructure/wiki/Osmocom_Network_In_The_Box\r\n" DIVIDER; 36 | 37 | 38 | -------------------------------------------------------------------------------- /openbsc/src/libcommon/talloc_ctx.c: -------------------------------------------------------------------------------- 1 | /* OpenBSC allocation contexts initialization code */ 2 | /* (C) 2011-2016 by sysmocom s.f.m.c. GmbH 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | extern void *tall_bsc_ctx; 25 | extern void *tall_fle_ctx; 26 | extern void *tall_locop_ctx; 27 | extern void *tall_authciphop_ctx; 28 | extern void *tall_gsms_ctx; 29 | extern void *tall_subscr_ctx; 30 | extern void *tall_sub_req_ctx; 31 | extern void *tall_call_ctx; 32 | extern void *tall_paging_ctx; 33 | extern void *tall_tqe_ctx; 34 | extern void *tall_trans_ctx; 35 | extern void *tall_map_ctx; 36 | extern void *tall_upq_ctx; 37 | extern void *tall_ctr_ctx; 38 | 39 | void talloc_ctx_init(void *ctx_root) 40 | { 41 | msgb_talloc_ctx_init(ctx_root, 0); 42 | tall_fle_ctx = talloc_named_const(ctx_root, 0, "bs11_file_list_entry"); 43 | tall_locop_ctx = talloc_named_const(ctx_root, 0, "loc_updating_oper"); 44 | tall_authciphop_ctx = talloc_named_const(ctx_root, 0, "auth_ciph_oper"); 45 | tall_gsms_ctx = talloc_named_const(ctx_root, 0, "sms"); 46 | tall_subscr_ctx = talloc_named_const(ctx_root, 0, "subscriber"); 47 | tall_sub_req_ctx = talloc_named_const(ctx_root, 0, "subscr_request"); 48 | tall_call_ctx = talloc_named_const(ctx_root, 0, "gsm_call"); 49 | tall_paging_ctx = talloc_named_const(ctx_root, 0, "paging_request"); 50 | tall_tqe_ctx = talloc_named_const(ctx_root, 0, "subch_txq_entry"); 51 | tall_trans_ctx = talloc_named_const(ctx_root, 0, "transaction"); 52 | tall_map_ctx = talloc_named_const(ctx_root, 0, "trau_map_entry"); 53 | tall_upq_ctx = talloc_named_const(ctx_root, 0, "trau_upq_entry"); 54 | tall_ctr_ctx = talloc_named_const(ctx_root, 0, "counter"); 55 | osmo_signal_talloc_ctx_init(ctx_root); 56 | } 57 | -------------------------------------------------------------------------------- /openbsc/src/libfilter/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOABIS_CFLAGS) \ 13 | $(LIBOSMOSCCP_CFLAGS) \ 14 | $(COVERAGE_CFLAGS) \ 15 | $(NULL) 16 | 17 | noinst_LIBRARIES = \ 18 | libfilter.a \ 19 | $(NULL) 20 | 21 | libfilter_a_SOURCES = \ 22 | bsc_msg_filter.c \ 23 | bsc_msg_acc.c \ 24 | bsc_msg_vty.c \ 25 | $(NULL) 26 | 27 | -------------------------------------------------------------------------------- /openbsc/src/libmgcp/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOVTY_CFLAGS) \ 11 | $(LIBOSMONETIF_CFLAGS) \ 12 | $(COVERAGE_CFLAGS) \ 13 | $(LIBBCG729_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(LIBOSMOCORE_LIBS) \ 18 | $(LIBOSMOGSM_LIBS) \ 19 | $(LIBOSMONETIF_LIBS) \ 20 | $(COVERAGE_LDFLAGS) \ 21 | $(LIBBCG729_LIBS) \ 22 | $(NULL) 23 | 24 | noinst_LIBRARIES = \ 25 | libmgcp.a \ 26 | $(NULL) 27 | 28 | noinst_HEADERS = \ 29 | g711common.h \ 30 | $(NULL) 31 | 32 | libmgcp_a_SOURCES = \ 33 | mgcp_protocol.c \ 34 | mgcp_network.c \ 35 | mgcp_vty.c \ 36 | mgcp_osmux.c \ 37 | mgcp_sdp.c \ 38 | $(NULL) 39 | if BUILD_MGCP_TRANSCODING 40 | libmgcp_a_SOURCES += \ 41 | mgcp_transcode.c \ 42 | $(NULL) 43 | endif 44 | -------------------------------------------------------------------------------- /openbsc/src/libmsc/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOVTY_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(COVERAGE_CFLAGS) \ 13 | $(LIBSMPP34_CFLAGS) \ 14 | $(NULL) 15 | 16 | noinst_HEADERS = \ 17 | meas_feed.h \ 18 | $(NULL) 19 | 20 | noinst_LIBRARIES = \ 21 | libmsc.a \ 22 | $(NULL) 23 | 24 | libmsc_a_SOURCES = \ 25 | auth.c \ 26 | db.c \ 27 | gsm_04_08.c \ 28 | gsm_04_11.c \ 29 | gsm_04_14.c \ 30 | gsm_04_80.c \ 31 | gsm_subscriber.c \ 32 | mncc.c \ 33 | mncc_builtin.c \ 34 | mncc_sock.c \ 35 | rrlp.c \ 36 | silent_call.c \ 37 | sms_queue.c \ 38 | token_auth.c \ 39 | ussd.c \ 40 | vty_interface_layer3.c \ 41 | transaction.c \ 42 | osmo_msc.c \ 43 | ctrl_commands.c \ 44 | meas_feed.c \ 45 | $(NULL) 46 | 47 | if BUILD_SMPP 48 | noinst_HEADERS += \ 49 | smpp_smsc.h \ 50 | $(NULL) 51 | 52 | libmsc_a_SOURCES += \ 53 | smpp_smsc.c \ 54 | smpp_openbsc.c \ 55 | smpp_vty.c \ 56 | smpp_utils.c \ 57 | $(NULL) 58 | endif 59 | -------------------------------------------------------------------------------- /openbsc/src/libmsc/meas_feed.h: -------------------------------------------------------------------------------- 1 | #ifndef _INT_MEAS_FEED_H 2 | #define _INT_MEAS_FEED_H 3 | 4 | #include 5 | 6 | int meas_feed_cfg_set(const char *dst_host, uint16_t dst_port); 7 | void meas_feed_cfg_get(char **host, uint16_t *port); 8 | 9 | void meas_feed_scenario_set(const char *name); 10 | const char *meas_feed_scenario_get(void); 11 | 12 | #endif /* _INT_MEAS_FEED_H */ 13 | -------------------------------------------------------------------------------- /openbsc/src/libmsc/smpp_utils.c: -------------------------------------------------------------------------------- 1 | 2 | /* (C) 2012-2013 by Harald Welte 3 | * 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | 21 | #include "smpp_smsc.h" 22 | #include 23 | 24 | 25 | int smpp_determine_scheme(uint8_t dcs, uint8_t *data_coding, int *mode) 26 | { 27 | if ((dcs & 0xF0) == 0xF0) { 28 | if (dcs & 0x04) { 29 | /* bit 2 == 1: 8bit data */ 30 | *data_coding = 0x02; 31 | *mode = MODE_8BIT; 32 | } else { 33 | /* bit 2 == 0: default alphabet */ 34 | *data_coding = 0x01; 35 | *mode = MODE_7BIT; 36 | } 37 | } else if ((dcs & 0xE0) == 0) { 38 | switch (dcs & 0xC) { 39 | case 0: 40 | *data_coding = 0x01; 41 | *mode = MODE_7BIT; 42 | break; 43 | case 4: 44 | *data_coding = 0x02; 45 | *mode = MODE_8BIT; 46 | break; 47 | case 8: 48 | *data_coding = 0x08; /* UCS-2 */ 49 | *mode = MODE_8BIT; 50 | break; 51 | default: 52 | goto unknown_mo; 53 | } 54 | } else { 55 | unknown_mo: 56 | LOGP(DLSMS, LOGL_ERROR, "SMPP MO Unknown Data Coding 0x%02x\n", dcs); 57 | return -1; 58 | } 59 | 60 | return 0; 61 | 62 | } 63 | -------------------------------------------------------------------------------- /openbsc/src/libtrau/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOVTY_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(LIBOSMONETIF_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(LIBOSMOCORE_LIBS) \ 18 | $(LIBOSMOGSM_LIBS) \ 19 | $(LIBOSMOABIS_LIBS) \ 20 | $(COVERAGE_LDFLAGS) \ 21 | $(NULL) 22 | 23 | noinst_LIBRARIES = \ 24 | libtrau.a \ 25 | $(NULL) 26 | 27 | libtrau_a_SOURCES = \ 28 | rtp_proxy.c \ 29 | trau_mux.c \ 30 | trau_upqueue.c \ 31 | $(NULL) 32 | -------------------------------------------------------------------------------- /openbsc/src/libtrau/trau_upqueue.c: -------------------------------------------------------------------------------- 1 | /* trau_upqueue.c - Pass msgb's up the chain */ 2 | 3 | /* (C) 2010 by Harald Welte 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | void trau_tx_to_mncc(struct gsm_network *net, struct msgb *msg) 25 | { 26 | net->mncc_recv(net, msg); 27 | } 28 | -------------------------------------------------------------------------------- /openbsc/src/osmo-bsc/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOCTRL_CFLAGS) \ 13 | $(LIBOSMONETIF_CFLAGS) \ 14 | $(LIBOSMOSCCP_CFLAGS) \ 15 | $(COVERAGE_CFLAGS) \ 16 | $(LIBOSMOABIS_CFLAGS) \ 17 | $(NULL) 18 | 19 | AM_LDFLAGS = \ 20 | $(COVERAGE_LDFLAGS) \ 21 | $(NULL) 22 | 23 | bin_PROGRAMS = \ 24 | osmo-bsc-sccplite \ 25 | $(NULL) 26 | 27 | osmo_bsc_sccplite_SOURCES = \ 28 | osmo_bsc_main.c \ 29 | osmo_bsc_vty.c \ 30 | osmo_bsc_api.c \ 31 | osmo_bsc_grace.c \ 32 | osmo_bsc_msc.c \ 33 | osmo_bsc_sccp.c \ 34 | osmo_bsc_filter.c \ 35 | osmo_bsc_bssap.c \ 36 | osmo_bsc_audio.c \ 37 | osmo_bsc_ctrl.c \ 38 | $(NULL) 39 | 40 | # once again since TRAU uses CC symbol :( 41 | osmo_bsc_sccplite_LDADD = \ 42 | $(top_builddir)/src/libfilter/libfilter.a \ 43 | $(top_builddir)/src/libbsc/libbsc.a \ 44 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 45 | $(top_builddir)/src/libmsc/libmsc.a \ 46 | $(top_builddir)/src/libtrau/libtrau.a \ 47 | $(top_builddir)/src/libcommon/libcommon.a \ 48 | $(LIBOSMOSCCP_LIBS) \ 49 | $(LIBOSMOCORE_LIBS) \ 50 | $(LIBOSMOGSM_LIBS) \ 51 | $(LIBOSMOVTY_LIBS) \ 52 | $(LIBOSMOCTRL_LIBS) \ 53 | $(COVERAGE_LDFLAGS) \ 54 | $(LIBOSMOABIS_LIBS) \ 55 | $(NULL) 56 | -------------------------------------------------------------------------------- /openbsc/src/osmo-bsc/osmo_bsc_audio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ipaccess audio handling 3 | * 4 | * (C) 2009-2010 by Holger Hans Peter Freyther 5 | * (C) 2009-2010 by On-Waves 6 | * All Rights Reserved 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU Affero General Public License as published by 10 | * the Free Software Foundation; either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Affero General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Affero General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | static int handle_abisip_signal(unsigned int subsys, unsigned int signal, 33 | void *handler_data, void *signal_data) 34 | { 35 | struct gsm_subscriber_connection *con; 36 | struct gsm_lchan *lchan = signal_data; 37 | int rc; 38 | 39 | if (subsys != SS_ABISIP) 40 | return 0; 41 | 42 | con = lchan->conn; 43 | if (!con || !con->sccp_con) 44 | return 0; 45 | 46 | switch (signal) { 47 | case S_ABISIP_CRCX_ACK: 48 | /* 49 | * TODO: handle handover here... then the audio should go to 50 | * the old mgcp port.. 51 | */ 52 | /* we can ask it to connect now */ 53 | LOGP(DMSC, LOGL_DEBUG, "Connecting BTS to port: %d conn: %d\n", 54 | con->sccp_con->rtp_port, lchan->abis_ip.conn_id); 55 | 56 | rc = rsl_ipacc_mdcx(lchan, ntohl(INADDR_ANY), 57 | con->sccp_con->rtp_port, 58 | lchan->abis_ip.rtp_payload2); 59 | if (rc < 0) { 60 | LOGP(DMSC, LOGL_ERROR, "Failed to send MDCX: %d\n", rc); 61 | return rc; 62 | } 63 | break; 64 | } 65 | 66 | return 0; 67 | } 68 | 69 | int osmo_bsc_audio_init(struct gsm_network *net) 70 | { 71 | osmo_signal_register_handler(SS_ABISIP, handle_abisip_signal, net); 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /openbsc/src/osmo-bsc_mgcp/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOABIS_CFLAGS) \ 13 | $(LIBOSMONETIF_CFLAGS) \ 14 | $(COVERAGE_CFLAGS) \ 15 | $(NULL) 16 | 17 | bin_PROGRAMS = \ 18 | osmo-bsc_mgcp \ 19 | $(NULL) 20 | 21 | osmo_bsc_mgcp_SOURCES = \ 22 | mgcp_main.c \ 23 | $(NULL) 24 | 25 | osmo_bsc_mgcp_LDADD = \ 26 | $(top_builddir)/src/libcommon/libcommon.a \ 27 | $(top_builddir)/src/libmgcp/libmgcp.a \ 28 | $(LIBOSMOVTY_LIBS) \ 29 | $(LIBOSMOCORE_LIBS) \ 30 | $(LIBOSMOGSM_LIBS) \ 31 | $(LIBOSMONETIF_LIBS) \ 32 | $(LIBBCG729_LIBS) \ 33 | $(LIBRARY_GSM) \ 34 | -lrt \ 35 | $(NULL) 36 | -------------------------------------------------------------------------------- /openbsc/src/osmo-bsc_nat/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOVTY_CFLAGS) \ 12 | $(LIBOSMOCTRL_CFLAGS) \ 13 | $(LIBOSMOSCCP_CFLAGS) \ 14 | $(LIBOSMOABIS_CFLAGS) \ 15 | $(LIBOSMONETIF_CFLAGS) \ 16 | $(LIBCRYPTO_CFLAGS) \ 17 | $(COVERAGE_CFLAGS) \ 18 | $(NULL) 19 | 20 | AM_LDFLAGS = \ 21 | $(COVERAGE_LDFLAGS) \ 22 | $(NULL) 23 | 24 | bin_PROGRAMS = \ 25 | osmo-bsc_nat \ 26 | $(NULL) 27 | 28 | osmo_bsc_nat_SOURCES = \ 29 | bsc_filter.c \ 30 | bsc_mgcp_utils.c \ 31 | bsc_nat.c \ 32 | bsc_nat_utils.c \ 33 | bsc_nat_vty.c \ 34 | bsc_sccp.c \ 35 | bsc_ussd.c \ 36 | bsc_nat_ctrl.c \ 37 | bsc_nat_rewrite.c \ 38 | bsc_nat_rewrite_trie.c \ 39 | bsc_nat_filter.c \ 40 | $(NULL) 41 | 42 | osmo_bsc_nat_LDADD = \ 43 | $(top_builddir)/src/libmgcp/libmgcp.a \ 44 | $(top_builddir)/src/libfilter/libfilter.a \ 45 | $(top_builddir)/src/libbsc/libbsc.a \ 46 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 47 | $(top_builddir)/src/libtrau/libtrau.a \ 48 | $(top_builddir)/src/libcommon/libcommon.a \ 49 | $(LIBOSMOSCCP_LIBS) \ 50 | $(LIBOSMOCORE_LIBS) \ 51 | $(LIBOSMOGSM_LIBS) \ 52 | $(LIBOSMOVTY_LIBS) \ 53 | $(LIBOSMOCTRL_LIBS) \ 54 | $(LIBOSMOABIS_LIBS) \ 55 | $(LIBOSMONETIF_LIBS) \ 56 | $(LIBCRYPTO_LIBS) \ 57 | -lrt \ 58 | $(NULL) 59 | -------------------------------------------------------------------------------- /openbsc/src/osmo-nitb/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(COVERAGE_CFLAGS) \ 10 | $(LIBOSMOCORE_CFLAGS) \ 11 | $(LIBOSMOGSM_CFLAGS) \ 12 | $(LIBOSMOVTY_CFLAGS) \ 13 | $(LIBOSMOCTRL_CFLAGS) \ 14 | $(LIBOSMOABIS_CFLAGS) \ 15 | $(LIBSMPP34_CFLAGS) \ 16 | $(LIBCRYPTO_CFLAGS) \ 17 | $(NULL) 18 | 19 | AM_LDFLAGS = \ 20 | $(COVERAGE_LDFLAGS) \ 21 | $(NULL) 22 | 23 | bin_PROGRAMS = \ 24 | osmo-nitb \ 25 | $(NULL) 26 | 27 | osmo_nitb_SOURCES = \ 28 | bsc_hack.c \ 29 | $(NULL) 30 | 31 | osmo_nitb_LDADD = \ 32 | $(top_builddir)/src/libbsc/libbsc.a \ 33 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 34 | $(top_builddir)/src/libmsc/libmsc.a \ 35 | $(top_builddir)/src/libtrau/libtrau.a \ 36 | $(top_builddir)/src/libcommon/libcommon.a \ 37 | $(LIBOSMOGSM_LIBS) \ 38 | $(LIBOSMOVTY_LIBS) \ 39 | $(LIBOSMOCORE_LIBS) \ 40 | $(LIBOSMOCTRL_LIBS) \ 41 | $(LIBOSMOABIS_LIBS) \ 42 | $(LIBSMPP34_LIBS) \ 43 | $(LIBCRYPTO_LIBS) \ 44 | -ldbi \ 45 | $(NULL) 46 | -------------------------------------------------------------------------------- /openbsc/src/utils/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_builddir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(COVERAGE_CFLAGS) \ 13 | $(SQLITE3_CFLAGS) \ 14 | $(LIBSMPP34_CFLAGS) \ 15 | $(NULL) 16 | 17 | AM_LDFLAGS = \ 18 | $(COVERAGE_LDFLAGS) \ 19 | $(NULL) 20 | 21 | bin_PROGRAMS = \ 22 | bs11_config \ 23 | isdnsync \ 24 | $(NULL) 25 | 26 | if BUILD_SMPP 27 | noinst_PROGRAMS = \ 28 | smpp_mirror \ 29 | $(NULL) 30 | endif 31 | 32 | bs11_config_SOURCES = \ 33 | bs11_config.c \ 34 | $(NULL) 35 | 36 | bs11_config_LDADD = \ 37 | $(top_builddir)/src/libbsc/libbsc.a \ 38 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 39 | $(top_builddir)/src/libtrau/libtrau.a \ 40 | $(top_builddir)/src/libcommon/libcommon.a \ 41 | $(LIBOSMOCORE_LIBS) \ 42 | $(LIBOSMOGSM_LIBS) \ 43 | $(LIBOSMOABIS_LIBS) \ 44 | $(NULL) 45 | 46 | isdnsync_SOURCES = \ 47 | isdnsync.c \ 48 | $(NULL) 49 | 50 | smpp_mirror_SOURCES = \ 51 | smpp_mirror.c \ 52 | $(NULL) 53 | 54 | smpp_mirror_LDADD = \ 55 | $(top_builddir)/src/libcommon/libcommon.a \ 56 | $(LIBOSMOCORE_LIBS) \ 57 | $(LIBOSMOGSM_LIBS) \ 58 | $(LIBSMPP34_LIBS) \ 59 | $(NULL) 60 | -------------------------------------------------------------------------------- /openbsc/tests/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = \ 2 | gsm0408 \ 3 | db \ 4 | channel \ 5 | mgcp \ 6 | abis \ 7 | trau \ 8 | subscr \ 9 | mm_auth \ 10 | nanobts_omlattr \ 11 | $(NULL) 12 | 13 | if BUILD_NAT 14 | SUBDIRS += \ 15 | bsc-nat \ 16 | bsc-nat-trie \ 17 | $(NULL) 18 | endif 19 | if BUILD_BSC 20 | SUBDIRS += \ 21 | bsc \ 22 | $(NULL) 23 | endif 24 | if BUILD_SMPP 25 | SUBDIRS += \ 26 | smpp \ 27 | $(NULL) 28 | endif 29 | 30 | # The `:;' works around a Bash 3.2 bug when the output is not writeable. 31 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac 32 | :;{ \ 33 | echo '# Signature of the current package.' && \ 34 | echo 'm4_define([AT_PACKAGE_NAME],' && \ 35 | echo ' [$(PACKAGE_NAME)])' && \ 36 | echo 'm4_define([AT_PACKAGE_TARNAME],' && \ 37 | echo ' [$(PACKAGE_TARNAME)])' && \ 38 | echo 'm4_define([AT_PACKAGE_VERSION],' && \ 39 | echo ' [$(PACKAGE_VERSION)])' && \ 40 | echo 'm4_define([AT_PACKAGE_STRING],' && \ 41 | echo ' [$(PACKAGE_STRING)])' && \ 42 | echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \ 43 | echo ' [$(PACKAGE_BUGREPORT)])'; \ 44 | echo 'm4_define([AT_PACKAGE_URL],' && \ 45 | echo ' [$(PACKAGE_URL)])'; \ 46 | } >'$(srcdir)/package.m4' 47 | 48 | EXTRA_DIST = \ 49 | testsuite.at \ 50 | $(srcdir)/package.m4 \ 51 | $(TESTSUITE) \ 52 | vty_test_runner.py \ 53 | ctrl_test_runner.py \ 54 | smpp_test_runner.py \ 55 | $(NULL) 56 | 57 | TESTSUITE = $(srcdir)/testsuite 58 | 59 | DISTCLEANFILES = \ 60 | atconfig \ 61 | $(NULL) 62 | 63 | if ENABLE_EXT_TESTS 64 | python-tests: $(BUILT_SOURCES) 65 | osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v 66 | osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v 67 | $(srcdir)/vty_test_runner.py -w $(abs_top_builddir) -v 68 | $(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v 69 | if BUILD_SMPP 70 | $(srcdir)/smpp_test_runner.py -w $(abs_top_builddir) -v 71 | endif 72 | rm -f $(top_builddir)/hlr.sqlite3 73 | else 74 | python-tests: $(BUILT_SOURCES) 75 | echo "Not running python-based tests (determined at configure-time)" 76 | endif 77 | 78 | check-local: atconfig $(TESTSUITE) 79 | $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) 80 | $(MAKE) $(AM_MAKEFLAGS) python-tests 81 | 82 | installcheck-local: atconfig $(TESTSUITE) 83 | $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \ 84 | $(TESTSUITEFLAGS) 85 | 86 | clean-local: 87 | test ! -f '$(TESTSUITE)' || \ 88 | $(SHELL) '$(TESTSUITE)' --clean 89 | 90 | AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te 91 | AUTOTEST = $(AUTOM4TE) --language=autotest 92 | $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4 93 | $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at 94 | mv $@.tmp $@ 95 | -------------------------------------------------------------------------------- /openbsc/tests/abis/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOABIS_CFLAGS) \ 11 | $(LIBOSMOGSM_CFLAGS) \ 12 | $(COVERAGE_CFLAGS) \ 13 | $(NULL) 14 | 15 | EXTRA_DIST = \ 16 | abis_test.ok \ 17 | $(NULL) 18 | 19 | noinst_PROGRAMS = \ 20 | abis_test \ 21 | $(NULL) 22 | 23 | abis_test_SOURCES = \ 24 | abis_test.c \ 25 | $(NULL) 26 | 27 | abis_test_LDADD = \ 28 | $(top_builddir)/src/libbsc/libbsc.a \ 29 | $(top_builddir)/src/libcommon/libcommon.a \ 30 | $(top_builddir)/src/libtrau/libtrau.a \ 31 | $(LIBOSMOCORE_LIBS) \ 32 | $(LIBOSMOABIS_LIBS) \ 33 | $(LIBOSMOGSM_LIBS) \ 34 | $(NULL) 35 | -------------------------------------------------------------------------------- /openbsc/tests/abis/abis_test.ok: -------------------------------------------------------------------------------- 1 | len: 26 2 | file_id: 31 36 38 64 34 37 32 00 3 | file_ver: 76 32 30 30 62 31 34 33 64 30 00 4 | len: 26 5 | file_id: 31 36 38 64 34 37 32 00 6 | file_ver: 76 32 30 30 62 31 34 33 64 31 00 7 | SELECTED: 1 8 | SELECTED: 0 9 | test_sw_selection(): OK 10 | -------------------------------------------------------------------------------- /openbsc/tests/atlocal.in: -------------------------------------------------------------------------------- 1 | enable_nat_test='@osmo_ac_build_nat@' 2 | enable_smpp_test='@osmo_ac_build_smpp@' 3 | enable_bsc_test='@osmo_ac_build_bsc@' 4 | enable_mgcp_transcoding_test='@osmo_ac_mgcp_transcoding@' 5 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat-trie/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include 2 | AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) 3 | AM_LDFLAGS = $(COVERAGE_LDFLAGS) 4 | 5 | EXTRA_DIST = bsc_nat_trie_test.ok prefixes.csv 6 | 7 | noinst_PROGRAMS = bsc_nat_trie_test 8 | 9 | bsc_nat_trie_test_SOURCES = bsc_nat_trie_test.c \ 10 | $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c 11 | bsc_nat_trie_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \ 12 | $(top_builddir)/src/libmgcp/libmgcp.a \ 13 | $(top_builddir)/src/libtrau/libtrau.a \ 14 | $(top_builddir)/src/libcommon/libcommon.a \ 15 | $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) -lrt \ 16 | $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) \ 17 | $(LIBOSMOABIS_LIBS) 18 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat-trie/bsc_nat_trie_test.ok: -------------------------------------------------------------------------------- 1 | Testing the trie 2 | Dumping the internal trie 3 | 1,1 4 | 12,2 5 | 123,3 6 | 1234,4 7 | 12345,5 8 | 123456,6 9 | 1234567,7 10 | 12345678,8 11 | 123456789,9 12 | 1234567890,10 13 | 13,11 14 | 14,12 15 | 15,13 16 | 16,14 17 | 82,16 18 | 823455,15 19 | +49123,17 20 | Done with the tests. 21 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat-trie/prefixes.csv: -------------------------------------------------------------------------------- 1 | 1,1 2 | 12,2 3 | 123,3 4 | 1234,4 5 | 12345,5 6 | 123456,6 7 | 1234567,7 8 | 12345678,8 9 | 123456789,9 10 | 1234567890,10 11 | 13,11 12 | 14,12 13 | 15,13 14 | 16,14 15 | 823455,15 16 | 82,16 17 | +49123,17 18 | 1ABC,18 19 | 12345678901234567890,19 20 | ,20 21 | 14A,21 22 | 124,324324324234 23 | 1234567890,10 24 | no line 25 | 99, 26 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOCTRL_LIBS) \ 12 | $(LIBOSMOSCCP_CFLAGS) \ 13 | $(LIBOSMOABIS_CFLAGS) \ 14 | $(LIBOSMONETIF_CFLAGS) \ 15 | $(COVERAGE_CFLAGS) \ 16 | $(NULL) 17 | 18 | AM_LDFLAGS = \ 19 | $(COVERAGE_LDFLAGS) \ 20 | $(NULL) 21 | 22 | EXTRA_DIST = \ 23 | bsc_nat_test.ok \ 24 | bsc_data.c \ 25 | barr.cfg \ 26 | barr_dup.cfg \ 27 | prefixes.csv \ 28 | $(NULL) 29 | 30 | noinst_PROGRAMS = \ 31 | bsc_nat_test \ 32 | $(NULL) 33 | 34 | bsc_nat_test_SOURCES = \ 35 | bsc_nat_test.c \ 36 | $(top_srcdir)/src/osmo-bsc_nat/bsc_filter.c \ 37 | $(top_srcdir)/src/osmo-bsc_nat/bsc_sccp.c \ 38 | $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_utils.c \ 39 | $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_rewrite.c \ 40 | $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_rewrite_trie.c \ 41 | $(top_srcdir)/src/osmo-bsc_nat/bsc_mgcp_utils.c \ 42 | $(top_srcdir)/src/osmo-bsc_nat/bsc_nat_filter.c 43 | 44 | bsc_nat_test_LDADD = \ 45 | $(top_builddir)/src/libfilter/libfilter.a \ 46 | $(top_builddir)/src/libbsc/libbsc.a \ 47 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 48 | $(top_builddir)/src/libmgcp/libmgcp.a \ 49 | $(top_builddir)/src/libtrau/libtrau.a \ 50 | $(top_builddir)/src/libcommon/libcommon.a \ 51 | $(LIBOSMOCORE_LIBS) \ 52 | $(LIBOSMOGSM_LIBS) \ 53 | $(LIBOSMOSCCP_LIBS) \ 54 | $(LIBOSMOVTY_LIBS) \ 55 | $(LIBOSMOABIS_LIBS) \ 56 | $(LIBOSMONETIF_LIBS) \ 57 | $(LIBOSMOCTRL_LIBS) \ 58 | -lrt \ 59 | $(NULL) 60 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat/barr.cfg: -------------------------------------------------------------------------------- 1 | 12123124:3:2: 2 | 12123123:3:1: 3 | 12123128:3:6: 4 | 12123125:3:3: 5 | 12123127:3:5: 6 | 12123126:3:4: 7 | 12123120:3:4: 8 | 12123119:3:4: 9 | 12123118:3:4: 10 | 12123117:3:4: 11 | 12123116:3:4: 12 | 12123115:3:4: 13 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat/barr_dup.cfg: -------------------------------------------------------------------------------- 1 | 12123124:3:2: 2 | 12123124:3:2: 3 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat/bsc_nat_test.ok: -------------------------------------------------------------------------------- 1 | Testing BSS Filtering. 2 | Going to test item: 0 3 | Going to test item: 1 4 | Going to test item: 2 5 | Going to test item: 3 6 | Going to test item: 4 7 | Going to test item: 5 8 | Going to test item: 6 9 | Going to test item: 7 10 | Going to test item: 8 11 | Going to test item: 9 12 | Going to test item: 10 13 | Going to test item: 11 14 | Going to test item: 12 15 | Testing connection tracking. 16 | Testing paging by lac. 17 | Testing MGCP. 18 | Testing finding of a BSC Connection 19 | Testing rewriting MGCP messages. 20 | Testing MGCP response parsing. 21 | Testing SMSC rewriting. 22 | Attempting to only rewrite the HDR 23 | Attempting to change nothing. 24 | Testing SMS TP-DA rewriting. 25 | IMSI: 12123115 CM: 3 LU: 4 26 | IMSI: 12123116 CM: 3 LU: 4 27 | IMSI: 12123117 CM: 3 LU: 4 28 | IMSI: 12123118 CM: 3 LU: 4 29 | IMSI: 12123119 CM: 3 LU: 4 30 | IMSI: 12123120 CM: 3 LU: 4 31 | IMSI: 12123123 CM: 3 LU: 1 32 | IMSI: 12123124 CM: 3 LU: 2 33 | IMSI: 12123125 CM: 3 LU: 3 34 | IMSI: 12123126 CM: 3 LU: 4 35 | IMSI: 12123127 CM: 3 LU: 5 36 | IMSI: 12123128 CM: 3 LU: 6 37 | IMSI: 12123124 CM: 3 LU: 2 38 | Testing LAC extraction from SCCP CR 39 | Testing execution completed. 40 | -------------------------------------------------------------------------------- /openbsc/tests/bsc-nat/prefixes.csv: -------------------------------------------------------------------------------- 1 | 0172,0049 2 | +49,0 3 | -------------------------------------------------------------------------------- /openbsc/tests/bsc/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOSCCP_CFLAGS) \ 12 | $(LIBOSMOABIS_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(COVERAGE_LDFLAGS) \ 18 | $(NULL) 19 | 20 | EXTRA_DIST = \ 21 | bsc_test.ok \ 22 | $(NULL) 23 | 24 | noinst_PROGRAMS = \ 25 | bsc_test \ 26 | $(NULL) 27 | 28 | bsc_test_SOURCES = \ 29 | bsc_test.c \ 30 | $(top_srcdir)/src/osmo-bsc/osmo_bsc_filter.c \ 31 | $(NULL) 32 | 33 | bsc_test_LDADD = \ 34 | $(top_builddir)/src/libbsc/libbsc.a \ 35 | $(top_builddir)/src/libmsc/libmsc.a \ 36 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 37 | $(top_builddir)/src/libmgcp/libmgcp.a \ 38 | $(top_builddir)/src/libtrau/libtrau.a \ 39 | $(top_builddir)/src/libcommon/libcommon.a \ 40 | $(LIBOSMOCORE_LIBS) \ 41 | $(LIBOSMOGSM_LIBS) \ 42 | $(LIBOSMOSCCP_LIBS) \ 43 | $(LIBOSMOVTY_LIBS) \ 44 | $(LIBOSMOABIS_LIBS) \ 45 | -lrt \ 46 | $(NULL) 47 | -------------------------------------------------------------------------------- /openbsc/tests/bsc/bsc_test.ok: -------------------------------------------------------------------------------- 1 | Testing BTS<->MSC message scan. 2 | Going to test item: 0 3 | Going to test item: 1 4 | Testing execution completed. 5 | -------------------------------------------------------------------------------- /openbsc/tests/channel/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(NULL) 13 | 14 | EXTRA_DIST = \ 15 | channel_test.ok \ 16 | $(NULL) 17 | 18 | noinst_PROGRAMS = \ 19 | channel_test \ 20 | $(NULL) 21 | 22 | channel_test_SOURCES = \ 23 | channel_test.c \ 24 | $(NULL) 25 | 26 | channel_test_LDFLAGS = \ 27 | -Wl,--wrap=paging_request \ 28 | $(NULL) 29 | 30 | channel_test_LDADD = \ 31 | $(top_builddir)/src/libmsc/libmsc.a \ 32 | $(top_builddir)/src/libbsc/libbsc.a \ 33 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 34 | $(top_builddir)/src/libcommon/libcommon.a \ 35 | $(LIBOSMOCORE_LIBS) \ 36 | $(LIBOSMOGSM_LIBS) \ 37 | $(LIBOSMOABIS_LIBS) \ 38 | $(LIBCRYPTO_LIBS) \ 39 | -ldbi \ 40 | $(NULL) 41 | -------------------------------------------------------------------------------- /openbsc/tests/channel/channel_test.ok: -------------------------------------------------------------------------------- 1 | Testing the gsm_subscriber chan logic 2 | Reached, didn't crash, test passed 3 | Testing subslot numbers for pchan types 4 | Testing the lchan printing: (bts=45,trx=0,ts=3,ss=4) (bts=45,trx=1,ts=3,ss=4) 5 | -------------------------------------------------------------------------------- /openbsc/tests/db/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(LIBSMPP34_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(COVERAGE_LDFLAGS) \ 18 | $(NULL) 19 | 20 | EXTRA_DIST = \ 21 | db_test.ok \ 22 | db_test.err \ 23 | hlr.sqlite3 \ 24 | $(NULL) 25 | 26 | noinst_PROGRAMS = \ 27 | db_test \ 28 | $(NULL) 29 | 30 | db_test_SOURCES = \ 31 | db_test.c \ 32 | $(NULL) 33 | 34 | db_test_LDADD = \ 35 | $(top_builddir)/src/libbsc/libbsc.a \ 36 | $(top_builddir)/src/libmsc/libmsc.a \ 37 | $(top_builddir)/src/libbsc/libbsc.a \ 38 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 39 | $(top_builddir)/src/libtrau/libtrau.a \ 40 | $(top_builddir)/src/libcommon/libcommon.a \ 41 | $(LIBOSMOCORE_LIBS) \ 42 | $(LIBOSMOABIS_LIBS) \ 43 | $(LIBOSMOGSM_LIBS) \ 44 | $(LIBSMPP34_LIBS) \ 45 | $(LIBOSMOVTY_LIBS) \ 46 | -ldbi \ 47 | $(NULL) 48 | -------------------------------------------------------------------------------- /openbsc/tests/db/db_test.err: -------------------------------------------------------------------------------- 1 | Going to migrate from revision 3 2 | Going to migrate from revision 4 3 | -------------------------------------------------------------------------------- /openbsc/tests/db/db_test.ok: -------------------------------------------------------------------------------- 1 | Testing subscriber database code. 2 | DB: Database initialized. 3 | DB: Database prepared. 4 | Done 5 | -------------------------------------------------------------------------------- /openbsc/tests/db/hlr.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osmocom/openbsc/2b80df6e794d22a09c56882834c67185acaaf8a9/openbsc/tests/db/hlr.sqlite3 -------------------------------------------------------------------------------- /openbsc/tests/gsm0408/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | $(LIBOSMOCORE_CFLAGS) \ 9 | $(LIBOSMOGSM_CFLAGS) \ 10 | $(LIBOSMOABIS_CFLAGS) \ 11 | $(NULL) 12 | 13 | noinst_PROGRAMS = \ 14 | gsm0408_test \ 15 | $(NULL) 16 | 17 | EXTRA_DIST = \ 18 | gsm0408_test.ok \ 19 | $(NULL) 20 | 21 | gsm0408_test_SOURCES = \ 22 | gsm0408_test.c \ 23 | $(NULL) 24 | 25 | gsm0408_test_LDADD = \ 26 | $(top_builddir)/src/libbsc/libbsc.a \ 27 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 28 | $(top_builddir)/src/libtrau/libtrau.a \ 29 | $(top_builddir)/src/libcommon/libcommon.a \ 30 | $(LIBOSMOCORE_LIBS) \ 31 | $(LIBOSMOGSM_LIBS) \ 32 | $(LIBOSMOABIS_LIBS) \ 33 | -ldbi \ 34 | $(NULL) 35 | -------------------------------------------------------------------------------- /openbsc/tests/mgcp/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_srcdir) \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | -ggdb3 \ 10 | $(LIBOSMOCORE_CFLAGS) \ 11 | $(LIBOSMOGSM_FLAGS) \ 12 | $(LIBOSMONETIF_CFLAGS) \ 13 | $(LIBOSMOABIS_CFLAGS) \ 14 | $(LIBOSMOSCCP_CFLAGS) \ 15 | $(COVERAGE_CFLAGS) \ 16 | $(LIBBCG729_CFLAGS) \ 17 | $(NULL) 18 | 19 | AM_LDFLAGS = \ 20 | $(COVERAGE_LDFLAGS) \ 21 | $(NULL) 22 | 23 | EXTRA_DIST = \ 24 | mgcp_test.ok \ 25 | mgcp_transcoding_test.ok \ 26 | $(NULL) 27 | 28 | noinst_PROGRAMS = \ 29 | mgcp_test \ 30 | $(NULL) 31 | if BUILD_MGCP_TRANSCODING 32 | noinst_PROGRAMS += \ 33 | mgcp_transcoding_test \ 34 | $(NULL) 35 | endif 36 | 37 | mgcp_test_SOURCES = \ 38 | mgcp_test.c \ 39 | $(NULL) 40 | 41 | mgcp_test_LDADD = \ 42 | $(top_builddir)/src/libbsc/libbsc.a \ 43 | $(top_builddir)/src/libmgcp/libmgcp.a \ 44 | $(top_builddir)/src/libcommon/libcommon.a \ 45 | $(LIBOSMOCORE_LIBS) \ 46 | $(LIBOSMOGSM_LIBS) \ 47 | $(LIBOSMOSCCP_LIBS) \ 48 | $(LIBOSMOVTY_LIBS) \ 49 | $(LIBRARY_DL) \ 50 | $(LIBOSMONETIF_LIBS) \ 51 | -lrt \ 52 | -lm \ 53 | $(NULL) 54 | 55 | mgcp_transcoding_test_SOURCES = \ 56 | mgcp_transcoding_test.c \ 57 | $(NULL) 58 | 59 | mgcp_transcoding_test_LDADD = \ 60 | $(top_builddir)/src/libbsc/libbsc.a \ 61 | $(top_builddir)/src/libmgcp/libmgcp.a \ 62 | $(top_builddir)/src/libcommon/libcommon.a \ 63 | $(LIBOSMOCORE_LIBS) \ 64 | $(LIBOSMOGSM_LIBS) \ 65 | $(LIBBCG729_LIBS) \ 66 | $(LIBOSMOSCCP_LIBS) \ 67 | $(LIBOSMOVTY_LIBS) \ 68 | $(LIBRARY_DL) \ 69 | $(LIBOSMONETIF_LIBS) \ 70 | $(LIBRARY_GSM) \ 71 | -lrt \ 72 | -lm \ 73 | $(NULL) 74 | -------------------------------------------------------------------------------- /openbsc/tests/mm_auth/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | $(LIBOSMOCORE_CFLAGS) \ 9 | $(LIBOSMOABIS_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBCRYPTO_CFLAGS) \ 12 | $(NULL) 13 | 14 | noinst_PROGRAMS = \ 15 | mm_auth_test \ 16 | $(NULL) 17 | 18 | EXTRA_DIST = \ 19 | mm_auth_test.ok \ 20 | $(NULL) 21 | 22 | mm_auth_test_SOURCES = \ 23 | mm_auth_test.c \ 24 | $(NULL) 25 | 26 | mm_auth_test_LDFLAGS = \ 27 | -Wl,--wrap=db_get_authinfo_for_subscr \ 28 | -Wl,--wrap=db_get_lastauthtuple_for_subscr \ 29 | -Wl,--wrap=db_sync_lastauthtuple_for_subscr \ 30 | $(NULL) 31 | 32 | mm_auth_test_LDADD = \ 33 | $(top_builddir)/src/libmsc/libmsc.a \ 34 | $(top_builddir)/src/libcommon/libcommon.a \ 35 | $(LIBOSMOCORE_LIBS) \ 36 | $(LIBOSMOGSM_LIBS) \ 37 | $(NULL) 38 | -------------------------------------------------------------------------------- /openbsc/tests/mm_auth/mm_auth_test.ok: -------------------------------------------------------------------------------- 1 | 2 | * test_error() 3 | wrapped: db_get_authinfo_for_subscr(): rc = -5 4 | auth_get_tuple_for_subscr(key_seq=0) --> auth_action == AUTH_ERROR 5 | 6 | * test_auth_not_avail() 7 | wrapped: db_get_authinfo_for_subscr(): rc = -2 8 | auth_get_tuple_for_subscr(key_seq=0) --> auth_action == AUTH_NOT_AVAIL 9 | 10 | * test_auth_then_ciph1() 11 | wrapped: db_get_authinfo_for_subscr(): rc = 0 12 | wrapped: db_get_lastauthtuple_for_subscr(): rc = -2 13 | wrapped: db_sync_lastauthtuple_for_subscr(): rc = 0 14 | auth_get_tuple_for_subscr(key_seq=0) --> auth_action == AUTH_DO_AUTH_THEN_CIPH 15 | wrapped: db_get_authinfo_for_subscr(): rc = 0 16 | wrapped: db_get_lastauthtuple_for_subscr(): rc = -2 17 | wrapped: db_sync_lastauthtuple_for_subscr(): rc = 0 18 | auth_get_tuple_for_subscr(key_seq=0) --> auth_action == AUTH_DO_AUTH_THEN_CIPH 19 | 20 | * test_auth_then_ciph2() 21 | wrapped: db_get_authinfo_for_subscr(): rc = 0 22 | wrapped: db_get_lastauthtuple_for_subscr(): rc = 0 23 | wrapped: db_sync_lastauthtuple_for_subscr(): rc = 0 24 | auth_get_tuple_for_subscr(key_seq=7) --> auth_action == AUTH_DO_AUTH_THEN_CIPH 25 | wrapped: db_get_authinfo_for_subscr(): rc = 0 26 | wrapped: db_get_lastauthtuple_for_subscr(): rc = 0 27 | wrapped: db_sync_lastauthtuple_for_subscr(): rc = 0 28 | auth_get_tuple_for_subscr(key_seq=7) --> auth_action == AUTH_DO_AUTH_THEN_CIPH 29 | 30 | * test_auth_reuse() 31 | wrapped: db_get_authinfo_for_subscr(): rc = 0 32 | wrapped: db_get_lastauthtuple_for_subscr(): rc = 0 33 | wrapped: db_sync_lastauthtuple_for_subscr(): rc = 0 34 | auth_get_tuple_for_subscr(key_seq=3) --> auth_action == AUTH_DO_CIPH 35 | 36 | * test_auth_reuse_key_seq_mismatch() 37 | wrapped: db_get_authinfo_for_subscr(): rc = 0 38 | wrapped: db_get_lastauthtuple_for_subscr(): rc = 0 39 | wrapped: db_sync_lastauthtuple_for_subscr(): rc = 0 40 | auth_get_tuple_for_subscr(key_seq=4) --> auth_action == AUTH_DO_AUTH_THEN_CIPH 41 | -------------------------------------------------------------------------------- /openbsc/tests/nanobts_omlattr/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | $(LIBOSMOCORE_CFLAGS) \ 9 | $(LIBOSMOGSM_CFLAGS) \ 10 | $(LIBOSMOABIS_CFLAGS) \ 11 | $(NULL) 12 | 13 | noinst_PROGRAMS = \ 14 | nanobts_omlattr_test \ 15 | $(NULL) 16 | 17 | EXTRA_DIST = \ 18 | nanobts_omlattr_test.ok \ 19 | $(NULL) 20 | 21 | nanobts_omlattr_test_SOURCES = \ 22 | nanobts_omlattr_test.c \ 23 | $(NULL) 24 | 25 | nanobts_omlattr_test_LDADD = \ 26 | $(top_builddir)/src/libbsc/libbsc.a \ 27 | $(top_builddir)/src/libmsc/libmsc.a \ 28 | $(top_builddir)/src/libtrau/libtrau.a \ 29 | $(top_builddir)/src/libcommon/libcommon.a \ 30 | $(LIBOSMOCORE_LIBS) \ 31 | $(LIBOSMOGSM_LIBS) \ 32 | $(LIBOSMOABIS_LIBS) \ 33 | -ldbi \ 34 | $(NULL) 35 | -------------------------------------------------------------------------------- /openbsc/tests/nanobts_omlattr/nanobts_omlattr_test.ok: -------------------------------------------------------------------------------- 1 | Testing nanobts_attr_bts_get()... 2 | result= 19555b61676d7318060e00020120331e2424a83421a81f3f2500010a0c0a0b012a0a2b03e80a80230a080362093f99000700f11000010539 3 | expected=19555b61676d7318060e00020120331e2424a83421a81f3f2500010a0c0a0b012a0a2b03e80a80230a080362093f99000700f11000010539 4 | ok. 5 | 6 | Testing nanobts_attr_nse_get()... 7 | result= 9d00020065a00007030303031e030aa1000b03030303030a030a030a03 8 | expected=9d00020065a00007030303031e030aa1000b03030303030a030a030a03 9 | ok. 10 | 11 | Testing nanobts_attr_cell_get()... 12 | result= 9a0001009c000205039e00020002a30009140505a0050a04080fa800020f00a9000500fa00fa02 13 | expected=9a0001009c000205039e00020002a30009140505a0050a04080fa800020f00a9000500fa00fa02 14 | ok. 15 | 16 | Testing nanobts_attr_nscv_get()... 17 | result= 9f00020065a2000859d80a0901655a3c 18 | expected=9f00020065a2000859d80a0901655a3c 19 | ok. 20 | 21 | Testing nanobts_attr_nscv_get()... 22 | result= 2d0b0500020362 23 | expected=2d0b0500020362 24 | ok. 25 | 26 | Done 27 | -------------------------------------------------------------------------------- /openbsc/tests/osmo-bsc-nat.cfg: -------------------------------------------------------------------------------- 1 | # Same as doc/examples/osmo-bsc_nat/osmo-bsc-nat.cfg, but without 'bscs-config-file' 2 | ! 3 | ! OsmoBSCNAT (0.12.0.266-2daa9) configuration saved from vty 4 | !! 5 | ! 6 | log stderr 7 | logging filter all 1 8 | logging color 1 9 | logging timestamp 0 10 | logging level all debug 11 | logging level rll notice 12 | logging level cc notice 13 | logging level mm notice 14 | logging level rr notice 15 | logging level rsl notice 16 | logging level nm info 17 | logging level mncc notice 18 | logging level pag notice 19 | logging level meas notice 20 | logging level sccp notice 21 | logging level msc notice 22 | logging level mgcp notice 23 | logging level ho notice 24 | logging level db notice 25 | logging level ref notice 26 | logging level gprs debug 27 | logging level ns info 28 | logging level bssgp debug 29 | logging level llc debug 30 | logging level sndcp debug 31 | logging level nat notice 32 | logging level ctrl notice 33 | logging level smpp debug 34 | logging level lglobal notice 35 | logging level llapd notice 36 | logging level linp notice 37 | logging level lmux notice 38 | logging level lmi notice 39 | logging level lmib notice 40 | logging level lsms notice 41 | ! 42 | line vty 43 | no login 44 | ! 45 | mgcp 46 | bind ip 0.0.0.0 47 | bind port 2427 48 | rtp bts-base 4000 49 | rtp net-base 16000 50 | rtp ip-dscp 0 51 | no rtcp-omit 52 | sdp audio-payload number 126 53 | sdp audio-payload name AMR/8000 54 | loop 0 55 | number endpoints 1 56 | call-agent ip 127.0.0.1 57 | rtp transcoder-base 0 58 | transcoder-remote-base 4000 59 | nat 60 | msc ip 127.0.0.1 61 | msc port 5000 62 | timeout auth 2 63 | timeout ping 20 64 | timeout pong 5 65 | ip-dscp 0 66 | access-list bla imsi-allow ^11$ 67 | -------------------------------------------------------------------------------- /openbsc/tests/smpp/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | -I$(top_srcdir)/src/libmsc \ 5 | $(NULL) 6 | 7 | AM_CFLAGS = \ 8 | -Wall \ 9 | -ggdb3 \ 10 | $(LIBOSMOCORE_CFLAGS) \ 11 | $(LIBOSMOGSM_CFLAGS) \ 12 | $(LIBOSMOSCCP_CFLAGS) \ 13 | $(LIBOSMOABIS_CFLAGS) \ 14 | $(COVERAGE_CFLAGS) \ 15 | $(LIBSMPP34_CFLAGS) \ 16 | $(NULL) 17 | 18 | AM_LDFLAGS = \ 19 | $(COVERAGE_LDFLAGS) \ 20 | $(NULL) 21 | 22 | EXTRA_DIST = \ 23 | smpp_test.ok \ 24 | smpp_test.err \ 25 | $(NULL) 26 | 27 | noinst_PROGRAMS = \ 28 | smpp_test \ 29 | $(NULL) 30 | 31 | smpp_test_SOURCES = \ 32 | smpp_test.c \ 33 | $(top_builddir)/src/libmsc/smpp_utils.c \ 34 | $(NULL) 35 | 36 | smpp_test_LDADD = \ 37 | $(top_builddir)/src/libcommon/libcommon.a \ 38 | $(LIBOSMOCORE_LIBS) \ 39 | $(LIBOSMOGSM_LIBS) \ 40 | $(NULL) 41 | -------------------------------------------------------------------------------- /openbsc/tests/smpp/smpp_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2013 by Holger Hans Peter Freyther 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include "smpp_smsc.h" 29 | 30 | struct coding_test { 31 | uint8_t dcs; 32 | uint8_t coding; 33 | int mode; 34 | int res; 35 | }; 36 | 37 | static struct coding_test codecs[] = { 38 | { .dcs = 0xf6 , .coding = 0x02, .mode = MODE_8BIT, .res = 0 }, 39 | { .dcs = 0xf2 , .coding = 0x01, .mode = MODE_7BIT, .res = 0 }, 40 | { .dcs = 0x02 , .coding = 0x01, .mode = MODE_7BIT, .res = 0 }, 41 | { .dcs = 0x06 , .coding = 0x02, .mode = MODE_8BIT, .res = 0 }, 42 | { .dcs = 0x0A , .coding = 0x08, .mode = MODE_8BIT, .res = 0 }, 43 | { .dcs = 0x0E , .coding = 0xFF, .mode = 0xFF, .res = -1 }, 44 | { .dcs = 0xE0 , .coding = 0xFF, .mode = 0xFF, .res = -1 }, 45 | }; 46 | 47 | static void test_coding_scheme(void) 48 | { 49 | int i; 50 | printf("Testing coding scheme support\n"); 51 | 52 | for (i = 0; i < ARRAY_SIZE(codecs); ++i) { 53 | uint8_t coding; 54 | int mode, res; 55 | 56 | res = smpp_determine_scheme(codecs[i].dcs, &coding, &mode); 57 | OSMO_ASSERT(res == codecs[i].res); 58 | if (res != -1) { 59 | OSMO_ASSERT(mode == codecs[i].mode); 60 | OSMO_ASSERT(coding == codecs[i].coding); 61 | } 62 | } 63 | } 64 | 65 | int main(int argc, char **argv) 66 | { 67 | osmo_init_logging(&log_info); 68 | log_set_use_color(osmo_stderr_target, 0); 69 | log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); 70 | log_set_print_category(osmo_stderr_target, 0); 71 | log_set_print_category_hex(osmo_stderr_target, 0); 72 | 73 | test_coding_scheme(); 74 | return EXIT_SUCCESS; 75 | } 76 | -------------------------------------------------------------------------------- /openbsc/tests/smpp/smpp_test.err: -------------------------------------------------------------------------------- 1 | SMPP MO Unknown Data Coding 0x0e 2 | SMPP MO Unknown Data Coding 0xe0 3 | -------------------------------------------------------------------------------- /openbsc/tests/smpp/smpp_test.ok: -------------------------------------------------------------------------------- 1 | Testing coding scheme support 2 | -------------------------------------------------------------------------------- /openbsc/tests/subscr/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(LIBSMPP34_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(COVERAGE_LDFLAGS) \ 18 | $(NULL) 19 | 20 | EXTRA_DIST = \ 21 | subscr_test.ok \ 22 | bsc_subscr_test.ok \ 23 | bsc_subscr_test.err \ 24 | $(NULL) 25 | 26 | noinst_PROGRAMS = \ 27 | subscr_test \ 28 | bsc_subscr_test \ 29 | $(NULL) 30 | 31 | subscr_test_SOURCES = \ 32 | subscr_test.c \ 33 | $(NULL) 34 | 35 | subscr_test_LDADD = \ 36 | $(top_builddir)/src/libbsc/libbsc.a \ 37 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 38 | $(top_builddir)/src/libtrau/libtrau.a \ 39 | $(top_builddir)/src/libcommon/libcommon.a \ 40 | $(LIBOSMOCORE_LIBS) \ 41 | $(LIBOSMOABIS_LIBS) \ 42 | $(LIBOSMOGSM_LIBS) \ 43 | $(LIBSMPP34_LIBS) \ 44 | $(LIBOSMOVTY_LIBS) \ 45 | $(NULL) 46 | 47 | bsc_subscr_test_SOURCES = \ 48 | bsc_subscr_test.c \ 49 | $(NULL) 50 | 51 | bsc_subscr_test_LDADD = \ 52 | $(top_builddir)/src/libbsc/libbsc.a \ 53 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 54 | $(top_builddir)/src/libtrau/libtrau.a \ 55 | $(top_builddir)/src/libcommon/libcommon.a \ 56 | $(LIBOSMOCORE_LIBS) \ 57 | $(LIBOSMOABIS_LIBS) \ 58 | $(LIBOSMOGSM_LIBS) \ 59 | $(LIBSMPP34_LIBS) \ 60 | $(LIBOSMOVTY_LIBS) \ 61 | $(NULL) 62 | -------------------------------------------------------------------------------- /openbsc/tests/subscr/bsc_subscr_test.err: -------------------------------------------------------------------------------- 1 | DREF BSC subscr IMSI:1234567890 usage increases to: 2 2 | DREF BSC subscr IMSI:1234567890 usage decreases to: 1 3 | DREF BSC subscr IMSI:1234567890 usage increases to: 2 4 | DREF BSC subscr IMSI:1234567890 usage decreases to: 1 5 | DREF BSC subscr IMSI:9876543210 usage increases to: 2 6 | DREF BSC subscr IMSI:9876543210 usage decreases to: 1 7 | DREF BSC subscr IMSI:5656565656 usage increases to: 2 8 | DREF BSC subscr IMSI:5656565656 usage decreases to: 1 9 | DREF BSC subscr IMSI:1234567890 usage decreases to: 0 10 | DREF BSC subscr IMSI:9876543210 usage increases to: 2 11 | DREF BSC subscr IMSI:9876543210 usage decreases to: 1 12 | DREF BSC subscr IMSI:5656565656 usage increases to: 2 13 | DREF BSC subscr IMSI:5656565656 usage decreases to: 1 14 | DREF BSC subscr IMSI:9876543210 usage decreases to: 0 15 | DREF BSC subscr IMSI:5656565656 usage increases to: 2 16 | DREF BSC subscr IMSI:5656565656 usage decreases to: 1 17 | DREF BSC subscr IMSI:5656565656 usage decreases to: 0 18 | -------------------------------------------------------------------------------- /openbsc/tests/subscr/bsc_subscr_test.ok: -------------------------------------------------------------------------------- 1 | Testing BSC subscriber core code. 2 | Test BSC subscriber allocation and deletion 3 | llist_count(bsc_subscribers) == 0 4 | llist_count(bsc_subscribers) == 1 5 | llist_count(bsc_subscribers) == 1 6 | llist_count(bsc_subscribers) == 2 7 | llist_count(bsc_subscribers) == 3 8 | llist_count(bsc_subscribers) == 2 9 | llist_count(bsc_subscribers) == 1 10 | llist_count(bsc_subscribers) == 0 11 | Done 12 | -------------------------------------------------------------------------------- /openbsc/tests/subscr/subscr_test.ok: -------------------------------------------------------------------------------- 1 | Testing subscriber core code. 2 | Test subscriber allocation and deletion 3 | Done 4 | -------------------------------------------------------------------------------- /openbsc/tests/trau/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | $(all_includes) \ 3 | -I$(top_srcdir)/include \ 4 | $(NULL) 5 | 6 | AM_CFLAGS = \ 7 | -Wall \ 8 | -ggdb3 \ 9 | $(LIBOSMOCORE_CFLAGS) \ 10 | $(LIBOSMOGSM_CFLAGS) \ 11 | $(LIBOSMOABIS_CFLAGS) \ 12 | $(LIBSMPP34_CFLAGS) \ 13 | $(COVERAGE_CFLAGS) \ 14 | $(NULL) 15 | 16 | AM_LDFLAGS = \ 17 | $(COVERAGE_LDFLAGS) \ 18 | $(NULL) 19 | 20 | EXTRA_DIST = \ 21 | trau_test.ok \ 22 | $(NULL) 23 | 24 | noinst_PROGRAMS = \ 25 | trau_test \ 26 | $(NULL) 27 | 28 | trau_test_SOURCES = \ 29 | trau_test.c \ 30 | $(NULL) 31 | 32 | trau_test_LDADD = \ 33 | $(top_builddir)/src/libbsc/libbsc.a \ 34 | $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ 35 | $(top_builddir)/src/libtrau/libtrau.a \ 36 | $(top_builddir)/src/libcommon/libcommon.a \ 37 | $(LIBOSMOCORE_LIBS) \ 38 | $(LIBOSMOABIS_LIBS) \ 39 | $(LIBOSMOGSM_LIBS) \ 40 | $(LIBSMPP34_LIBS) \ 41 | $(LIBOSMOVTY_LIBS) \ 42 | $(LIBRARY_DL) \ 43 | -ldbi \ 44 | $(NULL) 45 | 46 | -------------------------------------------------------------------------------- /openbsc/tests/trau/trau_test.c: -------------------------------------------------------------------------------- 1 | /* (C) 2013 by Andreas Eversberg 2 | * All Rights Reserved 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Affero General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Affero General Public License 15 | * along with this program. If not, see . 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | void test_trau_fr_efr(unsigned char *data) 28 | { 29 | struct decoded_trau_frame tf; 30 | struct msgb *msg; 31 | struct gsm_data_frame *frame; 32 | 33 | printf("Testing TRAU FR transcoding.\n"); 34 | data[0] = 0xd0; 35 | trau_encode_fr(&tf, data); 36 | tf.c_bits[11] = 0; /* clear BFI */ 37 | msg = trau_decode_fr(1, &tf); 38 | OSMO_ASSERT(msg != NULL); 39 | frame = (struct gsm_data_frame *)msg->data; 40 | OSMO_ASSERT(frame->msg_type == GSM_TCHF_FRAME); 41 | OSMO_ASSERT(!memcmp(frame->data, data, 33)); 42 | msgb_free(msg); 43 | 44 | printf("Testing TRAU EFR transcoding.\n"); 45 | data[0] = 0xc0; 46 | trau_encode_efr(&tf, data); 47 | OSMO_ASSERT(tf.d_bits[0] == 1); /* spare bit must be 1 */ 48 | tf.c_bits[11] = 0; /* clear BFI */ 49 | msg = trau_decode_efr(1, &tf); 50 | OSMO_ASSERT(msg != NULL); 51 | frame = (struct gsm_data_frame *)msg->data; 52 | OSMO_ASSERT(frame->msg_type == GSM_TCHF_FRAME_EFR); 53 | OSMO_ASSERT(!memcmp(frame->data, data, 31)); 54 | 55 | printf("Testing TRAU EFR decoding with CRC error.\n"); 56 | tf.d_bits[0] = 0; /* spare bit must be included */ 57 | msg = trau_decode_efr(1, &tf); 58 | OSMO_ASSERT(msg != NULL); 59 | frame = (struct gsm_data_frame *)msg->data; 60 | OSMO_ASSERT(frame->msg_type == GSM_BAD_FRAME); 61 | msgb_free(msg); 62 | } 63 | 64 | int main() 65 | { 66 | unsigned char data[33]; 67 | int i; 68 | 69 | msgb_talloc_ctx_init(NULL, 0); 70 | 71 | memset(data, 0x00, sizeof(data)); 72 | test_trau_fr_efr(data); 73 | memset(data, 0xff, sizeof(data)); 74 | test_trau_fr_efr(data); 75 | srandom(42); 76 | for (i = 0; i < sizeof(data); i++) 77 | data[i] = random(); 78 | test_trau_fr_efr(data); 79 | printf("Done\n"); 80 | return 0; 81 | } 82 | 83 | /* stubs */ 84 | void vty_out() {} 85 | -------------------------------------------------------------------------------- /openbsc/tests/trau/trau_test.ok: -------------------------------------------------------------------------------- 1 | Testing TRAU FR transcoding. 2 | Testing TRAU EFR transcoding. 3 | Testing TRAU EFR decoding with CRC error. 4 | Testing TRAU FR transcoding. 5 | Testing TRAU EFR transcoding. 6 | Testing TRAU EFR decoding with CRC error. 7 | Testing TRAU FR transcoding. 8 | Testing TRAU EFR transcoding. 9 | Testing TRAU EFR decoding with CRC error. 10 | Done 11 | -------------------------------------------------------------------------------- /openbsc/tools/hlrstat.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use DBI; 5 | my $dbh = DBI->connect("dbi:SQLite:dbname=hlr.sqlite3","",""); 6 | 7 | 8 | my %mcc_names; 9 | my %mcc_mnc_names; 10 | 11 | sub get_mcc_mnc_name($) 12 | { 13 | my $mcc_mnc = shift; 14 | my $ret = $mcc_mnc; 15 | 16 | if ($mcc_mnc_names{$mcc_mnc} ne '') { 17 | $ret = $mcc_mnc_names{$mcc_mnc}; 18 | } 19 | 20 | return $ret; 21 | } 22 | 23 | sub read_networks($) 24 | { 25 | my $filename = shift; 26 | my $cur_name; 27 | 28 | open(INFILE, $filename); 29 | while (my $l = ) { 30 | chomp($l); 31 | if ($l =~ /^#/) { 32 | next; 33 | } 34 | if ($l =~ /^\t/) { 35 | my ($mcc, $mnc, $brand, $r) = split(' ', $l, 4); 36 | #printf("%s|%s|%s\n", $mcc, $mnc, $brand); 37 | $mcc_mnc_names{"$mcc-$mnc"} = $brand; 38 | $mcc_names{$mcc} = $cur_name; 39 | } elsif ($l =~ /^(\w\w)\t(.*)/) { 40 | #printf("%s|%s\n", $1, $2); 41 | $cur_name = $2; 42 | } 43 | } 44 | close(INFILE); 45 | } 46 | 47 | read_networks("networks.tab"); 48 | 49 | my %oper_count; 50 | my %country_count; 51 | 52 | #my $sth = $dbh->prepare("SELECT imsi FROM subscriber where authorized=1"); 53 | my $sth = $dbh->prepare("SELECT imsi FROM subscriber"); 54 | 55 | $sth->execute(); 56 | 57 | while (my $href = $sth->fetchrow_hashref) { 58 | my ($mcc, $mnc) = $$href{imsi} =~ /(\d{3})(\d{2}).*/; 59 | #printf("%s %s-%s \n", $$href{imsi}, $mcc, $mnc); 60 | $oper_count{"$mcc-$mnc"}++; 61 | $country_count{$mcc}++; 62 | } 63 | 64 | 65 | foreach my $c (sort{$country_count{$b} <=> $country_count{$a}} keys %country_count) { 66 | printf("%s: %d\n", $mcc_names{$c}, $country_count{$c}); 67 | 68 | foreach my $k (sort{$oper_count{$b} <=> $oper_count{$a}} keys %oper_count) { 69 | if ($k =~ /^$c-/) { 70 | printf("\t%s: %d\n", get_mcc_mnc_name($k), $oper_count{$k}); 71 | } 72 | } 73 | } 74 | --------------------------------------------------------------------------------