aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-09-26 09:11:05 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2020-10-16 16:36:10 +0200
commitf2962b5252217a53b616f285eed40ddffd38715a (patch)
treeeb48c86da69181ae57eeae1bb67868f2c24dcbab
parentad574a9e31472cdab0051e828b1f57f7c6356f42 (diff)
WIP: PTP BVC RESETdaniel/gbproxy-ns2
-rw-r--r--include/osmocom/gprs/gprs_bssgp.h1
-rw-r--r--src/gb/gprs_bssgp.c28
-rw-r--r--src/gb/libosmogb.map1
3 files changed, 30 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index 8d7d46ca..ed73ff10 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -20,6 +20,7 @@ struct msgb *bssgp_msgb_alloc(void);
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_reset3(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 8b8d534e..f3103eec 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 @@ struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t
return NULL;
}
+/*! Transmit a BVC-RESET message (Chapter 10.4.12) */
+int bssgp_tx_bvc_reset3(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/libosmogb.map b/src/gb/libosmogb.map
index c9ba012c..a88d9379 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -17,6 +17,7 @@ bssgp_set_bssgp_callback;
bssgp_tx_bvc_block;
bssgp_tx_bvc_reset;
bssgp_tx_bvc_reset2;
+bssgp_tx_bvc_reset3;
bssgp_tx_bvc_unblock;
bssgp_tx_fc_bvc;
bssgp_tx_fc_ms;