bsc_api: Switch gsm_04_08.c to use the clear request of the API.

This commit is contained in:
Holger Hans Peter Freyther 2010-06-15 13:16:52 +08:00
parent ecd9933826
commit f6fb3efcba
3 changed files with 14 additions and 18 deletions

View File

@ -11,6 +11,7 @@ struct gsm_bts;
struct gsm_subscriber; struct gsm_subscriber;
struct gsm_network; struct gsm_network;
struct gsm_trans; struct gsm_trans;
struct gsm_subscriber_connection;
#define GSM48_ALLOC_SIZE 1024 #define GSM48_ALLOC_SIZE 1024
#define GSM48_ALLOC_HEADROOM 128 #define GSM48_ALLOC_HEADROOM 128
@ -23,6 +24,7 @@ static inline struct msgb *gsm48_msgb_alloc(void)
/* config options controlling the behaviour of the lower leves */ /* config options controlling the behaviour of the lower leves */
void gsm0408_allow_everyone(int allow); void gsm0408_allow_everyone(int allow);
void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id); int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id);
enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci); enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci);

View File

@ -253,35 +253,24 @@ static int gsm0408_authorize(struct gsm_subscriber_connection *conn, struct msgb
return 0; return 0;
} }
static int gsm0408_handle_lchan_signal(unsigned int subsys, unsigned int signal, void gsm0408_clear_request(struct gsm_subscriber_connection* conn, uint32_t cause)
void *handler_data, void *signal_data)
{ {
struct gsm_trans *trans, *temp; struct gsm_trans *trans, *temp;
if (subsys != SS_LCHAN || signal != S_LCHAN_UNEXPECTED_RELEASE)
return 0;
/* /*
* Cancel any outstanding location updating request * Cancel any outstanding location updating request
* operation taking place on the lchan. * operation taking place on the subscriber connection.
*/ */
struct gsm_lchan *lchan = (struct gsm_lchan *)signal_data; release_loc_updating_req(conn);
if (!lchan) release_security_operation(conn);
return 0;
release_loc_updating_req(&lchan->conn);
release_security_operation(&lchan->conn);
/* Free all transactions that are associated with the released lchan */ /* Free all transactions that are associated with the released lchan */
/* FIXME: this is not neccessarily the right thing to do, we should /* FIXME: this is not neccessarily the right thing to do, we should
* only set trans->lchan to NULL and wait for another lchan to be * only set trans->lchan to NULL and wait for another lchan to be
* established to the same MM entity (phone/subscriber) */ * established to the same MM entity (phone/subscriber) */
llist_for_each_entry_safe(trans, temp, &lchan->ts->trx->bts->network->trans_list, entry) { llist_for_each_entry_safe(trans, temp, &conn->bts->network->trans_list, entry) {
if (trans->conn && trans->conn->lchan == lchan) if (trans->conn == conn)
trans_free(trans); trans_free(trans);
} }
return 0;
} }
/* Chapter 9.2.14 : Send LOCATION UPDATING REJECT */ /* Chapter 9.2.14 : Send LOCATION UPDATING REJECT */
@ -3129,6 +3118,5 @@ int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id)
*/ */
static __attribute__((constructor)) void on_dso_load_0408(void) static __attribute__((constructor)) void on_dso_load_0408(void)
{ {
register_signal_handler(SS_LCHAN, gsm0408_handle_lchan_signal, NULL);
register_signal_handler(SS_ABISIP, handle_abisip_signal, NULL); register_signal_handler(SS_ABISIP, handle_abisip_signal, NULL);
} }

View File

@ -35,8 +35,14 @@ static void msc_sapi_n_reject(struct gsm_subscriber_connection* conn, int dlci)
gsm411_sapi_n_reject(conn); gsm411_sapi_n_reject(conn);
} }
static void msc_clear_request(struct gsm_subscriber_connection* conn, uint32_t cause)
{
gsm0408_clear_request(conn, cause);
}
static struct bsc_api msc_handler = { static struct bsc_api msc_handler = {
.sapi_n_reject = msc_sapi_n_reject, .sapi_n_reject = msc_sapi_n_reject,
.clear_request = msc_clear_request,
}; };
struct bsc_api *msc_bsc_api() { struct bsc_api *msc_bsc_api() {