2008-12-23 20:25:15 +00:00
|
|
|
#ifndef _GSM_DATA_H
|
|
|
|
#define _GSM_DATA_H
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#include <stdint.h>
|
2016-05-24 12:23:27 +00:00
|
|
|
#include <regex.h>
|
|
|
|
#include <sys/types.h>
|
2016-06-30 08:25:49 +00:00
|
|
|
#include <stdbool.h>
|
2011-05-24 11:25:38 +00:00
|
|
|
|
|
|
|
#include <osmocom/core/timer.h>
|
2016-07-12 13:42:02 +00:00
|
|
|
#include <osmocom/core/rate_ctr.h>
|
2011-05-25 11:10:08 +00:00
|
|
|
#include <osmocom/core/select.h>
|
2016-07-12 13:42:02 +00:00
|
|
|
#include <osmocom/core/stats.h>
|
2017-09-15 09:22:30 +00:00
|
|
|
#include <osmocom/gsm/gsm48.h>
|
2016-04-20 11:13:19 +00:00
|
|
|
#include <osmocom/crypt/auth.h>
|
2017-04-09 10:32:51 +00:00
|
|
|
#include <osmocom/sigtran/sccp_sap.h>
|
2011-05-24 11:25:38 +00:00
|
|
|
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/common.h>
|
|
|
|
#include <osmocom/msc/common_cs.h>
|
2017-09-03 23:03:58 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client.h>
|
2011-05-25 10:33:33 +00:00
|
|
|
|
2018-01-24 23:07:33 +00:00
|
|
|
#include "gsm_data_shared.h"
|
|
|
|
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2013-04-29 07:11:02 +00:00
|
|
|
/** annotations for msgb ownership */
|
|
|
|
#define __uses
|
|
|
|
|
2011-10-26 16:37:09 +00:00
|
|
|
struct mncc_sock_state;
|
2016-06-19 16:06:02 +00:00
|
|
|
struct vlr_instance;
|
|
|
|
struct vlr_subscr;
|
2017-07-05 13:19:52 +00:00
|
|
|
struct ranap_ue_conn_ctx;
|
2011-10-26 16:37:09 +00:00
|
|
|
|
2017-01-09 23:49:56 +00:00
|
|
|
#define tmsi_from_string(str) strtoul(str, NULL, 10)
|
|
|
|
|
2009-02-01 13:32:45 +00:00
|
|
|
struct msgb;
|
|
|
|
typedef int gsm_cbfn(unsigned int hooknum,
|
|
|
|
unsigned int event,
|
|
|
|
struct msgb *msg,
|
|
|
|
void *data, void *param);
|
|
|
|
|
2009-12-27 20:56:14 +00:00
|
|
|
struct gsm_auth_tuple {
|
|
|
|
int use_count;
|
|
|
|
int key_seq;
|
2016-04-20 11:13:19 +00:00
|
|
|
struct osmo_auth_vector vec;
|
2009-12-27 20:56:14 +00:00
|
|
|
};
|
2010-06-09 10:45:37 +00:00
|
|
|
#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
|
2009-12-27 20:56:14 +00:00
|
|
|
|
2017-02-02 00:07:28 +00:00
|
|
|
enum ran_type {
|
|
|
|
RAN_UNKNOWN,
|
|
|
|
RAN_GERAN_A, /* 2G / A-interface */
|
|
|
|
RAN_UTRAN_IU, /* 3G / Iu-interface (IuCS or IuPS) */
|
|
|
|
};
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
extern const struct value_string ran_type_names[];
|
|
|
|
static inline const char *ran_type_name(enum ran_type val)
|
|
|
|
{ return get_value_string(ran_type_names, val); }
|
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
struct gsm_classmark {
|
|
|
|
bool classmark1_set;
|
|
|
|
struct gsm48_classmark1 classmark1;
|
|
|
|
uint8_t classmark2_len;
|
|
|
|
uint8_t classmark2[3];
|
|
|
|
uint8_t classmark3_len;
|
|
|
|
uint8_t classmark3[14]; /* if cm3 gets extended by spec, it will be truncated */
|
|
|
|
};
|
|
|
|
|
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 integrity_protection_state {
|
|
|
|
INTEGRITY_PROTECTION_NONE = 0,
|
|
|
|
INTEGRITY_PROTECTION_IK = 1,
|
|
|
|
INTEGRITY_PROTECTION_IK_CK = 2,
|
|
|
|
};
|
|
|
|
|
2016-05-09 19:07:43 +00:00
|
|
|
/* active radio connection of a mobile subscriber */
|
2010-03-23 05:41:45 +00:00
|
|
|
struct gsm_subscriber_connection {
|
2016-06-19 16:06:02 +00:00
|
|
|
/* global linked list of subscriber_connections */
|
2010-09-15 16:53:37 +00:00
|
|
|
struct llist_head entry;
|
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
/* usage count. If this drops to zero, we start the release
|
|
|
|
* towards A/Iu */
|
|
|
|
uint32_t use_count;
|
2017-11-22 13:33:12 +00:00
|
|
|
uint32_t use_tokens;
|
2016-06-19 16:06:02 +00:00
|
|
|
|
|
|
|
/* The MS has opened the conn with a CM Service Request, and we shall
|
|
|
|
* keep it open for an actual request (or until timeout). */
|
|
|
|
bool received_cm_service_request;
|
2010-03-23 05:41:45 +00:00
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
/* libmsc/libvlr subscriber information (if available) */
|
|
|
|
struct vlr_subscr *vsub;
|
|
|
|
|
2013-06-30 13:30:47 +00:00
|
|
|
/* LU expiration handling */
|
|
|
|
uint8_t expire_timer_stopped;
|
2014-02-08 14:20:48 +00:00
|
|
|
/* SMS helpers for libmsc */
|
|
|
|
uint8_t next_rp_ref;
|
2013-06-30 13:30:47 +00:00
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
struct osmo_fsm_inst *conn_fsm;
|
|
|
|
|
2010-03-23 05:41:45 +00:00
|
|
|
/* Are we part of a special "silent" call */
|
|
|
|
int silent_call;
|
|
|
|
|
2015-08-04 11:32:09 +00:00
|
|
|
/* MNCC rtp bridge markers */
|
|
|
|
int mncc_rtp_bridge;
|
|
|
|
|
2010-03-23 06:52:17 +00:00
|
|
|
/* back pointers */
|
2016-05-09 20:33:01 +00:00
|
|
|
struct gsm_network *network;
|
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
bool in_release;
|
2010-11-14 15:19:48 +00:00
|
|
|
|
2017-02-02 00:07:28 +00:00
|
|
|
/* connected via 2G or 3G? */
|
|
|
|
enum ran_type via_ran;
|
2016-06-19 16:06:02 +00:00
|
|
|
|
|
|
|
struct gsm_classmark classmark;
|
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
|
|
|
|
|
|
|
uint16_t lac;
|
|
|
|
struct gsm_encr encr;
|
|
|
|
|
2018-02-03 20:08:26 +00:00
|
|
|
/* N(SD) expected in the received frame, per flow (TS 24.007 11.2.3.2.3.2.2) */
|
|
|
|
uint8_t n_sd_next[4];
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
struct {
|
2017-11-07 16:19:25 +00:00
|
|
|
struct mgcp_ctx *mgcp_ctx;
|
2017-04-09 10:32:51 +00:00
|
|
|
unsigned int mgcp_rtp_endpoint;
|
2017-11-07 16:19:25 +00:00
|
|
|
|
|
|
|
uint16_t local_port_ran;
|
|
|
|
char local_addr_ran[INET_ADDRSTRLEN];
|
|
|
|
uint16_t remote_port_ran;
|
|
|
|
char remote_addr_ran[INET_ADDRSTRLEN];
|
|
|
|
uint16_t local_port_cn;
|
|
|
|
char local_addr_cn[INET_ADDRSTRLEN];
|
|
|
|
uint16_t remote_port_cn;
|
|
|
|
char remote_addr_cn[INET_ADDRSTRLEN];
|
2017-04-09 10:32:51 +00:00
|
|
|
} rtp;
|
|
|
|
|
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
|
|
|
/* which Iu-CS connection, if any. */
|
|
|
|
struct {
|
2017-07-05 13:19:52 +00:00
|
|
|
struct ranap_ue_conn_ctx *ue_ctx;
|
2016-05-20 19:59:55 +00:00
|
|
|
uint8_t rab_id;
|
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
|
|
|
} iu;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/* A pointer to the SCCP user that handles
|
|
|
|
* the SCCP connections for this subscriber
|
|
|
|
* connection */
|
|
|
|
struct osmo_sccp_user *scu;
|
|
|
|
|
|
|
|
/* The address of the BSC that is associated
|
|
|
|
* with this subscriber connection */
|
|
|
|
struct osmo_sccp_addr bsc_addr;
|
|
|
|
|
|
|
|
/* The connection identifier that is used
|
|
|
|
* to reference the SCCP connection that is
|
|
|
|
* associated with this subscriber connection */
|
2018-01-30 10:38:59 +00:00
|
|
|
uint32_t conn_id;
|
2017-04-09 10:32:51 +00:00
|
|
|
} a;
|
2010-03-23 05:41:45 +00:00
|
|
|
};
|
|
|
|
|
2011-02-14 15:15:21 +00:00
|
|
|
|
2016-08-02 09:34:11 +00:00
|
|
|
enum {
|
2016-07-12 13:42:02 +00:00
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_ATTACH,
|
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_NORMAL,
|
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_PERIODIC,
|
|
|
|
MSC_CTR_LOC_UPDATE_TYPE_DETACH,
|
LU counters: count completion and failure, not messages sent
From a human admin viewpoint it doesn't make sense to count the messages sent:
When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect
the MS to respond with a TMSI Realloc Complete message. When that fails to come
through, the LU actually ends in failure, even though a LU Accept was sent.
If a conn breaks/vanishes during LU, we cancel the LU without sending any reply
at all, so the failed LU would not be counted.
Instead, count Location Updating results, i.e. completion and failures.
(With the new VLR developments, LU counters need to be triggered in completely
different places, and this patch prepares for that by providing sensible
counters.)
Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2016-05-09 11:18:03 +00:00
|
|
|
MSC_CTR_LOC_UPDATE_FAILED,
|
|
|
|
MSC_CTR_LOC_UPDATE_COMPLETED,
|
2016-07-12 13:42:02 +00:00
|
|
|
MSC_CTR_SMS_SUBMITTED,
|
|
|
|
MSC_CTR_SMS_NO_RECEIVER,
|
|
|
|
MSC_CTR_SMS_DELIVERED,
|
|
|
|
MSC_CTR_SMS_RP_ERR_MEM,
|
|
|
|
MSC_CTR_SMS_RP_ERR_OTHER,
|
2016-08-21 18:16:33 +00:00
|
|
|
MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR,
|
2016-07-12 13:42:02 +00:00
|
|
|
MSC_CTR_CALL_MO_SETUP,
|
|
|
|
MSC_CTR_CALL_MO_CONNECT_ACK,
|
|
|
|
MSC_CTR_CALL_MT_SETUP,
|
|
|
|
MSC_CTR_CALL_MT_CONNECT,
|
2016-08-23 05:32:27 +00:00
|
|
|
MSC_CTR_CALL_ACTIVE,
|
|
|
|
MSC_CTR_CALL_COMPLETE,
|
|
|
|
MSC_CTR_CALL_INCOMPLETE,
|
2016-07-12 13:42:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rate_ctr_desc msc_ctr_description[] = {
|
2017-11-18 22:22:17 +00:00
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_ATTACH] = {"loc_update_type:attach", "Received location update imsi attach requests."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type:normal", "Received location update normal requests."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type:periodic", "Received location update periodic requests."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type:detach", "Received location update detach indication."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp:failed", "Rejected location updates."},
|
|
|
|
[MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp:completed", "Successful location updates."},
|
|
|
|
[MSC_CTR_SMS_SUBMITTED] = {"sms:submitted", "Received a RPDU from a MS (MO)."},
|
|
|
|
[MSC_CTR_SMS_NO_RECEIVER] = {"sms:no_receiver", "Counts SMS which couldn't routed because no receiver found."},
|
|
|
|
[MSC_CTR_SMS_DELIVERED] = {"sms:delivered", "Global SMS Deliver attempts."},
|
|
|
|
[MSC_CTR_SMS_RP_ERR_MEM] = {"sms:rp_err_mem", "CAUSE_MT_MEM_EXCEEDED errors of MS responses on a sms deliver attempt."},
|
|
|
|
[MSC_CTR_SMS_RP_ERR_OTHER] = {"sms:rp_err_other", "Other error of MS responses on a sms delive attempt."},
|
|
|
|
[MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR] = {"sms:deliver_unknown_error", "Unknown error occured during sms delivery."},
|
2016-07-12 13:42:02 +00:00
|
|
|
/* FIXME: count also sms delivered */
|
2017-11-18 22:22:17 +00:00
|
|
|
[MSC_CTR_CALL_MO_SETUP] = {"call:mo_setup", "Received setup requests from a MS to init a MO call."},
|
|
|
|
[MSC_CTR_CALL_MO_CONNECT_ACK] = {"call:mo_connect_ack", "Received a connect ack from MS of a MO call. Call is now succesful connected up."},
|
|
|
|
[MSC_CTR_CALL_MT_SETUP] = {"call:mt_setup", "Sent setup requests to the MS (MT)."},
|
|
|
|
[MSC_CTR_CALL_MT_CONNECT] = {"call:mt_connect", "Sent a connect to the MS (MT)."},
|
|
|
|
[MSC_CTR_CALL_ACTIVE] = {"call:active", "Count total amount of calls that ever reached active state."},
|
|
|
|
[MSC_CTR_CALL_COMPLETE] = {"call:complete", "Count total amount of calls which got terminated by disconnect req or ind after reaching active state."},
|
|
|
|
[MSC_CTR_CALL_INCOMPLETE] = {"call:incomplete", "Count total amount of call which got terminated by any other reason after reaching active state."},
|
2016-08-02 09:34:11 +00:00
|
|
|
};
|
|
|
|
|
2016-07-12 13:42:02 +00:00
|
|
|
static const struct rate_ctr_group_desc msc_ctrg_desc = {
|
|
|
|
"msc",
|
|
|
|
"mobile switching center",
|
|
|
|
OSMO_STATS_CLASS_GLOBAL,
|
|
|
|
ARRAY_SIZE(msc_ctr_description),
|
|
|
|
msc_ctr_description,
|
2009-12-21 23:41:05 +00:00
|
|
|
};
|
|
|
|
|
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-15 02:02:27 +00:00
|
|
|
#define MSC_PAGING_RESPONSE_TIMER_DEFAULT 10
|
2009-12-01 12:06:54 +00:00
|
|
|
|
2016-05-10 11:29:33 +00:00
|
|
|
struct gsm_tz {
|
|
|
|
int override; /* if 0, use system's time zone instead. */
|
|
|
|
int hr; /* hour */
|
|
|
|
int mn; /* minute */
|
|
|
|
int dst; /* daylight savings */
|
|
|
|
};
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
struct gsm_network {
|
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
|
|
|
/* TODO MSCSPLIT the gsm_network struct is basically a kitchen sink for
|
|
|
|
* global settings and variables, "madly" mixing BSC and MSC stuff. Split
|
|
|
|
* this in e.g. struct osmo_bsc and struct osmo_msc, with the things
|
|
|
|
* these have in common, like country and network code, put in yet
|
|
|
|
* separate structs and placed as members in osmo_bsc and osmo_msc. */
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
/* global parameters */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t country_code;
|
|
|
|
uint16_t network_code;
|
2008-12-30 18:01:02 +00:00
|
|
|
char *name_long;
|
|
|
|
char *name_short;
|
2017-12-23 18:30:32 +00:00
|
|
|
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
|
|
|
|
uint8_t a5_encryption_mask;
|
2016-06-19 16:06:02 +00:00
|
|
|
bool authentication_required;
|
2009-12-14 08:00:24 +00:00
|
|
|
int send_mm_info;
|
2009-12-19 20:41:52 +00:00
|
|
|
struct {
|
|
|
|
int active;
|
|
|
|
} handover;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2016-08-02 09:34:11 +00:00
|
|
|
struct rate_ctr_group *msc_ctrs;
|
2016-08-23 05:32:27 +00:00
|
|
|
struct osmo_counter *active_calls;
|
2009-12-21 23:41:05 +00:00
|
|
|
|
2009-06-10 15:11:52 +00:00
|
|
|
/* layer 4 */
|
2011-10-26 16:37:09 +00:00
|
|
|
struct mncc_sock_state *mncc_state;
|
2016-05-11 12:28:25 +00:00
|
|
|
mncc_recv_cb_t mncc_recv;
|
2009-06-10 15:11:52 +00:00
|
|
|
struct llist_head upqueue;
|
2016-05-20 19:59:55 +00:00
|
|
|
/*
|
|
|
|
* TODO: Move the trans_list into the subscriber connection and
|
|
|
|
* create a pending list for MT transactions. These exist before
|
|
|
|
* we have a subscriber connection.
|
|
|
|
*/
|
2009-06-10 15:11:52 +00:00
|
|
|
struct llist_head trans_list;
|
|
|
|
|
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-15 02:02:27 +00:00
|
|
|
unsigned int paging_response_timer;
|
2009-12-13 09:53:12 +00:00
|
|
|
|
|
|
|
/* Radio Resource Location Protocol (TS 04.31) */
|
|
|
|
struct {
|
|
|
|
enum rrlp_mode mode;
|
|
|
|
} rrlp;
|
2010-09-06 01:25:48 +00:00
|
|
|
|
2010-12-24 12:48:27 +00:00
|
|
|
struct gsm_sms_queue *sms_queue;
|
2011-07-22 15:55:42 +00:00
|
|
|
|
|
|
|
/* control interface */
|
|
|
|
struct ctrl_handle *ctrl;
|
dyn TS: OS#1778 workaround: disable TCH/F on dyn TS for nitb
To avoid two phones picking mismatching TCH pchans, never pick TCH/F on dynamic
TS in osmo-nitb.
Add gsm_network flag dyn_ts_allow_tch_f, set to true by default in
gsm_network_init().
Set this flag to false in osmo-nitb's main().
See http://osmocom.org/issues/1778
Reasoning about ways to solve this:
* a compile time switch doesn't work because libbsc is first compiled and then
linked to both osmo-nitb and osmo-bsc.
* we could test net->bsc_api == msc_bsc_api(), but I have the so-called MSC
split waiting on branch sysmocom/cscn, which will result in msc_bsc_api() not
being linked in the osmo-bsc binary.
* have a function am_i_nitb() with different implementations in osmo-nitb and
osmo-bsc, but then we'd need to add implementations to all tests and other
binaries linking lchan_alloc().
* have a flag in struct bsc_api, but so far there are only function pointers
there.
Having a "global" flag in gsm_network allows to add a VTY command in case we
decide to keep this feature (#1781), has no linking implications and is nicely
explicit.
Tested that osmo-bsc still picks TCH/F on dyn TS indirectly, since I have no
standalone MSC available: when compiling osmo-nitb with the line that sets
dyn_ts_allow_tch_f = false commented out, TCH/F is picked as described in
OS#1778; and by printf-verifying that dyn_ts_allow_tch_f == true in osmo-bsc
main(), only osmo-nitb should have TCH/F disabled.
Related: OS#1778, OS#1781
Change-Id: If7e4797a72815fc6e2bbef27756ea5df69f4bde7
2016-07-23 18:15:28 +00:00
|
|
|
|
2016-05-09 19:03:12 +00:00
|
|
|
/* all active subscriber connections. */
|
|
|
|
struct llist_head subscr_conns;
|
2016-05-10 11:29:33 +00:00
|
|
|
|
|
|
|
/* if override is nonzero, this timezone data is used for all MM
|
|
|
|
* contexts. */
|
|
|
|
/* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable
|
|
|
|
* BTS|RNC specific timezone overrides for multi-tz networks in
|
2017-02-23 20:06:12 +00:00
|
|
|
* OsmoMSC, this should be tied to the location area code (LAC). */
|
2016-05-10 11:29:33 +00:00
|
|
|
struct gsm_tz tz;
|
add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.
Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).
Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.
During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.
Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.
Add bsc_subscr unit test.
Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-02-18 21:20:46 +00:00
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
/* MSC: GSUP server address of the HLR */
|
|
|
|
const char *gsup_server_addr_str;
|
|
|
|
uint16_t gsup_server_port;
|
|
|
|
|
|
|
|
struct vlr_instance *vlr;
|
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
|
|
|
|
|
|
|
/* Periodic location update default value */
|
|
|
|
uint8_t t3212;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
struct {
|
2017-09-03 23:03:58 +00:00
|
|
|
struct mgcp_client_conf conf;
|
|
|
|
struct mgcp_client *client;
|
|
|
|
} mgw;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
struct {
|
2017-04-09 10:32:51 +00:00
|
|
|
/* CS7 instance id number (set via VTY) */
|
|
|
|
uint32_t cs7_instance;
|
2017-07-05 13:19:52 +00:00
|
|
|
int rab_assign_addr_enc;
|
2017-04-09 10:32:51 +00:00
|
|
|
struct osmo_sccp_instance *sccp;
|
2016-05-20 19:59:55 +00:00
|
|
|
} iu;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/* CS7 instance id number (set via VTY) */
|
|
|
|
uint32_t cs7_instance;
|
|
|
|
/* A list with the context information about
|
|
|
|
* all BSCs we have connections with */
|
|
|
|
struct llist_head bscs;
|
|
|
|
struct osmo_sccp_instance *sccp;
|
|
|
|
} a;
|
2018-02-09 19:41:14 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
/* MSISDN to which to route MO emergency calls */
|
|
|
|
char *route_to_msisdn;
|
|
|
|
} emergency;
|
2008-12-23 20:25:15 +00:00
|
|
|
};
|
|
|
|
|
2012-11-08 18:44:08 +00:00
|
|
|
struct osmo_esme;
|
|
|
|
|
|
|
|
enum gsm_sms_source_id {
|
|
|
|
SMS_SOURCE_UNKNOWN = 0,
|
|
|
|
SMS_SOURCE_MS, /* received from MS */
|
|
|
|
SMS_SOURCE_VTY, /* received from VTY */
|
|
|
|
SMS_SOURCE_SMPP, /* received via SMPP */
|
|
|
|
};
|
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
#define SMS_HDR_SIZE 128
|
|
|
|
#define SMS_TEXT_SIZE 256
|
2012-11-23 18:02:37 +00:00
|
|
|
|
|
|
|
struct gsm_sms_addr {
|
|
|
|
uint8_t ton;
|
|
|
|
uint8_t npi;
|
|
|
|
char addr[21+1];
|
|
|
|
};
|
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
struct gsm_sms {
|
2009-11-06 15:06:19 +00:00
|
|
|
unsigned long long id;
|
2016-06-19 16:06:02 +00:00
|
|
|
struct vlr_subscr *receiver;
|
2012-11-23 22:35:01 +00:00
|
|
|
struct gsm_sms_addr src, dst;
|
2012-11-08 18:44:08 +00:00
|
|
|
enum gsm_sms_source_id source;
|
|
|
|
|
libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP
Hold on with the GSM 04.11 RP-ACK/RP-ERROR that we send to the MS until
we get a confirmation from the ESME, via SMPP DELIVER-SM-RESP, that we
can route this sms somewhere we can reach indeed.
After this change, the conversation looks like this:
MS GSM 03.40 SMSC SMPP 3.4 ESME
| | |
| SMS-SUBMIT | |
|------------------->| |
| | DELIVER-SM |
| |---------------->|
| | |
| | DELIVER-SM-RESP |
| |<----------------|
| GSM 04.11 RP-ACK | |
|<-------------------| |
| | |
Before this patch, the RP-ACK was sent back straight forward to the MS,
no matter if the sms can be route by the ESME or not. Thus, the user
ends up getting a misleading "message delivered" in their phone screen,
when the message may just be unroutable by the ESME hence silently
dropped.
If we get no reply from the ESME, there is a hardcoded timer that will
expire to send back an RP-ERROR to the MS indicating that network is
out-of-order. Currently this timer is arbitrarily set to 5 seconds. I
found no specific good default value on the SMPP 3.4 specs, section 7.2,
where the response_timer is described. There must be a place that
describes a better default value for this. We could also expose this
timer through VTY for configurability reasons, to be done later.
Given all this needs to happen asyncronously, ie. block the SMSC, this
patch extends the gsm_sms structure with two new fields to annotate
useful information to send the RP-ACK/RP-ERROR back to the MS of origin.
These new fields are:
* the GSM 04.07 transaction id, to look up for the gsm_trans object.
* the GSM 04.11 message reference so the MS of origin can correlate this
response to its original request.
Tested here using python-libsmpp script that replies with
DELIVER_SM_RESP and status code 0x0b (Invalid Destination). I can see
here on my motorola C155 that message cannot be delivered. I have tested
with the success status code in the SMPP DELIVER_SM_RESP too.
Change-Id: I0d5bd5693fed6d4f4bd2951711c7888712507bfd
2017-05-04 16:44:22 +00:00
|
|
|
struct {
|
|
|
|
uint8_t transaction_id;
|
|
|
|
uint32_t msg_ref;
|
|
|
|
} gsm411;
|
|
|
|
|
2012-11-08 18:44:08 +00:00
|
|
|
struct {
|
|
|
|
struct osmo_esme *esme;
|
|
|
|
uint32_t sequence_nr;
|
|
|
|
int transaction_mode;
|
|
|
|
char msg_id[16];
|
|
|
|
} smpp;
|
2009-03-30 20:56:32 +00:00
|
|
|
|
2009-07-05 12:02:46 +00:00
|
|
|
unsigned long validity_minutes;
|
2017-08-16 20:45:07 +00:00
|
|
|
time_t created;
|
2017-08-07 13:01:30 +00:00
|
|
|
bool is_report;
|
2011-04-18 15:04:00 +00:00
|
|
|
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;
|
|
|
|
uint8_t user_data_len;
|
|
|
|
uint8_t user_data[SMS_TEXT_SIZE];
|
2009-07-27 18:11:35 +00:00
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
char text[SMS_TEXT_SIZE];
|
|
|
|
};
|
|
|
|
|
2016-05-11 11:53:47 +00:00
|
|
|
extern void talloc_ctx_init(void *ctx_root);
|
|
|
|
|
2009-06-29 13:19:38 +00:00
|
|
|
extern void *tall_bsc_ctx;
|
2009-12-20 12:48:15 +00:00
|
|
|
extern int ipacc_rtp_direct;
|
2009-06-20 20:36:41 +00:00
|
|
|
|
2009-12-13 09:53:12 +00:00
|
|
|
enum rrlp_mode rrlp_mode_parse(const char *arg);
|
|
|
|
const char *rrlp_mode_name(enum rrlp_mode mode);
|
|
|
|
|
2016-05-20 15:15:44 +00:00
|
|
|
struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network);
|
|
|
|
void msc_subscr_con_free(struct gsm_subscriber_connection *conn);
|
2010-06-28 07:47:12 +00:00
|
|
|
|
2013-01-09 16:03:27 +00:00
|
|
|
/* control interface handling */
|
|
|
|
int bsc_base_ctrl_cmds_install(void);
|
2016-06-19 16:06:02 +00:00
|
|
|
int msc_ctrl_cmds_install(struct gsm_network *net);
|
2013-01-09 16:03:27 +00:00
|
|
|
|
2016-06-19 16:06:02 +00:00
|
|
|
bool classmark_is_r99(struct gsm_classmark *cm);
|
|
|
|
|
2011-05-25 11:10:08 +00:00
|
|
|
#endif /* _GSM_DATA_H */
|