Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LEA mDNS v2 #7540

Merged
merged 178 commits into from Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from 143 commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
66e79bf
LEAmDNS2 (Host Version)
Dec 2, 2019
9600318
Merge branch 'master' into LEAmDNS2
LaborEtArs Dec 2, 2019
af3a877
Second try :-)
Dec 3, 2019
56015f4
Merge branch 'LEAmDNS2' of https://github.com/LaborEtArs/Arduino into…
Dec 3, 2019
5287f82
Merge branch 'LEAmDNS2' of https://github.com/LaborEtArs/Arduino into…
d-a-v May 5, 2020
560c2a5
updated Source files from LEA
d-a-v May 7, 2020
d47f6f0
style
d-a-v May 8, 2020
8115134
Merge branch 'master' into LEAmDNS2
d-a-v May 8, 2020
1910848
two interface example is working (also with IPv6)
d-a-v May 8, 2020
c192667
restored former versions (legacy, LEAv1), clock example for new API
d-a-v May 8, 2020
0e692c3
add enableArduino() into LEAmDNSv2
d-a-v May 8, 2020
6d22b70
still using current LEA
d-a-v May 8, 2020
b7c3504
remove unwanted change
d-a-v May 8, 2020
ff0b100
remove unwanted changes
d-a-v May 8, 2020
e4bbed6
Merge branch 'LEAmDNS2' of github.com:d-a-v/Arduino into LEAmDNS2
d-a-v May 20, 2020
556bb1e
Merge branch 'master' into LEAmDNS2
d-a-v May 20, 2020
c6db2e5
wip
d-a-v May 23, 2020
b5fefcf
fix for lwIP-v1
d-a-v May 23, 2020
44ae221
Merge branch 'LEAmDNS2' into LEAmDNS2x
d-a-v May 23, 2020
1272926
wip
d-a-v May 23, 2020
5ffbe29
wip
d-a-v May 24, 2020
ad6b426
fix for lwIP-1.4
d-a-v May 24, 2020
d21edba
Merge branch 'LEAmDNS2' into LEAmDNS2x
d-a-v May 24, 2020
bae5f66
wip
d-a-v May 24, 2020
52787b2
wip
d-a-v May 24, 2020
b465c16
wip
d-a-v May 24, 2020
6646acb
wip - compilation OK - not tested
d-a-v May 25, 2020
eae8b4d
wip
d-a-v May 25, 2020
46f6d2b
clockv2 example: ap + sta
d-a-v May 25, 2020
0a81871
style
d-a-v May 25, 2020
b543f03
style
d-a-v May 25, 2020
8a392db
Merge branch 'master' into LEAmDNS2
d-a-v May 28, 2020
41bd315
using experimental namespace for not-default v2+Legacy API
d-a-v May 28, 2020
92cd216
ditto
d-a-v May 28, 2020
cc2af84
Fix HostProbeResult callback
hreintke May 30, 2020
ff3e869
Style
hreintke May 31, 2020
40262ce
fix copy-paste error
hreintke May 31, 2020
823396b
Merge branch 'LEAmDNS2' of https://github.com/Labor-Et-Ars/ESP8266-Ar…
d-a-v Jun 2, 2020
1a9e75c
Merge branch 'LEAmDNS2x' of github.com:d-a-v/Arduino into LEAmDNS2x
d-a-v Jun 3, 2020
6e18637
wip
d-a-v Jun 3, 2020
e82d252
wip
d-a-v Jun 3, 2020
0e0ef83
Merge branch 'master' into LEAmDNS2x
d-a-v Jun 4, 2020
9a3a696
wip. probe and service
hreintke Jun 6, 2020
930339e
wip query to use sendmessage() instead of sendmessage(netif)
hreintke Jun 7, 2020
1d62486
Merge branch 'LEAmDNS2x' of github.com:Labor-Et-Ars/ESP8266-Arduino i…
d-a-v Jun 7, 2020
bd3baa9
wip, installservicequery
hreintke Jun 7, 2020
27f275e
fix no retrun statement in sendmessage
hreintke Jun 7, 2020
5e58c73
wip installHostQuery
hreintke Jun 8, 2020
352a39a
Fix MDNS Clockv2 example
hreintke Jun 8, 2020
c786920
fix ipv6
hreintke Jun 8, 2020
450056e
Merge branch 'LEAmDNS2x' of github.com:Labor-Et-Ars/ESP8266-Arduino i…
d-a-v Jun 9, 2020
872a40d
Merge branch 'master' into LEAmDNS2x
d-a-v Jun 9, 2020
258afd4
fix emulation on host for LEAmDNS2x
d-a-v Jun 9, 2020
45c83ef
fix warning
d-a-v Jun 9, 2020
49979f2
comment out 3 delay(clsConsts::u32SendCooldown) - separate defines in…
d-a-v Jun 9, 2020
310526d
fix debug macros
d-a-v Jun 9, 2020
2204902
Add serviceMonitor_v2
hreintke Jun 11, 2020
46ab0a0
Improve MDNSServiceQueryCallback in servicemonior v1
hreintke Jun 11, 2020
225a46e
Fix HostDomainPort
hreintke Jun 11, 2020
39dafbc
temporary test mDNS_ServiceMonitor_v2_test.ino
d-a-v Jun 11, 2020
59a6ae4
remove useless debug messages
d-a-v Jun 11, 2020
accbd9c
fix debug macros
d-a-v Jun 12, 2020
1638402
always enable mdns error message when debug on serial port is enabled
d-a-v Jun 12, 2020
79efe99
fix crash in mDNS_ServiceMonitor_v2_test.ino
d-a-v Jun 12, 2020
bb08c8c
temporarily disable ipv6
d-a-v Jun 12, 2020
5505446
reintroduce `delay()` without `can_yield()` calls
d-a-v Jun 12, 2020
4563fde
netdump as an option
d-a-v Jun 12, 2020
6a83937
change mdns service names in test example
d-a-v Jun 13, 2020
868bddf
Merge branch 'master' into LEAmDNS2x
d-a-v Jun 13, 2020
cf74cc1
brings parts of #7375, + sendTimeout()
d-a-v Jun 14, 2020
f8533fc
use udp::sendTimeout
d-a-v Jun 14, 2020
5c3d2b6
fix constant
d-a-v Jun 14, 2020
54066fb
+mock udp::sendTimeout()
d-a-v Jun 14, 2020
295f397
fix typo
d-a-v Jun 14, 2020
bc10fbf
Fix HTTP Request in servicemonitor example
hreintke Jun 14, 2020
68d4409
emulation on host: adding key/value cmdline parameters usable in sket…
d-a-v Jun 16, 2020
6518db1
Merge branch 'master' into LEAmDNS2x
d-a-v Jun 16, 2020
9cd34f3
fix services enumeration
d-a-v Jun 16, 2020
7d99299
add LwipIntf::stateUpCB()
d-a-v Jun 18, 2020
44029e4
Merge branch 'lwipintfup' into LEAmDNS2x
d-a-v Jun 18, 2020
e73057a
sync with submodule
d-a-v Jun 18, 2020
e99897d
Merge branch 'lwipintfup' into LEAmDNS2x
d-a-v Jun 18, 2020
0e24587
use interface CB to restart mDNS
d-a-v Jun 18, 2020
39622af
ditto
d-a-v Jun 18, 2020
89068d3
Merge branch 'lwipintfup' into LEAmDNS2x
d-a-v Jun 18, 2020
9f99c76
use netif callback to restart mDNS
d-a-v Jun 18, 2020
d50b15c
ditto
d-a-v Jun 18, 2020
6a42f21
Merge branch 'lwipintfup' into LEAmDNS2x
d-a-v Jun 18, 2020
6b49de9
Fix Announce Failure
hreintke Jun 19, 2020
c90e9e2
allow user to select mDNS version before including ESP8266mDNS.h
d-a-v Jun 21, 2020
0df1d3b
typo
d-a-v Jun 21, 2020
411a941
fix namespace imports
d-a-v Jun 21, 2020
7e739ff
reimport clsLEAMDNSHost_Legacy::installServiceQuery() from initial so…
d-a-v Jun 21, 2020
2cfef04
clsMDNSHost -> clsLEAMDNSHost
d-a-v Jun 21, 2020
7fdf648
style
d-a-v Jun 21, 2020
64abb8c
false alarm #if0defines removed, log messages added
d-a-v Jun 22, 2020
166745d
style
d-a-v Jun 22, 2020
7bbd930
remove test example
d-a-v Jun 22, 2020
1309974
revert/fix ESP8266mDNS.h
d-a-v Jun 23, 2020
2cdc902
style
d-a-v Jun 30, 2020
11bd06b
Merge branch 'master' into LEAmDNS2x
d-a-v Jun 30, 2020
dd8d141
Merge branch 'master' into LEAmDNS2x
d-a-v Aug 12, 2020
3539444
fix multiple call to ::begin()
d-a-v Aug 12, 2020
468fa8c
ditto
d-a-v Aug 12, 2020
e5f0546
Merge branch 'master' into LEAmDNS2x
d-a-v Aug 20, 2020
057ceb5
enable LEA v1 by default (= no change to arduino master)
d-a-v Aug 20, 2020
bd6b0eb
style and fixes for CI
d-a-v Aug 20, 2020
fd5d277
remove lwIP-1.4 specifics
d-a-v Aug 20, 2020
27225e7
_P(PSTR())
d-a-v Aug 23, 2020
32cb828
sprintf always -> strcpy once
d-a-v Aug 23, 2020
6fede9b
comment
d-a-v Aug 23, 2020
91166a2
fix message
d-a-v Aug 23, 2020
57a2faf
fix host domain name and comment
d-a-v Aug 23, 2020
4b0f6e7
add TODO
d-a-v Aug 23, 2020
0b1cbba
remove comment
d-a-v Aug 23, 2020
07ca395
use lower case esp8266
d-a-v Aug 23, 2020
2839d59
fix strncpy size
d-a-v Aug 23, 2020
eda2e0b
astyle has issues with lambdas: rework logic to hide formatting issue
d-a-v Aug 23, 2020
3c34fca
remove old code
d-a-v Aug 23, 2020
29a2a88
remove service on request
d-a-v Aug 23, 2020
357a343
remove dead code
d-a-v Aug 23, 2020
01c1774
simplify use of tolower()
d-a-v Aug 23, 2020
3b1447c
strncpy: fix max len
d-a-v Aug 23, 2020
a296be0
knwon typo
d-a-v Aug 23, 2020
174e20e
fix bResult logic
d-a-v Aug 23, 2020
f3655f9
m_u8SentCount -> m_u32SentCount
d-a-v Aug 23, 2020
b8383e5
relavent -> relevant
d-a-v Aug 23, 2020
bdcfa73
fix strncpy
d-a-v Aug 23, 2020
69834c1
memcpy->strcpy to always have the ending \0
d-a-v Aug 23, 2020
42b05ce
remove redundant strcmp
d-a-v Aug 23, 2020
ab2d437
simplify fix strcpy
d-a-v Aug 23, 2020
60f6e15
ditto
d-a-v Aug 23, 2020
096094f
ditto
d-a-v Aug 23, 2020
ee08715
remove useless overloads
d-a-v Aug 23, 2020
c86b2d8
fix strncpy -> strcpy
d-a-v Aug 23, 2020
5c3f746
lenght typo
d-a-v Aug 23, 2020
2270b83
rework debug macros not nicely dealt by astyle
d-a-v Aug 23, 2020
5c7808a
clarify comment
d-a-v Aug 23, 2020
37d0300
align comment
d-a-v Aug 23, 2020
05b1581
typo: form -> from
d-a-v Aug 23, 2020
3431a01
typo: supportet -> supported
d-a-v Aug 23, 2020
04a01f0
style
d-a-v Aug 23, 2020
16504b2
fix typo in debug mode
d-a-v Aug 23, 2020
21a9096
simplification
d-a-v Aug 26, 2020
bae5612
add missing MIT licenses
d-a-v Aug 26, 2020
dd4c44f
fix previous fix from review: comparing with strlen is superfluous wh…
d-a-v Aug 26, 2020
2741d41
Revert "strncpy: fix max len"
hreintke Sep 13, 2020
7993108
fix more strncpy
d-a-v Sep 22, 2020
60f7456
comments for lwIPIntf-callback
d-a-v Sep 22, 2020
99de12a
using type alias LwipIntf::CBType
d-a-v Sep 22, 2020
3a22818
udpContext: move trySend to private section
d-a-v Sep 22, 2020
9047d2d
typos in comments
d-a-v Sep 22, 2020
cdd0a64
rename local mDNS instance in example
d-a-v Sep 22, 2020
a71e1c9
memory reservation for string in example
d-a-v Sep 22, 2020
fcd214b
string reservation
d-a-v Sep 22, 2020
6f92ac5
move strrstr() to stdlib_noniso.h
d-a-v Sep 22, 2020
53d5477
"good practices"
d-a-v Sep 22, 2020
281f67e
"good practices"
d-a-v Sep 22, 2020
9a1ad4b
_instanceName() return 0 when 0 has to be returned
d-a-v Sep 22, 2020
844abba
made some 0 into nullptr
d-a-v Sep 22, 2020
b27c540
typo
d-a-v Sep 22, 2020
a508202
typos
d-a-v Sep 22, 2020
da72802
static const -> constexpr
d-a-v Sep 22, 2020
140c45f
nsec comment
d-a-v Sep 22, 2020
fb1224c
typos
d-a-v Sep 22, 2020
0a18d0f
typedef -> using
d-a-v Sep 22, 2020
e50ff18
cleanup
d-a-v Sep 22, 2020
691c083
const for some function members
d-a-v Sep 22, 2020
0dab814
0 -> nullptr
d-a-v Sep 22, 2020
d4bf122
(*it). => it->
d-a-v Sep 22, 2020
00453f1
cleanup
d-a-v Sep 22, 2020
0c98b60
style
d-a-v Sep 22, 2020
15861ca
typo
d-a-v Sep 22, 2020
d84e323
Merge branch 'master' into LEAmDNS2x
d-a-v Sep 22, 2020
fb1a026
OTA service using hostname
hreintke Sep 24, 2020
df56854
remove: original mDNS implementation, and v2-to-v1=legacy adaptation …
d-a-v Sep 24, 2020
5f850f1
Merge branch 'master' into LEAmDNS2x
d-a-v Sep 24, 2020
4e97d1e
remove obsolete comments
d-a-v Sep 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions cores/esp8266/IPAddress.h
Expand Up @@ -32,6 +32,13 @@
struct ip_addr: ipv4_addr { };
#endif // !LWIP_IPV6

// to display a netif id with printf:
#define NETIFID_STR "%c%c%u"
#define NETIFID_VAL(netif) \
((netif)? (netif)->name[0]: '-'), \
((netif)? (netif)->name[1]: '-'), \
((netif)? netif_get_index(netif): 42)

// A class to make it easier to handle and pass around IP addresses
// IPv6 update:
// IPAddress is now a decorator class for lwIP's ip_addr_t
Expand Down
25 changes: 25 additions & 0 deletions cores/esp8266/LwipIntf.h
@@ -0,0 +1,25 @@

#ifndef _LWIPINTF_H
#define _LWIPINTF_H

#include <lwip/netif.h>

#include <functional>

class LwipIntf
{
private:

LwipIntf () { }
d-a-v marked this conversation as resolved.
Show resolved Hide resolved

protected:

static bool stateChangeSysCB (std::function<void(netif*)>&& cb);
d-a-v marked this conversation as resolved.
Show resolved Hide resolved

public:

static bool stateUpCB (std::function<void(netif*)>&& cb);

};

#endif // _LWIPINTF_H
42 changes: 42 additions & 0 deletions cores/esp8266/LwipIntfCB.cpp
@@ -0,0 +1,42 @@

#include <LwipIntf.h>
#include <Schedule.h>
#include <debug.h>

#define NETIF_STATUS_CB_SIZE 3

static int netifStatusChangeListLength = 0;
std::function<void(netif*)> netifStatusChangeList [NETIF_STATUS_CB_SIZE];
d-a-v marked this conversation as resolved.
Show resolved Hide resolved

extern "C" void netif_status_changed (struct netif* netif)
{
// override the default empty weak function
for (int i = 0; i < netifStatusChangeListLength; i++)
netifStatusChangeList[i](netif);
}

bool LwipIntf::stateChangeSysCB (std::function<void(netif*)>&& cb)
{
if (netifStatusChangeListLength >= NETIF_STATUS_CB_SIZE)
{
#if defined(DEBUG_ESP_CORE)
DEBUGV("NETIF_STATUS_CB_SIZE is too low\n");
#endif
return false;
}

netifStatusChangeList[netifStatusChangeListLength++] = cb;
return true;
}

bool LwipIntf::stateUpCB (std::function<void(netif*)>&& cb)
d-a-v marked this conversation as resolved.
Show resolved Hide resolved
{
return stateChangeSysCB([cb](netif* nif)
{
if (netif_is_up(nif))
schedule_function([cb, nif]()
{
cb(nif);
});
});
}
1 change: 1 addition & 0 deletions libraries/ArduinoOTA/ArduinoOTA.cpp
Expand Up @@ -21,6 +21,7 @@ extern "C" {
#include "include/UdpContext.h"

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
//#define MDNS2_EXPERIMENTAL_V1COMPAT
#include <ESP8266mDNS.h>
#endif

Expand Down
41 changes: 33 additions & 8 deletions libraries/ESP8266WiFi/src/include/UdpContext.h
Expand Up @@ -30,6 +30,7 @@ void esp_schedule();
}

#include <AddrList.h>
#include <PolledTimeout.h>

#define PBUF_ALIGNER_ADJUST 4
#define PBUF_ALIGNER(x) ((void*)((((intptr_t)(x))+3)&~3))
Expand Down Expand Up @@ -390,7 +391,16 @@ class UdpContext
return size;
}

bool send(const ip_addr_t* addr = 0, uint16_t port = 0)
void cancelBuffer ()
{
if (_tx_buf_head)
pbuf_free(_tx_buf_head);
_tx_buf_head = 0;
_tx_buf_cur = 0;
_tx_buf_offset = 0;
}

err_t trySend(const ip_addr_t* addr = 0, uint16_t port = 0, bool keepBuffer = true)
d-a-v marked this conversation as resolved.
Show resolved Hide resolved
{
size_t data_size = _tx_buf_offset;
pbuf* tx_copy = pbuf_alloc(PBUF_TRANSPORT, data_size, PBUF_RAM);
Expand All @@ -406,16 +416,12 @@ class UdpContext
data_size -= will_copy;
}
}
if (_tx_buf_head)
pbuf_free(_tx_buf_head);
_tx_buf_head = 0;
_tx_buf_cur = 0;
_tx_buf_offset = 0;
if (!keepBuffer)
cancelBuffer();
if(!tx_copy){
return false;
return ERR_MEM;
}


if (!addr) {
addr = &_pcb->remote_ip;
port = _pcb->remote_port;
Expand All @@ -434,6 +440,25 @@ class UdpContext
_pcb->ttl = old_ttl;
#endif
pbuf_free(tx_copy);
if (err == ERR_OK)
cancelBuffer();
return err;
}

bool send(const ip_addr_t* addr = 0, uint16_t port = 0)
{
return trySend(addr, port, /* don't keep buffer */false) == ERR_OK;
}

bool sendTimeout(const ip_addr_t* addr, uint16_t port,
esp8266::polledTimeout::oneShotFastMs::timeType timeoutMs)
{
err_t err;
esp8266::polledTimeout::oneShotFastMs timeout(timeoutMs);
while (((err = trySend(addr, port)) != ERR_OK) && !timeout)
delay(0);
if (err != ERR_OK)
cancelBuffer();
return err == ERR_OK;
}

Expand Down
Expand Up @@ -49,8 +49,11 @@
2. Open 'ESP8266mDNS.h' and set LEAmDNS to default.

*/
#include <ESP8266mDNS.h>
#include <PolledTimeout.h>

//#define MDNS2_EXPERIMENTAL_V1COMPAT
#include <ESP8266mDNS.h>

/*
Global defines and vars
*/
Expand Down