mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Add TXT support
This commit is contained in:
@ -57,6 +57,13 @@ struct MDNSService {
|
||||
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];
|
||||
};
|
||||
|
||||
class MDNSResponder {
|
||||
@ -78,16 +85,25 @@ public:
|
||||
addService(service.c_str(), proto.c_str(), port);
|
||||
}
|
||||
|
||||
void enableArduino(uint16_t port, bool auth=false);
|
||||
bool addServiceTxt(char *name, char *proto, char *txt);
|
||||
void addServiceTxt(const char *name, const char *proto, const char *txt){
|
||||
addServiceTxt((char *)name, (char *)proto, (char *)txt);
|
||||
}
|
||||
void addServiceTxt(String name, String proto, String txt){
|
||||
addServiceTxt(name.c_str(), proto.c_str(), txt.c_str());
|
||||
}
|
||||
|
||||
void enableArduino(uint16_t port, bool auth=false);
|
||||
|
||||
private:
|
||||
struct MDNSService * _services;
|
||||
UdpContext* _conn;
|
||||
char _hostName[128];
|
||||
bool _arduinoAuth;
|
||||
|
||||
uint32_t _getOurIp();
|
||||
uint16_t _getServicePort(char *service, char *proto);
|
||||
MDNSTxt * _getServiceTxt(char *name, char *proto);
|
||||
uint16_t _getServiceTxtLen(char *name, char *proto);
|
||||
void _parsePacket();
|
||||
void _reply(uint8_t replyMask, char * service, char *proto, uint16_t port);
|
||||
};
|
||||
|
Reference in New Issue
Block a user