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:
parent
5a46c629de
commit
5585d72c86
115 changed files with 675 additions and 675 deletions
|
@ -41,7 +41,7 @@
|
|||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip.c,v 1.29 2010/05/30 09:46:12 oliverschmidt Exp $
|
||||
* $Id: uip.c,v 1.30 2010/10/19 18:29:04 adamdunkels Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -302,7 +302,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
|
|||
u16_t
|
||||
uip_chksum(u16_t *data, u16_t len)
|
||||
{
|
||||
return htons(chksum(0, (u8_t *)data, len));
|
||||
return uip_htons(chksum(0, (u8_t *)data, len));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef UIP_ARCH_IPCHKSUM
|
||||
|
@ -313,7 +313,7 @@ uip_ipchksum(void)
|
|||
|
||||
sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);
|
||||
DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);
|
||||
return (sum == 0) ? 0xffff : htons(sum);
|
||||
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||
}
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -340,7 +340,7 @@ upper_layer_chksum(u8_t proto)
|
|||
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
|
||||
upper_layer_len);
|
||||
|
||||
return (sum == 0) ? 0xffff : htons(sum);
|
||||
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if UIP_CONF_IPV6
|
||||
|
@ -413,7 +413,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
|
|||
for(c = 0; c < UIP_CONNS; ++c) {
|
||||
conn = &uip_conns[c];
|
||||
if(conn->tcpstateflags != UIP_CLOSED &&
|
||||
conn->lport == htons(lastport)) {
|
||||
conn->lport == uip_htons(lastport)) {
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
|
|||
conn->rto = UIP_RTO;
|
||||
conn->sa = 0;
|
||||
conn->sv = 16; /* Initial value of the RTT variance. */
|
||||
conn->lport = htons(lastport);
|
||||
conn->lport = uip_htons(lastport);
|
||||
conn->rport = rport;
|
||||
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
||||
|
||||
|
@ -475,7 +475,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
|
|||
}
|
||||
|
||||
for(c = 0; c < UIP_UDP_CONNS; ++c) {
|
||||
if(uip_udp_conns[c].lport == htons(lastport)) {
|
||||
if(uip_udp_conns[c].lport == uip_htons(lastport)) {
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
|
|||
return 0;
|
||||
}
|
||||
|
||||
conn->lport = HTONS(lastport);
|
||||
conn->lport = UIP_HTONS(lastport);
|
||||
conn->rport = rport;
|
||||
if(ripaddr == NULL) {
|
||||
memset(&conn->ripaddr, 0, sizeof(uip_ipaddr_t));
|
||||
|
@ -935,7 +935,7 @@ uip_process(u8_t flag)
|
|||
address) as well. However, we will cheat here and accept all
|
||||
multicast packets that are sent to the ff02::/16 addresses. */
|
||||
if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr) &&
|
||||
BUF->destipaddr.u16[0] != HTONS(0xff02)) {
|
||||
BUF->destipaddr.u16[0] != UIP_HTONS(0xff02)) {
|
||||
UIP_STAT(++uip_stat.ip.drop);
|
||||
goto drop;
|
||||
}
|
||||
|
@ -1000,10 +1000,10 @@ uip_process(u8_t flag)
|
|||
|
||||
ICMPBUF->type = ICMP_ECHO_REPLY;
|
||||
|
||||
if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {
|
||||
ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;
|
||||
if(ICMPBUF->icmpchksum >= UIP_HTONS(0xffff - (ICMP_ECHO << 8))) {
|
||||
ICMPBUF->icmpchksum += UIP_HTONS(ICMP_ECHO << 8) + 1;
|
||||
} else {
|
||||
ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);
|
||||
ICMPBUF->icmpchksum += UIP_HTONS(ICMP_ECHO << 8);
|
||||
}
|
||||
|
||||
/* Swap IP addresses. */
|
||||
|
@ -1191,7 +1191,7 @@ uip_process(u8_t flag)
|
|||
BUF->ttl = uip_udp_conn->ttl;
|
||||
BUF->proto = UIP_PROTO_UDP;
|
||||
|
||||
UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN);
|
||||
UDPBUF->udplen = UIP_HTONS(uip_slen + UIP_UDPH_LEN);
|
||||
UDPBUF->udpchksum = 0;
|
||||
|
||||
BUF->srcport = uip_udp_conn->lport;
|
||||
|
@ -1939,15 +1939,15 @@ uip_process(u8_t flag)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
htons(u16_t val)
|
||||
uip_htons(u16_t val)
|
||||
{
|
||||
return HTONS(val);
|
||||
return UIP_HTONS(val);
|
||||
}
|
||||
|
||||
u32_t
|
||||
htonl(u32_t val)
|
||||
uip_htonl(u32_t val)
|
||||
{
|
||||
return HTONL(val);
|
||||
return UIP_HTONL(val);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue