blob: 5475272b00473714c50248aedebc99ceb0012dfe [file] [log] [blame]
Harald Welte3561bd42018-01-28 03:04:16 +01001#pragma once
2#include <osmocom/core/fsm.h>
3
4enum 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 Welte3561bd42018-01-28 03:04:16 +010011 /* MSC has sent BSSMAP CLEAR CMD */
12 GSCON_EV_A_CLEAR_CMD,
13 /* MSC SCCP disconnect indication */
14 GSCON_EV_A_DISC_IND,
Harald Welte3561bd42018-01-28 03:04:16 +010015
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020016 GSCON_EV_ASSIGNMENT_START,
17 GSCON_EV_ASSIGNMENT_END,
Harald Welte3561bd42018-01-28 03:04:16 +010018
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020019 GSCON_EV_HANDOVER_START,
20 GSCON_EV_HANDOVER_END,
21
Harald Welte3561bd42018-01-28 03:04:16 +010022 /* RSL CONNection FAILure Indication */
23 GSCON_EV_RSL_CONN_FAIL,
24
Harald Welte3561bd42018-01-28 03:04:16 +010025 /* 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 Weltec997ceb2018-05-30 01:39:43 +020033 /* MDCX response received (MSC) - triggered by LCLS */
34 GSCON_EV_MGW_MDCX_RESP_MSC,
Harald Welte3561bd42018-01-28 03:04:16 +010035
Harald Weltec997ceb2018-05-30 01:39:43 +020036 /* LCLS child FSM has terminated due to hard failure */
37 GSCON_EV_LCLS_FAIL,
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020038
39 GSCON_EV_FORGET_LCHAN,
40 GSCON_EV_FORGET_MGW_ENDPOINT,
Harald Welte3561bd42018-01-28 03:04:16 +010041};
42
43struct gsm_subscriber_connection;
44struct gsm_network;
Neels Hofmeyr149160f2018-06-16 17:20:13 +020045struct msgb;
Neels Hofmeyrf14aaa42019-04-23 18:37:37 +020046struct osmo_mgcpc_ep_ci;
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020047struct assignment_request;
48struct gsm_lchan;
49
50void bsc_subscr_conn_fsm_init();
Harald Welte3561bd42018-01-28 03:04:16 +010051
52/* Allocate a subscriber connection and its associated FSM */
53struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020054void gscon_update_id(struct gsm_subscriber_connection *conn);
Neels Hofmeyr149160f2018-06-16 17:20:13 +020055
56void gscon_submit_rsl_dtap(struct gsm_subscriber_connection *conn,
57 struct msgb *msg, int link_id, int allow_sacch);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020058int gscon_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg);
59
Neels Hofmeyrf14aaa42019-04-23 18:37:37 +020060struct osmo_mgcpc_ep *gscon_ensure_mgw_endpoint(struct gsm_subscriber_connection *conn,
61 uint16_t msc_assigned_cic);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020062bool 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 Hofmeyrf14aaa42019-04-23 18:37:37 +020068 struct osmo_mgcpc_ep_ci **created_ci);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020069
70void gscon_start_assignment(struct gsm_subscriber_connection *conn,
71 struct assignment_request *req);
72
73void gscon_change_primary_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *new_lchan);
Neels Hofmeyr5b1a7d12018-11-06 22:24:07 +010074void gscon_release_lchans(struct gsm_subscriber_connection *conn, bool do_rr_release);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020075
76void gscon_lchan_releasing(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan);
77void gscon_forget_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan);
78
Neels Hofmeyrf14aaa42019-04-23 18:37:37 +020079void gscon_forget_mgw_endpoint_ci(struct gsm_subscriber_connection *conn, struct osmo_mgcpc_ep_ci *ci);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020080
81bool gscon_is_aoip(struct gsm_subscriber_connection *conn);
82bool gscon_is_sccplite(struct gsm_subscriber_connection *conn);