This commit is contained in:
Links2004
2024-09-06 20:20:30 +02:00
parent af17970256
commit bd011d8fd8
5 changed files with 37 additions and 38 deletions

View File

@ -56,10 +56,10 @@ class SocketIOclient : protected WebSocketsClient {
#ifndef SSL_AXTLS #ifndef SSL_AXTLS
void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", const char * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5); void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", const char * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5);
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL); void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
#if defined(SSL_BARESSL) #if defined(SSL_BARESSL)
void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5); void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5);
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL); void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
#endif #endif
#endif #endif
#endif #endif
bool isConnected(void); bool isConnected(void);

View File

@ -262,9 +262,9 @@
#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) #elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
#if __has_include(<WiFiNINA.h>) #if __has_include(<WiFiNINA.h>)
#include <WiFiNINA.h> #include <WiFiNINA.h>
#else #else
#error "Please install WiFiNINA library!" #error "Please install WiFiNINA library!"
#endif #endif
#define WEBSOCKETS_NETWORK_CLASS WiFiClient #define WEBSOCKETS_NETWORK_CLASS WiFiClient
@ -273,10 +273,10 @@
#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) #elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
#if __has_include(<rpcWiFi.h>) && __has_include(<rpcWiFiClientSecure.h>) #if __has_include(<rpcWiFi.h>) && __has_include(<rpcWiFiClientSecure.h>)
#include <rpcWiFi.h> #include <rpcWiFi.h>
#include <rpcWiFiClientSecure.h> #include <rpcWiFiClientSecure.h>
#else #else
#error "Please install rpcWiFi library!" #error "Please install rpcWiFi library!"
#endif #endif
#define WEBSOCKETS_NETWORK_CLASS WiFiClient #define WEBSOCKETS_NETWORK_CLASS WiFiClient

View File

@ -177,7 +177,6 @@ void WebSocketsClient::setSSLClientCertKey(BearSSL::X509List * clientCert, BearS
} }
#endif // SSL_BARESSL #endif // SSL_BARESSL
#endif // SSL_AXTLS #endif // SSL_AXTLS
#endif // HAS_SSL #endif // HAS_SSL
@ -245,12 +244,12 @@ void WebSocketsClient::loop(void) {
if(_client.isSSL) { if(_client.isSSL) {
DEBUG_WEBSOCKETS("[WS-Client] connect wss...\n"); DEBUG_WEBSOCKETS("[WS-Client] connect wss...\n");
if(_client.ssl) { if(_client.ssl) {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
// does not support delete (no destructor) // does not support delete (no destructor)
#else #else
delete _client.ssl; delete _client.ssl;
#endif #endif
_client.ssl = NULL; _client.ssl = NULL;
_client.tcp = NULL; _client.tcp = NULL;
} }
@ -295,11 +294,11 @@ void WebSocketsClient::loop(void) {
} else { } else {
DEBUG_WEBSOCKETS("[WS-Client] connect ws...\n"); DEBUG_WEBSOCKETS("[WS-Client] connect ws...\n");
if(_client.tcp) { if(_client.tcp) {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
// does not support delete (no destructor) // does not support delete (no destructor)
#else #else
delete _client.tcp; delete _client.tcp;
#endif #endif
_client.tcp = NULL; _client.tcp = NULL;
} }
_client.tcp = new WEBSOCKETS_NETWORK_CLASS(); _client.tcp = new WEBSOCKETS_NETWORK_CLASS();
@ -550,11 +549,11 @@ void WebSocketsClient::clientDisconnect(WSclient_t * client) {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
client->status = WSC_NOT_CONNECTED; client->status = WSC_NOT_CONNECTED;
#else #else
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
// does not support delete (no destructor) // does not support delete (no destructor)
#else #else
delete client->tcp; delete client->tcp;
#endif #endif
#endif #endif
client->tcp = NULL; client->tcp = NULL;
} }

View File

@ -48,10 +48,10 @@ class WebSocketsClient : protected WebSockets {
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino"); void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
#else #else
void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino"); void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino");
#if defined(SSL_BARESSL) #if defined(SSL_BARESSL)
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino"); void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL); void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
#endif #endif
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL); void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
#endif #endif
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino"); void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino");
@ -131,11 +131,11 @@ class WebSocketsClient : protected WebSockets {
#define SSL_FINGERPRINT_NULL "" #define SSL_FINGERPRINT_NULL ""
#else #else
const uint8_t * _fingerprint; const uint8_t * _fingerprint;
#if defined(SSL_BARESSL) #if defined(SSL_BARESSL)
BearSSL::X509List * _CA_cert; BearSSL::X509List * _CA_cert;
BearSSL::X509List * _client_cert; BearSSL::X509List * _client_cert;
BearSSL::PrivateKey * _client_key; BearSSL::PrivateKey * _client_key;
#endif #endif
#define SSL_FINGERPRINT_IS_SET (_fingerprint != NULL) #define SSL_FINGERPRINT_IS_SET (_fingerprint != NULL)
#define SSL_FINGERPRINT_NULL NULL #define SSL_FINGERPRINT_NULL NULL
#endif #endif

View File

@ -65,11 +65,11 @@ WebSocketsServerCore::~WebSocketsServerCore() {
} }
WebSocketsServer::~WebSocketsServer() { WebSocketsServer::~WebSocketsServer() {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
// does not support delete (no destructor) // does not support delete (no destructor)
#else #else
delete _server; delete _server;
#endif #endif
} }
/** /**
@ -660,12 +660,12 @@ void WebSocketsServer::handleNewClients(void) {
while(_server->hasClient()) { while(_server->hasClient()) {
#endif #endif
// store new connection // store new connection
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available()); WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
#else #else
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept()); WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
#endif #endif
if(!tcpClient) { if(!tcpClient) {
DEBUG_WEBSOCKETS("[WS-Client] creating Network class failed!"); DEBUG_WEBSOCKETS("[WS-Client] creating Network class failed!");