1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Allman astyle: mDNS (#6629)

* allmanize mDNS
This commit is contained in:
Allman-astyler 2019-10-10 23:30:06 +02:00 committed by david gauchard
parent 52bc1df424
commit 9bdcd4f36a
15 changed files with 11800 additions and 10482 deletions

View File

@ -1,10 +1,10 @@
#include <ESP8266mDNS.h> #include <ESP8266mDNS.h>
/* /*
* MDNS responder global instance MDNS responder global instance
*
* Class type that is instantiated depends on the type mapping in ESP8266mDNS.h Class type that is instantiated depends on the type mapping in ESP8266mDNS.h
*/ */
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS) #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
MDNSResponder MDNS; MDNSResponder MDNS;
#endif #endif

View File

@ -1,44 +1,44 @@
/* /*
ESP8266mDNS.h - mDNSResponder for ESP8266 family ESP8266mDNS.h - mDNSResponder for ESP8266 family
This file is part of the esp8266 core for Arduino environment. This file is part of the esp8266 core for Arduino environment.
Legacy_ESP8266mDNS: Legacy_ESP8266mDNS:
The well known, thouroughly tested (yet no flawless) default mDNS library for the ESP8266 family The well known, thouroughly tested (yet no flawless) default mDNS library for the ESP8266 family
LEA_ESP8266mDNS: LEA_ESP8266mDNS:
An (currently) experimental mDNS implementation, that supports a lot more of mDNS features than Legacy_ESP8266mDNS, like: An (currently) experimental mDNS implementation, that supports a lot more of mDNS features than Legacy_ESP8266mDNS, like:
- Presenting a DNS-SD service to interested observers, eg. a http server by presenting _http._tcp service - Presenting a DNS-SD service to interested observers, eg. a http server by presenting _http._tcp service
- Support for multi-level compressed names in input; in output only a very simple one-leven full-name compression is implemented - Support for multi-level compressed names in input; in output only a very simple one-leven full-name compression is implemented
- Probing host and service domains for uniqueness in the local network - Probing host and service domains for uniqueness in the local network
- Tiebreaking while probing is supportet in a very minimalistic way (the 'higher' IP address wins the tiebreak) - Tiebreaking while probing is supportet in a very minimalistic way (the 'higher' IP address wins the tiebreak)
- Announcing available services after successful probing - Announcing available services after successful probing
- Using fixed service TXT items or - Using fixed service TXT items or
- Using dynamic service TXT items for presented services (via callback) - Using dynamic service TXT items for presented services (via callback)
- Remove services (and un-announcing them to the observers by sending goodbye-messages) - Remove services (and un-announcing them to the observers by sending goodbye-messages)
- Static queries for DNS-SD services (creating a fixed answer set after a certain timeout period) - Static queries for DNS-SD services (creating a fixed answer set after a certain timeout period)
- Dynamic queries for DNS-SD services with cached and updated answers and user notifications - Dynamic queries for DNS-SD services with cached and updated answers and user notifications
- Support for multi-homed client host domains - Support for multi-homed client host domains
See 'LEA_ESP8266mDNS/EPS8266mDNS.h' for more implementation details and usage informations. See 'LEA_ESP8266mDNS/EPS8266mDNS.h' for more implementation details and usage informations.
See 'examples/mDNS_Clock' and 'examples/mDNS_ServiceMonitor' for implementation examples of the advanced features. See 'examples/mDNS_Clock' and 'examples/mDNS_ServiceMonitor' for implementation examples of the advanced features.
LEA_ESP8266mDNS is (mostly) client source code compatible to 'Legacy_ESP8266mDNS', so it could be LEA_ESP8266mDNS is (mostly) client source code compatible to 'Legacy_ESP8266mDNS', so it could be
use as a 'drop-in' replacement in existing projects. use as a 'drop-in' replacement in existing projects.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
@ -47,10 +47,10 @@
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS) #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
// Maps the implementation to use to the global namespace type // Maps the implementation to use to the global namespace type
//using MDNSResponder = Legacy_MDNSResponder::MDNSResponder; //legacy //using MDNSResponder = Legacy_MDNSResponder::MDNSResponder; //legacy
using MDNSResponder = esp8266::MDNSImplementation::MDNSResponder; //new using MDNSResponder = esp8266::MDNSImplementation::MDNSResponder; //new
extern MDNSResponder MDNS; extern MDNSResponder MDNS;
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +1,43 @@
/* /*
ESP8266 Multicast DNS (port of CC3000 Multicast DNS library) ESP8266 Multicast DNS (port of CC3000 Multicast DNS library)
Version 1.1 Version 1.1
Copyright (c) 2013 Tony DiCola (tony@tonydicola.com) Copyright (c) 2013 Tony DiCola (tony@tonydicola.com)
ESP8266 port (c) 2015 Ivan Grokhotkov (ivan@esp8266.com) ESP8266 port (c) 2015 Ivan Grokhotkov (ivan@esp8266.com)
Extended MDNS-SD support 2016 Lars Englund (lars.englund@gmail.com) Extended MDNS-SD support 2016 Lars Englund (lars.englund@gmail.com)
This is a simple implementation of multicast DNS query support for an Arduino This is a simple implementation of multicast DNS query support for an Arduino
running on ESP8266 chip. Only support for resolving address queries is currently running on ESP8266 chip. Only support for resolving address queries is currently
implemented. implemented.
Requirements: Requirements:
- ESP8266WiFi library - ESP8266WiFi library
Usage: Usage:
- Include the ESP8266 Multicast DNS library in the sketch. - Include the ESP8266 Multicast DNS library in the sketch.
- Call the begin method in the sketch's setup and provide a domain name (without - Call the begin method in the sketch's setup and provide a domain name (without
the '.local' suffix, i.e. just provide 'foo' to resolve 'foo.local'), and the the '.local' suffix, i.e. just provide 'foo' to resolve 'foo.local'), and the
Adafruit CC3000 class instance. Optionally provide a time to live (in seconds) Adafruit CC3000 class instance. Optionally provide a time to live (in seconds)
for the DNS record--the default is 1 hour. for the DNS record--the default is 1 hour.
- Call the update method in each iteration of the sketch's loop function. - Call the update method in each iteration of the sketch's loop function.
License (MIT license): License (MIT license):
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#ifndef ESP8266MDNS_LEGACY_H #ifndef ESP8266MDNS_LEGACY_H
@ -54,95 +54,108 @@ License (MIT license):
class UdpContext; class UdpContext;
namespace Legacy_MDNSResponder { namespace Legacy_MDNSResponder
{
struct MDNSService; struct MDNSService;
struct MDNSTxt; struct MDNSTxt;
struct MDNSAnswer; struct MDNSAnswer;
class MDNSResponder { class MDNSResponder
{
public: public:
MDNSResponder(); MDNSResponder();
~MDNSResponder(); ~MDNSResponder();
bool begin(const char* hostName); bool begin(const char* hostName);
bool begin(const String& hostName) { bool begin(const String& hostName)
return begin(hostName.c_str()); {
} return begin(hostName.c_str());
//for compatibility }
bool begin(const char* hostName, IPAddress ip, uint32_t ttl=120){ //for compatibility
(void) ip; bool begin(const char* hostName, IPAddress ip, uint32_t ttl = 120)
(void) ttl; {
return begin(hostName); (void) ip;
} (void) ttl;
bool begin(const String& hostName, IPAddress ip, uint32_t ttl=120) { return begin(hostName);
return begin(hostName.c_str(), ip, ttl); }
} bool begin(const String& hostName, IPAddress ip, uint32_t ttl = 120)
/* Application should call this whenever AP is configured/disabled */ {
void notifyAPChange(); return begin(hostName.c_str(), ip, ttl);
void update(); }
/* Application should call this whenever AP is configured/disabled */
void notifyAPChange();
void update();
void addService(char *service, char *proto, uint16_t port); void addService(char *service, char *proto, uint16_t port);
void addService(const char *service, const char *proto, uint16_t port){ void addService(const char *service, const char *proto, uint16_t port)
addService((char *)service, (char *)proto, port); {
} addService((char *)service, (char *)proto, port);
void addService(const String& service, const String& proto, uint16_t port){ }
addService(service.c_str(), proto.c_str(), port); void addService(const String& service, const String& proto, uint16_t port)
} {
addService(service.c_str(), proto.c_str(), port);
bool addServiceTxt(char *name, char *proto, char * key, char * value); }
bool addServiceTxt(const char *name, const char *proto, const char *key,const char * value){
return addServiceTxt((char *)name, (char *)proto, (char *)key, (char *)value);
}
bool addServiceTxt(const String& name, const String& proto, const String& key, const String& value){
return addServiceTxt(name.c_str(), proto.c_str(), key.c_str(), value.c_str());
}
int queryService(char *service, char *proto);
int queryService(const char *service, const char *proto){
return queryService((char *)service, (char *)proto);
}
int queryService(const String& service, const String& proto){
return queryService(service.c_str(), proto.c_str());
}
String hostname(int idx);
IPAddress IP(int idx);
uint16_t port(int idx);
void enableArduino(uint16_t port, bool auth=false);
void setInstanceName(String name); bool addServiceTxt(char *name, char *proto, char * key, char * value);
void setInstanceName(const char * name){ bool addServiceTxt(const char *name, const char *proto, const char *key, const char * value)
setInstanceName(String(name)); {
} return addServiceTxt((char *)name, (char *)proto, (char *)key, (char *)value);
void setInstanceName(char * name){ }
setInstanceName(String(name)); bool addServiceTxt(const String& name, const String& proto, const String& key, const String& value)
} {
return addServiceTxt(name.c_str(), proto.c_str(), key.c_str(), value.c_str());
}
int queryService(char *service, char *proto);
int queryService(const char *service, const char *proto)
{
return queryService((char *)service, (char *)proto);
}
int queryService(const String& service, const String& proto)
{
return queryService(service.c_str(), proto.c_str());
}
String hostname(int idx);
IPAddress IP(int idx);
uint16_t port(int idx);
void enableArduino(uint16_t port, bool auth = false);
void setInstanceName(String name);
void setInstanceName(const char * name)
{
setInstanceName(String(name));
}
void setInstanceName(char * name)
{
setInstanceName(String(name));
}
private: private:
struct MDNSService * _services; struct MDNSService * _services;
UdpContext* _conn; UdpContext* _conn;
String _hostName; String _hostName;
String _instanceName; String _instanceName;
struct MDNSAnswer * _answers; struct MDNSAnswer * _answers;
struct MDNSQuery * _query; struct MDNSQuery * _query;
bool _newQuery; bool _newQuery;
bool _waitingForAnswers; bool _waitingForAnswers;
WiFiEventHandler _disconnectedHandler; WiFiEventHandler _disconnectedHandler;
WiFiEventHandler _gotIPHandler; WiFiEventHandler _gotIPHandler;
uint16_t _getServicePort(char *service, char *proto);
MDNSTxt * _getServiceTxt(char *name, char *proto); uint16_t _getServicePort(char *service, char *proto);
uint16_t _getServiceTxtLen(char *name, char *proto); MDNSTxt * _getServiceTxt(char *name, char *proto);
IPAddress _getRequestMulticastInterface(); uint16_t _getServiceTxtLen(char *name, char *proto);
void _parsePacket(); IPAddress _getRequestMulticastInterface();
void _replyToTypeEnumRequest(IPAddress multicastInterface); void _parsePacket();
void _replyToInstanceRequest(uint8_t questionMask, uint8_t responseMask, char * service, char *proto, uint16_t port, IPAddress multicastInterface); void _replyToTypeEnumRequest(IPAddress multicastInterface);
MDNSAnswer* _getAnswerFromIdx(int idx); void _replyToInstanceRequest(uint8_t questionMask, uint8_t responseMask, char * service, char *proto, uint16_t port, IPAddress multicastInterface);
int _getNumAnswers(); MDNSAnswer* _getAnswerFromIdx(int idx);
bool _listen(); int _getNumAnswers();
void _restart(); bool _listen();
void _restart();
}; };
} // namespace Legacy_MDNSResponder } // namespace Legacy_MDNSResponder

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,180 +1,182 @@
/* /*
* LEAmDNS_Priv.h LEAmDNS_Priv.h
*
* License (MIT license): License (MIT license):
* Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. THE SOFTWARE.
*
*/ */
#ifndef MDNS_PRIV_H #ifndef MDNS_PRIV_H
#define MDNS_PRIV_H #define MDNS_PRIV_H
namespace esp8266 { namespace esp8266
{
/*
* LEAmDNS /*
*/ LEAmDNS
*/
namespace MDNSImplementation {
namespace MDNSImplementation
// Enable class debug functions {
#define ESP_8266_MDNS_INCLUDE
//#define DEBUG_ESP_MDNS_RESPONDER // Enable class debug functions
#define ESP_8266_MDNS_INCLUDE
#if !defined(DEBUG_ESP_MDNS_RESPONDER) && defined(DEBUG_ESP_MDNS) //#define DEBUG_ESP_MDNS_RESPONDER
#define DEBUG_ESP_MDNS_RESPONDER
#endif #if !defined(DEBUG_ESP_MDNS_RESPONDER) && defined(DEBUG_ESP_MDNS)
#define DEBUG_ESP_MDNS_RESPONDER
#ifndef LWIP_OPEN_SRC #endif
#define LWIP_OPEN_SRC
#endif #ifndef LWIP_OPEN_SRC
#define LWIP_OPEN_SRC
// #endif
// If ENABLE_ESP_MDNS_RESPONDER_PASSIV_MODE is defined, the mDNS responder ignores a successful probing
// This allows to drive the responder in a environment, where 'update()' isn't called in the loop //
//#define ENABLE_ESP_MDNS_RESPONDER_PASSIV_MODE // If ENABLE_ESP_MDNS_RESPONDER_PASSIV_MODE is defined, the mDNS responder ignores a successful probing
// This allows to drive the responder in a environment, where 'update()' isn't called in the loop
// Enable/disable debug trace macros //#define ENABLE_ESP_MDNS_RESPONDER_PASSIV_MODE
#ifdef DEBUG_ESP_MDNS_RESPONDER
#define DEBUG_ESP_MDNS_INFO // Enable/disable debug trace macros
#define DEBUG_ESP_MDNS_ERR #ifdef DEBUG_ESP_MDNS_RESPONDER
#define DEBUG_ESP_MDNS_TX #define DEBUG_ESP_MDNS_INFO
#define DEBUG_ESP_MDNS_RX #define DEBUG_ESP_MDNS_ERR
#endif #define DEBUG_ESP_MDNS_TX
#define DEBUG_ESP_MDNS_RX
#ifdef DEBUG_ESP_MDNS_RESPONDER #endif
#ifdef DEBUG_ESP_MDNS_INFO
#define DEBUG_EX_INFO(A) A #ifdef DEBUG_ESP_MDNS_RESPONDER
#else #ifdef DEBUG_ESP_MDNS_INFO
#define DEBUG_EX_INFO(A) do { (void)0; } while (0) #define DEBUG_EX_INFO(A) A
#endif #else
#ifdef DEBUG_ESP_MDNS_ERR #define DEBUG_EX_INFO(A) do { (void)0; } while (0)
#define DEBUG_EX_ERR(A) A #endif
#else #ifdef DEBUG_ESP_MDNS_ERR
#define DEBUG_EX_ERR(A) do { (void)0; } while (0) #define DEBUG_EX_ERR(A) A
#endif #else
#ifdef DEBUG_ESP_MDNS_TX #define DEBUG_EX_ERR(A) do { (void)0; } while (0)
#define DEBUG_EX_TX(A) A #endif
#else #ifdef DEBUG_ESP_MDNS_TX
#define DEBUG_EX_TX(A) do { (void)0; } while (0) #define DEBUG_EX_TX(A) A
#endif #else
#ifdef DEBUG_ESP_MDNS_RX #define DEBUG_EX_TX(A) do { (void)0; } while (0)
#define DEBUG_EX_RX(A) A #endif
#else #ifdef DEBUG_ESP_MDNS_RX
#define DEBUG_EX_RX(A) do { (void)0; } while (0) #define DEBUG_EX_RX(A) A
#endif #else
#define DEBUG_EX_RX(A) do { (void)0; } while (0)
#ifdef DEBUG_ESP_PORT #endif
#define DEBUG_OUTPUT DEBUG_ESP_PORT
#else #ifdef DEBUG_ESP_PORT
#define DEBUG_OUTPUT Serial #define DEBUG_OUTPUT DEBUG_ESP_PORT
#endif #else
#else #define DEBUG_OUTPUT Serial
#define DEBUG_EX_INFO(A) do { (void)0; } while (0) #endif
#define DEBUG_EX_ERR(A) do { (void)0; } while (0) #else
#define DEBUG_EX_TX(A) do { (void)0; } while (0) #define DEBUG_EX_INFO(A) do { (void)0; } while (0)
#define DEBUG_EX_RX(A) do { (void)0; } while (0) #define DEBUG_EX_ERR(A) do { (void)0; } while (0)
#endif #define DEBUG_EX_TX(A) do { (void)0; } while (0)
#define DEBUG_EX_RX(A) do { (void)0; } while (0)
#endif
/* Replaced by 'lwip/prot/dns.h' definitions
#ifdef MDNS_IP4_SUPPORT
#define MDNS_MULTICAST_ADDR_IP4 (IPAddress(224, 0, 0, 251)) // ip_addr_t v4group = DNS_MQUERY_IPV4_GROUP_INIT /* Replaced by 'lwip/prot/dns.h' definitions
#endif #ifdef MDNS_IP4_SUPPORT
#ifdef MDNS_IP6_SUPPORT #define MDNS_MULTICAST_ADDR_IP4 (IPAddress(224, 0, 0, 251)) // ip_addr_t v4group = DNS_MQUERY_IPV4_GROUP_INIT
#define MDNS_MULTICAST_ADDR_IP6 (IPAddress("FF02::FB")) // ip_addr_t v6group = DNS_MQUERY_IPV6_GROUP_INIT #endif
#endif*/ #ifdef MDNS_IP6_SUPPORT
//#define MDNS_MULTICAST_PORT 5353 #define MDNS_MULTICAST_ADDR_IP6 (IPAddress("FF02::FB")) // ip_addr_t v6group = DNS_MQUERY_IPV6_GROUP_INIT
#endif*/
/* //#define MDNS_MULTICAST_PORT 5353
* This is NOT the TTL (Time-To-Live) for MDNS records, but the
* subnet level distance MDNS records should travel. /*
* 1 sets the subnet distance to 'local', which is default for MDNS. This is NOT the TTL (Time-To-Live) for MDNS records, but the
* (Btw.: 255 would set it to 'as far as possible' -> internet) subnet level distance MDNS records should travel.
* 1 sets the subnet distance to 'local', which is default for MDNS.
* However, RFC 3171 seems to force 255 instead (Btw.: 255 would set it to 'as far as possible' -> internet)
*/
#define MDNS_MULTICAST_TTL 255/*1*/ However, RFC 3171 seems to force 255 instead
*/
/* #define MDNS_MULTICAST_TTL 255/*1*/
* This is the MDNS record TTL
* Host level records are set to 2min (120s) /*
* service level records are set to 75min (4500s) This is the MDNS record TTL
*/ Host level records are set to 2min (120s)
#define MDNS_HOST_TTL 120 service level records are set to 75min (4500s)
#define MDNS_SERVICE_TTL 4500 */
#define MDNS_HOST_TTL 120
/* #define MDNS_SERVICE_TTL 4500
* Compressed labels are flaged by the two topmost bits of the length byte being set
*/ /*
#define MDNS_DOMAIN_COMPRESS_MARK 0xC0 Compressed labels are flaged by the two topmost bits of the length byte being set
/* */
* Avoid endless recursion because of malformed compressed labels #define MDNS_DOMAIN_COMPRESS_MARK 0xC0
*/ /*
#define MDNS_DOMAIN_MAX_REDIRCTION 6 Avoid endless recursion because of malformed compressed labels
*/
/* #define MDNS_DOMAIN_MAX_REDIRCTION 6
* Default service priority and weight in SRV answers
*/ /*
#define MDNS_SRV_PRIORITY 0 Default service priority and weight in SRV answers
#define MDNS_SRV_WEIGHT 0 */
#define MDNS_SRV_PRIORITY 0
/* #define MDNS_SRV_WEIGHT 0
* Delay between and number of probes for host and service domains
* Delay between and number of announces for host and service domains /*
* Delay between and number of service queries; the delay is multiplied by the resent number in '_checkServiceQueryCache' Delay between and number of probes for host and service domains
*/ Delay between and number of announces for host and service domains
#define MDNS_PROBE_DELAY 250 Delay between and number of service queries; the delay is multiplied by the resent number in '_checkServiceQueryCache'
#define MDNS_PROBE_COUNT 3 */
#define MDNS_ANNOUNCE_DELAY 1000 #define MDNS_PROBE_DELAY 250
#define MDNS_ANNOUNCE_COUNT 8 #define MDNS_PROBE_COUNT 3
#define MDNS_DYNAMIC_QUERY_RESEND_COUNT 5 #define MDNS_ANNOUNCE_DELAY 1000
#define MDNS_DYNAMIC_QUERY_RESEND_DELAY 5000 #define MDNS_ANNOUNCE_COUNT 8
#define MDNS_DYNAMIC_QUERY_RESEND_COUNT 5
#define MDNS_DYNAMIC_QUERY_RESEND_DELAY 5000
/*
* Force host domain to use only lowercase letters
*/ /*
//#define MDNS_FORCE_LOWERCASE_HOSTNAME Force host domain to use only lowercase letters
*/
/* //#define MDNS_FORCE_LOWERCASE_HOSTNAME
* Enable/disable the usage of the F() macro in debug trace printf calls.
* There needs to be an PGM comptible printf function to use this. /*
* Enable/disable the usage of the F() macro in debug trace printf calls.
* USE_PGM_PRINTF and F There needs to be an PGM comptible printf function to use this.
*/
#define USE_PGM_PRINTF USE_PGM_PRINTF and F
*/
#ifdef USE_PGM_PRINTF #define USE_PGM_PRINTF
#else
#ifdef F #ifdef USE_PGM_PRINTF
#undef F #else
#endif #ifdef F
#define F(A) A #undef F
#endif #endif
#define F(A) A
} // namespace MDNSImplementation #endif
} // namespace esp8266 } // namespace MDNSImplementation
// Include the main header, so the submodlues only need to include this header } // namespace esp8266
#include "LEAmDNS.h"
// Include the main header, so the submodlues only need to include this header
#include "LEAmDNS.h"
#endif // MDNS_PRIV_H
#endif // MDNS_PRIV_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,26 @@
/* /*
* LEAmDNS_Priv.h LEAmDNS_Priv.h
*
* License (MIT license): License (MIT license):
* Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. THE SOFTWARE.
*
*/ */
#ifndef MDNS_LWIPDEFS_H #ifndef MDNS_LWIPDEFS_H
#define MDNS_LWIPDEFS_H #define MDNS_LWIPDEFS_H

View File

@ -1,31 +0,0 @@
#!/bin/sh
set -e
org=$(cd ${0%/*}; pwd)
cd ${org}/..
pwd
test -d cores/esp8266
test -d libraries
# this warning question will be removed after restyle-all.sh is renamed to restyle.sh
echo "This is dangerous if you have modified your local repository"
echo "type iknowwhatido to continue"
read ans
test "$ans" = iknowwhatido || exit 1
for d in cores/esp8266 libraries; do
for e in c cpp h; do
find $d -name "*.$e" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_core.conf {} \;
done
done
for d in libraries; do
find $d -name "*.ino" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_examples.conf {} \;
done

19
tests/restyle-examples-only.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -e
org=$(cd ${0%/*}; pwd)
cd ${org}/..
pwd
test -d cores/esp8266
test -d libraries
# in a near future, restyle-all.sh will be renamed to restyle.sh
# and will be checked against CI
for d in libraries; do
find $d -name "*.ino" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_examples.conf {} \;
done

View File

@ -8,12 +8,21 @@ pwd
test -d cores/esp8266 test -d cores/esp8266
test -d libraries test -d libraries
# in a near future, restyle-all.sh will be renamed to restyle.sh #all="cores/esp8266 libraries"
# and will be checked against CI all="libraries/ESP8266mDNS"
for d in $all; do
for e in c cpp h; do
find $d -name "*.$e" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_core.conf {} \;
done
done
for d in libraries; do for d in libraries; do
find $d -name "*.ino" -exec \ find $d -name "*.ino" -exec \
astyle \ astyle \
--suffix=none \ --suffix=none \
--options=${org}/astyle_examples.conf {} \; --options=${org}/astyle_examples.conf {} \;
done done