netdb.h 985 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2019 Linaro Limited
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef ZEPHYR_INCLUDE_POSIX_NETDB_H_
  7. #define ZEPHYR_INCLUDE_POSIX_NETDB_H_
  8. #include <net/socket.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #define addrinfo zsock_addrinfo
  13. static inline int getaddrinfo(const char *host, const char *service,
  14. const struct zsock_addrinfo *hints,
  15. struct zsock_addrinfo **res)
  16. {
  17. return zsock_getaddrinfo(host, service, hints, res);
  18. }
  19. static inline void freeaddrinfo(struct zsock_addrinfo *ai)
  20. {
  21. zsock_freeaddrinfo(ai);
  22. }
  23. static inline const char *gai_strerror(int errcode)
  24. {
  25. return zsock_gai_strerror(errcode);
  26. }
  27. static inline int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
  28. char *host, socklen_t hostlen,
  29. char *serv, socklen_t servlen, int flags)
  30. {
  31. return zsock_getnameinfo(addr, addrlen, host, hostlen,
  32. serv, servlen, flags);
  33. }
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* ZEPHYR_INCLUDE_POSIX_NETDB_H_ */