mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-25 20:02:37 +03:00
advertise all hosted services (written by me-no-dev)
This commit is contained in:
parent
0b42f53bf4
commit
7a35ee4813
@ -366,6 +366,10 @@ void MDNSResponder::_parsePacket(){
|
|||||||
memmove(protoName, protoName+1, protoNameLen);
|
memmove(protoName, protoName+1, protoNameLen);
|
||||||
protoNameLen--;
|
protoNameLen--;
|
||||||
protoParsed = true;
|
protoParsed = true;
|
||||||
|
} else if(strcmp("services", serviceName) == 0 && strcmp("_dns-sd", protoName) == 0){
|
||||||
|
_conn->flush();
|
||||||
|
advertiseServices();
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
#ifdef MDNS_DEBUG_ERR
|
#ifdef MDNS_DEBUG_ERR
|
||||||
Serial.printf("ERR_PROTO: %s\n", protoName);
|
Serial.printf("ERR_PROTO: %s\n", protoName);
|
||||||
@ -479,6 +483,18 @@ void MDNSResponder::enableArduino(uint16_t port, bool auth){
|
|||||||
addServiceTxt("arduino", "tcp", "auth_upload", (auth) ? "yes":"no");
|
addServiceTxt("arduino", "tcp", "auth_upload", (auth) ? "yes":"no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t MDNSResponder::advertiseServices(){
|
||||||
|
MDNSService* servicePtr;
|
||||||
|
size_t i = 0;
|
||||||
|
for (servicePtr = _services; servicePtr; servicePtr = servicePtr->_next) {
|
||||||
|
if(servicePtr->_port > 0){
|
||||||
|
_reply(0x0F, servicePtr->_name, servicePtr->_proto, servicePtr->_port);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
void MDNSResponder::_reply(uint8_t replyMask, char * service, char *proto, uint16_t port){
|
void MDNSResponder::_reply(uint8_t replyMask, char * service, char *proto, uint16_t port){
|
||||||
int i;
|
int i;
|
||||||
if(replyMask == 0) return;
|
if(replyMask == 0) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user