Commit Graph

50 Commits

Author SHA1 Message Date
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
0fc7668d65 sendto should always call send if to == NULL || tolen <= 0
Since UDP socket may bind the target with connect call
2020-01-31 13:45:15 -06:00
Juha Niskanen
a762c06ed9 Fix typos and some incorrect comments
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle against .c and .h files and fix it

Author: Juha Niskanen <juha.niskanen@haltian.com>

    Fix typos and some incorrect comments
2020-01-20 09:32:36 -03: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
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
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
Gregory Nutt
9e8529b1d0 net/sockets: psock_sendto() is an internal OS interface an should not set the errno variable. 2017-09-29 17:35:38 -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
79a09bfd6e Socket I/F: Fix bad copy-past error. sendto() was called the address family's send() instead of sendto(). 2017-07-14 12:48:53 -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
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
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
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
64ffd89ee1 Another missing header file inclusion. 2016-12-09 17:25:00 -06:00
Gregory Nutt
16be9b332e More cancellation points 2016-12-09 15:17:58 -06:00
Gregory Nutt
a1469a3e95 Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err() 2016-06-11 15:50:49 -06:00
Gregory Nutt
86b79b33cf Reserver the name 'err' for other purposes 2016-06-11 14:40:07 -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
0bdf2d5360 UDP Networking: Misc fixes to get the last changes working + cleanup 2015-05-29 14:32:56 -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
8b9958b7ba Fix two compilation errors that occur when Unix domain occurs an IPv6 are enabled 2015-01-29 12:31:29 -06:00
Gregory Nutt
0deca5b039 Unix domain: Various fixes to get apps/examplex/udgram working 2015-01-29 11:05:04 -06:00
Gregory Nutt
9abd8e2e64 Fix typo in conditional compilation 2015-01-29 10:08:16 -06:00
Gregory Nutt
2c7123197c Networking: Move UDP-specifc parts of sendto() out of socket/sendto.c and into udp/udp_sendto.c. Hook in Unix domain sokcet sendto() logic (still just a stub for the moment) 2015-01-28 13:41:24 -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
59c0757183 Fix a few more dangling IPv6 issues found by code inspection 2015-01-18 10:33:27 -06:00
Gregory Nutt
cfbe12adb2 Networking: Fix some errors detected by Travis in configuration that have TCP on and UDP off and vice versa 2015-01-17 17:00:19 -06:00
Gregory Nutt
b80cdb3880 Fix a few warnings introduced with the last commit 2015-01-17 14:25:40 -06:00
Gregory Nutt
820509eadc Networking: Fix accept() so that it returns the correct IP address for the selected socket IP domain. 2015-01-17 09:27:05 -06:00
Gregory Nutt
4ad5998db3 net/socket and net/tcp: When we are ready to receive data or when we have outgoing data ready to be sent, we need to the notify the appropriate device driver of this condition. The notifying socket will be configured as either PF_INET or PF_INET6 and must look up the correct driver using the correct IP domain. 2015-01-17 08:33:14 -06:00
Gregory Nutt
2c251d845c include/net/if.h: Add a bit to the device flags to indicate if the device packet buffer holds an IPv4 or an IPv6 domain packet. Set/clear the flag along with the correct offset to the application payload data as each packet is received.
net/socket, net/tcp, net/udp:  Add logic to select the domain of the outputgoing packet before sending any UDP or TCP packet.  This sets the bit to indicate the IPv4 or IPv6 domain and the correct offset to the output going payload data.
2015-01-17 07:42:09 -06:00
Gregory Nutt
88a0e82934 Networking: Remove field d_sndata from the device structure. It is the same as d_appdata and unnecessary 2015-01-17 05:59:13 -06:00
Gregory Nutt
5e938941a6 Networking: Replace all references to net_ipaddr_t with either in_addr_t on net_ipv6addr_t. The goal is to support both IPv4 and IPv6 simultaneously. This requires that the two types be distinct and not conditionally typedef'ed to net_ipaddr_t. 2015-01-16 12:30:18 -06:00
Gregory Nutt
bee89be4f4 Networking: Drivers can have both IPv4 and IPv6 addesses, but a socket can only only one or the other; The socket connnection structures need to include a union of IPv4 and IPv6 addresses for the local address binding and for the remote address connections 2015-01-16 10:01:54 -06:00
Gregory Nutt
b36dbe1d89 Add logic to netdev_findbyaddr() to return the correct network device for the case where a broadcast address is used. This change caused trivial ripples through other files because additional parameters are required for netdev_findbyaddr() when CONFIG_NET_MULTINIC 2014-11-23 11:00:22 -06:00
Gregory Nutt
6e04518e4a If CONFIG_NET_ARP_SEND is enabled, then all ICMP, TCP, and UDP send operations will call arp_send() before attempting the real send operation. arp_send() will check if the the IP address mapping is in the ARP table and, if not send ARP requests periodically until it is. This eliminates losing the first outgoing message because there is not mapping in the ARP table. 2014-08-18 16:22:14 -06:00
Gregory Nutt
caba61999a Remove CONFIG_DISABLE_CLOCK 2014-08-07 12:35:24 -06:00
Gregory Nutt
73f3ecf7e2 NET: Rename network interrupt event flags more appropriately: TCP_, UDP_, ICMP_, or PKT_ vs UIP_ 2014-07-06 17:22:02 -06:00
Gregory Nutt
a6b39d1879 NET: in-progress change... don't use 2014-07-04 16:38:51 -06:00
Gregory Nutt
fa68fcc843 NET: Rename uip_callback_s to devif_callback_s 2014-06-29 12:59:34 -06:00
Gregory Nutt
8e706eb4ff Rename many functions in net/devif from uip_* to devif_* 2014-06-28 18:36:09 -06:00
Gregory Nutt
5790c94ba3 Rename net/uip to net/devif. Rename uip/uip.h to devif/devif.h 2014-06-28 18:07:02 -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