netutils: nxstyle fixes

fixes for errors reported by nxstyle tool

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2021-06-11 12:06:42 +02:00 committed by Xiang Xiao
parent adc3c9fae9
commit 5572819bb1
52 changed files with 228 additions and 173 deletions

View File

@ -30,6 +30,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* This is a mindless little wrapper around include/nuttx/config.h. Every
* file in the ftpc directory includes this file at the very beginning of
* of the file (instead of include/nuttx/config.h). The only purpose of
@ -58,7 +59,7 @@
****************************************************************************/
/****************************************************************************
* Public Functions
* Public Functions Prototypes
****************************************************************************/
#endif /* __APPS_NETUTILS_FTPC_FTPC_CONFIG_H */

View File

@ -77,8 +77,8 @@ int ftpc_help(SESSION handle, FAR const char *arg)
ret = ftpc_cmd(session, "HELP");
}
/* Logic is missing here to return the help string to the caller. The caller
* needs to call ftpc_getreply.
/* Logic is missing here to return the help string to the caller.
* The caller needs to call ftpc_getreply.
*/
return ret;

View File

@ -75,10 +75,10 @@ int ftpc_idle(SESSION handle, unsigned int idletime)
/* Check if the server supports the SITE IDLE command */
if (!FTPC_HAS_IDLE(session))
{
nwarn("WARNING: Server does not support SITE IDLE\n");
return ERROR;
}
{
nwarn("WARNING: Server does not support SITE IDLE\n");
return ERROR;
}
/* Did the caller provide an IDLE time? Or is this just a query for the
* current IDLE time setting?

View File

@ -65,8 +65,8 @@ int ftpc_unlink(SESSION handle, FAR const char *path)
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)handle;
int ret;
/* A DELE request asks the server to remove a regular file. A typical server
* accepts DELE with:
/* A DELE request asks the server to remove a regular file.
* A typical server accepts DELE with:
*
* - "250 Requested file action okay, completed" if the file was
* successfully removed

View File

@ -298,7 +298,9 @@ int curl4nx_easy_perform(FAR struct curl4nx_s *handle)
rxoff++;
}
/* Check for overflow, version code should not fill the tmpbuf */
/* Check for overflow,
* version code should not fill the tmpbuf
*/
if (tmplen == sizeof(tmpbuf))
{
@ -350,7 +352,9 @@ int curl4nx_easy_perform(FAR struct curl4nx_s *handle)
rxoff++;
}
/* Check for overflow, version code should not fill the tmpbuf */
/* Check for overflow,
* version code should not fill the tmpbuf
*/
if (tmplen == sizeof(tmpbuf))
{
@ -366,7 +370,7 @@ int curl4nx_easy_perform(FAR struct curl4nx_s *handle)
if (state == CURL4NX_STATE_STATUSREASON)
{
/* Accumulate response code until CRLF */
/* Accumulate response code until CRLF */
while (rxoff < ret)
{
@ -500,15 +504,17 @@ int curl4nx_easy_perform(FAR struct curl4nx_s *handle)
handle->max_redirs))
{
curl4nx_info(
"Too many redirections\n");
cret = CURL4NXE_TOO_MANY_REDIRECTS;
"Too many redirections\n");
cret =
CURL4NXE_TOO_MANY_REDIRECTS;
goto close;
}
cret =
curl4nx_easy_setopt(handle,
CURL4NXOPT_URL,
headerbuf + off);
curl4nx_easy_setopt(
handle,
CURL4NXOPT_URL,
headerbuf + off);
if (cret != CURL4NXE_OK)
{
goto close;
@ -516,9 +522,10 @@ int curl4nx_easy_perform(FAR struct curl4nx_s *handle)
redirected = true;
redircount += 1;
curl4nx_info("REDIRECTION (%d) -> %s\n",
redircount,
headerbuf + off);
curl4nx_info("
REDIRECTION (%d) -> %s\n",
redircount,
headerbuf + off);
}
}
}

View File

@ -120,6 +120,7 @@ int curl4nx_easy_setopt(FAR struct curl4nx_s *handle, int option,
cret = CURL4NXE_BAD_FUNCTION_ARGUMENT;
break;
}
handle->port = (uint16_t)(port & 0xffff);
break;
}
@ -196,6 +197,7 @@ int curl4nx_easy_setopt(FAR struct curl4nx_s *handle, int option,
cret = CURL4NXE_BAD_FUNCTION_ARGUMENT;
break;
}
handle->max_redirs = redirs;
break;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/netutils/curl4nx/curl4nx_private.h
* apps/netutils/libcurl4nx/curl4nx_private.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -96,7 +96,7 @@
while(0)
/****************************************************************************
* Private Types
* Public Types
****************************************************************************/
/****************************************************************************

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_delarp.c
* apps/netutils/netlib/netlib_delarp.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_eaddrconv.c
* apps/netutils/netlib/netlib_eaddrconv.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -61,9 +61,9 @@ bool netlib_eaddrconv(FAR const char *hwstr, FAR uint8_t *hw)
{
ch = *hwstr++;
if (++j > 3)
{
return false;
}
{
return false;
}
if (ch == ':' || ch == '\0')
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getarp.c
* apps/netutils/netlib/netlib_getarp.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getarptab.c
* apps/netutils/netlib/netlib_getarptab.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getdevs.c
* apps/netutils/netlib/netlib_getdevs.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getdripv4addr.c
* apps/netutils/netlib/netlib_getdripv4addr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -76,7 +76,7 @@ int netlib_get_dripv4addr(FAR const char *ifname, FAR struct in_addr *addr)
{
FAR struct sockaddr_in *req_addr;
req_addr = (FAR struct sockaddr_in*)&req.ifr_addr;
req_addr = (FAR struct sockaddr_in *)&req.ifr_addr;
memcpy(addr, &req_addr->sin_addr, sizeof(struct in_addr));
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getessid.c
* apps/netutils/netlib/netlib_getessid.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getifstatus.c
* apps/netutils/netlib/netlib_getifstatus.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getipv4addr.c
* apps/netutils/netlib/netlib_getipv4addr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -76,7 +76,7 @@ int netlib_get_ipv4addr(FAR const char *ifname, FAR struct in_addr *addr)
{
FAR struct sockaddr_in *req_addr;
req_addr = (FAR struct sockaddr_in*)&req.ifr_addr;
req_addr = (FAR struct sockaddr_in *)&req.ifr_addr;
memcpy(addr, &req_addr->sin_addr, sizeof(struct in_addr));
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getipv4netmask.c
* apps/netutils/netlib/netlib_getipv4netmask.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -76,7 +76,7 @@ int netlib_get_ipv4netmask(FAR const char *ifname, FAR struct in_addr *addr)
{
FAR struct sockaddr_in *req_addr;
req_addr = (FAR struct sockaddr_in*)&req.ifr_addr;
req_addr = (FAR struct sockaddr_in *)&req.ifr_addr;
memcpy(addr, &req_addr->sin_addr, sizeof(struct in_addr));
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getipv6addr.c
* apps/netutils/netlib/netlib_getipv6addr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getmacaddr.c
* apps/netutils/netlib/netlib_getmacaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getntab.c
* apps/netutils/netlib/netlib_getnbtab.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getnodnodeaddr.c
* apps/netutils/netlib/netlib_getnodeaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getpanid.c
* apps/netutils/netlib/netlib_getpanid.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -72,17 +72,17 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
{
/* Perform the IOCTL */
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
arg.u.getreq.attr = IEEE802154_ATTR_MAC_PANID;
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
arg.u.getreq.attr = IEEE802154_ATTR_MAC_PANID;
ret = ioctl(sockfd, MAC802154IOC_MLME_GET_REQUEST,
ret = ioctl(sockfd, MAC802154IOC_MLME_GET_REQUEST,
(unsigned long)((uintptr_t)&arg));
if (ret < 0)
{
ret = -errno;
fprintf(stderr, "MAC802154IOC_MLME_GET_REQUEST failed: %d\n",
ret);
}
if (ret < 0)
{
ret = -errno;
fprintf(stderr, "MAC802154IOC_MLME_GET_REQUEST failed: %d\n",
ret);
}
close(sockfd);
IEEE802154_PANIDCOPY(panid, arg.u.getreq.attrval.mac.panid);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_getproperties.c
* apps/netutils/netlib/netlib_getproperties.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setipmsfilter.c
* apps/netutils/netlib/netlib_ipmsfilter.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_ipv4route.c
* apps/netutils/netlib/netlib_ipv4route.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -71,14 +71,16 @@
static void set_nul_terminator(FAR char *str)
{
/* The first non-decimal character that is not '.' terminates the address */
/* The first non-decimal character that is not '.' terminates the
* address
*/
while ((*str >= '0' && *str <= '9') || *str == '.')
{
str++;
}
while ((*str >= '0' && *str <= '9') || *str == '.')
{
str++;
}
*str = '\0';
*str = '\0';
}
/****************************************************************************
@ -173,7 +175,7 @@ ssize_t netlib_read_ipv4route(FILE *stream,
{
return sizeof(struct netlib_ipv4_route_s);
}
}
}
}
return ret < 0 ? ret : -EINVAL;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_ipv4router.c
* apps/netutils/netlib/netlib_ipv4router.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -81,7 +81,9 @@ int netlib_ipv4router(FAR const struct in_addr *destipaddr,
hdest = ntohl(destipaddr->s_addr);
/* Find the routing table entry that provides the router for this sub-net. */
/* Find the routing table entry that provides the router for this
* sub-net.
*/
for (; ; )
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_ipv6netmask2prefix.c
* apps/netutils/netlib/netlib_ipv6netmask2prefix.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_ipv6route.c
* apps/netutils/netlib/netlib_ipv6route.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -70,17 +70,17 @@
static void set_nul_terminator(FAR char *str)
{
/* The first non-hex character that is not ':' terminates the address */
/* The first non-hex character that is not ':' terminates the address */
while ((*str >= '0' && *str <= '9') ||
(*str >= 'a' && *str <= 'f') ||
(*str >= 'A' && *str <= 'F') ||
*str == ':')
{
while ((*str >= '0' && *str <= '9') ||
(*str >= 'a' && *str <= 'f') ||
(*str >= 'A' && *str <= 'F') ||
*str == ':')
{
str++;
}
}
*str = '\0';
*str = '\0';
}
/****************************************************************************

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_ipv6router.c
* apps/netutils/netlib/netlib_ipv6router.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -88,7 +88,9 @@ int netlib_ipv6router(FAR const struct in6_addr *destipaddr,
hdest[6] = ntohs(destipaddr->s6_addr16[6]);
hdest[7] = ntohs(destipaddr->s6_addr16[7]);
/* Find the routing table entry that provides the router for this sub-net. */
/* Find the routing table entry that provides the router for this
* sub-net.
*/
for (; ; )
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_listenon.c
* apps/netutils/netlib/netlib_listenon.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -77,7 +77,8 @@ int netlib_listenon(uint16_t portno)
/* Set socket to reuse address */
optval = 1;
if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
if (setsockopt(listensd, SOL_SOCKET,
SO_REUSEADDR, (void *)&optval, sizeof(int)) < 0)
{
nwarn("WARNING: setsockopt SO_REUSEADDR failure: %d\n", errno);
}
@ -88,7 +89,8 @@ int netlib_listenon(uint16_t portno)
myaddr.sin_port = portno;
myaddr.sin_addr.s_addr = INADDR_ANY;
if (bind(listensd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0)
if (bind(listensd, (struct sockaddr *)&myaddr,
sizeof(struct sockaddr_in)) < 0)
{
nerr("ERROR: bind failure: %d\n", errno);
goto errout_with_socket;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_nodeaddrconv.c
* apps/netutils/netlib/netlib_nodeaddrconv.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_parsehttpurl.c
* apps/netutils/netlib/netlib_parsehttpurl.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_saddrconv.c
* apps/netutils/netlib/netlib_saddrconv.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -61,9 +61,9 @@ bool netlib_saddrconv(FAR const char *hwstr, FAR uint8_t *hw)
{
ch = *hwstr++;
if (++j > 3)
{
return false;
}
{
return false;
}
if (ch == ':' || ch == '\0')
{

View File

@ -63,7 +63,8 @@
*
****************************************************************************/
void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksize)
void netlib_server(uint16_t portno,
pthread_startroutine_t handler, int stacksize)
{
struct sockaddr_in myaddr;
#ifdef CONFIG_NET_SOLINGER
@ -86,12 +87,12 @@ void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksiz
/* Begin serving connections */
for (;;)
for (; ; )
{
/* Accept the next connectin */
addrlen = sizeof(struct sockaddr_in);
acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen);
acceptsd = accept(listensd, (struct sockaddr *)&myaddr, &addrlen);
if (acceptsd < 0)
{
nerr("ERROR: accept failure: %d\n", errno);
@ -108,7 +109,8 @@ void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksiz
ling.l_onoff = 1;
ling.l_linger = 30; /* timeout is seconds */
ret = setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger));
ret = setsockopt(acceptsd, SOL_SOCKET,
SO_LINGER, &ling, sizeof(struct linger));
if (ret < 0)
{
close(acceptsd);
@ -124,7 +126,8 @@ void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksiz
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, stacksize);
ret = pthread_create(&child, &attr, handler, (pthread_addr_t)((uintptr_t)acceptsd));
ret = pthread_create(&child, &attr,
handler, (pthread_addr_t)((uintptr_t)acceptsd));
if (ret != 0)
{
/* Close the connection */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setarp.c
* apps/netutils/netlib/netlib_setarp.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setdripv4addr.c
* apps/netutils/netlib/netlib_setdripv4addr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -105,6 +105,7 @@ int netlib_set_dripv4addr(FAR const char *ifname,
if (OK == ret)
{
/* Delete the default route first */
/* This call fails if no default route exists, but it's OK */
delroute(sockfd,

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_seteaddr.c
* apps/netutils/netlib/netlib_seteaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -72,20 +72,20 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
{
/* Perform the IOCTL */
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
arg.u.setreq.attr = IEEE802154_ATTR_MAC_EADDR;
IEEE802154_EADDRCOPY(arg.u.setreq.attrval.mac.eaddr, eaddr);
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
arg.u.setreq.attr = IEEE802154_ATTR_MAC_EADDR;
IEEE802154_EADDRCOPY(arg.u.setreq.attrval.mac.eaddr, eaddr);
ret = ioctl(sockfd, MAC802154IOC_MLME_SET_REQUEST,
ret = ioctl(sockfd, MAC802154IOC_MLME_SET_REQUEST,
(unsigned long)((uintptr_t)&arg));
if (ret < 0)
{
ret = -errno;
fprintf(stderr, "MAC802154IOC_MLME_SET_REQUEST failed: %d\n",
ret);
}
if (ret < 0)
{
ret = -errno;
fprintf(stderr, "MAC802154IOC_MLME_SET_REQUEST failed: %d\n",
ret);
}
close(sockfd);
close(sockfd);
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setessid.c
* apps/netutils/netlib/netlib_setessid.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setifstatus.c
* apps/netutils/netlib/netlib_setifstatus.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setipv4addr.c
* apps/netutils/netlib/netlib_setipv4addr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -56,7 +56,8 @@
*
****************************************************************************/
int netlib_set_ipv4addr(FAR const char *ifname, FAR const struct in_addr *addr)
int netlib_set_ipv4addr(FAR const char *ifname,
FAR const struct in_addr *addr)
{
int ret = ERROR;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setipv4dnsaddr.c
* apps/netutils/netlib/netlib_setipv4dnsaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setipv4netmask.c
* apps/netutils/netlib/netlib_setipv4netmask.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setipv6addr.c
* apps/netutils/netlib/netlib_setipv6addr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -80,7 +80,8 @@ int netlib_set_ipv6addr(FAR const char *ifname,
inaddr->sin6_port = 0;
memcpy(&inaddr->sin6_addr, addr, sizeof(struct in6_addr));
ret = ioctl(sockfd, SIOCSLIFADDR, ((unsigned long)(uintptr_t)&req));
ret = ioctl(sockfd, SIOCSLIFADDR,
((unsigned long)(uintptr_t)&req));
close(sockfd);
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setipv6netmask.c
* apps/netutils/netlib/netlib_setipv6netmask.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -79,7 +79,8 @@ int netlib_set_ipv6netmask(FAR const char *ifname,
inaddr->sin6_port = 0;
memcpy(&inaddr->sin6_addr, addr, sizeof(struct in6_addr));
ret = ioctl(sockfd, SIOCSLIFNETMASK, (unsigned long)((uintptr_t)&req));
ret = ioctl(sockfd, SIOCSLIFNETMASK,
(unsigned long)((uintptr_t)&req));
close(sockfd);
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/netlib/netlib_setmacaddr.c
* apps/netutils/netlib/netlib_setmacaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/tftp/tftpc_get.c
* apps/netutils/tftpc/tftpc_get.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/tftoc/tftpc_internal.h
* apps/netutils/tftpc/tftpc_internal.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,6 +42,7 @@
****************************************************************************/
/* Verify TFTP configuration settings ***************************************/
/* The settings beginning with CONFIG_NETUTILS_TFTP_* can all be set in the
* NuttX configuration file. If they are are defined in the configuration
* then default values are assigned here.
@ -157,15 +158,19 @@
/* Defined in tftp_packet.c *************************************************/
extern int tftp_sockinit(struct sockaddr_in *server, in_addr_t addr);
extern int tftp_mkreqpacket(uint8_t *buffer, int opcode, const char *path, bool binary);
extern int tftp_mkreqpacket(uint8_t *buffer, int opcode,
const char *path, bool binary);
extern int tftp_mkackpacket(uint8_t *buffer, uint16_t blockno);
extern int tftp_mkerrpacket(uint8_t *buffer, uint16_t errorcode, const char *errormsg);
extern int tftp_mkerrpacket(uint8_t *buffer, uint16_t errorcode,
const char *errormsg);
#ifdef CONFIG_DEBUG_NET_WARN
extern int tftp_parseerrpacket(const uint8_t *packet);
#endif
extern ssize_t tftp_recvfrom(int sd, void *buf, size_t len, struct sockaddr_in *from);
extern ssize_t tftp_sendto(int sd, const void *buf, size_t len, struct sockaddr_in *to);
extern ssize_t tftp_recvfrom(int sd, void *buf,
size_t len, struct sockaddr_in *from);
extern ssize_t tftp_sendto(int sd, const void *buf,
size_t len, struct sockaddr_in *to);
#ifdef CONFIG_NETUTILS_TFTP_DUMPBUFFERS
# define tftp_dumpbuffer(msg, buffer, nbytes) ninfodumpbuffer(msg, buffer, nbytes)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/tftp/tftpc_packets.c
* apps/netutils/tftpc/tftpc_packets.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/tftp/tftpc_put.c
* apps/netutils/tftpc/tftpc_put.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/thttpd/config.h
* apps/netutils/thttpd/config.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -22,7 +22,7 @@
#define __NETUTILS_THTTPD_CONFIG_H
/****************************************************************************
* Included files
* Included Files
****************************************************************************/
#include <nuttx/config.h>
@ -88,15 +88,17 @@
# define CONFIG_THTTPD_CGI_PATH "/mnt/www/cgi-bin"
# endif
/* Only CGI programs whose fully expanded paths match this pattern will be executed. In fact,
* if this value is not defined then no CGI logic will be built.
/* Only CGI programs whose fully expanded paths match this pattern will be
* executed. In fact, if this value is not defined then no CGI logic will
* be built.
*/
# ifndef CONFIG_THTTPD_CGI_PATTERN
# define CONFIG_THTTPD_CGI_PATTERN "/mnt/www/cgi-bin/*"
# endif
/* These provide the priority and stack size of the CGI child tasks */
/* These provide the priority and stack size of the CGI child tasks
*/
# ifndef CONFIG_THTTPD_CGI_PRIORITY
# define CONFIG_THTTPD_CGI_PRIORITY 50
@ -106,25 +108,29 @@
# define CONFIG_THTTPD_CGI_STACKSIZE 2048
# endif
/* Byte output limit for CGI tasks */
/* Byte output limit for CGI tasks
*/
# ifndef CONFIG_THTTPD_CGI_BYTECOUNT
# define CONFIG_THTTPD_CGI_BYTECOUNT 200000
# endif
/* How many seconds to allow CGI programs to run before killing them. */
/* How many seconds to allow CGI programs to run before killing them.
*/
# ifndef CONFIG_THTTPD_CGI_TIMELIMIT
# define CONFIG_THTTPD_CGI_TIMELIMIT 0 /* No time limit */
# endif
/* The default character set name to use with text MIME types. */
/* The default character set name to use with text MIME types.
*/
# ifndef CONFIG_THTTPD_CHARSET
# define CONFIG_THTTPD_CHARSET "iso-8859-1"
# endif
/* Initial buffer size, buffer reallocation increment, maximum buffer size */
/* Initial buffer size, buffer reallocation increment, maximum buffer size
*/
# ifndef CONFIG_THTTPD_IOBUFFERSIZE
# define CONFIG_THTTPD_IOBUFFERSIZE 256
@ -154,78 +160,93 @@
# error "Can't use uint16_t for buffer size"
# endif
/* A list of index filenames to check. The files are searched for in this order. */
/* A list of index filenames to check.
* The files are searched for in this order.
*/
# ifndef CONFIG_THTTPD_INDEX_NAMES
# define CONFIG_THTTPD_INDEX_NAMES "index.html", "index.htm", "index.cgi"
# endif
/* CONFIG_AUTH_FILE - The file to use for authentication. If this is defined then
* thttpd checks for this file in the local directory before every fetch. If the
* file exists then authentication is done, otherwise the fetch proceeds as usual.
* If you leave this undefined then thttpd will not implement authentication at
* all and will not check for auth files, which saves a bit of CPU time.
* A typical value is ".htpasswd"
/* CONFIG_AUTH_FILE - The file to use for authentication. If this is defined
* then thttpd checks for this file in the local directory before every
* fetch. If the file exists then authentication is done, otherwise the
* fetch proceeds as usual.
* If you leave this undefined then thttpd will not implement
* authentication at all and will not check for auth files, which saves a
* bit of CPU time. A typical value is ".htpasswd"
*/
/* The listen() backlog queue length. */
/* The listen() backlog queue length.
*/
# ifndef CONFIG_THTTPD_LISTEN_BACKLOG
# define CONFIG_THTTPD_LISTEN_BACKLOG 8
# endif
/* How many milliseconds to leave a connection open while doing a lingering close */
/* How many milliseconds to leave a connection open while doing a lingering
* close
*/
# ifndef CONFIG_THTTPD_LINGER_MSEC
# define CONFIG_THTTPD_LINGER_MSEC 500
# endif
/* How often to run the occasional cleanup job.*/
/* How often to run the occasional cleanup job.
*/
# ifndef CONFIG_THTTPD_OCCASIONAL_MSEC
# define CONFIG_THTTPD_OCCASIONAL_MSEC 120 /* Two minutes */
# endif
/* How many seconds to allow for reading the initial request on a new connection. */
/* How many seconds to allow for reading the initial request on a new
* connection.
*/
# ifndef CONFIG_THTTPD_IDLE_READ_LIMIT_SEC
# define CONFIG_THTTPD_IDLE_READ_LIMIT_SEC 300
# endif
/* How many seconds before an idle connection gets closed. */
/* How many seconds before an idle connection gets closed.
*/
# ifndef CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC
# define CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC 300
# endif
/* Memory debug instrumentation depends on other debug options */
/* Memory debug instrumentation depends on other debug options
*/
# if (!defined(CONFIG_DEBUG_FEATURES) || !defined(CONFIG_DEBUG_NET)) && defined(CONFIG_THTTPD_MEMDEBUG)
# undef CONFIG_THTTPD_MEMDEBUG
# endif
/* Tilde mapping. Many URLs use ~username to indicate a user's home directory. thttpd
* provides two options for mapping this construct to an actual filename.
/* Tilde mapping.
* Many URLs use ~username to indicate a user's home directory.
* thttpd provides two options for mapping this construct to an actual
* filename.
*
* 1) Map ~username to <prefix>/username. This is the recommended choice. Each user
* gets a subdirectory in the main web tree, and the tilde construct points there.
* 1) Map ~username to <prefix>/username. This is the recommended choice.
* Each user gets a subdirectory in the main web tree, and the tilde
* construct points there.
* The prefix could be something like "users", or it could be empty.
* 2) Map ~username to <user's homedir>/<postfix>. The postfix would be the name of
* a subdirectory off of the user's actual home dir, something like "public_html".
* 2) Map ~username to <user's homedir>/<postfix>. The postfix would be
* the name of a subdirectory off of the user's actual home dir, something
* like "public_html".
*
* You can also leave both options undefined, and thttpd will not do anything special
* about tildes. Enabling both options is an error.
* You can also leave both options undefined, and thttpd will not do anything
* special about tildes. Enabling both options is an error.
*
* Typical values, if they're defined, are "users" for CONFIG_THTTPD_TILDE_MAP1 and "public_html"
* for CONFIG_THTTPD_TILDE_MAP2.
* Typical values, if they're defined, are "users" for
* CONFIG_THTTPD_TILDE_MAP1 and "public_html" for CONFIG_THTTPD_TILDE_MAP2.
*/
# if defined(CONFIG_THTTPD_TILDE_MAP1) && defined(CONFIG_THTTPD_TILDE_MAP2)
# error "Both CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2 are defined"
# endif
/* If CONFIG_THTTPD_URLPATTERN is defined, then it will be used to match and verify
* referrers.
/* If CONFIG_THTTPD_URLPATTERN is defined, then it will be used to match and
* verify referrers.
*/
#else /* Dependencies not provided */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/webserver/httpd_mmap.c
* apps/netutils/webserver/httpd_mmap.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -19,7 +19,7 @@
****************************************************************************/
/****************************************************************************
* Included Header Files
* Included Files
****************************************************************************/
#include <nuttx/config.h>
@ -71,30 +71,32 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
if (-1 == stat(path, &st))
{
return ERROR;
return ERROR;
}
if (S_ISDIR(st.st_mode))
{
errno = EISDIR;
return ERROR;
errno = EISDIR;
return ERROR;
}
if (!S_ISREG(st.st_mode))
{
errno = ENOENT;
return ERROR;
errno = ENOENT;
return ERROR;
}
if (st.st_size > INT_MAX)
{
errno = EFBIG;
return ERROR;
errno = EFBIG;
return ERROR;
}
file->len = (int) st.st_size;
/* SUS3: "If len is zero, mmap() shall fail and no mapping shall be established." */
/* SUS3: "If len is zero, mmap() shall fail and no mapping shall
* be established."
*/
if (st.st_size == 0)
{
@ -104,14 +106,15 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
file->fd = open(path, O_RDONLY);
if (file->fd == -1)
{
return ERROR;
return ERROR;
}
file->data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED | MAP_FILE, file->fd, 0);
file->data = mmap(NULL, st.st_size, PROT_READ,
MAP_SHARED | MAP_FILE, file->fd, 0);
if (file->data == MAP_FAILED)
{
close(file->fd);
return ERROR;
close(file->fd);
return ERROR;
}
return OK;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* netutils/webserver/httpd_mmap.c
* apps/netutils/webserver/httpd_sendfile.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -19,7 +19,7 @@
****************************************************************************/
/****************************************************************************
* Included Header Files
* Included Files
****************************************************************************/
#include <nuttx/config.h>
@ -105,6 +105,7 @@ int httpd_sendfile_close(struct httpd_fs_file *file)
return OK;
}
#endif
if (-1 == close(file->fd))
{
return ERROR;