Merge pull request #933 from nhannam/raop-configurable-ports
[raop] Allow configuration of raop control and timing ports
This commit is contained in:
commit
90eb333f03
|
@ -276,6 +276,15 @@ audio {
|
|||
# path = "/path/to/fifo"
|
||||
#}
|
||||
|
||||
# AirPlay/Airport Express settings
|
||||
# common to all devices
|
||||
#airplay_shared {
|
||||
# UDP ports used when airplay devices make connections back to forked-daapd
|
||||
# (choosing specific ports may be helpful when running forked-daapd behind a firewall)
|
||||
# control_port = 0
|
||||
# timing_port = 0
|
||||
#}
|
||||
|
||||
# AirPlay/Airport Express device settings
|
||||
# (make sure you get the capitalization of the device name right)
|
||||
#airplay "My AirPlay device" {
|
||||
|
|
|
@ -137,6 +137,14 @@ static cfg_opt_t sec_alsa[] =
|
|||
CFG_END()
|
||||
};
|
||||
|
||||
/* AirPlay/ApEx shared section structure */
|
||||
static cfg_opt_t sec_airplay_shared[] =
|
||||
{
|
||||
CFG_INT("control_port", 0, CFGF_NONE),
|
||||
CFG_INT("timing_port", 0, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
/* AirPlay/ApEx device section structure */
|
||||
static cfg_opt_t sec_airplay[] =
|
||||
{
|
||||
|
@ -215,6 +223,7 @@ static cfg_opt_t toplvl_cfg[] =
|
|||
CFG_SEC("library", sec_library, CFGF_NONE),
|
||||
CFG_SEC("audio", sec_audio, CFGF_NONE),
|
||||
CFG_SEC("alsa", sec_alsa, CFGF_MULTI | CFGF_TITLE),
|
||||
CFG_SEC("airplay_shared", sec_airplay_shared, CFGF_NONE),
|
||||
CFG_SEC("airplay", sec_airplay, CFGF_MULTI | CFGF_TITLE),
|
||||
CFG_SEC("chromecast", sec_chromecast, CFGF_MULTI | CFGF_TITLE),
|
||||
CFG_SEC("fifo", sec_fifo, CFGF_NONE),
|
||||
|
|
|
@ -3064,6 +3064,7 @@ raop_v2_timing_start_one(struct raop_service *svc, int family)
|
|||
int on;
|
||||
int len;
|
||||
int ret;
|
||||
int timing_port;
|
||||
|
||||
#ifdef SOCK_CLOEXEC
|
||||
svc->fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
|
@ -3092,17 +3093,18 @@ raop_v2_timing_start_one(struct raop_service *svc, int family)
|
|||
memset(&sa, 0, sizeof(union sockaddr_all));
|
||||
sa.ss.ss_family = family;
|
||||
|
||||
timing_port = cfg_getint(cfg_getsec(cfg, "airplay_shared"), "timing_port");
|
||||
switch (family)
|
||||
{
|
||||
case AF_INET:
|
||||
sa.sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sa.sin.sin_port = 0;
|
||||
sa.sin.sin_port = htons(timing_port);
|
||||
len = sizeof(sa.sin);
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
sa.sin6.sin6_addr = in6addr_any;
|
||||
sa.sin6.sin6_port = 0;
|
||||
sa.sin6.sin6_port = htons(timing_port);
|
||||
len = sizeof(sa.sin6);
|
||||
break;
|
||||
}
|
||||
|
@ -3316,6 +3318,7 @@ raop_v2_control_start_one(struct raop_service *svc, int family)
|
|||
int on;
|
||||
int len;
|
||||
int ret;
|
||||
int control_port;
|
||||
|
||||
#ifdef SOCK_CLOEXEC
|
||||
svc->fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
|
@ -3344,17 +3347,18 @@ raop_v2_control_start_one(struct raop_service *svc, int family)
|
|||
memset(&sa, 0, sizeof(union sockaddr_all));
|
||||
sa.ss.ss_family = family;
|
||||
|
||||
control_port = cfg_getint(cfg_getsec(cfg, "airplay_shared"), "control_port");
|
||||
switch (family)
|
||||
{
|
||||
case AF_INET:
|
||||
sa.sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sa.sin.sin_port = 0;
|
||||
sa.sin.sin_port = htons(control_port);
|
||||
len = sizeof(sa.sin);
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
sa.sin6.sin6_addr = in6addr_any;
|
||||
sa.sin6.sin6_port = 0;
|
||||
sa.sin6.sin6_port = htons(control_port);
|
||||
len = sizeof(sa.sin6);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue