chromium/google_apis/gcm/engine/connection_handler_impl.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#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 {

// # of bytes a MCS version packet consumes.
const int kVersionPacketLen =;
// # of bytes a tag packet consumes.
const int kTagPacketLen =;
// Max # of bytes a length packet consumes. A Varint32 can consume up to 5 bytes
// (the msb in each byte is reserved for denoting whether more bytes follow).
// Although the protocol only allows for 4KiB payloads currently, and the socket
// stream buffer is only of size 8KiB, it's possible for certain applications to
// have larger message sizes. When payload is larger than 4KiB, an temporary
// in-memory buffer is used instead of the normal in-place socket stream buffer.
const int kSizePacketLenMin =;
const int kSizePacketLenMax =;

// The normal limit for a data packet is 4KiB. Any data packet with a size
// larger than this uses the temporary in-memory buffer,
const int kDefaultDataPacketLimit =;

// The current MCS protocol version.
const int kMCSVersion =;

}  // namespace

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() {}

}  // namespace gcm