diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-03-22 19:26:52 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-04-20 11:30:14 +0200 |
commit | 63b99ced83773d92310211d557009e1c8cc4faf4 (patch) | |
tree | 053ada36feb946ab27bacdbfdb64cfa256009730 /openbsc/src/libmsc/gsm_04_08.c | |
parent | 0b8e6dd2df71a221e2d79b19b0b80aea43b25a6d (diff) |
add preliminary paging response handling, incomplete
In gsm_04_08.c, add a static handle_paging_resp() to take over from the libbsc
function gsm48_handle_paging_resp(). Use the subscr->requests listing to handle
a Paging Response and call the pending cbfn.
In NITB, this used to be done via BTS, and I haven't entirely resolved yet how
exactly to rewire this in standalone libmsc. So far, this "works for me", but
is worth another visit.
Still missing: enable Integrity Protection.
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_08.c')
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 897f97271..cccb8f717 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -1245,6 +1245,47 @@ static int gsm0408_rcv_mm(struct gsm_subscriber_connection *conn, struct msgb *m return rc; } +static int handle_paging_resp(struct gsm_subscriber_connection *conn, + struct msgb *msg, struct gsm_subscriber *subscr) +{ + struct subscr_request *req, *req2; + + if (!conn->subscr) { + conn->subscr = subscr; + } else if (conn->subscr != subscr) { + LOGP(DRR, LOGL_ERROR, "<- Channel already owned by someone else?\n"); + subscr_put(subscr); + return -EINVAL; + } else { + DEBUGP(DRR, "<- Channel already owned by us\n"); + subscr_put(subscr); + subscr = conn->subscr; + } + + osmo_counter_inc(conn->network->stats.paging.completed); + + if (!subscr->is_paging) { + LOGP(DRR, LOGL_ERROR, "Paging Response received for subscriber that is not paging\n"); + return -1; + } + + llist_for_each_entry_safe(req, req2, &subscr->requests, entry) { + gsm_cbfn *cbfn = req->cbfn; + void *param = req->param; + + llist_del(&req->entry); + req = NULL; + + if (conn && cbfn) { + LOGP(DPAG, LOGL_DEBUG, "Calling paging cbfn.\n"); + cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED, + msg, conn, param); + } else + LOGP(DPAG, LOGL_DEBUG, "Paging without action.\n"); + } + return 0; +} + /* Receive a PAGING RESPONSE message from the MS */ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct msgb *msg) { @@ -1254,7 +1295,6 @@ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct m uint8_t mi_type; char mi_string[GSM48_MI_SIZE]; struct gsm_subscriber *subscr = NULL; - int rc = 0; resp = (struct gsm48_pag_resp *) &gh->data[0]; gsm48_paging_extract_mi(resp, msgb_l3len(msg) - sizeof(*gh), @@ -1289,12 +1329,12 @@ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct m /* We received a paging */ conn->expire_timer_stopped = 1; + /* FIXME start Integrity Protection in Iu mode */ + #if BEFORE_MSCSPLIT - rc = gsm48_handle_paging_resp(conn, msg, subscr); - return rc; + return gsm48_handle_paging_resp(conn, msg, subscr); #else - LOGP(DRR, LOGL_ERROR, "MSC wants to tell BSC to gsm48_handle_paging_resp() but A-interface not implemented\n"); - return -1; + return handle_paging_resp(conn, msg, subscr); #endif } |