<p>daniel has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/21231">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ns2: Add a function to reset the NSVC<br><br>Change-Id: If96d56b19959372af4eba009661be19e985b4d51<br>---<br>M src/gb/gprs_ns2_internal.h<br>M src/gb/gprs_ns2_vc_fsm.c<br>2 files changed, 23 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/21231/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h</span><br><span>index dee3ab7..1369efc 100644</span><br><span>--- a/src/gb/gprs_ns2_internal.h</span><br><span>+++ b/src/gb/gprs_ns2_internal.h</span><br><span>@@ -286,6 +286,7 @@</span><br><span> struct osmo_fsm_inst *gprs_ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,</span><br><span>                                      const char *id, bool initiate);</span><br><span> int gprs_ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc);</span><br><span style="color: hsl(120, 100%, 40%);">+int gprs_ns2_vc_reset(struct gprs_ns2_vc *nsvc);</span><br><span> int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);</span><br><span> int gprs_ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);</span><br><span> int gprs_ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);</span><br><span>diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c</span><br><span>index 0d30f12..390c997 100644</span><br><span>--- a/src/gb/gprs_ns2_vc_fsm.c</span><br><span>+++ b/src/gb/gprs_ns2_vc_fsm.c</span><br><span>@@ -619,6 +619,28 @@</span><br><span>        return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! Reset a NS-VC FSM.</span><br><span style="color: hsl(120, 100%, 40%);">+ *  \param nsvc the virtual circuit</span><br><span style="color: hsl(120, 100%, 40%);">+ *  \return 0 on success; negative on error */</span><br><span style="color: hsl(120, 100%, 40%);">+int gprs_ns2_vc_reset(struct gprs_ns2_vc *nsvc)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   int rc = -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+     struct osmo_fsm_inst *fi = nsvc->fi;</span><br><span style="color: hsl(120, 100%, 40%);">+       struct gprs_ns2_vc_priv *priv = fi->priv;</span><br><span style="color: hsl(120, 100%, 40%);">+  struct gprs_ns2_inst *nsi = nsvc->nse->nsi;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   switch (priv->nsvc->mode) {</span><br><span style="color: hsl(120, 100%, 40%);">+     case NS2_VC_MODE_ALIVE:</span><br><span style="color: hsl(120, 100%, 40%);">+               rc = osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_ALIVE, nsi->timeout[NS_TOUT_TNS_ALIVE], NS_TOUT_TNS_ALIVE);</span><br><span style="color: hsl(120, 100%, 40%);">+           break;</span><br><span style="color: hsl(120, 100%, 40%);">+        case NS2_VC_MODE_BLOCKRESET:</span><br><span style="color: hsl(120, 100%, 40%);">+          priv->initiater = true;</span><br><span style="color: hsl(120, 100%, 40%);">+            rc = osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], NS_TOUT_TNS_RESET);</span><br><span style="color: hsl(120, 100%, 40%);">+           break;</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+     return rc;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! entry point for messages from the driver/VL</span><br><span>  *  \param nsvc virtual circuit on which the message was received</span><br><span>  *  \param msg message that was received</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/21231">change 21231</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/21231"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If96d56b19959372af4eba009661be19e985b4d51 </div>
<div style="display:none"> Gerrit-Change-Number: 21231 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>