diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2017-11-08 14:02:08 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2017-11-09 16:08:25 +0000 |
commit | 39967011836c1e23dff188ffaadb747d9dcda062 (patch) | |
tree | 768e37aa23b5ad8775a47543ce26f1fdb3f3269d /wsutil | |
parent | 2ebc41050e43c508edbc8c0fa8cccb9797c463cf (diff) |
Replace inet_addr() with our inet_pton() wrapper
Error checking omitted like in original code.
Change-Id: If8b4181d30ddf5717951aaf7ec61db25c0bc5322
Reviewed-on: https://code.wireshark.org/review/24309
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/inet_addr.h | 3 | ||||
-rw-r--r-- | wsutil/inet_ipv4.h | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/wsutil/inet_addr.h b/wsutil/inet_addr.h index a3d45e25db..27ad4f143d 100644 --- a/wsutil/inet_addr.h +++ b/wsutil/inet_addr.h @@ -30,6 +30,7 @@ #endif #include <glib.h> +#include "inet_ipv4.h" #include "inet_ipv6.h" /* @@ -83,7 +84,7 @@ WS_DLL_PUBLIC WS_RETNONNULL const gchar * ws_inet_ntop6(gconstpointer src, gchar *dst, guint dst_size); WS_DLL_PUBLIC gboolean -ws_inet_pton4(const gchar *src, guint32 *dst); +ws_inet_pton4(const gchar *src, ws_in4_addr *dst); WS_DLL_PUBLIC gboolean ws_inet_pton6(const gchar *src, ws_in6_addr *dst); diff --git a/wsutil/inet_ipv4.h b/wsutil/inet_ipv4.h index 9c1094f5af..f86ac6d933 100644 --- a/wsutil/inet_ipv4.h +++ b/wsutil/inet_ipv4.h @@ -26,6 +26,12 @@ typedef guint32 ws_in4_addr; /* 32 bit IPv4 address, in network byte order */ +/* + * We define these in *network byte order*, unlike the C library. Therefore + * it uses a different prefix than INADDR_* to make the distinction more obvious. + */ +#define WS_IN4_LOOPBACK ((ws_in4_addr)GUINT32_TO_BE(0x7f000001)) + /** * Unicast Local * Returns true if the address is in the 224.0.0.0/24 local network |