Change in libosmocore[master]: gprs_ns2: add gprs_ns2_free_nses() to free all NS-E

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Mon Oct 12 01:16:51 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/20556 )


Change subject: gprs_ns2: add gprs_ns2_free_nses() to free all NS-E
......................................................................

gprs_ns2: add gprs_ns2_free_nses() to free all NS-E

Allow users to clean up most of the state (e.g. the PCU).

Change-Id: Ia00753a64b7622a0864341f51ea49b6963543755
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/libosmogb.map
3 files changed, 12 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/20556/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 2c58723..7531530 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -101,6 +101,7 @@
 struct gprs_ns2_nse *gprs_ns2_create_nse(struct gprs_ns2_inst *nsi, uint16_t nsei);
 uint16_t gprs_ns2_nse_nsei(struct gprs_ns2_nse *nse);
 void gprs_ns2_free_nse(struct gprs_ns2_nse *nse);
+void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi);
 
 /* create vc */
 void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc);
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 20e4473..a476cff 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -598,6 +598,15 @@
 	talloc_free(nse);
 }
 
+void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi)
+{
+	struct gprs_ns2_nse *nse, *ntmp;
+
+	llist_for_each_entry_safe(nse, ntmp, &nsi->nse, list) {
+		gprs_ns2_free_nse(nse);
+	}
+}
+
 static inline int ns2_tlv_parse(struct tlv_parsed *dec,
 			 const uint8_t *buf, int buf_len, uint8_t lv_tag,
 			 uint8_t lv_tag2)
@@ -997,15 +1006,10 @@
  *  \param[in] nsi NS instance to destroy */
 void gprs_ns2_free(struct gprs_ns2_inst *nsi)
 {
-	struct gprs_ns2_nse *nse, *ntmp;
-
 	if (!nsi)
 		return;
 
-	llist_for_each_entry_safe(nse, ntmp, &nsi->nse, list) {
-		gprs_ns2_free_nse(nse);
-	}
-
+	gprs_ns2_free_nses(nsi);
 	gprs_ns2_free_binds(nsi);
 
 	talloc_free(nsi);
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index d23d263..a185470 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -81,6 +81,7 @@
 gprs_ns2_free_bind;
 gprs_ns2_free_binds;
 gprs_ns2_free_nse;
+gprs_ns2_free_nses;
 gprs_ns2_free_nsvc;
 gprs_ns2_frgre_bind;
 gprs_ns2_instantiate;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20556
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia00753a64b7622a0864341f51ea49b6963543755
Gerrit-Change-Number: 20556
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201012/4e2d5d40/attachment.htm>


More information about the gerrit-log mailing list