split subscr_con_allocate()/_free() in bsc_ and msc_
Rename current subscr_con_allocate() and subscr_con_free to bsc_*, and add two separate msc_subscr_con_allocate() and _free(). The msc_subscr_con_free() ignores all lchan members. In libbsc use bsc_*, in libmsc use msc_*. Change-Id: I3cf7c7cafdf4672ec7b26058bba8a77159855257 Future: there will be distinct subscr conns for libbsc and libmsc.
This commit is contained in:
parent
640b794de0
commit
42eb0141d7
|
@ -522,8 +522,11 @@ struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
|
|||
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
|
||||
int gsm_bts_model_register(struct gsm_bts_model *model);
|
||||
|
||||
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan);
|
||||
void subscr_con_free(struct gsm_subscriber_connection *conn);
|
||||
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 *msc_subscr_con_allocate(struct gsm_network *network);
|
||||
void msc_subscr_con_free(struct gsm_subscriber_connection *conn);
|
||||
|
||||
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net,
|
||||
enum gsm_bts_type type,
|
||||
|
|
|
@ -239,7 +239,7 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan)
|
||||
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan *lchan)
|
||||
{
|
||||
struct gsm_subscriber_connection *conn;
|
||||
struct gsm_network *net = lchan->ts->trx->bts->network;
|
||||
|
@ -256,8 +256,7 @@ struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan)
|
|||
return conn;
|
||||
}
|
||||
|
||||
/* TODO: move subscriber put here... */
|
||||
void subscr_con_free(struct gsm_subscriber_connection *conn)
|
||||
void bsc_subscr_con_free(struct gsm_subscriber_connection *conn)
|
||||
{
|
||||
if (!conn)
|
||||
return;
|
||||
|
@ -682,7 +681,7 @@ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
|
|||
} else {
|
||||
/* allocate a new connection */
|
||||
rc = BSC_API_CONN_POL_REJECT;
|
||||
lchan->conn = subscr_con_allocate(msg->lchan);
|
||||
lchan->conn = bsc_subscr_con_allocate(msg->lchan);
|
||||
if (!lchan->conn) {
|
||||
lchan_release(lchan, 1, RSL_REL_NORMAL);
|
||||
return -1;
|
||||
|
@ -693,7 +692,7 @@ int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id)
|
|||
|
||||
if (rc != BSC_API_CONN_POL_ACCEPT) {
|
||||
lchan->conn->lchan = NULL;
|
||||
subscr_con_free(lchan->conn);
|
||||
bsc_subscr_con_free(lchan->conn);
|
||||
lchan_release(lchan, 1, RSL_REL_NORMAL);
|
||||
}
|
||||
}
|
||||
|
@ -852,7 +851,7 @@ static void handle_release(struct gsm_subscriber_connection *conn,
|
|||
gsm0808_clear(conn);
|
||||
|
||||
if (destruct)
|
||||
subscr_con_free(conn);
|
||||
bsc_subscr_con_free(conn);
|
||||
}
|
||||
|
||||
static void handle_chan_ack(struct gsm_subscriber_connection *conn,
|
||||
|
|
|
@ -3683,6 +3683,33 @@ int gsm0408_new_conn(struct gsm_subscriber_connection *conn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network)
|
||||
{
|
||||
struct gsm_subscriber_connection *conn;
|
||||
|
||||
conn = talloc_zero(network, struct gsm_subscriber_connection);
|
||||
if (!conn)
|
||||
return NULL;
|
||||
|
||||
conn->network = network;
|
||||
llist_add_tail(&conn->entry, &network->subscr_conns);
|
||||
return conn;
|
||||
}
|
||||
|
||||
void msc_subscr_con_free(struct gsm_subscriber_connection *conn)
|
||||
{
|
||||
if (!conn)
|
||||
return;
|
||||
|
||||
if (conn->subscr) {
|
||||
subscr_put(conn->subscr);
|
||||
conn->subscr = NULL;
|
||||
}
|
||||
|
||||
llist_del(&conn->entry);
|
||||
talloc_free(conn);
|
||||
}
|
||||
|
||||
/* Main entry point for GSM 04.08/44.008 Layer 3 data (e.g. from the BSC). */
|
||||
int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg)
|
||||
{
|
||||
|
|
|
@ -173,5 +173,5 @@ void msc_release_connection(struct gsm_subscriber_connection *conn)
|
|||
|
||||
conn->in_release = 1;
|
||||
gsm0808_clear(conn);
|
||||
subscr_con_free(conn);
|
||||
msc_subscr_con_free(conn);
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ static int move_to_msc(struct gsm_subscriber_connection *_conn,
|
|||
_conn->sccp_con = NULL;
|
||||
if (complete_layer3(_conn, msg, msc) != BSC_API_CONN_POL_ACCEPT) {
|
||||
gsm0808_clear(_conn);
|
||||
subscr_con_free(_conn);
|
||||
bsc_subscr_con_free(_conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ static int bssmap_handle_clear_command(struct osmo_bsc_sccp_con *conn,
|
|||
if (conn->conn) {
|
||||
LOGP(DMSC, LOGL_INFO, "Releasing all transactions on %p\n", conn);
|
||||
gsm0808_clear(conn->conn);
|
||||
subscr_con_free(conn->conn);
|
||||
bsc_subscr_con_free(conn->conn);
|
||||
conn->conn = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static void msc_outgoing_sccp_state(struct sccp_connection *conn, int old_state)
|
|||
LOGP(DMSC, LOGL_ERROR,
|
||||
"ERROR: The lchan is still associated.\n");
|
||||
gsm0808_clear(con_data->conn);
|
||||
subscr_con_free(con_data->conn);
|
||||
bsc_subscr_con_free(con_data->conn);
|
||||
con_data->conn = NULL;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ static void bsc_sccp_force_free(struct osmo_bsc_sccp_con *data)
|
|||
{
|
||||
if (data->conn) {
|
||||
gsm0808_clear(data->conn);
|
||||
subscr_con_free(data->conn);
|
||||
bsc_subscr_con_free(data->conn);
|
||||
data->conn = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue