Change in libosmocore[master]: ns2: Add a function to reset the NSVC

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

daniel gerrit-no-reply at lists.osmocom.org
Wed Nov 18 13:21:47 UTC 2020


daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21231 )


Change subject: ns2: Add a function to reset the NSVC
......................................................................

ns2: Add a function to reset the NSVC

Change-Id: If96d56b19959372af4eba009661be19e985b4d51
---
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vc_fsm.c
2 files changed, 23 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/21231/1

diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index dee3ab7..1369efc 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -286,6 +286,7 @@
 struct osmo_fsm_inst *gprs_ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,
 					    const char *id, bool initiate);
 int gprs_ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc);
+int gprs_ns2_vc_reset(struct gprs_ns2_vc *nsvc);
 int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
 int gprs_ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);
 int gprs_ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 0d30f12..390c997 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -619,6 +619,28 @@
 	return 0;
 }
 
+/*! Reset a NS-VC FSM.
+ *  \param nsvc the virtual circuit
+ *  \return 0 on success; negative on error */
+int gprs_ns2_vc_reset(struct gprs_ns2_vc *nsvc)
+{
+	int rc = -EINVAL;
+	struct osmo_fsm_inst *fi = nsvc->fi;
+	struct gprs_ns2_vc_priv *priv = fi->priv;
+	struct gprs_ns2_inst *nsi = nsvc->nse->nsi;
+
+	switch (priv->nsvc->mode) {
+	case NS2_VC_MODE_ALIVE:
+		rc = osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_ALIVE, nsi->timeout[NS_TOUT_TNS_ALIVE], NS_TOUT_TNS_ALIVE);
+		break;
+	case NS2_VC_MODE_BLOCKRESET:
+		priv->initiater = true;
+		rc = osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], NS_TOUT_TNS_RESET);
+		break;
+	}
+	return rc;
+}
+
 /*! entry point for messages from the driver/VL
  *  \param nsvc virtual circuit on which the message was received
  *  \param msg message that was received

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If96d56b19959372af4eba009661be19e985b4d51
Gerrit-Change-Number: 21231
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201118/0c33520c/attachment.htm>


More information about the gerrit-log mailing list