mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-30 09:03:23 -05:00
Advertise the _touch-able._tcp service
_touch-able._tcp is the service used by Remote.app to discover and identify libraries it interacts with.
This commit is contained in:
parent
d228e0dcb8
commit
73fa690fd4
32
src/main.c
32
src/main.c
@ -230,6 +230,7 @@ register_services(char *ffid, int no_rsp, int no_daap)
|
|||||||
char records[9][128];
|
char records[9][128];
|
||||||
int port;
|
int port;
|
||||||
uint32_t hash;
|
uint32_t hash;
|
||||||
|
uint64_t libhash;
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -289,6 +290,37 @@ register_services(char *ffid, int no_rsp, int no_daap)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < (sizeof(records) / sizeof(records[0])); i++)
|
||||||
|
{
|
||||||
|
memset(records[i], 0, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
libhash = murmur_hash64(libname, strlen(libname), 0);
|
||||||
|
|
||||||
|
snprintf(txtrecord[0], 128, "txtvers=1");
|
||||||
|
snprintf(txtrecord[1], 128, "DbId=%08" PRIX64, libhash);
|
||||||
|
snprintf(txtrecord[2], 128, "DvTy=iTunes");
|
||||||
|
snprintf(txtrecord[3], 128, "DvSv=2306"); /* Magic number! Yay! */
|
||||||
|
snprintf(txtrecord[4], 128, "Ver=131073"); /* iTunes 6.0.4 */
|
||||||
|
snprintf(txtrecord[5], 128, "OSsi=0x1F5"); /* Magic number! Yay! */
|
||||||
|
snprintf(txtrecord[6], 128, "CtlN=%s", libname);
|
||||||
|
|
||||||
|
/* Terminator */
|
||||||
|
txtrecord[7] = NULL;
|
||||||
|
|
||||||
|
/* The group name for the touch-able service advertising is a 64bit hash
|
||||||
|
* but is different from the DbId in iTunes. For now we'll use a hash of
|
||||||
|
* the library name for both, and we'll change that if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Use as scratch space for the hash */
|
||||||
|
snprintf(records[7], 128, "%08" PRIX64, libhash);
|
||||||
|
|
||||||
|
/* Register touch-able service, for Remote.app */
|
||||||
|
ret = mdns_register(records[7], "_touch-able._tcp", port, txtrecord);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user