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
|
@ -57,7 +57,7 @@
|
|||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: resolv.c,v 1.9 2010/05/31 15:22:08 nifi Exp $
|
||||
* $Id: resolv.c,v 1.10 2010/10/19 18:29:04 adamdunkels Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -237,9 +237,9 @@ check_entries(void)
|
|||
}
|
||||
hdr = (struct dns_hdr *)uip_appdata;
|
||||
memset(hdr, 0, sizeof(struct dns_hdr));
|
||||
hdr->id = htons(i);
|
||||
hdr->id = uip_htons(i);
|
||||
hdr->flags1 = DNS_FLAG1_RD;
|
||||
hdr->numquestions = HTONS(1);
|
||||
hdr->numquestions = UIP_HTONS(1);
|
||||
query = (char *)uip_appdata + 12;
|
||||
nameptr = namemapptr->name;
|
||||
--nameptr;
|
||||
|
@ -281,19 +281,19 @@ newdata(void)
|
|||
register struct namemap *namemapptr;
|
||||
|
||||
hdr = (struct dns_hdr *)uip_appdata;
|
||||
/* printf("ID %d\n", htons(hdr->id));
|
||||
/* printf("ID %d\n", uip_htons(hdr->id));
|
||||
printf("Query %d\n", hdr->flags1 & DNS_FLAG1_RESPONSE);
|
||||
printf("Error %d\n", hdr->flags2 & DNS_FLAG2_ERR_MASK);
|
||||
printf("Num questions %d, answers %d, authrr %d, extrarr %d\n",
|
||||
htons(hdr->numquestions),
|
||||
htons(hdr->numanswers),
|
||||
htons(hdr->numauthrr),
|
||||
htons(hdr->numextrarr));
|
||||
uip_htons(hdr->numquestions),
|
||||
uip_htons(hdr->numanswers),
|
||||
uip_htons(hdr->numauthrr),
|
||||
uip_htons(hdr->numextrarr));
|
||||
*/
|
||||
|
||||
/* The ID in the DNS header should be our entry into the name
|
||||
table. */
|
||||
i = (u8_t)htons(hdr->id);
|
||||
i = (u8_t)uip_htons(hdr->id);
|
||||
namemapptr = &names[i];
|
||||
if(i < RESOLV_ENTRIES &&
|
||||
namemapptr->state == STATE_ASKING) {
|
||||
|
@ -311,8 +311,8 @@ newdata(void)
|
|||
|
||||
/* We only care about the question(s) and the answers. The authrr
|
||||
and the extrarr are simply discarded. */
|
||||
nquestions = (u8_t)htons(hdr->numquestions);
|
||||
nanswers = (u8_t)htons(hdr->numanswers);
|
||||
nquestions = (u8_t)uip_htons(hdr->numquestions);
|
||||
nanswers = (u8_t)uip_htons(hdr->numanswers);
|
||||
|
||||
/* Skip the name in the question. XXX: This should really be
|
||||
checked agains the name in the question, to be sure that they
|
||||
|
@ -333,14 +333,14 @@ newdata(void)
|
|||
|
||||
ans = (struct dns_answer *)nameptr;
|
||||
/* printf("Answer: type %x, class %x, ttl %x, length %x\n",
|
||||
htons(ans->type), htons(ans->class), (htons(ans->ttl[0])
|
||||
<< 16) | htons(ans->ttl[1]), htons(ans->len));*/
|
||||
uip_htons(ans->type), uip_htons(ans->class), (uip_htons(ans->ttl[0])
|
||||
<< 16) | uip_htons(ans->ttl[1]), uip_htons(ans->len));*/
|
||||
|
||||
/* Check for IP address type and Internet class. Others are
|
||||
discarded. */
|
||||
if(ans->type == HTONS(1) &&
|
||||
ans->class == HTONS(1) &&
|
||||
ans->len == HTONS(4)) {
|
||||
if(ans->type == UIP_HTONS(1) &&
|
||||
ans->class == UIP_HTONS(1) &&
|
||||
ans->len == UIP_HTONS(4)) {
|
||||
/* printf("IP address %d.%d.%d.%d\n",
|
||||
ans->ipaddr[0],
|
||||
ans->ipaddr[1],
|
||||
|
@ -355,7 +355,7 @@ newdata(void)
|
|||
resolv_found(namemapptr->name, &namemapptr->ipaddr);
|
||||
return;
|
||||
} else {
|
||||
nameptr = nameptr + 10 + htons(ans->len);
|
||||
nameptr = nameptr + 10 + uip_htons(ans->len);
|
||||
}
|
||||
--nanswers;
|
||||
}
|
||||
|
@ -391,10 +391,10 @@ PROCESS_THREAD(resolv_process, ev, data)
|
|||
if(resolv_conn != NULL) {
|
||||
uip_udp_remove(resolv_conn);
|
||||
}
|
||||
resolv_conn = udp_new((uip_ipaddr_t *)data, HTONS(53), NULL);
|
||||
resolv_conn = udp_new((uip_ipaddr_t *)data, UIP_HTONS(53), NULL);
|
||||
|
||||
} else if(ev == tcpip_event) {
|
||||
if(uip_udp_conn->rport == HTONS(53)) {
|
||||
if(uip_udp_conn->rport == UIP_HTONS(53)) {
|
||||
if(uip_poll()) {
|
||||
check_entries();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue