aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_udp.c
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-11 21:01:48 +0200
committerAlexander Couzens <lynxis@fe80.eu>2020-10-12 15:54:21 +0200
commit979f5f5449909c1b779258e5c5ec66f5de02a3b2 (patch)
treefa8e10cfe5c1d21139b8ea793093d9e6a0007e58 /src/gb/gprs_ns2_udp.c
parentc4229a458c28af184260ee8e02aca4f124ec01b1 (diff)
gprs_ns2: add gprs_ns2_ip_vc_local() return the local sockaddr
Diffstat (limited to 'src/gb/gprs_ns2_udp.c')
-rw-r--r--src/gb/gprs_ns2_udp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index e6891183..a3e9da6b 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -393,6 +393,23 @@ struct gprs_ns2_vc *gprs_ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind,
return nsvc;
}
+/*! Return the socket address of the local peer of a NS-VC.
+ * \param[in] nsvc NS-VC whose local peer we want to know
+ * \return address of the local peer; NULL in case of error */
+const struct osmo_sockaddr *gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc)
+{
+ struct priv_bind *priv;
+
+ if (nsvc->ll != GPRS_NS_LL_UDP)
+ return NULL;
+
+ if (nsvc->bind->driver != &vc_driver_ip)
+ return NULL;
+
+ priv = nsvc->bind->priv;
+ return &priv->addr;
+}
+
/*! Return the socket address of the remote peer of a NS-VC.
* \param[in] nsvc NS-VC whose remote peer we want to know
* \return address of the remote peer; NULL in case of error */