1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-01 01:44:22 +03:00

Make a MutableByteRange typealias

Summary: See title

Differential Revision: D73621432

fbshipit-source-id: fd144f097ca80ffe04aab06c2412eed438de3f5b
This commit is contained in:
Aman Sharma
2025-04-25 10:38:49 -07:00
committed by Facebook GitHub Bot
parent 7d4f053bf7
commit 7b7c3eb88f
6 changed files with 33 additions and 33 deletions

View File

@ -37,6 +37,7 @@ using SystemClock = folly::chrono::SystemClock;
namespace quic {
using ByteRange = folly::ByteRange;
using MutableByteRange = folly::MutableByteRange;
using BufHelpers = folly::IOBuf; // For stuff like BufHelpers::create, etc.
using Buf = folly::IOBuf; // Used when we're not wrapping the buffer in an
// std::unique_ptr

View File

@ -1528,8 +1528,8 @@ void encryptPacketHeader(
encryptedBody += sampleBytesToUse;
memcpy(sample.data(), encryptedBody, sample.size());
folly::MutableByteRange initialByteRange(header, 1);
folly::MutableByteRange packetNumByteRange(
MutableByteRange initialByteRange(header, 1);
MutableByteRange packetNumByteRange(
header + headerLen - packetNumberLength, packetNumberLength);
if (headerForm == HeaderForm::Short) {
headerCipher.encryptShortHeader(

View File

@ -15,8 +15,8 @@ namespace quic {
void PacketNumberCipher::decipherHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes,
MutableByteRange initialByte,
MutableByteRange packetNumberBytes,
uint8_t initialByteMask,
uint8_t /* packetNumLengthMask */) const {
CHECK_EQ(packetNumberBytes.size(), kMaxPacketNumEncodingSize);
@ -32,8 +32,8 @@ void PacketNumberCipher::decipherHeader(
void PacketNumberCipher::cipherHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes,
MutableByteRange initialByte,
MutableByteRange packetNumberBytes,
uint8_t initialByteMask,
uint8_t /* packetNumLengthMask */) const {
HeaderProtectionMask headerMask = mask(sample);
@ -48,8 +48,8 @@ void PacketNumberCipher::cipherHeader(
void PacketNumberCipher::decryptLongHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const {
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const {
decipherHeader(
sample,
initialByte,
@ -60,8 +60,8 @@ void PacketNumberCipher::decryptLongHeader(
void PacketNumberCipher::decryptShortHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const {
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const {
decipherHeader(
sample,
initialByte,
@ -72,8 +72,8 @@ void PacketNumberCipher::decryptShortHeader(
void PacketNumberCipher::encryptLongHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const {
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const {
cipherHeader(
sample,
initialByte,
@ -84,8 +84,8 @@ void PacketNumberCipher::encryptLongHeader(
void PacketNumberCipher::encryptShortHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const {
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const {
cipherHeader(
sample,
initialByte,

View File

@ -32,8 +32,8 @@ class PacketNumberCipher {
*/
virtual void decryptLongHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const;
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const;
/**
* Decrypts a short header from a sample.
@ -43,8 +43,8 @@ class PacketNumberCipher {
*/
virtual void decryptShortHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const;
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const;
/**
* Encrypts a long header from a sample.
@ -53,8 +53,8 @@ class PacketNumberCipher {
*/
virtual void encryptLongHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const;
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const;
/**
* Encrypts a short header from a sample.
@ -63,8 +63,8 @@ class PacketNumberCipher {
*/
virtual void encryptShortHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes) const;
MutableByteRange initialByte,
MutableByteRange packetNumberBytes) const;
/**
* Returns the length of key needed for the pn cipher.
@ -79,15 +79,15 @@ class PacketNumberCipher {
protected:
virtual void cipherHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes,
MutableByteRange initialByte,
MutableByteRange packetNumberBytes,
uint8_t initialByteMask,
uint8_t packetNumLengthMask) const;
virtual void decipherHeader(
ByteRange sample,
folly::MutableByteRange initialByte,
folly::MutableByteRange packetNumberBytes,
MutableByteRange initialByte,
MutableByteRange packetNumberBytes,
uint8_t initialByteMask,
uint8_t packetNumLengthMask) const;
};

View File

@ -216,9 +216,8 @@ CodecResult QuicReadCodec::parseLongHeaderPacket(
if (largestRecvdPacketNum) {
expectedNextPacketNum = 1 + *largestRecvdPacketNum;
}
folly::MutableByteRange initialByteRange(
currentPacketData->writableData(), 1);
folly::MutableByteRange packetNumberByteRange(
MutableByteRange initialByteRange(currentPacketData->writableData(), 1);
MutableByteRange packetNumberByteRange(
currentPacketData->writableData() + packetNumberOffset,
kMaxPacketNumEncodingSize);
headerCipher->decryptLongHeader(
@ -287,8 +286,8 @@ CodecResult QuicReadCodec::tryParseShortHeaderPacket(
return CodecResult(Nothing());
}
folly::MutableByteRange initialByteRange(data->writableData(), 1);
folly::MutableByteRange packetNumberByteRange(
MutableByteRange initialByteRange(data->writableData(), 1);
MutableByteRange packetNumberByteRange(
data->writableData() + packetNumberOffset, kMaxPacketNumEncodingSize);
ByteRange sampleByteRange(data->writableData() + sampleOffset, sample.size());

View File

@ -88,7 +88,7 @@ void FileQLogger::writeToStream(folly::StringPiece message) {
while (!inputConsumed) {
compressionBuffer_->clear();
ByteRange inputRange(message);
auto outputRange = folly::MutableByteRange(
auto outputRange = MutableByteRange(
compressionBuffer_->writableData(), compressionBuffer_->capacity());
compressionCodec_->compressStream(inputRange, outputRange);
// Output range has advanced to last compressed byte written
@ -149,7 +149,7 @@ void FileQLogger::finishStream() {
while (!ended) {
compressionBuffer_->clear();
ByteRange inputRange(folly::StringPiece(""));
auto outputRange = folly::MutableByteRange(
auto outputRange = MutableByteRange(
compressionBuffer_->writableData(), compressionBuffer_->capacity());
ended = compressionCodec_->compressStream(
inputRange,