diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-07 09:19:46 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-07 09:19:46 +0200 |
commit | 61644f1dbe5389ed02a13f0940b05699db645919 (patch) | |
tree | 67a8522e138becd70a11ba4ebccf41991c4e780e /core | |
parent | 94361494fd45cfd1c51f80765e83566f589c5642 (diff) | |
parent | 528e791a5fa0032f335c6410d3e961851e29b325 (diff) |
Merge pull request #65447 from Faless/net/4.x_ssl_to_tls
[Net] Rename StreamPeerSSL to StreamPeerTLS.
Diffstat (limited to 'core')
-rw-r--r-- | core/io/http_client_tcp.cpp | 22 | ||||
-rw-r--r-- | core/io/stream_peer_tls.cpp (renamed from core/io/stream_peer_ssl.cpp) | 34 | ||||
-rw-r--r-- | core/io/stream_peer_tls.h (renamed from core/io/stream_peer_ssl.h) | 20 | ||||
-rw-r--r-- | core/register_core_types.cpp | 4 |
4 files changed, 40 insertions, 40 deletions
diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index 4aa1f2ed8c..7afab9ea09 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -32,7 +32,7 @@ #include "http_client_tcp.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/version.h" HTTPClient *HTTPClientTCP::_create_func() { @@ -108,8 +108,8 @@ void HTTPClientTCP::set_connection(const Ref<StreamPeer> &p_connection) { ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object."); if (ssl) { - ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerSSL>(p_connection.ptr()), - "Connection is not a reference to a valid StreamPeerSSL object."); + ERR_FAIL_NULL_MSG(Object::cast_to<StreamPeerTLS>(p_connection.ptr()), + "Connection is not a reference to a valid StreamPeerTLS object."); } if (connection == p_connection) { @@ -358,10 +358,10 @@ Error HTTPClientTCP::poll() { } break; } } else if (ssl) { - Ref<StreamPeerSSL> ssl; + Ref<StreamPeerTLS> ssl; if (!handshaking) { - // Connect the StreamPeerSSL and start handshaking. - ssl = Ref<StreamPeerSSL>(StreamPeerSSL::create()); + // Connect the StreamPeerTLS and start handshaking. + ssl = Ref<StreamPeerTLS>(StreamPeerTLS::create()); ssl->set_blocking_handshake_enabled(false); Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host); if (err != OK) { @@ -373,7 +373,7 @@ Error HTTPClientTCP::poll() { handshaking = true; } else { // We are already handshaking, which means we can use your already active SSL connection. - ssl = static_cast<Ref<StreamPeerSSL>>(connection); + ssl = static_cast<Ref<StreamPeerTLS>>(connection); if (ssl.is_null()) { close(); status = STATUS_SSL_HANDSHAKE_ERROR; @@ -383,13 +383,13 @@ Error HTTPClientTCP::poll() { ssl->poll(); // Try to finish the handshake. } - if (ssl->get_status() == StreamPeerSSL::STATUS_CONNECTED) { + if (ssl->get_status() == StreamPeerTLS::STATUS_CONNECTED) { // Handshake has been successful. handshaking = false; ip_candidates.clear(); status = STATUS_CONNECTED; return OK; - } else if (ssl->get_status() != StreamPeerSSL::STATUS_HANDSHAKING) { + } else if (ssl->get_status() != StreamPeerTLS::STATUS_HANDSHAKING) { // Handshake has failed. close(); status = STATUS_SSL_HANDSHAKE_ERROR; @@ -422,9 +422,9 @@ Error HTTPClientTCP::poll() { case STATUS_CONNECTED: { // Check if we are still connected. if (ssl) { - Ref<StreamPeerSSL> tmp = connection; + Ref<StreamPeerTLS> tmp = connection; tmp->poll(); - if (tmp->get_status() != StreamPeerSSL::STATUS_CONNECTED) { + if (tmp->get_status() != StreamPeerTLS::STATUS_CONNECTED) { status = STATUS_CONNECTION_ERROR; return ERR_CONNECTION_ERROR; } diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_tls.cpp index 5b90fb52a6..b1adde018a 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_tls.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* stream_peer_ssl.cpp */ +/* stream_peer_tls.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,42 +28,42 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "stream_peer_ssl.h" +#include "stream_peer_tls.h" #include "core/config/engine.h" -StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr; +StreamPeerTLS *(*StreamPeerTLS::_create)() = nullptr; -StreamPeerSSL *StreamPeerSSL::create() { +StreamPeerTLS *StreamPeerTLS::create() { if (_create) { return _create(); } return nullptr; } -bool StreamPeerSSL::available = false; +bool StreamPeerTLS::available = false; -bool StreamPeerSSL::is_available() { +bool StreamPeerTLS::is_available() { return available; } -void StreamPeerSSL::set_blocking_handshake_enabled(bool p_enabled) { +void StreamPeerTLS::set_blocking_handshake_enabled(bool p_enabled) { blocking_handshake = p_enabled; } -bool StreamPeerSSL::is_blocking_handshake_enabled() const { +bool StreamPeerTLS::is_blocking_handshake_enabled() const { return blocking_handshake; } -void StreamPeerSSL::_bind_methods() { - ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll); - ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerSSL::accept_stream, DEFVAL(Ref<X509Certificate>())); - ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>())); - ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status); - ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerSSL::get_stream); - ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream); - ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerSSL::set_blocking_handshake_enabled); - ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerSSL::is_blocking_handshake_enabled); +void StreamPeerTLS::_bind_methods() { + ClassDB::bind_method(D_METHOD("poll"), &StreamPeerTLS::poll); + ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerTLS::accept_stream, DEFVAL(Ref<X509Certificate>())); + ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerTLS::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>())); + ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerTLS::get_status); + ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerTLS::get_stream); + ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerTLS::disconnect_from_stream); + ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerTLS::set_blocking_handshake_enabled); + ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerTLS::is_blocking_handshake_enabled); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blocking_handshake"), "set_blocking_handshake_enabled", "is_blocking_handshake_enabled"); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_tls.h index fe68667adc..ed7334fab3 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_tls.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* stream_peer_ssl.h */ +/* stream_peer_tls.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,17 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef STREAM_PEER_SSL_H -#define STREAM_PEER_SSL_H +#ifndef STREAM_PEER_TLS_H +#define STREAM_PEER_TLS_H #include "core/crypto/crypto.h" #include "core/io/stream_peer.h" -class StreamPeerSSL : public StreamPeer { - GDCLASS(StreamPeerSSL, StreamPeer); +class StreamPeerTLS : public StreamPeer { + GDCLASS(StreamPeerTLS, StreamPeer); protected: - static StreamPeerSSL *(*_create)(); + static StreamPeerTLS *(*_create)(); static void _bind_methods(); static bool available; @@ -65,13 +65,13 @@ public: virtual void disconnect_from_stream() = 0; - static StreamPeerSSL *create(); + static StreamPeerTLS *create(); static bool is_available(); - StreamPeerSSL() {} + StreamPeerTLS() {} }; -VARIANT_ENUM_CAST(StreamPeerSSL::Status); +VARIANT_ENUM_CAST(StreamPeerTLS::Status); -#endif // STREAM_PEER_SSL_H +#endif // STREAM_PEER_TLS_H diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 7f734201e7..1b3f11ffab 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -58,7 +58,7 @@ #include "core/io/resource_format_binary.h" #include "core/io/resource_importer.h" #include "core/io/resource_uid.h" -#include "core/io/stream_peer_ssl.h" +#include "core/io/stream_peer_tls.h" #include "core/io/tcp_server.h" #include "core/io/translation_loader_po.h" #include "core/io/udp_server.h" @@ -202,7 +202,7 @@ void register_core_types() { ClassDB::register_custom_instance_class<CryptoKey>(); ClassDB::register_custom_instance_class<HMACContext>(); ClassDB::register_custom_instance_class<Crypto>(); - ClassDB::register_custom_instance_class<StreamPeerSSL>(); + ClassDB::register_custom_instance_class<StreamPeerTLS>(); ClassDB::register_custom_instance_class<PacketPeerDTLS>(); ClassDB::register_custom_instance_class<DTLSServer>(); |