aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc/bsc_subscr_conn_fsm.h
blob: 2317c83edc468619a2bd7c1fa5635e291b5c68b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include <osmocom/core/fsm.h>

enum gscon_fsm_event {
	/* local SCCP stack tells us incoming conn from MSC */
	GSCON_EV_A_CONN_IND,
	/* RSL side requests CONNECT to MSC */
	GSCON_EV_A_CONN_REQ,
	/* MSC confirms the SCCP connection */
	GSCON_EV_A_CONN_CFM,
	/* MSC has sent BSSMAP CLEAR CMD */
	GSCON_EV_A_CLEAR_CMD,
	/* MSC SCCP disconnect indication */
	GSCON_EV_A_DISC_IND,

	GSCON_EV_ASSIGNMENT_START,
	GSCON_EV_ASSIGNMENT_END,

	GSCON_EV_HANDOVER_START,
	GSCON_EV_HANDOVER_END,

	/* RSL CONNection FAILure Indication */
	GSCON_EV_RSL_CONN_FAIL,

	/* Mobile-originated DTAP (from MS) */
	GSCON_EV_MO_DTAP,
	/* Mobile-terminated DTAP (from MSC) */
	GSCON_EV_MT_DTAP,

	/* Transmit custom SCCP message */
	GSCON_EV_TX_SCCP,

	/* MDCX response received (MSC) - triggered by LCLS */
	GSCON_EV_MGW_MDCX_RESP_MSC,

	/* LCLS child FSM has terminated due to hard failure */
	GSCON_EV_LCLS_FAIL,

	GSCON_EV_FORGET_LCHAN,
	GSCON_EV_FORGET_MGW_ENDPOINT,
};

struct gsm_subscriber_connection;
struct gsm_network;
struct msgb;
struct mgcp_conn_peer;
struct mgwep_ci;
struct assignment_request;
struct gsm_lchan;

/* Allocate a subscriber connection and its associated FSM */
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net);
void gscon_update_id(struct gsm_subscriber_connection *conn);

int gscon_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg);

struct mgw_endpoint *gscon_ensure_mgw_endpoint(struct gsm_subscriber_connection *conn);
bool gscon_connect_mgw_to_msc(struct gsm_subscriber_connection *conn,
			      const char *addr, uint16_t port,
			      struct osmo_fsm_inst *notify,
			      uint32_t event_success, uint32_t event_failure,
			      void *notify_data,
			      struct mgwep_ci **created_ci);

void gscon_start_assignment(struct gsm_subscriber_connection *conn,
			    struct assignment_request *req);

void gscon_change_primary_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan **new_lchan);
void gscon_release_lchans(struct gsm_subscriber_connection *conn, bool do_sacch_deact);

void gscon_lchan_releasing(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan);
void gscon_forgetx_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan);