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

@ -29,7 +29,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: slip.c,v 1.1 2009/05/08 12:49:36 joxe Exp $
* @(#)$Id: slip.c,v 1.2 2010/10/19 18:29:05 adamdunkels Exp $
*/
@ -282,7 +282,7 @@ PROCESS_THREAD(slip_process, ev, data)
uint16_t nid = ip_id++;
BUF->ipid[0] = nid >> 8;
BUF->ipid[1] = nid;
nid = htons(nid);
nid = uip_htons(nid);
nid = ~nid; /* negate */
BUF->ipchksum += nid; /* add */
if(BUF->ipchksum < nid) { /* 1-complement overflow? */

View file

@ -18,7 +18,7 @@ struct uip_stats uip_stat;
uip_lladdr_t uip_lladdr;
u16_t htons(u16_t val) { return HTONS(val);}
u16_t uip_htons(u16_t val) { return UIP_HTONS(val);}
uip_ds6_netif_t uip_ds6_if;
@ -118,7 +118,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);
}
/*---------------------------------------------------------------------------*/

View file

@ -235,7 +235,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
#endif
//If not IPv6 we don't do anything
if (((struct uip_eth_hdr *) ethHeader)->type != HTONS(UIP_ETHTYPE_IPV6)) {
if (((struct uip_eth_hdr *) ethHeader)->type != UIP_HTONS(UIP_ETHTYPE_IPV6)) {
PRINTF("eth2low: Packet is not IPv6, dropping\n");
/* rndis_stat.txbad++; */
uip_len = 0;
@ -309,7 +309,7 @@ void mac_LowpanToEthernet(void)
/* parsed_frame = sicslowmac_get_frame(); */
//Setup generic ethernet stuff
ETHBUF(uip_buf)->type = htons(UIP_ETHTYPE_IPV6);
ETHBUF(uip_buf)->type = uip_htons(UIP_ETHTYPE_IPV6);
//Check for broadcast message
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
@ -782,7 +782,7 @@ void mac_logTXtoEthernet(frame_create_params_t *p,frame_result_t *frame_result)
sendlen = frame_result->length;
//Setup generic ethernet stuff
ETHBUF(raw_buf)->type = htons(UIP_ETHTYPE_802154);
ETHBUF(raw_buf)->type = uip_htons(UIP_ETHTYPE_802154);
uint64_t tempaddr;
@ -845,7 +845,7 @@ void mac_802154raw(const struct mac_driver *r)
sendlen = radio_frame_length();
//Setup generic ethernet stuff
ETHBUF(raw_buf)->type = htons(UIP_ETHTYPE_802154);
ETHBUF(raw_buf)->type = uip_htons(UIP_ETHTYPE_802154);
//Check for broadcast message