Add transport layer security to TCP sockets

This commit is contained in:
Lukas Dürrenberger committed 2026-10-04 22:12:01 +02:00
1 parent 917e811888
commit d95f00f212
5 files changed
+232

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#include <CSFML/Network/TcpSocket.h>
#include <SFML/Network/TcpSocket.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE("[Network] sfTcpSocket")
{
SECTION("sfTlsStatus")
{
STATIC_CHECK(sfTlsNotConnected == static_cast<int>(sf::TcpSocket::TlsStatus::NotConnected));
STATIC_CHECK(sfTlsHandshakeStarted == static_cast<int>(sf::TcpSocket::TlsStatus::HandshakeStarted));
STATIC_CHECK(sfTlsHandshakeComplete == static_cast<int>(sf::TcpSocket::TlsStatus::HandshakeComplete));
STATIC_CHECK(sfTlsError == static_cast<int>(sf::TcpSocket::TlsStatus::Error));
}
SECTION("TLS on unconnected socket")
{
sfTcpSocket* socket = sfTcpSocket_create();
CHECK(sfTcpSocket_setupTlsClient(socket, "localhost", true) == sfTlsNotConnected);
CHECK(sfTcpSocket_getCurrentCiphersuiteName(socket) == nullptr);
sfTcpSocket_destroy(socket);
}
}