diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2017-10-29 11:09:55 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2017-10-29 15:15:20 +0000 |
commit | de1b26a3c6fa27b29157e86a6da03f354586badb (patch) | |
tree | fd361a400873fac3a5ee73eeda7078d9282b0df0 | |
parent | a25af02ef7c3dee6d83f5d61fdb62ec8ebec971c (diff) |
More ws_inet_ntop() tweaks.
Change-Id: I8f77f189337f9299e566a4149ae6ea481d3dbed6
Reviewed-on: https://code.wireshark.org/review/24162
Reviewed-by: João Valverde <j@v6e.pt>
-rw-r--r-- | wsutil/inet_addr.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/wsutil/inet_addr.h b/wsutil/inet_addr.h index 768c8e9a10..05670e8ae5 100644 --- a/wsutil/inet_addr.h +++ b/wsutil/inet_addr.h @@ -25,6 +25,10 @@ #include "ws_symbol_export.h" #include "ws_attributes.h" +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif + #include <glib.h> #include "inet_ipv6.h" @@ -57,15 +61,29 @@ * buffer for IPv4 addresses and a 46-byte or larger buffer for * IPv6 addresses. */ -#define WS_INET_ADDRSTRLEN 16 -#define WS_INET6_ADDRSTRLEN 46 +#ifdef INET_ADDRSTRLEN + #define WS_INET_ADDRSTRLEN INET_ADDRSTRLEN +#else + #define WS_INET_ADDRSTRLEN 16 +#endif +#ifdef INET6_ADDRSTRLEN + #define WS_INET6_ADDRSTRLEN INET6_ADDRSTRLEN +#else + #define WS_INET6_ADDRSTRLEN 46 +#endif +/* + * 'dst_size' *must* be greater or equal to WS_INET_ADDRSTRLEN. + */ WS_DLL_PUBLIC WS_RETNONNULL const gchar * ws_inet_ntop4(gconstpointer src, gchar *dst, guint dst_size); WS_DLL_PUBLIC gboolean ws_inet_pton4(const gchar *src, guint32 *dst); +/* + * 'dst_size' *must* be greater or equal to WS_INET6_ADDRSTRLEN. + */ WS_DLL_PUBLIC WS_RETNONNULL const gchar * ws_inet_ntop6(gconstpointer src, gchar *dst, guint dst_size); |