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: ftpc.c,v 1.4 2010/05/31 15:22:08 nifi Exp $
* $Id: ftpc.c,v 1.5 2010/10/19 18:29:03 adamdunkels Exp $
*/
#include "contiki.h"
#include "ftpc.h"
@ -123,7 +123,7 @@ void
ftpc_init(void)
{
memb_init(&connections);
/* tcp_listen(HTONS(DATAPORT));*/
/* tcp_listen(UIP_HTONS(DATAPORT));*/
}
/*---------------------------------------------------------------------------*/
void *
@ -141,7 +141,7 @@ ftpc_connect(uip_ipaddr_t *ipaddr, u16_t port)
c->codeptr = 0;
c->dataconn.type = TYPE_DATA;
c->dataconn.port = DATAPORT;
tcp_listen(HTONS(DATAPORT));
tcp_listen(UIP_HTONS(DATAPORT));
if(tcp_connect(ipaddr, port, c) == NULL) {
memb_free(&connections, c);
@ -190,9 +190,9 @@ handle_input(struct ftp_connection *c)
c->state == STATE_RETR_SENT ||
c->state == STATE_CONNECTED)) {
if(code == 226 || code == 550) {
tcp_unlisten(htons(c->dataconn.port));
tcp_unlisten(uip_htons(c->dataconn.port));
++c->dataconn.port;
tcp_listen(htons(c->dataconn.port));
tcp_listen(uip_htons(c->dataconn.port));
c->state = STATE_SEND_PORT;
}