zephyr/include/net/socket_offload.h
Robert Lubos bea1093e62 net: sockets: Remove socket offloading interface
Instead of using a custom offloading interface, users can use
`NET_SOCKET_REGISTER` macro to register custom socket API provider. This
solution removes a limitation, that only one offloaded interface can be
registered and that it cannot be used together with native IP stack.

The only exception remainig are DNS releated operations -
`getaddrinfo`/`freeaddrinfo`, which, when offloaded, have to be
registered specifically.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-31 11:36:02 -05:00

53 lines
1.2 KiB
C

/*
* Copyright (c) 2018 Linaro Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Socket Offload Redirect API
*/
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
#define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
#include <net/net_ip.h>
#include <net/socket.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @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);
};
/**
* @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);
int socket_offload_getaddrinfo(const char *node, const char *service,
const struct zsock_addrinfo *hints,
struct zsock_addrinfo **res);
void socket_offload_freeaddrinfo(struct zsock_addrinfo *res);
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_ */