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

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: uip-fw.c,v 1.11 2008/02/08 09:12:57 nifi Exp $
* $Id: uip-fw.c,v 1.12 2010/10/19 18:29:04 adamdunkels Exp $
*/
/**
* \addtogroup uip
@ -413,7 +413,7 @@ uip_fw_forward(void)
#ifdef AODV_COMPLIANCE
#define udp ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
if(udp->proto == UIP_PROTO_UDP && udp->destport == HTONS(UAODV_UDPPORT)) {
if(udp->proto == UIP_PROTO_UDP && udp->destport == UIP_HTONS(UAODV_UDPPORT)) {
return UIP_FW_LOCAL;
}
#endif
@ -466,10 +466,10 @@ uip_fw_forward(void)
BUF->ttl = BUF->ttl - 1;
/* Update the IP checksum. */
if(BUF->ipchksum >= HTONS(0xffff - 0x0100)) {
BUF->ipchksum = BUF->ipchksum + HTONS(0x0100) + 1;
if(BUF->ipchksum >= UIP_HTONS(0xffff - 0x0100)) {
BUF->ipchksum = BUF->ipchksum + UIP_HTONS(0x0100) + 1;
} else {
BUF->ipchksum = BUF->ipchksum + HTONS(0x0100);
BUF->ipchksum = BUF->ipchksum + UIP_HTONS(0x0100);
}
if(uip_len > 0) {