mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 04:57:06 +03:00
make AirPlay work in AP mode
This commit is contained in:
@@ -437,6 +437,12 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
|
|||||||
LOG_INFO("[%p]: received %s", ctx, method);
|
LOG_INFO("[%p]: received %s", ctx, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((buf = kd_lookup(headers, "Apple-Challenge")) != NULL) {
|
||||||
|
int n;
|
||||||
|
char *buf_pad, *p, *data_b64 = NULL, data[32];
|
||||||
|
|
||||||
|
LOG_INFO("[%p]: challenge %s", ctx, buf);
|
||||||
|
|
||||||
// try to re-acquire IP address if we were missing it
|
// try to re-acquire IP address if we were missing it
|
||||||
if (S_ADDR(ctx->host) == INADDR_ANY) {
|
if (S_ADDR(ctx->host) == INADDR_ANY) {
|
||||||
S_ADDR(ctx->host) = get_localhost(NULL);
|
S_ADDR(ctx->host) = get_localhost(NULL);
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void raop_sink_init(raop_cmd_vcb_t cmd_cb, raop_data_cb_t data_cb) {
|
|||||||
free(sink_name_buffer);
|
free(sink_name_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO( "mdns hostname set to: [%s] with servicename %s", hostname, sink_name);
|
LOG_INFO( "mdns hostname for ip %s set to: [%s] with servicename %s", inet_ntoa(host), hostname, sink_name);
|
||||||
|
|
||||||
// create RAOP instance, latency is set by controller
|
// create RAOP instance, latency is set by controller
|
||||||
uint8_t mac[6];
|
uint8_t mac[6];
|
||||||
|
|||||||
@@ -23,12 +23,7 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#else
|
#else
|
||||||
/*
|
#include "tcpip_adapter.h"
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <net/if_arp.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
*/
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -84,8 +79,26 @@ in_addr_t get_localhost(char **name)
|
|||||||
}
|
}
|
||||||
else return INADDR_ANY;
|
else return INADDR_ANY;
|
||||||
#else
|
#else
|
||||||
// missing platform here ...
|
tcpip_adapter_ip_info_t ipInfo;
|
||||||
return INADDR_ANY;
|
tcpip_adapter_if_t if_type = TCPIP_ADAPTER_IF_STA;
|
||||||
|
|
||||||
|
// then get IP address
|
||||||
|
tcpip_adapter_get_ip_info(if_type, &ipInfo);
|
||||||
|
|
||||||
|
// we might be in AP mode
|
||||||
|
if (ipInfo.ip.addr == INADDR_ANY) {
|
||||||
|
if_type = TCPIP_ADAPTER_IF_AP;
|
||||||
|
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ipInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get hostname if required
|
||||||
|
if (name) {
|
||||||
|
const char *hostname;
|
||||||
|
tcpip_adapter_get_hostname(if_type, &hostname);
|
||||||
|
*name = strdup(hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ipInfo.ip.addr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user