2017-07-19 04:54:53 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Linaro Limited.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Socket Offload Redirect API
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
|
|
|
|
#define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
|
2017-07-19 04:54:53 +08:00
|
|
|
|
2019-12-05 22:49:15 +08:00
|
|
|
#include <net/net_ip.h>
|
|
|
|
#include <net/socket.h>
|
2019-08-05 22:18:46 +08:00
|
|
|
|
2017-07-19 04:54:53 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-12-05 22:49:15 +08:00
|
|
|
/**
|
|
|
|
* @brief An offloaded Socket DNS API interface
|
|
|
|
*
|
|
|
|
* It is assumed that these offload functions follow the
|
|
|
|
* POSIX socket API standard for arguments, return values and setting of errno.
|
|
|
|
*/
|
|
|
|
struct socket_dns_offload {
|
|
|
|
int (*getaddrinfo)(const char *node, const char *service,
|
|
|
|
const struct zsock_addrinfo *hints,
|
|
|
|
struct zsock_addrinfo **res);
|
|
|
|
void (*freeaddrinfo)(struct zsock_addrinfo *res);
|
|
|
|
};
|
2018-09-21 20:42:30 +08:00
|
|
|
|
2019-12-05 22:49:15 +08:00
|
|
|
/**
|
|
|
|
* @brief Register an offloaded socket DNS API interface.
|
|
|
|
*
|
|
|
|
* @param ops A pointer to the offloaded socket DNS API interface.
|
|
|
|
*/
|
|
|
|
void socket_offload_dns_register(const struct socket_dns_offload *ops);
|
2018-09-21 20:42:30 +08:00
|
|
|
|
2019-12-05 22:49:15 +08:00
|
|
|
int socket_offload_getaddrinfo(const char *node, const char *service,
|
|
|
|
const struct zsock_addrinfo *hints,
|
|
|
|
struct zsock_addrinfo **res);
|
2018-09-21 20:42:30 +08:00
|
|
|
|
2019-12-05 22:49:15 +08:00
|
|
|
void socket_offload_freeaddrinfo(struct zsock_addrinfo *res);
|
2019-01-17 21:55:05 +08:00
|
|
|
|
2017-07-19 04:54:53 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_ */
|