lynxis lazus has uploaded this change for review.

View Change

gb: add bssgp2_enc_flush_ll encode FLUSH-LL

Change-Id: I76dc3b08a63cfd78c9f7657fb58c2ddfa9b4b7e2
---
M include/osmocom/gprs/gprs_bssgp2.h
M src/gb/gprs_bssgp2.c
M src/gb/libosmogb.map
3 files changed, 30 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/07/29507/1
diff --git a/include/osmocom/gprs/gprs_bssgp2.h b/include/osmocom/gprs/gprs_bssgp2.h
index 3b5b6e8..23312fc 100644
--- a/include/osmocom/gprs/gprs_bssgp2.h
+++ b/include/osmocom/gprs/gprs_bssgp2.h
@@ -59,6 +59,7 @@
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, uint16_t *new_bvci, 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 8e2ba66..bf83943 100644
--- a/src/gb/gprs_bssgp2.c
+++ b/src/gb/gprs_bssgp2.c
@@ -349,6 +349,34 @@
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, uint16_t *new_bvci, 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 ff5b34a..e02273d 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -85,6 +85,7 @@
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;

To view, visit change 29507. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I76dc3b08a63cfd78c9f7657fb58c2ddfa9b4b7e2
Gerrit-Change-Number: 29507
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>
Gerrit-MessageType: newchange