Clean up mdnsresponder whitespace issues
This commit is contained in:
parent
e84b855368
commit
2d0e868011
2 changed files with 65 additions and 66 deletions
|
|
@ -488,11 +488,11 @@ void mdns_add_A(const char* rKey, u32_t ttl, ip_addr_t addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void mdns_add_facility( const char* instanceName, // Friendly name, need not be unique
|
void mdns_add_facility( const char* instanceName, // Friendly name, need not be unique
|
||||||
const char* serviceName, // Must be _name
|
const char* serviceName, // Must be "name", e.g. "hap" or "http"
|
||||||
const char* addText, // Must be <key>=<value>
|
const char* addText, // Must be <key>=<value>
|
||||||
mdns_flags flags, // TCP or UDP
|
mdns_flags flags, // TCP or UDP
|
||||||
u16_t onPort, // port number
|
u16_t onPort, // port number
|
||||||
u32_t ttl // seconds
|
u32_t ttl // seconds
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
char key[64];
|
char key[64];
|
||||||
|
|
@ -502,26 +502,25 @@ void mdns_add_facility( const char* instanceName, // Friendly name, need not b
|
||||||
|
|
||||||
#ifdef qDebugLog
|
#ifdef qDebugLog
|
||||||
printf("\nmDNS advertising instance %s protocol %s text %s on port %d %s TTL %d secs\n",
|
printf("\nmDNS advertising instance %s protocol %s text %s on port %d %s TTL %d secs\n",
|
||||||
instanceName,serviceName,addText,onPort,(flags & mdns_UDP) ? "UDP" : "TCP", ttl);
|
instanceName, serviceName, addText, onPort, (flags & mdns_UDP) ? "UDP" : "TCP", ttl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
snprintf(key,sizeof(key),"%s.%s.local.",serviceName,(flags & mdns_UDP) ? "_udp" :"_tcp");
|
snprintf(key, sizeof(key), "%s.%s.local.", serviceName, (flags & mdns_UDP) ? "_udp" :"_tcp");
|
||||||
snprintf(fullName,sizeof(fullName),"%s.%s",instanceName,key);
|
snprintf(fullName, sizeof(fullName), "%s.%s", instanceName, key);
|
||||||
snprintf(devName,sizeof(devName),"%s.local.",instanceName);
|
snprintf(devName, sizeof(devName), "%s.local.", instanceName);
|
||||||
|
|
||||||
if (!sdk_wifi_get_ip_info(STATION_IF,&ipInfo))
|
if (!sdk_wifi_get_ip_info(STATION_IF,&ipInfo))
|
||||||
ipInfo.ip.addr = IPADDR_NONE;
|
ipInfo.ip.addr = IPADDR_NONE;
|
||||||
|
|
||||||
// Order has significance for extraRR feature
|
// Order has significance for extraRR feature
|
||||||
mdns_add_TXT(fullName,ttl,addText);
|
mdns_add_TXT(fullName, ttl, addText);
|
||||||
mdns_add_A(devName,ttl,ipInfo.ip);
|
mdns_add_A(devName, ttl, ipInfo.ip);
|
||||||
mdns_add_SRV(fullName,ttl,onPort,devName);
|
mdns_add_SRV(fullName, ttl, onPort, devName);
|
||||||
mdns_add_PTR(key,ttl,fullName);
|
mdns_add_PTR(key, ttl, fullName);
|
||||||
|
|
||||||
// Optional, makes us browsable
|
// Optional, makes us browsable
|
||||||
if (flags & mdns_Browsable)
|
if (flags & mdns_Browsable)
|
||||||
mdns_add_PTR("_services._dns-sd._udp.local.",ttl,key);
|
mdns_add_PTR("_services._dns-sd._udp.local.",ttl,key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mdns_update_ipaddr(struct ip_info* ipInfo)
|
static void mdns_update_ipaddr(struct ip_info* ipInfo)
|
||||||
|
|
@ -641,7 +640,7 @@ static void mdns_reply(struct mdns_hdr* hdrP)
|
||||||
|
|
||||||
qp = mdns_get_question(qBase, qp, qStr, &qClass, &qType, &qUnicast);
|
qp = mdns_get_question(qBase, qp, qStr, &qClass, &qType, &qUnicast);
|
||||||
if (qClass==DNS_RRCLASS_IN || qClass==DNS_RRCLASS_ANY) {
|
if (qClass==DNS_RRCLASS_IN || qClass==DNS_RRCLASS_ANY) {
|
||||||
rsrcP = mdns_match(qStr,qType);
|
rsrcP = mdns_match(qStr, qType);
|
||||||
if (rsrcP) {
|
if (rsrcP) {
|
||||||
respLen = mdns_add_to_answer(rsrcP, mdns_response, respLen);
|
respLen = mdns_add_to_answer(rsrcP, mdns_response, respLen);
|
||||||
rHdr->numanswers = htons( htons(rHdr->numanswers) + 1 );
|
rHdr->numanswers = htons( htons(rHdr->numanswers) + 1 );
|
||||||
|
|
@ -663,7 +662,7 @@ static void mdns_reply(struct mdns_hdr* hdrP)
|
||||||
respLen = mdns_add_to_answer(extra, mdns_response, respLen);
|
respLen = mdns_add_to_answer(extra, mdns_response, respLen);
|
||||||
rHdr->numextrarr = htons( htons(rHdr->numextrarr) + 1 );
|
rHdr->numextrarr = htons( htons(rHdr->numextrarr) + 1 );
|
||||||
}
|
}
|
||||||
mdns_send_mcast(mdns_response,respLen);
|
mdns_send_mcast(mdns_response, respLen);
|
||||||
}
|
}
|
||||||
free(mdns_response);
|
free(mdns_response);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue