diff options
Diffstat (limited to 'gl/arpa_inet.in.h')
| -rw-r--r-- | gl/arpa_inet.in.h | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h index 523a448c..a9c93d07 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-2026 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 | ||
| 77 | htons (uint16_t value) | ||
| 78 | { | ||
| 79 | return htobe16 (value); | ||
| 80 | } | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #if !@HAVE_DECL_HTONL@ | ||
| 84 | _GL_ARPA_INET_INLINE uint32_t | ||
| 85 | htonl (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 | ||
| 95 | ntohs (uint16_t value) | ||
| 96 | { | ||
| 97 | return htobe16 (value); | ||
| 98 | } | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #if !@HAVE_DECL_NTOHL@ | ||
| 102 | _GL_ARPA_INET_INLINE uint32_t | ||
| 103 | ntohl (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 |
| @@ -112,7 +159,6 @@ _GL_CXXALIAS_SYS_CAST (inet_ntop, const char *, | |||
| 112 | _GL_CXXALIASWARN (inet_ntop); | 159 | _GL_CXXALIASWARN (inet_ntop); |
| 113 | # endif | 160 | # endif |
| 114 | #elif defined GNULIB_POSIXCHECK | 161 | #elif defined GNULIB_POSIXCHECK |
| 115 | # undef inet_ntop | ||
| 116 | # if HAVE_RAW_DECL_INET_NTOP | 162 | # if HAVE_RAW_DECL_INET_NTOP |
| 117 | _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " | 163 | _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " |
| 118 | "use gnulib module inet_ntop for portability"); | 164 | "use gnulib module inet_ntop for portability"); |
| @@ -126,14 +172,14 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " | |||
| 126 | # define inet_pton rpl_inet_pton | 172 | # define inet_pton rpl_inet_pton |
| 127 | # endif | 173 | # endif |
| 128 | _GL_FUNCDECL_RPL (inet_pton, int, | 174 | _GL_FUNCDECL_RPL (inet_pton, int, |
| 129 | (int af, const char *restrict src, void *restrict dst) | 175 | (int af, const char *restrict src, void *restrict dst), |
| 130 | _GL_ARG_NONNULL ((2, 3))); | 176 | _GL_ARG_NONNULL ((2, 3))); |
| 131 | _GL_CXXALIAS_RPL (inet_pton, int, | 177 | _GL_CXXALIAS_RPL (inet_pton, int, |
| 132 | (int af, const char *restrict src, void *restrict dst)); | 178 | (int af, const char *restrict src, void *restrict dst)); |
| 133 | # else | 179 | # else |
| 134 | # if !@HAVE_DECL_INET_PTON@ | 180 | # if !@HAVE_DECL_INET_PTON@ |
| 135 | _GL_FUNCDECL_SYS (inet_pton, int, | 181 | _GL_FUNCDECL_SYS (inet_pton, int, |
| 136 | (int af, const char *restrict src, void *restrict dst) | 182 | (int af, const char *restrict src, void *restrict dst), |
| 137 | _GL_ARG_NONNULL ((2, 3))); | 183 | _GL_ARG_NONNULL ((2, 3))); |
| 138 | # endif | 184 | # endif |
| 139 | _GL_CXXALIAS_SYS (inet_pton, int, | 185 | _GL_CXXALIAS_SYS (inet_pton, int, |
| @@ -143,13 +189,13 @@ _GL_CXXALIAS_SYS (inet_pton, int, | |||
| 143 | _GL_CXXALIASWARN (inet_pton); | 189 | _GL_CXXALIASWARN (inet_pton); |
| 144 | # endif | 190 | # endif |
| 145 | #elif defined GNULIB_POSIXCHECK | 191 | #elif defined GNULIB_POSIXCHECK |
| 146 | # undef inet_pton | ||
| 147 | # if HAVE_RAW_DECL_INET_PTON | 192 | # if HAVE_RAW_DECL_INET_PTON |
| 148 | _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " | 193 | _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " |
| 149 | "use gnulib module inet_pton for portability"); | 194 | "use gnulib module inet_pton for portability"); |
| 150 | # endif | 195 | # endif |
| 151 | #endif | 196 | #endif |
| 152 | 197 | ||
| 198 | _GL_INLINE_HEADER_END | ||
| 153 | 199 | ||
| 154 | #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ | 200 | #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ |
| 155 | #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ | 201 | #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ |
