mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-09-01 14:49:25 +00:00
Added disableTlsVerification flag to C API
This commit is contained in:
@ -37,6 +37,7 @@ extern "C" {
|
|||||||
#define RTC_ENABLE_WEBSOCKET 1
|
#define RTC_ENABLE_WEBSOCKET 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// libdatachannel C API
|
// libdatachannel C API
|
||||||
@ -120,7 +121,13 @@ RTC_EXPORT int rtcGetDataChannelLabel(int dc, char *buffer, int size);
|
|||||||
|
|
||||||
// WebSocket
|
// WebSocket
|
||||||
#if RTC_ENABLE_WEBSOCKET
|
#if RTC_ENABLE_WEBSOCKET
|
||||||
|
typedef struct {
|
||||||
|
bool disableTlsVerification;
|
||||||
|
} rtcWsConfiguration;
|
||||||
|
|
||||||
RTC_EXPORT int rtcCreateWebSocket(const char *url); // returns ws id
|
RTC_EXPORT int rtcCreateWebSocket(const char *url); // returns ws id
|
||||||
|
RTC_EXPORT int rtcCreateWebSocketEx(const char *url,
|
||||||
|
const rtcWsConfiguration *config); // returns ws id
|
||||||
RTC_EXPORT int rtcDeleteWebsocket(int ws);
|
RTC_EXPORT int rtcDeleteWebsocket(int ws);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
10
src/rtc.cpp
10
src/rtc.cpp
@ -273,6 +273,16 @@ int rtcCreateWebSocket(const char *url) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rtcCreateWebSocketEx(const char *url, const rtcWsConfiguration *config) {
|
||||||
|
return WRAP({
|
||||||
|
WebSocket::Configuration c;
|
||||||
|
c.disableTlsVerification = config->disableTlsVerification;
|
||||||
|
auto ws = std::make_shared<WebSocket>(c);
|
||||||
|
ws->open(url);
|
||||||
|
return emplaceWebSocket(ws);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
int rtcDeleteWebsocket(int ws) {
|
int rtcDeleteWebsocket(int ws) {
|
||||||
return WRAP({
|
return WRAP({
|
||||||
auto webSocket = getWebSocket(ws);
|
auto webSocket = getWebSocket(ws);
|
||||||
|
Reference in New Issue
Block a user