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>
|
|
|
|
|
|
|
|
/* Only one provider may register socket operations upon boot. */
|
|
|
|
const struct socket_offload *socket_ops;
|
|
|
|
|
|
|
|
void socket_offload_register(const struct socket_offload *ops)
|
|
|
|
{
|
|
|
|
__ASSERT_NO_MSG(ops);
|
|
|
|
__ASSERT_NO_MSG(socket_ops == NULL);
|
|
|
|
|
|
|
|
socket_ops = ops;
|
|
|
|
}
|
2019-01-17 14:55:05 +01:00
|
|
|
|
|
|
|
int fcntl(int fd, int cmd, ...)
|
|
|
|
{
|
|
|
|
__ASSERT_NO_MSG(socket_ops);
|
|
|
|
__ASSERT_NO_MSG(socket_ops->fcntl);
|
|
|
|
|
|
|
|
va_list args;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
va_start(args, cmd);
|
|
|
|
res = socket_ops->fcntl(fd, cmd, args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|