Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | #ifndef _GSM_DATA_H |
| 2 | #define _GSM_DATA_H |
| 3 | |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 4 | #include <stdint.h> |
Max | ddee01f | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 5 | #include <regex.h> |
| 6 | #include <sys/types.h> |
Max | e6052c4 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 7 | #include <stdbool.h> |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 8 | |
| 9 | #include <osmocom/core/timer.h> |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 10 | #include <osmocom/core/rate_ctr.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 11 | #include <osmocom/core/select.h> |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 12 | #include <osmocom/core/stats.h> |
Alexander Couzens | efa7b97 | 2019-04-27 23:45:37 +0200 | [diff] [blame] | 13 | #include <osmocom/core/stat_item.h> |
Max | 43b01b0 | 2017-09-15 11:22:30 +0200 | [diff] [blame] | 14 | #include <osmocom/gsm/gsm48.h> |
Harald Welte | 121e9a4 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 15 | #include <osmocom/crypt/auth.h> |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 16 | |
Neels Hofmeyr | 6c8afe1 | 2017-09-04 01:03:58 +0200 | [diff] [blame] | 17 | #include <osmocom/mgcp_client/mgcp_client.h> |
Harald Welte | b96be39 | 2011-05-25 12:33:33 +0200 | [diff] [blame] | 18 | |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 19 | #include <osmocom/msc/msc_common.h> |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 20 | #include <osmocom/msc/neighbor_ident.h> |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 21 | |
Harald Welte | d35038d | 2018-01-25 00:07:33 +0100 | [diff] [blame] | 22 | #include "gsm_data_shared.h" |
Pau Espin Pedrol | 4faff9e | 2019-05-06 19:29:11 +0200 | [diff] [blame] | 23 | #include "osmux.h" |
Harald Welte | d35038d | 2018-01-25 00:07:33 +0100 | [diff] [blame] | 24 | |
Holger Hans Peter Freyther | d7b22c6 | 2013-04-29 09:11:02 +0200 | [diff] [blame] | 25 | /** annotations for msgb ownership */ |
| 26 | #define __uses |
| 27 | |
Holger Hans Peter Freyther | 694c82d | 2011-10-26 18:37:09 +0200 | [diff] [blame] | 28 | struct mncc_sock_state; |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 29 | struct vlr_instance; |
| 30 | struct vlr_subscr; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 31 | struct gsup_client_mux; |
Holger Hans Peter Freyther | 694c82d | 2011-10-26 18:37:09 +0200 | [diff] [blame] | 32 | |
Keith Whyte | 1587ffb | 2020-08-28 13:36:58 +0200 | [diff] [blame] | 33 | #define SMS_DEFAULT_DB_FILE_PATH "sms.db" |
Neels Hofmeyr | 0e5d807 | 2017-01-10 00:49:56 +0100 | [diff] [blame] | 34 | #define tmsi_from_string(str) strtoul(str, NULL, 10) |
| 35 | |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 36 | enum { |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 37 | MSC_CTR_LOC_UPDATE_TYPE_ATTACH, |
| 38 | MSC_CTR_LOC_UPDATE_TYPE_NORMAL, |
| 39 | MSC_CTR_LOC_UPDATE_TYPE_PERIODIC, |
| 40 | MSC_CTR_LOC_UPDATE_TYPE_DETACH, |
Neels Hofmeyr | 36891a7 | 2016-05-09 13:18:03 +0200 | [diff] [blame] | 41 | MSC_CTR_LOC_UPDATE_FAILED, |
| 42 | MSC_CTR_LOC_UPDATE_COMPLETED, |
Neels Hofmeyr | e3d3dc6 | 2018-03-31 00:02:14 +0200 | [diff] [blame] | 43 | MSC_CTR_CM_SERVICE_REQUEST_REJECTED, |
| 44 | MSC_CTR_CM_SERVICE_REQUEST_ACCEPTED, |
| 45 | MSC_CTR_PAGING_RESP_REJECTED, |
| 46 | MSC_CTR_PAGING_RESP_ACCEPTED, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 47 | MSC_CTR_SMS_SUBMITTED, |
| 48 | MSC_CTR_SMS_NO_RECEIVER, |
| 49 | MSC_CTR_SMS_DELIVERED, |
| 50 | MSC_CTR_SMS_RP_ERR_MEM, |
| 51 | MSC_CTR_SMS_RP_ERR_OTHER, |
Alexander Couzens | aa386d2 | 2016-08-21 20:16:33 +0200 | [diff] [blame] | 52 | MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 53 | MSC_CTR_CALL_MO_SETUP, |
| 54 | MSC_CTR_CALL_MO_CONNECT_ACK, |
| 55 | MSC_CTR_CALL_MT_SETUP, |
| 56 | MSC_CTR_CALL_MT_CONNECT, |
Alexander Couzens | 92f552f | 2016-08-23 07:32:27 +0200 | [diff] [blame] | 57 | MSC_CTR_CALL_ACTIVE, |
| 58 | MSC_CTR_CALL_COMPLETE, |
| 59 | MSC_CTR_CALL_INCOMPLETE, |
Vadim Yanitskiy | 8e25cc5 | 2018-06-23 03:32:20 +0700 | [diff] [blame] | 60 | MSC_CTR_NC_SS_MO_REQUESTS, |
| 61 | MSC_CTR_NC_SS_MO_ESTABLISHED, |
| 62 | MSC_CTR_NC_SS_MT_REQUESTS, |
| 63 | MSC_CTR_NC_SS_MT_ESTABLISHED, |
Max | 366390d | 2018-11-02 16:01:03 +0100 | [diff] [blame] | 64 | MSC_CTR_BSSMAP_CIPHER_MODE_REJECT, |
| 65 | MSC_CTR_BSSMAP_CIPHER_MODE_COMPLETE, |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | static const struct rate_ctr_desc msc_ctr_description[] = { |
Vadim Yanitskiy | bc7dabd | 2019-11-23 01:37:51 +0700 | [diff] [blame] | 69 | [MSC_CTR_LOC_UPDATE_TYPE_ATTACH] = {"loc_update_type:attach", "Received Location Update (IMSI Attach) requests."}, |
| 70 | [MSC_CTR_LOC_UPDATE_TYPE_NORMAL] = {"loc_update_type:normal", "Received Location Update (LAC change) requests."}, |
| 71 | [MSC_CTR_LOC_UPDATE_TYPE_PERIODIC] = {"loc_update_type:periodic", "Received (periodic) Location Update requests."}, |
| 72 | [MSC_CTR_LOC_UPDATE_TYPE_DETACH] = {"loc_update_type:detach", "Received IMSI Detach indications."}, |
| 73 | [MSC_CTR_LOC_UPDATE_FAILED] = {"loc_update_resp:failed", "Rejected Location Update requests."}, |
| 74 | [MSC_CTR_LOC_UPDATE_COMPLETED] = {"loc_update_resp:completed", "Successful Location Update procedures."}, |
Vadim Yanitskiy | c6b088b | 2019-12-01 23:15:49 +0700 | [diff] [blame] | 75 | [MSC_CTR_CM_SERVICE_REQUEST_REJECTED] = {"cm_service_request:rejected", "Rejected CM Service Requests."}, |
| 76 | [MSC_CTR_CM_SERVICE_REQUEST_ACCEPTED] = {"cm_service_request:accepted", "Accepted CM Service Requests."}, |
| 77 | [MSC_CTR_PAGING_RESP_REJECTED] = {"paging_resp:rejected", "Rejected Paging Responses."}, |
| 78 | [MSC_CTR_PAGING_RESP_ACCEPTED] = {"paging_resp:accepted", "Accepted Paging Responses."}, |
Vadim Yanitskiy | 1ce842d | 2019-11-23 01:24:08 +0700 | [diff] [blame] | 79 | [MSC_CTR_SMS_SUBMITTED] = {"sms:submitted", "Total MO SMS received from the MS."}, |
| 80 | [MSC_CTR_SMS_NO_RECEIVER] = {"sms:no_receiver", "Failed MO SMS delivery attempts (no receiver found)."}, |
| 81 | [MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR] = {"sms:deliver_unknown_error", "Failed MO SMS delivery attempts (other reason)."}, |
| 82 | /* FIXME: "sms:delivered" should actually count number of _successfully_ delivered MT SMS. |
| 83 | * The current description reflects its current (errorneous) behaviour. */ |
| 84 | [MSC_CTR_SMS_DELIVERED] = {"sms:delivered", "Total MT SMS delivery attempts."}, |
| 85 | [MSC_CTR_SMS_RP_ERR_MEM] = {"sms:rp_err_mem", "Failed MT SMS delivery attempts (no memory)."}, |
| 86 | [MSC_CTR_SMS_RP_ERR_OTHER] = {"sms:rp_err_other", "Failed MT SMS delivery attempts (other reason)."}, |
Vadim Yanitskiy | 1448052 | 2019-12-01 23:12:38 +0700 | [diff] [blame] | 87 | [MSC_CTR_CALL_MO_SETUP] = {"call:mo_setup", "Received MO SETUP messages (MO call establishment)."}, |
| 88 | [MSC_CTR_CALL_MO_CONNECT_ACK] = {"call:mo_connect_ack", "Received MO CONNECT messages (MO call establishment)."}, |
| 89 | [MSC_CTR_CALL_MT_SETUP] = {"call:mt_setup", "Sent MT SETUP messages (MT call establishment)."}, |
| 90 | [MSC_CTR_CALL_MT_CONNECT] = {"call:mt_connect", "Sent MT CONNECT messages (MT call establishment)."}, |
| 91 | [MSC_CTR_CALL_ACTIVE] = {"call:active", "Calls that ever reached the active state."}, |
| 92 | [MSC_CTR_CALL_COMPLETE] = {"call:complete", "Calls terminated by DISCONNECT message after reaching the active state."}, |
| 93 | [MSC_CTR_CALL_INCOMPLETE] = {"call:incomplete", "Calls terminated by any other reason after reaching the active state."}, |
Vadim Yanitskiy | 8e25cc5 | 2018-06-23 03:32:20 +0700 | [diff] [blame] | 94 | [MSC_CTR_NC_SS_MO_REQUESTS] = {"nc_ss:mo_requests", "Received MS-initiated call independent SS/USSD requests."}, |
| 95 | [MSC_CTR_NC_SS_MO_ESTABLISHED] = {"nc_ss:mo_established", "Established MS-initiated call independent SS/USSD sessions."}, |
| 96 | [MSC_CTR_NC_SS_MT_REQUESTS] = {"nc_ss:mt_requests", "Received network-initiated call independent SS/USSD requests."}, |
| 97 | [MSC_CTR_NC_SS_MT_ESTABLISHED] = {"nc_ss:mt_established", "Established network-initiated call independent SS/USSD sessions."}, |
Max | 366390d | 2018-11-02 16:01:03 +0100 | [diff] [blame] | 98 | [MSC_CTR_BSSMAP_CIPHER_MODE_REJECT] = {"bssmap:cipher_mode_reject", "Number of CIPHER MODE REJECT messages processed by BSSMAP layer"}, |
| 99 | [MSC_CTR_BSSMAP_CIPHER_MODE_COMPLETE] = {"bssmap:cipher_mode_complete", "Number of CIPHER MODE COMPLETE messages processed by BSSMAP layer"}, |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 100 | }; |
| 101 | |
Alexander Couzens | efa7b97 | 2019-04-27 23:45:37 +0200 | [diff] [blame] | 102 | enum { |
| 103 | MSC_STAT_ACTIVE_CALLS, |
| 104 | MSC_STAT_ACTIVE_NC_SS, |
| 105 | }; |
| 106 | |
Alexander Couzens | 20423ea | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 107 | static const struct rate_ctr_group_desc msc_ctrg_desc = { |
| 108 | "msc", |
| 109 | "mobile switching center", |
| 110 | OSMO_STATS_CLASS_GLOBAL, |
| 111 | ARRAY_SIZE(msc_ctr_description), |
| 112 | msc_ctr_description, |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 113 | }; |
| 114 | |
Alexander Couzens | efa7b97 | 2019-04-27 23:45:37 +0200 | [diff] [blame] | 115 | static const struct osmo_stat_item_desc msc_stat_item_description[] = { |
| 116 | [MSC_STAT_ACTIVE_CALLS] = { "msc.active_calls", "Currently active calls " , OSMO_STAT_ITEM_NO_UNIT, 4, 0}, |
| 117 | [MSC_STAT_ACTIVE_NC_SS] = { "msc.active_nc_ss", "Currently active SS/USSD sessions", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, |
| 118 | }; |
| 119 | |
| 120 | static const struct osmo_stat_item_group_desc msc_statg_desc = { |
| 121 | "net", |
| 122 | "network statistics", |
| 123 | OSMO_STATS_CLASS_GLOBAL, |
| 124 | ARRAY_SIZE(msc_stat_item_description), |
| 125 | msc_stat_item_description, |
| 126 | }; |
| 127 | |
Neels Hofmeyr | 2ff5bcd | 2017-12-15 03:02:27 +0100 | [diff] [blame] | 128 | #define MSC_PAGING_RESPONSE_TIMER_DEFAULT 10 |
Harald Welte | b84ddfc | 2009-12-01 17:36:54 +0530 | [diff] [blame] | 129 | |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 130 | struct gsm_tz { |
| 131 | int override; /* if 0, use system's time zone instead. */ |
| 132 | int hr; /* hour */ |
| 133 | int mn; /* minute */ |
| 134 | int dst; /* daylight savings */ |
| 135 | }; |
| 136 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 137 | struct gsm_network { |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 138 | /* TODO MSCSPLIT the gsm_network struct is basically a kitchen sink for |
| 139 | * global settings and variables, "madly" mixing BSC and MSC stuff. Split |
| 140 | * this in e.g. struct osmo_bsc and struct osmo_msc, with the things |
| 141 | * these have in common, like country and network code, put in yet |
| 142 | * separate structs and placed as members in osmo_bsc and osmo_msc. */ |
| 143 | |
Neels Hofmeyr | 379d579 | 2018-02-22 04:04:54 +0100 | [diff] [blame] | 144 | struct osmo_plmn_id plmn; |
| 145 | |
Harald Welte | c6ba9c2 | 2008-12-30 18:01:02 +0000 | [diff] [blame] | 146 | char *name_long; |
| 147 | char *name_short; |
Neels Hofmeyr | 379d579 | 2018-02-22 04:04:54 +0100 | [diff] [blame] | 148 | |
Harald Welte | 7b222aa | 2017-12-23 19:30:32 +0100 | [diff] [blame] | 149 | /* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */ |
| 150 | uint8_t a5_encryption_mask; |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 151 | bool authentication_required; |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 152 | int send_mm_info; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 153 | |
Neels Hofmeyr | 4dfb2ba | 2019-08-13 16:00:37 +0200 | [diff] [blame] | 154 | /* Whether to use encryption on UTRAN. |
| 155 | * TODO: we should offer a choice of UEA1 and/or UEA2, and probably replace this bool with a bit-mask of |
| 156 | * permitted Iu encryption algorithms. See also OS#4143 and the 'encryption uea' vty command. */ |
| 157 | bool uea_encryption; |
| 158 | |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 159 | struct rate_ctr_group *msc_ctrs; |
Alexander Couzens | efa7b97 | 2019-04-27 23:45:37 +0200 | [diff] [blame] | 160 | struct osmo_stat_item_group *statg; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 161 | |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 162 | /* layer 4 */ |
Neels Hofmeyr | 80447eb | 2018-12-05 01:11:28 +0100 | [diff] [blame] | 163 | char *mncc_sock_path; |
Holger Hans Peter Freyther | 694c82d | 2011-10-26 18:37:09 +0200 | [diff] [blame] | 164 | struct mncc_sock_state *mncc_state; |
Neels Hofmeyr | 402006d | 2016-05-11 14:28:25 +0200 | [diff] [blame] | 165 | mncc_recv_cb_t mncc_recv; |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 166 | struct llist_head upqueue; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 167 | struct osmo_tdef *mncc_tdefs; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 168 | /* |
Neels Hofmeyr | c036b79 | 2018-11-29 22:37:51 +0100 | [diff] [blame] | 169 | * TODO: Move the trans_list into the RAN connection and |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 170 | * create a pending list for MT transactions. These exist before |
Neels Hofmeyr | c036b79 | 2018-11-29 22:37:51 +0100 | [diff] [blame] | 171 | * we have a RAN connection. |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 172 | */ |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 173 | struct llist_head trans_list; |
| 174 | |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 175 | /* Radio Resource Location Protocol (TS 04.31) */ |
| 176 | struct { |
| 177 | enum rrlp_mode mode; |
| 178 | } rrlp; |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 179 | |
Holger Hans Peter Freyther | 11b28f9 | 2010-12-24 13:48:27 +0100 | [diff] [blame] | 180 | struct gsm_sms_queue *sms_queue; |
Daniel Willmann | 6fc4a98 | 2011-07-22 17:55:42 +0200 | [diff] [blame] | 181 | |
Vadim Yanitskiy | f40e46f | 2018-11-20 06:20:53 +0700 | [diff] [blame] | 182 | /* The "SMS over GSUP" kill-switch that basically breaks internal |
| 183 | * SMS routing (i.e. SQLite DB and SMPP), and enables forwarding |
| 184 | * of short messages over GSUP towards ESME (through VLR and HLR). |
| 185 | * Please see OS#3587 for details. This is a temporary solution, |
| 186 | * so it should be removed as soon as we move the SMS processing |
| 187 | * logic to an external process (OsmoSMSC?). REMOVE ME! */ |
| 188 | bool sms_over_gsup; |
| 189 | |
Daniel Willmann | 6fc4a98 | 2011-07-22 17:55:42 +0200 | [diff] [blame] | 190 | /* control interface */ |
| 191 | struct ctrl_handle *ctrl; |
Neels Hofmeyr | 5f0c71b | 2016-07-23 20:15:28 +0200 | [diff] [blame] | 192 | |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 193 | /* if override is nonzero, this timezone data is used for all MM |
| 194 | * contexts. */ |
| 195 | /* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable |
| 196 | * BTS|RNC specific timezone overrides for multi-tz networks in |
Neels Hofmeyr | fe291de | 2017-02-23 21:06:12 +0100 | [diff] [blame] | 197 | * OsmoMSC, this should be tied to the location area code (LAC). */ |
Neels Hofmeyr | 7398395 | 2016-05-10 13:29:33 +0200 | [diff] [blame] | 198 | struct gsm_tz tz; |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 199 | |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 200 | /* MSC: GSUP server address of the HLR */ |
| 201 | const char *gsup_server_addr_str; |
| 202 | uint16_t gsup_server_port; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 203 | struct gsup_client_mux *gcm; |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 204 | |
| 205 | struct vlr_instance *vlr; |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 206 | |
Philipp Maier | 9ca7b31 | 2018-10-10 17:00:49 +0200 | [diff] [blame] | 207 | /* Global MNCC guard timer value */ |
| 208 | int mncc_guard_timeout; |
Vadim Yanitskiy | 64623e1 | 2018-11-28 23:05:51 +0700 | [diff] [blame] | 209 | /* Global guard timer value for NCSS sessions */ |
| 210 | int ncss_guard_timeout; |
Philipp Maier | 9ca7b31 | 2018-10-10 17:00:49 +0200 | [diff] [blame] | 211 | |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 212 | struct { |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 213 | struct osmo_tdef *tdefs; |
Neels Hofmeyr | 6c8afe1 | 2017-09-04 01:03:58 +0200 | [diff] [blame] | 214 | struct mgcp_client_conf conf; |
| 215 | struct mgcp_client *client; |
| 216 | } mgw; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 217 | |
| 218 | struct { |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 219 | /* CS7 instance id number (set via VTY) */ |
| 220 | uint32_t cs7_instance; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 221 | enum nsap_addr_enc rab_assign_addr_enc; |
| 222 | |
| 223 | struct sccp_ran_inst *sri; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 224 | } iu; |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 225 | |
| 226 | struct { |
| 227 | /* CS7 instance id number (set via VTY) */ |
| 228 | uint32_t cs7_instance; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 229 | |
| 230 | struct sccp_ran_inst *sri; |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 231 | } a; |
Harald Welte | 69c54a8 | 2018-02-09 20:41:14 +0100 | [diff] [blame] | 232 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 233 | /* A list of neighbor BSCs. This list is defined statically via VTY and does not |
| 234 | * necessarily correspond to BSCs attached to the A interface at a given moment. */ |
| 235 | struct neighbor_ident_list *neighbor_list; |
| 236 | |
Harald Welte | 69c54a8 | 2018-02-09 20:41:14 +0100 | [diff] [blame] | 237 | struct { |
| 238 | /* MSISDN to which to route MO emergency calls */ |
| 239 | char *route_to_msisdn; |
| 240 | } emergency; |
Stefan Sperling | afa030d | 2018-12-06 12:06:59 +0100 | [diff] [blame] | 241 | |
| 242 | /* This is transmitted as IPA Serial Number tag, which is used for GSUP routing (e.g. in OsmoHLR). |
| 243 | * For inter-MSC handover, the remote MSC's neighbor configuration requires to match this name. |
| 244 | * If no name is set, the IPA Serial Number will be the same as the Unit Name, |
| 245 | * and will be of the form 'MSC-00-00-00-00-00-00' */ |
| 246 | char *msc_ipa_name; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 247 | |
| 248 | struct llist_head neighbor_ident_list; |
| 249 | |
| 250 | struct { |
| 251 | uint64_t range_start; |
| 252 | uint64_t range_end; |
| 253 | uint64_t next; |
| 254 | } handover_number; |
Pau Espin Pedrol | 4faff9e | 2019-05-06 19:29:11 +0200 | [diff] [blame] | 255 | |
| 256 | /* Whether we want to use Osmux against BSCs. Controlled via VTY */ |
| 257 | enum osmux_usage use_osmux; |
Keith Whyte | 991bb42 | 2019-08-08 15:43:40 +0200 | [diff] [blame] | 258 | |
| 259 | /* Whether to use call waiting on the network */ |
| 260 | bool call_waiting; |
Keith Whyte | 1587ffb | 2020-08-28 13:36:58 +0200 | [diff] [blame] | 261 | char *sms_db_file_path; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 262 | }; |
| 263 | |
Harald Welte | d4bdee7 | 2012-11-08 19:44:08 +0100 | [diff] [blame] | 264 | struct osmo_esme; |
| 265 | |
| 266 | enum gsm_sms_source_id { |
| 267 | SMS_SOURCE_UNKNOWN = 0, |
| 268 | SMS_SOURCE_MS, /* received from MS */ |
| 269 | SMS_SOURCE_VTY, /* received from VTY */ |
| 270 | SMS_SOURCE_SMPP, /* received via SMPP */ |
| 271 | }; |
| 272 | |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 273 | #define SMS_TEXT_SIZE 256 |
Harald Welte | e07b6a7 | 2012-11-23 19:02:37 +0100 | [diff] [blame] | 274 | |
| 275 | struct gsm_sms_addr { |
| 276 | uint8_t ton; |
| 277 | uint8_t npi; |
| 278 | char addr[21+1]; |
| 279 | }; |
| 280 | |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 281 | struct gsm_sms { |
Harald Welte | d409be7 | 2009-11-07 00:06:19 +0900 | [diff] [blame] | 282 | unsigned long long id; |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 283 | struct vlr_subscr *receiver; |
Harald Welte | c0de14d | 2012-11-23 23:35:01 +0100 | [diff] [blame] | 284 | struct gsm_sms_addr src, dst; |
Harald Welte | d4bdee7 | 2012-11-08 19:44:08 +0100 | [diff] [blame] | 285 | enum gsm_sms_source_id source; |
| 286 | |
| 287 | struct { |
Pablo Neira Ayuso | 93ffbd0 | 2017-05-04 18:44:22 +0200 | [diff] [blame] | 288 | uint8_t transaction_id; |
| 289 | uint32_t msg_ref; |
| 290 | } gsm411; |
| 291 | |
| 292 | struct { |
Harald Welte | d4bdee7 | 2012-11-08 19:44:08 +0100 | [diff] [blame] | 293 | struct osmo_esme *esme; |
| 294 | uint32_t sequence_nr; |
| 295 | int transaction_mode; |
| 296 | char msg_id[16]; |
| 297 | } smpp; |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 298 | |
Harald Welte | b9c758b | 2009-07-05 14:02:46 +0200 | [diff] [blame] | 299 | unsigned long validity_minutes; |
Keith | c601adc | 2017-08-16 22:45:07 +0200 | [diff] [blame] | 300 | time_t created; |
Pablo Neira Ayuso | adae859 | 2017-08-07 14:01:30 +0100 | [diff] [blame] | 301 | bool is_report; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 302 | uint8_t reply_path_req; |
| 303 | uint8_t status_rep_req; |
| 304 | uint8_t ud_hdr_ind; |
| 305 | uint8_t protocol_id; |
| 306 | uint8_t data_coding_scheme; |
| 307 | uint8_t msg_ref; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 308 | uint8_t user_data_len; |
| 309 | uint8_t user_data[SMS_TEXT_SIZE]; |
Harald Welte | f3efc59 | 2009-07-27 20:11:35 +0200 | [diff] [blame] | 310 | |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 311 | char text[SMS_TEXT_SIZE]; |
| 312 | }; |
| 313 | |
Holger Hans Peter Freyther | f8c4219 | 2013-01-09 17:03:27 +0100 | [diff] [blame] | 314 | /* control interface handling */ |
| 315 | int bsc_base_ctrl_cmds_install(void); |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 316 | int msc_ctrl_cmds_install(struct gsm_network *net); |
Holger Hans Peter Freyther | f8c4219 | 2013-01-09 17:03:27 +0100 | [diff] [blame] | 317 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 318 | #endif /* _GSM_DATA_H */ |