mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 14:07:11 +03:00
update cspot
This commit is contained in:
18
components/spotify/cspot/bell/include/platform/MDNSService.h
Normal file
18
components/spotify/cspot/bell/include/platform/MDNSService.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef BELLL_MDNS_SERVICE_H
|
||||
#define BELLL_MDNS_SERVICE_H
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class MDNSService {
|
||||
public:
|
||||
static void registerService(
|
||||
const std::string &serviceName,
|
||||
const std::string &serviceType,
|
||||
const std::string &serviceProto,
|
||||
const std::string &serviceHost,
|
||||
int servicePort,
|
||||
const std::map<std::string, std::string> txtData
|
||||
);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef BELL_TLS_SOCKET_H
|
||||
#define BELL_TLS_SOCKET_H
|
||||
|
||||
#include "BellLogger.h"
|
||||
#include "BellSocket.h"
|
||||
#include <cstring>
|
||||
#include <ctype.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#ifdef BELL_USE_MBEDTLS
|
||||
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "mbedtls/entropy.h"
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/debug.h"
|
||||
#else
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
namespace bell {
|
||||
class TLSSocket : public bell::Socket {
|
||||
private:
|
||||
#ifdef BELL_USE_MBEDTLS
|
||||
mbedtls_net_context server_fd;
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
mbedtls_ssl_context ssl;
|
||||
mbedtls_ssl_config conf;
|
||||
#else
|
||||
|
||||
BIO *sbio, *out;
|
||||
int len;
|
||||
char tmpbuf[1024];
|
||||
SSL_CTX *ctx;
|
||||
SSL *ssl;
|
||||
|
||||
int sockFd;
|
||||
int sslFd;
|
||||
#endif
|
||||
|
||||
bool isClosed = false;
|
||||
public:
|
||||
TLSSocket();
|
||||
~TLSSocket() { close(); };
|
||||
|
||||
void open(std::string host, uint16_t port);
|
||||
|
||||
size_t read(uint8_t *buf, size_t len);
|
||||
size_t write(uint8_t *buf, size_t len);
|
||||
size_t poll();
|
||||
|
||||
void close();
|
||||
};
|
||||
|
||||
} // namespace bell
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "freertos/semphr.h"
|
||||
#elif __APPLE__
|
||||
#include <dispatch/dispatch.h>
|
||||
#elif _WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#include <semaphore.h>
|
||||
@@ -18,6 +20,8 @@ private:
|
||||
xSemaphoreHandle semaphoreHandle;
|
||||
#elif __APPLE__
|
||||
dispatch_semaphore_t semaphoreHandle;
|
||||
#elif _WIN32
|
||||
HANDLE semaphoreHandle;
|
||||
#else
|
||||
sem_t semaphoreHandle;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
#define ssize_t SSIZE_T
|
||||
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define bzero(p,n) memset(p,0,n)
|
||||
#define usleep(x) Sleep((x)/1000)
|
||||
|
||||
inline void close(int sock) { closesocket(sock); }
|
||||
inline size_t read(int sock, char* buf, size_t n) { return recv(sock, buf, n, 0); }
|
||||
inline int write(int sock, const char* buf, size_t n) { return send(sock, buf, n, 0); }
|
||||
Reference in New Issue
Block a user