2017-07-18 13:54:53 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Linaro Limited.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2018-11-30 12:54:56 +02:00
|
|
|
#include <logging/log.h>
|
|
|
|
LOG_MODULE_REGISTER(net_socket_offload, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
2018-10-05 14:37:37 -07:00
|
|
|
|
2017-07-18 13:54:53 -07:00
|
|
|
#include <net/socket_offload.h>
|
2019-12-05 15:49:15 +01:00
|
|
|
#include <net/socket.h>
|
2017-07-18 13:54:53 -07:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
#include "sockets_internal.h"
|
2017-07-18 13:54:53 -07:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
const struct socket_dns_offload *dns_offload;
|
|
|
|
|
|
|
|
void socket_offload_dns_register(const struct socket_dns_offload *ops)
|
2017-07-18 13:54:53 -07:00
|
|
|
{
|
|
|
|
__ASSERT_NO_MSG(ops);
|
2019-12-05 15:49:15 +01:00
|
|
|
__ASSERT_NO_MSG(dns_offload == NULL);
|
2017-07-18 13:54:53 -07:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
dns_offload = ops;
|
2017-07-18 13:54:53 -07:00
|
|
|
}
|
2019-01-17 14:55:05 +01:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
int socket_offload_getaddrinfo(const char *node, const char *service,
|
|
|
|
const struct zsock_addrinfo *hints,
|
|
|
|
struct zsock_addrinfo **res)
|
2019-03-05 15:08:36 -08:00
|
|
|
{
|
2019-12-05 15:49:15 +01:00
|
|
|
__ASSERT_NO_MSG(dns_offload);
|
|
|
|
__ASSERT_NO_MSG(dns_offload->getaddrinfo);
|
2019-03-05 15:08:36 -08:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
return dns_offload->getaddrinfo(node, service, hints, res);
|
|
|
|
}
|
2019-03-05 15:08:36 -08:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
void socket_offload_freeaddrinfo(struct zsock_addrinfo *res)
|
|
|
|
{
|
|
|
|
__ASSERT_NO_MSG(dns_offload);
|
|
|
|
__ASSERT_NO_MSG(dns_offload->freeaddrinfo);
|
2019-03-05 15:08:36 -08:00
|
|
|
|
2019-12-05 15:49:15 +01:00
|
|
|
return dns_offload->freeaddrinfo(res);
|
2019-03-05 15:08:36 -08:00
|
|
|
}
|