Skip to content

Commit

Permalink
Add avahi code to look for the rmeote control information for the cli…
Browse files Browse the repository at this point in the history
…ent and get the port number from it.
  • Loading branch information
mikebrady committed Oct 5, 2017
1 parent 44c39fe commit 139c18b
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 138 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ man/Makefile
man/Makefile.in
scripts/shairport-sync.service
scripts/shairport-sync
shairport-sync.core

#Some dbus files that are automatically generated
dbus/data/org.gnome.ShairportSync.service
Expand Down
16 changes: 16 additions & 0 deletions mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ void mdns_unregister(void) {
}
}

void mdns_dacp_monitor(char* dacp_id,uint16_t *port,void** private_pointer) {
if ((config.mdns) && (config.mdns->mdns_dacp_monitor)) {
int error = config.mdns->mdns_dacp_monitor(dacp_id,port,private_pointer);
if (error) {
debug(1,"Error starting a DACP monitor.");
}
} else
debug(1,"Can't start a DACP monitor.");
}

void mdns_dacp_dont_monitor(void** private_pointer) {
if ((config.mdns) && (config.mdns->mdns_dacp_dont_monitor)) {
config.mdns->mdns_dacp_dont_monitor(private_pointer);
} else
debug(1,"Can't stop a DACP monitor.");
}
void mdns_ls_backends(void) {
mdns_backend **b = NULL;
printf("Available mDNS backends: \n");
Expand Down
6 changes: 6 additions & 0 deletions mdns.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#ifndef _MDNS_H
#define _MDNS_H

#include <stdint.h>
#include "config.h"

extern int mdns_pid;

void mdns_unregister(void);
void mdns_register(void);
void mdns_dacp_monitor(char* dacp_id,uint16_t *port,void** private_pointer);
void mdns_dacp_dont_monitor(void** private_pointer);

void mdns_ls_backends(void);

typedef struct {
char *name;
int (*mdns_register)(char *apname, int port);
void (*mdns_unregister)(void);
int (*mdns_dacp_monitor)(char* dacp_id,uint16_t *port,void** private_pointer);
void (*mdns_dacp_dont_monitor)(void** private_pointer);
} mdns_backend;

#ifdef CONFIG_METADATA
Expand Down
Loading

0 comments on commit 139c18b

Please sign in to comment.