diff --git a/include/nuttx/net/ip.h b/include/nuttx/net/ip.h index 3ec30d222bb..4e6b940c5cb 100644 --- a/include/nuttx/net/ip.h +++ b/include/nuttx/net/ip.h @@ -61,6 +61,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* IP Version Mask (bits 0-3 of first byte) */ #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 sent; /* Number of sent packets at the IP layer */ 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 - were IP fragments */ + * were IP fragments */ 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 - were neither ICMP, UDP nor TCP */ + * were neither ICMP, UDP nor TCP */ }; #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 sent; /* Number of sent packets at the IP layer */ 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 - were neither ICMP, UDP nor TCP */ + * were neither ICMP, UDP nor TCP */ }; #endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_STATISTICS */ @@ -279,14 +280,14 @@ extern "C" ****************************************************************************/ #ifdef CONFIG_ENDIAN_BIG - /* Big-endian byte order: 11223344 */ + /* Big-endian byte order: 11223344 */ # define ip4_addr1(ipaddr) (((ipaddr) >> 24) & 0xff) # define ip4_addr2(ipaddr) (((ipaddr) >> 16) & 0xff) # define ip4_addr3(ipaddr) (((ipaddr) >> 8) & 0xff) # define ip4_addr4(ipaddr) ((ipaddr) & 0xff) #else - /* Little endian byte order: 44223311 */ + /* Little endian byte order: 44223311 */ # define ip4_addr1(ipaddr) ((ipaddr) & 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 * * Description: - * Is Ithe IPv6 address the unspecified address? See RFC 4291 (replaces + * Is the IPv6 address the unspecified address? See RFC 4291 (replaces * 3513). * ****************************************************************************/ diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index 33fe2edea15..fca8a07f027 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -623,8 +623,6 @@ FAR struct socket *sockfd_socket(int sockfd); * The protocol type or the specified protocol is not supported within * this domain. * - * Assumptions: - * ****************************************************************************/ 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 * value to indicate the nature of the error. * - * Assumptions: - * ****************************************************************************/ int net_close(int sockfd); @@ -693,8 +689,6 @@ int psock_close(FAR struct socket *psock); * ENOTSOCK * psock is a descriptor for a file, not a socket. * - * Assumptions: - * ****************************************************************************/ 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 * to accept new connections. * - * Assumptions: - * ****************************************************************************/ 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 * * 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, - * recv() will return 0. Otherwise, on any failure, a negated errno value - * is returned (see comments with send() for a list of appropriate errno - * values). + * psock_recvfrom() will return 0. Otherwise, on any failure, a negated + * errno value is returned (see comments with recvfrom() for a list of + * 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 * * 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, - * recv() will return 0. Otherwise, on any failure, a negated errno value - * is returned (see comments with send() for a list of appropriate errno - * values). + * nx_recvfrom() will return 0. Otherwise, on any failure, a negated errno + * value is returned (see comments with recvfrom() for a list of + * appropriate errno values). * ****************************************************************************/ @@ -1086,12 +1078,12 @@ ssize_t nx_recvfrom(int sockfd, FAR void *buf, size_t len, int flags, * Name: psock_getsockopt * * 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 * 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 * 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 * 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 * call. * - * Assumptions: - * ****************************************************************************/ int psock_setsockopt(FAR struct socket *psock, int level, int option, diff --git a/net/bluetooth/bluetooth_sockif.c b/net/bluetooth/bluetooth_sockif.c index 434cbf4295a..9eeb5337b6b 100644 --- a/net/bluetooth/bluetooth_sockif.c +++ b/net/bluetooth/bluetooth_sockif.c @@ -345,7 +345,7 @@ static int bluetooth_connect(FAR struct socket *psock, * * Returned Value: * 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: * The network is locked. @@ -709,7 +709,7 @@ static int bluetooth_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c index d39934fd4bc..5571edf756b 100644 --- a/net/can/can_sockif.c +++ b/net/can/can_sockif.c @@ -454,7 +454,7 @@ static int can_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/icmp/icmp_sockif.c b/net/icmp/icmp_sockif.c index 2b1e17946f8..152ff581d83 100644 --- a/net/icmp/icmp_sockif.c +++ b/net/icmp/icmp_sockif.c @@ -290,7 +290,7 @@ static int icmp_connect(FAR struct socket *psock, * * Returned Value: * 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: * The network is locked. @@ -421,7 +421,7 @@ static int icmp_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/icmpv6/icmpv6_sockif.c b/net/icmpv6/icmpv6_sockif.c index 3dbb5c82e47..0381152bb4a 100644 --- a/net/icmpv6/icmpv6_sockif.c +++ b/net/icmpv6/icmpv6_sockif.c @@ -290,7 +290,7 @@ static int icmpv6_connect(FAR struct socket *psock, * * Returned Value: * 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: * The network is locked. @@ -421,7 +421,7 @@ static int icmpv6_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/ieee802154/ieee802154_sockif.c b/net/ieee802154/ieee802154_sockif.c index 713eae031aa..19661e8537b 100644 --- a/net/ieee802154/ieee802154_sockif.c +++ b/net/ieee802154/ieee802154_sockif.c @@ -344,7 +344,7 @@ static int ieee802154_connect(FAR struct socket *psock, * * Returned Value: * 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: * The network is locked. @@ -594,7 +594,7 @@ static int ieee802154_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index 488f2d1bfc0..2aafef95583 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -578,7 +578,7 @@ static int inet_getpeername(FAR struct socket *psock, * * Returned Value: * 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: * 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: * The network is locked. diff --git a/net/local/local.h b/net/local/local.h index a9c98957b3a..8acf0d6b2cd 100644 --- a/net/local/local.h +++ b/net/local/local.h @@ -339,7 +339,7 @@ int local_release(FAR struct local_conn_s *conn); * * Returned Value: * 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: * psock The listening Unix domain socket structure * 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 * * Returned Value: @@ -426,8 +427,8 @@ 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, - size_t len, int flags, FAR const struct sockaddr *to, - socklen_t tolen); + size_t len, int flags, + FAR const struct sockaddr *to, socklen_t tolen); #endif /**************************************************************************** diff --git a/net/local/local_listen.c b/net/local/local_listen.c index a8b481066f1..75f3a422ffc 100644 --- a/net/local/local_listen.c +++ b/net/local/local_listen.c @@ -84,7 +84,7 @@ dq_queue_t g_local_listeners; * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index 577eb4191af..1b589ff7282 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -473,7 +473,7 @@ static int local_getpeername(FAR struct socket *psock, * * Returned Value: * 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: * 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: * The network is locked. diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c index 34b011a3a54..6ee8c9cae6e 100644 --- a/net/netlink/netlink_sockif.c +++ b/net/netlink/netlink_sockif.c @@ -417,7 +417,7 @@ static int netlink_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/pkt/pkt_sockif.c b/net/pkt/pkt_sockif.c index dbf3e3c381c..0824c1152fa 100644 --- a/net/pkt/pkt_sockif.c +++ b/net/pkt/pkt_sockif.c @@ -314,7 +314,7 @@ static int pkt_connect(FAR struct socket *psock, * * Returned Value: * 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: * The network is locked. @@ -490,7 +490,7 @@ static int pkt_getpeername(FAR struct socket *psock, * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c index f6c5862b23d..c345d610384 100644 --- a/net/socket/getsockopt.c +++ b/net/socket/getsockopt.c @@ -67,12 +67,12 @@ * 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 * 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 * retrieve options at the socket level, specify the level argument as * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level - * argument is SOL_CP. + * argument is SOL_TCP. * * See a complete list of values for the socket-level * '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 * retrieve options at the socket level, specify the level argument as * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level - * argument is SOL_CP. + * argument is SOL_TCP. * * See a complete list of values for the socket-level * '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 * retrieve options at the socket level, specify the level argument as * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level - * argument is SOL_CP. + * argument is SOL_TCP. * * See a complete list of values for the socket-level * 'option' argument. Protocol-specific options are are protocol specific diff --git a/net/socket/recvfrom.c b/net/socket/recvfrom.c index 6a01782c0da..c6d8dd338bd 100644 --- a/net/socket/recvfrom.c +++ b/net/socket/recvfrom.c @@ -77,11 +77,11 @@ * fromlen - The length of the address structure * * 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, - * recv() will return 0. Otherwise, on any failure, a negated errno value - * is returned (see comments with send() for a list of appropriate errno - * values). + * psock_recvfrom() will return 0. Otherwise, on any failure, a negated + * errno value is returned (see comments with recvfrom() for a list of + * 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 * * 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, - * recv() will return 0. Otherwise, on any failure, a negated errno value - * is returned (see comments with send() for a list of appropriate errno - * values). + * nx_recvfrom() will return 0. Otherwise, on any failure, a negated errno + * value is returned (see comments with recvfrom() for a list of + * appropriate errno values). * ****************************************************************************/ diff --git a/net/socket/recvmsg.c b/net/socket/recvmsg.c index 9ba5de30cea..ef9b69665fb 100644 --- a/net/socket/recvmsg.c +++ b/net/socket/recvmsg.c @@ -75,11 +75,11 @@ * flags - Receive flags * * 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, - * recv() will return 0. Otherwise, on any failure, a negated errno value - * is returned (see comments with send() for a list of appropriate errno - * values). + * psock_recvmsg() will return 0. Otherwise, on any failure, a negated + * errno value is returned (see comments with recvmsg() for a list of + * appropriate errno values). * ****************************************************************************/ @@ -150,11 +150,11 @@ ssize_t psock_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, * flags - Receive flags * * 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, - * recv() will return 0. Otherwise, on any failure, a negated errno value - * is returned (see comments with send() for a list of appropriate errno - * values). + * nx_recvmsg() will return 0. Otherwise, on any failure, a negated errno + * value is returned (see comments with recvmsg() for a list of appropriate + * errno values). * ****************************************************************************/ diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 9f3e19347a1..6c625d65574 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -1408,7 +1408,7 @@ int tcp_setsockopt(FAR struct socket *psock, int option, * The 'level' argument specifies the protocol level of the option. To * retrieve options at the socket level, specify the level argument as * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level - * argument is SOL_CP. + * argument is SOL_TCP. * * See a complete list of values for the socket-level * 'option' argument. Protocol-specific options are are protocol specific diff --git a/net/tcp/tcp_getsockopt.c b/net/tcp/tcp_getsockopt.c index c07a488873e..28bdd9333c8 100644 --- a/net/tcp/tcp_getsockopt.c +++ b/net/tcp/tcp_getsockopt.c @@ -74,7 +74,7 @@ * The 'level' argument specifies the protocol level of the option. To * retrieve options at the socket level, specify the level argument as * SOL_SOCKET; to retrieve options at the TCP-protocol level, the level - * argument is SOL_CP. + * argument is SOL_TCP. * * See a complete list of values for the socket-level * 'option' argument. Protocol-specific options are are protocol specific diff --git a/net/usrsock/usrsock.h b/net/usrsock/usrsock.h index 6fe76639481..2bbea25a55f 100644 --- a/net/usrsock/usrsock.h +++ b/net/usrsock/usrsock.h @@ -119,12 +119,12 @@ struct usrsock_conn_s struct { - sem_t sem; /* Request semaphore (only one outstanding request) */ - uint8_t xid; /* Expected message exchange id */ - bool inprogress; /* Request was received but daemon is still processing */ - uint16_t valuelen; /* Length of value from daemon */ + sem_t sem; /* Request semaphore (only one outstanding request) */ + uint8_t xid; /* Expected message exchange id */ + bool inprogress; /* Request was received but daemon is still processing */ + uint16_t valuelen; /* Length of value from daemon */ uint16_t valuelen_nontrunc; /* Actual length of value at daemon */ - int result; /* Result for request */ + int result; /* Result for request */ struct { @@ -203,8 +203,8 @@ FAR struct usrsock_conn_s *usrsock_alloc(void); * Name: usrsock_free() * * Description: - * Free a usrsock connection structure that is no longer in use. This should - * be done by the implementation of close(). + * Free a usrsock connection structure that is no longer in use. This + * 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 * connection for usrsock * - * Assumptions: - * ****************************************************************************/ 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, - FAR struct usrsock_data_reqstate_s *pstate, - FAR devif_callback_event_t event, - uint16_t flags); + FAR struct usrsock_data_reqstate_s *pstate, + FAR devif_callback_event_t event, + uint16_t flags); /**************************************************************************** * 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() @@ -324,7 +323,8 @@ void usrsockdev_register(void); * domain (see sys/socket.h) * type (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: * 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 * 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 @@ -365,8 +364,6 @@ int usrsock_socket(int domain, int type, int protocol, FAR struct socket *psock) * Returned Value: * 0 on success; -1 on error with errno set appropriately. * - * Assumptions: - * ****************************************************************************/ 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 * * 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 * to a socket." When a socket is created with socket, it exists in a name * space (address family) but has no name assigned. * * Input Parameters: - * conn usrsock socket connection structure + * psock A reference to the socket structure of the socket to be bound * addr Socket local address * addrlen Length of 'addr' * @@ -397,8 +394,6 @@ int usrsock_close(FAR struct usrsock_conn_s *conn); * ENOTSOCK * psock is a descriptor for a file, not a socket. * - * Assumptions: - * ****************************************************************************/ int usrsock_bind(FAR struct socket *psock, @@ -412,15 +407,13 @@ int usrsock_bind(FAR struct socket *psock, * Perform a usrsock connection * * 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 * addrlen Length of address buffer * * Returned Value: * None * - * Assumptions: - * ****************************************************************************/ int usrsock_connect(FAR struct socket *psock, @@ -448,7 +441,8 @@ int usrsock_connect(FAR struct socket *psock, * * Returned Value: * 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 * * 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 * 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 * newly created socket is no longer in the listening state. The original - * socket 'sockfd' is unaffected by this call. Per file descriptor flags - * are not inherited across an inet_accept. + * socket 'psock' is unaffected by this call. Per file descriptor flags + * 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 * 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. * * 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 - * pending connections are present on the queue, inet_accept returns + * pending connections are present on the queue, usrsock_accept returns * EAGAIN. * * Parameters: * psock Reference to the listening socket structure * 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. * * Returned Value: * 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: * 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 @@ -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. * * 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 * len Length of data to send * 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 * * Returned Value: - * None - * - * Assumptions: + * On success, returns the number of characters sent. On any failure, a + * negated errno value is returned. * ****************************************************************************/ @@ -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. * * 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 * len Length of buffer * flags Receive flags (ignored) * from Address of source (may be NULL) * 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, @@ -577,12 +578,13 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, * Name: usrsock_getsockopt * * Description: - * getsockopt() retrieve thse value for the option specified by the - * 'option' argument for the socket specified by the 'psock' argument. If - * 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 - * truncated. Otherwise, the length pointed to by the 'value_len' argument - * will be modified to indicate the actual length of the'value'. + * getsockopt() retrieve the value for the option specified by the + * 'option' argument at the protocol level specified by the 'level' + * argument. If 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 truncated. Otherwise, the length pointed to by the + * '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 * 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, - FAR void *value, FAR socklen_t *value_len); +int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, + int option, FAR void *value, + FAR socklen_t *value_len); /**************************************************************************** * Name: usrsock_setsockopt @@ -608,7 +611,7 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option, * Description: * psock_setsockopt() sets the option specified by the 'option' argument, * 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 * 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, - FAR const void *value, FAR socklen_t value_len); +int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, + int option, FAR const void *value, + FAR socklen_t value_len); /**************************************************************************** * 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. * * Input Parameters: - * conn usrsock socket connection structure + * psock A reference to the socket structure of the socket * addr sockaddr structure to receive data [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. * * Input Parameters: - * conn usrsock socket connection structure + * psock A reference to the socket structure of the socket * addr sockaddr structure to receive data [out] * addrlen Length of sockaddr structure [in/out] * @@ -681,16 +685,19 @@ int usrsock_getpeername(FAR struct socket *psock, * Name: usrsock_ioctl * * Description: - * The usrsock_ioctl() function performs network device specific operations. + * The usrsock_ioctl() function performs network device specific + * operations. * * 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 * 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 #ifdef __cplusplus diff --git a/net/usrsock/usrsock_accept.c b/net/usrsock/usrsock_accept.c index cab53f053c9..9133f0a7764 100644 --- a/net/usrsock/usrsock_accept.c +++ b/net/usrsock/usrsock_accept.c @@ -172,16 +172,16 @@ static int do_accept_request(FAR struct usrsock_conn_s *conn, * Name: usrsock_accept * * 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 * 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 * newly created socket is no longer in the listening state. The original - * socket 'sockfd' is unaffected by this call. Per file descriptor flags - * are not inherited across an inet_accept. + * socket 'psock' is unaffected by this call. Per file descriptor flags + * 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 * 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. * * 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 - * pending connections are present on the queue, inet_accept returns + * pending connections are present on the queue, usrsock_accept returns * EAGAIN. * * Parameters: diff --git a/net/usrsock/usrsock_bind.c b/net/usrsock/usrsock_bind.c index 93aa7b77e05..84133d61948 100644 --- a/net/usrsock/usrsock_bind.c +++ b/net/usrsock/usrsock_bind.c @@ -136,13 +136,13 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn, * Name: usrsock_bind * * 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 * to a socket." When a socket is created with socket, it exists in a name * space (address family) but has no name assigned. * * Input Parameters: - * conn usrsock socket connection structure + * psock A reference to the socket structure of the socket to be bound * addr Socket local address * addrlen Length of 'addr' * @@ -158,8 +158,6 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn, * ENOTSOCK * psock is a descriptor for a file, not a socket. * - * Assumptions: - * ****************************************************************************/ int usrsock_bind(FAR struct socket *psock, @@ -201,7 +199,7 @@ int usrsock_bind(FAR struct socket *psock, goto errout_unlock; } - /* Request user-space daemon to close socket. */ + /* Request user-space daemon to bind address. */ ret = do_bind_request(conn, addr, addrlen); if (ret >= 0) diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c index 0d6261a681a..0d79124913f 100644 --- a/net/usrsock/usrsock_conn.c +++ b/net/usrsock/usrsock_conn.c @@ -216,8 +216,6 @@ int usrsock_connidx(FAR struct usrsock_conn_s *conn) * Find a connection structure that is the appropriate * connection for usrsock * - * Assumptions: - * ****************************************************************************/ FAR struct usrsock_conn_s *usrsock_active(int16_t usockid) diff --git a/net/usrsock/usrsock_getpeername.c b/net/usrsock/usrsock_getpeername.c index 54ef03fb64a..7cc01bd171b 100644 --- a/net/usrsock/usrsock_getpeername.c +++ b/net/usrsock/usrsock_getpeername.c @@ -147,7 +147,7 @@ static int do_getpeername_request(FAR struct usrsock_conn_s *conn, * the object pointed to by address is unspecified. * * Parameters: - * conn usrsock socket connection structure + * psock A reference to the socket structure of the socket * addr sockaddr structure to receive data [out] * addrlen Length of sockaddr structure [in/out] * diff --git a/net/usrsock/usrsock_getsockname.c b/net/usrsock/usrsock_getsockname.c index bb64823afbf..da0d075db1b 100644 --- a/net/usrsock/usrsock_getsockname.c +++ b/net/usrsock/usrsock_getsockname.c @@ -162,7 +162,7 @@ static int do_getsockname_request(FAR struct usrsock_conn_s *conn, * the object pointed to by address is unspecified. * * Input Parameters: - * conn usrsock socket connection structure + * psock A reference to the socket structure of the socket * addr sockaddr structure to receive data [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)); - /* Request user-space daemon to close socket. */ + /* Request user-space daemon to handle request. */ ret = do_getsockname_request(conn, *addrlen); if (ret >= 0) diff --git a/net/usrsock/usrsock_getsockopt.c b/net/usrsock/usrsock_getsockopt.c index 7946baa2e85..0632d41a1e6 100644 --- a/net/usrsock/usrsock_getsockopt.c +++ b/net/usrsock/usrsock_getsockopt.c @@ -161,12 +161,13 @@ static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level, * Name: usrsock_getsockopt * * Description: - * getsockopt() retrieve thse value for the option specified by the - * 'option' argument for the socket specified by the 'psock' argument. If - * 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 - * truncated. Otherwise, the length pointed to by the 'value_len' argument - * will be modified to indicate the actual length of the'value'. + * getsockopt() retrieve the value for the option specified by the + * 'option' argument at the protocol level specified by the 'level' + * argument. If 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 truncated. Otherwise, the length pointed to by the + * '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 * 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)); - /* Request user-space daemon to close socket. */ + /* Request user-space daemon to handle request. */ ret = do_getsockopt_request(conn, level, option, *value_len); if (ret >= 0) diff --git a/net/usrsock/usrsock_ioctl.c b/net/usrsock/usrsock_ioctl.c index 137b9e71ed7..0b54707a574 100644 --- a/net/usrsock/usrsock_ioctl.c +++ b/net/usrsock/usrsock_ioctl.c @@ -140,9 +140,10 @@ static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd, * This function performs network device specific operations. * * 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 * 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; 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); if (ret >= 0) diff --git a/net/usrsock/usrsock_listen.c b/net/usrsock/usrsock_listen.c index 963a623363c..1d691ba32b2 100644 --- a/net/usrsock/usrsock_listen.c +++ b/net/usrsock/usrsock_listen.c @@ -135,7 +135,7 @@ static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog) * * Returned Value: * 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. * ****************************************************************************/ diff --git a/net/usrsock/usrsock_recvfrom.c b/net/usrsock/usrsock_recvfrom.c index 5df6de0306e..b3a1ad33b30 100644 --- a/net/usrsock/usrsock_recvfrom.c +++ b/net/usrsock/usrsock_recvfrom.c @@ -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. * * 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 * len Length of buffer * flags Receive flags (ignored) * from Address of source (may be NULL) * 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, diff --git a/net/usrsock/usrsock_sendto.c b/net/usrsock/usrsock_sendto.c index 23122327484..583de69f44f 100644 --- a/net/usrsock/usrsock_sendto.c +++ b/net/usrsock/usrsock_sendto.c @@ -200,13 +200,17 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn, * returned when the socket was not actually connected. * * 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 * len Length of data to send * flags Send flags (ignored) * to Address of recipient * 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, diff --git a/net/usrsock/usrsock_setsockopt.c b/net/usrsock/usrsock_setsockopt.c index be46f502341..092e26b1eb7 100644 --- a/net/usrsock/usrsock_setsockopt.c +++ b/net/usrsock/usrsock_setsockopt.c @@ -157,8 +157,7 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn, * Description: * psock_setsockopt() sets the option specified by the 'option' argument, * 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 * 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; } - /* Request user-space daemon to close socket. */ + /* Request user-space daemon to handle request. */ ret = do_setsockopt_request(conn, level, option, value, value_len); if (ret >= 0) diff --git a/net/usrsock/usrsock_socket.c b/net/usrsock/usrsock_socket.c index dec3961a6bf..a3e4c3cc06c 100644 --- a/net/usrsock/usrsock_socket.c +++ b/net/usrsock/usrsock_socket.c @@ -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 * this domain. * - * Assumptions: - * ****************************************************************************/ int usrsock_socket(int domain, int type, int protocol, diff --git a/net/usrsock/usrsock_sockif.c b/net/usrsock/usrsock_sockif.c index 4a83e88197b..a2286310fd7 100644 --- a/net/usrsock/usrsock_sockif.c +++ b/net/usrsock/usrsock_sockif.c @@ -96,7 +96,7 @@ const struct sock_intf_s g_usrsock_sockif = ****************************************************************************/ /**************************************************************************** - * Name: inet_setup + * Name: usrsock_sockif_setup * * Description: * 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: * 0 on success; -1 on error with errno set appropriately. * - * Assumptions: - * ****************************************************************************/ static int usrsock_sockif_close(FAR struct socket *psock)