aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2022-09-28 16:22:29 +0200
committerAlexander Couzens <lynxis@fe80.eu>2022-09-28 18:14:28 +0200
commit71ad530f7e3955ffbf59473dbcb8d1a3357b1f87 (patch)
treebece0e4c732d203b5642c3235b193736d6d1b8a3
parent70093f23ad2662ebfca1bfa95d084adeec495f42 (diff)
gb: add bssgp2_enc_flush_ll encode FLUSH-LL
-rw-r--r--include/osmocom/gprs/gprs_bssgp2.h2
-rw-r--r--src/gb/gprs_bssgp2.c29
-rw-r--r--src/gb/libosmogb.map1
3 files changed, 32 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp2.h b/include/osmocom/gprs/gprs_bssgp2.h
index 3b5b6e82..53e76e3a 100644
--- a/include/osmocom/gprs/gprs_bssgp2.h
+++ b/include/osmocom/gprs/gprs_bssgp2.h
@@ -59,6 +59,8 @@ struct msgb *bssgp2_enc_bvc_reset(uint16_t bvci, enum gprs_bssgp_cause cause,
struct msgb *bssgp2_enc_bvc_reset_ack(uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id,
const uint8_t *feat_bm, const uint8_t *ext_feat_bm);
+struct msgb *bssgp2_enc_flush_ll(uint32_t tlli, uint16_t old_bvci,
+ const uint16_t *new_bvci, const uint16_t *nsei);
struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg, uint16_t max_pdu_len);
diff --git a/src/gb/gprs_bssgp2.c b/src/gb/gprs_bssgp2.c
index 8e2ba66c..104fe08e 100644
--- a/src/gb/gprs_bssgp2.c
+++ b/src/gb/gprs_bssgp2.c
@@ -349,6 +349,35 @@ struct msgb *bssgp2_enc_fc_bvc(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_
return msg;
}
+/*! Encode BSSGP FLUSH-LL PDU as per TS 48.018 Section 10.4.1.
+ * \param[in] tlli - the TLLI of the MS
+ * \param[in] old_bvci BVCI
+ * \param[in] new_bvci2 optional BVCI - only encoded if non-NULL
+ * \param[in] nsei optional - only encoded if non-NULL
+ * \returns encoded PDU or NULL in case of error */
+struct msgb *bssgp2_enc_flush_ll(uint32_t tlli, uint16_t old_bvci,
+ const uint16_t *new_bvci, const uint16_t *nsei)
+{
+ struct msgb *msg = bssgp_msgb_alloc();
+ struct bssgp_normal_hdr *bgph;
+
+ if (!msg)
+ return NULL;
+
+ bgph = (struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
+ bgph->pdu_type = BSSGP_PDUT_FLUSH_LL;
+
+ msgb_tvlv_put_32be(msg, BSSGP_IE_TLLI, tlli);
+ msgb_tvlv_put_16be(msg, BSSGP_IE_BVCI, old_bvci);
+ if (new_bvci)
+ msgb_tvlv_put_16be(msg, BSSGP_IE_BVCI, *new_bvci);
+
+ if (nsei)
+ msgb_tvlv_put_16be(msg, BSSGP_IE_BVCI, *nsei);
+
+ return msg;
+}
+
/*! Encode a FLOW-CONTROL-BVC-ACK PDU as per TS 48.018 Section 10.4.4.
* \param[in] tag the tag IE value to encode
* \returns encoded PDU or NULL in case of error */
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index ff5b34a2..e02273d9 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -85,6 +85,7 @@ bssgp2_enc_fc_bvc;
bssgp2_enc_fc_bvc_ack;
bssgp2_enc_fc_ms;
bssgp2_enc_fc_ms_ack;
+bssgp2_enc_flush_ll;
bssgp2_enc_status;
bssgp_bvc_fsm_alloc_sig_bss;