mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
Add user-space networking stack API (usrsock)
User-space networking stack API allows user-space daemon to provide TCP/IP stack implementation for NuttX network. Main use for this is to allow use and seamless integration of HW-provided TCP/IP stacks to NuttX. For example, user-space daemon can translate /dev/usrsock API requests to HW TCP/IP API requests while rest of the user-space can access standard socket API, with socket descriptors that can be used with NuttX system calls.
This commit is contained in:
committed by
Gregory Nutt
parent
c999519bf2
commit
cd3c9634c8
+12
-1
@@ -45,6 +45,7 @@
|
||||
#include "udp/udp.h"
|
||||
#include "local/local.h"
|
||||
#include "socket/socket.h"
|
||||
#include "usrsock/usrsock.h"
|
||||
|
||||
#if defined(CONFIG_NET) && !defined(CONFIG_DISABLE_POLL)
|
||||
|
||||
@@ -57,7 +58,8 @@
|
||||
*/
|
||||
|
||||
#undef HAVE_NET_POLL
|
||||
#if defined(HAVE_TCP_POLL) || defined(HAVE_UDP_POLL) || defined(HAVE_LOCAL_POLL)
|
||||
#if defined(HAVE_TCP_POLL) || defined(HAVE_UDP_POLL) || \
|
||||
defined(HAVE_LOCAL_POLL) || defined(CONFIG_NET_USRSOCK)
|
||||
# define HAVE_NET_POLL 1
|
||||
#endif
|
||||
|
||||
@@ -233,6 +235,15 @@ int psock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup)
|
||||
#else
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_NET_USRSOCK
|
||||
if (psock->s_type == SOCK_USRSOCK_TYPE)
|
||||
{
|
||||
/* Perform usrsock setup/teardown. */
|
||||
|
||||
return usrsock_poll(psock, fds, setup);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check if we are setting up or tearing down the poll */
|
||||
|
||||
if (setup)
|
||||
|
||||
Reference in New Issue
Block a user