summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-11-11 19:20:42 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2019-11-24 19:59:35 +0100
commit951d32b817b58853cc928db19b7c544d88f29fc0 (patch)
tree3334874649e41b838ed806ca1ab4e25ee863b382 /src
parent06356fd9c3234574bd26d2f123acd334b4275f3c (diff)
osmo_sockaddr_str: deprecate osmo_sockaddr_str_*_32n()
Follow up for patch I3cf150cc0cc06dd36039fbde091bc71b01697322 osmo_sockaddr_str_{from,to}_32n actually use host byte order. Deprecate these and introduce a more accurately named version ending in h. Change-Id: Ic7fc279bf3c741811cfc002538e28e8f8560e338
Diffstat (limited to 'src')
-rw-r--r--src/sockaddr_str.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/sockaddr_str.c b/src/sockaddr_str.c
index 304363d9..c38a05cb 100644
--- a/src/sockaddr_str.c
+++ b/src/sockaddr_str.c
@@ -277,13 +277,20 @@ int osmo_sockaddr_str_from_32(struct osmo_sockaddr_str *sockaddr_str, uint32_t i
* \param[in] port Port number.
* \return 0 on success, negative on error.
*/
-int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port)
+int osmo_sockaddr_str_from_32h(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port)
{
if (!sockaddr_str)
return -ENOSPC;
return osmo_sockaddr_str_from_32(sockaddr_str, osmo_ntohl(ip), port);
}
+/*! DEPRECATED: the name suggests a conversion from network byte order, but actually converts from host byte order. Use
+ * osmo_sockaddr_str_from_32 for network byte order and osmo_sockaddr_str_from_32h for host byte order. */
+int osmo_sockaddr_str_from_32n(struct osmo_sockaddr_str *sockaddr_str, uint32_t ip, uint16_t port)
+{
+ return osmo_sockaddr_str_from_32h(sockaddr_str, ip, port);
+}
+
/*! Convert IPv4 address and port to osmo_sockaddr_str.
* \param[out] sockaddr_str The instance to copy to.
* \param[in] src IPv4 address and port data.
@@ -403,7 +410,7 @@ int osmo_sockaddr_str_to_32(const struct osmo_sockaddr_str *sockaddr_str, uint32
* \param[out] dst IPv4 address data in 32bit host-byte-order format to write to.
* \return 0 on success, negative on error (e.g. invalid IPv4 address string).
*/
-int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
+int osmo_sockaddr_str_to_32h(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
{
int rc;
uint32_t ip_h;
@@ -418,6 +425,13 @@ int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint3
return 0;
}
+/*! DEPRECATED: the name suggests a conversion to network byte order, but actually converts to host byte order. Use
+ * osmo_sockaddr_str_to_32() for network byte order and osmo_sockaddr_str_to_32h() for host byte order. */
+int osmo_sockaddr_str_to_32n(const struct osmo_sockaddr_str *sockaddr_str, uint32_t *ip)
+{
+ return osmo_sockaddr_str_to_32h(sockaddr_str, ip);
+}
+
/*! Convert osmo_sockaddr_str address string and port to IPv4 address and port data.
* \param[in] sockaddr_str The instance to convert the IP and port of.
* \param[out] dst IPv4 address and port data to write to.