Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 1 | #pragma once |
Neels Hofmeyr | b523f54 | 2020-07-09 15:54:40 +0200 | [diff] [blame] | 2 | #include <osmocom/gsm/protocol/gsm_08_08.h> |
| 3 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 4 | #include <osmocom/core/fsm.h> |
| 5 | |
| 6 | enum gscon_fsm_event { |
| 7 | /* local SCCP stack tells us incoming conn from MSC */ |
| 8 | GSCON_EV_A_CONN_IND, |
| 9 | /* RSL side requests CONNECT to MSC */ |
| 10 | GSCON_EV_A_CONN_REQ, |
| 11 | /* MSC confirms the SCCP connection */ |
| 12 | GSCON_EV_A_CONN_CFM, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 13 | /* MSC has sent BSSMAP CLEAR CMD */ |
| 14 | GSCON_EV_A_CLEAR_CMD, |
| 15 | /* MSC SCCP disconnect indication */ |
| 16 | GSCON_EV_A_DISC_IND, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 17 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 18 | GSCON_EV_ASSIGNMENT_START, |
| 19 | GSCON_EV_ASSIGNMENT_END, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 20 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 21 | GSCON_EV_HANDOVER_START, |
| 22 | GSCON_EV_HANDOVER_END, |
| 23 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 24 | /* RSL CONNection FAILure Indication */ |
| 25 | GSCON_EV_RSL_CONN_FAIL, |
| 26 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 27 | /* Mobile-originated DTAP (from MS) */ |
| 28 | GSCON_EV_MO_DTAP, |
| 29 | /* Mobile-terminated DTAP (from MSC) */ |
| 30 | GSCON_EV_MT_DTAP, |
| 31 | |
| 32 | /* Transmit custom SCCP message */ |
| 33 | GSCON_EV_TX_SCCP, |
| 34 | |
Harald Welte | c997ceb | 2018-05-30 01:39:43 +0200 | [diff] [blame] | 35 | /* MDCX response received (MSC) - triggered by LCLS */ |
| 36 | GSCON_EV_MGW_MDCX_RESP_MSC, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 37 | |
Harald Welte | c997ceb | 2018-05-30 01:39:43 +0200 | [diff] [blame] | 38 | /* LCLS child FSM has terminated due to hard failure */ |
| 39 | GSCON_EV_LCLS_FAIL, |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 40 | |
| 41 | GSCON_EV_FORGET_LCHAN, |
| 42 | GSCON_EV_FORGET_MGW_ENDPOINT, |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 43 | }; |
| 44 | |
Neels Hofmeyr | b523f54 | 2020-07-09 15:54:40 +0200 | [diff] [blame] | 45 | struct gscon_clear_cmd_data { |
| 46 | enum gsm0808_cause cause_0808; |
| 47 | bool is_csfb; |
| 48 | }; |
| 49 | |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 50 | struct gsm_subscriber_connection; |
| 51 | struct gsm_network; |
Neels Hofmeyr | 149160f | 2018-06-16 17:20:13 +0200 | [diff] [blame] | 52 | struct msgb; |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 53 | struct osmo_mgcpc_ep_ci; |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 54 | struct assignment_request; |
| 55 | struct gsm_lchan; |
| 56 | |
| 57 | void bsc_subscr_conn_fsm_init(); |
Harald Welte | 3561bd4 | 2018-01-28 03:04:16 +0100 | [diff] [blame] | 58 | |
| 59 | /* Allocate a subscriber connection and its associated FSM */ |
| 60 | struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 61 | void gscon_update_id(struct gsm_subscriber_connection *conn); |
Neels Hofmeyr | 149160f | 2018-06-16 17:20:13 +0200 | [diff] [blame] | 62 | |
| 63 | void gscon_submit_rsl_dtap(struct gsm_subscriber_connection *conn, |
| 64 | struct msgb *msg, int link_id, int allow_sacch); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 65 | int gscon_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg); |
| 66 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 67 | struct osmo_mgcpc_ep *gscon_ensure_mgw_endpoint(struct gsm_subscriber_connection *conn, |
| 68 | uint16_t msc_assigned_cic); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 69 | bool gscon_connect_mgw_to_msc(struct gsm_subscriber_connection *conn, |
| 70 | struct gsm_lchan *for_lchan, |
| 71 | const char *addr, uint16_t port, |
| 72 | struct osmo_fsm_inst *notify, |
| 73 | uint32_t event_success, uint32_t event_failure, |
| 74 | void *notify_data, |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 75 | struct osmo_mgcpc_ep_ci **created_ci); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 76 | |
| 77 | void gscon_start_assignment(struct gsm_subscriber_connection *conn, |
| 78 | struct assignment_request *req); |
| 79 | |
| 80 | void gscon_change_primary_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *new_lchan); |
Neels Hofmeyr | b523f54 | 2020-07-09 15:54:40 +0200 | [diff] [blame] | 81 | void gscon_release_lchans(struct gsm_subscriber_connection *conn, bool do_rr_release, enum gsm48_rr_cause cause_rr); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 82 | |
| 83 | void gscon_lchan_releasing(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan); |
| 84 | void gscon_forget_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan); |
| 85 | |
Neels Hofmeyr | f14aaa4 | 2019-04-23 18:37:37 +0200 | [diff] [blame] | 86 | void gscon_forget_mgw_endpoint_ci(struct gsm_subscriber_connection *conn, struct osmo_mgcpc_ep_ci *ci); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 87 | |
| 88 | bool gscon_is_aoip(struct gsm_subscriber_connection *conn); |
| 89 | bool gscon_is_sccplite(struct gsm_subscriber_connection *conn); |