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
This commit is contained in:
parent
958f259f95
commit
c19581f268
|
@ -8,43 +8,18 @@
|
||||||
#define BSC_API_CONN_POL_ACCEPT 0
|
#define BSC_API_CONN_POL_ACCEPT 0
|
||||||
#define BSC_API_CONN_POL_REJECT 1
|
#define BSC_API_CONN_POL_REJECT 1
|
||||||
|
|
||||||
struct bsc_api {
|
void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci);
|
||||||
/*! \brief BTS->MSC: tell MSC a SAPI was not established */
|
void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr);
|
||||||
void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci);
|
int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel);
|
||||||
/*! \brief MS->MSC: Tell MSC that ciphering has been enabled */
|
void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg);
|
||||||
void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn,
|
void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_cause);
|
||||||
struct msgb *msg, uint8_t chosen_encr);
|
void bsc_assign_fail(struct gsm_subscriber_connection *conn, uint8_t cause, uint8_t *rr_cause);
|
||||||
/*! \brief MS->MSC: New MM context with L3 payload */
|
int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
|
||||||
int (*compl_l3)(struct gsm_subscriber_connection *conn,
|
void bsc_cm_update(struct gsm_subscriber_connection *conn,
|
||||||
struct msgb *msg, uint16_t chosen_channel);
|
const uint8_t *cm2, uint8_t cm2_len,
|
||||||
/*! \brief MS->BSC/MSC: Um L3 message */
|
const uint8_t *cm3, uint8_t cm3_len);
|
||||||
void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id,
|
void bsc_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate);
|
||||||
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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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_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_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate);
|
||||||
int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
|
int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
|
||||||
|
|
|
@ -256,7 +256,6 @@ enum bts_gprs_mode {
|
||||||
struct gsm_lchan;
|
struct gsm_lchan;
|
||||||
struct osmo_rtp_socket;
|
struct osmo_rtp_socket;
|
||||||
struct rtp_socket;
|
struct rtp_socket;
|
||||||
struct bsc_api;
|
|
||||||
|
|
||||||
/* Network Management State */
|
/* Network Management State */
|
||||||
struct gsm_nm_state {
|
struct gsm_nm_state {
|
||||||
|
@ -1217,8 +1216,6 @@ struct gsm_network {
|
||||||
|
|
||||||
struct rate_ctr_group *bsc_ctrs;
|
struct rate_ctr_group *bsc_ctrs;
|
||||||
|
|
||||||
struct bsc_api *bsc_api;
|
|
||||||
|
|
||||||
unsigned int num_bts;
|
unsigned int num_bts;
|
||||||
struct llist_head bts_list;
|
struct llist_head bts_list;
|
||||||
|
|
||||||
|
|
|
@ -45,52 +45,9 @@
|
||||||
#define HO_DTAP_CACHE_MSGB_CB_ALLOW_SACCH 1
|
#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 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 gsm_lchan *lchan);
|
||||||
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 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 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start a new assignment and make sure that it is completed within T10 either
|
* Start a new assignment and make sure that it is completed within T10 either
|
||||||
|
@ -145,7 +102,7 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha
|
||||||
|
|
||||||
/* handle AMR correctly */
|
/* handle AMR correctly */
|
||||||
if (chan_mode == GSM48_CMODE_SPEECH_AMR)
|
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) {
|
if (rsl_chan_activate_lchan(new_lchan, 0x1, 0) < 0) {
|
||||||
LOGPLCHAN(new_lchan, DHO, LOGL_ERROR, "could not activate channel\n");
|
LOGPLCHAN(new_lchan, DHO, LOGL_ERROR, "could not activate channel\n");
|
||||||
|
@ -202,12 +159,6 @@ void ho_dtap_cache_flush(struct gsm_subscriber_connection *conn, int send)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) */
|
/*! \brief process incoming 08.08 DTAP from MSC (send via BTS to MS) */
|
||||||
int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
|
int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
|
||||||
struct msgb *msg, int link_id, int allow_sacch)
|
struct msgb *msg, int link_id, int allow_sacch)
|
||||||
|
@ -246,7 +197,7 @@ int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
|
||||||
OBSC_LINKID_CB(msg) = link_id;
|
OBSC_LINKID_CB(msg) = link_id;
|
||||||
if (rll_establish(msg->lchan, sapi, rll_ind_cb, msg) != 0) {
|
if (rll_establish(msg->lchan, sapi, rll_ind_cb, msg) != 0) {
|
||||||
msgb_free(msg);
|
msgb_free(msg);
|
||||||
send_sapi_reject(conn, link_id);
|
bsc_sapi_n_reject(conn, link_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -306,9 +257,6 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
|
||||||
{
|
{
|
||||||
/* TODO: Add multirate configuration, make it work for more than audio. */
|
/* 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 (!chan_compat_with_mode(conn->lchan, chan_mode, full_rate)) {
|
||||||
if (handle_new_assignment(conn, chan_mode, full_rate) != 0)
|
if (handle_new_assignment(conn, chan_mode, full_rate) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -319,7 +267,7 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (chan_mode == GSM48_CMODE_SPEECH_AMR)
|
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,
|
LOGPLCHAN(conn->lchan, DMSC, LOGL_NOTICE,
|
||||||
"Sending ChanModify for speech: %s\n",
|
"Sending ChanModify for speech: %s\n",
|
||||||
|
@ -331,7 +279,7 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
api->assign_fail(conn, 0, NULL);
|
bsc_assign_fail(conn, 0, NULL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +293,6 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn,
|
||||||
struct msgb *msg)
|
struct msgb *msg)
|
||||||
{
|
{
|
||||||
struct gsm48_hdr *gh = msgb_l3(msg);
|
struct gsm48_hdr *gh = msgb_l3(msg);
|
||||||
struct bsc_api *api = conn->network->bsc_api;
|
|
||||||
enum gsm48_rr_cause cause;
|
enum gsm48_rr_cause cause;
|
||||||
|
|
||||||
/* Expecting gsm48_hdr + cause value */
|
/* Expecting gsm48_hdr + cause value */
|
||||||
|
@ -393,13 +340,12 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn,
|
||||||
if (is_ipaccess_bts(conn_get_bts(conn)) && conn->lchan->tch_mode != GSM48_CMODE_SIGN)
|
if (is_ipaccess_bts(conn_get_bts(conn)) && conn->lchan->tch_mode != GSM48_CMODE_SIGN)
|
||||||
rsl_ipacc_crcx(conn->lchan);
|
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,
|
static void handle_ass_fail(struct gsm_subscriber_connection *conn,
|
||||||
struct msgb *msg)
|
struct msgb *msg)
|
||||||
{
|
{
|
||||||
struct bsc_api *api = conn->network->bsc_api;
|
|
||||||
uint8_t *rr_failure;
|
uint8_t *rr_failure;
|
||||||
struct gsm48_hdr *gh;
|
struct gsm48_hdr *gh;
|
||||||
|
|
||||||
|
@ -446,15 +392,12 @@ static void handle_ass_fail(struct gsm_subscriber_connection *conn,
|
||||||
rr_failure = &gh->data[0];
|
rr_failure = &gh->data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
api->assign_fail(conn,
|
bsc_assign_fail(conn, GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, rr_failure);
|
||||||
GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE,
|
|
||||||
rr_failure);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_classmark_chg(struct gsm_subscriber_connection *conn,
|
static void handle_classmark_chg(struct gsm_subscriber_connection *conn,
|
||||||
struct msgb *msg)
|
struct msgb *msg)
|
||||||
{
|
{
|
||||||
struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
|
|
||||||
struct gsm48_hdr *gh = msgb_l3(msg);
|
struct gsm48_hdr *gh = msgb_l3(msg);
|
||||||
unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
|
unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
|
||||||
uint8_t cm2_len, cm3_len = 0;
|
uint8_t cm2_len, cm3_len = 0;
|
||||||
|
@ -486,7 +429,7 @@ static void handle_classmark_chg(struct gsm_subscriber_connection *conn,
|
||||||
}
|
}
|
||||||
DEBUGPC(DRR, "CM3(len=%u)\n", cm3_len);
|
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 */
|
/* Chapter 9.1.16 Handover complete */
|
||||||
|
@ -533,7 +476,6 @@ static void handle_rr_ho_fail(struct msgb *msg)
|
||||||
static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
||||||
uint8_t link_id, struct msgb *msg)
|
uint8_t link_id, struct msgb *msg)
|
||||||
{
|
{
|
||||||
struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
|
|
||||||
struct gsm48_hdr *gh;
|
struct gsm48_hdr *gh;
|
||||||
uint8_t pdisc;
|
uint8_t pdisc;
|
||||||
uint8_t msg_type;
|
uint8_t msg_type;
|
||||||
|
@ -582,9 +524,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
||||||
handle_rr_ho_fail(msg);
|
handle_rr_ho_fail(msg);
|
||||||
break;
|
break;
|
||||||
case GSM48_MT_RR_CIPH_M_COMPL:
|
case GSM48_MT_RR_CIPH_M_COMPL:
|
||||||
if (api->cipher_mode_compl)
|
bsc_cipher_mode_compl(conn, msg, conn->lchan->encr.alg_id);
|
||||||
api->cipher_mode_compl(conn, msg,
|
|
||||||
conn->lchan->encr.alg_id);
|
|
||||||
break;
|
break;
|
||||||
case GSM48_MT_RR_ASS_COMPL:
|
case GSM48_MT_RR_ASS_COMPL:
|
||||||
handle_ass_compl(conn, msg);
|
handle_ass_compl(conn, msg);
|
||||||
|
@ -595,13 +535,10 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
||||||
case GSM48_MT_RR_CHAN_MODE_MODIF_ACK:
|
case GSM48_MT_RR_CHAN_MODE_MODIF_ACK:
|
||||||
osmo_timer_del(&conn->T10);
|
osmo_timer_del(&conn->T10);
|
||||||
rc = gsm48_rx_rr_modif_ack(msg);
|
rc = gsm48_rx_rr_modif_ack(msg);
|
||||||
if (rc < 0) {
|
if (rc < 0)
|
||||||
api->assign_fail(conn,
|
bsc_assign_fail(conn, GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE, NULL);
|
||||||
GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE,
|
else
|
||||||
NULL);
|
bsc_assign_compl(conn, 0);
|
||||||
} else if (rc >= 0) {
|
|
||||||
api->assign_compl(conn, 0);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GSM48_MT_RR_CLSM_CHG:
|
case GSM48_MT_RR_CLSM_CHG:
|
||||||
handle_classmark_chg(conn, msg);
|
handle_classmark_chg(conn, msg);
|
||||||
|
@ -609,8 +546,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
||||||
case GSM48_MT_RR_APP_INFO:
|
case GSM48_MT_RR_APP_INFO:
|
||||||
/* Passing RR APP INFO to MSC, not quite
|
/* Passing RR APP INFO to MSC, not quite
|
||||||
* according to spec */
|
* according to spec */
|
||||||
if (api->dtap)
|
bsc_dtap(conn, link_id, msg);
|
||||||
api->dtap(conn, link_id, msg);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Drop unknown RR message */
|
/* Drop unknown RR message */
|
||||||
|
@ -621,8 +557,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (api->dtap)
|
bsc_dtap(conn, link_id, msg);
|
||||||
api->dtap(conn, link_id, msg);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -631,7 +566,6 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
|
||||||
int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
|
int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
|
|
||||||
struct gsm_lchan *lchan;
|
struct gsm_lchan *lchan;
|
||||||
|
|
||||||
lchan = msg->lchan;
|
lchan = msg->lchan;
|
||||||
|
@ -656,7 +590,7 @@ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
|
||||||
lchan->conn->lchan = lchan;
|
lchan->conn->lchan = lchan;
|
||||||
|
|
||||||
/* fwd via bsc_api to send COMPLETE L3 INFO to MSC */
|
/* 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) {
|
if (rc != BSC_API_CONN_POL_ACCEPT) {
|
||||||
//osmo_fsm_inst_dispatch(lchan->conn->fi, FIXME, NULL);
|
//osmo_fsm_inst_dispatch(lchan->conn->fi, FIXME, NULL);
|
||||||
|
@ -716,20 +650,6 @@ int gsm0808_clear(struct gsm_subscriber_connection *conn)
|
||||||
return 0;
|
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)
|
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;
|
struct msgb *msg = _data;
|
||||||
|
@ -749,7 +669,7 @@ static void rll_ind_cb(struct gsm_lchan *lchan, uint8_t link_id, void *_data, en
|
||||||
case BSC_RLLR_IND_REL_IND:
|
case BSC_RLLR_IND_REL_IND:
|
||||||
case BSC_RLLR_IND_ERR_IND:
|
case BSC_RLLR_IND_ERR_IND:
|
||||||
case BSC_RLLR_IND_TIMEOUT:
|
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);
|
msgb_free(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -758,7 +678,6 @@ static void rll_ind_cb(struct gsm_lchan *lchan, uint8_t link_id, void *_data, en
|
||||||
static int bsc_handle_lchan_signal(unsigned int subsys, unsigned int signal,
|
static int bsc_handle_lchan_signal(unsigned int subsys, unsigned int signal,
|
||||||
void *handler_data, void *signal_data)
|
void *handler_data, void *signal_data)
|
||||||
{
|
{
|
||||||
struct bsc_api *bsc;
|
|
||||||
struct gsm_lchan *lchan;
|
struct gsm_lchan *lchan;
|
||||||
struct lchan_signal_data *lchan_data;
|
struct lchan_signal_data *lchan_data;
|
||||||
|
|
||||||
|
@ -771,40 +690,33 @@ static int bsc_handle_lchan_signal(unsigned int subsys, unsigned int signal,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lchan = lchan_data->lchan;
|
lchan = lchan_data->lchan;
|
||||||
bsc = lchan->ts->trx->bts->network->bsc_api;
|
|
||||||
if (!bsc)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (signal) {
|
switch (signal) {
|
||||||
case S_LCHAN_UNEXPECTED_RELEASE:
|
case S_LCHAN_UNEXPECTED_RELEASE:
|
||||||
handle_release(lchan->conn, bsc, lchan);
|
handle_release(lchan->conn, lchan);
|
||||||
break;
|
break;
|
||||||
case S_LCHAN_ACTIVATE_ACK:
|
case S_LCHAN_ACTIVATE_ACK:
|
||||||
handle_chan_ack(lchan->conn, bsc, lchan);
|
handle_chan_ack(lchan->conn, lchan);
|
||||||
break;
|
break;
|
||||||
case S_LCHAN_ACTIVATE_NACK:
|
case S_LCHAN_ACTIVATE_NACK:
|
||||||
handle_chan_nack(lchan->conn, bsc, lchan);
|
handle_chan_nack(lchan->conn, lchan);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_release(struct gsm_subscriber_connection *conn,
|
static void handle_release(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
|
||||||
struct bsc_api *bsc, struct gsm_lchan *lchan)
|
|
||||||
{
|
{
|
||||||
if (conn->secondary_lchan == lchan) {
|
if (conn->secondary_lchan == lchan) {
|
||||||
osmo_timer_del(&conn->T10);
|
osmo_timer_del(&conn->T10);
|
||||||
conn->secondary_lchan = NULL;
|
conn->secondary_lchan = NULL;
|
||||||
|
|
||||||
bsc->assign_fail(conn,
|
bsc_assign_fail(conn, GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, NULL);
|
||||||
GSM0808_CAUSE_RADIO_INTERFACE_FAILURE,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear the connection now */
|
/* clear the connection now */
|
||||||
if (bsc->clear_request)
|
bsc_clear_request(conn, 0);
|
||||||
bsc->clear_request(conn, 0);
|
|
||||||
|
|
||||||
/* now give up all channels */
|
/* now give up all channels */
|
||||||
if (conn->lchan == lchan)
|
if (conn->lchan == lchan)
|
||||||
|
@ -814,8 +726,7 @@ static void handle_release(struct gsm_subscriber_connection *conn,
|
||||||
lchan->conn = NULL;
|
lchan->conn = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_chan_ack(struct gsm_subscriber_connection *conn,
|
static void handle_chan_ack(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
|
||||||
struct bsc_api *api, struct gsm_lchan *lchan)
|
|
||||||
{
|
{
|
||||||
if (conn->secondary_lchan != lchan)
|
if (conn->secondary_lchan != lchan)
|
||||||
return;
|
return;
|
||||||
|
@ -824,8 +735,7 @@ static void handle_chan_ack(struct gsm_subscriber_connection *conn,
|
||||||
gsm48_send_rr_ass_cmd(conn->lchan, lchan, lchan->ms_power);
|
gsm48_send_rr_ass_cmd(conn->lchan, lchan, lchan->ms_power);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_chan_nack(struct gsm_subscriber_connection *conn,
|
static void handle_chan_nack(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
|
||||||
struct bsc_api *api, struct gsm_lchan *lchan)
|
|
||||||
{
|
{
|
||||||
if (conn->secondary_lchan != lchan)
|
if (conn->secondary_lchan != lchan)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -51,7 +51,6 @@ static bool msc_connected(struct gsm_subscriber_connection *conn)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
|
|
||||||
static int complete_layer3(struct gsm_subscriber_connection *conn,
|
static int complete_layer3(struct gsm_subscriber_connection *conn,
|
||||||
struct msgb *msg, struct bsc_msc_data *msc);
|
struct msgb *msg, struct bsc_msc_data *msc);
|
||||||
|
|
||||||
|
@ -135,12 +134,13 @@ static int bsc_filter_data(struct gsm_subscriber_connection *conn,
|
||||||
return rc;
|
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;
|
int rc;
|
||||||
struct msgb *resp;
|
struct msgb *resp;
|
||||||
|
|
||||||
if (!msc_connected(conn))
|
if (!conn || !msc_connected(conn))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOGP(DMSC, LOGL_NOTICE, "Tx MSC SAPI N REJECT DLCI=0x%02x\n", dlci);
|
LOGP(DMSC, LOGL_NOTICE, "Tx MSC SAPI N REJECT DLCI=0x%02x\n", dlci);
|
||||||
|
@ -150,8 +150,8 @@ static void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
|
||||||
msgb_free(resp);
|
msgb_free(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
|
/*! MS->MSC: Tell MSC that ciphering has been enabled. */
|
||||||
struct msgb *msg, uint8_t chosen_encr)
|
void bsc_cipher_mode_compl(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t chosen_encr)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct msgb *resp;
|
struct msgb *resp;
|
||||||
|
@ -210,12 +210,8 @@ static void bsc_send_ussd_no_srv(struct gsm_subscriber_connection *conn,
|
||||||
bsc_send_ussd_release_complete(conn);
|
bsc_send_ussd_release_complete(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*! MS->MSC: New MM context with L3 payload. */
|
||||||
* Instruct to reserve data for a new connectiom, create the complete
|
int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel)
|
||||||
* 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)
|
|
||||||
{
|
{
|
||||||
struct bsc_msc_data *msc;
|
struct bsc_msc_data *msc;
|
||||||
|
|
||||||
|
@ -367,7 +363,8 @@ static int handle_cc_setup(struct gsm_subscriber_connection *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
int lu_cause;
|
||||||
|
|
||||||
|
@ -399,7 +396,8 @@ static void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, st
|
||||||
osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_DTAP, msg);
|
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))
|
if (!msc_connected(conn))
|
||||||
return;
|
return;
|
||||||
|
@ -424,14 +422,15 @@ static void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bsc_assign_fail(struct gsm_subscriber_connection *conn,
|
/*! BSC->MSC: Assignment of lchan failed. */
|
||||||
uint8_t cause, uint8_t *rr_cause)
|
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");
|
LOGP(DMSC, LOGL_INFO, "Tx MSC ASSIGN FAIL\n");
|
||||||
osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_RR_ASS_FAIL, NULL);
|
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;
|
int rc;
|
||||||
struct msgb *resp;
|
struct msgb *resp;
|
||||||
|
@ -454,9 +453,10 @@ static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t ca
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bsc_cm_update(struct gsm_subscriber_connection *conn,
|
/*! BSC->MSC: Classmark Update. */
|
||||||
const uint8_t *cm2, uint8_t cm2_len,
|
void bsc_cm_update(struct gsm_subscriber_connection *conn,
|
||||||
const uint8_t *cm3, uint8_t cm3_len)
|
const uint8_t *cm2, uint8_t cm2_len,
|
||||||
|
const uint8_t *cm3, uint8_t cm3_len)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct msgb *resp;
|
struct msgb *resp;
|
||||||
|
@ -470,8 +470,8 @@ static void bsc_cm_update(struct gsm_subscriber_connection *conn,
|
||||||
msgb_free(resp);
|
msgb_free(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bsc_mr_config(struct gsm_subscriber_connection *conn,
|
/*! Configure the multirate setting on this channel. */
|
||||||
struct gsm_lchan *lchan, int full_rate)
|
void bsc_mr_config(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan, int full_rate)
|
||||||
{
|
{
|
||||||
struct bsc_msc_data *msc;
|
struct bsc_msc_data *msc;
|
||||||
struct gsm48_multi_rate_conf *ms_conf, *bts_conf;
|
struct gsm48_multi_rate_conf *ms_conf, *bts_conf;
|
||||||
|
@ -511,20 +511,3 @@ static void bsc_mr_config(struct gsm_subscriber_connection *conn,
|
||||||
/* now copy this into the bts structure */
|
/* now copy this into the bts structure */
|
||||||
memcpy(lchan->mr_bts_lv, lchan->mr_ms_lv, sizeof(lchan->mr_ms_lv));
|
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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -827,7 +827,6 @@ int main(int argc, char **argv)
|
||||||
fprintf(stderr, "Bootstrapping the network failed. exiting.\n");
|
fprintf(stderr, "Bootstrapping the network failed. exiting.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
bsc_api_init(bsc_gsmnet, osmo_bsc_api());
|
|
||||||
|
|
||||||
/* start control interface after reading config for
|
/* start control interface after reading config for
|
||||||
* ctrl_vty_get_bind_addr() */
|
* ctrl_vty_get_bind_addr() */
|
||||||
|
|
|
@ -235,3 +235,17 @@ int main(int argc, char **argv)
|
||||||
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
|
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
|
||||||
OSMO_ASSERT(0);
|
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) {}
|
||||||
|
|
|
@ -1346,7 +1346,6 @@ int main(int argc, char **argv)
|
||||||
struct gsm_lchan *lchan[256];
|
struct gsm_lchan *lchan[256];
|
||||||
int lchan_num = 0;
|
int lchan_num = 0;
|
||||||
int i;
|
int i;
|
||||||
struct bsc_api bsc_api = {};
|
|
||||||
int algorithm;
|
int algorithm;
|
||||||
int test_case_i;
|
int test_case_i;
|
||||||
int last_test_i;
|
int last_test_i;
|
||||||
|
@ -1376,8 +1375,6 @@ int main(int argc, char **argv)
|
||||||
if (!bsc_gsmnet)
|
if (!bsc_gsmnet)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
bsc_api_init(bsc_gsmnet, &bsc_api);
|
|
||||||
|
|
||||||
ho_set_algorithm(bsc_gsmnet->ho, 2);
|
ho_set_algorithm(bsc_gsmnet->ho, 2);
|
||||||
ho_set_ho_active(bsc_gsmnet->ho, true);
|
ho_set_ho_active(bsc_gsmnet->ho, true);
|
||||||
ho_set_hodec2_as_active(bsc_gsmnet->ho, true);
|
ho_set_hodec2_as_active(bsc_gsmnet->ho, true);
|
||||||
|
@ -1695,3 +1692,16 @@ void trau_recv_lchan() {}
|
||||||
void trau_send_frame() {}
|
void trau_send_frame() {}
|
||||||
int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; }
|
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; }
|
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) {}
|
||||||
|
|
Loading…
Reference in New Issue