mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 04:27:12 +03:00
make AirPlay work in AP mode
This commit is contained in:
@@ -436,6 +436,12 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
|
||||
if (strcmp(method, "OPTIONS")) {
|
||||
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
|
||||
if (S_ADDR(ctx->host) == INADDR_ANY) {
|
||||
|
||||
@@ -163,7 +163,7 @@ void raop_sink_init(raop_cmd_vcb_t cmd_cb, raop_data_cb_t data_cb) {
|
||||
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
|
||||
uint8_t mac[6];
|
||||
|
||||
@@ -23,12 +23,7 @@
|
||||
#ifdef WIN32
|
||||
#include <iphlpapi.h>
|
||||
#else
|
||||
/*
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <netdb.h>
|
||||
*/
|
||||
#include "tcpip_adapter.h"
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
@@ -84,8 +79,26 @@ in_addr_t get_localhost(char **name)
|
||||
}
|
||||
else return INADDR_ANY;
|
||||
#else
|
||||
// missing platform here ...
|
||||
return INADDR_ANY;
|
||||
tcpip_adapter_ip_info_t ipInfo;
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user