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

110 Commits

Author SHA1 Message Date
david gauchard
e5f4514847
mDNS: protect MDNSResponder::queryService against misuse (#7216)
* mDNS: protect MDNSResponder::queryService against misuse

* fix style
2020-04-15 14:22:02 -04:00
david gauchard
a8515a7d66
use STA as default interface in mDNS (#7042) 2020-02-05 10:14:42 +01:00
LeisureLadi
7b0fa3554c Update LEAmDNS.cpp (fix issue #6982) (#7025)
* Update LEAmDNS.cpp (issue #6982)

Check m_pUDPContext before calling functions to reset WiFi event callbacks, stop probing ... to close #6982

* Update LEAmDNS.cpp

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-01-27 16:08:30 -08:00
Dirk Mueller
8bc5a10d6d Further const correctness / String by reference passing cleanups (#6571)
There are actually several instances where we pass in read-only
parameters as pass-by-value, where in the case of String() that
is inefficient as it involves copy-constructor/temp string creations.

We can avoid that, similarly to single character string concatenations
done via string literals instead of char literals.
2019-10-31 16:02:39 +01:00
Allman-astyler
9bdcd4f36a Allman astyle: mDNS (#6629)
* allmanize mDNS
2019-10-10 23:30:06 +02:00
Max Prokhorov
d62fb9ffeb MDNS: fix legacy unicast responses (#6613)
* mdns: use ID from parameter struct when constructing response message

* print id for legacy requests
2019-10-07 14:25:51 +02:00
david gauchard
5ca0bde200 MDNS: fix random crash on startup (#6261)
* mDNS debug option + AP address is used by default when STA is also present

* mDNS: store network interface, checking it is up

* igmp: force on selected interface (avoid crash *sometimes*)

* fix for all lwip2 ipv4 ipv6 & lwip1

* mdns: IPAddress is not needed to reference associated interface

* mdns: debug: fix print warnings

* emulation: add ets_strncpy

* emulation: truly emulate AddrList (remove fake one)
2019-09-04 20:10:47 -07:00
david gauchard
06f1865628
new network feature: NAPT (widely known as NAT) (#6360)
* lwIP: napt patches (enabled with lwip2 w/o IPv6 w/ features)
2019-08-28 17:51:14 +02:00
Dirk O. Kaar
48ace77b48 Refactored to avoid compiler warning (#6278)
Fixes commit 2d9253e46c41ef6949759ec028a356917d289831.
2019-07-10 10:47:01 -07:00
david gauchard
6272e897ca
mock: addrList fix (#6248)
* improve mock tcp write
* mock addrlist
* add a single mock build in travis
2019-07-03 09:49:03 +02:00
david gauchard
f9009b8a5e
mDNS: restriction to a single interface (#6224)
Default interface is STA (or AP if available and STA is unavailable).
An interface can also be specified in ::begin() by its IP address.
MDNS will not cross interfaces (there is currently no notion of "bridged interfaces")

Multiple instances should be working, this is not tested in this commit.
2019-06-27 09:30:12 +02:00
Dirk O. Kaar
2d9253e46c The use of bind in Ticker.h is prone to type inference failure (#6129)
* std::bind has issues with type inference, use lambdas whereever possible.

* Fix indentation.

* More descriptive placeholder name in lambda expression

* Use formal argument names for remaining currying placeholders
2019-05-25 20:12:48 +02:00
Allman-astyler
eea9999dc5 Revert "Allman now (#6080)" (#6090)
This reverts commit 98125f88605cd7e46e9be4e1b3ad0600dd5d2b51.
2019-05-14 00:09:54 +02:00
Allman-astyler
98125f8860 Allman now (#6080)
* switch restyle script for CI

* remove confirmation

* restyle with allman
2019-05-13 16:41:34 +02:00
hreintke
106d6f33a0 MDNS Callback setting needs std::bind parameter by reference instead of by value (#6037) 2019-05-02 07:54:43 -04:00
david gauchard
9a2ed274f3 polledTimeout: add option to use CPU count instead of millis() (#5870)
* polledTimeout: add option to use CPU count instead of millis()

* use more "using" alias

* more c++/clear code, using typename (thanks @devyte)

* rename class name to include unit, introduce timeMax() and check it with assert()

* remove useless defines

* improve api readability, add micro-second unit

* update example

* mock: emulate getCycleCount, add/fix polledTimeout CI test

* + nano-seconds, assert -> message, comments, host test

* allow 0 for timeout (enables immediate timeout, fix division by 0)

* typo, set member instead of local variable

* unify error message

* slight change on checkExpired() allows "never expired"
also removed printed message, add YieldAndDelay, simplify calculations

* remove traces of debug.h/cpp in this PR

* include missing <limits> header

* back to original expired test, introduce boolean _neverExpires, fix reset(), getTimeout() is invalid

* fix expiredOneShot with _timeout==0 check

* reenable getTimeout()

* expose checkExpired with unit conversion

* fix timing comments, move critical code to iram

* add member ::neverExpires and use it where relevant

* improve clarity

* remove exposed checkExpired(), adapt LEAmDNS with equivalent

* add API ::resetToNeverExpires(), use it in LEAmDNS

* remove offending constness from ::flagged() LEAmDNS (due do API fix in PolledTimeout)

* simplify "Fast" base classes

* minor variable rename

* Fix examples

* compliance with good c++ manners

* minor changes for consistency

* add missing const

* expired() and bool() moved to iram

* constexpr compensation computing

* add/update comments

* move neverExpires and alwaysExpired
2019-04-05 10:50:53 -03:00
Zachary Drew
7a2e935f53 Fix OTA in AP mode (#5894)
OTA is broken in AP mode because ESP8266mDNS is checking whether the station is connected before processing. Change the logic to WiFi.isConnected() OR WiFi.softAPgetStationNum()>0 fixes the issue.
2019-03-21 12:05:16 -07:00
Max Prokhorov
8961bba94e LEAmDNS: remove implicit debug statements (#5895) 2019-03-21 17:04:12 +01:00
hreintke
82789d201c Functional update, host and service probes (#5653)
* Functional update, host and service probes

* Fix ServiceMonitor.ino warnings

* Adding MDNSServiceQueryCallback functional
ServiceMonitor.ino needs some updates for web page but works on Serial output.

* DynamicServices Functional

* Fix ServiceMonitor to match latest MDNSServiceInfo

* Fix unused variable in LEAdns.h

* mDNS_Clock.ino fix

* example restyle

* Add keyValues and answerInfo

* Waring and formattin fix

* Change     struct MDNSServiceInfo   {  MDNSServiceInfo(MDNSResponder ...
to     struct MDNSServiceInfo { MDNSServiceInfo(MDNSResponder&

* Make AnswerType user friendly

* Update ServiceInfo example

* Code cleanup

* AnswerType update, Astyle update servicemonitor

* Update clock example to webserver

* Second typedef for probe callbacks
Change String -> const char* at multiple locations

* Optimizations

* Update callbacks to void

* esp32 compatibility

* std::map to const char*

* Fix emplace_back call

* Change Dynamic callback to void(...)

* Add WiFi events reset() in close()
2019-02-05 00:40:45 -03:00
LaborEtArs
3f267bd238 LEAmDNS_Fixes_1_3 (#5689)
* LEAmDNS_Fixes_1_3

* Updated LEAmDNSResponder::begin()
2019-01-29 23:24:59 -03:00
david gauchard
f42bfdfc0d
adaptations for lwIP-v1.4 (#5682)
* adaptations for lwIP-v1.4
* add lwIP-v1.4 in CI
2019-01-28 22:31:59 +01:00
LaborEtArs
a89ab24edc LEAmDNS Fixes (#5641)
- Better separation of ESP wifi thread code from user thread code
- Added a flag for 'update()'-less use (disabled by default)
- The too fast updates for service queries are fixed
- Switched fully to PolledTimeout; LEATimeFlag not needed anymore (BTW: a const 'expired()' method would be helpful)
- The device should stay visible now even after the first TTL timeout
- Improved service querying (queries five times now)
- Fixed TTL (bug introduced with Fixes 1.0)
2019-01-22 12:21:42 +01:00
hreintke
e9a6fd2f82 Update mDNS examples to use HTTP Server instead of TCP Server (#5589) 2019-01-22 10:04:56 +01:00
LaborEtArs
570b9a6b6a LEAmDNS Fixes 1.1 (#5619)
* Fixes 1.1

- Better separation of ESP wifi thread code from user thread code
- Added a flag for 'update()'-less use (disabled by default)
- The too fast updates for service queries are fixed
- Switched fully to PolledTimeout; LEATimeFlag not needed anymore (BTW: a const 'expired()' method would be helpful)
- The device should stay visible now even after the first TTL timeout
- Improved service querying (queries five times now)

* Update mDNS_Clock.ino

Removed references to LEATimeFlag.h

* Update mDNS_Clock.ino

Styling
2019-01-18 15:59:26 -03:00
hreintke
62b8ac6be7 Fix LeamDNS examples (#5563)
* Fix LeamDNS examples

* Fix Style check error

* Another style fix
2018-12-29 00:00:16 -03:00
david gauchard
eb5d636f0d
use newlib api in new mDNS, fix host using mDNS (#5545) 2018-12-27 22:06:10 +01:00
david gauchard
e3bc3c226b
Fixes for IPv6, added in CI (#5557) 2018-12-27 16:13:48 +01:00
Takayuki 'January June' Suwa
8049543e98 mDNS: Add support for String arg to begin() (#5542)
Analogous to commit dd6333ee8b26dd9cc82dea252ba150e85c0ebb11
2018-12-23 12:57:34 -03:00
david gauchard
228ad7ed75 tests/host: fixes and updates (#5537)
(LEAmDNS, broken pipe, non blocking accepted sockets, digitalRead)
2018-12-22 03:03:11 -03:00
Peter
64f7147da3 Undo move of keywords.txt and readme.rst for ESP8266mDNS library (#5495)
The keywords.txt and readme.rst for the ESP8266mDNS library got caught up in the reorganisation of the library files.
2018-12-14 06:26:18 -08:00
Develo
e9d052c621
WIP - Update ArduinoOTA and examples with MDNS.update() calls (#5494)
* ArduinoOTA: allow use without MDNS, add MDNS.update() in handle()

* Update examples with MDNS.update() in loop

* Update CaptivePortalAdvanced.ino

Fix typo

* Update CaptivePortalAdvanced.ino

astyle

* Update Arduino_Wifi_AVRISP.ino

astyle
2018-12-14 03:29:32 -03:00
Earle F. Philhower, III
7898ca7b46 Convert to standard PSTR/PROGMEM macros (#5458)
The bug referenced in the code that required a custom macro to enable
PSTR/PROGMEM compilation ( https://github.com/esp8266/Arduino/issues/3369 )
was fixed a while back and all PROGMEM references now live in their own
save .sections.

This patch simply is the output of `sed -i s/PSTR_LEA/PSTR/g *` and
`sed -i s/PROGMEM_LEA/PROGMEM/g *` on the codebase and the removal
of those defines.
2018-12-08 23:43:13 -03:00
Develo
4d15590096
formalization of LEA's mdns rewrite (#5450)
* formalization of LEA's mdns rewrite (code), minor changes to polledTimeout

* fix typo

* Fix mdns examples
2018-12-08 19:36:20 -03:00
LaborEtArs
58a044b254 LEAmDNS - Multicast DNS Responder (#5442)
* LEAmDNS Responder (II)

Created a new branch to solve commit conflicts with recent changes to ESP8266mDNSResponder.cpp by d-a-v.

* Removed millis() roll-over issues

* fix LEA-mDNS

* astyle on lea-mdns examples

* add compatibility with lwIP-v1

* ditto

* use strncasecmp instead of lwip's strnicmp from lwIP-v2 (thanks @devyte)

* ditto

* fixes

* Update mDNS_Clock.ino

unindent

* Update mDNS_ServiceMonitor.ino

unindent

* Update LEAmDNS.h

Add setInstanceName() forwarder for compat

* Disable DEBUG_ESP_MDNS_RESPONDER by default

* [Fixed] Debug output line

DEBUG_OUTPUT needs to go inside DEBUG_EX_ function otherwise throw error if DEBUG_ESP_MDNS_RESPONDER is not defined
2018-12-05 16:51:01 -03:00
david gauchard
92373a9837 Deprecate axTLS, update examples (#5366)
* update examples

* fix serial<->tcp example, use STASSID instead of SSID (name collision)

* fix HTTPSRequest.ino

* update AxTLS HTTPS examples, update AxTLS API to deprecated

* fixes

* fixes + fix astyle (no preproc directives) + restyling script

* fix HTTPClient library

* fixes

* common.sh: do not reload arduino when already present (for locally CI testing)

* common.sh: do not reload ArduinoJson when already present (for locally CI testing)

* fix

* fix

* fix deprecated example

* fix WiFiHTTPSServer.ino

* reduce footprint

* wipfix

* fix led builtin

* fix example

* finished updating APSSID on all examples

* style

* restyle examples

* helper to run CI test locally

* local CI runner more verbose

* +const

* deprecation deprecation

* deprecation

* Update NTPClient.ino

const char[] => const char *

* Update interactive.ino

const char[] => const char *
2018-11-29 20:49:27 -08:00
david gauchard
5c4db3acf4
IPv6 on esp8266-nonos-sdk and arduino (#5136) 2018-11-27 23:07:47 +01:00
dav1901
cd05bae0e8 Pass string objects by reference (#5378) 2018-11-25 11:18:44 -03:00
david gauchard
74ca42f829 Sketch emulation on host (#5342)
* WIP compile examples on host with 'make examples'

* WIP bufferize tcp input

* WIP Makefile

* WIP network to rework, tcp/udp to factorize, udp addresses broken

* minor changes to the core

* WIP basic udp working

* WIP mdns

* WIP mcast receiving, not sending

* WIP mdns OK

* beta version

* SSL + doc

* update travis host test command

* licenses

* typo

* doc: arduino builder is not around: declare functions before calling them

* fix with latest SSL PR, compile in 32 bits mode

* fix make clean

* make -m32 optional

* 32bits compiler ability tester

* WIP

* WIP (fix 1 vtable error, still another one to hunt with using spiffs)

* example astyle

* fix os_printf_plus

* load / save mock spiffs

* fix style

* fix using spiffs/mock

* don't mess ram

* update doc

* remove leftover

* optimization -Os except for CI, rename ARCH32 to FORCE32

* revert useless cast (not even compiled)

* remove unused function

* use proper type for pointer arithmetics

* makefile: sketch object and cpp file moved to bin/ directories
easier to clean, and IDE don't like them

* changes for review

* make use of %zd

* less verbose makefile by default (option)

* update readme
2018-11-20 18:51:45 -02:00
sadykowich
91519309d0 Add files via upload (#5119)
add missing ESP8266mDNS/library.properties
(needed for eclipse)
2018-09-11 15:36:14 +02:00
A C SREEDHAR REDDY
e0b6242e04 clear mdns.queryservice()'s previous result when called (#4894)
cleared the linkedlist.
* issue #4893
2018-07-05 23:17:53 -04:00
Mike Morrison
ea4720b03e fix issue with compressed pointer (issue 4648) (#4752) 2018-06-07 12:31:49 -04:00
fabianoms
4e2e1f268c AddServiceTxt returning bool (issue #1962) (#4507) 2018-03-17 20:16:26 -03:00
Jonatan Olofsson
461c922586 Compressed dns (#3769)
* Add UdpContext seek and tell

* Add support for DNS compressed messages

* mDNS compressed pointer: Validate offset before jumping
2018-03-16 09:46:35 -03:00
Ivan Grokhotkov
61cd8d8385 examples: format all .ino files
This formats all the example source files using Arduino style rules.
2018-03-08 14:32:06 +08:00
Develo
bb5787a1cd
Fix mdns buffer overrun by 1 (#4317)
* fix mdns buffer overflow, minor indent/prettify
2018-02-07 14:39:27 -03:00
Bryce Schober
20b7e480b5 Make ESP8266mDNS debug output like other ESP libs 2017-10-22 13:56:45 +08:00
James Stanley
2abbc36da4 Put WiFi into station mode in examples (#3731) 2017-10-22 13:53:01 +08:00
david gauchard
85078f47a0 yet less warnings for Wall Wextra guys 2017-05-18 06:43:22 -05:00
Ivan Grokhotkov
283eb97cd3 docs: convert to .rst and add readthedocs 2017-05-14 11:44:16 -05:00
Christopher Cooper
0c66c8a88f [Issue #3145] ESP8266mDNS: Improve compliance with DNS-SD RFC6763
- When the "_services._dns_sd._udp.local" meta-query is received, an
enumeration of services types is now returned (e.g. "_http._tcp.local")
instead of an enumeration of instances (e.g.
"MyService._http._tcp.local").  This is consistent with Section 9 of the
RFC.

- When a response is sent, the response records are now properly
partitioned as either answers or additional records.  Only response
records that were explicitly requested as a result of the questions
should be treated as answers.  This is consistent with Section 12 of the
RFC.

- The "MDNSResponder::advertiseServices()" method has been removed as it
was declared as "private" and is no longer being called.  This method
was sending a response on multiple interfaces when available, but this
wasn't really necessary since the interface from which the request was
received that caused it to be invoked is known.
2017-05-01 05:31:10 -05:00