bsc: Make open/close work on the sccp data

This commit is contained in:
Holger Hans Peter Freyther
2010-11-06 20:15:17 +01:00
parent b8781d2cd5
commit 7e9010892d
3 changed files with 12 additions and 10 deletions

View File

@@ -16,15 +16,16 @@ struct osmo_bsc_sccp_con {
struct timer_list sccp_it_timeout; struct timer_list sccp_it_timeout;
struct timer_list sccp_cc_timeout; struct timer_list sccp_cc_timeout;
struct gsm_subscriber_connection *conn;
uint8_t new_subscriber; uint8_t new_subscriber;
}; };
struct bsc_api *osmo_bsc_api(); struct bsc_api *osmo_bsc_api();
int bsc_queue_for_msc(struct gsm_subscriber_connection *conn, struct msgb *msg); int bsc_queue_for_msc(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_open_connection(struct gsm_subscriber_connection *conn, struct msgb *msg); int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg);
int bsc_create_new_connection(struct gsm_subscriber_connection *conn); int bsc_create_new_connection(struct gsm_subscriber_connection *conn);
int bsc_delete_connection(struct gsm_subscriber_connection *conn); int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp);
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);

View File

@@ -99,12 +99,12 @@ static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg
conn->bts->cell_identity); conn->bts->cell_identity);
if (!resp) { if (!resp) {
LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n"); LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n");
bsc_delete_connection(conn); bsc_delete_connection(conn->sccp_con);
return BSC_API_CONN_POL_REJECT; return BSC_API_CONN_POL_REJECT;
} }
if (bsc_open_connection(conn, resp) != 0) { if (bsc_open_connection(conn->sccp_con, resp) != 0) {
bsc_delete_connection(conn); bsc_delete_connection(conn->sccp_con);
msgb_free(resp); msgb_free(resp);
return BSC_API_CONN_POL_REJECT; return BSC_API_CONN_POL_REJECT;
} }

View File

@@ -126,29 +126,30 @@ int bsc_create_new_connection(struct gsm_subscriber_connection *conn)
bsc_con->sccp = sccp; bsc_con->sccp = sccp;
bsc_con->msc_con = net->msc_data->msc_con; bsc_con->msc_con = net->msc_data->msc_con;
bsc_con->conn = conn;
llist_add(&bsc_con->entry, &active_connections); llist_add(&bsc_con->entry, &active_connections);
conn->sccp_con = bsc_con; conn->sccp_con = bsc_con;
return 0; return 0;
} }
int bsc_open_connection(struct gsm_subscriber_connection *conn, struct msgb *msg) int bsc_open_connection(struct osmo_bsc_sccp_con *conn, struct msgb *msg)
{ {
LOGP(DMSC, LOGL_ERROR, "Not implemented yet.\n"); LOGP(DMSC, LOGL_ERROR, "Not implemented yet.\n");
return -1; return -1;
} }
int bsc_delete_connection(struct gsm_subscriber_connection *conn) int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp)
{ {
struct osmo_bsc_sccp_con *sccp = conn->sccp_con;
if (!sccp) if (!sccp)
return 0; return 0;
if (sccp->conn)
LOGP(DMSC, LOGL_ERROR, "Should have been cleared.\n");
llist_del(&sccp->entry); llist_del(&sccp->entry);
bsc_del_timer(&sccp->sccp_it_timeout); bsc_del_timer(&sccp->sccp_it_timeout);
bsc_del_timer(&sccp->sccp_cc_timeout); bsc_del_timer(&sccp->sccp_cc_timeout);
talloc_free(sccp); talloc_free(sccp);
conn->sccp_con = NULL;
return 0; return 0;
} }