net: fix typos, incorrect comments, nxstyle

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
This commit is contained in:
Juha Niskanen
2020-12-13 15:58:02 +02:00
committed by Xiang Xiao
parent eaa75b11f8
commit de1ad1fdb3
32 changed files with 169 additions and 167 deletions
+10 -9
View File
@@ -61,6 +61,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* IP Version Mask (bits 0-3 of first byte) */ /* IP Version Mask (bits 0-3 of first byte) */
#define IP_VERSION_MASK 0x70 #define IP_VERSION_MASK 0x70
@@ -188,13 +189,13 @@ struct ipv4_stats_s
net_stats_t recv; /* Number of received packets at the IP layer */ net_stats_t recv; /* Number of received packets at the IP layer */
net_stats_t sent; /* Number of sent packets at the IP layer */ net_stats_t sent; /* Number of sent packets at the IP layer */
net_stats_t vhlerr; /* Number of packets dropped due to wrong net_stats_t vhlerr; /* Number of packets dropped due to wrong
IP version or header length */ * IP version or header length */
net_stats_t fragerr; /* Number of packets dropped since they net_stats_t fragerr; /* Number of packets dropped since they
were IP fragments */ * were IP fragments */
net_stats_t chkerr; /* Number of packets dropped due to IP net_stats_t chkerr; /* Number of packets dropped due to IP
checksum errors */ * checksum errors */
net_stats_t protoerr; /* Number of packets dropped since they net_stats_t protoerr; /* Number of packets dropped since they
were neither ICMP, UDP nor TCP */ * were neither ICMP, UDP nor TCP */
}; };
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
@@ -205,9 +206,9 @@ struct ipv6_stats_s
net_stats_t recv; /* Number of received packets at the IP layer */ net_stats_t recv; /* Number of received packets at the IP layer */
net_stats_t sent; /* Number of sent packets at the IP layer */ net_stats_t sent; /* Number of sent packets at the IP layer */
net_stats_t vhlerr; /* Number of packets dropped due to wrong net_stats_t vhlerr; /* Number of packets dropped due to wrong
IP version or header length */ * IP version or header length */
net_stats_t protoerr; /* Number of packets dropped since they net_stats_t protoerr; /* Number of packets dropped since they
were neither ICMP, UDP nor TCP */ * were neither ICMP, UDP nor TCP */
}; };
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
#endif /* CONFIG_NET_STATISTICS */ #endif /* CONFIG_NET_STATISTICS */
@@ -279,14 +280,14 @@ extern "C"
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ENDIAN_BIG #ifdef CONFIG_ENDIAN_BIG
/* Big-endian byte order: 11223344 */ /* Big-endian byte order: 11223344 */
# define ip4_addr1(ipaddr) (((ipaddr) >> 24) & 0xff) # define ip4_addr1(ipaddr) (((ipaddr) >> 24) & 0xff)
# define ip4_addr2(ipaddr) (((ipaddr) >> 16) & 0xff) # define ip4_addr2(ipaddr) (((ipaddr) >> 16) & 0xff)
# define ip4_addr3(ipaddr) (((ipaddr) >> 8) & 0xff) # define ip4_addr3(ipaddr) (((ipaddr) >> 8) & 0xff)
# define ip4_addr4(ipaddr) ((ipaddr) & 0xff) # define ip4_addr4(ipaddr) ((ipaddr) & 0xff)
#else #else
/* Little endian byte order: 44223311 */ /* Little endian byte order: 44223311 */
# define ip4_addr1(ipaddr) ((ipaddr) & 0xff) # define ip4_addr1(ipaddr) ((ipaddr) & 0xff)
# define ip4_addr2(ipaddr) (((ipaddr) >> 8) & 0xff) # define ip4_addr2(ipaddr) (((ipaddr) >> 8) & 0xff)
@@ -576,7 +577,7 @@ bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1,
* Name: net_is_addr_unspecified * Name: net_is_addr_unspecified
* *
* Description: * Description:
* Is Ithe IPv6 address the unspecified address? See RFC 4291 (replaces * Is the IPv6 address the unspecified address? See RFC 4291 (replaces
* 3513). * 3513).
* *
****************************************************************************/ ****************************************************************************/
+10 -20
View File
@@ -623,8 +623,6 @@ FAR struct socket *sockfd_socket(int sockfd);
* The protocol type or the specified protocol is not supported within * The protocol type or the specified protocol is not supported within
* this domain. * this domain.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int psock_socket(int domain, int type, int protocol, int psock_socket(int domain, int type, int protocol,
@@ -643,8 +641,6 @@ int psock_socket(int domain, int type, int protocol,
* Returns zero (OK) on success. On failure, it returns a negated errno * Returns zero (OK) on success. On failure, it returns a negated errno
* value to indicate the nature of the error. * value to indicate the nature of the error.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int net_close(int sockfd); int net_close(int sockfd);
@@ -693,8 +689,6 @@ int psock_close(FAR struct socket *psock);
* ENOTSOCK * ENOTSOCK
* psock is a descriptor for a file, not a socket. * psock is a descriptor for a file, not a socket.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
struct sockaddr; /* Forward reference. See nuttx/include/sys/socket.h */ struct sockaddr; /* Forward reference. See nuttx/include/sys/socket.h */
@@ -869,8 +863,6 @@ int psock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
* Timeout while attempting connection. The server may be too busy * Timeout while attempting connection. The server may be too busy
* to accept new connections. * to accept new connections.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
@@ -1029,11 +1021,11 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
* fromlen - The length of the address structure * fromlen - The length of the address structure
* *
* Returned Value: * Returned Value:
* On success, returns the number of characters sent. If no data is * On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown, * available to be received and the peer has performed an orderly shutdown,
* recv() will return 0. Otherwise, on any failure, a negated errno value * psock_recvfrom() will return 0. Otherwise, on any failure, a negated
* is returned (see comments with send() for a list of appropriate errno * errno value is returned (see comments with recvfrom() for a list of
* values). * appropriate errno values).
* *
****************************************************************************/ ****************************************************************************/
@@ -1067,11 +1059,11 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
* fromlen - The length of the address structure * fromlen - The length of the address structure
* *
* Returned Value: * Returned Value:
* On success, returns the number of characters sent. If no data is * On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown, * available to be received and the peer has performed an orderly shutdown,
* recv() will return 0. Otherwise, on any failure, a negated errno value * nx_recvfrom() will return 0. Otherwise, on any failure, a negated errno
* is returned (see comments with send() for a list of appropriate errno * value is returned (see comments with recvfrom() for a list of
* values). * appropriate errno values).
* *
****************************************************************************/ ****************************************************************************/
@@ -1086,12 +1078,12 @@ ssize_t nx_recvfrom(int sockfd, FAR void *buf, size_t len, int flags,
* Name: psock_getsockopt * Name: psock_getsockopt
* *
* Description: * Description:
* getsockopt() retrieve thse value for the option specified by the * getsockopt() retrieve the value for the option specified by the
* 'option' argument for the socket specified by the 'psock' argument. If * 'option' argument for the socket specified by the 'psock' argument. If
* the size of the option value is greater than 'value_len', the value * the size of the option value is greater than 'value_len', the value
* stored in the object pointed to by the 'value' argument will be silently * stored in the object pointed to by the 'value' argument will be silently
* truncated. Otherwise, the length pointed to by the 'value_len' argument * truncated. Otherwise, the length pointed to by the 'value_len' argument
* will be modified to indicate the actual length of the'value'. * will be modified to indicate the actual length of the 'value'.
* *
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
@@ -1170,8 +1162,6 @@ int psock_getsockopt(FAR struct socket *psock, int level, int option,
* Insufficient resources are available in the system to complete the * Insufficient resources are available in the system to complete the
* call. * call.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int psock_setsockopt(FAR struct socket *psock, int level, int option, int psock_setsockopt(FAR struct socket *psock, int level, int option,
+2 -2
View File
@@ -345,7 +345,7 @@ static int bluetooth_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
@@ -709,7 +709,7 @@ static int bluetooth_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -454,7 +454,7 @@ static int can_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+2 -2
View File
@@ -290,7 +290,7 @@ static int icmp_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
@@ -421,7 +421,7 @@ static int icmp_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+2 -2
View File
@@ -290,7 +290,7 @@ static int icmpv6_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
@@ -421,7 +421,7 @@ static int icmpv6_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+2 -2
View File
@@ -344,7 +344,7 @@ static int ieee802154_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
@@ -594,7 +594,7 @@ static int ieee802154_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+2 -2
View File
@@ -578,7 +578,7 @@ static int inet_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
@@ -808,7 +808,7 @@ static int inet_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
+5 -4
View File
@@ -339,7 +339,7 @@ int local_release(FAR struct local_conn_s *conn);
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
@@ -357,7 +357,8 @@ int local_listen(FAR struct socket *psock, int backlog);
* Input Parameters: * Input Parameters:
* psock The listening Unix domain socket structure * psock The listening Unix domain socket structure
* addr Receives the address of the connecting client * addr Receives the address of the connecting client
* addrlen Input: allocated size of 'addr', Return: returned size of 'addr' * addrlen Input: allocated size of 'addr'
* Return: returned size of 'addr'
* newconn The new, accepted Unix domain connection structure * newconn The new, accepted Unix domain connection structure
* *
* Returned Value: * Returned Value:
@@ -426,8 +427,8 @@ ssize_t psock_local_send(FAR struct socket *psock, FAR const void *buf,
#ifdef CONFIG_NET_LOCAL_DGRAM #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,
socklen_t tolen); FAR const struct sockaddr *to, socklen_t tolen);
#endif #endif
/**************************************************************************** /****************************************************************************
+1 -1
View File
@@ -84,7 +84,7 @@ dq_queue_t g_local_listeners;
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+2 -2
View File
@@ -473,7 +473,7 @@ static int local_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
@@ -601,7 +601,7 @@ static int local_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
+1 -1
View File
@@ -417,7 +417,7 @@ static int netlink_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+2 -2
View File
@@ -314,7 +314,7 @@ static int pkt_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
@@ -490,7 +490,7 @@ static int pkt_getpeername(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+4 -4
View File
@@ -67,12 +67,12 @@
* the size of the option value is greater than 'value_len', the value * the size of the option value is greater than 'value_len', the value
* stored in the object pointed to by the 'value' argument will be silently * stored in the object pointed to by the 'value' argument will be silently
* truncated. Otherwise, the length pointed to by the 'value_len' argument * truncated. Otherwise, the length pointed to by the 'value_len' argument
* will be modified to indicate the actual length of the'value'. * will be modified to indicate the actual length of the 'value'.
* *
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
* SOL_SOCKET; to retrieve options at the TCP-protocol level, the level * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level
* argument is SOL_CP. * argument is SOL_TCP.
* *
* See <sys/socket.h> a complete list of values for the socket-level * See <sys/socket.h> a complete list of values for the socket-level
* 'option' argument. Protocol-specific options are are protocol specific * 'option' argument. Protocol-specific options are are protocol specific
@@ -302,7 +302,7 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
* SOL_SOCKET; to retrieve options at the TCP-protocol level, the level * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level
* argument is SOL_CP. * argument is SOL_TCP.
* *
* See <sys/socket.h> a complete list of values for the socket-level * See <sys/socket.h> a complete list of values for the socket-level
* 'option' argument. Protocol-specific options are are protocol specific * 'option' argument. Protocol-specific options are are protocol specific
@@ -405,7 +405,7 @@ int psock_getsockopt(FAR struct socket *psock, int level, int option,
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
* SOL_SOCKET; to retrieve options at the TCP-protocol level, the level * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level
* argument is SOL_CP. * argument is SOL_TCP.
* *
* See <sys/socket.h> a complete list of values for the socket-level * See <sys/socket.h> a complete list of values for the socket-level
* 'option' argument. Protocol-specific options are are protocol specific * 'option' argument. Protocol-specific options are are protocol specific
+8 -8
View File
@@ -77,11 +77,11 @@
* fromlen - The length of the address structure * fromlen - The length of the address structure
* *
* Returned Value: * Returned Value:
* On success, returns the number of characters sent. If no data is * On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown, * available to be received and the peer has performed an orderly shutdown,
* recv() will return 0. Otherwise, on any failure, a negated errno value * psock_recvfrom() will return 0. Otherwise, on any failure, a negated
* is returned (see comments with send() for a list of appropriate errno * errno value is returned (see comments with recvfrom() for a list of
* values). * appropriate errno values).
* *
****************************************************************************/ ****************************************************************************/
@@ -139,11 +139,11 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
* fromlen - The length of the address structure * fromlen - The length of the address structure
* *
* Returned Value: * Returned Value:
* On success, returns the number of characters sent. If no data is * On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown, * available to be received and the peer has performed an orderly shutdown,
* recv() will return 0. Otherwise, on any failure, a negated errno value * nx_recvfrom() will return 0. Otherwise, on any failure, a negated errno
* is returned (see comments with send() for a list of appropriate errno * value is returned (see comments with recvfrom() for a list of
* values). * appropriate errno values).
* *
****************************************************************************/ ****************************************************************************/
+8 -8
View File
@@ -75,11 +75,11 @@
* flags - Receive flags * flags - Receive flags
* *
* Returned Value: * Returned Value:
* On success, returns the number of characters sent. If no data is * On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown, * available to be received and the peer has performed an orderly shutdown,
* recv() will return 0. Otherwise, on any failure, a negated errno value * psock_recvmsg() will return 0. Otherwise, on any failure, a negated
* is returned (see comments with send() for a list of appropriate errno * errno value is returned (see comments with recvmsg() for a list of
* values). * appropriate errno values).
* *
****************************************************************************/ ****************************************************************************/
@@ -150,11 +150,11 @@ ssize_t psock_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
* flags - Receive flags * flags - Receive flags
* *
* Returned Value: * Returned Value:
* On success, returns the number of characters sent. If no data is * On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown, * available to be received and the peer has performed an orderly shutdown,
* recv() will return 0. Otherwise, on any failure, a negated errno value * nx_recvmsg() will return 0. Otherwise, on any failure, a negated errno
* is returned (see comments with send() for a list of appropriate errno * value is returned (see comments with recvmsg() for a list of appropriate
* values). * errno values).
* *
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -1408,7 +1408,7 @@ int tcp_setsockopt(FAR struct socket *psock, int option,
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
* SOL_SOCKET; to retrieve options at the TCP-protocol level, the level * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level
* argument is SOL_CP. * argument is SOL_TCP.
* *
* See <sys/socket.h> a complete list of values for the socket-level * See <sys/socket.h> a complete list of values for the socket-level
* 'option' argument. Protocol-specific options are are protocol specific * 'option' argument. Protocol-specific options are are protocol specific
+1 -1
View File
@@ -74,7 +74,7 @@
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
* SOL_SOCKET; to retrieve options at the TCP-protocol level, the level * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level
* argument is SOL_CP. * argument is SOL_TCP.
* *
* See <sys/socket.h> a complete list of values for the socket-level * See <sys/socket.h> a complete list of values for the socket-level
* 'option' argument. Protocol-specific options are are protocol specific * 'option' argument. Protocol-specific options are are protocol specific
+65 -58
View File
@@ -119,12 +119,12 @@ struct usrsock_conn_s
struct struct
{ {
sem_t sem; /* Request semaphore (only one outstanding request) */ sem_t sem; /* Request semaphore (only one outstanding request) */
uint8_t xid; /* Expected message exchange id */ uint8_t xid; /* Expected message exchange id */
bool inprogress; /* Request was received but daemon is still processing */ bool inprogress; /* Request was received but daemon is still processing */
uint16_t valuelen; /* Length of value from daemon */ uint16_t valuelen; /* Length of value from daemon */
uint16_t valuelen_nontrunc; /* Actual length of value at daemon */ uint16_t valuelen_nontrunc; /* Actual length of value at daemon */
int result; /* Result for request */ int result; /* Result for request */
struct struct
{ {
@@ -203,8 +203,8 @@ FAR struct usrsock_conn_s *usrsock_alloc(void);
* Name: usrsock_free() * Name: usrsock_free()
* *
* Description: * Description:
* Free a usrsock connection structure that is no longer in use. This should * Free a usrsock connection structure that is no longer in use. This
* be done by the implementation of close(). * should be done by the implementation of close().
* *
****************************************************************************/ ****************************************************************************/
@@ -236,8 +236,6 @@ int usrsock_connidx(FAR struct usrsock_conn_s *conn);
* Find a connection structure that is the appropriate * Find a connection structure that is the appropriate
* connection for usrsock * connection for usrsock
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
FAR struct usrsock_conn_s *usrsock_active(int16_t usockid); FAR struct usrsock_conn_s *usrsock_active(int16_t usockid);
@@ -256,15 +254,16 @@ int usrsock_setup_request_callback(FAR struct usrsock_conn_s *conn,
****************************************************************************/ ****************************************************************************/
int usrsock_setup_data_request_callback(FAR struct usrsock_conn_s *conn, int usrsock_setup_data_request_callback(FAR struct usrsock_conn_s *conn,
FAR struct usrsock_data_reqstate_s *pstate, FAR struct usrsock_data_reqstate_s *pstate,
FAR devif_callback_event_t event, FAR devif_callback_event_t event,
uint16_t flags); uint16_t flags);
/**************************************************************************** /****************************************************************************
* Name: usrsock_teardown_request_callback() * Name: usrsock_teardown_request_callback()
****************************************************************************/ ****************************************************************************/
void usrsock_teardown_request_callback(FAR struct usrsock_reqstate_s *pstate); void usrsock_teardown_request_callback(
FAR struct usrsock_reqstate_s *pstate);
/**************************************************************************** /****************************************************************************
* Name: usrsock_teardown_data_request_callback() * Name: usrsock_teardown_data_request_callback()
@@ -324,7 +323,8 @@ void usrsockdev_register(void);
* domain (see sys/socket.h) * domain (see sys/socket.h)
* type (see sys/socket.h) * type (see sys/socket.h)
* protocol (see sys/socket.h) * protocol (see sys/socket.h)
* psock A pointer to a user allocated socket structure to be initialized. * psock A pointer to a user allocated socket structure to be
* initialized.
* *
* Returned Value: * Returned Value:
* 0 on success; negative error-code on error * 0 on success; negative error-code on error
@@ -347,11 +347,10 @@ void usrsockdev_register(void);
* The protocol type or the specified protocol is not supported within * The protocol type or the specified protocol is not supported within
* this domain. * this domain.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int usrsock_socket(int domain, int type, int protocol, FAR struct socket *psock); int usrsock_socket(int domain, int type, int protocol,
FAR struct socket *psock);
/**************************************************************************** /****************************************************************************
* Name: usrsock_close * Name: usrsock_close
@@ -365,8 +364,6 @@ int usrsock_socket(int domain, int type, int protocol, FAR struct socket *psock)
* Returned Value: * Returned Value:
* 0 on success; -1 on error with errno set appropriately. * 0 on success; -1 on error with errno set appropriately.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int usrsock_close(FAR struct usrsock_conn_s *conn); int usrsock_close(FAR struct usrsock_conn_s *conn);
@@ -375,13 +372,13 @@ int usrsock_close(FAR struct usrsock_conn_s *conn);
* Name: usrsock_bind * Name: usrsock_bind
* *
* Description: * Description:
* usrsock_bind() gives the socket 'conn' the local address 'addr'. 'addr' * usrsock_bind() gives the socket 'psock' the local address 'addr'. 'addr'
* is 'addrlen' bytes long. Traditionally, this is called "assigning a name * is 'addrlen' bytes long. Traditionally, this is called "assigning a name
* to a socket." When a socket is created with socket, it exists in a name * to a socket." When a socket is created with socket, it exists in a name
* space (address family) but has no name assigned. * space (address family) but has no name assigned.
* *
* Input Parameters: * Input Parameters:
* conn usrsock socket connection structure * psock A reference to the socket structure of the socket to be bound
* addr Socket local address * addr Socket local address
* addrlen Length of 'addr' * addrlen Length of 'addr'
* *
@@ -397,8 +394,6 @@ int usrsock_close(FAR struct usrsock_conn_s *conn);
* ENOTSOCK * ENOTSOCK
* psock is a descriptor for a file, not a socket. * psock is a descriptor for a file, not a socket.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int usrsock_bind(FAR struct socket *psock, int usrsock_bind(FAR struct socket *psock,
@@ -412,15 +407,13 @@ int usrsock_bind(FAR struct socket *psock,
* Perform a usrsock connection * Perform a usrsock connection
* *
* Input Parameters: * Input Parameters:
* psock A reference to the socket structure of the socket to be connected * psock A reference to the socket structure of the socket
* addr The address of the remote server to connect to * addr The address of the remote server to connect to
* addrlen Length of address buffer * addrlen Length of address buffer
* *
* Returned Value: * Returned Value:
* None * None
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int usrsock_connect(FAR struct socket *psock, int usrsock_connect(FAR struct socket *psock,
@@ -448,7 +441,8 @@ int usrsock_connect(FAR struct socket *psock,
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for a description of the appropriate error
* value.
* *
****************************************************************************/ ****************************************************************************/
@@ -458,16 +452,16 @@ int usrsock_listen(FAR struct socket *psock, int backlog);
* Name: usrsock_accept * Name: usrsock_accept
* *
* Description: * Description:
* The usrsock_sockif_accept function is used with connection-based socket * The usrsock_accept function is used with connection-based socket
* types (SOCK_STREAM, SOCK_SEQPACKET and SOCK_RDM). It extracts the first * types (SOCK_STREAM, SOCK_SEQPACKET and SOCK_RDM). It extracts the first
* connection request on the queue of pending connections, creates a new * connection request on the queue of pending connections, creates a new
* connected socket with mostly the same properties as 'sockfd', and * connected socket with mostly the same properties as 'psock', and
* allocates a new socket descriptor for the socket, which is returned. The * allocates a new socket descriptor for the socket, which is returned. The
* newly created socket is no longer in the listening state. The original * newly created socket is no longer in the listening state. The original
* socket 'sockfd' is unaffected by this call. Per file descriptor flags * socket 'psock' is unaffected by this call. Per file descriptor flags
* are not inherited across an inet_accept. * are not inherited across an usrsock_accept.
* *
* The 'sockfd' argument is a socket descriptor that has been created with * The 'psock' argument is a socket descriptor that has been created with
* socket(), bound to a local address with bind(), and is listening for * socket(), bound to a local address with bind(), and is listening for
* connections after a call to listen(). * connections after a call to listen().
* *
@@ -477,20 +471,21 @@ int usrsock_listen(FAR struct socket *psock, int backlog);
* actual length of the address returned. * actual length of the address returned.
* *
* If no pending connections are present on the queue, and the socket is * If no pending connections are present on the queue, and the socket is
* not marked as non-blocking, inet_accept blocks the caller until a * not marked as non-blocking, usrsock_accept blocks the caller until a
* connection is present. If the socket is marked non-blocking and no * connection is present. If the socket is marked non-blocking and no
* pending connections are present on the queue, inet_accept returns * pending connections are present on the queue, usrsock_accept returns
* EAGAIN. * EAGAIN.
* *
* Parameters: * Parameters:
* psock Reference to the listening socket structure * psock Reference to the listening socket structure
* addr Receives the address of the connecting client * addr Receives the address of the connecting client
* addrlen Input: allocated size of 'addr', Return: returned size of 'addr' * addrlen Input: allocated size of 'addr'
* Return: returned size of 'addr'
* newsock Location to return the accepted socket information. * newsock Location to return the accepted socket information.
* *
* Returned Value: * Returned Value:
* Returns 0 (OK) on success. On failure, it returns a negated errno * Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the appropriate error value. * value. See accept() for a description of the appropriate error value.
* *
* Assumptions: * Assumptions:
* The network is locked. * The network is locked.
@@ -517,7 +512,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
* *
****************************************************************************/ ****************************************************************************/
int usrsock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup); int usrsock_poll(FAR struct socket *psock, FAR struct pollfd *fds,
bool setup);
/**************************************************************************** /****************************************************************************
* Name: usrsock_sendto * Name: usrsock_sendto
@@ -529,7 +525,7 @@ int usrsock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup);
* returned when the socket was not actually connected. * returned when the socket was not actually connected.
* *
* Input Parameters: * Input Parameters:
* psock A reference to the socket structure of the socket to be connected * psock A reference to the socket structure of the socket
* buf Data to send * buf Data to send
* len Length of data to send * len Length of data to send
* flags Send flags (ignored) * flags Send flags (ignored)
@@ -537,9 +533,8 @@ int usrsock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup);
* tolen The length of the address structure * tolen The length of the address structure
* *
* Returned Value: * Returned Value:
* None * On success, returns the number of characters sent. On any failure, a
* * negated errno value is returned.
* Assumptions:
* *
****************************************************************************/ ****************************************************************************/
@@ -560,13 +555,19 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
* on return to indicate the actual size of the address stored there. * on return to indicate the actual size of the address stored there.
* *
* Input Parameters: * Input Parameters:
* psock A pointer to a NuttX-specific, internal socket structure * psock A reference to the socket structure of the socket
* buf Buffer to receive data * buf Buffer to receive data
* len Length of buffer * len Length of buffer
* flags Receive flags (ignored) * flags Receive flags (ignored)
* from Address of source (may be NULL) * from Address of source (may be NULL)
* fromlen The length of the address structure * fromlen The length of the address structure
* *
* Returned Value:
* On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown,
* recvfrom() will return 0. Otherwise, on any failure, a negated errno
* value is returned.
*
****************************************************************************/ ****************************************************************************/
ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
@@ -577,12 +578,13 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
* Name: usrsock_getsockopt * Name: usrsock_getsockopt
* *
* Description: * Description:
* getsockopt() retrieve thse value for the option specified by the * getsockopt() retrieve the value for the option specified by the
* 'option' argument for the socket specified by the 'psock' argument. If * 'option' argument at the protocol level specified by the 'level'
* the size of the option value is greater than 'value_len', the value * argument. If the size of the option value is greater than 'value_len',
* stored in the object pointed to by the 'value' argument will be silently * the value stored in the object pointed to by the 'value' argument will
* truncated. Otherwise, the length pointed to by the 'value_len' argument * be silently truncated. Otherwise, the length pointed to by the
* will be modified to indicate the actual length of the'value'. * 'value_len' argument will be modified to indicate the actual length
* of the 'value'.
* *
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
@@ -599,8 +601,9 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
* *
****************************************************************************/ ****************************************************************************/
int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option, int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level,
FAR void *value, FAR socklen_t *value_len); int option, FAR void *value,
FAR socklen_t *value_len);
/**************************************************************************** /****************************************************************************
* Name: usrsock_setsockopt * Name: usrsock_setsockopt
@@ -608,7 +611,7 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
* Description: * Description:
* psock_setsockopt() sets the option specified by the 'option' argument, * psock_setsockopt() sets the option specified by the 'option' argument,
* at the protocol level specified by the 'level' argument, to the value * at the protocol level specified by the 'level' argument, to the value
* pointed to by the 'value' argument for the socket on the 'psock' argument. * pointed to by the 'value' argument for the usrsock connection.
* *
* The 'level' argument specifies the protocol level of the option. To set * The 'level' argument specifies the protocol level of the option. To set
* options at the socket level, specify the level argument as SOL_SOCKET. * options at the socket level, specify the level argument as SOL_SOCKET.
@@ -624,8 +627,9 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
* *
****************************************************************************/ ****************************************************************************/
int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option, int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level,
FAR const void *value, FAR socklen_t value_len); int option, FAR const void *value,
FAR socklen_t value_len);
/**************************************************************************** /****************************************************************************
* Name: usrsock_getsockname * Name: usrsock_getsockname
@@ -643,7 +647,7 @@ int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
* the object pointed to by address is unspecified. * the object pointed to by address is unspecified.
* *
* Input Parameters: * Input Parameters:
* conn usrsock socket connection structure * psock A reference to the socket structure of the socket
* addr sockaddr structure to receive data [out] * addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out] * addrlen Length of sockaddr structure [in/out]
* *
@@ -668,7 +672,7 @@ int usrsock_getsockname(FAR struct socket *psock,
* the object pointed to by address is unspecified. * the object pointed to by address is unspecified.
* *
* Input Parameters: * Input Parameters:
* conn usrsock socket connection structure * psock A reference to the socket structure of the socket
* addr sockaddr structure to receive data [out] * addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out] * addrlen Length of sockaddr structure [in/out]
* *
@@ -681,16 +685,19 @@ int usrsock_getpeername(FAR struct socket *psock,
* Name: usrsock_ioctl * Name: usrsock_ioctl
* *
* Description: * Description:
* The usrsock_ioctl() function performs network device specific operations. * The usrsock_ioctl() function performs network device specific
* operations.
* *
* Parameters: * Parameters:
* psock A pointer to a NuttX-specific, internal socket structure * psock A reference to the socket structure of the socket
* cmd The ioctl command * cmd The ioctl command
* arg The argument of the ioctl cmd * arg The argument of the ioctl cmd
* arglen The length of 'arg'
* *
****************************************************************************/ ****************************************************************************/
int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg, size_t arglen); int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg,
size_t arglen);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
+7 -7
View File
@@ -172,16 +172,16 @@ static int do_accept_request(FAR struct usrsock_conn_s *conn,
* Name: usrsock_accept * Name: usrsock_accept
* *
* Description: * Description:
* The usrsock_sockif_accept function is used with connection-based socket * The usrsock_accept function is used with connection-based socket
* types (SOCK_STREAM, SOCK_SEQPACKET and SOCK_RDM). It extracts the first * types (SOCK_STREAM, SOCK_SEQPACKET and SOCK_RDM). It extracts the first
* connection request on the queue of pending connections, creates a new * connection request on the queue of pending connections, creates a new
* connected socket with mostly the same properties as 'sockfd', and * connected socket with mostly the same properties as 'psock', and
* allocates a new socket descriptor for the socket, which is returned. The * allocates a new socket descriptor for the socket, which is returned. The
* newly created socket is no longer in the listening state. The original * newly created socket is no longer in the listening state. The original
* socket 'sockfd' is unaffected by this call. Per file descriptor flags * socket 'psock' is unaffected by this call. Per file descriptor flags
* are not inherited across an inet_accept. * are not inherited across an usrsock_accept.
* *
* The 'sockfd' argument is a socket descriptor that has been created with * The 'psock' argument is a socket descriptor that has been created with
* socket(), bound to a local address with bind(), and is listening for * socket(), bound to a local address with bind(), and is listening for
* connections after a call to listen(). * connections after a call to listen().
* *
@@ -191,9 +191,9 @@ static int do_accept_request(FAR struct usrsock_conn_s *conn,
* actual length of the address returned. * actual length of the address returned.
* *
* If no pending connections are present on the queue, and the socket is * If no pending connections are present on the queue, and the socket is
* not marked as non-blocking, inet_accept blocks the caller until a * not marked as non-blocking, usrsock_accept blocks the caller until a
* connection is present. If the socket is marked non-blocking and no * connection is present. If the socket is marked non-blocking and no
* pending connections are present on the queue, inet_accept returns * pending connections are present on the queue, usrsock_accept returns
* EAGAIN. * EAGAIN.
* *
* Parameters: * Parameters:
+3 -5
View File
@@ -136,13 +136,13 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn,
* Name: usrsock_bind * Name: usrsock_bind
* *
* Description: * Description:
* usrsock_bind() gives the socket 'conn' the local address 'addr'. 'addr' * usrsock_bind() gives the socket 'psock' the local address 'addr'. 'addr'
* is 'addrlen' bytes long. Traditionally, this is called "assigning a name * is 'addrlen' bytes long. Traditionally, this is called "assigning a name
* to a socket." When a socket is created with socket, it exists in a name * to a socket." When a socket is created with socket, it exists in a name
* space (address family) but has no name assigned. * space (address family) but has no name assigned.
* *
* Input Parameters: * Input Parameters:
* conn usrsock socket connection structure * psock A reference to the socket structure of the socket to be bound
* addr Socket local address * addr Socket local address
* addrlen Length of 'addr' * addrlen Length of 'addr'
* *
@@ -158,8 +158,6 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn,
* ENOTSOCK * ENOTSOCK
* psock is a descriptor for a file, not a socket. * psock is a descriptor for a file, not a socket.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int usrsock_bind(FAR struct socket *psock, int usrsock_bind(FAR struct socket *psock,
@@ -201,7 +199,7 @@ int usrsock_bind(FAR struct socket *psock,
goto errout_unlock; goto errout_unlock;
} }
/* Request user-space daemon to close socket. */ /* Request user-space daemon to bind address. */
ret = do_bind_request(conn, addr, addrlen); ret = do_bind_request(conn, addr, addrlen);
if (ret >= 0) if (ret >= 0)
-2
View File
@@ -216,8 +216,6 @@ int usrsock_connidx(FAR struct usrsock_conn_s *conn)
* Find a connection structure that is the appropriate * Find a connection structure that is the appropriate
* connection for usrsock * connection for usrsock
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
FAR struct usrsock_conn_s *usrsock_active(int16_t usockid) FAR struct usrsock_conn_s *usrsock_active(int16_t usockid)
+1 -1
View File
@@ -147,7 +147,7 @@ static int do_getpeername_request(FAR struct usrsock_conn_s *conn,
* the object pointed to by address is unspecified. * the object pointed to by address is unspecified.
* *
* Parameters: * Parameters:
* conn usrsock socket connection structure * psock A reference to the socket structure of the socket
* addr sockaddr structure to receive data [out] * addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out] * addrlen Length of sockaddr structure [in/out]
* *
+2 -2
View File
@@ -162,7 +162,7 @@ static int do_getsockname_request(FAR struct usrsock_conn_s *conn,
* the object pointed to by address is unspecified. * the object pointed to by address is unspecified.
* *
* Input Parameters: * Input Parameters:
* conn usrsock socket connection structure * psock A reference to the socket structure of the socket
* addr sockaddr structure to receive data [out] * addr sockaddr structure to receive data [out]
* addrlen Length of sockaddr structure [in/out] * addrlen Length of sockaddr structure [in/out]
* *
@@ -211,7 +211,7 @@ int usrsock_getsockname(FAR struct socket *psock,
usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs)); usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs));
/* Request user-space daemon to close socket. */ /* Request user-space daemon to handle request. */
ret = do_getsockname_request(conn, *addrlen); ret = do_getsockname_request(conn, *addrlen);
if (ret >= 0) if (ret >= 0)
+8 -7
View File
@@ -161,12 +161,13 @@ static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level,
* Name: usrsock_getsockopt * Name: usrsock_getsockopt
* *
* Description: * Description:
* getsockopt() retrieve thse value for the option specified by the * getsockopt() retrieve the value for the option specified by the
* 'option' argument for the socket specified by the 'psock' argument. If * 'option' argument at the protocol level specified by the 'level'
* the size of the option value is greater than 'value_len', the value * argument. If the size of the option value is greater than 'value_len',
* stored in the object pointed to by the 'value' argument will be silently * the value stored in the object pointed to by the 'value' argument will
* truncated. Otherwise, the length pointed to by the 'value_len' argument * be silently truncated. Otherwise, the length pointed to by the
* will be modified to indicate the actual length of the'value'. * 'value_len' argument will be modified to indicate the actual length
* of the 'value'.
* *
* The 'level' argument specifies the protocol level of the option. To * The 'level' argument specifies the protocol level of the option. To
* retrieve options at the socket level, specify the level argument as * retrieve options at the socket level, specify the level argument as
@@ -225,7 +226,7 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn,
usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs)); usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs));
/* Request user-space daemon to close socket. */ /* Request user-space daemon to handle request. */
ret = do_getsockopt_request(conn, level, option, *value_len); ret = do_getsockopt_request(conn, level, option, *value_len);
if (ret >= 0) if (ret >= 0)
+3 -2
View File
@@ -140,9 +140,10 @@ static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd,
* This function performs network device specific operations. * This function performs network device specific operations.
* *
* Parameters: * Parameters:
* psock A pointer to a NuttX-specific, internal socket structure * psock A reference to the socket structure of the socket
* cmd The ioctl command * cmd The ioctl command
* arg The argument of the ioctl cmd * arg The argument of the ioctl cmd
* arglen The length of 'arg'
* *
****************************************************************************/ ****************************************************************************/
@@ -187,7 +188,7 @@ int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg,
inbufs[0].iov_len = arglen; inbufs[0].iov_len = arglen;
usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs)); usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs));
/* Request user-space daemon to close socket. */ /* Request user-space daemon to handle ioctl. */
ret = do_ioctl_request(conn, cmd, arg, arglen); ret = do_ioctl_request(conn, cmd, arg, arglen);
if (ret >= 0) if (ret >= 0)
+1 -1
View File
@@ -135,7 +135,7 @@ static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog)
* *
* Returned Value: * Returned Value:
* On success, zero is returned. On error, a negated errno value is * On success, zero is returned. On error, a negated errno value is
* returned. See list() for the set of appropriate error values. * returned. See listen() for the set of appropriate error values.
* *
****************************************************************************/ ****************************************************************************/
+7 -1
View File
@@ -206,13 +206,19 @@ static int do_recvfrom_request(FAR struct usrsock_conn_s *conn,
* on return to indicate the actual size of the address stored there. * on return to indicate the actual size of the address stored there.
* *
* Input Parameters: * Input Parameters:
* psock A pointer to a NuttX-specific, internal socket structure * psock A reference to the socket structure of the socket
* buf Buffer to receive data * buf Buffer to receive data
* len Length of buffer * len Length of buffer
* flags Receive flags (ignored) * flags Receive flags (ignored)
* from Address of source (may be NULL) * from Address of source (may be NULL)
* fromlen The length of the address structure * fromlen The length of the address structure
* *
* Returned Value:
* On success, returns the number of characters received. If no data is
* available to be received and the peer has performed an orderly shutdown,
* recvfrom() will return 0. Otherwise, on any failure, a negated errno
* value is returned.
*
****************************************************************************/ ****************************************************************************/
ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
+5 -1
View File
@@ -200,13 +200,17 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn,
* returned when the socket was not actually connected. * returned when the socket was not actually connected.
* *
* Input Parameters: * Input Parameters:
* psock A pointer to a NuttX-specific, internal socket structure * psock A reference to the socket structure of the socket
* buf Data to send * buf Data to send
* len Length of data to send * len Length of data to send
* flags Send flags (ignored) * flags Send flags (ignored)
* to Address of recipient * to Address of recipient
* tolen The length of the address structure * tolen The length of the address structure
* *
* Returned Value:
* On success, returns the number of characters sent. On any failure, a
* negated errno value is returned.
*
****************************************************************************/ ****************************************************************************/
ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf, ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
+2 -3
View File
@@ -157,8 +157,7 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn,
* Description: * Description:
* psock_setsockopt() sets the option specified by the 'option' argument, * psock_setsockopt() sets the option specified by the 'option' argument,
* at the protocol level specified by the 'level' argument, to the value * at the protocol level specified by the 'level' argument, to the value
* pointed to by the 'value' argument for the socket on the 'psock' * pointed to by the 'value' argument for the usrsock connection.
* argument.
* *
* The 'level' argument specifies the protocol level of the option. To set * The 'level' argument specifies the protocol level of the option. To set
* options at the socket level, specify the level argument as SOL_SOCKET. * options at the socket level, specify the level argument as SOL_SOCKET.
@@ -212,7 +211,7 @@ int usrsock_setsockopt(FAR struct usrsock_conn_s *conn,
goto errout_unlock; goto errout_unlock;
} }
/* Request user-space daemon to close socket. */ /* Request user-space daemon to handle request. */
ret = do_setsockopt_request(conn, level, option, value, value_len); ret = do_setsockopt_request(conn, level, option, value, value_len);
if (ret >= 0) if (ret >= 0)
-2
View File
@@ -190,8 +190,6 @@ static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain,
* The protocol type or the specified protocol is not supported within * The protocol type or the specified protocol is not supported within
* this domain. * this domain.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
int usrsock_socket(int domain, int type, int protocol, int usrsock_socket(int domain, int type, int protocol,
+1 -3
View File
@@ -96,7 +96,7 @@ const struct sock_intf_s g_usrsock_sockif =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: inet_setup * Name: usrsock_sockif_setup
* *
* Description: * Description:
* Called for socket() to verify that the provided socket type and * Called for socket() to verify that the provided socket type and
@@ -263,8 +263,6 @@ static ssize_t usrsock_sockif_send(FAR struct socket *psock,
* Returned Value: * Returned Value:
* 0 on success; -1 on error with errno set appropriately. * 0 on success; -1 on error with errno set appropriately.
* *
* Assumptions:
*
****************************************************************************/ ****************************************************************************/
static int usrsock_sockif_close(FAR struct socket *psock) static int usrsock_sockif_close(FAR struct socket *psock)