mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-14 11:56:32 +03:00
add TLS support for all boards
This commit is contained in:
72
lib_standalone/ESP_SSLClient.h
Normal file
72
lib_standalone/ESP_SSLClient.h
Normal file
@@ -0,0 +1,72 @@
|
||||
// standalone stub for ESP_SSLClient (BearSSL) - no-op TLS on host build
|
||||
// Inherits from Stream so it gets print/println via Print, matching the real API.
|
||||
|
||||
#ifndef ESP_SSLClient_h
|
||||
#define ESP_SSLClient_h
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Stream.h"
|
||||
#include "WiFiClient.h"
|
||||
#include <ClientPosixIPAddress.h>
|
||||
|
||||
class ESP_SSLClient : public Stream {
|
||||
public:
|
||||
ESP_SSLClient() = default;
|
||||
|
||||
void setInsecure() {
|
||||
}
|
||||
void setCACert(const char *) {
|
||||
}
|
||||
void setCertificate(const char *) {
|
||||
}
|
||||
void setPrivateKey(const char *) {
|
||||
}
|
||||
void setBufferSizes(int, int) {
|
||||
}
|
||||
void setSessionTimeout(int) {
|
||||
}
|
||||
void setClient(WiFiClient *) {
|
||||
}
|
||||
void setClient(WiFiClient *, bool) {
|
||||
}
|
||||
|
||||
int connect(IPAddress, uint16_t) {
|
||||
return 0;
|
||||
}
|
||||
int connect(const char *, uint16_t) {
|
||||
return 0;
|
||||
}
|
||||
bool connected() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Stream / Print overrides
|
||||
int available() override {
|
||||
return 0;
|
||||
}
|
||||
int read() override {
|
||||
return -1;
|
||||
}
|
||||
int read(uint8_t *, size_t) {
|
||||
return 0;
|
||||
}
|
||||
int peek() override {
|
||||
return -1;
|
||||
}
|
||||
size_t write(uint8_t) override {
|
||||
return 0;
|
||||
}
|
||||
size_t write(const uint8_t *, size_t) override {
|
||||
return 0;
|
||||
}
|
||||
void flush() override {
|
||||
}
|
||||
|
||||
void stop() {
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ESP_SSLClient_h
|
||||
49
lib_standalone/WiFiClient.h
Normal file
49
lib_standalone/WiFiClient.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// standalone stub for WiFiClient (no-op networking on host build)
|
||||
|
||||
#ifndef WiFiClient_h
|
||||
#define WiFiClient_h
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ClientPosixIPAddress.h>
|
||||
|
||||
class WiFiClient {
|
||||
public:
|
||||
WiFiClient() = default;
|
||||
|
||||
int connect(IPAddress, uint16_t) {
|
||||
return 0;
|
||||
}
|
||||
int connect(const char *, uint16_t) {
|
||||
return 0;
|
||||
}
|
||||
bool connected() {
|
||||
return false;
|
||||
}
|
||||
int available() {
|
||||
return 0;
|
||||
}
|
||||
int read() {
|
||||
return -1;
|
||||
}
|
||||
int read(uint8_t *, size_t) {
|
||||
return 0;
|
||||
}
|
||||
size_t write(uint8_t) {
|
||||
return 0;
|
||||
}
|
||||
size_t write(const uint8_t *, size_t) {
|
||||
return 0;
|
||||
}
|
||||
void stop() {
|
||||
}
|
||||
|
||||
// ESP32 socket option passthrough (e.g. TCP_NODELAY)
|
||||
int setSocketOption(int, int, const void *, size_t) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // WiFiClient_h
|
||||
10
lib_standalone/lwip/sockets.h
Normal file
10
lib_standalone/lwip/sockets.h
Normal file
@@ -0,0 +1,10 @@
|
||||
// standalone stub for <lwip/sockets.h>
|
||||
// pulls in POSIX equivalents on the host build for things like IPPROTO_TCP / TCP_NODELAY.
|
||||
|
||||
#ifndef LWIP_SOCKETS_STUB_H_
|
||||
#define LWIP_SOCKETS_STUB_H_
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#endif // LWIP_SOCKETS_STUB_H_
|
||||
Reference in New Issue
Block a user