aboutsummaryrefslogtreecommitdiffstats
path: root/lib/in46_addr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/in46_addr.c')
-rw-r--r--lib/in46_addr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/in46_addr.c b/lib/in46_addr.c
index f4bb8a2..648fe7e 100644
--- a/lib/in46_addr.c
+++ b/lib/in46_addr.c
@@ -60,7 +60,11 @@ int in46a_to_sas(struct sockaddr_storage *out, const struct in46_addr *in)
return 0;
}
-/*! Convenience wrapper around inet_ntop() for \ref in46_addr */
+/*! Convenience wrapper around inet_ntop() for in46_addr.
+ * \param[in] in the in46_addr to print
+ * \param[out] dst destination buffer where string representation of the address is stored
+ * \param[out] dst_size size dst. Usually it should be at least INET6_ADDRSTRLEN.
+ * \return address of dst on success, NULL on error */
const char *in46a_ntop(const struct in46_addr *in, char *dst, socklen_t dst_size)
{
int af;
@@ -371,3 +375,10 @@ default_to_dyn_v4:
dst->v4.s_addr = 0;
return 1;
}
+
+void in46a_from_gsna(const struct ul16_t *in, struct in46_addr *dst)
+{
+ dst->len = in->l;
+ OSMO_ASSERT(in->l <= sizeof(dst->v6));
+ memcpy(&dst->v6, in->v, in->l);
+}