Change in libosmocore[master]: gprs_ns2: rework gprs_ns2_fr_connect*()

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
Thu Dec 3 05:40:18 UTC 2020


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


Change subject: gprs_ns2: rework gprs_ns2_fr_connect*()
......................................................................

gprs_ns2: rework gprs_ns2_fr_connect*()

Add gprs_ns2_fr_connect2() and change gprs_ns2_fr_connect() to be similar to
gprs_ns2_ip_connect() and gprs_ns2_connect2().

This is an API break but there wasn't yet a release with NS2.

Change-Id: I4e1374b0e979b3293302c5ed46a91a58f3a5a916
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2_fr.c
2 files changed, 43 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/21486/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 598f197..942cb87 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -183,6 +183,10 @@
 int gprs_ns2_is_fr_bind(struct gprs_ns2_vc_bind *bind);
 struct gprs_ns2_vc *gprs_ns2_fr_nsvc_by_dlci(struct gprs_ns2_vc_bind *bind, uint16_t dlci);
 struct gprs_ns2_vc *gprs_ns2_fr_connect(struct gprs_ns2_vc_bind *bind,
+					struct gprs_ns2_nse *nse,
+					uint16_t nsvci,
+					uint16_t dlci);
+struct gprs_ns2_vc *gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind,
 					uint16_t nsei,
 					uint16_t nsvci,
 					uint16_t dlci);
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 9327d54..3c84356 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -586,6 +586,45 @@
  *  \param[in] dlci Data Link connection identifier
  *  \return pointer to newly-allocated, connected and activated NS-VC; NULL on error */
 struct gprs_ns2_vc *gprs_ns2_fr_connect(struct gprs_ns2_vc_bind *bind,
+					struct gprs_ns2_nse *nse,
+					uint16_t nsvci,
+					uint16_t dlci)
+{
+	struct gprs_ns2_vc *nsvc = NULL;
+	struct priv_vc *priv = NULL;
+
+	nsvc = gprs_ns2_fr_nsvc_by_dlci(bind, dlci);
+	if (nsvc) {
+		goto err;
+	}
+
+	nsvc = ns2_vc_alloc(bind, nse, true, NS2_VC_MODE_BLOCKRESET);
+	if (!nsvc)
+		goto err;
+
+	nsvc->priv = priv = fr_alloc_vc(bind, nsvc, dlci);
+	if (!priv)
+		goto err;
+
+	nsvc->nsvci = nsvci;
+	nsvc->nsvci_is_valid = true;
+
+	gprs_ns2_vc_fsm_start(nsvc);
+
+	return nsvc;
+
+err:
+	gprs_ns2_free_nsvc(nsvc);
+	return NULL;
+}
+
+
+/*! Create, connect and activate a new FR-based NS-VC
+ *  \param[in] bind bind in which the new NS-VC is to be created
+ *  \param[in] nsei NSEI of the NS Entity in which the NS-VC is to be created
+ *  \param[in] dlci Data Link connection identifier
+ *  \return pointer to newly-allocated, connected and activated NS-VC; NULL on error */
+struct gprs_ns2_vc *gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind,
 					uint16_t nsei,
 					uint16_t nsvci,
 					uint16_t dlci)

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4e1374b0e979b3293302c5ed46a91a58f3a5a916
Gerrit-Change-Number: 21486
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/20201203/6c750fff/attachment.htm>


More information about the gerrit-log mailing list