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