aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/bsc/Makefile.am2
-rw-r--r--include/osmocom/bsc/bsc_api.h3
-rw-r--r--include/osmocom/bsc/bsc_subscr_conn_fsm.h74
-rw-r--r--include/osmocom/bsc/gsm_data.h33
-rw-r--r--include/osmocom/bsc/handover.h20
-rw-r--r--include/osmocom/bsc/osmo_bsc.h2
-rw-r--r--include/osmocom/bsc/osmo_bsc_mgcp.h62
-rw-r--r--include/osmocom/bsc/osmo_bsc_sigtran.h5
8 files changed, 114 insertions, 87 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 17e8bd313..b25dfd833 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -12,6 +12,7 @@ noinst_HEADERS = \
bsc_nat_sccp.h \
bsc_rll.h \
bsc_subscriber.h \
+ bsc_subscr_conn_fsm.h \
bss.h \
bts_ipaccess_nanobts_omlattr.h \
chan_alloc.h \
@@ -36,7 +37,6 @@ noinst_HEADERS = \
openbscdefines.h \
osmo_bsc.h \
osmo_bsc_grace.h \
- osmo_bsc_mgcp.h \
osmo_bsc_rf.h \
osmo_bsc_sigtran.h \
bsc_msc_data.h \
diff --git a/include/osmocom/bsc/bsc_api.h b/include/osmocom/bsc/bsc_api.h
index 6ee05629f..01f90b158 100644
--- a/include/osmocom/bsc/bsc_api.h
+++ b/include/osmocom/bsc/bsc_api.h
@@ -46,6 +46,9 @@ struct bsc_api {
void (*conn_cleanup)(struct gsm_subscriber_connection *conn);
};
+uint8_t lchan_to_chosen_channel(struct gsm_lchan *lchan);
+uint8_t chan_mode_to_speech(struct gsm_lchan *lchan);
+
int bsc_api_init(struct gsm_network *network, struct bsc_api *api);
int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id, int allow_sacch);
int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate);
diff --git a/include/osmocom/bsc/bsc_subscr_conn_fsm.h b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
new file mode 100644
index 000000000..234161fa0
--- /dev/null
+++ b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
@@ -0,0 +1,74 @@
+#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 requests assignment */
+ GSCON_EV_A_ASSIGNMENT_CMD,
+ /* MSC has sent BSSMAP CLEAR CMD */
+ GSCON_EV_A_CLEAR_CMD,
+ /* MSC SCCP disconnect indication */
+ GSCON_EV_A_DISC_IND,
+ /* MSC sends Handover Request (in CR) */
+ GSCON_EV_A_HO_REQ,
+
+ /* RR ASSIGNMENT COMPLETE received */
+ GSCON_EV_RR_ASS_COMPL,
+ /* RR ASSIGNMENT FAIL received */
+ GSCON_EV_RR_ASS_FAIL,
+ /* RR MODE MODIFY ACK received */
+ GSCON_EV_RR_MODE_MODIFY_ACK,
+
+ /* RR HO ACC (access burst on ext HO) */
+ GSCON_EV_RR_HO_ACC, /* NOT USED YET! */
+ /* RR HANDOVER COMPLETE received */
+ GSCON_EV_RR_HO_COMPL, /* NOT USED YET! */
+ GSCON_EV_RR_HO_FAIL, /* NOT USED YET! */
+
+ /* RSL RLL Release Indication */
+ GSCON_EV_RLL_REL_IND,
+ /* RSL CONNection FAILure Indication */
+ GSCON_EV_RSL_CONN_FAIL,
+
+ /* RSL/lchan tells us clearing is complete */
+ GSCON_EV_RSL_CLEAR_COMPL,
+
+ /* 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,
+
+ /* MGW is indicating failure (BTS) */
+ GSCON_EV_MGW_FAIL_BTS,
+ /* MGW is indicating failure (MSC) */
+ GSCON_EV_MGW_FAIL_MSC,
+ /* CRCX response received (BTS) */
+ GSCON_EV_MGW_CRCX_RESP_BTS,
+ /* MDCX response received (BTS) */
+ GSCON_EV_MGW_MDCX_RESP_BTS,
+ /* CRCX response received (MSC) */
+ GSCON_EV_MGW_CRCX_RESP_MSC,
+
+ /* Internal handover request (intra-BSC handover) */
+ GSCON_EV_HO_START,
+ /* Handover timed out (T3103 in handover_logic.c) */
+ GSCON_EV_HO_TIMEOUT,
+ /* Handover failed (handover_logic.c) */
+ GSCON_EV_HO_FAIL,
+ /* Handover completed successfully (handover_logic.c) */
+ GSCON_EV_HO_COMPL,
+};
+
+struct gsm_subscriber_connection;
+struct gsm_network;
+
+/* Allocate a subscriber connection and its associated FSM */
+struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net);
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 74009a9c2..82a5a5129 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -15,10 +15,12 @@
#include <osmocom/gsm/bts_features.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
#include <osmocom/gsm/gsm48.h>
+#include <osmocom/core/fsm.h>
#include <osmocom/crypt/auth.h>
#include <osmocom/bsc/rest_octets.h>
+#include <osmocom/bsc/handover.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/gsm/gsm_utils.h>
@@ -95,6 +97,9 @@ struct gsm_subscriber_connection {
/* global linked list of subscriber_connections */
struct llist_head entry;
+ /* FSM instance to control the subscriber connection state (RTP, A) */
+ struct osmo_fsm_inst *fi;
+
/* libbsc subscriber information (if available) */
struct bsc_subscr *bsub;
@@ -103,8 +108,9 @@ struct gsm_subscriber_connection {
/* the primary / currently active lchan to the BTS/subscriber */
struct gsm_lchan *lchan;
- /* the future/allocated but not yet used lchan during HANDOVER */
- struct gsm_lchan *ho_lchan;
+
+ /* handover information, if a handover is pending for this conn. */
+ struct bsc_handover *ho;
/* timer for assignment handling */
struct osmo_timer_list T10;
@@ -166,11 +172,21 @@ struct gsm_subscriber_connection {
* 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;
+ /* FSM instance to control the BTS sided RTP connection */
+ struct osmo_fsm_inst *fi_bts;
+
+ /* FSM instance to control the MSC sided RTP connection */
+ struct osmo_fsm_inst *fi_msc;
+
+ /* Endpoint identifier of the MGCP endpoint the connection uses */
+ char *mgw_endpoint;
+
+ /* Channel rate flag, FR=1, HR=0, Invalid=-1 */
+ int full_rate;
+
+ /* Channel mode flage (signaling or voice channel) */
+ enum gsm48_chan_mode chan_mode;
+
} user_plane;
};
@@ -1340,8 +1356,7 @@ void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
int gsm_bts_model_register(struct gsm_bts_model *model);
-struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan *lchan);
-void bsc_subscr_con_free(struct gsm_subscriber_connection *conn);
+struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *network);
struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network);
void msc_subscr_con_free(struct gsm_subscriber_connection *conn);
diff --git a/include/osmocom/bsc/handover.h b/include/osmocom/bsc/handover.h
index 0fbfaf671..eb03f6a7b 100644
--- a/include/osmocom/bsc/handover.h
+++ b/include/osmocom/bsc/handover.h
@@ -4,10 +4,12 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
+#include <osmocom/gsm/gsm_utils.h>
struct gsm_lchan;
struct gsm_bts;
struct gsm_subscriber_connection;
+struct gsm_meas_rep mr;
#define LOGPHOLCHANTOLCHAN(old_lchan, new_lchan, level, fmt, args...) \
LOGP(DHODEC, level, "(BTS %u trx %u arfcn %u ts %u lchan %u %s)->(BTS %u trx %u arfcn %u ts %u lchan %u %s) (subscr %s) " fmt, \
@@ -38,21 +40,23 @@ enum hodec_id {
struct bsc_handover {
struct llist_head list;
- enum hodec_id from_hodec_id;
-
+ /* Initial details of what is requested */
struct gsm_lchan *old_lchan;
- struct gsm_lchan *new_lchan;
-
- struct osmo_timer_list T3103;
-
- uint8_t ho_ref;
+ struct gsm_bts *new_bts;
+ enum gsm_chan_t new_lchan_type;
+ bool async;
+ /* Derived and resulting state */
bool inter_cell;
- bool async;
+ uint8_t ho_ref;
+ enum hodec_id from_hodec_id;
+ struct gsm_lchan *new_lchan;
+ struct osmo_timer_list T3103;
};
int bsc_handover_start(enum hodec_id from_hodec_id, struct gsm_lchan *old_lchan, struct gsm_bts *new_bts,
enum gsm_chan_t new_lchan_type);
+int bsc_handover_start_gscon(struct gsm_subscriber_connection *conn);
void bsc_clear_handover(struct gsm_subscriber_connection *conn, int free_lchan);
struct gsm_lchan *bsc_handover_pending(struct gsm_lchan *new_lchan);
diff --git a/include/osmocom/bsc/osmo_bsc.h b/include/osmocom/bsc/osmo_bsc.h
index 678ac41d2..ed5698db4 100644
--- a/include/osmocom/bsc/osmo_bsc.h
+++ b/include/osmocom/bsc/osmo_bsc.h
@@ -39,6 +39,4 @@ void bsc_gen_location_state_trap(struct gsm_bts *bts);
struct llist_head *bsc_access_lists(void);
-int bssmap_send_aoip_ass_compl(struct gsm_lchan *lchan);
-
#endif
diff --git a/include/osmocom/bsc/osmo_bsc_mgcp.h b/include/osmocom/bsc/osmo_bsc_mgcp.h
deleted file mode 100644
index 15039f747..000000000
--- a/include/osmocom/bsc/osmo_bsc_mgcp.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#pragma once
-
-#include <osmocom/mgcp_client/mgcp_common.h>
-#include <osmocom/mgcp_client/mgcp_client.h>
-
-/* MGCP state handler context. This context information stores all information
- * to handle the direction of the RTP streams via MGCP. There is one instance
- * of this context struct per subscriber connection.
- * (see also struct osmo_bsc_sccp_con) */
-struct mgcp_ctx {
- /* FSM instance, which handles the connection switching procedure */
- struct osmo_fsm_inst *fsm;
-
- /* RTP endpoint number. This number number identifies the endpoint
- * on the MGW on which the BTS and NET connection is created. This
- * endpoint number is assigned and released automatically. */
- uint16_t rtp_endpoint;
-
- /* RTP connection identifiers */
- char conn_id_bts[MGCP_CONN_ID_LENGTH];
- char conn_id_net[MGCP_CONN_ID_LENGTH];
-
- /* 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 gsm_subscriber_connection *conn;
- enum gsm48_chan_mode chan_mode;
- bool full_rate;
- struct gsm_lchan *lchan;
- struct gsm_lchan *ho_lchan;
- struct msgb *resp;
- mgcp_trans_id_t mgw_pending_trans;
-};
-
-void mgcp_init(struct gsm_network *net);
-
-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);
-void mgcp_free_ctx(struct mgcp_ctx *mgcp_ctx);
diff --git a/include/osmocom/bsc/osmo_bsc_sigtran.h b/include/osmocom/bsc/osmo_bsc_sigtran.h
index 5cb723066..80d4f5b8b 100644
--- a/include/osmocom/bsc/osmo_bsc_sigtran.h
+++ b/include/osmocom/bsc/osmo_bsc_sigtran.h
@@ -33,11 +33,6 @@ int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct ms
/* Send data to MSC */
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 gsm_subscriber_connection *sccp);
-
/* Initalize osmo sigtran backhaul */
int osmo_bsc_sigtran_init(struct llist_head *mscs);