diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-12-03 06:11:39 +0100 |
---|---|---|
committer | lynxis lazus <lynxis@fe80.eu> | 2020-12-15 11:46:45 +0000 |
commit | ebcbd726ee562e186fdd8d95abb7cfe706678fe0 (patch) | |
tree | a003ad3b054e222b9f5a39af28c30017988181b8 /src/gb/gprs_ns2_fr.c | |
parent | aaa55a663eb3a96db043e4bf83c7ad9be36718d1 (diff) |
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
Diffstat (limited to 'src/gb/gprs_ns2_fr.c')
-rw-r--r-- | src/gb/gprs_ns2_fr.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c index 5da6fcea..b62b5af6 100644 --- a/src/gb/gprs_ns2_fr.c +++ b/src/gb/gprs_ns2_fr.c @@ -606,6 +606,45 @@ struct gprs_ns2_vc_bind *gprs_ns2_fr_bind_by_netif( * \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) |