#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "google_apis/gcm/engine/connection_handler_impl.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/task/sequenced_task_runner.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
#include "google_apis/gcm/base/mcs_util.h"
#include "google_apis/gcm/base/socket_stream.h"
#include "google_apis/gcm/protocol/mcs.pb.h"
#include "net/base/net_errors.h"
#include "net/socket/stream_socket.h"
io;
namespace gcm {
namespace {
const int kVersionPacketLen = …;
const int kTagPacketLen = …;
const int kSizePacketLenMin = …;
const int kSizePacketLenMax = …;
const int kDefaultDataPacketLimit = …;
const int kMCSVersion = …;
}
ConnectionHandlerImpl::ConnectionHandlerImpl(
scoped_refptr<base::SequencedTaskRunner> io_task_runner,
base::TimeDelta read_timeout,
const ProtoReceivedCallback& read_callback,
const ProtoSentCallback& write_callback,
const ConnectionChangedCallback& connection_callback)
: … { … }
ConnectionHandlerImpl::~ConnectionHandlerImpl() { … }
void ConnectionHandlerImpl::Init(
const mcs_proto::LoginRequest& login_request,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream) { … }
void ConnectionHandlerImpl::Reset() { … }
bool ConnectionHandlerImpl::CanSendMessage() const { … }
void ConnectionHandlerImpl::SendMessage(
const google::protobuf::MessageLite& message) { … }
void ConnectionHandlerImpl::Login(
const google::protobuf::MessageLite& login_request) { … }
void ConnectionHandlerImpl::OnMessageSent() { … }
void ConnectionHandlerImpl::GetNextMessage() { … }
void ConnectionHandlerImpl::WaitForData(ProcessingState state) { … }
void ConnectionHandlerImpl::OnGotVersion() { … }
void ConnectionHandlerImpl::OnGotMessageTag() { … }
void ConnectionHandlerImpl::OnGotMessageSize() { … }
void ConnectionHandlerImpl::OnGotMessageBytes() { … }
void ConnectionHandlerImpl::OnTimeout() { … }
void ConnectionHandlerImpl::CloseConnection() { … }
}