diff --git a/include/arpa/inet.h b/include/arpa/inet.h index 86ea2159f90f..26b9e31bf9b4 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -118,13 +118,13 @@ in_addr_t inet_lnaof(struct in_addr in); in_addr_t inet_netof(struct in_addr in); #else FAR char *_inet_ntoa(in_addr_t in); -# define inet_ntoa(in) _inet_ntoa(in.s_addr); +# define inet_ntoa(in) _inet_ntoa(in.s_addr) in_addr_t _inet_lnaof(in_addr_t in); -# define inet_lnaof(in) _inet_lnaof(in.s_addr); +# define inet_lnaof(in) _inet_lnaof(in.s_addr) in_addr_t _inet_netof(in_addr_t in); -# define inet_netof(in) _inet_netof(in.s_addr); +# define inet_netof(in) _inet_netof(in.s_addr) #endif struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host); diff --git a/include/net/if.h b/include/net/if.h index 1d06f7075f55..9a26ec388782 100644 --- a/include/net/if.h +++ b/include/net/if.h @@ -176,7 +176,7 @@ struct lifreq #define lifr_mii_val_in lifr_ifru.lifru_mii_data.val_in /* PHY input data */ #define lifr_mii_val_out lifr_ifru.lifru_mii_data.val_out /* PHY output data */ -/* Used only with the SIOCGLIFCONF IOCTL commnd*/ +/* Used only with the SIOCGLIFCONF IOCTL commnd */ struct lifconf { @@ -221,7 +221,6 @@ struct ifreq #define ifr_flags ifr_ifru.ifru_flags /* interface flags */ #define ifr_mii_notify_pid ifr_ifru.ifru_mii_notify.pid /* PID to be notified */ #define ifr_mii_notify_event ifr_ifru.ifru_mii_notify.event /* Describes notification */ -#define ifr_mii_notify_arg ifr_ifru.ifru_mii_notify.arg /* sigval argument */ #define ifr_mii_phy_id ifr_ifru.ifru_mii_data.phy_id /* PHY device address */ #define ifr_mii_reg_num ifr_ifru.ifru_mii_data.reg_num /* PHY register address */ #define ifr_mii_val_in ifr_ifru.ifru_mii_data.val_in /* PHY input data */ diff --git a/include/net/route.h b/include/net/route.h index 24f37b7b4c0d..9f859d7815a0 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -110,8 +110,8 @@ int addroute(int sockfd, FAR struct sockaddr_storage *target, * Name: net_delroute * * Description: - * Add a new route to the routing table. This is just a convenience - * wrapper for the SIOCADDRT ioctl call. + * Delete a route from the routing table. This is just a convenience + * wrapper for the SIOCDELRT ioctl call. * * Input Parameters: * sockfd - Any socket descriptor diff --git a/include/netinet/arp.h b/include/netinet/arp.h index dcaf530ea58f..c28a35900e3b 100644 --- a/include/netinet/arp.h +++ b/include/netinet/arp.h @@ -43,16 +43,14 @@ #include #include -#include #include /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Three ioctls are available on all PF_INET sockets, but only if the NuttX - * configuration CONFIG_NET_ARPIOCTLS is defined. Each ioctl takes a pointer - * to a 'struct arpreq' as its parameter. +/* Three ioctls are available on all PF_INET sockets. Each ioctl takes a + * pointer to a 'struct arpreq' as its parameter. */ #define SIOCSARP _ARPIOC(1) /* Set a ARP mapping */ @@ -102,15 +100,9 @@ extern "C" * Public Function Prototypes ****************************************************************************/ -/* If CONFIG_NET_ARPIOCTLS is defined then the semi-standard ioctl commands - * described above are supported. If not, you can call the network ARP - * interfaces directly in a very non-standard way. See - * include/nuttx/net/arp.h for prototypes. - */ - #undef EXTERN #ifdef __cplusplus } #endif -#endif /* __INCLUDE_NETINET_ARP_H */ +#endif /* __INCLUDE_NETINET_ARP_H */ diff --git a/include/netinet/ether.h b/include/netinet/ether.h index e7cb37eb0a19..63416df25fbc 100644 --- a/include/netinet/ether.h +++ b/include/netinet/ether.h @@ -76,4 +76,4 @@ int ether_line(FAR const char *line, FAR struct ether_addr *addr, } #endif -#endif /* __INCLUDE_NETINET_ETHER_H */ +#endif /* __INCLUDE_NETINET_ETHER_H */ diff --git a/include/netinet/ip6.h b/include/netinet/ip6.h index be16ae722c0e..7f486f1e42f1 100644 --- a/include/netinet/ip6.h +++ b/include/netinet/ip6.h @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_NETINET_I6P_H -#define __INCLUDE_NETINET_I6P_H +#ifndef __INCLUDE_NETINET_IP6_H +#define __INCLUDE_NETINET_IP6_H /**************************************************************************** * Included Files @@ -51,4 +51,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __INCLUDE_NETINET_I6P_H */ +#endif /* __INCLUDE_NETINET_IP6_H */ diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h index a9b8cae05978..31809d602257 100644 --- a/include/nuttx/fs/ioctl.h +++ b/include/nuttx/fs/ioctl.h @@ -310,7 +310,7 @@ #define _CAIOCVALID(c) (_IOC_TYPE(c)==_CAIOCBASE) #define _CAIOC(nr) _IOC(_CAIOCBASE,nr) -/* NuttX USB CDC/ACM serial driver ioctl definitions ************************/ +/* NuttX battery driver ioctl definitions ***********************************/ /* (see nuttx/power/battery.h) */ @@ -368,7 +368,7 @@ /* Discrete Joystick (see nuttx/include/input/djoystick.h */ -#define _JOYIOCVALID(c) (_IOC_SMASK(c)==_JOYBASE) +#define _JOYIOCVALID(c) (_IOC_TYPE(c)==_JOYBASE) #define _JOYIOC(nr) _IOC(_JOYBASE,nr) /* FIFOs and pipe driver ioctl definitions **********************************/ diff --git a/include/nuttx/net/icmp.h b/include/nuttx/net/icmp.h index 9ba90bfefc8b..dacde22c8860 100644 --- a/include/nuttx/net/icmp.h +++ b/include/nuttx/net/icmp.h @@ -51,7 +51,6 @@ #include #include -#include /**************************************************************************** * Pre-processor Definitions diff --git a/include/nuttx/net/icmpv6.h b/include/nuttx/net/icmpv6.h index 4f3c1dcfe49a..87799f95d3ac 100644 --- a/include/nuttx/net/icmpv6.h +++ b/include/nuttx/net/icmpv6.h @@ -51,7 +51,6 @@ #include #include -#include /**************************************************************************** * Pre-processor Definitions diff --git a/include/nuttx/net/igmp.h b/include/nuttx/net/igmp.h index 5a18cc08dc6b..132a5350ad37 100644 --- a/include/nuttx/net/igmp.h +++ b/include/nuttx/net/igmp.h @@ -50,12 +50,8 @@ #include #include -#include - -#include #include -#include #include #ifdef CONFIG_NET_IGMP diff --git a/include/nuttx/net/ip.h b/include/nuttx/net/ip.h index 0a2d39d10670..af1a31ecccf5 100644 --- a/include/nuttx/net/ip.h +++ b/include/nuttx/net/ip.h @@ -52,7 +52,6 @@ #include #include -#include #include #include @@ -564,7 +563,7 @@ bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1, * Name: net_is_addr_loopback * * Description: - * Is Ithe Pv6 address a the loopback address? See RFC 4291 (replaces + * Is the IPv6 address a the loopback address? See RFC 4291 (replaces * 3513). * ****************************************************************************/ diff --git a/include/nuttx/net/ipv6ext.h b/include/nuttx/net/ipv6ext.h index b1359f33244e..72fb54a0da1e 100644 --- a/include/nuttx/net/ipv6ext.h +++ b/include/nuttx/net/ipv6ext.h @@ -1,6 +1,6 @@ /**************************************************************************** * include/nuttx/net/ipv6ext.h - * IPv4 Extension Header Definitions + * IPv6 Extension Header Definitions * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -107,9 +107,13 @@ */ #define NEXT_HOPBYBOT_EH 0 /* 0 Hop-by-Hop Options Header */ + /* 1 See IP_PROTO_ICMP in + * include/nuttx/net/ip.h. */ + /* 2 See IP_PROTO_IGMP in + * include/nuttx/net/ip.h. */ /* 6 See IP_PROTO_TCP in * include/nuttx/net/ip.h. */ - /* 17 See IP_PROTO_TCP in + /* 17 See IP_PROTO_UDP in * include/nuttx/net/ip.h. */ #define NEXT_ENCAP_EH 41 /* 41 Encapsulated IPv6 Header */ #define NEXT_ROUTING_EH 43 /* 43 Routing Header */ diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index 3ad7afb17468..a7118751a654 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -1376,7 +1376,7 @@ int net_dup2(int sockfd1, int sockfd2); * * Input Parameters: * sockfd - Socket descriptor of the socket to operate on - * bug - Caller-provided location in which to return the fstat data + * buf - Caller-provided location in which to return the fstat data * * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on diff --git a/include/nuttx/net/tcp.h b/include/nuttx/net/tcp.h index 4fb4a207f143..3e9f6dcfd25c 100644 --- a/include/nuttx/net/tcp.h +++ b/include/nuttx/net/tcp.h @@ -56,7 +56,7 @@ #include #include -#include +#include #include /**************************************************************************** diff --git a/net/socket/net_fstat.c b/net/socket/net_fstat.c index 0462ae7d48bd..46b6788bded9 100644 --- a/net/socket/net_fstat.c +++ b/net/socket/net_fstat.c @@ -44,7 +44,6 @@ #include #include -#include #include #include @@ -64,7 +63,7 @@ * * Input Parameters: * sockfd - Socket descriptor of the socket to operate on - * bug - Caller-provided location in which to return the fstat data + * buf - Caller-provided location in which to return the fstat data * * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on diff --git a/net/socket/net_sockif.c b/net/socket/net_sockif.c index ef9dfbceed17..01e83681cc60 100644 --- a/net/socket/net_sockif.c +++ b/net/socket/net_sockif.c @@ -75,7 +75,7 @@ ****************************************************************************/ FAR const struct sock_intf_s * - net_sockif(sa_family_t family, int type, int protocol) +net_sockif(sa_family_t family, int type, int protocol) { FAR const struct sock_intf_s *sockif = NULL; diff --git a/net/socket/socket.h b/net/socket/socket.h index 107e23e92ee3..ee901b251ba3 100644 --- a/net/socket/socket.h +++ b/net/socket/socket.h @@ -124,9 +124,9 @@ /* Macros to convert timeout value */ #ifdef CONFIG_NET_SOCKOPTS -#define _SO_TIMEOUT(t) ((t) ? (t) * MSEC_PER_DSEC : UINT_MAX) +# define _SO_TIMEOUT(t) ((t) ? (t) * MSEC_PER_DSEC : UINT_MAX) #else -#define _SO_TIMEOUT(t) (UINT_MAX) +# define _SO_TIMEOUT(t) (UINT_MAX) #endif /* CONFIG_NET_SOCKOPTS */ /* Macro to set socket errors */ @@ -212,23 +212,6 @@ void psock_release(FAR struct socket *psock); void sockfd_release(int sockfd); -/**************************************************************************** - * Name: sockfd_socket - * - * Description: - * Given a socket descriptor, return the underlying socket structure. - * - * Input Parameters: - * sockfd - The socket descriptor index to use. - * - * Returned Value: - * On success, a reference to the socket structure associated with the - * the socket descriptor is returned. NULL is returned on any failure. - * - ****************************************************************************/ - -FAR struct socket *sockfd_socket(int sockfd); - /**************************************************************************** * Name: net_sockif * @@ -247,7 +230,7 @@ FAR struct socket *sockfd_socket(int sockfd); ****************************************************************************/ FAR const struct sock_intf_s * - net_sockif(sa_family_t family, int type, int protocol); +net_sockif(sa_family_t family, int type, int protocol); /**************************************************************************** * Name: net_timeo @@ -271,70 +254,5 @@ FAR const struct sock_intf_s * int net_timeo(clock_t start_time, socktimeo_t timeo); #endif -/**************************************************************************** - * Name: psock_send - * - * Description: - * The send() call may be used only when the socket is in a connected state - * (so that the intended recipient is known). The only difference between - * send() and write() is the presence of flags. With zero flags parameter, - * send() is equivalent to write(). Also, send(sockfd,buf,len,flags) is - * equivalent to sendto(sockfd,buf,len,flags,NULL,0). - * - * Input Parameters: - * psock An instance of the internal socket structure. - * buf Data to send - * len Length of data to send - * flags Send flags - * - * Returned Value: - * On success, returns the number of characters sent. On error, - * -1 is returned, and errno is set appropriately: - * - * EAGAIN or EWOULDBLOCK - * The socket is marked non-blocking and the requested operation - * would block. - * EBADF - * An invalid descriptor was specified. - * ECONNRESET - * Connection reset by peer. - * EDESTADDRREQ - * The socket is not connection-mode, and no peer address is set. - * EFAULT - * An invalid user space address was specified for a parameter. - * EINTR - * A signal occurred before any data was transmitted. - * EINVAL - * Invalid argument passed. - * EISCONN - * The connection-mode socket was connected already but a recipient - * was specified. (Now either this error is returned, or the recipient - * specification is ignored.) - * EMSGSIZE - * The socket type requires that message be sent atomically, and the - * size of the message to be sent made this impossible. - * ENOBUFS - * The output queue for a network interface was full. This generally - * indicates that the interface has stopped sending, but may be - * caused by transient congestion. - * ENOMEM - * No memory available. - * ENOTCONN - * The socket is not connected, and no target has been given. - * ENOTSOCK - * The argument s is not a socket. - * EOPNOTSUPP - * Some bit in the flags argument is inappropriate for the socket - * type. - * EPIPE - * The local end has been shut down on a connection oriented socket. - * In this case the process will also receive a SIGPIPE unless - * MSG_NOSIGNAL is set. - * - ****************************************************************************/ - -ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len, - int flags); - #endif /* CONFIG_NET */ #endif /* _NET_SOCKET_SOCKET_H */ diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c index 376bf760cb62..ba51c4d7f85c 100644 --- a/net/utils/net_lock.c +++ b/net/utils/net_lock.c @@ -40,14 +40,13 @@ #include #include -#include +#include #include #include #include #include #include -#include #include #include #include @@ -66,8 +65,8 @@ ****************************************************************************/ static sem_t g_netlock; -static pid_t g_holder = NO_HOLDER; -static unsigned int g_count = 0; +static pid_t g_holder = NO_HOLDER; +static unsigned int g_count = 0; /**************************************************************************** * Private Functions diff --git a/net/utils/utils.h b/net/utils/utils.h index e47ded957d98..04bc38742287 100644 --- a/net/utils/utils.h +++ b/net/utils/utils.h @@ -98,7 +98,7 @@ void net_lockinitialize(void); int net_breaklock(FAR unsigned int *count); /**************************************************************************** - * Name: net_breaklock + * Name: net_restorelock * * Description: * Restore the locked state