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
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||
*
|
||||
* $Id: wpcap.c,v 1.4 2009/04/29 11:56:14 adamdunkels Exp $
|
||||
* $Id: wpcap.c,v 1.5 2010/10/19 18:29:05 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -67,8 +67,8 @@
|
|||
#include <err.h>
|
||||
|
||||
/* Avoid 'conflicting types' errors. */
|
||||
#define htonl
|
||||
#define htons
|
||||
#define uip_htonl
|
||||
#define uip_htons
|
||||
|
||||
|
||||
#define PROGRESS(x)
|
||||
|
@ -449,12 +449,12 @@ arp_out(struct ethip_hdr *iphdr, int len)
|
|||
|
||||
uip_ipaddr_copy(&arphdr->dipaddr, &ipaddr);
|
||||
uip_ipaddr_copy(&arphdr->sipaddr, &netaddr);
|
||||
arphdr->opcode = HTONS(ARP_REQUEST); /* ARP request. */
|
||||
arphdr->hwtype = HTONS(ARP_HWTYPE_ETH);
|
||||
arphdr->protocol = HTONS(UIP_ETHTYPE_IP);
|
||||
arphdr->opcode = UIP_HTONS(ARP_REQUEST); /* ARP request. */
|
||||
arphdr->hwtype = UIP_HTONS(ARP_HWTYPE_ETH);
|
||||
arphdr->protocol = UIP_HTONS(UIP_ETHTYPE_IP);
|
||||
arphdr->hwlen = 6;
|
||||
arphdr->protolen = 4;
|
||||
arphdr->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
|
||||
arphdr->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_ARP);
|
||||
|
||||
/* uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];*/
|
||||
|
||||
|
@ -467,7 +467,7 @@ arp_out(struct ethip_hdr *iphdr, int len)
|
|||
#endif /* 0 */
|
||||
memcpy(iphdr->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
|
||||
iphdr->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
|
||||
iphdr->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_IP);
|
||||
|
||||
return len + sizeof(struct uip_eth_hdr);
|
||||
}
|
||||
|
@ -478,8 +478,8 @@ do_arp(void *buf, int len)
|
|||
struct arp_hdr *hdr;
|
||||
|
||||
hdr = (struct arp_hdr *)buf;
|
||||
if(hdr->ethhdr.type == HTONS(UIP_ETHTYPE_ARP)) {
|
||||
if(hdr->opcode == HTONS(ARP_REQUEST)) {
|
||||
if(hdr->ethhdr.type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
|
||||
if(hdr->opcode == UIP_HTONS(ARP_REQUEST)) {
|
||||
/* Check if the ARP is for our network */
|
||||
/* printf("ARP for %d.%d.%d.%d we are %d.%d.%d.%d/%d.%d.%d.%d\n",
|
||||
uip_ipaddr_to_quad(&hdr->dipaddr),
|
||||
|
@ -491,7 +491,7 @@ do_arp(void *buf, int len)
|
|||
/* printf("ARP for us.\n");*/
|
||||
uip_arp_update(&hdr->sipaddr, &hdr->shwaddr);
|
||||
|
||||
hdr->opcode = HTONS(ARP_REPLY);
|
||||
hdr->opcode = UIP_HTONS(ARP_REPLY);
|
||||
|
||||
memcpy(&hdr->dhwaddr.addr, &hdr->shwaddr.addr, 6);
|
||||
memcpy(&hdr->shwaddr.addr, &uip_ethaddr.addr, 6);
|
||||
|
@ -502,11 +502,11 @@ do_arp(void *buf, int len)
|
|||
uip_ipaddr_copy(&hdr->dipaddr, &hdr->sipaddr);
|
||||
uip_ipaddr_copy(&hdr->sipaddr, &tmpaddr);
|
||||
|
||||
hdr->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
|
||||
hdr->ethhdr.type = UIP_HTONS(UIP_ETHTYPE_ARP);
|
||||
raw_send(hdr, sizeof(struct arp_hdr));
|
||||
return NULL;
|
||||
}
|
||||
} else if(hdr->opcode == HTONS(ARP_REPLY)) {
|
||||
} else if(hdr->opcode == UIP_HTONS(ARP_REPLY)) {
|
||||
/* ARP reply. We insert or update the ARP table if it was meant
|
||||
for us. */
|
||||
if(uip_ipaddr_maskcmp(&hdr->dipaddr, &netaddr, &netmask)) {
|
||||
|
@ -514,7 +514,7 @@ do_arp(void *buf, int len)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(hdr->ethhdr.type == HTONS(UIP_ETHTYPE_IP)) {
|
||||
if(hdr->ethhdr.type == UIP_HTONS(UIP_ETHTYPE_IP)) {
|
||||
return &((struct ethip_hdr *)hdr)->vhl;
|
||||
}
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue