diff --git a/core/net/uip-fw.h b/core/net/uip-fw.h index 4fd823930..d01d7c703 100644 --- a/core/net/uip-fw.h +++ b/core/net/uip-fw.h @@ -41,7 +41,7 @@ * * Author: Adam Dunkels * - * $Id: uip-fw.h,v 1.2 2006/08/09 16:13:40 bg- Exp $ + * $Id: uip-fw.h,v 1.3 2006/08/14 13:58:28 bg- Exp $ */ #ifndef __UIP_FW_H__ #define __UIP_FW_H__ @@ -79,8 +79,8 @@ struct uip_fw_netif { */ #define UIP_FW_NETIF(ip1,ip2,ip3,ip4, nm1,nm2,nm3,nm4, outputfunc) \ NULL, \ - { .u16 = {HTONS((ip1 << 8) | ip2), HTONS((ip3 << 8) | ip4)} }, \ - { .u16 = {HTONS((nm1 << 8) | nm2), HTONS((nm3 << 8) | nm4)} }, \ + { {ip1, ip2, ip3, ip4} }, \ + { {nm1, nm2, nm3, nm4} }, \ outputfunc /** diff --git a/core/net/uip.c b/core/net/uip.c index 3af0f39ce..68073fee4 100644 --- a/core/net/uip.c +++ b/core/net/uip.c @@ -41,7 +41,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: uip.c,v 1.4 2006/08/13 14:53:45 oliverschmidt Exp $ + * $Id: uip.c,v 1.5 2006/08/14 13:58:28 bg- Exp $ * */ @@ -90,31 +90,23 @@ here. Otherwise, the address */ #if UIP_FIXEDADDR > 0 const uip_ipaddr_t uip_hostaddr = - {HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1), - HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)}; + { UIP_IPADDR0, UIP_IPADDR1, UIP_IPADDR2, UIP_IPADDR3 }; const uip_ipaddr_t uip_draddr = - {HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1), - HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)}; + { UIP_DRIPADDR0, UIP_DRIPADDR1, UIP_DRIPADDR2, UIP_DRIPADDR3 }; const uip_ipaddr_t uip_netmask = - {HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1), - HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)}; + { UIP_NETMASK0, UIP_NETMASK1, UIP_NETMASK2, UIP_NETMASK3 }; #else uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask; #endif /* UIP_FIXEDADDR */ const uip_ipaddr_t uip_broadcast_addr = #if UIP_CONF_IPV6 - {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff}; + { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; #else /* UIP_CONF_IPV6 */ - {0xffff,0xffff}; + { { 0xff, 0xff, 0xff, 0xff } }; #endif /* UIP_CONF_IPV6 */ -const uip_ipaddr_t all_zeroes_addr = -#if UIP_CONF_IPV6 - {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; -#else /* UIP_CONF_IPV6 */ - {0x0000,0x0000}; -#endif /* UIP_CONF_IPV6 */ - +const uip_ipaddr_t all_zeroes_addr = { { 0x0, /* rest is 0 */ } }; #if UIP_FIXEDETHADDR const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0, diff --git a/core/net/uip.h b/core/net/uip.h index a3f0575cf..f6a6789a2 100644 --- a/core/net/uip.h +++ b/core/net/uip.h @@ -46,7 +46,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: uip.h,v 1.2 2006/08/09 16:13:40 bg- Exp $ + * $Id: uip.h,v 1.3 2006/08/14 13:58:28 bg- Exp $ * */ @@ -60,16 +60,16 @@ * */ typedef union uip_ip4addr_t { - u16_t u16[2]; /* Must come first for now!!! */ - u8_t u8[4]; + u8_t u8[4]; /* Initializer, must come first!!! */ + u16_t u16[2]; #if 0 u32_t u32; #endif } uip_ip4addr_t; typedef union uip_ip6addr_t { + u8_t u8[16]; /* Initializer, must come first!!! */ u16_t u16[8]; - u8_t u8[16]; } uip_ip6addr_t; #if UIP_CONF_IPV6 @@ -865,14 +865,14 @@ struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport); * \hideinitializer */ #define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \ - ((u16_t *)(addr))[0] = HTONS((addr0)); \ - ((u16_t *)(addr))[1] = HTONS((addr1)); \ - ((u16_t *)(addr))[2] = HTONS((addr2)); \ - ((u16_t *)(addr))[3] = HTONS((addr3)); \ - ((u16_t *)(addr))[4] = HTONS((addr4)); \ - ((u16_t *)(addr))[5] = HTONS((addr5)); \ - ((u16_t *)(addr))[6] = HTONS((addr6)); \ - ((u16_t *)(addr))[7] = HTONS((addr7)); \ + (addr)->u16[0] = HTONS(addr0); \ + (addr)->u16[1] = HTONS(addr1); \ + (addr)->u16[2] = HTONS(addr2); \ + (addr)->u16[3] = HTONS(addr3); \ + (addr)->u16[4] = HTONS(addr4); \ + (addr)->u16[5] = HTONS(addr5); \ + (addr)->u16[6] = HTONS(addr6); \ + (addr)->u16[7] = HTONS(addr7); \ } while(0) /**