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: ether.c,v 1.16 2010/02/23 18:44:08 adamdunkels Exp $
* $Id: ether.c,v 1.17 2010/10/19 18:29:05 adamdunkels Exp $
*/
/**
* \file
@ -191,9 +191,9 @@ ether_server_init(void)
memset((char *)&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr("127.0.0.1");/*htonl(INADDR_ANY);*/
sa.sin_addr.s_addr = inet_addr("127.0.0.1");/*uip_htonl(INADDR_ANY);*/
sa.sin_port = htons(ETHER_PORT);
sa.sin_port = uip_htons(ETHER_PORT);
/* printf("Binding to port %d\n", ETHER_PORT);*/
@ -219,9 +219,9 @@ ether_client_init(int port)
memset((char *)&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr("127.0.0.1");/*htonl(INADDR_ANY);*/
sa.sin_addr.s_addr = inet_addr("127.0.0.1");/*uip_htonl(INADDR_ANY);*/
sa.sin_port = htons(port);
sa.sin_port = uip_htons(port);
/* printf("ether_client_init: binding to port %d\n", port);*/
if(bind(sc, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
@ -403,7 +403,7 @@ send_packet(char *data, int len, int port)
memset((char *)&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
sa.sin_port = htons(port);
sa.sin_port = uip_htons(port);
if(sendto(s, data, len, 0, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
perror("ether: send_packet: sendto");
@ -526,7 +526,7 @@ node_send_packet(char *data, int len)
memset((char *)&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
sa.sin_port = htons(ETHER_PORT);
sa.sin_port = uip_htons(ETHER_PORT);
if(sendto(sc, data, len, 0,
(struct sockaddr *)&sa, sizeof(sa)) == -1) {