net/: Run nxstyle against all C files.
This commit is contained in:
parent
6d63ba711b
commit
3b275fcf4e
50 changed files with 157 additions and 64 deletions
|
|
@ -125,8 +125,10 @@ void arp_arpin(FAR struct net_driver_s *dev)
|
|||
|
||||
arp->ah_opcode = HTONS(ARP_REPLY);
|
||||
memcpy(arp->ah_dhwaddr, arp->ah_shwaddr, ETHER_ADDR_LEN);
|
||||
memcpy(arp->ah_shwaddr, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
|
||||
memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
|
||||
memcpy(arp->ah_shwaddr, dev->d_mac.ether.ether_addr_octet,
|
||||
ETHER_ADDR_LEN);
|
||||
memcpy(eth->src, dev->d_mac.ether.ether_addr_octet,
|
||||
ETHER_ADDR_LEN);
|
||||
memcpy(eth->dest, arp->ah_dhwaddr, ETHER_ADDR_LEN);
|
||||
|
||||
arp->ah_dipaddr[0] = arp->ah_sipaddr[0];
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ static const uint16_t g_broadcast_ipaddr[2] =
|
|||
* Well-known ethernet multicast address:
|
||||
*
|
||||
* ADDRESS TYPE USAGE
|
||||
* 01-00-0c-cc-cc-cc 0x0802 CDP (Cisco Discovery Protocol), VTP (Virtual Trunking Protocol)
|
||||
* 01-00-0c-cc-cc-cc 0x0802 CDP (Cisco Discovery Protocol),
|
||||
* VTP (Virtual Trunking Protocol)
|
||||
* 01-00-0c-cc-cc-cd 0x0802 Cisco Shared Spanning Tree Protocol Address
|
||||
* 01-80-c2-00-00-00 0x0802 Spanning Tree Protocol (for bridges) IEEE 802.1D
|
||||
* 01-80-c2-00-00-02 0x0809 Ethernet OAM Protocol IEEE 802.3ah
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ static uint16_t bluetooth_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
|||
}
|
||||
|
||||
/* Make sure that this is the driver to which the socket is bound. */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
pstate = (FAR struct bluetooth_recvfrom_s *)pvpriv;
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ static uint16_t bluetooth_sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||
}
|
||||
|
||||
/* Make sure that this is the driver to which the socket is connected. */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
pstate = (FAR struct bluetooth_sendto_s *)pvpriv;
|
||||
|
|
@ -203,6 +204,7 @@ static uint16_t bluetooth_sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||
return flags;
|
||||
|
||||
errout:
|
||||
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
pstate->is_cb->flags = 0;
|
||||
|
|
|
|||
|
|
@ -466,6 +466,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
|||
{
|
||||
#ifdef NET_TCP_HAVE_STACK
|
||||
case IP_PROTO_TCP: /* TCP input */
|
||||
|
||||
/* Forward the IPv6 TCP packet */
|
||||
|
||||
tcp_ipv6_input(dev, iphdrlen);
|
||||
|
|
@ -502,6 +503,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
|||
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
case IP_PROTO_UDP: /* UDP input */
|
||||
|
||||
/* Forward the IPv6 UDP packet */
|
||||
|
||||
udp_ipv6_input(dev, iphdrlen);
|
||||
|
|
@ -512,6 +514,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
|||
|
||||
#ifdef NET_ICMPv6_HAVE_STACK
|
||||
case IP_PROTO_ICMP6: /* ICMP6 input */
|
||||
|
||||
/* Forward the ICMPv6 packet */
|
||||
|
||||
icmpv6_input(dev, iphdrlen);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ struct icmp_recvfrom_s
|
|||
FAR uint8_t *recv_buf; /* Location to return the response */
|
||||
uint16_t recv_buflen; /* Size of the response */
|
||||
int16_t recv_result; /* >=0: receive size on success;
|
||||
* <0:negated errno on fail */
|
||||
* <0: negated errno on fail */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -300,11 +300,12 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||
* device.
|
||||
*/
|
||||
|
||||
if (!net_ipv4addr_maskcmp(pstate->snd_toaddr, dev->d_ipaddr, dev->d_netmask))
|
||||
if (!net_ipv4addr_maskcmp(pstate->snd_toaddr, dev->d_ipaddr,
|
||||
dev->d_netmask))
|
||||
{
|
||||
/* Destination address was not on the local network served by this
|
||||
* device. If a timeout occurs, then the most likely reason is
|
||||
* that the destination address is not reachable.
|
||||
/* Destination address was not on the local network served by
|
||||
* this device. If a timeout occurs, then the most likely
|
||||
* reason is that the destination address is not reachable.
|
||||
*/
|
||||
|
||||
nerr("ERROR: Not reachable\n");
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ struct icmpv6_recvfrom_s
|
|||
FAR uint8_t *recv_buf; /* Location to return the response */
|
||||
uint16_t recv_buflen; /* Size of the response */
|
||||
int16_t recv_result; /* >=0: receive size on success;
|
||||
* <0:negated errno on fail */
|
||||
* <0: negated errno on fail */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -190,7 +190,8 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
|||
{
|
||||
iaddr = (FAR struct sockaddr_ieee802154_s *)pstate->ir_from;
|
||||
iaddr->sa_family = AF_IEEE802154;
|
||||
memcpy(&iaddr->sa_addr, &container->ic_src, sizeof(struct ieee802154_saddr_s));
|
||||
memcpy(&iaddr->sa_addr, &container->ic_src,
|
||||
sizeof(struct ieee802154_saddr_s));
|
||||
}
|
||||
|
||||
/* Free both the IOB and the container */
|
||||
|
|
@ -237,6 +238,7 @@ static uint16_t ieee802154_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
|||
}
|
||||
|
||||
/* Make sure that this is the driver to which the socket is bound. */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
pstate = (FAR struct ieee802154_recvfrom_s *)pvpriv;
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@ static uint16_t ieee802154_sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||
}
|
||||
|
||||
/* Make sure that this is the driver to which the socket is connected. */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
pstate = (FAR struct ieee802154_sendto_s *)pvpriv;
|
||||
|
|
@ -391,6 +392,7 @@ static uint16_t ieee802154_sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||
return flags;
|
||||
|
||||
errout:
|
||||
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
pstate->is_cb->flags = 0;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ static uint16_t tcp_close_eventhandler(FAR struct net_driver_s *dev,
|
|||
pstate->cl_result = OK;
|
||||
}
|
||||
|
||||
goto end_wait;
|
||||
goto end_wait;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
||||
|
|
|
|||
|
|
@ -853,7 +853,8 @@ static uint16_t inet_tcp_eventhandler(FAR struct net_driver_s *dev,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
static inline void inet_udp_sender(struct net_driver_s *dev, struct inet_recvfrom_s *pstate)
|
||||
static inline void inet_udp_sender(FAR struct net_driver_s *dev,
|
||||
FAR struct inet_recvfrom_s *pstate)
|
||||
{
|
||||
/* Get the family from the packet type, IP address from the IP header, and
|
||||
* the port number from the UDP header.
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ static int ipv4_decr_ttl(FAR struct ipv4_hdr_s *ipv4)
|
|||
{
|
||||
#ifdef CONFIG_NET_ICMP
|
||||
/* Return an ICMP error packet back to the sender. */
|
||||
|
||||
# warning Missing logic
|
||||
#endif
|
||||
|
||||
|
|
@ -488,6 +489,7 @@ int ipv4_forward(FAR struct net_driver_s *dev, FAR struct ipv4_hdr_s *ipv4)
|
|||
*/
|
||||
|
||||
/* Correct dev->d_buf by adding back the L1 header length */
|
||||
|
||||
#endif
|
||||
|
||||
nwarn("WARNING: Packet forwarding to same device not supportedN\n");
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ static int ipv6_decr_ttl(FAR struct ipv6_hdr_s *ipv6)
|
|||
{
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
/* Return an ICMPv6 error packet back to the sender. */
|
||||
|
||||
# warning Missing logic
|
||||
#endif
|
||||
|
||||
|
|
@ -635,6 +636,7 @@ int ipv6_forward(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6)
|
|||
*/
|
||||
|
||||
/* Correct dev->d_buf by adding back the L1 header length */
|
||||
|
||||
#endif
|
||||
|
||||
/* Nothing other 6LoWPAN forwarding is currently handled and that
|
||||
|
|
|
|||
|
|
@ -369,12 +369,14 @@ psock_dgram_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
|||
return readlen;
|
||||
|
||||
errout_with_infd:
|
||||
|
||||
/* Close the read-only file descriptor */
|
||||
|
||||
file_close(&conn->lc_infile);
|
||||
conn->lc_infile.f_inode = NULL;
|
||||
|
||||
errout_with_halfduplex:
|
||||
|
||||
/* Release our reference to the half duplex FIFO */
|
||||
|
||||
(void)local_release_halfduplex(conn);
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
conn->lc_outfile.f_inode = NULL;
|
||||
|
||||
errout_with_halfduplex:
|
||||
|
||||
/* Release our reference to the half duplex FIFO */
|
||||
|
||||
(void)local_release_halfduplex(conn);
|
||||
|
|
|
|||
|
|
@ -553,6 +553,7 @@ static int local_connect(FAR struct socket *psock,
|
|||
case SOCK_DGRAM:
|
||||
{
|
||||
/* Perform the datagram connection logic */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
return -ENOSYS;
|
||||
|
|
@ -697,6 +698,7 @@ static ssize_t local_send(FAR struct socket *psock, FAR const void *buf,
|
|||
case SOCK_DGRAM:
|
||||
{
|
||||
/* Local UDP packet send */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
ret = -ENOSYS;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group,
|
|||
mlderr("Bad msgtype: %02x \n", msgtype);
|
||||
DEBUGPANIC();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,8 @@ static int ioctl_add_ipv6route(FAR struct rtentry *rtentry)
|
|||
net_ipv6addr_copy(router, in6addr_any.s6_addr16);
|
||||
}
|
||||
|
||||
return net_addroute_ipv6(target->sin6_addr.s6_addr16, netmask->sin6_addr.s6_addr16, router);
|
||||
return net_addroute_ipv6(target->sin6_addr.s6_addr16,
|
||||
netmask->sin6_addr.s6_addr16, router);
|
||||
}
|
||||
#endif /* HAVE_WRITABLE_IPv6ROUTE */
|
||||
|
||||
|
|
@ -1553,18 +1554,21 @@ ssize_t net_ioctl_arglen(int cmd)
|
|||
return sizeof(struct iwreq);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_WIRELESS_IEEE802154
|
||||
if (_MAC802154IOCVALID(cmd))
|
||||
{
|
||||
return sizeof(struct ieee802154_netmac_s);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_WIRELESS_PKTRADIO
|
||||
if (WL_ISPKTRADIOCMD(cmd))
|
||||
{
|
||||
return sizeof(struct pktradio_ifreq_s);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_WIRELESS_BLUETOOTH
|
||||
if (WL_IBLUETOOTHCMD(cmd))
|
||||
{
|
||||
|
|
@ -1572,6 +1576,7 @@ ssize_t net_ioctl_arglen(int cmd)
|
|||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,9 +425,12 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
|||
|
||||
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_DRIVERS_IEEE80211)
|
||||
ninfo("Registered MAC: %02x:%02x:%02x:%02x:%02x:%02x as dev: %s\n",
|
||||
dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
|
||||
dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
|
||||
dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5],
|
||||
dev->d_mac.ether.ether_addr_octet[0],
|
||||
dev->d_mac.ether.ether_addr_octet[1],
|
||||
dev->d_mac.ether.ether_addr_octet[2],
|
||||
dev->d_mac.ether.ether_addr_octet[3],
|
||||
dev->d_mac.ether.ether_addr_octet[4],
|
||||
dev->d_mac.ether.ether_addr_octet[5],
|
||||
dev->d_ifname);
|
||||
#else
|
||||
ninfo("Registered dev: %s\n", dev->d_ifname);
|
||||
|
|
@ -437,4 +440,3 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
|||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -550,6 +550,7 @@ static int netlink_close(FAR struct socket *psock)
|
|||
if (conn->crefs <= 1)
|
||||
{
|
||||
/* Yes... inform user-space daemon of socket close. */
|
||||
|
||||
#warning Missing logic
|
||||
|
||||
/* Free the connection structure */
|
||||
|
|
|
|||
|
|
@ -299,6 +299,7 @@ static ssize_t netprocfs_read(FAR struct file *filep, FAR char *buffer,
|
|||
switch (priv->entry)
|
||||
{
|
||||
case NETPROCFS_SUBDIR_DEV:
|
||||
|
||||
/* Show device-specific statistics */
|
||||
|
||||
nreturned = netprocfs_read_devstats(priv, buffer, buflen);
|
||||
|
|
@ -306,6 +307,7 @@ static ssize_t netprocfs_read(FAR struct file *filep, FAR char *buffer,
|
|||
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
case NETPROCFS_SUBDIR_STAT:
|
||||
|
||||
/* Show the network layer statistics */
|
||||
|
||||
nreturned = netprocfs_read_netstats(priv, buffer, buflen);
|
||||
|
|
@ -313,6 +315,7 @@ static ssize_t netprocfs_read(FAR struct file *filep, FAR char *buffer,
|
|||
|
||||
#ifdef CONFIG_NET_MLD
|
||||
case NETPROCFS_SUBDIR_MLD:
|
||||
|
||||
/* Show the MLD statistics */
|
||||
|
||||
nreturned = netprocfs_read_mldstats(priv, buffer, buflen);
|
||||
|
|
@ -362,7 +365,8 @@ static int netprocfs_dup(FAR const struct file *oldp, FAR struct file *newp)
|
|||
|
||||
/* Allocate a new container to hold the task and attribute selection */
|
||||
|
||||
newpriv = (FAR struct netprocfs_file_s *)kmm_zalloc(sizeof(struct netprocfs_file_s));
|
||||
newpriv = (FAR struct netprocfs_file_s *)
|
||||
kmm_zalloc(sizeof(struct netprocfs_file_s));
|
||||
if (!newpriv)
|
||||
{
|
||||
ferr("ERROR: Failed to allocate file attributes\n");
|
||||
|
|
|
|||
|
|
@ -638,6 +638,7 @@ static int route_opendir(FAR const char *relpath,
|
|||
return -ENOTDIR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
if (strcmp(relpath, g_route_ipv6_path) == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -241,8 +241,9 @@ static FAR struct sixlowpan_addrcontext_s *
|
|||
net_ipv6addr_prefixcmp(&g_hc06_addrcontexts[i].prefix, ipaddr, 64))
|
||||
{
|
||||
ninfo("Context found for ipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x Context: %d\n",
|
||||
ntohs(ipaddr[0]), ntohs(ipaddr[1]), ntohs(ipaddr[2]), ntohs(ipaddr[3]),
|
||||
ntohs(ipaddr[4]), ntohs(ipaddr[5]), ntohs(ipaddr[6]), ntohs(ipaddr[7]),
|
||||
ntohs(ipaddr[0]), ntohs(ipaddr[1]), ntohs(ipaddr[2]),
|
||||
ntohs(ipaddr[3]), ntohs(ipaddr[4]), ntohs(ipaddr[5]),
|
||||
ntohs(ipaddr[6]), ntohs(ipaddr[7]),
|
||||
g_hc06_addrcontexts[i].number);
|
||||
|
||||
return &g_hc06_addrcontexts[i];
|
||||
|
|
@ -1406,6 +1407,7 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
|
|||
switch (*g_hc06ptr & SIXLOWPAN_NHC_UDP_CS_P_11)
|
||||
{
|
||||
case SIXLOWPAN_NHC_UDP_CS_P_00:
|
||||
|
||||
/* 1 byte for NHC, 4 byte for ports, 2 bytes chksum */
|
||||
|
||||
memcpy(&udp->srcport, g_hc06ptr + 1, 2);
|
||||
|
|
@ -1418,6 +1420,7 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
|
|||
break;
|
||||
|
||||
case SIXLOWPAN_NHC_UDP_CS_P_01:
|
||||
|
||||
/* 1 byte for NHC + source 16bit inline, dest = 0xF0 + 8 bit
|
||||
* inline
|
||||
*/
|
||||
|
|
@ -1435,6 +1438,7 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
|
|||
break;
|
||||
|
||||
case SIXLOWPAN_NHC_UDP_CS_P_10:
|
||||
|
||||
/* 1 byte for NHC + source = 0xF0 + 8bit inline, dest = 16 bit
|
||||
* inline
|
||||
*/
|
||||
|
|
@ -1452,6 +1456,7 @@ void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
|
|||
break;
|
||||
|
||||
case SIXLOWPAN_NHC_UDP_CS_P_11:
|
||||
|
||||
/* 1 byte for NHC, 1 byte for ports */
|
||||
|
||||
udp->srcport =
|
||||
|
|
|
|||
|
|
@ -342,7 +342,8 @@ static int sixlowpan_frame_process(FAR struct radio_driver_s *radio,
|
|||
|
||||
if (fragsize > CONFIG_NET_6LOWPAN_PKTSIZE)
|
||||
{
|
||||
nwarn("WARNING: Reassembled packet size exeeds CONFIG_NET_6LOWPAN_PKTSIZE\n");
|
||||
nwarn("WARNING: Reassembled packet size exceeds "
|
||||
"CONFIG_NET_6LOWPAN_PKTSIZE\n");
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +449,8 @@ static int sixlowpan_frame_process(FAR struct radio_driver_s *radio,
|
|||
hc1 = fptr + g_frame_hdrlen;
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06
|
||||
if ((hc1[SIXLOWPAN_HC1_DISPATCH] & SIXLOWPAN_DISPATCH_IPHC_MASK) == SIXLOWPAN_DISPATCH_IPHC)
|
||||
if ((hc1[SIXLOWPAN_HC1_DISPATCH] & SIXLOWPAN_DISPATCH_IPHC_MASK) ==
|
||||
SIXLOWPAN_DISPATCH_IPHC)
|
||||
{
|
||||
ninfo("IPHC Dispatch\n");
|
||||
sixlowpan_uncompresshdr_hc06(radio, metadata, fragsize, iob, fptr, bptr);
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ static uint16_t send_eventhandler(FAR struct net_driver_s *dev,
|
|||
return flags;
|
||||
|
||||
end_wait:
|
||||
|
||||
/* Do not allow any further callbacks */
|
||||
|
||||
sinfo->s_cb->flags = 0;
|
||||
|
|
|
|||
|
|
@ -603,6 +603,7 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
|
|||
return flags;
|
||||
|
||||
end_wait:
|
||||
|
||||
/* Do not allow any further callbacks */
|
||||
|
||||
sinfo->s_cb->flags = 0;
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio,
|
|||
{
|
||||
srcaddr->nv_addrlen = NET_6LOWPAN_EADDRSIZE;
|
||||
memcpy(srcaddr->nv_addr, ind->src.eaddr, NET_6LOWPAN_EADDRSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int psock_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
|
||||
int psock_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen)
|
||||
{
|
||||
/* Verify that the psock corresponds to valid, allocated socket */
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int psock_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
|
||||
int psock_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen)
|
||||
{
|
||||
/* Verify that the psock corresponds to valid, allocated socket */
|
||||
|
||||
|
|
|
|||
|
|
@ -204,45 +204,51 @@ int psock_vfcntl(FAR struct socket *psock, int cmd, va_list ap)
|
|||
break;
|
||||
|
||||
case F_GETOWN:
|
||||
/* If fd refers to a socket, get the process or process group ID specified
|
||||
* to receive SIGURG signals when out-of-band data is available. Positive values
|
||||
* indicate a process ID; negative values, other than -1, indicate a process group
|
||||
* ID. If fd does not refer to a socket, the results are unspecified.
|
||||
/* If fd refers to a socket, get the process or process group ID
|
||||
* specified to receive SIGURG signals when out-of-band data is
|
||||
* available. Positive values indicate a process ID; negative
|
||||
* values, other than -1, indicate a process group ID. If fd does
|
||||
* not refer to a socket, the results are unspecified.
|
||||
*/
|
||||
|
||||
case F_SETOWN:
|
||||
/* If fd refers to a socket, set the process or process group ID specified
|
||||
* to receive SIGURG signals when out-of-band data is available, using the value
|
||||
* of the third argument, arg, taken as type int. Positive values indicate a
|
||||
* process ID; negative values, other than -1, indicate a process group ID. If
|
||||
* fd does not refer to a socket, the results are unspecified.
|
||||
/* If fd refers to a socket, set the process or process group ID
|
||||
* specified to receive SIGURG signals when out-of-band data is
|
||||
* available, using the value of the third argument, arg, taken as
|
||||
* type int. Positive values indicate a process ID; negative values,
|
||||
* other than -1, indicate a process group ID. If fd does not refer
|
||||
* to a socket, the results are unspecified.
|
||||
*/
|
||||
|
||||
case F_GETLK:
|
||||
/* Get the first lock which blocks the lock description pointed to by the third
|
||||
* argument, arg, taken as a pointer to type struct flock, defined in <fcntl.h>.
|
||||
* The information retrieved shall overwrite the information passed to fcntl() in
|
||||
* the structure flock. If no lock is found that would prevent this lock from being
|
||||
* created, then the structure shall be left unchanged except for the lock type
|
||||
* which shall be set to F_UNLCK.
|
||||
/* Get the first lock which blocks the lock description pointed to
|
||||
* by the third argument, arg, taken as a pointer to type struct
|
||||
* flock, defined in <fcntl.h>. The information retrieved shall
|
||||
* overwrite the information passed to fcntl() in the structure
|
||||
* flock. If no lock is found that would prevent this lock from
|
||||
* being created, then the structure shall be left unchanged except
|
||||
* for the lock type which shall be set to F_UNLCK.
|
||||
*/
|
||||
|
||||
case F_SETLK:
|
||||
/* Set or clear a file segment lock according to the lock description pointed to
|
||||
* by the third argument, arg, taken as a pointer to type struct flock, defined in
|
||||
* <fcntl.h>. F_SETLK can establish shared (or read) locks (F_RDLCK) or exclusive
|
||||
* (or write) locks (F_WRLCK), as well as to remove either type of lock (F_UNLCK).
|
||||
* F_RDLCK, F_WRLCK, and F_UNLCK are defined in <fcntl.h>. If a shared or exclusive
|
||||
* lock cannot be set, fcntl() shall return immediately with a return value of -1.
|
||||
/* Set or clear a file segment lock according to the lock
|
||||
* description pointed to by the third argument, arg, taken as a
|
||||
* pointer to type struct flock, defined in <fcntl.h>. F_SETLK can
|
||||
* establish shared (or read) locks (F_RDLCK) or exclusive (or
|
||||
* write) locks (F_WRLCK), as well as to remove either type of
|
||||
* lock (F_UNLCK). F_RDLCK, F_WRLCK, and F_UNLCK are defined in
|
||||
* <fcntl.h>. If a shared or exclusive lock cannot be set, fcntl()
|
||||
* shall return immediately with a return value of -1.
|
||||
*/
|
||||
|
||||
case F_SETLKW:
|
||||
/* This command shall be equivalent to F_SETLK except that if a shared or exclusive
|
||||
* lock is blocked by other locks, the thread shall wait until the request can be
|
||||
* satisfied. If a signal that is to be caught is received while fcntl() is waiting
|
||||
* for a region, fcntl() shall be interrupted. Upon return from the signal handler,
|
||||
* fcntl() shall return -1 with errno set to [EINTR], and the lock operation shall
|
||||
* not be done.
|
||||
/* This command shall be equivalent to F_SETLK except that if a
|
||||
* shared or exclusive lock is blocked by other locks, the thread
|
||||
* shall wait until the request can be satisfied. If a signal that
|
||||
* is to be caught is received while fcntl() is waiting for a
|
||||
* region, fcntl() shall be interrupted. Upon return from the signal
|
||||
* handler, fcntl() shall return -1 with errno set to [EINTR], and
|
||||
* the lock operation shall not be done.
|
||||
*/
|
||||
|
||||
ret = -ENOSYS; /* F_GETOWN, F_SETOWN, F_GETLK, F_SETLK, F_SETLKW */
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
i += dev->d_buf[hdrlen + 1 + i];
|
||||
}
|
||||
}
|
||||
|
|
@ -703,6 +704,7 @@ found:
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
i += dev->d_buf[hdrlen + 1 + i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,6 +310,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||
switch (conn->tcpstateflags & TCP_STATE_MASK)
|
||||
{
|
||||
case TCP_SYN_RCVD:
|
||||
|
||||
/* In the SYN_RCVD state, we should retransmit our
|
||||
* SYNACK.
|
||||
*/
|
||||
|
|
@ -318,12 +319,14 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||
goto done;
|
||||
|
||||
case TCP_SYN_SENT:
|
||||
|
||||
/* In the SYN_SENT state, we retransmit out SYN. */
|
||||
|
||||
tcp_ack(dev, conn, TCP_SYN);
|
||||
goto done;
|
||||
|
||||
case TCP_ESTABLISHED:
|
||||
|
||||
/* In the ESTABLISHED state, we call upon the application
|
||||
* to do the actual retransmit after which we jump into
|
||||
* the code for sending out the packet.
|
||||
|
|
@ -336,6 +339,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||
case TCP_FIN_WAIT_1:
|
||||
case TCP_CLOSING:
|
||||
case TCP_LAST_ACK:
|
||||
|
||||
/* In all these states we should retransmit a FINACK. */
|
||||
|
||||
tcp_send(dev, conn, TCP_FIN | TCP_ACK, hdrlen);
|
||||
|
|
@ -467,6 +471,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* There was no need for a retransmission and there was no
|
||||
* need to probe the remote peer. We poll the application for
|
||||
* new outgoing data.
|
||||
|
|
|
|||
|
|
@ -159,20 +159,20 @@ int tcp_txdrain(FAR struct socket *psock,
|
|||
|
||||
ret = tcp_disconnect_notifier_setup(txdrain_worker, conn, &waitsem);
|
||||
|
||||
/* Zero is a special value that means that no connection has been
|
||||
* established. Otherwise it is a special 'key' that can be used
|
||||
* to teardown the notification later
|
||||
*/
|
||||
/* Zero is a special value that means that no connection has been
|
||||
* established. Otherwise it is a special 'key' that can be used
|
||||
* to teardown the notification later
|
||||
*/
|
||||
|
||||
if (ret > 0)
|
||||
{
|
||||
/* Save the disconnect key */
|
||||
if (ret > 0)
|
||||
{
|
||||
/* Save the disconnect key */
|
||||
|
||||
int disconn_key = ret;
|
||||
int disconn_key = ret;
|
||||
|
||||
/* There is pending write data and the socket is connected..
|
||||
* wait for it to drain or be be disconnected.
|
||||
*/
|
||||
/* There is pending write data and the socket is connected..
|
||||
* wait for it to drain or be be disconnected.
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_UDP_READAHEAD
|
||||
static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn,
|
||||
static uint16_t udp_datahandler(FAR struct net_driver_s *dev,
|
||||
FAR struct udp_conn_s *conn,
|
||||
FAR uint8_t *buffer, uint16_t buflen)
|
||||
{
|
||||
FAR struct iob_s *iob;
|
||||
|
|
@ -87,12 +88,14 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con
|
|||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
FAR struct sockaddr_in src_addr4 =
|
||||
{
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
FAR void *src_addr;
|
||||
uint8_t src_addr_size;
|
||||
|
||||
|
|
|
|||
|
|
@ -561,6 +561,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
ret = state.st_sndlen;
|
||||
|
||||
errout_with_lock:
|
||||
|
||||
/* Release the semaphore */
|
||||
|
||||
nxsem_destroy(&state.st_sem);
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ static int do_accept_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_accept_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
if (addrlen > UINT16_MAX)
|
||||
|
|
@ -233,6 +234,7 @@ int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
struct usrsock_data_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
FAR struct usrsock_conn_s *newconn;
|
||||
struct iovec inbufs[2];
|
||||
socklen_t inaddrlen = 0;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ static int do_bind_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_bind_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[2];
|
||||
|
||||
/* Prepare request for daemon to read. */
|
||||
|
|
@ -170,6 +171,7 @@ int usrsock_bind(FAR struct socket *psock,
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
ssize_t ret;
|
||||
|
||||
DEBUGASSERT(conn);
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ static int do_close_request(FAR struct usrsock_conn_s *conn)
|
|||
struct usrsock_request_close_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
/* Prepare request for daemon to read. */
|
||||
|
|
@ -140,6 +141,7 @@ int usrsock_close(FAR struct usrsock_conn_s *conn)
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
int ret;
|
||||
|
||||
net_lock();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ static int do_connect_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_connect_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[2];
|
||||
|
||||
if (addrlen > UINT16_MAX)
|
||||
|
|
@ -162,6 +163,7 @@ int usrsock_connect(FAR struct socket *psock,
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(conn);
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ static int do_getpeername_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_getpeername_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
if (addrlen > UINT16_MAX)
|
||||
|
|
@ -175,6 +176,7 @@ int usrsock_getpeername(FAR struct socket *psock,
|
|||
struct usrsock_data_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec inbufs[1];
|
||||
ssize_t ret;
|
||||
socklen_t outaddrlen = 0;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ static int do_getsockname_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_getsockname_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
if (addrlen > UINT16_MAX)
|
||||
|
|
@ -175,6 +176,7 @@ int usrsock_getsockname(FAR struct socket *psock,
|
|||
struct usrsock_data_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec inbufs[1];
|
||||
ssize_t ret;
|
||||
socklen_t outaddrlen = 0;
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ static int do_getsockopt_request(FAR struct usrsock_conn_s *conn, int level,
|
|||
struct usrsock_request_getsockopt_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
if (level < INT16_MIN || level > INT16_MAX)
|
||||
|
|
@ -189,6 +190,7 @@ int usrsock_getsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
|
|||
struct usrsock_data_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec inbufs[1];
|
||||
ssize_t ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ static int do_ioctl_request(FAR struct usrsock_conn_s *conn, int cmd,
|
|||
struct usrsock_request_ioctl_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[2];
|
||||
|
||||
if (arglen > UINT16_MAX)
|
||||
|
|
@ -168,6 +169,7 @@ int usrsock_ioctl(FAR struct socket *psock, int cmd, FAR void *arg,
|
|||
struct usrsock_data_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec inbufs[1];
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ static int do_listen_request(FAR struct usrsock_conn_s *conn, int backlog)
|
|||
struct usrsock_request_listen_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
if (backlog > UINT16_MAX)
|
||||
|
|
@ -160,6 +161,7 @@ int usrsock_listen(FAR struct socket *psock, int backlog)
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(conn);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ static int do_recvfrom_request(FAR struct usrsock_conn_s *conn, size_t buflen,
|
|||
struct usrsock_request_recvfrom_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
if (addrlen > UINT16_MAX)
|
||||
|
|
@ -221,6 +222,7 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
|||
struct usrsock_data_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec inbufs[2];
|
||||
socklen_t addrlen = 0;
|
||||
socklen_t outaddrlen = 0;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_sendto_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[3];
|
||||
|
||||
if (addrlen > UINT16_MAX)
|
||||
|
|
@ -216,6 +217,7 @@ ssize_t usrsock_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
ssize_t ret;
|
||||
#ifdef CONFIG_NET_SOCKOPTS
|
||||
struct timespec abstime;
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ static int do_setsockopt_request(FAR struct usrsock_conn_s *conn,
|
|||
struct usrsock_request_setsockopt_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[2];
|
||||
|
||||
if (level < INT16_MIN || level > INT16_MAX)
|
||||
|
|
@ -180,6 +181,7 @@ int usrsock_setsockopt(FAR struct usrsock_conn_s *conn, int level, int option,
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
ssize_t ret;
|
||||
|
||||
DEBUGASSERT(conn);
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ static int do_socket_request(FAR struct usrsock_conn_s *conn, int domain,
|
|||
struct usrsock_request_socket_s req =
|
||||
{
|
||||
};
|
||||
|
||||
struct iovec bufs[1];
|
||||
|
||||
/* Prepare request for daemon to read. */
|
||||
|
|
@ -200,6 +201,7 @@ int usrsock_socket(int domain, int type, int protocol,
|
|||
struct usrsock_reqstate_s state =
|
||||
{
|
||||
};
|
||||
|
||||
FAR struct usrsock_conn_s *conn;
|
||||
int err;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ static int usrsock_sockif_setup(FAR struct socket *psock, int protocol)
|
|||
return -ENETDOWN;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NET_USRSOCK_TCP
|
||||
if (type == SOCK_STREAM)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue