diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-09-03 13:54:37 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-09-05 14:30:17 +0200 |
commit | f53fde91a36eff2601df9811fddee97b8f89d6ee (patch) | |
tree | 4fab4e91ba2be64871a04406d2d257f4e6f221b8 /src/common/rsl.c | |
parent | cb57028d52b711dfbc27dacf0b82c5a12f1f71c2 (diff) |
ETWS Primary Notification via P1 Rest Octets
The ETWS (Earthquake and Tsunami Warning System) uses a so-called
ETWS Primary Notification which is sent
* to phones in dedicated mode (via DCCH from the BSC)
* to phones in idle mode (via P1 Rest Octets on PCH/CCCH)
This patch implements the second part of the functionality, i.e.
transmitting the related ETWS Primary Notification via PCH. As
3GPP doesn't specify how this is communicated over Abis, we use
a new, vendor-specific RSL message type.
Closes: OS#4047
Depends: libosmocore I89c24a81ada6627694a9632e87485a61cbd3e680
Depends: libosmocore I36fc2ffc22728887d1cb8768c7fcd9739a8ec0fc
Change-Id: I18c60cdb86b9c19e09f5ec06d66e9b91608880e6
Diffstat (limited to 'src/common/rsl.c')
-rw-r--r-- | src/common/rsl.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c index d09dc4a4..0bcad4c0 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -522,6 +522,46 @@ static int rsl_rx_sms_bcast_cmd(struct gsm_bts_trx *trx, struct msgb *msg) return 0; } +/* OSMO_ETWS_CMD - proprietary extension as TS 48.058 has no standardized way to do this :( */ +static int rsl_rx_osmo_etws_cmd(struct gsm_bts_trx *trx, struct msgb *msg) +{ + struct abis_rsl_cchan_hdr *cch = msgb_l2(msg); + struct gsm_bts *bts = trx->bts; + struct tlv_parsed tp; + + rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg)); + + if (!TLVP_PRESENT(&tp, RSL_IE_SMSCB_MSG)) + return rsl_tx_error_report(trx, RSL_ERR_MAND_IE_ERROR, &cch->chan_nr, NULL, msg); + + bts->etws.prim_notif_len = TLVP_LEN(&tp, RSL_IE_SMSCB_MSG); + if (bts->etws.prim_notif_len == 0) { + LOGP(DRSL, LOGL_NOTICE, "ETWS Primary Notification OFF\n"); + talloc_free(bts->etws.prim_notif); + bts->etws.prim_notif = NULL; + bts->etws.prim_notif_len = 0; + bts->etws.page_size = 0; + bts->etws.num_pages = 0; + bts->etws.next_page = 0; + } else { + LOGP(DRSL, LOGL_NOTICE, "ETWS Primary Notification: %s\n", + osmo_hexdump(TLVP_VAL(&tp, RSL_IE_SMSCB_MSG), + TLVP_LEN(&tp, RSL_IE_SMSCB_MSG))); + talloc_free(bts->etws.prim_notif); + bts->etws.prim_notif = talloc_memdup(bts, TLVP_VAL(&tp, RSL_IE_SMSCB_MSG), + bts->etws.prim_notif_len); + + bts->etws.page_size = 14; /* maximum possible in SI1 Rest Octets */ + bts->etws.num_pages = bts->etws.prim_notif_len / bts->etws.page_size; + if (bts->etws.prim_notif_len % bts->etws.page_size) + bts->etws.num_pages++; + + /* toggle the PNI to allow phones to distinguish new from old primary notification */ + bts->etws.pni = !bts->etws.pni; + } + return 0; +} + /*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given output buffer. * \param[out] buf Output buffer, must be caller-allocated and hold at least len + 2 or sizeof(sysinfo_buf_t) bytes * \param[out] valid pointer to bit-mask of 'valid' System information types @@ -2951,6 +2991,9 @@ static int rsl_rx_cchan(struct gsm_bts_trx *trx, struct msgb *msg) rsl_msg_name(cch->c.msg_type)); rsl_tx_error_report(trx, RSL_ERR_MSG_TYPE, &cch->chan_nr, NULL, msg); break; + case RSL_MT_OSMO_ETWS_CMD: + ret = rsl_rx_osmo_etws_cmd(trx, msg); + break; default: LOGPLCHAN(msg->lchan, DRSL, LOGL_NOTICE, "undefined RSL cchan msg_type 0x%02x\n", cch->c.msg_type); |