dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21722 )
Change subject: gprs_bssgp: add handling for BSSGP RIM primitives ...................................................................... gprs_bssgp: add handling for BSSGP RIM primitives Receive and forward RIM messages to bssgp_prim_cb() Change-Id: Idfd0a65872a2cc6089885afd8d31b0b029d85d47 Related: SYS#5103 --- M include/osmocom/gprs/gprs_bssgp.h M include/osmocom/gsm/prim.h M src/gb/gprs_bssgp.c 3 files changed, 48 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/22/21722/1 diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h index 662685e..1deafe3 100644 --- a/include/osmocom/gprs/gprs_bssgp.h +++ b/include/osmocom/gprs/gprs_bssgp.h @@ -55,6 +55,8 @@ PRIM_NM_BVC_BLOCK, PRIM_NM_BVC_UNBLOCK, PRIM_NM_STATUS, + + PRIM_BSSGP_RIM }; struct osmo_bssgp_prim { diff --git a/include/osmocom/gsm/prim.h b/include/osmocom/gsm/prim.h index e7a60e3..045e353 100644 --- a/include/osmocom/gsm/prim.h +++ b/include/osmocom/gsm/prim.h @@ -16,4 +16,6 @@ SAP_BSSGP_PFM, SAP_NS, + + SAP_BSSGP_RIM, }; diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c index d73696c..9e3227e 100644 --- a/src/gb/gprs_bssgp.c +++ b/src/gb/gprs_bssgp.c @@ -700,6 +700,41 @@ return bssgp_prim_cb(&nmp.oph, NULL); } +static int bssgp_rx_rim(struct msgb *msg, struct tlv_parsed *tp, uint16_t bvci) +{ + struct osmo_bssgp_prim nmp; + uint16_t nsei = msgb_nsei(msg); + struct bssgp_normal_hdr *bgph = + (struct bssgp_normal_hdr *)msgb_bssgph(msg); + enum bssgp_prim prim; + + DEBUGP(DLBSSGP, "BSSGP BVCI=%u Rx RIM-PDU:%s\n", bvci, + bssgp_pdu_str(bgph->pdu_type)); + + /* Specify PRIM type based on the RIM PDU */ + switch (bgph->pdu_type) { + case BSSGP_PDUT_RAN_INFO: + case BSSGP_PDUT_RAN_INFO_REQ: + case BSSGP_PDUT_RAN_INFO_ACK: + case BSSGP_PDUT_RAN_INFO_ERROR: + case BSSGP_PDUT_RAN_INFO_APP_ERROR: + prim = PRIM_BSSGP_RIM; + break; + default: + /* Caller already makes sure that this can't happen. */ + OSMO_ASSERT(false); + } + + /* Send NM_BVC_RESET.ind to NM */ + memset(&nmp, 0, sizeof(nmp)); + nmp.nsei = nsei; + nmp.bvci = bvci; + nmp.tp = tp; + osmo_prim_init(&nmp.oph, SAP_BSSGP_RIM, prim, PRIM_OP_INDICATION, msg); + bssgp_prim_cb(&nmp.oph, NULL); + + return 0; +} /* One element (msgb) in a BSSGP Flow Control queue */ struct bssgp_fc_queue_element { @@ -1125,6 +1160,15 @@ case BSSGP_PDUT_STATUS: /* This is already handled in bssgp_rcvmsg() */ break; + + case BSSGP_PDUT_RAN_INFO: + case BSSGP_PDUT_RAN_INFO_REQ: + case BSSGP_PDUT_RAN_INFO_ACK: + case BSSGP_PDUT_RAN_INFO_ERROR: + case BSSGP_PDUT_RAN_INFO_APP_ERROR: + bssgp_rx_rim(msg, tp, bvci); + break; + /* those only exist in the SGSN -> BSS direction */ case BSSGP_PDUT_PAGING_PS: case BSSGP_PDUT_PAGING_CS: -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21722 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idfd0a65872a2cc6089885afd8d31b0b029d85d47 Gerrit-Change-Number: 21722 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pma...@sysmocom.de> Gerrit-MessageType: newchange