Make the register interfaces compatible with SPS 4.1. The secondary message information is ignored.

This commit is contained in:
Mike Brady
2022-08-10 09:12:09 +01:00
parent 437048c5ff
commit 6c1625e6f2
2 changed files with 16 additions and 11 deletions
+12 -8
View File
@@ -80,15 +80,17 @@ static int fork_execvp(const char *file, char *const argv[]) {
return response;
}
static int mdns_external_avahi_register(char *apname, __attribute__((unused)) int port,
__attribute__((unused)) char **txt_records) {
static int mdns_external_avahi_register(char *ap1name, __attribute__((unused)) char *ap2name,
__attribute__((unused)) int port,
__attribute__((unused)) char **txt_records,
__attribute__((unused)) char **secondary_txt_records) {
char mdns_port[6];
snprintf(mdns_port, sizeof(mdns_port), "%d", config.port);
char *argvwithoutmetadata[] = {
NULL, apname, config.regtype, mdns_port, MDNS_RECORD_WITHOUT_METADATA, NULL};
NULL, ap1name, config.regtype, mdns_port, MDNS_RECORD_WITHOUT_METADATA, NULL};
#ifdef CONFIG_METADATA
char *argvwithmetadata[] = {NULL, apname, config.regtype, mdns_port, MDNS_RECORD_WITH_METADATA,
char *argvwithmetadata[] = {NULL, ap1name, config.regtype, mdns_port, MDNS_RECORD_WITH_METADATA,
NULL};
#endif
char **argv;
@@ -120,16 +122,18 @@ static int mdns_external_avahi_register(char *apname, __attribute__((unused)) in
return -1;
}
static int mdns_external_dns_sd_register(char *apname, __attribute__((unused)) int port,
__attribute__((unused)) char **txt_records) {
static int mdns_external_dns_sd_register(char *ap1name, __attribute__((unused)) char *ap2name,
__attribute__((unused)) int port,
__attribute__((unused)) char **txt_records,
__attribute__((unused)) char **secondary_txt_records) {
char mdns_port[6];
snprintf(mdns_port, sizeof(mdns_port), "%d", config.port);
char *argvwithoutmetadata[] = {
NULL, apname, config.regtype, mdns_port, MDNS_RECORD_WITHOUT_METADATA, NULL};
NULL, ap1name, config.regtype, mdns_port, MDNS_RECORD_WITHOUT_METADATA, NULL};
#ifdef CONFIG_METADATA
char *argvwithmetadata[] = {NULL, apname, config.regtype, mdns_port, MDNS_RECORD_WITH_METADATA,
char *argvwithmetadata[] = {NULL, ap1name, config.regtype, mdns_port, MDNS_RECORD_WITH_METADATA,
NULL};
#endif
+4 -3
View File
@@ -38,8 +38,9 @@
static struct mdnsd *svr = NULL;
static int mdns_tinysvcmdns_register(char *apname, int port,
__attribute__((unused)) char **txt_records) {
static int mdns_tinysvcmdns_register(char *ap1name, __attribute__((unused)) char *ap2name, int port,
__attribute__((unused)) char **txt_records,
__attribute__((unused)) char **secondary_txt_records) {
struct ifaddrs *ifalist;
struct ifaddrs *ifa;
@@ -146,7 +147,7 @@ static int mdns_tinysvcmdns_register(char *apname, int port,
strcat(extendedregtype, ".local");
struct mdns_service *svc =
mdnsd_register_svc(svr, apname, extendedregtype, port, NULL,
mdnsd_register_svc(svr, ap1name, extendedregtype, port, NULL,
(const char **)txt); // TTL should be 75 minutes, i.e. 4500 seconds
mdns_service_destroy(svc);