2019-02-14 09:44:45 +00:00
|
|
|
#pragma once
|
2009-07-23 19:25:08 +00:00
|
|
|
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/gsm_data.h>
|
|
|
|
#include <osmocom/msc/gsm_subscriber.h>
|
2011-03-22 15:47:59 +00:00
|
|
|
#include <osmocom/core/linuxlist.h>
|
2019-02-28 04:50:06 +00:00
|
|
|
#include <osmocom/core/fsm.h>
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/gsm_04_11.h>
|
|
|
|
#include <osmocom/msc/mncc.h>
|
2019-02-28 04:50:06 +00:00
|
|
|
#include <osmocom/msc/debug.h>
|
2011-10-28 02:07:07 +00:00
|
|
|
#include <osmocom/gsm/gsm0411_smc.h>
|
2011-10-28 09:11:13 +00:00
|
|
|
#include <osmocom/gsm/gsm0411_smr.h>
|
2009-07-26 12:24:11 +00:00
|
|
|
|
2019-02-14 09:54:10 +00:00
|
|
|
/* Used for late TID assignment */
|
|
|
|
#define TRANS_ID_UNASSIGNED 0xff
|
|
|
|
|
2019-02-28 04:50:06 +00:00
|
|
|
#define LOG_TRANS_CAT(trans, subsys, level, fmt, args...) \
|
|
|
|
LOGP(subsys, level, \
|
|
|
|
"trans(%s %s callref-0x%x tid-%u%s) " fmt, \
|
|
|
|
(trans) ? gsm48_pdisc_name((trans)->protocol) : "NULL", \
|
|
|
|
(trans) ? ((trans)->conn ? (trans)->conn->fi->id : vlr_subscr_name((trans)->vsub)) : "NULL", \
|
|
|
|
(trans) ? (trans)->callref : 0, \
|
|
|
|
(trans) ? (trans)->transaction_id : 0, \
|
|
|
|
(trans) && (trans)->paging_request ? ",PAGING" : "", \
|
|
|
|
##args)
|
|
|
|
|
|
|
|
#define LOG_TRANS(trans, level, fmt, args...) \
|
|
|
|
LOG_TRANS_CAT(trans, trans_log_subsys(trans), level, fmt, ##args)
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
enum bridge_state {
|
|
|
|
BRIDGE_STATE_NONE,
|
|
|
|
BRIDGE_STATE_LOOPBACK_PENDING,
|
|
|
|
BRIDGE_STATE_LOOPBACK_ESTABLISHED,
|
|
|
|
BRIDGE_STATE_BRIDGE_PENDING,
|
|
|
|
BRIDGE_STATE_BRIDGE_ESTABLISHED,
|
|
|
|
};
|
|
|
|
|
2009-07-26 12:24:11 +00:00
|
|
|
/* One transaction */
|
|
|
|
struct gsm_trans {
|
|
|
|
/* Entry in list of all transactions */
|
|
|
|
struct llist_head entry;
|
|
|
|
|
2016-08-29 15:52:39 +00:00
|
|
|
/* Back pointer to the network struct */
|
2014-12-02 10:58:00 +00:00
|
|
|
struct gsm_network *net;
|
|
|
|
|
2009-07-26 12:24:11 +00:00
|
|
|
/* The protocol within which we live */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t protocol;
|
2009-07-26 12:24:11 +00:00
|
|
|
|
|
|
|
/* The current transaction ID */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t transaction_id;
|
2016-08-29 15:52:39 +00:00
|
|
|
|
2018-04-09 14:35:01 +00:00
|
|
|
/* The DLCI (DCCH/ACCH + SAPI) of this transaction */
|
|
|
|
uint8_t dlci;
|
|
|
|
|
2009-07-26 12:24:11 +00:00
|
|
|
/* To whom we belong, unique identifier of remote MM entity */
|
2016-06-19 16:06:02 +00:00
|
|
|
struct vlr_subscr *vsub;
|
2009-07-26 12:24:11 +00:00
|
|
|
|
2010-03-23 06:00:22 +00:00
|
|
|
/* The associated connection we are using to transmit messages */
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct ran_conn *conn;
|
2009-07-26 12:24:11 +00:00
|
|
|
|
|
|
|
/* reference from MNCC or other application */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint32_t callref;
|
2009-07-26 12:24:11 +00:00
|
|
|
|
2009-12-19 21:23:05 +00:00
|
|
|
/* if traffic channel receive was requested */
|
|
|
|
int tch_recv;
|
|
|
|
|
2010-12-29 16:09:07 +00:00
|
|
|
/* is thats one paging? */
|
2015-04-06 10:03:45 +00:00
|
|
|
struct subscr_request *paging_request;
|
2010-12-29 16:09:07 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
/* bearer capabilities (rate and codec) */
|
|
|
|
struct gsm_mncc_bearer_cap bearer_cap;
|
|
|
|
|
|
|
|
/* if true, TCH_RTP_CREATE is sent after the
|
|
|
|
* assignment is done */
|
|
|
|
bool tch_rtp_create;
|
|
|
|
|
2009-07-26 12:24:11 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
|
|
|
|
/* current call state */
|
|
|
|
int state;
|
|
|
|
|
|
|
|
/* current timer and message queue */
|
|
|
|
int Tcurrent; /* current CC timer */
|
|
|
|
int T308_second; /* used to send release again */
|
2011-05-06 10:11:06 +00:00
|
|
|
struct osmo_timer_list timer;
|
2018-10-10 15:00:49 +00:00
|
|
|
struct osmo_timer_list timer_guard;
|
2009-07-26 12:24:11 +00:00
|
|
|
struct gsm_mncc msg; /* stores setup/disconnect/release message */
|
2018-12-20 02:03:44 +00:00
|
|
|
bool assignment_started;
|
2009-07-26 12:24:11 +00:00
|
|
|
} cc;
|
|
|
|
struct {
|
2011-10-28 02:07:07 +00:00
|
|
|
struct gsm411_smc_inst smc_inst;
|
2011-10-28 09:11:13 +00:00
|
|
|
struct gsm411_smr_inst smr_inst;
|
2011-10-28 02:07:07 +00:00
|
|
|
|
2015-12-21 09:05:56 +00:00
|
|
|
/* SM-RP-MR, Message Reference (see GSM TS 04.11, section 8.2.3) */
|
|
|
|
uint8_t sm_rp_mr;
|
|
|
|
|
2009-08-08 14:03:15 +00:00
|
|
|
struct gsm_sms *sms;
|
2009-07-26 12:24:11 +00:00
|
|
|
} sms;
|
2018-06-17 14:09:28 +00:00
|
|
|
struct {
|
|
|
|
/**
|
|
|
|
* Stores a GSM 04.80 message to be sent to
|
|
|
|
* a subscriber after successful Paging Response
|
|
|
|
*/
|
|
|
|
struct msgb *msg;
|
libmsc/gsm_09_11.c: implement guard timer for NCSS sessions
It may happen that either the MS or an EUSE would become
unresponsive during a call independent SS session, e.g.
due to a bug, or a dropped message. In such cases, the
corresponding transaction would remain unfreed forever.
This change introduces a guard timer, that prevents keeping
'stalled' NCSS sessions forever. As soon as it expires, both
sides (i.e. MS and EUSE) are getting notified, and the
transaction is being released.
By default, the timer expires after 30 seconds. As soon as
either the MS, or an EUSE initiates any activity,
the watchdog timer is rescheduled.
The timeout value can be configured from the VTY:
msc
...
! Use 0 to disable this timer
ncss guard-timeout 30
Please note that changing the timeout value at run-time
doesn't affect the existing NCSS sessions, excepting the
case when the timer is disabled at run-time.
This change makes TC_lu_and_ss_session_timeout pass.
Change-Id: Icf4d87c45e90324764073e8230e0fb9cb96dd9cb
Related Change-Id: (TTCN) I3e1791773d56617172ae27a46889a1ae4d400e2f
Related: OS#3655
2018-11-28 16:05:51 +00:00
|
|
|
/* Inactivity timer, triggers transaction release */
|
|
|
|
struct osmo_timer_list timer_guard;
|
2018-06-17 14:09:28 +00:00
|
|
|
} ss;
|
2009-07-26 12:24:11 +00:00
|
|
|
};
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct gsm_trans *peer;
|
|
|
|
enum bridge_state state;
|
|
|
|
} bridge;
|
2009-07-26 12:24:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-23 19:25:08 +00:00
|
|
|
|
2019-01-02 10:48:14 +00:00
|
|
|
struct gsm_trans *trans_find_by_id(const struct ran_conn *conn,
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t proto, uint8_t trans_id);
|
2019-01-02 10:48:14 +00:00
|
|
|
struct gsm_trans *trans_find_by_callref(const struct gsm_network *net,
|
2011-04-18 15:04:00 +00:00
|
|
|
uint32_t callref);
|
2019-01-23 14:22:27 +00:00
|
|
|
struct gsm_trans *trans_find_by_sm_rp_mr(const struct gsm_network *net,
|
|
|
|
const struct vlr_subscr *vsub,
|
2015-12-21 09:05:56 +00:00
|
|
|
uint8_t sm_rp_mr);
|
2009-07-23 19:25:08 +00:00
|
|
|
|
2014-12-02 13:22:53 +00:00
|
|
|
struct gsm_trans *trans_alloc(struct gsm_network *net,
|
2016-06-19 16:06:02 +00:00
|
|
|
struct vlr_subscr *vsub,
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t protocol, uint8_t trans_id,
|
|
|
|
uint32_t callref);
|
2009-07-23 19:25:08 +00:00
|
|
|
void trans_free(struct gsm_trans *trans);
|
|
|
|
|
2019-01-02 10:48:14 +00:00
|
|
|
int trans_assign_trans_id(const struct gsm_network *net, const struct vlr_subscr *vsub,
|
2019-01-10 16:25:33 +00:00
|
|
|
uint8_t protocol);
|
rename gsm_subscriber_connection to ran_conn
In preparation for inter-BSC and inter-MSC handover, we need to separate the
subscriber management logic from the actual RAN connections. What better time
to finally rename gsm_subscriber_connection.
* Name choice:
In 2G, this is a connection to the BSS, but even though 3GPP TS commonly talk
of "BSS-A" and "BSS-B" when explaining handover, it's not good to call it
"bss_conn": in 3G a BSS is called RNS, IIUC.
The overall term for 2G (GERAN) and 3G (UTRAN) is RAN: Radio Access Network.
* Rationale:
A subscriber in the MSC so far has only one RAN connection, but e.g. for
inter-BSC handover, a second one needs to be created to handover to. Most of
the items in the former gsm_subscriber_connection are actually related to the
RAN, with only a few MM and RTP related items. So, as a first step, just rename
it to ran_conn, to cosmetically prepare for moving the not strictly RAN related
items away later.
Also:
- Rename some functions from msc_subscr_conn_* to ran_conn_*
- Rename "Subscr_Conn" FSM instance name to "RAN_conn"
- Rename SUBSCR_CONN_* to RAN_CONN_*
Change-Id: Ic595f7a558d3553c067f77dc67543ab59659707a
2018-11-29 21:37:51 +00:00
|
|
|
struct gsm_trans *trans_has_conn(const struct ran_conn *conn);
|
2019-01-02 10:48:14 +00:00
|
|
|
void trans_conn_closed(const struct ran_conn *conn);
|
2019-02-28 04:50:06 +00:00
|
|
|
|
|
|
|
static inline int trans_log_subsys(const struct gsm_trans *trans)
|
|
|
|
{
|
|
|
|
if (!trans)
|
|
|
|
return DMSC;
|
|
|
|
switch (trans->protocol) {
|
|
|
|
case GSM48_PDISC_CC:
|
|
|
|
return DCC;
|
|
|
|
case GSM48_PDISC_SMS:
|
|
|
|
return DLSMS;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return DMSC;
|
|
|
|
}
|