Skip to content
Snippets Groups Projects
Commit d041a6cd authored by Luca Barbato's avatar Luca Barbato Committed by Felix Paul Kühne
Browse files

upnp: implement getPreferedAdapter for macOS


Signed-off-by: default avatarFelix Paul Kühne <felix@feepk.net>
parent 271b64ab
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,9 @@ libupnp_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(sddir)'
libupnp_plugin_la_LIBADD = $(UPNP_LIBS)
EXTRA_LTLIBRARIES += libupnp_plugin.la
sd_LTLIBRARIES += $(LTLIBupnp)
if HAVE_OSX
libupnp_plugin_la_LDFLAGS += -Wl,-framework,CoreFoundation,-framework,SystemConfiguration
endif
libpulselist_plugin_la_SOURCES = services_discovery/pulse.c
libpulselist_plugin_la_CFLAGS = $(AM_CFLAGS) $(PULSE_CFLAGS)
......
......@@ -334,11 +334,39 @@ done:
#ifdef UPNP_ENABLE_IPV6
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#include <SystemConfiguration/SystemConfiguration.h>
#include "vlc_charset.h"
inline char *getPreferedAdapter()
{
SCDynamicStoreRef session = SCDynamicStoreCreate(NULL, CFSTR("session"), NULL, NULL);
CFDictionaryRef q = (CFDictionaryRef) SCDynamicStoreCopyValue(session, CFSTR("State:/Network/Global/IPv4"));
char *returnValue = NULL;
if (q != NULL) {
const void *val;
if (CFDictionaryGetValueIfPresent(q, CFSTR("PrimaryInterface"), &val)) {
returnValue = FromCFString((CFStringRef)val, kCFStringEncodingUTF8);
}
}
CFRelease(q);
CFRelease(session);
return returnValue;
}
#else
inline char *getIpv4ForMulticast()
{
return NULL;
}
#endif
#else
inline char *getIpv4ForMulticast()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment