#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/protocol/stun_tcp_packet_processor.h"
#include "base/containers/span.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/numerics/byte_conversions.h"
#include "net/base/io_buffer.h"
#include "third_party/webrtc/media/base/rtp_utils.h"
#include "third_party/webrtc/rtc_base/time_utils.h"
namespace remoting::protocol {
namespace {
PacketLength;
constexpr size_t kPacketHeaderSize = …;
constexpr size_t kStunHeaderSize = …;
constexpr size_t kTurnChannelDataHeaderSize = …;
constexpr size_t kPacketLengthOffset = …;
int GetExpectedStunPacketSize(const uint8_t* data_ptr,
size_t len,
size_t* pad_bytes) { … }
}
StunTcpPacketProcessor::StunTcpPacketProcessor() = default;
StunTcpPacketProcessor::~StunTcpPacketProcessor() = default;
StunTcpPacketProcessor* StunTcpPacketProcessor::GetInstance() { … }
scoped_refptr<net::IOBufferWithSize> StunTcpPacketProcessor::Pack(
const uint8_t* data,
size_t data_size) const { … }
scoped_refptr<net::IOBufferWithSize> StunTcpPacketProcessor::Unpack(
const uint8_t* data,
size_t data_size,
size_t* bytes_consumed) const { … }
void StunTcpPacketProcessor::ApplyPacketOptions(
uint8_t* data,
size_t data_size,
const rtc::PacketTimeUpdateParams& packet_time_params) const { … }
}