#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/host/security_key/security_key_socket.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/timer/timer.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/socket/stream_socket.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace remoting {
namespace {
const size_t kRequestSizeBytes = …;
const size_t kMaxRequestLength = …;
const size_t kRequestReadBufferLength = …;
const char kSshError[] = …;
}
SecurityKeySocket::SecurityKeySocket(std::unique_ptr<net::StreamSocket> socket,
base::TimeDelta timeout,
base::OnceClosure timeout_callback)
: … { … }
SecurityKeySocket::~SecurityKeySocket() { … }
bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) { … }
void SecurityKeySocket::SendResponse(const std::string& response_data) { … }
void SecurityKeySocket::SendSshError() { … }
void SecurityKeySocket::StartReadingRequest(
base::OnceClosure request_received_callback) { … }
void SecurityKeySocket::OnDataWritten(int result) { … }
void SecurityKeySocket::DoWrite() { … }
void SecurityKeySocket::OnDataRead(int result) { … }
void SecurityKeySocket::DoRead() { … }
bool SecurityKeySocket::IsRequestComplete() const { … }
bool SecurityKeySocket::IsRequestTooLarge() const { … }
size_t SecurityKeySocket::GetRequestLength() const { … }
std::string SecurityKeySocket::GetResponseLengthAsBytes(
const std::string& response) const { … }
void SecurityKeySocket::ResetTimer() { … }
}