summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_08.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-30 15:04:56 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-12 16:05:05 +0100
commitfbd934be94acef01c5bd0d6f54e18735d3d23e07 (patch)
treea3d4c98a087b9bded7df4d5f7f5a3583db609428 /openbsc/src/libmsc/gsm_04_08.c
parent5d80cbe481a0207675120194d0fedbd8744d9a0d (diff)
complete IuCS paging implementation
Add paging timeout to struct gsm_subscriber. Previously, paging timeout was implemented only on BSC level, where each request has its own timeout value. The MSC will still send individual requests to BSC or RNC level, where they timeout individually. However, the MSC must also have an own timeout to be sure to discard stale pagings that the BSC or RNC never replied for. Add handle_paging_resp(), copying the few libmsc relevant parts of gsm48_handle_paging_resp().
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_08.c')
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 8c9328703..5e86dcfa3 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -1249,6 +1249,30 @@ static int gsm0408_rcv_mm(struct gsm_subscriber_connection *conn, struct msgb *m
return rc;
}
+static int handle_paging_resp(struct msgb *msg,
+ struct gsm_subscriber_connection *conn,
+ struct gsm_subscriber *subscr)
+{
+ if (!conn->subscr) {
+ conn->subscr = subscr;
+ } else if (conn->subscr != subscr) {
+ LOGP(DPAG, LOGL_ERROR,
+ "Connection already owned by another subscriber?\n");
+ subscr_put(subscr);
+ return -EINVAL;
+ } else {
+ DEBUGP(DPAG, "Connection already owned by the subscriber\n");
+ subscr_put(subscr);
+ subscr = conn->subscr;
+ }
+
+ /* TODO: count successful paging *in MSC*, similarly to BSC:
+ * rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED]); */
+#warning "missing rate counter for paging on MSC level"
+
+ return subscr_rx_paging_response(msg, conn);
+}
+
/* Receive a PAGING RESPONSE message from the MS */
static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
@@ -1292,14 +1316,7 @@ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct m
/* We received a paging */
conn->expire_timer_stopped = 1;
-#if 0
- TODO implement paging response in libmsc!
- Excluding this to be able to link without libbsc:
- rc = gsm48_handle_paging_resp(conn, msg, subscr);
- return rc;
-#else
- return -ENOTSUP;
-#endif
+ return handle_paging_resp(msg, conn, subscr);
}
static int gsm48_rx_rr_app_info(struct gsm_subscriber_connection *conn, struct msgb *msg)
@@ -3581,12 +3598,12 @@ int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg)
trans_free(trans);
return 0;
}
- /* store setup informations until paging was successfull */
+ /* store setup information until paging succeeds */
memcpy(&trans->cc.msg, data, sizeof(struct gsm_mncc));
/* Request a channel */
- trans->paging_request = subscr_request_channel(subscr,
- RSL_CHANNEED_TCH_F, setup_trig_pag_evt,
+ trans->paging_request = subscr_request_conn(subscr,
+ setup_trig_pag_evt,
trans);
if (!trans->paging_request) {
LOGP(DCC, LOGL_ERROR, "Failed to allocate paging token.\n");