arpa_inet.in.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* A GNU-like <arpa/inet.h>.
  2. Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. #ifndef _GL_ARPA_INET_H
  15. #if __GNUC__ >= 3
  16. @PRAGMA_SYSTEM_HEADER@
  17. #endif
  18. /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
  19. under MinGW.
  20. But avoid namespace pollution on glibc systems. */
  21. #ifndef __GLIBC__
  22. # include <sys/socket.h>
  23. #endif
  24. #if @HAVE_ARPA_INET_H@
  25. /* The include_next requires a split double-inclusion guard. */
  26. # @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
  27. #endif
  28. #ifndef _GL_ARPA_INET_H
  29. #define _GL_ARPA_INET_H
  30. /* The definition of _GL_ARG_NONNULL is copied here. */
  31. /* The definition of _GL_WARN_ON_USE is copied here. */
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #if @GNULIB_INET_NTOP@
  36. # if !@HAVE_DECL_INET_NTOP@
  37. /* Converts an internet address from internal format to a printable,
  38. presentable format.
  39. AF is an internet address family, such as AF_INET or AF_INET6.
  40. SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
  41. (for AF_INET6).
  42. DST points to a buffer having room for CNT bytes.
  43. The printable representation of the address (in numeric form, not
  44. surrounded by [...], no reverse DNS is done) is placed in DST, and
  45. DST is returned. If an error occurs, the return value is NULL and
  46. errno is set. If CNT bytes are not sufficient to hold the result,
  47. the return value is NULL and errno is set to ENOSPC. A good value
  48. for CNT is 46.
  49. For more details, see the POSIX:2001 specification
  50. <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
  51. extern const char *inet_ntop (int af, const void *restrict src,
  52. char *restrict dst, socklen_t cnt)
  53. _GL_ARG_NONNULL ((2, 3));
  54. # endif
  55. #elif defined GNULIB_POSIXCHECK
  56. # undef inet_ntop
  57. # if HAVE_RAW_DECL_INET_NTOP
  58. _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
  59. "use gnulib module inet_ntop for portability");
  60. # endif
  61. #endif
  62. #if @GNULIB_INET_PTON@
  63. # if !@HAVE_DECL_INET_PTON@
  64. extern int inet_pton (int af, const char *restrict src, void *restrict dst)
  65. _GL_ARG_NONNULL ((2, 3));
  66. # endif
  67. #elif defined GNULIB_POSIXCHECK
  68. # undef inet_pton
  69. # if HAVE_RAW_DECL_INET_PTON
  70. _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
  71. "use gnulib module inet_pton for portability");
  72. # endif
  73. #endif
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* _GL_ARPA_INET_H */
  78. #endif /* _GL_ARPA_INET_H */