Store the GSM BTS in the gsm subscriber connection

Remove further usage of lchan from the gsm 04.11 bits
This commit is contained in:
Holger Hans Peter Freyther 2010-03-23 07:52:17 +01:00
parent ec32b5860e
commit 18b63f4b41
3 changed files with 9 additions and 8 deletions

View File

@ -201,8 +201,9 @@ struct gsm_subscriber_connection {
/* Are we part of a special "silent" call */
int silent_call;
/* back pointer to the gsm_lchan */
/* back pointers */
struct gsm_lchan *lchan;
struct gsm_bts *bts;
};
struct gsm_lchan {

View File

@ -264,6 +264,7 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type)
/* Configure the time and start it so it will be closed */
lchan->conn.lchan = lchan;
lchan->conn.bts = lchan->ts->trx->bts;
lchan->conn.release_timer.cb = auto_release_channel;
lchan->conn.release_timer.data = lchan;
bsc_schedule_timer(&lchan->conn.release_timer, LCHAN_RELEASE_TIMEOUT);

View File

@ -504,9 +504,8 @@ static int gsm340_gen_tpdu(struct msgb *msg, struct gsm_sms *sms)
/* process an incoming TPDU (called from RP-DATA)
* return value > 0: RP CAUSE for ERROR; < 0: silent error; 0 = success */
static int gsm340_rx_tpdu(struct msgb *msg)
static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct gsm_bts *bts = msg->lchan->ts->trx->bts;
u_int8_t *smsp = msgb_sms(msg);
struct gsm_sms *gsms;
u_int8_t sms_mti, sms_mms, sms_vpf, sms_alphabet, sms_rp;
@ -515,7 +514,7 @@ static int gsm340_rx_tpdu(struct msgb *msg)
u_int8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */
int rc = 0;
counter_inc(bts->network->stats.sms.submitted);
counter_inc(conn->bts->network->stats.sms.submitted);
gsms = sms_alloc();
if (!gsms)
@ -603,10 +602,10 @@ static int gsm340_rx_tpdu(struct msgb *msg)
dispatch_signal(SS_SMS, 0, gsms);
/* determine gsms->receiver based on dialled number */
gsms->receiver = subscr_get_by_extension(bts->network, gsms->dest_addr);
gsms->receiver = subscr_get_by_extension(conn->bts->network, gsms->dest_addr);
if (!gsms->receiver) {
rc = 1; /* cause 1: unknown subscriber */
counter_inc(bts->network->stats.sms.no_receiver);
counter_inc(conn->bts->network->stats.sms.no_receiver);
goto out;
}
@ -680,7 +679,7 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
DEBUGP(DSMS, "DST(%u,%s)\n", dst_len, hexdump(dst, dst_len));
rc = gsm340_rx_tpdu(msg);
rc = gsm340_rx_tpdu(trans->conn, msg);
if (rc == 0)
return gsm411_send_rp_ack(trans, rph->msg_ref);
else if (rc > 0)
@ -766,7 +765,7 @@ static int gsm411_rx_rp_ack(struct msgb *msg, struct gsm_trans *trans,
static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans,
struct gsm411_rp_hdr *rph)
{
struct gsm_network *net = trans->conn->lchan->ts->trx->bts->network;
struct gsm_network *net = trans->conn->bts->network;
struct gsm_sms *sms = trans->sms.sms;
u_int8_t cause_len = rph->data[0];
u_int8_t cause = rph->data[1];