inet_pton.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef INET_PTON
  2. #define INET_PTON
  3. #ifdef WIN32
  4. #ifdef IPV6_
  5. #define INET_IPV6
  6. #endif
  7. #include "unixutil.h"
  8. #include <errno.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. /*!
  12. * \file
  13. *
  14. * \author: Paul Vixie, 1996.
  15. *
  16. * \brief Network support routines missing in WIN32.
  17. *
  18. * \warning Don't even consider trying to compile this on a system where
  19. * sizeof(int) < 4. sizeof(int) 4 is fine; all the world's not a VAX.
  20. *
  21. */
  22. /*!
  23. * \brief convert a network format address to presentation format.
  24. *
  25. * \return
  26. * pointer to presentation format address (`dst'), or NULL (see errno).
  27. */
  28. extern const char *inet_ntop(int af, const void *src, char *dst,
  29. socklen_t size);
  30. /*!
  31. * \brief convert from presentation format (which usually means ASCII printable)
  32. * to network format (which is usually some kind of binary format).
  33. *
  34. * \return
  35. * \li 1 if the address was valid for the specified address family
  36. * \li 0 if the address wasn't valid (`dst' is untouched in this case)
  37. * \li -1 if some other error occurred (`dst' is untouched in this case, too)
  38. */
  39. extern int inet_pton(int af, const char *src, void *dst);
  40. #endif /* WIN32 */
  41. #endif /* INET_PTON */