#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/media_router/common/providers/cast/channel/cast_framer.h"
#include <stdlib.h>
#include <limits>
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/memory/free_deleter.h"
#include "base/notreached.h"
#include "base/numerics/byte_conversions.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
namespace cast_channel {
MessageFramer::MessageFramer(scoped_refptr<net::GrowableIOBuffer> input_buffer)
: … { … }
MessageFramer::~MessageFramer() = default;
MessageFramer::MessageHeader::MessageHeader() = default;
void MessageFramer::MessageHeader::SetMessageSize(size_t size) { … }
void MessageFramer::MessageHeader::PrependToString(std::string* str) { … }
void MessageFramer::MessageHeader::Deserialize(base::span<const uint8_t> data,
MessageHeader* header) { … }
size_t MessageFramer::MessageHeader::max_body_size() { … }
size_t MessageFramer::MessageHeader::max_message_size() { … }
std::string MessageFramer::MessageHeader::ToString() { … }
bool MessageFramer::Serialize(const CastMessage& message_proto,
std::string* message_data) { … }
size_t MessageFramer::BytesRequested() { … }
std::unique_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes,
size_t* message_length,
ChannelError* error) { … }
void MessageFramer::Reset() { … }
}