1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

-replace char _hostName[63], char _instanceName[63], and char _txt[128] with Strings. Calling enableArduino allocates four TXT records, and there is quite an overhead of storing tcp_check=no inside an 128-byte buffer. Plus you gain flexibility by supporting TXT records larger than 128 bytes. Host and instance names should also be less than 63 characters most of the time.\n-move definitions of struct MDNSService and struct MDNSTxt to .cpp file, and use forward declaratio

This commit is contained in:
Eric Wilkison
2015-12-18 11:37:53 -08:00
parent 1c8f9f5468
commit c40cb79ec2
2 changed files with 61 additions and 61 deletions

View File

@ -52,19 +52,8 @@ License (MIT license):
class UdpContext;
struct MDNSService {
MDNSService* _next;
char _name[32];
char _proto[3];
uint16_t _port;
struct MDNSTxt * _txts;
uint16_t _txtLen; // length of all txts
};
struct MDNSTxt{
MDNSTxt * _next;
char _txt[128];
};
struct MDNSService;
struct MDNSTxt;
class MDNSResponder {
public:
@ -95,19 +84,19 @@ public:
void enableArduino(uint16_t port, bool auth=false);
void setInstanceName(char * name);
void setInstanceName(String name);
void setInstanceName(const char * name){
setInstanceName((char*) name);
setInstanceName(String(name));
}
void setInstanceName(String name){
setInstanceName(name.c_str());
void setInstanceName(char * name){
setInstanceName(String(name));
}
private:
struct MDNSService * _services;
UdpContext* _conn;
char _hostName[63];
char _instanceName[63];
String _hostName;
String _instanceName;
uint32_t _getOurIp();
uint16_t _getServicePort(char *service, char *proto);