You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.6 KiB

  1. /* udns_XtoX.c
  2. udns_ntop() and udns_pton() routines, which are either
  3. - wrappers for inet_ntop() and inet_pton() or
  4. - reimplementations of those routines.
  5. Copyright (C) 2005 Michael Tokarev <mjt@corpit.ru>
  6. This file is part of UDNS library, an async DNS stub resolver.
  7. This library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with this library, in file named COPYING.LGPL; if not,
  17. write to the Free Software Foundation, Inc., 59 Temple Place,
  18. Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifdef HAVE_CONFIG_H
  21. # include "config.h"
  22. #endif
  23. #include "udns.h"
  24. #if HAVE_DECL_INET_NTOP == 1
  25. #include <sys/types.h>
  26. #include <sys/socket.h>
  27. #include <arpa/inet.h>
  28. const char *dns_ntop(int af, const void *src, char *dst, int size) {
  29. return inet_ntop(af, src, dst, size);
  30. }
  31. int dns_pton(int af, const char *src, void *dst) {
  32. return inet_pton(af, src, dst);
  33. }
  34. #else
  35. #include <winsock2.h> /* includes <windows.h> */
  36. #include <ws2tcpip.h> /* needed for struct in6_addr */
  37. #ifndef EAFNOSUPPORT
  38. #define EAFNOSUPPORT WSAEAFNOSUPPORT
  39. #endif
  40. #define inet_XtoX_prefix dns_
  41. #include "inet_XtoX.c"
  42. #endif