Unix domain: Add options to build in stream or datagram support separately

This commit is contained in:
Gregory Nutt 2015-01-31 07:58:51 -06:00
parent e025094593
commit 0fc8d2fcc5
24 changed files with 193 additions and 98 deletions

View File

@ -385,6 +385,8 @@ CONFIG_NET_NACTIVESOCKETS=16
# Unix Domain Socket Support # Unix Domain Socket Support
# #
CONFIG_NET_LOCAL=y CONFIG_NET_LOCAL=y
# CONFIG_NET_LOCAL_STREAM is not set
CONFIG_NET_LOCAL_DGRAM=y
# #
# TCP/IP Networking # TCP/IP Networking

View File

@ -385,6 +385,8 @@ CONFIG_NET_NACTIVESOCKETS=16
# Unix Domain Socket Support # Unix Domain Socket Support
# #
CONFIG_NET_LOCAL=y CONFIG_NET_LOCAL=y
CONFIG_NET_LOCAL_STREAM=y
# CONFIG_NET_LOCAL_DGRAM is not set
# #
# TCP/IP Networking # TCP/IP Networking

View File

@ -14,6 +14,18 @@ config NET_LOCAL
if NET_LOCAL if NET_LOCAL
config NET_LOCAL_STREAM
bool "Unix domain stream sockets"
default y
---help---
Enable support for Unix domain SOCK_STREAM type sockets
config NET_LOCAL_DGRAM
bool "Unix domain datagram sockets"
default y
---help---
Enable support for Unix domain SOCK_DGRAM type sockets
endif # NET_LOCAL endif # NET_LOCAL
endmenu # Unix Domain Sockets endmenu # Unix Domain Sockets

View File

@ -37,9 +37,16 @@
ifeq ($(CONFIG_NET_LOCAL),y) ifeq ($(CONFIG_NET_LOCAL),y)
NET_CSRCS += local_conn.c local_connect.c local_release.c local_bind.c NET_CSRCS += local_conn.c local_release.c local_bind.c local_fifo.c
NET_CSRCS += local_listen.c local_accept.c local_fifo.c local_recvfrom.c NET_CSRCS += local_recvfrom.c local_sendpacket.c local_recvutils.c
NET_CSRCS += local_send.c local_sendto.c local_sendpacket.c local_recvutils.c
ifeq ($(CONFIG_NET_LOCAL_STREAM),y)
NET_CSRCS += local_connect.c local_listen.c local_accept.c local_send.c
endif
ifeq ($(CONFIG_NET_LOCAL_DGRAM),y)
NET_CSRCS += local_sendto.c
endif
ifneq ($(CONFIG_DISABLE_POLL),y) ifneq ($(CONFIG_DISABLE_POLL),y)
NET_CSRCS += local_netpoll.c NET_CSRCS += local_netpoll.c

View File

@ -140,6 +140,7 @@ struct local_conn_s
int16_t lc_outfd; /* File descriptor of write-only FIFO (peers) */ int16_t lc_outfd; /* File descriptor of write-only FIFO (peers) */
char lc_path[UNIX_PATH_MAX]; /* Path assigned by bind() */ char lc_path[UNIX_PATH_MAX]; /* Path assigned by bind() */
#ifdef CONFIG_NET_LOCAL_STREAM
/* SOCK_STREAM fields common to both client and server */ /* SOCK_STREAM fields common to both client and server */
sem_t lc_waitsem; /* Use to wait for a connection to be accepted */ sem_t lc_waitsem; /* Use to wait for a connection to be accepted */
@ -174,6 +175,7 @@ struct local_conn_s
uint16_t lc_remaining; /* Bytes remaining in the incoming stream */ uint16_t lc_remaining; /* Bytes remaining in the incoming stream */
} peer; } peer;
} u; } u;
#endif /* CONFIG_NET_LOCAL_STREAM */
}; };
/**************************************************************************** /****************************************************************************
@ -188,9 +190,11 @@ extern "C"
# define EXTERN extern # define EXTERN extern
#endif #endif
#ifdef CONFIG_NET_LOCAL_STREAM
/* A list of all SOCK_STREAM listener connections */ /* A list of all SOCK_STREAM listener connections */
EXTERN dq_queue_t g_local_listeners; EXTERN dq_queue_t g_local_listeners;
#endif
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
@ -347,8 +351,10 @@ int psock_local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
ssize_t psock_local_send(FAR struct socket *psock, FAR const void *buf, ssize_t psock_local_send(FAR struct socket *psock, FAR const void *buf,
size_t len, int flags); size_t len, int flags);
#endif
/**************************************************************************** /****************************************************************************
* Function: psock_local_sendto * Function: psock_local_sendto
@ -375,9 +381,11 @@ ssize_t psock_local_send(FAR struct socket *psock, FAR const void *buf,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf, ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf,
size_t len, int flags, FAR const struct sockaddr *to, size_t len, int flags, FAR const struct sockaddr *to,
socklen_t tolen); socklen_t tolen);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_send_packet * Name: local_send_packet
@ -497,7 +505,9 @@ int local_sync(int fd);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_create_fifos(FAR struct local_conn_s *conn); int local_create_fifos(FAR struct local_conn_s *conn);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_create_halfduplex * Name: local_create_halfduplex
@ -507,8 +517,10 @@ int local_create_fifos(FAR struct local_conn_s *conn);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_create_halfduplex(FAR struct local_conn_s *conn, int local_create_halfduplex(FAR struct local_conn_s *conn,
FAR const char *path); FAR const char *path);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_release_fifos * Name: local_release_fifos
@ -518,7 +530,9 @@ int local_create_halfduplex(FAR struct local_conn_s *conn,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_release_fifos(FAR struct local_conn_s *conn); int local_release_fifos(FAR struct local_conn_s *conn);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_release_halfduplex * Name: local_release_halfduplex
@ -528,7 +542,9 @@ int local_release_fifos(FAR struct local_conn_s *conn);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_release_halfduplex(FAR struct local_conn_s *conn); int local_release_halfduplex(FAR struct local_conn_s *conn);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_open_client_rx * Name: local_open_client_rx
@ -538,7 +554,9 @@ int local_release_halfduplex(FAR struct local_conn_s *conn);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock); int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_open_client_tx * Name: local_open_client_tx
@ -548,7 +566,9 @@ int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock); int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_open_server_rx * Name: local_open_server_rx
@ -558,7 +578,9 @@ int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock); int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_open_server_tx * Name: local_open_server_tx
@ -568,7 +590,9 @@ int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock); int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_open_receiver * Name: local_open_receiver
@ -578,7 +602,9 @@ int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock); int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock);
#endif
/**************************************************************************** /****************************************************************************
* Name: local_open_sender * Name: local_open_sender
@ -588,8 +614,10 @@ int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path, int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
bool nonblock); bool nonblock);
#endif
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -38,7 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_STREAM)
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -223,4 +223,4 @@ int psock_local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
} }
} }
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */ #endif /* CONFIG_NET && CONFIG_NET_LOCAL_STREAM */

View File

@ -66,7 +66,9 @@
void local_initialize(void) void local_initialize(void)
{ {
#ifdef CONFIG_NET_LOCAL_STREAM
dq_init(&g_local_listeners); dq_init(&g_local_listeners);
#endif
} }
/**************************************************************************** /****************************************************************************
@ -90,7 +92,9 @@ FAR struct local_conn_s *local_alloc(void)
conn->lc_infd = -1; conn->lc_infd = -1;
conn->lc_outfd = -1; conn->lc_outfd = -1;
#ifdef CONFIG_NET_LOCAL_STREAM
sem_init(&conn->lc_waitsem, 0, 0); sem_init(&conn->lc_waitsem, 0, 0);
#endif
} }
return conn; return conn;
@ -123,10 +127,12 @@ void local_free(FAR struct local_conn_s *conn)
close(conn->lc_outfd); close(conn->lc_outfd);
} }
#ifdef CONFIG_NET_LOCAL_STREAM
/* Destroy all FIFOs associted with the connection */ /* Destroy all FIFOs associted with the connection */
local_release_fifos(conn); local_release_fifos(conn);
sem_destroy(&conn->lc_waitsem); sem_destroy(&conn->lc_waitsem);
#endif
/* And free the connection structure */ /* And free the connection structure */

View File

@ -38,7 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_STREAM)
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -315,4 +315,4 @@ int psock_local_connect(FAR struct socket *psock,
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */ #endif /* CONFIG_NET && CONFIG_NET_LOCAL_STREAM */

View File

@ -76,6 +76,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
static inline void local_cs_name(FAR struct local_conn_s *conn, static inline void local_cs_name(FAR struct local_conn_s *conn,
FAR char *path) FAR char *path)
{ {
@ -83,6 +84,7 @@ static inline void local_cs_name(FAR struct local_conn_s *conn,
conn->lc_path); conn->lc_path);
path[LOCAL_FULLPATH_LEN-1] = '\0'; path[LOCAL_FULLPATH_LEN-1] = '\0';
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_sc_name * Name: local_sc_name
@ -92,6 +94,7 @@ static inline void local_cs_name(FAR struct local_conn_s *conn,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
static inline void local_sc_name(FAR struct local_conn_s *conn, static inline void local_sc_name(FAR struct local_conn_s *conn,
FAR char *path) FAR char *path)
{ {
@ -99,6 +102,7 @@ static inline void local_sc_name(FAR struct local_conn_s *conn,
conn->lc_path); conn->lc_path);
path[LOCAL_FULLPATH_LEN-1] = '\0'; path[LOCAL_FULLPATH_LEN-1] = '\0';
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_hd_name * Name: local_hd_name
@ -108,11 +112,13 @@ static inline void local_sc_name(FAR struct local_conn_s *conn,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
static inline void local_hd_name(FAR const char *inpath, FAR char *outpath) static inline void local_hd_name(FAR const char *inpath, FAR char *outpath)
{ {
(void)snprintf(outpath, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_HD_SUFFIX, inpath); (void)snprintf(outpath, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_HD_SUFFIX, inpath);
outpath[LOCAL_FULLPATH_LEN-1] = '\0'; outpath[LOCAL_FULLPATH_LEN-1] = '\0';
} }
#endif /* CONFIG_NET_LOCAL_DGRAM */
/**************************************************************************** /****************************************************************************
* Name: local_fifo_exists * Name: local_fifo_exists
@ -330,6 +336,7 @@ static int local_set_policy(int fd, unsigned long policy)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_create_fifos(FAR struct local_conn_s *conn) int local_create_fifos(FAR struct local_conn_s *conn)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -349,6 +356,7 @@ int local_create_fifos(FAR struct local_conn_s *conn)
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_create_halfduplex * Name: local_create_halfduplex
@ -358,6 +366,7 @@ int local_create_fifos(FAR struct local_conn_s *conn)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_create_halfduplex(FAR struct local_conn_s *conn, FAR const char *path) int local_create_halfduplex(FAR struct local_conn_s *conn, FAR const char *path)
{ {
char fullpath[LOCAL_FULLPATH_LEN]; char fullpath[LOCAL_FULLPATH_LEN];
@ -367,6 +376,7 @@ int local_create_halfduplex(FAR struct local_conn_s *conn, FAR const char *path)
local_hd_name(path, fullpath); local_hd_name(path, fullpath);
return local_create_fifo(fullpath); return local_create_fifo(fullpath);
} }
#endif /* CONFIG_NET_LOCAL_DGRAM */
/**************************************************************************** /****************************************************************************
* Name: local_release_fifos * Name: local_release_fifos
@ -376,6 +386,7 @@ int local_create_halfduplex(FAR struct local_conn_s *conn, FAR const char *path)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_release_fifos(FAR struct local_conn_s *conn) int local_release_fifos(FAR struct local_conn_s *conn)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -396,6 +407,7 @@ int local_release_fifos(FAR struct local_conn_s *conn)
return ret1 < 0 ? ret1 : ret2; return ret1 < 0 ? ret1 : ret2;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_release_halfduplex * Name: local_release_halfduplex
@ -405,6 +417,7 @@ int local_release_fifos(FAR struct local_conn_s *conn)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_release_halfduplex(FAR struct local_conn_s *conn) int local_release_halfduplex(FAR struct local_conn_s *conn)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -414,6 +427,7 @@ int local_release_halfduplex(FAR struct local_conn_s *conn)
local_hd_name(conn->lc_path, path); local_hd_name(conn->lc_path, path);
return local_release_fifo(path); return local_release_fifo(path);
} }
#endif /* CONFIG_NET_LOCAL_DGRAM */
/**************************************************************************** /****************************************************************************
* Name: local_open_client_rx * Name: local_open_client_rx
@ -423,6 +437,7 @@ int local_release_halfduplex(FAR struct local_conn_s *conn)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock) int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -444,6 +459,7 @@ int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock)
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_open_client_tx * Name: local_open_client_tx
@ -453,6 +469,7 @@ int local_open_client_rx(FAR struct local_conn_s *client, bool nonblock)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock) int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -474,6 +491,7 @@ int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock)
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_open_server_rx * Name: local_open_server_rx
@ -483,6 +501,7 @@ int local_open_client_tx(FAR struct local_conn_s *client, bool nonblock)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock) int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -504,6 +523,7 @@ int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock)
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_open_server_tx * Name: local_open_server_tx
@ -513,6 +533,7 @@ int local_open_server_rx(FAR struct local_conn_s *server, bool nonblock)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock) int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -534,6 +555,7 @@ int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock)
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Name: local_open_receiver * Name: local_open_receiver
@ -543,6 +565,7 @@ int local_open_server_tx(FAR struct local_conn_s *server, bool nonblock)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock) int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock)
{ {
char path[LOCAL_FULLPATH_LEN]; char path[LOCAL_FULLPATH_LEN];
@ -564,6 +587,7 @@ int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock)
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_DGRAM */
/**************************************************************************** /****************************************************************************
* Name: local_open_sender * Name: local_open_sender
@ -573,6 +597,7 @@ int local_open_receiver(FAR struct local_conn_s *conn, bool nonblock)
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path, int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
bool nonblock) bool nonblock)
{ {
@ -595,5 +620,6 @@ int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_DGRAM */
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */ #endif /* CONFIG_NET && CONFIG_NET_LOCAL */

View File

@ -38,7 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_STREAM)
#include <assert.h> #include <assert.h>
#include <queue.h> #include <queue.h>
@ -148,4 +148,4 @@ int local_listen(FAR struct local_conn_s *server, int backlog)
return OK; return OK;
} }
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */ #endif /* CONFIG_NET && CONFIG_NET_LOCAL_STREAM */

View File

@ -141,6 +141,7 @@ static int psock_fifo_read(FAR struct socket *psock, FAR void *buf,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_STREAM
static inline ssize_t static inline ssize_t
psock_stream_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, psock_stream_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
int flags, FAR struct sockaddr *from, int flags, FAR struct sockaddr *from,
@ -212,6 +213,7 @@ psock_stream_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
return readlen; return readlen;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Function: psock_dgram_recvfrom * Function: psock_dgram_recvfrom
@ -234,6 +236,7 @@ psock_stream_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_LOCAL_DGRAM
static inline ssize_t static inline ssize_t
psock_dgram_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, psock_dgram_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
int flags, FAR struct sockaddr *from, int flags, FAR struct sockaddr *from,
@ -377,6 +380,7 @@ errout_with_halfduplex:
(void)local_release_halfduplex(conn); (void)local_release_halfduplex(conn);
return ret; return ret;
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -418,15 +422,21 @@ ssize_t psock_local_recvfrom(FAR struct socket *psock, FAR void *buf,
/* Check for a stream socket */ /* Check for a stream socket */
#ifdef CONFIG_NET_LOCAL_STREAM
if (psock->s_type == SOCK_STREAM) if (psock->s_type == SOCK_STREAM)
{ {
return psock_stream_recvfrom(psock, buf, len, flags, from, fromlen); return psock_stream_recvfrom(psock, buf, len, flags, from, fromlen);
} }
else if (psock->s_type == SOCK_DGRAM) else
#endif
#ifdef CONFIG_NET_LOCAL_DGRAM
if (psock->s_type == SOCK_DGRAM)
{ {
return psock_dgram_recvfrom(psock, buf, len, flags, from, fromlen); return psock_dgram_recvfrom(psock, buf, len, flags, from, fromlen);
} }
else else
#endif
{ {
DEBUGPANIC(); DEBUGPANIC();
ndbg("ERROR: Unrecognized socket type: %s\n", psock->s_type); ndbg("ERROR: Unrecognized socket type: %s\n", psock->s_type);

View File

@ -76,6 +76,7 @@ int local_release(FAR struct local_conn_s *conn)
DEBUGASSERT(conn->lc_crefs == 0); DEBUGASSERT(conn->lc_crefs == 0);
state = net_lock(); state = net_lock();
#ifdef CONFIG_NET_LOCAL_STREAM
/* We should not bet here with state LOCAL_STATE_ACCEPT. That is an /* We should not bet here with state LOCAL_STATE_ACCEPT. That is an
* internal state that should be atomic with respect to socket operations. * internal state that should be atomic with respect to socket operations.
*/ */
@ -116,6 +117,7 @@ int local_release(FAR struct local_conn_s *conn)
dq_rem(&conn->lc_node, &g_local_listeners); dq_rem(&conn->lc_node, &g_local_listeners);
} }
#endif /* CONFIG_NET_LOCAL_STREAM */
/* For the remaining states (LOCAL_STATE_UNBOUND and LOCAL_STATE_UNBOUND), /* For the remaining states (LOCAL_STATE_UNBOUND and LOCAL_STATE_UNBOUND),
* we simply free the connection structure. * we simply free the connection structure.

View File

@ -38,7 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_STREAM)
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
@ -101,4 +101,4 @@ ssize_t psock_local_send(FAR struct socket *psock, FAR const void *buf,
return ret < 0 ? ret : len; return ret < 0 ? ret : len;
} }
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */ #endif /* CONFIG_NET && CONFIG_NET_LOCAL_STREAM */

View File

@ -38,7 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET) && defined(CONFIG_NET_LOCAL_DGRAM)
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -174,4 +174,4 @@ errout_with_halfduplex:
return nsent; return nsent;
} }
#endif /* CONFIG_NET && CONFIG_NET_LOCAL */ #endif /* CONFIG_NET && CONFIG_NET_LOCAL_DGRAM */

View File

@ -47,7 +47,7 @@ else
# Local Unix domain support # Local Unix domain support
ifeq ($(CONFIG_NET_LOCAL),y) ifeq ($(CONFIG_NET_LOCAL_STREAM),y)
SOCK_CSRCS += send.c listen.c accept.c SOCK_CSRCS += send.c listen.c accept.c
endif endif
endif endif

View File

@ -39,7 +39,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 && \ #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 && \
(defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL)) (defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM))
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -217,7 +217,7 @@ int accept(int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
break; break;
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
case PF_LOCAL: case PF_LOCAL:
{ {
if (*addrlen < sizeof(sa_family_t)) if (*addrlen < sizeof(sa_family_t))
@ -261,7 +261,7 @@ int accept(int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
/* Perform the correct accept operation for this address domain */ /* Perform the correct accept operation for this address domain */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -275,10 +275,10 @@ int accept(int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
goto errout_with_socket; goto errout_with_socket;
} }
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
else else
#endif #endif
{ {
@ -318,4 +318,4 @@ errout:
return ERROR; return ERROR;
} }
#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS && (CONFIG_NET_TCP || CONFIG_NET_LOCAL) */ #endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS && (CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM) */

View File

@ -216,10 +216,10 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
* domain socket. * domain socket.
*/ */
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
/* Is this a Unix domain socket? */ /* Is this a Unix domain socket? */
@ -230,10 +230,10 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
ret = psock_local_bind(psock, addr, addrlen); ret = psock_local_bind(psock, addr, addrlen);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
else else
#endif #endif
{ {
@ -251,16 +251,16 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
} }
} }
break; break;
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */
/* Bind a datagram socket which may either be TCP/IP or a local, Unix /* Bind a datagram socket which may either be TCP/IP or a local, Unix
* domain socket. * domain socket.
*/ */
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_DGRAM: case SOCK_DGRAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
/* Is this a Unix domain socket? */ /* Is this a Unix domain socket? */
@ -271,10 +271,10 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
ret = psock_local_bind(psock, addr, addrlen); ret = psock_local_bind(psock, addr, addrlen);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
else else
#endif #endif
{ {
@ -292,7 +292,7 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
} }
} }
break; break;
#endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL_DGRAM */
default: default:
err = EBADF; err = EBADF;

View File

@ -525,7 +525,7 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
switch (psock->s_type) switch (psock->s_type)
{ {
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
{ {
/* Verify that the socket is not already connected */ /* Verify that the socket is not already connected */
@ -538,7 +538,7 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
/* It's not ... connect it */ /* It's not ... connect it */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -547,10 +547,10 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
ret = psock_local_connect(psock, addr); ret = psock_local_connect(psock, addr);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
else else
#endif #endif
{ {
@ -567,12 +567,12 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
} }
} }
break; break;
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_DGRAM: case SOCK_DGRAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -581,10 +581,10 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
ret = psock_local_connect(psock, addr); ret = psock_local_connect(psock, addr);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
else else
#endif #endif
{ {
@ -599,7 +599,7 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
} }
} }
break; break;
#endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL_DGRAM */
default: default:
err = EBADF; err = EBADF;

View File

@ -533,10 +533,10 @@ int psock_close(FAR struct socket *psock)
switch (psock->s_type) switch (psock->s_type)
{ {
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -545,10 +545,10 @@ int psock_close(FAR struct socket *psock)
local_close(psock); local_close(psock);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
else else
#endif #endif
{ {
@ -584,15 +584,15 @@ int psock_close(FAR struct socket *psock)
conn->crefs--; conn->crefs--;
} }
} }
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */
} }
break; break;
#endif #endif
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_DGRAM: case SOCK_DGRAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -601,10 +601,10 @@ int psock_close(FAR struct socket *psock)
local_close(psock); local_close(psock);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
else else
#endif #endif
{ {
@ -628,7 +628,7 @@ int psock_close(FAR struct socket *psock)
conn->crefs--; conn->crefs--;
} }
} }
#endif /* CONFIG_NET_UDP */ #endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL_DGRAM */
} }
break; break;
#endif #endif

View File

@ -155,7 +155,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
*/ */
if ((0 if ((0
#ifdef CONFIG_NET_TCP_LOCAL #ifdef CONFIG_NET_LOCAL
|| psock->s_domain == PF_LOCAL /* Unix domain stream or datagram */ || psock->s_domain == PF_LOCAL /* Unix domain stream or datagram */
#endif #endif
#ifdef CONFIG_NET_TCP_READAHEAD #ifdef CONFIG_NET_TCP_READAHEAD
@ -190,7 +190,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
*/ */
int mode = va_arg(ap, int); int mode = va_arg(ap, int);
#if defined(CONFIG_NET_LOCAL) || defined(CONFIG_NET_TCP_READAHEAD) #if defined(CONFIG_NET_LOCAL_STREAM) || defined(CONFIG_NET_TCP_READAHEAD)
if (psock->s_type == SOCK_STREAM) /* IP or Unix domain stream */ if (psock->s_type == SOCK_STREAM) /* IP or Unix domain stream */
{ {
if ((mode & O_NONBLOCK) != 0) if ((mode & O_NONBLOCK) != 0)
@ -204,7 +204,7 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
} }
else else
#endif #endif
#if defined(CONFIG_NET_LOCAL) || defined(CONFIG_NET_UDP_READAHEAD) #if defined(CONFIG_NET_LOCAL_DGRAM) || defined(CONFIG_NET_UDP_READAHEAD)
if (psock->s_type == SOCK_DGRAM) /* IP or Unix domain datagram */ if (psock->s_type == SOCK_DGRAM) /* IP or Unix domain datagram */
{ {
if ((mode & O_NONBLOCK) != 0) if ((mode & O_NONBLOCK) != 0)

View File

@ -1803,10 +1803,10 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
break; break;
#endif /* CONFIG_NET_PKT */ #endif /* CONFIG_NET_PKT */
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -1814,10 +1814,10 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
ret = psock_local_recvfrom(psock, buf, len, flags, ret = psock_local_recvfrom(psock, buf, len, flags,
from, fromlen); from, fromlen);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
else else
#endif #endif
{ {
@ -1826,12 +1826,12 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP */
} }
break; break;
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_DGRAM: case SOCK_DGRAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
@ -1839,10 +1839,10 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
ret = psock_local_recvfrom(psock, buf, len, flags, ret = psock_local_recvfrom(psock, buf, len, flags,
from, fromlen); from, fromlen);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
else else
#endif #endif
{ {
@ -1851,7 +1851,7 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
#endif /* CONFIG_NET_UDP */ #endif /* CONFIG_NET_UDP */
} }
break; break;
#endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL_DGRAM */
default: default:
{ {

View File

@ -38,7 +38,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -144,20 +144,20 @@ ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len,
break; break;
#endif #endif
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
{ {
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
{ {
ret = psock_local_send(psock, buf, len, flags); ret = psock_local_send(psock, buf, len, flags);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
else else
#endif #endif
{ {
@ -166,7 +166,7 @@ ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len,
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP */
} }
break; break;
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */
default: default:
{ {
@ -251,4 +251,4 @@ ssize_t send(int sockfd, FAR const void *buf, size_t len, int flags)
return psock_send(sockfd_socket(sockfd), buf, len, flags); return psock_send(sockfd_socket(sockfd), buf, len, flags);
} }
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */

View File

@ -126,7 +126,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
socklen_t tolen) socklen_t tolen)
{ {
socklen_t minlen; socklen_t minlen;
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
ssize_t nsent; ssize_t nsent;
#endif #endif
int err; int err;
@ -137,10 +137,10 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
if (!to || !tolen) if (!to || !tolen)
{ {
#ifdef CONFIG_NET_TCP #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
return psock_send(psock, buf, len, flags); return psock_send(psock, buf, len, flags);
#else #else
ndbg("ERROR: No to address\n"); ndbg("ERROR: No 'to' address\n");
err = EINVAL; err = EINVAL;
goto errout; goto errout;
#endif #endif
@ -162,7 +162,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
break; break;
#endif #endif
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
case AF_LOCAL: case AF_LOCAL:
minlen = sizeof(sa_family_t); minlen = sizeof(sa_family_t);
break; break;
@ -199,22 +199,22 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
goto errout; goto errout;
} }
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
/* Now handle the sendto() operation according to the socket domain, /* Now handle the sendto() operation according to the socket domain,
* currently either IP or Unix domains. * currently either IP or Unix domains.
*/ */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
if (psock->s_domain == PF_LOCAL) if (psock->s_domain == PF_LOCAL)
#endif #endif
{ {
nsent = psock_local_sendto(psock, buf, len, flags, to, tolen); nsent = psock_local_sendto(psock, buf, len, flags, to, tolen);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
else else
#endif #endif
{ {
@ -234,7 +234,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
return nsent; return nsent;
#else #else
err = ENOSYS; err = ENOSYS;
#endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL_DGRAM */
errout: errout:
set_errno(err); set_errno(err);

View File

@ -296,10 +296,10 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
switch (type) switch (type)
{ {
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
if (ipdomain) if (ipdomain)
#endif #endif
{ {
@ -311,7 +311,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
} }
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
else else
#endif #endif
@ -322,15 +322,15 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
goto errout; goto errout;
} }
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
break; break;
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL_STREAM */
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_DGRAM: case SOCK_DGRAM:
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
if (ipdomain) if (ipdomain)
#endif #endif
{ {
@ -342,7 +342,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
} }
#endif /* CONFIG_NET_UDP */ #endif /* CONFIG_NET_UDP */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
else else
#endif #endif
@ -353,10 +353,10 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
goto errout; goto errout;
} }
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
break; break;
#endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL_DGRAM */
#ifdef CONFIG_NET_PKT #ifdef CONFIG_NET_PKT
case SOCK_RAW: case SOCK_RAW:
@ -392,11 +392,11 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
err = ENOMEM; /* Assume failure to allocate connection instance */ err = ENOMEM; /* Assume failure to allocate connection instance */
switch (type) switch (type)
{ {
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM)
case SOCK_STREAM: case SOCK_STREAM:
{ {
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
if (ipdomain) if (ipdomain)
#endif #endif
{ {
@ -406,7 +406,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
} }
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_STREAM
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
else else
#endif #endif
@ -415,7 +415,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
ret = psock_local_alloc(psock); ret = psock_local_alloc(psock);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_STREAM */
/* Check for failures to allocate the connection structure. */ /* Check for failures to allocate the connection structure. */
@ -430,11 +430,11 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
break; break;
#endif #endif
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL) #if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL_DGRAM)
case SOCK_DGRAM: case SOCK_DGRAM:
{ {
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
if (ipdomain) if (ipdomain)
#endif #endif
{ {
@ -444,7 +444,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
} }
#endif /* CONFIG_NET_UDP */ #endif /* CONFIG_NET_UDP */
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL_DGRAM
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
else else
#endif #endif
@ -453,7 +453,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
ret = psock_local_alloc(psock); ret = psock_local_alloc(psock);
} }
#endif /* CONFIG_NET_LOCAL */ #endif /* CONFIG_NET_LOCAL_DGRAM */
/* Check for failures to allocate the connection structure. */ /* Check for failures to allocate the connection structure. */