From a82796f83faf8b8fef0d3763c33b9ebe4970c43a Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 6 Jul 2015 12:22:30 +0300 Subject: [PATCH] Revert a460efb --- libraries/ESP8266WiFi/src/lwip/ip_addr.h | 16 ---------------- libraries/ESP8266mDNS/ESP8266mDNS.cpp | 4 ++-- tools/sdk/include/ip_addr.h | 12 +++++++++--- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/libraries/ESP8266WiFi/src/lwip/ip_addr.h b/libraries/ESP8266WiFi/src/lwip/ip_addr.h index 2787d1285..cfc10f809 100644 --- a/libraries/ESP8266WiFi/src/lwip/ip_addr.h +++ b/libraries/ESP8266WiFi/src/lwip/ip_addr.h @@ -41,11 +41,9 @@ extern "C" { /* This is the aligned version of ip_addr_t, used as local variable, on the stack, etc. */ -#if !defined(IP2STR) struct ip_addr { u32_t addr; }; -#endif /* This is the packed version of ip_addr_t, used in network headers that are itself packed */ @@ -63,9 +61,7 @@ PACK_STRUCT_END /** ip_addr_t uses a struct for convenience only, so that the same defines can * operate both on ip_addr_t as well as on ip_addr_p_t. */ -#if !defined(IP2STR) typedef struct ip_addr ip_addr_t; -#endif typedef struct ip_addr_packed ip_addr_p_t; /* @@ -97,15 +93,11 @@ extern const ip_addr_t ip_addr_broadcast; #define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast) /** 255.255.255.255 */ -#if !defined(IPADDR_NONE) #define IPADDR_NONE ((u32_t)0xffffffffUL) -#endif /** 127.0.0.1 */ #define IPADDR_LOOPBACK ((u32_t)0x7f000001UL) /** 0.0.0.0 */ -#if !defined(IPADDR_ANY) #define IPADDR_ANY ((u32_t)0x00000000UL) -#endif /** 255.255.255.255 */ #define IPADDR_BROADCAST ((u32_t)0xffffffffUL) @@ -142,7 +134,6 @@ extern const ip_addr_t ip_addr_broadcast; #define IP_LOOPBACKNET 127 /* official! */ -#if !defined(IP4_ADDR) #if BYTE_ORDER == BIG_ENDIAN /** Set an IP address given by the four byte-parts */ #define IP4_ADDR(ipaddr, a,b,c,d) \ @@ -159,7 +150,6 @@ extern const ip_addr_t ip_addr_broadcast; ((u32_t)((b) & 0xff) << 8) | \ (u32_t)((a) & 0xff) #endif -#endif /** MEMCPY-like copying of IP addresses where addresses are known to be * 16-bit-aligned if the port is correctly configured (so a port could define @@ -227,7 +217,6 @@ u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR; ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0)) /* Get one byte from the 4-byte address */ -#if !defined(IP2STR) #define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0]) #define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1]) #define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2]) @@ -238,20 +227,16 @@ u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR; #define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr)) #define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr)) #define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr)) -#endif /** For backwards compatibility */ #define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr) -#if !defined(IP2STR) u32_t ipaddr_addr(const char *cp)ICACHE_FLASH_ATTR; -#endif int ipaddr_aton(const char *cp, ip_addr_t *addr)ICACHE_FLASH_ATTR; /** returns ptr to static buffer; not reentrant! */ char *ipaddr_ntoa(const ip_addr_t *addr)ICACHE_FLASH_ATTR; char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)ICACHE_FLASH_ATTR; -#if !defined(IP2STR) #define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \ ip4_addr2_16(ipaddr), \ ip4_addr3_16(ipaddr), \ @@ -264,7 +249,6 @@ struct ip_info { struct ip_addr netmask; struct ip_addr gw; }; -#endif #ifdef __cplusplus } #endif diff --git a/libraries/ESP8266mDNS/ESP8266mDNS.cpp b/libraries/ESP8266mDNS/ESP8266mDNS.cpp index 640aa2754..3868a5c8b 100644 --- a/libraries/ESP8266mDNS/ESP8266mDNS.cpp +++ b/libraries/ESP8266mDNS/ESP8266mDNS.cpp @@ -32,7 +32,8 @@ License (MIT license): // - DNS request and response: http://www.ietf.org/rfc/rfc1035.txt // - Multicast DNS: http://www.ietf.org/rfc/rfc6762.txt -#define LWIP_INTERNAL +#define LWIP_OPEN_SRC + #include "ESP8266mDNS.h" #include @@ -41,7 +42,6 @@ License (MIT license): extern "C" { #include "osapi.h" #include "ets_sys.h" - #include "ip_addr.h" #include "user_interface.h" } diff --git a/tools/sdk/include/ip_addr.h b/tools/sdk/include/ip_addr.h index 74ea7a2b2..fc488ea8f 100644 --- a/tools/sdk/include/ip_addr.h +++ b/tools/sdk/include/ip_addr.h @@ -10,11 +10,17 @@ struct ip_addr { typedef struct ip_addr ip_addr_t; struct ip_info { - ip_addr_t ip; - ip_addr_t netmask; - ip_addr_t gw; + struct ip_addr ip; + struct ip_addr netmask; + struct ip_addr gw; }; +#define IP4_ADDR(ipaddr, a,b,c,d) \ + (ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \ + ((uint32)((c) & 0xff) << 16) | \ + ((uint32)((b) & 0xff) << 8) | \ + (uint32)((a) & 0xff) + /** * Determine if two address are on the same network. *