diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2023-07-16 16:56:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-16 16:56:47 -0400 |
| commit | 2461c78e3f9368e4a03b4c27fae207cbb1d9cfff (patch) | |
| tree | 50812311958a38d27d9ebcd1cfa443b77ff1c40c /src/core/hle/service/ssl/ssl_backend.h | |
| parent | 04868ab9da2049429808a265dc50696f6300b2b4 (diff) | |
| parent | 644c3ce609c7a327866ae0107bd7772e34e8ecb9 (diff) | |
Merge pull request #10912 from comex/ssl
Implement SSL service
Diffstat (limited to 'src/core/hle/service/ssl/ssl_backend.h')
| -rw-r--r-- | src/core/hle/service/ssl/ssl_backend.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/core/hle/service/ssl/ssl_backend.h b/src/core/hle/service/ssl/ssl_backend.h new file mode 100644 index 000000000..25c16bcc1 --- /dev/null +++ b/src/core/hle/service/ssl/ssl_backend.h @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/result.h" + +#include "common/common_types.h" + +#include <memory> +#include <span> +#include <string> +#include <vector> + +namespace Network { +class SocketBase; +} + +namespace Service::SSL { + +constexpr Result ResultNoSocket{ErrorModule::SSLSrv, 103}; +constexpr Result ResultInvalidSocket{ErrorModule::SSLSrv, 106}; +constexpr Result ResultTimeout{ErrorModule::SSLSrv, 205}; +constexpr Result ResultInternalError{ErrorModule::SSLSrv, 999}; // made up + +// ResultWouldBlock is returned from Read and Write, and oddly, DoHandshake, +// with no way in the latter case to distinguish whether the client should poll +// for read or write. The one official client I've seen handles this by always +// polling for read (with a timeout). +constexpr Result ResultWouldBlock{ErrorModule::SSLSrv, 204}; + +class SSLConnectionBackend { +public: + virtual ~SSLConnectionBackend() {} + virtual void SetSocket(std::shared_ptr<Network::SocketBase> socket) = 0; + virtual Result SetHostName(const std::string& hostname) = 0; + virtual Result DoHandshake() = 0; + virtual ResultVal<size_t> Read(std::span<u8> data) = 0; + virtual ResultVal<size_t> Write(std::span<const u8> data) = 0; + virtual ResultVal<std::vector<std::vector<u8>>> GetServerCerts() = 0; +}; + +ResultVal<std::unique_ptr<SSLConnectionBackend>> CreateSSLConnectionBackend(); + +} // namespace Service::SSL |
