A simple but substantial change: uIP used the htons()/HTONS() macro

functions for converting between host and network byte order. These
names are the de facto standard names for this functionality because
of the original BSD TCP/IP implementation. But they cause problems for
uIP/Contiki: some platforms define these names themselves (Mac OS,
most notably), causing compilation problems for Contiki on those
platforms.

This commit changes all htons to uip_htons instead. Same goes for
htonl, ntohs, and ntohl. All-caps versions as well.
This commit is contained in:
adamdunkels 2010-10-19 18:29:03 +00:00
parent 5a46c629de
commit 5585d72c86
115 changed files with 675 additions and 675 deletions

View file

@ -54,7 +54,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: uip_arp.c,v 1.5 2008/02/07 01:35:00 adamdunkels Exp $
* $Id: uip_arp.c,v 1.6 2010/10/19 18:29:04 adamdunkels Exp $
*
*/
@ -290,7 +290,7 @@ uip_arp_arpin(void)
uip_len = 0;
switch(BUF->opcode) {
case HTONS(ARP_REQUEST):
case UIP_HTONS(ARP_REQUEST):
/* ARP request. If it asked for our address, we send out a
reply. */
/* if(BUF->dipaddr[0] == uip_hostaddr[0] &&
@ -306,7 +306,7 @@ uip_arp_arpin(void)
with this host in the future. */
uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
BUF->opcode = HTONS(ARP_REPLY);
BUF->opcode = UIP_HTONS(ARP_REPLY);
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
@ -316,11 +316,11 @@ uip_arp_arpin(void)
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
BUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_ARP);
uip_len = sizeof(struct arp_hdr);
}
break;
case HTONS(ARP_REPLY):
case UIP_HTONS(ARP_REPLY):
/* ARP reply. We insert or update the ARP table if it was meant
for us. */
if(uip_ipaddr_cmp(&BUF->dipaddr, &uip_hostaddr)) {
@ -404,12 +404,12 @@ uip_arp_out(void)
uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
BUF->hwtype = HTONS(ARP_HWTYPE_ETH);
BUF->protocol = HTONS(UIP_ETHTYPE_IP);
BUF->opcode = UIP_HTONS(ARP_REQUEST); /* ARP request. */
BUF->hwtype = UIP_HTONS(ARP_HWTYPE_ETH);
BUF->protocol = UIP_HTONS(UIP_ETHTYPE_IP);
BUF->hwlen = 6;
BUF->protolen = 4;
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
BUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_ARP);
uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
@ -422,7 +422,7 @@ uip_arp_out(void)
}
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
IPBUF->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_IP);
uip_len += sizeof(struct uip_eth_hdr);
}