This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
daniel gerrit-no-reply at lists.osmocom.orgdaniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/20958 ) Change subject: libosmogb: Add a function to tx BVC RESET by nsei/bvci ...................................................................... libosmogb: Add a function to tx BVC RESET by nsei/bvci This is needed for osmo-gbproxy where we need more control over BSSGP. Related: SYS#4998 Change-Id: Ifa769bce920a08cf93553dcb164a3fcf50162517 --- M include/osmocom/gprs/gprs_bssgp.h M src/gb/gprs_bssgp.c M src/gb/gprs_bssgp_bss.c M src/gb/libosmogb.map 4 files changed, 34 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/20958/1 diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h index 8d7d46c..4eb9df4 100644 --- a/include/osmocom/gprs/gprs_bssgp.h +++ b/include/osmocom/gprs/gprs_bssgp.h @@ -20,6 +20,7 @@ struct msgb *bssgp_msgb_copy(const struct msgb *msg, const char *name); const char *bssgp_cause_str(enum gprs_bssgp_cause cause); const char *bssgp_pdu_str(enum bssgp_pdu_type pdu); +int bssgp_tx_bvc_reset_nsei_bvci(uint16_t nsei, uint16_t bvci, enum gprs_bssgp_cause cause, const struct gprs_ra_id *ra_id, uint16_t cell_id); /* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */ int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei, uint16_t bvci, uint16_t ns_bvci); diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c index 8b8d534..9be8abd 100644 --- a/src/gb/gprs_bssgp.c +++ b/src/gb/gprs_bssgp.c @@ -41,6 +41,7 @@ #include <osmocom/gprs/gprs_ns.h> #include "common_vty.h" +#include "osmocom/gsm/gsm48.h" void *bssgp_tall_ctx = NULL; @@ -92,6 +93,33 @@ return NULL; } +/*! Transmit a BVC-RESET message with a given nsei and bvci (Chapter 10.4.12) */ +int bssgp_tx_bvc_reset_nsei_bvci(uint16_t nsei, uint16_t bvci, enum gprs_bssgp_cause cause, const struct gprs_ra_id *ra_id, uint16_t cell_id) +{ + struct msgb *msg = bssgp_msgb_alloc(); + struct bssgp_normal_hdr *bgph = + (struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph)); + uint16_t _bvci = osmo_htons(bvci); + + msgb_nsei(msg) = nsei; + msgb_bvci(msg) = 0; /* Signalling */ + bgph->pdu_type = BSSGP_PDUT_BVC_RESET; + LOGP(DBSSGP, LOGL_NOTICE, "BSSGP (BVCI=%u) Tx BVC-RESET " + "CAUSE=%s\n", bvci, bssgp_cause_str(cause)); + + msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &_bvci); + msgb_tvlv_put(msg, BSSGP_IE_CAUSE, 1, (uint8_t *) &cause); + if (ra_id) { + uint8_t bssgp_cid[8]; + bssgp_create_cell_id(bssgp_cid, ra_id, cell_id); + msgb_tvlv_put(msg, BSSGP_IE_CELL_ID, sizeof(bssgp_cid), bssgp_cid); + } + + /* Optional: Feature Bitmap */ + + return bssgp_ns_send(bssgp_ns_send_data, msg); +} + /*! Initiate reset procedure for all PTP BVC on a given NSEI. * * This function initiates reset procedure for all PTP BVC with a given cause. diff --git a/src/gb/gprs_bssgp_bss.c b/src/gb/gprs_bssgp_bss.c index d1734ee..079116a 100644 --- a/src/gb/gprs_bssgp_bss.c +++ b/src/gb/gprs_bssgp_bss.c @@ -293,28 +293,10 @@ /*! Transmit a BVC-RESET message (Chapter 10.4.12) */ int bssgp_tx_bvc_reset2(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause, bool add_cell_id) { - struct msgb *msg = bssgp_msgb_alloc(); - struct bssgp_normal_hdr *bgph = - (struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph)); - uint16_t _bvci = osmo_htons(bvci); - - LOGP(DBSSGP, LOGL_NOTICE, "BSSGP (BVCI=%u) Tx BVC-RESET " - "CAUSE=%s\n", bvci, bssgp_cause_str(cause)); - - msgb_nsei(msg) = bctx->nsei; - msgb_bvci(msg) = 0; /* Signalling */ - bgph->pdu_type = BSSGP_PDUT_BVC_RESET; - - msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &_bvci); - msgb_tvlv_put(msg, BSSGP_IE_CAUSE, 1, &cause); - if (add_cell_id) { - uint8_t bssgp_cid[8]; - bssgp_create_cell_id(bssgp_cid, &bctx->ra_id, bctx->cell_id); - msgb_tvlv_put(msg, BSSGP_IE_CELL_ID, sizeof(bssgp_cid), bssgp_cid); - } - /* Optional: Feature Bitmap */ - - return bssgp_ns_send(bssgp_ns_send_data, msg); + if (add_cell_id) + return bssgp_tx_bvc_reset_simple(bctx->nsei, bvci, cause, &bctx->ra_id, bctx->cell_id); + else + return bssgp_tx_bvc_reset_simple(bctx->nsei, bvci, cause, NULL, 0); } int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause) { diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map index 3755b4f..2ef12bc 100644 --- a/src/gb/libosmogb.map +++ b/src/gb/libosmogb.map @@ -17,6 +17,7 @@ bssgp_tx_bvc_block; bssgp_tx_bvc_reset; bssgp_tx_bvc_reset2; +bssgp_tx_bvc_reset_nsei_bvci; bssgp_tx_bvc_unblock; bssgp_tx_fc_bvc; bssgp_tx_fc_ms; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20958 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ifa769bce920a08cf93553dcb164a3fcf50162517 Gerrit-Change-Number: 20958 Gerrit-PatchSet: 1 Gerrit-Owner: daniel <dwillmann at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201029/21c45dec/attachment.htm>