mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 21:13:44 +00:00
Compare commits
379 Commits
openbsc/0.
...
openbsc/0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0977e0c4b8 | ||
|
|
68368dd99a | ||
|
|
50be1a9d7f | ||
|
|
951f34b885 | ||
|
|
c2c0ea700b | ||
|
|
8c36fdb1d8 | ||
|
|
55466197f0 | ||
|
|
dec7387a22 | ||
|
|
998a98185f | ||
|
|
5d2a30a83c | ||
|
|
c5df08b388 | ||
|
|
93ef33edb6 | ||
|
|
03ff1c8477 | ||
|
|
41b42c7229 | ||
|
|
faf1f64a2d | ||
|
|
26d0fe3c89 | ||
|
|
6c88217c19 | ||
|
|
d5b3ca621b | ||
|
|
300457b7d2 | ||
|
|
45222a79e2 | ||
|
|
08e324fda7 | ||
|
|
f5ede52a22 | ||
|
|
40aac3f7f6 | ||
|
|
3365cd1cfe | ||
|
|
2957de9228 | ||
|
|
1c5dd2c9bb | ||
|
|
6b8a56c365 | ||
|
|
511bd8e98c | ||
|
|
b52b4cfc48 | ||
|
|
8cbc4a406d | ||
|
|
914660d6f6 | ||
|
|
63ef215e15 | ||
|
|
f7e94106bb | ||
|
|
2692e3bcff | ||
|
|
347e7ba377 | ||
|
|
1491f2e7a9 | ||
|
|
2eb6e2c0ad | ||
|
|
3ffcf2045c | ||
|
|
da6597ea29 | ||
|
|
694c82d8e3 | ||
|
|
2a260ee9bc | ||
|
|
bb5c594e15 | ||
|
|
86aaefe17b | ||
|
|
2192ed8d61 | ||
|
|
c951946691 | ||
|
|
67c0c7f8aa | ||
|
|
851f1206a8 | ||
|
|
d4c6f8b343 | ||
|
|
066a0f5c0b | ||
|
|
2b697a6671 | ||
|
|
0c1a30312d | ||
|
|
37a63ca34a | ||
|
|
3dccda5ef0 | ||
|
|
6142dc407a | ||
|
|
2b17454f4a | ||
|
|
42b9195023 | ||
|
|
30ebcf71d0 | ||
|
|
00a8ab9d3b | ||
|
|
670ffe3290 | ||
|
|
74c7dc36b6 | ||
|
|
cc98d188eb | ||
|
|
df82b72375 | ||
|
|
08542564fe | ||
|
|
a3199070e9 | ||
|
|
a62b247b02 | ||
|
|
d271a350b4 | ||
|
|
c57e6eda9b | ||
|
|
15eae8dcaf | ||
|
|
4f8ad5350a | ||
|
|
1942729fa7 | ||
|
|
ca86dd5776 | ||
|
|
b70bd52c2a | ||
|
|
4329099e28 | ||
|
|
f3b5932ecf | ||
|
|
7c78c479ac | ||
|
|
d02e68b24d | ||
|
|
e1d2e1c74c | ||
|
|
0a65461065 | ||
|
|
59947a0329 | ||
|
|
135a6bd3c6 | ||
|
|
ab386e6120 | ||
|
|
6b353778c4 | ||
|
|
cab0d7bedc | ||
|
|
b4d913d336 | ||
|
|
0eae6136e2 | ||
|
|
f7a2b19771 | ||
|
|
90dc4679e1 | ||
|
|
bc56b0b771 | ||
|
|
a90eb0066a | ||
|
|
05ac9e365c | ||
|
|
9cc771bd3d | ||
|
|
5763093285 | ||
|
|
bc076ae53b | ||
|
|
4ad44249c3 | ||
|
|
e54db171ee | ||
|
|
7c3298af9e | ||
|
|
80c37bd806 | ||
|
|
594b322a4e | ||
|
|
ed999b29bc | ||
|
|
128892f55f | ||
|
|
3488c3ddc4 | ||
|
|
c7e49d35ea | ||
|
|
06c9da6c22 | ||
|
|
8697e43bb2 | ||
|
|
ed5cacb240 | ||
|
|
7abecfcfc9 | ||
|
|
c45a8045a6 | ||
|
|
7fad70c198 | ||
|
|
013ae46ef6 | ||
|
|
fc462dd59e | ||
|
|
6fc6a12c07 | ||
|
|
7ddc318687 | ||
|
|
513da17732 | ||
|
|
563d99d3c3 | ||
|
|
46f799b224 | ||
|
|
e8bd9e885d | ||
|
|
5da9b52d06 | ||
|
|
c21aa18e35 | ||
|
|
0000ca5885 | ||
|
|
986926ebde | ||
|
|
4da5592c46 | ||
|
|
28d9ccbca0 | ||
|
|
f7dc7614c2 | ||
|
|
2962c20f73 | ||
|
|
cd98656315 | ||
|
|
1045697c34 | ||
|
|
44d26113bc | ||
|
|
3c3003f703 | ||
|
|
c8755af8a5 | ||
|
|
9d2f377927 | ||
|
|
cde579473b | ||
|
|
bda367c697 | ||
|
|
1664602476 | ||
|
|
e5215b5398 | ||
|
|
6e4c26aa08 | ||
|
|
52a0b12fe1 | ||
|
|
0b69bc34d7 | ||
|
|
cdf76cff9f | ||
|
|
901d57db07 | ||
|
|
f31dd86059 | ||
|
|
402ccedcf4 | ||
|
|
eabb6e3e4f | ||
|
|
1f447fbef1 | ||
|
|
4b2ed35b8f | ||
|
|
074b2b24e0 | ||
|
|
07b7bd79d6 | ||
|
|
b226864db5 | ||
|
|
d455ebe5ff | ||
|
|
8d9876e1ba | ||
|
|
3118191f59 | ||
|
|
fa2218cbc9 | ||
|
|
6d718c054a | ||
|
|
44fb151c12 | ||
|
|
1c33d4c00d | ||
|
|
fc83a36cbd | ||
|
|
31f5f71647 | ||
|
|
0e412c7a55 | ||
|
|
74db7744ee | ||
|
|
9b9a171da9 | ||
|
|
5e3bbba962 | ||
|
|
fe1ca353bb | ||
|
|
95fd72b9f7 | ||
|
|
d010eb4651 | ||
|
|
74902c5435 | ||
|
|
baf7700429 | ||
|
|
f6b606f422 | ||
|
|
cd367b959e | ||
|
|
d4ab13b630 | ||
|
|
36ac775838 | ||
|
|
5b3c05d89a | ||
|
|
258c713343 | ||
|
|
d1476bc603 | ||
|
|
2c5f4c635a | ||
|
|
46324ccfcd | ||
|
|
142c4b8ca8 | ||
|
|
7017fa7c9d | ||
|
|
f071e16f23 | ||
|
|
6552047d44 | ||
|
|
f8e49dd187 | ||
|
|
1b5e5c3727 | ||
|
|
f505f5dff1 | ||
|
|
07252918ea | ||
|
|
a86bc39cc9 | ||
|
|
fc5391f54e | ||
|
|
bc07090af2 | ||
|
|
f7d557cdf2 | ||
|
|
e8aef2a84b | ||
|
|
2c192639b5 | ||
|
|
e46792971b | ||
|
|
4462f8c30f | ||
|
|
203d865317 | ||
|
|
4bcc1c37b8 | ||
|
|
7d33bdf962 | ||
|
|
75413c4928 | ||
|
|
376f782e28 | ||
|
|
cccd301499 | ||
|
|
9f32a8a3c1 | ||
|
|
a0d9db99cb | ||
|
|
3d331c0062 | ||
|
|
f5bbb1eb71 | ||
|
|
784ca9c179 | ||
|
|
b7849987e5 | ||
|
|
c7921c9205 | ||
|
|
e86b3ebf2e | ||
|
|
23cf666359 | ||
|
|
e31816c83b | ||
|
|
c90499bb28 | ||
|
|
1cf43ece12 | ||
|
|
bc82f92a8d | ||
|
|
457a081379 | ||
|
|
2c1ae479ab | ||
|
|
1a07e21eaf | ||
|
|
f6093a4d0e | ||
|
|
8b65ab9d91 | ||
|
|
d134cc7d9d | ||
|
|
df680288a9 | ||
|
|
850dc6bbfa | ||
|
|
32bc11698a | ||
|
|
978714d752 | ||
|
|
28307643d7 | ||
|
|
5ac0179f47 | ||
|
|
3300c01e82 | ||
|
|
472e7e937c | ||
|
|
135a648ad7 | ||
|
|
d64c0bca17 | ||
|
|
6be350c045 | ||
|
|
b96be39d47 | ||
|
|
bb6034e2d8 | ||
|
|
9bdf5a9ef7 | ||
|
|
e36b487958 | ||
|
|
acc4031cf5 | ||
|
|
9c20571280 | ||
|
|
2e2ff34021 | ||
|
|
df8e6e9e4a | ||
|
|
ad75eababc | ||
|
|
384ef09920 | ||
|
|
1d54c40dd6 | ||
|
|
20102b0c82 | ||
|
|
f2c1f25612 | ||
|
|
4e318f5938 | ||
|
|
4e4fa4ce9b | ||
|
|
792edebb4f | ||
|
|
9e26773167 | ||
|
|
2b245c4f2b | ||
|
|
db1bd6998b | ||
|
|
80cffaf323 | ||
|
|
f142c97907 | ||
|
|
cdc59ff5cc | ||
|
|
867d9f3985 | ||
|
|
15c6172a8d | ||
|
|
a85515bea5 | ||
|
|
0d2881ad58 | ||
|
|
c68f754b3b | ||
|
|
6e52b88a17 | ||
|
|
d2a7878b35 | ||
|
|
1e9ae4be66 | ||
|
|
c0370e4399 | ||
|
|
d3080be131 | ||
|
|
67cd75f9fa | ||
|
|
99beb96fc0 | ||
|
|
ebf8b0a291 | ||
|
|
0e1620ff4a | ||
|
|
5d41b90e60 | ||
|
|
52defe9506 | ||
|
|
eb113137c8 | ||
|
|
88b6a1fa80 | ||
|
|
66f27ed0cb | ||
|
|
9cbdf1138f | ||
|
|
ef466d4f06 | ||
|
|
ab46cf38d4 | ||
|
|
c0d17f2266 | ||
|
|
dfb342c19a | ||
|
|
e1273b1f3c | ||
|
|
bbc5b99a6b | ||
|
|
4db9299286 | ||
|
|
bf540cb7c3 | ||
|
|
286ba0e68f | ||
|
|
0dc36f1e3a | ||
|
|
ef1e587008 | ||
|
|
6860c44071 | ||
|
|
474698abef | ||
|
|
1ffe98c175 | ||
|
|
66e14cdda6 | ||
|
|
5a081bbb1d | ||
|
|
e188010512 | ||
|
|
2a9eeaa588 | ||
|
|
a78b6026c9 | ||
|
|
163f612326 | ||
|
|
de2b860dff | ||
|
|
c3f28320c2 | ||
|
|
5deb6c3c5f | ||
|
|
0b03f16cdb | ||
|
|
71dd06cfcb | ||
|
|
123bc32834 | ||
|
|
91b9a45be4 | ||
|
|
e5d324981d | ||
|
|
a64037cd4a | ||
|
|
80352e03ca | ||
|
|
d447e99587 | ||
|
|
0e7d071e47 | ||
|
|
a8a09df6a6 | ||
|
|
c42ad8b686 | ||
|
|
5cde92cb0e | ||
|
|
06009c8d5a | ||
|
|
fede54c821 | ||
|
|
7e737007d9 | ||
|
|
4c80a516f8 | ||
|
|
25ffe54118 | ||
|
|
23b1b808f1 | ||
|
|
91afbbc56a | ||
|
|
ca05d432d7 | ||
|
|
0d20b63574 | ||
|
|
81863cde82 | ||
|
|
090493863b | ||
|
|
18fe88933c | ||
|
|
0e8facca42 | ||
|
|
390ba3faa0 | ||
|
|
cfccedd74a | ||
|
|
0d93fb4127 | ||
|
|
ffcf66f30e | ||
|
|
b326100b12 | ||
|
|
5d7b65b407 | ||
|
|
755f7442dd | ||
|
|
9f1294d623 | ||
|
|
c281b4e85a | ||
|
|
625295b14f | ||
|
|
66add64b71 | ||
|
|
22f58a9a58 | ||
|
|
3ab864a860 | ||
|
|
55ef5fb7ef | ||
|
|
4b41746ce3 | ||
|
|
7d73642d0e | ||
|
|
ef38e85542 | ||
|
|
da2f769681 | ||
|
|
165fe56260 | ||
|
|
f22e348287 | ||
|
|
4c9557ef24 | ||
|
|
13673749ff | ||
|
|
a18b11602c | ||
|
|
9e7e55f164 | ||
|
|
6a7babd658 | ||
|
|
d000c27d3b | ||
|
|
06f4fc79a2 | ||
|
|
fcac2911cf | ||
|
|
6110a3f3fa | ||
|
|
3c409c249d | ||
|
|
928cb33eb4 | ||
|
|
7c6b8cbbed | ||
|
|
d36ff76f9d | ||
|
|
136f453dd2 | ||
|
|
3848770669 | ||
|
|
50e529d44e | ||
|
|
c76fb5dd10 | ||
|
|
739a566961 | ||
|
|
5d7ad47386 | ||
|
|
682587748f | ||
|
|
16b7f5c4ef | ||
|
|
40d1c3fef1 | ||
|
|
8b277ac381 | ||
|
|
1484d88d7a | ||
|
|
f38ca9aec7 | ||
|
|
d529db6e50 | ||
|
|
af9b810419 | ||
|
|
217c6b6ad2 | ||
|
|
e898ecc57b | ||
|
|
1edc2b4c85 | ||
|
|
ba9adbb951 | ||
|
|
4fcd3570cb | ||
|
|
75755c5d87 | ||
|
|
8aeac19dbd | ||
|
|
f6d6b21ec2 | ||
|
|
aff63bc089 | ||
|
|
1164dce679 | ||
|
|
3ede723cb4 | ||
|
|
e6e8383a92 | ||
|
|
5748c20be1 | ||
|
|
d4571f41a3 | ||
|
|
53492c86e8 | ||
|
|
52af3aee5a |
11
openbsc/.gitignore
vendored
11
openbsc/.gitignore
vendored
@@ -39,14 +39,25 @@ src/utils/isdnsync
|
||||
src/nat/bsc_nat
|
||||
src/gprs/osmo-sgsn
|
||||
src/gprs/osmo-gbproxy
|
||||
src/osmo-bsc_nat/osmo-bsc_nat
|
||||
|
||||
#tests
|
||||
tests/bsc-nat/bsc_nat_test
|
||||
tests/channel/channel_test
|
||||
tests/db/db_test
|
||||
tests/debug/debug_test
|
||||
tests/gsm0408/gsm0408_test
|
||||
tests/mgcp/mgcp_test
|
||||
tests/sccp/sccp_test
|
||||
tests/sms/sms_test
|
||||
tests/timer/timer_test
|
||||
tests/gprs/gprs_test
|
||||
|
||||
tests/atconfig
|
||||
tests/atlocal
|
||||
tests/package.m4
|
||||
tests/testsuite
|
||||
tests/testsuite.log
|
||||
|
||||
|
||||
src/openbsc.cfg*
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
|
||||
|
||||
INCLUDES = $(all_includes) -I$(top_srcdir)/include
|
||||
SUBDIRS = include src tests
|
||||
SUBDIRS = doc include src tests
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = openbsc.pc
|
||||
|
||||
BUILT_SOURCES = $(top_srcdir)/.version
|
||||
EXTRA_DIST = git-version-gen
|
||||
$(top_srcdir)/.version:
|
||||
echo $(VERSION) > $@-t && mv $@-t $@
|
||||
dist-hook:
|
||||
|
||||
@@ -4,6 +4,7 @@ AC_INIT([openbsc],
|
||||
[openbsc-devel@lists.openbsc.org])
|
||||
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
|
||||
dnl kernel style compile messages
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
@@ -17,10 +18,6 @@ AC_PROG_RANLIB
|
||||
dnl checks for libraries
|
||||
AC_SEARCH_LIBS(crypt, crypt,
|
||||
[LIBCRYPT="-lcrypt"; AC_DEFINE([VTY_CRYPT_PW], [], [Use crypt functionality of vty.])])
|
||||
AC_SEARCH_LIBS(gtp_new, gtp,
|
||||
[LIBCRYPT="-lgtp"; AC_SUBST([GPRS_LIBGTP], [1])])
|
||||
|
||||
AM_CONDITIONAL(HAVE_LIBGTP, test "x$GPRS_LIBGTP" != "x")
|
||||
|
||||
|
||||
AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
|
||||
@@ -32,10 +29,11 @@ AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Require
|
||||
osmo_ac_build_nat="no"
|
||||
])
|
||||
AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
|
||||
AC_SUBST(osmo_ac_build_nat)
|
||||
|
||||
AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
|
||||
[
|
||||
PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
|
||||
PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
|
||||
osmo_ac_build_bsc="yes"
|
||||
],
|
||||
[
|
||||
@@ -43,12 +41,19 @@ AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo B
|
||||
])
|
||||
AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.30)
|
||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.1.28)
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2)
|
||||
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.0)
|
||||
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.1.0)
|
||||
|
||||
found_libgtp=yes
|
||||
PKG_CHECK_MODULES(LIBGTP, libgtp, , found_libgtp=no)
|
||||
AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
|
||||
|
||||
dnl checks for header files
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
|
||||
AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
|
||||
|
||||
|
||||
dnl Checks for typedefs, structures and compiler characteristics
|
||||
@@ -57,7 +62,7 @@ dnl Checks for typedefs, structures and compiler characteristics
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden "
|
||||
AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
|
||||
AC_COMPILE_IFELSE([char foo;],
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
SYMBOL_VISIBILITY="-fvisibility=hidden"],
|
||||
AC_MSG_RESULT([no]))
|
||||
@@ -88,8 +93,8 @@ AC_OUTPUT(
|
||||
include/Makefile
|
||||
src/Makefile
|
||||
src/libtrau/Makefile
|
||||
src/libabis/Makefile
|
||||
src/libbsc/Makefile
|
||||
src/libctrl/Makefile
|
||||
src/libmsc/Makefile
|
||||
src/libmgcp/Makefile
|
||||
src/libcommon/Makefile
|
||||
@@ -102,10 +107,14 @@ AC_OUTPUT(
|
||||
src/libgb/Makefile
|
||||
src/gprs/Makefile
|
||||
tests/Makefile
|
||||
tests/atlocal
|
||||
tests/debug/Makefile
|
||||
tests/gsm0408/Makefile
|
||||
tests/db/Makefile
|
||||
tests/channel/Makefile
|
||||
tests/bsc-nat/Makefile
|
||||
tests/mgcp/Makefile
|
||||
tests/gprs/Makefile
|
||||
doc/Makefile
|
||||
doc/examples/Makefile
|
||||
Makefile)
|
||||
104
openbsc/contrib/bsc_control.py
Executable file
104
openbsc/contrib/bsc_control.py
Executable file
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys,os
|
||||
from optparse import OptionParser
|
||||
import socket
|
||||
import struct
|
||||
|
||||
verbose = False
|
||||
|
||||
def prefix_ipa_ctrl_header(data):
|
||||
return struct.pack(">HBB", len(data)+1, 0xee, 0) + data
|
||||
|
||||
def remove_ipa_ctrl_header(data):
|
||||
if (len(data) < 4):
|
||||
raise BaseException("Answer too short!")
|
||||
(plen, ipa_proto, osmo_proto) = struct.unpack(">HBB", data[:4])
|
||||
if (plen + 3 > len(data)):
|
||||
print "Warning: Wrong payload length (expected %i, got %i)" % (plen, len(data) - 3)
|
||||
if (ipa_proto != 0xee or osmo_proto != 0):
|
||||
raise BaseException("Wrong protocol in answer!")
|
||||
|
||||
return data[4:plen+3], data[plen+3:]
|
||||
|
||||
def connect(host, port):
|
||||
if verbose:
|
||||
print "Connecting to host %s:%i" % (host, port)
|
||||
|
||||
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sck.setblocking(1)
|
||||
sck.connect((host, port))
|
||||
return sck
|
||||
|
||||
def send(sck, data):
|
||||
if verbose:
|
||||
print "Sending \"%s\"" %(data)
|
||||
data = prefix_ipa_ctrl_header(data)
|
||||
sck.send(data)
|
||||
|
||||
def do_set(var, value, id, sck):
|
||||
setmsg = "SET %s %s %s" %(options.id, var, value)
|
||||
send(sck, setmsg)
|
||||
|
||||
def do_get(var, id, sck):
|
||||
getmsg = "GET %s %s" %(options.id, var)
|
||||
send(sck, getmsg)
|
||||
|
||||
parser = OptionParser("Usage: %prog [options] var [value]")
|
||||
parser.add_option("-d", "--host", dest="host",
|
||||
help="connect to HOST", metavar="HOST")
|
||||
parser.add_option("-p", "--port", dest="port", type="int",
|
||||
help="use PORT", metavar="PORT", default=4249)
|
||||
parser.add_option("-g", "--get", action="store_true",
|
||||
dest="cmd_get", help="perform GET operation")
|
||||
parser.add_option("-s", "--set", action="store_true",
|
||||
dest="cmd_set", help="perform SET operation")
|
||||
parser.add_option("-i", "--id", dest="id", default="1",
|
||||
help="set id manually", metavar="ID")
|
||||
parser.add_option("-v", "--verbose", action="store_true",
|
||||
dest="verbose", help="be verbose", default=False)
|
||||
parser.add_option("-m", "--monitor", action="store_true",
|
||||
dest="monitor", help="monitor the connection for traps", default=False)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
verbose = options.verbose
|
||||
|
||||
if options.cmd_set and options.cmd_get:
|
||||
parser.error("Get and set options are mutually exclusive!")
|
||||
|
||||
if not (options.cmd_get or options.cmd_set or options.monitor):
|
||||
parser.error("One of -m, -g, or -s must be set")
|
||||
|
||||
if not (options.host):
|
||||
parser.error("Destination host and port required!")
|
||||
|
||||
sock = connect(options.host, options.port)
|
||||
|
||||
if options.cmd_set:
|
||||
if len(args) < 2:
|
||||
parser.error("Set requires var and value arguments")
|
||||
do_set(args[0], ' '.join(args[1:]), options.id, sock)
|
||||
|
||||
if options.cmd_get:
|
||||
if len(args) != 1:
|
||||
parser.error("Get requires the var argument")
|
||||
do_get(args[0], options.id, sock)
|
||||
|
||||
data = sock.recv(1024)
|
||||
while (len(data)>0):
|
||||
(answer, data) = remove_ipa_ctrl_header(data)
|
||||
print "Got message:", answer
|
||||
|
||||
if options.monitor:
|
||||
while (True):
|
||||
data = sock.recv(1024)
|
||||
if len(data) == 0:
|
||||
print "Connection is gone."
|
||||
break
|
||||
|
||||
while (len(data)>0):
|
||||
(answer, data) = remove_ipa_ctrl_header(data)
|
||||
print "Got message:", answer
|
||||
|
||||
sock.close()
|
||||
80
openbsc/contrib/gprs/gprs-buffer-count.lua
Normal file
80
openbsc/contrib/gprs/gprs-buffer-count.lua
Normal file
@@ -0,0 +1,80 @@
|
||||
-- I count the buffer space needed for LLC PDUs in the worse case and print it
|
||||
|
||||
do
|
||||
local function init_listener()
|
||||
-- handle the port as NS over IP
|
||||
local udp_port_table = DissectorTable.get("udp.port")
|
||||
local gprs_ns_dis = Dissector.get("gprs_ns")
|
||||
udp_port_table:add(23000,gprs_ns_dis)
|
||||
|
||||
-- bssgp filters
|
||||
local bssgp_pdu_get = Field.new("bssgp.pdu_type")
|
||||
local bssgp_delay_get = Field.new("bssgp.delay_val")
|
||||
local llcgprs_get = Field.new("llcgprs")
|
||||
local pdus = nil
|
||||
|
||||
print("START...")
|
||||
|
||||
local tap = Listener.new("ip", "udp.port == 23000 && bssgp.pdu_type == 0")
|
||||
function tap.packet(pinfo,tvb,ip)
|
||||
local pdu = bssgp_pdu_get()
|
||||
local len = llcgprs_get().len
|
||||
local delay = bssgp_delay_get()
|
||||
|
||||
-- only handle bssgp, but we also want the IP frame
|
||||
if not pdu then
|
||||
return
|
||||
end
|
||||
|
||||
if tonumber(tostring(delay)) == 65535 then
|
||||
pdus = { next = pdus,
|
||||
len = len,
|
||||
expires = -1 }
|
||||
else
|
||||
local off = tonumber(tostring(delay)) / 100.0
|
||||
pdus = { next = pdus,
|
||||
len = len,
|
||||
expires = pinfo.rel_ts + off }
|
||||
end
|
||||
local now_time = tonumber(tostring(pinfo.rel_ts))
|
||||
local now_size = 0
|
||||
local l = pdus
|
||||
local prev = nil
|
||||
local count = 0
|
||||
while l do
|
||||
if now_time < l.expires or l.expires == -1 then
|
||||
now_size = now_size + l.len
|
||||
prev = l
|
||||
l = l.next
|
||||
count = count + 1
|
||||
else
|
||||
-- delete things
|
||||
if prev == nil then
|
||||
pdus = nil
|
||||
l = nil
|
||||
else
|
||||
prev.next = l.next
|
||||
l = l.next
|
||||
end
|
||||
end
|
||||
end
|
||||
-- print("TOTAL: " .. now_time .. " PDU_SIZE: " .. now_size)
|
||||
print(now_time .. " " .. now_size / 1024.0 .. " " .. count)
|
||||
-- print("NOW: " .. tostring(pinfo.rel_ts) .. " Delay: " .. tostring(delay) .. " Length: " .. tostring(len))
|
||||
end
|
||||
|
||||
function tap.draw()
|
||||
-- well... this will not be called...
|
||||
-- for ip,bssgp_histo in pairs(dumpers) do
|
||||
-- print("IP " .. ip)
|
||||
-- end
|
||||
print("END")
|
||||
end
|
||||
|
||||
function tap.reset()
|
||||
-- well... this will not be called...
|
||||
end
|
||||
end
|
||||
|
||||
init_listener()
|
||||
end
|
||||
30
openbsc/contrib/nat/test_regexp.c
Normal file
30
openbsc/contrib/nat/test_regexp.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* make test_regexp */
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
regex_t reg;
|
||||
regmatch_t matches[2];
|
||||
|
||||
if (argc != 4) {
|
||||
printf("Invoke with: test_regexp REGEXP REPLACE NR\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (regcomp(®, argv[1], REG_EXTENDED) != 0) {
|
||||
fprintf(stderr, "Regexp '%s' is not valid.\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (regexec(®, argv[3], 2, matches, 0) == 0 && matches[1].rm_eo != -1)
|
||||
printf("New Number: %s%s\n", argv[2], &argv[3][matches[1].rm_so]);
|
||||
else
|
||||
printf("No match.\n");
|
||||
|
||||
regfree(®);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,3 +1,9 @@
|
||||
openbsc (0.9.13.115.eb113-1) natty; urgency=low
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Harald Welte <laforge@gnumonks.org> Wed, 11 May 2011 18:41:24 +0000
|
||||
|
||||
openbsc (0.9.4-1) unstable; urgency=low
|
||||
|
||||
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
|
||||
|
||||
@@ -1 +1 @@
|
||||
/usr/bin/bsc_nat
|
||||
/usr/bin/osmo-bsc_nat
|
||||
|
||||
1
openbsc/debian/osmocom-bsc.examples
Normal file
1
openbsc/debian/osmocom-bsc.examples
Normal file
@@ -0,0 +1 @@
|
||||
doc/examples/osmo-bsc_mgcp
|
||||
@@ -1,6 +1 @@
|
||||
src/openbsc.cfg.1-1
|
||||
src/openbsc.cfg.1-2
|
||||
src/openbsc.cfg.1-2-hopping
|
||||
src/openbsc.cfg.gprs
|
||||
src/openbsc.cfg.nanobts
|
||||
src/openbsc.cfg.nanobts.multitrx
|
||||
doc/examples/osmo-nitb
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC=osmo-nitb # Introduce a short description here
|
||||
NAME=osmo-nitb # Introduce the short server's name here
|
||||
DAEMON=/usr/sbin/bsc_hack # Introduce the server's location here
|
||||
DAEMON_ARGS="-D" # Arguments to run the daemon with
|
||||
DAEMON=/usr/sbin/osmo-nitb # Introduce the server's location here
|
||||
DAEMON_ARGS="-D" # Arguments to run the daemon with
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
/usr/bin/bsc_hack
|
||||
/usr/bin/osmo-nitb
|
||||
|
||||
1
openbsc/debian/osmocom-sgsn.examples
Normal file
1
openbsc/debian/osmocom-sgsn.examples
Normal file
@@ -0,0 +1 @@
|
||||
doc/examples/osmo-sgsn
|
||||
1
openbsc/doc/Makefile.am
Normal file
1
openbsc/doc/Makefile.am
Normal file
@@ -0,0 +1 @@
|
||||
SUBDIRS = examples
|
||||
21
openbsc/doc/control-interface.txt
Normal file
21
openbsc/doc/control-interface.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
The protocol for the control interface is wrapped inside the ip.access header
|
||||
with the IPAC_PROTO_OSMO protocol ID (0xee). Inside the ip.access header is
|
||||
a struct ipaccess_head_ext with protocol ID 0x00 which indicates the control
|
||||
interface.
|
||||
|
||||
After that the actual protocol is text based:
|
||||
|
||||
* Getting the value of a variable
|
||||
-> GET <id> <var>
|
||||
<- GET_REPLY <id> <var> <val>
|
||||
or ERROR <id> <reason>
|
||||
|
||||
* Setting the value of a variable
|
||||
-> SET <id> <var> <val>
|
||||
<- SET_REPLY <id> <var> <val>
|
||||
or ERROR <id> <reason>
|
||||
|
||||
* A value changes which triggers a trap
|
||||
<- TRAP <var> <val>
|
||||
|
||||
<id> needs to be unique within a connection. '0' is not allowed
|
||||
@@ -52,10 +52,10 @@ int abis_link_event(int event, void *data);
|
||||
signal some event (such as layer 1 connect/disconnect) from the
|
||||
input core to the stack.
|
||||
|
||||
int subch_demux_in(mx, const u_int8_t *data, int len);
|
||||
int subch_demux_in(mx, const uint8_t *data, int len);
|
||||
receive 'len' bytes from a given E1 timeslot (TRAU frames)
|
||||
|
||||
int subchan_mux_out(mx, u_int8_t *data, int len);
|
||||
int subchan_mux_out(mx, uint8_t *data, int len);
|
||||
obtain 'len' bytes of output data to be sent on E1 timeslot
|
||||
|
||||
Intrface by Input Core for Input Plugins
|
||||
@@ -112,8 +112,8 @@ struct e1inp_sign_link {
|
||||
struct llist_head tx_list;
|
||||
|
||||
/* SAPI and TEI on the E1 TS */
|
||||
u_int8_t sapi;
|
||||
u_int8_t tei;
|
||||
uint8_t sapi;
|
||||
uint8_t tei;
|
||||
}
|
||||
|
||||
enum e1inp_ts_type {
|
||||
@@ -140,7 +140,7 @@ struct e1inp_ts {
|
||||
union {
|
||||
struct {
|
||||
/* mISDN driver has one fd for each ts */
|
||||
struct bsc_fd;
|
||||
struct osmo_fd;
|
||||
} misdn;
|
||||
} driver;
|
||||
};
|
||||
@@ -160,7 +160,7 @@ int e1inp_update_ts(struct e1inp_ts *ts);
|
||||
|
||||
/* Receive a packet from the E1 driver */
|
||||
int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
|
||||
u_int8_t tei, u_int8_t sapi);
|
||||
uint8_t tei, uint8_t sapi);
|
||||
|
||||
/* Send a packet, callback function in the driver */
|
||||
int e1driver_tx_ts(struct e1inp_ts *ts, struct msgb *msg)
|
||||
|
||||
23
openbsc/doc/examples/Makefile.am
Normal file
23
openbsc/doc/examples/Makefile.am
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
CFG_FILES = find $(srcdir) -name '*.cfg*' | sed -e 's,^$(srcdir),,'
|
||||
|
||||
dist-hook:
|
||||
for f in $$($(CFG_FILES)); do \
|
||||
j="$(distdir)/$$f" && \
|
||||
mkdir -p "$$(dirname $$j)" && \
|
||||
$(INSTALL_DATA) $(srcdir)/$$f $$j; \
|
||||
done
|
||||
|
||||
install-data-hook:
|
||||
for f in $$($(CFG_FILES)); do \
|
||||
j="$(DESTDIR)$(docdir)/examples/$$f" && \
|
||||
mkdir -p "$$(dirname $$j)" && \
|
||||
$(INSTALL_DATA) $(srcdir)/$$f $$j; \
|
||||
done
|
||||
|
||||
uninstall-hook:
|
||||
@$(PRE_UNINSTALL)
|
||||
for f in $$($(CFG_FILES)); do \
|
||||
j="$(DESTDIR)$(docdir)/examples/$$f" && \
|
||||
$(RM) $$j; \
|
||||
done
|
||||
133
openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
Normal file
133
openbsc/doc/examples/osmo-bsc/osmo-bsc.cfg
Normal file
@@ -0,0 +1,133 @@
|
||||
!
|
||||
! OsmoBSC (0.9.14+gitr1+3d331c0062bb0c9694dbd4d1eab7adc58138c3ae) configuration saved from vty
|
||||
!!
|
||||
password foo
|
||||
!
|
||||
log stderr
|
||||
logging color 1
|
||||
logging timestamp 0
|
||||
logging level all everything
|
||||
logging level rll notice
|
||||
logging level cc notice
|
||||
logging level mm notice
|
||||
logging level rr notice
|
||||
logging level rsl notice
|
||||
logging level nm info
|
||||
logging level mncc notice
|
||||
logging level sms notice
|
||||
logging level pag notice
|
||||
logging level meas notice
|
||||
logging level mi notice
|
||||
logging level mib notice
|
||||
logging level mux notice
|
||||
logging level inp notice
|
||||
logging level sccp notice
|
||||
logging level msc notice
|
||||
logging level mgcp notice
|
||||
logging level ho notice
|
||||
logging level db notice
|
||||
logging level ref notice
|
||||
logging level gprs debug
|
||||
logging level ns info
|
||||
logging level bssgp debug
|
||||
logging level llc debug
|
||||
logging level sndcp debug
|
||||
logging level nat notice
|
||||
logging level lglobal notice
|
||||
logging level llapdm notice
|
||||
!
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver ipa
|
||||
network
|
||||
network country code 1
|
||||
mobile network code 1
|
||||
short name OsmoBSC
|
||||
long name OsmoBSC
|
||||
auth policy closed
|
||||
location updating reject cause 13
|
||||
encryption a5 0
|
||||
neci 1
|
||||
paging any use tch 0
|
||||
rrlp mode none
|
||||
mm info 1
|
||||
handover 0
|
||||
handover window rxlev averaging 10
|
||||
handover window rxqual averaging 1
|
||||
handover window rxlev neighbor averaging 10
|
||||
handover power budget interval 6
|
||||
handover power budget hysteresis 3
|
||||
handover maximum distance 9999
|
||||
timer t3101 10
|
||||
timer t3103 0
|
||||
timer t3105 0
|
||||
timer t3107 0
|
||||
timer t3109 0
|
||||
timer t3111 0
|
||||
timer t3113 60
|
||||
timer t3115 0
|
||||
timer t3117 0
|
||||
timer t3119 0
|
||||
timer t3122 0
|
||||
timer t3141 0
|
||||
dtx-used 0
|
||||
subscriber-keep-in-ram 0
|
||||
bts 0
|
||||
type nanobts
|
||||
band DCS1800
|
||||
cell_identity 0
|
||||
location_area_code 1
|
||||
training_sequence_code 7
|
||||
base_station_id_code 63
|
||||
ms max power 15
|
||||
cell reselection hysteresis 4
|
||||
rxlev access min 0
|
||||
channel allocator ascending
|
||||
rach tx integer 9
|
||||
rach max transmission 7
|
||||
ip.access unit_id 0 0
|
||||
oml ip.access stream_id 255 line 0
|
||||
neighbor-list mode manual-si5
|
||||
neighbor-list add arfcn 100
|
||||
neighbor-list add arfcn 200
|
||||
si5 neighbor-list add arfcn 10
|
||||
si5 neighbor-list add arfcn 20
|
||||
gprs mode none
|
||||
trx 0
|
||||
rf_locked 0
|
||||
arfcn 871
|
||||
nominal power 23
|
||||
max_power_red 20
|
||||
rsl e1 tei 0
|
||||
timeslot 0
|
||||
phys_chan_config CCCH+SDCCH4
|
||||
hopping enabled 0
|
||||
timeslot 1
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 2
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 3
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 4
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 5
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 6
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 7
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
msc
|
||||
ip.access rtp-base 4000
|
||||
timeout-ping 20
|
||||
timeout-pong 5
|
||||
mid-call-timeout 0
|
||||
dest 192.168.100.11 6666 0
|
||||
90
openbsc/doc/examples/osmo-nitb/hsl/openbsc.cfg
Normal file
90
openbsc/doc/examples/osmo-nitb/hsl/openbsc.cfg
Normal file
@@ -0,0 +1,90 @@
|
||||
!
|
||||
! OpenBSC (0.9.11.261-32c0) configuration saved from vty
|
||||
!!
|
||||
password foo
|
||||
!
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver hsl
|
||||
network
|
||||
network country code 262
|
||||
mobile network code 42
|
||||
short name OpenBSC
|
||||
long name OpenBSC
|
||||
auth policy closed
|
||||
location updating reject cause 13
|
||||
encryption a5 0
|
||||
neci 1
|
||||
paging any use tch 0
|
||||
rrlp mode none
|
||||
mm info 0
|
||||
handover 0
|
||||
handover window rxlev averaging 10
|
||||
handover window rxqual averaging 1
|
||||
handover window rxlev neighbor averaging 10
|
||||
handover power budget interval 6
|
||||
handover power budget hysteresis 3
|
||||
handover maximum distance 9999
|
||||
timer t3101 10
|
||||
timer t3103 0
|
||||
timer t3105 0
|
||||
timer t3107 0
|
||||
timer t3109 0
|
||||
timer t3111 0
|
||||
timer t3113 60
|
||||
timer t3115 0
|
||||
timer t3117 0
|
||||
timer t3119 0
|
||||
timer t3122 0
|
||||
timer t3141 0
|
||||
dtx-used 1
|
||||
subscriber-keep-in-ram 0
|
||||
bts 0
|
||||
type hsl_femto
|
||||
band DCS1800
|
||||
cell_identity 0
|
||||
location_area_code 1
|
||||
training_sequence_code 0
|
||||
base_station_id_code 0
|
||||
ms max power 15
|
||||
cell reselection hysteresis 4
|
||||
rxlev access min 0
|
||||
channel allocator ascending
|
||||
rach tx integer 9
|
||||
rach max transmission 1
|
||||
hsl serial-number 8303701
|
||||
neighbor-list mode automatic
|
||||
oml hsl line 0
|
||||
gprs mode none
|
||||
trx 0
|
||||
rf_locked 0
|
||||
arfcn 871
|
||||
nominal power 23
|
||||
max_power_red 20
|
||||
rsl e1 tei 0
|
||||
timeslot 0
|
||||
phys_chan_config CCCH+SDCCH4
|
||||
hopping enabled 0
|
||||
timeslot 1
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 2
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 3
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 4
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 5
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 6
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
timeslot 7
|
||||
phys_chan_config TCH/F
|
||||
hopping enabled 0
|
||||
@@ -6,6 +6,8 @@ password foo
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver ipa
|
||||
network
|
||||
network country code 1
|
||||
mobile network code 1
|
||||
@@ -49,7 +51,7 @@ network
|
||||
rach tx integer 9
|
||||
rach max transmission 7
|
||||
ip.access unit_id 1800 0
|
||||
oml ip.access stream_id 255
|
||||
oml ip.access stream_id 255 line 0
|
||||
gprs mode none
|
||||
trx 0
|
||||
rf_locked 0
|
||||
@@ -6,6 +6,8 @@ password foo
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver ipa
|
||||
network
|
||||
network country code 1
|
||||
mobile network code 1
|
||||
@@ -49,7 +51,7 @@ network
|
||||
rach tx integer 9
|
||||
rach max transmission 7
|
||||
ip.access unit_id 1801 0
|
||||
oml ip.access stream_id 255
|
||||
oml ip.access stream_id 255 line 0
|
||||
gprs mode none
|
||||
trx 0
|
||||
rf_locked 0
|
||||
118
openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg
Normal file
118
openbsc/doc/examples/osmo-nitb/nokia/openbsc_nokia_3trx.cfg
Normal file
@@ -0,0 +1,118 @@
|
||||
!
|
||||
! OpenBSC configuration saved from vty
|
||||
! !
|
||||
password foo
|
||||
!
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
e1_input
|
||||
e1_line 0 driver misdn
|
||||
network
|
||||
network country code 1
|
||||
mobile network code 1
|
||||
short name OpenBSC
|
||||
long name OpenBSC
|
||||
auth policy accept-all
|
||||
timer t3101 10
|
||||
timer t3113 60
|
||||
bts 0
|
||||
type nokia_site
|
||||
band GSM1800
|
||||
cell_identity 1
|
||||
location_area_code 1
|
||||
base_station_id_code 63
|
||||
training_sequence_code 7
|
||||
|
||||
oml e1 line 0 timeslot 1 sub-slot full
|
||||
oml e1 tei 1
|
||||
|
||||
trx 0
|
||||
arfcn 866
|
||||
max_power_red 24
|
||||
rsl e1 line 0 timeslot 2 sub-slot full
|
||||
rsl e1 tei 1
|
||||
timeslot 0
|
||||
phys_chan_config CCCH+SDCCH4
|
||||
e1 line 0 timeslot 6 sub-slot full
|
||||
timeslot 1
|
||||
phys_chan_config SDCCH8
|
||||
e1 line 0 timeslot 6 sub-slot 1
|
||||
timeslot 2
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 6 sub-slot 2
|
||||
timeslot 3
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 6 sub-slot 3
|
||||
timeslot 4
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 7 sub-slot 0
|
||||
timeslot 5
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 7 sub-slot 1
|
||||
timeslot 6
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 7 sub-slot 2
|
||||
timeslot 7
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 7 sub-slot 3
|
||||
|
||||
trx 1
|
||||
arfcn 870
|
||||
max_power_red 24
|
||||
rsl e1 line 0 timeslot 3 sub-slot full
|
||||
rsl e1 tei 2
|
||||
timeslot 0
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 8 sub-slot 0
|
||||
timeslot 1
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 8 sub-slot 1
|
||||
timeslot 2
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 8 sub-slot 2
|
||||
timeslot 3
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 8 sub-slot 3
|
||||
timeslot 4
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 9 sub-slot 0
|
||||
timeslot 5
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 9 sub-slot 1
|
||||
timeslot 6
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 9 sub-slot 2
|
||||
timeslot 7
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 9 sub-slot 3
|
||||
|
||||
trx 2
|
||||
arfcn 874
|
||||
max_power_red 24
|
||||
rsl e1 line 0 timeslot 4 sub-slot full
|
||||
rsl e1 tei 3
|
||||
timeslot 0
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 10 sub-slot 0
|
||||
timeslot 1
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 10 sub-slot 1
|
||||
timeslot 2
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 10 sub-slot 2
|
||||
timeslot 3
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 10 sub-slot 3
|
||||
timeslot 4
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 11 sub-slot 0
|
||||
timeslot 5
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 11 sub-slot 1
|
||||
timeslot 6
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 11 sub-slot 2
|
||||
timeslot 7
|
||||
phys_chan_config TCH/F
|
||||
e1 line 0 timeslot 11 sub-slot 3
|
||||
26
openbsc/doc/examples/osmo-sgsn/osmo-sgsn.cfg
Normal file
26
openbsc/doc/examples/osmo-sgsn/osmo-sgsn.cfg
Normal file
@@ -0,0 +1,26 @@
|
||||
!
|
||||
! Osmocom SGSN configuration
|
||||
!
|
||||
!
|
||||
line vty
|
||||
no login
|
||||
!
|
||||
sgsn
|
||||
gtp local-ip 10.23.23.23
|
||||
ggsn 0 remote-ip 192.168.0.101
|
||||
ggsn 0 gtp-version 1
|
||||
!
|
||||
ns
|
||||
timer tns-block 3
|
||||
timer tns-block-retries 3
|
||||
timer tns-reset 3
|
||||
timer tns-reset-retries 3
|
||||
timer tns-test 30
|
||||
timer tns-alive 3
|
||||
timer tns-alive-retries 10
|
||||
encapsulation udp local-ip 192.168.0.101
|
||||
encapsulation udp local-port 23000
|
||||
encapsulation framerelay-gre enabled 0
|
||||
!
|
||||
bssgp
|
||||
!
|
||||
@@ -12,7 +12,7 @@ specific parameters from channel assignment:
|
||||
|
||||
hopping sequence generation (6.2.3):
|
||||
|
||||
u_int8_t rntable[114] = {
|
||||
uint8_t rntable[114] = {
|
||||
48, 98, 63, 1, 36, 95, 78, 102, 94, 73,
|
||||
0, 64, 25, 81, 76, 59, 124, 23, 104, 100,
|
||||
101, 47, 118, 85, 18, 56, 96, 86, 54, 2,
|
||||
@@ -29,15 +29,15 @@ u_int8_t rntable[114] = {
|
||||
/* mai=0 represents lowest ARFCN in the MA */
|
||||
|
||||
|
||||
u_int8_t hopping_mai(u_int8_t hsn, u_int32_t fn, u_int8_t maio,
|
||||
u_int8_t t1, u_int8_t t2, u_int8_t t3_)
|
||||
uint8_t hopping_mai(uint8_t hsn, uint32_t fn, uint8_t maio,
|
||||
uint8_t t1, uint8_t t2, uint8_t t3_)
|
||||
{
|
||||
u_int8_t mai;
|
||||
uint8_t mai;
|
||||
|
||||
if (hsn == 0) /* cyclic hopping */
|
||||
mai = (fn + maio) % n;
|
||||
else {
|
||||
u_int32_t m, m_, t_, s;
|
||||
uint32_t m, m_, t_, s;
|
||||
|
||||
m = t2 + rntable[(hsn xor (t1 % 64)) + t3];
|
||||
m_ = m % (2^NBIN);
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
|
||||
gsm_subscriber.h gsm_04_11.h debug.h signal.h \
|
||||
misdn.h chan_alloc.h paging.h \
|
||||
subchan_demux.h trau_frame.h e1_input.h trau_mux.h \
|
||||
ipaccess.h rs232.h openbscdefines.h rtp_proxy.h \
|
||||
trau_mux.h rs232.h openbscdefines.h rtp_proxy.h \
|
||||
bsc_rll.h mncc.h transaction.h ussd.h gsm_04_80.h \
|
||||
silent_call.h mgcp.h meas_rep.h rest_octets.h \
|
||||
system_information.h handover.h mgcp_internal.h \
|
||||
vty.h socket.h \
|
||||
vty.h socket.h e1_config.h trau_upqueue.h token_auth.h \
|
||||
handover_decision.h rrlp.h control_if.h \
|
||||
crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \
|
||||
gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
|
||||
gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
|
||||
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \
|
||||
osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h
|
||||
osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \
|
||||
bss.h gsm_data_shared.h control_cmd.h ipaccess.h mncc_int.h
|
||||
|
||||
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
|
||||
openbscdir = $(includedir)/openbsc
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
#ifndef _NM_H
|
||||
#define _NM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <osmocore/tlv.h>
|
||||
#include <osmocore/protocol/gsm_12_21.h>
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <osmocom/gsm/abis_nm.h>
|
||||
#include <osmocom/gsm/protocol/gsm_12_21.h>
|
||||
|
||||
struct cell_global_id {
|
||||
u_int16_t mcc;
|
||||
u_int16_t mnc;
|
||||
u_int16_t lac;
|
||||
u_int16_t ci;
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint16_t lac;
|
||||
uint16_t ci;
|
||||
};
|
||||
|
||||
/* The BCCH info from an ip.access test, in host byte order
|
||||
@@ -38,26 +38,22 @@ struct cell_global_id {
|
||||
struct ipac_bcch_info {
|
||||
struct llist_head list;
|
||||
|
||||
u_int16_t info_type;
|
||||
u_int8_t freq_qual;
|
||||
u_int16_t arfcn;
|
||||
u_int8_t rx_lev;
|
||||
u_int8_t rx_qual;
|
||||
uint16_t info_type;
|
||||
uint8_t freq_qual;
|
||||
uint16_t arfcn;
|
||||
uint8_t rx_lev;
|
||||
uint8_t rx_qual;
|
||||
int16_t freq_err;
|
||||
u_int16_t frame_offset;
|
||||
u_int32_t frame_nr_offset;
|
||||
u_int8_t bsic;
|
||||
uint16_t frame_offset;
|
||||
uint32_t frame_nr_offset;
|
||||
uint8_t bsic;
|
||||
struct cell_global_id cgi;
|
||||
u_int8_t ba_list_si2[16];
|
||||
u_int8_t ba_list_si2bis[16];
|
||||
u_int8_t ba_list_si2ter[16];
|
||||
u_int8_t ca_list_si1[16];
|
||||
uint8_t ba_list_si2[16];
|
||||
uint8_t ba_list_si2bis[16];
|
||||
uint8_t ba_list_si2ter[16];
|
||||
uint8_t ca_list_si1[16];
|
||||
};
|
||||
|
||||
extern const struct value_string abis_nm_adm_state_names[];
|
||||
extern const struct value_string abis_nm_obj_class_names[];
|
||||
extern const struct tlv_definition nm_att_tlvdef;
|
||||
|
||||
/* PUBLIC */
|
||||
|
||||
struct msgb;
|
||||
@@ -72,60 +68,58 @@ struct abis_nm_cfg {
|
||||
|
||||
extern int abis_nm_rcvmsg(struct msgb *msg);
|
||||
|
||||
int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const u_int8_t *buf, int len);
|
||||
int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len);
|
||||
int abis_nm_rx(struct msgb *msg);
|
||||
int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8_t i1, u_int8_t i2);
|
||||
int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
|
||||
u_int8_t i1, u_int8_t i2, enum abis_nm_adm_state adm_state);
|
||||
int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
|
||||
u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot,
|
||||
u_int8_t tei);
|
||||
int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2);
|
||||
int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0,
|
||||
uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state);
|
||||
int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr,
|
||||
uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot,
|
||||
uint8_t tei);
|
||||
int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx,
|
||||
u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot);
|
||||
uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot);
|
||||
int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
|
||||
u_int8_t e1_port, u_int8_t e1_timeslot,
|
||||
u_int8_t e1_subslot);
|
||||
int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len);
|
||||
int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len);
|
||||
int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb);
|
||||
int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
|
||||
u_int8_t i2, u_int8_t i3, int nack, u_int8_t *attr, int att_len);
|
||||
int abis_nm_raw_msg(struct gsm_bts *bts, int len, u_int8_t *msg);
|
||||
uint8_t e1_port, uint8_t e1_timeslot,
|
||||
uint8_t e1_subslot);
|
||||
int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len);
|
||||
int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len);
|
||||
int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb);
|
||||
int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1,
|
||||
uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len);
|
||||
int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg);
|
||||
int abis_nm_event_reports(struct gsm_bts *bts, int on);
|
||||
int abis_nm_reset_resource(struct gsm_bts *bts);
|
||||
int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname,
|
||||
u_int8_t win_size, int forced,
|
||||
uint8_t win_size, int forced,
|
||||
gsm_cbfn *cbfn, void *cb_data);
|
||||
int abis_nm_software_load_status(struct gsm_bts *bts);
|
||||
int abis_nm_software_activate(struct gsm_bts *bts, const char *fname,
|
||||
gsm_cbfn *cbfn, void *cb_data);
|
||||
|
||||
int abis_nm_conn_mdrop_link(struct gsm_bts *bts, u_int8_t e1_port0, u_int8_t ts0,
|
||||
u_int8_t e1_port1, u_int8_t ts1);
|
||||
int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0,
|
||||
uint8_t e1_port1, uint8_t ts1);
|
||||
|
||||
int abis_nm_perform_test(struct gsm_bts *bts, u_int8_t obj_class,
|
||||
u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
|
||||
u_int8_t test_nr, u_int8_t auton_report, struct msgb *msg);
|
||||
|
||||
int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan);
|
||||
int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class,
|
||||
uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
|
||||
uint8_t test_nr, uint8_t auton_report, struct msgb *msg);
|
||||
|
||||
/* Siemens / BS-11 specific */
|
||||
int abis_nm_bs11_reset_resource(struct gsm_bts *bts);
|
||||
int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin);
|
||||
int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
|
||||
u_int8_t idx, u_int8_t attr_len, const u_int8_t *attr);
|
||||
int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx);
|
||||
int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx);
|
||||
uint8_t idx, uint8_t attr_len, const uint8_t *attr);
|
||||
int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx);
|
||||
int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx);
|
||||
int abis_nm_bs11_delete_object(struct gsm_bts *bts,
|
||||
enum abis_bs11_objtype type, u_int8_t idx);
|
||||
int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx);
|
||||
int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, u_int8_t e1_port,
|
||||
u_int8_t e1_timeslot, u_int8_t e1_subslot, u_int8_t tei);
|
||||
enum abis_bs11_objtype type, uint8_t idx);
|
||||
int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx);
|
||||
int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port,
|
||||
uint8_t e1_timeslot, uint8_t e1_subslot, uint8_t tei);
|
||||
int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts);
|
||||
int abis_nm_bs11_get_serno(struct gsm_bts *bts);
|
||||
int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level);
|
||||
int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level);
|
||||
int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx);
|
||||
int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on);
|
||||
int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on);
|
||||
int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on);
|
||||
int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on);
|
||||
int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password);
|
||||
@@ -135,38 +129,39 @@ int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value);
|
||||
int abis_nm_bs11_get_cclk(struct gsm_bts *bts);
|
||||
int abis_nm_bs11_get_state(struct gsm_bts *bts);
|
||||
int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
|
||||
u_int8_t win_size, int forced, gsm_cbfn *cbfn);
|
||||
uint8_t win_size, int forced, gsm_cbfn *cbfn);
|
||||
int abis_nm_bs11_set_ext_time(struct gsm_bts *bts);
|
||||
int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport);
|
||||
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg);
|
||||
int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport);
|
||||
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg);
|
||||
int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect);
|
||||
int abis_nm_bs11_restart(struct gsm_bts *bts);
|
||||
|
||||
/* ip.access nanoBTS specific commands */
|
||||
int abis_nm_ipaccess_msg(struct gsm_bts *bts, u_int8_t msg_type,
|
||||
u_int8_t obj_class, u_int8_t bts_nr,
|
||||
u_int8_t trx_nr, u_int8_t ts_nr,
|
||||
u_int8_t *attr, int attr_len);
|
||||
int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, u_int8_t *attr,
|
||||
int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type,
|
||||
uint8_t obj_class, uint8_t bts_nr,
|
||||
uint8_t trx_nr, uint8_t ts_nr,
|
||||
uint8_t *attr, int attr_len);
|
||||
int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr,
|
||||
int attr_len);
|
||||
int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx);
|
||||
int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, u_int8_t obj_class,
|
||||
u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
|
||||
u_int8_t *attr, u_int8_t attr_len);
|
||||
int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class,
|
||||
uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
|
||||
uint8_t *attr, uint8_t attr_len);
|
||||
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
|
||||
u_int32_t ip, u_int16_t port, u_int8_t stream);
|
||||
void abis_nm_ipaccess_cgi(u_int8_t *buf, struct gsm_bts *bts);
|
||||
int ipac_parse_bcch_info(struct ipac_bcch_info *binf, u_int8_t *buf);
|
||||
const char *ipacc_testres_name(u_int8_t res);
|
||||
uint32_t ip, uint16_t port, uint8_t stream);
|
||||
void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts);
|
||||
int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf);
|
||||
const char *ipacc_testres_name(uint8_t res);
|
||||
|
||||
/* Functions calling into other code parts */
|
||||
const char *nm_opstate_name(u_int8_t os);
|
||||
const char *nm_avail_name(u_int8_t avail);
|
||||
int nm_is_running(struct gsm_nm_state *s);
|
||||
|
||||
int abis_nm_vty_init(void);
|
||||
|
||||
void abis_nm_clear_queue(struct gsm_bts *bts);
|
||||
|
||||
int _abis_nm_sendmsg(struct msgb *msg);
|
||||
|
||||
void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */
|
||||
|
||||
#endif /* _NM_H */
|
||||
|
||||
@@ -34,6 +34,13 @@ enum abis_om2k_mo_cls {
|
||||
OM2K_MO_CLS_RX = 0x0c,
|
||||
};
|
||||
|
||||
enum om2k_mo_state {
|
||||
OM2K_MO_S_RESET = 0,
|
||||
OM2K_MO_S_STARTED,
|
||||
OM2K_MO_S_ENABLED,
|
||||
OM2K_MO_S_DISABLED,
|
||||
};
|
||||
|
||||
struct abis_om2k_mo {
|
||||
uint8_t class;
|
||||
uint8_t bts;
|
||||
@@ -41,12 +48,26 @@ struct abis_om2k_mo {
|
||||
uint8_t inst;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* on-wire format for IS conn group */
|
||||
struct om2k_is_conn_grp {
|
||||
uint16_t icp1;
|
||||
uint16_t icp2;
|
||||
uint8_t cont_idx;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* internal data formant for IS conn group */
|
||||
struct is_conn_group {
|
||||
struct llist_head list;
|
||||
uint16_t icp1;
|
||||
uint16_t icp2;
|
||||
uint8_t ci;
|
||||
};
|
||||
|
||||
extern const struct abis_om2k_mo om2k_mo_cf;
|
||||
extern const struct abis_om2k_mo om2k_mo_is;
|
||||
extern const struct abis_om2k_mo om2k_mo_con;
|
||||
extern const struct abis_om2k_mo om2k_mo_tf;
|
||||
|
||||
extern const struct value_string om2k_mo_class_short_vals[];
|
||||
|
||||
int abis_om2k_rcvmsg(struct msgb *msg);
|
||||
@@ -63,8 +84,7 @@ int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
|
||||
int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
|
||||
int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
|
||||
uint8_t operational);
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts, struct om2k_is_conn_grp *cg,
|
||||
unsigned int num_cg);
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts);
|
||||
int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts);
|
||||
int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx);
|
||||
int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx);
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#ifndef _RSL_H
|
||||
#define _RSL_H
|
||||
|
||||
#include <osmocore/protocol/gsm_08_58.h>
|
||||
#include <osmocom/gsm/protocol/gsm_08_58.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
struct gsm_bts;
|
||||
struct gsm_lchan;
|
||||
@@ -32,61 +32,56 @@ struct gsm_subscriber;
|
||||
struct gsm_bts_trx_ts;
|
||||
|
||||
|
||||
int rsl_bcch_info(struct gsm_bts_trx *trx, u_int8_t type,
|
||||
const u_int8_t *data, int len);
|
||||
int rsl_sacch_filling(struct gsm_bts_trx *trx, u_int8_t type,
|
||||
const u_int8_t *data, int len);
|
||||
int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr,
|
||||
u_int8_t act_type,
|
||||
int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type,
|
||||
const uint8_t *data, int len);
|
||||
int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type,
|
||||
const uint8_t *data, int len);
|
||||
int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr,
|
||||
uint8_t act_type,
|
||||
struct rsl_ie_chan_mode *chan_mode,
|
||||
struct rsl_ie_chan_ident *chan_ident,
|
||||
u_int8_t bs_power, u_int8_t ms_power,
|
||||
u_int8_t ta);
|
||||
int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
|
||||
u_int8_t ta, u_int8_t ho_ref);
|
||||
uint8_t bs_power, uint8_t ms_power,
|
||||
uint8_t ta);
|
||||
int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
|
||||
uint8_t ta, uint8_t ho_ref);
|
||||
int rsl_chan_mode_modify_req(struct gsm_lchan *ts);
|
||||
int rsl_encryption_cmd(struct msgb *msg);
|
||||
int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len,
|
||||
u_int8_t *ms_ident, u_int8_t chan_needed);
|
||||
int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val);
|
||||
int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len,
|
||||
uint8_t *ms_ident, uint8_t chan_needed);
|
||||
int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val);
|
||||
|
||||
int rsl_data_request(struct msgb *msg, u_int8_t link_id);
|
||||
int rsl_establish_request(struct gsm_lchan *lchan, u_int8_t link_id);
|
||||
int rsl_relase_request(struct gsm_lchan *lchan, u_int8_t link_id);
|
||||
int rsl_data_request(struct msgb *msg, uint8_t link_id);
|
||||
int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id);
|
||||
int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id);
|
||||
|
||||
/* Siemens vendor-specific RSL extensions */
|
||||
int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);
|
||||
|
||||
/* ip.access specfic RSL extensions */
|
||||
int rsl_ipacc_crcx(struct gsm_lchan *lchan);
|
||||
int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip,
|
||||
u_int16_t port, u_int8_t rtp_payload2);
|
||||
int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip,
|
||||
uint16_t port, uint8_t rtp_payload2);
|
||||
int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan);
|
||||
int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act);
|
||||
|
||||
int abis_rsl_rcvmsg(struct msgb *msg);
|
||||
|
||||
unsigned int get_paging_group(u_int64_t imsi, unsigned int bs_cc_chans,
|
||||
int n_pag_blocks);
|
||||
unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res);
|
||||
u_int64_t str_to_imsi(const char *imsi_str);
|
||||
u_int8_t lchan2chan_nr(const struct gsm_lchan *lchan);
|
||||
int rsl_release_request(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t reason);
|
||||
uint64_t str_to_imsi(const char *imsi_str);
|
||||
int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason);
|
||||
|
||||
int rsl_lchan_set_state(struct gsm_lchan *lchan, int);
|
||||
|
||||
/* to be provided by external code */
|
||||
int abis_rsl_sendmsg(struct msgb *msg);
|
||||
int rsl_deact_sacch(struct gsm_lchan *lchan);
|
||||
int rsl_lchan_rll_release(struct gsm_lchan *lchan, u_int8_t link_id);
|
||||
int rsl_lchan_rll_release(struct gsm_lchan *lchan, uint8_t link_id);
|
||||
|
||||
/* BCCH related code */
|
||||
int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf);
|
||||
int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf);
|
||||
int rsl_number_of_paging_subchannels(struct gsm_bts *bts);
|
||||
|
||||
int rsl_sacch_info_modify(struct gsm_lchan *lchan, u_int8_t type,
|
||||
const u_int8_t *data, int len);
|
||||
int rsl_sacch_info_modify(struct gsm_lchan *lchan, uint8_t type,
|
||||
const uint8_t *data, int len);
|
||||
|
||||
int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db);
|
||||
int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm);
|
||||
@@ -95,5 +90,12 @@ int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm);
|
||||
int rsl_sms_cb_command(struct gsm_bts *bts, uint8_t chan_number,
|
||||
uint8_t cb_command, const uint8_t *data, int len);
|
||||
|
||||
/* some Nokia specific stuff */
|
||||
int rsl_nokia_si_begin(struct gsm_bts_trx *trx);
|
||||
int rsl_nokia_si_end(struct gsm_bts_trx *trx);
|
||||
|
||||
/* required for Nokia BTS power control */
|
||||
int rsl_bs_power_control(struct gsm_bts_trx *trx, uint8_t channel, uint8_t reduction);
|
||||
|
||||
#endif /* RSL_MT_H */
|
||||
|
||||
|
||||
@@ -9,18 +9,25 @@
|
||||
#define BSC_API_CONN_POL_REJECT 1
|
||||
|
||||
struct bsc_api {
|
||||
/*! \brief BTS->MSC: tell MSC a SAPI was not established */
|
||||
void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci);
|
||||
/*! \brief MS->MSC: Tell MSC that ciphering has been enabled */
|
||||
void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn,
|
||||
struct msgb *msg, uint8_t chosen_encr);
|
||||
/*! \brief MS->MSC: New MM context with L3 payload */
|
||||
int (*compl_l3)(struct gsm_subscriber_connection *conn,
|
||||
struct msgb *msg, uint16_t chosen_channel);
|
||||
/*! \brief MS->BSC/MSC: Um L3 message */
|
||||
void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id,
|
||||
struct msgb *msg);
|
||||
/*! \brief BSC->MSC: Assignment of lchan successful */
|
||||
void (*assign_compl)(struct gsm_subscriber_connection *conn,
|
||||
uint8_t rr_cause, uint8_t chosen_channel,
|
||||
uint8_t encr_alg_id, uint8_t speech_mode);
|
||||
/*! \brief BSC->MSC: Assignment of lchan failed */
|
||||
void (*assign_fail)(struct gsm_subscriber_connection *conn,
|
||||
uint8_t cause, uint8_t *rr_cause);
|
||||
/*! \brief BSC->MSC: RR conn has been cleared */
|
||||
int (*clear_request)(struct gsm_subscriber_connection *conn,
|
||||
uint32_t cause);
|
||||
};
|
||||
|
||||
@@ -22,25 +22,33 @@
|
||||
#ifndef BSC_MSC_H
|
||||
#define BSC_MSC_H
|
||||
|
||||
#include <osmocore/write_queue.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocom/core/write_queue.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
struct bsc_msc_dest {
|
||||
struct llist_head list;
|
||||
|
||||
char *ip;
|
||||
int port;
|
||||
int dscp;
|
||||
};
|
||||
|
||||
|
||||
struct bsc_msc_connection {
|
||||
struct write_queue write_queue;
|
||||
struct osmo_wqueue write_queue;
|
||||
int is_connected;
|
||||
int is_authenticated;
|
||||
int first_contact;
|
||||
const char *ip;
|
||||
int port;
|
||||
int prio;
|
||||
|
||||
struct llist_head *dests;
|
||||
|
||||
void (*connection_loss) (struct bsc_msc_connection *);
|
||||
void (*connected) (struct bsc_msc_connection *);
|
||||
struct timer_list reconnect_timer;
|
||||
struct timer_list timeout_timer;
|
||||
struct osmo_timer_list reconnect_timer;
|
||||
struct osmo_timer_list timeout_timer;
|
||||
};
|
||||
|
||||
struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio);
|
||||
struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest);
|
||||
int bsc_msc_connect(struct bsc_msc_connection *);
|
||||
void bsc_msc_schedule_connect(struct bsc_msc_connection *);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
* (C) 2010 by On-Waves
|
||||
* (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
|
||||
* (C) 2010-2011 by On-Waves
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -23,22 +23,23 @@
|
||||
|
||||
#include "mgcp.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/msgfile.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocore/write_queue.h>
|
||||
#include <osmocore/rate_ctr.h>
|
||||
#include <osmocore/statistics.h>
|
||||
#include <osmocore/protocol/gsm_04_08.h>
|
||||
#include <osmocom/core/select.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/msgfile.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/write_queue.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <osmocom/core/statistics.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#define DIR_BSC 1
|
||||
#define DIR_MSC 2
|
||||
|
||||
#define PAGIN_GROUP_UNASSIGNED -1
|
||||
|
||||
struct sccp_source_reference;
|
||||
struct sccp_connections;
|
||||
struct bsc_nat_parsed;
|
||||
@@ -55,6 +56,34 @@ enum {
|
||||
NAT_CON_TYPE_OTHER,
|
||||
};
|
||||
|
||||
/*
|
||||
* Is this terminated to the MSC, to the local machine (release
|
||||
* handling for IMSI filtering) or to a USSD provider?
|
||||
*/
|
||||
enum {
|
||||
NAT_CON_END_MSC,
|
||||
NAT_CON_END_LOCAL,
|
||||
NAT_CON_END_USSD,
|
||||
};
|
||||
|
||||
/*
|
||||
* Pending command entry
|
||||
*/
|
||||
struct bsc_cmd_list {
|
||||
struct llist_head list_entry;
|
||||
|
||||
struct osmo_timer_list timeout;
|
||||
|
||||
/* The NATed ID used on the bsc_con*/
|
||||
int nat_id;
|
||||
|
||||
/* The control connection from which the command originated */
|
||||
struct ctrl_connection *ccon;
|
||||
|
||||
/* The command from the control connection */
|
||||
struct ctrl_cmd *cmd;
|
||||
};
|
||||
|
||||
/*
|
||||
* Per BSC data structure
|
||||
*/
|
||||
@@ -65,17 +94,17 @@ struct bsc_connection {
|
||||
int authenticated;
|
||||
|
||||
/* the fd we use to communicate */
|
||||
struct write_queue write_queue;
|
||||
struct osmo_wqueue write_queue;
|
||||
|
||||
/* the BSS associated */
|
||||
struct bsc_config *cfg;
|
||||
|
||||
/* a timeout node */
|
||||
struct timer_list id_timeout;
|
||||
struct osmo_timer_list id_timeout;
|
||||
|
||||
/* pong timeout */
|
||||
struct timer_list ping_timeout;
|
||||
struct timer_list pong_timeout;
|
||||
struct osmo_timer_list ping_timeout;
|
||||
struct osmo_timer_list pong_timeout;
|
||||
|
||||
/* mgcp related code */
|
||||
char *_endpoint_status;
|
||||
@@ -83,6 +112,10 @@ struct bsc_connection {
|
||||
int max_endpoints;
|
||||
int last_endpoint;
|
||||
|
||||
/* track the pending commands for this BSC */
|
||||
struct llist_head cmd_pending;
|
||||
int last_id;
|
||||
|
||||
/* a back pointer */
|
||||
struct bsc_nat *nat;
|
||||
};
|
||||
@@ -125,6 +158,7 @@ struct bsc_config {
|
||||
char *acc_lst_name;
|
||||
|
||||
int forbid_paging;
|
||||
int paging_group;
|
||||
|
||||
/* audio handling */
|
||||
int max_endpoints;
|
||||
@@ -142,6 +176,14 @@ struct bsc_lac_entry {
|
||||
uint16_t lac;
|
||||
};
|
||||
|
||||
struct bsc_nat_paging_group {
|
||||
struct llist_head entry;
|
||||
|
||||
/* list of lac entries */
|
||||
struct llist_head lists;
|
||||
int nr;
|
||||
};
|
||||
|
||||
/**
|
||||
* BSCs point of view of endpoints
|
||||
*/
|
||||
@@ -159,21 +201,21 @@ struct bsc_endpoint {
|
||||
*/
|
||||
struct bsc_nat_statistics {
|
||||
struct {
|
||||
struct counter *conn;
|
||||
struct counter *calls;
|
||||
struct osmo_counter *conn;
|
||||
struct osmo_counter *calls;
|
||||
} sccp;
|
||||
|
||||
struct {
|
||||
struct counter *reconn;
|
||||
struct counter *auth_fail;
|
||||
struct osmo_counter *reconn;
|
||||
struct osmo_counter *auth_fail;
|
||||
} bsc;
|
||||
|
||||
struct {
|
||||
struct counter *reconn;
|
||||
struct osmo_counter *reconn;
|
||||
} msc;
|
||||
|
||||
struct {
|
||||
struct counter *reconn;
|
||||
struct osmo_counter *reconn;
|
||||
} ussd;
|
||||
};
|
||||
|
||||
@@ -216,6 +258,9 @@ struct bsc_nat {
|
||||
/* access lists */
|
||||
struct llist_head access_lists;
|
||||
|
||||
/* paging groups */
|
||||
struct llist_head paging_groups;
|
||||
|
||||
/* known BSC's */
|
||||
struct llist_head bsc_configs;
|
||||
int num_bsc;
|
||||
@@ -227,8 +272,8 @@ struct bsc_nat {
|
||||
int mgcp_length;
|
||||
|
||||
/* msc things */
|
||||
char *msc_ip;
|
||||
int msc_port;
|
||||
struct llist_head dests;
|
||||
struct bsc_msc_dest *main_dest;
|
||||
struct bsc_msc_connection *msc_con;
|
||||
char *token;
|
||||
|
||||
@@ -244,20 +289,39 @@ struct bsc_nat {
|
||||
|
||||
/* number rewriting */
|
||||
char *num_rewr_name;
|
||||
struct msg_entries *num_rewr;
|
||||
struct llist_head num_rewr;
|
||||
|
||||
char *smsc_rewr_name;
|
||||
struct llist_head smsc_rewr;
|
||||
char *tpdest_match_name;
|
||||
struct llist_head tpdest_match;
|
||||
char *sms_clear_tp_srr_name;
|
||||
struct llist_head sms_clear_tp_srr;
|
||||
|
||||
/* USSD messages we want to match */
|
||||
char *ussd_lst_name;
|
||||
char *ussd_query;
|
||||
regex_t ussd_query_re;
|
||||
char *ussd_token;
|
||||
char *ussd_local;
|
||||
struct bsc_fd ussd_listen;
|
||||
struct osmo_fd ussd_listen;
|
||||
struct bsc_nat_ussd_con *ussd_con;
|
||||
|
||||
/* for maintainenance */
|
||||
int blocked;
|
||||
|
||||
/* statistics */
|
||||
struct bsc_nat_statistics stats;
|
||||
};
|
||||
|
||||
struct bsc_nat_ussd_con {
|
||||
struct osmo_wqueue queue;
|
||||
struct bsc_nat *nat;
|
||||
int authorized;
|
||||
|
||||
struct osmo_timer_list auth_timeout;
|
||||
};
|
||||
|
||||
/* create and init the structures */
|
||||
struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token);
|
||||
struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num);
|
||||
@@ -285,7 +349,7 @@ struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg);
|
||||
*/
|
||||
int bsc_nat_filter_ipa(int direction, struct msgb *msg, struct bsc_nat_parsed *parsed);
|
||||
int bsc_nat_vty_init(struct bsc_nat *nat);
|
||||
struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg, int *_lac);
|
||||
int bsc_nat_find_paging(struct msgb *msg, const uint8_t **,int *len);
|
||||
|
||||
/**
|
||||
* Content filtering.
|
||||
@@ -326,12 +390,11 @@ uint32_t bsc_mgcp_extract_ci(const char *resp);
|
||||
|
||||
|
||||
int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
|
||||
int bsc_do_write(struct write_queue *queue, struct msgb *msg, int id);
|
||||
int bsc_write_msg(struct write_queue *queue, struct msgb *msg);
|
||||
int bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg);
|
||||
int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int id);
|
||||
int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg);
|
||||
int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg);
|
||||
|
||||
/* IMSI allow/deny handling */
|
||||
void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
|
||||
struct bsc_nat_acc_lst *bsc_nat_acc_lst_find(struct bsc_nat *nat, const char *name);
|
||||
struct bsc_nat_acc_lst *bsc_nat_acc_lst_get(struct bsc_nat *nat, const char *name);
|
||||
void bsc_nat_acc_lst_delete(struct bsc_nat_acc_lst *lst);
|
||||
@@ -350,6 +413,27 @@ int bsc_ussd_init(struct bsc_nat *nat);
|
||||
int bsc_check_ussd(struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct msgb *msg);
|
||||
int bsc_close_ussd_connections(struct bsc_nat *nat);
|
||||
|
||||
struct msgb *bsc_nat_rewrite_setup(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi);
|
||||
struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi);
|
||||
|
||||
/** paging group handling */
|
||||
struct bsc_nat_paging_group *bsc_nat_paging_group_num(struct bsc_nat *nat, int group);
|
||||
struct bsc_nat_paging_group *bsc_nat_paging_group_create(struct bsc_nat *nat, int group);
|
||||
void bsc_nat_paging_group_delete(struct bsc_nat_paging_group *);
|
||||
void bsc_nat_paging_group_add_lac(struct bsc_nat_paging_group *grp, int lac);
|
||||
void bsc_nat_paging_group_del_lac(struct bsc_nat_paging_group *grp, int lac);
|
||||
|
||||
/**
|
||||
* Number rewriting support below
|
||||
*/
|
||||
struct bsc_nat_num_rewr_entry {
|
||||
struct llist_head list;
|
||||
|
||||
regex_t msisdn_reg;
|
||||
regex_t num_reg;
|
||||
|
||||
char *replace;
|
||||
};
|
||||
|
||||
void bsc_nat_num_rewr_entry_adapt(void *ctx, struct llist_head *head, const struct osmo_config_list *);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#ifndef BSC_NAT_SCCP_H
|
||||
#define BSC_NAT_SCCP_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <osmocom/sccp/sccp_types.h>
|
||||
|
||||
/*
|
||||
@@ -77,9 +76,13 @@ struct sccp_connections {
|
||||
/* status */
|
||||
int con_type;
|
||||
int con_local;
|
||||
int authorized;
|
||||
int imsi_checked;
|
||||
char *imsi;
|
||||
|
||||
/* remember which Transactions we run over the bypass */
|
||||
char ussd_ti[8];
|
||||
|
||||
/*
|
||||
* audio handling. Remember if we have ever send a CRCX,
|
||||
* remember the endpoint used by the MSC and BSC.
|
||||
|
||||
@@ -10,10 +10,10 @@ enum bsc_rllr_ind {
|
||||
BSC_RLLR_IND_TIMEOUT,
|
||||
};
|
||||
|
||||
int rll_establish(struct gsm_lchan *lchan, u_int8_t link_id,
|
||||
void (*cb)(struct gsm_lchan *, u_int8_t, void *,
|
||||
int rll_establish(struct gsm_lchan *lchan, uint8_t link_id,
|
||||
void (*cb)(struct gsm_lchan *, uint8_t, void *,
|
||||
enum bsc_rllr_ind),
|
||||
void *data);
|
||||
void rll_indication(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t type);
|
||||
void rll_indication(struct gsm_lchan *lchan, uint8_t link_id, uint8_t type);
|
||||
|
||||
#endif /* _BSC_RLL_H */
|
||||
|
||||
18
openbsc/include/openbsc/bss.h
Normal file
18
openbsc/include/openbsc/bss.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _BSS_H_
|
||||
#define _BSS_H_
|
||||
|
||||
struct gsm_network;
|
||||
struct msgb;
|
||||
|
||||
/* start and stop network */
|
||||
extern int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, struct msgb *), const char *cfg_file);
|
||||
extern int bsc_shutdown_net(struct gsm_network *net);
|
||||
|
||||
/* register all supported BTS */
|
||||
extern int bts_init(void);
|
||||
extern int bts_model_bs11_init(void);
|
||||
extern int bts_model_rbs2k_init(void);
|
||||
extern int bts_model_nanobts_init(void);
|
||||
extern int bts_model_hslfemto_init(void);
|
||||
extern int bts_model_nokia_site_init(void);
|
||||
#endif
|
||||
155
openbsc/include/openbsc/control_cmd.h
Normal file
155
openbsc/include/openbsc/control_cmd.h
Normal file
@@ -0,0 +1,155 @@
|
||||
#ifndef _CONTROL_CMD_H
|
||||
#define _CONTROL_CMD_H
|
||||
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/write_queue.h>
|
||||
|
||||
#include <osmocom/vty/vector.h>
|
||||
|
||||
#define CTRL_CMD_ERROR -1
|
||||
#define CTRL_CMD_HANDLED 0
|
||||
#define CTRL_CMD_REPLY 1
|
||||
|
||||
enum ctrl_node_type {
|
||||
CTRL_NODE_ROOT, /* Root elements */
|
||||
CTRL_NODE_NET, /* Network specific (net.) */
|
||||
CTRL_NODE_BTS, /* BTS specific (net.btsN.) */
|
||||
CTRL_NODE_TRX, /* TRX specific (net.btsN.trxM.) */
|
||||
CTRL_NODE_TS, /* TS specific (net.btsN.trxM.tsI.) */
|
||||
_LAST_CTRL_NODE
|
||||
};
|
||||
|
||||
enum ctrl_type {
|
||||
CTRL_TYPE_UNKNOWN,
|
||||
CTRL_TYPE_GET,
|
||||
CTRL_TYPE_SET,
|
||||
CTRL_TYPE_GET_REPLY,
|
||||
CTRL_TYPE_SET_REPLY,
|
||||
CTRL_TYPE_TRAP,
|
||||
CTRL_TYPE_ERROR
|
||||
};
|
||||
|
||||
struct ctrl_connection {
|
||||
struct llist_head list_entry;
|
||||
|
||||
/* The queue for sending data back */
|
||||
struct osmo_wqueue write_queue;
|
||||
|
||||
/* Callback if the connection was closed */
|
||||
void (*closed_cb)(struct ctrl_connection *conn);
|
||||
|
||||
/* Pending commands for this connection */
|
||||
struct llist_head cmds;
|
||||
};
|
||||
|
||||
struct ctrl_cmd {
|
||||
struct ctrl_connection *ccon;
|
||||
enum ctrl_type type;
|
||||
char *id;
|
||||
void *node;
|
||||
char *variable;
|
||||
char *value;
|
||||
char *reply;
|
||||
};
|
||||
|
||||
struct ctrl_cmd_struct {
|
||||
int nr_commands;
|
||||
char **command;
|
||||
};
|
||||
|
||||
struct ctrl_cmd_element {
|
||||
const char *name;
|
||||
const char *param;
|
||||
struct ctrl_cmd_struct strcmd;
|
||||
int (*set)(struct ctrl_cmd *cmd, void *data);
|
||||
int (*get)(struct ctrl_cmd *cmd, void *data);
|
||||
int (*verify)(struct ctrl_cmd *cmd, const char *value, void *data);
|
||||
};
|
||||
|
||||
struct ctrl_cmd_map {
|
||||
char *cmd;
|
||||
enum ctrl_type type;
|
||||
};
|
||||
|
||||
int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *data);
|
||||
int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd);
|
||||
int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data);
|
||||
int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
|
||||
struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg);
|
||||
struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd);
|
||||
struct ctrl_cmd *ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd);
|
||||
struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type);
|
||||
|
||||
#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \
|
||||
static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
|
||||
{ \
|
||||
dtype *node = data; \
|
||||
cmd->reply = talloc_asprintf(cmd, "%i", node->element); \
|
||||
if (!cmd->reply) { \
|
||||
cmd->reply = "OOM"; \
|
||||
return CTRL_CMD_ERROR; \
|
||||
} \
|
||||
return CTRL_CMD_REPLY; \
|
||||
} \
|
||||
static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \
|
||||
{ \
|
||||
dtype *node = data; \
|
||||
int tmp = atoi(cmd->value); \
|
||||
node->element = tmp; \
|
||||
return get_##cmdname(cmd, data); \
|
||||
} \
|
||||
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \
|
||||
{ \
|
||||
int tmp = atoi(value); \
|
||||
if ((tmp >= min)&&(tmp <= max)) { \
|
||||
return 0; \
|
||||
} \
|
||||
return -1; \
|
||||
} \
|
||||
struct ctrl_cmd_element cmd_##cmdname = { \
|
||||
.name = cmdstr, \
|
||||
.param = NULL, \
|
||||
.get = &get_##cmdname, \
|
||||
.set = &set_##cmdname, \
|
||||
.verify = &verify_##cmdname, \
|
||||
}
|
||||
|
||||
#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \
|
||||
static int get_##cmdname(struct ctrl_cmd *cmd, dtype *data) \
|
||||
{ \
|
||||
cmd->reply = talloc_asprintf(cmd, "%s", data->element); \
|
||||
if (!cmd->reply) { \
|
||||
cmd->reply = "OOM"; \
|
||||
return CTRL_CMD_ERROR; \
|
||||
} \
|
||||
return CTRL_CMD_REPLY; \
|
||||
} \
|
||||
static int set_##cmdname(struct ctrl_cmd *cmd, dtype *data) \
|
||||
{ \
|
||||
bsc_replace_string(cmd->node, &data->element, cmd->value); \
|
||||
return get_##cmdname(cmd, data); \
|
||||
} \
|
||||
struct ctrl_cmd_element cmd_##cmdname = { \
|
||||
.name = cmdstr, \
|
||||
.param = NULL, \
|
||||
.get = &get_##cmdname, \
|
||||
.set = &set_##cmdname, \
|
||||
.verify = NULL, \
|
||||
}
|
||||
|
||||
#define CTRL_CMD_DEFINE(cmdname, cmdstr) \
|
||||
static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \
|
||||
static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
|
||||
static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \
|
||||
struct ctrl_cmd_element cmd_##cmdname = { \
|
||||
.name = cmdstr, \
|
||||
.param = NULL, \
|
||||
.get = &get_##cmdname, \
|
||||
.set = &set_##cmdname, \
|
||||
.verify = &verify_##cmdname, \
|
||||
}
|
||||
|
||||
struct gsm_network;
|
||||
int controlif_setup(struct gsm_network *gsmnet, uint16_t port);
|
||||
|
||||
#endif /* _CONTROL_CMD_H */
|
||||
13
openbsc/include/openbsc/control_if.h
Normal file
13
openbsc/include/openbsc/control_if.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _CONTROL_IF_H
|
||||
#define _CONTROL_IF_H
|
||||
|
||||
#include <osmocom/core/write_queue.h>
|
||||
#include <openbsc/control_cmd.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
|
||||
int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
|
||||
int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data);
|
||||
int controlif_setup(struct gsm_network *gsmnet, uint16_t port);
|
||||
|
||||
#endif /* _CONTROL_IF_H */
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#ifndef _CRC24_H
|
||||
#define _CRC24_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define INIT_CRC24 0xffffff
|
||||
|
||||
u_int32_t crc24_calc(u_int32_t fcs, u_int8_t *cp, unsigned int len);
|
||||
uint32_t crc24_calc(uint32_t fcs, uint8_t *cp, unsigned int len);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef _DB_H
|
||||
#define _DB_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "gsm_subscriber.h"
|
||||
|
||||
struct gsm_equipment;
|
||||
struct gsm_network;
|
||||
@@ -29,12 +29,10 @@ struct gsm_auth_tuple;
|
||||
struct gsm_sms;
|
||||
struct gsm_subscriber;
|
||||
|
||||
enum gsm_subscriber_field;
|
||||
|
||||
/* one time initialisation */
|
||||
int db_init(const char *name);
|
||||
int db_prepare();
|
||||
int db_fini();
|
||||
int db_prepare(void);
|
||||
int db_fini(void);
|
||||
|
||||
/* subscriber management */
|
||||
struct gsm_subscriber *db_create_subscriber(struct gsm_network *net,
|
||||
@@ -45,7 +43,7 @@ struct gsm_subscriber *db_get_subscriber(struct gsm_network *net,
|
||||
int db_sync_subscriber(struct gsm_subscriber *subscriber);
|
||||
int db_subscriber_alloc_tmsi(struct gsm_subscriber *subscriber);
|
||||
int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber);
|
||||
int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, u_int32_t* token);
|
||||
int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t* token);
|
||||
int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char *imei);
|
||||
int db_sync_equipment(struct gsm_equipment *equip);
|
||||
int db_subscriber_update(struct gsm_subscriber *subscriber);
|
||||
@@ -71,12 +69,12 @@ int db_sms_inc_deliver_attempts(struct gsm_sms *sms);
|
||||
|
||||
/* APDU blob storage */
|
||||
int db_apdu_blob_store(struct gsm_subscriber *subscr,
|
||||
u_int8_t apdu_id_flags, u_int8_t len,
|
||||
u_int8_t *apdu);
|
||||
uint8_t apdu_id_flags, uint8_t len,
|
||||
uint8_t *apdu);
|
||||
|
||||
/* Statistics counter storage */
|
||||
struct counter;
|
||||
int db_store_counter(struct counter *ctr);
|
||||
struct osmo_counter;
|
||||
int db_store_counter(struct osmo_counter *ctr);
|
||||
struct rate_ctr_group;
|
||||
int db_store_rate_ctr_group(struct rate_ctr_group *ctrg);
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#define _DEBUG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
|
||||
#define DEBUG
|
||||
#include <osmocore/logging.h>
|
||||
#include <osmocom/core/logging.h>
|
||||
|
||||
/* Debug Areas of the code */
|
||||
enum {
|
||||
@@ -19,10 +19,6 @@ enum {
|
||||
DSMS,
|
||||
DPAG,
|
||||
DMEAS,
|
||||
DMI,
|
||||
DMIB,
|
||||
DMUX,
|
||||
DINP,
|
||||
DSCCP,
|
||||
DMSC,
|
||||
DMGCP,
|
||||
@@ -35,6 +31,7 @@ enum {
|
||||
DLLC,
|
||||
DSNDCP,
|
||||
DNAT,
|
||||
DCTRL,
|
||||
Debug_LastEntry,
|
||||
};
|
||||
|
||||
|
||||
11
openbsc/include/openbsc/e1_config.h
Normal file
11
openbsc/include/openbsc/e1_config.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _E1_CONFIG_H
|
||||
#define _E1_CONFIG_H
|
||||
|
||||
#include <openbsc/gsm_data_shared.h>
|
||||
|
||||
int e1_reconfig_ts(struct gsm_bts_trx_ts *ts);
|
||||
int e1_reconfig_trx(struct gsm_bts_trx *trx);
|
||||
int e1_reconfig_bts(struct gsm_bts *bts);
|
||||
|
||||
#endif /* _E1_CONFIG_H */
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
#ifndef _E1_INPUT_H
|
||||
#define _E1_INPUT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <openbsc/subchan_demux.h>
|
||||
|
||||
#define NUM_E1_TS 32
|
||||
|
||||
enum e1inp_sign_type {
|
||||
E1INP_SIGN_NONE,
|
||||
E1INP_SIGN_OML,
|
||||
E1INP_SIGN_RSL,
|
||||
};
|
||||
const char *e1inp_signtype_name(enum e1inp_sign_type tp);
|
||||
|
||||
struct e1inp_ts;
|
||||
|
||||
struct e1inp_sign_link {
|
||||
/* list of signalling links */
|
||||
struct llist_head list;
|
||||
|
||||
/* to which timeslot do we belong? */
|
||||
struct e1inp_ts *ts;
|
||||
|
||||
enum e1inp_sign_type type;
|
||||
|
||||
/* trx for msg->trx of received msgs */
|
||||
struct gsm_bts_trx *trx;
|
||||
|
||||
/* msgb queue of to-be-transmitted msgs */
|
||||
struct llist_head tx_list;
|
||||
|
||||
/* SAPI and TEI on the E1 TS */
|
||||
u_int8_t sapi;
|
||||
u_int8_t tei;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u_int8_t channel;
|
||||
} misdn;
|
||||
} driver;
|
||||
};
|
||||
|
||||
enum e1inp_ts_type {
|
||||
E1INP_TS_TYPE_NONE,
|
||||
E1INP_TS_TYPE_SIGN,
|
||||
E1INP_TS_TYPE_TRAU,
|
||||
};
|
||||
const char *e1inp_tstype_name(enum e1inp_ts_type tp);
|
||||
|
||||
/* A timeslot in the E1 interface */
|
||||
struct e1inp_ts {
|
||||
enum e1inp_ts_type type;
|
||||
int num;
|
||||
|
||||
/* to which line do we belong ? */
|
||||
struct e1inp_line *line;
|
||||
|
||||
union {
|
||||
struct {
|
||||
/* list of all signalling links on this TS */
|
||||
struct llist_head sign_links;
|
||||
/* delay for the queue */
|
||||
int delay;
|
||||
/* timer when to dequeue next frame */
|
||||
struct timer_list tx_timer;
|
||||
} sign;
|
||||
struct {
|
||||
/* subchannel demuxer for frames from E1 */
|
||||
struct subch_demux demux;
|
||||
/* subchannel muxer for frames to E1 */
|
||||
struct subch_mux mux;
|
||||
} trau;
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
/* mISDN driver has one fd for each ts */
|
||||
struct bsc_fd fd;
|
||||
} misdn;
|
||||
struct {
|
||||
/* ip.access driver has one fd for each ts */
|
||||
struct bsc_fd fd;
|
||||
} ipaccess;
|
||||
struct {
|
||||
/* DAHDI driver has one fd for each ts */
|
||||
struct bsc_fd fd;
|
||||
struct lapd_instance *lapd;
|
||||
} dahdi;
|
||||
} driver;
|
||||
};
|
||||
|
||||
struct e1inp_driver {
|
||||
struct llist_head list;
|
||||
const char *name;
|
||||
int (*want_write)(struct e1inp_ts *ts);
|
||||
int (*line_update)(struct e1inp_line *line);
|
||||
int default_delay;
|
||||
};
|
||||
|
||||
struct e1inp_line {
|
||||
struct llist_head list;
|
||||
unsigned int num;
|
||||
const char *name;
|
||||
|
||||
/* array of timestlots */
|
||||
struct e1inp_ts ts[NUM_E1_TS];
|
||||
|
||||
struct e1inp_driver *driver;
|
||||
void *driver_data;
|
||||
};
|
||||
|
||||
/* register a driver with the E1 core */
|
||||
int e1inp_driver_register(struct e1inp_driver *drv);
|
||||
|
||||
/* fine a previously registered driver */
|
||||
struct e1inp_driver *e1inp_driver_find(const char *name);
|
||||
|
||||
/* register a line with the E1 core */
|
||||
int e1inp_line_register(struct e1inp_line *line);
|
||||
|
||||
/* get a line by its ID */
|
||||
struct e1inp_line *e1inp_line_get(u_int8_t e1_nr);
|
||||
|
||||
/* create a line in the E1 input core */
|
||||
struct e1inp_line *e1inp_line_create(u_int8_t e1_nr, const char *driver_name);
|
||||
|
||||
/* find a sign_link for given TEI and SAPI in a TS */
|
||||
struct e1inp_sign_link *
|
||||
e1inp_lookup_sign_link(struct e1inp_ts *ts, u_int8_t tei,
|
||||
u_int8_t sapi);
|
||||
|
||||
/* create a new signalling link in a E1 timeslot */
|
||||
struct e1inp_sign_link *
|
||||
e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type,
|
||||
struct gsm_bts_trx *trx, u_int8_t tei,
|
||||
u_int8_t sapi);
|
||||
|
||||
/* configure and initialize one e1inp_ts */
|
||||
int e1inp_ts_config(struct e1inp_ts *ts, struct e1inp_line *line,
|
||||
enum e1inp_ts_type type);
|
||||
|
||||
/* Call from the Stack: configuration of this TS has changed */
|
||||
int e1inp_update_ts(struct e1inp_ts *ts);
|
||||
|
||||
/* Receive a packet from the E1 driver */
|
||||
int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
|
||||
u_int8_t tei, u_int8_t sapi);
|
||||
|
||||
/* called by driver if it wants to transmit on a given TS */
|
||||
struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts,
|
||||
struct e1inp_sign_link **sign_link);
|
||||
|
||||
/* called by driver in case some kind of link state event */
|
||||
int e1inp_event(struct e1inp_ts *ts, int evt, u_int8_t tei, u_int8_t sapi);
|
||||
|
||||
/* Write LAPD frames to the fd. */
|
||||
void e1_set_pcap_fd(int fd);
|
||||
|
||||
/* called by TRAU muxer to obtain the destination mux entity */
|
||||
struct subch_mux *e1inp_get_mux(u_int8_t e1_nr, u_int8_t ts_nr);
|
||||
|
||||
void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
|
||||
int e1inp_line_update(struct e1inp_line *line);
|
||||
|
||||
/* e1_config.c */
|
||||
int e1_reconfig_ts(struct gsm_bts_trx_ts *ts);
|
||||
int e1_reconfig_trx(struct gsm_bts_trx *trx);
|
||||
int e1_reconfig_bts(struct gsm_bts *bts);
|
||||
|
||||
int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin);
|
||||
int ipaccess_setup(struct gsm_network *gsmnet);
|
||||
|
||||
extern struct llist_head e1inp_driver_list;
|
||||
extern struct llist_head e1inp_line_list;
|
||||
|
||||
int e1inp_vty_init(void);
|
||||
void e1inp_init(void);
|
||||
|
||||
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml);
|
||||
|
||||
#endif /* _E1_INPUT_H */
|
||||
@@ -1,16 +1,15 @@
|
||||
#ifndef _GB_PROXY_H
|
||||
#define _GB_PROXY_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
#include <openbsc/gprs_ns.h>
|
||||
#include <osmocom/vty/command.h>
|
||||
|
||||
struct gbproxy_config {
|
||||
/* parsed from config file */
|
||||
u_int16_t nsip_sgsn_nsei;
|
||||
uint16_t nsip_sgsn_nsei;
|
||||
|
||||
/* misc */
|
||||
struct gprs_ns_inst *nsi;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Section 5.4.1 */
|
||||
/*! \brief Fixed BVCI definitions (Section 5.4.1) */
|
||||
#define BVCI_SIGNALLING 0x0000
|
||||
#define BVCI_PTM 0x0001
|
||||
|
||||
/* Section 11.3.26 / Table 11.27 */
|
||||
/*! \brief BSSGP PDU types (Section 11.3.26 / Table 11.27) */
|
||||
enum bssgp_pdu_type {
|
||||
/* PDUs between RL and BSSGP SAPs */
|
||||
BSSGP_PDUT_DL_UNITDATA = 0x00,
|
||||
@@ -53,19 +53,21 @@ enum bssgp_pdu_type {
|
||||
BSSGP_PDUT_DELETE_BSS_PFC_ACK = 0x57,
|
||||
};
|
||||
|
||||
/* Section 10.2.1 and 10.2.2 */
|
||||
/*! \brief BSSGP User-Data header (Section 10.2.1 and 10.2.2) */
|
||||
struct bssgp_ud_hdr {
|
||||
uint8_t pdu_type;
|
||||
uint32_t tlli;
|
||||
uint8_t qos_profile[3];
|
||||
uint8_t data[0]; /* TLV's */
|
||||
uint8_t pdu_type; /*!< BSSGP PDU type */
|
||||
uint32_t tlli; /*!< Temporary Link-Local Identifier */
|
||||
uint8_t qos_profile[3]; /*!< QoS profile */
|
||||
uint8_t data[0]; /* optional/conditional IEs as TLVs */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*! \brief BSSGP normal header */
|
||||
struct bssgp_normal_hdr {
|
||||
uint8_t pdu_type;
|
||||
uint8_t data[0]; /* TLV's */
|
||||
uint8_t pdu_type; /*!< BSSGP PDU type */
|
||||
uint8_t data[0]; /*!< optional/conditional IEs as TLVs */
|
||||
};
|
||||
|
||||
/*! \brief BSSGP Information Element Identifiers */
|
||||
enum bssgp_iei_type {
|
||||
BSSGP_IE_ALIGNMENT = 0x00,
|
||||
BSSGP_IE_BMAX_DEFAULT_MS = 0x01,
|
||||
@@ -115,7 +117,7 @@ enum bssgp_iei_type {
|
||||
BSSGP_IE_SERVICE_UTRAN_CCO = 0x3d,
|
||||
};
|
||||
|
||||
/* Section 11.3.8 / Table 11.10: Cause coding */
|
||||
/*! \brief Cause coding (Section 11.3.8 / Table 11.10) */
|
||||
enum gprs_bssgp_cause {
|
||||
BSSGP_CAUSE_PROC_OVERLOAD = 0x00,
|
||||
BSSGP_CAUSE_EQUIP_FAIL = 0x01,
|
||||
@@ -159,9 +161,8 @@ int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg);
|
||||
struct bssgp_bvc_ctx {
|
||||
struct llist_head list;
|
||||
|
||||
/* parsed RA ID and Cell ID of the remote BTS */
|
||||
struct gprs_ra_id ra_id;
|
||||
uint16_t cell_id;
|
||||
struct gprs_ra_id ra_id; /*!< parsed RA ID of the remote BTS */
|
||||
uint16_t cell_id; /*!< Cell ID of the remote BTS */
|
||||
|
||||
/* NSEI and BVCI of underlying Gb link. Together they
|
||||
* uniquely identify a link to a BTS (5.4.4) */
|
||||
@@ -182,7 +183,19 @@ struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t
|
||||
/* Find a BTS context based on BVCI+NSEI tuple */
|
||||
struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei);
|
||||
|
||||
#include <osmocore/tlv.h>
|
||||
#define BVC_F_BLOCKED 0x0001
|
||||
|
||||
enum bssgp_ctr {
|
||||
BSSGP_CTR_PKTS_IN,
|
||||
BSSGP_CTR_PKTS_OUT,
|
||||
BSSGP_CTR_BYTES_IN,
|
||||
BSSGP_CTR_BYTES_OUT,
|
||||
BSSGP_CTR_BLOCKED,
|
||||
BSSGP_CTR_DISCARDED,
|
||||
};
|
||||
|
||||
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
|
||||
/* BSSGP-UL-UNITDATA.ind */
|
||||
int gprs_bssgp_rcvmsg(struct msgb *msg);
|
||||
@@ -192,6 +205,8 @@ struct sgsn_mm_ctx;
|
||||
int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx);
|
||||
|
||||
uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf);
|
||||
int bssgp_create_cell_id(uint8_t *buf, const struct gprs_ra_id *raid,
|
||||
uint16_t cid);
|
||||
|
||||
/* Wrapper around TLV parser to parse BSSGP IEs */
|
||||
static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len)
|
||||
@@ -199,27 +214,30 @@ static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len)
|
||||
return tlv_parse(tp, &tvlv_att_def, buf, len, 0, 0);
|
||||
}
|
||||
|
||||
/*! \brief BSSGP Paging mode */
|
||||
enum bssgp_paging_mode {
|
||||
BSSGP_PAGING_PS,
|
||||
BSSGP_PAGING_CS,
|
||||
};
|
||||
|
||||
/*! \brief BSSGP Paging scope */
|
||||
enum bssgp_paging_scope {
|
||||
BSSGP_PAGING_BSS_AREA, /* all cells in BSS */
|
||||
BSSGP_PAGING_LOCATION_AREA, /* all cells in LA */
|
||||
BSSGP_PAGING_ROUTEING_AREA, /* all cells in RA */
|
||||
BSSGP_PAGING_BVCI, /* one cell */
|
||||
BSSGP_PAGING_BSS_AREA, /*!< all cells in BSS */
|
||||
BSSGP_PAGING_LOCATION_AREA, /*!< all cells in LA */
|
||||
BSSGP_PAGING_ROUTEING_AREA, /*!< all cells in RA */
|
||||
BSSGP_PAGING_BVCI, /*!< one cell */
|
||||
};
|
||||
|
||||
/*! \brief BSSGP paging information */
|
||||
struct bssgp_paging_info {
|
||||
enum bssgp_paging_mode mode;
|
||||
enum bssgp_paging_scope scope;
|
||||
struct gprs_ra_id raid;
|
||||
uint16_t bvci;
|
||||
const char *imsi;
|
||||
uint32_t *ptmsi;
|
||||
uint16_t drx_params;
|
||||
uint8_t qos[3];
|
||||
enum bssgp_paging_mode mode; /*!< CS or PS paging */
|
||||
enum bssgp_paging_scope scope; /*!< bssgp_paging_scope */
|
||||
struct gprs_ra_id raid; /*!< RA Identifier */
|
||||
uint16_t bvci; /*!< BVCI */
|
||||
char *imsi; /*!< IMSI, if any */
|
||||
uint32_t *ptmsi; /*!< P-TMSI, if any */
|
||||
uint16_t drx_params; /*!< DRX parameters */
|
||||
uint8_t qos[3]; /*!< QoS parameters */
|
||||
};
|
||||
|
||||
/* Send a single GMM-PAGING.req to a given NSEI/NS-BVCI */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _GPRS_GMM_H
|
||||
#define _GPRS_GMM_H
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
|
||||
int gsm48_tx_gsm_deact_pdp_req(struct sgsn_pdp_ctx *pdp, uint8_t sm_cause);
|
||||
|
||||
@@ -27,6 +27,23 @@ enum gprs_llc_u_cmd {
|
||||
GPRS_LLC_U_NULL_CMD = 0x00,
|
||||
};
|
||||
|
||||
/* Section 6.4.1.6 / Table 6 */
|
||||
enum gprs_llc_xid_type {
|
||||
GPRS_LLC_XID_T_VERSION = 0,
|
||||
GPRS_LLC_XID_T_IOV_UI = 1,
|
||||
GPRS_LLC_XID_T_IOV_I = 2,
|
||||
GPRS_LLC_XID_T_T200 = 3,
|
||||
GPRS_LLC_XID_T_N200 = 4,
|
||||
GPRS_LLC_XID_T_N201_U = 5,
|
||||
GPRS_LLC_XID_T_N201_I = 6,
|
||||
GPRS_LLC_XID_T_mD = 7,
|
||||
GPRS_LLC_XID_T_mU = 8,
|
||||
GPRS_LLC_XID_T_kD = 9,
|
||||
GPRS_LLC_XID_T_kU = 10,
|
||||
GPRS_LLC_XID_T_L3_PAR = 11,
|
||||
GPRS_LLC_XID_T_RESET = 12,
|
||||
};
|
||||
|
||||
/* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */
|
||||
/* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */
|
||||
enum gprs_llc_primitive {
|
||||
@@ -99,8 +116,8 @@ struct gprs_llc_lle {
|
||||
|
||||
enum gprs_llc_lle_state state;
|
||||
|
||||
struct timer_list t200;
|
||||
struct timer_list t201; /* wait for acknowledgement */
|
||||
struct osmo_timer_list t200;
|
||||
struct osmo_timer_list t201; /* wait for acknowledgement */
|
||||
|
||||
uint16_t v_sent;
|
||||
uint16_t v_ack;
|
||||
@@ -151,6 +168,9 @@ int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv);
|
||||
int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command,
|
||||
void *mmctx);
|
||||
|
||||
/* Chapter 7.2.1.2 LLGMM-RESET.req */
|
||||
int gprs_llgmm_reset(struct gprs_llc_llme *llme);
|
||||
|
||||
/* 04.64 Chapter 7.2.1.1 LLGMM-ASSIGN */
|
||||
int gprs_llgmm_assign(struct gprs_llc_llme *llme,
|
||||
uint32_t old_tlli, uint32_t new_tlli,
|
||||
@@ -159,4 +179,20 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
|
||||
int gprs_llc_init(const char *cipher_plugin_path);
|
||||
int gprs_llc_vty_init(void);
|
||||
|
||||
/**
|
||||
* \short Check if N(U) should be considered a retransmit
|
||||
*
|
||||
* Implements the range check as of GSM 04.64 8.4.2
|
||||
* Receipt of unacknowledged information.
|
||||
*
|
||||
* @returns Returns 1 if (V(UR)-32) <= N(U) < V(UR)
|
||||
* @param nu N(U) unconfirmed sequence number of the UI frame
|
||||
* @param vur V(UR) unconfirmend received state variable
|
||||
*/
|
||||
static inline int gprs_llc_is_retransmit(uint16_t nu, uint16_t vur)
|
||||
{
|
||||
int delta = (vur - nu) & 0x1ff;
|
||||
return 0 < delta && delta < 32;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,12 +7,19 @@
|
||||
* 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05)
|
||||
* 3GPP TS 48.016 version 6.5.0 Release 6 / ETSI TS 148 016 V6.5.0 (2005-11) */
|
||||
|
||||
/*! \addtogroup libgb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \file gprs_ns.h */
|
||||
|
||||
/*! \brief Common header of GPRS NS */
|
||||
struct gprs_ns_hdr {
|
||||
uint8_t pdu_type;
|
||||
uint8_t data[0];
|
||||
uint8_t pdu_type; /*!< NS PDU type */
|
||||
uint8_t data[0]; /*!< variable-length payload */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* TS 08.16, Section 10.3.7, Table 14 */
|
||||
/*! \brief NS PDU Type (TS 08.16, Section 10.3.7, Table 14) */
|
||||
enum ns_pdu_type {
|
||||
NS_PDUT_UNITDATA = 0x00,
|
||||
NS_PDUT_RESET = 0x02,
|
||||
@@ -35,7 +42,7 @@ enum ns_pdu_type {
|
||||
SNS_PDUT_SIZE_ACK = 0x13,
|
||||
};
|
||||
|
||||
/* TS 08.16, Section 10.3, Table 12 */
|
||||
/*! \brief NS Control IE (TS 08.16, Section 10.3, Table 12) */
|
||||
enum ns_ctrl_ie {
|
||||
NS_IE_CAUSE = 0x00,
|
||||
NS_IE_VCI = 0x01,
|
||||
@@ -52,7 +59,7 @@ enum ns_ctrl_ie {
|
||||
NS_IE_IP_ADDR = 0x0b,
|
||||
};
|
||||
|
||||
/* TS 08.16, Section 10.3.2, Table 13 */
|
||||
/*! \brief NS Cause (TS 08.16, Section 10.3.2, Table 13) */
|
||||
enum ns_cause {
|
||||
NS_CAUSE_TRANSIT_FAIL = 0x00,
|
||||
NS_CAUSE_OM_INTERVENTION = 0x01,
|
||||
@@ -77,10 +84,10 @@ enum ns_cause {
|
||||
|
||||
/* Our Implementation */
|
||||
#include <netinet/in.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
#define NS_TIMERS_COUNT 7
|
||||
#define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries)"
|
||||
@@ -90,6 +97,8 @@ enum ns_cause {
|
||||
"Reset Timer (Tns-reset) timeout\n" \
|
||||
"Reset Timer (Tns-reset) number of retries\n" \
|
||||
"Test Timer (Tns-test) timeout\n" \
|
||||
"Alive Timer (Tns-alive) timeout\n" \
|
||||
"Alive Timer (Tns-alive) number of retries\n"
|
||||
|
||||
enum ns_timeout {
|
||||
NS_TOUT_TNS_BLOCK,
|
||||
@@ -104,42 +113,46 @@ enum ns_timeout {
|
||||
#define NSE_S_BLOCKED 0x0001
|
||||
#define NSE_S_ALIVE 0x0002
|
||||
|
||||
/*! \brief Osmocom NS link layer types */
|
||||
enum gprs_ns_ll {
|
||||
GPRS_NS_LL_UDP,
|
||||
GPRS_NS_LL_E1,
|
||||
GPRS_NS_LL_FR_GRE,
|
||||
GPRS_NS_LL_UDP, /*!< NS/UDP/IP */
|
||||
GPRS_NS_LL_E1, /*!< NS/E1 */
|
||||
GPRS_NS_LL_FR_GRE, /*!< NS/FR/GRE/IP */
|
||||
};
|
||||
|
||||
/*! \brief Osmoco NS events */
|
||||
enum gprs_ns_evt {
|
||||
GPRS_NS_EVT_UNIT_DATA,
|
||||
};
|
||||
|
||||
struct gprs_nsvc;
|
||||
/*! \brief Osmocom GPRS callback function type */
|
||||
typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
|
||||
struct msgb *msg, uint16_t bvci);
|
||||
|
||||
/* An instance of the NS protocol stack */
|
||||
/*! \brief An instance of the NS protocol stack */
|
||||
struct gprs_ns_inst {
|
||||
/* callback to the user for incoming UNIT DATA IND */
|
||||
/*! \brief callback to the user for incoming UNIT DATA IND */
|
||||
gprs_ns_cb_t *cb;
|
||||
|
||||
/* linked lists of all NSVC in this instance */
|
||||
/*! \brief linked lists of all NSVC in this instance */
|
||||
struct llist_head gprs_nsvcs;
|
||||
|
||||
/* a NSVC object that's needed to deal with packets for unknown NSVC */
|
||||
/*! \brief a NSVC object that's needed to deal with packets for
|
||||
* unknown NSVC */
|
||||
struct gprs_nsvc *unknown_nsvc;
|
||||
|
||||
uint16_t timeout[NS_TIMERS_COUNT];
|
||||
|
||||
/* NS-over-IP specific bits */
|
||||
/*! \brief NS-over-IP specific bits */
|
||||
struct {
|
||||
struct bsc_fd fd;
|
||||
struct osmo_fd fd;
|
||||
uint32_t local_ip;
|
||||
uint16_t local_port;
|
||||
} nsip;
|
||||
/* NS-over-FR-over-GRE-over-IP specific bits */
|
||||
/*! \brief NS-over-FR-over-GRE-over-IP specific bits */
|
||||
struct {
|
||||
struct bsc_fd fd;
|
||||
struct osmo_fd fd;
|
||||
uint32_t local_ip;
|
||||
int enabled:1;
|
||||
} frgre;
|
||||
@@ -153,17 +166,20 @@ enum nsvc_timer_mode {
|
||||
_NSVC_TIMER_NR,
|
||||
};
|
||||
|
||||
/*! \brief Structure representing a single NS-VC */
|
||||
struct gprs_nsvc {
|
||||
/*! \brief list of NS-VCs within NS Instance */
|
||||
struct llist_head list;
|
||||
/*! \brief pointer to NS Instance */
|
||||
struct gprs_ns_inst *nsi;
|
||||
|
||||
uint16_t nsei; /* end-to-end significance */
|
||||
uint16_t nsvci; /* uniquely identifies NS-VC at SGSN */
|
||||
uint16_t nsei; /*! \brief end-to-end significance */
|
||||
uint16_t nsvci; /*! \brief uniquely identifies NS-VC at SGSN */
|
||||
|
||||
uint32_t state;
|
||||
uint32_t remote_state;
|
||||
|
||||
struct timer_list timer;
|
||||
struct osmo_timer_list timer;
|
||||
enum nsvc_timer_mode timer_mode;
|
||||
int alive_retries;
|
||||
|
||||
@@ -172,7 +188,7 @@ struct gprs_nsvc {
|
||||
|
||||
struct rate_ctr_group *ctrg;
|
||||
|
||||
/* which link-layer are we based on? */
|
||||
/*! \brief which link-layer are we based on? */
|
||||
enum gprs_ns_ll ll;
|
||||
|
||||
union {
|
||||
@@ -229,4 +245,6 @@ static inline struct msgb *gprs_ns_msgb_alloc(void)
|
||||
return msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM, "GPRS/NS");
|
||||
}
|
||||
|
||||
/*! }@ */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
#include <stdint.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <osmocore/gsm48.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
#include <osmocom/gsm/gsm48.h>
|
||||
|
||||
#include <osmocom/crypt/gprs_cipher.h>
|
||||
|
||||
@@ -78,7 +80,7 @@ struct sgsn_mm_ctx {
|
||||
/* CKSN */
|
||||
enum gprs_ciph_algo ciph_algo;
|
||||
struct {
|
||||
uint8_t buf[14]; /* 10.5.5.12a */
|
||||
uint8_t buf[52]; /* 10.5.5.12a */
|
||||
uint8_t len;
|
||||
} ms_radio_access_capa;
|
||||
struct {
|
||||
@@ -102,7 +104,7 @@ struct sgsn_mm_ctx {
|
||||
uint16_t nsei;
|
||||
uint16_t bvci;
|
||||
struct rate_ctr_group *ctrg;
|
||||
struct timer_list timer;
|
||||
struct osmo_timer_list timer;
|
||||
unsigned int T; /* Txxxx number */
|
||||
unsigned int num_T_exp; /* number of consecutive T expirations */
|
||||
|
||||
@@ -168,7 +170,7 @@ struct sgsn_pdp_ctx {
|
||||
//uint32_t charging_id;
|
||||
int reordering_reqd;
|
||||
|
||||
struct timer_list timer;
|
||||
struct osmo_timer_list timer;
|
||||
unsigned int T; /* Txxxx number */
|
||||
unsigned int num_T_exp; /* number of consecutive T expirations */
|
||||
};
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef _GSM_04_08_H
|
||||
#define _GSM_04_08_H
|
||||
|
||||
#include <openbsc/meas_rep.h>
|
||||
#include <osmocom/gsm/gsm48.h>
|
||||
#include <osmocom/gsm/gsm_utils.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
||||
|
||||
#include <osmocore/protocol/gsm_04_08.h>
|
||||
#include <osmocore/gsm48.h>
|
||||
#include <openbsc/meas_rep.h>
|
||||
|
||||
struct msgb;
|
||||
struct gsm_bts;
|
||||
@@ -28,37 +29,38 @@ void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t caus
|
||||
void gsm0408_clear_all_trans(struct gsm_network *net, int protocol);
|
||||
int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg);
|
||||
|
||||
int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id);
|
||||
int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id);
|
||||
int gsm0408_new_conn(struct gsm_subscriber_connection *conn);
|
||||
enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, u_int8_t ra);
|
||||
enum gsm_chreq_reason_t get_reason_by_chreq(u_int8_t ra, int neci);
|
||||
enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra);
|
||||
/* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */
|
||||
int get_reason_by_chreq(uint8_t ra, int neci);
|
||||
void gsm_net_update_ctype(struct gsm_network *net);
|
||||
|
||||
int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn);
|
||||
int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, u_int8_t *rand, int key_seq);
|
||||
int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq);
|
||||
int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn);
|
||||
int gsm48_send_rr_release(struct gsm_lchan *lchan);
|
||||
int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv);
|
||||
int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, u_int8_t apdu_id,
|
||||
u_int8_t apdu_len, const u_int8_t *apdu);
|
||||
int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, u_int8_t power_class);
|
||||
int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id,
|
||||
uint8_t apdu_len, const uint8_t *apdu);
|
||||
int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class);
|
||||
int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan,
|
||||
u_int8_t power_command, u_int8_t ho_ref);
|
||||
uint8_t power_command, uint8_t ho_ref);
|
||||
|
||||
int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg);
|
||||
|
||||
/* convert a ASCII phone number to call-control BCD */
|
||||
int encode_bcd_number(u_int8_t *bcd_lv, u_int8_t max_len,
|
||||
int encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len,
|
||||
int h_len, const char *input);
|
||||
int decode_bcd_number(char *output, int output_len, const u_int8_t *bcd_lv,
|
||||
int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv,
|
||||
int h_len);
|
||||
|
||||
int send_siemens_mrpci(struct gsm_lchan *lchan, u_int8_t *classmark2_lv);
|
||||
int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv);
|
||||
int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type);
|
||||
int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, u_int8_t *mi_type);
|
||||
int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type);
|
||||
int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr);
|
||||
|
||||
int gsm48_lchan_modify(struct gsm_lchan *lchan, u_int8_t lchan_mode);
|
||||
int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode);
|
||||
int gsm48_rx_rr_modif_ack(struct msgb *msg);
|
||||
int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _GSM48_GPRS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <osmocore/protocol/gsm_04_08.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
||||
|
||||
/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
|
||||
#define GSM48_MT_GMM_ATTACH_REQ 0x01
|
||||
@@ -378,6 +378,4 @@ struct gsm48_qos {
|
||||
};
|
||||
|
||||
|
||||
int gprs_tlli_type(uint32_t tlli);
|
||||
|
||||
#endif /* _GSM48_GPRS_H */
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#ifndef _GSM_04_11_H
|
||||
#define _GSM_04_11_H
|
||||
|
||||
#include <osmocore/protocol/gsm_04_11.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_11.h>
|
||||
|
||||
#define UM_SAPI_SMS 3 /* See GSM 04.05/04.06 */
|
||||
|
||||
/* SMS deliver PDU */
|
||||
struct sms_deliver {
|
||||
u_int8_t mti:2; /* message type indicator */
|
||||
u_int8_t mms:1; /* more messages to send */
|
||||
u_int8_t rp:1; /* reply path */
|
||||
u_int8_t udhi:1; /* user data header indicator */
|
||||
u_int8_t sri:1; /* status report indication */
|
||||
u_int8_t *orig_addr; /* originating address */
|
||||
u_int8_t pid; /* protocol identifier */
|
||||
u_int8_t dcs; /* data coding scheme */
|
||||
uint8_t mti:2; /* message type indicator */
|
||||
uint8_t mms:1; /* more messages to send */
|
||||
uint8_t rp:1; /* reply path */
|
||||
uint8_t udhi:1; /* user data header indicator */
|
||||
uint8_t sri:1; /* status report indication */
|
||||
uint8_t *orig_addr; /* originating address */
|
||||
uint8_t pid; /* protocol identifier */
|
||||
uint8_t dcs; /* data coding scheme */
|
||||
/* service centre time stamp */
|
||||
u_int8_t ud_len; /* user data length */
|
||||
u_int8_t *user_data; /* user data */
|
||||
uint8_t ud_len; /* user data length */
|
||||
uint8_t *user_data; /* user data */
|
||||
|
||||
u_int8_t msg_ref; /* message reference */
|
||||
u_int8_t *smsc;
|
||||
uint8_t msg_ref; /* message reference */
|
||||
uint8_t *smsc;
|
||||
};
|
||||
|
||||
struct msgb;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef _GSM_04_80_H
|
||||
#define _GSM_04_80_H
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/protocol/gsm_04_80.h>
|
||||
#include <osmocore/gsm0480.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/gsm/protocol/gsm_04_80.h>
|
||||
#include <osmocom/gsm/gsm0480.h>
|
||||
|
||||
struct gsm_subscriber_connection;
|
||||
|
||||
|
||||
@@ -1,100 +1,18 @@
|
||||
#ifndef _GSM_DATA_H
|
||||
#define _GSM_DATA_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct osmo_msc_data;
|
||||
struct osmo_bsc_sccp_con;
|
||||
struct gsm_sms_queue;
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
enum gsm_phys_chan_config {
|
||||
GSM_PCHAN_NONE,
|
||||
GSM_PCHAN_CCCH,
|
||||
GSM_PCHAN_CCCH_SDCCH4,
|
||||
GSM_PCHAN_TCH_F,
|
||||
GSM_PCHAN_TCH_H,
|
||||
GSM_PCHAN_SDCCH8_SACCH8C,
|
||||
GSM_PCHAN_PDCH, /* GPRS PDCH */
|
||||
GSM_PCHAN_TCH_F_PDCH, /* TCH/F if used, PDCH otherwise */
|
||||
GSM_PCHAN_UNKNOWN,
|
||||
};
|
||||
|
||||
enum gsm_chan_t {
|
||||
GSM_LCHAN_NONE,
|
||||
GSM_LCHAN_SDCCH,
|
||||
GSM_LCHAN_TCH_F,
|
||||
GSM_LCHAN_TCH_H,
|
||||
GSM_LCHAN_UNKNOWN,
|
||||
};
|
||||
|
||||
/* RRLP mode of operation */
|
||||
enum rrlp_mode {
|
||||
RRLP_MODE_NONE,
|
||||
RRLP_MODE_MS_BASED,
|
||||
RRLP_MODE_MS_PREF,
|
||||
RRLP_MODE_ASS_PREF,
|
||||
};
|
||||
|
||||
/* Channel Request reason */
|
||||
enum gsm_chreq_reason_t {
|
||||
GSM_CHREQ_REASON_EMERG,
|
||||
GSM_CHREQ_REASON_PAG,
|
||||
GSM_CHREQ_REASON_CALL,
|
||||
GSM_CHREQ_REASON_LOCATION_UPD,
|
||||
GSM_CHREQ_REASON_OTHER,
|
||||
};
|
||||
|
||||
#include <osmocore/timer.h>
|
||||
#include <openbsc/system_information.h>
|
||||
#include <openbsc/rest_octets.h>
|
||||
#include <openbsc/mncc.h>
|
||||
|
||||
#include <osmocore/tlv.h>
|
||||
#include <osmocore/bitvec.h>
|
||||
#include <osmocore/statistics.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
#include <osmocore/utils.h>
|
||||
#include <osmocore/rxlev_stat.h>
|
||||
|
||||
#include <osmocore/protocol/gsm_08_58.h>
|
||||
|
||||
|
||||
#define TRX_NR_TS 8
|
||||
#define TS_MAX_LCHAN 8
|
||||
|
||||
#define HARDCODED_ARFCN 123
|
||||
#define HARDCODED_TSC 7
|
||||
#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
|
||||
|
||||
/* for multi-drop config */
|
||||
#define HARDCODED_BTS0_TS 1
|
||||
#define HARDCODED_BTS1_TS 6
|
||||
#define HARDCODED_BTS2_TS 11
|
||||
|
||||
/* reserved according to GSM 03.03 § 2.4 */
|
||||
#define GSM_RESERVED_TMSI 0xFFFFFFFF
|
||||
|
||||
enum gsm_hooks {
|
||||
GSM_HOOK_NM_SWLOAD,
|
||||
GSM_HOOK_RR_PAGING,
|
||||
GSM_HOOK_RR_SECURITY,
|
||||
};
|
||||
|
||||
enum gsm_paging_event {
|
||||
GSM_PAGING_SUCCEEDED,
|
||||
GSM_PAGING_EXPIRED,
|
||||
GSM_PAGING_OOM,
|
||||
GSM_PAGING_BUSY,
|
||||
};
|
||||
|
||||
enum bts_gprs_mode {
|
||||
BTS_GPRS_NONE = 0,
|
||||
BTS_GPRS_GPRS = 1,
|
||||
BTS_GPRS_EGPRS = 2,
|
||||
};
|
||||
#include <osmocom/abis/e1_input.h>
|
||||
|
||||
#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
|
||||
|
||||
struct mncc_sock_state;
|
||||
|
||||
/* the data structure stored in msgb->cb for openbsc apps */
|
||||
struct openbsc_msgb_cb {
|
||||
unsigned char *bssgph;
|
||||
@@ -104,11 +22,11 @@ struct openbsc_msgb_cb {
|
||||
unsigned char *bssgp_cell_id;
|
||||
|
||||
/* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
|
||||
u_int16_t nsei;
|
||||
u_int16_t bvci;
|
||||
uint16_t nsei;
|
||||
uint16_t bvci;
|
||||
|
||||
/* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
|
||||
u_int32_t tlli;
|
||||
uint32_t tlli;
|
||||
} __attribute__((packed));
|
||||
#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
|
||||
#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
|
||||
@@ -144,32 +62,18 @@ enum gsm_auth_algo {
|
||||
struct gsm_auth_info {
|
||||
enum gsm_auth_algo auth_algo;
|
||||
unsigned int a3a8_ki_len;
|
||||
u_int8_t a3a8_ki[16];
|
||||
uint8_t a3a8_ki[16];
|
||||
};
|
||||
|
||||
struct gsm_auth_tuple {
|
||||
int use_count;
|
||||
int key_seq;
|
||||
u_int8_t rand[16];
|
||||
u_int8_t sres[4];
|
||||
u_int8_t kc[8];
|
||||
uint8_t rand[16];
|
||||
uint8_t sres[4];
|
||||
uint8_t kc[8];
|
||||
};
|
||||
#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
|
||||
|
||||
|
||||
struct gsm_lchan;
|
||||
struct gsm_subscriber;
|
||||
struct gsm_mncc;
|
||||
struct rtp_socket;
|
||||
struct bsc_api;
|
||||
|
||||
/* Network Management State */
|
||||
struct gsm_nm_state {
|
||||
u_int8_t operational;
|
||||
u_int8_t administrative;
|
||||
u_int8_t availability;
|
||||
};
|
||||
|
||||
/*
|
||||
* LOCATION UPDATING REQUEST state
|
||||
*
|
||||
@@ -178,7 +82,7 @@ struct gsm_nm_state {
|
||||
* - Accept/Reject according to global policy
|
||||
*/
|
||||
struct gsm_loc_updating_operation {
|
||||
struct timer_list updating_timer;
|
||||
struct osmo_timer_list updating_timer;
|
||||
unsigned int waiting_for_imsi : 1;
|
||||
unsigned int waiting_for_imei : 1;
|
||||
unsigned int key_seq : 4;
|
||||
@@ -198,7 +102,7 @@ struct gsm_security_operation {
|
||||
* a couple of seconds to work around MSC issues.
|
||||
*/
|
||||
struct gsm_anchor_operation {
|
||||
struct timer_list timeout;
|
||||
struct osmo_timer_list timeout;
|
||||
};
|
||||
|
||||
/* Maximum number of neighbor cells whose average we track */
|
||||
@@ -208,32 +112,11 @@ struct gsm_anchor_operation {
|
||||
|
||||
/* processed neighbor measurements for one cell */
|
||||
struct neigh_meas_proc {
|
||||
u_int16_t arfcn;
|
||||
u_int8_t bsic;
|
||||
u_int8_t rxlev[MAX_WIN_NEIGH_AVG];
|
||||
uint16_t arfcn;
|
||||
uint8_t bsic;
|
||||
uint8_t rxlev[MAX_WIN_NEIGH_AVG];
|
||||
unsigned int rxlev_cnt;
|
||||
u_int8_t last_seen_nr;
|
||||
};
|
||||
|
||||
#define MAX_A5_KEY_LEN (128/8)
|
||||
#define A38_XOR_MIN_KEY_LEN 12
|
||||
#define A38_XOR_MAX_KEY_LEN 16
|
||||
#define A38_COMP128_KEY_LEN 16
|
||||
#define RSL_ENC_ALG_A5(x) (x+1)
|
||||
|
||||
/* is the data link established? who established it? */
|
||||
#define LCHAN_SAPI_UNUSED 0
|
||||
#define LCHAN_SAPI_MS 1
|
||||
#define LCHAN_SAPI_NET 2
|
||||
|
||||
/* state of a logical channel */
|
||||
enum gsm_lchan_state {
|
||||
LCHAN_S_NONE, /* channel is not active */
|
||||
LCHAN_S_ACT_REQ, /* channel activatin requested */
|
||||
LCHAN_S_ACTIVE, /* channel is active and operational */
|
||||
LCHAN_S_REL_REQ, /* channel release has been requested */
|
||||
LCHAN_S_REL_ERR, /* channel is in an error state */
|
||||
LCHAN_S_INACTIVE, /* channel is set inactive */
|
||||
uint8_t last_seen_nr;
|
||||
};
|
||||
|
||||
/* the per subscriber data for lchan */
|
||||
@@ -264,427 +147,65 @@ struct gsm_subscriber_connection {
|
||||
struct gsm_bts *bts;
|
||||
|
||||
/* for assignment handling */
|
||||
struct timer_list T10;
|
||||
struct osmo_timer_list T10;
|
||||
struct gsm_lchan *secondary_lchan;
|
||||
|
||||
};
|
||||
|
||||
struct gsm_lchan {
|
||||
/* The TS that we're part of */
|
||||
struct gsm_bts_trx_ts *ts;
|
||||
/* The logical subslot number in the TS */
|
||||
u_int8_t nr;
|
||||
/* The logical channel type */
|
||||
enum gsm_chan_t type;
|
||||
/* RSL channel mode */
|
||||
enum rsl_cmod_spd rsl_cmode;
|
||||
/* If TCH, traffic channel mode */
|
||||
enum gsm48_chan_mode tch_mode;
|
||||
/* State */
|
||||
enum gsm_lchan_state state;
|
||||
/* Power levels for MS and BTS */
|
||||
u_int8_t bs_power;
|
||||
u_int8_t ms_power;
|
||||
/* Encryption information */
|
||||
struct {
|
||||
u_int8_t alg_id;
|
||||
u_int8_t key_len;
|
||||
u_int8_t key[MAX_A5_KEY_LEN];
|
||||
} encr;
|
||||
|
||||
struct timer_list T3101;
|
||||
struct timer_list T3111;
|
||||
struct timer_list error_timer;
|
||||
#define ROLE_BSC
|
||||
#include "gsm_data_shared.h"
|
||||
|
||||
/* AMR bits */
|
||||
struct gsm48_multi_rate_conf mr_conf;
|
||||
|
||||
/* Established data link layer services */
|
||||
u_int8_t sapis[8];
|
||||
int sach_deact;
|
||||
int release_reason;
|
||||
|
||||
/* GSM Random Access data */
|
||||
struct gsm48_req_ref *rqd_ref;
|
||||
uint8_t rqd_ta;
|
||||
|
||||
/* cache of last measurement reports on this lchan */
|
||||
struct gsm_meas_rep meas_rep[6];
|
||||
int meas_rep_idx;
|
||||
|
||||
/* table of neighbor cell measurements */
|
||||
struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
|
||||
|
||||
struct {
|
||||
u_int32_t bound_ip;
|
||||
u_int32_t connect_ip;
|
||||
u_int16_t bound_port;
|
||||
u_int16_t connect_port;
|
||||
u_int16_t conn_id;
|
||||
u_int8_t rtp_payload;
|
||||
u_int8_t rtp_payload2;
|
||||
u_int8_t speech_mode;
|
||||
struct rtp_socket *rtp_socket;
|
||||
} abis_ip;
|
||||
|
||||
struct gsm_subscriber_connection *conn;
|
||||
};
|
||||
|
||||
struct gsm_e1_subslot {
|
||||
/* Number of E1 link */
|
||||
u_int8_t e1_nr;
|
||||
/* Number of E1 TS inside E1 link */
|
||||
u_int8_t e1_ts;
|
||||
/* Sub-slot within the E1 TS, 0xff if full TS */
|
||||
u_int8_t e1_ts_ss;
|
||||
};
|
||||
|
||||
#define TS_F_PDCH_MODE 0x1000
|
||||
/* One Timeslot in a TRX */
|
||||
struct gsm_bts_trx_ts {
|
||||
struct gsm_bts_trx *trx;
|
||||
/* number of this timeslot at the TRX */
|
||||
u_int8_t nr;
|
||||
|
||||
enum gsm_phys_chan_config pchan;
|
||||
|
||||
unsigned int flags;
|
||||
struct gsm_nm_state nm_state;
|
||||
struct tlv_parsed nm_attr;
|
||||
u_int8_t nm_chan_comb;
|
||||
|
||||
struct {
|
||||
/* Parameters below are configured by VTY */
|
||||
int enabled;
|
||||
u_int8_t maio;
|
||||
u_int8_t hsn;
|
||||
struct bitvec arfcns;
|
||||
u_int8_t arfcns_data[1024/8];
|
||||
/* This is the pre-computed MA for channel assignments */
|
||||
struct bitvec ma;
|
||||
u_int8_t ma_len; /* part of ma_data that is used */
|
||||
u_int8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
|
||||
} hopping;
|
||||
|
||||
/* To which E1 subslot are we connected */
|
||||
struct gsm_e1_subslot e1_link;
|
||||
|
||||
struct gsm_lchan lchan[TS_MAX_LCHAN];
|
||||
};
|
||||
|
||||
/* One TRX in a BTS */
|
||||
struct gsm_bts_trx {
|
||||
/* list header in bts->trx_list */
|
||||
struct llist_head list;
|
||||
|
||||
struct gsm_bts *bts;
|
||||
/* number of this TRX in the BTS */
|
||||
u_int8_t nr;
|
||||
/* human readable name / description */
|
||||
char *description;
|
||||
/* how do we talk RSL with this TRX? */
|
||||
struct gsm_e1_subslot rsl_e1_link;
|
||||
u_int8_t rsl_tei;
|
||||
struct e1inp_sign_link *rsl_link;
|
||||
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
|
||||
struct e1inp_sign_link *oml_link;
|
||||
|
||||
struct gsm_nm_state nm_state;
|
||||
struct tlv_parsed nm_attr;
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
} bb_transc;
|
||||
|
||||
u_int16_t arfcn;
|
||||
int nominal_power; /* in dBm */
|
||||
unsigned int max_power_red; /* in actual dB */
|
||||
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
} bbsig;
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
} pa;
|
||||
} bs11;
|
||||
struct {
|
||||
unsigned int test_state;
|
||||
u_int8_t test_nr;
|
||||
struct rxlev_stats rxlev_stat;
|
||||
} ipaccess;
|
||||
};
|
||||
struct gsm_bts_trx_ts ts[TRX_NR_TS];
|
||||
};
|
||||
|
||||
#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
|
||||
|
||||
enum gsm_bts_type {
|
||||
GSM_BTS_TYPE_UNKNOWN,
|
||||
GSM_BTS_TYPE_BS11,
|
||||
GSM_BTS_TYPE_NANOBTS,
|
||||
GSM_BTS_TYPE_RBS2000,
|
||||
GSM_BTS_TYPE_HSL_FEMTO,
|
||||
};
|
||||
|
||||
struct vty;
|
||||
|
||||
struct gsm_bts_model {
|
||||
struct llist_head list;
|
||||
|
||||
enum gsm_bts_type type;
|
||||
const char *name;
|
||||
|
||||
int (*oml_rcvmsg)(struct msgb *msg);
|
||||
|
||||
void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
|
||||
void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
|
||||
void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
|
||||
|
||||
struct tlv_definition nm_att_tlvdef;
|
||||
|
||||
struct bitvec features;
|
||||
uint8_t _features_data[128/8];
|
||||
};
|
||||
|
||||
enum gsm_bts_features {
|
||||
BTS_FEAT_HSCSD,
|
||||
BTS_FEAT_GPRS,
|
||||
BTS_FEAT_EGPRS,
|
||||
BTS_FEAT_ECSD,
|
||||
BTS_FEAT_HOPPING,
|
||||
};
|
||||
|
||||
/*
|
||||
* This keeps track of the paging status of one BTS. It
|
||||
* includes a number of pending requests, a back pointer
|
||||
* to the gsm_bts, a timer and some more state.
|
||||
*/
|
||||
struct gsm_bts_paging_state {
|
||||
/* pending requests */
|
||||
struct llist_head pending_requests;
|
||||
struct gsm_bts *bts;
|
||||
|
||||
struct timer_list work_timer;
|
||||
struct timer_list credit_timer;
|
||||
|
||||
/* free chans needed */
|
||||
int free_chans_need;
|
||||
|
||||
/* load */
|
||||
u_int16_t available_slots;
|
||||
};
|
||||
|
||||
struct gsm_envabtse {
|
||||
struct gsm_nm_state nm_state;
|
||||
};
|
||||
|
||||
struct gsm_bts_gprs_nsvc {
|
||||
struct gsm_bts *bts;
|
||||
/* data read via VTY config file, to configure the BTS
|
||||
* via OML from BSC */
|
||||
int id;
|
||||
u_int16_t nsvci;
|
||||
u_int16_t local_port; /* on the BTS */
|
||||
u_int16_t remote_port; /* on the SGSN */
|
||||
u_int32_t remote_ip; /* on the SGSN */
|
||||
|
||||
struct gsm_nm_state nm_state;
|
||||
};
|
||||
|
||||
enum neigh_list_manual_mode {
|
||||
NL_MODE_AUTOMATIC = 0,
|
||||
NL_MODE_MANUAL = 1,
|
||||
NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */
|
||||
};
|
||||
|
||||
/* One BTS */
|
||||
struct gsm_bts {
|
||||
/* list header in net->bts_list */
|
||||
struct llist_head list;
|
||||
|
||||
struct gsm_network *network;
|
||||
/* number of ths BTS in network */
|
||||
u_int8_t nr;
|
||||
/* human readable name / description */
|
||||
char *description;
|
||||
/* Cell Identity */
|
||||
u_int16_t cell_identity;
|
||||
/* location area code of this BTS */
|
||||
u_int16_t location_area_code;
|
||||
/* Training Sequence Code */
|
||||
u_int8_t tsc;
|
||||
/* Base Station Identification Code (BSIC) */
|
||||
u_int8_t bsic;
|
||||
/* type of BTS */
|
||||
enum gsm_bts_type type;
|
||||
struct gsm_bts_model *model;
|
||||
enum gsm_band band;
|
||||
/* should the channel allocator allocate channels from high TRX to TRX0,
|
||||
* rather than starting from TRX0 and go upwards? */
|
||||
int chan_alloc_reverse;
|
||||
/* maximum Tx power that the MS is permitted to use in this cell */
|
||||
int ms_max_power;
|
||||
|
||||
/* how do we talk OML with this TRX? */
|
||||
struct gsm_e1_subslot oml_e1_link;
|
||||
u_int8_t oml_tei;
|
||||
struct e1inp_sign_link *oml_link;
|
||||
|
||||
/* Abis network management O&M handle */
|
||||
struct abis_nm_h *nmh;
|
||||
struct gsm_nm_state nm_state;
|
||||
struct tlv_parsed nm_attr;
|
||||
|
||||
/* number of this BTS on given E1 link */
|
||||
u_int8_t bts_nr;
|
||||
|
||||
/* paging state and control */
|
||||
struct gsm_bts_paging_state paging;
|
||||
|
||||
/* CCCH is on C0 */
|
||||
struct gsm_bts_trx *c0;
|
||||
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
} site_mgr;
|
||||
|
||||
enum neigh_list_manual_mode neigh_list_manual_mode;
|
||||
/* parameters from which we build SYSTEM INFORMATION */
|
||||
struct {
|
||||
struct gsm48_rach_control rach_control;
|
||||
u_int8_t ncc_permitted;
|
||||
struct gsm48_cell_sel_par cell_sel_par;
|
||||
struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */
|
||||
struct gsm48_cell_options cell_options;
|
||||
struct gsm48_control_channel_descr chan_desc;
|
||||
struct bitvec neigh_list;
|
||||
struct bitvec cell_alloc;
|
||||
struct bitvec si5_neigh_list;
|
||||
struct {
|
||||
/* bitmask large enough for all possible ARFCN's */
|
||||
u_int8_t neigh_list[1024/8];
|
||||
u_int8_t cell_alloc[1024/8];
|
||||
/* If the user wants a different neighbor list in SI5 than in SI2 */
|
||||
u_int8_t si5_neigh_list[1024/8];
|
||||
} data;
|
||||
} si_common;
|
||||
|
||||
/* do we use static (user-defined) system information messages? (bitmask) */
|
||||
uint32_t si_mode_static;
|
||||
/* bitmask of all SI that are present/valid in si_buf */
|
||||
uint32_t si_valid;
|
||||
/* buffers where we put the pre-computed SI */
|
||||
sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
|
||||
|
||||
/* ip.accesss Unit ID's have Site/BTS/TRX layout */
|
||||
union {
|
||||
struct {
|
||||
u_int16_t site_id;
|
||||
u_int16_t bts_id;
|
||||
u_int32_t flags;
|
||||
} ip_access;
|
||||
struct {
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
} cclk;
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
} rack;
|
||||
struct gsm_envabtse envabtse[4];
|
||||
} bs11;
|
||||
struct {
|
||||
struct {
|
||||
struct llist_head conn_groups;
|
||||
} is;
|
||||
struct {
|
||||
struct llist_head conn_groups;
|
||||
} con;
|
||||
} rbs2000;
|
||||
struct {
|
||||
unsigned long serno;
|
||||
} hsl;
|
||||
};
|
||||
|
||||
/* Not entirely sure how ip.access specific this is */
|
||||
struct {
|
||||
enum bts_gprs_mode mode;
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
u_int16_t nsei;
|
||||
uint8_t timer[7];
|
||||
} nse;
|
||||
struct {
|
||||
struct gsm_nm_state nm_state;
|
||||
u_int16_t bvci;
|
||||
uint8_t timer[11];
|
||||
} cell;
|
||||
struct gsm_bts_gprs_nsvc nsvc[2];
|
||||
u_int8_t rac;
|
||||
} gprs;
|
||||
|
||||
/* RACH NM values */
|
||||
int rach_b_thresh;
|
||||
int rach_ldavg_slots;
|
||||
|
||||
/* transceivers */
|
||||
int num_trx;
|
||||
struct llist_head trx_list;
|
||||
|
||||
/* Abis NM queue */
|
||||
struct llist_head abis_queue;
|
||||
int abis_nm_pend;
|
||||
};
|
||||
|
||||
/* Some statistics of our network */
|
||||
struct gsmnet_stats {
|
||||
struct {
|
||||
struct counter *total;
|
||||
struct counter *no_channel;
|
||||
struct osmo_counter *total;
|
||||
struct osmo_counter *no_channel;
|
||||
} chreq;
|
||||
struct {
|
||||
struct counter *attempted;
|
||||
struct counter *no_channel; /* no channel available */
|
||||
struct counter *timeout; /* T3103 timeout */
|
||||
struct counter *completed; /* HO COMPL received */
|
||||
struct counter *failed; /* HO FAIL received */
|
||||
struct osmo_counter *attempted;
|
||||
struct osmo_counter *no_channel; /* no channel available */
|
||||
struct osmo_counter *timeout; /* T3103 timeout */
|
||||
struct osmo_counter *completed; /* HO COMPL received */
|
||||
struct osmo_counter *failed; /* HO FAIL received */
|
||||
} handover;
|
||||
struct {
|
||||
struct counter *attach;
|
||||
struct counter *normal;
|
||||
struct counter *periodic;
|
||||
struct counter *detach;
|
||||
struct osmo_counter *attach;
|
||||
struct osmo_counter *normal;
|
||||
struct osmo_counter *periodic;
|
||||
struct osmo_counter *detach;
|
||||
} loc_upd_type;
|
||||
struct {
|
||||
struct counter *reject;
|
||||
struct counter *accept;
|
||||
struct osmo_counter *reject;
|
||||
struct osmo_counter *accept;
|
||||
} loc_upd_resp;
|
||||
struct {
|
||||
struct counter *attempted;
|
||||
struct counter *detached;
|
||||
struct counter *completed;
|
||||
struct counter *expired;
|
||||
struct osmo_counter *attempted;
|
||||
struct osmo_counter *detached;
|
||||
struct osmo_counter *completed;
|
||||
struct osmo_counter *expired;
|
||||
} paging;
|
||||
struct {
|
||||
struct counter *submitted; /* MO SMS submissions */
|
||||
struct counter *no_receiver;
|
||||
struct counter *delivered; /* MT SMS deliveries */
|
||||
struct counter *rp_err_mem;
|
||||
struct counter *rp_err_other;
|
||||
struct osmo_counter *submitted; /* MO SMS submissions */
|
||||
struct osmo_counter *no_receiver;
|
||||
struct osmo_counter *delivered; /* MT SMS deliveries */
|
||||
struct osmo_counter *rp_err_mem;
|
||||
struct osmo_counter *rp_err_other;
|
||||
} sms;
|
||||
struct {
|
||||
struct counter *mo_setup;
|
||||
struct counter *mo_connect_ack;
|
||||
struct counter *mt_setup;
|
||||
struct counter *mt_connect;
|
||||
struct osmo_counter *mo_setup;
|
||||
struct osmo_counter *mo_connect_ack;
|
||||
struct osmo_counter *mt_setup;
|
||||
struct osmo_counter *mt_connect;
|
||||
} call;
|
||||
struct {
|
||||
struct counter *rf_fail;
|
||||
struct counter *rll_err;
|
||||
struct osmo_counter *rf_fail;
|
||||
struct osmo_counter *rll_err;
|
||||
} chan;
|
||||
struct {
|
||||
struct counter *oml_fail;
|
||||
struct counter *rsl_fail;
|
||||
struct osmo_counter *oml_fail;
|
||||
struct osmo_counter *rsl_fail;
|
||||
} bts;
|
||||
};
|
||||
|
||||
@@ -699,8 +220,8 @@ enum gsm_auth_policy {
|
||||
|
||||
struct gsm_network {
|
||||
/* global parameters */
|
||||
u_int16_t country_code;
|
||||
u_int16_t network_code;
|
||||
uint16_t country_code;
|
||||
uint16_t network_code;
|
||||
char *name_long;
|
||||
char *name_short;
|
||||
enum gsm_auth_policy auth_policy;
|
||||
@@ -728,6 +249,7 @@ struct gsm_network {
|
||||
struct gsmnet_stats stats;
|
||||
|
||||
/* layer 4 */
|
||||
struct mncc_sock_state *mncc_state;
|
||||
int (*mncc_recv) (struct gsm_network *net, struct msgb *msg);
|
||||
struct llist_head upqueue;
|
||||
struct llist_head trans_list;
|
||||
@@ -765,7 +287,6 @@ struct gsm_network {
|
||||
|
||||
/* MSC data in case we are a true BSC */
|
||||
struct osmo_msc_data *msc_data;
|
||||
int hardcoded_rtp_payload;
|
||||
|
||||
/* subscriber related features */
|
||||
int keep_subscr;
|
||||
@@ -780,50 +301,32 @@ struct gsm_sms {
|
||||
struct gsm_subscriber *receiver;
|
||||
|
||||
unsigned long validity_minutes;
|
||||
u_int8_t reply_path_req;
|
||||
u_int8_t status_rep_req;
|
||||
u_int8_t ud_hdr_ind;
|
||||
u_int8_t protocol_id;
|
||||
u_int8_t data_coding_scheme;
|
||||
u_int8_t msg_ref;
|
||||
uint8_t reply_path_req;
|
||||
uint8_t status_rep_req;
|
||||
uint8_t ud_hdr_ind;
|
||||
uint8_t protocol_id;
|
||||
uint8_t data_coding_scheme;
|
||||
uint8_t msg_ref;
|
||||
char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes
|
||||
* BCD == 20 bytes string */
|
||||
u_int8_t user_data_len;
|
||||
u_int8_t user_data[SMS_TEXT_SIZE];
|
||||
uint8_t user_data_len;
|
||||
uint8_t user_data[SMS_TEXT_SIZE];
|
||||
|
||||
char text[SMS_TEXT_SIZE];
|
||||
};
|
||||
|
||||
|
||||
struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code,
|
||||
struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code,
|
||||
int (*mncc_recv)(struct gsm_network *, struct msgb *));
|
||||
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
|
||||
u_int8_t tsc, u_int8_t bsic);
|
||||
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
|
||||
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
|
||||
|
||||
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
|
||||
|
||||
/* Get reference to a neighbor cell on a given BCCH ARFCN */
|
||||
struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
|
||||
u_int16_t arfcn, u_int8_t bsic);
|
||||
uint16_t arfcn, uint8_t bsic);
|
||||
|
||||
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
|
||||
|
||||
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
|
||||
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
|
||||
const char *gsm_lchant_name(enum gsm_chan_t c);
|
||||
const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
|
||||
char *gsm_trx_name(struct gsm_bts_trx *trx);
|
||||
char *gsm_ts_name(struct gsm_bts_trx_ts *ts);
|
||||
char *gsm_lchan_name(struct gsm_lchan *lchan);
|
||||
const char *gsm_lchans_name(enum gsm_lchan_state s);
|
||||
|
||||
void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
|
||||
u_int8_t e1_ts, u_int8_t e1_ts_ss);
|
||||
enum gsm_bts_type parse_btstype(const char *arg);
|
||||
const char *btstype2str(enum gsm_bts_type type);
|
||||
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
|
||||
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
|
||||
struct gsm_bts *start_bts);
|
||||
|
||||
@@ -853,7 +356,6 @@ static inline int is_siemens_bts(struct gsm_bts *bts)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
|
||||
const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
|
||||
|
||||
@@ -863,17 +365,27 @@ const char *rrlp_mode_name(enum rrlp_mode mode);
|
||||
enum bts_gprs_mode bts_gprs_mode_parse(const char *arg);
|
||||
const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
|
||||
|
||||
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
|
||||
|
||||
int gsm48_ra_id_by_bts(u_int8_t *buf, struct gsm_bts *bts);
|
||||
int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
|
||||
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
|
||||
struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
|
||||
|
||||
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
|
||||
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
|
||||
int gsm_bts_model_register(struct gsm_bts_model *model);
|
||||
|
||||
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan);
|
||||
void subscr_con_free(struct gsm_subscriber_connection *conn);
|
||||
|
||||
#endif
|
||||
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net,
|
||||
enum gsm_bts_type type,
|
||||
uint8_t tsc, uint8_t bsic);
|
||||
void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
|
||||
uint8_t e1_ts, uint8_t e1_ts_ss);
|
||||
|
||||
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
|
||||
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
|
||||
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
|
||||
|
||||
/* generic E1 line operations for all ISDN-based BTS. */
|
||||
extern struct e1inp_line_ops bts_isdn_e1inp_line_ops;
|
||||
|
||||
#endif /* _GSM_DATA_H */
|
||||
|
||||
632
openbsc/include/openbsc/gsm_data_shared.h
Normal file
632
openbsc/include/openbsc/gsm_data_shared.h
Normal file
@@ -0,0 +1,632 @@
|
||||
#ifndef _GSM_DATA_SHAREDH
|
||||
#define _GSM_DATA_SHAREDH
|
||||
|
||||
#include <regex.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/bitvec.h>
|
||||
#include <osmocom/core/statistics.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <osmocom/gsm/gsm_utils.h>
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <osmocom/gsm/rxlev_stat.h>
|
||||
#include <osmocom/gsm/sysinfo.h>
|
||||
|
||||
#include <osmocom/gsm/protocol/gsm_08_58.h>
|
||||
#include <osmocom/gsm/protocol/gsm_12_21.h>
|
||||
|
||||
#include <osmocom/abis/e1_input.h>
|
||||
|
||||
struct osmo_msc_data;
|
||||
struct osmo_bsc_sccp_con;
|
||||
struct gsm_sms_queue;
|
||||
|
||||
/* RRLP mode of operation */
|
||||
enum rrlp_mode {
|
||||
RRLP_MODE_NONE,
|
||||
RRLP_MODE_MS_BASED,
|
||||
RRLP_MODE_MS_PREF,
|
||||
RRLP_MODE_ASS_PREF,
|
||||
};
|
||||
|
||||
/* Channel Request reason */
|
||||
enum gsm_chreq_reason_t {
|
||||
GSM_CHREQ_REASON_EMERG,
|
||||
GSM_CHREQ_REASON_PAG,
|
||||
GSM_CHREQ_REASON_CALL,
|
||||
GSM_CHREQ_REASON_LOCATION_UPD,
|
||||
GSM_CHREQ_REASON_OTHER,
|
||||
};
|
||||
|
||||
#define TRX_NR_TS 8
|
||||
#define TS_MAX_LCHAN 8
|
||||
|
||||
#define HARDCODED_ARFCN 123
|
||||
#define HARDCODED_TSC 7
|
||||
#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
|
||||
|
||||
/* for multi-drop config */
|
||||
#define HARDCODED_BTS0_TS 1
|
||||
#define HARDCODED_BTS1_TS 6
|
||||
#define HARDCODED_BTS2_TS 11
|
||||
|
||||
/* reserved according to GSM 03.03 § 2.4 */
|
||||
#define GSM_RESERVED_TMSI 0xFFFFFFFF
|
||||
|
||||
enum gsm_hooks {
|
||||
GSM_HOOK_NM_SWLOAD,
|
||||
GSM_HOOK_RR_PAGING,
|
||||
GSM_HOOK_RR_SECURITY,
|
||||
};
|
||||
|
||||
enum gsm_paging_event {
|
||||
GSM_PAGING_SUCCEEDED,
|
||||
GSM_PAGING_EXPIRED,
|
||||
GSM_PAGING_OOM,
|
||||
GSM_PAGING_BUSY,
|
||||
};
|
||||
|
||||
enum bts_gprs_mode {
|
||||
BTS_GPRS_NONE = 0,
|
||||
BTS_GPRS_GPRS = 1,
|
||||
BTS_GPRS_EGPRS = 2,
|
||||
};
|
||||
|
||||
struct gsm_lchan;
|
||||
struct gsm_subscriber;
|
||||
struct gsm_mncc;
|
||||
struct osmo_rtp_socket;
|
||||
struct rtp_socket;
|
||||
struct bsc_api;
|
||||
|
||||
/* Network Management State */
|
||||
struct gsm_nm_state {
|
||||
uint8_t operational;
|
||||
uint8_t administrative;
|
||||
uint8_t availability;
|
||||
};
|
||||
|
||||
struct gsm_abis_mo {
|
||||
uint8_t obj_class;
|
||||
struct abis_om_obj_inst obj_inst;
|
||||
const char *name;
|
||||
struct gsm_nm_state nm_state;
|
||||
struct tlv_parsed *nm_attr;
|
||||
struct gsm_bts *bts;
|
||||
};
|
||||
|
||||
#define MAX_A5_KEY_LEN (128/8)
|
||||
#define A38_XOR_MIN_KEY_LEN 12
|
||||
#define A38_XOR_MAX_KEY_LEN 16
|
||||
#define A38_COMP128_KEY_LEN 16
|
||||
#define RSL_ENC_ALG_A5(x) (x+1)
|
||||
|
||||
/* is the data link established? who established it? */
|
||||
#define LCHAN_SAPI_UNUSED 0
|
||||
#define LCHAN_SAPI_MS 1
|
||||
#define LCHAN_SAPI_NET 2
|
||||
|
||||
/* state of a logical channel */
|
||||
enum gsm_lchan_state {
|
||||
LCHAN_S_NONE, /* channel is not active */
|
||||
LCHAN_S_ACT_REQ, /* channel activatin requested */
|
||||
LCHAN_S_ACTIVE, /* channel is active and operational */
|
||||
LCHAN_S_REL_REQ, /* channel release has been requested */
|
||||
LCHAN_S_REL_ERR, /* channel is in an error state */
|
||||
LCHAN_S_INACTIVE, /* channel is set inactive */
|
||||
};
|
||||
|
||||
/* BTS ONLY */
|
||||
#define MAX_NUM_UL_MEAS 104
|
||||
#define LC_UL_M_F_L1_VALID (1 << 0)
|
||||
#define LC_UL_M_F_RES_VALID (1 << 1)
|
||||
|
||||
struct bts_ul_meas {
|
||||
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
|
||||
uint16_t ber10k;
|
||||
/* timing advance offset (in quarter bits) */
|
||||
int16_t ta_offs_qbits;
|
||||
/* C/I ratio in dB */
|
||||
float c_i;
|
||||
/* flags */
|
||||
uint8_t is_sub:1;
|
||||
/* RSSI in dBm * -1 */
|
||||
uint8_t inv_rssi;
|
||||
};
|
||||
|
||||
struct amr_mode {
|
||||
uint8_t mode;
|
||||
uint8_t threshold;
|
||||
uint8_t hysteresis;
|
||||
};
|
||||
struct amr_multirate_conf {
|
||||
uint8_t gsm48_ie[2];
|
||||
struct amr_mode mode[4];
|
||||
uint8_t num_modes;
|
||||
};
|
||||
/* /BTS ONLY */
|
||||
|
||||
struct gsm_lchan {
|
||||
/* The TS that we're part of */
|
||||
struct gsm_bts_trx_ts *ts;
|
||||
/* The logical subslot number in the TS */
|
||||
uint8_t nr;
|
||||
/* The logical channel type */
|
||||
enum gsm_chan_t type;
|
||||
/* RSL channel mode */
|
||||
enum rsl_cmod_spd rsl_cmode;
|
||||
/* If TCH, traffic channel mode */
|
||||
enum gsm48_chan_mode tch_mode;
|
||||
/* State */
|
||||
enum gsm_lchan_state state;
|
||||
/* Power levels for MS and BTS */
|
||||
uint8_t bs_power;
|
||||
uint8_t ms_power;
|
||||
/* Encryption information */
|
||||
struct {
|
||||
uint8_t alg_id;
|
||||
uint8_t key_len;
|
||||
uint8_t key[MAX_A5_KEY_LEN];
|
||||
} encr;
|
||||
|
||||
/* AMR bits */
|
||||
struct gsm48_multi_rate_conf mr_conf;
|
||||
|
||||
/* Established data link layer services */
|
||||
uint8_t sapis[8];
|
||||
int sach_deact;
|
||||
int release_reason;
|
||||
|
||||
struct {
|
||||
uint32_t bound_ip;
|
||||
uint32_t connect_ip;
|
||||
uint16_t bound_port;
|
||||
uint16_t connect_port;
|
||||
uint16_t conn_id;
|
||||
uint8_t rtp_payload;
|
||||
uint8_t rtp_payload2;
|
||||
uint8_t speech_mode;
|
||||
#ifdef ROLE_BSC
|
||||
struct rtp_socket *rtp_socket;
|
||||
#else
|
||||
struct osmo_rtp_socket *rtp_socket;
|
||||
#endif
|
||||
} abis_ip;
|
||||
|
||||
uint8_t rqd_ta;
|
||||
|
||||
#ifdef ROLE_BSC
|
||||
struct osmo_timer_list T3101;
|
||||
struct osmo_timer_list T3111;
|
||||
struct osmo_timer_list error_timer;
|
||||
struct osmo_timer_list act_timer;
|
||||
|
||||
/* table of neighbor cell measurements */
|
||||
struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
|
||||
|
||||
/* cache of last measurement reports on this lchan */
|
||||
struct gsm_meas_rep meas_rep[6];
|
||||
int meas_rep_idx;
|
||||
|
||||
/* GSM Random Access data */
|
||||
struct gsm48_req_ref *rqd_ref;
|
||||
|
||||
struct gsm_subscriber_connection *conn;
|
||||
#else
|
||||
struct lapdm_channel lapdm_ch;
|
||||
struct llist_head dl_tch_queue;
|
||||
struct {
|
||||
/* bitmask of all SI that are present/valid in si_buf */
|
||||
uint32_t valid;
|
||||
uint32_t last;
|
||||
/* buffers where we put the pre-computed SI */
|
||||
sysinfo_buf_t buf[_MAX_SYSINFO_TYPE];
|
||||
} si;
|
||||
struct {
|
||||
uint8_t flags;
|
||||
/* RSL measurment result number, 0 at lchan_act */
|
||||
uint8_t res_nr;
|
||||
/* current Tx power level of the BTS */
|
||||
uint8_t bts_tx_pwr;
|
||||
/* number of measurements stored in array below */
|
||||
uint8_t num_ul_meas;
|
||||
struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
|
||||
/* last L1 header from the MS */
|
||||
uint8_t l1_info[2];
|
||||
struct {
|
||||
uint8_t rxlev_full;
|
||||
uint8_t rxlev_sub;
|
||||
uint8_t rxqual_full;
|
||||
uint8_t rxqual_sub;
|
||||
} res;
|
||||
} meas;
|
||||
struct {
|
||||
struct amr_multirate_conf amr_mr;
|
||||
struct {
|
||||
uint8_t buf[16];
|
||||
uint8_t len;
|
||||
} last_sid;
|
||||
} tch;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define TS_F_PDCH_MODE 0x1000
|
||||
/* One Timeslot in a TRX */
|
||||
struct gsm_bts_trx_ts {
|
||||
struct gsm_bts_trx *trx;
|
||||
/* number of this timeslot at the TRX */
|
||||
uint8_t nr;
|
||||
|
||||
enum gsm_phys_chan_config pchan;
|
||||
|
||||
unsigned int flags;
|
||||
struct gsm_abis_mo mo;
|
||||
struct tlv_parsed nm_attr;
|
||||
uint8_t nm_chan_comb;
|
||||
int tsc; /* -1 == use BTS TSC */
|
||||
|
||||
struct {
|
||||
/* Parameters below are configured by VTY */
|
||||
int enabled;
|
||||
uint8_t maio;
|
||||
uint8_t hsn;
|
||||
struct bitvec arfcns;
|
||||
uint8_t arfcns_data[1024/8];
|
||||
/* This is the pre-computed MA for channel assignments */
|
||||
struct bitvec ma;
|
||||
uint8_t ma_len; /* part of ma_data that is used */
|
||||
uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
|
||||
} hopping;
|
||||
|
||||
/* To which E1 subslot are we connected */
|
||||
struct gsm_e1_subslot e1_link;
|
||||
|
||||
struct gsm_lchan lchan[TS_MAX_LCHAN];
|
||||
};
|
||||
|
||||
/* One TRX in a BTS */
|
||||
struct gsm_bts_trx {
|
||||
/* list header in bts->trx_list */
|
||||
struct llist_head list;
|
||||
|
||||
struct gsm_bts *bts;
|
||||
/* number of this TRX in the BTS */
|
||||
uint8_t nr;
|
||||
/* human readable name / description */
|
||||
char *description;
|
||||
/* how do we talk RSL with this TRX? */
|
||||
struct gsm_e1_subslot rsl_e1_link;
|
||||
uint8_t rsl_tei;
|
||||
struct e1inp_sign_link *rsl_link;
|
||||
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
|
||||
struct e1inp_sign_link *oml_link;
|
||||
|
||||
struct gsm_abis_mo mo;
|
||||
struct tlv_parsed nm_attr;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} bb_transc;
|
||||
|
||||
uint16_t arfcn;
|
||||
int nominal_power; /* in dBm */
|
||||
unsigned int max_power_red; /* in actual dB */
|
||||
|
||||
struct {
|
||||
void *l1h;
|
||||
} role_bts;
|
||||
|
||||
union {
|
||||
struct {
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} bbsig;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} pa;
|
||||
} bs11;
|
||||
struct {
|
||||
unsigned int test_state;
|
||||
uint8_t test_nr;
|
||||
struct rxlev_stats rxlev_stat;
|
||||
} ipaccess;
|
||||
};
|
||||
struct gsm_bts_trx_ts ts[TRX_NR_TS];
|
||||
};
|
||||
|
||||
#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
|
||||
|
||||
enum gsm_bts_type {
|
||||
GSM_BTS_TYPE_UNKNOWN,
|
||||
GSM_BTS_TYPE_BS11,
|
||||
GSM_BTS_TYPE_NANOBTS,
|
||||
GSM_BTS_TYPE_RBS2000,
|
||||
GSM_BTS_TYPE_HSL_FEMTO,
|
||||
GSM_BTS_TYPE_NOKIA_SITE,
|
||||
};
|
||||
|
||||
struct vty;
|
||||
|
||||
struct gsm_bts_model {
|
||||
struct llist_head list;
|
||||
|
||||
enum gsm_bts_type type;
|
||||
const char *name;
|
||||
|
||||
bool started;
|
||||
int (*start)(struct gsm_network *net);
|
||||
int (*oml_rcvmsg)(struct msgb *msg);
|
||||
|
||||
void (*e1line_bind_ops)(struct e1inp_line *line);
|
||||
|
||||
void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
|
||||
void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
|
||||
void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
|
||||
|
||||
struct tlv_definition nm_att_tlvdef;
|
||||
|
||||
struct bitvec features;
|
||||
uint8_t _features_data[128/8];
|
||||
};
|
||||
|
||||
enum gsm_bts_features {
|
||||
BTS_FEAT_HSCSD,
|
||||
BTS_FEAT_GPRS,
|
||||
BTS_FEAT_EGPRS,
|
||||
BTS_FEAT_ECSD,
|
||||
BTS_FEAT_HOPPING,
|
||||
};
|
||||
|
||||
/*
|
||||
* This keeps track of the paging status of one BTS. It
|
||||
* includes a number of pending requests, a back pointer
|
||||
* to the gsm_bts, a timer and some more state.
|
||||
*/
|
||||
struct gsm_bts_paging_state {
|
||||
/* pending requests */
|
||||
struct llist_head pending_requests;
|
||||
struct gsm_bts *bts;
|
||||
|
||||
struct osmo_timer_list work_timer;
|
||||
struct osmo_timer_list credit_timer;
|
||||
|
||||
/* free chans needed */
|
||||
int free_chans_need;
|
||||
|
||||
/* load */
|
||||
uint16_t available_slots;
|
||||
};
|
||||
|
||||
struct gsm_envabtse {
|
||||
struct gsm_abis_mo mo;
|
||||
};
|
||||
|
||||
struct gsm_bts_gprs_nsvc {
|
||||
struct gsm_bts *bts;
|
||||
/* data read via VTY config file, to configure the BTS
|
||||
* via OML from BSC */
|
||||
int id;
|
||||
uint16_t nsvci;
|
||||
uint16_t local_port; /* on the BTS */
|
||||
uint16_t remote_port; /* on the SGSN */
|
||||
uint32_t remote_ip; /* on the SGSN */
|
||||
|
||||
struct gsm_abis_mo mo;
|
||||
};
|
||||
|
||||
enum neigh_list_manual_mode {
|
||||
NL_MODE_AUTOMATIC = 0,
|
||||
NL_MODE_MANUAL = 1,
|
||||
NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */
|
||||
};
|
||||
|
||||
/* One BTS */
|
||||
struct gsm_bts {
|
||||
/* list header in net->bts_list */
|
||||
struct llist_head list;
|
||||
|
||||
/* number of ths BTS in network */
|
||||
uint8_t nr;
|
||||
/* human readable name / description */
|
||||
char *description;
|
||||
/* Cell Identity */
|
||||
uint16_t cell_identity;
|
||||
/* location area code of this BTS */
|
||||
uint16_t location_area_code;
|
||||
/* Training Sequence Code */
|
||||
uint8_t tsc;
|
||||
/* Base Station Identification Code (BSIC) */
|
||||
uint8_t bsic;
|
||||
/* type of BTS */
|
||||
enum gsm_bts_type type;
|
||||
struct gsm_bts_model *model;
|
||||
enum gsm_band band;
|
||||
/* maximum Tx power that the MS is permitted to use in this cell */
|
||||
int ms_max_power;
|
||||
|
||||
/* how do we talk OML with this TRX? */
|
||||
struct gsm_e1_subslot oml_e1_link;
|
||||
uint8_t oml_tei;
|
||||
struct e1inp_sign_link *oml_link;
|
||||
|
||||
/* Abis network management O&M handle */
|
||||
struct abis_nm_h *nmh;
|
||||
|
||||
struct gsm_abis_mo mo;
|
||||
|
||||
/* number of this BTS on given E1 link */
|
||||
uint8_t bts_nr;
|
||||
|
||||
/* paging state and control */
|
||||
struct gsm_bts_paging_state paging;
|
||||
|
||||
/* CCCH is on C0 */
|
||||
struct gsm_bts_trx *c0;
|
||||
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} site_mgr;
|
||||
|
||||
/* bitmask of all SI that are present/valid in si_buf */
|
||||
uint32_t si_valid;
|
||||
/* buffers where we put the pre-computed SI */
|
||||
sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
|
||||
|
||||
/* TimeZone hours, mins, and bts specific */
|
||||
int tzhr;
|
||||
int tzmn;
|
||||
int tz_bts_specific;
|
||||
|
||||
/* ip.accesss Unit ID's have Site/BTS/TRX layout */
|
||||
union {
|
||||
struct {
|
||||
uint16_t site_id;
|
||||
uint16_t bts_id;
|
||||
uint32_t flags;
|
||||
} ip_access;
|
||||
struct {
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} cclk;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} rack;
|
||||
struct gsm_envabtse envabtse[4];
|
||||
} bs11;
|
||||
struct {
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
struct llist_head conn_groups;
|
||||
} is;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
struct llist_head conn_groups;
|
||||
} con;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} dp;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
} tf;
|
||||
} rbs2000;
|
||||
struct {
|
||||
unsigned long serno;
|
||||
} hsl;
|
||||
struct {
|
||||
uint8_t bts_type;
|
||||
int configured:1,
|
||||
skip_reset:1,
|
||||
did_reset:1,
|
||||
wait_reset:1;
|
||||
struct osmo_timer_list reset_timer;
|
||||
} nokia;
|
||||
};
|
||||
|
||||
/* Not entirely sure how ip.access specific this is */
|
||||
struct {
|
||||
enum bts_gprs_mode mode;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
uint16_t nsei;
|
||||
uint8_t timer[7];
|
||||
} nse;
|
||||
struct {
|
||||
struct gsm_abis_mo mo;
|
||||
uint16_t bvci;
|
||||
uint8_t timer[11];
|
||||
} cell;
|
||||
struct gsm_bts_gprs_nsvc nsvc[2];
|
||||
uint8_t rac;
|
||||
} gprs;
|
||||
|
||||
/* RACH NM values */
|
||||
int rach_b_thresh;
|
||||
int rach_ldavg_slots;
|
||||
|
||||
/* transceivers */
|
||||
int num_trx;
|
||||
struct llist_head trx_list;
|
||||
|
||||
#ifdef ROLE_BSC
|
||||
/* Abis NM queue */
|
||||
struct llist_head abis_queue;
|
||||
int abis_nm_pend;
|
||||
|
||||
struct gsm_network *network;
|
||||
|
||||
/* should the channel allocator allocate channels from high TRX to TRX0,
|
||||
* rather than starting from TRX0 and go upwards? */
|
||||
int chan_alloc_reverse;
|
||||
|
||||
enum neigh_list_manual_mode neigh_list_manual_mode;
|
||||
/* parameters from which we build SYSTEM INFORMATION */
|
||||
struct {
|
||||
struct gsm48_rach_control rach_control;
|
||||
uint8_t ncc_permitted;
|
||||
struct gsm48_cell_sel_par cell_sel_par;
|
||||
struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */
|
||||
struct gsm48_cell_options cell_options;
|
||||
struct gsm48_control_channel_descr chan_desc;
|
||||
struct bitvec neigh_list;
|
||||
struct bitvec cell_alloc;
|
||||
struct bitvec si5_neigh_list;
|
||||
struct {
|
||||
/* bitmask large enough for all possible ARFCN's */
|
||||
uint8_t neigh_list[1024/8];
|
||||
uint8_t cell_alloc[1024/8];
|
||||
/* If the user wants a different neighbor list in SI5 than in SI2 */
|
||||
uint8_t si5_neigh_list[1024/8];
|
||||
} data;
|
||||
} si_common;
|
||||
|
||||
/* do we use static (user-defined) system information messages? (bitmask) */
|
||||
uint32_t si_mode_static;
|
||||
#endif /* ROLE_BSC */
|
||||
void *role;
|
||||
};
|
||||
|
||||
|
||||
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx);
|
||||
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
|
||||
|
||||
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
|
||||
|
||||
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
|
||||
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
|
||||
const char *gsm_lchant_name(enum gsm_chan_t c);
|
||||
const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
|
||||
char *gsm_trx_name(const struct gsm_bts_trx *trx);
|
||||
char *gsm_ts_name(const struct gsm_bts_trx_ts *ts);
|
||||
char *gsm_lchan_name(const struct gsm_lchan *lchan);
|
||||
const char *gsm_lchans_name(enum gsm_lchan_state s);
|
||||
|
||||
|
||||
void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
|
||||
|
||||
struct gsm_abis_mo *
|
||||
gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
|
||||
const struct abis_om_obj_inst *obj_inst);
|
||||
|
||||
struct gsm_nm_state *
|
||||
gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class,
|
||||
const struct abis_om_obj_inst *obj_inst);
|
||||
void *
|
||||
gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
|
||||
const struct abis_om_obj_inst *obj_inst);
|
||||
|
||||
/* reset the state of all MO in the BTS */
|
||||
void gsm_bts_mo_reset(struct gsm_bts *bts);
|
||||
|
||||
uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr);
|
||||
uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
|
||||
|
||||
/*
|
||||
* help with parsing regexps
|
||||
*/
|
||||
int gsm_parse_reg(void *ctx, regex_t *reg, char **str,
|
||||
int argc, const char **argv) __attribute__ ((warn_unused_result));
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,8 @@
|
||||
#ifndef _GSM_SUBSCR_H
|
||||
#define _GSM_SUBSCR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "gsm_data.h"
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
|
||||
#define GSM_IMEI_LENGTH 17
|
||||
#define GSM_IMSI_LENGTH 17
|
||||
@@ -24,24 +23,24 @@ struct gsm_equipment {
|
||||
char name[GSM_NAME_LENGTH];
|
||||
|
||||
struct gsm48_classmark1 classmark1;
|
||||
u_int8_t classmark2_len;
|
||||
u_int8_t classmark2[3];
|
||||
u_int8_t classmark3_len;
|
||||
u_int8_t classmark3[14];
|
||||
uint8_t classmark2_len;
|
||||
uint8_t classmark2[3];
|
||||
uint8_t classmark3_len;
|
||||
uint8_t classmark3[14];
|
||||
};
|
||||
|
||||
struct gsm_subscriber {
|
||||
struct gsm_network *net;
|
||||
long long unsigned int id;
|
||||
char imsi[GSM_IMSI_LENGTH];
|
||||
u_int32_t tmsi;
|
||||
u_int16_t lac;
|
||||
uint32_t tmsi;
|
||||
uint16_t lac;
|
||||
char name[GSM_NAME_LENGTH];
|
||||
char extension[GSM_EXTENSION_LENGTH];
|
||||
int authorized;
|
||||
|
||||
/* Temporary field which is not stored in the DB/HLR */
|
||||
u_int32_t flags;
|
||||
uint32_t flags;
|
||||
|
||||
/* Every user can only have one equipment in use at any given
|
||||
* point in time */
|
||||
@@ -72,7 +71,7 @@ enum gsm_subscriber_update_reason {
|
||||
struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr);
|
||||
struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr);
|
||||
struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net,
|
||||
u_int32_t tmsi);
|
||||
uint32_t tmsi);
|
||||
struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net,
|
||||
const char *imsi);
|
||||
struct gsm_subscriber *subscr_get_by_extension(struct gsm_network *net,
|
||||
|
||||
7
openbsc/include/openbsc/handover_decision.h
Normal file
7
openbsc/include/openbsc/handover_decision.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _HANDOVER_DECISION_H
|
||||
#define _HANDOVER_DECISION_H
|
||||
|
||||
void on_dso_load_ho_dec(void);
|
||||
|
||||
#endif /* _HANDOVER_DECISION_H */
|
||||
|
||||
@@ -1,58 +1,10 @@
|
||||
#ifndef _IPACCESS_H
|
||||
#define _IPACCESS_H
|
||||
|
||||
#include "e1_input.h"
|
||||
#include <osmocom/abis/e1_input.h>
|
||||
#include "gsm_subscriber.h"
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
||||
#define IPA_TCP_PORT_OML 3002
|
||||
#define IPA_TCP_PORT_RSL 3003
|
||||
|
||||
struct ipaccess_head {
|
||||
u_int16_t len; /* network byte order */
|
||||
u_int8_t proto;
|
||||
u_int8_t data[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ipaccess_head_ext {
|
||||
uint8_t proto;
|
||||
uint8_t data[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
enum ipaccess_proto {
|
||||
IPAC_PROTO_RSL = 0x00,
|
||||
IPAC_PROTO_IPACCESS = 0xfe,
|
||||
IPAC_PROTO_SCCP = 0xfd,
|
||||
IPAC_PROTO_OML = 0xff,
|
||||
|
||||
|
||||
/* OpenBSC extensions */
|
||||
IPAC_PROTO_OSMO = 0xee,
|
||||
IPAC_PROTO_MGCP_OLD = 0xfc,
|
||||
};
|
||||
|
||||
enum ipaccess_msgtype {
|
||||
IPAC_MSGT_PING = 0x00,
|
||||
IPAC_MSGT_PONG = 0x01,
|
||||
IPAC_MSGT_ID_GET = 0x04,
|
||||
IPAC_MSGT_ID_RESP = 0x05,
|
||||
IPAC_MSGT_ID_ACK = 0x06,
|
||||
|
||||
/* OpenBSC extension */
|
||||
IPAC_MSGT_SCCP_OLD = 0xff,
|
||||
};
|
||||
|
||||
enum ipaccess_id_tags {
|
||||
IPAC_IDTAG_SERNR = 0x00,
|
||||
IPAC_IDTAG_UNITNAME = 0x01,
|
||||
IPAC_IDTAG_LOCATION1 = 0x02,
|
||||
IPAC_IDTAG_LOCATION2 = 0x03,
|
||||
IPAC_IDTAG_EQUIPVERS = 0x04,
|
||||
IPAC_IDTAG_SWVERSION = 0x05,
|
||||
IPAC_IDTAG_IPADDR = 0x06,
|
||||
IPAC_IDTAG_MACADDR = 0x07,
|
||||
IPAC_IDTAG_UNIT = 0x08,
|
||||
};
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/gsm/protocol/ipaccess.h>
|
||||
|
||||
struct ipac_msgt_sccp_state {
|
||||
uint8_t src_ref[3];
|
||||
@@ -62,54 +14,35 @@ struct ipac_msgt_sccp_state {
|
||||
char imsi[GSM_IMSI_LENGTH];
|
||||
} __attribute__((packed));
|
||||
|
||||
int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa);
|
||||
/*
|
||||
* @add_remove 0 for remove, 1 for add, 3 to asK
|
||||
* @nr_lacs Number of extra lacs inside this package
|
||||
* @lac One lac entry
|
||||
*/
|
||||
struct ipac_ext_lac_cmd {
|
||||
uint8_t add_remove;
|
||||
uint8_t nr_extra_lacs;
|
||||
uint16_t lac;
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* methods for parsing and sending a message
|
||||
*/
|
||||
int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd);
|
||||
struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error);
|
||||
int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
|
||||
void ipaccess_prepend_header(struct msgb *msg, int proto);
|
||||
void ipaccess_prepend_header_ext(struct msgb *msg, int proto);
|
||||
int ipaccess_send_pong(int fd);
|
||||
int ipaccess_send_id_ack(int fd);
|
||||
int ipaccess_send_id_req(int fd);
|
||||
|
||||
const char *ipaccess_idtag_name(uint8_t tag);
|
||||
int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
|
||||
int ipaccess_parse_unitid(const char *str, uint16_t *site_id, uint16_t *bts_id, uint16_t *trx_id);
|
||||
|
||||
int ipaccess_drop_oml(struct gsm_bts *bts);
|
||||
int ipaccess_drop_rsl(struct gsm_bts_trx *trx);
|
||||
|
||||
/*
|
||||
* Firmware specific header
|
||||
*/
|
||||
struct sdp_firmware {
|
||||
char magic[4];
|
||||
char more_magic[2];
|
||||
u_int16_t more_more_magic;
|
||||
u_int32_t header_length;
|
||||
u_int32_t file_length;
|
||||
char sw_part[20];
|
||||
char text1[64];
|
||||
char time[12];
|
||||
char date[14];
|
||||
char text2[10];
|
||||
char version[20];
|
||||
u_int16_t table_offset;
|
||||
/* stuff i don't know */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sdp_header_entry {
|
||||
u_int16_t something1;
|
||||
char text1[64];
|
||||
char time[12];
|
||||
char date[14];
|
||||
char text2[10];
|
||||
char version[20];
|
||||
u_int32_t length;
|
||||
u_int32_t addr1;
|
||||
u_int32_t addr2;
|
||||
u_int32_t start;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct sdp_header_item {
|
||||
struct sdp_header_entry header_entry;
|
||||
struct llist_head entry;
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
#ifndef _MEAS_REP_H
|
||||
#define _MEAS_REP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MRC_F_PROCESSED 0x0001
|
||||
|
||||
/* extracted from a L3 measurement report IE */
|
||||
struct gsm_meas_rep_cell {
|
||||
u_int8_t rxlev;
|
||||
u_int8_t bsic;
|
||||
u_int8_t neigh_idx;
|
||||
u_int16_t arfcn;
|
||||
uint8_t rxlev;
|
||||
uint8_t bsic;
|
||||
uint8_t neigh_idx;
|
||||
uint16_t arfcn;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
/* RX Level and RX Quality */
|
||||
struct gsm_rx_lev_qual {
|
||||
u_int8_t rx_lev;
|
||||
u_int8_t rx_qual;
|
||||
uint8_t rx_lev;
|
||||
uint8_t rx_qual;
|
||||
};
|
||||
|
||||
/* unidirectional measumrement report */
|
||||
@@ -38,7 +40,7 @@ struct gsm_meas_rep {
|
||||
struct gsm_lchan *lchan;
|
||||
|
||||
/* number of the measurement report */
|
||||
u_int8_t nr;
|
||||
uint8_t nr;
|
||||
/* flags, see MEAS_REP_F_* */
|
||||
unsigned int flags;
|
||||
|
||||
@@ -46,11 +48,11 @@ struct gsm_meas_rep {
|
||||
struct gsm_meas_rep_unidir ul;
|
||||
struct gsm_meas_rep_unidir dl;
|
||||
|
||||
u_int8_t bs_power;
|
||||
u_int8_t ms_timing_offset;
|
||||
uint8_t bs_power;
|
||||
uint8_t ms_timing_offset;
|
||||
struct {
|
||||
int8_t pwr; /* MS power in dBm */
|
||||
u_int8_t ta; /* MS timing advance */
|
||||
uint8_t ta; /* MS timing advance */
|
||||
} ms_l1;
|
||||
|
||||
/* neighbor measurement reports for up to 6 cells */
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#ifndef OPENBSC_MGCP_H
|
||||
#define OPENBSC_MGCP_H
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/write_queue.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/write_queue.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
@@ -82,7 +82,7 @@ struct mgcp_trunk_config;
|
||||
typedef int (*mgcp_realloc)(struct mgcp_trunk_config *cfg, int endpoint);
|
||||
typedef int (*mgcp_change)(struct mgcp_trunk_config *cfg, int endpoint, int state);
|
||||
typedef int (*mgcp_policy)(struct mgcp_trunk_config *cfg, int endpoint, int state, const char *transactio_id);
|
||||
typedef int (*mgcp_reset)(struct mgcp_config *cfg);
|
||||
typedef int (*mgcp_reset)(struct mgcp_trunk_config *cfg);
|
||||
|
||||
#define PORT_ALLOC_STATIC 0
|
||||
#define PORT_ALLOC_DYNAMIC 1
|
||||
@@ -135,7 +135,7 @@ struct mgcp_config {
|
||||
struct in_addr transcoder_in;
|
||||
int transcoder_remote_base;
|
||||
|
||||
struct write_queue gw_fd;
|
||||
struct osmo_wqueue gw_fd;
|
||||
|
||||
struct mgcp_port_range bts_ports;
|
||||
struct mgcp_port_range net_ports;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifndef OPENBSC_MGCP_DATA_H
|
||||
#define OPENBSC_MGCP_DATA_H
|
||||
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
#define CI_UNUSED 0
|
||||
|
||||
@@ -66,8 +66,8 @@ struct mgcp_rtp_end {
|
||||
/*
|
||||
* Each end has a socket...
|
||||
*/
|
||||
struct bsc_fd rtp;
|
||||
struct bsc_fd rtcp;
|
||||
struct osmo_fd rtp;
|
||||
struct osmo_fd rtcp;
|
||||
|
||||
int local_port;
|
||||
int local_alloc;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef MISDN_H
|
||||
#define MISDN_H
|
||||
|
||||
#include "e1_input.h"
|
||||
#include <osmocom/abis/e1_input.h>
|
||||
|
||||
int mi_setup(int cardnr, struct e1inp_line *line, int release_l2);
|
||||
int mi_e1_line_update(struct e1inp_line *line);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#ifndef _MNCC_H
|
||||
#define _MNCC_H
|
||||
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/mncc.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/gsm/mncc.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -96,6 +96,8 @@ struct gsm_call {
|
||||
#define GSM_TCHF_FRAME 0x0300
|
||||
#define GSM_TCHF_FRAME_EFR 0x0301
|
||||
|
||||
#define MNCC_SOCKET_HELLO 0x0400
|
||||
|
||||
#define GSM_MAX_FACILITY 128
|
||||
#define GSM_MAX_SSVERSION 128
|
||||
#define GSM_MAX_USERUSER 128
|
||||
@@ -148,6 +150,7 @@ struct gsm_mncc {
|
||||
int emergency;
|
||||
char imsi[16];
|
||||
|
||||
unsigned char lchan_type;
|
||||
unsigned char lchan_mode;
|
||||
};
|
||||
|
||||
@@ -157,6 +160,12 @@ struct gsm_data_frame {
|
||||
unsigned char data[0];
|
||||
};
|
||||
|
||||
#define MNCC_SOCK_VERSION 1
|
||||
struct gsm_mncc_hello {
|
||||
uint32_t msg_type;
|
||||
uint32_t version;
|
||||
};
|
||||
|
||||
char *get_mncc_name(int value);
|
||||
void mncc_set_cause(struct gsm_mncc *data, int loc, int val);
|
||||
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg);
|
||||
|
||||
12
openbsc/include/openbsc/mncc_int.h
Normal file
12
openbsc/include/openbsc/mncc_int.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _MNCC_INT_H
|
||||
#define _MNCC_INT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct mncc_int {
|
||||
uint8_t def_codec[2];
|
||||
};
|
||||
|
||||
extern struct mncc_int mncc_int;
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,8 @@ struct osmo_bsc_sccp_con {
|
||||
/* SCCP connection realted */
|
||||
struct sccp_connection *sccp;
|
||||
struct bsc_msc_connection *msc_con;
|
||||
struct timer_list sccp_it_timeout;
|
||||
struct timer_list sccp_cc_timeout;
|
||||
struct osmo_timer_list sccp_it_timeout;
|
||||
struct osmo_timer_list sccp_cc_timeout;
|
||||
|
||||
struct llist_head sccp_queue;
|
||||
unsigned int sccp_queue_size;
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
#ifndef OSMO_BSC_RF
|
||||
#define OSMO_BSC_RF
|
||||
|
||||
#include <osmocore/write_queue.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocom/core/write_queue.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
struct gsm_network;
|
||||
|
||||
struct osmo_bsc_rf {
|
||||
/* the value of signal.h */
|
||||
int policy;
|
||||
struct bsc_fd listen;
|
||||
struct osmo_fd listen;
|
||||
struct gsm_network *gsm_network;
|
||||
|
||||
const char *last_state_command;
|
||||
|
||||
/* delay the command */
|
||||
char last_request;
|
||||
struct timer_list delay_cmd;
|
||||
struct osmo_timer_list delay_cmd;
|
||||
|
||||
/* verify that RF is up as it should be */
|
||||
struct timer_list rf_check;
|
||||
struct osmo_timer_list rf_check;
|
||||
|
||||
/* some handling for the automatic grace switch */
|
||||
struct timer_list grace_timeout;
|
||||
struct osmo_timer_list grace_timeout;
|
||||
};
|
||||
|
||||
struct osmo_bsc_rf_conn {
|
||||
struct write_queue queue;
|
||||
struct osmo_wqueue queue;
|
||||
struct osmo_bsc_rf *rf;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "bsc_msc.h"
|
||||
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
struct osmo_bsc_rf;
|
||||
struct gsm_network;
|
||||
@@ -36,15 +36,15 @@ struct gsm_audio_support {
|
||||
};
|
||||
|
||||
struct osmo_msc_data {
|
||||
/* Back pointer */
|
||||
struct gsm_network *network;
|
||||
|
||||
/* Connection data */
|
||||
char *bsc_token;
|
||||
int msc_port;
|
||||
int msc_ip_dscp;
|
||||
char *msc_ip;
|
||||
int ping_timeout;
|
||||
int pong_timeout;
|
||||
struct timer_list ping_timer;
|
||||
struct timer_list pong_timer;
|
||||
struct osmo_timer_list ping_timer;
|
||||
struct osmo_timer_list pong_timer;
|
||||
struct bsc_msc_connection *msc_con;
|
||||
int core_ncc;
|
||||
int core_mcc;
|
||||
@@ -54,14 +54,18 @@ struct osmo_msc_data {
|
||||
struct gsm_audio_support **audio_support;
|
||||
int audio_length;
|
||||
|
||||
/* destinations */
|
||||
struct llist_head dests;
|
||||
|
||||
|
||||
/* mgcp agent */
|
||||
struct write_queue mgcp_agent;
|
||||
struct osmo_wqueue mgcp_agent;
|
||||
|
||||
/* rf ctl related bits */
|
||||
char *mid_call_txt;
|
||||
int mid_call_timeout;
|
||||
struct osmo_bsc_rf *rf_ctl;
|
||||
char *rf_ctrl_name;
|
||||
struct osmo_bsc_rf *rf_ctrl;
|
||||
|
||||
/* ussd welcome text */
|
||||
char *ussd_welcome_txt;
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include "gsm_data.h"
|
||||
#include "gsm_subscriber.h"
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
|
||||
/**
|
||||
* A pending paging request
|
||||
@@ -43,7 +43,7 @@ struct gsm_paging_request {
|
||||
int chan_type;
|
||||
|
||||
/* Timer 3113: how long do we try to page? */
|
||||
struct timer_list T3113;
|
||||
struct osmo_timer_list T3113;
|
||||
|
||||
/* How often did we ask the BTS to page? */
|
||||
int attempts;
|
||||
@@ -53,9 +53,6 @@ struct gsm_paging_request {
|
||||
void *cbfn_param;
|
||||
};
|
||||
|
||||
/* call once for every gsm_bts... */
|
||||
void paging_init(struct gsm_bts *bts);
|
||||
|
||||
/* schedule paging request */
|
||||
int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
|
||||
int type, gsm_cbfn *cbfn, void *data);
|
||||
@@ -66,6 +63,11 @@ void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
|
||||
struct msgb *msg);
|
||||
|
||||
/* update paging load */
|
||||
void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t);
|
||||
void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);
|
||||
|
||||
/* pending paging requests */
|
||||
unsigned int paging_pending_requests_nr(struct gsm_bts *bts);
|
||||
|
||||
void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#ifndef _REST_OCTETS_H
|
||||
#define _REST_OCTETS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <openbsc/gsm_04_08.h>
|
||||
|
||||
/* generate SI1 rest octets */
|
||||
int rest_octets_si1(u_int8_t *data, u_int8_t *nch_pos);
|
||||
int rest_octets_si1(uint8_t *data, uint8_t *nch_pos);
|
||||
|
||||
struct gsm48_si_selection_params {
|
||||
u_int16_t penalty_time:5,
|
||||
uint16_t penalty_time:5,
|
||||
temp_offs:3,
|
||||
cell_resel_off:6,
|
||||
cbq:1,
|
||||
@@ -16,18 +15,18 @@ struct gsm48_si_selection_params {
|
||||
};
|
||||
|
||||
struct gsm48_si_power_offset {
|
||||
u_int8_t power_offset:2,
|
||||
uint8_t power_offset:2,
|
||||
present:1;
|
||||
};
|
||||
|
||||
struct gsm48_si3_gprs_ind {
|
||||
u_int8_t si13_position:1,
|
||||
uint8_t si13_position:1,
|
||||
ra_colour:3,
|
||||
present:1;
|
||||
};
|
||||
|
||||
struct gsm48_lsa_params {
|
||||
u_int32_t prio_thr:3,
|
||||
uint32_t prio_thr:3,
|
||||
lsa_offset:3,
|
||||
mcc:12,
|
||||
mnc:12;
|
||||
@@ -37,26 +36,26 @@ struct gsm48_lsa_params {
|
||||
struct gsm48_si_ro_info {
|
||||
struct gsm48_si_selection_params selection_params;
|
||||
struct gsm48_si_power_offset power_offset;
|
||||
u_int8_t si2ter_indicator;
|
||||
u_int8_t early_cm_ctrl;
|
||||
uint8_t si2ter_indicator;
|
||||
uint8_t early_cm_ctrl;
|
||||
struct {
|
||||
u_int8_t where:3,
|
||||
uint8_t where:3,
|
||||
present:1;
|
||||
} scheduling;
|
||||
struct gsm48_si3_gprs_ind gprs_ind;
|
||||
|
||||
/* SI 4 specific */
|
||||
struct gsm48_lsa_params lsa_params;
|
||||
u_int16_t cell_id;
|
||||
u_int8_t break_ind; /* do we have SI7 + SI8 ? */
|
||||
uint16_t cell_id;
|
||||
uint8_t break_ind; /* do we have SI7 + SI8 ? */
|
||||
};
|
||||
|
||||
|
||||
/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
|
||||
int rest_octets_si3(u_int8_t *data, const struct gsm48_si_ro_info *si3);
|
||||
int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
|
||||
|
||||
/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
|
||||
int rest_octets_si4(u_int8_t *data, const struct gsm48_si_ro_info *si4);
|
||||
int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4);
|
||||
|
||||
enum pbcch_carrier_type {
|
||||
PBCCH_BCCH,
|
||||
@@ -75,59 +74,59 @@ enum gprs_nmo {
|
||||
struct gprs_cell_options {
|
||||
enum gprs_nmo nmo;
|
||||
/* T3168: wait for packet uplink assignment message */
|
||||
u_int32_t t3168; /* in milliseconds */
|
||||
uint32_t t3168; /* in milliseconds */
|
||||
/* T3192: wait for release of the TBF after reception of the final block */
|
||||
u_int32_t t3192; /* in milliseconds */
|
||||
u_int32_t drx_timer_max;/* in seconds */
|
||||
u_int32_t bs_cv_max;
|
||||
uint32_t t3192; /* in milliseconds */
|
||||
uint32_t drx_timer_max;/* in seconds */
|
||||
uint32_t bs_cv_max;
|
||||
|
||||
u_int8_t ext_info_present;
|
||||
uint8_t ext_info_present;
|
||||
struct {
|
||||
u_int8_t egprs_supported;
|
||||
u_int8_t use_egprs_p_ch_req;
|
||||
u_int8_t bep_period;
|
||||
u_int8_t pfc_supported;
|
||||
u_int8_t dtm_supported;
|
||||
u_int8_t bss_paging_coordination;
|
||||
uint8_t egprs_supported;
|
||||
uint8_t use_egprs_p_ch_req;
|
||||
uint8_t bep_period;
|
||||
uint8_t pfc_supported;
|
||||
uint8_t dtm_supported;
|
||||
uint8_t bss_paging_coordination;
|
||||
} ext_info;
|
||||
};
|
||||
|
||||
/* TS 04.60 Table 12.9.2 */
|
||||
struct gprs_power_ctrl_pars {
|
||||
u_int8_t alpha;
|
||||
u_int8_t t_avg_w;
|
||||
u_int8_t t_avg_t;
|
||||
u_int8_t pc_meas_chan;
|
||||
u_int8_t n_avg_i;
|
||||
uint8_t alpha;
|
||||
uint8_t t_avg_w;
|
||||
uint8_t t_avg_t;
|
||||
uint8_t pc_meas_chan;
|
||||
uint8_t n_avg_i;
|
||||
};
|
||||
|
||||
struct gsm48_si13_info {
|
||||
struct gprs_cell_options cell_opts;
|
||||
struct gprs_power_ctrl_pars pwr_ctrl_pars;
|
||||
u_int8_t bcch_change_mark;
|
||||
u_int8_t si_change_field;
|
||||
u_int8_t pbcch_present;
|
||||
uint8_t bcch_change_mark;
|
||||
uint8_t si_change_field;
|
||||
uint8_t pbcch_present;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u_int8_t rac;
|
||||
u_int8_t spgc_ccch_sup;
|
||||
u_int8_t net_ctrl_ord;
|
||||
u_int8_t prio_acc_thr;
|
||||
uint8_t rac;
|
||||
uint8_t spgc_ccch_sup;
|
||||
uint8_t net_ctrl_ord;
|
||||
uint8_t prio_acc_thr;
|
||||
} no_pbcch;
|
||||
struct {
|
||||
u_int8_t psi1_rep_per;
|
||||
u_int8_t pb;
|
||||
u_int8_t tsc;
|
||||
u_int8_t tn;
|
||||
uint8_t psi1_rep_per;
|
||||
uint8_t pb;
|
||||
uint8_t tsc;
|
||||
uint8_t tn;
|
||||
enum pbcch_carrier_type carrier_type;
|
||||
u_int16_t arfcn;
|
||||
u_int8_t maio;
|
||||
uint16_t arfcn;
|
||||
uint8_t maio;
|
||||
} pbcch;
|
||||
};
|
||||
};
|
||||
|
||||
/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
|
||||
int rest_octets_si13(u_int8_t *data, const struct gsm48_si13_info *si13);
|
||||
int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
|
||||
|
||||
#endif /* _REST_OCTETS_H */
|
||||
|
||||
7
openbsc/include/openbsc/rrlp.h
Normal file
7
openbsc/include/openbsc/rrlp.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _RRLP_H
|
||||
#define _RRLP_H
|
||||
|
||||
void on_dso_load_rrlp(void);
|
||||
|
||||
#endif /* _RRLP_H */
|
||||
|
||||
@@ -24,14 +24,15 @@
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
#include <openbsc/mncc.h>
|
||||
|
||||
#define RTP_PT_GSM_FULL 3
|
||||
#define RTP_PT_GSM_HALF 96
|
||||
#define RTP_PT_GSM_EFR 97
|
||||
#define RTP_PT_AMR_FULL 98
|
||||
#define RTP_PT_AMR_HALF 99
|
||||
#define RTP_PT_AMR 98
|
||||
|
||||
enum rtp_rx_action {
|
||||
RTP_NONE,
|
||||
@@ -48,7 +49,7 @@ struct rtp_sub_socket {
|
||||
struct sockaddr_in sin_local;
|
||||
struct sockaddr_in sin_remote;
|
||||
|
||||
struct bsc_fd bfd;
|
||||
struct osmo_fd bfd;
|
||||
/* linked list of to-be-transmitted msgb's */
|
||||
struct llist_head tx_queue;
|
||||
};
|
||||
@@ -67,23 +68,23 @@ struct rtp_socket {
|
||||
} proxy;
|
||||
struct {
|
||||
struct gsm_network *net;
|
||||
u_int32_t callref;
|
||||
uint32_t callref;
|
||||
} receive;
|
||||
};
|
||||
enum rtp_tx_action tx_action;
|
||||
struct {
|
||||
u_int16_t sequence;
|
||||
u_int32_t timestamp;
|
||||
u_int32_t ssrc;
|
||||
uint16_t sequence;
|
||||
uint32_t timestamp;
|
||||
uint32_t ssrc;
|
||||
struct timeval last_tv;
|
||||
} transmit;
|
||||
};
|
||||
|
||||
struct rtp_socket *rtp_socket_create(void);
|
||||
int rtp_socket_bind(struct rtp_socket *rs, u_int32_t ip);
|
||||
int rtp_socket_connect(struct rtp_socket *rs, u_int32_t ip, u_int16_t port);
|
||||
int rtp_socket_bind(struct rtp_socket *rs, uint32_t ip);
|
||||
int rtp_socket_connect(struct rtp_socket *rs, uint32_t ip, uint16_t port);
|
||||
int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other);
|
||||
int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, u_int32_t callref);
|
||||
int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, uint32_t callref);
|
||||
int rtp_socket_free(struct rtp_socket *rs);
|
||||
int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame);
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#ifndef _SGSN_H
|
||||
#define _SGSN_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
#include <openbsc/gprs_ns.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
@@ -22,11 +21,11 @@ struct sgsn_instance {
|
||||
char *config_file;
|
||||
struct sgsn_config cfg;
|
||||
/* File descriptor wrappers for LibGTP */
|
||||
struct bsc_fd gtp_fd0;
|
||||
struct bsc_fd gtp_fd1c;
|
||||
struct bsc_fd gtp_fd1u;
|
||||
struct osmo_fd gtp_fd0;
|
||||
struct osmo_fd gtp_fd1c;
|
||||
struct osmo_fd gtp_fd1u;
|
||||
/* Timer for libGTP */
|
||||
struct timer_list gtp_timer;
|
||||
struct osmo_timer_list gtp_timer;
|
||||
/* GSN instance for libgtp */
|
||||
struct gsn_t *gsn;
|
||||
};
|
||||
@@ -61,5 +60,7 @@ int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi,
|
||||
struct msgb *msg, uint32_t npdu_len, uint8_t *npdu);
|
||||
int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi,
|
||||
void *mmcontext);
|
||||
int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle,
|
||||
uint8_t *hdr, uint16_t len);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
|
||||
#include <osmocore/signal.h>
|
||||
#include <osmocom/core/signal.h>
|
||||
|
||||
/*
|
||||
* Signalling subsystems
|
||||
@@ -40,14 +40,12 @@ enum signal_subsystems {
|
||||
SS_LCHAN,
|
||||
SS_SUBSCR,
|
||||
SS_SCALL,
|
||||
SS_GLOBAL,
|
||||
SS_CHALLOC,
|
||||
SS_NS,
|
||||
SS_IPAC_NWL,
|
||||
SS_RF,
|
||||
SS_MSC,
|
||||
SS_HO,
|
||||
SS_INPUT,
|
||||
};
|
||||
|
||||
/* SS_PAGING signals */
|
||||
@@ -84,6 +82,7 @@ enum signal_nm {
|
||||
S_NM_TEST_REP, /* GSM 12.21 Test Report */
|
||||
S_NM_STATECHG_OPER, /* Operational State changed*/
|
||||
S_NM_STATECHG_ADM, /* Administrative State changed */
|
||||
S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */
|
||||
};
|
||||
|
||||
/* SS_LCHAN signals */
|
||||
@@ -128,7 +127,6 @@ enum signal_ipaccess {
|
||||
};
|
||||
|
||||
enum signal_global {
|
||||
S_GLOBAL_SHUTDOWN,
|
||||
S_GLOBAL_BTS_CLOSE_OM,
|
||||
};
|
||||
|
||||
@@ -139,16 +137,6 @@ enum signal_rf {
|
||||
S_RF_GRACE,
|
||||
};
|
||||
|
||||
/* SS_INPUT signals */
|
||||
enum signal_input {
|
||||
S_INP_NONE,
|
||||
S_INP_TEI_UP,
|
||||
S_INP_TEI_DN,
|
||||
S_INP_LINE_INIT,
|
||||
S_INP_LINE_ALARM,
|
||||
S_INP_LINE_NOALARM,
|
||||
};
|
||||
|
||||
struct gsm_subscriber;
|
||||
|
||||
struct paging_signal_data {
|
||||
@@ -169,15 +157,30 @@ struct scall_signal_data {
|
||||
|
||||
struct ipacc_ack_signal_data {
|
||||
struct gsm_bts_trx *trx;
|
||||
u_int8_t msg_type;
|
||||
uint8_t msg_type;
|
||||
};
|
||||
|
||||
struct abis_om2k_mo;
|
||||
|
||||
struct nm_statechg_signal_data {
|
||||
u_int8_t obj_class;
|
||||
struct gsm_bts *bts;
|
||||
uint8_t obj_class;
|
||||
void *obj;
|
||||
struct gsm_nm_state *old_state;
|
||||
struct gsm_nm_state *new_state;
|
||||
|
||||
/* This pointer is vaold for TS 12.21 MO */
|
||||
struct abis_om_obj_inst *obj_inst;
|
||||
/* This pointer is vaold for RBS2000 MO */
|
||||
struct abis_om2k_mo *om2k_mo;
|
||||
};
|
||||
|
||||
struct nm_om2k_signal_data {
|
||||
struct gsm_bts *bts;
|
||||
void *obj;
|
||||
struct abis_om2k_mo *om2k_mo;
|
||||
|
||||
uint8_t accordance_ind;
|
||||
};
|
||||
|
||||
struct nm_nack_signal_data {
|
||||
@@ -244,12 +247,4 @@ struct ho_signal_data {
|
||||
struct gsm_lchan *new_lchan;
|
||||
};
|
||||
|
||||
struct input_signal_data {
|
||||
int link_type;
|
||||
uint8_t tei;
|
||||
uint8_t sapi;
|
||||
struct gsm_bts_trx *trx;
|
||||
struct e1inp_line *line;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef _BSC_SOCKET_H
|
||||
#define _BSC_SOCKET_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
#ifndef IPPROTO_GRE
|
||||
#define IPPROTO_GRE 47
|
||||
#endif
|
||||
|
||||
int make_sock(struct bsc_fd *bfd, int proto, u_int32_t ip, u_int16_t port,
|
||||
int (*cb)(struct bsc_fd *fd, unsigned int what));
|
||||
int make_sock(struct osmo_fd *bfd, int proto,
|
||||
uint32_t ip, uint16_t port, int priv_nr,
|
||||
int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
|
||||
|
||||
#endif /* _BSC_SOCKET_H */
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
#ifndef _SUBCH_DEMUX_H
|
||||
#define _SUBCH_DEMUX_H
|
||||
/* A E1 sub-channel (de)multiplexer with TRAU frame sync */
|
||||
|
||||
/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
||||
#define NR_SUBCH 4
|
||||
#define TRAU_FRAME_SIZE 40
|
||||
#define TRAU_FRAME_BITS (TRAU_FRAME_SIZE*8)
|
||||
|
||||
/***********************************************************************/
|
||||
/* DEMULTIPLEXER */
|
||||
/***********************************************************************/
|
||||
|
||||
struct demux_subch {
|
||||
u_int8_t out_bitbuf[TRAU_FRAME_BITS];
|
||||
u_int16_t out_idx; /* next bit to be written in out_bitbuf */
|
||||
/* number of consecutive zeros that we have received (for sync) */
|
||||
unsigned int consecutive_zeros;
|
||||
/* are we in TRAU frame sync or not? */
|
||||
unsigned int in_sync;
|
||||
};
|
||||
|
||||
struct subch_demux {
|
||||
/* bitmask of currently active subchannels */
|
||||
u_int8_t chan_activ;
|
||||
/* one demux_subch struct for every subchannel */
|
||||
struct demux_subch subch[NR_SUBCH];
|
||||
/* callback to be called once we have received a complete
|
||||
* frame on a given subchannel */
|
||||
int (*out_cb)(struct subch_demux *dmx, int ch, u_int8_t *data, int len,
|
||||
void *);
|
||||
/* user-provided data, transparently passed to out_cb() */
|
||||
void *data;
|
||||
};
|
||||
|
||||
/* initialize one demultiplexer instance */
|
||||
int subch_demux_init(struct subch_demux *dmx);
|
||||
|
||||
/* feed 'len' number of muxed bytes into the demultiplexer */
|
||||
int subch_demux_in(struct subch_demux *dmx, u_int8_t *data, int len);
|
||||
|
||||
/* activate decoding/processing for one subchannel */
|
||||
int subch_demux_activate(struct subch_demux *dmx, int subch);
|
||||
|
||||
/* deactivate decoding/processing for one subchannel */
|
||||
int subch_demux_deactivate(struct subch_demux *dmx, int subch);
|
||||
|
||||
/***********************************************************************/
|
||||
/* MULTIPLEXER */
|
||||
/***********************************************************************/
|
||||
|
||||
/* one element in the tx_queue of a muxer sub-channel */
|
||||
struct subch_txq_entry {
|
||||
struct llist_head list;
|
||||
|
||||
unsigned int bit_len; /* total number of bits in 'bits' */
|
||||
unsigned int next_bit; /* next bit to be transmitted */
|
||||
|
||||
u_int8_t bits[0]; /* one bit per byte */
|
||||
};
|
||||
|
||||
struct mux_subch {
|
||||
struct llist_head tx_queue;
|
||||
};
|
||||
|
||||
/* structure representing one instance of the subchannel muxer */
|
||||
struct subch_mux {
|
||||
struct mux_subch subch[NR_SUBCH];
|
||||
};
|
||||
|
||||
/* initialize a subchannel muxer instance */
|
||||
int subchan_mux_init(struct subch_mux *mx);
|
||||
|
||||
/* request the output of 'len' multiplexed bytes */
|
||||
int subchan_mux_out(struct subch_mux *mx, u_int8_t *data, int len);
|
||||
|
||||
/* enqueue some data into one sub-channel of the muxer */
|
||||
int subchan_mux_enqueue(struct subch_mux *mx, int s_nr, const u_int8_t *data,
|
||||
int len);
|
||||
|
||||
#endif /* _SUBCH_DEMUX_H */
|
||||
@@ -1,45 +1,10 @@
|
||||
#ifndef _SYSTEM_INFO_H
|
||||
#define _SYSTEM_INFO_H
|
||||
|
||||
#include <osmocore/utils.h>
|
||||
|
||||
#define GSM_MACBLOCK_LEN 23
|
||||
#include <osmocom/gsm/sysinfo.h>
|
||||
|
||||
struct gsm_bts;
|
||||
|
||||
|
||||
enum osmo_sysinfo_type {
|
||||
SYSINFO_TYPE_NONE,
|
||||
SYSINFO_TYPE_1,
|
||||
SYSINFO_TYPE_2,
|
||||
SYSINFO_TYPE_3,
|
||||
SYSINFO_TYPE_4,
|
||||
SYSINFO_TYPE_5,
|
||||
SYSINFO_TYPE_6,
|
||||
SYSINFO_TYPE_7,
|
||||
SYSINFO_TYPE_8,
|
||||
SYSINFO_TYPE_9,
|
||||
SYSINFO_TYPE_10,
|
||||
SYSINFO_TYPE_13,
|
||||
SYSINFO_TYPE_16,
|
||||
SYSINFO_TYPE_17,
|
||||
SYSINFO_TYPE_18,
|
||||
SYSINFO_TYPE_19,
|
||||
SYSINFO_TYPE_20,
|
||||
SYSINFO_TYPE_2bis,
|
||||
SYSINFO_TYPE_2ter,
|
||||
SYSINFO_TYPE_2quater,
|
||||
SYSINFO_TYPE_5bis,
|
||||
SYSINFO_TYPE_5ter,
|
||||
/* FIXME all the various bis and ter */
|
||||
_MAX_SYSINFO_TYPE
|
||||
};
|
||||
|
||||
typedef u_int8_t sysinfo_buf_t[GSM_MACBLOCK_LEN];
|
||||
|
||||
extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE];
|
||||
uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type);
|
||||
const char *gsm_sitype_name(enum osmo_sysinfo_type si_type);
|
||||
int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
|
||||
|
||||
#endif
|
||||
|
||||
7
openbsc/include/openbsc/token_auth.h
Normal file
7
openbsc/include/openbsc/token_auth.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _TOKEN_AUTH_H
|
||||
#define _TOKEN_AUTH_H
|
||||
|
||||
void on_dso_load_token(void);
|
||||
|
||||
#endif /* _TOKEN_AUTH_H */
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <openbsc/gsm_04_11.h>
|
||||
#include <openbsc/mncc.h>
|
||||
|
||||
/* One transaction */
|
||||
struct gsm_trans {
|
||||
@@ -12,10 +13,10 @@ struct gsm_trans {
|
||||
struct llist_head entry;
|
||||
|
||||
/* The protocol within which we live */
|
||||
u_int8_t protocol;
|
||||
uint8_t protocol;
|
||||
|
||||
/* The current transaction ID */
|
||||
u_int8_t transaction_id;
|
||||
uint8_t transaction_id;
|
||||
|
||||
/* To whom we belong, unique identifier of remote MM entity */
|
||||
struct gsm_subscriber *subscr;
|
||||
@@ -24,7 +25,7 @@ struct gsm_trans {
|
||||
struct gsm_subscriber_connection *conn;
|
||||
|
||||
/* reference from MNCC or other application */
|
||||
u_int32_t callref;
|
||||
uint32_t callref;
|
||||
|
||||
/* if traffic channel receive was requested */
|
||||
int tch_recv;
|
||||
@@ -41,14 +42,14 @@ struct gsm_trans {
|
||||
/* current timer and message queue */
|
||||
int Tcurrent; /* current CC timer */
|
||||
int T308_second; /* used to send release again */
|
||||
struct timer_list timer;
|
||||
struct osmo_timer_list timer;
|
||||
struct gsm_mncc msg; /* stores setup/disconnect/release message */
|
||||
} cc;
|
||||
struct {
|
||||
u_int8_t link_id; /* RSL Link ID to be used for this trans */
|
||||
uint8_t link_id; /* RSL Link ID to be used for this trans */
|
||||
int is_mt; /* is this a MO (0) or MT (1) transfer */
|
||||
enum gsm411_cp_state cp_state;
|
||||
struct timer_list cp_timer;
|
||||
struct osmo_timer_list cp_timer;
|
||||
|
||||
enum gsm411_rp_state rp_state;
|
||||
|
||||
@@ -60,16 +61,16 @@ struct gsm_trans {
|
||||
|
||||
|
||||
struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
|
||||
u_int8_t proto, u_int8_t trans_id);
|
||||
uint8_t proto, uint8_t trans_id);
|
||||
struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
|
||||
u_int32_t callref);
|
||||
uint32_t callref);
|
||||
|
||||
struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
|
||||
u_int8_t protocol, u_int8_t trans_id,
|
||||
u_int32_t callref);
|
||||
uint8_t protocol, uint8_t trans_id,
|
||||
uint32_t callref);
|
||||
void trans_free(struct gsm_trans *trans);
|
||||
|
||||
int trans_assign_trans_id(struct gsm_subscriber *subscr,
|
||||
u_int8_t protocol, u_int8_t ti_flag);
|
||||
uint8_t protocol, uint8_t ti_flag);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef _TRAU_FRAME_H
|
||||
#define _TRAU_FRAME_H
|
||||
/* TRAU frame handling according to GSM TS 08.60 */
|
||||
|
||||
/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* 21 for FR/EFR, 25 for AMR, 15 for OM, 15 for data, 13 for E-data, 21 idle */
|
||||
#define MAX_C_BITS 25
|
||||
/* 260 for FR/EFR, 256 for AMR, 264 for OM, 288 for E-data */
|
||||
#define MAX_D_BITS 288
|
||||
/* for all speech frames */
|
||||
#define MAX_T_BITS 4
|
||||
/* for OM */
|
||||
#define MAX_S_BITS 6
|
||||
/* for E-data */
|
||||
#define MAX_M_BITS 2
|
||||
|
||||
struct decoded_trau_frame {
|
||||
u_int8_t c_bits[MAX_C_BITS];
|
||||
u_int8_t d_bits[MAX_D_BITS];
|
||||
u_int8_t t_bits[MAX_T_BITS];
|
||||
u_int8_t s_bits[MAX_S_BITS];
|
||||
u_int8_t m_bits[MAX_M_BITS];
|
||||
};
|
||||
|
||||
#define TRAU_FT_FR_UP 0x02 /* 0 0 0 1 0 - 3.5.1.1.1 */
|
||||
#define TRAU_FT_FR_DOWN 0x1c /* 1 1 1 0 0 - 3.5.1.1.1 */
|
||||
#define TRAU_FT_EFR 0x1a /* 1 1 0 1 0 - 3.5.1.1.1 */
|
||||
#define TRAU_FT_AMR 0x06 /* 0 0 1 1 0 - 3.5.1.2 */
|
||||
#define TRAU_FT_OM_UP 0x07 /* 0 0 1 0 1 - 3.5.2 */
|
||||
#define TRAU_FT_OM_DOWN 0x1b /* 1 1 0 1 1 - 3.5.2 */
|
||||
#define TRAU_FT_DATA_UP 0x08 /* 0 1 0 0 0 - 3.5.3 */
|
||||
#define TRAU_FT_DATA_DOWN 0x16 /* 1 0 1 1 0 - 3.5.3 */
|
||||
#define TRAU_FT_D145_SYNC 0x14 /* 1 0 1 0 0 - 3.5.3 */
|
||||
#define TRAU_FT_EDATA 0x1f /* 1 1 1 1 1 - 3.5.4 */
|
||||
#define TRAU_FT_IDLE_UP 0x10 /* 1 0 0 0 0 - 3.5.5 */
|
||||
#define TRAU_FT_IDLE_DOWN 0x0e /* 0 1 1 1 0 - 3.5.5 */
|
||||
|
||||
|
||||
int decode_trau_frame(struct decoded_trau_frame *fr, const u_int8_t *trau_bits);
|
||||
int encode_trau_frame(u_int8_t *trau_bits, const struct decoded_trau_frame *fr);
|
||||
int trau_frame_up2down(struct decoded_trau_frame *fr);
|
||||
u_int8_t *trau_idle_frame(void);
|
||||
|
||||
|
||||
#endif /* _TRAU_FRAME_H */
|
||||
@@ -28,6 +28,10 @@
|
||||
* optimization to routing them externally.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <openbsc/mncc.h>
|
||||
|
||||
/* map a TRAU mux map entry */
|
||||
int trau_mux_map(const struct gsm_e1_subslot *src,
|
||||
const struct gsm_e1_subslot *dst);
|
||||
@@ -35,14 +39,17 @@ int trau_mux_map_lchan(const struct gsm_lchan *src,
|
||||
const struct gsm_lchan *dst);
|
||||
|
||||
/* unmap a TRAU mux map entry */
|
||||
int trau_mux_unmap(const struct gsm_e1_subslot *ss, u_int32_t callref);
|
||||
int trau_mux_unmap(const struct gsm_e1_subslot *ss, uint32_t callref);
|
||||
|
||||
/* we get called by subchan_demux */
|
||||
int trau_mux_input(struct gsm_e1_subslot *src_e1_ss,
|
||||
const u_int8_t *trau_bits, int num_bits);
|
||||
const uint8_t *trau_bits, int num_bits);
|
||||
|
||||
/* add a trau receiver */
|
||||
int trau_recv_lchan(struct gsm_lchan *lchan, u_int32_t callref);
|
||||
int trau_recv_lchan(struct gsm_lchan *lchan, uint32_t callref);
|
||||
|
||||
/* send trau from application */
|
||||
int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame);
|
||||
|
||||
/* callback invoked if we receive TRAU frames */
|
||||
int subch_cb(struct subch_demux *dmx, int ch, uint8_t *data, int len, void *_priv);
|
||||
|
||||
7
openbsc/include/openbsc/trau_upqueue.h
Normal file
7
openbsc/include/openbsc/trau_upqueue.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _TRAU_UPQUEUE_H
|
||||
#define _TRAU_UPQUEUE_H
|
||||
|
||||
void trau_tx_to_mncc(struct gsm_network *net, struct msgb *msg);
|
||||
|
||||
#endif /* _TRAU_UPQUEUE_H */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/* Handler function for mobile-originated USSD messages */
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);
|
||||
|
||||
|
||||
@@ -29,18 +29,20 @@ enum bsc_vty_node {
|
||||
NS_NODE,
|
||||
BSSGP_NODE,
|
||||
OML_NODE,
|
||||
E1INP_NODE,
|
||||
NAT_NODE,
|
||||
NAT_BSC_NODE,
|
||||
MSC_NODE,
|
||||
OM2K_NODE,
|
||||
TRUNK_NODE,
|
||||
PGROUP_NODE,
|
||||
MNCC_INT_NODE,
|
||||
};
|
||||
|
||||
extern int bsc_vty_is_config_node(struct vty *vty, int node);
|
||||
extern void bsc_replace_string(void *ctx, char **dst, const char *newstr);
|
||||
|
||||
int bsc_vty_init(void);
|
||||
struct log_info;
|
||||
int bsc_vty_init(const struct log_info *cat);
|
||||
int bsc_vty_init_extra(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
|
||||
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
|
||||
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(COVERAGE_LDFLAGS)
|
||||
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
|
||||
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
|
||||
|
||||
SUBDIRS = libcommon libabis libmgcp libbsc libmsc libtrau osmo-nitb osmo-bsc_mgcp utils ipaccess libgb gprs
|
||||
SUBDIRS = libcommon libmgcp libbsc libmsc libtrau libctrl osmo-nitb osmo-bsc_mgcp utils ipaccess libgb gprs
|
||||
|
||||
# Conditional modules
|
||||
if BUILD_NAT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
|
||||
AM_CFLAGS=-Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
|
||||
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(COVERAGE_LDFLAGS)
|
||||
AM_CFLAGS=-Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
|
||||
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
|
||||
OSMO_LIBS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS)
|
||||
|
||||
noinst_HEADERS = gprs_sndcp.h
|
||||
|
||||
@@ -12,11 +13,12 @@ endif
|
||||
|
||||
osmo_gbproxy_SOURCES = gb_proxy.c gb_proxy_main.c gb_proxy_vty.c
|
||||
osmo_gbproxy_LDADD = $(top_builddir)/src/libgb/libgb.a \
|
||||
$(top_builddir)/src/libcommon/libcommon.a
|
||||
$(top_builddir)/src/libcommon/libcommon.a \
|
||||
$(OSMO_LIBS)
|
||||
|
||||
osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.c \
|
||||
sgsn_main.c sgsn_vty.c sgsn_libgtp.c \
|
||||
gprs_llc.c gprs_llc_vty.c crc24.c
|
||||
osmo_sgsn_LDADD = $(top_builddir)/src/libgb/libgb.a \
|
||||
$(top_builddir)/src/libcommon/libcommon.a \
|
||||
-lgtp
|
||||
-lgtp $(OSMO_LIBS)
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <openbsc/crc24.h>
|
||||
|
||||
/* CRC24 table - FCS */
|
||||
static const u_int32_t tbl_crc24[256] = {
|
||||
static const uint32_t tbl_crc24[256] = {
|
||||
0x00000000, 0x00d6a776, 0x00f64557, 0x0020e221, 0x00b78115, 0x00612663, 0x0041c442, 0x00976334,
|
||||
0x00340991, 0x00e2aee7, 0x00c24cc6, 0x0014ebb0, 0x00838884, 0x00552ff2, 0x0075cdd3, 0x00a36aa5,
|
||||
0x00681322, 0x00beb454, 0x009e5675, 0x0048f103, 0x00df9237, 0x00093541, 0x0029d760, 0x00ff7016,
|
||||
@@ -60,7 +59,7 @@ static const u_int32_t tbl_crc24[256] = {
|
||||
|
||||
#define INIT_CRC24 0xffffff
|
||||
|
||||
u_int32_t crc24_calc(u_int32_t fcs, u_int8_t *cp, unsigned int len)
|
||||
uint32_t crc24_calc(uint32_t fcs, uint8_t *cp, unsigned int len)
|
||||
{
|
||||
while (len--)
|
||||
fcs = (fcs >> 8) ^ tbl_crc24[(fcs ^ *cp++) & 0xff];
|
||||
|
||||
@@ -27,11 +27,10 @@
|
||||
#include <errno.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
#include <openbsc/signal.h>
|
||||
#include <openbsc/debug.h>
|
||||
|
||||
@@ -28,15 +28,14 @@
|
||||
#include <signal.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocore/rate_ctr.h>
|
||||
#include <osmocore/process.h>
|
||||
#include <osmocom/core/application.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/select.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
|
||||
#include <openbsc/signal.h>
|
||||
#include <openbsc/debug.h>
|
||||
@@ -47,6 +46,7 @@
|
||||
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/vty/telnet_interface.h>
|
||||
#include <osmocom/vty/logging.h>
|
||||
|
||||
#include "../../bscconfig.h"
|
||||
|
||||
@@ -64,7 +64,6 @@ const char *openbsc_copyright =
|
||||
"This is free software: you are free to change and redistribute it.\r\n"
|
||||
"There is NO WARRANTY, to the extent permitted by law.\r\n";
|
||||
|
||||
static struct log_target *stderr_target;
|
||||
static char *config_file = "osmo_gbproxy.cfg";
|
||||
struct gbproxy_config gbcfg;
|
||||
static int daemonize = 0;
|
||||
@@ -74,7 +73,7 @@ extern struct gbprox_peer *gbprox_peer_sgsn;
|
||||
|
||||
/* call-back function for the NS protocol */
|
||||
static int proxy_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
|
||||
struct msgb *msg, u_int16_t bvci)
|
||||
struct msgb *msg, uint16_t bvci)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
@@ -98,7 +97,7 @@ static void signal_handler(int signal)
|
||||
|
||||
switch (signal) {
|
||||
case SIGINT:
|
||||
dispatch_signal(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
|
||||
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
|
||||
sleep(1);
|
||||
exit(0);
|
||||
break;
|
||||
@@ -162,10 +161,10 @@ static void handle_options(int argc, char **argv)
|
||||
print_help();
|
||||
exit(0);
|
||||
case 's':
|
||||
log_set_use_color(stderr_target, 0);
|
||||
log_set_use_color(osmo_stderr_target, 0);
|
||||
break;
|
||||
case 'd':
|
||||
log_parse_category_mask(stderr_target, optarg);
|
||||
log_parse_category_mask(osmo_stderr_target, optarg);
|
||||
break;
|
||||
case 'D':
|
||||
daemonize = 1;
|
||||
@@ -174,10 +173,10 @@ static void handle_options(int argc, char **argv)
|
||||
config_file = strdup(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
log_set_print_timestamp(stderr_target, 1);
|
||||
log_set_print_timestamp(osmo_stderr_target, 1);
|
||||
break;
|
||||
case 'e':
|
||||
log_set_log_level(stderr_target, atoi(optarg));
|
||||
log_set_log_level(osmo_stderr_target, atoi(optarg));
|
||||
break;
|
||||
case 'V':
|
||||
print_version(1);
|
||||
@@ -212,16 +211,13 @@ int main(int argc, char **argv)
|
||||
signal(SIGABRT, &signal_handler);
|
||||
signal(SIGUSR1, &signal_handler);
|
||||
signal(SIGUSR2, &signal_handler);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
osmo_init_ignore_signals();
|
||||
|
||||
log_init(&log_info);
|
||||
stderr_target = log_target_create_stderr();
|
||||
log_add_target(stderr_target);
|
||||
log_set_all_filter(stderr_target, 1);
|
||||
osmo_init_logging(&log_info);
|
||||
|
||||
vty_info.copyright = openbsc_copyright;
|
||||
vty_init(&vty_info);
|
||||
logging_vty_add_cmds();
|
||||
logging_vty_add_cmds(&log_info);
|
||||
gbproxy_vty_init();
|
||||
|
||||
handle_options(argc, argv);
|
||||
@@ -239,7 +235,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
gbcfg.nsi = bssgp_nsi;
|
||||
gprs_ns_vty_init(bssgp_nsi);
|
||||
register_signal_handler(SS_NS, &gbprox_signal, NULL);
|
||||
osmo_signal_register_handler(SS_NS, &gbprox_signal, NULL);
|
||||
|
||||
rc = gbproxy_parse_config(config_file, &gbcfg);
|
||||
if (rc < 0) {
|
||||
@@ -279,7 +275,7 @@ int main(int argc, char **argv)
|
||||
gbprox_reset_persistent_nsvcs(bssgp_nsi);
|
||||
|
||||
while (1) {
|
||||
rc = bsc_select_main(0);
|
||||
rc = osmo_select_main(0);
|
||||
if (rc < 0)
|
||||
exit(3);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/gb_proxy.h>
|
||||
@@ -66,7 +65,9 @@ DEFUN(cfg_gbproxy,
|
||||
DEFUN(cfg_nsip_sgsn_nsei,
|
||||
cfg_nsip_sgsn_nsei_cmd,
|
||||
"sgsn nsei <0-65534>",
|
||||
"Set the NSEI to be used in the connection with the SGSN")
|
||||
"SGSN information\n"
|
||||
"NSEI to be used in the connection with the SGSN\n"
|
||||
"The NSEI\n")
|
||||
{
|
||||
unsigned int port = atoi(argv[0]);
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <openbsc/db.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/tlv.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
#include <osmocore/signal.h>
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocore/rate_ctr.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <osmocom/gsm/gsm_utils.h>
|
||||
#include <osmocom/core/signal.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
@@ -208,7 +208,7 @@ static void mmctx_timer_cb(void *_mm);
|
||||
static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
|
||||
unsigned int seconds)
|
||||
{
|
||||
if (bsc_timer_pending(&mm->timer))
|
||||
if (osmo_timer_pending(&mm->timer))
|
||||
LOGP(DMM, LOGL_ERROR, "Starting MM timer %u while old "
|
||||
"timer %u pending\n", T, mm->T);
|
||||
mm->T = T;
|
||||
@@ -218,7 +218,7 @@ static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
|
||||
mm->timer.data = mm;
|
||||
mm->timer.cb = &mmctx_timer_cb;
|
||||
|
||||
bsc_schedule_timer(&mm->timer, seconds, 0);
|
||||
osmo_timer_schedule(&mm->timer, seconds, 0);
|
||||
}
|
||||
|
||||
static void mmctx_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T)
|
||||
@@ -226,12 +226,12 @@ static void mmctx_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T)
|
||||
if (mm->T != T)
|
||||
LOGP(DMM, LOGL_ERROR, "Stopping MM timer %u but "
|
||||
"%u is running\n", T, mm->T);
|
||||
bsc_del_timer(&mm->timer);
|
||||
osmo_timer_del(&mm->timer);
|
||||
}
|
||||
|
||||
/* Send a message through the underlying layer */
|
||||
static int gsm48_gmm_sendmsg(struct msgb *msg, int command,
|
||||
const struct sgsn_mm_ctx *mm)
|
||||
struct sgsn_mm_ctx *mm)
|
||||
{
|
||||
if (mm)
|
||||
rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_SIG_OUT]);
|
||||
@@ -463,7 +463,7 @@ static int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm, uint8_t *rand,
|
||||
uint8_t *m_rand, *m_cksn;
|
||||
|
||||
DEBUGP(DMM, "<- GPRS AUTH AND CIPHERING REQ (rand = %s)\n",
|
||||
hexdump(rand, 16));
|
||||
osmo_hexdump(rand, 16));
|
||||
|
||||
mmctx2msgid(msg, mm);
|
||||
|
||||
@@ -598,7 +598,7 @@ static int gsm48_rx_gmm_id_resp(struct sgsn_mm_ctx *ctx, struct msgb *msg)
|
||||
struct sgsn_mm_ctx *ictx;
|
||||
ictx = sgsn_mm_ctx_by_imsi(mi_string);
|
||||
if (ictx) {
|
||||
DEBUGP(DMM, "Deleting old MM Context for same IMSI ",
|
||||
DEBUGP(DMM, "Deleting old MM Context for same IMSI "
|
||||
"p_tmsi_old=0x%08x, p_tmsi_new=0x%08x\n",
|
||||
ictx->p_tmsi, ctx->p_tmsi);
|
||||
gprs_llgmm_assign(ictx->llme, ictx->tlli,
|
||||
@@ -675,8 +675,9 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
/* MS Radio Access Capability 10.5.5.12a */
|
||||
ms_ra_acc_cap_len = *cur++;
|
||||
ms_ra_acc_cap = cur;
|
||||
if (ms_ra_acc_cap_len > 51)
|
||||
if (ms_ra_acc_cap_len > 52)
|
||||
goto err_inval;
|
||||
cur += ms_ra_acc_cap_len;
|
||||
|
||||
/* Optional: Old P-TMSI Signature, Requested READY timer, TMSI Status */
|
||||
|
||||
@@ -735,8 +736,10 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
ctx->cell_id = cid;
|
||||
/* Update MM Context with other data */
|
||||
ctx->drx_parms = drx_par;
|
||||
ctx->ms_radio_access_capa.len = ms_ra_acc_cap_len;
|
||||
memcpy(ctx->ms_radio_access_capa.buf, ms_ra_acc_cap, ms_ra_acc_cap_len);
|
||||
ctx->ms_radio_access_capa.len = OSMO_MIN(ms_ra_acc_cap_len,
|
||||
sizeof((ctx->ms_radio_access_capa.buf)));
|
||||
memcpy(ctx->ms_radio_access_capa.buf, ms_ra_acc_cap,
|
||||
ctx->ms_radio_access_capa.len);
|
||||
ctx->ms_network_capa.len = msnc_len;
|
||||
memcpy(ctx->ms_network_capa.buf, msnc, msnc_len);
|
||||
|
||||
@@ -754,7 +757,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
|
||||
GPRS_ALGO_GEA0, NULL);
|
||||
|
||||
DEBUGPC(DMM, "\n");
|
||||
return ctx ? gsm48_gmm_authorize(ctx, GMM_T3350_MODE_ATT) : 0;
|
||||
return gsm48_gmm_authorize(ctx, GMM_T3350_MODE_ATT);
|
||||
|
||||
err_inval:
|
||||
DEBUGPC(DMM, "\n");
|
||||
@@ -864,7 +867,7 @@ static int gsm48_tx_gmm_ra_upd_rej(struct msgb *old_msg, uint8_t cause)
|
||||
}
|
||||
|
||||
static void process_ms_ctx_status(struct sgsn_mm_ctx *mmctx,
|
||||
uint16_t pdp_status)
|
||||
const uint8_t *pdp_status)
|
||||
{
|
||||
struct sgsn_pdp_ctx *pdp, *pdp2;
|
||||
/* 24.008 4.7.5.1.3: If the PDP context status information element is
|
||||
@@ -875,11 +878,20 @@ static void process_ms_ctx_status(struct sgsn_mm_ctx *mmctx,
|
||||
* being in state PDP-INACTIVE. */
|
||||
|
||||
llist_for_each_entry_safe(pdp, pdp2, &mmctx->pdp_list, list) {
|
||||
if (!(pdp_status & (1 << pdp->nsapi))) {
|
||||
LOGP(DMM, LOGL_NOTICE, "Dropping PDP context for NSAPI=%u "
|
||||
"due to PDP CTX STATUS IE= 0x%04x\n",
|
||||
pdp->nsapi, pdp_status);
|
||||
sgsn_delete_pdp_ctx(pdp);
|
||||
if (pdp->nsapi < 8) {
|
||||
if (!(pdp_status[0] & (1 << pdp->nsapi))) {
|
||||
LOGP(DMM, LOGL_NOTICE, "Dropping PDP context for NSAPI=%u "
|
||||
"due to PDP CTX STATUS IE= 0x%02x%02x\n",
|
||||
pdp->nsapi, pdp_status[1], pdp_status[0]);
|
||||
sgsn_delete_pdp_ctx(pdp);
|
||||
}
|
||||
} else {
|
||||
if (!(pdp_status[1] & (1 << (pdp->nsapi - 8)))) {
|
||||
LOGP(DMM, LOGL_NOTICE, "Dropping PDP context for NSAPI=%u "
|
||||
"due to PDP CTX STATUS IE= 0x%02x%02x\n",
|
||||
pdp->nsapi, pdp_status[1], pdp_status[0]);
|
||||
sgsn_delete_pdp_ctx(pdp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -910,6 +922,9 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
/* MS Radio Access Capability 10.5.5.12a */
|
||||
ms_ra_acc_cap_len = *cur++;
|
||||
ms_ra_acc_cap = cur;
|
||||
if (ms_ra_acc_cap_len > 52)
|
||||
return gsm48_tx_gmm_ra_upd_rej(msg, GMM_CAUSE_PROTO_ERR_UNSPEC);
|
||||
cur += ms_ra_acc_cap_len;
|
||||
|
||||
/* Optional: Old P-TMSI Signature, Requested READY timer, TMSI Status,
|
||||
* DRX parameter, MS network capability */
|
||||
@@ -930,6 +945,10 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
/* Look-up the MM context based on old RA-ID and TLLI */
|
||||
mmctx = sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &old_ra_id);
|
||||
if (!mmctx || mmctx->mm_state == GMM_DEREGISTERED) {
|
||||
/* send a XID reset to re-set all LLC sequence numbers
|
||||
* in the MS */
|
||||
DEBUGPC(DMM, " LLC XID RESET ");
|
||||
gprs_llgmm_reset(llme);
|
||||
/* The MS has to perform GPRS attach */
|
||||
DEBUGPC(DMM, " REJECT\n");
|
||||
/* Device is still IMSI atached for CS but initiate GPRS ATTACH */
|
||||
@@ -969,11 +988,13 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
/* Look at PDP Context Status IE and see if MS's view of
|
||||
* activated/deactivated NSAPIs agrees with our view */
|
||||
if (TLVP_PRESENT(&tp, GSM48_IE_GMM_PDP_CTX_STATUS)) {
|
||||
uint16_t pdp_status = ntohs(*(uint16_t *)
|
||||
TLVP_VAL(&tp, GSM48_IE_GMM_PDP_CTX_STATUS));
|
||||
const uint8_t *pdp_status = TLVP_VAL(&tp, GSM48_IE_GMM_PDP_CTX_STATUS);
|
||||
process_ms_ctx_status(mmctx, pdp_status);
|
||||
}
|
||||
|
||||
/* Make sure we are NORMAL (i.e. not SUSPENDED anymore) */
|
||||
mmctx->mm_state = GMM_REGISTERED_NORMAL;
|
||||
|
||||
/* Send RA UPDATE ACCEPT */
|
||||
return gsm48_tx_gmm_ra_upd_ack(mmctx);
|
||||
}
|
||||
@@ -1001,6 +1022,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
gh->msg_type != GSM48_MT_GMM_ATTACH_REQ &&
|
||||
gh->msg_type != GSM48_MT_GMM_RA_UPD_REQ) {
|
||||
LOGP(DMM, LOGL_NOTICE, "Cannot handle GMM for unknown MM CTX\n");
|
||||
gprs_llgmm_reset(llme);
|
||||
return gsm48_tx_gmm_status_oldmsg(msg, GMM_CAUSE_MS_ID_NOT_DERIVED);
|
||||
}
|
||||
|
||||
@@ -1029,6 +1051,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
mmctx->tlli = mmctx->tlli_new;
|
||||
gprs_llgmm_assign(mmctx->llme, 0xffffffff, mmctx->tlli_new,
|
||||
GPRS_ALGO_GEA0, NULL);
|
||||
rc = 0;
|
||||
break;
|
||||
case GSM48_MT_GMM_RA_UPD_COMPL:
|
||||
/* only in case SGSN offered new P-TMSI */
|
||||
@@ -1039,6 +1062,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
mmctx->tlli = mmctx->tlli_new;
|
||||
gprs_llgmm_assign(mmctx->llme, 0xffffffff, mmctx->tlli_new,
|
||||
GPRS_ALGO_GEA0, NULL);
|
||||
rc = 0;
|
||||
break;
|
||||
case GSM48_MT_GMM_PTMSI_REALL_COMPL:
|
||||
DEBUGP(DMM, "-> PTMSI REALLLICATION COMPLETE\n");
|
||||
@@ -1047,6 +1071,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
|
||||
/* Unassign the old TLLI */
|
||||
mmctx->tlli = mmctx->tlli_new;
|
||||
//gprs_llgmm_assign(mmctx->llme, 0xffffffff, mmctx->tlli_new, GPRS_ALGO_GEA0, NULL);
|
||||
rc = 0;
|
||||
break;
|
||||
case GSM48_MT_GMM_AUTH_CIPH_RESP:
|
||||
rc = gsm48_rx_gmm_auth_ciph_resp(mmctx, msg);
|
||||
@@ -1087,7 +1112,7 @@ static void mmctx_timer_cb(void *_mm)
|
||||
/* FIXME */
|
||||
break;
|
||||
}
|
||||
bsc_schedule_timer(&mm->timer, GSM0408_T3350_SECS, 0);
|
||||
osmo_timer_schedule(&mm->timer, GSM0408_T3350_SECS, 0);
|
||||
break;
|
||||
case 3360: /* waiting for AUTH AND CIPH RESP */
|
||||
if (mm->num_T_exp >= 5) {
|
||||
@@ -1096,7 +1121,7 @@ static void mmctx_timer_cb(void *_mm)
|
||||
break;
|
||||
}
|
||||
/* FIXME: re-transmit the respective msg and re-start timer */
|
||||
bsc_schedule_timer(&mm->timer, GSM0408_T3360_SECS, 0);
|
||||
osmo_timer_schedule(&mm->timer, GSM0408_T3360_SECS, 0);
|
||||
break;
|
||||
case 3370: /* waiting for IDENTITY RESPONSE */
|
||||
if (mm->num_T_exp >= 5) {
|
||||
@@ -1107,7 +1132,7 @@ static void mmctx_timer_cb(void *_mm)
|
||||
}
|
||||
/* re-tranmit IDENTITY REQUEST and re-start timer */
|
||||
gsm48_tx_gmm_id_req(mm, mm->t3370_id_type);
|
||||
bsc_schedule_timer(&mm->timer, GSM0408_T3370_SECS, 0);
|
||||
osmo_timer_schedule(&mm->timer, GSM0408_T3370_SECS, 0);
|
||||
break;
|
||||
default:
|
||||
LOGP(DMM, LOGL_ERROR, "timer expired in unknown mode %u\n",
|
||||
@@ -1122,7 +1147,7 @@ static void pdpctx_timer_cb(void *_mm);
|
||||
static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
|
||||
unsigned int seconds)
|
||||
{
|
||||
if (bsc_timer_pending(&pdp->timer))
|
||||
if (osmo_timer_pending(&pdp->timer))
|
||||
LOGP(DMM, LOGL_ERROR, "Starting MM timer %u while old "
|
||||
"timer %u pending\n", T, pdp->T);
|
||||
pdp->T = T;
|
||||
@@ -1132,7 +1157,7 @@ static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
|
||||
pdp->timer.data = pdp;
|
||||
pdp->timer.cb = &pdpctx_timer_cb;
|
||||
|
||||
bsc_schedule_timer(&pdp->timer, seconds, 0);
|
||||
osmo_timer_schedule(&pdp->timer, seconds, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1457,7 +1482,7 @@ static void pdpctx_timer_cb(void *_pdp)
|
||||
break;
|
||||
}
|
||||
gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_NET_FAIL);
|
||||
bsc_schedule_timer(&pdp->timer, GSM0408_T3395_SECS, 0);
|
||||
osmo_timer_schedule(&pdp->timer, GSM0408_T3395_SECS, 0);
|
||||
break;
|
||||
default:
|
||||
LOGP(DMM, LOGL_ERROR, "timer expired in unknown mode %u\n",
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <openbsc/debug.h>
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <openbsc/gprs_bssgp.h>
|
||||
#include <openbsc/gprs_llc.h>
|
||||
#include <openbsc/crc24.h>
|
||||
#include <openbsc/sgsn.h>
|
||||
|
||||
/* Section 8.9.9 LLC layer parameter default values */
|
||||
static const struct gprs_llc_params llc_default_params[] = {
|
||||
@@ -311,14 +312,15 @@ int gprs_llc_tx_u(struct msgb *msg, uint8_t sapi, int command,
|
||||
}
|
||||
|
||||
/* Send XID response to LLE */
|
||||
static int gprs_llc_tx_xid(struct gprs_llc_lle *lle, struct msgb *msg)
|
||||
static int gprs_llc_tx_xid(struct gprs_llc_lle *lle, struct msgb *msg,
|
||||
int command)
|
||||
{
|
||||
/* copy identifiers from LLE to ensure lower layers can route */
|
||||
msgb_tlli(msg) = lle->llme->tlli;
|
||||
msgb_bvci(msg) = lle->llme->bvci;
|
||||
msgb_nsei(msg) = lle->llme->nsei;
|
||||
|
||||
return gprs_llc_tx_u(msg, lle->sapi, 0, GPRS_LLC_U_XID, 1);
|
||||
return gprs_llc_tx_u(msg, lle->sapi, command, GPRS_LLC_U_XID, 1);
|
||||
}
|
||||
|
||||
/* Transmit a UI frame over the given SAPI */
|
||||
@@ -421,6 +423,54 @@ int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command,
|
||||
return gprs_bssgp_tx_dl_ud(msg, mmctx);
|
||||
}
|
||||
|
||||
/* According to 6.4.1.6 / Figure 11 */
|
||||
static int msgb_put_xid_par(struct msgb *msg, uint8_t type, uint8_t length, uint8_t *data)
|
||||
{
|
||||
uint8_t header_len = 1;
|
||||
uint8_t *cur;
|
||||
|
||||
/* type is a 5-bit field... */
|
||||
if (type > 0x1f)
|
||||
return -EINVAL;
|
||||
|
||||
if (length > 3)
|
||||
header_len = 2;
|
||||
|
||||
cur = msgb_put(msg, length + header_len);
|
||||
|
||||
/* build the header without or with XL bit */
|
||||
if (length <= 3) {
|
||||
*cur++ = (type << 2) | (length & 3);
|
||||
} else {
|
||||
*cur++ = 0x80 | (type << 2) | (length >> 6);
|
||||
*cur++ = (length << 2);
|
||||
}
|
||||
|
||||
/* copy over the payload of the parameter*/
|
||||
memcpy(cur, data, length);
|
||||
|
||||
return length + header_len;
|
||||
}
|
||||
|
||||
static void rx_llc_xid(struct gprs_llc_lle *lle,
|
||||
struct gprs_llc_hdr_parsed *gph)
|
||||
{
|
||||
/* FIXME: 8.5.3.3: check if XID is invalid */
|
||||
if (gph->is_cmd) {
|
||||
/* FIXME: implement XID negotiation using SNDCP */
|
||||
struct msgb *resp;
|
||||
uint8_t *xid;
|
||||
resp = msgb_alloc_headroom(4096, 1024, "LLC_XID");
|
||||
xid = msgb_put(resp, gph->data_len);
|
||||
memcpy(xid, gph->data, gph->data_len);
|
||||
gprs_llc_tx_xid(lle, resp, 0);
|
||||
} else {
|
||||
/* FIXME: if we had sent a XID reset, send
|
||||
* LLGMM-RESET.conf to GMM */
|
||||
/* FIXME: implement XID negotiation using SNDCP */
|
||||
}
|
||||
}
|
||||
|
||||
static void gprs_llc_hdr_dump(struct gprs_llc_hdr_parsed *gph)
|
||||
{
|
||||
DEBUGP(DLLC, "LLC SAPI=%u %c %c FCS=0x%06x",
|
||||
@@ -465,19 +515,12 @@ static int gprs_llc_hdr_rx(struct gprs_llc_hdr_parsed *gph,
|
||||
case GPRS_LLC_FRMR: /* Section 6.4.1.5 */
|
||||
break;
|
||||
case GPRS_LLC_XID: /* Section 6.4.1.6 */
|
||||
/* FIXME: implement XID negotiation using SNDCP */
|
||||
{
|
||||
struct msgb *resp;
|
||||
uint8_t *xid;
|
||||
resp = msgb_alloc_headroom(4096, 1024, "LLC_XID");
|
||||
xid = msgb_put(resp, gph->data_len);
|
||||
memcpy(xid, gph->data, gph->data_len);
|
||||
gprs_llc_tx_xid(lle, resp);
|
||||
}
|
||||
rx_llc_xid(lle, gph);
|
||||
break;
|
||||
case GPRS_LLC_UI:
|
||||
if (gph->seq_tx < lle->vu_recv) {
|
||||
LOGP(DLLC, LOGL_NOTICE, "TLLI=%08x dropping UI, vurecv %u <= %u\n",
|
||||
if (gprs_llc_is_retransmit(gph->seq_tx, lle->vu_recv)) {
|
||||
LOGP(DLLC, LOGL_NOTICE,
|
||||
"TLLI=%08x dropping UI, N(U=%d) not in window V(URV(UR:%d).\n",
|
||||
lle->llme ? lle->llme->tlli : -1,
|
||||
gph->seq_tx, lle->vu_recv);
|
||||
return -EIO;
|
||||
@@ -498,7 +541,6 @@ static int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
|
||||
uint8_t *llc_hdr, int len)
|
||||
{
|
||||
uint8_t *ctrl = llc_hdr+1;
|
||||
int is_sack = 0;
|
||||
|
||||
if (len <= CRC24_LENGTH)
|
||||
return -EIO;
|
||||
@@ -658,7 +700,7 @@ static int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
|
||||
int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv)
|
||||
{
|
||||
struct bssgp_ud_hdr *udh = (struct bssgp_ud_hdr *) msgb_bssgph(msg);
|
||||
struct gprs_llc_hdr *lh = msgb_llch(msg);
|
||||
struct gprs_llc_hdr *lh = (struct gprs_llc_hdr *) msgb_llch(msg);
|
||||
struct gprs_llc_hdr_parsed llhp;
|
||||
struct gprs_llc_lle *lle;
|
||||
int rc = 0;
|
||||
@@ -696,7 +738,7 @@ int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv)
|
||||
struct gprs_llc_llme *llme;
|
||||
/* FIXME: don't use the TLLI but the 0xFFFF unassigned? */
|
||||
llme = llme_alloc(msgb_tlli(msg));
|
||||
LOGP(DLLC, LOGL_DEBUG, "LLC RX: unknown TLLI 0x08x, "
|
||||
LOGP(DLLC, LOGL_DEBUG, "LLC RX: unknown TLLI 0x%08x, "
|
||||
"creating LLME on the fly\n", msgb_tlli(msg));
|
||||
lle = &llme->lle[llhp.sapi];
|
||||
} else {
|
||||
@@ -846,6 +888,21 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Chapter 7.2.1.2 LLGMM-RESET.req */
|
||||
int gprs_llgmm_reset(struct gprs_llc_llme *llme)
|
||||
{
|
||||
struct msgb *msg = msgb_alloc_headroom(4096, 1024, "LLC_XID");
|
||||
int random = rand();
|
||||
|
||||
/* First XID component must be RESET */
|
||||
msgb_put_xid_par(msg, GPRS_LLC_XID_T_RESET, 0, NULL);
|
||||
/* randomly select new IOV-UI */
|
||||
msgb_put_xid_par(msg, GPRS_LLC_XID_T_IOV_UI, 4, (uint8_t *) &random);
|
||||
|
||||
/* FIXME: Start T200, wait for XID response */
|
||||
return gprs_llc_tx_xid(&llme->lle[1], msg, 1);
|
||||
}
|
||||
|
||||
int gprs_llc_init(const char *cipher_plugin_path)
|
||||
{
|
||||
return gprs_cipher_load(cipher_plugin_path);
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/tlv.h>
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocore/rate_ctr.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/select.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/signal.h>
|
||||
#include <openbsc/gprs_llc.h>
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocore/rate_ctr.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <openbsc/gsm_subscriber.h>
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/gprs_sgsn.h>
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/timer.h>
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/timer.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <openbsc/debug.h>
|
||||
@@ -566,11 +566,15 @@ static int sndcp_ll_reset_ind(struct gprs_sndcp_entity *se)
|
||||
{
|
||||
/* treat all outstanding SNDCP-LLC request type primitives as not sent */
|
||||
/* reset all SNDCP XID parameters to default values */
|
||||
LOGP(DSNDCP, LOGL_NOTICE, "not implemented.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sndcp_ll_status_ind()
|
||||
{
|
||||
/* inform the SM sub-layer by means of SNSM-STATUS.req */
|
||||
LOGP(DSNDCP, LOGL_NOTICE, "not implemented.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _INT_SNDCP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
|
||||
/* A fragment queue header, maintaining list of fragments for one N-PDU */
|
||||
struct defrag_state {
|
||||
@@ -20,7 +20,7 @@ struct defrag_state {
|
||||
/* linked list of defrag_queue_entry: one for each fragment */
|
||||
struct llist_head frag_list;
|
||||
|
||||
struct timer_list timer;
|
||||
struct osmo_timer_list timer;
|
||||
};
|
||||
|
||||
/* See 6.7.1.2 Reassembly */
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/tlv.h>
|
||||
#include <osmocore/talloc.h>
|
||||
#include <osmocore/select.h>
|
||||
#include <osmocore/rate_ctr.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include <osmocom/gsm/tlv.h>
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/core/select.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/signal.h>
|
||||
#include <openbsc/gprs_llc.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user