mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
net: use HTONS, NTOHS, HTONL, NTOHL macro in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
@@ -946,7 +946,7 @@ static int c5471_transmit(struct c5471_driver_s *priv)
|
||||
{
|
||||
/* 16-bits at a time. */
|
||||
|
||||
packetmem[i] = htons(((uint16_t *)dev->d_buf)[j]);
|
||||
packetmem[i] = HTONS(((uint16_t *)dev->d_buf)[j]);
|
||||
}
|
||||
|
||||
putreg32(((getreg32(priv->c_rxcpudesc) & ~EIM_RXDESC_BYTEMASK) |
|
||||
@@ -1257,7 +1257,7 @@ static void c5471_receive(struct c5471_driver_s *priv)
|
||||
* 16-bits at a time.
|
||||
*/
|
||||
|
||||
((uint16_t *)dev->d_buf)[j] = htons(packetmem[i]);
|
||||
((uint16_t *)dev->d_buf)[j] = HTONS(packetmem[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1314,7 +1314,7 @@ static void c5471_receive(struct c5471_driver_s *priv)
|
||||
|
||||
dev->d_len = packetlen;
|
||||
ninfo("Received packet, packetlen: %d type: %02x\n",
|
||||
packetlen, ntohs(BUF->type));
|
||||
packetlen, NTOHS(BUF->type));
|
||||
c5471_dumpbuffer("Received packet", dev->d_buf, dev->d_len);
|
||||
|
||||
#ifdef CONFIG_NET_PKT
|
||||
|
||||
@@ -817,7 +817,7 @@ static inline void imx_dispatch(FAR struct imx_driver_s *priv)
|
||||
#ifdef CONFIG_NET_ARP
|
||||
/* Check for an ARP packet */
|
||||
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
arp_arpin(&priv->dev);
|
||||
|
||||
@@ -775,7 +775,7 @@ static inline void imxrt_dispatch(FAR struct imxrt_driver_s *priv)
|
||||
#ifdef CONFIG_NET_ARP
|
||||
/* Check for an ARP packet */
|
||||
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
arp_arpin(&priv->dev);
|
||||
|
||||
@@ -718,7 +718,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
arp_arpin(&priv->dev);
|
||||
|
||||
@@ -1041,7 +1041,7 @@ static void lpc17_40_rxdone_work(FAR void *arg)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->lp_dev);
|
||||
arp_arpin(&priv->lp_dev);
|
||||
|
||||
@@ -1718,7 +1718,7 @@ static void lpc43_receive(FAR struct lpc43_ethmac_s *priv)
|
||||
else
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -1005,7 +1005,7 @@ static void lpc54_eth_rxdispatch(struct lpc54_ethdriver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
||||
if (ETHBUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
struct lpc54_txring_s *txring;
|
||||
unsigned int chan;
|
||||
|
||||
@@ -195,7 +195,7 @@ void amebaz_netdev_notify_receive(FAR struct amebaz_dev_s *priv,
|
||||
{
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (hdr->type == htons(ETHTYPE_ARP))
|
||||
if (hdr->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->dev);
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
|
||||
@@ -770,7 +770,7 @@ static inline void s32k1xx_dispatch(FAR struct s32k1xx_driver_s *priv)
|
||||
#ifdef CONFIG_NET_ARP
|
||||
/* Check for an ARP packet */
|
||||
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
arp_arpin(&priv->dev);
|
||||
|
||||
@@ -1299,7 +1299,7 @@ static void sam_receive(struct sam_emac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -1362,7 +1362,7 @@ static void sam_receive(struct sam_emac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -1673,7 +1673,7 @@ static void sam_receive(struct sam_emac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -1308,7 +1308,7 @@ static void sam_receive(struct sam_gmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -1291,7 +1291,7 @@ static void sam_receive(struct sam_gmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -2013,7 +2013,7 @@ static void sam_receive(struct sam_emac_s *priv, int qid)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
|
||||
@@ -1839,7 +1839,7 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
@@ -3690,7 +3690,7 @@ static int stm32_ethreset(FAR struct stm32_ethmac_s *priv)
|
||||
while (((stm32_getreg(STM32_ETH_DMABMR) & ETH_DMABMR_SR) != 0) &&
|
||||
retries > 0)
|
||||
{
|
||||
retries --;
|
||||
retries--;
|
||||
up_mdelay(10);
|
||||
}
|
||||
|
||||
|
||||
@@ -1920,7 +1920,7 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -2027,7 +2027,7 @@ static void stm32_receive(struct stm32_ethmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -892,7 +892,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
||||
if (ETHBUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP packet received (%02x)\n", ETHBUF->type);
|
||||
NETDEV_RXARP(&priv->ld_dev);
|
||||
@@ -912,7 +912,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
||||
#endif
|
||||
{
|
||||
nwarn("WARNING: Unsupported packet type dropped (%02x)\n",
|
||||
htons(ETHBUF->type));
|
||||
HTONS(ETHBUF->type));
|
||||
NETDEV_RXDROPPED(&priv->ld_dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1815,7 +1815,7 @@ static void tiva_receive(FAR struct tiva_ethmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ static void emac_receive(FAR struct emac_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->d_dev);
|
||||
|
||||
|
||||
@@ -1549,7 +1549,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
/* Handle the incoming ARP packet */
|
||||
|
||||
@@ -1572,7 +1572,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
||||
/* Unrecognized... drop it. */
|
||||
|
||||
nerr("ERROR: Unrecognized packet type dropped: %04x\n",
|
||||
ntohs(BUF->type));
|
||||
NTOHS(BUF->type));
|
||||
NETDEV_RXDROPPED(&priv->pd_dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -1666,7 +1666,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
/* Handle the incoming ARP packet */
|
||||
|
||||
@@ -1689,7 +1689,7 @@ static void pic32mz_rxdone(struct pic32mz_driver_s *priv)
|
||||
/* Unrecognized... drop it. */
|
||||
|
||||
nwarn("WARNING: Unrecognized packet type dropped: %04x\n",
|
||||
ntohs(BUF->type));
|
||||
NTOHS(BUF->type));
|
||||
NETDEV_RXDROPPED(&priv->pd_dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ static void misoc_net_receive(FAR struct misoc_net_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->misoc_net_dev);
|
||||
NETDEV_RXARP(&priv->misoc_net_dev);
|
||||
|
||||
@@ -1635,7 +1635,7 @@ static void rx65n_receive(FAR struct rx65n_ethmac_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
@@ -3646,7 +3646,7 @@ static int rx65n_ethreset(FAR struct rx65n_ethmac_s *priv)
|
||||
while (((rx65n_getreg(RX65N_ETHD_EDMR) & ETHD_EDMR_SWR) != 0) &&
|
||||
retries > 0)
|
||||
{
|
||||
retries --;
|
||||
retries--;
|
||||
up_mdelay(10);
|
||||
}
|
||||
|
||||
@@ -3703,7 +3703,7 @@ static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv)
|
||||
while (((rx65n_getreg(RX65N_ETHD_EDMR) & ETHD_EDMR_SWR) != 0) &&
|
||||
retries > 0)
|
||||
{
|
||||
retries --;
|
||||
retries--;
|
||||
up_mdelay(10);
|
||||
}
|
||||
|
||||
|
||||
@@ -607,7 +607,7 @@ static void bl602_net_receive(struct bl602_net_driver_s *priv)
|
||||
#ifdef CONFIG_NET_ARP
|
||||
/* Check for an ARP packet */
|
||||
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
/* Dispatch ARP packet to the network layer */
|
||||
|
||||
|
||||
@@ -805,7 +805,7 @@ static void wlan_rxpoll(void *arg)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (eth_hdr->type == htons(ETHTYPE_ARP))
|
||||
if (eth_hdr->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ static void netdriver_recv_work(FAR void *arg)
|
||||
else
|
||||
#endif/* CONFIG_NET_IPv6 */
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (eth->type == htons(ETHTYPE_ARP))
|
||||
if (eth->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
NETDEV_RXARP(dev);
|
||||
|
||||
@@ -261,7 +261,7 @@ void wpcap_init(void)
|
||||
struct in_addr addr;
|
||||
FARPROC dlladdr;
|
||||
|
||||
addr.s_addr = htonl(WCAP_IPADDR);
|
||||
addr.s_addr = HTONL(WCAP_IPADDR);
|
||||
syslog(LOG_INFO, "wpcap_init: IP address: %s\n", inet_ntoa(addr));
|
||||
|
||||
wpcap = LoadLibrary("wpcap.dll");
|
||||
|
||||
@@ -1449,7 +1449,7 @@ static void emac_rx_interrupt_work(void *arg)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (eth_hdr->type == htons(ETHTYPE_ARP))
|
||||
if (eth_hdr->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -802,7 +802,7 @@ static void wlan_rxpoll(void *arg)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (eth_hdr->type == htons(ETHTYPE_ARP))
|
||||
if (eth_hdr->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
|
||||
|
||||
@@ -1496,7 +1496,7 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (ETHBUF->type == htons(ETHTYPE_ARP))
|
||||
if (ETHBUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP packet received (%02x)\n", ETHBUF->type);
|
||||
EMAC_STAT(priv, rx_arp);
|
||||
|
||||
@@ -221,8 +221,8 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
/* From this, we can get the offset to the list of relocation entries */
|
||||
|
||||
offset = ntohl(hdr->h_relocstart);
|
||||
nrelocs = ntohs(hdr->h_reloccount);
|
||||
offset = NTOHL(hdr->h_relocstart);
|
||||
nrelocs = NTOHS(hdr->h_reloccount);
|
||||
binfo("offset: %08lx nrelocs: %d\n", (long)offset, nrelocs);
|
||||
|
||||
/* The value of the relocation list that we get from the header is a
|
||||
@@ -395,8 +395,8 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
* this module and the number of symbols imported by this module.
|
||||
*/
|
||||
|
||||
offset = ntohl(hdr->h_importsymbols);
|
||||
nimports = ntohs(hdr->h_importcount);
|
||||
offset = NTOHL(hdr->h_importsymbols);
|
||||
nimports = NTOHS(hdr->h_importcount);
|
||||
binfo("Imports offset: %08" PRIx32 " nimports: %d\n", offset, nimports);
|
||||
|
||||
/* The import[] table resides within the D-Space allocation. If
|
||||
|
||||
@@ -137,9 +137,9 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
* network order.
|
||||
*/
|
||||
|
||||
datastart = ntohl(loadinfo->header.h_datastart);
|
||||
dataend = ntohl(loadinfo->header.h_dataend);
|
||||
bssend = ntohl(loadinfo->header.h_bssend);
|
||||
datastart = NTOHL(loadinfo->header.h_datastart);
|
||||
dataend = NTOHL(loadinfo->header.h_dataend);
|
||||
bssend = NTOHL(loadinfo->header.h_bssend);
|
||||
|
||||
/* And put this information into the loadinfo structure as well.
|
||||
*
|
||||
@@ -150,12 +150,12 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
* bsssize = the address range from dataend up to bssend.
|
||||
*/
|
||||
|
||||
loadinfo->entryoffs = ntohl(loadinfo->header.h_entry);
|
||||
loadinfo->entryoffs = NTOHL(loadinfo->header.h_entry);
|
||||
loadinfo->isize = datastart;
|
||||
|
||||
loadinfo->datasize = dataend - datastart;
|
||||
loadinfo->bsssize = bssend - dataend;
|
||||
loadinfo->stacksize = ntohl(loadinfo->header.h_stacksize);
|
||||
loadinfo->stacksize = NTOHL(loadinfo->header.h_stacksize);
|
||||
|
||||
/* This is the initial dspace size. We'll re-calculate this later
|
||||
* after the memory has been allocated.
|
||||
@@ -167,7 +167,7 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
* this later).
|
||||
*/
|
||||
|
||||
loadinfo->relocstart = ntohl(loadinfo->header.h_relocstart);
|
||||
loadinfo->relocstart = NTOHL(loadinfo->header.h_relocstart);
|
||||
loadinfo->reloccount = ntohs(loadinfo->header.h_reloccount);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1019,7 +1019,7 @@ static void dm9x_receive(FAR struct dm9x_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->dm_dev);
|
||||
NETDEV_RXARP(&priv->dm_dev);
|
||||
|
||||
@@ -1461,7 +1461,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP packet received (%02x)\n", BUF->type);
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
@@ -1481,7 +1481,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
||||
#endif
|
||||
{
|
||||
nwarn("WARNING: Unsupported packet type dropped (%02x)\n",
|
||||
htons(BUF->type));
|
||||
HTONS(BUF->type));
|
||||
NETDEV_RXDROPPED(&priv->dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1561,7 +1561,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP packet received (%02x)\n", BUF->type);
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
@@ -1590,7 +1590,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
||||
enc_rxrmpkt(priv, descr);
|
||||
|
||||
nerr("ERROR: Unsupported packet type dropped (%02x)\n",
|
||||
htons(BUF->type));
|
||||
HTONS(BUF->type));
|
||||
NETDEV_RXDROPPED(&priv->dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -767,7 +767,7 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->ft_dev);
|
||||
|
||||
|
||||
@@ -722,7 +722,7 @@ static void lan91c111_receive(FAR struct net_driver_s *dev)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (eth->type == htons(ETHTYPE_ARP))
|
||||
if (eth->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
ninfo("ARP frame\n");
|
||||
NETDEV_RXARP(dev);
|
||||
|
||||
@@ -294,10 +294,10 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
||||
#endif
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
ninfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||
ntohs(dev->d_ipv6addr[0]), ntohs(dev->d_ipv6addr[1]),
|
||||
ntohs(dev->d_ipv6addr[2]), ntohs(dev->d_ipv6addr[3]),
|
||||
ntohs(dev->d_ipv6addr[4]), ntohs(dev->d_ipv6addr[5]),
|
||||
ntohs(dev->d_ipv6addr[6]), ntohs(dev->d_ipv6addr[7]));
|
||||
NTOHS(dev->d_ipv6addr[0]), NTOHS(dev->d_ipv6addr[1]),
|
||||
NTOHS(dev->d_ipv6addr[2]), NTOHS(dev->d_ipv6addr[3]),
|
||||
NTOHS(dev->d_ipv6addr[4]), NTOHS(dev->d_ipv6addr[5]),
|
||||
NTOHS(dev->d_ipv6addr[6]), NTOHS(dev->d_ipv6addr[7]));
|
||||
#endif
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
@@ -898,7 +898,7 @@ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev)
|
||||
};
|
||||
|
||||
dnsaddr.sin_family = AF_INET;
|
||||
dnsaddr.sin_port = htons(DNS_DEFAULT_PORT);
|
||||
dnsaddr.sin_port = HTONS(DNS_DEFAULT_PORT);
|
||||
memcpy(&dnsaddr.sin_addr, &msg.dnsaddr, sizeof(msg.dnsaddr));
|
||||
|
||||
dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr,
|
||||
@@ -914,7 +914,7 @@ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev)
|
||||
};
|
||||
|
||||
dnsaddr.sin6_family = AF_INET6;
|
||||
dnsaddr.sin6_port = htons(DNS_DEFAULT_PORT);
|
||||
dnsaddr.sin6_port = HTONS(DNS_DEFAULT_PORT);
|
||||
memcpy(&dnsaddr.sin6_addr, msg.ipv6dnsaddr, sizeof(msg.ipv6dnsaddr));
|
||||
|
||||
dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr,
|
||||
|
||||
@@ -447,7 +447,7 @@ static void skel_receive(FAR struct skel_driver_s *priv)
|
||||
#ifdef CONFIG_NET_ARP
|
||||
/* Check for an ARP packet */
|
||||
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
/* Dispatch ARP packet to the network layer */
|
||||
|
||||
|
||||
+1
-1
@@ -605,7 +605,7 @@ static void tun_net_receive_tap(FAR struct tun_device_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->dev);
|
||||
NETDEV_RXARP(&priv->dev);
|
||||
|
||||
@@ -532,7 +532,7 @@ static void cdcecm_receive(FAR struct cdcecm_driver_s *self)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
/* Dispatch ARP packet to the network layer */
|
||||
|
||||
|
||||
@@ -939,7 +939,7 @@ static void rndis_rxdispatch(FAR void *arg)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (hdr->type == htons(ETHTYPE_ARP))
|
||||
if (hdr->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
NETDEV_RXARP(&priv->netdev);
|
||||
|
||||
@@ -954,7 +954,7 @@ static void rndis_rxdispatch(FAR void *arg)
|
||||
#endif
|
||||
{
|
||||
uerr("ERROR: Unsupported packet type dropped (%02x)\n",
|
||||
htons(hdr->type));
|
||||
HTONS(hdr->type));
|
||||
NETDEV_RXDROPPED(&priv->netdev);
|
||||
priv->netdev.d_len = 0;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ static int vnc_connect(FAR struct vnc_session_s *session, int port)
|
||||
/* Create a listening socket */
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_port = HTONS(port);
|
||||
addr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
ret = psock_socket(AF_INET, SOCK_STREAM, 0, &session->listen);
|
||||
|
||||
@@ -1308,7 +1308,7 @@ static void _parse_pkt_in_s4(FAR struct pkt_ctx_s *pkt_ctx,
|
||||
wlinfo("from (%s:%s)\n", addr, port);
|
||||
|
||||
inet_aton(addr, &pkt_dat->addr.sin_addr);
|
||||
pkt_dat->addr.sin_port = htons((uint16_t)atoi(port));
|
||||
pkt_dat->addr.sin_port = HTONS((uint16_t)atoi(port));
|
||||
|
||||
/* Skip until data length */
|
||||
|
||||
@@ -2030,7 +2030,7 @@ static enum pkt_type_e gs2200m_send_bulk(FAR struct gs2200m_dev_s *dev,
|
||||
else
|
||||
{
|
||||
wlinfo("** addr=%s port=%d\n", inet_ntoa(msg->addr.sin_addr),
|
||||
ntohs(msg->addr.sin_port));
|
||||
NTOHS(msg->addr.sin_port));
|
||||
|
||||
/* NOTE: See 7.5.3.2 Bulk Data Handling for UDP
|
||||
* <ESC>Y<CID><IP address>:<port>:<Data Length xxxx 4 ascii char><data>
|
||||
@@ -2038,7 +2038,7 @@ static enum pkt_type_e gs2200m_send_bulk(FAR struct gs2200m_dev_s *dev,
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "%cY%c%s:%d:%s",
|
||||
ASCII_ESC, msg->cid,
|
||||
inet_ntoa(msg->addr.sin_addr), ntohs(msg->addr.sin_port),
|
||||
inet_ntoa(msg->addr.sin_addr), NTOHS(msg->addr.sin_port),
|
||||
digits);
|
||||
}
|
||||
|
||||
@@ -2221,12 +2221,12 @@ static enum pkt_type_e gs2200m_get_cstatus(FAR struct gs2200m_dev_s *dev,
|
||||
|
||||
if (msg->local)
|
||||
{
|
||||
msg->addr.sin_port = htons(p[0]);
|
||||
msg->addr.sin_port = HTONS(p[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
char addr[20];
|
||||
msg->addr.sin_port = htons(p[1]);
|
||||
msg->addr.sin_port = HTONS(p[1]);
|
||||
snprintf(addr, sizeof(addr),
|
||||
"%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
|
||||
inet_aton(addr, &msg->addr.sin_addr);
|
||||
|
||||
@@ -369,7 +369,7 @@ static void bcmf_receive(FAR struct bcmf_dev_s *priv)
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ARP
|
||||
if (BUF->type == htons(ETHTYPE_ARP))
|
||||
if (BUF->type == HTONS(ETHTYPE_ARP))
|
||||
{
|
||||
arp_arpin(&priv->bc_dev);
|
||||
NETDEV_RXARP(&priv->bc_dev);
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ static int rpcclnt_socket(FAR struct rpcclnt *rpc, in_port_t rport)
|
||||
if (rport != 0)
|
||||
{
|
||||
sin = (FAR struct sockaddr_in6 *)&raddr;
|
||||
sin->sin6_port = htons(rport);
|
||||
sin->sin6_port = HTONS(rport);
|
||||
}
|
||||
|
||||
sin = (FAR struct sockaddr_in6 *)&laddr;
|
||||
@@ -210,7 +210,7 @@ static int rpcclnt_socket(FAR struct rpcclnt *rpc, in_port_t rport)
|
||||
if (rport != 0)
|
||||
{
|
||||
sin = (FAR struct sockaddr_in *)&raddr;
|
||||
sin->sin_port = htons(rport);
|
||||
sin->sin_port = HTONS(rport);
|
||||
}
|
||||
|
||||
sin = (FAR struct sockaddr_in *)&laddr;
|
||||
|
||||
@@ -1430,7 +1430,7 @@ static int userfs_bind(FAR struct inode *blkdriver, FAR const void *data,
|
||||
/* Preset the server address */
|
||||
|
||||
priv->server.sin_family = AF_INET;
|
||||
priv->server.sin_port = htons(config->portno);
|
||||
priv->server.sin_port = HTONS(config->portno);
|
||||
priv->server.sin_addr.s_addr = HTONL(INADDR_LOOPBACK);
|
||||
|
||||
/* Create a LocalHost UDP client socket */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user