socket_offload.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2018 Linaro Limited.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief Socket Offload Redirect API
  9. */
  10. #ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
  11. #define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
  12. #include <net/net_ip.h>
  13. #include <net/socket.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * @brief An offloaded Socket DNS API interface
  19. *
  20. * It is assumed that these offload functions follow the
  21. * POSIX socket API standard for arguments, return values and setting of errno.
  22. */
  23. struct socket_dns_offload {
  24. int (*getaddrinfo)(const char *node, const char *service,
  25. const struct zsock_addrinfo *hints,
  26. struct zsock_addrinfo **res);
  27. void (*freeaddrinfo)(struct zsock_addrinfo *res);
  28. };
  29. /**
  30. * @brief Register an offloaded socket DNS API interface.
  31. *
  32. * @param ops A pointer to the offloaded socket DNS API interface.
  33. */
  34. void socket_offload_dns_register(const struct socket_dns_offload *ops);
  35. int socket_offload_getaddrinfo(const char *node, const char *service,
  36. const struct zsock_addrinfo *hints,
  37. struct zsock_addrinfo **res);
  38. void socket_offload_freeaddrinfo(struct zsock_addrinfo *res);
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif /* ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_ */