Change in osmo-bsc[master]: remove struct bsc_api

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jun 7 01:01:43 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/9482


Change subject: remove struct bsc_api
......................................................................

remove struct bsc_api

struct bsc_api was used to provide an abstract API for both osmo-bsc and
osmo-msc, between BSC and MSC. That's no longer needed, so get rid of it, to
prevent code turbulences it creates for no reason.

Change-Id: I3fd5888c63a0b4f95520a498320aa105a6d60579
---
M include/osmocom/bsc/bsc_api.h
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/bsc_api.c
M src/osmo-bsc/osmo_bsc_api.c
M src/osmo-bsc/osmo_bsc_main.c
M tests/bsc/bsc_test.c
M tests/handover/handover_test.c
7 files changed, 86 insertions(+), 198 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/82/9482/1

diff --git a/include/osmocom/bsc/bsc_api.h b/include/osmocom/bsc/bsc_api.h
index 06f8093..a90268b 100644
--- a/include/osmocom/bsc/bsc_api.h
+++ b/include/osmocom/bsc/bsc_api.h
@@ -8,43 +8,18 @@
 #define BSC_API_CONN_POL_ACCEPT	0
 #define BSC_API_CONN_POL_REJECT	1
 
-struct bsc_api {
-	/*! \brief BTS->MSC: tell MSC a SAPI was not established */
-	void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci);
-	/*! \brief MS->MSC: Tell MSC that ciphering has been enabled */
-	void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn,
-				  struct msgb *msg, uint8_t chosen_encr);
-	/*! \brief MS->MSC: New MM context with L3 payload */
-	int (*compl_l3)(struct gsm_subscriber_connection *conn,
-			struct msgb *msg, uint16_t chosen_channel); 
-	/*! \brief MS->BSC/MSC: Um L3 message */
-	void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id,
-			struct msgb *msg);
-	/*! \brief BSC->MSC: Assignment of lchan successful */
-	void (*assign_compl)(struct gsm_subscriber_connection *conn, uint8_t rr_cause);
-	/*! \brief BSC->MSC: Assignment of lchan failed */
-	void (*assign_fail)(struct gsm_subscriber_connection *conn,
-			 uint8_t cause, uint8_t *rr_cause);
-	/*! \brief BSC->MSC: RR conn has been cleared */
-	int (*clear_request)(struct gsm_subscriber_connection *conn,
-			      uint32_t cause);
-	/*! \brief BSC->MSC: Classmark Update */
-	void (*classmark_chg)(struct gsm_subscriber_connection *conn,
-			      const uint8_t *cm2, uint8_t cm2_len,
-			      const uint8_t *cm3, uint8_t cm3_len);
+void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci);
+void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr);
+int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel);
+void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg);
+void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause);
+void bsc_assign_fail(struct gsm_subscriber_connection *conn, uint8_t cause, uint8_t *rr_cause);
+int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
+void bsc_cm_update(struct gsm_subscriber_connection *conn,
+		   const uint8_t *cm2, uint8_t cm2_len,
+		   const uint8_t *cm3, uint8_t cm3_len);
+void bsc_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate);
 
-	/**
-	 * Configure the multirate setting on this channel. If it is
-	 * not implemented AMR5.9 will be used.
-	 */
-	void (*mr_config)(struct gsm_subscriber_connection *conn,
-				struct gsm_lchan *lchan, int full_rate);
-
-	/** Callback for additional actions during conn cleanup */
-	void (*conn_cleanup)(struct gsm_subscriber_connection *conn);
-};
-
-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);
 int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index a8d1f92..56cca16 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -256,7 +256,6 @@
 struct gsm_lchan;
 struct osmo_rtp_socket;
 struct rtp_socket;
-struct bsc_api;
 
 /* Network Management State */
 struct gsm_nm_state {
@@ -1217,8 +1216,6 @@
 
 	struct rate_ctr_group *bsc_ctrs;
 
-	struct bsc_api *bsc_api;
-
 	unsigned int num_bts;
 	struct llist_head bts_list;
 
diff --git a/src/osmo-bsc/bsc_api.c b/src/osmo-bsc/bsc_api.c
index 8ae781e..5334314 100644
--- a/src/osmo-bsc/bsc_api.c
+++ b/src/osmo-bsc/bsc_api.c
@@ -45,52 +45,9 @@
 #define HO_DTAP_CACHE_MSGB_CB_ALLOW_SACCH 1
 
 static void rll_ind_cb(struct gsm_lchan *, uint8_t, void *, enum bsc_rllr_ind);
-static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id);
-static void handle_release(struct gsm_subscriber_connection *conn, struct bsc_api *bsc, struct  gsm_lchan *lchan);
-static void handle_chan_ack(struct gsm_subscriber_connection *conn, struct bsc_api *bsc, struct  gsm_lchan *lchan);
-static void handle_chan_nack(struct gsm_subscriber_connection *conn, struct bsc_api *bsc, struct  gsm_lchan *lchan);
-
-/*! \brief Determine and apply AMR multi-rate configuration to lchan
- *  Determine which AMR multi-rate configuration to use and apply it to
- *  the lchan (so it can be communicated to BTS and MS during channel
- *  activation.
- *  \param[in] conn subscriber connection (used to resolve bsc_api)
- *  \param[out] lchan logical channel to which to apply mr config
- *  \param[in] full_rate whether to use full-rate (1) or half-rate (0) config
- */
-static void handle_mr_config(struct gsm_subscriber_connection *conn,
-			     struct gsm_lchan *lchan, int full_rate)
-{
-	struct bsc_api *api;
-	api = conn->network->bsc_api;
-	struct amr_multirate_conf *mr;
-	struct gsm48_multi_rate_conf *mr_conf;
-
-	/* BSC api override for this method, used in OsmoBSC mode with
-	 * bsc_mr_config() to use MSC-specific/specified configuration */
-	if (api->mr_config)
-		return api->mr_config(conn, lchan, full_rate);
-
-	/* NITB case: use the BTS-specic multi-rate configuration from
-	 * the vty/configuration file */
-	if (full_rate)
-		mr = &lchan->ts->trx->bts->mr_full;
-	else
-		mr = &lchan->ts->trx->bts->mr_half;
-
-	mr_conf = (struct gsm48_multi_rate_conf *) mr->gsm48_ie;
-	mr_conf->ver = 1;
-
-	/* default, if no AMR codec defined */
-	if (!mr->gsm48_ie[1]) {
-		mr_conf->icmi = 1;
-		mr_conf->m5_90 = 1;
-	}
-	/* store encoded MR config IE lchan for both MS (uplink) and BTS
-	 * (downlink) directions */
-	gsm48_multirate_config(lchan->mr_ms_lv, mr, mr->ms_mode);
-	gsm48_multirate_config(lchan->mr_bts_lv, mr, mr->bts_mode);
-}
+static void handle_release(struct gsm_subscriber_connection *conn, struct  gsm_lchan *lchan);
+static void handle_chan_ack(struct gsm_subscriber_connection *conn, struct  gsm_lchan *lchan);
+static void handle_chan_nack(struct gsm_subscriber_connection *conn, struct  gsm_lchan *lchan);
 
 /*
  * Start a new assignment and make sure that it is completed within T10 either
@@ -145,7 +102,7 @@
 
 	/* handle AMR correctly */
 	if (chan_mode == GSM48_CMODE_SPEECH_AMR)
-		handle_mr_config(conn, new_lchan, full_rate);
+		bsc_mr_config(conn, new_lchan, full_rate);
 
 	if (rsl_chan_activate_lchan(new_lchan, 0x1, 0) < 0) {
 		LOGPLCHAN(new_lchan, DHO, LOGL_ERROR, "could not activate channel\n");
@@ -202,12 +159,6 @@
 	}
 }
 
-int bsc_api_init(struct gsm_network *network, struct bsc_api *api)
-{
-	network->bsc_api = api;
-	return 0;
-}
-
 /*! \brief process incoming 08.08 DTAP from MSC (send via BTS to MS) */
 int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
 			struct msgb *msg, int link_id, int allow_sacch)
@@ -246,7 +197,7 @@
 		OBSC_LINKID_CB(msg) = link_id;
 		if (rll_establish(msg->lchan, sapi, rll_ind_cb, msg) != 0) {
 			msgb_free(msg);
-			send_sapi_reject(conn, link_id);
+			bsc_sapi_n_reject(conn, link_id);
 			return -1;
 		}
 		return 0;
@@ -306,9 +257,6 @@
 {
 	/* TODO: Add multirate configuration, make it work for more than audio. */
 
-	struct bsc_api *api;
-	api = conn->network->bsc_api;
-
 	if (!chan_compat_with_mode(conn->lchan, chan_mode, full_rate)) {
 		if (handle_new_assignment(conn, chan_mode, full_rate) != 0)
 			goto error;
@@ -319,7 +267,7 @@
 			return 1;
 
 		if (chan_mode == GSM48_CMODE_SPEECH_AMR)
-			handle_mr_config(conn, conn->lchan, full_rate);
+			bsc_mr_config(conn, conn->lchan, full_rate);
 
 		LOGPLCHAN(conn->lchan, DMSC, LOGL_NOTICE,
 			  "Sending ChanModify for speech: %s\n",
@@ -331,7 +279,7 @@
 	return 0;
 
 error:
-	api->assign_fail(conn, 0, NULL);
+	bsc_assign_fail(conn, 0, NULL);
 	return -1;
 }
 
@@ -345,7 +293,6 @@
 			     struct msgb *msg)
 {
 	struct gsm48_hdr *gh = msgb_l3(msg);
-	struct bsc_api *api = conn->network->bsc_api;
 	enum gsm48_rr_cause cause;
 
 	/* Expecting gsm48_hdr + cause value */
@@ -393,13 +340,12 @@
 	if (is_ipaccess_bts(conn_get_bts(conn)) && conn->lchan->tch_mode != GSM48_CMODE_SIGN)
 		rsl_ipacc_crcx(conn->lchan);
 
-	api->assign_compl(conn, cause);
+	bsc_assign_compl(conn, cause);
 }
 
 static void handle_ass_fail(struct gsm_subscriber_connection *conn,
 			    struct msgb *msg)
 {
-	struct bsc_api *api = conn->network->bsc_api;
 	uint8_t *rr_failure;
 	struct gsm48_hdr *gh;
 
@@ -446,15 +392,12 @@
 		rr_failure = &gh->data[0];
 	}
 
-	api->assign_fail(conn,
-			 GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE,
-			 rr_failure);
+	bsc_assign_fail(conn, GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, rr_failure);
 }
 
 static void handle_classmark_chg(struct gsm_subscriber_connection *conn,
 				 struct msgb *msg)
 {
-	struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
 	struct gsm48_hdr *gh = msgb_l3(msg);
 	unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
 	uint8_t cm2_len, cm3_len = 0;
@@ -486,7 +429,7 @@
 		}
 		DEBUGPC(DRR, "CM3(len=%u)\n", cm3_len);
 	}
-	api->classmark_chg(conn, cm2, cm2_len, cm3, cm3_len);
+	bsc_cm_update(conn, cm2, cm2_len, cm3, cm3_len);
 }
 
 /* Chapter 9.1.16 Handover complete */
@@ -533,7 +476,6 @@
 static void dispatch_dtap(struct gsm_subscriber_connection *conn,
 			  uint8_t link_id, struct msgb *msg)
 {
-	struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
 	struct gsm48_hdr *gh;
 	uint8_t pdisc;
 	uint8_t msg_type;
@@ -582,9 +524,7 @@
 			handle_rr_ho_fail(msg);
 			break;
 		case GSM48_MT_RR_CIPH_M_COMPL:
-			if (api->cipher_mode_compl)
-				api->cipher_mode_compl(conn, msg,
-						conn->lchan->encr.alg_id);
+			bsc_cipher_mode_compl(conn, msg, conn->lchan->encr.alg_id);
 			break;
 		case GSM48_MT_RR_ASS_COMPL:
 			handle_ass_compl(conn, msg);
@@ -595,13 +535,10 @@
 		case GSM48_MT_RR_CHAN_MODE_MODIF_ACK:
 			osmo_timer_del(&conn->T10);
 			rc = gsm48_rx_rr_modif_ack(msg);
-			if (rc < 0) {
-				api->assign_fail(conn,
-						 GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE,
-						 NULL);
-			} else if (rc >= 0) {
-				api->assign_compl(conn, 0);
-			}
+			if (rc < 0)
+				bsc_assign_fail(conn, GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE, NULL);
+			else
+				bsc_assign_compl(conn, 0);
 			break;
 		case GSM48_MT_RR_CLSM_CHG:
 			handle_classmark_chg(conn, msg);
@@ -609,8 +546,7 @@
 		case GSM48_MT_RR_APP_INFO:
 			/* Passing RR APP INFO to MSC, not quite
 			 * according to spec */
-			if (api->dtap)
-				api->dtap(conn, link_id, msg);
+			bsc_dtap(conn, link_id, msg);
 			break;
 		default:
 			/* Drop unknown RR message */
@@ -621,8 +557,7 @@
 		}
 		break;
 	default:
-		if (api->dtap)
-			api->dtap(conn, link_id, msg);
+		bsc_dtap(conn, link_id, msg);
 		break;
 	}
 }
@@ -631,7 +566,6 @@
 int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
 {
 	int rc;
-	struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
 	struct gsm_lchan *lchan;
 
 	lchan = msg->lchan;
@@ -656,7 +590,7 @@
 		lchan->conn->lchan = lchan;
 
 		/* fwd via bsc_api to send COMPLETE L3 INFO to MSC */
-		rc = api->compl_l3(lchan->conn, msg, 0);
+		rc = bsc_compl_l3(lchan->conn, msg, 0);
 
 		if (rc != BSC_API_CONN_POL_ACCEPT) {
 			//osmo_fsm_inst_dispatch(lchan->conn->fi, FIXME, NULL);
@@ -716,20 +650,6 @@
 	return 0;
 }
 
-static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id)
-{
-	struct bsc_api *api;
-
-	if (!conn)
-		return;
-
-	api = conn->network->bsc_api;
-	if (!api || !api->sapi_n_reject)
-		return;
-
-	api->sapi_n_reject(conn, link_id);
-}
-
 static void rll_ind_cb(struct gsm_lchan *lchan, uint8_t link_id, void *_data, enum bsc_rllr_ind rllr_ind)
 {
 	struct msgb *msg = _data;
@@ -749,7 +669,7 @@
 	case BSC_RLLR_IND_REL_IND:
 	case BSC_RLLR_IND_ERR_IND:
 	case BSC_RLLR_IND_TIMEOUT:
-		send_sapi_reject(lchan->conn, OBSC_LINKID_CB(msg));
+		bsc_sapi_n_reject(lchan->conn, OBSC_LINKID_CB(msg));
 		msgb_free(msg);
 		break;
 	}
@@ -758,7 +678,6 @@
 static int bsc_handle_lchan_signal(unsigned int subsys, unsigned int signal,
 				   void *handler_data, void *signal_data)
 {
-	struct bsc_api *bsc;
 	struct gsm_lchan *lchan;
 	struct lchan_signal_data *lchan_data;
 
@@ -771,40 +690,33 @@
 		return 0;
 
 	lchan = lchan_data->lchan;
-	bsc = lchan->ts->trx->bts->network->bsc_api;
-	if (!bsc)
-		return 0;
 
 	switch (signal) {
 	case S_LCHAN_UNEXPECTED_RELEASE:
-		handle_release(lchan->conn, bsc, lchan);
+		handle_release(lchan->conn, lchan);
 		break;
 	case S_LCHAN_ACTIVATE_ACK:
-		handle_chan_ack(lchan->conn, bsc, lchan);
+		handle_chan_ack(lchan->conn, lchan);
 		break;
 	case S_LCHAN_ACTIVATE_NACK:
-		handle_chan_nack(lchan->conn, bsc, lchan);
+		handle_chan_nack(lchan->conn, lchan);
 		break;
 	}
 
 	return 0;
 }
 
-static void handle_release(struct gsm_subscriber_connection *conn,
-			   struct bsc_api *bsc, struct gsm_lchan *lchan)
+static void handle_release(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
 {
 	if (conn->secondary_lchan == lchan) {
 		osmo_timer_del(&conn->T10);
 		conn->secondary_lchan = NULL;
 
-		bsc->assign_fail(conn,
-				 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE,
-				 NULL);
+		bsc_assign_fail(conn, GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, NULL);
 	}
 
 	/* clear the connection now */
-	if (bsc->clear_request)
-		bsc->clear_request(conn, 0);
+	bsc_clear_request(conn, 0);
 
 	/* now give up all channels */
 	if (conn->lchan == lchan)
@@ -814,8 +726,7 @@
 	lchan->conn = NULL;
 }
 
-static void handle_chan_ack(struct gsm_subscriber_connection *conn,
-			    struct bsc_api *api, struct gsm_lchan *lchan)
+static void handle_chan_ack(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
 {
 	if (conn->secondary_lchan != lchan)
 		return;
@@ -824,8 +735,7 @@
 	gsm48_send_rr_ass_cmd(conn->lchan, lchan, lchan->ms_power);
 }
 
-static void handle_chan_nack(struct gsm_subscriber_connection *conn,
-			     struct bsc_api *api, struct gsm_lchan *lchan)
+static void handle_chan_nack(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
 {
 	if (conn->secondary_lchan != lchan)
 		return;
diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c
index 8081ea4..51fbdd3 100644
--- a/src/osmo-bsc/osmo_bsc_api.c
+++ b/src/osmo-bsc/osmo_bsc_api.c
@@ -51,7 +51,6 @@
 	return true;
 }
 
-static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
 static int complete_layer3(struct gsm_subscriber_connection *conn,
 			   struct msgb *msg, struct bsc_msc_data *msc);
 
@@ -135,12 +134,13 @@
 	return rc;
 }
 
-static void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
+/*! BTS->MSC: tell MSC a SAPI was not established. */
+void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
 {
 	int rc;
 	struct msgb *resp;
 
-	if (!msc_connected(conn))
+	if (!conn || !msc_connected(conn))
 		return;
 
 	LOGP(DMSC, LOGL_NOTICE, "Tx MSC SAPI N REJECT DLCI=0x%02x\n", dlci);
@@ -150,8 +150,8 @@
 		msgb_free(resp);
 }
 
-static void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
-				  struct msgb *msg, uint8_t chosen_encr)
+/*! MS->MSC: Tell MSC that ciphering has been enabled. */
+void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr)
 {
 	int rc;
 	struct msgb *resp;
@@ -210,12 +210,8 @@
 	bsc_send_ussd_release_complete(conn);
 }
 
-/*
- * Instruct to reserve data for a new connectiom, create the complete
- * layer three message, send it to open the connection.
- */
-static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg,
-			uint16_t chosen_channel)
+/*! MS->MSC: New MM context with L3 payload. */
+int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel)
 {
 	struct bsc_msc_data *msc;
 
@@ -367,7 +363,8 @@
 }
 
 
-static void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
+/*! MS->BSC/MSC: Um L3 message. */
+void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
 {
 	int lu_cause;
 
@@ -399,7 +396,8 @@
 	osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_DTAP, msg);
 }
 
-static void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause)
+/*! BSC->MSC: Assignment of lchan successful. */
+void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause)
 {
 	if (!msc_connected(conn))
 		return;
@@ -424,14 +422,15 @@
 	}
 }
 
-static void bsc_assign_fail(struct gsm_subscriber_connection *conn,
-			    uint8_t cause, uint8_t *rr_cause)
+/*! BSC->MSC: Assignment of lchan failed. */
+void bsc_assign_fail(struct gsm_subscriber_connection *conn, uint8_t cause, uint8_t *rr_cause)
 {
 	LOGP(DMSC, LOGL_INFO, "Tx MSC ASSIGN FAIL\n");
 	osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_RR_ASS_FAIL, NULL);
 }
 
-static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
+/*! BSC->MSC: RR conn has been cleared. */
+int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
 {
 	int rc;
 	struct msgb *resp;
@@ -454,9 +453,10 @@
 	return 1;
 }
 
-static void bsc_cm_update(struct gsm_subscriber_connection *conn,
-			  const uint8_t *cm2, uint8_t cm2_len,
-			  const uint8_t *cm3, uint8_t cm3_len)
+/*! BSC->MSC: Classmark Update. */
+void bsc_cm_update(struct gsm_subscriber_connection *conn,
+		   const uint8_t *cm2, uint8_t cm2_len,
+		   const uint8_t *cm3, uint8_t cm3_len)
 {
 	int rc;
 	struct msgb *resp;
@@ -470,8 +470,8 @@
 		msgb_free(resp);
 }
 
-static void bsc_mr_config(struct gsm_subscriber_connection *conn,
-				struct gsm_lchan *lchan, int full_rate)
+/*! Configure the multirate setting on this channel. */
+void bsc_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate)
 {
 	struct bsc_msc_data *msc;
 	struct gsm48_multi_rate_conf *ms_conf, *bts_conf;
@@ -511,20 +511,3 @@
 	/* now copy this into the bts structure */
 	memcpy(lchan->mr_bts_lv, lchan->mr_ms_lv, sizeof(lchan->mr_ms_lv));
 }
-
-static struct bsc_api bsc_handler = {
-	.sapi_n_reject = bsc_sapi_n_reject,
-	.cipher_mode_compl = bsc_cipher_mode_compl,
-	.compl_l3 = bsc_compl_l3,
-	.dtap = bsc_dtap,
-	.assign_compl = bsc_assign_compl,
-	.assign_fail = bsc_assign_fail,
-	.clear_request = bsc_clear_request,
-	.classmark_chg = bsc_cm_update,
-	.mr_config = bsc_mr_config,
-};
-
-struct bsc_api *osmo_bsc_api()
-{
-	return &bsc_handler;
-}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 5c6a872..494f280 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -827,7 +827,6 @@
 		fprintf(stderr, "Bootstrapping the network failed. exiting.\n");
 		exit(1);
 	}
-	bsc_api_init(bsc_gsmnet, osmo_bsc_api());
 
 	/* start control interface after reading config for
 	 * ctrl_vty_get_bind_addr() */
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 183fddf..652c8c6 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -242,3 +242,17 @@
 struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
 	OSMO_ASSERT(0);
 }
+
+void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci) {}
+void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr) {}
+int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel)
+{ return 0; }
+void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg) {}
+void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause) {}
+void bsc_assign_fail(struct gsm_subscriber_connection *conn, uint8_t cause, uint8_t *rr_cause) {}
+int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
+{ return 0; }
+void bsc_cm_update(struct gsm_subscriber_connection *conn,
+		   const uint8_t *cm2, uint8_t cm2_len,
+		   const uint8_t *cm3, uint8_t cm3_len) {}
+void bsc_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate) {}
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 26074a2..87e64ec 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1346,7 +1346,6 @@
 	struct gsm_lchan *lchan[256];
 	int lchan_num = 0;
 	int i;
-	struct bsc_api bsc_api = {};
 	int algorithm;
 	int test_case_i;
 	int last_test_i;
@@ -1376,8 +1375,6 @@
 	if (!bsc_gsmnet)
 		exit(1);
 
-	bsc_api_init(bsc_gsmnet, &bsc_api);
-
 	ho_set_algorithm(bsc_gsmnet->ho, 2);
 	ho_set_ho_active(bsc_gsmnet->ho, true);
 	ho_set_hodec2_as_active(bsc_gsmnet->ho, true);
@@ -1695,3 +1692,16 @@
 void trau_send_frame() {}
 int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; }
 int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; }
+void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci) {}
+void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr) {}
+int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel)
+{ return 0; }
+void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg) {}
+void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause) {}
+void bsc_assign_fail(struct gsm_subscriber_connection *conn, uint8_t cause, uint8_t *rr_cause) {}
+int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
+{ return 0; }
+void bsc_cm_update(struct gsm_subscriber_connection *conn,
+		   const uint8_t *cm2, uint8_t cm2_len,
+		   const uint8_t *cm3, uint8_t cm3_len) {}
+void bsc_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate) {}

-- 
To view, visit https://gerrit.osmocom.org/9482
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fd5888c63a0b4f95520a498320aa105a6d60579
Gerrit-Change-Number: 9482
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180607/3d5a55be/attachment.htm>


More information about the gerrit-log mailing list