Commit Graph

44 Commits

Author SHA1 Message Date
Peter Bee e223f60c09 net/socket: move si_send/recv into sendmsg/recvmsg
Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
the other way round.

Change-Id: I7b858556996e0862df22807a6edf6d7cfe6518fc
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-03-05 04:46:13 -08:00
Jiuzhu Dong 4d5a964f29 net: unify socket into file descriptor
Change-Id: I9bcd21564e6c97d3edbb38aed1748c114160ea36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-03 19:01:41 -08:00
Alin Jerpelea 37d5c1b0d9 net: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
YAMAMOTO Takashi 3297c09d58 net/socket/send.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
SPRESENSE 76c87d2f85 net/socket: Fix nxstyle issue 2020-07-22 11:41:53 +01:00
SPRESENSE 5ee0432d6f net/socket: Fix sanity checking of socket interface
No error occurs even if NULL is set in the input argument
of socket API. So added an argument check process.
2020-07-22 11:41:53 +01:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
liuhuahang ce634578dd This change implements the SO_ERROR socket option that is used to obtain the last error reported by the network.
Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>

    net/: Trivial changes to PR from review.  Biggest difference:  type of s_error changed to int16_t to save a byte or two.

Author: liuhuahang <liuhuahang@xiaomi.com>

    Implement SO_ERROR for getsockopt()
2019-12-24 08:09:55 -06:00
Gregory Nutt 88130a996a net/: Fixes for more coding standard issues detected by nxstyle. 2018-10-29 18:00:30 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Jussi Kivilinna 957831d2ba net/socket: psock_send/psock_sendto: remove assert check for null psock and buf input pointers. Removes check as 'psock == NULL' altogether because that checked for later in psock_send and psock_sendto. Change null check for 'buf' so that it is handled same as in recvfrom.c (return -EINVAL instead of
assert).
2017-10-11 11:04:05 -06:00
Gregory Nutt af072d52bc Adds OS internal functions nx_send(), ns_recv(), and nx_recvfrom() which are functionally equivalent to send(), recv(), and recvfrom() except that they do not set the errno variable and do not cause cancellation points. 2017-10-11 09:25:43 -06:00
Gregory Nutt 6c5f254a5b psock_send() no longer sets errno, so send() must now set it. 2017-09-30 06:27:37 -06:00
Gregory Nutt 44736b721c net/sockets: psock_send() is an internal OS interface an should not set the errno variable. 2017-09-29 17:48:15 -06:00
Jussi Kivilinna 7846381e09 net/socket: send: verify that sockfd is valid, fixes assert when using send on closed socket 2017-09-12 07:40:13 -06:00
Jussi Kivilinna 1fa854285d net/socket: Do not enter cancellation point in psock_send() as this is already done in send() 2017-09-12 07:39:05 -06:00
Gregory Nutt ef796b2d9e Socket I/F: Misc clean-up to get a clean USRSOCK build. 2017-07-14 14:41:46 -06:00
Gregory Nutt 85b1ae4cf0 Socket interface: Added bind() and connect() interfaces. 2017-07-13 09:28:18 -06:00
Gregory Nutt 1b9cb70828 Sockets: Initial steps to adde a socket interface to the networking. Each address family will have an interface that describes how to perform socket operations on that address family. Currently only a couple of methods are defined in the table as a proof of concept. More to come. Currently there are only tables for the INET/INET6 family, the Unix LOCAL family, and the raw PACKET family. Hopefully there will be AF_IEEE802154 and AF_BLUETOOTH comming down the pike. 2017-07-12 15:07:32 -06:00
Gregory Nutt 8d81b35c44 network: Correct some issues that prevent TCP from working correctly when both IPv4 and IPv6 are enabled. 2017-07-07 08:50:01 -06:00
Gregory Nutt cfea8adacb L should be capitalized in 6LoWPAN 2017-06-18 16:00:08 -06:00
Gregory Nutt d5207efb5a Be consistent... Use Name: consistent in function headers vs Function: 2017-04-21 16:33:14 -06:00
Jussi Kivilinna ae1265c01e net/socket/send: fix building without CONFIG_NET_6LOWPAN 2017-04-03 07:36:29 -06:00
Gregory Nutt 76406af71b 6loWPAN: Add support for sendto() 2017-04-02 11:15:46 -06:00
Jussi Kivilinna cd3c9634c8 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.
2017-03-31 08:58:14 -06:00
Gregory Nutt c3c8f8ed31 6loWPAN: Simplify some logic in send() if there is only an IEEE802.15.4 MAC 2017-03-28 16:14:58 -06:00
Gregory Nutt 64933246c3 6loWPAN: Tie 6loWPAN send into common socket send logic. 2017-03-28 14:08:54 -06:00
Gregory Nutt b52e4e5ecd Move cancellation point definitions to their own header file. 2016-12-10 09:08:26 -06:00
Gregory Nutt bc3ca25cc7 Cancellation points: Close up some logic to eliminte some race conditions. 2016-12-10 08:36:58 -06:00
Gregory Nutt 38b9ab09d9 Fix copy-and-paste gone wrong. 2016-12-09 17:28:03 -06:00
Gregory Nutt 16be9b332e More cancellation points 2016-12-09 15:17:58 -06:00
Gregory Nutt 2c95fef501 Remove some empty code section comments 2016-02-26 07:35:55 -06:00
Gregory Nutt 530d229361 net/udp: Add support for send() with connected UDP sockets 2015-08-11 19:17:55 -06:00
Gregory Nutt 0fc8d2fcc5 Unix domain: Add options to build in stream or datagram support separately 2015-01-31 07:58:51 -06:00
Gregory Nutt e4e863e752 Merge remote-tracking branch 'origin/master' into afunix 2015-01-28 12:14:00 -06:00
Gregory Nutt 5c2aad64cd Networking: Missed header file inclusion 2015-01-28 12:09:00 -06:00
Gregory Nutt 9c2af5317f Merge remote-tracking branch 'origin/master' into afunix 2015-01-28 12:03:43 -06:00
Gregory Nutt 371a9fd84c Networking: Fix another deadlock condition. tcp_write_buffer_alloc() calls sem_wait() with network locked. That worked if CONFIG_NET_NOINTS was not defined because interrupts are automatically restored when the wait happens. But with CONFIG_NET_NOINTS=y, the wait blocks with the network locked -- bad style and also can lead to a deadlock condition 2015-01-28 11:56:11 -06:00
Gregory Nutt 6a1bfc9594 Unix domain: Fix a typo and some missing conditional compilation 2015-01-28 11:48:23 -06:00
Gregory Nutt cba78c7349 Unix domain: More fixes. With these changes, apps/examples/ustream works 2015-01-28 08:39:48 -06:00
Gregory Nutt a88b824f96 Networking: Hook in send and revcfrom Unix domain socket logic; still needs hooks for sendto logic 2015-01-26 18:47:48 -06:00
Gregory Nutt aec4528882 Cosmetic standardization of some naming in comments 2015-01-19 16:02:56 -06:00
Gregory Nutt 2d52d70d4c NET: Move private definitions from include/nuttx/net/tcp to net/tcp/tcp.h 2014-07-06 12:34:27 -06:00
Gregory Nutt 76fa58ee00 Move all socket-related files from net/ to net/socket. Move net/net.h to net/socket/socket.h 2014-06-28 17:25:18 -06:00