summaryrefslogtreecommitdiffstats
path: root/gl/arpa_inet.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/arpa_inet.in.h')
-rw-r--r--gl/arpa_inet.in.h58
1 files changed, 53 insertions, 5 deletions
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index 523a448c..d7417bfd 100644
--- a/gl/arpa_inet.in.h
+++ b/gl/arpa_inet.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <arpa/inet.h>. 1/* A GNU-like <arpa/inet.h>.
2 2
3 Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -60,6 +60,53 @@
60# include <ws2tcpip.h> 60# include <ws2tcpip.h>
61#endif 61#endif
62 62
63#if !(@HAVE_DECL_HTONL@ || @HAVE_DECL_HTONS@ || @HAVE_DECL_NTOHL@ || @HAVE_DECL_NTOHS@)
64# include <endian.h>
65#endif
66
67_GL_INLINE_HEADER_BEGIN
68#ifndef _GL_ARPA_INET_INLINE
69# define _GL_ARPA_INET_INLINE _GL_INLINE
70#endif
71
72
73/* Host to network byte order. */
74
75#if !@HAVE_DECL_HTONS@
76_GL_ARPA_INET_INLINE uint16_t
77htons (uint16_t value)
78{
79 return htobe16 (value);
80}
81#endif
82
83#if !@HAVE_DECL_HTONL@
84_GL_ARPA_INET_INLINE uint32_t
85htonl (uint32_t value)
86{
87 return htobe32 (value);
88}
89#endif
90
91/* Network to host byte order. */
92
93#if !@HAVE_DECL_NTOHS@
94_GL_ARPA_INET_INLINE uint16_t
95ntohs (uint16_t value)
96{
97 return htobe16 (value);
98}
99#endif
100
101#if !@HAVE_DECL_NTOHL@
102_GL_ARPA_INET_INLINE uint32_t
103ntohl (uint32_t value)
104{
105 return htobe32 (value);
106}
107#endif
108
109
63/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 110/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
64 111
65/* The definition of _GL_ARG_NONNULL is copied here. */ 112/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -90,7 +137,7 @@
90# endif 137# endif
91_GL_FUNCDECL_RPL (inet_ntop, const char *, 138_GL_FUNCDECL_RPL (inet_ntop, const char *,
92 (int af, const void *restrict src, 139 (int af, const void *restrict src,
93 char *restrict dst, socklen_t cnt) 140 char *restrict dst, socklen_t cnt),
94 _GL_ARG_NONNULL ((2, 3))); 141 _GL_ARG_NONNULL ((2, 3)));
95_GL_CXXALIAS_RPL (inet_ntop, const char *, 142_GL_CXXALIAS_RPL (inet_ntop, const char *,
96 (int af, const void *restrict src, 143 (int af, const void *restrict src,
@@ -99,7 +146,7 @@ _GL_CXXALIAS_RPL (inet_ntop, const char *,
99# if !@HAVE_DECL_INET_NTOP@ 146# if !@HAVE_DECL_INET_NTOP@
100_GL_FUNCDECL_SYS (inet_ntop, const char *, 147_GL_FUNCDECL_SYS (inet_ntop, const char *,
101 (int af, const void *restrict src, 148 (int af, const void *restrict src,
102 char *restrict dst, socklen_t cnt) 149 char *restrict dst, socklen_t cnt),
103 _GL_ARG_NONNULL ((2, 3))); 150 _GL_ARG_NONNULL ((2, 3)));
104# endif 151# endif
105/* Need to cast, because on NonStop Kernel, the fourth parameter is 152/* Need to cast, because on NonStop Kernel, the fourth parameter is
@@ -126,14 +173,14 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
126# define inet_pton rpl_inet_pton 173# define inet_pton rpl_inet_pton
127# endif 174# endif
128_GL_FUNCDECL_RPL (inet_pton, int, 175_GL_FUNCDECL_RPL (inet_pton, int,
129 (int af, const char *restrict src, void *restrict dst) 176 (int af, const char *restrict src, void *restrict dst),
130 _GL_ARG_NONNULL ((2, 3))); 177 _GL_ARG_NONNULL ((2, 3)));
131_GL_CXXALIAS_RPL (inet_pton, int, 178_GL_CXXALIAS_RPL (inet_pton, int,
132 (int af, const char *restrict src, void *restrict dst)); 179 (int af, const char *restrict src, void *restrict dst));
133# else 180# else
134# if !@HAVE_DECL_INET_PTON@ 181# if !@HAVE_DECL_INET_PTON@
135_GL_FUNCDECL_SYS (inet_pton, int, 182_GL_FUNCDECL_SYS (inet_pton, int,
136 (int af, const char *restrict src, void *restrict dst) 183 (int af, const char *restrict src, void *restrict dst),
137 _GL_ARG_NONNULL ((2, 3))); 184 _GL_ARG_NONNULL ((2, 3)));
138# endif 185# endif
139_GL_CXXALIAS_SYS (inet_pton, int, 186_GL_CXXALIAS_SYS (inet_pton, int,
@@ -150,6 +197,7 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
150# endif 197# endif
151#endif 198#endif
152 199
200_GL_INLINE_HEADER_END
153 201
154#endif /* _@GUARD_PREFIX@_ARPA_INET_H */ 202#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
155#endif /* _@GUARD_PREFIX@_ARPA_INET_H */ 203#endif /* _@GUARD_PREFIX@_ARPA_INET_H */