Commit Graph

466 Commits

Author SHA1 Message Date
Max dcc193d3a6 Add control command to expire subscriber
It's equivalent of existing vty command: common part is extracted into
shared helper function.

Change-Id: I267886b7c79ed6d9c2f34a2e60d2972b7f4f4036
2018-01-05 10:10:35 +00:00
Max a263bb215b VLR: log subscriber update
* move log helpers to generic header
* log subscriber update

It's handy for troubleshooting issues with subscriber update via GSUP
from HLR.

Change-Id: I1958aeeb3ea99831c7e2c5ee9a6b59834baf4520
2017-12-31 11:01:46 +00:00
Max 7772c7de55 VLR: remove unused parameter
The expire_lu is never used but is printed for every subscriber. Let's
remove it to avoid confusion.

Change-Id: I6f7ad1670836384d1e6a58f47a13464fdbbf8509
2017-12-29 18:12:37 +01:00
Neels Hofmeyr facd57ac56 fix: properly cancel all Paging on IMSI Detach
It's not clear cut which code is responsible for canceling pending requests,
since the requests list is kept in vlr_subscr, but sending out Paging does
certainly not belong in the VLR. Place the requests cleanup in gsm_04_08.c.

Add to test_ms_timeout_paging() in msc_vlr_test_ms_timeout.c to verify that a
pending paging is canceled on IMSI Detach.

Change-Id: Ib8874a9d92f02b0826525b55518332f6899688fd
2017-12-20 23:07:10 +01:00
Neels Hofmeyr 2ff5bcdc38 fix paging: add timeout to discard unsuccessful paging
Currently, if there is no reply from the BSS / RNC, a subscriber will remain as
"already paged" forever, and is never going to be paged again. Even on IMSI
Detach, the pending request will keep a ref count on the vlr_subscr.

Add a paging timeout, as gsm_network->paging_timeout and in the VTY on the
'msc' node as 'paging timeout (default|<1-65535>'. (There is a 'network' /
'T3113' in OsmoBSC, but to not confuse the two, give this a different name.)

Add test_ms_timeout_paging() test to verify the timeout works.

I hit this while testing Paging across multiple hNodeB, when a UE lost
connection to the hNodeB. I noticed that no matter how long I wait, no Paging
is sent out anymore, and found this embarrassing issue. Good grief...

The choice of 10 seconds is taken from https://osmocom.org/issues/2756

Change-Id: I2db6f1e2ad341cf9c2cc7a21ec2fca0bae5b2db5
2017-12-20 23:07:10 +01:00
Neels Hofmeyr c1d69256f6 cosmetic: rename sccp_rx_udt and sccp_rx_dt to a_*
These rx functions are only used for the A interface, hence the names should
not suggest general SCCP rx (which Iu also has).

Change-Id: I6815c3d4dea4c2abfdff1cf0239ada6a9254f351
2017-12-20 16:14:50 +00:00
Neels Hofmeyr 76a10f569f drop unused T* timers (BSC land, not MSC)
Change-Id: If27899c90b7c79f25cd5fd5e2429cb3012d69744
2017-12-18 18:02:21 +01:00
Neels Hofmeyr 2ef2da54ab cosmetic prep: tell vlr_ops.set_ciph_mode() whether UMTS AKA is used
In case of UMTS AKA, the Kc for ciphering must be derived from the 3G auth
tokens. tuple->vec.kc was calculated from the GSM algorithm and is not
necessarily a match for the UMTS AKA tokens.

To decide (in an upcoming patch) whether to use UMTS AKA derived Kc or the Kc
from the auth vector, the set_ciph_mode() from vlr_ops needs to know whether
UMTS AKA is being used. This could possibly derived from the msc_conn_ref, but
all flags are already available in the vlr_lu_fsm and vlr_access_req_fsm. Hence
add a umts_aka flag to the set_ciph_mode() callback invocation. The VLR FSMs
thus decide whether UMTS AKA or GSM AKA is to be used during Ciphering Mode
Command, which makes more sense than re-implementing the same decision process
in the MSC.

I considered placing the Kc derivation in vlr_set_ciph_mode() and only tell the
MSC's set_ciph_mode() implementation the precise keys it should use, but the
RAN particulars, and whether a Kc is used at all, rather belong with the MSC.

Related: OS#2745
Prepares: If04e405426c55a81341747a9b450a69188525d5c
Change-Id: I983c48347faf4ee1b405d8174b4e006c904157cf
2017-12-18 05:18:11 +01:00
Neels Hofmeyr e3d72d7827 cosmetic prep: publish vlr_use_umts_aka() decision
During Set Ciphering Mode on GERAN, it is required to know whether UMTS AKA is
used to decide which Kc to pick. Change static function is_umts_auth() into
public vlr_use_umts_aka(), so future patches can re-use it.

Prepares: If04e405426c55a81341747a9b450a69188525d5c
Change-Id: I85d784c62ecbabdb6186a3dae4dcd554e7921041
2017-12-18 05:18:11 +01:00
Neels Hofmeyr 703638e79a cosmetic: move translation of vlr_ciph into msc_vlr_set_ciph_mode()
a_iface_tx_cipher_mode() is a bit too far away from the VLR to be handling its
ciphering enums. Instead, construct the gsm0808_encrypt_info in the
msc_vlr_set_ciph_mode() callback.

Greatly simplify the sanity checking code: a_iface_tx_cipher_mode() no longer
needs to re-verify the presence of the gsm0808_encrypt_info contents.

Change-Id: Id46f9a513b555d0a481f7124c9984c2b5b196b3e
2017-12-18 05:18:11 +01:00
Neels Hofmeyr cf30913c8e fix BSSMAP Cipher Mode Cmd: properly set permitted algorithms
The bit shifting is performed in gsm0808_enc_encrypt_info(), and must not be
done when populating the gsm0808_encrypt_info struct.

Provide vlr_ciph_to_gsm0808_alg_id() to translate the enum vlr_ciph to the
GSM0808_* constants we need to put in the gsm0808_encrypt_info struct instead.

Related: OS#2745
Change-Id: If75f95e8a5cc8b9979610ce6d746c1f0073ee39a
2017-12-18 03:48:24 +01:00
Neels Hofmeyr fb21d9dde6 compiler warning: drop double 'const' in a_iface_tx_cipher_mode()
Change-Id: I3b8baa9a259704e719ce7f12776f2d2125ebdef0
2017-12-14 03:51:34 +01:00
Philipp Maier fe6acd6189 mncc: re-add lchan members to structs
The lchan related struct members do not serve any useful purpose
in the msc code, since the lchan concept is not in the scope of
osmo-msc. However, if removed te struct size will change which
will lead into shortened protocol messages as well. This is
is detected by osmo-sip-connector and eventually leads into
a reject ofthe shortended protocol messages.

Re add the missing struct members in order to maintain
compatibility

This commit reverts the changes made to mncc.h by commit:
e2f24d53e4

Change-Id: Ia02373a36df7605507ee3de49173a9fd6547b726
2017-12-05 18:42:48 +00:00
Neels Hofmeyr 6166f29412 subscr_conn: introduce usage tokens for ref error tracking
When hunting a conn use count bug, it was very hard to figure out who's (not)
using the conn. To ease tracking down this bug and future bugs, explicitly name
what a conn is being reserved for, and track in a bit mask.

Show in the DREF logs what uses and un-uses a conn. See the test expectation
updates, which nicely show how that clarifies the state of the conn in the
logs.

On errors, log them, but don't fail hard: if one conn use/un-use fails, we
don't want to crash the entire MSC before we have to.

Change-Id: I259aa0eec41efebb4c8221275219433eafaa549b
2017-11-27 15:40:01 +01:00
Neels Hofmeyr 1a5bcd5c3b sub_pres_vlr_fsm_start: fix heap use after free
When sub_pres_vlr_fsm_start() is called, it dispatches an event which may in
some cases already cause tear down and free of the parent FSM instance, after
which storing the returned instance pointer in that parent's metadata will use
freed memory. Instead, pass the target pointer to remember the instance at to
sub_pres_vlr_fsm_start() and assign the pointer *before* firing the event.

Explain so in a new comment.

I haven't checked whether that pointer is actually used at all -- this is the
easiest way to fix the use-after-free without getting sucked into semantic
questions.

Change-Id: Ibdc0b64cd12ba3e2b9737e3517d8484e67abcf04
2017-11-20 13:49:32 +00:00
Neels Hofmeyr c6bf27466c rate_ctr: don't use . as separator
Use ':' as separator, so that no mangled rate_ctr descriptions are allocated.

When '.' is used, the rate_ctr mangling code creates tallocs of mangled counter
descriptors, and hence affects the amount of expected talloc contexts in
msc_vlr_tests.c.

Change-Id: Ib1db8e3dc6c833174f1b0b1ca051b0861f477408
2017-11-20 13:49:32 +00:00
Neels Hofmeyr 33f534136c cosmetic: vlr: rename auth_tuple_max_use_count to _reuse_
The name auth_tuple_max_use_count suggests that if I want to use each auth
tuple exactly once, I need to set it to 1. Curiously, so far you need to set
to intended uses - 1.

Reflect this in its name by renaming to auth_tuple_max_reuse_count.

I first considered to not rename but change the if-conditions so that == 1
means each tuple is used once, and upon struct vlr allocation, set the default
to 1. That would also logically entail that setting to 0 means to re-use
vectors infinitely often, like now a value < 0 does. That means, when
allocating a vlr struct zeroed out, we would by default have the most
dangerous/unsafe configuration. It's no problem to set a default to 1 upon
allocation, but by renaming the variable instead, we get safer alloc-zero
behavior and don't need to change any conditionals in the code (even though the
patch ends up considerably larger from all the renaming).

Change-Id: I0b036cae1536d5d6fb2304f837ed1a6c3713be55
2017-10-31 02:02:43 +01:00
Max 61cacb0aaa Remove pkg-config file
It's an artefact of split which is unused anyway.

Change-Id: I15c0b4457c108c7791b0f30b79660d9e6d09b269
2017-10-16 15:29:26 +02:00
Harald Welte 5c76e0aa1a remove further files and autotest/autoconf bits irrelevant to osmo-msc
Change-Id: I68e879e7474cbd3dd053f23bc4d5d22dc2748c5b
2017-10-03 09:44:23 +08:00
Max a8b1aac5bc Remove unused osmo_bsc_rf.h header
Change-Id: I7a668665b571d00a6a34629626ddbfb60b6c09cc
2017-09-15 14:18:35 +02:00
Max e591d479dd Remove BTS-specific attributes
Remove *bts_model_* functions as they are only useful to BSC.

Change-Id: Ic80d11d6f8167b49a94fc9c6edbc5ff9fbe36587
2017-09-15 14:15:52 +02:00
Max f953d8bbb2 Remove SI-related code
Get rid of unused data structures and functions related to SI handling.

Change-Id: I048885e85a9f97b8b071f3a3f1c362b54a44720e
2017-09-15 13:52:52 +02:00
Max 43b01b0514 Remove rest_octets.h
The MSC should not fiddle with low-level SI details like rest octets
anyway. Unfortunately simply removing the header is impossible as it
causes massive fallout due to missing includes. Fixed it as well.

The only other parameter which required removal is cell_ro_sel_par which
is not referenced anywhere in the code anyway.

Change-Id: Ibff77330de056fad4288cd4c48d016aad8105354
2017-09-15 11:31:03 +02:00
Philipp Maier 4502f5ff58 a_iface: fix memory leaks
Fix multiple memory leaske in A/BSSMAP code

Change-Id: I90703c96e6a266a1cfa60b184139375aeb9ae32d
2017-09-11 10:14:00 +02:00
Neels Hofmeyr 6c8afe148b use separated libosmo-mgcp-client, apply rename to mgcp_client_*
After osmo-mgw changes I8e0b2d2a399b77086a36606f5e427271c6242df1 and
I99f7faab637cfcc22ece64a1dbcbe590f2042187, apply linking of new
libosmo-mgcp-client and renames to drop the "gw" from mgcp_client_*.

Also rename the gsm_network.mgcpgw to mgw, to indicate that the MGCP client is
used to contact the MGW (Media Gateway).

Depends: I8e0b2d2a399b77086a36606f5e427271c6242df1 (osmo-mgw)
         I99f7faab637cfcc22ece64a1dbcbe590f2042187 (osmo-mgw)
Change-Id: I093ad02ca0e532f659447c785e09678b3e6f220d
2017-09-08 23:47:37 +00:00
Neels Hofmeyr 9084396467 rename include/openbsc to include/osmocom/msc
Change-Id: I1f96a1285bbd1b4607614856bca935d5c26e2da9
2017-09-06 16:41:25 +02:00
Neels Hofmeyr bac227653a split off osmo-msc: remove files, apply build, rename
Change-Id: Icf025e5ea8d180613b3114282951c9afa67af9a7
2017-08-29 12:51:19 +00:00
Neels Hofmeyr 979cd26f35 move to osmo-mgw.git: osmo-bsc_mgcp and libmgcp as libosmo-legacy-mgcp
Rewire build and includes to libosmo-legacy-mgcp.

Drop osmo-bsc_mgcp and related python tests, now found in osmo-mgw.git.

libosmo-legacy-mgcp is installed from osmo-mgw, hence add the dependency to
jenkins.sh (so far using the pre_release branch).

Change-Id: Ic99d681759edce11564da62500c2aac5cf5fffe2
2017-08-29 12:51:19 +00:00
Neels Hofmeyr 00e82d61ab move libiu to osmo-iuh/libosmo-ranap
Remove libiu here, use the functions from libosmo-ranap instead, by applying
the ranap_ / RANAP_ prefix.

Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0

To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers
available, add iu_dummy.h, containing mere function signatures that match
iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx.

Make sure we can build with and without --enable-iu: include osmo-iuh headers
only with --enable-iu.

Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
2017-08-29 12:51:18 +00:00
Philipp Maier fbf6610dc1 Implement AoIP, port to M3UA SIGTRAN (large addition and refactoring)
This was originally a long series of commits converging to the final result
seen in this patch. It does not make much sense to review the smaller steps'
trial and error, we need to review this entire change as a whole.

Implement AoIP in osmo-msc and osmo-bsc.

Change over to the new libosmo-sigtran API with support for proper
SCCP/M3UA/SCTP stacking, as mandated by 3GPP specifications for the IuCS and
IuPS interfaces.

From here on, a separate osmo-stp process is required for SCCP routing between
OsmoBSC / OsmoHNBGW <-> OsmoMSC / OsmoSGSN

jenkins.sh: build from libosmo-sccp and osmo-iuh master branches now for new
M3UA SIGTRAN.

Patch-by: pmaier, nhofmeyr, laforge
Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
2017-08-29 12:51:18 +00:00
Keith Whyte c601adcb89 libmsc: Use actual delivery time in delivery reports.
Set the time on the status report to the time the message was delivered, as
this may not be the same as the time when we are delivering the report to the
originating MS.

Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
2017-08-27 02:33:50 +02:00
Harald Welte 586e6819eb Migrate from gprs_apn_to_str() to libosmocore osmo_apn_to_str()
In 2015, Jacob moved/copied related functions to libosmocore, but
for some reason didn't remove the copies here.  Let's follow-up on
that and remove duplicated code.

The libosmocore commit introducing osmo_apn_to_str() was
8114294bf29ac6e44822c0ae43d4b0819f11b022

Change-Id: I7315ffcbed8a54cca2056f313bb7783ad82d0ee9
2017-08-27 02:33:49 +02:00
Pau Espin e93fad8043 mgcp_osmux: Remove unused parameter
Change-Id: Icb1e7cb15fe04642578f5292124ebc1eac9c9aa3
2017-08-27 02:33:49 +02:00
Alexander Chemeris 3d18dda61a libcommon: Fix log output for bts>0.
Fixes regression probably introduced in c696cc28.

For bts>0 logging doesn't show bts number correctly when printing lchan
identification string - it will always show it as "bts=0". The reason for
this is that the identification string is cached before bts->nr value is
set to a proper value.

This patch sets bts->nr as part of the first step of the bts structure
initialization, before caching happens thus making sure the cached
identification string is cached with the correct values.

Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d
2017-08-27 02:33:49 +02:00
Pablo Neira Ayuso adae859eeb libmsc: add support for SMPP delivery receipts
If the mobile phone requests a status report via SMS, send a DELIVER_SM
with esm_class = Delivery Receipt to ESME to indicate that the SMS has
been already delivered to its destination.

    MS        GSM 03.40           SMSC       SMPP 3.4               ESME
     |                             |                                |
     |       SMS-DELIVER           |                                |
     |<----------------------------|                                |
     |     GSM 04.11 RP-ACK        |                                |
     |---------------------------->|                                |
     |                             |           DELIVER-SM           |
     |                             |  esm_class = Delivery Receipt  |
     |                             |------------------------------->|
     |                             |         DELIVER-SM-RESP        |
     |                             |<-------------------------------|
     |                             |                                |

This patch implements "Appendix B. Delivery Receipt Format" as specified
in the SMPP 3.4 specs. This string is conveyed in the SMS message as
data, and it is only meaningful to the ESME, for logging purposes. The
"submit date" and "done date" are not yet set, and other fields are just
sent with dummy values, so they are left to be finished as future work.

The new SMPP TLV tag TLVID_user_message_reference is added to the SMPP
messages inconditionally now since this information is required by
delivery-reports to associate the status-report with the original SMS.

Change-Id: Ic1a9023074bfa938099377980b6aff9b262fab2a
2017-08-27 02:33:49 +02:00
Harald Welte 5d1fa89819 GSM timers: User reasonable defaults; don't save if equal default
A number of the GSM timers (including T3109) had no reasonable
default values if not specified in the VTY / config file.  Together
with unconditional writing to the config file, this created
config files with a persistent setting for important timers as '0'.

To make things worse, many of our example cofig files suffered from the
same problem.

Let's avoid this from happening by
* having reasonable defaults if nothing specified in the config file
* conditionally savingg timers only if they differ from default
* reject any timer values that state zero during start-up (see previous
  commit)

Change-Id: Iaac0bfca423852b61d8b9eb1438157ef00d0d8c8
Closes: OS#2380
2017-08-27 02:33:48 +02:00
Harald Welte eac38c3fa8 Support for TS 04.14 conformance test commands
Change-Id: Ib27edbfc8ccdedf00589ec715ced7bed435fa94c
2017-08-27 02:33:48 +02:00
Holger Hans Peter Freyther 9d6f0625f7 sgsn: Fill the cch_pdp with a value coming from the tlv structure
For some GGSNs we need to insert the PDP Charging Characteristics
that were returned. We receive these values from GSUP and will
fill them into the tlv structure when finding the ggsn context.

Change-Id: I1725bfd2403d29ce3550bfcd6fcc1498426ef906
2017-08-27 02:33:48 +02:00
Neels Hofmeyr 4df72051f9 mgcp: hack RAB success from nano3G: patch first RTP payload
The ip.access nano3G needs the first RTP payload's first two bytes to read hex
'e400', or it will reject the RAB assignment. Add flag
patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on
a stream, and overwrite its first bytes with e400. This should probably be
configurable, but seems to not harm other femto cells (as long as we patch only
the first RTP payload in each stream). Only do this when sending to the BTS
side.

Related: OS#2459
Change-Id: I5eff04dcb0936e21690e427ae5e49228cd459bd4
2017-08-23 14:34:38 +02:00
Neels Hofmeyr 84da6b1edb Implement IuCS (large refactoring and addition)
osmo-nitb becomes osmo-msc
add DIUCS debug log constant
add iucs.[hc]
add msc vty, remove nitb vty
add libiudummy, to avoid linking Iu deps in tests
Use new msc_tx_dtap() instead of gsm0808_submit_dtap()
libmgcp: add mgcpgw client API
bridge calls via mgcpgw

Enable MSC specific CTRL commands, bsc_base_ctrl_cmds_install() still needs to
be split up.

Change-Id: I5b5b6a9678b458affa86800afb1ec726e66eed88
2017-08-08 19:17:53 +02:00
Neels Hofmeyr 4283675311 sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config
In an upcoming commit, sgsn_vty_init() will require access to the global sgsn
config struct to initialize a generic VTY command with the proper config
destination address, see Change-Id I5b5b6a9678b458affa86800afb1ec726e66eed88.

Change-Id: Ie6b6e5422987586531a898e0c5b867623dbecb0f
2017-08-08 19:17:53 +02:00
Neels Hofmeyr e2f24d53e4 mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.

Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.

Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").

move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().

libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.

Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.

Remove LCHAN_MODIFY from internal MNCC state machine.

Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.

msc_compl_l3(): publish in .h, tweak return value.  Use new libmsc enum values
for return val, to avoid dependency on libbsc headers.  Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c

add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc

gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.

Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.

Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-08-08 19:17:53 +02:00
Neels Hofmeyr 54a706cf92 vlr: LU FSM: enable Retrieve_IMEISV_If_Required
Change-Id: I121b95ad6d5ecb7603815eece2b43008de487a8a
2017-08-07 16:52:25 +02:00
Harald Welte 2483f1b050 Use libvlr in libmsc (large refactoring)
Original libvlr code is by Harald Welte <laforge@gnumonks.org>,
polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>.

This is a long series of trial-and-error development collapsed in one patch.
This may be split in smaller commits if reviewers prefer that. If we can keep
it as one, we have saved ourselves the additional separation work.

SMS:

The SQL based lookup of SMS for attached subscribers no longer works since the
SQL database no longer has the subscriber data. Replace with a round-robin on
the SMS recipient MSISDNs paired with a VLR subscriber RAM lookup whether the
subscriber is currently attached.

If there are many SMS for not-attached subscribers in the SMS database, this
will become inefficient: a DB hit returns a pending SMS, the RAM lookup will
reveal that the subscriber is not attached, after which the DB is hit for the
next SMS. It would become more efficient e.g. by having an MSISDN based hash
list for the VLR subscribers and by marking non-attached SMS recipients in the
SMS database so that they can be excluded with the SQL query already.

There is a sanity limit to do at most 100 db hits per attempt to find a pending
SMS. So if there are more than 100 stored SMS waiting for their recipients to
actually attach to the MSC, it may take more than one SMS queue trigger to
deliver SMS for subscribers that are actually attached.

This is not very beautiful, but is merely intended to carry us over to a time
when we have a proper separate SMSC entity.

Introduce gsm_subscriber_connection ref-counting in libmsc.

Remove/Disable VTY and CTRL commands to create subscribers, which is now a task
of the OsmoHLR. Adjust the python tests accordingly.

Remove VTY cmd subscriber-keep-in-ram.

Use OSMO_GSUP_PORT = 4222 instead of 2222. See
I4222e21686c823985be8ff1f16b1182be8ad6175.

So far use the LAC from conn->bts, will be replaced by conn->lac in
Id3705236350d5f69e447046b0a764bbabc3d493c.

Related: OS#1592 OS#1974
Change-Id: I639544a6cdda77a3aafc4e3446a55393f60e4050
2017-07-23 04:08:43 +02:00
Harald Welte b8b85a1b2e Add libvlr implementation
Original libvlr code is by Harald Welte <laforge@gnumonks.org>,
polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>.

This is a long series of trial-and-error development collapsed in one patch.
This may be split in smaller commits if reviewers prefer that. If we can keep
it as one, we have saved ourselves the additional separation work.

Related: OS#1592
Change-Id: Ie303c98f8c18e40c87c1b68474b35de332033622
2017-07-21 18:32:03 +02:00
Neels Hofmeyr f2ba81303e gsup_client: allow passing a unit id to identify with HLR
Before, each GSUP client would contact the HLR with an identical unit id, i.e.
"SGSN-00-00-00-00-00-00", with the result that some messages were sucked off by
the wrong client.

Pass explicit unit name from each gsup client user, so that OsmoMSC is "MSC"
and OsmoSGSN is "SGSN". Hence the HLR can properly route the messages.

Todo: also set some values instead of the zeros.

Unrelated cosmetic change while editing the arguments: gsup_client_create()'s
definition's oap client config arg name mismatched the one used in the
declaration. Use oapc_config in both.

Change-Id: I0a60681ab4a4d73e26fe8f0637447db4b6fe6eb2
2017-07-13 02:17:31 +00:00
Neels Hofmeyr 29b9206e80 move openbsc/* to repos root
This is the first step in creating this repository from the legacy openbsc.git.

Like all other Osmocom repositories, keep the autoconf and automake files in
the repository root. openbsc.git has been the sole exception, which ends now.

Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7
2017-07-12 23:17:10 +00:00
Harald Welte 13e10daa33 move openbsc into its own subdirectory 2009-06-10 05:40:52 +08:00
Harald Welte f7c43524cf * add support for storing classmark1/2/3 per subscriber
* add support for parsing measurement results (both BTS and MS side)
2009-06-09 20:24:21 +00:00
Harald Welte d3ff51dfe3 don't prefix every line with timestamp, this saves some screen real estate 2009-06-09 20:21:57 +00:00
Holger Freyther 6d9f77acd0 openbscdefines.h: Add header file to control visibility of symbols
Add the hooks/configure detection to compile everything with
-fvisibility=hidden and then make certain symbols visible. This
will be used to make parts of the API public.
There are no users yet but we should have some soon.
2009-06-08 10:32:54 +00:00
Holger Freyther 7c19f74084 lchan: Handle the abnormal case of channel getting closed
The abnormal case is that lchan_free ist getting called due
a RSL_MT_CHAN_REL_ACK in the RSL but the refcount of this
channel is not zero. This means that some "logical operation"
is still going on that needs to be cancelled.
Instead of always queuing up all operations in the
struct gsm_lchan use the signal framework to inform higher
layers about this abnormal case.

In gsm_04_08.c a signal handler is installed and in the
abnormal case the location updating request operation is
freed.
2009-06-06 13:54:35 +00:00
Holger Freyther c7b86f9011 Revert "[db] Keep track of the current gsm_network"
This was a stupid decision. We will have to assign the
network at some other place. The problem will be a problem
when we have two gsm_networks in one process and the same
subscriber is traveling in both networks.
2009-06-06 13:54:20 +00:00
Harald Welte 8b697c74c7 BS11: add nm_state for EnveBTES, PA and BBSIG physical objects 2009-06-05 19:18:45 +00:00
Holger Freyther c3d4b2d441 [subscr] Remove the struct gsm_bts pointer from subscriber
The pointer was initially added to support to open a lchan
by using the gsm_subscriber structure. We would have restored
the struct gsm_bts from the db when loading the subscriber.

Instead we will dynamically resolve the gsm_bts and might end
up paging multiple bts in the same (stored/old) location area
until it answers.
2009-06-04 14:27:39 +00:00
Holger Freyther 862cfff609 gsm_subscriber.h: Remove trailing whitespace...
Cosmetic changed
2009-06-04 14:15:33 +00:00
Holger Freyther 213b20bec0 [subscriber] Change id to long long unsigned int (Andreas Eversberg)
Changes the subscriber id type defintion from "long unsigned int" to "long
long unsigned int". Without, printf with '%llu' caused a crash.
2009-06-02 03:24:54 +00:00
Holger Freyther 4f584c3d4b [lchan] Log increase/decrease of channel use count (Andreas Eversberg)
This is part of patch 22 and will log changes in the usecount
of the lchan.
2009-06-02 02:55:07 +00:00
Harald Welte 7b26bcb1b5 * give Siemens ObjClass reasonable names rather than A3/A5/A6
* add nm_state objects for RACK and CCLK
* add obj_class human-readable printing for all vendor obj_classes
* add human-readable printing of administrative state
* add enum for cell_alloc numbers
2009-05-28 11:39:21 +00:00
Harald Welte 40f828936f show and edit subscribers from the vty interface 2009-05-23 17:31:39 +00:00
Harald Welte 78f2f508e6 Add user-configurable BSIC setting 2009-05-23 16:56:52 +00:00
Harald Welte 110c0ab6c5 * replace some more hex bytes in init msgs by #defines
* when using patch_tables(), use the ARFCN of the BTS, not the cmdline argument
2009-05-23 16:27:05 +00:00
Harald Welte 45b407ad25 With this patch, the TRAU muxing code supports not just bridging only.
A new function trau_recv_lchan() is used to link a channel to a call reference
of a transaction. (Transactions are used in later patches.) TRAU frames will
then be forwarded to the application with the given call reference (in later
patches). Also the application can send TRAU frames by using trau_send_lchan().

A new list is introduced in trau_mux.c. (upqueue_entry) All subslots
that must be sent to application are listed here.

Received TRAU frames are written in the upqueue of application
interface, if a call reference is found in the upqueue-list. If an entry
is found the ss_entry list, the TRAU frames are bridged as before. The
frames have a message type (msg_type), a call reference (callref) and a
trau frame (data). The length of trau frame is defined by the content of
the c-bits inside the frame.

There is no support for ip.access yet, as they don't use the traditional
TRAU frame format. Harald must add this in order to use application interface
with ip-access. The bridging with ip-access works as before.
(Andreas Eversberg)
2009-05-23 15:51:12 +00:00
Harald Welte be99149e72 add new function gsm_bts_by_lac() to search for BTS based on location area 2009-05-23 13:56:40 +00:00
Harald Welte c125a680ef A new debug flag is introduced: "DMNCC". MNCC is the Mobile Network Call
Control. This is required for later patches, that extract the call
control from gsm_04_08.c. (Andreas Eversberg)
2009-05-23 06:42:38 +00:00
Harald Welte a4d49e96ab Some messages have one or two length-value information elements. The is
no IE type included in the message. These information elements are
mandatory, so their actual IE type is known. The improved parse_tlv()
function allows to parse zero, one, or two length-value elements.
(Andreas Eversberg)
2009-05-23 06:39:58 +00:00
Harald Welte f55b49fef3 To slow down transmission of many ABIS frames at a time, a delay timer
is used for the E1's time slot. This timer replaces the "usleep()"
function, so the process will not block the execution of libbsc. The
timer is started after a frame is transmitted. If another frame is in
the transmit queue, the frame will only be queued until the timer times
out. If the timer is not running or times out, the frame is transmitted
and the timer is restarted.

The problem with partly provisioned TRX (locks show on LMT) is solved.
The adjustment for the inter frame delay of 50 miliseconds is for
further study.
(Andreas Eversberg)
2009-05-23 06:20:41 +00:00
Harald Welte 703af9887d fix some more compiler warnings 2009-05-23 06:14:44 +00:00
Harald Welte 04d3c9224f An application that has own events and file descriptors, must poll
select function ob libbsc. A "polling" flag is used to enable polling.
In this case select() will not sleep until file descriptor events occurr
or nearest timer expires. Also a return value will indicate if there was
an event that has been handled. If there was an event, the application
decides to poll again and don't wait.

In case for bsc_hack, the polling flag is not set. select will sleep as
usual.

(Andreas Eversberg)
2009-05-23 06:07:04 +00:00
Harald Welte 7572745816 Add missing "extern" prefix (Andreas Eversberg) 2009-05-23 05:26:29 +00:00
Harald Welte be68f6fc6c Change the variable "new" to "_new" in order to include it from C++ code.
The define "container_of" will cast pointer before assigning. Compilers
with stricter options require this. (Andreas Eversberg)
2009-05-23 05:24:48 +00:00
Harald Welte ff117a8d11 * rename the timer functions to avoid name collisions with libmisdn.
* the return value of bsc_update_timers() is required for applications to find out if a timer was fired
(Andreas Eversberg)
2009-05-23 05:22:08 +00:00
Harald Welte 12247c6713 Fix compilation issues on OS X - mainly #include file changes (Lars Immisch) 2009-05-21 07:23:02 +00:00
Harald Welte ef061951e6 dump CCLK accuracy/type as part of bs11_config query 2009-05-17 12:43:42 +00:00
Harald Welte cf5b3597ed add verbose reporting of RR STATUS cause 2009-05-01 18:28:42 +00:00
Harald Welte 0db97b253d abis_nm: print some information about failure event report type / severity 2009-05-01 17:22:47 +00:00
Harald Welte f9a8cc3cba send a signal for every software activation or failure event report 2009-05-01 15:39:49 +00:00
Harald Welte edb3778542 * Add support for multiple ip.access nanoBTS at one BSC
* keep track of site_id/bts_id in struct gsm_bts
 * dynamically match incoming OML/RSL over TCP connections by BTS Unit ID
 * introduce new debug category DINP (separate from DMI for hexdumps)
 * remove ia_config() as it is no longer needed
 * 
* ensure that signalling links / E1 line information is correctly printed
* when bootstrapping RSL or OML, tell us for which BTS it is being doen
* separate bootstrap_bts() out from bootstrap_network()
* statically configure two ip.access BTS, one with unit id's 1800/0/0 and 1801/0/0
2009-05-01 14:59:07 +00:00
Harald Welte 25de99170f add new 'ipaccess-config' program to set Unit ID and primary OML NVRAM parameters of ip.access BTS 2009-04-30 15:53:07 +00:00
Harald Welte 193fefc683 functionality to set nanoBTS NVRAM attributes and to restart BTS 2009-04-30 15:16:27 +00:00
Harald Welte 3bfbb84021 Add some more ip.access specific OML attributes/messages. In this case it is
about configuring the primary OML link IP address in the NVRAM of the device.
2009-04-29 22:58:38 +00:00
Harald Welte e69f5fb411 Add bs11_config commands to set the PLL mode from E1_LOCKED to STANDALONE
and vice-versa.  This has not yet been tested yet.
2009-04-28 16:31:38 +00:00
Holger Freyther b5c00f5587 [misdn] Add option to automatically release layer2 on exit
Patch by Andreas Eversberg to automatically release
layer2 on exit of the application. Made the naming of
the variables consistent (only release_l2 and not both
release_l2 and l2_release).
2009-04-22 22:08:07 +00:00
Holger Freyther dda22c18b5 [bsc_hack] Allow to select the cardnr defaulting to number 0
Patch from Andreas Eversberg to allow to select the ISDN
card number. The default remains the same.
2009-04-22 22:07:31 +00:00
Holger Freyther bcdebbfcab [bsc_hack] House keeping, remove dead code
This callback is not used from within the paging layer. We do
have a different set of callbacks in place. Remove it here.
2009-04-19 06:39:29 +00:00
Holger Freyther 36650b872f [db] Keep track of the current gsm_network 2009-04-19 06:35:16 +00:00
Holger Freyther a1f92f0a43 [subscriber] Introduce subscr_put_channel
Introduce subscr_put_channel to release a channel and to
allow gsm_subscriber.c to hand this channel to any suitable
pending requests.
2009-04-12 05:37:52 +00:00
Holger Freyther 4a49e77ff4 [subscriber] Update the current_bts field on imsi detach and LOC accept
When sending LOCATION UPDATING REQUEST Accept or when getting
a IMSI Detach update the gsm_bts of the gsm_subscriber.
2009-04-12 05:37:29 +00:00
Holger Freyther 0469cf608b [e1] Enable dumping of LAPD frames again
Kill mi_set_pcap_fd from the header, introduce e1_set_pcap_fd
and call it from bsc_hack.c. Hook into abis_rsl_sendmsg and
_abis_nm_sendmsg for sending and e1inp_rx_ts for reading. It compiles
and should not cause a regression.
2009-03-31 12:14:16 +00:00
Harald Welte 7e310b12ff Store incoming SMS into SQL database
* gsm_util now uses caller-allocated data (rather than callee-allocated)
* correctly parse destination address
* parse (but not transcode) non-default encodings of SMS
* reject SMS to unknown destination number
* resolve target subscriber id and store incoming SMS (without header) in 'sms' table

What we're now missing is the sending part, i.e. a regular task iterating over
all pending SMS and trying to deliver them.  Also, check for pending SMS once
we get a LOCATION UPDATE.
2009-03-30 20:56:32 +00:00
Harald Welte 273feca77f Fix 'delete-trx1' command of bs11_config (we can now delete TRX1) 2009-03-28 16:53:25 +00:00
Holger Freyther 1047940dce [misc] Make distcheck work again 2009-03-11 03:29:43 +00:00
Harald Welte c63e51daac * correctly handle VTY_READ/VTY_WRITE events and select loop integration of VTY 2009-03-10 19:46:16 +00:00
Harald Welte d256d4f19c * make sure we can obtain signalling type and timslot type names
* make sure every e1 timeslot has a valid backpointer to its line
2009-03-10 19:44:48 +00:00
Harald Welte 4d87f24e6f export nm_*_name() functions to get operational and availability state to strings 2009-03-10 19:43:44 +00:00
Harald Welte 44d542eba5 export list of e1 drivers and e1 lines 2009-03-10 18:24:35 +00:00
Harald Welte 404cdd8951 make telnet interface use VTY code 2009-03-10 12:21:45 +00:00
Harald Welte 68628e8479 add VTY dumping functions for OpenBSC 2009-03-10 12:17:57 +00:00
Harald Welte 955049f191 import VTY code from zebra/quagga (from my cardshell project) 2009-03-10 12:16:51 +00:00
Harald Welte 32201c1aea move is_ipaccess_bts() and parse_btstype9) to gsm_data.c 2009-03-10 12:15:10 +00:00
Harald Welte a27d8d2a91 add USSD protocol discriminator 2009-03-10 12:13:42 +00:00
Holger Freyther ff9592fa10 [misc] Fix compile warnings... 2009-03-09 16:17:14 +00:00
Harald Welte ddab3c78c5 introduce new 'mode' parameter to RSL ACTIVATE CHANNEL 2009-02-28 13:19:15 +00:00
Harald Welte 4a543e81cf * more RSL and 04.08 constant defines
* initialize some data structures before using them in RSL
* DATA_REQ is a transparent message
* more elaborate DEBUGP statements here and there
* don't call 04.08 with zero-length RSL DATA INDICATION
* reject 04.08 CC HOLD and RETRIEVE, as we don't support them yet
2009-02-28 13:17:55 +00:00
Harald Welte 02b0e093a1 make sure all channels in one BTS use the same TSC (training sequence code) 2009-02-28 13:11:07 +00:00
Harald Welte 3cc4bf517f make hexdump return a 'char *' rather than printing by itself 2009-02-28 13:08:01 +00:00
Holger Freyther 59da07bd0e [sms] Add test case for the 7-bit coding/decoding...
we don't pass it yet.
2009-02-23 00:50:38 +00:00
Holger Freyther 5775f46403 [misc] Fix make distcheck again... 2009-02-23 00:50:28 +00:00
Harald Welte 6154898753 fix paging response parsing for phase1 phones (classmar2 can be less than 4 bytes in length) 2009-02-22 21:26:29 +00:00
Harald Welte 2f74aa413b * location updating types
* struct for imsi detach
2009-02-22 21:14:04 +00:00
Harald Welte 5659d666fb add missing SET BS11 ATTRIBUTE NACK MT 2009-02-21 20:45:39 +00:00
Harald Welte b6c92ae782 * set OML TEI and E1 timeslot in one command
* introduce new 'oml-tei' command of bs11_config
2009-02-21 20:15:32 +00:00
Harald Welte 099d6100e6 fix various compiler warnings while building bs11_config 2009-02-21 12:59:58 +00:00
Harald Welte 7bc4cbc45c tlv_parser now operates on 'const' input buffer 2009-02-21 12:59:22 +00:00
Holger Freyther 3281f6e233 [build] Create a libbsc.a as noinst_LIBRARY, link bsc_hack and tests against it
Link the tests against the libbsc.a to avoid most of the breakage
when creating new symbols.
2009-02-20 18:33:00 +00:00
Harald Welte 23a686347d add gst_ts_name() function to obtain human-readable channel name 2009-02-19 17:06:42 +00:00
Harald Welte f1e6f96654 don't pass subchannel data to the TRAU decoder if we're not synchronized yet 2009-02-19 17:05:13 +00:00
Harald Welte 26aa6a1166 trau mux updates
* add function to map two lchans to each other
* make sure to evic old trau mux mappings before creating a new one
2009-02-19 15:14:23 +00:00
Harald Welte 78fc0d40a6 add various BS11 management related abis_nm functions 2009-02-19 02:50:57 +00:00
Harald Welte 0313394a88 * support BS11 specific IE types in abis_nm
* make bs11_config compile again 
* now that we have a proper TLV parser, use it to parse the status response on the serial port
2009-02-18 19:51:53 +00:00
Harald Welte 7eb1f621e0 "the big fix", of the E1 subchannel [de]multiplexer. I don't even remember how
many bugs I fixed during the last couple of hours.  It was never working at
any time before.
2009-02-18 03:40:58 +00:00
Harald Welte da78376396 * ensure TCH/F are activated signalling-only
* add function for RSL CHANNEL MODIFY REQUEST
* add missing channel activation function to header file
2009-02-18 03:29:53 +00:00
Harald Welte 8e4ae95e0b #defines for GSM48 channel modes 2009-02-18 03:28:01 +00:00
Harald Welte b480f41b57 add DMUX debug prefix 2009-02-18 03:27:39 +00:00
Holger Freyther 76c9569021 [utils] Create gsm_utils for 7bit encoding and decoding... 2009-02-17 20:31:30 +00:00
Harald Welte 49f48b8b77 various CC updates:
* correctly lchan_put the second lchan of a call at teardown
* map the RTP streams of ip.access onto each other
* fix bug that prevented a CONNECt message to ever reach the 'B' side
2009-02-17 15:29:33 +00:00
Harald Welte 167df88aae * increased debug verbosity for ip.access BIDND_ACK processing
* emit a signel when the BIND is acknowledged
2009-02-17 14:35:45 +00:00
Harald Welte 677c21f4ab add parsing for ip.access vendor specific NM messages 2009-02-17 13:22:23 +00:00
Harald Welte 7ccf77810b slightly more complete GSM 04.08 CC, we can now
* initiate phone calls from one MS
* look-up the subscriber based on dialled extension
* page the called subscriber
* send the SETUP to the called subscriber, including CLIP/CLIR
* get ALERTING notification back to caller
* relay DISCONNECT from either side to the other
This is still far from being complete, but it at least works for the most common case
2009-02-17 01:43:01 +00:00
Harald Welte 75a1fa834c switch paging code to use a timer again, since not all BTS send reliable CCCH load indications 2009-02-17 01:39:41 +00:00
Harald Welte 0932d1e2b4 forgot the header files in last commit. sigh. 2009-02-16 22:53:52 +00:00
Harald Welte e1b1338c88 add IEI values for GSM 04.11 2009-02-16 22:32:17 +00:00
Harald Welte 595ad7b762 modify the signal handler/dispatch code (sorry zecke, no offense, I just had some different ideas)
* introduce new notion of subsystem in addition to signal number
* no need for bitmasks of 'areas' (aka subsystems)
* pass subsystem/signal_nr/... per argument rather than by data structure
2009-02-16 22:05:44 +00:00
Harald Welte 7509926614 * introduce TLV parser definitions for RSL IE's
* introduce functions for ip.access specific RSL commands
2009-02-16 21:12:08 +00:00
Harald Welte e021254b64 introduce msgb_l2len() function 2009-02-16 21:09:34 +00:00
Holger Freyther 9b177760bb [sms] Send a notification on incoming SMS
Further tests of the signal class. Send a notification
on incoming SMS.
2009-02-16 19:07:18 +00:00
Harald Welte 0a23990be8 introduce msgb_l3len() function 2009-02-15 17:18:37 +00:00
Harald Welte d4c9bf3c5a * add bs_power and ms_power attributes to each channel and use them in channel activation 2009-02-15 16:56:18 +00:00
Harald Welte cd99387bd2 * use more constants to name the various BTS/TRX/... attributes
* set BS power reduction up to 30dB reduction.  we want to be quiet!
2009-02-15 16:16:28 +00:00
Harald Welte 4f361fcb68 * add commond header file for ipaccess protocol
* query for more attributes during ipaccess-find
2009-02-15 15:32:53 +00:00
Harald Welte 5c1e458376 Add support for ip.access RSL link on port 3003 2009-02-15 11:57:29 +00:00
Harald Welte 8c1d0e41a7 * add bsc_hack commandline argument to select BTS type
* add event-based OML bring-up for nanoBTS
2009-02-15 03:38:12 +00:00
Harald Welte e0590df524 * extend TLV parser to use a list of TLV type descriptions
* implement TLV type descriptions for NM
* add operational/administrative/availability state keeping logic to abis_nm
* explicitly print all NACK's in abis_nm
* make sure we produce [not just for BS-11] valid channel attributes
2009-02-15 03:34:15 +00:00
Holger Freyther e4b3fa3633 [signal] Move the area into the struct signal_data...
Remove the parameter and move the signal kind into the
signal struct. Make register/deregister fully symmetric.
2009-02-14 22:51:10 +00:00
Holger Freyther 2b2d2e350e [signal] Add generic signal registration and dispatch...
This will be used for generic registration and dispatching
of any kind of event. We will have different areas (like
with the debug interface) and each layer can define their
own struct for the event message... This is not tested yet
2009-02-14 22:51:00 +00:00
Harald Welte bbcc7a5bb8 introduce gsm_nm_state object in all our nm-relevant data structures 2009-02-14 19:45:44 +00:00
Harald Welte 2fa79349aa implement type1TV or type 2 detection 2009-02-14 19:07:10 +00:00
Harald Welte 22af0db588 * add comments for SET BTS ATTR and SET RADIO CARRIER ATTR
* use OPSTART on objects whose operational state is Disabled
2009-02-14 15:41:08 +00:00
Harald Welte 5fd8a545c8 preliminary ip.access BTS support, as of now only OML singalling works 2009-02-13 02:43:36 +00:00
Harald Welte 34a9968baf * more extensive A-bis OML support 2009-02-13 02:41:40 +00:00
Harald Welte 7584aeac42 * add more GSM 04.08 IEIs
* implement function for CHANNEL MODE MODIFY
* don't use hard-coded SETUP message but construct it with tlv functions
2009-02-11 11:44:12 +00:00
Harald Welte 45f83a10d8 include already-exported lchan2chan_nr() function in header file 2009-02-11 11:43:19 +00:00
Holger Freyther b1ffbb62ee [paging] Send paging requests as response to the PAGING LOAD indicator
Kill the paging timer and send paging upon paging load notifications.
2009-02-11 01:49:15 +00:00
Holger Freyther f6535bb444 [paging] Stop counting the requests... harald implemented sepc conform timer support
We do have a dispose timer, there is no need to discard the
paging request this way... remove the code.
2009-02-11 01:02:45 +00:00
Holger Freyther c009f3fa65 [misc] Add header files to fix make distcheck 2009-02-10 23:36:14 +00:00
Harald Welte cd06bfbc9d * fill the e1_link member of every bts_trx_ts structure
* introduce new timer as part of every paging request
2009-02-10 17:33:56 +00:00
Holger Freyther 392209cbb5 [paging] Introduce a variable containing the free paging slots
Start with a large number of available slots. It is guranteed
that we will - at some point - get a paging load and will properly
update the counter and keep it updated.
2009-02-10 00:06:19 +00:00
Holger Freyther 1fd34141c2 [paging] Cleanup page -> paging in function names 2009-02-09 23:42:03 +00:00
Holger Freyther 9c564b85e6 introduce lookup of subscribers based on their extension number 2009-02-09 23:39:20 +00:00
Harald Welte 1fa60c8ab0 * add trau_mux implementation to relay from one incoming TRAU
channel to another one (simple voice call switching)
* add a way more generic E1 input layer, abstracting out the misdn
  low-level interface. This also adds infrastructure for multiple TRX
  in one BTS, as well as multiple BTS on one E1 link
* add a E1 subchannel multiplexer for sending multiple 16kbit sub-channels
  one one 64kBps E1 channel
* add TRAU IDLE frame generation
* terminate bsc_hack in case there is a E1 / mISDN init error
* introduce 'e1_config.c' file with static configuration of our
  E1 setup (which TRX/BTS is configured for which TEI/SAPI/E1). This should
  later become a config file rather than a compiled C file.

WARNING: all this compiles but is not tested yet.  Expect fix-up committs over
the next hours or so
2009-02-09 18:13:26 +00:00
Harald Welte e79769b926 make sure certain functions are per TRX, not per BTS, such as
* rsl_chan_activate()
* rsl_bcch_info()
* rsl_sacch_filling()
2009-02-07 00:48:17 +00:00
Holger Freyther 7b2ef7ff4e [dist] Fix make distcheck by adding the new header files 2009-02-06 22:08:17 +00:00
Holger Freyther e64a7a3c3b [rr] Send a Channel Release before deactivating the channel
After auto releasing a channel the next paging request will
not be immediately answered. The hypothesis was that we do
not release the channel properly. Implementing Channel Release
of GSM 04.08 should have fixed it, but it didn't. According
to the wireshark dissectors the message is correct though.

- Add the RR cause values to gsm_04_08.
- Implement the Channel Release message
- Invoke the release channel function before deallocating
  the lchan.
2009-02-06 21:55:37 +00:00
Holger Freyther ceb59b72c2 [paging] Move the paging state into struct gsm_bts
There is a 1:1 relationship between gsm_bts and the paging
operation. Move the paging state into the gsm_bts which is
simplfying the code a lot. This was hinted by LaF0rge.

(I'm not happy with the names of the structs)
2009-02-06 18:54:00 +00:00
Harald Welte a7dbe49a19 BS11 logon message type 2009-02-06 16:44:37 +00:00
Harald Welte 763da00e97 add new routine to stop paging 2009-02-06 12:52:14 +00:00
Harald Welte 91b5b0d41d add some initial simplistic TLV parser 2009-02-06 12:51:39 +00:00
Harald Welte 6ddd1683b5 introduce new "DEBUGPC" macro for continuing on the same line without prefix of file/line/time 2009-02-06 12:38:29 +00:00
Harald Welte 2d35ae6d3b implement parsing of PAGING RESPONSE 2009-02-06 12:02:13 +00:00
Holger Freyther 3aa8d6c46d [paging] This is paging my phone but it looks completely wrong...
- The paging block calculation is wrong but I have a hard time finding
  the right information. The table of 05.02 (Table 5 of 9) looks good
  but my phone is not happy with that group...
2009-02-04 02:14:45 +00:00
Holger Freyther 2976c40cd1 [paging] Allow call the paging related helper functions
they alread had external linkage
2009-02-04 01:09:20 +00:00
Holger Freyther 1adb4ff002 [paging] Keep a copy of the Control Channel Description in the bts struct
- Initialize Control Channel Description of SI3 
- Patch the table
- Setting ATT now is easy
- Paging can now extract all required information... to determine
  the right paging group.
2009-02-04 00:04:52 +00:00
Holger Freyther b01554493f [rsl] Prepare to properly handle the paging command add defines to the RSL
For finding the right paging group one needs to know various
settings that are broadcasted as part of system settings 3. This
includes the CCCH Conf, the BS_PA_MFRMS, BS_AG_BLKS_RES.... The
next step will be to move away from the hardcoded System Settings 3
so one can calculate the paging group...
2009-02-03 23:24:04 +00:00
Harald Welte 3ffd1376b7 * add abis_nm_software_load_status() to header file
* new abis_nm_bs11_bsc_disconnect() function to disconnect BSC/BTS link
* add support for 'forced load' of BS-11 software to abis_nm.c and bs11_config
* remove lots of debug output
* print progress during software load
2009-02-01 22:15:49 +00:00
Harald Welte c12d52bae4 * improve parsing of status/phase response from BTS
* split rs232 support into separate file (like misdn.c)
2009-02-01 21:39:06 +00:00
Harald Welte 268bb40b35 * add more detailed status printout to bs11_config
* add support for real LMT logon time
* add support for abis external time
* move 'create_trx1_objects' to separate function
2009-02-01 19:11:56 +00:00
Harald Welte 4fc898a0d5 add missing 'requests' field that zecke probably forgot to commit 2009-02-01 17:57:04 +00:00
Harald Welte 5e4d1b3663 * rename NM_MT_BS11_LOGOFF to NM_MT_BS11_LMT_LOGOFF
* add more BS11 specific attributes
* define all valid BS11 PA power classes
* add callback function to software load
* introduce SWL load function for BS-11 style SWL file lists
* separate activation of software from loading of software
* add function to obtain BS-11 serial number
2009-02-01 13:36:56 +00:00
Harald Welte 8e1e3eece8 introduce generic callback function and hook enum 2009-02-01 13:32:45 +00:00
Harald Welte 043d04a99a * Use new NM_ATT_BS11 definitions instead of magic numbers
* rename FECTORY_LOGON into LMT_LOGON since it's not always factory level
2009-01-29 23:15:30 +00:00
Harald Welte 934e68bbcf more BS11 specific attribute definitions 2009-01-29 23:08:12 +00:00
Harald Welte 3b8ba215b9 * Fix BS11 software download routines in abis_nm.c
* Introduce user-configurable delay when sending serial msgs from bs11_config
2009-01-29 12:27:58 +00:00
Holger Freyther 245c534806 [pedantic] Declare abis_nm_bs11_reset_resource to avoid a warning in bsc_hack.c
This command is BS11 specific and was put in the appropriate section
of the header file.
2009-01-27 19:00:44 +00:00
Harald Welte f3066bb17e add zero-length data field to abis_fom_hdr 2009-01-18 19:02:46 +00:00
Harald Welte 4724f99d19 Implementation of GSM12.21 LOAD SOFTWARE (BS11 dialect thereof) 2009-01-18 18:01:49 +00:00
Harald Welte 978cb42911 add BTS TYPE field to facilitate future non-BS11 BTS support 2009-01-18 17:57:27 +00:00
Harald Welte 85770c7aa4 * use #define for number of TS in one TRX
* use data structure to indicate E1 timeslot/subslot for every TRX:TS
2009-01-18 17:47:32 +00:00
Harald Welte 1bc0906436 abis_nm: more BS11 specific messages for configuration 2009-01-18 14:17:52 +00:00
Harald Welte 05188ee7a7 * prefix all BS11 specific OML functions with proper name
* add more BS11 specific OML commands (TRX power, logon, OML TEI, ...)
2009-01-18 11:39:08 +00:00
Harald Welte adaf08bec8 add some more BS11 specific OML definitions 2009-01-18 11:08:10 +00:00
Harald Welte ba4cf164b0 Start working on CM Service Request
Be able to send Accept/Reject the Service Request. Use mi_string
instead of the the msgb buffer (even if it is memsetted and such)...

The TMSI allocation seems to be a bit problematic and needs some
further checking. The rough idea is that we try to find the subscriber
for a CM Service Request and then decide based on the subscriber
if we want to handle the call.
2009-01-10 01:49:35 +00:00
Harald Welte 38c2f13098 Hook the paging code into bsc_hack.c and telnet_interface.c
Wrote and test code to add and remove paging requests... This
will be using the fact that the linux list is building a circle
on each tick we can send one/x paging requests and continue round
robin...
2009-01-06 23:10:57 +00:00
Harald Welte b68899d3e3 Start creating a paging layer...
You can request to open a channel to a MS and the paging layer
will call you once the channel is allocated. Internally the CCCH
Load Indication will be handled and retry to page a terminal.
2009-01-06 21:47:18 +00:00
Harald Welte ce281c0772 add initializer function for subchan_demux 2009-01-05 20:14:14 +00:00
Harald Welte 418f5a4e25 * add function to change c-bits in TRAU frame from uplink to downlink
* add function to re-encode an exploded TRAU frame into a bit-per-byte stream
2009-01-05 20:12:47 +00:00
Harald Welte 38e04372e5 handle IDLE speech frames in trau_frame code 2009-01-05 19:42:46 +00:00
Harald Welte 2a8ee52ced add (untested) TRAU frame decoder with support for FR/EFR and AMR 2009-01-05 19:01:01 +00:00
Harald Welte 54bd94d8b7 add (untested) 16kbit E1 sub-channel demux with TRAU frame sync 2009-01-05 19:00:01 +00:00
Holger Freyther ca362a6028 Make gcc happy and remove a couple of warnings
Remove the callbacks from gsm_network for now. A set of different
callbacks will be back. E.g. when the paging is completed, when the
Q.931 like call handling is there...

Remove var's or move them into #if 0, remove unused stuff that looks
like we do not need it anytime soon or #if 0 them, move stuff around.
2009-01-04 21:05:01 +00:00
Holger Freyther 7448a53ddb Be able to initiate paging from the telnet interface
The actual paging by subscriber needs to be implemented
2009-01-04 20:18:23 +00:00
Holger Freyther a553d098e7 Export the gsm0411 alloc and send function 2009-01-04 20:16:25 +00:00
Harald Welte a72c98eb2f functions to convert lchan/pchan type into human-readable string 2009-01-04 16:10:38 +00:00
Harald Welte 47d88aecaf Add some functions to CREATE OBJECTs in the BS-11 internal database 2009-01-04 12:02:08 +00:00
Holger Freyther 3e2c32322e Make gsm48_sendmsg public as well 2009-01-04 03:55:31 +00:00
Holger Freyther 819dd205a9 Make gsm48_msgb_alloc public and usable for the telnet_interface 2009-01-04 03:52:50 +00:00
Holger Freyther f87573dc4e Implement put_channel/get_channel, save on which bts we currently operate
Allow to change the refcount for a given channel. Store which
bts is our primary bts. A command to switch the primary bts will
be added as well. This makes entering and parsing of commands more
easy.
2009-01-04 03:49:41 +00:00
Holger Freyther d0e38c3cad Add implementation to find a lchan by the struct gsm_subscriber
Really compare pointers to check if the one gsm_subscriber
is equal to the other... gsm_subscriber should be unique for
a given IMSI so comparing the pointers should be fine.
2009-01-04 03:48:30 +00:00
Holger Freyther a471a41680 Define the gsm_subscriber getter functions in the header 2009-01-04 03:47:05 +00:00
Harald Welte 4668fdaa26 define and use enum values for BS11 (or Siemens?) specific OML message types 2009-01-03 08:19:29 +00:00
Holger Freyther 460af8b794 Clean up struct gsm_network and remove the gsm_subscriber 2009-01-03 05:48:32 +00:00
Harald Welte b8f04ea5a9 Add new management function to struct timer_list
Make sure that del_timer succeeds and removes an entry from the list. Currently
sending the LOCATION UPDATING REJECT from within the timer will not remove the
list element as ->active gets set to 0 in the timer updating before calling the
callback. Fix the segfault and allow the timer to be removed from within its
own callback.
2009-01-02 23:57:22 +00:00
Holger Freyther 219518d064 Add simplistic telnet control interface
This might turn into a complete wire protocol with special
client software. For now it will be a simple client interface
that you can use with telnet to do certain things.

This is using flex to implement the parsing. Implementation
and more commands will follow.
2009-01-02 22:04:43 +00:00
Holger Freyther b21b305d7c Fix make distcheck by adding some header files 2009-01-02 02:00:35 +00:00
Holger Freyther 9a3ee0ff1b Add the option to write the communication on the D Channel to a pcap file
When using ISDN as network type and using a fake LAPD encapsulation
wireshark should be able to recognize some bits if dump.

Append a dummy LAPD header. It is not clear to me if the Control field
of the LAPD frame is part of the msg or if we need to add it as well.

TODO:
    - Do the same for the B Channel
    - Write out time
    - Check if more of the LAPD frame needs to be prepended. The
      information from the mISDNhead comes into mind. Maybe it makes
      sense to start a custom wireshark mISDN dissector.
2009-01-02 00:40:15 +00:00
Holger Freyther 12aa50d5a2 Change the subscriber and database backend
gsm_subscriber is now refcounted, the db backend is leaking
a lot less, db_get_subscriber will allocate the subscr record
now, subscr_* will look up a subscriber in the list of currently
active subscribers and add an ref to this one.

The db test cases pass, more testing will be when next to the bts
2009-01-01 18:02:05 +00:00
Holger Freyther 67b4b9a017 Do not call rsl_chan_release directly but use the use_count of the lchan
Call use_lchan early in allocate_loc_updating_req, do not directly call
rsl_chan_release but go through channel alloc to take the use_count into
account.
2009-01-01 03:46:11 +00:00
Holger Freyther 73487a23da Introduce logical updating request operation on the gsm_lchan
We are going to have logical operations like Phone Call, SMS,
Paging, Updating Request on a logical channel and for each of
these operations we might need to store state. For now pointers
in gsm_lchan look like the best way of doing this and we start
by introducing an operation for the location updating request.

The new flow of things are:
    - We get the location updating request and update/create
      the subscriber and maybe send the identity requests to
      the mobile station
    - We start the updating timer, if it times out we will
      reject the mobile station.
    - Once we get the Identity Responses we have asked for
      and the reject timer did not fire yet we might accept
      the user.
2008-12-31 18:53:57 +00:00
Holger Freyther e97f7fba97 Add an option to set the global reject cause
This will need to be moved into bsc_hack.c together with the
policy to accept/reject a UPDATING LOCATION REQUEST.
2008-12-31 18:52:11 +00:00
Holger Freyther c6ea9dbeba Recylce a gsm_lchan when the refcount drops to zero
When a channel is allocated, start a timeout, when a lchan_use
is used the timer will be restarted, when the timeout fires
we will try to recycle or restart the timer.
2008-12-30 19:18:21 +00:00
Holger Freyther 590d66acec Fix the reference. The names and values are described in 9.1 of 04.08 2008-12-30 19:13:13 +00:00
Harald Welte c6ba9c2a97 * 04:08: add MM INFO information elements
* gsm_data: add network name to gsm_network
2008-12-30 18:01:02 +00:00
Holger Freyther 89824fc466 Add an option to allow everyone to the network.
This should move out of gsm_04_08 and the accept, reject
policy should be controllable by the higher levels.
2008-12-30 16:18:18 +00:00
Holger Freyther a767794d96 [gsm0408] Add enum values for the LOCATION UPDATING REJECT cause
Convert spec to the enum
2008-12-30 16:18:16 +00:00
Harald Welte b0f4793f90 export debug_flags 2008-12-30 14:59:01 +00:00
Holger Freyther b7193e4e94 Introduce new callbacks, remember that we have LOC UPD REQ, reject things only once
gsm_data.h add new callbacks, add some parameters, update bsc_hack and
other call sites.

Remember that we need to ACCEPT/REJECT the LOCATION UPDATE REQUEST and
then send the ACCEPT or schedule the sending of the reject. Currently
it is possible that for a new subscriber that we do not have a !subscbr
yet, we will trigger an IDENTITY REQUEST and schedule the reject timer.
This may lead to rejecting AND accepting (a new subscriber). This issue
is triggered when allowing everyone to connect to the network.
2008-12-29 17:44:08 +00:00
Holger Freyther 2eafef599c Up on call released release the channel and take the next item
Once a call is released, release the gsm_lchan and move to the
next item in pending_stations or wait for more work.
2008-12-29 06:42:17 +00:00
Holger Freyther abade7af88 Initiate a call once we have a channel assigned 2008-12-29 06:42:15 +00:00
Holger Freyther 88ea832ed7 Unite the acked/nacked handling in a common response... 2008-12-29 06:23:52 +00:00
Holger Freyther 24893de3cb Inform the bsc about acked or nacked channels...
On channel allocation the bsc_hack added a cookie to the lchan on
ack and nack we will take a look and then assume it is the channel
we have allocated. This can be easily exploited by a MS sending fake
responses to paging commands. After the channel has been acked we would
have to ask for the tmsi or find the information on the channel
allocation. For now we will guess.
2008-12-29 06:23:51 +00:00
Holger Freyther 3186bf209a Add callback for allocated lchannels
Currently it is not possible to know for which tmsi the channel
is going to be allocated. The bsc_hack will guess.. in the future
it might be forced to ask for the tmsi after the channel has been
opened...
2008-12-29 06:23:49 +00:00
Holger Freyther 07cc8d8bee Improve page command handling in the bsc_hack
Add a callback to the gsm_network. When updating the location and
assigning a new tmsi callback into the bsc_hack.c and have a queue
of mobile stations to page, allocate a channel for and ultimately
dial.
2008-12-29 06:23:46 +00:00
Daniel Willmann 6fe997e9dd Implement sending SMS and send one on network registration 2008-12-29 04:20:41 +00:00
Harald Welte e14a57cc0e Create request channel reason to see channel requests originating from PAG 2008-12-29 04:08:28 +00:00
Harald Welte d35b6a7b12 debug: Create a region for Paging Command 2008-12-29 04:06:41 +00:00
Harald Welte de9226de16 Split out rach_control, missing mask from the last commit 2008-12-29 02:37:23 +00:00
Daniel Willmann 471712b133 ACK sms-submit 2008-12-29 01:54:02 +00:00
Daniel Willmann e0fbec823b Parse sms-submit messages 2008-12-29 00:44:41 +00:00
Harald Welte b84e2f4f1b * use 16bit for network and country code
* use aligned attribute for more data structures
* add command line arguments for operator/country code
2008-12-28 23:42:04 +00:00
Holger Freyther bde361064a make it optional where the hlr database is stored
Add --database to define where the database is stored. The default
was changed to not store the file in /tmp anymore.
2008-12-28 22:51:39 +00:00
Holger Freyther 177466199f [gsm0408] Make the generate_lai usable by other code
Prefix generate_lai with gsm0408 and update call sites. It will
be used from within bsc_hack.c
2008-12-28 16:32:44 +00:00
Holger Freyther 1ad732c699 [debug.h] Introduce a static assert using the array with negative size trick
It is inspired by the COMPILE_ASSERT from WebKit and is using the well
known trick to get compile time assertions.
2008-12-28 16:32:41 +00:00
Holger Freyther 5e85c8ea40 [gsm_04_08] Add structs for system information type 1 to 6
system information type 4 is a bit tricky as it has
a variable length and is terminated by a manadantory field.

System Information Type 6 has a mandantory SI 6 Reset Octet
but our BTS is happy with not receiving it. Make it optional
by the adding a 'pointer'.

System Information Type 5 and System Information Type 6 are
send through rsl_sacch_filling and it looks like we do not
need to send the L2 pseudo length. So far we have not found
the documentation confirming this. This is why the header
from Type 1 to Type 4 is not used.
2008-12-28 16:32:39 +00:00
Harald Welte 255539c742 working state up to location update and classmark inquiry 2008-12-28 02:26:27 +00:00
Daniel Willmann fdd0a6c157 Add SMS (GSM 04.11) testing program 2008-12-28 01:51:14 +00:00
Daniel Willmann 8b3390effd Start implementing GSM 04.11 (short message service) 2008-12-28 00:31:09 +00:00
Stefan Schmidt 4d4661d65b Draft ideas for high level call handling 2008-12-27 22:59:48 +00:00
Jan Luebbe 391d86e0d5 add extension field to subscriber struct and name column to db 2008-12-27 22:33:34 +00:00
Harald Welte bcae43fe1b SMS stub 2008-12-27 21:45:37 +00:00
Jan Luebbe fac25fccbd add a equipment table 2008-12-27 18:04:34 +00:00
Harald Welte a3d0438ff7 missing header file changes 2008-12-27 17:02:56 +00:00