2010-06-15 03:52:51 +00:00
|
|
|
/* Routines for the MSC handling */
|
|
|
|
|
|
|
|
#ifndef OSMO_MSC_H
|
|
|
|
#define OSMO_MSC_H
|
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
#include <osmocom/core/fsm.h>
|
|
|
|
#include <osmocom/gsm/gsup.h>
|
|
|
|
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/gsm_data.h>
|
2016-06-19 16:06:02 +00:00
|
|
|
|
|
|
|
#define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
|
|
|
|
#define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
|
|
|
|
|
|
|
|
enum subscr_conn_fsm_event {
|
|
|
|
/* Mark 0 as invalid to catch uninitialized vars */
|
|
|
|
SUBSCR_CONN_E_INVALID = 0,
|
|
|
|
/* Timeout on connection establishment starts */
|
|
|
|
SUBSCR_CONN_E_START,
|
|
|
|
/* LU or Process Access FSM has determined that this conn is good */
|
|
|
|
SUBSCR_CONN_E_ACCEPTED,
|
|
|
|
/* received first reply from MS in "real" CC, SMS, USSD communication */
|
|
|
|
SUBSCR_CONN_E_COMMUNICATING,
|
|
|
|
/* Some async action has completed, check again whether all is done */
|
2018-03-15 12:26:43 +00:00
|
|
|
SUBSCR_CONN_E_RELEASE_WHEN_UNUSED,
|
2016-06-19 16:06:02 +00:00
|
|
|
/* MS/BTS/BSC originated close request */
|
|
|
|
SUBSCR_CONN_E_MO_CLOSE,
|
|
|
|
/* MSC originated close request, e.g. failed authentication */
|
|
|
|
SUBSCR_CONN_E_CN_CLOSE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum subscr_conn_fsm_state {
|
|
|
|
SUBSCR_CONN_S_INIT,
|
|
|
|
SUBSCR_CONN_S_NEW,
|
|
|
|
SUBSCR_CONN_S_ACCEPTED,
|
|
|
|
SUBSCR_CONN_S_COMMUNICATING,
|
|
|
|
SUBSCR_CONN_S_RELEASED,
|
|
|
|
};
|
|
|
|
|
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-05-08 13:12:20 +00:00
|
|
|
enum msc_compl_l3_rc {
|
|
|
|
MSC_CONN_ACCEPT = 0,
|
|
|
|
MSC_CONN_REJECT = 1,
|
|
|
|
};
|
|
|
|
|
subscr_conn: store complete_layer3_type in conn, not FSM event arg
Instead of jumping through hoops to pass the Complete Layer 3 operation that
created this conn via FSM event dispatch parameters, put it right in the
gsm_subscriber_connection struct, where it always belonged.
Move definition of the enum complete_layer3_type to gsm_data.h, where
gsm_subscriber_connection is defined.
Introduce msc_subscr_conn_update_id() to set the complete_layer3_type of the
conn as soon as a Complete Layer 3 message is received.
In msc_subscr_conn_update_id(), already include an mi_string argument to
prepare for an upcoming patch where the FSM will be allocated much earlier when
the Mobile Identity is not known yet, and we'll also update the fi->id here.
The odd logging change in the msc_vlr_tests output uncovers a wrong use of the
osmo_fsm_inst_dispatch() data argument for SUBSCR_CONN_E_CN_CLOSE events: if a
child FSM signals unsuccessful result, instead of the failure cause, it passed
the complete_layer3_type, as requested upon FSM allocation, which was then
misinterpreted as a failure cause. Now a child FSM failure will pass NULL
instead, while other SUBSCR_CONN_E_CN_CLOSE events may still pass a valid cause
value.
Related: OS#3122
Change-Id: Iae30dd57a8861c4eaaf56999f872d4e635ba97fb
2018-04-02 10:26:16 +00:00
|
|
|
void msc_subscr_conn_update_id(struct gsm_subscriber_connection *conn,
|
|
|
|
enum complete_layer3_type from, const char *id);
|
2018-02-15 09:33:26 +00:00
|
|
|
char *msc_subscr_conn_get_conn_id(struct gsm_subscriber_connection *conn);
|
2016-06-19 16:06:02 +00:00
|
|
|
int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id);
|
|
|
|
|
|
|
|
int msc_vlr_alloc(struct gsm_network *net);
|
|
|
|
int msc_vlr_start(struct gsm_network *net);
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci);
|
|
|
|
int msc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
|
2016-05-20 19:59:55 +00:00
|
|
|
int msc_compl_l3(struct gsm_subscriber_connection *conn,
|
|
|
|
struct msgb *msg, uint16_t chosen_channel);
|
|
|
|
void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id,
|
|
|
|
struct msgb *msg);
|
|
|
|
void msc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
|
|
|
|
struct msgb *msg, uint8_t alg_id);
|
|
|
|
void msc_rx_sec_mode_compl(struct gsm_subscriber_connection *conn);
|
2017-04-09 10:32:51 +00:00
|
|
|
void msc_classmark_chg(struct gsm_subscriber_connection *conn,
|
|
|
|
const uint8_t *cm2, uint8_t cm2_len,
|
|
|
|
const uint8_t *cm3, uint8_t cm3_len);
|
|
|
|
void msc_assign_fail(struct gsm_subscriber_connection *conn,
|
|
|
|
uint8_t cause, uint8_t *rr_cause);
|
2016-05-20 19:59:55 +00:00
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
void msc_subscr_conn_init(void);
|
2018-02-06 15:51:31 +00:00
|
|
|
bool msc_subscr_conn_is_accepted(const struct gsm_subscriber_connection *conn);
|
2016-06-19 16:06:02 +00:00
|
|
|
void msc_subscr_conn_communicating(struct gsm_subscriber_connection *conn);
|
|
|
|
void msc_subscr_conn_close(struct gsm_subscriber_connection *conn,
|
|
|
|
uint32_t cause);
|
|
|
|
|
2017-11-22 13:33:12 +00:00
|
|
|
enum msc_subscr_conn_use {
|
|
|
|
MSC_CONN_USE_UNTRACKED = -1,
|
|
|
|
MSC_CONN_USE_COMPL_L3,
|
|
|
|
MSC_CONN_USE_DTAP,
|
|
|
|
MSC_CONN_USE_FSM,
|
|
|
|
MSC_CONN_USE_TRANS_CC,
|
|
|
|
MSC_CONN_USE_TRANS_SMS,
|
|
|
|
MSC_CONN_USE_TRANS_USSD,
|
|
|
|
MSC_CONN_USE_SILENT_CALL,
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct value_string msc_subscr_conn_use_names[];
|
|
|
|
static inline const char *msc_subscr_conn_use_name(enum msc_subscr_conn_use val)
|
|
|
|
{ return get_value_string(msc_subscr_conn_use_names, val); }
|
|
|
|
|
|
|
|
#define msc_subscr_conn_get(conn, balance_token) \
|
|
|
|
_msc_subscr_conn_get(conn, balance_token, __BASE_FILE__, __LINE__)
|
|
|
|
#define msc_subscr_conn_put(conn, balance_token) \
|
|
|
|
_msc_subscr_conn_put(conn, balance_token, __BASE_FILE__, __LINE__)
|
2016-06-19 16:06:02 +00:00
|
|
|
struct gsm_subscriber_connection *
|
|
|
|
_msc_subscr_conn_get(struct gsm_subscriber_connection *conn,
|
2017-11-22 13:33:12 +00:00
|
|
|
enum msc_subscr_conn_use balance_token,
|
2016-06-19 16:06:02 +00:00
|
|
|
const char *file, int line);
|
|
|
|
void _msc_subscr_conn_put(struct gsm_subscriber_connection *conn,
|
2017-11-22 13:33:12 +00:00
|
|
|
enum msc_subscr_conn_use balance_token,
|
2016-06-19 16:06:02 +00:00
|
|
|
const char *file, int line);
|
2010-06-15 03:52:51 +00:00
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
void msc_stop_paging(struct vlr_subscr *vsub);
|
|
|
|
|
2018-03-12 22:59:07 +00:00
|
|
|
void subscr_conn_release_when_unused(struct gsm_subscriber_connection *conn);
|
|
|
|
|
2010-06-15 03:52:51 +00:00
|
|
|
#endif
|