implement parsing of PAGING RESPONSE

This commit is contained in:
Harald Welte 2009-02-06 12:02:13 +00:00
parent 1cbfaf508a
commit 2d35ae6d3b
2 changed files with 50 additions and 3 deletions

View File

@ -98,6 +98,16 @@ struct gsm48_control_channel_descr {
u_int8_t t3212; u_int8_t t3212;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Section 9.1.25 PAGING RESPONSE */
struct gsm48_paging_response {
u_int8_t spare:4,
cipher_keyt_seq:4;
/* length + 3 bytes */
u_int32_t classmark2;
u_int8_t mi_len;
u_int8_t mi[0];
} __attribute__ ((packed));
/* Section 9.2.9 CM service request */ /* Section 9.2.9 CM service request */
struct gsm48_service_request { struct gsm48_service_request {
u_int8_t cm_service_type : 4, u_int8_t cm_service_type : 4,

View File

@ -649,10 +649,45 @@ static int gsm0408_rcv_mm(struct msgb *msg)
return rc; return rc;
} }
/* Receive a PAGING RESPONSE message from the MS */
static int gsm48_rr_rx_pag_resp(struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
struct gsm48_paging_response *pr =
(struct gsm48_paging_response *) gh->data;
u_int8_t mi_type = pr->mi[0] & GSM_MI_TYPE_MASK;
char mi_string[MI_SIZE];
struct gsm_subscriber *subscr;
int rc = 0;
mi_to_string(mi_string, sizeof(mi_string), &pr->mi[0], pr->mi_len);
DEBUGP(DRR, "PAGING RESPONSE: mi_type=0x%02x MI(%s)\n",
mi_type, mi_string);
subscr = subscr_get_by_tmsi(mi_string);
if (!subscr) {
DEBUGP(DRR, "<- Can't find any subscriber for this ID\n");
/* FIXME: close channel? */
return -EINVAL;
}
DEBUGP(DRR, "<- Channel was requested by %s\n",
subscr->name ? subscr->name : subscr->imsi);
if (!msg->lchan->subscr)
msg->lchan->subscr = subscr;
else if (msg->lchan->subscr != subscr) {
DEBUGP(DRR, "<- Channel already owned by someone else?\n");
subscr_put(subscr);
}
return rc;
}
/* Receive a GSM 04.08 Radio Resource (RR) message */ /* Receive a GSM 04.08 Radio Resource (RR) message */
static int gsm0408_rcv_rr(struct msgb *msg) static int gsm0408_rcv_rr(struct msgb *msg)
{ {
struct gsm48_hdr *gh = msgb_l3(msg); struct gsm48_hdr *gh = msgb_l3(msg);
int rc = 0;
switch (gh->msg_type) { switch (gh->msg_type) {
case GSM48_MT_RR_CLSM_CHG: case GSM48_MT_RR_CLSM_CHG:
@ -663,13 +698,15 @@ static int gsm0408_rcv_rr(struct msgb *msg)
DEBUGP(DRR, "GRPS SUSPEND REQUEST\n"); DEBUGP(DRR, "GRPS SUSPEND REQUEST\n");
break; break;
case GSM48_MT_RR_PAG_RESP: case GSM48_MT_RR_PAG_RESP:
rc = gsm48_rr_rx_pag_resp(msg);
break;
default: default:
fprintf(stderr, "Unimplemented GSM 04.08 msg type 0x%02x\n", fprintf(stderr, "Unimplemented GSM 04.08 RR msg type 0x%02x\n",
gh->msg_type); gh->msg_type);
break; break;
} }
return 0; return rc;
} }
/* Call Control */ /* Call Control */
@ -816,7 +853,7 @@ static int gsm0408_rcv_cc(struct msgb *msg)
/* FIXME: continue with CALL_PROCEEDING, ALERTING, CONNECT, RELEASE_COMPLETE */ /* FIXME: continue with CALL_PROCEEDING, ALERTING, CONNECT, RELEASE_COMPLETE */
break; break;
default: default:
fprintf(stderr, "Unimplemented GSM 04.08 msg type 0x%02x\n", fprintf(stderr, "Unimplemented GSM 04.08 CC msg type 0x%02x\n",
msg_type); msg_type);
break; break;
} }