tools/nxstyle.c: Fix logic error that prevent detecion of '/' and '/=' as operators. net/: Minor updates resulting from testing tools/nxstyle.

This commit is contained in:
Gregory Nutt 2019-03-11 12:48:17 -06:00
parent 0a7f7642c0
commit f6b00e1966
77 changed files with 473 additions and 283 deletions

View file

@ -16,6 +16,12 @@ that copyrighted additions were made during the years of 2007 and 2011
whereas "2007-2011" would indicate copyrighted additions in the years 2007,
2008, 2009, 2010, and 2011.
Copyright Line Continuation: Copy information which exceeds the usable line
lengh may be broken and continued on the following line, such as:
Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All
rights reserved.
NuttX
^^^^^

View file

@ -63,6 +63,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_DEBUG_FEATURES

View file

@ -144,8 +144,10 @@ static uint16_t arp_send_eventhandler(FAR struct net_driver_s *dev,
return flags;
}
/* It looks like we are good to send the data */
/* Copy the packet data into the device packet buffer and send it */
/* It looks like we are good to send the data.
*
* Copy the packet data into the device packet buffer and send it.
*/
arp_format(dev, state->snd_ipaddr);

View file

@ -140,7 +140,6 @@ static int arp_match(FAR struct net_driver_s *dev, FAR void *arg)
return 1;
}
/****************************************************************************
* Name: arp_return_old_entry
*

View file

@ -92,8 +92,10 @@ void bluetooth_poll(FAR struct net_driver_s *dev,
radio->r_dev.d_len = 0;
radio->r_dev.d_sndlen = 0;
/* Perform the application callback */
/* REVISIT: Need to pass the meta data and the IOB through the callback */
/* Perform the application callback.
*
* REVISIT: Need to pass the meta data and the IOB through the callback
*/
#warning Missing logic
/* Perform the application callback */

View file

@ -420,8 +420,9 @@ static int bluetooth_bind(FAR struct socket *psock,
iaddr = (FAR const struct sockaddr_bt_s *)addr;
/* Very that some address was provided */
/* REVISIT: Currently and explict address must be assigned. Should we
/* Very that some address was provided.
*
* REVISIT: Currently and explict address must be assigned. Should we
* support some moral equivalent to INADDR_ANY?
*/
@ -667,7 +668,7 @@ static ssize_t bluetooth_send(FAR struct socket *psock, FAR const void *buf,
{
/* send() may be used only if the socket is has been connected. */
if (!_SS_ISCONNECTED( psock->s_flags))
if (!_SS_ISCONNECTED(psock->s_flags))
{
ret = -ENOTCONN;
}

View file

@ -223,7 +223,6 @@ static uint8_t devif_reassembly(FAR struct net_driver_s *dev)
g_reassembly_bitmap[offset / (8 * 8)] |=
g_bitmap_bits[(offset / 8) & 7] &
~g_bitmap_bits[((offset + len) / 8) & 7];
}
else
{
@ -342,8 +341,10 @@ int ipv4_input(FAR struct net_driver_s *dev)
g_netstats.ipv4.recv++;
#endif
/* Start of IP input header processing code. */
/* Check validity of the IP header. */
/* Start of IP input header processing code.
*
* Check validity of the IP header.
*/
if (ipv4->vhl != 0x45)
{

View file

@ -289,8 +289,10 @@ int ipv6_input(FAR struct net_driver_s *dev)
g_netstats.ipv6.recv++;
#endif
/* Start of IP input header processing code. */
/* Check validity of the IP header. */
/* Start of IP input header processing code.
*
* Check validity of the IP header.
*/
if ((ipv6->vtc & 0xf0) != 0x60)
{

View file

@ -213,8 +213,9 @@ FAR struct ieee802154_conn_s *
conn != NULL;
conn = (FAR struct ieee802154_conn_s *)conn->node.flink)
{
/* Does the destination address match the bound address of the socket. */
/* REVISIT: Currently and explicit address must be assigned. Should we
/* Does the destination address match the bound address of the socket.
*
* REVISIT: Currently and explicit address must be assigned. Should we
* support some moral equivalent to INADDR_ANY?
*/

View file

@ -92,8 +92,10 @@ void ieee802154_poll(FAR struct net_driver_s *dev,
radio->r_dev.d_len = 0;
radio->r_dev.d_sndlen = 0;
/* Perform the application callback */
/* REVISIT: Need to pass the meta data and the IOB through the callback */
/* Perform the application callback.
*
* REVISIT: Need to pass the meta data and the IOB through the callback.
*/
#warning Missing logic
/* Perform the application callback */

View file

@ -229,8 +229,9 @@ static void ieee802154_meta_data(FAR struct radio_driver_s *radio,
meta->flags.ackreq = TRUE;
}
/* Destination address */
/* If the output address is NULL, then it is broadcast on the 802.15.4
/* Destination address.
*
* If the output address is NULL, then it is broadcast on the 802.15.4
* network.
*/

View file

@ -421,8 +421,9 @@ static int ieee802154_bind(FAR struct socket *psock,
iaddr = (FAR const struct sockaddr_ieee802154_s *)addr;
/* Very that some address was provided */
/* REVISIT: Currently and explict address must be assigned. Should we
/* Very that some address was provided.
*
* REVISIT: Currently and explict address must be assigned. Should we
* support some moral equivalent to INADDR_ANY?
*/

View file

@ -32,8 +32,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*
* ________________
/* ________________
* | |
* | |
* | |

View file

@ -81,6 +81,7 @@ static inline void igmp_sched_send(FAR struct net_driver_s *dev,
in_addr_t *dest;
/* REVISIT: This should be deferred to a work queue */
/* Check what kind of message we need to send. There are only two
* possibilities:
*/

View file

@ -1548,8 +1548,9 @@ ssize_t inet_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
}
}
/* Read from the network interface driver buffer */
/* Or perform the TCP/IP or UDP recv() operation */
/* Read from the network interface driver buffer.
* Or perform the TCP/IP or UDP recv() operation.
*/
switch (psock->s_type)
{

View file

@ -183,7 +183,7 @@ struct local_conn_s
struct
{
uint16_t lc_remaining; /* (For binary compatibility with peer) */
volatile int lc_result; /* Result of the connection operation (client)*/
volatile int lc_result; /* Result of the connection operation (client) */
} client;
/* Fields common to connected peers (connected or accepted) */
@ -651,7 +651,6 @@ int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
bool nonblock);
#endif
/****************************************************************************
* Name: local_accept_pollnotify
****************************************************************************/

View file

@ -180,8 +180,8 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
conn->lc_type = LOCAL_TYPE_PATHNAME;
conn->lc_state = LOCAL_STATE_CONNECTED;
strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX-1);
conn->lc_path[UNIX_PATH_MAX-1] = '\0';
strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1);
conn->lc_path[UNIX_PATH_MAX - 1] = '\0';
conn->lc_instance_id = client->lc_instance_id;
/* Open the server-side write-only FIFO. This should not

View file

@ -91,7 +91,7 @@ int psock_local_bind(FAR struct socket *psock,
}
else
{
namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX-1);
namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX - 1);
if (namelen <= 0)
{
/* Zero-length sun_path... This is an abstract Unix domain socket */
@ -107,8 +107,8 @@ int psock_local_bind(FAR struct socket *psock,
/* Copy the path into the connection structure */
(void)strncpy(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1);
conn->lc_path[UNIX_PATH_MAX-1] = '\0';
(void)strncpy(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1);
conn->lc_path[UNIX_PATH_MAX - 1] = '\0';
conn->lc_instance_id = -1;
}
}

View file

@ -309,15 +309,16 @@ int psock_local_connect(FAR struct socket *psock,
case LOCAL_TYPE_PATHNAME: /* lc_path holds a null terminated string */
{
if (strncmp(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1) == 0)
if (strncmp(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1)
== 0)
{
int ret = OK;
/* Bind the address and protocol */
client->lc_proto = conn->lc_proto;
strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1);
client->lc_path[UNIX_PATH_MAX-1] = '\0';
strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1);
client->lc_path[UNIX_PATH_MAX - 1] = '\0';
client->lc_instance_id = local_generate_instance_id();
/* The client is now bound to an address */

View file

@ -82,16 +82,16 @@ static inline void local_cs_name(FAR struct local_conn_s *conn,
{
if (conn->lc_instance_id < 0)
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_CS_SUFFIX,
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_CS_SUFFIX,
conn->lc_path);
}
else
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_CS_SUFFIX "%x",
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_CS_SUFFIX "%x",
conn->lc_path, conn->lc_instance_id);
}
path[LOCAL_FULLPATH_LEN-1] = '\0';
path[LOCAL_FULLPATH_LEN - 1] = '\0';
}
#endif /* CONFIG_NET_LOCAL_STREAM */
@ -109,16 +109,16 @@ static inline void local_sc_name(FAR struct local_conn_s *conn,
{
if (conn->lc_instance_id < 0)
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_SC_SUFFIX,
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_SC_SUFFIX,
conn->lc_path);
}
else
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_SC_SUFFIX "%x",
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_SC_SUFFIX "%x",
conn->lc_path, conn->lc_instance_id);
}
path[LOCAL_FULLPATH_LEN-1] = '\0';
path[LOCAL_FULLPATH_LEN - 1] = '\0';
}
#endif /* CONFIG_NET_LOCAL_STREAM */
@ -133,8 +133,9 @@ static inline void local_sc_name(FAR struct local_conn_s *conn,
#ifdef CONFIG_NET_LOCAL_DGRAM
static inline void local_hd_name(FAR const char *inpath, FAR char *outpath)
{
(void)snprintf(outpath, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_HD_SUFFIX, inpath);
outpath[LOCAL_FULLPATH_LEN-1] = '\0';
(void)snprintf(outpath, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_HD_SUFFIX,
inpath);
outpath[LOCAL_FULLPATH_LEN - 1] = '\0';
}
#endif /* CONFIG_NET_LOCAL_DGRAM */

View file

@ -219,7 +219,7 @@ int local_getaddr(FAR struct local_conn_s *conn, FAR struct sockaddr *addr,
* of the whole Unix domain address.
*/
pathlen = strnlen(conn->lc_path, UNIX_PATH_MAX-1);
pathlen = strnlen(conn->lc_path, UNIX_PATH_MAX - 1);
totlen = sizeof(sa_family_t) + pathlen + 1;
/* If the length of the whole Unix domain address is larger than the

View file

@ -70,7 +70,6 @@
int local_release(FAR struct local_conn_s *conn)
{
/* There should be no references on this structure */
DEBUGASSERT(conn->lc_crefs == 0);

View file

@ -558,6 +558,7 @@ static int local_connect(FAR struct socket *psock,
{
/* Perform the datagram connection logic */
#warning Missing logic
return -ENOSYS;
}
break;
@ -703,6 +704,7 @@ static ssize_t local_send(FAR struct socket *psock, FAR const void *buf,
{
/* Local UDP packet send */
#warning Missing logic
ret = -ENOSYS;
}
break;

View file

@ -52,7 +52,7 @@
* Public Types
****************************************************************************/
/****************************************************************************
/****************************************************************************
* Public Data
****************************************************************************/

View file

@ -299,18 +299,18 @@ void mld_new_pollcycle(FAR struct net_driver_s *dev)
/* Update member ship in every group */
for (member = (FAR struct mld_group_s *)dev->d_mld.grplist.head;
member;
member = member->next)
{
/* Save the number of members that reported in the previous query
* cycle; reset the number of members that have reported in the new
* query cycle.
*/
for (member = (FAR struct mld_group_s *)dev->d_mld.grplist.head;
member;
member = member->next)
{
/* Save the number of members that reported in the previous query
* cycle; reset the number of members that have reported in the new
* query cycle.
*/
member->lstmbrs = member->members;
member->members = 0;
}
member->lstmbrs = member->members;
member->members = 0;
}
}
#endif

View file

@ -82,7 +82,6 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr)
return -EINVAL;
}
group = mld_grpallocfind(dev, grpaddr);
if (group == NULL)
{

View file

@ -67,8 +67,8 @@
static void neighbor_dump_address(FAR const void *buf, unsigned int buflen)
{
char outbuf[16*3 + 9]; /* 6-byte header header + 16 hex bytes +
* 2 space separator + NUL termination */
char outbuf[16 * 3 + 9]; /* 6-byte header header + 16 hex bytes +
* 2 space separator + NUL termination */
FAR const uint8_t *buffer = buf;
FAR char *ptr;
unsigned int i;

View file

@ -1804,7 +1804,6 @@ void netdev_ifdown(FAR struct net_driver_s *dev)
netdown_notifier_signal(dev);
#endif
}
}

View file

@ -298,8 +298,7 @@ static int netlink_getpeername(FAR struct socket *psock,
FAR socklen_t *addrlen)
{
#warning Missing logic for NETLINK getsockname
return -EOPNOTSUPP;
//return -EAFNOSUPPORT;
return -EOPNOTSUPP; /* Or maybe return -EAFNOSUPPORT; */
}
/****************************************************************************

View file

@ -231,7 +231,6 @@ static const char g_route_ipv4_subdir[] = "ipv4";
static const char g_route_ipv6_subdir[] = "ipv6";
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -735,7 +734,7 @@ static int route_readdir(struct fs_dirent_s *dir)
/* Save the filename and file type */
dir->fd_dir.d_type = DTYPE_FILE;
strncpy(dir->fd_dir.d_name, dname, NAME_MAX+1);
strncpy(dir->fd_dir.d_name, dname, NAME_MAX + 1);
/* Set up the next directory entry offset. NOTE that we could use the
* standard f_pos instead of our own private index.

View file

@ -58,6 +58,7 @@
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Line generating functions */
static int netprocfs_header(FAR struct netprocfs_file_s *netfile);

View file

@ -466,7 +466,6 @@ static void net_reset_ipv6_cache(void)
{
net_add_newest_ipv6(&g_prealloc_ipv6cache[i]);
}
}
#endif
@ -538,8 +537,10 @@ int net_addcache_ipv4(FAR struct net_route_ipv4_s *route)
return ret;
}
/* First, check if the route already exists in the cache */
/* Visit each entry in the cache */
/* First, check if the route already exists in the cache.
*
* Visit each entry in the cache
*/
for (prev = NULL, cache = g_ipv4_cache.head;
cache != NULL;
@ -618,8 +619,10 @@ int net_addcache_ipv6(FAR struct net_route_ipv6_s *route)
return ret;
}
/* First, check if the route already exists in the cache */
/* Visit each entry in the cache */
/* First, check if the route already exists in the cache.
*
* Visit each entry in the cache.
*/
for (prev = NULL, cache = g_ipv6_cache.head;
cache != NULL;

View file

@ -665,8 +665,10 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
fragn_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN;
/* Copy payload and enqueue */
/* Check for the last fragment */
/* Copy payload and enqueue.
*
* Check for the last fragment.
*/
paysize = (framelen - fragn_hdrlen) & SIXLOWPAN_DISPATCH_FRAG_MASK;
if (paysize > buflen - outlen + protosize)

View file

@ -106,6 +106,7 @@ struct sixlowpan_addrcontext_s
****************************************************************************/
/* HC06 specific variables **************************************************/
/* Use of global variables simplifies the logic and is safe in the multi-
* device environment because access is serialized via the network lock.
*
@ -124,6 +125,7 @@ static struct sixlowpan_addrcontext_s
static FAR uint8_t *g_hc06ptr;
/* Constant Data ************************************************************/
/* Uncompression of linklocal
*
* 0 -> 16 bytes from packet
@ -487,8 +489,10 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
ipaddr[6] = HTONS(0xfe00);
}
/* Handle the even bytes in the address */
/* If the postcount is even then take extra care with endian-ness */
/* Handle the even bytes in the address.
*
* If the postcount is even then take extra care with endian-ness.
*/
destndx = 8 - (postcount >> 1);
@ -802,8 +806,10 @@ int sixlowpan_compresshdr_hc06(FAR struct radio_driver_s *radio,
}
}
/* Note that the payload length is always compressed */
/* Next header. We compress it if UDP */
/* Note that the payload length is always compressed.
*
* Next header. We compress it if UDP.
*/
#ifdef CONFIG_NET_UDP
if (ipv6->proto == IP_PROTO_UDP)
@ -1169,8 +1175,9 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
tmp = *g_hc06ptr;
g_hc06ptr += 4;
/* hc06 format of tc is ECN | DSCP , original is DSCP | ECN */
/* set version, pick highest DSCP bits and set in vtc */
/* hc06 format of tc is ECN | DSCP , original is DSCP | ECN
* Set version, pick highest DSCP bits and set in vtc.
*/
ipv6->vtc = 0x60 | ((tmp >> 2) & 0x0f);
@ -1193,15 +1200,17 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
}
else
{
/* Version is always 6! */
/* Version and flow label are compressed */
/* Version is always 6!
*
* Version and flow label are compressed.
*/
if ((iphc0 & SIXLOWPAN_IPHC_TC_01) == 0)
{
/* Traffic class is inline */
ipv6->vtc = 0x60 | ((*g_hc06ptr >> 2) & 0x0f);
ipv6->tcf = ((*g_hc06ptr << 6) & 0xC0) | ((*g_hc06ptr >> 2) & 0x30);
ipv6->tcf = ((*g_hc06ptr << 6) & 0xc0) | ((*g_hc06ptr >> 2) & 0x30);
ipv6->flow = 0;
g_hc06ptr += 1;
}
@ -1268,8 +1277,9 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
}
}
/* If tmp == 0 we do not have a address context and therefore no prefix */
/* REVISIT: Source address may not be the same size as the destination
/* If tmp == 0 we do not have a address context and therefore no prefix.
*
* REVISIT: Source address may not be the same size as the destination
* address.
*/
@ -1279,8 +1289,9 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
}
else
{
/* No compression and link local */
/* REVISIT: Source address may not be the same size as the destination
/* No compression and link local.
*
* REVISIT: Source address may not be the same size as the destination
* address.
*/
@ -1288,8 +1299,10 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
ipv6->srcipaddr);
}
/* Destination address */
/* Put the destination address compression mode into tmp */
/* Destination address.
*
* Put the destination address compression mode into tmp.
*/
tmp = ((iphc1 & SIXLOWPAN_IPHC_DAM_MASK) >> SIXLOWPAN_IPHC_DAM_BIT) & 0x03;
@ -1320,7 +1333,11 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
* DAM 11: 8 bits ff02::00xx
*/
uint8_t prefix[] = { 0xff, 0x02 };
uint8_t prefix[] =
{
0xff, 0x02
};
if (tmp > 0 && tmp < 3)
{
prefix[1] = *g_hc06ptr;
@ -1333,8 +1350,10 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
}
else
{
/* No multicast */
/* Context based */
/* No multicast.
*
* Context based.
*/
if ((iphc1 & SIXLOWPAN_IPHC_DAC) != 0)
{

View file

@ -137,7 +137,7 @@ int sixlowpan_compresshdr_hc1(FAR struct radio_driver_s *radio,
!sixlowpan_ismacbased(ipv6->srcipaddr, &radio->r_dev.d_mac.radio) ||
!sixlowpan_islinklocal(ipv6->destipaddr) ||
!sixlowpan_ismacbased(ipv6->destipaddr, destmac) ||
( 1
(1
#ifdef CONFIG_NET_TCP
&& ipv6->proto != IP_PROTO_TCP
#endif
@ -306,8 +306,9 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio,
ninfo("fptr=%p g_frame_hdrlen=%u\n", fptr, g_frame_hdrlen);
/* Format the IPv6 header in the device d_buf */
/* Set version, traffic clase, and flow label. This assumes that Bit 4 is
/* Format the IPv6 header in the device d_buf.
*
* Set version, traffic clase, and flow label. This assumes that Bit 4 is
* set in HC1.
*/
@ -363,9 +364,11 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio,
/* UDP ports, len, checksum */
udp->srcport =
htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] >> 4));
htons(CONFIG_NET_6LOWPAN_MINPORT +
(hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] >> 4));
udp->destport =
htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] & 0x0F));
htons(CONFIG_NET_6LOWPAN_MINPORT +
(hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] & 0x0f));
ninfo("UDP srcport=%04x destport=%04x\n", udp->srcport, udp->destport);
@ -459,7 +462,7 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio,
/* This is a 1st fragment */
ipv6->len[0] = (iplen - IPv6_HDRLEN) >> 8;
ipv6->len[1] = (iplen - IPv6_HDRLEN) & 0x00FF;
ipv6->len[1] = (iplen - IPv6_HDRLEN) & 0x00ff;
}
ninfo("IPv6 len=%02x:%02x\n", ipv6->len[0], ipv6->len[1]);

View file

@ -80,8 +80,10 @@
memcpy(dest, src, len)
#ifdef CONFIG_WIRELESS_IEEE802154
/* IEEE 802.15.4 address macros */
/* Copy a an IEEE 802.15.4 address */
/* IEEE 802.15.4 address macros
*
* Copy a an IEEE 802.15.4 address.
*/
#define sixlowpan_saddrcopy(dest,src) \
sixlowpan_anyaddrcopy(dest,src,NET_6LOWPAN_SADDRSIZE)

View file

@ -246,8 +246,9 @@ static int sixlowpan_tcp_header(FAR struct tcp_conn_s *conn,
ipv6tcp->tcp.urgp[0] = 0; /* No urgent data */
ipv6tcp->tcp.urgp[1] = 0;
/* Set the sequency number information */
/* REVISIT: There is currently no wait for the data to be ACKed and,
/* Set the sequency number information.
*
* REVISIT: There is currently no wait for the data to be ACKed and,
* hence, no mechanism to retransmit the packet.
*/

View file

@ -445,7 +445,6 @@ void sixlowpan_udp_send(FAR struct net_driver_s *dev,
if (dev != NULL && dev->d_len > 0 && fwddev != NULL)
{
sixlowpan_dumpbuffer("Outgoing UDP packet",
(FAR const uint8_t *)ipv6udp, dev->d_len);

View file

@ -694,7 +694,8 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio,
srcaddr->nv_addrlen = NET_6LOWPAN_SADDRSIZE;
/* MAC802154 gives us Short Address in Little Endinan Order, but we
* need it in Network Order */
* need it in Network Order.
*/
srcaddr->nv_addr[0] = ind->src.saddr[1];
srcaddr->nv_addr[1] = ind->src.saddr[0];
@ -704,7 +705,8 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio,
srcaddr->nv_addrlen = NET_6LOWPAN_EADDRSIZE;
/* MAC802154 gives us Extended Address in Little Endinan Order, but
* we need it in Network Order */
* we need it in Network Order.
*/
srcaddr->nv_addr[0] = ind->src.eaddr[7];
srcaddr->nv_addr[1] = ind->src.eaddr[6];
@ -777,7 +779,8 @@ int sixlowpan_extract_destaddr(FAR struct radio_driver_s *radio,
destaddr->nv_addrlen = NET_6LOWPAN_SADDRSIZE;
/* MAC802154 gives us Short Address in Little Endinan Order, but we
* need it in Network Order */
* need it in Network Order.
*/
destaddr->nv_addr[0] = ind->dest.saddr[1];
destaddr->nv_addr[1] = ind->dest.saddr[0];
@ -787,7 +790,8 @@ int sixlowpan_extract_destaddr(FAR struct radio_driver_s *radio,
destaddr->nv_addrlen = NET_6LOWPAN_EADDRSIZE;
/* MAC802154 gives us Extended Address in Little Endinan Order, but
* we need it in Network Order */
* we need it in Network Order.
*/
destaddr->nv_addr[0] = ind->dest.eaddr[7];
destaddr->nv_addr[1] = ind->dest.eaddr[6];

View file

@ -171,9 +171,9 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev,
* and that no further process of the new data should be
* attempted.
* TCP_SNDACK - If TCP_NEWDATA is cleared, then TCP_SNDACK may be set
* to indicate that an ACK should be included in the response.
* (In TCP_NEWDATA is cleared but TCP_SNDACK is not set, then
* dev->d_len should also be cleared).
* to indicate that an ACK should be included in the
* response. (In TCP_NEWDATA is cleared but TCP_SNDACK is
* not set, then dev->d_len should also be cleared).
*/
flags = devif_conn_event(dev, conn, flags, conn->list);

View file

@ -265,9 +265,9 @@ static int tcp_selectport(uint8_t domain, FAR const union ip_addr_u *ipaddr,
if (portno == 0)
{
/* No local port assigned. Loop until we find a valid listen port number
* that is not being used by any other connection. NOTE the following loop
* is assumed to terminate but could not if all 32000-4096+1 ports are
* in used (unlikely).
* that is not being used by any other connection. NOTE the following
* loop is assumed to terminate but could not if all 32000-4096+1 ports
* are in used (unlikely).
*/
do
@ -701,7 +701,8 @@ FAR struct tcp_conn_s *tcp_alloc(uint8_t domain)
/* Now there is guaranteed to be one free connection. Get it! */
conn = (FAR struct tcp_conn_s *)dq_remfirst(&g_free_tcp_connections);
conn = (FAR struct tcp_conn_s *)
dq_remfirst(&g_free_tcp_connections);
}
}
#endif
@ -753,8 +754,8 @@ void tcp_free(FAR struct tcp_conn_s *conn)
DEBUGASSERT(conn->crefs == 0);
net_lock();
/* Free remaining callbacks, actually there should be only the close callback
* left.
/* Free remaining callbacks, actually there should be only the close
* callback left.
*/
for (cb = conn->list; cb; cb = next)
@ -783,12 +784,14 @@ void tcp_free(FAR struct tcp_conn_s *conn)
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
/* Release any write buffers attached to the connection */
while ((wrbuffer = (struct tcp_wrbuffer_s *)sq_remfirst(&conn->write_q)) != NULL)
while ((wrbuffer = (struct tcp_wrbuffer_s *)
sq_remfirst(&conn->write_q)) != NULL)
{
tcp_wrbuffer_release(wrbuffer);
}
while ((wrbuffer = (struct tcp_wrbuffer_s *)sq_remfirst(&conn->unacked_q)) != NULL)
while ((wrbuffer = (struct tcp_wrbuffer_s *)
sq_remfirst(&conn->unacked_q)) != NULL)
{
tcp_wrbuffer_release(wrbuffer);
}

View file

@ -269,14 +269,14 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
}
else
{
/* All other options have a length field, so that we easily
* can skip past them.
/* All other options have a length field, so that we
* easily can skip past them.
*/
if (dev->d_buf[hdrlen + 1 + i] == 0)
{
/* If the length field is zero, the options are malformed
* and we don't process them further.
/* If the length field is zero, the options are
* malformed and we don't process them further.
*/
break;
@ -395,13 +395,14 @@ found:
/* Check for a to KeepAlive probes. These packets have these properties:
*
* - TCP_ACK flag is set. SYN/FIN/RST never appear in a Keepalive probe.
* - Sequence number is the sequence number of previously ACKed data, i.e.,
* the expected sequence number minus one.
* - Sequence number is the sequence number of previously ACKed data,
* i.e., the expected sequence number minus one.
* - The data payload is one or two bytes.
*
* We would expect a KeepAlive only in the ESTABLISHED state and only after
* some time has elapsed with no network activity. If there is un-ACKed data,
* then we will let the normal TCP re-transmission logic handle that case.
* some time has elapsed with no network activity. If there is un-ACKed
* data, then we will let the normal TCP re-transmission logic handle that
* case.
*/
if ((tcp->flags & TCP_ACK) != 0 &&
@ -590,7 +591,8 @@ found:
* handshake is not complete
*/
nwarn("WARNING: Listen canceled while waiting for ACK on port %d\n",
nwarn("WARNING: Listen canceled while waiting for ACK on "
"port %d\n",
tcp->destport);
/* Free the connection structure */
@ -643,7 +645,8 @@ found:
* state.
*/
if ((flags & TCP_ACKDATA) != 0 && (tcp->flags & TCP_CTL) == (TCP_SYN | TCP_ACK))
if ((flags & TCP_ACKDATA) != 0 &&
(tcp->flags & TCP_CTL) == (TCP_SYN | TCP_ACK))
{
/* Parse the TCP MSS option, if present. */
@ -750,7 +753,8 @@ found:
* sequence numbers will be screwed up.
*/
if ((tcp->flags & TCP_FIN) != 0 && (conn->tcpstateflags & TCP_STOPPED) == 0)
if ((tcp->flags & TCP_FIN) != 0 &&
(conn->tcpstateflags & TCP_STOPPED) == 0)
{
/* Needs to be investigated further.
* Windows often sends FIN packets together with the last ACK for
@ -811,8 +815,8 @@ found:
{
dev->d_urglen = 0;
#else /* CONFIG_NET_TCPURGDATA */
dev->d_appdata = ((FAR uint8_t *)dev->d_appdata) + ((tcp->urgp[0] << 8) |
tcp->urgp[1]);
dev->d_appdata = ((FAR uint8_t *)dev->d_appdata) +
((tcp->urgp[0] << 8) | tcp->urgp[1]);
dev->d_len -= (tcp->urgp[0] << 8) | tcp->urgp[1];
#endif /* CONFIG_NET_TCPURGDATA */
}
@ -823,7 +827,8 @@ found:
* the keep alive timer.
*/
if (conn->keepalive && (dev->d_len > 0 || (tcp->flags & TCP_ACK) != 0))
if (conn->keepalive &&
(dev->d_len > 0 || (tcp->flags & TCP_ACK) != 0))
{
/* Reset the last known "alive" time.
*

View file

@ -294,7 +294,8 @@ int tcp_accept_connection(FAR struct net_driver_s *dev,
else
{
/* Add the connection to the backlog and notify any threads that
* may be waiting on poll()/select() that the connection is available.
* may be waiting on poll()/select() that the connection is
* available.
*/
ret = tcp_backlogadd(listener, conn);

View file

@ -94,7 +94,8 @@ static void tcp_close_connection(FAR struct socket *psock, uint16_t flags)
* And we need to set these two socket status bits appropriately:
*
* _SF_CONNECTED==1 && _SF_CLOSED==0 - the socket is connected
* _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully disconnected
* _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully
* disconnected
* _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected
*/
@ -111,8 +112,8 @@ static void tcp_close_connection(FAR struct socket *psock, uint16_t flags)
}
else if ((flags & (TCP_ABORT | TCP_TIMEDOUT | NETDEV_DOWN)) != 0)
{
/* The loss of connection was less than graceful. This will (eventually)
* be reported as an ENOTCONN error.
/* The loss of connection was less than graceful. This will
* (eventually) be reported as an ENOTCONN error.
*/
psock->s_flags &= ~(_SF_CONNECTED | _SF_CLOSED);
@ -162,7 +163,8 @@ static uint16_t tcp_disconnect_event(FAR struct net_driver_s *dev,
else if ((flags & TCP_CONNECTED) != 0)
{
#if 0 /* REVISIT: Assertion fires. Why? */
FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)psock->s_conn;
FAR struct tcp_conn_s *conn =
(FAR struct tcp_conn_s *)psock->s_conn;
/* Make sure that this is the device bound to the connection */

View file

@ -286,8 +286,10 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
#ifdef CONFIG_NET_ETHERNET
static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn)
{
/* Only Ethernet drivers are supported by this function */
/* REVISIT: Could the MAC address not also be in a routing table? */
/* Only Ethernet drivers are supported by this function.
*
* REVISIT: Could the MAC address not also be in a routing table?
*/
if (conn->dev->d_lltype != NET_LL_ETHERNET)
{
@ -804,7 +806,8 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
sndlen = conn->winsize;
}
ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u mss=%u winsize=%u\n",
ninfo("SEND: wrb=%p pktlen=%u sent=%u sndlen=%u mss=%u "
"winsize=%u\n",
wrb, TCP_WBPKTLEN(wrb), TCP_WBSENT(wrb), sndlen, conn->mss,
conn->winsize);
@ -1270,7 +1273,8 @@ int psock_tcp_cansend(FAR struct socket *psock)
}
/* In order to setup the send, we need to have at least one free write
* buffer head and at least one free IOB to initialize the write buffer head.
* buffer head and at least one free IOB to initialize the write buffer
* head.
*
* REVISIT: The send will still block if we are unable to buffer the entire
* user-provided buffer which may be quite large. We will almost certainly

View file

@ -234,8 +234,10 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
#ifdef CONFIG_NET_ETHERNET
static inline bool psock_send_addrchck(FAR struct tcp_conn_s *conn)
{
/* Only Ethernet drivers are supported by this function */
/* REVISIT: Could the MAC address not also be in a routing table? */
/* Only Ethernet drivers are supported by this function.
*
* REVISIT: Could the MAC address not also be in a routing table?
*/
if (conn->dev->d_lltype != NET_LL_ETHERNET)
{
@ -525,11 +527,11 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
* Then we will split the remaining, single packet into two partial
* packets. This will stimulate the RFC 1122 peer to ACK sooner.
*
* Don't try to split very small packets (less than CONFIG_NET_TCP_SPLIT_SIZE).
* Only the first even packet and the last odd packets could have
* sndlen less than CONFIG_NET_TCP_SPLIT_SIZE. The value of sndlen on
* the last even packet is guaranteed to be at least MSS/2 by the
* logic below.
* Don't try to split very small packets (less than
* CONFIG_NET_TCP_SPLIT_SIZE). Only the first even packet and the
* last odd packets could have sndlen less than
* CONFIG_NET_TCP_SPLIT_SIZE. The value of sndlen on the last even
* packet is guaranteed to be at least MSS / 2 by the logic below.
*/
if (sndlen >= CONFIG_NET_TCP_SPLIT_SIZE)
@ -599,11 +601,12 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->winsize)
{
/* Set the sequence number for this packet. NOTE: The network updates
* sndseq on receipt of ACK *before* this function is called. In that
* case sndseq will point to the next unacknowledged byte (which might
* have already been sent). We will overwrite the value of sndseq
* here before the packet is sent.
/* Set the sequence number for this packet. NOTE: The network
* updates sndseq on receipt of ACK *before* this function is
* called. In that case sndseq will point to the next
* unacknowledged byte (which might have already been sent). We
* will overwrite the value of sndseq here before the packet is
* sent.
*/
seqno = pstate->snd_sent + pstate->snd_isn;
@ -637,7 +640,6 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
pstate->snd_sent += sndlen;
ninfo("SEND: acked=%d sent=%d buflen=%d\n",
pstate->snd_acked, pstate->snd_sent, pstate->snd_buflen);
}
}
}
@ -934,8 +936,9 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
goto errout;
}
/* If net_lockedwait failed, then we were probably reawakened by a signal. In
* this case, net_lockedwait will have returned negated errno appropriately.
/* If net_lockedwait failed, then we were probably reawakened by a signal.
* In this case, net_lockedwait will have returned negated errno
* appropriately.
*/
if (ret < 0)

View file

@ -437,15 +437,17 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
dev->d_sndlen = sndlen;
/* Set the sequence number for this packet. NOTE: The network updates
* sndseq on recept of ACK *before* this function is called. In that
* case sndseq will point to the next unacknowledge byte (which might
* have already been sent). We will overwrite the value of sndseq
* here before the packet is sent.
/* Set the sequence number for this packet. NOTE: The network
* updates sndseq on recept of ACK *before* this function is
* called. In that case sndseq will point to the next
* unacknowledge byte (which might have already been sent). We
* will overwrite the value of sndseq here before the packet is
* sent.
*/
seqno = pstate->snd_sent + pstate->snd_isn;
ninfo("SEND: sndseq %08x->%08x len: %d\n", conn->sndseq, seqno, ret);
ninfo("SEND: sndseq %08x->%08x len: %d\n",
conn->sndseq, seqno, ret);
tcp_setsequence(conn->sndseq, seqno);

View file

@ -393,8 +393,9 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
if (conn->keepretries >= conn->keepcnt)
{
/* Yes... stop the network monitor, closing the connection and all sockets
* associated with the connection.
/* Yes... stop the network monitor, closing the
* connection and all sockets associated with the
* connection.
*/
tcp_stop_monitor(conn, TCP_ABORT);
@ -445,8 +446,8 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
tcp_setsequence(conn->sndseq, saveseq);
/* Increment the number of un-ACKed bytes due to the dummy
* byte that we just sent.
/* Increment the number of un-ACKed bytes due to the
* dummy byte that we just sent.
*/
conn->unacked++;

View file

@ -163,8 +163,8 @@ FAR struct tcp_wrbuffer_s *tcp_wrbuffer_alloc(void)
wrb->wb_iob = net_ioballoc(false);
/* Did we get an IOB? We should always get one except under some really weird
* error conditions.
/* Did we get an IOB? We should always get one except under some really
* weird error conditions.
*/
if (wrb->wb_iob == NULL)

View file

@ -420,7 +420,8 @@ static inline FAR struct udp_conn_s *
* IP address is available and we will insist that the
* destination IP matches the bound address. If a socket is bound
* to INADDR6_ANY (laddr), then it should receive all packets
* directed to the port. REVISIT: Should also depend on SO_BROADCAST.
* directed to the port. REVISIT: Should also depend on
* SO_BROADCAST.
*
* 2. If this is a connection mode UDP socket, then the source address
* is verified against the connected remote address.
@ -638,7 +639,8 @@ void udp_free(FAR struct udp_conn_s *conn)
#ifdef CONFIG_NET_UDP_WRITE_BUFFERS
/* Release any write buffers attached to the connection */
while ((wrbuffer = (struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q)) != NULL)
while ((wrbuffer = (struct udp_wrbuffer_s *)
sq_remfirst(&conn->write_q)) != NULL)
{
udp_wrbuffer_release(wrbuffer);
}
@ -762,7 +764,8 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr)
* interfaces for receiving (Sending will use the default port).
*/
net_ipv6addr_copy(conn->u.ipv6.laddr, inaddr->sin6_addr.in6_u.u6_addr16);
net_ipv6addr_copy(conn->u.ipv6.laddr,
inaddr->sin6_addr.in6_u.u6_addr16);
}
#endif /* CONFIG_NET_IPv6 */

View file

@ -106,7 +106,6 @@ static FAR struct net_driver_s *upd_bound_device(FAR struct udp_conn_s *conn)
# define upd_bound_device(c) netdev_default();
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -250,8 +249,9 @@ FAR struct net_driver_s *udp_find_raddr_device(FAR struct udp_conn_s *conn)
}
else
{
/* Not a suitable IPv4 unicast address for device lookup */
/* Return the device bound to this UDP socket, if any */
/* Not a suitable IPv4 unicast address for device lookup.
* Return the device bound to this UDP socket, if any.
*/
return upd_bound_device(conn);
}
@ -302,8 +302,9 @@ FAR struct net_driver_s *udp_find_raddr_device(FAR struct udp_conn_s *conn)
}
else
{
/* Not a suitable IPv6 unicast address for device lookup */
/* Return the device bound to this UDP socket, if any */
/* Not a suitable IPv6 unicast address for device lookup.
* Return the device bound to this UDP socket, if any.
*/
return upd_bound_device(conn);
}

View file

@ -766,8 +766,10 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
goto errout_with_lock;
}
/* Initialize the write buffer */
/* Check if the socket is connected */
/* Initialize the write buffer
*
* Check if the socket is connected
*/
if (_SS_ISCONNECTED(psock->s_flags))
{
@ -915,11 +917,13 @@ int psock_udp_cansend(FAR struct socket *psock)
}
/* In order to setup the send, we need to have at least one free write
* buffer head and at least one free IOB to initialize the write buffer head.
* buffer head and at least one free IOB to initialize the write buffer
* head.
*
* REVISIT: The send will still block if we are unable to buffer the entire
* user-provided buffer which may be quite large. We will almost certainly
* need to have more than one free IOB, but we don't know how many more.
* REVISIT: The send will still block if we are unable to buffer the
* entire user-provided buffer which may be quite large. We will almost
* certainly need to have more than one free IOB, but we don't know how
* many more.
*/
if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0)

View file

@ -139,7 +139,8 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn)
if (conn->domain == PF_INET6 &&
ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr))
{
in_addr_t raddr = ip6_get_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr);
in_addr_t raddr =
ip6_get_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr);
net_ipv4addr_hdrcopy(ipv4->destipaddr, &raddr);
}
else

View file

@ -63,7 +63,8 @@
void udp_wrbuffer_dump(FAR const char *msg, FAR struct udp_wrbuffer_s *wrb,
unsigned int len, unsigned int offset)
{
syslog(LOG_DEBUG, "%s: wrb=%p pktlen=%d\n", msg, wrb, wrb->wb_iob->io_pktlen);
syslog(LOG_DEBUG, "%s: wrb=%p pktlen=%d\n",
msg, wrb, wrb->wb_iob->io_pktlen);
iob_dump("I/O Buffer Chain", wrb->wb_iob, len, offset);
}

View file

@ -98,7 +98,8 @@ static uint16_t accept_event(FAR struct net_driver_s *dev, FAR void *pvconn,
pstate->reqstate.result == -EAGAIN)
{
/* After reception of connection, mark input not ready. Daemon will
* send event to restore this flag. */
* send event to restore this flag.
*/
conn->flags &= ~USRSOCK_EVENT_RECVFROM_AVAIL;
}
@ -153,9 +154,12 @@ static uint16_t accept_event(FAR struct net_driver_s *dev, FAR void *pvconn,
* Name: do_accept_request
****************************************************************************/
static int do_accept_request(FAR struct usrsock_conn_s *conn, socklen_t addrlen)
static int do_accept_request(FAR struct usrsock_conn_s *conn,
socklen_t addrlen)
{
struct usrsock_request_accept_s req = {};
struct usrsock_request_accept_s req =
{
};
struct iovec bufs[1];
if (addrlen > UINT16_MAX)
@ -226,7 +230,9 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
FAR socklen_t *addrlen, FAR struct socket *newsock)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
struct usrsock_data_reqstate_s state =
{
};
FAR struct usrsock_conn_s *newconn;
struct iovec inbufs[2];
socklen_t inaddrlen = 0;
@ -259,7 +265,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
ninfo("usockid=%d; accept() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}
@ -422,7 +429,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
usrsock_setup_datain(conn, inbufs, ARRAY_SIZE(inbufs));
/* We might start getting events for this socket right after
* returning to daemon, so setup 'newconn' already here. */
* returning to daemon, so setup 'newconn' already here.
*/
newconn->state = USRSOCK_CONN_STATE_READY;
@ -455,7 +463,8 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
newsock->s_sockif = psock->s_sockif;
/* Store length of 'from' address that was available at
* daemon-side. */
* daemon-side.
*/
outaddrlen = state.valuelen_nontrunc;

View file

@ -109,7 +109,9 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn,
FAR const struct sockaddr *addr,
socklen_t addrlen)
{
struct usrsock_request_bind_s req = {};
struct usrsock_request_bind_s req =
{
};
struct iovec bufs[2];
/* Prepare request for daemon to read. */
@ -165,7 +167,9 @@ int usrsock_bind(FAR struct socket *psock,
socklen_t addrlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
ssize_t ret;
DEBUGASSERT(conn);
@ -180,7 +184,8 @@ int usrsock_bind(FAR struct socket *psock,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -108,7 +108,9 @@ static uint16_t close_event(FAR struct net_driver_s *dev, FAR void *pvconn,
static int do_close_request(FAR struct usrsock_conn_s *conn)
{
struct usrsock_request_close_s req = {};
struct usrsock_request_close_s req =
{
};
struct iovec bufs[1];
/* Prepare request for daemon to read. */
@ -135,7 +137,9 @@ static int do_close_request(FAR struct usrsock_conn_s *conn)
int usrsock_close(FAR struct usrsock_conn_s *conn)
{
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
int ret;
net_lock();

View file

@ -124,7 +124,8 @@ FAR struct usrsock_conn_s *usrsock_alloc(void)
/* The free list is protected by a semaphore (that behaves like a mutex). */
_usrsock_semtake(&g_free_sem);
conn = (FAR struct usrsock_conn_s *)dq_remfirst(&g_free_usrsock_connections);
conn = (FAR struct usrsock_conn_s *)
dq_remfirst(&g_free_usrsock_connections);
if (conn)
{
/* Make sure that the connection is marked as uninitialized */
@ -287,7 +288,8 @@ int usrsock_setup_data_request_callback(FAR struct usrsock_conn_s *conn,
{
pstate->valuelen = 0;
pstate->valuelen_nontrunc = 0;
return usrsock_setup_request_callback(conn, &pstate->reqstate, event, flags);
return usrsock_setup_request_callback(conn, &pstate->reqstate, event,
flags);
}
/****************************************************************************

View file

@ -109,7 +109,9 @@ static int do_connect_request(FAR struct usrsock_conn_s *conn,
FAR const struct sockaddr *addr,
socklen_t addrlen)
{
struct usrsock_request_connect_s req = {};
struct usrsock_request_connect_s req =
{
};
struct iovec bufs[2];
if (addrlen > UINT16_MAX)
@ -157,7 +159,9 @@ int usrsock_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
int ret;
DEBUGASSERT(conn);
@ -172,7 +176,8 @@ int usrsock_connect(FAR struct socket *psock,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNREFUSED;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNREFUSED;
goto errout_unlock;
}

View file

@ -279,7 +279,8 @@ static uint8_t usrsockdev_get_xid(FAR struct usrsock_conn_s *conn)
#endif
/* Each connection can one only one request/response pending. So map
* connection structure index to xid value. */
* connection structure index to xid value.
*/
conn_idx = usrsock_connidx(conn);
@ -341,7 +342,8 @@ static bool usrsockdev_is_opened(FAR struct usrsockdev_s *dev)
* Name: usrsockdev_pollnotify
****************************************************************************/
static void usrsockdev_pollnotify(FAR struct usrsockdev_s *dev, pollevent_t eventset)
static void usrsockdev_pollnotify(FAR struct usrsockdev_s *dev,
pollevent_t eventset)
{
#ifndef CONFIG_DISABLE_POLL
int i;
@ -561,7 +563,8 @@ static ssize_t usrsockdev_handle_response(FAR struct usrsockdev_s *dev,
if (USRSOCK_MESSAGE_REQ_IN_PROGRESS(hdr->head.flags))
{
/* In-progress response is acknowledgment that response was
* received. */
* received.
*/
conn->resp.inprogress = true;
}
@ -593,7 +596,8 @@ usrsockdev_handle_datareq_response(FAR struct usrsockdev_s *dev,
{
FAR const struct usrsock_message_datareq_ack_s *datahdr = buffer;
FAR const struct usrsock_message_req_ack_s *hdr = &datahdr->reqack;
int num_inbufs, iovpos;
int num_inbufs;
int iovpos;
ssize_t ret;
if (USRSOCK_MESSAGE_REQ_IN_PROGRESS(hdr->head.flags))
@ -612,7 +616,8 @@ usrsockdev_handle_datareq_response(FAR struct usrsockdev_s *dev,
}
/* In-progress response is acknowledgment that response was
* received. */
* received.
*/
conn->resp.inprogress = true;
@ -635,7 +640,8 @@ usrsockdev_handle_datareq_response(FAR struct usrsockdev_s *dev,
if (datahdr->valuelen > 0 || datahdr->valuelen_nontrunc > 0)
{
nerr("error: response result negative, and valuelen or valuelen_nontrunc non-zero.\n");
nerr("error: response result negative, and valuelen or "
"valuelen_nontrunc non-zero.\n");
ret = -EINVAL;
goto unlock_out;
@ -788,8 +794,9 @@ static ssize_t usrsockdev_handle_req_response(FAR struct usrsockdev_s *dev,
if (dev->req.ack_xid == hdr->xid && dev->req.iov)
{
/* Signal that request was received and read by daemon and acknowledgment
* response was received. */
/* Signal that request was received and read by daemon and
* acknowledgment response was received.
*/
dev->req.iov = NULL;
@ -830,8 +837,8 @@ static ssize_t usrsockdev_handle_message(FAR struct usrsockdev_s *dev,
* Name: usrsockdev_write
****************************************************************************/
static ssize_t usrsockdev_write(FAR struct file *filep, FAR const char *buffer,
size_t len)
static ssize_t usrsockdev_write(FAR struct file *filep,
FAR const char *buffer, size_t len)
{
FAR struct inode *inode = filep->f_inode;
FAR struct usrsock_conn_s *conn;
@ -860,7 +867,8 @@ static ssize_t usrsockdev_write(FAR struct file *filep, FAR const char *buffer,
if (!dev->datain_conn)
{
/* Start of message, buffer length should be at least size of common
* message header. */
* message header.
*/
if (len < sizeof(struct usrsock_message_common_s))
{
@ -932,7 +940,8 @@ static int usrsockdev_open(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct usrsockdev_s *dev;
int ret, tmp;
int ret;
int tmp;
DEBUGASSERT(inode);
@ -1239,7 +1248,8 @@ int usrsockdev_do_request(FAR struct usrsock_conn_s *conn,
}
else
{
ninfo("usockid=%d; daemon abruptly closed /usr/usrsock.\n", conn->usockid);
ninfo("usockid=%d; daemon abruptly closed /usr/usrsock.\n",
conn->usockid);
ret = -ESHUTDOWN;
}
@ -1271,7 +1281,8 @@ void usrsockdev_register(void)
nxsem_init(&g_usrsockdev.req.acksem, 0, 0);
nxsem_setprotocol(&g_usrsockdev.req.acksem, SEM_PRIO_NONE);
(void)register_driver("/dev/usrsock", &g_usrsockdevops, 0666, &g_usrsockdev);
(void)register_driver("/dev/usrsock", &g_usrsockdevops, 0666,
&g_usrsockdev);
}
#endif /* CONFIG_NET && CONFIG_NET_USRSOCK */

View file

@ -120,7 +120,9 @@ static uint16_t getpeername_event(FAR struct net_driver_s *dev,
static int do_getpeername_request(FAR struct usrsock_conn_s *conn,
socklen_t addrlen)
{
struct usrsock_request_getpeername_s req = {};
struct usrsock_request_getpeername_s req =
{
};
struct iovec bufs[1];
if (addrlen > UINT16_MAX)
@ -170,7 +172,9 @@ int usrsock_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
struct usrsock_data_reqstate_s state =
{
};
struct iovec inbufs[1];
ssize_t ret;
socklen_t outaddrlen = 0;
@ -185,7 +189,8 @@ int usrsock_getpeername(FAR struct socket *psock,
ninfo("usockid=%d; usrsock_getpeername() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -120,7 +120,9 @@ static uint16_t getsockname_event(FAR struct net_driver_s *dev,
static int do_getsockname_request(FAR struct usrsock_conn_s *conn,
socklen_t addrlen)
{
struct usrsock_request_getsockname_s req = {};
struct usrsock_request_getsockname_s req =
{
};
struct iovec bufs[1];
if (addrlen > UINT16_MAX)
@ -170,7 +172,9 @@ int usrsock_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
struct usrsock_data_reqstate_s state =
{
};
struct iovec inbufs[1];
ssize_t ret;
socklen_t outaddrlen = 0;
@ -185,7 +189,8 @@ int usrsock_getsockname(FAR struct socket *psock,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -60,8 +60,9 @@
* Private Functions
****************************************************************************/
static uint16_t getsockopt_event(FAR struct net_driver_s *dev, FAR void *pvconn,
FAR void *pvpriv, uint16_t flags)
static uint16_t getsockopt_event(FAR struct net_driver_s *dev,
FAR void *pvconn, FAR void *pvpriv,
uint16_t flags)
{
FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
FAR struct usrsock_conn_s *conn = pvconn;
@ -118,7 +119,9 @@ static uint16_t getsockopt_event(FAR struct net_driver_s *dev, FAR void *pvconn,
static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level,
int option, socklen_t value_len)
{
struct usrsock_request_getsockopt_s req = {};
struct usrsock_request_getsockopt_s req =
{
};
struct iovec bufs[1];
if (level < INT16_MIN || level > INT16_MAX)
@ -183,7 +186,9 @@ static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level,
int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
FAR void *value, FAR socklen_t *value_len)
{
struct usrsock_data_reqstate_s state = {};
struct usrsock_data_reqstate_s state =
{
};
struct iovec inbufs[1];
ssize_t ret;
@ -197,7 +202,8 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -119,7 +119,9 @@ static uint16_t ioctl_event(FAR struct net_driver_s *dev,
static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd,
FAR void *arg, size_t arglen)
{
struct usrsock_request_ioctl_s req = {};
struct usrsock_request_ioctl_s req =
{
};
struct iovec bufs[2];
if (arglen > UINT16_MAX)
@ -159,10 +161,13 @@ static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd,
*
****************************************************************************/
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)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
struct usrsock_data_reqstate_s state =
{
};
struct iovec inbufs[1];
int ret;
@ -176,7 +181,8 @@ int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg, size_t argle
ninfo("usockid=%d; ioctl() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -102,7 +102,9 @@ static uint16_t listen_event(FAR struct net_driver_s *dev, FAR void *pvconn,
static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog)
{
struct usrsock_request_listen_s req = {};
struct usrsock_request_listen_s req =
{
};
struct iovec bufs[1];
if (backlog > UINT16_MAX)
@ -155,7 +157,9 @@ static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog)
int usrsock_listen(FAR struct socket *psock, int backlog)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
int ret;
DEBUGASSERT(conn);
@ -170,7 +174,8 @@ int usrsock_listen(FAR struct socket *psock, int backlog)
ninfo("usockid=%d; listen() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNREFUSED;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNREFUSED;
goto errout_unlock;
}

View file

@ -183,7 +183,8 @@ static int usrsock_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
/* Allocate a container to hold the poll information */
info = (FAR struct usrsock_poll_s *)kmm_malloc(sizeof(struct usrsock_poll_s));
info = (FAR struct usrsock_poll_s *)
kmm_malloc(sizeof(struct usrsock_poll_s));
if (!info)
{
return -ENOMEM;
@ -305,7 +306,8 @@ errout_unlock:
*
* Input Parameters:
* psock - An instance of the internal socket structure.
* fds - The structure describing the events to be stopped being monitored.
* fds - The structure describing the events to be stopped being
* monitored.
*
* Returned Value:
* 0: Success; Negated errno on failure

View file

@ -59,8 +59,9 @@
* Private Functions
****************************************************************************/
static uint16_t recvfrom_event(FAR struct net_driver_s *dev, FAR void *pvconn,
FAR void *pvpriv, uint16_t flags)
static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
FAR void *pvconn, FAR void *pvpriv,
uint16_t flags)
{
FAR struct usrsock_data_reqstate_s *pstate = pvpriv;
FAR struct usrsock_conn_s *conn = pvconn;
@ -103,7 +104,8 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev, FAR void *pvconn,
pstate->reqstate.result == -EAGAIN)
{
/* After reception of data, mark input not ready. Daemon will
* send event to restore this flag. */
* send event to restore this flag.
*/
conn->flags &= ~USRSOCK_EVENT_RECVFROM_AVAIL;
}
@ -161,7 +163,9 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev, FAR void *pvconn,
static int do_recvfrom_request(FAR struct usrsock_conn_s *conn, size_t buflen,
socklen_t addrlen)
{
struct usrsock_request_recvfrom_s req = {};
struct usrsock_request_recvfrom_s req =
{
};
struct iovec bufs[1];
if (addrlen > UINT16_MAX)
@ -214,7 +218,9 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
FAR socklen_t *fromlen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_data_reqstate_s state = {};
struct usrsock_data_reqstate_s state =
{
};
struct iovec inbufs[2];
socklen_t addrlen = 0;
socklen_t outaddrlen = 0;
@ -246,7 +252,8 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}
@ -432,7 +439,8 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
if (ret >= 0)
{
/* Store length of 'from' address that was available at
* daemon-side. */
* daemon-side.
*/
outaddrlen = state.valuelen_nontrunc;
}

View file

@ -90,7 +90,8 @@ static uint16_t sendto_event(FAR struct net_driver_s *dev, FAR void *pvconn,
if (pstate->result >= 0 || pstate->result == -EAGAIN)
{
/* After reception of data, mark input not ready. Daemon will
* send event to restore this flag. */
* send event to restore this flag.
*/
conn->flags &= ~USRSOCK_EVENT_SENDTO_READY;
}
@ -152,7 +153,9 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn,
FAR const struct sockaddr *addr,
socklen_t addrlen)
{
struct usrsock_request_sendto_s req = {};
struct usrsock_request_sendto_s req =
{
};
struct iovec bufs[3];
if (addrlen > UINT16_MAX)
@ -210,7 +213,9 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
socklen_t tolen)
{
FAR struct usrsock_conn_s *conn = psock->s_conn;
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
ssize_t ret;
#ifdef CONFIG_NET_SOCKOPTS
struct timespec abstime;
@ -229,7 +234,8 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -60,8 +60,9 @@
* Private Functions
****************************************************************************/
static uint16_t setsockopt_event(FAR struct net_driver_s *dev, FAR void *pvconn,
FAR void *pvpriv, uint16_t flags)
static uint16_t setsockopt_event(FAR struct net_driver_s *dev,
FAR void *pvconn, FAR void *pvpriv,
uint16_t flags)
{
FAR struct usrsock_reqstate_s *pstate = pvpriv;
FAR struct usrsock_conn_s *conn = pvconn;
@ -110,7 +111,9 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn,
int level, int option, FAR const void *value,
socklen_t value_len)
{
struct usrsock_request_setsockopt_s req = {};
struct usrsock_request_setsockopt_s req =
{
};
struct iovec bufs[2];
if (level < INT16_MIN || level > INT16_MAX)
@ -154,7 +157,8 @@ 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 socket on the 'psock'
* argument.
*
* The 'level' argument specifies the protocol level of the option. To set
* options at the socket level, specify the level argument as SOL_SOCKET.
@ -173,7 +177,9 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn,
int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
FAR const void *value, FAR socklen_t value_len)
{
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
ssize_t ret;
DEBUGASSERT(conn);
@ -188,7 +194,8 @@ int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
ninfo("usockid=%d; connect() with uninitialized usrsock.\n",
conn->usockid);
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE : -ECONNRESET;
ret = (conn->state == USRSOCK_CONN_STATE_ABORTED) ? -EPIPE :
-ECONNRESET;
goto errout_unlock;
}

View file

@ -90,7 +90,8 @@ static uint16_t socket_event(FAR struct net_driver_s *dev, FAR void *pvconn,
if (pstate->result >= 0)
{
/* We might start getting events for this socket right after
* returning to daemon, so setup 'conn' already here. */
* returning to daemon, so setup 'conn' already here.
*/
conn->state = USRSOCK_CONN_STATE_READY;
conn->usockid = pstate->result;
@ -117,7 +118,9 @@ static uint16_t socket_event(FAR struct net_driver_s *dev, FAR void *pvconn,
static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain,
int type, int protocol)
{
struct usrsock_request_socket_s req = {};
struct usrsock_request_socket_s req =
{
};
struct iovec bufs[1];
/* Prepare request for daemon to read. */
@ -160,10 +163,11 @@ static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain,
* structure.
*
* Input Parameters:
* 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.
* 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.
*
* Returned Value:
* 0 on success; negative error-code on error
@ -190,9 +194,12 @@ static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain,
*
****************************************************************************/
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)
{
struct usrsock_reqstate_s state = {};
struct usrsock_reqstate_s state =
{
};
FAR struct usrsock_conn_s *conn;
int err;
int ret;

View file

@ -56,7 +56,8 @@
* Private Function Prototypes
****************************************************************************/
static int usrsock_sockif_setup(FAR struct socket *psock, int protocol);
static int usrsock_sockif_setup(FAR struct socket *psock,
int protocol);
static sockcaps_t usrsock_sockif_sockcaps(FAR struct socket *psock);
static void usrsock_sockif_addref(FAR struct socket *psock);
static ssize_t usrsock_sockif_send(FAR struct socket *psock,
@ -105,8 +106,9 @@ const struct sock_intf_s g_usrsock_sockif =
* specific socket fields.
*
* Input Parameters:
* psock A pointer to a user allocated socket structure to be initialized.
* protocol (see sys/socket.h)
* psock - A pointer to a user allocated socket structure to be
* initialized.
* protocol - (see sys/socket.h)
*
* Returned Value:
* Zero (OK) is returned on success. Otherwise, a negated errno value is

View file

@ -1,7 +1,8 @@
/****************************************************************************
* net/utils/net_chksum.c
*
* Copyright (C) 2007-2010, 2012, 2014-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2010, 2012, 2014-2015 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -69,8 +70,9 @@
* data and len.
*
* Input Parameters:
* sum - Partial calculations carried over from a previous call to chksum().
* This should be zero on the first time that check sum is called.
* sum - Partial calculations carried over from a previous call to
* chksum(). This should be zero on the first time that check
* sum is called.
* data - Beginning of the data to include in the checksum.
* len - Length of the data to include in the checksum.
*

View file

@ -1,7 +1,8 @@
/****************************************************************************
* net/utils/net_incr32.c
*
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/****************************************************************************
* net/utils/net_ipchksum.c
*
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017-2018 Gregory Nutt. All
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017-2018 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
@ -100,8 +100,10 @@ uint16_t ipv4_upperlayer_chksum(FAR struct net_driver_s *dev, uint8_t proto)
return 0;
}
/* First sum pseudo-header. */
/* IP protocol and length fields. This addition cannot carry. */
/* First sum pseudo-header.
*
* IP protocol and length fields. This addition cannot carry.
*/
sum = upperlen + proto;
@ -173,7 +175,8 @@ uint16_t ipv6_upperlayer_chksum(FAR struct net_driver_s *dev,
/* Sum IP source and destination addresses. */
sum = chksum(sum, (FAR uint8_t *)&ipv6->srcipaddr, 2 * sizeof(net_ipv6addr_t));
sum = chksum(sum, (FAR uint8_t *)&ipv6->srcipaddr,
2 * sizeof(net_ipv6addr_t));
/* Sum IP payload data. */

View file

@ -1,7 +1,8 @@
/****************************************************************************
* net/utils/net_tcpchksum.c
*
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,8 @@
/****************************************************************************
* net/utils/net_udpchksum.c
*
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1068,20 +1068,20 @@ int main(int argc, char **argv, char **envp)
break;
case '/':
/* C++-style comment */
/* C comment terminator*/
if (line[n] == '/')
if (line[n - 1] == '*')
{
if (line[n - 1] == '*')
{
n++;
}
else if (line[n + 1] == '/')
{
fprintf(stderr, "C++ style comment on at %d:%d\n",
lineno, n);
n++;
}
n++;
}
/* C++-style comment */
else if (line[n + 1] == '/')
{
fprintf(stderr, "C++ style comment on at %d:%d\n",
lineno, n);
n++;
}
/* /= */
@ -1091,6 +1091,9 @@ int main(int argc, char **argv, char **envp)
check_spaces_leftright(line, lineno, n, n + 1);
n++;
}
/* Division operator */
else
{
check_spaces_leftright(line, lineno, n, n);