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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20563 ) Change subject: gprs_ns2: add gprs_ns2_ip_vc_equal() ...................................................................... gprs_ns2: add gprs_ns2_ip_vc_equal() Compare the NS-VC with the given parameter Change-Id: I3a0cd305fd73b3cb9ec70246ec15ac70b83e57f2 --- M include/osmocom/gprs/gprs_ns2.h M src/gb/gprs_ns2_udp.c M src/gb/libosmogb.map 3 files changed, 39 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h index 6f33f79..497265e 100644 --- a/include/osmocom/gprs/gprs_ns2.h +++ b/include/osmocom/gprs/gprs_ns2.h @@ -147,6 +147,10 @@ const struct osmo_sockaddr *gprs_ns2_ip_vc_remote(const struct gprs_ns2_vc *nsvc); const struct osmo_sockaddr *gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc); +bool gprs_ns2_ip_vc_equal(const struct gprs_ns2_vc *nsvc, + const struct osmo_sockaddr *local, + const struct osmo_sockaddr *remote, + uint16_t nsvci); const struct osmo_sockaddr *gprs_ns2_ip_bind_sockaddr(struct gprs_ns2_vc_bind *bind); int gprs_ns2_is_ip_bind(struct gprs_ns2_vc_bind *bind); int gprs_ns2_ip_bind_set_dscp(struct gprs_ns2_vc_bind *bind, int dscp); diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c index d41c492..2cc1006 100644 --- a/src/gb/gprs_ns2_udp.c +++ b/src/gb/gprs_ns2_udp.c @@ -424,6 +424,40 @@ return &priv->remote; } +/*! Compare the NS-VC with the given parameter + * \param[in] nsvc NS-VC to compare with + * \param[in] local The local address + * \param[in] remote The remote address + * \param[in] nsvci NS-VCI will only be used if the NS-VC in BLOCKRESET mode otherwise NS-VCI isn't applicable. + * \return true if the NS-VC has the same properties as given + */ +bool gprs_ns2_ip_vc_equal(const struct gprs_ns2_vc *nsvc, + const struct osmo_sockaddr *local, + const struct osmo_sockaddr *remote, + uint16_t nsvci) +{ + struct priv_vc *vpriv; + struct priv_bind *bpriv; + + if (nsvc->ll != GPRS_NS_LL_UDP) + return false; + + vpriv = nsvc->priv; + bpriv = nsvc->bind->priv; + + if (osmo_sockaddr_cmp(local, &bpriv->addr)) + return false; + + if (osmo_sockaddr_cmp(remote, &vpriv->remote)) + return false; + + if (nsvc->mode == NS2_VC_MODE_BLOCKRESET) + if (nsvc->nsvci != nsvci) + return false; + + return true; +} + /*! Return the locally bound socket address of the bind. * \param[in] bind The bind whose local address we want to know * \return address of the local bind */ diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map index eea1285..c9ba012 100644 --- a/src/gb/libosmogb.map +++ b/src/gb/libosmogb.map @@ -95,6 +95,7 @@ gprs_ns2_ip_connect_sns; gprs_ns2_ip_vc_local; gprs_ns2_ip_vc_remote; +gprs_ns2_ip_vc_equal; gprs_ns2_is_frgre_bind; gprs_ns2_is_ip_bind; gprs_ns2_ll_str; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20563 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I3a0cd305fd73b3cb9ec70246ec15ac70b83e57f2 Gerrit-Change-Number: 20563 Gerrit-PatchSet: 4 Gerrit-Owner: lynxis lazus <lynxis at fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201012/01479861/attachment.htm>