aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gprs/gprs_bssgp.h3
-rw-r--r--src/gb/gprs_bssgp.c28
-rw-r--r--src/gb/libosmogb.map2
3 files changed, 33 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index 2dead692..400c3e00 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -207,6 +207,9 @@ int bssgp_fc_in(struct bssgp_flow_control *fc, struct msgb *msg,
int bssgp_fc_ms_init(struct bssgp_flow_control *fc_ms, uint16_t bvci,
uint16_t nsei, uint32_t max_queue_depth);
+void bssgp_flush_all_queues();
+void bssgp_fc_flush_queue(struct bssgp_flow_control *fc);
+
/* gprs_bssgp_vty.c */
int bssgp_vty_init(void);
void bssgp_set_log_ss(int ss);
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 5dfce16c..3b9fbf95 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -1263,3 +1263,31 @@ void bssgp_set_log_ss(int ss)
{
DBSSGP = ss;
}
+
+/*!
+ * \brief Flush the queue of the bssgp_flow_control
+ * \param[in] The flow control object which holds the queue.
+ */
+void bssgp_fc_flush_queue(struct bssgp_flow_control *fc)
+{
+ struct bssgp_fc_queue_element *element, *tmp;
+
+ llist_for_each_entry_safe(element, tmp, &fc->queue, list) {
+ msgb_free(element->msg);
+ llist_del(&element->list);
+ talloc_free(element);
+ }
+}
+
+/*!
+ * \brief Flush the queues of all BSSGP contexts.
+ */
+void bssgp_flush_all_queues()
+{
+ struct bssgp_bvc_ctx *bctx;
+
+ llist_for_each_entry(bctx, &bssgp_bvc_ctxts, list) {
+ if (bctx->fc)
+ bssgp_fc_flush_queue(bctx->fc);
+ }
+}
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index d56e6514..ec69670e 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -6,6 +6,8 @@ bssgp_pdu_str;
bssgp_fc_in;
bssgp_fc_init;
bssgp_fc_ms_init;
+bssgp_fc_flush_queue;
+bssgp_flush_all_queues;
bssgp_msgb_alloc;
bssgp_msgb_copy;
bssgp_msgb_tlli_put;