aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-01-28 02:45:46 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-19 08:20:35 +0000
commit519c7e1d428bfba728a76885c9c5394185a6497d (patch)
treefb802b82931eba0351c29cdeea8cf5054f4180a8 /include
parentc1db52f1326bd136862ff4a789fe1be27556658f (diff)
Structural reform: Get rid of osmo_bsc_sccp_con
There was always a 1:1 correspondence between gsm_subscriber_connection and osmo_bsc_sccp_con, so there's really no point in having two separate dynamically allocated data structures with pointers back and forth and another linked list around. Let's merge osmo_bsc_sccp_con into gsm_subscriber_connection for simplicity. The resulting code might not be elegant in places, but I've tried to do only the most simple changes in this patch, while further simplifications can be done in later subsequent patches. As a side-effect, this patch also fixes lchan clearing if the MSC (or the local SCCP provider) hard-disconnects the SCCP connection. Change-Id: Idd2b733477ee90d24dec369755a00f1c39c93f39
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/bsc/gsm_data.h51
-rw-r--r--include/osmocom/bsc/osmo_bsc.h53
-rw-r--r--include/osmocom/bsc/osmo_bsc_mgcp.h5
-rw-r--r--include/osmocom/bsc/osmo_bsc_sigtran.h6
4 files changed, 58 insertions, 57 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index c730d9641..04dc69673 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -25,6 +25,7 @@
#include <osmocom/gsm/protocol/gsm_12_21.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/bsc/meas_rep.h>
+#include <osmocom/bsc/bsc_msg_filter.h>
struct mgcp_client_conf;
struct mgcp_client;
@@ -80,6 +81,12 @@ struct gsm_classmark {
uint8_t classmark3[14]; /* if cm3 gets extended by spec, it will be truncated */
};
+enum subscr_sccp_state {
+ SUBSCR_SCCP_ST_NONE,
+ SUBSCR_SCCP_ST_WAIT_CONN_CONF,
+ SUBSCR_SCCP_ST_CONNECTED
+};
+
/* active radio connection of a mobile subscriber */
struct gsm_subscriber_connection {
/* global linked list of subscriber_connections */
@@ -88,9 +95,6 @@ struct gsm_subscriber_connection {
/* libbsc subscriber information (if available) */
struct bsc_subscr *bsub;
- /* SCCP connection associatd with this subscriber_connection */
- struct osmo_bsc_sccp_con *sccp_con;
-
/* back pointers */
struct gsm_network *network;
@@ -121,6 +125,47 @@ struct gsm_subscriber_connection {
* capabilities, which the MSC is required to translate into the codec list. */
struct gsm0808_speech_codec_list codec_list;
bool codec_list_present;
+
+ /* flag to prevent multiple simultaneous ciphering commands */
+ int ciphering_handled;
+
+ /* state related to welcome USSD */
+ uint8_t new_subscriber;
+
+ /* state related to osmo_bsc_filter.c */
+ struct bsc_filter_state filter_state;
+
+ /* SCCP connection associatd with this subscriber_connection */
+ struct {
+ /* for advanced ping/pong */
+ int send_ping;
+
+ /* SCCP connection realted */
+ struct bsc_msc_data *msc;
+
+ /* Sigtran connection ID */
+ int conn_id;
+ enum subscr_sccp_state state;
+ } sccp;
+
+ /* for audio handling */
+ struct {
+ uint16_t cic;
+ uint32_t rtp_ip;
+ int rtp_port;
+ /* RTP address of the remote end (assigned by MSC through assignment request) */
+ struct sockaddr_storage aoip_rtp_addr_remote;
+
+ /* Local RTP address (reported back to the MSC by us with the
+ * assignment complete message) */
+ struct sockaddr_storage aoip_rtp_addr_local;
+
+ /* storage to keep states of the MGCP connection handler, the
+ * handler is created when an assignment request is received
+ * and is terminated when the assignment complete message is
+ * sent */
+ struct mgcp_ctx *mgcp_ctx;
+ } user_plane;
};
diff --git a/include/osmocom/bsc/osmo_bsc.h b/include/osmocom/bsc/osmo_bsc.h
index 485c83648..678ac41d2 100644
--- a/include/osmocom/bsc/osmo_bsc.h
+++ b/include/osmocom/bsc/osmo_bsc.h
@@ -16,59 +16,14 @@ enum bsc_con {
};
struct bsc_msc_data;
-struct bsc_msc_connection;
-
-struct osmo_bsc_sccp_con {
- /* list_head anchoring us to gsm_network.subscr_conns */
- struct llist_head entry;
-
- /* flag to prevent multiple simultaneous ciphering commands */
- int ciphering_handled;
-
- /* for audio handling */
- struct {
- uint16_t cic;
- uint32_t rtp_ip;
- int rtp_port;
- /* RTP address of the remote end (assigned by MSC through assignment request) */
- struct sockaddr_storage aoip_rtp_addr_remote;
-
- /* Local RTP address (reported back to the MSC by us with the
- * assignment complete message) */
- struct sockaddr_storage aoip_rtp_addr_local;
-
- /* storage to keep states of the MGCP connection handler, the
- * handler is created when an assignment request is received
- * and is terminated when the assignment complete message is
- * sent */
- struct mgcp_ctx *mgcp_ctx;
- } user_plane;
-
- /* for advanced ping/pong */
- int send_ping;
-
- /* SCCP connection realted */
- struct bsc_msc_data *msc;
-
- /* back-pointer to subscriber connection */
- struct gsm_subscriber_connection *conn;
- /* state related to welcome USSD */
- uint8_t new_subscriber;
-
- /* state related to osmo_bsc_filter.c */
- struct bsc_filter_state filter_state;
-
- /* Sigtran connection ID */
- int conn_id;
-};
struct bsc_api *osmo_bsc_api();
-int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg);
-int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg);
+int bsc_queue_for_msc(struct gsm_subscriber_connection *conn, struct msgb *msg);
+int bsc_open_connection(struct gsm_subscriber_connection *sccp, struct msgb *msg);
enum bsc_con bsc_create_new_connection(struct gsm_subscriber_connection *conn,
struct bsc_msc_data *msc, int send_ping);
-int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp);
+int bsc_delete_connection(struct gsm_subscriber_connection *sccp);
struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn, struct msgb *);
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
@@ -76,7 +31,7 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn);
int bsc_handle_udt(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length);
-int bsc_handle_dt(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);
+int bsc_handle_dt(struct gsm_subscriber_connection *conn, struct msgb *msg, unsigned int len);
int bsc_ctrl_cmds_install();
diff --git a/include/osmocom/bsc/osmo_bsc_mgcp.h b/include/osmocom/bsc/osmo_bsc_mgcp.h
index dc2ba3475..15039f747 100644
--- a/include/osmocom/bsc/osmo_bsc_mgcp.h
+++ b/include/osmocom/bsc/osmo_bsc_mgcp.h
@@ -43,7 +43,7 @@ struct mgcp_ctx {
/* Copy of the pointer and the data with context information
* needed to process the AoIP and MGCP requests (system data) */
struct mgcp_client *mgcp;
- struct osmo_bsc_sccp_con *conn;
+ struct gsm_subscriber_connection *conn;
enum gsm48_chan_mode chan_mode;
bool full_rate;
struct gsm_lchan *lchan;
@@ -54,7 +54,8 @@ struct mgcp_ctx {
void mgcp_init(struct gsm_network *net);
-struct mgcp_ctx *mgcp_assignm_req(void *ctx, struct mgcp_client *mgcp, struct osmo_bsc_sccp_con *conn,
+struct mgcp_ctx *mgcp_assignm_req(void *ctx, struct mgcp_client *mgcp,
+ struct gsm_subscriber_connection *conn,
enum gsm48_chan_mode chan_mode, bool full_rate);
void mgcp_clear_complete(struct mgcp_ctx *mgcp_ctx, struct msgb *resp);
void mgcp_ass_complete(struct mgcp_ctx *mgcp_ctx, struct gsm_lchan *lchan);
diff --git a/include/osmocom/bsc/osmo_bsc_sigtran.h b/include/osmocom/bsc/osmo_bsc_sigtran.h
index 89649036e..5cb723066 100644
--- a/include/osmocom/bsc/osmo_bsc_sigtran.h
+++ b/include/osmocom/bsc/osmo_bsc_sigtran.h
@@ -28,15 +28,15 @@
enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, struct bsc_msc_data *msc);
/* Open a new connection oriented sigtran connection */
-int osmo_bsc_sigtran_open_conn(const struct osmo_bsc_sccp_con *conn, struct msgb *msg);
+int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg);
/* Send data to MSC */
-int osmo_bsc_sigtran_send(const struct osmo_bsc_sccp_con *conn, struct msgb *msg);
+int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg);
/* Delete a connection from the list with open connections
* (called by osmo_bsc_api.c on failing open connections and
* locally, when a connection is closed by the MSC */
-int osmo_bsc_sigtran_del_conn(struct osmo_bsc_sccp_con *sccp);
+int osmo_bsc_sigtran_del_conn(struct gsm_subscriber_connection *sccp);
/* Initalize osmo sigtran backhaul */
int osmo_bsc_sigtran_init(struct llist_head *mscs);