network: Move USRSOCK specific code from from inet_sockif to usrsock_sockif

This commit is contained in:
Jussi Kivilinna
2017-07-31 09:33:59 -06:00
committed by Gregory Nutt
parent 00d8dd3912
commit 7dfb01dbce
14 changed files with 105 additions and 315 deletions
+15
View File
@@ -23,6 +23,16 @@ config NET_USRSOCK_CONNS
Note: Usrsock daemon can impose additional restrictions for
maximum number of concurrent connections supported.
config NET_USRSOCK_NO_INET
bool "Disable PF_INET for usrsock"
default n
---help---
config NET_USRSOCK_NO_INET6
bool "Disable PF_INET6 for usrsock"
default n
---help---
config NET_USRSOCK_UDP
bool "User-space daemon provides UDP sockets"
default n
@@ -35,5 +45,10 @@ config NET_USRSOCK_TCP
select NET_TCP
---help---
config NET_USRSOCK_OTHER
bool "Enable other protocol families in addition of INET & INET6"
default n
---help---
endif # NET_USRSOCK
endmenu # User-space networking stack API
+1 -1
View File
@@ -41,7 +41,7 @@ NET_CSRCS += usrsock_close.c usrsock_conn.c usrsock_bind.c usrsock_connect.c
NET_CSRCS += usrsock_dev.c
NET_CSRCS += usrsock_event.c usrsock_getsockname.c usrsock_getsockopt.c
NET_CSRCS += usrsock_poll.c usrsock_recvfrom.c usrsock_sendto.c
NET_CSRCS += usrsock_setsockopt.c usrsock_socket.c
NET_CSRCS += usrsock_setsockopt.c usrsock_socket.c usrsock_sockif.c
# Include User Socket build support
+9 -5
View File
@@ -153,6 +153,8 @@ extern "C"
# define EXTERN extern
#endif
EXTERN const struct sock_intf_s g_usrsock_sockif;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -368,7 +370,7 @@ int usrsock_close(FAR struct usrsock_conn_s *conn);
*
****************************************************************************/
int usrsock_bind(FAR struct usrsock_conn_s *conn,
int usrsock_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr,
socklen_t addrlen);
@@ -427,6 +429,7 @@ int usrsock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup);
* psock A reference to the socket structure of the socket to be connected
* buf Data to send
* len Length of data to send
* flags Send flags (ignored)
* to Address of recipient
* tolen The length of the address structure
*
@@ -438,7 +441,7 @@ int usrsock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup);
****************************************************************************/
ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
size_t len, FAR const struct sockaddr *to,
size_t len, int flags, FAR const struct sockaddr *to,
socklen_t tolen);
/****************************************************************************
@@ -457,14 +460,15 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
* psock A pointer to a NuttX-specific, internal socket structure
* buf Buffer to receive data
* len Length of buffer
* flags Receive flags
* flags Receive flags (ignored)
* from Address of source (may be NULL)
* fromlen The length of the address structure
*
****************************************************************************/
ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
FAR struct sockaddr *from, FAR socklen_t *fromlen);
int flags, FAR struct sockaddr *from,
FAR socklen_t *fromlen);
/****************************************************************************
* Name: usrsock_getsockopt
@@ -542,7 +546,7 @@ int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
*
****************************************************************************/
int usrsock_getsockname(FAR struct usrsock_conn_s *conn,
int usrsock_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
#undef EXTERN
+2 -1
View File
@@ -162,10 +162,11 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn,
*
****************************************************************************/
int usrsock_bind(FAR struct usrsock_conn_s *conn,
int usrsock_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr,
socklen_t addrlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_reqstate_s state = {};
ssize_t ret;
+2 -1
View File
@@ -189,9 +189,10 @@ static void setup_conn_getsockname(FAR struct usrsock_conn_s *conn,
*
****************************************************************************/
int usrsock_getsockname(FAR struct usrsock_conn_s *conn,
int usrsock_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
struct iovec inbufs[1];
ssize_t ret;
+3 -1
View File
@@ -229,13 +229,15 @@ static void setup_conn_recvfrom(FAR struct usrsock_conn_s *conn,
* psock A pointer to a NuttX-specific, internal socket structure
* buf Buffer to receive data
* len Length of buffer
* flags Receive flags (ignored)
* from Address of source (may be NULL)
* fromlen The length of the address structure
*
****************************************************************************/
ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
FAR struct sockaddr *from, FAR socklen_t *fromlen)
int flags, FAR struct sockaddr *from,
FAR socklen_t *fromlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
+2 -2
View File
@@ -201,14 +201,14 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn,
* psock A pointer to a NuttX-specific, internal socket structure
* buf Data to send
* len Length of data to send
* flags Send flags
* flags Send flags (ignored)
* to Address of recipient
* tolen The length of the address structure
*
****************************************************************************/
ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
size_t len, FAR const struct sockaddr *to,
size_t len, int flags, FAR const struct sockaddr *to,
socklen_t tolen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;