gprs_ns2: add gprs_ns2_ip_vc_local() return the local sockaddr

Change-Id: I65a739772596015b90473045d32d4934d924e43f
This commit is contained in:
Alexander Couzens 2020-10-11 21:01:48 +02:00
parent c4229a458c
commit 979f5f5449
3 changed files with 19 additions and 0 deletions

View File

@ -140,6 +140,7 @@ int gprs_ns2_ip_connect_sns(struct gprs_ns2_vc_bind *bind,
uint16_t nsei);
const struct osmo_sockaddr *gprs_ns2_ip_vc_remote(struct gprs_ns2_vc *nsvc);
const struct osmo_sockaddr *gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc);
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);

View File

@ -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 */

View File

@ -93,6 +93,7 @@ gprs_ns2_ip_connect;
gprs_ns2_ip_connect2;
gprs_ns2_ip_connect_inactive;
gprs_ns2_ip_connect_sns;
gprs_ns2_ip_vc_local;
gprs_ns2_ip_vc_remote;
gprs_ns2_is_frgre_bind;
gprs_ns2_is_ip_bind;